Class
Node<TNodeData, TLinkData>

Default implementation of the Node<TNodeData, TLinkData> interface.

Definition

Namespace:Telerik.Windows.Diagrams.Core

Assembly:Telerik.Windows.Diagrams.Core.dll

Type Parameters:

TNodeData

The type of the payload.

TLinkData

The type of the link data.

Syntax:

cs-api-definition
public class Node<TNodeData, TLinkData> : INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>> where TNodeData : new() where TLinkData : new()

Inheritance: objectNode<TNodeData, TLinkData>

Derived Classes: TreeNode<TNode, TLink>

Implements: INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>

Constructors

Node()

Initializes a new instance of the Node<TNodeData, TLinkData> class.

Declaration

cs-api-definition
public Node()

Node(IShape)

Initializes a new instance of the Node<TNodeData, TLinkData> class.

Declaration

cs-api-definition
public Node(IShape shape)

Parameters

shape

IShape

The shape this node is based on.

Node(IShape, bool)

Initializes a new instance of the Node<TNodeData, TLinkData> class.

Declaration

cs-api-definition
public Node(IShape shape, bool isDirected)

Parameters

shape

IShape

The shape.

isDirected

bool

If set to true [is directed].

Node(int, bool)

Initializes a new instance of the Node<TNodeData, TLinkData> class.

Declaration

cs-api-definition
public Node(int id, bool isDirected)

Parameters

id

int

The identifier.

isDirected

bool

If set to true the links are considered as directed and AllLinks is the same as the Outgoing or Incoming collections.

Properties

Gets all the links of this node.

Declaration

cs-api-definition
public IList<Edge<TNodeData, TLinkData>> AllLinks { get; }

Property Value

IList<Edge<TNodeData, TLinkData>>

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.AllLinks

AssociatedShape

Get the shape associated with this layout shape.

Declaration

cs-api-definition
public IShape AssociatedShape { get; protected set; }

Property Value

IShape

BoundingRectangle

Gets or sets the bounding rectangle of the shape.

Declaration

cs-api-definition
public Rect BoundingRectangle { get; set; }

Property Value

Rect

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.BoundingRectangle

Center

Gets or sets the geometric center of this ControlShape.

Declaration

cs-api-definition
public Point Center { get; set; }

Property Value

Point

Children

Gets the children nodes attached to this node.

Declaration

cs-api-definition
public IEnumerable<Node<TNodeData, TLinkData>> Children { get; }

Property Value

IEnumerable<Node<TNodeData, TLinkData>>

The children collection.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.Children

Remarks

  • A child is defined as the opposite node from an edge starting at this node.
  • If the graph is not directed this will return the same collection as the Children and the Neighbors property, i.e. all the nodes attached to the this node.

Data

Gets or sets the data or payload carried by this node.

Declaration

cs-api-definition
public TNodeData Data { get; set; }

Property Value

TNodeData

The data.

Degree

Returns the total number of links attached.

Declaration

cs-api-definition
public int Degree { get; }

Property Value

int

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.Degree

Id

Gets or sets Id.

Declaration

cs-api-definition
public int Id { get; set; }

Property Value

int

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.Id

Incoming

Get the node's incoming links.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public IList<Edge<TNodeData, TLinkData>> Incoming { get; protected set; }

Property Value

IList<Edge<TNodeData, TLinkData>>

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.Incoming

Remarks

  • If the node is directed (i.e. IsDirected = true) then this collection is the same as the AllLinks collection.
  • Do not add links to this collection but use the AddLink(TNode, TNode) method in order to update the related properties (AllLinks, Outgoing...).

IsDirected

Gets whether this node's links are directed.

Declaration

cs-api-definition
public bool IsDirected { get; set; }

Property Value

bool

true if this instance is directed; otherwise, false.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.IsDirected

IsRoot

Gets or sets whether this node is a tree-root.

Declaration

cs-api-definition
public bool IsRoot { get; set; }

Property Value

bool

true if this instance is root; otherwise, false.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.IsRoot

Remarks

This property only makes sense in a tree-context. Use a spanning tree algorithm to extract a tree from a generic graph if necessary.

IsVirtual

Gets or sets whether this node maps to a container or a collection of physical shapes.

Declaration

cs-api-definition
public bool IsVirtual { get; set; }

Property Value

bool

Neighbors

Gets the nodes adjacent to this node, i.e. both the Parents and Children nodes.

Declaration

cs-api-definition
public IEnumerable<Node<TNodeData, TLinkData>> Neighbors { get; }

Property Value

IEnumerable<Node<TNodeData, TLinkData>>

All the neighbors nodes of this node.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.Neighbors

Outgoing

Get the node's outgoing links.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public IList<Edge<TNodeData, TLinkData>> Outgoing { get; set; }

Property Value

IList<Edge<TNodeData, TLinkData>>

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.Outgoing

Remarks

  • If the node is directed (i.e. IsDirected = true) then this collection is the same as the AllLinks collection.
  • Do not add links to this collection but use the AddLink(TNode, TNode) method in order to update the related properties (AllLinks, Outgoing...).

Parents

Gets the parent nodes attached to this node.

Declaration

cs-api-definition
public IEnumerable<Node<TNodeData, TLinkData>> Parents { get; }

Property Value

IEnumerable<Node<TNodeData, TLinkData>>

The parent collection.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.Parents

Remarks

  • A parent is defined as the opposite node from an edge ending at this node.
  • If the graph is not directed this will return the same collection as the Children and the Neighbors property, i.e. all the nodes attached to the this node.

Methods

AddIncomingEdge(Edge<TNodeData, TLinkData>)

Adds an incoming link.

Declaration

cs-api-definition
public void AddIncomingEdge(Edge<TNodeData, TLinkData> edge)

Parameters

edge

Edge<TNodeData, TLinkData>

The link to add.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.AddIncomingEdge(Edge<TNodeData, TLinkData>)

AddOutgoingEdge(Edge<TNodeData, TLinkData>)

Adds an outgoing link.

Declaration

cs-api-definition
public void AddOutgoingEdge(Edge<TNodeData, TLinkData> edge)

Parameters

edge

Edge<TNodeData, TLinkData>

The link to add.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.AddOutgoingEdge(Edge<TNodeData, TLinkData>)

Clone()

Returns a (shallow) copy of this node.

Declaration

cs-api-definition
public Node<TNodeData, TLinkData> Clone()

Returns

Node<TNodeData, TLinkData>

Returns a copy of this node, including the references of incoming and outgoing edges. It does not however clone beyond these collections.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.Clone()

GetBoundsFromAssociatedShape()

Gets the bounds from the associated shape, if possible.

Declaration

cs-api-definition
public void GetBoundsFromAssociatedShape()

GetCenterFromAssociatedShape()

Gets the bounds from the associated shape.

Declaration

cs-api-definition
public void GetCenterFromAssociatedShape()

RemoveIncomingEdge(Edge<TNodeData, TLinkData>)

Removes an incoming edge.

Declaration

cs-api-definition
public void RemoveIncomingEdge(Edge<TNodeData, TLinkData> edge)

Parameters

edge

Edge<TNodeData, TLinkData>

The edge to remove.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.RemoveIncomingEdge(Edge<TNodeData, TLinkData>)

Removes a link.

Declaration

cs-api-definition
public void RemoveLink(Edge<TNodeData, TLinkData> link)

Parameters

link

Edge<TNodeData, TLinkData>

The link.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.RemoveLink(Edge<TNodeData, TLinkData>)

RemoveOutgoingEdge(Edge<TNodeData, TLinkData>)

Removes the given outgoing edge.

Declaration

cs-api-definition
public void RemoveOutgoingEdge(Edge<TNodeData, TLinkData> edge)

Parameters

edge

Edge<TNodeData, TLinkData>

The edge to remove.

Implements INode<Node<TNodeData, TLinkData>, Edge<TNodeData, TLinkData>>.RemoveOutgoingEdge(Edge<TNodeData, TLinkData>)

TransferBoundsToAssociatedShape()

Transfers the bounds to the associated shape, if possible.

Declaration

cs-api-definition
public void TransferBoundsToAssociatedShape()

TransferCenterToAssociatedShape()

Transfers the center to the associated shape, if possible.

Declaration

cs-api-definition
public void TransferCenterToAssociatedShape()