|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.AbstractLayoutStage
y.layout.router.OrthogonalEdgeRouter
public class OrthogonalEdgeRouter
This class represents an orthogonal edge router. An orthogonal edge router is a layout algorithm that changes the coordinates of the edge paths in a way that the resulting layout of the edges is me up of vertical and horizontal segments only. The router does not change the location or the size of the nodes in a diagram in any way.
Several LayoutStages can be used to enhance performance and/or functionality of this class, e.g. EdgeGroupRouterStage, GroupNodeRouterStage, ReducedSphereOfActionStage or PatchRouterStage.
This edge router will obey strong and weak port constraints. It expects the port constraints to be bound to the input
graph by the data provider keys PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY and PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY. Furthermore, this class supports the more advanced port constraint
concept of PortCandidates. It expects collections of port candidates to be bound to the input graph by the
data provider keys PortCandidate.SOURCE_PCLIST_DPKEY and PortCandidate.TARGET_PCLIST_DPKEY.
The router often finds ideal routes in difficult situations like the one depicted below.

| Field Summary | |
|---|---|
static byte |
ROUTE_ALL_EDGES
Sphere of action specifier. |
static byte |
ROUTE_EDGES_AT_SELECTED_NODES
Sphere of action specifier. |
static byte |
ROUTE_SELECTED_EDGES
Sphere of action specifier. |
static byte |
STYLE_ADHOC
Routing style specifier. |
static byte |
STYLE_PREFERMIDDLE
Routing style specifier. |
static byte |
STYLE_SHORTPATH
Routing style specifier. |
| Fields inherited from interface y.layout.Layouter |
|---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
| Constructor Summary | |
|---|---|
OrthogonalEdgeRouter()
Creates a new instance of the Orthogonal Edge Router. |
|
OrthogonalEdgeRouter(Layouter core)
Convenience constructor to simultaneously set a core layout algorithm which will run before the orthogonal edge router. |
|
| Method Summary | |
|---|---|
boolean |
canLayout(LayoutGraph graph)
Returns true if the specified core layouter does, and also when there is no core layouter. |
void |
doLayout(LayoutGraph graph)
Main entrance to orthogonal edge routing. |
boolean |
getBadOrthogonal()
Returns whether bad edges should be drawn in an orthogonal fashion. |
double |
getCenterToSpaceRatio()
Returns the currently set ratio between the two complementary weighting strategies center driven and space driven. |
boolean |
getCoupledDistances()
Returns whether the minimum distances are coupled. |
double |
getCrossingCost()
Returns the cost for each edge crossing of a routed path. |
int |
getCustomBorderCapacity()
Returns the currently set custom value for the capacity of the routing border around the graph's bounding box. |
boolean |
getCustomBorderCapacityEnabled()
Returns whether a custom value for the capacity of the routing border is used. |
YPoint |
getGridOrigin()
Returns a grid point coordinate used when grid routing is enabled. |
int |
getGridSpacing()
Returns the grid spacing to be assumed when grid routing is enabled. |
int |
getMinimumDistance()
Returns the minimum distance between edge segments. |
int |
getMinimumDistanceToNode()
Returns the minimum distance between edge segments and nodes. |
byte |
getRoutingStyle()
Returns the currently set routing style. |
byte |
getSphereOfAction()
Returns the currently set sphere of action specifier. |
boolean |
isGridRoutingEnabled()
Returns whether or not to route edge segments on grid lines. |
boolean |
isInnerPortsEnabled()
Returns whether edge ports (that do not have a strong port constraint set) should lie inside the node's bounding box or on the node's border. |
boolean |
isLocalCrossingMinimizationEnabled()
Returns whether the local crossing minimization strategy is enabled. |
boolean |
isReroutingEnabled()
Whether rerouting bad edges is enabled. |
void |
setBadOrthogonal(boolean value)
Determines the way that edges which cannot be routed should be drawn. |
void |
setCenterToSpaceRatio(double csr)
Determines the ratio between two complementary weighting strategies, namely center driven and space driven weighting, when looking for an edge path. |
void |
setCoupledDistances(boolean coupled)
Whether or not the minimum distances should be coupled, i.e., whether half the value set for the minimum distance between edge segments should automatically be used as the minimum distance between edge segments and nodes, or a custom value should be used instead. |
void |
setCrossingCost(double cost)
Sets the cost for each edge crossing of a routed path. |
void |
setCustomBorderCapacity(int value)
Determines the custom value for the capacity of the routing border around the graph's bounding box. |
void |
setCustomBorderCapacityEnabled(boolean value)
Whether or not a custom value for the capacity of the routing border around the graph's bounding box should be applied. |
void |
setGridOrigin(int x,
int y)
Sets a grid point coordinate used when grid routing is enabled. |
void |
setGridRoutingEnabled(boolean enabled)
Whether or not to route edge segments on grid lines. |
void |
setGridSpacing(int spacing)
Sets the grid spacing to be assumed when grid routing is enabled. |
void |
setInnerPortsEnabled(boolean value)
Whether edge ports (that do not have a strong port constraint set) should lie inside the node's bounding box or on the node's border. |
void |
setLocalCrossingMinimizationEnabled(boolean enabled)
Whether or not a local crossing minimization strategy should be applied. |
void |
setMinimumDistance(int dist)
Sets the minimum distance between edge segments. |
void |
setMinimumDistanceToNode(int dist)
Sets the minimum distance between edge segments and nodes. |
boolean |
setProperty(String key,
Object value)
For internal use only. |
void |
setReroutingEnabled(boolean enabled)
Whether or not to enable a further crossing minimization optimization based on rerouting edges that cross many edges. |
void |
setRoutingStyle(byte style)
Sets the preferred routing style for the edges to be routed. |
void |
setSphereOfAction(byte sphere)
Sets the edge (sub-)set to be routed. |
| 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 |
|---|
public static final byte ROUTE_ALL_EDGES
setSphereOfAction(byte),
Constant Field Valuespublic static final byte ROUTE_SELECTED_EDGES
Layouter.SELECTED_EDGES.
Graph.addDataProvider(Object,DataProvider),
setSphereOfAction(byte),
Constant Field Valuespublic static final byte ROUTE_EDGES_AT_SELECTED_NODES
Layouter.SELECTED_NODES.
Graph.addDataProvider(Object,DataProvider),
setSphereOfAction(byte),
Constant Field Valuespublic static final byte STYLE_ADHOC
setRoutingStyle(byte),
Constant Field Valuespublic static final byte STYLE_SHORTPATH
setRoutingStyle(byte),
Constant Field Valuespublic static final byte STYLE_PREFERMIDDLE
setRoutingStyle(byte),
Constant Field Values| Constructor Detail |
|---|
public OrthogonalEdgeRouter()
setSphereOfAction(byte),
setGridRoutingEnabled(boolean),
setRoutingStyle(byte),
setBadOrthogonal(boolean)public OrthogonalEdgeRouter(Layouter core)
OrthogonalEdgeRouter()| Method Detail |
|---|
public boolean canLayout(LayoutGraph graph)
true if the specified core layouter does, and also when there is no core layouter.
public void doLayout(LayoutGraph graph)
public boolean setProperty(String key,
Object value)
public void setCrossingCost(double cost)
n means that a path rather changes
direction n times than crossing the path of an edge. By default the cost is set to 0 and
therefore no global crossing optimization is performed. Setting a higher value will activate global crossing
minimization. A good trade-off between the number of direction changes and few crossings of a path is achieved by
values between 1 and 3.
public double getCrossingCost()
setCrossingCost(double)public void setReroutingEnabled(boolean enabled)
0.
setCrossingCost(double)public boolean isReroutingEnabled()
setReroutingEnabled(boolean)public void setSphereOfAction(byte sphere)
ROUTE_ALL_EDGES.
sphere - One of ROUTE_SELECTED_EDGES, ROUTE_EDGES_AT_SELECTED_NODES, and ROUTE_ALL_EDGES.Layouter.SELECTED_EDGES,
Layouter.SELECTED_NODESpublic byte getSphereOfAction()
setSphereOfAction(byte)public void setGridRoutingEnabled(boolean enabled)
setGridOrigin(int,int),
setGridSpacing(int)public boolean isGridRoutingEnabled()
setGridRoutingEnabled(boolean)
public void setGridOrigin(int x,
int y)
(0, 0) is set.
setGridRoutingEnabled(boolean)public YPoint getGridOrigin()
setGridOrigin(int,int)public void setGridSpacing(int spacing)
2 is set,
which is also the minimum allowed spacing.
spacing - Integral value that determines the desired grid spacing. Positive values less than 2 are ignored,
negative values are mapped to their absolute.setGridRoutingEnabled(boolean)public int getGridSpacing()
setGridSpacing(int)public void setMinimumDistance(int dist)
2 is set, which is also the
minimum allowed distance.
dist - Integral value that determines the desired distance. Positive values less than 4 are
ignored, negative values are mapped to their absolute.
Note: If the minimum distances are coupled (as is the default), half the value as set here is automatically used as the minimum distance between edge segments and nodes.
setCoupledDistances(boolean),
setMinimumDistanceToNode(int)public int getMinimumDistance()
setMinimumDistance(int)public void setCoupledDistances(boolean coupled)
By default the minimum distances are coupled.
setMinimumDistance(int),
setMinimumDistanceToNode(int)public boolean getCoupledDistances()
setCoupledDistances(boolean)public void setMinimumDistanceToNode(int dist)
dist - Integral value that determines the desired distance. Positive values less than 2 are
ignored, negative values are mapped to their absolute.
Note: If the minimum distances are coupled (as is the default), half the value as set for the minimum distance between edge segments is automatically used here.
setCoupledDistances(boolean),
setMinimumDistance(int)public int getMinimumDistanceToNode()
setMinimumDistanceToNode(int)public void setLocalCrossingMinimizationEnabled(boolean enabled)
public boolean isLocalCrossingMinimizationEnabled()
setLocalCrossingMinimizationEnabled(boolean)public void setCenterToSpaceRatio(double csr)
csr - Ranges from 0.0 to 1.0; higher values give more emphasis to edge paths closer
to an edge's center. The default is an equal weighting of center driven and space driven strategy, i.e.,
csr equals 0.5.public double getCenterToSpaceRatio()
setCenterToSpaceRatio(double)public void setRoutingStyle(byte style)
STYLE_PREFERMIDDLE.
style - One of STYLE_ADHOC, STYLE_SHORTPATH, and STYLE_PREFERMIDDLE.public byte getRoutingStyle()
setRoutingStyle(byte)public void setBadOrthogonal(boolean value)
Default setting is true.
public boolean getBadOrthogonal()
setBadOrthogonal(boolean)public void setCustomBorderCapacityEnabled(boolean value)
Default setting is false.
setCustomBorderCapacity(int)public boolean getCustomBorderCapacityEnabled()
setCustomBorderCapacityEnabled(boolean),
setCustomBorderCapacity(int)public void setCustomBorderCapacity(int value)
public int getCustomBorderCapacity()
setCustomBorderCapacity(int)public void setInnerPortsEnabled(boolean value)
Default setting is false.
public boolean isInnerPortsEnabled()
setInnerPortsEnabled(boolean)
|
© Copyright 2000-2008, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||