|
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.circular.SingleCycleLayouter
public class SingleCycleLayouter
This layout algorithm places all nodes of a graph on a single cycle.
All nodes of a graph are placed on one common circle, generating circular layouts. The edges are drawn as simple, straight lines. The resulting layouts look like a ring. Edges connecting nodes which are not next to each other on the ring are routed inside of the circle.
Single-cycle circular layouts are suitable for the visualization of networks such as ring networks or smaller social networks. They are also useful to layout cyclic subgraphs of a larger graph.
An example of a single cycle layout
First, the nodes are sorted by applying either a custom or some default NodeSequencer
.
Then, all nodes are placed on a circle with an appropriate radius according to the calculated order.
The order in which the nodes are placed on the circle is a crucial aspect
of this algorithm. By specifying a NodeSequencer
instance via setNodeSequencer(NodeSequencer)
,
the order can be customized.
There are two options to determine the radius of the circle on which nodes are placed:
minimum radius
will be obeyed when choosing the radius.automatic
radius selection
and specify the custom radius via setFixedRadius(double)
.
Field Summary |
---|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
SingleCycleLayouter()
Creates a new SingleCycleLayouter instance with default settings. |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Accepts general graphs without exception. |
void |
doLayoutCore(LayoutGraph graph)
Arranges the nodes of the given graph such that they all lie on a common circle. |
boolean |
getAutomaticRadius()
Returns whether or not the radius of the circle should be determined automatically. |
double |
getFixedRadius()
Returns a fixed radius for the circle on which the nodes will be placed. |
double |
getInitialAngle()
Returns the angle that describes the location on the circle of the first node. |
double |
getLastAppliedRadius()
Returns the radius that was applied to the last layout calculated by this algorithm. |
int |
getMinimalNodeDistance()
Returns the minimum distance between nodes that are next to each other on the circle. |
double |
getMinimalRadius()
Returns the minimum radius for the circle on which the nodes are placed. |
NodeSequencer |
getNodeSequencer()
Returns the custom NodeSequencer that will be used for determining the order of the nodes for the circle
placement. |
boolean |
isFromSketchModeEnabled()
Returns whether or not to consider the coordinates of the input diagram when arranging the graph. |
void |
setAutomaticRadius(boolean automatic)
Specifies whether or not the radius of the circle should be determined automatically. |
void |
setFixedRadius(double radius)
Specifies a fixed radius for the circle on which the nodes will be placed. |
void |
setFromSketchModeEnabled(boolean fromSketchModeEnabled)
Specifies whether or not to consider the coordinates of the input diagram when arranging the graph. |
void |
setInitialAngle(double initialAngle)
Specifies the angle that describes the location on the circle of the first node. |
void |
setMinimalNodeDistance(int minimumNodeDistance)
Specifies the minimum distance between nodes that are next to each other on the circle. |
void |
setMinimalRadius(double minimumRadius)
Specifies the minimum radius for the circle on which the nodes are placed. |
void |
setNodeSequencer(NodeSequencer sequencer)
Specifies the custom NodeSequencer that will be used for determining the order of the nodes for the circle
placement. |
void |
setOrientationLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage that modifies the orientation of the layout is activated. |
void |
setSelfLoopLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing self-loops is activated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SingleCycleLayouter()
SingleCycleLayouter
instance with default settings.
Method Detail |
---|
public double getInitialAngle()
The angle is measured in radians and world coordinates, e.g., 0
means east,
Pi/2
means south.
SingleCycleLayouter
is used by CircularLayouter
to
arrange single-cycle partitions. The CircularLayouter
will automatically
choose the initial angle.setInitialAngle(double)
public void setInitialAngle(double initialAngle)
The angle is measured in radians and world coordinates, e.g., 0
means east,
Pi/2
means south.
SingleCycleLayouter
is used by CircularLayouter
to
arrange single-cycle partitions. The CircularLayouter
will automatically
choose the initial angle.initialAngle
- the angle for the placement of the first node in radians0.0 - the highlighted first node is placed east | Pi/2 - the highlighted first node is placed south |
public boolean isFromSketchModeEnabled()
If this feature is enabled, the original circular order of peripheral nodes around an estimated circle center will be preserved.
true
if the initial coordinates of the nodes are considered,
false
otherwisesetFromSketchModeEnabled(boolean)
public void setFromSketchModeEnabled(boolean fromSketchModeEnabled)
If this feature is enabled, the original circular order of peripheral nodes around an estimated circle center will be preserved.
fromSketchModeEnabled
- true
if the initial coordinates of the nodes should be considered,
false
otherwiseOrder of nodes when From Sketch mode is disabled | Initial graph with changed node order | Order of nodes when From Sketch mode is enabled |
public void setMinimalNodeDistance(int minimumNodeDistance)
automatic radius
selection
is disabled. In that case, the distance between nodes will follow from the specified
fixed radius
.minimumNodeDistance
- the non-negative minimum distance between nodes
java.lang.IllegalArgumentException
- if the given distance is negativeMinimum node distance set to 30 | Minimum node distance set to 60 |
public int getMinimalNodeDistance()
automatic radius
selection
is disabled. In that case, the distance between nodes will follow from the specified
fixed radius
.setMinimalNodeDistance(int)
public void setFixedRadius(double radius)
automatically
selected
by the layout algorithm.radius
- the fixed radius for the circle
java.lang.IllegalArgumentException
- if the given radius is negativesetMinimalRadius(double)
,
setAutomaticRadius(boolean)
200 | 50 |
public double getFixedRadius()
automatically
selected
by the layout algorithm.setFixedRadius(double)
,
setMinimalRadius(double)
,
setAutomaticRadius(boolean)
public void setMinimalRadius(double minimumRadius)
automatic radius selection
is enabled. Otherwise, the chosen fixed radius
will be used.minimumRadius
- the minimum circle radius
java.lang.IllegalArgumentException
- if the given minimum radius is negativesetFixedRadius(double)
,
setAutomaticRadius(boolean)
public double getMinimalRadius()
automatic radius selection
is enabled. Otherwise, the chosen fixed radius
will be used.setMinimalRadius(double)
,
setFixedRadius(double)
,
setAutomaticRadius(boolean)
public void setAutomaticRadius(boolean automatic)
If enabled, the radius will be chosen such that the distance between nodes which are next to each other on
the circle is approximately the same as the minimum node distance
.
If this feature is disabled, the radius specified via setFixedRadius(double)
will be applied.
automatic
- true
, if the radius of the circle should be determined automatically,
false
, otherwisesetMinimalRadius(double)
,
setFixedRadius(double)
public boolean getAutomaticRadius()
If enabled, the radius will be chosen such that the distance between nodes which are next to each other on
the circle is approximately the same as the minimum node distance
.
If this feature is disabled, the radius specified via setFixedRadius(double)
will be applied.
true
, if the radius of the circle is determined automatically,
false
, otherwisesetAutomaticRadius(boolean)
,
setMinimalRadius(double)
,
setFixedRadius(double)
public void setNodeSequencer(NodeSequencer sequencer)
NodeSequencer
that will be used for determining the order of the nodes for the circle
placement.
null
.sequencer
- the sequencer for determining a node order for the circle placementpublic NodeSequencer getNodeSequencer()
NodeSequencer
that will be used for determining the order of the nodes for the circle
placement.
null
.setNodeSequencer(NodeSequencer)
public double getLastAppliedRadius()
This method is useful if one wants to know the actual radius of a layout calculated by this algorithm.
public void setOrientationLayouterEnabled(boolean enabled)
LayoutStage
that modifies the orientation of the layout is activated.
setOrientationLayouterEnabled
in class CanonicMultiStageLayouter
LayoutOrientation.TOP_TO_BOTTOM
, the orientation of
the layout will not be modified.OrientationLayouter
has no significant
effect.LayoutStage
is activated.enabled
- true
if the stage that modifies the orientation is activated,
false
otherwiseCanonicMultiStageLayouter.isOrientationLayouterEnabled()
,
CanonicMultiStageLayouter.setOrientationLayouter(y.layout.LayoutStage)
,
CanonicMultiStageLayouter.setLayoutOrientation(byte)
,
OrientationLayouter
public void setSelfLoopLayouterEnabled(boolean enabled)
LayoutStage
used for routing self-loops is activated.
setSelfLoopLayouterEnabled
in class CanonicMultiStageLayouter
CircularLayouter
cannot handle self-loops. Disabling SelfLoopLayouter
will lead
to errors during execution.enabled
- true
if the stage responsible for routing self-loops is activated, false
otherwiseCanonicMultiStageLayouter.isSelfLoopLayouterEnabled()
,
CanonicMultiStageLayouter.setSelfLoopLayouter(y.layout.LayoutStage)
,
SelfLoopLayouter
public boolean canLayoutCore(LayoutGraph graph)
canLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
true
for all general graphs, false
if the given graph is null
public void doLayoutCore(LayoutGraph graph)
doLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |