Search this API

y.layout.hierarchic.incremental
Class EdgeLayoutDescriptor

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

public class EdgeLayoutDescriptor
extends java.lang.Object

This class is used by HierarchicLayouter during the various phases to provide routing details for the edges of the graph.

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

This class is designed as a class to allow future additions of new getter methods.

 
Not all of these values will be considered for all kinds of edges and algorithm settings.
See Also:
HierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY, NodeLayoutDescriptor
 

Field Summary
static int RECURSIVE_EDGE_STYLE_DIRECTED
          Routing specifier that routes edges between different group contents recursively and directed.
static int RECURSIVE_EDGE_STYLE_OFF
          Routing specifier that routes edges between different group contents non-recursively.
static int RECURSIVE_EDGE_STYLE_UNDIRECTED
          Routing specifier that routes edges between different group contents recursively and undirected.
 
Constructor Summary
EdgeLayoutDescriptor()
          Creates a new instance of an EdgeLayoutDescriptor with the default values.
 
Method Summary
 EdgeLayoutDescriptor createCopy()
          Creates a copy of this EdgeLayoutDescriptor instance.
 double getMinimumDistance()
          Returns the preferred minimum distance to obstacles.
 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 getMinimumLength()
          Returns the minimum length of an edge.
 double getMinimumSlope()
          Returns the minimum slope that the mid segments of this edge should have, if the edge is routed polyline in vertical layouts.
 double getMinOctilinearSegmentLength()
          Returns the minimum length of octilinear segments for this edge.
 int getRecursiveEdgeStyle()
          Returns how edges in grouped graphs are routed between the content of different groups.
 RoutingStyle getRoutingStyle()
          Returns the routing style for this edge.
 boolean isDirectGroupContentEdgeRoutingEnabled()
          Returns whether or not this edge is routed directly to a group node's border if it connects the group node with one of its descendants.
 boolean isOrthogonallyRouted()
          Deprecated. Replaced by getRoutingStyle().
 boolean isSourcePortOptimizationEnabled()
          Returns whether or not source port optimization is enabled.
 boolean isTargetPortOptimizationEnabled()
          Returns whether or not target port optimization is enabled.
 void setDirectGroupContentEdgeRoutingEnabled(boolean enabled)
          Specifies whether or not this edge is routed directly to a group node's border if it connects the group node with one of its descendants.
 void setMinimumDistance(double distance)
          Specifies the preferred minimum distance to obstacles.
 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 setMinimumLength(double length)
          Specifies the minimum length of an edge.
 void setMinimumSlope(double slope)
          Specifies the minimum slope that the mid segments of this edge should have, if the edge is routed polyline in vertical layouts.
 void setMinOctilinearSegmentLength(double minOctilinearSegmentLength)
          Specifies the minimum length of octilinear segments for this edge.
 void setOrthogonallyRouted(boolean orthogonal)
          Deprecated. Replaced by setRoutingStyle(RoutingStyle).
 void setRecursiveEdgeStyle(int recursiveEdgeStyle)
          Specifies how edges in grouped graphs are routed between the content of different groups.
 void setRoutingStyle(RoutingStyle routingStyle)
          Specifies the routing style for this edge.
 void setSourcePortOptimizationEnabled(boolean enable)
          Specifies whether or not source port optimization is enabled.
 void setTargetPortOptimizationEnabled(boolean enable)
          Specifies whether or not target port optimization is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECURSIVE_EDGE_STYLE_OFF

public static final int RECURSIVE_EDGE_STYLE_OFF
Routing specifier that routes edges between different group contents non-recursively. Edges may leave and enter group nodes at the left and right side in order to connect as directly as possible.

See Also:
setRecursiveEdgeStyle(int), Constant Field Values
Sample Graph:

RECURSIVE_EDGE_STYLE_DIRECTED

public static final int RECURSIVE_EDGE_STYLE_DIRECTED
Routing specifier that routes edges between different group contents recursively and directed. Edges can only leave the groups at the bottom side and enter them at the top side.

See Also:
setRecursiveEdgeStyle(int), Constant Field Values
Sample Graph:

RECURSIVE_EDGE_STYLE_UNDIRECTED

public static final int RECURSIVE_EDGE_STYLE_UNDIRECTED
Routing specifier that routes edges between different group contents recursively and undirected. Edges can leave the groups at the bottom or top side and enter them at the bottom or top side. This style is more compact than the directed edge style.

See Also:
setRecursiveEdgeStyle(int), Constant Field Values
Sample Graph:
Constructor Detail

EdgeLayoutDescriptor

public EdgeLayoutDescriptor()
Creates a new instance of an EdgeLayoutDescriptor with the default values.

Method Detail

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 should be greater than 0.

If the value is 0.0d the first segment does not need to be orthogonal.

 
The first segment length may be violated for curved edge routes when using curve connection style CurveConnectionStyle.ORGANIC.
Default Value:
The default value is 10.0d.
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 10

Minimum first segment length 50

getMinimumFirstSegmentLength

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

The minimum length should be greater than 0.

If the value is 0.0d the first segment does not need to be orthogonal.

 
The first segment length may be violated for curved edge routes when using curve connection style CurveConnectionStyle.ORGANIC.
Returns:
the minimum length of the first segment
See Also:
setMinimumFirstSegmentLength(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 should be greater than 0.

If the value is 0.0d the last segment does not need to be orthogonal.

 
The last segment length may be violated for curved edge routes when using curve connection style CurveConnectionStyle.ORGANIC.
Default Value:
The default value is 15.0d.
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 50

getMinimumLastSegmentLength

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

The minimum length should be greater than 0.

If the value is 0.0d the last segment does not need to be orthogonal.

 
The last segment length may be violated for curved edge routes when using curve connection style CurveConnectionStyle.ORGANIC.
Returns:
the minimum length of the last segment
See Also:
setMinimumLastSegmentLength(double)

setMinimumLength

public void setMinimumLength(double length)
Specifies the minimum length of an edge.

If this is used for polyline routing, it describes the minimum vertical length of the mid segment. If it is used for orthogonal routing, it describes the minimum length of the whole edge.

The minimum length should be greater than 0.

Default Value:
The default value is 20.0d.
Parameters:
length - the minimum segment length.
Throws:
java.lang.IllegalArgumentException - if the minimum length is negative
Sample Graphs:

Minimum segment length 15

Minimum segment length 50

getMinimumLength

public double getMinimumLength()
Returns the minimum length of an edge.

If this is used for polyline routing, it describes the minimum vertical length of the mid segment. If it is used for orthogonal routing, it describes the minimum length of the whole edge.

The minimum length should be greater than 0.

Returns:
the minimum segment length.
See Also:
setMinimumLength(double)

setMinimumDistance

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

The minimum distance should be greater than 0.

Default Value:
The default value is 10.0d.
Parameters:
distance - the minimum distance to obstacles
Throws:
java.lang.IllegalArgumentException - if the minimum length is negative
Sample Graphs:

Minimum distance 15

Minimum distance 40

getMinimumDistance

public double getMinimumDistance()
Returns the preferred minimum distance to obstacles.

The minimum distance should be greater than 0.

Returns:
the minimum distance to obstacles
See Also:
setMinimumDistance(double)

setMinimumSlope

public void setMinimumSlope(double slope)
Specifies the minimum slope that the mid segments of this edge should have, if the edge is routed polyline in vertical layouts.

The minimum slope should be greater than 0.

Default Value:
The default value is 0.3d.
Parameters:
slope - the minimum slope of the mid segments
Throws:
java.lang.IllegalArgumentException - if the given minimum slope is negative
Sample Graphs:

Minimum slope 0.25d

Minimum slope 2.0d

getMinimumSlope

public double getMinimumSlope()
Returns the minimum slope that the mid segments of this edge should have, if the edge is routed polyline in vertical layouts.

The minimum slope should be greater than 0.

Returns:
the minimum slope of the mid segments
See Also:
setMinimumSlope(double)

isSourcePortOptimizationEnabled

public boolean isSourcePortOptimizationEnabled()
Returns whether or not source port optimization is enabled.

This means that the algorithm should try to find a better source port constraint if the current constraint is null or PortConstraint.ANY_SIDE.

Returns:
true if source port optimization is enabled, false otherwise
See Also:
setSourcePortOptimizationEnabled(boolean)

setSourcePortOptimizationEnabled

public void setSourcePortOptimizationEnabled(boolean enable)
Specifies whether or not source port optimization is enabled.

This means that the algorithm should try to find a better source port constraint if the current constraint is null or PortConstraint.ANY_SIDE.

Default Value:
The default value is false. Ports being placed at the side of the node which lies closest to the target of the edge in terms of layering.
Parameters:
enable - true if source port optimization should be enabled, false otherwise

isTargetPortOptimizationEnabled

public boolean isTargetPortOptimizationEnabled()
Returns whether or not target port optimization is enabled.

This means that the algorithm should try to find a better target port constraint if the current constraint is null or PortConstraint.ANY_SIDE.

Returns:
true if target port optimization should be enabled, false otherwise
See Also:
setTargetPortOptimizationEnabled(boolean)

setTargetPortOptimizationEnabled

public void setTargetPortOptimizationEnabled(boolean enable)
Specifies whether or not target port optimization is enabled.

This means that the algorithm should try to find a better target port constraint if the current constraint is null or PortConstraint.ANY_SIDE.

Default Value:
The default value is false. Ports being placed at the side of the node which lies closest to the source of the edge in terms of layering.
Parameters:
enable - true if target port optimization should be enabled, false otherwise

setOrthogonallyRouted

public void setOrthogonallyRouted(boolean orthogonal)
Deprecated. Replaced by setRoutingStyle(RoutingStyle).

Specifies whether or not this edge are orthogonally routed.

This does not affect the routing of bus-like structures.

Default Value:
The default value is false.
Parameters:
orthogonal - true if his edge should be routed orthogonally, false otherwise

isOrthogonallyRouted

public boolean isOrthogonallyRouted()
Deprecated. Replaced by getRoutingStyle().

Specifies whether or not this edge are orthogonally routed.

This does not affect the routing of bus-like structures.

Returns:
true if his edge should be routed orthogonally, false otherwise

getRoutingStyle

public RoutingStyle getRoutingStyle()
Returns the routing style for this edge.

Returns:
a RoutingStyle instance
See Also:
setRoutingStyle(RoutingStyle), RoutingStyle

setRoutingStyle

public void setRoutingStyle(RoutingStyle routingStyle)
Specifies the routing style for this edge.

Parameters:
routingStyle - a given RoutingStyle instance
See Also:
RoutingStyle
Sample Graphs:

Routing style orthogonal

Routing style polyline

Routing style octilinear

Routing style curved

getMinOctilinearSegmentLength

public double getMinOctilinearSegmentLength()
Returns the minimum length of octilinear segments for this edge.

 
The layout algorithm cannot always maintain the specified minimum length.
 
This option has an effect only if the routing style is octilinear.
Returns:
the minimum length of octilinear segment
See Also:
setMinOctilinearSegmentLength(double), setRoutingStyle(RoutingStyle)

setMinOctilinearSegmentLength

public void setMinOctilinearSegmentLength(double minOctilinearSegmentLength)
Specifies the minimum length of octilinear segments for this edge.

 
The layout algorithm cannot always maintain the specified minimum length.
 
This option has an effect only if the routing style is octilinear.
Default Value:
The default value is 20.0d.
Parameters:
minOctilinearSegmentLength - the minimum length of octilinear segment
Throws:
java.lang.IllegalArgumentException - if the minimum length of the first segment is negative
See Also:
setRoutingStyle(RoutingStyle)
Sample Graphs:

Minimum octilinear segment length 20

Minimum octilinear segment length 100

createCopy

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

Returns:
a copy of this EdgeLayoutDescriptor instance

getRecursiveEdgeStyle

public int getRecursiveEdgeStyle()
Returns how edges in grouped graphs are routed between the content of different groups.

 
If also direct routing between groups and their content is enabled, such an edge may not be strictly recursive anymore. Edges may leave/enter group nodes left or right.
 
An edge that belongs to a bus structure can not be recursive at the same time.
Returns:
one of the predefined recursive routing styles
See Also:
setRecursiveEdgeStyle(int)

setRecursiveEdgeStyle

public void setRecursiveEdgeStyle(int recursiveEdgeStyle)
Specifies how edges in grouped graphs are routed between the content of different groups.

 
If also direct routing between groups and their content is enabled, such an edge may not be strictly recursive anymore. Edges may leave/enter group nodes left or right.
 
An edge that belongs to a bus structure can not be recursive at the same time.
Default Value:
The default value is RECURSIVE_EDGE_STYLE_OFF. Edges are not routed recursively.
Parameters:
recursiveEdgeStyle - one of the predefined recursive routing styles
Throws:
java.lang.IllegalArgumentException - if an unknown style is specified
Sample Graphs:

RECURSIVE_EDGE_STYLE_OFF

RECURSIVE_EDGE_STYLE_DIRECTED

RECURSIVE_EDGE_STYLE_UNDIRECTED

isDirectGroupContentEdgeRoutingEnabled

public boolean isDirectGroupContentEdgeRoutingEnabled()
Returns whether or not this edge is routed directly to a group node's border if it connects the group node with one of its descendants.

When enabled, the edge will connect to the inner side of the group node's border instead of leaving the group node and connect from outside.

 
Edges that are completely overlapped by their source or target may require special attention during visualization. They can disappear when edges are clipped at their source and target.
 
This only applies to edges that connect to a group node from inside this group node.
Returns:
true if the edge is routed directly, false otherwise
See Also:
setDirectGroupContentEdgeRoutingEnabled(boolean)

setDirectGroupContentEdgeRoutingEnabled

public void setDirectGroupContentEdgeRoutingEnabled(boolean enabled)
Specifies whether or not this edge is routed directly to a group node's border if it connects the group node with one of its descendants.

When enabled, the edge will connect to the inner side of the group node's border instead of leaving the group node and connect from outside.

 
Edges that are completely overlapped by their source or target may require special attention during visualization. They can disappear when edges are clipped at their source and target.
 
This only applies to edges that connect to a group node from inside this group node.
Default Value:
The default value is false.
Parameters:
enabled - true if the edge is routed directly, false otherwise
Sample Graphs:

false

true

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