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.
var 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. |
groupPadding | 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. |
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 |
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. |
localEdgeProcessing | Separates the x position of edges as they connect to vertices |
WeightedCellSorter | A utility class used to track cells whilst sorting occurs on the weighted sum of their connected edges. |
Functions | |
WeightedCellSorter | Constructs a new weighted cell sorted for the given cell and weight. |
Variables | |
weightedValue | The weighted value of the cell stored. |
nudge | Whether or not to flip equal weight values. |
visited | Whether or not this cell has been visited in the current assignment. |
rankIndex | The index this cell is in the model rank. |
cell | The cell whose median value is being calculated. |
Functions | |
compare | Compares two WeightedCellSorters. |
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. |
mxCompactTreeLayout.prototype.sortOutgoingEdges = function( source, edges )
Called if sortEdges is true to sort the array of outgoing edges in place.
A utility class used to track cells whilst sorting occurs on the weighted sum of their connected edges. Does not violate (x.compareTo(y)==0) == (x.equals(y))
Functions | |
WeightedCellSorter | Constructs a new weighted cell sorted for the given cell and weight. |
Variables | |
weightedValue | The weighted value of the cell stored. |
nudge | Whether or not to flip equal weight values. |
visited | Whether or not this cell has been visited in the current assignment. |
rankIndex | The index this cell is in the model rank. |
cell | The cell whose median value is being calculated. |
Functions | |
compare | Compares two WeightedCellSorters. |
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
Padding added to resized parents.
mxCompactTreeLayout.prototype.groupPadding
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
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
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, visited )
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 )
Constructs a new weighted cell sorted for the given cell and weight.
function WeightedCellSorter( cell, weightedValue )
The weighted value of the cell stored.
WeightedCellSorter.prototype.weightedValue
Whether or not to flip equal weight values.
WeightedCellSorter.prototype.nudge
Whether or not this cell has been visited in the current assignment.
WeightedCellSorter.prototype.visited
The index this cell is in the model rank.
WeightedCellSorter.prototype.rankIndex
The cell whose median value is being calculated.
WeightedCellSorter.prototype.cell
Compares two WeightedCellSorters.
WeightedCellSorter.prototype.compare = function( a, b )
Returns all children in the given parent which do not have incoming edges.
mxGraph.prototype.findTreeRoots = function( parent, isolate, invert )