Package | com.yworks.yfiles.layout.hierarchic |
Class | public class PendularDrawer |
Inheritance | PendularDrawer AbstractDrawer YObject Object |
Property | Defined By | ||
---|---|---|---|
distanceToNextNode : NodeMap
Stores the minimal distance between the right border of a node and the left border of its right hand side neighbor in a layer. | AbstractDrawer | ||
_dummyMap : NodeMap
See dummyMap
| AbstractDrawer | ||
_edgeLengthKey : Object
The key to the data provider, which stores the length of the edges. | AbstractDrawer | ||
graph : LayoutGraph
The graph bound to this drawer instance. | AbstractDrawer | ||
layoutGraph : LayoutGraph [write-only] | PendularDrawer | ||
left : NodeMap
map that maps the left node for each node in a layer or null if it is the leftmost
| PendularDrawer | ||
_minimalEdgeDistance : Number
The minimal distance between two edges in the same layer. | AbstractDrawer | ||
_minimalLayerDistance : Number
The minimal distance between two layers. | AbstractDrawer | ||
_minimalMultiEdgeDistance : Number
The minimal distance between two edges sharing source/target in the same layer. | AbstractDrawer | ||
_minimalNodeDistance : Number
The minimal distance between two nodes in the same layer. | AbstractDrawer | ||
right : NodeMap
map that maps the right node for each node in a layer or null if it is the rightmost
| PendularDrawer |
Method | Defined By | ||
---|---|---|---|
PendularDrawer(init:Boolean = true)
empty constructor, does nothing
| PendularDrawer | ||
Binds the specified graph to this drawer and calls the abstract method assignFinalCoordinates()
| AbstractDrawer | ||
assignYCoords(graph:LayoutGraph, layerLists:Vector.<Object>):void
Assign the y coordinates to the nodes respecting the minimal layer distance. | AbstractDrawer | ||
assignYCoords2(graph:LayoutGraph, layers:Vector.<Object>):void
Assign the y coordinates to the nodes respecting the minimal layer distance. | AbstractDrawer | ||
equals(o:Object):Boolean | YObject | ||
getBottomBorder(v:Node):Number
Returns the height of the bottom border of the given node. | AbstractDrawer | ||
getBottomHalf(v:Node):Number
Returns the height of the border-obeying bottom half of the node,
| AbstractDrawer | ||
getBottomY(v:Node):Number
Returns the border obeying bottom y-coordinate of the given node. | AbstractDrawer | ||
getClass():Class [override] | PendularDrawer | ||
getFullHeight(v:Node):Number
Returns the border obeying full height of the given node. | AbstractDrawer | ||
getFullWidth(v:Node):Number
Returns the border obeying full width of the given node. | AbstractDrawer | ||
getLeftBorder(v:Node):Number
Returns the width of the left border of the given node. | AbstractDrawer | ||
getLeftHalf(v:Node):Number
Returns the width of the border-obeying left half of the node,
| AbstractDrawer | ||
Returns the border obeying left x-coordinate of the given node. | AbstractDrawer | ||
getRightBorder(v:Node):Number
Returns the width of the right border of the given node. | AbstractDrawer | ||
getRightHalf(v:Node):Number
Returns the width of the border-obeying right half of the node,
| AbstractDrawer | ||
Returns the border obeying right x-coordinate of the given node. | AbstractDrawer | ||
getTopBorder(v:Node):Number
Returns the height of the top border of the given node. | AbstractDrawer | ||
getTopHalf(v:Node):Number
Returns the height of the border-obeying top half of the node,
| AbstractDrawer | ||
Returns the border obeying top y-coordinate of the given node. | AbstractDrawer | ||
hashCode():int | YObject | ||
[static]
empty constructor, does nothing
| PendularDrawer |
Method | Defined By | ||
---|---|---|---|
assignFinalCoordinates(layerLists:Vector.<Object>, layerID:DataProvider):void [override]
This is the main loop of this layout algorithm. | PendularDrawer | ||
dispose():void
Frees allocated resources after the drawer is finished. | AbstractDrawer | ||
disposeStructures():void
Cleans up previously allocated structures, that were constructed by a call to initStructures
| PendularDrawer | ||
Finds chains of nodes, i.e. | PendularDrawer | ||
getDistanceToNextNode(v:Node):Number
Returns the minimal distance between the right border of the given node and the left border of its right hand side neighbor in the layer. | AbstractDrawer | ||
getEdgeWeight(e:Edge):Number
Returns a non-negative value for each Edge e. | PendularDrawer | ||
getMaximumExtent(n:Node, toLeft:Boolean):Number
Calculates the highest or lowest x-coordinate the Node n can be assigned to, without breaking the constraints. | PendularDrawer | ||
getMinimalLayerDistance(n:Node, toLeft:Boolean):Number
Returns the minimum distance between two Nodes on the same layer according to getMinimalNodeDistance(), getMinimalEdgeDistance() and getMinimalMultiEdgeDistance(). | PendularDrawer | ||
getPendulumForce(cursor:YCursor, direction:int):Number
Helper method which calculates the force acting on all nodes given by the cursor. | PendularDrawer | ||
Helper method which calculates the force that all nodes given by EdgeCursor apply to v. | PendularDrawer | ||
getZ():Number
Calculates the value of the function this algorithm should minimize. | PendularDrawer | ||
initAbstractDrawer():void | AbstractDrawer | ||
initializeDistancesToNextNode(layerLists:Vector.<Object>):void
Initializes the minimal distances between the right border of a node and the left border of its right hand side neighbor in a layer. | AbstractDrawer | ||
initializePositions(layerList:Vector.<Object>):void
Helper method which initializes the positions of the nodes in all layers. | PendularDrawer | ||
initPendularDrawer():void
Initializes this object. | PendularDrawer | ||
initStructures():void
used to initialize internal structures such as NodeMap right and NodeMap left bendGridWidth and nodeGridWidth. | PendularDrawer | ||
isSegmentNode(n:Node):Boolean
Helper method that determines whether a node is a so-called segment node. | PendularDrawer | ||
minNode():void
Performs the minNode phase. | PendularDrawer | ||
Performs the minPath phase. | PendularDrawer | ||
Helper method which moves a given node by a given amount if the useGrid is set to true, this method will snap the new node position to the appropriate grid, i.e. | PendularDrawer | ||
moveMultiple(nodes:YCursor, distance:Number):void
Helper method which moves the nodes provided by the Cursor nodes by the given amount. | PendularDrawer | ||
Partitions a layer given by its NodeList by calculating the forces according to the given direction. | PendularDrawer | ||
shakePartition(partition:YList, direction:int):void
Shakes a given partition of a Layer, i.e. | PendularDrawer | ||
Helper method for use in minPath. | PendularDrawer | ||
Helper method which checks whether two adjacent nodes on a layer touch each other, i.e. | PendularDrawer | ||
verifyMovement(n:Node, distance:Number):Number
Assures that if distance was applied to the n's x-coordinate no given constraint gets broken. | PendularDrawer |
layoutGraph | property |
layoutGraph:LayoutGraph
[write-only] protected function set layoutGraph(value:LayoutGraph):void
left | property |
protected var left:NodeMap
map that maps the left node for each node in a layer or null
if it is the leftmost
right | property |
protected var right:NodeMap
map that maps the right node for each node in a layer or null
if it is the rightmost
PendularDrawer | () | Constructor |
public function PendularDrawer(init:Boolean = true)
empty constructor, does nothing
Parametersinit:Boolean (default = true ) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods.
This parameter can safely be ignored/omitted when calling the constructor.
|
assignFinalCoordinates | () | method |
override protected function assignFinalCoordinates(layerLists:Vector.<Object>, layerID:DataProvider):void
This is the main loop of this layout algorithm. For now it does the following loop:
Parameters
layerLists:Vector.<Object> — a list of all the nodes for each layer, to determine their relative positions
| |
layerID:DataProvider |
disposeStructures | () | method |
protected function disposeStructures():void
Cleans up previously allocated structures, that were constructed by a call to initStructures
See also
findChains | () | method |
protected function findChains():YList
Finds chains of nodes, i.e. maximum number of adjacent nodes (real ones and dummy nodes) have indegree and outdegree 1.
ReturnsYList — a list of NodeLists containing each more than 1 nodes
|
See also
getClass | () | method |
override public function getClass():Class
ReturnsClass |
getEdgeWeight | () | method |
protected function getEdgeWeight(e:Edge):Number
Returns a non-negative value for each Edge e.
In this implementation edges between two real nodes result in an edge weight of 1. Edges between one dummy and one real node result in an edge weight of segmentEndFactor * 1
. Edges between two dummy nodes get an edge weight of segmentFactor * 1
. One could implement edge weights by supplying an EdgeMap
mapping a non-negative numeric value for each edge.
Parameters
e:Edge — the edge
|
Number — a non-negative value
|
getMaximumExtent | () | method |
protected function getMaximumExtent(n:Node, toLeft:Boolean):Number
Calculates the highest or lowest x-coordinate the Node n can be assigned to, without breaking the constraints.
Parameters
n:Node — the node
| |
toLeft:Boolean — true if the minimum x-coordinate shall be calculated; false for the maximum x-coordinate
|
Number — the maximum/minimum extent of the node's center x-coordinate
|
getMinimalLayerDistance | () | method |
protected function getMinimalLayerDistance(n:Node, toLeft:Boolean):Number
Returns the minimum distance between two Nodes on the same layer according to getMinimalNodeDistance(), getMinimalEdgeDistance() and getMinimalMultiEdgeDistance().
Parameters
n:Node — the node
| |
toLeft:Boolean — true if the minimum x-coordinate shall be calculated; false for the maximum x-coordinate
|
Number — the maximum/minimum extent of the node's center x-coordinate
|
See also
getPendulumForce | () | method |
protected function getPendulumForce(cursor:YCursor, direction:int):Number
Helper method which calculates the force acting on all nodes given by the cursor. The force is calculated by the sum of the results of calls to getPendulumForce(Node, int) divided by the number of the nodes.
Parameters
cursor:YCursor — the nodes for which the force will be calculated
| |
direction:int — -1 if nodes in higher layers should be used to calculate the forces, 1 if nodes in lower layers should be used, 0 if both surrounding layers should be used
|
Number — a force, i.e. a signed value, which, if applied to the nodes in cursor, would minimize the force acting on them.
|
getPendulumForceOnNode | () | method |
protected function getPendulumForceOnNode(v:Node, ec:EdgeCursor):Number
Helper method which calculates the force that all nodes given by EdgeCursor apply to v. The force is calculated by the sum of the weighted differences of the x-coordinates.
Parameters
v:Node — the node for which the force will be calculated
| |
ec:EdgeCursor — the EdgeCursor which determines which edges should be considered in the calculation
|
Number — a force, i.e. a signed value, which (if added to the x-coordinate of v) would minimize the force on v if applied.
|
See also
getZ | () | method |
protected function getZ():Number
Calculates the value of the function this algorithm should minimize.
ReturnsNumber — a positive value.
|
initializePositions | () | method |
protected function initializePositions(layerList:Vector.<Object>):void
Helper method which initializes the positions of the nodes in all layers. This method respects getMinimalLayerDistance(Node,boolean) and compacts the graph to the leftmost position (0)
Parameters
layerList:Vector.<Object> — an array of NodeLists each corresponding to a single layer
|
initPendularDrawer | () | method |
protected final function initPendularDrawer():void
Initializes this object. See the documentation of the corresponding factory method newPendularDrawer()
for details.
See also
initStructures | () | method |
protected function initStructures():void
used to initialize internal structures such as NodeMap right
and NodeMap left
bendGridWidth
and nodeGridWidth
.
Note that the NodeMaps do not yet contain any values unless you call initializePositions()
isSegmentNode | () | method |
protected function isSegmentNode(n:Node):Boolean
Helper method that determines whether a node is a so-called segment node.
Parameters
n:Node — the Node
|
Boolean — true iff (inDegree == 1 && outDegree < 2) || (outDegree == 1 && inDegree < 2)
|
minNode | () | method |
protected function minNode():void
Performs the minNode phase. It uses a queue, which is initially filled with all nodes in the layout graph. For each Node n that is popped off the queue it performs a call to
minPath | () | method |
protected function minPath(segments:YList):Boolean
Performs the minPath phase. It tries to straighten the chains given by a list of NodeLists, by sequentially assigning the same x- coordinate to as many adjacent nodes of each chain as possible, not violating the constraints and not changing coordinates of nodes in the neighborhood of each segment
Parameters
segments:YList — a list of NodeList each containing a chain of nodes
|
Boolean — true iff there was a change in any coordinate of the graph
|
See also
move | () | method |
protected function move(n:Node, distance:Number):void
Helper method which moves a given node by a given amount if the useGrid is set to true, this method will snap the new node position to the appropriate grid, i.e. it decides whether to use nodeGridWith or bendGridWith
Parameters
n:Node — the node
| |
distance:Number — the distance that shall be added to the nodes x-coordinate
|
moveMultiple | () | method |
protected function moveMultiple(nodes:YCursor, distance:Number):void
Helper method which moves the nodes provided by the Cursor nodes by the given amount. This one in turn calls move(Node,double) to delegate its work.
Parameters
nodes:YCursor — the nodes
| |
distance:Number — the distance that shall be added to the nodes x-coordinate
|
See also
newPendularDrawer | () | method |
public static function newPendularDrawer():PendularDrawer
empty constructor, does nothing
ReturnsPendularDrawer |
partitionLayer | () | method |
protected function partitionLayer(layer:NodeList, direction:int):YList
Partitions a layer given by its NodeList by calculating the forces according to the given direction. This one is intended for use with the shakePartition() method.
Parameters
layer:NodeList — the layer which shall be partitioned
| |
direction:int — -1 if nodes in higher layers should be used to calculate the forces, 1 if nodes in lower layers should be used, 0 if both surrounding layers should be used
|
YList — a list of NodeLists each containing adjacent nodes in that layer, which can be treated as a single unit when moving
|
See also
shakePartition | () | method |
protected function shakePartition(partition:YList, direction:int):void
Shakes a given partition of a Layer, i.e. it calculates the forces for each part of the partition and applies them if possible. It uses the functionality of these methods:
Parameters
partition:YList — a List of NodeLists each containing at least one node belonging to a single layer
| |
direction:int — -1 if nodes in higher layers should be used to calculate the forces, 1 if nodes in lower layers should be used, 0 if both surrounding layers should be used
|
See also
straightenPath | () | method |
protected function straightenPath(firstCell:ListCell, lastCell:ListCell, range:Vector.<Number>):Boolean
Helper method for use in minPath
.
It will assign the same x-coordinate to all the nodes given the first and the last cell in NodeList. Note that this method does not double-check whether the given range is valid for all nodes.
Parameters
firstCell:ListCell — this determines the first Node in a NodeList which should be assigned a new x-coordinate
| |
lastCell:ListCell — this determines the last Node in a NodeList (which must be same List as the one for firstCell) which should be assigned a new x-coordinate
| |
range:Vector.<Number> — an interval providing information of the legal range, the Nodes x-coordinates could be set to. The values can can be smaller than (-Double.MAX_VALUE) for the left border and greater than Double.MAX_VALUE for the right one
|
Boolean — true iff this method has done any change to the graphs coordinates
|
See also
touches | () | method |
protected function touches(v1:Node, v2:Node):Boolean
Helper method which checks whether two adjacent nodes on a layer touch each other, i.e. their distance is smaller than getMinimalLayerDistance(v1, ...)
Parameters
v1:Node — one node
| |
v2:Node — another node
|
Boolean — true iff their distance is smaller than getMinimalLayerDistance+EPSILON
|
See also
verifyMovement | () | method |
protected function verifyMovement(n:Node, distance:Number):Number
Assures that if distance was applied to the n's x-coordinate no given constraint gets broken. It makes extensive use of getMinimalLayerDistance(v1, ...)
Parameters
n:Node — the node to be moved
| |
distance:Number — the distance which shall be verified
|
Number — the distance which can be applied to n without breaking any constraint
|
See also