org.graffiti.plugins.algorithms.reingoldtilford
Class CenterToCenterEdgeLayoutStrategy

java.lang.Object
  extended by org.graffiti.plugins.algorithms.reingoldtilford.CenterToCenterEdgeLayoutStrategy
All Implemented Interfaces:
EdgeLayoutStrategy

public class CenterToCenterEdgeLayoutStrategy
extends Object
implements EdgeLayoutStrategy

Lays the edges in a straight line between the parent and the respective child.

If stayOnTopSide is false, edges may intersect the siblings of the incident child.

The following pictures show the results of the different assignments of stayOnBottomSide and stayOnTopSide.

!stayOnTopSide && !stayOnBottomSide 

stayOnTopSide && !stayOnBottomSide   

stayOnTopSide && stayOnBottomSide   

Version:
$Revision$ $Date$
Author:
Andreas Gleißner
See Also:
EdgeLayout.CENTER_TO_CENTER, EdgeLayout.CENTER_TO_TOP, EdgeLayout.BOTTOM_TO_TOP

Constructor Summary
CenterToCenterEdgeLayoutStrategy(boolean stayOnTopSide, boolean stayOnBottomSide)
          Creates a new CenterToCenterEdgeLayoutStrategy.
 
Method Summary
 void calculateContours(Tree tree, ReingoldTilfordAlgorithm algorithm)
          Creates and sets the contours of tree.
 void layEdges(Tree tree, double xOrigin, double yOrigin, ReingoldTilfordAlgorithm algorithm)
          Sets the ports and bends for the edges connecting the root node of tree with its subtrees.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CenterToCenterEdgeLayoutStrategy

public CenterToCenterEdgeLayoutStrategy(boolean stayOnTopSide,
                                        boolean stayOnBottomSide)
Creates a new CenterToCenterEdgeLayoutStrategy.

Parameters:
stayOnTopSide - See stayOnTopSide
stayOnBottomSide - See stayOnBottomSide
Method Detail

calculateContours

public void calculateContours(Tree tree,
                              ReingoldTilfordAlgorithm algorithm)
Creates and sets the contours of tree.
Preconditions:
tree must contain at least 1 child.
The children of tree have been combined.

Specified by:
calculateContours in interface EdgeLayoutStrategy
Parameters:
tree - the tree whose contours are set.
algorithm - the Reingold-Tilford algorithm.
See Also:
EdgeLayout.calculateContours(Tree, ReingoldTilfordAlgorithm)

layEdges

public void layEdges(Tree tree,
                     double xOrigin,
                     double yOrigin,
                     ReingoldTilfordAlgorithm algorithm)
Sets the ports and bends for the edges connecting the root node of tree with its subtrees. Implementing methods must not directly query or set coordinates but rather use the methods ReingoldTilfordAlgorithm.createPort(String, double, double) and ReingoldTilfordAlgorithm.createCoordinateAttribute(String, double, double) .

Specified by:
layEdges in interface EdgeLayoutStrategy
Parameters:
tree - the tree layout whose edges are layed out.
xOrigin - the absolute x-coordinate of tree within the coordinate system of Gravisto.
yOrigin - the absolute x-coordinate of tree within the coordinate system of Gravisto.
algorithm - the Reingold-Tilford algorithm.
See Also:
Orientation, EdgeLayout.layEdges(Tree, double, double, ReingoldTilfordAlgorithm)


Generated at 2012-05-30 11:01:25 PM CEST