public class SingleCycleLayout extends MultiStageLayout
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. If a graph contains many edges, the number of edge crossings inside the circle may be quite high.
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
INodeSequencer
. 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 INodeSequencer
instance via 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 FixedRadius
.
Constructor and Description |
---|
SingleCycleLayout()
Creates a new
SingleCycleLayout instance with default settings. |
Modifier and Type | Method and Description |
---|---|
void |
applyLayoutCore(LayoutGraph graph)
Arranges the nodes of the given graph such that they all lie on a common circle.
|
double |
getFixedRadius()
Gets a fixed radius for the circle on which the nodes will be placed.
|
double |
getInitialAngle()
Gets the angle that describes the location on the circle of the first node.
|
double |
getLastAppliedRadius()
Gets the radius that was applied to the last layout calculated by this algorithm.
|
int |
getMinimumNodeDistance()
Gets the minimum distance between nodes that are next to each other on the circle.
|
double |
getMinimumRadius()
Gets the minimum radius for the circle on which the nodes are placed.
|
INodeSequencer |
getNodeSequencer()
Gets the
INodeSequencer that will be used for determining the order of the nodes for the circle placement. |
boolean |
isAutomaticRadiusEnabled()
Gets whether or not the radius of the circle should be determined automatically.
|
boolean |
isFromSketchModeEnabled()
Gets whether or not to consider the coordinates of the input diagram when arranging the graph.
|
void |
setAutomaticRadiusEnabled(boolean value)
Sets whether or not the radius of the circle should be determined automatically.
|
void |
setFixedRadius(double value)
Sets a fixed radius for the circle on which the nodes will be placed.
|
void |
setFromSketchModeEnabled(boolean value)
Sets whether or not to consider the coordinates of the input diagram when arranging the graph.
|
void |
setInitialAngle(double value)
Sets the angle that describes the location on the circle of the first node.
|
void |
setMinimumNodeDistance(int value)
Sets the minimum distance between nodes that are next to each other on the circle.
|
void |
setMinimumRadius(double value)
Sets the minimum radius for the circle on which the nodes are placed.
|
void |
setNodeSequencer(INodeSequencer value)
Sets the
INodeSequencer that will be used for determining the order of the nodes for the circle placement. |
void |
setOrientationLayoutEnabled(boolean value)
Sets whether or not the
ILayoutStage that modifies the orientation of the layout is
activated. |
void |
setSelfLoopRouterEnabled(boolean value)
Sets whether or not the
ILayoutStage used for routing self-loops is activated. |
appendStage, applyLayout, checkNodeSize, disableAllStages, getComponentLayout, getHideGroupsStage, getLabeling, getLayoutOrientation, getOrientationLayout, getParallelEdgeRouter, getSelfLoopRouter, getSubgraphLayout, isComponentLayoutEnabled, isHideGroupsStageEnabled, isLabelingEnabled, isOrientationLayoutEnabled, isParallelEdgeRouterEnabled, isSelfLoopRouterEnabled, isSubgraphLayoutEnabled, prependStage, removeStage, setComponentLayout, setComponentLayoutEnabled, setHideGroupsStage, setHideGroupsStageEnabled, setLabeling, setLabelingEnabled, setLayoutOrientation, setOrientationLayout, setParallelEdgeRouter, setParallelEdgeRouterEnabled, setSelfLoopRouter, setSubgraphLayout, setSubgraphLayoutEnabled
public SingleCycleLayout()
SingleCycleLayout
instance with default settings.public void applyLayoutCore(LayoutGraph graph)
applyLayoutCore
in class MultiStageLayout
graph
- the input graphpublic double getFixedRadius()
IllegalArgumentException
- if the given radius is negativeautomatically selected
by
the layout algorithm.setMinimumRadius(double)
,
setAutomaticRadiusEnabled(boolean)
,
setFixedRadius(double)
public double getInitialAngle()
The angle is measured in radians and world coordinates, e.g., 0
means east, Pi/2
means south.
SingleCycleLayout
is used by CircularLayout
to arrange single-cycle
partitions. The CircularLayout
will automatically choose the initial angle.setInitialAngle(double)
public double getLastAppliedRadius()
This method is useful if one wants to know the actual radius of a layout calculated by this algorithm.
public int getMinimumNodeDistance()
IllegalArgumentException
- if the given distance is negativeautomatic radius selection
is
disabled. In that case, the distance between nodes will follow from the specified
fixed radius
.setMinimumNodeDistance(int)
public double getMinimumRadius()
IllegalArgumentException
- if the given minimum radius is negativeautomatic radius selection
is enabled.
Otherwise, the chosen fixed radius
will be used.setFixedRadius(double)
,
setAutomaticRadiusEnabled(boolean)
,
setMinimumRadius(double)
public INodeSequencer getNodeSequencer()
INodeSequencer
that will be used for determining the order of the nodes for the circle placement.IllegalArgumentException
- if the specified INodeSequencer
is null
setNodeSequencer(INodeSequencer)
public boolean isAutomaticRadiusEnabled()
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 FixedRadius
will be applied.
true
. The radius will be chosen automatically.true
, if the radius of the circle is determined automatically, false
, otherwisesetMinimumRadius(double)
,
setFixedRadius(double)
,
setAutomaticRadiusEnabled(boolean)
public boolean isFromSketchModeEnabled()
If this feature is enabled, the original circular order of peripheral nodes around an estimated circle center will be preserved.
false
. The coordinates of the input diagram are not considered.true
if the initial coordinates of the nodes are considered, false
otherwisesetFromSketchModeEnabled(boolean)
public void setAutomaticRadiusEnabled(boolean value)
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 FixedRadius
will be applied.
true
. The radius will be chosen automatically.value
- true
, if the radius of the circle is determined automatically, false
, otherwisesetMinimumRadius(double)
,
setFixedRadius(double)
,
isAutomaticRadiusEnabled()
public void setFixedRadius(double value)
IllegalArgumentException
- if the given radius is negativeautomatically selected
by
the layout algorithm.value
- the fixed radius for the circlesetMinimumRadius(double)
,
setAutomaticRadiusEnabled(boolean)
,
getFixedRadius()
public void setFromSketchModeEnabled(boolean value)
If this feature is enabled, the original circular order of peripheral nodes around an estimated circle center will be preserved.
false
. The coordinates of the input diagram are not considered.value
- true
if the initial coordinates of the nodes are considered, false
otherwiseisFromSketchModeEnabled()
public void setInitialAngle(double value)
The angle is measured in radians and world coordinates, e.g., 0
means east, Pi/2
means south.
SingleCycleLayout
is used by CircularLayout
to arrange single-cycle
partitions. The CircularLayout
will automatically choose the initial angle.value
- the angle for the placement of the first node in radiansgetInitialAngle()
public void setMinimumNodeDistance(int value)
IllegalArgumentException
- if the given distance is negativeautomatic radius selection
is
disabled. In that case, the distance between nodes will follow from the specified
fixed radius
.value
- the non-negative minimum distance between nodesgetMinimumNodeDistance()
public void setMinimumRadius(double value)
IllegalArgumentException
- if the given minimum radius is negativeautomatic radius selection
is enabled.
Otherwise, the chosen fixed radius
will be used.value
- the minimum circle radiussetFixedRadius(double)
,
setAutomaticRadiusEnabled(boolean)
,
getMinimumRadius()
public void setNodeSequencer(INodeSequencer value)
INodeSequencer
that will be used for determining the order of the nodes for the circle placement.IllegalArgumentException
- if the specified INodeSequencer
is null
value
- the sequencer for determining a node order for the circle placementgetNodeSequencer()
public void setOrientationLayoutEnabled(boolean value)
ILayoutStage
that modifies the orientation of the layout is
activated.setOrientationLayoutEnabled
in class MultiStageLayout
LayoutOrientation.TOP_TO_BOTTOM
, the orientation of the layout will not be
modified.OrientationLayout
has no significant
effect.true
. The orientation ILayoutStage
is activated.value
- true
if the stage that modifies the orientation is activated, false
otherwiseMultiStageLayout.isOrientationLayoutEnabled()
,
MultiStageLayout.setOrientationLayout(com.yworks.yfiles.layout.ILayoutStage)
,
MultiStageLayout.setLayoutOrientation(com.yworks.yfiles.layout.LayoutOrientation)
,
OrientationLayout
public void setSelfLoopRouterEnabled(boolean value)
ILayoutStage
used for routing self-loops is activated.setSelfLoopRouterEnabled
in class MultiStageLayout
CircularLayout
cannot handle self-loops. Disabling SelfLoopRouter
will lead to
errors during execution.true
. The stage that routes self-loops is activated.value
- true
if the stage responsible for routing self-loops is activated, false
otherwiseMultiStageLayout.isSelfLoopRouterEnabled()
,
MultiStageLayout.setSelfLoopRouter(com.yworks.yfiles.layout.ILayoutStage)
,
SelfLoopRouter