Search this API

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()


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()
          Returns the distance between edges.
 double getMinDistance(LayoutGraph graph, Layer layer, LayoutDataProvider ldp, Node left, Node right)
          Main interface method.
 double getMinimumFirstSegmentLength()
          Returns the minimum length of the first and last segment of an edge.
 double getNode2EdgeDistance()
          Returns the distance between nodes and edges.
 double getNode2NodeDistance()
          Returns the distance between nodes.
 void initialize(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
          Called to initialize internal data structures.
 void setEdge2EdgeDistance(double edge2EdgeDistance)
          Sets the distance between edges.
 void setMinimumFirstSegmentLength(double minimumFirstSegmentLength)
          Sets the minimum length of the first and last segment of an edge.
 void setNode2EdgeDistance(double node2EdgeDistance)
          Sets the distance between nodes and edges.
 void setNode2NodeDistance(double node2NodeDistance)
          Sets the distance between nodes.
 
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()
Returns the distance between nodes.


setNode2NodeDistance

public void setNode2NodeDistance(double node2NodeDistance)
Sets the distance between nodes.


getNode2EdgeDistance

public double getNode2EdgeDistance()
Returns the distance between nodes and edges.


setNode2EdgeDistance

public void setNode2EdgeDistance(double node2EdgeDistance)
Sets the distance between nodes and edges.


getEdge2EdgeDistance

public double getEdge2EdgeDistance()
Returns the distance between edges.


setEdge2EdgeDistance

public void setEdge2EdgeDistance(double edge2EdgeDistance)
Sets the distance between edges.


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 minimum length of the first and last segment of an edge.


setMinimumFirstSegmentLength

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


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