Extends mxGraphLayout to implement a compact tree (Moen) algorithm. This layout is suitable for graphs that have no cycles (trees). Vertices that are not connected to the tree will be ignored by this layout.
let layout = new mxCompactTreeLayout(graph); layout.execute(graph.getDefaultParent());
mxCompactTreeLayout | Extends mxGraphLayout to implement a compact tree (Moen) algorithm. |
Functions | |
mxCompactTreeLayout | Constructs a new compact tree layout for the specified graph and orientation. |
Variables | |
horizontal | Specifies the orientation of the layout. |
invert | Specifies if edge directions should be inverted. |
resizeParent | If the parents should be resized to match the width/height of the children. |
maintainParentLocation | Specifies if the parent location should be maintained, so that the top, left corner stays the same before and after execution of the layout. |
groupPadding | Padding added to resized parents. |
groupPaddingTop | Top padding added to resized parents. |
groupPaddingRight | Right padding added to resized parents. |
groupPaddingBottom | Bottom padding added to resized parents. |
groupPaddingLeft | Left padding added to resized parents. |
parentsChanged | A set of the parents that need updating based on children process as part of the layout. |
moveTree | Specifies if the tree should be moved to the top, left corner if it is inside a top-level layer. |
visited | Specifies if the tree should be moved to the top, left corner if it is inside a top-level layer. |
levelDistance | Holds the levelDistance. |
nodeDistance | Holds the nodeDistance. |
resetEdges | Specifies if all edge points of traversed edges should be removed. |
prefHozEdgeSep | The preferred horizontal distance between edges exiting a vertex. |
prefVertEdgeOff | The preferred vertical offset between edges exiting a vertex. |
minEdgeJetty | The minimum distance for an edge jetty from a vertex. |
channelBuffer | The size of the vertical buffer in the center of inter-rank channels where edge control points should not be placed. |
edgeRouting | Whether or not to apply the internal tree edge routing. |
sortEdges | Specifies if edges should be sorted according to the order of their opposite terminal cell in the model. |
alignRanks | Whether or not the tops of cells in each rank should be aligned across the rank |
maxRankHeight | An array of the maximum height of cells (relative to the layout direction) per rank |
root | The cell to use as the root of the tree |
node | The internal node representation of the root cell. |
Functions | |
isVertexIgnored | Returns a boolean indicating if the given mxCell should be ignored as a vertex. |
isHorizontal | Returns horizontal. |
execute | Implements mxGraphLayout.execute. |
moveNode | Moves the specified node and all of its children by the given amount. |
sortOutgoingEdges | Called if sortEdges is true to sort the array of outgoing edges in place. |
findRankHeights | Stores the maximum height (relative to the layout direction) of cells in each rank |
setCellHeights | Set the cells heights (relative to the layout direction) when the tops of each rank are to be aligned |
dfs | Does a depth first search starting at the specified cell. |
layout | Starts the actual compact tree layout algorithm at the given node. |
horizontalLayout | |
verticalLayout | |
attachParent | |
layoutLeaf | |
join | |
merge | |
offset | |
bridge | |
createNode | |
apply | |
createLine | |
adjustParents | Adjust parent cells whose child geometries have changed. |
localEdgeProcessing | Moves the specified node and all of its children by the given amount. |
processNodeOutgoing | Separates the x position of edges as they connect to vertices |
mxCompactTreeLayout.prototype.isHorizontal = function()
Returns horizontal.
mxCompactTreeLayout.prototype.execute = function( parent, root )
Implements mxGraphLayout.execute.
If the parent has any connected edges, then it is used as the root of the tree. Else, mxGraph.findTreeRoots will be used to find a suitable root node within the set of children of the given parent.
parent | mxCell whose children should be laid out. |
root | Optional mxCell that will be used as the root of the tree. Overrides root if specified. |
mxCompactTreeLayout.prototype.sortOutgoingEdges = function( source, edges )
Called if sortEdges is true to sort the array of outgoing edges in place.
Constructs a new compact tree layout for the specified graph and orientation.
function mxCompactTreeLayout( graph, horizontal, invert )
Specifies the orientation of the layout.
mxCompactTreeLayout.prototype.horizontal
Specifies if edge directions should be inverted.
mxCompactTreeLayout.prototype.invert
If the parents should be resized to match the width/height of the children.
mxCompactTreeLayout.prototype.resizeParent
Specifies if the parent location should be maintained, so that the top, left corner stays the same before and after execution of the layout.
mxCompactTreeLayout.prototype.maintainParentLocation
Padding added to resized parents.
mxCompactTreeLayout.prototype.groupPadding
Top padding added to resized parents.
mxCompactTreeLayout.prototype.groupPaddingTop
Right padding added to resized parents.
mxCompactTreeLayout.prototype.groupPaddingRight
Bottom padding added to resized parents.
mxCompactTreeLayout.prototype.groupPaddingBottom
Left padding added to resized parents.
mxCompactTreeLayout.prototype.groupPaddingLeft
A set of the parents that need updating based on children process as part of the layout.
mxCompactTreeLayout.prototype.parentsChanged
Specifies if the tree should be moved to the top, left corner if it is inside a top-level layer.
mxCompactTreeLayout.prototype.moveTree
Specifies if the tree should be moved to the top, left corner if it is inside a top-level layer.
mxCompactTreeLayout.prototype.visited
Holds the levelDistance.
mxCompactTreeLayout.prototype.levelDistance
Holds the nodeDistance.
mxCompactTreeLayout.prototype.nodeDistance
Specifies if all edge points of traversed edges should be removed.
mxCompactTreeLayout.prototype.resetEdges
The preferred horizontal distance between edges exiting a vertex.
mxCompactTreeLayout.prototype.prefHozEdgeSep
The preferred vertical offset between edges exiting a vertex.
mxCompactTreeLayout.prototype.prefVertEdgeOff
The minimum distance for an edge jetty from a vertex.
mxCompactTreeLayout.prototype.minEdgeJetty
The size of the vertical buffer in the center of inter-rank channels where edge control points should not be placed.
mxCompactTreeLayout.prototype.channelBuffer
Whether or not to apply the internal tree edge routing.
mxCompactTreeLayout.prototype.edgeRouting
Specifies if edges should be sorted according to the order of their opposite terminal cell in the model.
mxCompactTreeLayout.prototype.sortEdges
Whether or not the tops of cells in each rank should be aligned across the rank
mxCompactTreeLayout.prototype.alignRanks
An array of the maximum height of cells (relative to the layout direction) per rank
mxCompactTreeLayout.prototype.maxRankHeight
The cell to use as the root of the tree
mxCompactTreeLayout.prototype.root
The internal node representation of the root cell.
mxCompactTreeLayout.prototype.node
Returns a boolean indicating if the given mxCell should be ignored as a vertex.
mxCompactTreeLayout.prototype.isVertexIgnored = function( vertex )
Returns horizontal.
mxCompactTreeLayout.prototype.isHorizontal = function()
Implements mxGraphLayout.execute.
mxCompactTreeLayout.prototype.execute = function( parent, root )
Executes the layout algorithm for the children of the given parent.
mxGraphLayout.prototype.execute = function( parent )
Moves the specified node and all of its children by the given amount.
mxCompactTreeLayout.prototype.moveNode = function( node, dx, dy )
Called if sortEdges is true to sort the array of outgoing edges in place.
mxCompactTreeLayout.prototype.sortOutgoingEdges = function( source, edges )
Stores the maximum height (relative to the layout direction) of cells in each rank
mxCompactTreeLayout.prototype.findRankHeights = function( node, rank )
Set the cells heights (relative to the layout direction) when the tops of each rank are to be aligned
mxCompactTreeLayout.prototype.setCellHeights = function( node, rank )
Does a depth first search starting at the specified cell.
mxCompactTreeLayout.prototype.dfs = function( cell, parent )
Starts the actual compact tree layout algorithm at the given node.
mxCompactTreeLayout.prototype.layout = function( node )
mxCompactTreeLayout.prototype.horizontalLayout = function( node, x0, y0, bounds )
mxCompactTreeLayout.prototype.verticalLayout = function( node, parent, x0, y0, bounds )
mxCompactTreeLayout.prototype.attachParent = function( node, height )
mxCompactTreeLayout.prototype.layoutLeaf = function( node )
mxCompactTreeLayout.prototype.join = function( node )
mxCompactTreeLayout.prototype.merge = function( p1, p2 )
mxCompactTreeLayout.prototype.offset = function( p1, p2, a1, a2, b1, b2 )
mxCompactTreeLayout.prototype.bridge = function( line1, x1, y1, line2, x2, y2 )
mxCompactTreeLayout.prototype.createNode = function( cell )
mxCompactTreeLayout.prototype.apply = function( node, bounds )
mxCompactTreeLayout.prototype.createLine = function( dx, dy, next )
Adjust parent cells whose child geometries have changed.
mxCompactTreeLayout.prototype.adjustParents = function()
Moves the specified node and all of its children by the given amount.
mxCompactTreeLayout.prototype.localEdgeProcessing = function( node )
Separates the x position of edges as they connect to vertices
mxCompactTreeLayout.prototype.processNodeOutgoing = function( node )
Returns all children in the given parent which do not have incoming edges.
mxGraph.prototype.findTreeRoots = function( parent, isolate, invert )