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.
 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.
 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 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

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-2021,
yWorks GmbH.
All rights reserved.