|
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
This class can be used to distribute overlapping edge segments of orthogonally routed edges. The edge segments will then be distributed in their so called channel according to the given settings. The channel in which the segments can be distributed is defined by the surrounding graph elements, which will form borderlines for the channel.
The distance between the distributed edge segments can be determined by methodsetPreferredDistance(double)
.
The edge segments can also be forced to be distributed on a given grid (setGridEnabled(boolean)
) whose
origin ( setGridOffset(double,double)
) and grid width ( setGridWidth(double)
) can be set.
Note: this LayoutStage is not capable of moving nodes. If the set conditions like preferred distance or the grid width
can not be satisfied, for example, because there is not enough space inside the channel, the set values will by
default be adjusted (reduced). Concerning the grid, it will be divided by 2 until all segments will fit. The
preferred distance will be adjusted so that the maximum possible distance near the given value will be taken. Also,
segments that are directly at a node (source or target) will be distributed, so that they are placed equidistant
all along the node's side.
Settings setGridWidthAdjustable(boolean)
and setPreferredDistanceAdjustable(boolean)
can be used to
force the algorithm to distribute the edges with the exact given distances. If the segments will not fit into the
given channel, they then will not be distributed at all. So there is a guarantee that they will match the settings if
they are routed.
setLockFirstAndLastSegment(boolean)
can be used to guarantee that the first and last segment of an edge
(connected to source or target), won't be distributed. So ports can easily be kept without setting explicit strong
port constraints or fixed PortCandidates.
The algorithm will not distribute the segments, whose end connect to a node at a strong port constraint or fixed
port candidate.
Field Summary | |
---|---|
static Object |
AFFECTED_EDGES
DataProvider key that can be used to determine which edges the distribution stage will route. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
OrthogonalSegmentDistributionStage()
|
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Returns true iff the given graph can be laid
out by this algorithm. |
void |
doLayout(LayoutGraph graph)
Main layout routine that assigns new layout information to the given graph. |
Object |
getAffectedEdgesDPKey()
Returns the DataProvider key, which determines the edges, that shall be distributed by the algorithm. |
double |
getGridOffsetX()
Returns the grid offset in x direction. by default this will be 0. |
double |
getGridOffsetY()
Returns the grid offset in y direction. by default this will be 0. |
double |
getGridWidth()
Returns the grid width that shall be used if grid distribution is enabled. |
double |
getPreferredDistance()
Returns the preferred distance, segments shall have to each other and to the channel's border. |
boolean |
isGridEnabled()
Returns whether grid distribution is enabled or not. |
boolean |
isGridWidthAdjustable()
Returns whether or not the algorithm is allowed to reduce the grid width, if segments cannot be distributed using the previously given grid width. |
boolean |
isLockFirstAndLastSegment()
Returns whether the first and last segment of an edge (connected to source or target), will be distributed. |
boolean |
isPreferredDistanceAdjustable()
Returns what happens if the preferred distance can not be kept, because there is not enough space for the segments to be distributed in that distance. |
void |
setAffectedEdgesDPKey(Object key)
Sets the DataProvider key, which determines the edges, that shall be distributed by the algorithm. |
void |
setGridEnabled(boolean gridEnabled)
Determines whether grid distribution is enabled or not. |
void |
setGridOffset(double offsetX,
double offsetY)
Can be used to set the grid origin. |
void |
setGridWidth(double gridWidth)
Sets the grid width that shall be used if grid distribution is enabled. |
void |
setGridWidthAdjustable(boolean gridWidthAdjustable)
Specifies whether or not the algorithm is allowed to reduce the grid width, if segments cannot be distributed using the previously given grid width. |
void |
setLockFirstAndLastSegment(boolean lockFirstAndLastSegment)
Determines whether the first and last segment of an edge (connected to source or target), will be distributed. |
void |
setPreferredDistance(double minimumDistance)
Specifies the preferred distance, segments shall have to each other and to the channel's border. |
void |
setPreferredDistanceAdjustable(boolean preferredDistanceAdjustable)
Determines what happens if the preferred distance can not be kept, because there is not enough space for the segments to be distributed in that distance. |
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 Object AFFECTED_EDGES
Constructor Detail |
---|
public OrthogonalSegmentDistributionStage()
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
.
public void doLayout(LayoutGraph graph)
Layouter
public void setAffectedEdgesDPKey(Object key)
By default, AFFECTED_EDGES
is used.
key
- the key, which determines the edges, that shall be distributed by the algorithm.public Object getAffectedEdgesDPKey()
By default, AFFECTED_EDGES
is used.
public boolean isPreferredDistanceAdjustable()
true
the algorithm is allowed to reduce the distance to
the next best value, that is possible. If set to false
the algorithm will not at all distribute those
segments. By default the setting is true
and therefore segments will be distributed.
true
- if the preferred distance will be adjusted by the algorithm, if needed
false
- if the algorithm will not distribute segments, if their preferred distance can not be
kept.public void setPreferredDistanceAdjustable(boolean preferredDistanceAdjustable)
true
the algorithm is allowed to reduce the
distance to the next best value, that is possible. If set to false
the algorithm will not at all
distribute those segments. By default the setting is true
and therefore segments will be distributed.
Note: Preferred distances will not be kept for segments connecting to nodes (first and last segment of an edge).
The segments are distributed equidistant all along the node side, thus may lead to bigger distances between
segments.
preferredDistanceAdjustable
- determines if the algorithm is allowed to reduce the preferred distancepublic boolean isGridWidthAdjustable()
By default, the algorithm is allowed to reduce the grid width.
public void setGridWidthAdjustable(boolean gridWidthAdjustable)
By default, the algorithm is allowed to reduce the grid width.
gridWidthAdjustable
- whether or not the algorithm is allowed to reduce the grid width.public boolean isGridEnabled()
public void setGridEnabled(boolean gridEnabled)
gridEnabled
- whether to enable grid distribution or not.public double getGridWidth()
public void setGridWidth(double gridWidth)
gridWidth
- the grid width that shall be set.public void setGridOffset(double offsetX, double offsetY)
offsetX
- the offset in x direction.offsetY
- the offset in y directionpublic double getGridOffsetX()
public double getGridOffsetY()
public boolean isLockFirstAndLastSegment()
false
, i.e. first and last segments are not locked.
public void setLockFirstAndLastSegment(boolean lockFirstAndLastSegment)
false
, i.e. first and last segments are not locked.
lockFirstAndLastSegment
- whether to lock the first and last segments of edges, and therefore not distribute
them.public double getPreferredDistance()
Default value is 10.0
.
Note: if setPreferredDistanceAdjustable(boolean)
is set to true
(which is the default), the
preferred distance might be adjusted so that the maximum possible distance near the given value will be taken. This
happens if the channel is not big enough to fit in all segments with the desired preferred distance.
public void setPreferredDistance(double minimumDistance)
Default value is 10.0
.
Note: if setPreferredDistanceAdjustable(boolean)
is set to true
(which is the default), the
preferred distance might be adjusted so that the maximum possible distance near the given value will be taken. This
happens if the channel is not big enough to fit in all segments with the desired preferred distance.
minimumDistance
- the preferred distance, segments shall have to each other and to the channel's border.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |