|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.layout.hierarchic.AbstractDrawer | +--y.layout.hierarchic.PendularDrawer
This class implements the third phase of the sugiyama layout algorithm as described in "Visualisierungstechniken fuer den Compilerbau" (Georg Sander) mixed with techniques as described in "A technique for drawing directed graphs" (Gansner et al)
Field Summary | |
protected NodeMap |
left
map that maps the left node for each node in a layer or null if it is the leftmost |
protected NodeMap |
right
map that maps the right node for each node in a layer or null if it is the rightmost |
Fields inherited from class y.layout.hierarchic.AbstractDrawer |
distanceToNextNode, dummyMap, edgeLengthKey, graph, minimalEdgeDistance, minimalLayerDistance, minimalMultiEdgeDistance, minimalNodeDistance |
Fields inherited from interface y.layout.hierarchic.Drawer |
NODE_BORDER_BOTTOM, NODE_BORDER_LEFT, NODE_BORDER_RIGHT, NODE_BORDER_TOP, NODE_DISTANCE |
Constructor Summary | |
PendularDrawer()
empty constructor, does nothing |
Method Summary | |
protected void |
assignCoordinates(NodeList[] layerLists,
DataProvider layerID)
This is the main loop of this layoutalgorithm. |
protected void |
disposeStructures()
Cleans up previously allocated structures, that were constructed by a call to initStructures |
protected YList |
findChains()
Finds chains of nodes, i.e. maximum number of adjacent nodes (real ones and dummy nodes) have indegree and outdegree 1. |
protected double |
getEdgeWeight(Edge e)
This method returns a non-negative value for each Edge e. |
protected double |
getMaximumExtent(Node n,
boolean toLeft)
Calculates the highest or lowest x-coordinate the Node n can be assigned to, without breaking the constraints. |
protected double |
getMinimalLayerDistance(Node n,
boolean toLeft)
Returns the minimum distance between two Nodes on the same layer according to getMinimalNodeDistance(), getMinimalEdgeDistance() and getMinimalMultiEdgeDistance(). |
protected double |
getPendulumForce(Node v,
EdgeCursor ec)
Helper method which calculates the force that all nodes given by EdgeCursor apply to v. |
protected double |
getPendulumForce(YCursor cursor,
int direction)
Helper method which calculates the force acting on all nodes given by the cursor. |
protected double |
getZ()
This method calculates the function whose value this algorithm should minimize. |
protected void |
initializePositions(NodeList[] layerList)
Helper method which initializes the positions of the nodes in all layers. |
protected void |
initStructures()
used to initialize internal structures such as NodeMap right and
NodeMap left bendGridWidth and nodeGridWidth .
|
protected boolean |
isSegmentNode(Node n)
Helper method that determines wether a node is a socalled segmentnode. |
protected void |
minNode()
Performs the minNode phase. |
protected boolean |
minPath(YList segments)
Performs the minPath phase. |
protected void |
move(Node n,
double distance)
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 wether to use nodeGridWith or bendGridWith |
protected void |
move(YCursor nodes,
double distance)
Helper method which moves the nodes provided by the Cursor nodes by the given amount. |
protected YList |
partitionLayer(NodeList layer,
int direction)
Partitions a layer given by its NodeList by calculating the forces according to the given direction. |
protected void |
setLayoutGraph(LayoutGraph g)
|
protected void |
shakePartition(YList partition,
int direction)
Shakes a given partition of a Layer, i.e. it calculates the forces for each part of the partition and applies them if possible. |
protected boolean |
straightenPath(ListCell firstCell,
ListCell lastCell,
double[] range)
Helper method for use in minPath .
|
protected boolean |
touches(Node v1,
Node v2)
Helper method which checks wether two adjacent nodes on a layer touch each other, i.e. their distance is smaller than getMinimalLayerDistance(v1, ...) |
protected double |
verifyMovement(Node n,
double distance)
Assures that if distance was applied to the n's x-coordinate no given constraint gets broken. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected NodeMap right
null
if it is the rightmost
protected NodeMap left
null
if it is the leftmost
Constructor Detail |
public PendularDrawer()
Method Detail |
protected void initStructures()
NodeMap right
and
NodeMap left
bendGridWidth
and nodeGridWidth
.
Note that the NodeMaps do not yet contain any values unless you call initializePositions()
protected void assignCoordinates(NodeList[] layerLists, DataProvider layerID)
assignCoordinates
in class AbstractDrawer
layerLists
- a list of all the nodes for each layer, to determine
their relative positionsprotected void disposeStructures()
initStructures
PendularDrawer.initStructures()
protected boolean minPath(YList segments)
segments
- a list of NodeList each containing a chain of nodes
true
iff there was a change in any coordinate of the graphPendularDrawer.findChains()
protected YList findChains()
PendularDrawer.minPath(YList)
protected boolean straightenPath(ListCell firstCell, ListCell lastCell, double[] range)
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 doublecheck whether the given
range is valid for all nodes.
firstCell
- this determines the first Node in a NodeList
which should be assigned a new x-coordinatelastCell
- 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-coordinaterange
- 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
true
iff this method has done any change to the graphs
coordinatesPendularDrawer.minPath(YList)
protected boolean isSegmentNode(Node n)
n
- the Node
protected void minNode()
protected void shakePartition(YList partition, int direction)
partition
- a List of NodeLists each containing at least one node
belonging to a single layerdirection
- -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 usedPendularDrawer.partitionLayer(NodeList,int)
,
PendularDrawer.getPendulumForce(YCursor, int)
protected YList partitionLayer(NodeList layer, int direction)
layer
- the layer which shall be partitioneddirection
- -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
PendularDrawer.getPendulumForce(YCursor, int)
,
PendularDrawer.touches(Node,Node)
,
PendularDrawer.shakePartition(YList,int direction)
protected void setLayoutGraph(LayoutGraph g)
protected double getPendulumForce(Node v, EdgeCursor ec)
v
- the node for which the force will be calculatedec
- the EdgeCursor which determines which edges should be
considered in the calculation
PendularDrawer.getEdgeWeight(Edge)
protected boolean touches(Node v1, Node v2)
v1
- one nodev2
- another node
true
iff their distance is smaller than
getMinimalLayerDistance+EPSILONPendularDrawer.getMinimalLayerDistance(Node,boolean)
protected double verifyMovement(Node n, double distance)
n
- the node to be moveddistance
- the distance which shall be verified
PendularDrawer.getMinimalLayerDistance(Node,boolean)
protected double getPendulumForce(YCursor cursor, int direction)
cursor
- the nodes for which the force will be calculateddirection
- -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
protected void move(Node n, double distance)
n
- the nodedistance
- the distance that shall be added to the nodes x-coordinateprotected void move(YCursor nodes, double distance)
nodes
- the nodesdistance
- the distance that shall be added to the nodes x-coordinatePendularDrawer.move(Node,double)
protected double getZ()
protected double getEdgeWeight(Edge e)
segmentEndFactor * 1
.
Edges between two dummy nodes get an edge weight of segmentFactor * 1
.
One could implement edgeweights by supplying an EdgeMap
mapping a non-negative
numeric value for each edge.
e
- the edge
protected double getMaximumExtent(Node n, boolean toLeft)
n
- the nodetoLeft
- true
if the minimum x-coordinate shall be calculated;
false
for the maximum x-coordinate
protected double getMinimalLayerDistance(Node n, boolean toLeft)
n
- the nodetoLeft
- true
if the minimum x-coordinate shall be calculated;
false
for the maximum x-coordinate
AbstractDrawer.getMinimalMultiEdgeDistance()
,
AbstractDrawer.getMinimalNodeDistance()
,
AbstractDrawer.getMinimalEdgeDistance()
protected void initializePositions(NodeList[] layerList)
layerList
- an array of NodeLists each corresponding to a single layer
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |