Search this API

y.layout.circular
Class CircularLayouter

java.lang.Object
  extended by y.layout.CanonicMultiStageLayouter
      extended by y.layout.circular.CircularLayouter
All Implemented Interfaces:
Layouter

public class CircularLayouter
extends CanonicMultiStageLayouter

Circular style layouter. This layouter either places all nodes on or inside a circle or partitions the graph in disjoint node sets each of which will be laid out separately. The exact behavior for the layout of these partitions can be controlled via setPartitionLayoutStyle(byte). The partition policy can be set with setLayoutStyle(byte). The separate partitions themselves are arranged using a BalloonLayouter.

Here is a sample output of the layouter using BCC_COMPACT as partition policy and PARTITION_LAYOUTSTYLE_CYCLIC as layout style for the partitions.


Field Summary
static byte BCC_COMPACT
          Layout style specifier.
static byte BCC_ISOLATED
          Layout style specifier.
static Object CIRCLE_ID_HOLDER_DPKEY
          Used for publishing the final circle information.
static byte CIRCULAR_CUSTOM_GROUPS
          Layout style specifier.
static Object CIRCULAR_CUSTOM_GROUPS_DPKEY
          This key is used to identify custom groups.
static byte PARTITION_LAYOUTSTYLE_CYCLIC
          Place each node of a partition on the boundary of a circle.
static byte PARTITION_LAYOUTSTYLE_DISK
          Create semi-compact layout for each partition.
static byte PARTITION_LAYOUTSTYLE_ORGANIC
          Create most compact layout for each partition.
static byte SINGLE_CYCLE
          Layout style specifier.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
CircularLayouter()
          Create a new instance of this layouter.
 
Method Summary
 boolean canLayoutCore(LayoutGraph graph)
          Always returns true.
 void doLayout(LayoutGraph layoutGraph)
          Calculates a layout for the given graph.
 void doLayoutCore(LayoutGraph graph)
          Core layout routine.
 BalloonLayouter getBalloonLayouter()
          Returns the BalloonLayouter used for arranging the partitions

Configuring that layouter has effect upon the partition arrangement within the overall layout.

 byte getLayoutStyle()
          Returns the global layout style for this layouter.
 int getMaximalDeviationAngle()
          Returns the maximal deviation angle allowed for an edge.
 byte getPartitionLayoutStyle()
          Returns the layout style for the arrangement of each partition.
 SingleCycleLayouter getSingleCycleLayouter()
          Returns the SingleCycleLayouter used for laying out single node cycles

Configuring that layouter has effects upon single cycle layouts

 boolean isConsiderNodeLabelsEnabled()
          Returns whether or not node labels are taken into account when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps).
 boolean isFromSketchModeEnabled()
          Returns whether or not to take the coordinates of the input diagram into account when arranging the nodes of the partitions and the partitions themselves.
 boolean isPlaceChildrenOnCommonRadiusEnabled()
          Returns whether or not, in the underlying tree, the children of a node are placed on a common radius.
 void setConsiderNodeLabelsEnabled(boolean handleNodeLabels)
          Specifies whether or not to consider node labels when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps).
 void setFromSketchModeEnabled(boolean fromSketchModeEnabled)
          Determines whether or not to take the coordinates of the input diagram into account when arranging the nodes of the partitions and the partitions themselves.
 void setLayoutStyle(byte style)
          Sets the global layout style for this layouter.
 void setMaximalDeviationAngle(int deviationAngle)
          Sets the maximal deviation angle allowed for an edge.
 void setPartitionLayoutStyle(byte partitionLayoutStyle)
          Sets the layout style for the arrangement of each partition.
 void setPlaceChildrenOnCommonRadiusEnabled(boolean placeChildrenOnCommonRadiusEnabled)
          Specifies whether or not, in the underlying tree, the children of a tree node are placed on a common radius.
 
Methods inherited from class y.layout.CanonicMultiStageLayouter
appendStage, calcLayout, calcLayout, canLayout, checkGroupNodeSize, checkNodeSize, doLayout, enableOnlyCore, getComponentLayouter, getGroupNodeHider, getLabelLayouter, getLayoutOrientation, getOrientationLayouter, getParallelEdgeLayouter, getSelfLoopLayouter, getSubgraphLayouter, isComponentLayouterEnabled, isGroupNodeHidingEnabled, isLabelLayouterEnabled, isOrientationLayouterEnabled, isParallelEdgeLayouterEnabled, isSelfLoopLayouterEnabled, isSubgraphLayouterEnabled, prependStage, removeStage, setComponentLayouter, setComponentLayouterEnabled, setGroupNodeHider, setGroupNodeHidingEnabled, setLabelLayouter, setLabelLayouterEnabled, setLayoutOrientation, setOrientationLayouter, setOrientationLayouterEnabled, setParallelEdgeLayouter, setParallelEdgeLayouterEnabled, setSelfLoopLayouter, setSelfLoopLayouterEnabled, setSubgraphLayouter, setSubgraphLayouterEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CIRCLE_ID_HOLDER_DPKEY

public static final Object CIRCLE_ID_HOLDER_DPKEY
Used for publishing the final circle information. If the DataProvider associated to this key is also a DataAcceptor, the integer circle id of each node is stored using the acceptor's setInt method. Otherwise, the provider's values should be of type IntValueSettable whose setValue method is used to store the integer circle id of each node.


BCC_COMPACT

public static final byte BCC_COMPACT
Layout style specifier. In this layout style the nodes within a biconnected component of the input graph are treated as separate partitions. If a node belongs to more biconnected components, it will be assigned to the one that seems to be more suitable.

This parameter can be set with setLayoutStyle(byte)

See Also:
Constant Field Values

BCC_ISOLATED

public static final byte BCC_ISOLATED
Layout style specifier. In this layout style the nodes within a biconnected component of the input graph are treated as separate partitions. If a node belongs to more biconnected components, it will form an isolated partition and will be laid out in between all of it's biconnected component cycles.

This parameter can be set with setLayoutStyle(byte)

See Also:
Constant Field Values

CIRCULAR_CUSTOM_GROUPS

public static final byte CIRCULAR_CUSTOM_GROUPS
Layout style specifier. In this layout style the user can specify groups that will each form a separate partition. To specify groups, a DataProvider with key CIRCULAR_CUSTOM_GROUPS_DPKEY must be registered.

This parameter can be set with setLayoutStyle(byte)

See Also:
Constant Field Values

SINGLE_CYCLE

public static final byte SINGLE_CYCLE
Layout style specifier. In this layout style all nodes of the input graph will be put on or inside a single cycle.

This parameter can be set with setLayoutStyle(byte)

See Also:
Constant Field Values

CIRCULAR_CUSTOM_GROUPS_DPKEY

public static final Object CIRCULAR_CUSTOM_GROUPS_DPKEY
This key is used to identify custom groups.


PARTITION_LAYOUTSTYLE_CYCLIC

public static final byte PARTITION_LAYOUTSTYLE_CYCLIC
Place each node of a partition on the boundary of a circle.

This style is very fast, but the results may need much space.

This parameter can be set with setPartitionLayoutStyle(byte)

See Also:
Constant Field Values

PARTITION_LAYOUTSTYLE_DISK

public static final byte PARTITION_LAYOUTSTYLE_DISK
Create semi-compact layout for each partition.

This style places nodes in the inside and the border of a circle and arranges them in an organic manner, leading to more compact layout. Only nodes with connections into other partitions are guaranteed to lie on the boundary of the resulting disk. This style may come with a performance penalty. This parameter can be set with setPartitionLayoutStyle(byte)

See Also:
Constant Field Values

PARTITION_LAYOUTSTYLE_ORGANIC

public static final byte PARTITION_LAYOUTSTYLE_ORGANIC
Create most compact layout for each partition.

This style creates an organic circular layout for each partition. Even nodes that connect into different partitions may be placed in the inside of the resulting disk. This style may come with a performance penalty.

This parameter can be set with setPartitionLayoutStyle(byte)

See Also:
Constant Field Values
Constructor Detail

CircularLayouter

public CircularLayouter()
Create a new instance of this layouter.

The default values are:

Method Detail

isConsiderNodeLabelsEnabled

public boolean isConsiderNodeLabelsEnabled()
Returns whether or not node labels are taken into account when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps).

Returns:
whether this feature is enabled.
See Also:
setConsiderNodeLabelsEnabled(boolean)

setConsiderNodeLabelsEnabled

public void setConsiderNodeLabelsEnabled(boolean handleNodeLabels)
Specifies whether or not to consider node labels when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps).

Parameters:
handleNodeLabels - whether to enable this feature

isPlaceChildrenOnCommonRadiusEnabled

public boolean isPlaceChildrenOnCommonRadiusEnabled()
Returns whether or not, in the underlying tree, the children of a node are placed on a common radius.

Returns:
whether this feature is enabled.
See Also:
setPlaceChildrenOnCommonRadiusEnabled(boolean)

setPlaceChildrenOnCommonRadiusEnabled

public void setPlaceChildrenOnCommonRadiusEnabled(boolean placeChildrenOnCommonRadiusEnabled)
Specifies whether or not, in the underlying tree, the children of a tree node are placed on a common radius. Disabling this feature may produce more compact layout results.

Parameters:
placeChildrenOnCommonRadiusEnabled - whether to enable this feature

isFromSketchModeEnabled

public boolean isFromSketchModeEnabled()
Returns whether or not to take the coordinates of the input diagram into account when arranging the nodes of the partitions and the partitions themselves.

See Also:
setFromSketchModeEnabled(boolean)

setFromSketchModeEnabled

public void setFromSketchModeEnabled(boolean fromSketchModeEnabled)
Determines whether or not to take the coordinates of the input diagram into account when arranging the nodes of the partitions and the partitions themselves.

If enabled:

Switching between different partition policies or group layout styles can lead to unexpected results.

By default this feature is disabled.


setMaximalDeviationAngle

public void setMaximalDeviationAngle(int deviationAngle)
Sets the maximal deviation angle allowed for an edge. The deviation angle for an edge is the difference between its optimal radiation angle away from the parent cycle and its actual radiation angle.

By default a maximal deviation angle of 90 degrees is applied.

Parameters:
deviationAngle - the deviation angle given in degrees.

getMaximalDeviationAngle

public int getMaximalDeviationAngle()
Returns the maximal deviation angle allowed for an edge.

See Also:
setMaximalDeviationAngle(int)

setLayoutStyle

public void setLayoutStyle(byte style)
Sets the global layout style for this layouter. Allowed layout styles are SINGLE_CYCLE, BCC_ISOLATED, BCC_COMPACT and CIRCULAR_CUSTOM_GROUPS

By default BCC_COMPACT is used as layout style

Parameters:
style - one of SINGLE_CYCLE, BCC_ISOLATED, BCC_COMPACT or CIRCULAR_CUSTOM_GROUPS

getLayoutStyle

public byte getLayoutStyle()
Returns the global layout style for this layouter.

See Also:
setLayoutStyle(byte)

getSingleCycleLayouter

public SingleCycleLayouter getSingleCycleLayouter()
Returns the SingleCycleLayouter used for laying out single node cycles

Configuring that layouter has effects upon single cycle layouts


getBalloonLayouter

public BalloonLayouter getBalloonLayouter()
Returns the BalloonLayouter used for arranging the partitions

Configuring that layouter has effect upon the partition arrangement within the overall layout.


getPartitionLayoutStyle

public byte getPartitionLayoutStyle()
Returns the layout style for the arrangement of each partition.

Returns:
One of PARTITION_LAYOUTSTYLE_CYCLIC,PARTITION_LAYOUTSTYLE_DISK or PARTITION_LAYOUTSTYLE_ORGANIC

setPartitionLayoutStyle

public void setPartitionLayoutStyle(byte partitionLayoutStyle)
Sets the layout style for the arrangement of each partition.

Default is PARTITION_LAYOUTSTYLE_CYCLIC

Parameters:
partitionLayoutStyle - one of PARTITION_LAYOUTSTYLE_CYCLIC, PARTITION_LAYOUTSTYLE_DISK or PARTITION_LAYOUTSTYLE_ORGANIC

canLayoutCore

public boolean canLayoutCore(LayoutGraph graph)
Always returns true.

Specified by:
canLayoutCore in class CanonicMultiStageLayouter

doLayoutCore

public void doLayoutCore(LayoutGraph graph)
Core layout routine.

Specified by:
doLayoutCore in class CanonicMultiStageLayouter

doLayout

public void doLayout(LayoutGraph layoutGraph)
Calculates a layout for the given graph. The given graph will not be copied during the layout process and the layout will be immediately applied to the given graph. This method is not side effect free in the sense that the order of edges or nodes in the input graph may change during the layout process.

Specified by:
doLayout in interface Layouter
Overrides:
doLayout in class CanonicMultiStageLayouter

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.