public class DefaultDrawingDistanceCalculator extends Object implements IDrawingDistanceCalculator
IDrawingDistanceCalculator implementation that is used by HierarchicLayoutCore
to configure the INodePlacer.| Constructor and Description |
|---|
DefaultDrawingDistanceCalculator()
Creates a new instance of
DefaultDrawingDistanceCalculator with default settings. |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose(LayoutGraph graph,
ILayers layers,
ILayoutDataProvider ldp)
Disposes of internal data structures.
|
double |
getEdgeToEdgeDistance()
Gets the minimum distance between two edges.
|
double |
getMinDistance(LayoutGraph graph,
ILayer layer,
ILayoutDataProvider ldp,
Node left,
Node right)
Determines the minimum distance between two
Nodes of the same layer. |
double |
getNodeToEdgeDistance()
|
double |
getNodeToNodeDistance()
Gets the minimum distance between two
Nodes. |
void |
initialize(LayoutGraph graph,
ILayers layers,
ILayoutDataProvider ldp)
Initializes internal data structures.
|
boolean |
isAdaptiveMinimumEdgeDistanceEnabled()
Gets whether or not an adaptive minimum edge distance is used.
|
boolean |
isCompactionEnabled()
Gets whether or not the compaction option is enabled.
|
boolean |
isSwimlaneDistanceOptimizationEnabled()
Gets whether or not to use an optimized minimum distance calculation for swimlane layouts.
|
void |
setAdaptiveMinimumEdgeDistanceEnabled(boolean value)
Sets whether or not an adaptive minimum edge distance is used.
|
void |
setCompactionEnabled(boolean value)
Sets whether or not the compaction option is enabled.
|
void |
setEdgeToEdgeDistance(double value)
Sets the minimum distance between two edges.
|
void |
setNodeToEdgeDistance(double value)
|
void |
setNodeToNodeDistance(double value)
Sets the minimum distance between two
Nodes. |
void |
setSwimlaneDistanceOptimizationEnabled(boolean value)
Sets whether or not to use an optimized minimum distance calculation for swimlane layouts.
|
public DefaultDrawingDistanceCalculator()
DefaultDrawingDistanceCalculator with default settings.public void dispose(LayoutGraph graph, ILayers layers, ILayoutDataProvider ldp)
IDrawingDistanceCalculatorImplementations should release internally held data structures when they are not needed any more.
dispose in interface IDrawingDistanceCalculatorgraph - the input graph that contains all elements that are used during the node placementlayers - the ILayers object that will be used during subsequent callsldp - the ILayoutDataProvider implementation which provides access to the INodeData
and IEdgeData instancesIDrawingDistanceCalculator.initialize(LayoutGraph, ILayers, ILayoutDataProvider)public double getEdgeToEdgeDistance()
Minimum distance should be greater than 0.
IllegalArgumentException - if the minimum distance is negativesetEdgeToEdgeDistance(double)public double getMinDistance(LayoutGraph graph, ILayer layer, ILayoutDataProvider ldp, Node left, Node right)
Nodes of the same layer.getMinDistance in interface IDrawingDistanceCalculatorgraph - the input graphlayer - the ILayer object that will be used during subsequent callsldp - the ILayoutDataProvider used for querying informationleft - 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 interestright - 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 interestNodes of same layerpublic double getNodeToEdgeDistance()
Node and an (non-adjacent) Edge.
Minimum distance should be greater than 0.
IllegalArgumentException - if the minimum distance is negativesetNodeToEdgeDistance(double)public double getNodeToNodeDistance()
Nodes.
Minimum distance should be greater than 0.
IllegalArgumentException - if the minimum distance is negativesetNodeToNodeDistance(double)public void initialize(LayoutGraph graph, ILayers layers, ILayoutDataProvider ldp)
IDrawingDistanceCalculatorImplementations may cache lengthy calculations in the initialization phase.
initialize in interface IDrawingDistanceCalculatorgraph - the input graph that contains all elements that are used during the node placementlayers - the ILayers object that will be used during subsequent callsldp - the ILayoutDataProvider implementation which provides access to the INodeData
and IEdgeData instancesIDrawingDistanceCalculator.dispose(LayoutGraph, ILayers, ILayoutDataProvider)public boolean isAdaptiveMinimumEdgeDistanceEnabled()
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.
true. An adaptive minimum distance is used.true if an adaptive minimum distance should be used, false otherwisesetAdaptiveMinimumEdgeDistanceEnabled(boolean)public boolean isCompactionEnabled()
NodeCompaction
or LabelCompactionEnabled
is enabled.false. Compaction is disabled.true if compaction is enabled, false otherwisesetCompactionEnabled(boolean)public boolean isSwimlaneDistanceOptimizationEnabled()
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.
false. true if modified distance calculation for swimlane layouts should be used, false otherwisesetSwimlaneDistanceOptimizationEnabled(boolean)public void setAdaptiveMinimumEdgeDistanceEnabled(boolean value)
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.
true. An adaptive minimum distance is used.value - true if an adaptive minimum distance should be used, false otherwiseisAdaptiveMinimumEdgeDistanceEnabled()public void setCompactionEnabled(boolean value)
NodeCompaction
or LabelCompactionEnabled
is enabled.false. Compaction is disabled.value - true if compaction is enabled, false otherwiseisCompactionEnabled()public void setEdgeToEdgeDistance(double value)
Minimum distance should be greater than 0.
IllegalArgumentException - if the minimum distance is negativevalue - the given minimum distancegetEdgeToEdgeDistance()public void setNodeToEdgeDistance(double value)
Node and an (non-adjacent) Edge.
Minimum distance should be greater than 0.
IllegalArgumentException - if the minimum distance is negativevalue - the minimum distancegetNodeToEdgeDistance()public void setNodeToNodeDistance(double value)
Nodes.
Minimum distance should be greater than 0.
IllegalArgumentException - if the minimum distance is negativevalue - the minimum distancegetNodeToNodeDistance()public void setSwimlaneDistanceOptimizationEnabled(boolean value)
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.
false. value - true if modified distance calculation for swimlane layouts should be used, false otherwiseisSwimlaneDistanceOptimizationEnabled()