mxCoordinateAssignment

Sets the horizontal locations of node and edge dummy nodes on each layer.  Uses median down and up weighings as well as heuristics to straighten edges as far as possible.

Summary
mxCoordinateAssignmentSets the horizontal locations of node and edge dummy nodes on each layer.
Functions
mxCoordinateAssignmentCreates a coordinate assignment.
Variables
layoutReference to the enclosing mxHierarchicalLayout.
intraCellSpacingThe minimum buffer between cells on the same rank.
interRankCellSpacingThe minimum distance between cells on adjacent ranks.
parallelEdgeSpacingThe distance between each parallel edge on each ranks for long edges.
maxIterationsThe number of heuristic iterations to run.
prefHozEdgeSepThe preferred horizontal distance between edges exiting a vertex
prefVertEdgeOffThe preferred vertical offset between edges exiting a vertex
minEdgeJettyThe minimum distance for an edge jetty from a vertex
channelBufferThe size of the vertical buffer in the center of inter-rank channels where edge control points should not be placed
jettyPositionsMap of internal edges and (x,y) pair of positions of the start and end jetty for that edge where it connects to the source and target vertices.
orientationThe position of the root ( start ) node(s) relative to the rest of the laid out graph.
initialXThe minimum x position node placement starts at
limitXThe maximum x value this positioning lays up to
currentXDeltaThe sum of x-displacements for the current iteration
widestRankThe rank that has the widest x position
rankTopYInternal cache of top-most values of Y for each rank
rankBottomYInternal cache of bottom-most value of Y for each rank
widestRankValueThe X-coordinate of the edge of the widest rank
rankWidthsThe width of all the ranks
rankYThe Y-coordinate of all the ranks
fineTuningWhether or not to perform local optimisations and iterate multiple times through the algorithm.
nextLayerConnectedCacheA store of connections to the layer above for speed
previousLayerConnectedCacheA store of connections to the layer below for speed
groupPaddingPadding added to resized parents
Functions
executeA basic horizontal coordinate assignment algorithm
minNodePerforms one median positioning sweep in both directions
medianPosPerforms one median positioning sweep in one direction
rankMedianPositionPerforms median minimisation over one rank.
calculatedWeightedValueCalculates the priority the specified cell has based on the type of its cell and the cells it is connected to on the next layer
medianXValueCalculates the median position of the connected cell on the specified rank
initialCoordsSets up the layout in an initial positioning.
rankCoordinatesSets up the layout in an initial positioning.
calculateWidestRankCalculates the width rank in the hierarchy.
minPathStraightens out chains of virtual nodes where possibleacade to those stored after this layout processing step has completed.
repositionValidDetermines whether or not a node may be moved to the specified x position on the specified rank
setCellLocationsSets the cell locations in the facade to those stored after this layout processing step has completed.
localEdgeProcessingSeparates the x position of edges as they connect to vertices
setEdgePositionFixes the control points
setVertexLocationFixes the position of the specified vertex.
processReversedEdgeHook to add additional processing

Functions

mxCoordinateAssignment

function mxCoordinateAssignment(layout,
intraCellSpacing,
interRankCellSpacing,
orientation,
initialX,
parallelEdgeSpacing)

Creates a coordinate assignment.

Arguments

intraCellSpacingthe minimum buffer between cells on the same rank
interRankCellSpacingthe minimum distance between cells on adjacent ranks
orientationthe position of the root node(s) relative to the graph
initialXthe leftmost coordinate node placement starts at

Variables

layout

mxCoordinateAssignment.prototype.layout

Reference to the enclosing mxHierarchicalLayout.

intraCellSpacing

mxCoordinateAssignment.prototype.intraCellSpacing

The minimum buffer between cells on the same rank.  Default is 30.

interRankCellSpacing

mxCoordinateAssignment.prototype.interRankCellSpacing

The minimum distance between cells on adjacent ranks.  Default is 10.

parallelEdgeSpacing

mxCoordinateAssignment.prototype.parallelEdgeSpacing

The distance between each parallel edge on each ranks for long edges.  Default is 10.

maxIterations

mxCoordinateAssignment.prototype.maxIterations

The number of heuristic iterations to run.  Default is 8.

prefHozEdgeSep

mxCoordinateAssignment.prototype.prefHozEdgeSep

The preferred horizontal distance between edges exiting a vertex

prefVertEdgeOff

mxCoordinateAssignment.prototype.prefVertEdgeOff

The preferred vertical offset between edges exiting a vertex

minEdgeJetty

mxCoordinateAssignment.prototype.minEdgeJetty

The minimum distance for an edge jetty from a vertex

channelBuffer

mxCoordinateAssignment.prototype.channelBuffer

The size of the vertical buffer in the center of inter-rank channels where edge control points should not be placed

jettyPositions

mxCoordinateAssignment.prototype.jettyPositions

Map of internal edges and (x,y) pair of positions of the start and end jetty for that edge where it connects to the source and target vertices.  Note this should technically be a WeakHashMap, but since JS does not have an equivalent, housekeeping must be performed before using. i.e. check all edges are still in the model and clear the values.  Note that the y co-ord is the offset of the jetty, not the absolute point

orientation

mxCoordinateAssignment.prototype.orientation

The position of the root ( start ) node(s) relative to the rest of the laid out graph.  Default is mxConstants.DIRECTION_NORTH.

initialX

mxCoordinateAssignment.prototype.initialX

The minimum x position node placement starts at

limitX

mxCoordinateAssignment.prototype.limitX

The maximum x value this positioning lays up to

currentXDelta

mxCoordinateAssignment.prototype.currentXDelta

The sum of x-displacements for the current iteration

widestRank

mxCoordinateAssignment.prototype.widestRank

The rank that has the widest x position

rankTopY

mxCoordinateAssignment.prototype.rankTopY

Internal cache of top-most values of Y for each rank

rankBottomY

mxCoordinateAssignment.prototype.rankBottomY

Internal cache of bottom-most value of Y for each rank

widestRankValue

mxCoordinateAssignment.prototype.widestRankValue

The X-coordinate of the edge of the widest rank

rankWidths

mxCoordinateAssignment.prototype.rankWidths

The width of all the ranks

rankY

mxCoordinateAssignment.prototype.rankY

The Y-coordinate of all the ranks

fineTuning

mxCoordinateAssignment.prototype.fineTuning

Whether or not to perform local optimisations and iterate multiple times through the algorithm.  Default is true.

nextLayerConnectedCache

mxCoordinateAssignment.prototype.nextLayerConnectedCache

A store of connections to the layer above for speed

previousLayerConnectedCache

mxCoordinateAssignment.prototype.previousLayerConnectedCache

A store of connections to the layer below for speed

groupPadding

mxCoordinateAssignment.prototype.groupPadding

Padding added to resized parents

Functions

execute

mxCoordinateAssignment.prototype.execute = function(parent)

A basic horizontal coordinate assignment algorithm

minNode

mxCoordinateAssignment.prototype.minNode = function(model)

Performs one median positioning sweep in both directions

medianPos

mxCoordinateAssignment.prototype.medianPos = function(i,
model)

Performs one median positioning sweep in one direction

Parameters

ithe iteration of the whole process
modelan internal model of the hierarchical layout

rankMedianPosition

mxCoordinateAssignment.prototype.rankMedianPosition = function(rankValue,
model,
nextRankValue)

Performs median minimisation over one rank.

Parameters

rankValuethe layer number of this rank
modelan internal model of the hierarchical layout
nextRankValuethe layer number whose connected cels are to be laid out relative to

calculatedWeightedValue

mxCoordinateAssignment.prototype.calculatedWeightedValue = function(
   currentCell,
   collection
)

Calculates the priority the specified cell has based on the type of its cell and the cells it is connected to on the next layer

Parameters

currentCellthe cell whose weight is to be calculated
collectionthe cells the specified cell is connected to

medianXValue

mxCoordinateAssignment.prototype.medianXValue = function(connectedCells,
rankValue)

Calculates the median position of the connected cell on the specified rank

Parameters

connectedCellsthe cells the candidate connects to on this level
rankValuethe layer number of this rank

initialCoords

mxCoordinateAssignment.prototype.initialCoords = function(facade,
model)

Sets up the layout in an initial positioning.  The ranks are all centered as much as possible along the middle vertex in each rank.  The other cells are then placed as close as possible on either side.

Parameters

facadethe facade describing the input graph
modelan internal model of the hierarchical layout

rankCoordinates

mxCoordinateAssignment.prototype.rankCoordinates = function(rankValue,
graph,
model)

Sets up the layout in an initial positioning.  All the first cells in each rank are moved to the left and the rest of the rank inserted as close together as their size and buffering permits.  This method works on just the specified rank.

Parameters

rankValuethe current rank being processed
graphthe facade describing the input graph
modelan internal model of the hierarchical layout

calculateWidestRank

mxCoordinateAssignment.prototype.calculateWidestRank = function(graph,
model)

Calculates the width rank in the hierarchy.  Also set the y value of each rank whilst performing the calculation

Parameters

graphthe facade describing the input graph
modelan internal model of the hierarchical layout

minPath

mxCoordinateAssignment.prototype.minPath = function(graph,
model)

Straightens out chains of virtual nodes where possibleacade to those stored after this layout processing step has completed.

Parameters

graphthe facade describing the input graph
modelan internal model of the hierarchical layout

repositionValid

mxCoordinateAssignment.prototype.repositionValid = function(model,
cell,
rank,
position)

Determines whether or not a node may be moved to the specified x position on the specified rank

Parameters

modelthe layout model
cellthe cell being analysed
rankthe layer of the cell
positionthe x position being sought

setCellLocations

mxCoordinateAssignment.prototype.setCellLocations = function(graph,
model)

Sets the cell locations in the facade to those stored after this layout processing step has completed.

Parameters

graphthe input graph
modelthe layout model

localEdgeProcessing

mxCoordinateAssignment.prototype.localEdgeProcessing = function(model)

Separates the x position of edges as they connect to vertices

Parameters

modelthe layout model

setEdgePosition

mxCoordinateAssignment.prototype.setEdgePosition = function(cell)

Fixes the control points

setVertexLocation

mxCoordinateAssignment.prototype.setVertexLocation = function(cell)

Fixes the position of the specified vertex.

Parameters

cellthe vertex to position

processReversedEdge

mxCoordinateAssignment.prototype.processReversedEdge = function(graph,
model)

Hook to add additional processing

Parameters

edgethe hierarchical model edge
realEdgethe real edge in the graph
function mxCoordinateAssignment(layout,
intraCellSpacing,
interRankCellSpacing,
orientation,
initialX,
parallelEdgeSpacing)
Creates a coordinate assignment.
mxCoordinateAssignment.prototype.layout
Reference to the enclosing mxHierarchicalLayout.
A hierarchical layout algorithm.
mxCoordinateAssignment.prototype.intraCellSpacing
The minimum buffer between cells on the same rank.
mxCoordinateAssignment.prototype.interRankCellSpacing
The minimum distance between cells on adjacent ranks.
mxCoordinateAssignment.prototype.parallelEdgeSpacing
The distance between each parallel edge on each ranks for long edges.
mxCoordinateAssignment.prototype.maxIterations
The number of heuristic iterations to run.
mxCoordinateAssignment.prototype.prefHozEdgeSep
The preferred horizontal distance between edges exiting a vertex
mxCoordinateAssignment.prototype.prefVertEdgeOff
The preferred vertical offset between edges exiting a vertex
mxCoordinateAssignment.prototype.minEdgeJetty
The minimum distance for an edge jetty from a vertex
mxCoordinateAssignment.prototype.channelBuffer
The size of the vertical buffer in the center of inter-rank channels where edge control points should not be placed
mxCoordinateAssignment.prototype.jettyPositions
Map of internal edges and (x,y) pair of positions of the start and end jetty for that edge where it connects to the source and target vertices.
mxCoordinateAssignment.prototype.orientation
The position of the root ( start ) node(s) relative to the rest of the laid out graph.
mxCoordinateAssignment.prototype.initialX
The minimum x position node placement starts at
mxCoordinateAssignment.prototype.limitX
The maximum x value this positioning lays up to
mxCoordinateAssignment.prototype.currentXDelta
The sum of x-displacements for the current iteration
mxCoordinateAssignment.prototype.widestRank
The rank that has the widest x position
mxCoordinateAssignment.prototype.rankTopY
Internal cache of top-most values of Y for each rank
mxCoordinateAssignment.prototype.rankBottomY
Internal cache of bottom-most value of Y for each rank
mxCoordinateAssignment.prototype.widestRankValue
The X-coordinate of the edge of the widest rank
mxCoordinateAssignment.prototype.rankWidths
The width of all the ranks
mxCoordinateAssignment.prototype.rankY
The Y-coordinate of all the ranks
mxCoordinateAssignment.prototype.fineTuning
Whether or not to perform local optimisations and iterate multiple times through the algorithm.
mxCoordinateAssignment.prototype.nextLayerConnectedCache
A store of connections to the layer above for speed
mxCoordinateAssignment.prototype.previousLayerConnectedCache
A store of connections to the layer below for speed
mxCoordinateAssignment.prototype.groupPadding
Padding added to resized parents
mxCoordinateAssignment.prototype.execute = function(parent)
A basic horizontal coordinate assignment algorithm
mxCoordinateAssignment.prototype.minNode = function(model)
Performs one median positioning sweep in both directions
mxCoordinateAssignment.prototype.medianPos = function(i,
model)
Performs one median positioning sweep in one direction
mxCoordinateAssignment.prototype.rankMedianPosition = function(rankValue,
model,
nextRankValue)
Performs median minimisation over one rank.
mxCoordinateAssignment.prototype.calculatedWeightedValue = function(
   currentCell,
   collection
)
Calculates the priority the specified cell has based on the type of its cell and the cells it is connected to on the next layer
mxCoordinateAssignment.prototype.medianXValue = function(connectedCells,
rankValue)
Calculates the median position of the connected cell on the specified rank
mxCoordinateAssignment.prototype.initialCoords = function(facade,
model)
Sets up the layout in an initial positioning.
mxCoordinateAssignment.prototype.rankCoordinates = function(rankValue,
graph,
model)
Sets up the layout in an initial positioning.
mxCoordinateAssignment.prototype.calculateWidestRank = function(graph,
model)
Calculates the width rank in the hierarchy.
mxCoordinateAssignment.prototype.minPath = function(graph,
model)
Straightens out chains of virtual nodes where possibleacade to those stored after this layout processing step has completed.
mxCoordinateAssignment.prototype.repositionValid = function(model,
cell,
rank,
position)
Determines whether or not a node may be moved to the specified x position on the specified rank
mxCoordinateAssignment.prototype.setCellLocations = function(graph,
model)
Sets the cell locations in the facade to those stored after this layout processing step has completed.
mxCoordinateAssignment.prototype.localEdgeProcessing = function(model)
Separates the x position of edges as they connect to vertices
mxCoordinateAssignment.prototype.setEdgePosition = function(cell)
Fixes the control points
mxCoordinateAssignment.prototype.setVertexLocation = function(cell)
Fixes the position of the specified vertex.
mxCoordinateAssignment.prototype.processReversedEdge = function(graph,
model)
Hook to add additional processing
DIRECTION_NORTH: 'north'
Constant for direction north.
Close