|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.hierarchic.incremental.SimplexNodePlacer
public class SimplexNodePlacer
This class is a NodePlacer implementation based on rank assignment.
The drawer works with integer values and rounds double values to integers using sophisticated quantizing.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
static int |
GROUP_COMPACTION_MAX
A strategy specifying maximal horizontal group compaction. |
static int |
GROUP_COMPACTION_NONE
A strategy specifying no horizontal group compaction. |
| Constructor Summary | |
|---|---|
SimplexNodePlacer()
|
|
| Method Summary | |
|---|---|
void |
assignLayerCoordinates(LayoutGraph graph,
LayoutDataProvider layoutDataProvider,
Layers layers)
Assigns preliminary y-coordinates for each layer of a hierarchic layout. |
protected void |
assignNodesToSublayer(NodeList layerNodes,
LayoutDataProvider ldp,
LayoutGraph graph,
NodeMap lowerSublayer)
Assigns the nodes of a given layer to the corresponding upper/lower sublayer if node compaction is enabled. |
void |
assignSequenceCoordinates(LayoutGraph graph,
LayoutDataProvider layoutDataProvider,
Layers layers,
DrawingDistanceCalculator drawingDistanceCalculator)
Determines the resulting x-coordinates of a hierarchic layout. |
int |
getGroupCompactionStrategy()
Specifies the strategy used for controlling the horizontal compactness of group nodes. |
protected double |
getLayerAlignment(LayoutGraph graph,
LayoutDataProvider ldp,
Node node,
int layerIndex,
double minLayerHeight)
Returns the alignment of the node with a specified layer. |
long |
getMaximalDuration()
Returns the time limit (in milliseconds) set for the layout algorithm. |
protected double |
getMinDistance(LayoutGraph graph,
Layer layer,
Node predNode,
Node succ)
Specifies the minimum allowed distance between two nodes of the same given layer. |
protected double |
getMinimumLayerHeight(LayoutGraph graph,
LayoutDataProvider ldp,
Layer layer)
Returns the minimum height of a given layer. |
double |
getMinimumSublayerDistance()
Returns the minimum distance between the upper and lower sublayer. |
double |
getSwimLaneCrossingWeight()
Returns the relative weight of edges crossing a swimlane relative to edges that stay in their lane. |
boolean |
isBaryCenterModeEnabled()
Returns whether or not a barycenter drawing mode should be used. |
boolean |
isBendReductionEnabled()
Returns whether or not an optimization step should be applied that tries to further reduce the number of bends. |
boolean |
isBreakLongSegmentsEnabled()
Returns whether or not the SimplexNodePlacer should break long edge segments in favor of a
potentially more compact layout. |
boolean |
isEdgeStraighteningOptimizationEnabled()
Returns whether or not a postprocessing step should be applied to reduce the number of bends. |
boolean |
isExactPlacementEnforced()
Returns whether or not the SimplexNodePlacer enforces the placement of nodes at their
exact current positions, even if this violates minimum distance constraints. |
protected boolean |
isFixedNode(LayoutGraph graph,
LayoutDataProvider provider,
Node node,
boolean inLayer)
Returns whether or not the given node should be treated as a node with fixed (given) coordinates. |
boolean |
isFromSketchLayerAssignment()
Returns whether or not the SimplexNodePlacer should try to use the coordinates given from the current
sketch for the determination of the layer coordinates. |
boolean |
isHorizontalCompactionEnabled()
Returns whether or not the SimplexNodePlacer tries to create a maximally compact horizontal layout at
the cost of more bends. |
boolean |
isLabelCompactionEnabled()
Returns whether or not the SimplexNodePlacer places labels in a more compact style. |
boolean |
isNodeCompactionEnabled()
Returns whether or not nodes should be placed in a more compact style with respect to layout width. |
void |
setBaryCenterModeEnabled(boolean enabled)
Specifies whether or not a barycenter drawing mode should be used. |
void |
setBendReductionEnabled(boolean bendReductionEnabled)
Specifies whether or not an optimization step should be applied that tries to further reduce the number of bends. |
void |
setBreakLongSegmentsEnabled(boolean breakLongSegmentsEnabled)
Specifies whether or not the SimplexNodePlacer should break long edge segments in favor of a
potentially more compact layout. |
void |
setEdgeStraighteningOptimizationEnabled(boolean edgeStraighteningOptimizationEnabled)
Specifies whether or not a postprocessing step should be applied to reduce the number of bends. |
void |
setExactPlacementEnforced(boolean exactPlacementEnforced)
Specifies whether or not the SimplexNodePlacer enforces the placement of nodes at their
exact current positions, even if this violates minimum distance constraints. |
void |
setFromSketchLayerAssignment(boolean fromSketchLayerAssignment)
Specifies whether or not the SimplexNodePlacer should try to use the coordinates given from the current
sketch for the determination of the layer coordinates. |
void |
setGroupCompactionStrategy(int groupCompactionStrategy)
Specifies the strategy used for controlling the horizontal compactness of group nodes. |
void |
setHorizontalCompactionEnabled(boolean horizontalCompactionEnabled)
Specifies whether or not the SimplexNodePlacer tries to create a maximally compact horizontal layout at
the cost of more bends. |
void |
setLabelCompactionEnabled(boolean labelCompactionEnabled)
Specifies whether or not the SimplexNodePlacer places labels in a more compact style. |
void |
setMaximalDuration(long maximalDuration)
Specifies the time limit (in milliseconds) set for the layout algorithm. |
void |
setMinimumSublayerDistance(double minimumSublayerDistance)
Specifies the minimum distance between the upper and lower sublayer. |
void |
setNodeCompactionEnabled(boolean nodeCompactionEnabled)
Specifies whether or not nodes should be placed in a more compact style with respect to layout width. |
void |
setSwimLaneCrossingWeight(double weight)
Specifies the relative weight of edges crossing a swimlane relative to edges that stay in their lane. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int GROUP_COMPACTION_NONE
This means that group node contents will occupy nearly the same horizontal positions as when not grouped at all.
public static final int GROUP_COMPACTION_MAX
This means that the node placer will try to minimize the horizontally occupied space for a group node.
| Constructor Detail |
|---|
public SimplexNodePlacer()
| Method Detail |
|---|
public boolean isNodeCompactionEnabled()
If enabled, the algorithm may place the nodes of a layer in a stacked style (horizontally interleaving), i.e., it splits the layer into an upper and lower sublayer and places adjacent nodes into different sublayers if this reduces the width of the layer.
DrawingDistanceCalculators,
see HierarchicLayouter.setDrawingDistanceCalculator(DrawingDistanceCalculator).true if nodes are placed in a compact style, false otherwisesetNodeCompactionEnabled(boolean),
setMinimumSublayerDistance(double),
assignNodesToSublayer(y.base.NodeList, LayoutDataProvider, y.layout.LayoutGraph, y.base.NodeMap)public void setNodeCompactionEnabled(boolean nodeCompactionEnabled)
If enabled, the algorithm may place the nodes of a layer in a stacked style (horizontally interleaving), i.e., it splits the layer into an upper and lower sublayer and places adjacent nodes into different sublayers if this reduces the width of the layer.
DrawingDistanceCalculators,
see HierarchicLayouter.setDrawingDistanceCalculator(DrawingDistanceCalculator).nodeCompactionEnabled - true if nodes should be placed in a compact style, false otherwisesetMinimumSublayerDistance(double),
assignNodesToSublayer(y.base.NodeList, LayoutDataProvider, y.layout.LayoutGraph, y.base.NodeMap)![]() false | ![]() true |
public double getMinimumSublayerDistance()
A too small distance value may prevent adjacent nodes from being placed in a stacked style
(horizontally interleaving) because the vertical distance between these nodes must be greater than or equal to the value
specified by NodeLayoutDescriptor.getMinimumDistance().
Values should be greater than 0.
is enabled.setMinimumSublayerDistance(double),
setNodeCompactionEnabled(boolean)public void setMinimumSublayerDistance(double minimumSublayerDistance)
A too small distance value may prevent adjacent nodes from being placed in a stacked style
(horizontally interleaving) because the vertical distance between these nodes must be greater than or equal to the value
specified by NodeLayoutDescriptor.getMinimumDistance().
Values should be greater than 0.
is enabled.minimumSublayerDistance - the minimum distance
java.lang.IllegalArgumentException - if minimum sublayer distance is negativesetNodeCompactionEnabled(boolean)![]() Minimum distance 15.0d | ![]() Minimum distance 100.0d |
public boolean isLabelCompactionEnabled()
SimplexNodePlacer places labels in a more compact style.
If this option is enabled the algorithm tries to place adjacent label elements in a stacked style, i.e., horizontally interleaving.
DrawingDistanceCalculators,
see HierarchicLayouter.setDrawingDistanceCalculator(DrawingDistanceCalculator).true if labels are placed compact, false otherwisepublic void setLabelCompactionEnabled(boolean labelCompactionEnabled)
SimplexNodePlacer places labels in a more compact style.
If this option is enabled the algorithm tries to place adjacent label elements in a stacked style, i.e., horizontally interleaving.
DrawingDistanceCalculators,
see HierarchicLayouter.setDrawingDistanceCalculator(DrawingDistanceCalculator).labelCompactionEnabled - true if labels should be placed compact, false otherwisepublic boolean isBendReductionEnabled()
setMaximalDuration(long)) the number of bends is not reduced.IncrementalHierarchicLayouter.TABULAR_GROUPS_DPKEY).true if the bend optimization step is applied, false otherwisesetBendReductionEnabled(boolean),
setMaximalDuration(long)public void setBendReductionEnabled(boolean bendReductionEnabled)
setMaximalDuration(long)) the number of bends is not reduced.IncrementalHierarchicLayouter.TABULAR_GROUPS_DPKEY).bendReductionEnabled - true if the bend optimization step should be applied, false
otherwisesetMaximalDuration(long)public boolean isHorizontalCompactionEnabled()
SimplexNodePlacer tries to create a maximally compact horizontal layout at
the cost of more bends.
For best results, setBreakLongSegmentsEnabled(boolean) and setLabelCompactionEnabled(boolean)
should also be enabled.
true if a maximally compact horizontal layout is created, false otherwiseisHorizontalCompactionEnabled(),
setLabelCompactionEnabled(boolean),
setBreakLongSegmentsEnabled(boolean)public void setHorizontalCompactionEnabled(boolean horizontalCompactionEnabled)
SimplexNodePlacer tries to create a maximally compact horizontal layout at
the cost of more bends.
For best results, setBreakLongSegmentsEnabled(boolean) and setLabelCompactionEnabled(boolean)
should also be enabled.
horizontalCompactionEnabled - true if a maximally compact horizontal layout should be created,
false otherwiseisHorizontalCompactionEnabled(),
setLabelCompactionEnabled(boolean),
setBreakLongSegmentsEnabled(boolean)public boolean isEdgeStraighteningOptimizationEnabled()
Furthermore, enabling this option may violate some minimum distances specified by the user and the edge distribution is no longer uniform.
setNodeCompactionEnabled(boolean) is disabled.true if the number of bends is reduced, false otherwisesetEdgeStraighteningOptimizationEnabled(boolean)public void setEdgeStraighteningOptimizationEnabled(boolean edgeStraighteningOptimizationEnabled)
Furthermore, enabling this option may violate some minimum distances specified by the user and the edge distribution is no longer uniform.
setNodeCompactionEnabled(boolean) is disabled.edgeStraighteningOptimizationEnabled - true if the number of bends should be reduced,
false otherwisefalse | true |
public int getGroupCompactionStrategy()
setBendReductionEnabled(boolean).setGroupCompactionStrategy(int)public void setGroupCompactionStrategy(int groupCompactionStrategy)
setBendReductionEnabled(boolean).GROUP_COMPACTION_NONE. No group compaction is performed.groupCompactionStrategy - one of the predefined compaction strategiespublic boolean isExactPlacementEnforced()
SimplexNodePlacer enforces the placement of nodes at their
exact current positions, even if this violates minimum distance constraints.
true if exact coordinates are enforced, false otherwisesetExactPlacementEnforced(boolean)public void setExactPlacementEnforced(boolean exactPlacementEnforced)
SimplexNodePlacer enforces the placement of nodes at their
exact current positions, even if this violates minimum distance constraints.
exactPlacementEnforced - true if exact coordinates should be enforced, false otherwisepublic boolean isFromSketchLayerAssignment()
SimplexNodePlacer should try to use the coordinates given from the current
sketch for the determination of the layer coordinates.
true if the current sketch is used, false otherwisesetFromSketchLayerAssignment(boolean)public void setFromSketchLayerAssignment(boolean fromSketchLayerAssignment)
SimplexNodePlacer should try to use the coordinates given from the current
sketch for the determination of the layer coordinates.
public long getMaximalDuration()
Values have to be greater than or equal to 0.
setMaximalDuration(long)public void setMaximalDuration(long maximalDuration)
Values have to be greater than or equal to 0.
Long.MAX_VALUE. The layout algorithm runs unrestricted.maximalDuration - a non-negative value that specifies the time limit
java.lang.IllegalArgumentException - if the maximum duration is negativepublic void setSwimLaneCrossingWeight(double weight)
Values should lie within [0,1] interval.
public double getSwimLaneCrossingWeight()
Values should lie within [0,1] interval.
[0,1]setSwimLaneCrossingWeight(double)public void setBaryCenterModeEnabled(boolean enabled)
If this mode is enabled the resulting drawing is likely to have more bends, but may be more symmetric.
public boolean isBaryCenterModeEnabled()
If this mode is enabled the resulting drawing is likely to have more bends, but may be more symmetric.
setBendReductionEnabled(boolean) may produce more symmetric results.true if a barycenter drawing mode is used, false otherwisesetBaryCenterModeEnabled(boolean)
public void assignLayerCoordinates(LayoutGraph graph,
LayoutDataProvider layoutDataProvider,
Layers layers)
NodePlacerThe distance between two layers will be adjusted later by the edge routing algorithm. This method is responsible for assigning the relative positions of the nodes within each layer.
assignLayerCoordinates in interface NodePlacergraph - the input graphlayoutDataProvider - the LayoutDataProvider containing information about the elementslayers - the Layers instance that will be calculated by this method
protected void assignNodesToSublayer(NodeList layerNodes,
LayoutDataProvider ldp,
LayoutGraph graph,
NodeMap lowerSublayer)
node compaction is enabled.
Information about sublayers is given by a NodeMap whose NodeMap.getBool(Object) method
has to return true for each node that should be placed in the lower sublayer
(values are set by this method).
layerNodes - a list of all @link y.layout.hierarchic.incremental.NodeData#TYPE_NORMAL normal nodes}
of a layerldp - the LayoutDataProvider implementation which provides access to the NodeData and
EdgeData instancesgraph - the given graphlowerSublayer - the NodeMap holding sublayer informationsetNodeCompactionEnabled(boolean)
protected boolean isFixedNode(LayoutGraph graph,
LayoutDataProvider provider,
Node node,
boolean inLayer)
This callback method is used by both assignLayerCoordinates(y.layout.LayoutGraph,LayoutDataProvider,Layers)
and assignSequenceCoordinates(y.layout.LayoutGraph,LayoutDataProvider,Layers,DrawingDistanceCalculator).
If inLayer argument is true, this method is called from within the
assignLayerCoordinates(y.layout.LayoutGraph,LayoutDataProvider,Layers) method.
graph - the given graphprovider - the LayoutDataProvider implementation which provides access to the NodeData and
EdgeData instancesnode - the given nodeinLayer - true if the layer coordinate of the node is queried, false if the sequence
coordinate is queried
true if the node should be treated as fixed, false otherwise
protected double getMinimumLayerHeight(LayoutGraph graph,
LayoutDataProvider ldp,
Layer layer)
layer.
This callback method is used by assignLayerCoordinates(LayoutGraph,LayoutDataProvider,Layers).
graph - the given graphldp - the LayoutDataProvider implementation which provides access to the NodeData and
EdgeData instanceslayer - the given Layer object
protected double getLayerAlignment(LayoutGraph graph,
LayoutDataProvider ldp,
Node node,
int layerIndex,
double minLayerHeight)
This callback method is used by assignLayerCoordinates(LayoutGraph,LayoutDataProvider,Layers).
graph - the input graphldp - the LayoutDataProvider implementation which provides access to the NodeData and
EdgeData instancesnode - the given nodelayerIndex - the index of the layerminLayerHeight - the minimum height of the layer
public void assignSequenceCoordinates(LayoutGraph graph,
LayoutDataProvider layoutDataProvider,
Layers layers,
DrawingDistanceCalculator drawingDistanceCalculator)
NodePlacer
The minimum distance between each pair of nodes of the graph is determined by a DrawingDistanceCalculator
instance.
assignSequenceCoordinates in interface NodePlacergraph - the input graphlayoutDataProvider - the LayoutDataProvider containing information about the elementslayers - the Layers instance that will be calculated by this methoddrawingDistanceCalculator - the given DrawingDistanceCalculator instance
protected double getMinDistance(LayoutGraph graph,
Layer layer,
Node predNode,
Node succ)
This callback method is used by assignSequenceCoordinates(LayoutGraph, LayoutDataProvider, Layers, DrawingDistanceCalculator).
graph - the graph that contains the nodeslayer - the layer that contains the nodespredNode - the node to the left of the other one, may be null to indicate a border linesucc - the node to the right of the other one, may be null to indicate a border line
DrawingDistanceCalculatorpublic boolean isBreakLongSegmentsEnabled()
SimplexNodePlacer should break long edge segments in favor of a
potentially more compact layout.
A long edge is an edge that spans multiple layers. For each layer, a dummy node is necessary to model the edge path from source to target.
true if long edges are broken, false otherwisesetBreakLongSegmentsEnabled(boolean)public void setBreakLongSegmentsEnabled(boolean breakLongSegmentsEnabled)
SimplexNodePlacer should break long edge segments in favor of a
potentially more compact layout.
A long edge is an edge that spans multiple layers. For each layer, a dummy node is necessary to model the edge path from source to target.
breakLongSegmentsEnabled - true if long edges should be broken, false otherwise
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||