|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.AbstractLayoutStage y.layout.organic.OrganicRemoveOverlapsStage
public class OrganicRemoveOverlapsStage
This layout stage removes node overlaps while changes to the original layout structure are avoided and a specified minimum node distance is guaranteed.
Unlike the overlap removal approach implemented by RemoveOverlapsLayoutStage
, this stage tries
to keep the original layout structure, i.e., it tries to keep the geometric distances between the nodes.
The strategy for removing overlaps is similar to the layout strategy used by organic (force-directed)
layout algorithms (e.g. SmartOrganicLayouter
).
Therefore, this stage is especially well suited to remove node overlaps in undirected graph drawings
with straight-line edges, as produced by organic layout approaches.
A graph containing overlaps (left) and the result after applying this layout stage
It is possible to define a minimum distance
between nodes.
This feature allows to not only remove overlaps but forces nodes to keep the specified distance to other nodes.
Nodes can be marked as fixed. Such nodes will not be moved during the overlap removal process.
A DataProvider
with key FIXED_NODE_DPKEY
can be registered to mark the fixed nodes.
Note that inputs with fixed nodes may significantly increase the overall runtime. Hence class ShuffleLayouter
may be the better choice for such inputs.
Field Summary | |
---|---|
static java.lang.Object |
FIXED_NODE_DPKEY
A DataProvider key for marking nodes as fixed
A node marked as fixed will not be moved by this algorithm but stay at its current position. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
OrganicRemoveOverlapsStage()
Creates a new instance of OrganicRemoveOverlapsStage with default settings. |
|
OrganicRemoveOverlapsStage(Layouter core)
Creates a new instance of OrganicRemoveOverlapsStage with the given layout algorithm as
core algorithm . |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts general graphs without exception. |
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. |
long |
getMaximumDuration()
Returns the maximum duration in milliseconds that this layout stage is allowed to run. |
double |
getMinimalNodeDistance()
Returns the minimum distance to be kept between any two nodes of the graph. |
void |
setMaximumDuration(long maximumDuration)
Specifies the maximum duration in milliseconds that this layout stage is allowed to run. |
void |
setMinimalNodeDistance(double minimumNodeDistance)
Sets the minimum distance to be kept between any two nodes of the graph. |
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 java.lang.Object FIXED_NODE_DPKEY
DataProvider
key for marking nodes as fixed
A node marked as fixed will not be moved by this algorithm but stay at its current position.
Constructor Detail |
---|
public OrganicRemoveOverlapsStage(Layouter core)
OrganicRemoveOverlapsStage
with the given layout algorithm as
core algorithm
.
core
- the core layout algorithmpublic OrganicRemoveOverlapsStage()
OrganicRemoveOverlapsStage
with default settings.
Method Detail |
---|
public long getMaximumDuration()
This maximum time does not include the time required for the core layout algorithm
.
The duration needs to be non-negative.
setMaximumDuration(long)
public void setMaximumDuration(long maximumDuration)
This maximum time does not include the time required for the core layout algorithm
.
The duration needs to be non-negative.
Long.MAX_VALUE
. maximumDuration
- the non-negative maximum duration in milliseconds
java.lang.IllegalArgumentException
- if the specified duration has a negative valuepublic double getMinimalNodeDistance()
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 distance needs to be a non-negative value.
setMinimalNodeDistance(double)
public void setMinimalNodeDistance(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 distance needs to be a non-negative value.
public boolean canLayout(LayoutGraph graph)
graph
- the input graph
true
for all inputsLayouter.doLayout(LayoutGraph)
public void doLayout(LayoutGraph graph)
minimum distance
to each other.
If a core layout algorithm
is specified, it will be executed first.
graph
- the input graphLayouter.canLayout(LayoutGraph)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |