Packagecom.yworks.yfiles.layout.organic
Classpublic class OrganicLayouter
InheritanceOrganicLayouter Inheritance CanonicMultiStageLayouter Inheritance YObject Inheritance Object

A graph layout algorithm that is based on a force directed model.

Here is a sample output of the layouter:



Public Properties
 PropertyDefined By
  activateDeterministicMode : Boolean
Getter: Returns whether or not this layouter is in deterministic mode.
OrganicLayouter
  activateTreeBeautifier : Boolean
Specifies whether or not to activate the subtree beautifier.
OrganicLayouter
  attraction : int
Specifies the current attraction.
OrganicLayouter
 InheritedcomponentLayouter : LayoutStage
Specifies the LayoutStage responsible for laying out the connected components of the graph.
CanonicMultiStageLayouter
 InheritedcomponentLayouterEnabled : Boolean
Getter: Returns whether or not ComponentLayouter is enabled.
CanonicMultiStageLayouter
  finalTemperature : Number
Specifies the final temperature.
OrganicLayouter
  gravityFactor : Number
Specifies the gravity factor.
OrganicLayouter
  groupBoundsCalculator : GroupBoundsCalculator
Getter: Returns the GroupBoundsCalculator instance that is used for the calculation of the group nodes' bounds if a hierarchically grouped graph is being laid out.
OrganicLayouter
  groupNodeCompactness : Number
Getter: Returns the group node compactness factor.
OrganicLayouter
 InheritedgroupNodeHider : LayoutStage
Specifies the LayoutStage that is responsible for hiding away grouping information for the layout algorithm.
CanonicMultiStageLayouter
  groupNodePolicy : int
Getter: Returns the policy for group nodes.
OrganicLayouter
 InheritedhideGroupNodes : Boolean
Specifies whether or not to hide away group nodes before the layout begins.
CanonicMultiStageLayouter
  initialPlacement : int
Specifies the initial placement strategy.
OrganicLayouter
  initialTemperature : Number
Specifies the initial temperature.
OrganicLayouter
  iterationFactor : Number
Specifies the iteration factor of this layouter.
OrganicLayouter
 InheritedlabelLayouter : LayoutStage
Getter: Returns the algorithm used for placing labels.
CanonicMultiStageLayouter
 InheritedlabelLayouterEnabled : Boolean
Getter: Returns whether or not LabelLayouter is enabled.
CanonicMultiStageLayouter
 InheritedlayoutOrientation : int
Specifies the main layout orientation.
CanonicMultiStageLayouter
  maximumDuration : uint
Specifies the maximum duration granted to this layouter.
OrganicLayouter
  obeyNodeSize : Boolean
Specifies whether or not node sizes should be considered by this layouter.
OrganicLayouter
 InheritedorientationLayouter : LayoutStage
Specifies the LayoutStage that is responsible for changing the orientation of the computed layout.
CanonicMultiStageLayouter
 InheritedorientationLayouterEnabled : Boolean
Getter: Returns whether or not the OrientationLayouter is enabled.
CanonicMultiStageLayouter
 InheritedparallelEdgeLayouter : LayoutStage
Getter: Returns the LayoutStage responsible for routing parallel edges.
CanonicMultiStageLayouter
 InheritedparallelEdgeLayouterEnabled : Boolean
Getter: Returns whether or not the ParallelEdgeLayouter is enabled.
CanonicMultiStageLayouter
  preferredEdgeLength : int
Specifies the general edge length that should be attained by this layouter.
OrganicLayouter
  repulsion : int
Specifies the current repulsion.
OrganicLayouter
 InheritedselfLoopLayouter : LayoutStage
Getter: Returns the LayoutStage used for routing Self-loops.
CanonicMultiStageLayouter
 InheritedselfLoopLayouterEnabled : Boolean
Getter: Returns whether or not the SelfLoopLayouter is enabled.
CanonicMultiStageLayouter
  sphereOfAction : int
Specifies the sphere of action for this layouter.
OrganicLayouter
 InheritedsubgraphLayouter : LayoutStage
Specifies the LayoutStage that is responsible for constraining the layout process to a subgraph of the target graph.
CanonicMultiStageLayouter
 InheritedsubgraphLayouterEnabled : Boolean
Getter: Returns whether or not the SubgraphLayouter is enabled.
CanonicMultiStageLayouter
Public Methods
 MethodDefined By
  
OrganicLayouter(init:Boolean = true)
Returns a new organic Layouter.
OrganicLayouter
 Inherited
Appends a stage to the layout pipeline.
CanonicMultiStageLayouter
 Inherited
Returns a layout for the given layout graph.
CanonicMultiStageLayouter
 Inherited
Returns a layout for the given graph interface and layout.
CanonicMultiStageLayouter
 Inherited
canLayout(graph:LayoutGraph):Boolean
Tests whether or not the given graph can be laid out by this layouter.
CanonicMultiStageLayouter
  
canLayoutCore(graph:LayoutGraph):Boolean
[override] Returns always true because this algorithms has no preconditions.
OrganicLayouter
  
dispose():void
Frees resources
OrganicLayouter
 Inherited
doLayout(layoutGraph:LayoutGraph):void
Calculates a layout for the given graph.
CanonicMultiStageLayouter
 Inherited
Calculates a layout for the given graph interface and layout.
CanonicMultiStageLayouter
  
[override] Invokes the core layout algorithm.
OrganicLayouter
 Inherited
Disables all layout stages and performs only the core layouter.
CanonicMultiStageLayouter
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
OrganicLayouter
 Inherited
hashCode():int
YObject
  
[static] Returns a new organic Layouter.
OrganicLayouter
 Inherited
Prepends a stage to the layout pipeline.
CanonicMultiStageLayouter
 Inherited
Removes a LayoutStage that has been previously added by the methods appendStage() or prependStage().
CanonicMultiStageLayouter
Protected Methods
 MethodDefined By
 Inherited
checkGroupNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given group node object is zero.
CanonicMultiStageLayouter
 Inherited
checkNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given node object is zero.
CanonicMultiStageLayouter
 Inherited
CanonicMultiStageLayouter
  
Initializes this object.
OrganicLayouter
Public Constants
 ConstantDefined By
  ALL : int = 0
[static] Sphere of action specifier.
OrganicLayouter
  AS_IS : int = 2
[static] Initial placement strategy.
OrganicLayouter
  FIXED_GROUP_NODES_DPKEY : Object = y.layout.organic.OrganicLayouter.FIXED_GROUP_NODES_DPKEY
[static] DataProvider key used in conjunction with hierarchically grouped graphs.
OrganicLayouter
  FIXED_GROUPS_POLICY : int = 1
[static] Node group policy specifier.
OrganicLayouter
  IGNORE_GROUPS_POLICY : int = 2
[static] Node group policy specifier.
OrganicLayouter
  LAYOUT_GROUPS_POLICY : int = 0
[static] Node group policy specifier.
OrganicLayouter
  MAINLY_SELECTION : int = 1
[static] Sphere of action specifier.
OrganicLayouter
  ONLY_SELECTION : int = 2
[static] Sphere of action specifier.
OrganicLayouter
  PREFERRED_EDGE_LENGTH_DATA : Object = OrganicLayouter.EDGE_LENGTH_DATA
[static] Key used to associate a com.yworks.yfiles.base.DataProvider with a LayoutGraph.
OrganicLayouter
  RANDOM : int = 0
[static] Initial placement strategy.
OrganicLayouter
  SPHERE_OF_ACTION_NODES : Object = SPHERE_OF_ACTION_NODES
[static] DataProvider key used in conjunction with the sphere-of-action feature.
OrganicLayouter
  ZERO : int = 1
[static] Initial placement strategy.
OrganicLayouter
Property Detail
activateDeterministicModeproperty
activateDeterministicMode:Boolean

Getter: Returns whether or not this layouter is in deterministic mode.

Setter: Specifies whether or not this layouter should work in a deterministic mode. In a deterministic mode this layouter produces the same layouts for the same input graph and layout parameters.

By default deterministic mode is inactive.


Implementation
    public function get activateDeterministicMode():Boolean
    public function set activateDeterministicMode(value:Boolean):void
activateTreeBeautifierproperty 
activateTreeBeautifier:Boolean

Specifies whether or not to activate the subtree beautifier. Activating this feature lays out subtrees within the given graph structure in an optimized way.

By default this feature is inactive.


Implementation
    public function get activateTreeBeautifier():Boolean
    public function set activateTreeBeautifier(value:Boolean):void
attractionproperty 
attraction:int

Specifies the current attraction.


Implementation
    public function get attraction():int
    public function set attraction(value:int):void
finalTemperatureproperty 
finalTemperature:Number

Specifies the final temperature. This is an absolute temperature. If the average temperature falls under this value, the layout process comes to a halt. The default is 1.0d.


Implementation
    public function get finalTemperature():Number
    public function set finalTemperature(value:Number):void
gravityFactorproperty 
gravityFactor:Number

Specifies the gravity factor. The magnitude of the gravity factor determines the strength of the force towards the barycenter of the graph. A high factor layout tends to cluster nodes around the barycenter of the graph. A low factor stretches the outskirts of the graph far away from the center.

By default a value of 0.0 is assumed.


Implementation
    public function get gravityFactor():Number
    public function set gravityFactor(value:Number):void
groupBoundsCalculatorproperty 
groupBoundsCalculator:GroupBoundsCalculator

Getter: Returns the GroupBoundsCalculator instance that is used for the calculation of the group nodes' bounds if a hierarchically grouped graph is being laid out. By default a com.yworks.yfiles.layout.grouping.MinimumSizeGroupBoundsCalculator instance is registered with this instance.

Setter: Sets the instance used for the calculation of the group nodes' bounds if a hierarchically grouped graph is being laid out.


Implementation
    public function get groupBoundsCalculator():GroupBoundsCalculator
    public function set groupBoundsCalculator(value:GroupBoundsCalculator):void

See also

groupNodeCompactnessproperty 
groupNodeCompactness:Number

Getter: Returns the group node compactness factor.

Setter: Sets the compactness of group nodes. Values should be in the range [0..1], where 0 results in group nodes not affecting the overall layout too much, whereas a value of 1 forces nodes in the same group to be clustered tightly.


Implementation
    public function get groupNodeCompactness():Number
    public function set groupNodeCompactness(value:Number):void

Throws
IllegalArgumentException — if compactness value does not lie in [0..1]
groupNodePolicyproperty 
groupNodePolicy:int

Getter: Returns the policy for group nodes. This policy controls the behavior of this layouter when acting on hierarchically grouped graphs. The default is LAYOUT_GROUPS_POLICY.

Setter: Sets the policy for group nodes. This policy controls the behavior of this layouter when acting on hierarchically grouped graphs. This should be one of FIXED_GROUPS_POLICY, LAYOUT_GROUPS_POLICY, or IGNORE_GROUPS_POLICY.


Implementation
    public function get groupNodePolicy():int
    public function set groupNodePolicy(value:int):void

See also

initialPlacementproperty 
initialPlacement:int

Specifies the initial placement strategy.

The default value is AS_IS.


Implementation
    public function get initialPlacement():int
    public function set initialPlacement(value:int):void

See also

initialTemperatureproperty 
initialTemperature:Number

Specifies the initial temperature. The temperature will be multiplied with the preferredEdgeLength and then assigned as the initial node heat.

The default is 0.1d.


Implementation
    public function get initialTemperature():Number
    public function set initialTemperature(value:Number):void
iterationFactorproperty 
iterationFactor:Number

Specifies the iteration factor of this layouter. A higher iteration factor usually means better layout results and longer running times.

By default an iteration factor of 3 is set.


Implementation
    public function get iterationFactor():Number
    public function set iterationFactor(value:Number):void
maximumDurationproperty 
maximumDuration:uint

Specifies the maximum duration granted to this layouter.


Implementation
    public function get maximumDuration():uint
    public function set maximumDuration(value:uint):void
obeyNodeSizeproperty 
obeyNodeSize:Boolean

Specifies whether or not node sizes should be considered by this layouter. If you want to layout a diagram with big nodes in it you can reduce node overlaps by setting this feature to true.

Defaults to true.


Implementation
    public function get obeyNodeSize():Boolean
    public function set obeyNodeSize(value:Boolean):void
preferredEdgeLengthproperty 
preferredEdgeLength:int

Specifies the general edge length that should be attained by this layouter.

By default an edge length of 80 is set.


Implementation
    public function get preferredEdgeLength():int
    public function set preferredEdgeLength(value:int):void
repulsionproperty 
repulsion:int

Specifies the current repulsion.


Implementation
    public function get repulsion():int
    public function set repulsion(value:int):void
sphereOfActionproperty 
sphereOfAction:int

Specifies the sphere of action for this layouter.

The default value is ALL.


Implementation
    public function get sphereOfAction():int
    public function set sphereOfAction(value:int):void

See also

Constructor Detail
OrganicLayouter()Constructor
public function OrganicLayouter(init:Boolean = true)

Returns a new organic Layouter.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
canLayoutCore()method
override public function canLayoutCore(graph:LayoutGraph):Boolean

Returns always true because this algorithms has no preconditions.

Parameters

graph:LayoutGraph

Returns
Booleantrue.
dispose()method 
public function dispose():void

Frees resources

doLayoutCore()method 
override public function doLayoutCore(graph:LayoutGraph):void

Invokes the core layout algorithm.

Parameters

graph:LayoutGraph

getClass()method 
override public function getClass():Class

Returns
Class
initOrganicLayouter()method 
protected final function initOrganicLayouter():void

Initializes this object. See the documentation of the corresponding factory method newOrganicLayouter() for details.

See also

newOrganicLayouter()method 
public static function newOrganicLayouter():OrganicLayouter

Returns a new organic Layouter.

Returns
OrganicLayouter
Constant Detail
ALLConstant
public static const ALL:int = 0

Sphere of action specifier. Displace all nodes.

See also

AS_ISConstant 
public static const AS_IS:int = 2

Initial placement strategy. Start with given positions.

See also

FIXED_GROUP_NODES_DPKEYConstant 
public static const FIXED_GROUP_NODES_DPKEY:Object = y.layout.organic.OrganicLayouter.FIXED_GROUP_NODES_DPKEY

DataProvider key used in conjunction with hierarchically grouped graphs. If this data provider key is registered with the LayoutGraph, then its associated data provider must return for each group node node in the input graph a boolean value indicating whether its contents/children should be treated as fixed or not.

See also

FIXED_GROUPS_POLICYConstant 
public static const FIXED_GROUPS_POLICY:int = 1

Node group policy specifier. This layouter will keep the relative positions of nodes that belong to the same group. The layouter will take the fixed groups into account when placing the other nodes of the graph.

IGNORE_GROUPS_POLICYConstant 
public static const IGNORE_GROUPS_POLICY:int = 2

Node group policy specifier. This layouter will ignore all grouping related information when laying out the graph.

LAYOUT_GROUPS_POLICYConstant 
public static const LAYOUT_GROUPS_POLICY:int = 0

Node group policy specifier. This layouter will consider grouping information of an input graph. It will layout the contents of groups in a way that highlights their togetherness.

MAINLY_SELECTIONConstant 
public static const MAINLY_SELECTION:int = 1

Sphere of action specifier. Displace mainly selected nodes, but allow minor movement of unselected nodes as well. A node is considered to be selected if the LayoutGraph DataProvider registered with the key SPHERE_OF_ACTION_NODES returns true for that node.

See also

ONLY_SELECTIONConstant 
public static const ONLY_SELECTION:int = 2

Sphere of action specifier. Displace only selected nodes A node is considered to be selected if the LayoutGraph DataProvider registered with the key SPHERE_OF_ACTION_NODES returns true for that node.

See also

PREFERRED_EDGE_LENGTH_DATAConstant 
public static const PREFERRED_EDGE_LENGTH_DATA:Object = OrganicLayouter.EDGE_LENGTH_DATA

Key used to associate a com.yworks.yfiles.base.DataProvider with a LayoutGraph. The associated DataProvider must return an int values for each edge of the LayoutGraph. The value returned for a specific edge will be interpreted as its preferred edge length.

If a DataProvider is bound to this key, then the global preferredEdgeLength for all edges (see preferredEdgeLength) will be ignored.

Example: Assuming that a method int getWeight(Edge) is provided that returns for each edge a double value between 0.0 and 1.0, then these edge weights can be translated to edge length preferences between 0 and 200 that the OrganicLayouter tries to obey.
 import y.util.DataProviderAdapter; //define an adequate data provider DataProviderAdapter edgeLengthData = new DataProviderAdapter() { public int getInt(Object o) { return (int)(200*getWeight((Edge)o)); } } LayoutGraph graph = ...; OrganicLayouter layouter = ...; //register the data provider graph.addDataProvider(PREFERRED_EDGE_LENGTH_DATA, edgeLengthData); //launch the layouter layouter.doLayout(graph); 

See also

RANDOMConstant 
public static const RANDOM:int = 0

Initial placement strategy. Start with randomly chosen positions.

See also

SPHERE_OF_ACTION_NODESConstant 
public static const SPHERE_OF_ACTION_NODES:Object = SPHERE_OF_ACTION_NODES

DataProvider key used in conjunction with the sphere-of-action feature. If this data provider key is being used, then it must return for each node in the input graph a boolean value indicating whether or not it should be handled by this layouter.

See also

ZEROConstant 
public static const ZERO:int = 1

Initial placement strategy. Start with all positions set to (0,0,0).

See also