|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.router.OrganicEdgeRouter
public class OrganicEdgeRouter
This algorithm routes edges using an organic-like layout approach and style.
It is implemented as a LayoutStage so that it can easily be appended to
another stage, by setting the other stage as the core of this one.
Note that this algorithm only works correctly if it is guaranteed that nodes are at
least approximately twice as far away from each other as the minimal edge
distance, which has been set for this algorithm. This can be achieved by using
the createNodeEnlargementStage()
layout stage in combination with a stage
that removes node overlaps as the core of this layouter.
SmartOrganicLayouter
:
Field Summary | |
---|---|
static Object |
ROUTE_EDGE_DPKEY
Use this key to provide the algorithm with boolean values for each edge, specifying the ones which should be rerouted. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
OrganicEdgeRouter()
Creates a new instance of OrganicEdgeRouter with an initial minimal distance of 10 . |
|
OrganicEdgeRouter(double minNodeDistance)
Creates a new instance of OrganicEdgeRouter using the given initial minimal distance |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Returns true iff the given graph can be laid
out by this algorithm. |
protected void |
checkGroupNodeSize(GraphLayout layout,
Object node)
This method throws an IllegalArgumentException if the width/height of the given group node object is zero. |
protected void |
checkNodeSize(GraphLayout layout,
Object node)
This method throws an IllegalArgumentException if the width/height of the given node object is zero. |
LayoutStage |
createNodeEnlargementStage()
This will return a layout stage which can be given a core layouter, which itself should assure that the nodes do not overlap. |
void |
doLayout(LayoutGraph graph)
Main layout routine that assigns new layout information to the given graph. |
Layouter |
getCoreLayouter()
Returns the core layouter. |
double |
getMinimalDistance()
Returns the minimal distance between nodes and non-incident edges. |
boolean |
isEdgeNodeOverlapAllowed()
Returns whether or not edge-node overlaps are allowed. |
boolean |
isRoutingAll()
Returns whether edges should be rerouted even if they do not obey all constraints initially. |
boolean |
isUsingBends()
Returns whether given bend coordinates are taken into account when determining initial bend positions. |
void |
setCoreLayouter(Layouter l)
Sets the core layouter. |
void |
setEdgeNodeOverlapAllowed(boolean edgeNodeOverlapAllowed)
Enabling this option often leads to better results if the createNodeEnlargementStage() LayoutStage is not used
(e.g. because the nodes are not allowed to move) and the distances between some nodes are small. |
void |
setMinimalDistance(double minimalDistance)
Specifies the minimal distance the algorithm should guarantee between nodes and non-incident edges. |
void |
setRoutingAll(boolean routingAll)
Specifies whether edges should be rerouted even if they do not obey all constraints initially. |
void |
setUsingBends(boolean usingBends)
Specifies whether given bend coordinates are taken into account when determining initial bend positions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object ROUTE_EDGE_DPKEY
Constructor Detail |
---|
public OrganicEdgeRouter()
10
.
public OrganicEdgeRouter(double minNodeDistance)
Method Detail |
---|
public boolean canLayout(LayoutGraph graph)
Layouter
true
iff the given graph can be laid
out by this algorithm. Calling doLayout
with
the given graph as its argument will only success if
this method returns true
.
canLayout
in interface Layouter
public boolean isEdgeNodeOverlapAllowed()
createNodeEnlargementStage()
LayoutStage is not used
(e.g. because the nodes are not allowed to move) and the distances between some nodes are small.
However enabling this option may produce edge-node overlaps. Furthermore, the minimal distance (set with
setMinimalDistance(double)
cannot always be maintained in that case.
setEdgeNodeOverlapAllowed(boolean)
,
createNodeEnlargementStage()
,
setMinimalDistance(double)
public void setEdgeNodeOverlapAllowed(boolean edgeNodeOverlapAllowed)
createNodeEnlargementStage()
LayoutStage is not used
(e.g. because the nodes are not allowed to move) and the distances between some nodes are small.
However enabling this option may produce edge-node overlaps. Furthermore, the minimal distance (set with
setMinimalDistance(double)
) cannot always be maintained in that case.
edgeNodeOverlapAllowed
- true if edge-node overlaps should be allowed.isEdgeNodeOverlapAllowed()
,
createNodeEnlargementStage()
,
setMinimalDistance(double)
public void doLayout(LayoutGraph graph)
Layouter
doLayout
in interface Layouter
protected void checkNodeSize(GraphLayout layout, Object node) throws IllegalArgumentException
IllegalArgumentException
if the width/height of the given node object is zero.
It is called by the doLayout(LayoutGraph)
method for each node object in the input graph.
IllegalArgumentException
- thrown if the width/height of the node object is zero.layout
- a graph layout object.node
- the node object to test.checkGroupNodeSize(GraphLayout,Object)
protected void checkGroupNodeSize(GraphLayout layout, Object node) throws IllegalArgumentException
IllegalArgumentException
if the width/height of the given group node object is zero.
It is called by the doLayout(LayoutGraph)
method for each group node object in the input graph.
IllegalArgumentException
- thrown if the width/height of the group node object is zero.layout
- a graph layout object.node
- the group node object to test.checkNodeSize(GraphLayout,Object)
public Layouter getCoreLayouter()
getCoreLayouter
in interface LayoutStage
public void setCoreLayouter(Layouter l)
setCoreLayouter
in interface LayoutStage
public double getMinimalDistance()
public void setMinimalDistance(double minimalDistance)
public boolean isUsingBends()
public void setUsingBends(boolean usingBends)
public boolean isRoutingAll()
false
so that if edges that do not intersect with other nodes will not be rerouted
by this algorithm.
public void setRoutingAll(boolean routingAll)
false
so that if edges that do not intersect with other nodes will not be rerouted
by this algorithm.
public LayoutStage createNodeEnlargementStage()
RemoveOverlapsLayoutStage rmos = new RemoveOverlapsLayoutStage(0); LayoutStage nodeEnlarger = router.createNodeEnlargementStage(); final CompositeLayoutStage cls = new CompositeLayoutStage(); cls.appendStage(nodeEnlarger); cls.appendStage(new BendConverter()); cls.appendStage(rmos); OrganicEdgeRouter oer = new OrganicEdgeRouter(); oer.setCoreLayouter(cls); oer.doLayout(myGraph);
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |