Search this API

y.layout.router
Class CurveEdgeLayoutDescriptor

java.lang.Object
  extended by y.layout.router.CurveEdgeLayoutDescriptor

public class CurveEdgeLayoutDescriptor
extends java.lang.Object

This class is used by CurveRoutingStage to provide routing details for the edges of the graph.

A CurveEdgeLayoutDescriptor instance can be specified individually for single edges using a DataProvider that returns an CurveEdgeLayoutDescriptor instance for each edge of the graph, or null if no CurveEdgeLayoutDescriptor is bound to an edge. The DataProvider is registered with the graph using key CurveRoutingStage.CURVE_EDGE_LAYOUT_DESCRIPTOR_DPKEY.

This class is designed such that it allows future additions of new getter methods.

See Also:
CurveRoutingStage, CurveRoutingStage.CURVE_EDGE_LAYOUT_DESCRIPTOR_DPKEY
 
Your browser does not support SVG content.

Constructor Summary
CurveEdgeLayoutDescriptor()
           
 
Method Summary
 CurveEdgeLayoutDescriptor createCopy()
          Creates a copy of this CurveEdgeLayoutDescriptor instance.
 double getCurveUTurnSymmetry()
          Returns how symmetric u-turn parts of the curved routes should preferably be.
 double getMinimumEdgeToEdgeDistance()
          Returns the minimum distance to segments belonging to other edges.
 double getMinimumFirstSegmentLength()
          Returns the minimum length of the first segment of the edge path (at the source node).
 double getMinimumLastSegmentLength()
          Returns the minimum length of the last segment of the edge path (at the target node).
 double getMinimumNodeToEdgeDistance()
          Returns the minimum distance to nodes.
 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 if that makes the curves more direct and smoother.
 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 if that makes the curves more direct and smoother.
 void setCurveUTurnSymmetry(double curveUTurnSymmetry)
          Specifies how symmetric u-turn parts of the curved routes should preferably be.
 void setMinimumEdgeToEdgeDistance(double distance)
          Specifies the minimum distance to segments belonging to other edges.
 void setMinimumFirstSegmentLength(double length)
          Specifies the minimum length of the first segment of the edge path (at the source node).
 void setMinimumLastSegmentLength(double length)
          Specifies the minimum length of the last segment of the edge path (at the target node).
 void setMinimumNodeToEdgeDistance(double distance)
          Specifies the minimum distance to nodes.
 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
 

Constructor Detail

CurveEdgeLayoutDescriptor

public CurveEdgeLayoutDescriptor()
Method Detail

getMinimumFirstSegmentLength

public double getMinimumFirstSegmentLength()
Returns the minimum length of the first segment of the edge path (at the source node).

The minimum length must be greater than or equal to 0.

 
The first segment length starts, if present, at the halo of the source node.
 
The first segment length is ignored when using source connection style CurveConnectionStyle.ORGANIC.
Returns:
the minimum length of the first segment
See Also:
setMinimumFirstSegmentLength(double)

setMinimumFirstSegmentLength

public void setMinimumFirstSegmentLength(double length)
Specifies the minimum length of the first segment of the edge path (at the source node).

The minimum length must be greater than or equal to 0.

 
The first segment length starts, if present, at the halo of the source node.
 
The first segment length is ignored when using source connection style CurveConnectionStyle.ORGANIC.
Default Value:
The default value is 5.0.
Parameters:
length - the minimum length of the first segment
Throws:
java.lang.IllegalArgumentException - if the minimum length of the first segment is negative
Sample Graphs:

Minimum first segment length 5

Minimum first segment length 30

getMinimumLastSegmentLength

public double getMinimumLastSegmentLength()
Returns the minimum length of the last segment of the edge path (at the target node).

The minimum length must be greater than or equal to 0.

If the minimum length is zero, the curved route may end with a non-orthogonal last segment such that the port location provided by the core layout may also be changed.

 
The last segment length ends, if present, at the halo of the target node.
 
The last segment length is ignored when using target connection style CurveConnectionStyle.ORGANIC.
Returns:
the minimum length of the last segment
See Also:
setMinimumLastSegmentLength(double)

setMinimumLastSegmentLength

public void setMinimumLastSegmentLength(double length)
Specifies the minimum length of the last segment of the edge path (at the target node).

The minimum length must be greater than or equal to 0.

If the minimum length is zero, the curved route may end with a non-orthogonal last segment such that the port location provided by the core layout may also be changed.

 
The last segment length ends, if present, at the halo of the target node.
 
The last segment length is ignored when using target connection style CurveConnectionStyle.ORGANIC.
Default Value:
The default value is 10.0.
Parameters:
length - the minimum length of the last segment
Throws:
java.lang.IllegalArgumentException - if the minimum length of the last segment is negative
Sample Graphs:

Minimum last segment length 10

Minimum last segment length 30

getMinimumEdgeToEdgeDistance

public double getMinimumEdgeToEdgeDistance()
Returns the minimum distance to segments belonging to other edges.

The minimum distance must be greater than or equal to 0.

Returns:
the minimum distance between this curved edge and other edges
See Also:
setMinimumEdgeToEdgeDistance(double)

setMinimumEdgeToEdgeDistance

public void setMinimumEdgeToEdgeDistance(double distance)
Specifies the minimum distance to segments belonging to other edges.

The minimum distance must be greater than or equal to 0.

 
The minimum edge distance influences how the curves are created. If this distance is already violated in the result of the core layout algorithm, it has no effect on the curved routes, i.e. the curved route may also violate it.
Default Value:
The default value is 10.0.
Parameters:
distance - the minimum distance between this curved edge and other edges
Throws:
java.lang.IllegalArgumentException - if the minimum distance is negative

getMinimumNodeToEdgeDistance

public double getMinimumNodeToEdgeDistance()
Returns the minimum distance to nodes.

The minimum distance must be greater than or equal to 0.

 
The minimum node distance influences how the curves are created. If this distance is already violated in the result of the core layout algorithm, it has no effect on the curved routes, i.e. the curved route may also violate it.
Returns:
the minimum distance between this curve edge and nodes
See Also:
setMinimumNodeToEdgeDistance(double)

setMinimumNodeToEdgeDistance

public void setMinimumNodeToEdgeDistance(double distance)
Specifies the minimum distance to nodes.

The minimum distance must be greater than or equal to 0.

 
The minimum node distance influences how the curves are created. If this distance is already violated in the result of the core layout algorithm, it has no effect on the curved routes, i.e. the curved route may also violate it.
Default Value:
The default value is 10.0.
Parameters:
distance - the minimum distance between this curve edge and nodes
Throws:
java.lang.IllegalArgumentException - if the minimum distance is negative

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

isCurveShortcutsAllowed

public boolean isCurveShortcutsAllowed()
Returns whether or not curved edges may shortcut and introduce additional edge crossings if that makes the curves more direct and smoother.

If enabled, 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. Note that it is not possible to precisely predict the impact of this setting for the general case.

 
If symmetric u-turns are preferred, enabling this property may be beneficial. For example, creating a perfectly symmetric u-turn curve may require to cross an additional edge.
Returns:
true, if curved edges may shortcut and introduce additional edge crossings in favor of more direct curves, false, otherwise
See Also:
setCurveShortcutsAllowed(boolean)

setCurveShortcutsAllowed

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

If enabled, 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. Note that it is not possible to precisely predict the impact of this setting for the general case.

 
If symmetric u-turns are preferred, enabling this property may be beneficial. For example, creating a perfectly symmetric u-turn curve may require to cross an additional edge.
Default Value:
The default value is false. Curved edges do not shortcut.
Parameters:
curveShortcutsAllowed - true, if curved edges may shortcut and introduce additional edge crossings in favor of more direct curves, false, otherwise
Sample Graphs:

Curve shortcuts are disabled

Curve shortcuts are enabled

getCurveUTurnSymmetry

public double getCurveUTurnSymmetry()
Returns how symmetric u-turn parts of the 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.
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:
setCurveUTurnSymmetry(double)

setCurveUTurnSymmetry

public void setCurveUTurnSymmetry(double curveUTurnSymmetry)
Specifies how symmetric u-turn parts of the 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.
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
Sample Graphs:

0.0

0.7

1.0

getSourceCurveConnectionStyle

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

Returns:
one of the predefined curve connection styles
See Also:
setTargetCurveConnectionStyle(byte), setSourceCurveConnectionStyle(byte), CurveConnectionStyle.KEEP_PORT, CurveConnectionStyle.ORGANIC

setSourceCurveConnectionStyle

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

Default Value:
The default value is CurveConnectionStyle.KEEP_PORT. The 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:
CurveConnectionStyle.KEEP_PORT, CurveConnectionStyle.ORGANIC, setTargetCurveConnectionStyle(byte)

getTargetCurveConnectionStyle

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

Returns:
one of the predefined curve connection styles
See Also:
setSourceCurveConnectionStyle(byte), setTargetCurveConnectionStyle(byte), CurveConnectionStyle.KEEP_PORT, CurveConnectionStyle.ORGANIC

setTargetCurveConnectionStyle

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

Default Value:
The default value is CurveConnectionStyle.KEEP_PORT. The 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:
CurveConnectionStyle.KEEP_PORT, CurveConnectionStyle.ORGANIC, setSourceCurveConnectionStyle(byte)

createCopy

public CurveEdgeLayoutDescriptor createCopy()
Creates a copy of this CurveEdgeLayoutDescriptor instance.

Returns:
a copy of this CurveEdgeLayoutDescriptor instance

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