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 java.lang.Object
implements DrawingDistanceCalculator

This class is a DrawingDistanceCalculator implementation that 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 with default settings.
 
Method Summary
 void dispose(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
          Disposes of internal data structures.
 double getEdge2EdgeDistance()
          Returns the minimum distance between two edges.
 double getMinDistance(LayoutGraph graph, Layer layer, LayoutDataProvider ldp, Node left, Node right)
          Main interface method called by NodePlacer instances to determine the minimum distance between Nodes of same layer.
 double getMinimumFirstSegmentLength()
          Returns the minimum length of the first segment of the edge path (at the source node).
 double getNode2EdgeDistance()
          Returns the minimum distance between a Node and an (non-adjacent) Edge.
 double getNode2NodeDistance()
          Returns the minimum distance between two Nodes.
 void initialize(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
          Initializes internal data structures.
 boolean isCompactionEnabled()
          Returns whether or not the compaction option is enabled.
 void setCompactionEnabled(boolean compactionEnabled)
          Specifies whether or not the compaction option is enabled.
 void setEdge2EdgeDistance(double edgeToEdgeDistance)
          Specifies the minimum distance between two edges.
 void setMinimumFirstSegmentLength(double minimumFirstSegmentLength)
          Specifies the minimum length of the first segment of the edge path (at the source node).
 void setNode2EdgeDistance(double nodeToEdgeDistance)
          Specifies the minimum distance between a Node and an (non-adjacent) Edge.
 void setNode2NodeDistance(double nodeToNodeDistance)
          Specifies the minimum distance between two 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 with default settings.

Method Detail

getMinDistance

public double getMinDistance(LayoutGraph graph,
                             Layer layer,
                             LayoutDataProvider ldp,
                             Node left,
                             Node right)
Description copied from interface: DrawingDistanceCalculator
Main interface method called by NodePlacer instances to determine the minimum distance between Nodes of same layer.

Specified by:
getMinDistance in interface DrawingDistanceCalculator
Parameters:
graph - the input graph
layer - the Layer object that will be used during subsequent calls
ldp - the LayoutDataProvider implementation which provides access to the NodeData and EdgeData instances
left - the left 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 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
Returns:
the minimum distance between two Nodes of the same layer

isCompactionEnabled

public boolean isCompactionEnabled()
Returns whether or not the compaction option is enabled.

 
This option is automatically set by the layout algorithm if option SimplexNodePlacer.setNodeCompactionEnabled(boolean) or SimplexNodePlacer.setLabelCompactionEnabled(boolean) is enabled.
Returns:
true if compaction is enabled, false otherwise
See Also:
setCompactionEnabled(boolean)

setCompactionEnabled

public void setCompactionEnabled(boolean compactionEnabled)
Specifies whether or not the compaction option is enabled.

 
This option is automatically set by the layout algorithm if option SimplexNodePlacer.setNodeCompactionEnabled(boolean) or SimplexNodePlacer.setLabelCompactionEnabled(boolean) is enabled.
Default Value:
The default value is false. Compaction is disabled.
Parameters:
compactionEnabled - true if compaction is enabled, false otherwise
See Also:
SimplexNodePlacer.setNodeCompactionEnabled(boolean), SimplexNodePlacer.setLabelCompactionEnabled(boolean)

getNode2NodeDistance

public double getNode2NodeDistance()
Returns the minimum distance between two Nodes.

Minimum distance should be greater than 0.

Returns:
the minimum distance
See Also:
setNode2NodeDistance(double)

setNode2NodeDistance

public void setNode2NodeDistance(double nodeToNodeDistance)
Specifies the minimum distance between two Nodes.

Minimum distance should be greater than 0.

Default Value:
The default value is 30.0d.
Parameters:
nodeToNodeDistance - the given minimum distance
Throws:
java.lang.IllegalArgumentException - if the minimum distance is negative
Sample Graphs:

Minimum node to node distance 30

Minimum node to node distance 10

getNode2EdgeDistance

public double getNode2EdgeDistance()
Returns the minimum distance between a Node and an (non-adjacent) Edge.

Minimum distance should be greater than 0.

Returns:
the minimum distance
See Also:
setNode2EdgeDistance(double)

setNode2EdgeDistance

public void setNode2EdgeDistance(double nodeToEdgeDistance)
Specifies the minimum distance between a Node and an (non-adjacent) Edge.

Minimum distance should be greater than 0.

Default Value:
The default value is 15.0d.
Parameters:
nodeToEdgeDistance - the given minimum distance
Throws:
java.lang.IllegalArgumentException - if the minimum distance is negative
Sample Graphs:

Minimum node to edge distance 15

Minimum node to edge distance 100

getEdge2EdgeDistance

public double getEdge2EdgeDistance()
Returns the minimum distance between two edges.

Minimum distance should be greater than 0.

Returns:
the given minimum distance

setEdge2EdgeDistance

public void setEdge2EdgeDistance(double edgeToEdgeDistance)
Specifies the minimum distance between two edges.

Minimum distance should be greater than 0.

Default Value:
The default value is 10.0d.
Parameters:
edgeToEdgeDistance - the given minimum distance
Throws:
java.lang.IllegalArgumentException - if the minimum distance is negative
Sample Graphs:

Minimum edge to edge distance 10

Minimum edge to edge distance 100

dispose

public void dispose(LayoutGraph graph,
                    Layers layers,
                    LayoutDataProvider ldp)
Description copied from interface: DrawingDistanceCalculator
Disposes of internal data structures.

Implementations should release internally held data structures when they are not needed any more.

Specified by:
dispose in interface DrawingDistanceCalculator
Parameters:
graph - the input 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 implementation which provides access to the NodeData and EdgeData instances
See Also:
DrawingDistanceCalculator.initialize(LayoutGraph, Layers, LayoutDataProvider)

initialize

public void initialize(LayoutGraph graph,
                       Layers layers,
                       LayoutDataProvider ldp)
Description copied from interface: DrawingDistanceCalculator
Initializes internal data structures.

Implementations may cache lengthy calculations in the initialization phase.

Specified by:
initialize in interface DrawingDistanceCalculator
Parameters:
graph - the input 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 implementation which provides access to the NodeData and EdgeData instances
See Also:
DrawingDistanceCalculator.dispose(LayoutGraph, Layers, LayoutDataProvider)

getMinimumFirstSegmentLength

public double getMinimumFirstSegmentLength()
Returns the minimum length of the first segment of the edge path (at the source node).

The minimum length should be greater than 0.

If the value is 0.0d the first segment does not need to be orthogonal.

Returns:
the minimum length of the first segment
See Also:
setMinimumFirstSegmentLength(double)

setMinimumFirstSegmentLength

public void setMinimumFirstSegmentLength(double minimumFirstSegmentLength)
Specifies the minimum length of the first segment of the edge path (at the source node).

The minimum length should be greater than 0.

If the value is 0.0d the first segment does not need to be orthogonal.

Default Value:
The default value is 15.0d.
Parameters:
minimumFirstSegmentLength - the minimum length of the first segment
Throws:
java.lang.IllegalArgumentException - if the minimum length of the first segment is negative
Sample Graphs:

Minimum first segment length 10

Minimum first segment length 50

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