|
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.router.OrthogonalSegmentDistributionStage
public class OrthogonalSegmentDistributionStage
OrthogonalSegmentDistributionStage
distributes overlapping edge segments of orthogonally routed edges.
The edge segments are assigned to the so-called channels within which they are distributed. Those channels are
defined by the surrounding graph elements.
The algorithm will not distribute the segments, whose endpoints connect to a node using a port that has a strong
PortConstraint
or a fixed PortCandidate
.
It is possible to define a preferred distance
between distributed edge
segments. This distance will only be applied if there is enough space in the according channel. In the case where there is not
enough space, the preferred distance may be reduced
for the edges.
If the layout algorithm is not allowed to reduce the preferred distance, these edges won't be distributed.
Edges can be distributed on grid coordinates
. The grid can only be considered if
there is enough space in the according channel for at least as many grid lines as the number of segments. In the case where there
is not enough space, the grid spacing
may be reduced
in
this channel. If the layout algorithm is not allowed to reduce the grid spacing, these edges won't be distributed.
Method setLockFirstAndLastSegment(boolean)
can be used to guarantee that the first and last segment of an edge
won't be distributed. So, ports can easily be maintained without setting explicit strong PortConstraint
s or fixed
PortCandidate
s.
OrthogonalSegmentDistributionStage
is not capable of moving nodes. Hence, edges are only distributed if
they keep the aforementioned settings or the layout algorithm is allowed to adjust those settings.Field Summary | |
---|---|
static java.lang.Object |
AFFECTED_EDGES
A DataProvider key for determining which edges are distributed.
|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
OrthogonalSegmentDistributionStage()
Creates a new instance of OrthogonalSegmentDistributionStage with default settings. |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts all graphs that can be handled by the core layout algorithm . |
void |
doLayout(LayoutGraph graph)
Distributes overlapping orthogonal segments after the core layout has been calculated. |
java.lang.Object |
getAffectedEdgesDPKey()
Returns the key to register a DataProvider which determines the edges that shall be routed by this
algorithm. |
double |
getGridOffsetX()
Returns the x-coordinate of the origin of the grid. |
double |
getGridOffsetY()
Returns the y-coordinate of the origin of the grid. |
double |
getGridWidth()
Returns the spacing between two grid lines. |
double |
getPreferredDistance()
Returns the preferred distance between each two segments. |
boolean |
isGridEnabled()
Returns whether or not the orthogonal segments are distributed on grid coordinates. |
boolean |
isGridWidthAdjustable()
Returns whether or not the grid spacing can be reduced if there is not enough space. |
boolean |
isLockFirstAndLastSegment()
Returns whether or not the first and last segment of an edge will be distributed. |
boolean |
isPreferredDistanceAdjustable()
Returns whether or not the preferred distance between edges can be reduced if there is not enough space. |
void |
setAffectedEdgesDPKey(java.lang.Object key)
Specifies the key to register a DataProvider which determines the edges that shall be routed by this
algorithm. |
void |
setGridEnabled(boolean gridEnabled)
Specifies whether or not the orthogonal segments are distributed on grid coordinates. |
void |
setGridOffset(double offsetX,
double offsetY)
Specifies the coordinates of the origin of the grid. |
void |
setGridWidth(double gridSpacing)
Specifies the spacing between two grid lines. |
void |
setGridWidthAdjustable(boolean gridSpacingAdjustable)
Specifies whether or not the grid spacing can be reduced if there is not enough space. |
void |
setLockFirstAndLastSegment(boolean lockFirstAndLastSegment)
Specifies whether or not the first and last segment of an edge will be distributed. |
void |
setPreferredDistance(double minimumDistance)
Specifies the preferred distance between each two segments. |
void |
setPreferredDistanceAdjustable(boolean preferredDistanceAdjustable)
Specifies whether or not the preferred distance between edges can be reduced if there is not enough space. |
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 AFFECTED_EDGES
DataProvider
key for determining which edges are distributed.
Constructor Detail |
---|
public OrthogonalSegmentDistributionStage()
OrthogonalSegmentDistributionStage
with default settings.
Method Detail |
---|
public boolean canLayout(LayoutGraph graph)
core layout algorithm
.
If there is no core layout algorithm
, all graphs are accepted.
graph
- the input graph
true
if there is no core layout algorithm or the core layout algorithm accepts the graph,
false
otherwiseLayouter.doLayout(LayoutGraph)
public void doLayout(LayoutGraph graph)
graph
- the input graphLayouter.canLayout(LayoutGraph)
public void setAffectedEdgesDPKey(java.lang.Object key)
DataProvider
which determines the edges that shall be routed by this
algorithm.
AFFECTED_EDGES
key
- the key to register a DataProvider
which determines the edges to route
java.lang.IllegalArgumentException
- if the specified DataProvider
key is null
public java.lang.Object getAffectedEdgesDPKey()
DataProvider
which determines the edges that shall be routed by this
algorithm.
DataProvider
which determines the edges to routesetAffectedEdgesDPKey(Object)
public boolean isPreferredDistanceAdjustable()
The space between the nodes limits distributing the orthogonal segments while considering the
preferred distance
. In case this option is enabled, the layout algorithm may
reduce the preferred distance, otherwise the algorithm will only distribute segments if there is enough space.
true
if the layout algorithm is allowed to reduce the preferred distance, false
if it should only distribute segments where there is enough space to maintain the preferred distancesetPreferredDistanceAdjustable(boolean)
public void setPreferredDistanceAdjustable(boolean preferredDistanceAdjustable)
The space between the nodes restricts the distribution of the orthogonal segments while considering the
preferred distance
. In case this option is enabled, the layout algorithm may
reduce the preferred distance, otherwise the algorithm will only distribute segments if there is enough space.
preferredDistanceAdjustable
- true
if the layout algorithm should be allowed to reduce the
preferred distance, false
if it only distributes segments where
there is enough space to maintain the preferred distancepublic boolean isGridWidthAdjustable()
The space between the nodes limits the number of grid lines on which edges are placed. In case this option is
enabled, the layout algorithm will divide the given grid spacing by 2
as long as there are not
enough grid lines on which the segments can be distributed, otherwise the grid spacing remains unchanged.
true
if the algorithm should be allowed to reduce the grid spacing, false
otherwisesetGridWidthAdjustable(boolean)
public void setGridWidthAdjustable(boolean gridSpacingAdjustable)
The space between the nodes limits the number of grid lines on which edges are placed. In case this option is
enabled, the layout algorithm will divide the given grid spacing by 2
as long as there are not
enough grid lines on which the segments can be distributed, otherwise the grid spacing remains unchanged.
gridSpacingAdjustable
- true
if the algorithm should be allowed to reduce the grid spacing,
false
otherwisepublic boolean isGridEnabled()
true
if segments are distributed on grid coordinates, false
otherwisesetGridEnabled(boolean)
,
setGridOffset(double, double)
,
setGridWidth(double)
,
setGridWidthAdjustable(boolean)
public void setGridEnabled(boolean gridEnabled)
gridEnabled
- true
if segments are distributed on grid coordinates, false
otherwisesetGridOffset(double, double)
,
setGridWidth(double)
,
setGridWidthAdjustable(boolean)
public double getGridWidth()
The spacing should be at least 0
.
setGridEnabled(boolean)
,
setGridEnabled(boolean)
,
setGridWidthAdjustable(boolean)
public void setGridWidth(double gridSpacing)
The spacing should be at least 0
.
gridSpacing
- the grid spacing
java.lang.IllegalArgumentException
- if the specified spacing is negativesetGridEnabled(boolean)
,
setGridWidthAdjustable(boolean)
public void setGridOffset(double offsetX, double offsetY)
The grid coordinates will be multiples of the grid spacing
added to this origin.
offsetX
- the x-coordinate of the grid originoffsetY
- the y-coordinate of the grid originsetGridEnabled(boolean)
public double getGridOffsetX()
The grid coordinates will be multiples of the grid spacing
added to this origin.
setGridOffset(double, double)
,
setGridEnabled(boolean)
,
getGridOffsetY()
public double getGridOffsetY()
The grid coordinates will be multiples of the grid spacing
added to this origin.
setGridOffset(double, double)
,
setGridEnabled(boolean)
,
getGridOffsetX()
public boolean isLockFirstAndLastSegment()
core layout algorithm
calculated.true
if the first and last segments won't be distributed, false
otherwisesetLockFirstAndLastSegment(boolean)
public void setLockFirstAndLastSegment(boolean lockFirstAndLastSegment)
core layout algorithm
calculated.lockFirstAndLastSegment
- true
if the first and last segments won't be distributed,
false
otherwisepublic double getPreferredDistance()
This value also applies to the distance between a segment and the border of the containing channel.
The preferred distance should be at least 0
.
adjustable
, the
preferred distance might be reduced to the maximum possible distance closest to the given value. This happens if
the channel is not large enough to fit in all segments with the desired preferred distance.setPreferredDistance(double)
,
setPreferredDistanceAdjustable(boolean)
public void setPreferredDistance(double minimumDistance)
This value also applies to the distance between a segment and the border of the containing channel.
The preferred distance should be at least 0
.
adjustable
, the
preferred distance might be reduced to the maximum possible distance closest to the given value. This happens if
the channel is not large enough to fit in all segments with the desired preferred distance.minimumDistance
- the preferred distance between two segments
java.lang.IllegalArgumentException
- if the specified distance is negativesetPreferredDistanceAdjustable(boolean)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |