Table of Contents

Class Network<V, E, Y>.Vertex

Namespace
Northwoods.Go.Layouts
Assembly
Northwoods.GoDiagram.WinForms.dll

A vertex represents a Node in a Network<V, E, Y>, along with its Bounds and Focus and collections of Network<V, E, Y>.Edges that come into and go out of the vertex.

public class Network<V, E, Y>.Vertex
Inheritance
Network<V, E, Y>.Vertex
Derived
Inherited Members

Remarks

The Node property may be null for vertexes that represent "dummy" nodes, when the layout wants to work with a network that is not isomorphic with the collection of Nodes and Links being laid out.

This holds layout-specific data for the node. For each kind of layout that uses a Network there is a subclass of Network<V, E, Y>.Vertex and a subclass of Network<V, E, Y>.Edge:

  • CircularLayout: CircularVertex and CircularEdge
  • ForceDirectedLayout: ForceDirectedVertex and ForceDirectedEdge
  • LayeredDigraphLayout: LayeredDigraphVertex and LayeredDigraphEdge
  • TreeLayout: TreeVertex and TreeEdge

Modifying a Network<V, E, Y> or a Network<V, E, Y>.Vertex or an Network<V, E, Y>.Edge does not invalidate the Layout or raise any changed events.

Constructors

Vertex(Network<V, E, Y>)

This constructs a vertex that does not know about any Node and sets its network.

public Vertex(Network<V, E, Y> network)

Parameters

network Network<V, E, Y>

Fields

SmartComparer

This static comparer is used to compare the Text values of the Nodes of the argument Network<V, E, Y>.Vertexes. If the text ends in a number, the values are compared as numbers rather than lexicographically.

public static readonly Comparison<V> SmartComparer

Field Value

Comparison<V>

Remarks

Naturally this comparison is significantly slower than StandardComparer.

StandardComparer

This static comparer is used to compare the Text values of the Nodes of the argument Network<V, E, Y>.Vertexes. This just does a simple case-sensitive string comparison.

public static readonly Comparison<V> StandardComparer

Field Value

Comparison<V>

Remarks

Alternatively you may wish to use SmartComparer or write your own comparison function.

Properties

Bounds

Gets or sets the bounds of this vertex, in document coordinates.

public Rect Bounds { get; set; }

Property Value

Rect

Remarks

Setting this property does not directly modify the position of any Node, but it will modify the value of CenterX and CenterY, as well as the subsidiary convenience properties X, Y, Width, and Height.

CenterX

Gets or sets the center X of this vertex, in document coordinates.

public double CenterX { get; set; }

Property Value

double

Remarks

This property depends on both Bounds and Focus. Setting this property does not modify the position of any Node, but it will modify the value of Bounds.

CenterY

Gets or sets the center Y of this vertex, in document coordinates.

public double CenterY { get; set; }

Property Value

double

Remarks

This property depends on both Bounds and Focus. Setting this property does not modify the position of any Node, but it will modify the value of Bounds.

Data

Gets or sets the data object in the model that should be associated with this vertex, if any.

public object Data { get; set; }

Property Value

object

Remarks

The value will be non-null if this vertex is virtualized, not represented by a real Node in the Diagram. Each data object should have a "Bounds" property that is a Rect or any Object with "X", "Y", "Width", and "Height" properties that are real numbers, and non-negative numbers for the width and the height. Setting this data property will also set the Bounds and Focus properties.

DestinationEdges

This read-only property returns an iterator for all of the edges that go out of this vertex.

public IReadOnlyCollection<E> DestinationEdges { get; }

Property Value

IReadOnlyCollection<E>

DestinationVertexes

This read-only property returns an iterator for all of the vertexes that are connected with edges going out of this vertex.

public IReadOnlyCollection<V> DestinationVertexes { get; }

Property Value

IReadOnlyCollection<V>

Remarks

Note that this is inefficient compared to iterating over the edges (DestinationEdges) due to the need to avoid duplicate vertexes if there happen to be multiple edges connecting with the same vertex.

Edges

This read-only property returns an iterator for all of the edges that are connected with this vertex in either direction.

public IReadOnlyCollection<E> Edges { get; }

Property Value

IReadOnlyCollection<E>

Remarks

Note that this is inefficient compared to iterating over the edges: SourceEdges and DestinationEdges.

Focus

Gets or sets the offset of the FocusX and FocusY from the Bounds position.

public Point Focus { get; set; }

Property Value

Point

Remarks

Setting this property does not directly modify the position of any Node, but it does affect the value of CenterX and CenterY.

The "focus" is normally the center of the Node's LocationElement.

FocusX

Gets or sets the relative X position of the "center" point, the focus.

public double FocusX { get; set; }

Property Value

double

FocusY

Gets or sets the relative Y position of the "center" point, the focus.

public double FocusY { get; set; }

Property Value

double

Height

Gets or sets the height of this vertex.

public double Height { get; set; }

Property Value

double

Remarks

This is always the vertical distance reserved for the node.

this[string]

This index operator allows for access to programmer-defined properties stored in a Dictionary<string, object>.

public object this[string prop] { get; set; }

Parameters

prop string

the property name, which must begin with a _

Property Value

object

Network

Gets the Network<V, E, Y> that owns this vertex.

public Network<V, E, Y> Network { get; set; }

Property Value

Network<V, E, Y>

Remarks

The default value is null. It is set automatically for you in CreateVertex().

Node

Gets or sets the Node associated with this vertex, if any.

public Node Node { get; set; }

Property Value

Node

Remarks

The value may be null if this vertex is a "dummy" vertex, not represented by a real Node in the Diagram.

This property setter also sets the Bounds and Focus properties according to the value of the Node's ActualBounds and its LocationElement's center point.

SourceEdges

This read-only property returns an iterator for all of the edges that come into this vertex.

public IReadOnlyCollection<E> SourceEdges { get; }

Property Value

IReadOnlyCollection<E>

SourceVertexes

This read-only property returns an iterator for all of the vertexes that are connected with edges coming into this vertex.

public IReadOnlyCollection<V> SourceVertexes { get; }

Property Value

IReadOnlyCollection<V>

Remarks

Note that this is inefficient compared to iterating over the edges (SourceEdges) due to the need to avoid duplicate vertexes if there happen to be multiple edges connecting with the same vertex.

Vertexes

This read-only property returns an iterator for all of the vertexes that are connected in either direction with this vertex.

public IReadOnlyCollection<V> Vertexes { get; }

Property Value

IReadOnlyCollection<V>

Remarks

Note that this is inefficient compared to iterating over the edges (SourceEdges and DestinationEdges) due to the need to avoid duplicate vertexes if there happen to be multiple edges connecting with the same vertex.

Width

Gets or sets the width of this vertex.

public double Width { get; set; }

Property Value

double

Remarks

This is always the horizontal distance reserved for the node.

X

Gets or sets the left point of this vertex.

public double X { get; set; }

Property Value

double

Y

Gets or sets the top point of this vertex.

public double Y { get; set; }

Property Value

double

Methods

AddDestinationEdge(E)

Adds a Network<V, E, Y>.Edge to the list of successors (the edge will be going out from this vertex).

public virtual void AddDestinationEdge(E edge)

Parameters

edge E

Remarks

Calling this method does not modify the FromVertex of the Edge.

AddSourceEdge(E)

Adds an Network<V, E, Y>.Edge to the list of predecessors (the edge will be coming into this vertex).

public virtual void AddSourceEdge(E edge)

Parameters

edge E

Remarks

Calling this method does not modify the ToVertex of the Edge.

Commit()

Moves the Node corresponding to this vertex so that its position is at the current Bounds point.

public virtual void Commit()

Remarks

To make the most common cases look right, the Node's LocationElement is centered. Thus iconic nodes will have the center of the icon be positioned according to the center of this vertex, ignoring any labels. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

DeleteDestinationEdge(E)

Deletes a Network<V, E, Y>.Edge from the list of successors (the edge was going out from this vertex).

public virtual void DeleteDestinationEdge(E edge)

Parameters

edge E

Remarks

Calling this method does not modify the FromVertex of the Edge.

DeleteSourceEdge(E)

Deletes an Network<V, E, Y>.Edge from the list of predecessors (the edge was coming into this vertex).

public virtual void DeleteSourceEdge(E edge)

Parameters

edge E

Remarks

Calling this method does not modify the ToVertex of the Edge.