Packagecom.yworks.yfiles.layout
Classpublic class LayoutTool
InheritanceLayoutTool Inheritance YObject Inheritance Object

This class is a container for several helper and utility functions for the LayoutGraph class.

See also

com.yworks.yfiles.layout.LayoutGraph


Public Methods
 MethodDefined By
  
LayoutTool(init:Boolean = true)
LayoutTool
  
alignNodeLayouts(g:LayoutGraph, nodes:NodeList, referenceNode:Node, vertical:Boolean, mode:int):void
[static] Aligns the specified nodes either vertically or horizontally according to the specified node alignment mode.
LayoutTool
  
[static] Applies a GraphLayout to a LayoutGraph.
LayoutTool
  
arrangeRectangleGrid(rects:Vector.<Object>, finalRect:Rectangle2D, viewRatio:Number):Dimension
[static] Reassigns the bounds of the rectangles in rects to fit into a large rectangle, whose bounds will be stored in finalRect.
LayoutTool
  
arrangeRectangleMultiRows(rects:Vector.<Object>, finalRect:Rectangle2D, preferredWidth:Number, preferredHeight:Number, compaction:Boolean, constraintMode:int):int
[static] Reassigns the bound of the rectangles in rects to fit in a large rectangle, whose bounds will be stored in finalRect.
LayoutTool
  
arrangeRectangleMultiRowsWithAlignment(rects:Vector.<Object>, finalRect:Rectangle2D, preferredWidth:Number, preferredHeight:Number, compaction:Boolean, constraintMode:int, alignment:int):int
[static] Reassigns the bound of the rectangles in rects to fit in a large rectangle, whose bounds will be stored in finalRect.
LayoutTool
  
arrangeRectangleRows(rects:Vector.<Object>, finalRect:Rectangle2D, viewRatio:Number):int
[static] Reassigns the bounds of the rectangles in rects to fit in a large rectangle, whose bounds will be stored in finalRect.
LayoutTool
  
arrangeRectangleRowsWithAlignment(rects:Vector.<Object>, finalRect:Rectangle2D, viewRatio:Number, alignment:int):int
[static] Reassigns the bounds of the rectangles in rects to fit into a large rectangle, whose bounds will be stored in finalRect.
LayoutTool
  
[static] Set the layout of two parallel edges with different direction identical.
LayoutTool
  
[static] Flips the orientation of a given rectangle, if its up vector points downward ( upY (com.yworks.yfiles.geom.YOrientedRectangle.upY) > 0).
LayoutTool
  
[static] This helper method clips the path of the edge on the bounding box of the start and end points.
LayoutTool
  
[static] This helper method clips the path of the edge on the bounding box of the start and end points.
LayoutTool
  
[static] Determines the main direction of the edge flow by analyzing the current layout of the graph.
LayoutTool
  
[static] Returns the path of the layout of a specific edge as a String.
LayoutTool
 Inherited
equals(o:Object):Boolean
YObject
  
[static] Returns the bounding box of the given node.
LayoutTool
  
[static] Returns the bounding box of the given edge.
LayoutTool
  
[static] Returns the bounding box of the edges accessible through the given edge cursor.
LayoutTool
  
[static] Returns the bounding box of the nodes accessible through the given node cursor.
LayoutTool
  
[static] Returns the bounding box of the nodes and edges accessible through the given cursors.
LayoutTool
  
getBoundingBoxForSubgraphWithHales(graph:LayoutGraph, nc:NodeCursor, ec:EdgeCursor, includeNodeLabels:Boolean, includeEdgeLabels:Boolean, includeHalos:Boolean):Rectangle2D
[static] Returns the bounding box of the nodes and edges accessible through the given cursors.
LayoutTool
  
[static] Returns the bounding box of the nodes and edges accessible through the given cursors.
LayoutTool
  
getBoundingBoxForSubgraphWithNodeAndEdgeLabels(graph:LayoutGraph, nc:NodeCursor, ec:EdgeCursor, includeNodeLabels:Boolean, includeEdgeLabels:Boolean):Rectangle2D
[static] Returns the bounding box of the nodes and edges accessible through the given cursors.
LayoutTool
  
getClass():Class
[override]
LayoutTool
  
[static] This helper method clips the path of an edge on the bounding box of the start and end vertices.
LayoutTool
  
[static] This helper method clips the path of an edge on the bounding box of the start and end vertices.
LayoutTool
  
getEdgeClippedOnBBWithInset(edge:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout, inset:Number):YPointPath
[static] This helper method clips the path of an edge on the bounding box of the start and end vertices.
LayoutTool
  
[static] Returns the label layout factory for the given graph.
LayoutTool
  
getLabelPlacement(model:NodeLabelModel, labelSize:YDimension, nodeLayout:NodeLayout, param:Object):YPoint
[static] Returns the upper left corner of the given label's paraxial bounding box as encoded by the specified model parameter.
LayoutTool
  
getLabelPlacement2(model:EdgeLabelModel, labelSize:YDimension, edgeLayout:EdgeLayout, sourceLayout:NodeLayout, targetLayout:NodeLayout, param:Object):YPoint
[static] Returns the upper left corner of the given label's paraxial bounding box as encoded by the specified model parameter.
LayoutTool
  
getNodeDistance(graph:LayoutGraph, s:Node, t:Node):Number
[static] Returns the distance between the centers of two nodes
LayoutTool
  
[static] Returns the positions of the nodes of a graph's diagram.
LayoutTool
  
getPathLength(graph:LayoutGraph, e:Edge):Number
[static] Returns the length of path of a given edge.
LayoutTool
 Inherited
hashCode():int
YObject
  
[static] This method assigns the position (0,0) to all nodes in the graph, and sets the edges to straight lines with ports in the center of the adjacent node.
LayoutTool
  
[static] This helper method tests if the path of an edge is outside the bounding box of the start and end vertices.
LayoutTool
  
isEdgeOutsideNodesWithInset(edge:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout, inset:Number):Boolean
[static] This helper method tests if the path of an edge is outside the bounding box of the start and end vertices.
LayoutTool
  
[static] Returns true if most of the edges of the graph are routed octilinear.
LayoutTool
  
[static] Returns true if most of the edges of the graph are routed orthogonal.
LayoutTool
  
moveEdge(g:LayoutGraph, edge:Edge, dx:Number, dy:Number):void
[static] Moves the edge points of the given edge by the vector (dx,dy).
LayoutTool
  
moveEdges(g:LayoutGraph, edges:EdgeCursor, dx:Number, dy:Number):void
[static] Moves all edges accessible through the given edge cursor by the vector (dx,dy).
LayoutTool
  
moveNode(g:LayoutGraph, node:Node, dx:Number, dy:Number):void
[static] Moves the given node by the vector (dx,dy).
LayoutTool
  
moveNodes(g:LayoutGraph, nodes:NodeCursor, dx:Number, dy:Number):void
[static] Moves all nodes accessible through the given node cursor by the vector (dx,dy).
LayoutTool
  
moveSubgraphEdgeInduced(g:LayoutGraph, edges:EdgeCursor, dx:Number, dy:Number):void
[static] Moves the subgraph induced by edges accessible through the given edge cursor by the vector (dx,dy).
LayoutTool
  
moveSubgraphNodeInduced(g:LayoutGraph, nodes:NodeCursor, dx:Number, dy:Number):void
[static] Moves the subgraph induced by nodes accessible through the given node cursor by the vector (dx,dy).
LayoutTool
  
[static] Checks whether or not the path of an edge intersects the interior of a given rectangular area.
LayoutTool
  
[static] This helper method removes duplicate bends from all edges in the graph
LayoutTool
  
[static] This helper method removes duplicate bends from the given edge in the graph
LayoutTool
  
resetPath(gd:LayoutGraph, edge:Edge):void
[static] Assigns a trivial path which has no control points to the specified edge and sets the edge's ports to the center of the corresponding node.
LayoutTool
  
resetPath2(gd:LayoutGraph, edge:Edge, resetPorts:Boolean):void
[static] Assigns a trivial path which has no control points to the specified edge.
LayoutTool
  
[static] Assigns a trivial path which has no control points to all edges in the specified graph and sets the edges' ports to the center of the corresponding nodes.
LayoutTool
  
resetPathsAndPorts(gd:LayoutGraph, resetPorts:Boolean):void
[static] Assigns a trivial path which has no control points to all edges in the specified graph.
LayoutTool
  
[static] Sets the ports to the center of the nodes.
LayoutTool
  
[static] Reverses the layout of an edge.
LayoutTool
  
[static] Round the values of the control points and ports of an edge.
LayoutTool
  
[static] Round the values of the layout of an entire layout.
LayoutTool
  
[static] Round the values of the layout of a node.
LayoutTool
  
routeEdgesParallel(gd:LayoutGraph, e1:Edge, e2:Edge, lineDistance:Number):void
[static] Routes two edges which are incident to the same nodes, in parallel.
LayoutTool
  
routeEdgesParallelJoinEnds(gd:LayoutGraph, e1:Edge, e2:Edge, lineDistance:Number, joinEnds:Boolean, absJoinDist:Number, relJoinDist:Number):void
[static] Routes two edges which are incident to the same nodes, in parallel.
LayoutTool
  
routeEdgesParallelMultiple(gd:LayoutGraph, e1:Edge, list:EdgeList, lineDistance:Number):void
[static] Routes a list of edges with are incident to the same nodes, in parallel.
LayoutTool
  
routeEdgesParallelMultipleJoinEnds(gd:LayoutGraph, e1:Edge, list:EdgeList, lineDistance:Number, adjustE1:Boolean, joinEnds:Boolean, absJoinDist:Number, relJoinDist:Number):void
[static] Routes a list of edges which are incident to the same nodes, in parallel.
LayoutTool
  
[static] Routes a self-loop.
LayoutTool
Public Constants
 ConstantDefined By
  ALIGN_NODES_CENTERED : int = 0
[static] Node alignment policy that results in center aligned nodes.
LayoutTool
  ALIGN_NODES_DISTRIBUTED : int = 2
[static] Node alignment policy that results in vertically or horizontally distributed nodes.
LayoutTool
  ALIGN_NODES_LEADING : int = -1
[static] Node alignment policy that results in top aligned nodes for vertical alignment and left aligned nodes for horizontal alignments.
LayoutTool
  ALIGN_NODES_TRAILING : int = 1
[static] Node alignment policy that results in bottom aligned nodes for vertical alignment and right aligned nodes for horizontal alignments.
LayoutTool
  CENTER : int = 4
[static] Constant which can be used for arrangeRectangleRowsWithAlignment().
LayoutTool
  FLOW_DOWN : int = 0
[static] Edge flow specifier used by method determineEdgeFlowDirection().
LayoutTool
  FLOW_LEFT : int = 3
[static] Edge flow specifier used by method determineEdgeFlowDirection().
LayoutTool
  FLOW_NONE : int = -1
[static] Edge flow specifier used by method determineEdgeFlowDirection().
LayoutTool
  FLOW_RIGHT : int = 1
[static] Edge flow specifier used by method determineEdgeFlowDirection().
LayoutTool
  FLOW_UP : int = 2
[static] Edge flow specifier used by method determineEdgeFlowDirection().
LayoutTool
  JUSTIFIED : int = 3
[static] Constant which can be used for arrangeRectangleRowsWithAlignment().
LayoutTool
  LEADING : int = 1
[static] Constant which can be used for arrangeRectangleRowsWithAlignment().
LayoutTool
  MULTI_ROW_HEIGHT_CONSTRAINT : int = 1
[static] Constraint specifier constant for the multi-row rectangle arrangement realized by arrangeRectangleMultiRowsWithAlignment() Limits the height of the arrangement to the given preferred height value.
LayoutTool
  MULTI_ROW_NO_CONSTRAINT : int = 0
[static] Constraint specifier constant for the multi-row rectangle arrangement realized by arrangeRectangleMultiRowsWithAlignment() Both, height and width, are not limited in size by any constraint.
LayoutTool
  MULTI_ROW_WIDTH_CONSTRAINT : int = 2
[static] Constraint specifier constant for the multi-row rectangle arrangement realized by arrangeRectangleMultiRowsWithAlignment() Limits the width of the arrangement to the given preferred width value.
LayoutTool
  TRAILING : int = 2
[static] Constant which can be used for arrangeRectangleRowsWithAlignment().
LayoutTool
Constructor Detail
LayoutTool()Constructor
public function LayoutTool(init:Boolean = true)



Parameters
init:Boolean (default = true)
Method Detail
alignNodeLayouts()method
public static function alignNodeLayouts(g:LayoutGraph, nodes:NodeList, referenceNode:Node, vertical:Boolean, mode:int):void

Aligns the specified nodes either vertically or horizontally according to the specified node alignment mode.

For vertical arrangements, nodes are either top-aligned (ALIGN_NODES_LEADING), center-aligned (ALIGN_NODES_CENTERED), bottom-aligned (ALIGN_NODES_TRAILING), or vertically distributed (ALIGN_NODES_DISTRIBUTED).

For horizontal arrangements, nodes are either left-aligned (ALIGN_NODES_LEADING), center-aligned (ALIGN_NODES_CENTERED), right-aligned (ALIGN_NODES_TRAILING), or horizontally distributed (ALIGN_NODES_DISTRIBUTED).

In this context, distributed means that the specified nodes are placed in such a way that the projections of their bounds onto the vertical or horizontal coordinate axis do not overlap. E.g. after vertically distributing nodes, (n1.y + n1.height) <= n2.y for two consecutively placed nodes n1 and n2.

Parameters

g:LayoutGraph — the graph that contains the specified nodes.
 
nodes:NodeList — a subset of the specified graph's nodes that is arranged.
 
referenceNode:Node — if null, the common coordinate for aligning the specified nodes is calculated as the the vertical minimum (top-aligned), the vertical center, the vertical maximum (bottom-aligned), the horizontal minimum (left-aligned), the horizontal center, or the horizontal maximum (right-aligned) of the bounds of the specified nodes; otherwise the appropriate coordinate of the given reference node's bounds is used as common coordinate for aligning the specified nodes. The reference node is ignored when distributing (ALIGN_NODES_DISTRIBUTED) nodes.
 
vertical:Boolean — if true nodes are aligned (or distributed) according to their y-coordinates; otherwise nodes are aligned (or distributed) according to their x-coordinates.
 
mode:int — one of
  • ALIGN_NODES_LEADING,
  • ALIGN_NODES_CENTERED,
  • ALIGN_NODES_TRAILING, or
  • ALIGN_NODES_DISTRIBUTED.

See also

applyGraphLayout()method 
public static function applyGraphLayout(graph:LayoutGraph, gl:GraphLayout):void

Applies a GraphLayout to a LayoutGraph.

Precondition the GraphLayout data must be defined for elements in the given LayoutGraph.

Parameters

graph:LayoutGraph
 
gl:GraphLayout

arrangeRectangleGrid()method 
public static function arrangeRectangleGrid(rects:Vector.<Object>, finalRect:Rectangle2D, viewRatio:Number):Dimension

Reassigns the bounds of the rectangles in rects to fit into a large rectangle, whose bounds will be stored in finalRect. This procedure tries to generate a final rectangle, whose aspect ratio is as close as possible to viewRatio. This is achieved by arranging the rectangles in a grid-like fashion. The dimension of this grid is returned.

Parameters

rects:Vector.<Object> — the rectangles whose, coordinates will be modified
 
finalRect:Rectangle2D — the exact dimension will be placed in this rectangle
 
viewRatio:Number — the preferred ratio of the grid, must be greater than 0.

Returns
Dimension — the dimension of the grid
arrangeRectangleMultiRows()method 
public static function arrangeRectangleMultiRows(rects:Vector.<Object>, finalRect:Rectangle2D, preferredWidth:Number, preferredHeight:Number, compaction:Boolean, constraintMode:int):int

Reassigns the bound of the rectangles in rects to fit in a large rectangle, whose bounds will be stored in finalRect. The rectangles will be placed within this bound arranged within rows, where each row may be split into more sub-rows. This often leads to more compact results than provided by the procedure used in arrangeRectangleRowsWithAlignment(). A row will be subdivided into more rows, if two successive rectangles to be placed in the row could be placed stacked within this row without making the row larger in height.

This method calls arrangeRectangleMultiRowsWithAlignment() with the last alignment parameter being LEADING .

Parameters

rects:Vector.<Object> — the rectangles to arrange (coordinates will be assigned).
 
finalRect:Rectangle2D — the exact resulting dimension will be stored in this rectangle
 
preferredWidth:Number — the preferred width of the result finalRect, must be greater than 0.
 
preferredHeight:Number — the preferred height of the result finalRect, must be greater than 0.
 
compaction:Boolean — if true, then the algorithm tries to always minimize the resulting dimension, whilst respecting the given constraints.
 
constraintMode:int — the width or height constraints to consider. Possible values are MULTI_ROW_NO_CONSTRAINT, MULTI_ROW_WIDTH_CONSTRAINT and MULTI_ROW_HEIGHT_CONSTRAINT.

Returns
int — the number of rows used

See also

arrangeRectangleMultiRowsWithAlignment()method 
public static function arrangeRectangleMultiRowsWithAlignment(rects:Vector.<Object>, finalRect:Rectangle2D, preferredWidth:Number, preferredHeight:Number, compaction:Boolean, constraintMode:int, alignment:int):int

Reassigns the bound of the rectangles in rects to fit in a large rectangle, whose bounds will be stored in finalRect. The rectangles will be placed within this bound arranged within rows, where each row may be split into more sub-rows. This often leads to more compact results than provided by the procedure used in arrangeRectangleRowsWithAlignment(). A row will be subdivided into more rows if two successive rectangles to be placed in the row could be placed stacked within this row without making the row larger in height.

Parameters

rects:Vector.<Object> — the rectangles to arrange (coordinates will be assigned).
 
finalRect:Rectangle2D — the exact resulting dimension will be stored in this rectangle
 
preferredWidth:Number — the preferred width of the result finalRect, must be greater than 0.
 
preferredHeight:Number — the preferred height of the result finalRect, must be greater than 0.
 
compaction:Boolean — if true, then the algorithm tries to always minimize the resulting dimension, whilst respecting the given constraints.
 
constraintMode:int — the width or height constraints to consider. Possible values are MULTI_ROW_NO_CONSTRAINT, MULTI_ROW_WIDTH_CONSTRAINT and MULTI_ROW_HEIGHT_CONSTRAINT.
 
alignment:int — the alignment policy to follow. Possible values are LEADING, TRAILING and CENTER . The best results (regarding compactness) are achieved using LEADING. Other alignment modes are ignored.

Returns
int — the number of rows used

See also

arrangeRectangleRows()method 
public static function arrangeRectangleRows(rects:Vector.<Object>, finalRect:Rectangle2D, viewRatio:Number):int

Reassigns the bounds of the rectangles in rects to fit in a large rectangle, whose bounds will be stored in finalRect. This procedure tries to generate a final rectangle, whose aspect ratio is as close as possible to viewRatio. This is achieved by arranging the rectangles in a rows. The number of used rows will be returned. This method invokes arrangeRectangleRows (arrangeRectangleRowsWithAlignment()) with LEADING as the last argument.

Parameters

rects:Vector.<Object> — the rectangles whose coordinates will be modified
 
finalRect:Rectangle2D — the exact dimension will be placed in this rectangle
 
viewRatio:Number — the preferred ratio of the resulting bounds, must be greater than 0.

Returns
int — the number of used rows

See also

arrangeRectangleRowsWithAlignment()method 
public static function arrangeRectangleRowsWithAlignment(rects:Vector.<Object>, finalRect:Rectangle2D, viewRatio:Number, alignment:int):int

Reassigns the bounds of the rectangles in rects to fit into a large rectangle, whose bounds will be stored in finalRect. This procedure tries to generate a final rectangle, whose aspect ratio is as close as possible to viewRatio. This is achieved by arranging the rectangles in rows. The number of generated rows is returned.

Parameters

rects:Vector.<Object> — the rectangles whose coordinates will be modified
 
finalRect:Rectangle2D — the exact dimension will be placed in this rectangle
 
viewRatio:Number — the preferred ratio of the resulting bounds, must be greater than 0.
 
alignment:int — determines the alignment policy for rows, that are not completely filled

Returns
int — the number of generated rows
assignReverseLayout()method 
public static function assignReverseLayout(graph:LayoutGraph, e1:Edge, e2:Edge):void

Set the layout of two parallel edges with different direction identical.

Parameters

graph:LayoutGraph
 
e1:Edge — the edge for which the points are set.
 
e2:Edge — the template.

autoFlipBox()method 
public static function autoFlipBox(rect:YOrientedRectangle):Boolean

Flips the orientation of a given rectangle, if its up vector points downward ( upY (com.yworks.yfiles.geom.YOrientedRectangle.upY) > 0). That means, it rotates the rectangle by 180 degree without changing the rectangle's center.

Parameters

rect:YOrientedRectangle — the given rectangle.

Returns
Booleantrue if the given rectangle was flipped and false otherwise.

See also

clipEdgeOnBB()method 
public static function clipEdgeOnBB(gd:LayoutGraph, e:Edge):void

This helper method clips the path of the edge on the bounding box of the start and end points.

Parameters

gd:LayoutGraph
 
e:Edge

clipEdgesOnBB()method 
public static function clipEdgesOnBB(gd:LayoutGraph):void

This helper method clips the path of the edge on the bounding box of the start and end points.

Parameters

gd:LayoutGraph

determineEdgeFlowDirection()method 
public static function determineEdgeFlowDirection(graph:LayoutGraph, considerEdges:DataProvider):int

Determines the main direction of the edge flow by analyzing the current layout of the graph. The method only considers edges for which the given DataProvider returns true.

Parameters

graph:LayoutGraph — the underlying graph.
 
considerEdges:DataProvider — the edges to consider.

Returns
int — the flow direction, i.e., FLOW_DOWN, FLOW_LEFT, FLOW_NONE, FLOW_RIGHT or FLOW_UP.

See also

edgeLayoutString()method 
public static function edgeLayoutString(gd:LayoutGraph, edge:Edge):String

Returns the path of the layout of a specific edge as a String.

Parameters

gd:LayoutGraph
 
edge:Edge

Returns
String
getBoundingBox()method 
public static function getBoundingBox(graph:LayoutGraph, n:Node):Rectangle2D

Returns the bounding box of the given node.

Parameters

graph:LayoutGraph
 
n:Node

Returns
Rectangle2D
getBoundingBoxForEdge()method 
public static function getBoundingBoxForEdge(graph:LayoutGraph, e:Edge):Rectangle2D

Returns the bounding box of the given edge.

Parameters

graph:LayoutGraph
 
e:Edge

Returns
Rectangle2D
getBoundingBoxForEdges()method 
public static function getBoundingBoxForEdges(graph:LayoutGraph, ec:EdgeCursor):Rectangle2D

Returns the bounding box of the edges accessible through the given edge cursor.

Parameters

graph:LayoutGraph
 
ec:EdgeCursor

Returns
Rectangle2D
getBoundingBoxForNodes()method 
public static function getBoundingBoxForNodes(graph:LayoutGraph, nc:NodeCursor):Rectangle2D

Returns the bounding box of the nodes accessible through the given node cursor.

Parameters

graph:LayoutGraph
 
nc:NodeCursor

Returns
Rectangle2D
getBoundingBoxForSubgraph()method 
public static function getBoundingBoxForSubgraph(graph:LayoutGraph, nc:NodeCursor, ec:EdgeCursor):Rectangle2D

Returns the bounding box of the nodes and edges accessible through the given cursors.

Parameters

graph:LayoutGraph
 
nc:NodeCursor
 
ec:EdgeCursor

Returns
Rectangle2D
getBoundingBoxForSubgraphWithHales()method 
public static function getBoundingBoxForSubgraphWithHales(graph:LayoutGraph, nc:NodeCursor, ec:EdgeCursor, includeNodeLabels:Boolean, includeEdgeLabels:Boolean, includeHalos:Boolean):Rectangle2D

Returns the bounding box of the nodes and edges accessible through the given cursors.

Parameters

graph:LayoutGraph — The graph containing the nodes and edges to consider.
 
nc:NodeCursor — The node cursor to access the nodes to consider.
 
ec:EdgeCursor — The edge cursor to access the edges to consider.
 
includeNodeLabels:Boolean — Whether the bounds calculation should take node labels into account.
 
includeEdgeLabels:Boolean — Whether the bounds calculation should take edge labels into account.
 
includeHalos:Boolean — Whether the bounds calculation should take node halos into account.

Returns
Rectangle2D — the bounding box of the nodes and edges accessible through the given cursors.
getBoundingBoxForSubgraphWithLabels()method 
public static function getBoundingBoxForSubgraphWithLabels(graph:LayoutGraph, nc:NodeCursor, ec:EdgeCursor, includeLabels:Boolean):Rectangle2D

Returns the bounding box of the nodes and edges accessible through the given cursors. Optionally, the resulting bounding box will also include the bounds of all node and edge labels attached to the accessible nodes and edges.

Parameters

graph:LayoutGraph
 
nc:NodeCursor
 
ec:EdgeCursor
 
includeLabels:Boolean

Returns
Rectangle2D
getBoundingBoxForSubgraphWithNodeAndEdgeLabels()method 
public static function getBoundingBoxForSubgraphWithNodeAndEdgeLabels(graph:LayoutGraph, nc:NodeCursor, ec:EdgeCursor, includeNodeLabels:Boolean, includeEdgeLabels:Boolean):Rectangle2D

Returns the bounding box of the nodes and edges accessible through the given cursors. Optionally, the resulting bounding box will also include the bounds of all node and edge labels attached to the accessible nodes and edges.

Parameters

graph:LayoutGraph
 
nc:NodeCursor
 
ec:EdgeCursor
 
includeNodeLabels:Boolean
 
includeEdgeLabels:Boolean

Returns
Rectangle2D
getClass()method 
override public function getClass():Class

Returns
Class
getEdgeClippedOnBB()method 
public static function getEdgeClippedOnBB(gd:LayoutGraph, edge:Edge):YPointPath

This helper method clips the path of an edge on the bounding box of the start and end vertices.

Parameters

gd:LayoutGraph
 
edge:Edge

Returns
YPointPath
getEdgeClippedOnBB2()method 
public static function getEdgeClippedOnBB2(edge:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout):YPointPath

This helper method clips the path of an edge on the bounding box of the start and end vertices.

Parameters

edge:EdgeLayout
 
sourceNode:NodeLayout
 
targetNode:NodeLayout

Returns
YPointPath
getEdgeClippedOnBBWithInset()method 
public static function getEdgeClippedOnBBWithInset(edge:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout, inset:Number):YPointPath

This helper method clips the path of an edge on the bounding box of the start and end vertices.

Parameters

edge:EdgeLayout
 
sourceNode:NodeLayout
 
targetNode:NodeLayout
 
inset:Number

Returns
YPointPath
getLabelFactory()method 
public static function getLabelFactory(graph:LayoutGraph):LabelLayoutFactory

Returns the label layout factory for the given graph. Note that the factory instance is bound to the specified graph instance, i.e., you can only create, add and remove labels for this graph.

Parameters

graph:LayoutGraph — the graph.

Returns
LabelLayoutFactory — the label factory of the graph.
getLabelPlacement()method 
public static function getLabelPlacement(model:NodeLabelModel, labelSize:YDimension, nodeLayout:NodeLayout, param:Object):YPoint

Returns the upper left corner of the given label's paraxial bounding box as encoded by the specified model parameter.

Parameters

model:NodeLabelModel — the label model used to place the label.
 
labelSize:YDimension — the size of the label that should be placed.
 
nodeLayout:NodeLayout — the layout of the node to which the label belongs.
 
param:Object — the model parameter that describes the abstract position of the label within the specified model. The parameter must have been generated by said model.

Returns
YPoint — the upper left corner of the label's bounding box.

See also

getLabelPlacement2()method 
public static function getLabelPlacement2(model:EdgeLabelModel, labelSize:YDimension, edgeLayout:EdgeLayout, sourceLayout:NodeLayout, targetLayout:NodeLayout, param:Object):YPoint

Returns the upper left corner of the given label's paraxial bounding box as encoded by the specified model parameter.

Parameters

model:EdgeLabelModel — the label model used to place the label.
 
labelSize:YDimension — the size of the label that should be placed.
 
edgeLayout:EdgeLayout — the layout of the edge to which the label belongs.
 
sourceLayout:NodeLayout — the layout of the source node of the label owning edge.
 
targetLayout:NodeLayout — the layout of the target node of the label owning edge.
 
param:Object — the model parameter that describes the abstract position of the label within the specified model. The parameter must have been generated by said model.

Returns
YPoint — the upper left corner of the label's bounding box.

See also

getNodeDistance()method 
public static function getNodeDistance(graph:LayoutGraph, s:Node, t:Node):Number

Returns the distance between the centers of two nodes

Parameters

graph:LayoutGraph
 
s:Node
 
t:Node

Returns
Number
getNodePositions()method 
public static function getNodePositions(gd:LayoutGraph):String

Returns the positions of the nodes of a graph's diagram.

Parameters

gd:LayoutGraph

Returns
String
getPathLength()method 
public static function getPathLength(graph:LayoutGraph, e:Edge):Number

Returns the length of path of a given edge. The path starts at the source point traverses through all control points and ends at the target point.

Parameters

graph:LayoutGraph
 
e:Edge

Returns
Number
initDiagram()method 
public static function initDiagram(gd:LayoutGraph):void

This method assigns the position (0,0) to all nodes in the graph, and sets the edges to straight lines with ports in the center of the adjacent node.

Parameters

gd:LayoutGraph

isEdgeOutsideNodes()method 
public static function isEdgeOutsideNodes(gd:LayoutGraph, edge:Edge):Boolean

This helper method tests if the path of an edge is outside the bounding box of the start and end vertices.

Parameters

gd:LayoutGraph
 
edge:Edge

Returns
Boolean
isEdgeOutsideNodesWithInset()method 
public static function isEdgeOutsideNodesWithInset(edge:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout, inset:Number):Boolean

This helper method tests if the path of an edge is outside the bounding box of the start and end vertices.

Parameters

edge:EdgeLayout
 
sourceNode:NodeLayout
 
targetNode:NodeLayout
 
inset:Number

Returns
Boolean
isUsingOctilinearEdgeRoutes()method 
public static function isUsingOctilinearEdgeRoutes(graph:LayoutGraph, considerEdges:DataProvider):Boolean

Returns true if most of the edges of the graph are routed octilinear. The method only considers edges for which the given DataProvider returns true.

Note: for orthogonal layouts this method returns true.

Parameters

graph:LayoutGraph — the underlying graph.
 
considerEdges:DataProvider — the edges to consider.

Returns
Boolean — true if most of the edges of the graph are routed octilinear.
isUsingOrthogonalEdgeRoutes()method 
public static function isUsingOrthogonalEdgeRoutes(graph:LayoutGraph, considerEdges:DataProvider):Boolean

Returns true if most of the edges of the graph are routed orthogonal. The method only considers edges for which the given DataProvider returns true.

Parameters

graph:LayoutGraph — the underlying graph.
 
considerEdges:DataProvider — the edges to consider.

Returns
Boolean — true if most of the edges of the graph are routed orthogonal.
moveEdge()method 
public static function moveEdge(g:LayoutGraph, edge:Edge, dx:Number, dy:Number):void

Moves the edge points of the given edge by the vector (dx,dy).

Parameters

g:LayoutGraph
 
edge:Edge
 
dx:Number
 
dy:Number

moveEdges()method 
public static function moveEdges(g:LayoutGraph, edges:EdgeCursor, dx:Number, dy:Number):void

Moves all edges accessible through the given edge cursor by the vector (dx,dy).

Parameters

g:LayoutGraph
 
edges:EdgeCursor
 
dx:Number
 
dy:Number

moveNode()method 
public static function moveNode(g:LayoutGraph, node:Node, dx:Number, dy:Number):void

Moves the given node by the vector (dx,dy).

Parameters

g:LayoutGraph
 
node:Node
 
dx:Number
 
dy:Number

moveNodes()method 
public static function moveNodes(g:LayoutGraph, nodes:NodeCursor, dx:Number, dy:Number):void

Moves all nodes accessible through the given node cursor by the vector (dx,dy).

Parameters

g:LayoutGraph
 
nodes:NodeCursor
 
dx:Number
 
dy:Number

moveSubgraphEdgeInduced()method 
public static function moveSubgraphEdgeInduced(g:LayoutGraph, edges:EdgeCursor, dx:Number, dy:Number):void

Moves the subgraph induced by edges accessible through the given edge cursor by the vector (dx,dy).

Parameters

g:LayoutGraph
 
edges:EdgeCursor
 
dx:Number
 
dy:Number

moveSubgraphNodeInduced()method 
public static function moveSubgraphNodeInduced(g:LayoutGraph, nodes:NodeCursor, dx:Number, dy:Number):void

Moves the subgraph induced by nodes accessible through the given node cursor by the vector (dx,dy).

Parameters

g:LayoutGraph
 
nodes:NodeCursor
 
dx:Number
 
dy:Number

pathIntersectsRect()method 
public static function pathIntersectsRect(graph:LayoutGraph, e:Edge, rect:Rectangle2D):Boolean

Checks whether or not the path of an edge intersects the interior of a given rectangular area.

Parameters

graph:LayoutGraph
 
e:Edge
 
rect:Rectangle2D

Returns
Boolean
removeDuplicateBends()method 
public static function removeDuplicateBends(gd:LayoutGraph):void

This helper method removes duplicate bends from all edges in the graph

Parameters

gd:LayoutGraph — a graph diagram.

removeDuplicateBendsFromEdge()method 
public static function removeDuplicateBendsFromEdge(gd:LayoutGraph, edge:Edge):void

This helper method removes duplicate bends from the given edge in the graph

Parameters

gd:LayoutGraph — a graph diagram.
 
edge:Edge — the edge.

resetPath()method 
public static function resetPath(gd:LayoutGraph, edge:Edge):void

Assigns a trivial path which has no control points to the specified edge and sets the edge's ports to the center of the corresponding node. Calling this method is equivalent to

Parameters

gd:LayoutGraph — a graph diagram.
 
edge:Edge — an edge in graph.

See also

resetPath2()method 
public static function resetPath2(gd:LayoutGraph, edge:Edge, resetPorts:Boolean):void

Assigns a trivial path which has no control points to the specified edge.

Parameters

gd:LayoutGraph — a graph diagram.
 
edge:Edge — an edge in graph.
 
resetPorts:Boolean — if true, the ports of the edge are set to the center of the corresponding node.

resetPaths()method 
public static function resetPaths(gd:LayoutGraph):void

Assigns a trivial path which has no control points to all edges in the specified graph and sets the edges' ports to the center of the corresponding nodes. Calling this method is equivalent to

Parameters

gd:LayoutGraph — a graph diagram.

See also

resetPathsAndPorts()method 
public static function resetPathsAndPorts(gd:LayoutGraph, resetPorts:Boolean):void

Assigns a trivial path which has no control points to all edges in the specified graph.

Parameters

gd:LayoutGraph — a graph diagram.
 
resetPorts:Boolean — if true, the ports of the edges are set to the center of the corresponding nodes.

resetPorts()method 
public static function resetPorts(gd:LayoutGraph):void

Sets the ports to the center of the nodes.

Parameters

gd:LayoutGraph — a graph diagram.

reverseEdgeLayout()method 
public static function reverseEdgeLayout(el:EdgeLayout):void

Reverses the layout of an edge. This method reverses the order of points and swaps source with target point.

Parameters

el:EdgeLayout

roundEdgeLayout()method 
public static function roundEdgeLayout(gd:LayoutGraph, edge:Edge):void

Round the values of the control points and ports of an edge.

Parameters

gd:LayoutGraph
 
edge:Edge

roundLayout()method 
public static function roundLayout(gd:LayoutGraph):void

Round the values of the layout of an entire layout.

Parameters

gd:LayoutGraph

roundNodeLayout()method 
public static function roundNodeLayout(gd:LayoutGraph, node:Node):void

Round the values of the layout of a node.

Parameters

gd:LayoutGraph
 
node:Node

routeEdgesParallel()method 
public static function routeEdgesParallel(gd:LayoutGraph, e1:Edge, e2:Edge, lineDistance:Number):void

Routes two edges which are incident to the same nodes, in parallel.

Parameters

gd:LayoutGraph
 
e1:Edge
 
e2:Edge
 
lineDistance:Number

See also

routeEdgesParallelJoinEnds()method 
public static function routeEdgesParallelJoinEnds(gd:LayoutGraph, e1:Edge, e2:Edge, lineDistance:Number, joinEnds:Boolean, absJoinDist:Number, relJoinDist:Number):void

Routes two edges which are incident to the same nodes, in parallel.

Parameters

gd:LayoutGraph — the graph
 
e1:Edge — the leading edge
 
e2:Edge — the edge to be adjusted (may be e1)
 
lineDistance:Number — the distance between the two edges
 
joinEnds:Boolean — whether the end points should all be set to the end points of e1
 
absJoinDist:Number — the absolute distance between the end points and the beginning to the parallel segment routing
 
relJoinDist:Number — the relative distance, measured relative to the length of the first/last segments

routeEdgesParallelMultiple()method 
public static function routeEdgesParallelMultiple(gd:LayoutGraph, e1:Edge, list:EdgeList, lineDistance:Number):void

Routes a list of edges with are incident to the same nodes, in parallel. Invoking this method is equivalent to: .

Parameters

gd:LayoutGraph — the graph
 
e1:Edge — the leading edge
 
list:EdgeList — the list of edges that will be aligned to e1
 
lineDistance:Number — the distance between two edges

See also

routeEdgesParallelMultipleJoinEnds()method 
public static function routeEdgesParallelMultipleJoinEnds(gd:LayoutGraph, e1:Edge, list:EdgeList, lineDistance:Number, adjustE1:Boolean, joinEnds:Boolean, absJoinDist:Number, relJoinDist:Number):void

Routes a list of edges which are incident to the same nodes, in parallel.

Parameters

gd:LayoutGraph — the graph
 
e1:Edge — the leading edge
 
list:EdgeList — the list of edges that will be aligned to e1
 
lineDistance:Number — the distance between two edges
 
adjustE1:Boolean — whether e1 should be adjusted if the size of list is odd
 
joinEnds:Boolean — whether the end points should all be set to the end points of e1
 
absJoinDist:Number — the absolute distance between the end points and the beginning to the parallel segment routing
 
relJoinDist:Number — the relative distance, measured relative to the length of the first/last segments

routeSelfLoop()method 
public static function routeSelfLoop(gd:LayoutGraph, e:Edge):void

Routes a self-loop.

Parameters

gd:LayoutGraph
 
e:Edge — An edge with e.source.equals(e.target).

Constant Detail
ALIGN_NODES_CENTEREDConstant
public static const ALIGN_NODES_CENTERED:int = 0

Node alignment policy that results in center aligned nodes.

See also

ALIGN_NODES_DISTRIBUTEDConstant 
public static const ALIGN_NODES_DISTRIBUTED:int = 2

Node alignment policy that results in vertically or horizontally distributed nodes. In this context, distributed means that the vertical (or horizontal) extensions of nodes do not overlap independent of their horizontal (or vertical) position.

See also

ALIGN_NODES_LEADINGConstant 
public static const ALIGN_NODES_LEADING:int = -1

Node alignment policy that results in top aligned nodes for vertical alignment and left aligned nodes for horizontal alignments.

See also

ALIGN_NODES_TRAILINGConstant 
public static const ALIGN_NODES_TRAILING:int = 1

Node alignment policy that results in bottom aligned nodes for vertical alignment and right aligned nodes for horizontal alignments.

See also

CENTERConstant 
public static const CENTER:int = 4

Constant which can be used for arrangeRectangleRowsWithAlignment(). Rectangles in one row will be centered on the row.

See also

FLOW_DOWNConstant 
public static const FLOW_DOWN:int = 0

Edge flow specifier used by method determineEdgeFlowDirection(). This value specifies that the flow direction of most edges is down.

See also

FLOW_LEFTConstant 
public static const FLOW_LEFT:int = 3

Edge flow specifier used by method determineEdgeFlowDirection(). This value specifies that the flow direction of most edges is left.

See also

FLOW_NONEConstant 
public static const FLOW_NONE:int = -1

Edge flow specifier used by method determineEdgeFlowDirection(). This value specifies that there is no main flow direction.

See also

FLOW_RIGHTConstant 
public static const FLOW_RIGHT:int = 1

Edge flow specifier used by method determineEdgeFlowDirection(). This value specifies that the flow direction of most edges is right.

See also

FLOW_UPConstant 
public static const FLOW_UP:int = 2

Edge flow specifier used by method determineEdgeFlowDirection(). This value specifies that the flow direction of most edges is up.

See also

JUSTIFIEDConstant 
public static const JUSTIFIED:int = 3

Constant which can be used for arrangeRectangleRowsWithAlignment(). Rectangles in one row will be justified in the row.

See also

LEADINGConstant 
public static const LEADING:int = 1

Constant which can be used for arrangeRectangleRowsWithAlignment(). Rectangles in one row will be aligned with the leading edge.

See also

MULTI_ROW_HEIGHT_CONSTRAINTConstant 
public static const MULTI_ROW_HEIGHT_CONSTRAINT:int = 1

Constraint specifier constant for the multi-row rectangle arrangement realized by arrangeRectangleMultiRowsWithAlignment() Limits the height of the arrangement to the given preferred height value. If some rectangles are higher than allowed, then they are placed nevertheless, but the constraint will be still considered for the rest and not weakened to the height of the higher rectangles. Having one rectangle being higher than the constraint allows does always result in arrangements consisting only of a single top-level row.

See also

MULTI_ROW_NO_CONSTRAINTConstant 
public static const MULTI_ROW_NO_CONSTRAINT:int = 0

Constraint specifier constant for the multi-row rectangle arrangement realized by arrangeRectangleMultiRowsWithAlignment() Both, height and width, are not limited in size by any constraint. The rectangles will be arranged in a way that the view ratio defined by the preferred height and width will be achieved.

See also

MULTI_ROW_WIDTH_CONSTRAINTConstant 
public static const MULTI_ROW_WIDTH_CONSTRAINT:int = 2

Constraint specifier constant for the multi-row rectangle arrangement realized by arrangeRectangleMultiRowsWithAlignment() Limits the width of the arrangement to the given preferred width value. If a rectangle is wider than allowed, then it will nevertheless be placed (in a row containing the rectangle alone), but the constraint will be still considered for other rows and not weakened.

See also

TRAILINGConstant 
public static const TRAILING:int = 2

Constant which can be used for arrangeRectangleRowsWithAlignment(). Rectangles in one row will be aligned to the trailing edge.

See also