|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.organic.RemoveOverlapsLayoutStage
public class RemoveOverlapsLayoutStage
This LayoutStage
removes node overlaps and guarantees a certain minimum distance between nodes.
This stage only removes overlaps between nodes of the input graph. To do so, overlapping nodes will
be moved apart. Results often look like a stretched version of the original graph. Before removing
the node overlaps, an optional core layout algorithm
is applied.
A graph containing overlaps (left) and the result after the overlap removal
It is possible to define a minimum distance
between nodes.
This feature allows to not only remove overlaps but forces nodes to keep a specified distance to other nodes.
Field Summary | |
---|---|
protected LayoutGraph |
graph
The input graph. |
protected double[] |
h
The height values of nodes, ordered within the array based on node indices. |
protected Node[] |
nodes
The node array of the input graph . |
protected YRandom |
random
The source of randomness used during the layout process. |
protected double[] |
w
The width values of nodes, ordered within the array based on node indices. |
protected double[] |
x
The x-coordinates of nodes, ordered within the array based on node indices. |
protected double[] |
y
The y-coordinates of nodes, ordered within the array based on node indices. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
RemoveOverlapsLayoutStage(double minimumNodeDistance)
Creates a new RemoveOverlapsLayoutStage instance with a given minimum node distance . |
|
RemoveOverlapsLayoutStage(YRandom random,
double minimumNodeDistance)
Creates a new RemoveOverlapsLayoutStage instance with a given minimum node distance and a YRandom instance representing the source of randomness for this layout stage. |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts all graphs which are accepted by the specified core layout algorithm . |
void |
doLayout(LayoutGraph graph)
Removes node overlaps and displaces nodes of the given graph such that they keep the specified minimum distance to each other. |
Layouter |
getCoreLayouter()
Returns the core layout algorithm that is wrapped by this stage and is applied before removing node overlaps. |
double |
getMinimumNodeDistance()
Returns the minimum distance to be kept between any two nodes of the graph. |
void |
setCoreLayouter(Layouter l)
Specifies the core layout algorithm that is wrapped by this stage and is applied before removing node overlaps. |
void |
setMinimumNodeDistance(double minimumNodeDistance)
Specifies the minimum distance to be kept between any two nodes of the graph. |
protected void |
updatePos()
Updates the data structure holding x-coordinates and y-coordinates of the
nodes according to the current center coordinates . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected LayoutGraph graph
protected YRandom random
protected double[] x
protected double[] y
protected double[] w
protected double[] h
protected Node[] nodes
graph
.
Constructor Detail |
---|
public RemoveOverlapsLayoutStage(double minimumNodeDistance)
RemoveOverlapsLayoutStage
instance with a given minimum node distance
.
The minimum node distance needs to be non-negative.
minimumNodeDistance
- a non-negative minimum distance value
java.lang.IllegalArgumentException
- if the given distance is negativepublic RemoveOverlapsLayoutStage(YRandom random, double minimumNodeDistance)
RemoveOverlapsLayoutStage
instance with a given minimum node distance
and a YRandom
instance representing the source of randomness for this layout stage.
The minimum node distance needs to be non-negative.
random
- the source of randomness for this layout stageminimumNodeDistance
- a non-negative minimum distance value
java.lang.IllegalArgumentException
- if the given distance is negativeMethod Detail |
---|
public double getMinimumNodeDistance()
Due to this distance not only nodes that overlap will be moved to resolve the overlap, but also nodes which are too close to each other with respect to this distance will be displaced.
The minimum node distance needs to be non-negative.
setMinimumNodeDistance(double)
public void setMinimumNodeDistance(double minimumNodeDistance)
Due to this distance not only nodes that overlap will be moved to resolve the overlap, but also nodes which are too close to each other with respect to this distance will be displaced.
The minimum node distance needs to be non-negative.
public boolean canLayout(LayoutGraph graph)
core layout algorithm
.
canLayout
in interface Layouter
graph
- the input graph
true
if the core algorithm
is null
or
can handle the given graph, false
otherwiseLayouter.doLayout(LayoutGraph)
public void doLayout(LayoutGraph graph)
minimum distance
to each other.
If a core layout algorithm
is specified, it will be executed first.
doLayout
in interface Layouter
graph
- the input graphLayouter.canLayout(LayoutGraph)
protected void updatePos()
x-coordinates
and y-coordinates
of the
nodes
according to the current center coordinates
.
public Layouter getCoreLayouter()
getCoreLayouter
in interface LayoutStage
setCoreLayouter(Layouter)
public void setCoreLayouter(Layouter l)
setCoreLayouter
in interface LayoutStage
l
- the core layout algorithm
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |