Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LayoutVertex

Hierarchy

A vertex represents a Node in a LayoutNetwork, along with its bounds and focus and collections of LayoutEdges that come into and go out of the vertex. 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 LayoutNetwork there is a subclass of LayoutVertex and a subclass of LayoutEdge:

Modifying a LayoutNetwork or a LayoutVertex or a LayoutEdge does not invalidate the Layout or raise any changed events.

Index

Constructors

constructor

Properties

bounds : Rect

  • Gets or sets the bounds of this vertex, in document coordinates. 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 : number

  • Gets or sets the center Point.x of this vertex, in document coordinates. 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 : number

  • Gets or sets the center Point.y of this vertex, in document coordinates. 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 : ObjectData

  • Gets or sets the data object in the model that should be associated with this vertex, if any. 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 JavaScript 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.

    since

    1.6

Read-only destinationEdges : Iterator<LayoutEdge>

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

Read-only destinationVertexes : Iterator<LayoutVertex>

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

    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.

Read-only edges : Iterator<LayoutEdge>

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

    Note that this is inefficient compared to iterating over the edges: sourceEdges and destinationEdges.

Read-only edgesCount : number

  • This read-only property returns the total number of edges that are connected with this vertex in either direction.

focus : Point

focusX : number

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

focusY : number

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

height : number

  • Gets or sets the height of this vertex. This is always the vertical distance reserved for the node.

network : LayoutNetwork

node : Node

  • Gets or sets the Node associated with this vertex, if any. 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 Part.locationObject's center point.

Read-only sourceEdges : Iterator<LayoutEdge>

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

Read-only sourceVertexes : Iterator<LayoutVertex>

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

    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.

Read-only vertexes : Iterator<LayoutVertex>

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

    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 : number

  • Gets or sets the width of this vertex. This is always the horizontal distance reserved for the node.

x : number

  • Gets or sets the left point of this vertex.

y : number

  • Gets or sets the top point of this vertex.

Methods

addDestinationEdge

  • Adds a LayoutEdge to the list of successors (the edge will be going out from this vertex). Calling this method does not modify the LayoutEdge.fromVertex of the LayoutEdge.

    Parameters

    Returns void

addSourceEdge

  • Adds a LayoutEdge to the list of predecessors (the edge will be coming into this vertex). Calling this method does not modify the LayoutEdge.toVertex of the LayoutEdge.

    Parameters

    Returns void

Virtual commit

  • commit(): void
  • Moves the Node corresponding to this vertex so that its position is at the current bounds point.

    To make the most common cases look right, the Node's Part.locationObject 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.

    Returns void

deleteDestinationEdge

  • Deletes a LayoutEdge from the list of successors (the edge was going out from this vertex). Calling this method does not modify the LayoutEdge.fromVertex of the LayoutEdge.

    Parameters

    Returns void

deleteSourceEdge

  • Deletes a LayoutEdge from the list of predecessors (the edge was coming into this vertex). Calling this method does not modify the LayoutEdge.toVertex of the LayoutEdge.

    Parameters

    Returns void

Static smartComparer

  • This static function is used to compare the Part.text values of the nodes of the argument LayoutVertexes. If the text ends in a number, the values are compared as numbers rather than lexicographically. Naturally this comparison is significantly slower than LayoutVertex.standardComparer.

    Parameters

    Returns number

    int -1, 0, or 1, depending on whether the comparison between M and N is less than, equal, or greater than.

Static standardComparer

  • This static function is used to compare the Part.text values of the nodes of the argument LayoutVertexes. This just does a simple case-sensitive string comparison. Alternatively you may wish to use LayoutVertex.smartComparer or write your own comparison function.

    Parameters

    Returns number

    int -1, 0, or 1, depending on whether the comparison between M and N is less than, equal, or greater than.