y.layout.hierarchic.incremental
Class SimplexNodePlacer

java.lang.Object
  extended by y.layout.hierarchic.incremental.SimplexNodePlacer
All Implemented Interfaces:
NodePlacer

public class SimplexNodePlacer
extends Object
implements NodePlacer

NodePlacer implementation based on rank-assignment. The drawer works with integer values and rounds double values to integers using sophisticated quantizing.

 
Your browser does not support SVG content.

Field Summary
static int GROUP_COMPACTION_MAX
          Compaction strategy specifier for use with setGroupCompactionStrategy(int).
static int GROUP_COMPACTION_NONE
          Compaction strategy specifier for use with setGroupCompactionStrategy(int).
 
Constructor Summary
SimplexNodePlacer()
           
 
Method Summary
 void assignLayerCoordinates(LayoutGraph graph, LayoutDataProvider layoutDataProvider, Layers layers)
          Invoked by HierarchicLayouter before the ports get assigned.
 void assignSequenceCoordinates(LayoutGraph graph, LayoutDataProvider layoutDataProvider, Layers layers, DrawingDistanceCalculator drawingDistanceCalculator)
          Invoked by HierarchicLayouter to determine the resulting x coordinates.
 int getGroupCompactionStrategy()
          Gets the strategy that is used to control the horizontal compactness of group nodes.
protected  double getLayerAlignment(LayoutGraph graph, LayoutDataProvider ldp, Node node, int layerIndex, double minLayerHeight)
          Callback method used by assignLayerCoordinates(LayoutGraph,LayoutDataProvider,Layers) to determine the alignment of the node inside the layer
protected  double getMinDistance(LayoutGraph graph, Layer layer, Node predNode, Node succ)
          Determines the minimum allowed distance between two nodes in a given layer
protected  double getMinimumLayerHeight(LayoutGraph graph, LayoutDataProvider ldp, Layer layer)
          Callback method used by assignLayerCoordinates(LayoutGraph,LayoutDataProvider,Layers) to determine the minimum height of a layer.
 double getSwimLaneCrossingWeight()
          Returns the relative weight of edges crossing a swim lane relative to edges that stay in their lane.
 boolean isBaryCenterModeEnabled()
          Gets the state of the barycenter drawing mode.
 boolean isBreakLongSegmentsEnabled()
           
 boolean isExactPlacementEnforced()
          Returns whether this instance should enforce the placement of nodes at their exact current position, even if this violates minimum distance constraints.
protected  boolean isFixedNode(LayoutGraph graph, LayoutDataProvider provider, Node node, boolean inLayer)
          Callback used by both assignLayerCoordinates(y.layout.LayoutGraph,LayoutDataProvider,Layers) and assignSequenceCoordinates(y.layout.LayoutGraph,LayoutDataProvider,Layers,DrawingDistanceCalculator) to determine whether the given node should be treated as a node with fixed (given) coordinates.
 boolean isHorizontalCompactionEnabled()
           
 void setBaryCenterModeEnabled(boolean enabled)
          Enables or disables the barycenter drawing mode.
 void setBreakLongSegmentsEnabled(boolean breakLongSegmentsEnabled)
           
 void setExactPlacementEnforced(boolean exactPlacementEnforced)
          Determines whether this instance enforces the placement of nodes at their exact current position, even if this violates minimum distance constraints.
 void setGroupCompactionStrategy(int groupCompactionStrategy)
          Sets the strategy that is used to control the horizontal compactness of group nodes.
 void setHorizontalCompactionEnabled(boolean horizontalCompactionEnabled)
           
 void setSwimLaneCrossingWeight(double weight)
          Sets the relative weight of edges crossing a swim lane 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

GROUP_COMPACTION_NONE

public static final int GROUP_COMPACTION_NONE
Compaction strategy specifier for use with setGroupCompactionStrategy(int). This specifies no horizontal group compaction, i.e. group node contents will occupy nearly the same horizontal positions as when not grouped at all.

See Also:
Constant Field Values

GROUP_COMPACTION_MAX

public static final int GROUP_COMPACTION_MAX
Compaction strategy specifier for use with setGroupCompactionStrategy(int). This specifies maximal horizontal group compaction, i.e. the node placer will try to minimimze the horizontally occupied space for a group node.

See Also:
Constant Field Values
Constructor Detail

SimplexNodePlacer

public SimplexNodePlacer()
Method Detail

isHorizontalCompactionEnabled

public boolean isHorizontalCompactionEnabled()

setHorizontalCompactionEnabled

public void setHorizontalCompactionEnabled(boolean horizontalCompactionEnabled)

getGroupCompactionStrategy

public int getGroupCompactionStrategy()
Gets the strategy that is used to control the horizontal compactness of group nodes.

Returns:
One of GROUP_COMPACTION_NONE or GROUP_COMPACTION_MAX.
See Also:
GROUP_COMPACTION_MAX, GROUP_COMPACTION_NONE, setGroupCompactionStrategy(int)

setGroupCompactionStrategy

public void setGroupCompactionStrategy(int groupCompactionStrategy)
Sets the strategy that is used to control the horizontal compactness of group nodes.

Parameters:
groupCompactionStrategy - One of GROUP_COMPACTION_NONE or GROUP_COMPACTION_MAX.
See Also:
GROUP_COMPACTION_MAX, GROUP_COMPACTION_NONE, getGroupCompactionStrategy()

isExactPlacementEnforced

public boolean isExactPlacementEnforced()
Returns whether this instance should enforce the placement of nodes at their exact current position, even if this violates minimum distance constraints. The default is true.

See Also:
setExactPlacementEnforced(boolean)

setExactPlacementEnforced

public void setExactPlacementEnforced(boolean exactPlacementEnforced)
Determines whether this instance enforces the placement of nodes at their exact current position, even if this violates minimum distance constraints. The default is true.

Parameters:
exactPlacementEnforced - whether to enforce exact coordinates

setSwimLaneCrossingWeight

public void setSwimLaneCrossingWeight(double weight)
Sets the relative weight of edges crossing a swim lane relative to edges that stay in their lane. A value of 0.0d (the default) will effectively make the algorithm ignore edges crossing a swim lane border.

Parameters:
weight - the relative weight of an edge crossing a swim lane border [0.0d .. 1.0d]

getSwimLaneCrossingWeight

public double getSwimLaneCrossingWeight()
Returns the relative weight of edges crossing a swim lane relative to edges that stay in their lane. The default value is 0.0d which will effectively make the algorithm ignore edges crossing a swim lane border.

Returns:
the relative weight of an edge crossing a swim lane border [0.0d .. 1.0d]

setBaryCenterModeEnabled

public void setBaryCenterModeEnabled(boolean enabled)
Enables or disables the barycenter drawing mode. If this mode is enabled the resulting drawing is likely to have more bends but may be more symmetric. By default this mode is turned off.

Parameters:
enabled - whether to enable this mode

isBaryCenterModeEnabled

public boolean isBaryCenterModeEnabled()
Gets the state of the barycenter drawing mode. If this mode is enabled the resulting drawing is likely to have more bends but may be more symmetric. By default this mode is turned off.

Returns:
whether the mode is enabled

assignLayerCoordinates

public void assignLayerCoordinates(LayoutGraph graph,
                                   LayoutDataProvider layoutDataProvider,
                                   Layers layers)
Description copied from interface: NodePlacer
Invoked by HierarchicLayouter before the ports get assigned. This method is used to assign preliminary y coordinates for each layer. The 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.

Specified by:
assignLayerCoordinates in interface NodePlacer
Parameters:
graph - the graph that contains the elements
layoutDataProvider - the LayoutDataProvider that contains information about the elements
layers - the Layers that shall be calculated by this method

isFixedNode

protected boolean isFixedNode(LayoutGraph graph,
                              LayoutDataProvider provider,
                              Node node,
                              boolean inLayer)
Callback used by both assignLayerCoordinates(y.layout.LayoutGraph,LayoutDataProvider,Layers) and assignSequenceCoordinates(y.layout.LayoutGraph,LayoutDataProvider,Layers,DrawingDistanceCalculator) to determine whether the given node should be treated as a node with fixed (given) coordinates.

Parameters:
graph - the graph that contains the node
provider - the current LayoutDataProvider
node - the node
inLayer - whether the nodes' layer coordinate is queried or the sequence coordinate. Iff inLayer is true this method is called from within the assignLayerCoordinates(y.layout.LayoutGraph,LayoutDataProvider,Layers) method
Returns:
whether the node should be treated as fixed

getMinimumLayerHeight

protected double getMinimumLayerHeight(LayoutGraph graph,
                                       LayoutDataProvider ldp,
                                       Layer layer)
Callback method used by assignLayerCoordinates(LayoutGraph,LayoutDataProvider,Layers) to determine the minimum height of a layer.


getLayerAlignment

protected double getLayerAlignment(LayoutGraph graph,
                                   LayoutDataProvider ldp,
                                   Node node,
                                   int layerIndex,
                                   double minLayerHeight)
Callback method used by assignLayerCoordinates(LayoutGraph,LayoutDataProvider,Layers) to determine the alignment of the node inside the layer


assignSequenceCoordinates

public void assignSequenceCoordinates(LayoutGraph graph,
                                      LayoutDataProvider layoutDataProvider,
                                      Layers layers,
                                      DrawingDistanceCalculator drawingDistanceCalculator)
Description copied from interface: NodePlacer
Invoked by HierarchicLayouter to determine the resulting x coordinates. This method is invoked after all ports have been assigned their final relative coordinates and nodes have been given relative coordinates within each layer.

Specified by:
assignSequenceCoordinates in interface NodePlacer
Parameters:
graph - the graph that contains the elements
layoutDataProvider - the LayoutDataProvider that contains information about the elements
layers - the Layers that shall be calculated by this method
drawingDistanceCalculator - an instance that can be queried to determine the minimum distance between each pair of nodes in the graph

getMinDistance

protected double getMinDistance(LayoutGraph graph,
                                Layer layer,
                                Node predNode,
                                Node succ)
Determines the minimum allowed distance between two nodes in a given layer

Parameters:
graph - the graph that contains the nodes
layer - the layer that contains the nodes
predNode - the node to the left of the other one, may be null to indicate a border line
succ - the node to the right of the other one, may be null to indicate a border line
Returns:
the minimum distance allowed between those two nodes ( >=0 )
See Also:
DrawingDistanceCalculator

isBreakLongSegmentsEnabled

public boolean isBreakLongSegmentsEnabled()

setBreakLongSegmentsEnabled

public void setBreakLongSegmentsEnabled(boolean breakLongSegmentsEnabled)

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