|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.layout.AbstractLayoutStage | +--y.layout.router.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 made 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.
This edge router can 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
Precondition: In the current version, the input graph may not contain any self-loops.
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 false if the graph contains any self-loops, else
true . |
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. |
int |
getCustomBorderCapacity()
Returns the currently set custom value for the capacity of the routing border around the graph's bounding box. |
boolean |
getCustomBorderCapacityEnabled()
Returns the a custom value for the capacity of the routing border should be applied. |
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. |
String |
getStatistics()
Returns statistical information about the Orthogonal Edge Router. |
boolean |
isGridRoutingEnabled()
Returns whether or not to route edge segments on grid lines. |
boolean |
isInnerPortsEnabled()
Returns whether edge ports should lay inside the node's bounding box or on its border. |
boolean |
isLocalCrossingMinimizationEnabled()
Returns whether the local crossing minimization strategy 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 |
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 should lay inside the node's bounding box or on its 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)
|
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
OrthogonalEdgeRouter.setSphereOfAction(byte)
,
Constant Field Valuespublic static final byte ROUTE_SELECTED_EDGES
Layouter.SELECTED_EDGES
.
Graph.addDataProvider(Object, DataProvider)
,
OrthogonalEdgeRouter.setSphereOfAction(byte)
,
Constant Field Valuespublic static final byte ROUTE_EDGES_AT_SELECTED_NODES
Layouter.SELECTED_NODES
.
Graph.addDataProvider(Object, DataProvider)
,
OrthogonalEdgeRouter.setSphereOfAction(byte)
,
Constant Field Valuespublic static final byte STYLE_ADHOC
OrthogonalEdgeRouter.setRoutingStyle(byte)
,
Constant Field Valuespublic static final byte STYLE_SHORTPATH
OrthogonalEdgeRouter.setRoutingStyle(byte)
,
Constant Field Valuespublic static final byte STYLE_PREFERMIDDLE
OrthogonalEdgeRouter.setRoutingStyle(byte)
,
Constant Field ValuesConstructor Detail |
public OrthogonalEdgeRouter()
OrthogonalEdgeRouter.setSphereOfAction(byte)
,
OrthogonalEdgeRouter.setGridRoutingEnabled(boolean)
,
OrthogonalEdgeRouter.setRoutingStyle(byte)
,
OrthogonalEdgeRouter.setBadOrthogonal(boolean)
public OrthogonalEdgeRouter(Layouter core)
OrthogonalEdgeRouter.OrthogonalEdgeRouter()
Method Detail |
public boolean canLayout(LayoutGraph graph)
false
if the graph contains any self-loops, else
true
.
public void doLayout(LayoutGraph graph)
OrthogonalEdgeRouter.setSphereOfAction(byte)
,
OrthogonalEdgeRouter.setGridRoutingEnabled(boolean)
, and
OrthogonalEdgeRouter.setMinimumDistance(int)
/
OrthogonalEdgeRouter.setGridSpacing(int)
, respectively.
These are the three basic main options. Further aspects can be set by
the methods
OrthogonalEdgeRouter.setRoutingStyle(byte)
, and
OrthogonalEdgeRouter.setBadOrthogonal(boolean)
.
Precondition:
Note, that the given graph should not contain any self-loops.
public boolean setProperty(String key, Object value)
public String getStatistics()
public void setSphereOfAction(byte sphere)
sphere
- One of OrthogonalEdgeRouter.ROUTE_SELECTED_EDGES
, OrthogonalEdgeRouter.ROUTE_EDGES_AT_SELECTED_NODES
and OrthogonalEdgeRouter.ROUTE_ALL_EDGES
.Layouter.SELECTED_EDGES
,
Layouter.SELECTED_NODES
public byte getSphereOfAction()
OrthogonalEdgeRouter.setSphereOfAction(byte)
public void setGridRoutingEnabled(boolean enabled)
OrthogonalEdgeRouter.setGridOrigin(int, int)
,
OrthogonalEdgeRouter.setGridSpacing(int)
public boolean isGridRoutingEnabled()
public void setGridOrigin(int x, int y)
(0, 0)
is set.
OrthogonalEdgeRouter.setGridRoutingEnabled(boolean)
public YPoint getGridOrigin()
public void setGridSpacing(int spacing)
2
is set. This 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.OrthogonalEdgeRouter.setGridRoutingEnabled(boolean)
public int getGridSpacing()
public void setMinimumDistance(int dist)
2
is set. This 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.
OrthogonalEdgeRouter.setCoupledDistances(boolean)
,
OrthogonalEdgeRouter.setMinimumDistanceToNode(int)
public int getMinimumDistance()
public void setCoupledDistances(boolean coupled)
OrthogonalEdgeRouter.setMinimumDistanceToNode(int)
,
OrthogonalEdgeRouter.setMinimumDistance(int)
public boolean getCoupledDistances()
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.
OrthogonalEdgeRouter.setCoupledDistances(boolean)
,
OrthogonalEdgeRouter.setMinimumDistance(int)
public int getMinimumDistanceToNode()
public void setLocalCrossingMinimizationEnabled(boolean enabled)
public boolean isLocalCrossingMinimizationEnabled()
OrthogonalEdgeRouter.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()
OrthogonalEdgeRouter.setCenterToSpaceRatio(double)
public void setRoutingStyle(byte style)
OrthogonalEdgeRouter.STYLE_PREFERMIDDLE
.
style
- One of OrthogonalEdgeRouter.STYLE_ADHOC
, OrthogonalEdgeRouter.STYLE_SHORTPATH
and
OrthogonalEdgeRouter.STYLE_PREFERMIDDLE
.public byte getRoutingStyle()
OrthogonalEdgeRouter.setRoutingStyle(byte)
public void setBadOrthogonal(boolean value)
public boolean getBadOrthogonal()
OrthogonalEdgeRouter.setBadOrthogonal(boolean)
public void setCustomBorderCapacityEnabled(boolean value)
OrthogonalEdgeRouter.setCustomBorderCapacity(int)
public boolean getCustomBorderCapacityEnabled()
OrthogonalEdgeRouter.setCustomBorderCapacity(int)
public void setCustomBorderCapacity(int value)
public int getCustomBorderCapacity()
OrthogonalEdgeRouter.setCustomBorderCapacity(int)
public void setInnerPortsEnabled(boolean value)
public boolean isInnerPortsEnabled()
OrthogonalEdgeRouter.setInnerPortsEnabled(boolean)
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |