Search this API

y.layout.hierarchic.incremental
Class RoutingStyle

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

public class RoutingStyle
extends java.lang.Object

This class is used by EdgeLayoutDescriptor to specify the routing style for different types of edges.

See Also:
EdgeLayoutDescriptor.setRoutingStyle(RoutingStyle), EdgeData.getType()
 

Field Summary
static byte EDGE_STYLE_CURVED
          A routing style constant specifying that the edges should be curved.
static byte EDGE_STYLE_OCTILINEAR
          A routing style constant specifying that the edges should be octilinear.
static byte EDGE_STYLE_ORTHOGONAL
          A routing style constant specifying that the edges should be orthogonal.
static byte EDGE_STYLE_POLYLINE
          A routing style constant specifying that the edges should be polyline.
 
Constructor Summary
RoutingStyle(byte routingStyle)
          Creates a new RoutingStyle instance with the given routing style for each edge.
RoutingStyle(byte routingStyle, boolean controlPointCreation)
          Creates a new RoutingStyle instance with the given routing style for each edge and also specifying whether or not the resulting path should consist of cubic bezier control points.
 
Method Summary
 byte getBackloopRoutingStyle()
          Returns the routing style for back-loop edges.
 double getCurveUTurnSymmetry()
          Returns how symmetric u-turn parts of curved routes should preferably be.
 byte getDefaultEdgeRoutingStyle()
          Returns the default routing style for edges that have no individual routing style.
 byte getEdgeGroupRoutingStyle()
          Returns the routing style for grouped edges at the common segments.
 byte getSameLayerEdgeRoutingStyle()
          Returns the routing style for same-layer edges.
 byte getSelfloopRoutingStyle()
          Returns the routing style for self-loops.
 byte getSourceCurveConnectionStyle()
          Returns the style which determines how curved edge paths connect at the source side of the edge.
 byte getTargetCurveConnectionStyle()
          Returns the style which determines how curved edge paths connect at the target side of the edge.
 boolean isControlPointCreationEnabled()
          Returns whether or not the points of the resulting edge path represent cubic bezier control points.
 boolean isCurveShortcutsAllowed()
          Returns whether or not curved edges may shortcut and introduce additional edge crossings to make curves more direct and smoother.
 void setBackloopRoutingStyle(byte backloopRoutingStyle)
          Specifies the routing style for back-loop edges.
 void setControlPointCreationEnabled(boolean controlPointCreation)
          Specifies whether or not the points of the resulting edge path represent cubic bezier control points.
 void setCurveShortcutsAllowed(boolean curveShortcutsAllowed)
          Specifies whether or not curved edges may shortcut and introduce additional edge crossings to make curves more direct and smoother.
 void setCurveUTurnSymmetry(double curveUTurnSymmetry)
          Specifies how symmetric u-turn parts of curved routes should preferably be.
 void setDefaultEdgeRoutingStyle(byte defaultEdgeRoutingStyle)
          Specifies the default routing style for edges that have no individual routing style.
 void setEdgeGroupRoutingStyle(byte edgeGroupRoutingStyle)
          Specifies the routing style for grouped edges at the common segments.
 void setSameLayerEdgeRoutingStyle(byte sameLayerEdgeRoutingStyle)
          Specifies the routing style for same-layer edges.
 void setSelfloopRoutingStyle(byte selfloopRoutingStyle)
          Specifies the routing style for self-loops.
 void setSourceCurveConnectionStyle(byte curveConnectionStyle)
          Specifies the style which determines how curved edge paths connect at the source side of the edge.
 void setTargetCurveConnectionStyle(byte curveConnectionStyle)
          Specifies the style which determines how curved edge paths connect at the target side of the edge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDGE_STYLE_ORTHOGONAL

public static final byte EDGE_STYLE_ORTHOGONAL
A routing style constant specifying that the edges should be orthogonal. Orthogonal edges only consist of vertical and horizontal segments.

See Also:
Constant Field Values
Sample Graph:

Routing style orthogonal

EDGE_STYLE_OCTILINEAR

public static final byte EDGE_STYLE_OCTILINEAR
A routing style constant specifying that the edges should be octilinear. Octilinear edges consist of vertical and horizontal segments as well as segments with slope -1 and 1.

See Also:
Constant Field Values
Sample Graph:

Routing style octilinear

EDGE_STYLE_POLYLINE

public static final byte EDGE_STYLE_POLYLINE
A routing style constant specifying that the edges should be polyline.

See Also:
Constant Field Values
Sample Graph:

Routing style polyline

EDGE_STYLE_CURVED

public static final byte EDGE_STYLE_CURVED
A routing style constant specifying that the edges should be curved.

Curved edges are constructed using cubic bezier splines. As for other routing styles, overlaps with other elements are avoided. If there is very little space for a smooth curve, it can happen that the resulting path is polyline or almost polyline with little curving. To reserve more space for curved edges, one can increase values of settings that influence the distances between graph elements, e.g., EdgeLayoutDescriptor.getMinimumDistance().

When integrated edge labeling is enabled, for edge labels a straight, non-curved segment where the label is placed will be inserted. All the settings of the PreferredPlacementDescriptor are supported. Similarly, for the minimum first segment length and the minimum last segment length, a straight edge segment is created to fulfill the constraints.

 
Compared to the other routing styles, the curved routing style may significantly increase the runtime, especially for graphs with a large number of edges.
 
If the bends should actually be interpreted as bezier points, i.e. to let the visualization create the spline curves, enable setControlPointCreationEnabled(boolean)
See Also:
Constant Field Values
Sample Graph:

Routing style curved
Constructor Detail

RoutingStyle

public RoutingStyle(byte routingStyle)
Creates a new RoutingStyle instance with the given routing style for each edge.

Parameters:
routingStyle - one of the predefined routing styles
Throws:
java.lang.IllegalArgumentException - if an unknown routing style is given

RoutingStyle

public RoutingStyle(byte routingStyle,
                    boolean controlPointCreation)
Creates a new RoutingStyle instance with the given routing style for each edge and also specifying whether or not the resulting path should consist of cubic bezier control points.

Parameters:
routingStyle - one of the predefined routing styles
controlPointCreation - true if the resulting path should consist of cubic bezier control points, false otherwise
Throws:
java.lang.IllegalArgumentException - if an unknown routing style is given
Method Detail

getBackloopRoutingStyle

public byte getBackloopRoutingStyle()
Returns the routing style for back-loop edges.

This style is used for routing U-turns of common edges (i.e., edges that are neither self-loops nor same-layer edges). A U-turn is a non-monotonic part of the edge route that is required for reversed edges if option IncrementalHierarchicLayouter.setBackloopRoutingEnabled(boolean) is enabled or in some other scenarios with port constraints/candidates.

Returns:
one of the predefined routing styles
See Also:
setBackloopRoutingStyle(byte)

setBackloopRoutingStyle

public void setBackloopRoutingStyle(byte backloopRoutingStyle)
Specifies the routing style for back-loop edges.

This style is used for routing U-turns of common edges (i.e., edges that are neither self-loops nor same-layer edges). A U-turn is a non-monotonic part of the edge route that is required for reversed edges if option IncrementalHierarchicLayouter.setBackloopRoutingEnabled(boolean) is enabled or in some other scenarios with port constraints/candidates.

Parameters:
backloopRoutingStyle - one of the predefined routing styles
Throws:
java.lang.IllegalArgumentException - if an unknown routing style is given

getEdgeGroupRoutingStyle

public byte getEdgeGroupRoutingStyle()
Returns the routing style for grouped edges at the common segments.

More precisely, grouped edges are routed in a bus-style fashion (i.e., the paths of the edges will share a common edge segment) and this option allows to specify the routing style at the bus.

Returns:
one of the predefined routing styles
See Also:
setEdgeGroupRoutingStyle(byte)

setEdgeGroupRoutingStyle

public void setEdgeGroupRoutingStyle(byte edgeGroupRoutingStyle)
Specifies the routing style for grouped edges at the common segments.

More precisely, grouped edges are routed in a bus-style fashion (i.e., the paths of the edges will share a common edge segment) and this option allows to specify the routing style at the bus.

Parameters:
edgeGroupRoutingStyle - one of the predefined routing styles
Throws:
java.lang.IllegalArgumentException - if an unknown routing style is given

getDefaultEdgeRoutingStyle

public byte getDefaultEdgeRoutingStyle()
Returns the default routing style for edges that have no individual routing style.

Returns:
one of the predefined routing styles

setDefaultEdgeRoutingStyle

public void setDefaultEdgeRoutingStyle(byte defaultEdgeRoutingStyle)
Specifies the default routing style for edges that have no individual routing style.

Parameters:
defaultEdgeRoutingStyle - one of the predefined routing styles
Throws:
java.lang.IllegalArgumentException - if an unknown routing style is given

getSameLayerEdgeRoutingStyle

public byte getSameLayerEdgeRoutingStyle()
Returns the routing style for same-layer edges.

A same-layer edge is an edge whose source/target are assigned to the same layer.

Returns:
one of the predefined routing styles
See Also:
setSameLayerEdgeRoutingStyle(byte)

setSameLayerEdgeRoutingStyle

public void setSameLayerEdgeRoutingStyle(byte sameLayerEdgeRoutingStyle)
Specifies the routing style for same-layer edges.

A same-layer edge is an edge whose source/target are assigned to the same layer.

Parameters:
sameLayerEdgeRoutingStyle - one of the predefined routing styles
Throws:
java.lang.IllegalArgumentException - if an unknown routing style is given

getSelfloopRoutingStyle

public byte getSelfloopRoutingStyle()
Returns the routing style for self-loops.

Returns:
one of the predefined routing styles
See Also:
setSelfloopRoutingStyle(byte)

setSelfloopRoutingStyle

public void setSelfloopRoutingStyle(byte selfloopRoutingStyle)
Specifies the routing style for self-loops.

Parameters:
selfloopRoutingStyle - one of the predefined routing styles
Throws:
java.lang.IllegalArgumentException - if an unknown routing style is given

getSourceCurveConnectionStyle

public byte getSourceCurveConnectionStyle()
Returns the style which determines how curved edge paths connect at the source side of the edge.

 
When specifying style CurveConnectionStyle.ORGANIC, the source port may end up not being on the side of the node pointing in the main layout direction anymore. For example, the port may be moved to the left or right side of the node for the default top-to-bottom layout orientation.
 
This setting only affects the source side of edges with a curved edge routing style.
Returns:
one of the predefined curve connection styles
See Also:
setTargetCurveConnectionStyle(byte), setSourceCurveConnectionStyle(byte)

setSourceCurveConnectionStyle

public void setSourceCurveConnectionStyle(byte curveConnectionStyle)
Specifies the style which determines how curved edge paths connect at the source side of the edge.

 
When specifying style CurveConnectionStyle.ORGANIC, the source port may end up not being on the side of the node pointing in the main layout direction anymore. For example, the port may be moved to the left or right side of the node for the default top-to-bottom layout orientation.
 
This setting only affects the source side of edges with a curved edge routing style.
Default Value:
The default value is CurveConnectionStyle.KEEP_PORT. The hierarchic source port and the first segment is kept.
Parameters:
curveConnectionStyle - one of the predefined curve connection styles
Throws:
java.lang.IllegalArgumentException - if an unknown connection style is given
See Also:
setTargetCurveConnectionStyle(byte)
Sample Graphs:

Curved edges with the source and target ports kept as they are in a hierarchic layout

Organic-like curve connections at source and target side

getTargetCurveConnectionStyle

public byte getTargetCurveConnectionStyle()
Returns the style which determines how curved edge paths connect at the target side of the edge.

 
When specifying style CurveConnectionStyle.ORGANIC, the target port may end up not being on the side of the node pointing against the main layout direction anymore. For example, the port may be moved to the left or right side of the node for the default top-to-bottom layout orientation.
 
This setting only affects the target side of edges with a curved edge routing style.
Returns:
one of the predefined curve connection styles
See Also:
setSourceCurveConnectionStyle(byte), setTargetCurveConnectionStyle(byte)

setTargetCurveConnectionStyle

public void setTargetCurveConnectionStyle(byte curveConnectionStyle)
Specifies the style which determines how curved edge paths connect at the target side of the edge.

 
When specifying style CurveConnectionStyle.ORGANIC, the target port may end up not being on the side of the node pointing against the main layout direction anymore. For example, the port may be moved to the left or right side of the node for the default top-to-bottom layout orientation.
 
This setting only affects the target side of edges with a curved edge routing style.
Default Value:
The default value is CurveConnectionStyle.KEEP_PORT. The hierarchic target port and the last segment is kept.
Parameters:
curveConnectionStyle - one of the predefined curve connection styles
Throws:
java.lang.IllegalArgumentException - if an unknown connection style is given
See Also:
setSourceCurveConnectionStyle(byte)
Sample Graphs:

Curved edges with the source and target ports kept as they are in a hierarchic layout

Organic-like curve connections at source and target side

isCurveShortcutsAllowed

public boolean isCurveShortcutsAllowed()
Returns whether or not curved edges may shortcut and introduce additional edge crossings to make curves more direct and smoother.

In relation to nodes, labels and other edges, the curved and non-curved edges take the same route, for example, both might cross a certain other edge or pass a certain node on its left side. If this property is disabled (default), the curved edges adhere to this.

If enabled, however, curved edges may shortcut and cross additional edges. This can yield to a direct and possibly smoother curved route. Still, intersections with nodes, node labels and edge labels are not allowed.

 
If symmetric u-turn curves are preferred, enabling this property may be beneficial. For example, creating a perfectly symmetric u-turn curve may require to cross an additional edge.
 
This setting only affects edges with a curved edge routing style. It is not possible to precisely predict the impact of this setting for the general case. Usually, the effect of this property can mainly be observed for long edges close to the exterior of large graphs.
Returns:
true, if curved edges may shortcut in favor of more direct curves, false, otherwise
See Also:
EDGE_STYLE_CURVED, setCurveShortcutsAllowed(boolean)

setCurveShortcutsAllowed

public void setCurveShortcutsAllowed(boolean curveShortcutsAllowed)
Specifies whether or not curved edges may shortcut and introduce additional edge crossings to make curves more direct and smoother.

In relation to nodes, labels and other edges, the curved and non-curved edges take the same route, for example, both might cross a certain other edge or pass a certain node on its left side. If this property is disabled (default), the curved edges adhere to this.

If enabled, however, curved edges may shortcut and cross additional edges. This can yield to a direct and possibly smoother curved route. Still, intersections with nodes, node labels and edge labels are not allowed.

 
If symmetric u-turn curves are preferred, enabling this property may be beneficial. For example, creating a perfectly symmetric u-turn curve may require to cross an additional edge.
 
This setting only affects edges with a curved edge routing style. It is not possible to precisely predict the impact of this setting for the general case. Usually, the effect of this property can mainly be observed for long edges close to the exterior of large graphs.
Default Value:
The default value is false. Curved edges do not shortcut.
Parameters:
curveShortcutsAllowed - true, if curved edges may shortcut in favor of more direct curves, false, otherwise
See Also:
EDGE_STYLE_CURVED
Sample Graphs:

Curve shortcuts are disabled

Curve shortcuts are enabled

getCurveUTurnSymmetry

public double getCurveUTurnSymmetry()
Returns how symmetric u-turn parts of curved routes should preferably be.

If this property is greater than zero, the algorithm tries to achieve a more symmetric path for 180-degree turns (u-turns) by specifically handling them. Symmetric turns likely require more space compared to more direct variants. The value of this property must be within interval [0,1], where a higher value indicates more emphasis on symmetry and lower values that symmetry is not important.

This setting influences the symmetry of a single curved route and does not affect symmetry of multiple curves in relation to each other.

 
The difference to value 0 might be perceived as being greater than the difference between other values. The reason is that with 0, u-turns are not handled specifically at all.
 
This setting only affects edges with a curved edge routing style.
Returns:
the symmetry preference for u-turns of curved edges within interval [0,1], where a higher value means that symmetric turns are preferred
See Also:
EDGE_STYLE_CURVED, setCurveUTurnSymmetry(double)

setCurveUTurnSymmetry

public void setCurveUTurnSymmetry(double curveUTurnSymmetry)
Specifies how symmetric u-turn parts of curved routes should preferably be.

If this property is greater than zero, the algorithm tries to achieve a more symmetric path for 180-degree turns (u-turns) by specifically handling them. Symmetric turns likely require more space compared to more direct variants. The value of this property must be within interval [0,1], where a higher value indicates more emphasis on symmetry and lower values that symmetry is not important.

This setting influences the symmetry of a single curved route and does not affect symmetry of multiple curves in relation to each other.

 
The difference to value 0 might be perceived as being greater than the difference between other values. The reason is that with 0, u-turns are not handled specifically at all.
 
This setting only affects edges with a curved edge routing style.
Default Value:
The default value is 0. The symmetry of u-turns is not specifically optimized.
Parameters:
curveUTurnSymmetry - the symmetry preference for u-turns of curved edges within interval [0,1], where a higher value means that symmetric turns are preferred
Throws:
java.lang.IllegalArgumentException - if the given symmetry value is negative or larger than one
See Also:
EDGE_STYLE_CURVED
Sample Graphs:

0.0

0.7

1.0

isControlPointCreationEnabled

public boolean isControlPointCreationEnabled()
Returns whether or not the points of the resulting edge path represent cubic bezier control points.

 
This feature is useful when the visualization of the edge draws bezier curves instead of polyline paths.
Returns:
true if the bends are interpreted as cubic bezier control points, false otherwise
See Also:
setControlPointCreationEnabled(boolean)

setControlPointCreationEnabled

public void setControlPointCreationEnabled(boolean controlPointCreation)
Specifies whether or not the points of the resulting edge path represent cubic bezier control points.

 
This feature is useful when the visualization of the edge draws bezier curves instead of polyline paths.
Default Value:
The default value is false. Each point is a normal polyline bend point.
Parameters:
controlPointCreation - true if the points of the edge path should represent cubic bezier control points, false otherwise

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