Search this API

y.layout.hierarchic.incremental
Class DefaultDrawingDistanceCalculator

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

public class DefaultDrawingDistanceCalculator
extends java.lang.Object
implements DrawingDistanceCalculator

This class is a default DrawingDistanceCalculator implementation that is used by HierarchicLayouter to configure the NodePlacer.

 

Constructor Summary
DefaultDrawingDistanceCalculator()
          Creates a new instance of DefaultDrawingDistanceCalculator 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)
          Determines the minimum distance between two Nodes of the same layer.
 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 isAdaptiveMinEdgeDistanceEnabled()
          Returns whether or not an adaptive minimum edge distance is used.
 boolean isCompactionEnabled()
          Returns whether or not the compaction option is enabled.
 boolean isSwimLaneDistanceOptimizationEnabled()
          Returns whether or not to use an optimized minimum distance calculation for swimlane layouts.
 void setAdaptiveMinEdgeDistanceEnabled(boolean adaptiveMinEdgeDistanceEnabled)
          Specifies whether or not an adaptive minimum edge distance is used.
 void setCompactionEnabled(boolean compactionEnabled)
          Specifies whether or not the compaction option is enabled.
 void setEdge2EdgeDistance(double edge2EdgeDistance)
          Specifies the minimum distance between two edges.
 void setNode2EdgeDistance(double node2EdgeDistance)
          Specifies the minimum distance between a Node and an (non-adjacent) Edge.
 void setNode2NodeDistance(double node2NodeDistance)
          Specifies the minimum distance between two Nodes.
 void setSwimLaneDistanceOptimizationEnabled(boolean enabled)
          Specifies whether or not to use an optimized minimum distance calculation for swimlane layouts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDrawingDistanceCalculator

public DefaultDrawingDistanceCalculator()
Creates a new instance of DefaultDrawingDistanceCalculator with default settings.

Method Detail

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)

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)

isAdaptiveMinEdgeDistanceEnabled

public boolean isAdaptiveMinEdgeDistanceEnabled()
Returns whether or not an adaptive minimum edge distance is used.

If this option is enabled the minimum distance between two adjacent edges is the minimum of the current minimum edge distance and the distance of the edges' source/target points.

Returns:
true if an adaptive minimum distance should be used, false otherwise
See Also:
setAdaptiveMinEdgeDistanceEnabled(boolean)

setAdaptiveMinEdgeDistanceEnabled

public void setAdaptiveMinEdgeDistanceEnabled(boolean adaptiveMinEdgeDistanceEnabled)
Specifies whether or not an adaptive minimum edge distance is used.

If this option is enabled the minimum distance between two adjacent edges is the minimum of the current minimum edge distance and the distance of the edges' source/target points.

Default Value:
The default value is true. An adaptive minimum distance is used.
Parameters:
adaptiveMinEdgeDistanceEnabled - true if an adaptive minimum distance should be used, false otherwise

isCompactionEnabled

public boolean isCompactionEnabled()
Returns whether or not the compaction option 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

getMinDistance

public double getMinDistance(LayoutGraph graph,
                             Layer layer,
                             LayoutDataProvider ldp,
                             Node left,
                             Node right)
Determines the minimum distance between two Nodes of the 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 used for querying information
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 distances between Nodes of same layer

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 node2NodeDistance)
Specifies the minimum distance between two Nodes.

Minimum distance should be greater than 0.

Default Value:
The default value is 30.0d.
Parameters:
node2NodeDistance - 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 node2EdgeDistance)
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:
node2EdgeDistance - 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 edge2EdgeDistance)
Specifies the minimum distance between two edges.

Minimum distance should be greater than 0.

Default Value:
The default value is 20.0d.
Parameters:
edge2EdgeDistance - 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

setSwimLaneDistanceOptimizationEnabled

public void setSwimLaneDistanceOptimizationEnabled(boolean enabled)
Specifies whether or not to use an optimized minimum distance calculation for swimlane layouts.

If set to true this instance will report 0.0d as the minimum distance between two nodes if they belong to different swimlanes. This avoids unwanted feedback between different swimlanes during node placement.

Default Value:
The default value is false.
Parameters:
enabled - true if modified distance calculation for swimlane layouts should be used, false otherwise

isSwimLaneDistanceOptimizationEnabled

public boolean isSwimLaneDistanceOptimizationEnabled()
Returns whether or not to use an optimized minimum distance calculation for swimlane layouts.

If set to true this instance will report 0.0d as the minimum distance between two nodes if they belong to different swimlanes. This avoids unwanted feedback between different swimlanes during node placement.

Returns:
true if modified distance calculation for swimlane layouts should be used, false otherwise
See Also:
setSwimLaneDistanceOptimizationEnabled(boolean)

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