|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.CanonicMultiStageLayouter y.layout.random.RandomLayouter
public class RandomLayouter
This layout algorithm arranges the graph in a random fashion.
The nodes are placed at random positions. Edges connect the nodes with a straight line, anchored in the center of the nodes.
The layout algorithm iterates over all nodes and places them at random locations. All bends are removed from the edges and their ports move to the center of the incident nodes.
It is possible to specify a rectangular area
in which all nodes are placed.
To get the same random layout in several runs, a constant seed
can be set.
Field Summary |
---|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
RandomLayouter()
Creates a new instance of RandomLayouter with default settings. |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Accepts all general graphs without exception. |
void |
doLayoutCore(LayoutGraph graph)
Places the nodes at random positions. |
java.awt.Rectangle |
getLayoutBounds()
Returns a rectangular area that confines the layout. |
long |
getSeed()
Returns the seed for the randomization of the node locations. |
void |
setLayoutBounds(java.awt.Rectangle r)
Specifies a rectangular area that confines the layout. |
void |
setSeed(long seed)
Specifies the seed for the randomization of the node locations. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomLayouter()
RandomLayouter
with default settings.
Method Detail |
---|
public void setLayoutBounds(java.awt.Rectangle r)
Rectangle
. A square located at (0,0)
whose width and height are 500
.r
- the rectangle that defines the layout space
java.lang.IllegalArgumentException
- if the specified rectangle is null
Rectangle with width 500 and height 500 | Rectangle with width 600 and height 200 |
public java.awt.Rectangle getLayoutBounds()
setLayoutBounds(Rectangle)
public boolean canLayoutCore(LayoutGraph graph)
canLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
true
for all graphspublic void doLayoutCore(LayoutGraph graph)
doLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graphpublic long getSeed()
setSeed(long)
public void setSeed(long seed)
System.currentTimeMillis()
. seed
- the randomization seed
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |