Search this API

y.layout.hierarchic.incremental
Class NodeLayoutDescriptor

java.lang.Object
  extended by y.layout.hierarchic.incremental.NodeLayoutDescriptor

public class NodeLayoutDescriptor
extends Object

This class is used by HierarchicLayouter during the various phases to determine the drawing details of the graph's nodes.
Note: not all of these values will be used for all kinds of nodes and any kind of algorithm used.
This class is designed as a class to allow for future additions of new getter methods.

See Also:
HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY, EdgeLayoutDescriptor

Field Summary
static byte NODE_LABEL_MODE_CONSIDER_FOR_DRAWING
          Byte constant used by getNodeLabelMode() and setNodeLabelMode(byte).
static byte NODE_LABEL_MODE_CONSIDER_FOR_ROUTING
          Byte constant used by getNodeLabelMode() and setNodeLabelMode(byte).
static byte NODE_LABEL_MODE_CONSIDER_FOR_SELF_LOOPS
          Byte constant used by getNodeLabelMode() and setNodeLabelMode(byte).
static byte NODE_LABEL_MODE_NEVER
          Byte constant used by getNodeLabelMode() and setNodeLabelMode(byte).
 
Constructor Summary
NodeLayoutDescriptor()
          Creates a new instance of a NodeLayoutDescriptor using the default values.
 
Method Summary
 double getLayerAlignment()
          Returns the alignment of the node within its layer Default is 0.5d which results in center-aligned nodes.
 double getMinimumDistance()
          Returns the preferred minimum distance of the node to obstacles.
 double getMinimumLayerHeight()
          Returns the minimum height of the layer this node will be assigned to.
 byte getNodeLabelMode()
          Returns the mode that determines the consideration of node labels during the layout.
 double getPortBorderGapRatio(int side)
          Returns the port border gap ratio for the port distribution at the given side.
 void setLayerAlignment(double alignment)
          Sets the alignment of the node within its layer.
 void setMinimumDistance(double distance)
          Sets the preferred minimum distance to obstacles.
 void setMinimumLayerHeight(double height)
          Sets the minimum height of the layer this node will be assigned to.
 void setNodeLabelMode(byte mode)
          Sets the mode that determines the consideration of node labels during the layout.
 void setPortBorderGapRatio(int side, double ratio)
          Sets the port border gap ratio for the port distribution at the given side.
 void setPortBorderGapRatios(double ratio)
          Sets the port border gap ratio for the port distribution on all sides of the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_LABEL_MODE_NEVER

public static final byte NODE_LABEL_MODE_NEVER
Byte constant used by getNodeLabelMode() and setNodeLabelMode(byte). This mode prevents node labels from being considered during the layout at all.

See Also:
Constant Field Values

NODE_LABEL_MODE_CONSIDER_FOR_SELF_LOOPS

public static final byte NODE_LABEL_MODE_CONSIDER_FOR_SELF_LOOPS
Byte constant used by getNodeLabelMode() and setNodeLabelMode(byte). This mode makes the algorithm consider node labels for self-loops, node placement, and routing.

See Also:
Constant Field Values

NODE_LABEL_MODE_CONSIDER_FOR_DRAWING

public static final byte NODE_LABEL_MODE_CONSIDER_FOR_DRAWING
Byte constant used by getNodeLabelMode() and setNodeLabelMode(byte). This mode makes the algorithm consider node labels for node placement and routing but not for self loops.

See Also:
Constant Field Values

NODE_LABEL_MODE_CONSIDER_FOR_ROUTING

public static final byte NODE_LABEL_MODE_CONSIDER_FOR_ROUTING
Byte constant used by getNodeLabelMode() and setNodeLabelMode(byte). This mode makes the algorithm consider node labels during routing only.

See Also:
Constant Field Values
Constructor Detail

NodeLayoutDescriptor

public NodeLayoutDescriptor()
Creates a new instance of a NodeLayoutDescriptor using the default values.

Method Detail

setPortBorderGapRatio

public void setPortBorderGapRatio(int side,
                                  double ratio)
Sets the port border gap ratio for the port distribution at the given side.

Parameters:
side - the side
ratio - the new ratio

setPortBorderGapRatios

public void setPortBorderGapRatios(double ratio)
Sets the port border gap ratio for the port distribution on all sides of the node.

Parameters:
ratio - the new ratio
See Also:
setPortBorderGapRatio(int, double)

getPortBorderGapRatio

public double getPortBorderGapRatio(int side)
Returns the port border gap ratio for the port distribution at the given side. Default is 0.5d for all sides.

Parameters:
side - the 0-based clockwise side index for top-to-bottom layouts
Returns:
the ratio

setLayerAlignment

public void setLayerAlignment(double alignment)
Sets the alignment of the node within its layer. A value of 0.0d means nodes are aligned at the top of the layer (for top-down drawing). A value of 0.5d results in center-aligned nodes and 1.0d leads to bottom-aligned nodes.

Throws:
IllegalArgumentException - if the alignment is not within [0.0d .. 1.0d]
Parameters:
alignment - the vertical alignment [0.0d .. 1.0d]

getLayerAlignment

public double getLayerAlignment()
Returns the alignment of the node within its layer Default is 0.5d which results in center-aligned nodes.

Returns:
vertical alignment of the node within its layer
See Also:
setLayerAlignment(double)

setNodeLabelMode

public void setNodeLabelMode(byte mode)
Sets the mode that determines the consideration of node labels during the layout. Note that in order to get this feature working the algorithm must be provided information about the layout of the node labels. If IncrementalHierarchicLayouter is used for the layout the IncrementalHierarchicLayouter.setConsiderNodeLabelsEnabled(boolean) should be set to true. Otherwise one has to assure that e.g. via an instanceof LabelLayoutTranslator the algorithm receives the appropriate information. The mode constant can be one of NODE_LABEL_MODE_NEVER, NODE_LABEL_MODE_CONSIDER_FOR_SELF_LOOPS, NODE_LABEL_MODE_CONSIDER_FOR_DRAWING, or NODE_LABEL_MODE_CONSIDER_FOR_ROUTING.

Throws:
IllegalArgumentException - if the constant is unknown.
Parameters:
mode - the new mode constant
See Also:
IncrementalHierarchicLayouter.setConsiderNodeLabelsEnabled(boolean)

getNodeLabelMode

public byte getNodeLabelMode()
Returns the mode that determines the consideration of node labels during the layout.
This can be one of NODE_LABEL_MODE_NEVER, NODE_LABEL_MODE_CONSIDER_FOR_SELF_LOOPS, NODE_LABEL_MODE_CONSIDER_FOR_DRAWING, or NODE_LABEL_MODE_CONSIDER_FOR_ROUTING.
The default is NODE_LABEL_MODE_CONSIDER_FOR_DRAWING.

Returns:
the mode constant as defined in this class
See Also:
setNodeLabelMode(byte), IncrementalHierarchicLayouter.setConsiderNodeLabelsEnabled(boolean)

setMinimumLayerHeight

public void setMinimumLayerHeight(double height)
Sets the minimum height of the layer this node will be assigned to. Note, that this will only affect the drawing if different layerAlignments are present.

Parameters:
height - the minimum height of the layer this node is in.

getMinimumLayerHeight

public double getMinimumLayerHeight()
Returns the minimum height of the layer this node will be assigned to. Note, that this will only affect the drawing if different layerAlignments are present.

Returns:
the minimum height of the layer this node is in.

setMinimumDistance

public void setMinimumDistance(double distance)
Sets the preferred minimum distance to obstacles.

Parameters:
distance - the minimum distance to obstacles

getMinimumDistance

public double getMinimumDistance()
Returns the preferred minimum distance of the node to obstacles. Default is 5.0d.

Returns:
the preferred minimum distance to obstacles

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