Search this API

y.layout.router
Class OrthogonalEdgeRouter

java.lang.Object
  extended by y.layout.AbstractLayoutStage
      extended by y.layout.router.OrthogonalEdgeRouter
All Implemented Interfaces:
Layouter, LayoutStage
Direct Known Subclasses:
ChannelEdgeRouter.OrthogonalShortestPathPathFinder

public class OrthogonalEdgeRouter
extends AbstractLayoutStage

This edge routing algorithm generates orthogonal routes for the edges of the graph.

Note that class EdgeRouter offers a newer, improved implementation that better supports drawing constraints like port constraints, group nodes and edge groups.

Layout Style

Edges are routed in an orthogonal fashion, i.e. edge paths consist only of vertical and horizontal segments.

During the routing process, the positions of the nodes are considered to be fixed and the router will not modify their locations or their sizes in any way.

The edge routing algorithm can be applied wherever it is required to route the edges as orthogonal segments without crossing any nodes, while keeping the positions of the nodes in the diagram fixed. Some potential applications include electric circuit design, floor planning, UML class diagrams/inheritance diagrams and navigation maps.


Sample output of the orthogonal edge routing algorithm with default settings


Sample output of the orthogonal edge routing algorithm with edge grouping

Concept

Orthogonal edge router divides the area of the graph into several sub-areas (determined by the bounds of graph objects existing in the diagram) and tries to find the best routes for the edge segments between the source and the target nodes of each edge.

Two different strategies for path finding are available, namely center driven and space driven weighting. They can be set using setCenterToSpaceRatio(double). Space driven strategy implies that edge paths that are evenly distributed over the available space should be preferred. Center driven strategy implies that edge paths that are closer to the center of the edge (i.e. the point of the edge that is equidistant from both its endpoints) should be preferred.

Features

OrthogonalEdgeRouter supports edge routing such that the generated paths obey so-called monotonic path restrictions. This means that (ideally) each vertical and/or each horizontal segment of an edge path is directed from the source node towards the target node. Specifying a monotonic path restriction can be done using setMonotonicPathRestriction(byte).

The routing algorithm supports two approaches to connect edges on a specific side or even on an exact location to a node. PortConstraints define a single constraint for the ports of an edge. To realize more complex port restrictions, several PortCandidates or PortCandidateSets can be assigned to edges or nodes. If an edge with registered PortCandidates connects to nodes with PortCandidateSets, the edge router will try to match both collections in order to find an appropriate port. In case there is no matching port candidate, a PortCandidate specified for the edge is preferred. Since their simultaneous existence at the same node may be ambiguous, it is not recommended to use a combination of PortConstraints and PortCandidates in the same diagram.

Edges can be grouped so that they share common segments at the beginning or end of their routes. Although a graph may contain source and target grouped edges, one edge can only be part of a source or a target group. Edge groups are specified using DataProviders that provide the same ID object for all edges in the same group. Those DataProviders are registered with the graph with key PortConstraintKeys.SOURCE_GROUPID_KEY for source groups or key PortConstraintKeys.TARGET_GROUPID_KEY for target groups. Edge groups are only considered if the edge router uses stage EdgeGroupRouterStage.

The edge routing algorithm can be configured such that the number of crossings generated in a diagram is reduced. This can be achieved using methods setLocalCrossingMinimizationEnabled(boolean), setCrossingCost(double) and setReroutingEnabled(boolean).

Several LayoutStages can be used to enhance performance and/or functionality of this class, e.g. EdgeGroupRouterStage, GroupNodeRouterStage, ReducedSphereOfActionStage or PatchRouterStage.

 
Group nodes can only be considered correctly if the edge router uses stage GroupNodeRouterStage.
 

Field Summary
static byte MONOTONIC_BOTH
          A constant specifying monotonic edge path restrictions for the horizontal and vertical direction.
static byte MONOTONIC_HORIZONTAL
          A constant specifying monotonic edge path restrictions for the horizontal direction.
static byte MONOTONIC_NONE
          A constant specifying that there are no monotonic edge path restrictions.
static byte MONOTONIC_VERTICAL
          A constant specifying monotonic edge path restrictions for the vertical direction.
static byte ROUTE_ALL_EDGES
          A scope specifier which defines that all edges of the input graph will be routed.
static byte ROUTE_EDGES_AT_SELECTED_NODES
          A scope specifier which defines that only edges incident to selected nodes will be routed.
static byte ROUTE_SELECTED_EDGES
          A scope specifier which defines that only the selected edges of the input graph will be routed.
static byte STYLE_ADHOC
          A routing style that draws the edge segments ad hoc, i.e., rather crude.
static byte STYLE_BALANCED
          A routing style that draws the edge segments using well-balanced routes.
static byte STYLE_PREFERMIDDLE
          A routing style that draws the edge segments such that their distance from already known obstacles such as nodes or other edge segments is as great as possible.
static byte STYLE_SHORTPATH
          A routing style that prefers the shortest routes for drawing the edge segments.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
OrthogonalEdgeRouter()
          Creates a new OrthogonalEdgeRouter instance with default settings.
OrthogonalEdgeRouter(Layouter core)
          Creates a new OrthogonalEdgeRouter instance with a given core layouter and default settings.
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Checks whether or not the given graph can be handled by this edge routing algorithm.
protected  void checkGroupNodeSize(GraphLayout layout, java.lang.Object node)
          Checks whether or not the width/height of a given group node is zero or negative.
protected  void checkNodeSize(GraphLayout layout, java.lang.Object node)
          Checks whether or not the width/height of a given node is zero or negative.
 void doLayout(LayoutGraph graph)
          Performs the orthogonal routing of the edges of the input graph.
 boolean getBadOrthogonal()
          Returns whether or not edges that cannot be routed should be drawn in an orthogonal fashion.
 double getCenterToSpaceRatio()
          Returns the ratio between two complementary weighting strategies during path searching.
 boolean getCoupledDistances()
          Returns whether or not the minimum distances are coupled.
 double getCrossingCost()
          Returns the cost of each edge crossing.
 int getCustomBorderCapacity()
          Returns the number of parallel edge paths that may be accommodated on the routing border around the graph's bounding box.
 boolean getCustomBorderCapacityEnabled()
          Returns whether or not to use a custom value for the capacity of parallel edge paths accommodated on the routing border.
 YPoint getGridOrigin()
          Returns the point on which the grid starts.
 int getGridSpacing()
          Returns the equidistant spacing between the horizontal and vertical grid lines.
 int getMinimumDistance()
          Specifies the minimum distance between any two edge segments.
 int getMinimumDistanceToNode()
          Returns the minimum distance between edge segments and nodes.
 byte getMonotonicPathRestriction()
          Returns the monotonic path restrictions that should be applied.
 byte getRoutingStyle()
          Returns the preferred edge routing style.
 java.lang.Object getSelectedEdgesDpKey()
          Returns the DataProvider key to look up the selection state of the edges.
 java.lang.Object getSelectedNodesDpKey()
          Returns the DataProvider key to look up the selection state of the nodes.
 byte getSphereOfAction()
          Returns a (sub-)set of edges that shall be routed by the edge router.
 boolean isConsiderNodeLabelsEnabled()
          Specifies whether or not the orthogonal edge router considers the labels of the nodes as obstacles when calculating the edge routes to avoid overlaps.
 boolean isEnforceMonotonicPathRestrictions()
          Returns whether or not monotonic path restrictions should be enforced.
 boolean isGridRoutingEnabled()
          Returns whether or not the edge segments are routed on grid lines.
 boolean isInnerPortsEnabled()
          Returns whether or not edge ports that do not have a strong port constraint should lie in the interior of the bounding box or on the border of a node.
 boolean isLocalCrossingMinimizationEnabled()
          Returns whether or not a local crossing minimization strategy should be applied.
 boolean isReroutingEnabled()
          Returns whether or not the orthogonal edge router performs an additional step to reroute the edges such that the number of edge crossings is reduced.
 void setBadOrthogonal(boolean value)
          Specifies whether or not edges that cannot be routed should be drawn in an orthogonal fashion.
 void setCenterToSpaceRatio(double csr)
          Specifies the ratio between two complementary weighting strategies during path searching.
 void setConsiderNodeLabelsEnabled(boolean enabled)
          Specifies whether or not the orthogonal edge router considers the labels of the nodes as obstacles when calculating the edge routes to avoid overlaps.
 void setCoupledDistances(boolean coupled)
          Specifies whether or not the minimum distances should be coupled.
 void setCrossingCost(double cost)
          Specifies the cost of each edge crossing.
 void setCustomBorderCapacity(int value)
          Specifies the number of parallel edge paths that may be accommodated on the routing border around the graph's bounding box.
 void setCustomBorderCapacityEnabled(boolean value)
          Specifies whether or not to use a custom value for the capacity of parallel edge paths accommodated on the routing border.
 void setEnforceMonotonicPathRestrictions(boolean enforceMonotonicPathRestrictions)
          Specifies whether or not monotonic path restrictions should be enforced.
 void setGridOrigin(int x, int y)
          Specifies the coordinates of the point on which the grid starts.
 void setGridRoutingEnabled(boolean enabled)
          Specifies whether or not the edge segments are routed on grid lines.
 void setGridSpacing(int spacing)
          Specifies the equidistant spacing between the horizontal and vertical grid lines.
 void setInnerPortsEnabled(boolean value)
          Specifies whether or not edge ports that do not have a strong port constraint should lie in the interior of the bounding box or on the border of a node.
 void setLocalCrossingMinimizationEnabled(boolean enabled)
          Specifies whether or not a local crossing minimization strategy should be applied.
 void setMinimumDistance(int dist)
          Specifies the minimum distance between any two edge segments.
 void setMinimumDistanceToNode(int dist)
          Specifies the minimum distance between edge segments and nodes.
 void setMonotonicPathRestriction(byte monotonicPathRestriction)
          Specifies the monotonic path restrictions that should be applied.
 void setReroutingEnabled(boolean enabled)
          Specifies whether or not the orthogonal edge router performs an additional step to reroute the edges such that the number of edge crossings is reduced.
 void setRoutingStyle(byte style)
          Specifies the preferred edge routing style.
 void setSelectedEdgesDpKey(java.lang.Object key)
          Specifies the DataProvider key to look up the selection state of the edges.
 void setSelectedNodesDpKey(java.lang.Object key)
          Specifies the DataProvider key to look up the selection state of the nodes.
 void setSphereOfAction(byte scope)
          Specifies a (sub-)set of edges that shall be routed by the orthogonal edge router.
 
Methods inherited from class y.layout.AbstractLayoutStage
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MONOTONIC_NONE

public static final byte MONOTONIC_NONE
A constant specifying that there are no monotonic edge path restrictions.

See Also:
setMonotonicPathRestriction(byte), Constant Field Values
Sample Graph:

MONOTONIC_VERTICAL

public static final byte MONOTONIC_VERTICAL
A constant specifying monotonic edge path restrictions for the vertical direction.

This implies that each vertical edge segment is directed from the source towards the target node. Furthermore, each edge path starts and ends with a vertical segment.

See Also:
setMonotonicPathRestriction(byte), Constant Field Values
Sample Graph:

MONOTONIC_HORIZONTAL

public static final byte MONOTONIC_HORIZONTAL
A constant specifying monotonic edge path restrictions for the horizontal direction.

This implies that each horizontal edge segment is directed from the source towards the target node. Furthermore, each edge path starts and ends with a horizontal segment.

See Also:
setMonotonicPathRestriction(byte), Constant Field Values
Sample Graph:

MONOTONIC_BOTH

public static final byte MONOTONIC_BOTH
A constant specifying monotonic edge path restrictions for the horizontal and vertical direction.

This implies that each horizontal and vertical edge segment is directed from the source towards the target node.

See Also:
setMonotonicPathRestriction(byte), Constant Field Values
Sample Graph:

STYLE_ADHOC

public static final byte STYLE_ADHOC
A routing style that draws the edge segments ad hoc, i.e., rather crude.

See Also:
setRoutingStyle(byte), Constant Field Values
Sample Graph:

STYLE_SHORTPATH

public static final byte STYLE_SHORTPATH
A routing style that prefers the shortest routes for drawing the edge segments.

See Also:
setRoutingStyle(byte), Constant Field Values
Sample Graph:

STYLE_PREFERMIDDLE

public static final byte STYLE_PREFERMIDDLE
A routing style that draws the edge segments such that their distance from already known obstacles such as nodes or other edge segments is as great as possible.

In the case where the edge segments have to be routed in between two obstacles, then the route that lies on the the line that is equidistant from the two obstacles will be preferred.

See Also:
setRoutingStyle(byte), Constant Field Values
Sample Graph:

STYLE_BALANCED

public static final byte STYLE_BALANCED
A routing style that draws the edge segments using well-balanced routes.

The two end segments of an edge as well as the segments between bends of different directions are drawn similar to STYLE_PREFERMIDDLE. Segments between bends of the same direction (i.e. u-shape turns) are drawn using the shortest routes.

See Also:
setRoutingStyle(byte), Constant Field Values
Sample Graph:

ROUTE_ALL_EDGES

public static final byte ROUTE_ALL_EDGES
A scope specifier which defines that all edges of the input graph will be routed.

See Also:
setSphereOfAction(byte), Constant Field Values
Sample Graphs:

Initial graph

All edges routed by this orthogonal edge routing algorithm

ROUTE_SELECTED_EDGES

public static final byte ROUTE_SELECTED_EDGES
A scope specifier which defines that only the selected edges of the input graph will be routed.

The selection state of an edge is determined by a boolean value returned by a DataProvider registered with key getSelectedEdgesDpKey().

All other non-selected edges will be considered to have fixed routes.

See Also:
setSphereOfAction(byte), setSelectedEdgesDpKey(Object), Constant Field Values
Sample Graphs:

Initial graph

Only selected (marked) edges routed by this edge routing algorithm

ROUTE_EDGES_AT_SELECTED_NODES

public static final byte ROUTE_EDGES_AT_SELECTED_NODES
A scope specifier which defines that only edges incident to selected nodes will be routed.

The selection state of a node is determined by a boolean value returned by a DataProvider registered with key getSelectedNodesDpKey().

All other edges that are incident to non-selected nodes will be considered to have fixed routes.

See Also:
setSphereOfAction(byte), setSelectedNodesDpKey(Object), Constant Field Values
Sample Graphs:

Initial graph

Only edges connected to selected (marked) nodes routed by this edge routing algorithm
Constructor Detail

OrthogonalEdgeRouter

public OrthogonalEdgeRouter()
Creates a new OrthogonalEdgeRouter instance with default settings.


OrthogonalEdgeRouter

public OrthogonalEdgeRouter(Layouter core)
Creates a new OrthogonalEdgeRouter instance with a given core layouter and default settings.

Parameters:
core - the given core layouter
Method Detail

getSelectedNodesDpKey

public java.lang.Object getSelectedNodesDpKey()
Returns the DataProvider key to look up the selection state of the nodes.

If a DataProvider is registered with this key, only the edges that are incident to selected nodes will be routed, while all other edges will be considered to have fixed routes.

Returns:
the DataProvider key for node selection
See Also:
setSelectedNodesDpKey(Object)

setSelectedNodesDpKey

public void setSelectedNodesDpKey(java.lang.Object key)
Specifies the DataProvider key to look up the selection state of the nodes.

If a DataProvider is registered with this key, only the edges that are incident to selected nodes will be routed, while all other edges will be considered to have fixed routes.

Default Value:
The default value is Layouter.SELECTED_NODES
Parameters:
key - the DataProvider key for node selection
Throws:
java.lang.IllegalArgumentException - if the specified DataProvider key is null
See Also:
getSelectedNodesDpKey()

getSelectedEdgesDpKey

public java.lang.Object getSelectedEdgesDpKey()
Returns the DataProvider key to look up the selection state of the edges.

If a DataProvider is registered with this key, only the selected edges will be routed, while all other edges will be considered to have fixed routes.

Returns:
the DataProvider key for edge selection
See Also:
setSelectedEdgesDpKey(Object)

setSelectedEdgesDpKey

public void setSelectedEdgesDpKey(java.lang.Object key)
Specifies the DataProvider key to look up the selection state of the edges.

If a DataProvider is registered with this key, only the selected edges will be routed, while all other edges will be considered to have fixed routes.

Default Value:
The default value is Layouter.SELECTED_EDGES
Parameters:
key - the DataProvider key for edge selection
Throws:
java.lang.IllegalArgumentException - if the specified DataProvider key is null
See Also:
getSelectedEdgesDpKey()

setConsiderNodeLabelsEnabled

public void setConsiderNodeLabelsEnabled(boolean enabled)
Specifies whether or not the orthogonal edge router considers the labels of the nodes as obstacles when calculating the edge routes to avoid overlaps.

Default Value:
The default value is false.
Parameters:
enabled - true if the orthogonal edge router should take the node labels into consideration, false otherwise
Sample Graphs:

false

true

isConsiderNodeLabelsEnabled

public boolean isConsiderNodeLabelsEnabled()
Specifies whether or not the orthogonal edge router considers the labels of the nodes as obstacles when calculating the edge routes to avoid overlaps.

Returns:
true if the orthogonal edge router takes the node labels into consideration, false otherwise
See Also:
setConsiderNodeLabelsEnabled(boolean)

getMonotonicPathRestriction

public byte getMonotonicPathRestriction()
Returns the monotonic path restrictions that should be applied.

Monotonic path restrictions imply that (ideally) the vertical and/or horizontal segments of an edge path are directed from the source node towards the target node without ever changing their direction back towards the source node.

Returns:
one of the given monotonic path restrictions
See Also:
setMonotonicPathRestriction(byte)

setMonotonicPathRestriction

public void setMonotonicPathRestriction(byte monotonicPathRestriction)
Specifies the monotonic path restrictions that should be applied.

Monotonic path restrictions imply that (ideally) the vertical and/or horizontal segments of an edge path are directed from the source node towards the target node without ever changing their direction back towards the source node.

Default Value:
The default value is MONOTONIC_NONE. No path restrictions are used.
Parameters:
monotonicPathRestriction - the given monotonic path restriction
Throws:
java.lang.IllegalArgumentException - if the given argument is an unknown monotonic path restriction

isEnforceMonotonicPathRestrictions

public boolean isEnforceMonotonicPathRestrictions()
Returns whether or not monotonic path restrictions should be enforced.

 
Enabling this option guarantees that path restrictions specified by setMonotonicPathRestriction(byte) will be enforced such that only monotonic edge paths occur in the diagram. However, it is possible that additional overlaps between edges and nodes will be introduced.
Returns:
true if monotonic path restrictions are enforced, false otherwise
See Also:
setEnforceMonotonicPathRestrictions(boolean)

setEnforceMonotonicPathRestrictions

public void setEnforceMonotonicPathRestrictions(boolean enforceMonotonicPathRestrictions)
Specifies whether or not monotonic path restrictions should be enforced.

 
Enabling this option guarantees that path restrictions specified by setMonotonicPathRestriction(byte) will be enforced such that only monotonic edge paths occur in the diagram. However, it is possible that additional overlaps between edges and nodes will be introduced.
Default Value:
The default value is false.
Parameters:
enforceMonotonicPathRestrictions - true if monotonic path restrictions should be enforced, false otherwise
Sample Graphs:

Monotonic vertical path restriction is not enforced and cannot be obeyed due to the obstacle node

Monotonic vertical path restriction is enforced leading the edge to cross the obstacle node

canLayout

public boolean canLayout(LayoutGraph graph)
Checks whether or not the given graph can be handled by this edge routing algorithm. This is always true unless the user specifies a core layout algorithm that cannot handle this graph or if the width/height of a node is zero.

Parameters:
graph - the input graph
Returns:
true if the input graph can be handled by this edge routing algorithm, false otherwise
See Also:
Layouter.doLayout(LayoutGraph)

doLayout

public void doLayout(LayoutGraph graph)
Performs the orthogonal routing of the edges of the input graph.

This method also prepares the graph for the edge routing process.

 
The given graph will not be copied during the edge routing process and the result will be immediately applied to the input graph.
Parameters:
graph - the input graph
See Also:
Layouter.canLayout(LayoutGraph)

checkNodeSize

protected void checkNodeSize(GraphLayout layout,
                             java.lang.Object node)
                      throws java.lang.IllegalArgumentException
Checks whether or not the width/height of a given node is zero or negative.

This method is called by doLayout(LayoutGraph) for each node of the input graph. It may be overridden in order to obtain a custom implementation of node-size check.

Parameters:
layout - a given GraphLayout instance
node - a given node object
Throws:
java.lang.IllegalArgumentException - if the width/height of the node object is zero or negative
See Also:
checkGroupNodeSize(GraphLayout,Object)

checkGroupNodeSize

protected void checkGroupNodeSize(GraphLayout layout,
                                  java.lang.Object node)
                           throws java.lang.IllegalArgumentException
Checks whether or not the width/height of a given group node is zero or negative.

This method is called by doLayout(LayoutGraph) for each group node of the input graph. It may be overridden in order to obtain a custom implementation of group-node-size check.

Parameters:
layout - a given GraphLayout instance
node - a given group node object
Throws:
java.lang.IllegalArgumentException - if the width/height of the group node object is zero or negative
See Also:
checkNodeSize(GraphLayout,Object)

setCrossingCost

public void setCrossingCost(double cost)
Specifies the cost of each edge crossing.

A cost of value n means that it is more profitable for a path to change its direction n times rather than crossing the path of an edge.

This option is performed globally, i.e. to an entire edge path, in contrast to setLocalCrossingMinimizationEnabled(boolean enabled).

The cost has to be non-negative.

 
A good trade-off between the number of changes in direction and the number of crossings of an edge path is achieved by selecting values between 1.0 and 3.0.
Default Value:
The default value is 1.5.
Parameters:
cost - a non-negative cost value
Throws:
java.lang.IllegalArgumentException - if the given cost is negative
Sample Graphs:

Crossing cost 1.0

Crossing cost 3.0

getCrossingCost

public double getCrossingCost()
Returns the cost of each edge crossing.

A cost of value n means that it is more profitable for a path to change its direction n times rather than crossing the path of an edge.

This option is performed globally, i.e. to an entire edge path, in contrast to setLocalCrossingMinimizationEnabled(boolean enabled).

The cost has to be non-negative.

 
A good trade-off between the number of changes in direction and the number of crossings of an edge path is achieved by selecting values between 1.0 and 3.0.
Returns:
a non-negative cost value
See Also:
setCrossingCost(double)

setReroutingEnabled

public void setReroutingEnabled(boolean enabled)
Specifies whether or not the orthogonal edge router performs an additional step to reroute the edges such that the number of edge crossings is reduced.

 
The rerouting step will only take effect if a value greater than 0.0 is assigned to the global crossing cost.
Default Value:
The default value is false.
Parameters:
enabled - true if the rerouting step should be performed, false otherwise
Sample Graphs:

Crossing cost 3.0 and rerouting crossing edges disabled

Crossing cost 3.0 and rerouting crossing edges enabled

isReroutingEnabled

public boolean isReroutingEnabled()
Returns whether or not the orthogonal edge router performs an additional step to reroute the edges such that the number of edge crossings is reduced.

 
The rerouting step will only take effect if a value greater than 0.0 is assigned to the global crossing cost.
Returns:
true if the rerouting step is performed, false otherwise
See Also:
setReroutingEnabled(boolean)

setSphereOfAction

public void setSphereOfAction(byte scope)
Specifies a (sub-)set of edges that shall be routed by the orthogonal edge router.

Default Value:
The default value is ROUTE_ALL_EDGES
Parameters:
scope - one of the predefined scope values
Throws:
java.lang.IllegalArgumentException - if the given argument is none of the above constants
See Also:
getSelectedEdgesDpKey(), getSelectedNodesDpKey()

getSphereOfAction

public byte getSphereOfAction()
Returns a (sub-)set of edges that shall be routed by the edge router.

Returns:
one of the predefined scope values
See Also:
setSphereOfAction(byte), getSelectedEdgesDpKey()

setGridRoutingEnabled

public void setGridRoutingEnabled(boolean enabled)
Specifies whether or not the edge segments are routed on grid lines.

If this option is disabled, the specified grid spacing/origin is ignored.

Default Value:
The default value is false.
Parameters:
enabled - true if edge segments should be routed on a grid, false otherwise
See Also:
setGridOrigin(int, int), setGridSpacing(int)
Sample Graphs:

false

true

isGridRoutingEnabled

public boolean isGridRoutingEnabled()
Returns whether or not the edge segments are routed on grid lines.

If this option is disabled, the specified grid spacing/origin is ignored.

Returns:
true if edge segments are routed on a grid, false otherwise
See Also:
setGridRoutingEnabled(boolean), setGridOrigin(int, int), setGridSpacing(int)

setGridOrigin

public void setGridOrigin(int x,
                          int y)
Specifies the coordinates of the point on which the grid starts.

 
This option will only take effect if grid routing is enabled.
Default Value:
The default value is (0,. 0)
Parameters:
x - the x-coordinate of the point
y - the y-coordinate of the point
See Also:
setGridRoutingEnabled(boolean), setGridSpacing(int)

getGridOrigin

public YPoint getGridOrigin()
Returns the point on which the grid starts.

 
This option will take effect only if grid routing is enabled.
Returns:
the point on which the grid starts
See Also:
setGridOrigin(int, int), setGridRoutingEnabled(boolean), setGridSpacing(int)

setGridSpacing

public void setGridSpacing(int spacing)
Specifies the equidistant spacing between the horizontal and vertical grid lines.

Positive values greater than 2 are allowed. Positive values less than 2 are ignored, while negative values are mapped to their absolute value.

 
This option will take effect only if grid routing is enabled.
Default Value:
The default value is 2.
Parameters:
spacing - the grid spacing
See Also:
setGridRoutingEnabled(boolean)
Sample Graphs:

Grid spacing 10

Grid spacing 20

getGridSpacing

public int getGridSpacing()
Returns the equidistant spacing between the horizontal and vertical grid lines.

Positive values greater than 2 are allowed. Positive values less than 2 are ignored, while negative values are mapped to their absolute value.

 
This option will take effect only if grid routing is enabled.
Returns:
the grid spacing
See Also:
setGridSpacing(int), setGridRoutingEnabled(boolean)

setMinimumDistance

public void setMinimumDistance(int dist)
Specifies the minimum distance between any two edge segments.

Positive values greater than 4 are allowed. Positive values less than 4 are ignored, while negative values are mapped to their absolute values.

 
If the minimum distances are coupled (as holds by default), half of this value is automatically considered as the minimum distance between edge segments and nodes.
Default Value:
The default value is 4.
Parameters:
dist - the minimum distance
Sample Graphs:

Minimum distance 4

Minimum distance 15

getMinimumDistance

public int getMinimumDistance()
Specifies the minimum distance between any two edge segments.

Positive values greater than 4 are allowed. Positive values less than 4 are ignored, while negative values are mapped to their absolute values.

 
If the minimum distances are coupled (as holds by default), half of this value is automatically considered as the minimum distance between edge segments and nodes.
Returns:
dist the minimum distance
See Also:
setMinimumDistance(int)

setCoupledDistances

public void setCoupledDistances(boolean coupled)
Specifies whether or not the minimum distances should be coupled. If they are coupled, the minimum distance between edge segments and nodes is equal to half of the value returned by getMinimumDistance(). Otherwise, the algorithm uses the custom value returned by getMinimumDistanceToNode().

Default Value:
The default value is true.
Parameters:
coupled - true if minimum distances should be coupled, false otherwise
See Also:
setMinimumDistance(int), setMinimumDistanceToNode(int)

getCoupledDistances

public boolean getCoupledDistances()
Returns whether or not the minimum distances are coupled. If they are coupled, the minimum distance between edge segments and nodes is equal to half of the value returned by getMinimumDistance(). Otherwise, the algorithm uses the custom value returned by getMinimumDistanceToNode().

Returns:
true if minimum distances are coupled, false otherwise
See Also:
setCoupledDistances(boolean), setMinimumDistance(int), setMinimumDistanceToNode(int)

setMinimumDistanceToNode

public void setMinimumDistanceToNode(int dist)
Specifies the minimum distance between edge segments and nodes.

Positive values greater than 2 are allowed. Positive values less than 2 are ignored, while negative values are mapped to their absolute values.

 
If the minimum distances are coupled (as holds by default), the algorithm ignores this value.
Default Value:
The default value is 2.
Parameters:
dist - the minimum distance
See Also:
setMinimumDistance(int), setCoupledDistances(boolean)
Sample Graphs:

Minimum distance between edge segments and nodes 10

Minimum distance between edge segments and nodes 15

getMinimumDistanceToNode

public int getMinimumDistanceToNode()
Returns the minimum distance between edge segments and nodes.

Positive values greater than 2 are allowed. Positive values less than 2 are ignored, while negative values are mapped to their absolute values.

 
If the minimum distances are coupled (as holds by default), the algorithm ignores this value.
Returns:
the minimum distance
See Also:
setMinimumDistanceToNode(int), setMinimumDistance(int), setCoupledDistances(boolean)

setLocalCrossingMinimizationEnabled

public void setLocalCrossingMinimizationEnabled(boolean enabled)
Specifies whether or not a local crossing minimization strategy should be applied. If this option is enabled, the number of crossings between edges incident to the same side of a node is reduced.

Default Value:
The default value is true.
Parameters:
enabled - true if a local crossing minimization strategy should be applied, false otherwise
Sample Graphs:

false

true

isLocalCrossingMinimizationEnabled

public boolean isLocalCrossingMinimizationEnabled()
Returns whether or not a local crossing minimization strategy should be applied. If this option is enabled, the number of crossings between edges incident to the same side of a node is reduced.

Returns:
true if a local crossing minimization strategy is applied, false otherwise
See Also:
setLocalCrossingMinimizationEnabled(boolean)

setCenterToSpaceRatio

public void setCenterToSpaceRatio(double csr)
Specifies the ratio between two complementary weighting strategies during path searching. These two available weighting strategies are:

If the ratio is negative or zero, space driven strategy will be selected.

Default Value:
The default value is 0.5.
Parameters:
csr - the desired ratio
Sample Graphs:

Ratio 0.0 - Space driven strategy

Ratio 0.5 - Balanced

Ratio 1.0 - Center driven strategy

getCenterToSpaceRatio

public double getCenterToSpaceRatio()
Returns the ratio between two complementary weighting strategies during path searching. These two available weighting strategies are:

If the ratio is negative or zero, space driven strategy will be selected.

Returns:
the desired ratio
See Also:
setCenterToSpaceRatio(double)

setRoutingStyle

public void setRoutingStyle(byte style)
Specifies the preferred edge routing style.

Default Value:
The default value is STYLE_BALANCED
Parameters:
style - one of the predefined routing styles

getRoutingStyle

public byte getRoutingStyle()
Returns the preferred edge routing style.

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

setBadOrthogonal

public void setBadOrthogonal(boolean value)
Specifies whether or not edges that cannot be routed should be drawn in an orthogonal fashion.

If this option is disabled, edges that cannot be routed due to lack of space will be routed as straight-line segments.

Default Value:
The default value is true.
Parameters:
value - true if edges that cannot be routed should be drawn orthogonal, false otherwise
Sample Graphs:

false

true

getBadOrthogonal

public boolean getBadOrthogonal()
Returns whether or not edges that cannot be routed should be drawn in an orthogonal fashion.

If this option is disabled, edges that cannot be routed due to lack of space will be routed as straight-line segments.

Returns:
true if edges that cannot be routed are drawn orthogonal, false otherwise
See Also:
setBadOrthogonal(boolean)

setCustomBorderCapacityEnabled

public void setCustomBorderCapacityEnabled(boolean value)
Specifies whether or not to use a custom value for the capacity of parallel edge paths accommodated on the routing border.

The routing border contains the space left of the leftmost node, right of the rightmost node, above the topmost node, and below the bottommost node.

Default Value:
The default value is false.
Parameters:
value - true if a custom capacity should be used, false otherwise
See Also:
setCustomBorderCapacity(int)

getCustomBorderCapacityEnabled

public boolean getCustomBorderCapacityEnabled()
Returns whether or not to use a custom value for the capacity of parallel edge paths accommodated on the routing border.

The routing border contains the space left of the leftmost node, right of the rightmost node, above the topmost node, and below the bottommost node.

Default Value:
The default value is false.
Returns:
true if a custom capacity is used, false otherwise
See Also:
setCustomBorderCapacityEnabled(boolean), setCustomBorderCapacity(int)

setCustomBorderCapacity

public void setCustomBorderCapacity(int value)
Specifies the number of parallel edge paths that may be accommodated on the routing border around the graph's bounding box.

The routing border contains the space on the left of the leftmost node, on the right of the rightmost node, above the topmost node, and below the bottommost node.

If a negative value is given as input, its absolute value will be used instead.

 
This option will take effect only if getCustomBorderCapacityEnabled() returns true.
Default Value:
The default value is 5.
Parameters:
value - the capacity value
Sample Graphs:

Custom border capacity 5. Only 10 out of 13 parallel edges can be routed, 5 on the top and 5 on the bottom. Edges that cannot be routed cross the obstacle node.

Custom border capacity 10. All parallel edges can be routed.

getCustomBorderCapacity

public int getCustomBorderCapacity()
Returns the number of parallel edge paths that may be accommodated on the routing border around the graph's bounding box.

The routing border contains the space on the left of the leftmost node, on the right of the rightmost node, above the topmost node, and below the bottommost node.

If a negative value is given as input, its absolute value will be used instead.

 
This option will take effect only if getCustomBorderCapacityEnabled() returns true.
Returns:
the capacity value
See Also:
setCustomBorderCapacity(int)

setInnerPortsEnabled

public void setInnerPortsEnabled(boolean value)
Specifies whether or not edge ports that do not have a strong port constraint should lie in the interior of the bounding box or on the border of a node.

The interior of the bounding box refers to the meridian of the node for edges connecting to the left and to the right side or to the equator of the node for edges connecting to the upper and to the lower side.

Default Value:
The default value is false.
Parameters:
value - true if edge ports should lie in the interior or on the border of the node, false otherwise
Sample Graphs:

Inner port are disabled. Black rectangles on the nodes' borders correspond to edge ports.

Inner port are enabled. Black rectangles in the interior of nodes correspond to edge ports.

isInnerPortsEnabled

public boolean isInnerPortsEnabled()
Returns whether or not edge ports that do not have a strong port constraint should lie in the interior of the bounding box or on the border of a node.

The interior of the bounding box refers to the meridian of the node for edges connecting to the left and to the right side or to the equator of the node for edges connecting to the upper and to the lower side.

Returns:
true if edge ports lie in the interior or on the border of the node, false otherwise
See Also:
setInnerPortsEnabled(boolean)

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