|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.hierarchic.incremental.NodeLayoutDescriptor
public class NodeLayoutDescriptor
This class is used by HierarchicLayouter
during the various phases to provide the drawing details of
the nodes of the graph.
A NodeLayoutDescriptor
instance can be specified individually for single nodes using a
DataProvider
that returns a NodeLayoutDescriptor
instance for each node of the graph, or
null
if no NodeLayoutDescriptor
is bound to an edge. The DataProvider
is
registered with the graph with key HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY
.
This class is designed as a class to allow future additions of new getter methods.
HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY
,
EdgeLayoutDescriptor
Field Summary | |
---|---|
static byte |
NODE_LABEL_MODE_CONSIDER_FOR_DRAWING
A constant that makes the algorithm consider node labels for node placement and routing, but not for self-loops. |
static byte |
NODE_LABEL_MODE_CONSIDER_FOR_ROUTING
A constant that makes the algorithm consider node labels during routing only. |
static byte |
NODE_LABEL_MODE_CONSIDER_FOR_SELF_LOOPS
A constant that makes the algorithm consider node labels for self-loops, node placement and routing. |
static byte |
NODE_LABEL_MODE_NEVER
A constant that prevents node labels from being considered during the layout. |
static byte |
PORT_ASSIGNMENT_DEFAULT
A port assignment strategy that distributes ports evenly along the border of the node. |
static byte |
PORT_ASSIGNMENT_ON_GRID
A port assignment strategy that places all edges on grid lines. |
static byte |
PORT_ASSIGNMENT_ON_SUBGRID
A port assignment strategy that places all edges on grid lines or sub-grid lines. |
Constructor Summary | |
---|---|
NodeLayoutDescriptor()
Creates a new instance of a NodeLayoutDescriptor with the
default values. |
Method Summary | |
---|---|
YPoint |
getGridReference()
Returns the node's reference point that will be placed on a grid coordinate. |
double |
getLayerAlignment()
Returns the alignment of the node of this NodeLayoutDescriptor instance within its layer. |
double |
getMinimumDistance()
Returns the preferred minimum distance to obstacles. |
double |
getMinimumLayerHeight()
Returns the minimum height of the layer to which this node is assigned. |
byte |
getNodeLabelMode()
Returns the mode that determines how node labels are handled by the algorithm during the layout. |
byte |
getPortAssignment()
Returns the assignment strategy which distributes the ports along the node borders. |
double |
getPortBorderGapRatio(int side)
Returns the port border gap ratio for the port distribution at a given side of the node. |
void |
setGridReference(YPoint gridReference)
Specifies the node's reference point that will be placed on a grid coordinate. |
void |
setLayerAlignment(double alignment)
Specifies the alignment of the node of this NodeLayoutDescriptor instance within its layer. |
void |
setMinimumDistance(double distance)
Specifies the preferred minimum distance to obstacles. |
void |
setMinimumLayerHeight(double height)
Specifies the minimum height of the layer to which this node is assigned. |
void |
setNodeLabelMode(byte mode)
Specifies the mode that determines how node labels are handled by the algorithm during the layout. |
void |
setPortAssignment(byte portAssignment)
Specifies the assignment strategy which distributes the ports along the node borders. |
void |
setPortBorderGapRatio(int side,
double ratio)
Specifies the port border gap ratio for the port distribution at a given side of the node. |
void |
setPortBorderGapRatios(double ratio)
Specifies 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 |
---|
public static final byte PORT_ASSIGNMENT_DEFAULT
This is the default port assignment strategy of IncrementalHierarchicLayouter
.
public static final byte PORT_ASSIGNMENT_ON_GRID
If there are not enough grid lines for each port, ports may overlap. In case there is no grid line available at the side of a node, the ports are placed centered at that side.
public static final byte PORT_ASSIGNMENT_ON_SUBGRID
If there are not enough grid lines for each port, the grid gets subdivided with sub-grid lines until each edge has space for its port.
public static final byte NODE_LABEL_MODE_NEVER
It is used by getNodeLabelMode()
and setNodeLabelMode(byte)
.
setNodeLabelMode(byte)
,
Constant Field Valuespublic static final byte NODE_LABEL_MODE_CONSIDER_FOR_SELF_LOOPS
It is used by getNodeLabelMode()
and setNodeLabelMode(byte)
.
setNodeLabelMode(byte)
,
Constant Field Valuespublic static final byte NODE_LABEL_MODE_CONSIDER_FOR_DRAWING
It is used by getNodeLabelMode()
and setNodeLabelMode(byte)
.
setNodeLabelMode(byte)
,
Constant Field Valuespublic static final byte NODE_LABEL_MODE_CONSIDER_FOR_ROUTING
It is used by getNodeLabelMode()
and setNodeLabelMode(byte)
.
setNodeLabelMode(byte)
,
Constant Field ValuesConstructor Detail |
---|
public NodeLayoutDescriptor()
NodeLayoutDescriptor
with the
default values.
Method Detail |
---|
public void setPortBorderGapRatio(int side, double ratio)
This ratio determines the gap between a corner of the node and the first assigned port.
The ratio should be greater than 0
.
A value of 0.0d
results in ports being placed directly on the corner of the node (if there is more
than one port).
A value of 0.5d
results in ports being distributed along the side of the node so that the
distance between the corner of the node and the first port is half as wide as the distance between two adjacent
ports.
A value of Double.POSITIVE_INFINITY
results in all ports being centered at the side in one point.
side
- the zero-based clockwise side index for top-to-bottom layouts (i.e., top is 0)ratio
- the given ratio
java.lang.IllegalArgumentException
- if the given ratio is negativesetPortBorderGapRatios(double)
Port border gap ratio 0.0d - node 1 has port constraint PortConstraint.SOUTH while nodes
2,3,4 have port constraints PortConstraint.NORTH . | Port border gap ratio 0.5d - node 1 has port constraint PortConstraint.SOUTH while nodes
2,3,4 have port constraints PortConstraint.NORTH . |
public void setPortBorderGapRatios(double ratio)
This ratio determines the gap between a corner of the node and the first assigned port.
The ratio should be greater than 0
.
A value of 0.0d
results in ports being placed directly on the corner of the node (if there is more
than one port).
A value of 0.5d
results in ports being distributed along the side of the node so that the
distance between the corner of the node and the first port is half as wide as the distance between two adjacent
ports.
A value of Double.POSITIVE_INFINITY
results in all ports being centered at the side in one point.
ratio
- the given ratio
java.lang.IllegalArgumentException
- if the given ratio is negativesetPortBorderGapRatio(int, double)
Port border gap ratio 0.0d - node 1 has port constraint PortConstraint.WEST and
PortConstraint.EAST while nodes 2,3,4 have port constraints PortConstraint.SOUTH . | Port border gap ratio 0.5d - node 1 has port constraint PortConstraint.WEST and
PortConstraint.EAST while nodes 2,3,4 have port constraints PortConstraint.SOUTH . | Port border gap ratio 0.5d - node 1 has port constraint PortConstraint.WEST and
PortConstraint.EAST while nodes 2,3,4 have port constraints PortConstraint.SOUTH . |
public double getPortBorderGapRatio(int side)
This ratio determines the gap between a corner of the node and the first assigned port.
The ratio should be greater than 0
.
A value of 0.0d
results in ports being placed directly on the corner of the node (if there is more
than one port).
A value of 0.5d
results in ports being distributed along the side of the node so that the
distance between the corner of the node and the first port is half as wide as the distance between two adjacent
ports.
A value of Double.POSITIVE_INFINITY
results in all ports being centered at the side in one point.
side
- the zero-based clockwise side index for top-to-bottom layouts (i.e., top is 0)
setPortBorderGapRatios(double)
,
setPortBorderGapRatio(int, double)
public void setLayerAlignment(double alignment)
node
of this NodeLayoutDescriptor
instance within its layer.
0.0d
corresponds to top-alignment.0.5d
corresponds to center-alignment.1.0d
corresponds to bottom-alignment.
This value should be within [0,1]
interval.
alignment
- a value from [0,1]
interval
java.lang.IllegalArgumentException
- if the alignment is not within [0.0d .. 1.0d]Top-alignment (0.0d) | Center-alignment (0.5d) | Bottom-alignment (1.0d) |
public double getLayerAlignment()
node
of this NodeLayoutDescriptor
instance within its layer.
0.0d
corresponds to top-alignment.0.5d
corresponds to center-alignment.1.0d
corresponds to bottom-alignment.
This value should be within [0,1]
interval.
[0,1]
intervalsetLayerAlignment(double)
public void setNodeLabelMode(byte mode)
IncrementalHierarchicLayouter
is used for the layout, method
IncrementalHierarchicLayouter.setConsiderNodeLabelsEnabled(boolean)
should
be set to true
. Otherwise, one has to assure that e.g., via an instance of
LabelLayoutTranslator
, the algorithm receives the appropriate information.NODE_LABEL_MODE_CONSIDER_FOR_DRAWING
. Node labels will be considered for node placement and
routing, but not for self-loops.mode
- one of the predefined constants
java.lang.IllegalArgumentException
- if the constant is unknown.IncrementalHierarchicLayouter.setConsiderNodeLabelsEnabled(boolean)
public byte getNodeLabelMode()
IncrementalHierarchicLayouter
is used for the layout, method
IncrementalHierarchicLayouter.setConsiderNodeLabelsEnabled(boolean)
should
be set to true
. Otherwise, one has to assure that e.g., via an instance of
LabelLayoutTranslator
, the algorithm receives the appropriate information.IncrementalHierarchicLayouter.setConsiderNodeLabelsEnabled(boolean)
,
setNodeLabelMode(byte)
public void setMinimumLayerHeight(double height)
Values should be equal or greater than 0
.
layer alignments
.height
- a non-negative minimum height
java.lang.IllegalArgumentException
- if the minimum height is negativepublic double getMinimumLayerHeight()
Values should be equal or greater than 0
.
layer alignments
.setMinimumLayerHeight(double)
public void setMinimumDistance(double distance)
Currently, this distance only affects the following scenarios:
The minimum distance should be greater than 0
.
IncrementalHierarchicLayouter.setNodeToNodeDistance(double)
and IncrementalHierarchicLayouter.setNodeToEdgeDistance(double)
, respectively.
If individual spacings around nodes are required, NodeHalo
s can be defined.distance
- the minimum distance to obstacles
java.lang.IllegalArgumentException
- if the minimum length is negativeMinimum distance 5.0 | Minimum distance 50.0 |
public double getMinimumDistance()
Currently, this distance only affects the following scenarios:
The minimum distance should be greater than 0
.
IncrementalHierarchicLayouter.setNodeToNodeDistance(double)
and IncrementalHierarchicLayouter.setNodeToEdgeDistance(double)
, respectively.
If individual spacings around nodes are required, NodeHalo
s can be defined.setMinimumDistance(double)
public YPoint getGridReference()
The reference point is specified as offset to the center of the node.
Hence, if for example the upper left corner of the node should be placed on a grid coordinate,
you have to use -width
/2 as x-offset
and -height
/2 as y-offset.
grid
.public void setGridReference(YPoint gridReference)
The reference point is specified as offset to the center of the node.
Hence, if for example the upper left corner of the node should be placed on a grid coordinate,
you have to use -width
/2 as x-offset
and -height
/2 as y-offset.
grid
.YPoint.ORIGIN
. The reference point is YPoint.ORIGIN
and the center of the
node is placed on the grid.gridReference
- the reference point for grid placement
java.lang.IllegalArgumentException
- if the given grid reference is nullpublic byte getPortAssignment()
PORT_ASSIGNMENT_DEFAULT
, PORT_ASSIGNMENT_ON_GRID
and
PORT_ASSIGNMENT_ON_SUBGRID
are currently only supported in
DefaultPortAllocator
. A custom implementation of
PortAllocator
will have to handle these assignments itself or will
replace them with its own behavior.setPortAssignment(byte)
public void setPortAssignment(byte portAssignment)
PORT_ASSIGNMENT_DEFAULT
, PORT_ASSIGNMENT_ON_GRID
and
PORT_ASSIGNMENT_ON_SUBGRID
are currently only supported in
DefaultPortAllocator
. A custom implementation of
PortAllocator
will have to handle these assignments itself or will
replace them with its own behavior.PORT_ASSIGNMENT_DEFAULT
. Ports are distributed evenly along the border of the node.portAssignment
- one of the predefined port assignment strategies
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |