y.layout.hierarchic.incremental
Class TypeBasedDrawingDistanceCalculator

java.lang.Object
  extended by y.layout.hierarchic.incremental.TypeBasedDrawingDistanceCalculator
All Implemented Interfaces:
DrawingDistanceCalculator

public class TypeBasedDrawingDistanceCalculator
extends Object
implements DrawingDistanceCalculator

This implementation returns the minimum distances for each kind of node pair based on their type as returned by NodeData.getType()

 
Your browser does not support SVG content.

Constructor Summary
TypeBasedDrawingDistanceCalculator()
          Creates a new instance of TypeBasedDrawingDistanceCalculator
 
Method Summary
 void dispose(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
          Called to dispose internal data structures.
 double getEdge2EdgeDistance()
          Getter for property edge2EdgeDistance.
 double getMinDistance(LayoutGraph graph, Layer layer, LayoutDataProvider ldp, Node left, Node right)
          Main interface method.
 double getMinimumFirstSegmentLength()
          Returns the minimumFirstSegmentLength
 double getNode2EdgeDistance()
          Getter for property node2EdgeDistance.
 double getNode2NodeDistance()
          Getter for property node2NodeDistance.
 void initialize(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
          Called to initialize internal data structures.
 void setEdge2EdgeDistance(double edge2EdgeDistance)
          Setter for property edge2EdgeDistance.
 void setMinimumFirstSegmentLength(double minimumFirstSegmentLength)
          Sets the minimum length of the first and last segment of an edge.
 void setNode2EdgeDistance(double node2EdgeDistance)
          Setter for property node2EdgeDistance.
 void setNode2NodeDistance(double node2NodeDistance)
          Setter for property node2NodeDistance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeBasedDrawingDistanceCalculator

public TypeBasedDrawingDistanceCalculator()
Creates a new instance of TypeBasedDrawingDistanceCalculator

Method Detail

getMinDistance

public double getMinDistance(LayoutGraph graph,
                             Layer layer,
                             LayoutDataProvider ldp,
                             Node left,
                             Node right)
Description copied from interface: DrawingDistanceCalculator
Main interface method. Queried by NodePlacer instances to determine the minimum distances between elements in one layer. Note that either of the Node arguments may be null. In that case only the border of the non-null node should be considered.

Specified by:
getMinDistance in interface DrawingDistanceCalculator
Parameters:
graph - the graph that contains the nodes
layer - the layer object that contains the nodes
ldp - the LayoutDataProvider that can be used to query information
left - the left one of the two nodes whose minimum distance is to be determined or null if only the left border of the right node is of interest.
right - the right one of the two nodes whose minimum distance is to be determined or null if only the right border of the left node is of interest.

getNode2NodeDistance

public double getNode2NodeDistance()
Getter for property node2NodeDistance.

Returns:
Value of property node2NodeDistance.

setNode2NodeDistance

public void setNode2NodeDistance(double node2NodeDistance)
Setter for property node2NodeDistance.

Parameters:
node2NodeDistance - New value of property node2NodeDistance.

getNode2EdgeDistance

public double getNode2EdgeDistance()
Getter for property node2EdgeDistance.

Returns:
Value of property node2EdgeDistance.

setNode2EdgeDistance

public void setNode2EdgeDistance(double node2EdgeDistance)
Setter for property node2EdgeDistance.

Parameters:
node2EdgeDistance - New value of property node2EdgeDistance.

getEdge2EdgeDistance

public double getEdge2EdgeDistance()
Getter for property edge2EdgeDistance.

Returns:
Value of property edge2EdgeDistance.

setEdge2EdgeDistance

public void setEdge2EdgeDistance(double edge2EdgeDistance)
Setter for property edge2EdgeDistance.

Parameters:
edge2EdgeDistance - New value of property edge2EdgeDistance.

dispose

public void dispose(LayoutGraph graph,
                    Layers layers,
                    LayoutDataProvider ldp)
Description copied from interface: DrawingDistanceCalculator
Called to dispose internal data structures. Implementations should release internally held data structures here.

Specified by:
dispose in interface DrawingDistanceCalculator
Parameters:
graph - the graph that contains all elements that are used during the node placement
layers - the Layers object that was used
ldp - the LayoutDataProvider that was used to query information
See Also:
DrawingDistanceCalculator.initialize(LayoutGraph, Layers, LayoutDataProvider)

initialize

public void initialize(LayoutGraph graph,
                       Layers layers,
                       LayoutDataProvider ldp)
Description copied from interface: DrawingDistanceCalculator
Called to initialize internal data structures. Implementations may cache lengthy calculations in the initialization phase. It is guaranteed that the graph will not be changed during subsequent calls to DrawingDistanceCalculator.getMinDistance(LayoutGraph, Layer, LayoutDataProvider, Node, Node).

Specified by:
initialize in interface DrawingDistanceCalculator
Parameters:
graph - the graph that contains all elements that are used during the node placement
layers - the Layers object that will be used during subsequent calls
ldp - the LayoutDataProvider that can be used to query information
See Also:
DrawingDistanceCalculator.dispose(LayoutGraph, Layers, LayoutDataProvider)

getMinimumFirstSegmentLength

public double getMinimumFirstSegmentLength()
Returns the minimumFirstSegmentLength

Returns:
the minimum first segment length

setMinimumFirstSegmentLength

public void setMinimumFirstSegmentLength(double minimumFirstSegmentLength)
Sets the minimum length of the first and last segment of an edge.

Parameters:
minimumFirstSegmentLength - the new length

© Copyright 2000-2008,
yWorks GmbH.
All rights reserved.