Packagecom.yworks.yfiles.layout.multipage
Classpublic class MultiPageLayouter
InheritanceMultiPageLayouter Inheritance AbstractLayoutStage Inheritance YObject Inheritance Object

Layout algorithm that subdivides the input graph into several com.yworks.yfiles.layout.LayoutGraph s (called page graphs) such that the layout of each graph fits the specified maximum page size (maxPageSize).

To guarantee that no information is lost, the layout algorithm replaces edges between nodes on different pages by so-called connector nodes (see com.yworks.yfiles.layout.multipage.NodeInfoCompanion.TYPE_CONNECTOR). Furthermore, it may replicate (proxy) nodes and insert elements called proxy reference nodes to refers to such proxies (see com.yworks.yfiles.layout.multipage.NodeInfoCompanion.TYPE_PROXY and com.yworks.yfiles.layout.multipage.NodeInfoCompanion.TYPE_PROXY_REFERENCE).

Unlike other yFiles layout algorithms, MultiPageLayouter does not modify its input graph but returns its result as a com.yworks.yfiles.layout.multipage.MultiPageLayout . To be able to profit as much as possible from existing layout support, MultiPageLayouter implements the com.yworks.yfiles.layout.Layouter interface although method doLayout (com.yworks.yfiles.layout.Layouter.doLayout()) does not specify a return value. Therefore client code has to register (layoutCallback) a com.yworks.yfiles.layout.multipage.LayoutCallback that is notified of MultiPageLayouter results.

Note: Client code must register data providers for keys NODE_ID_DPKEY, EDGE_ID_DPKEY, NODE_LABEL_ID_DPKEY, and EDGE_LABEL_ID_DPKEY before calling doLayout() or calcLayout().

See also

com.yworks.yfiles.layout.LayoutGraph
specified maximum page size
com.yworks.yfiles.layout.multipage.NodeInfoCompanion.TYPE_CONNECTOR
com.yworks.yfiles.layout.multipage.NodeInfoCompanion.TYPE_PROXY
com.yworks.yfiles.layout.multipage.NodeInfoCompanion.TYPE_PROXY_REFERENCE
com.yworks.yfiles.layout.multipage.MultiPageLayout
com.yworks.yfiles.layout.Layouter
doLayout
register
com.yworks.yfiles.layout.multipage.LayoutCallback
NODE_ID_DPKEY
EDGE_ID_DPKEY
NODE_LABEL_ID_DPKEY
EDGE_LABEL_ID_DPKEY
doLayout()
calcLayout()


Public Properties
 PropertyDefined By
 InheritedcoreLayouter : Layouter
Specifies the core layouter.
AbstractLayoutStage
  edgeBundleModeMask : int
Getter: Returns the bit mask that is used to define edge bundles.
MultiPageLayouter
  elementFactory : ElementFactory
Specifies the element factory that is used to create special nodes and edges in a multi-page layout.
MultiPageLayouter
  groupMode : int
Specifies how to handle node grouping.
MultiPageLayouter
  labelLayouter : LayoutStage
Getter: Returns the algorithm that is used for placing labels.
MultiPageLayouter
  labelLayouterEnabled : Boolean
Getter: Returns whether or not the specified labeling stage is enabled.
MultiPageLayouter
  layoutCallback : LayoutCallback
Specifies the callback that is notified upon completion of multi-page layout calculation runs.
MultiPageLayouter
  maxPageSize : YDimension
Specifies the maximum size allowed for a single page.
MultiPageLayouter
  preferredMaximalDuration : LongImpl
Getter: Returns the preferred time limit (in milliseconds) set for the layout algorithm.
MultiPageLayouter
Public Methods
 MethodDefined By
  
MultiPageLayouter(core:Layouter, init:Boolean = true)
Creates an instance of this layouter.
MultiPageLayouter
  
Calculates a new multi-page layout for the specified graph.
MultiPageLayouter
  
canLayout(graph:LayoutGraph):Boolean
[override]
MultiPageLayouter
  
doLayout(graph:LayoutGraph):void
[override] Calculates a new multi-page layout for the specified graph.
MultiPageLayouter
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
MultiPageLayouter
 Inherited
hashCode():int
YObject
  
[static] Creates an instance of this layouter.
MultiPageLayouter
Protected Methods
 MethodDefined By
 Inherited
canLayoutCore(graph:LayoutGraph):Boolean
Queries the core layouter whether or not the given graph can be laid out.
AbstractLayoutStage
  
Creates an element factory for multi-page layouts.
MultiPageLayouter
  
doIncrementalLayout(graph:LayoutGraph, incrementalNodesDP:DataProvider, context:LayoutContext):void
Called to improve layout results.
MultiPageLayouter
 Inherited
Invokes the layout routine of the core layouter.
AbstractLayoutStage
 Inherited
AbstractLayoutStage
 Inherited
AbstractLayoutStage
  
Initializes this object.
MultiPageLayouter
  
removeConnectorPair(connector1:Node, connector2:Node, originalEdgeIds:YList, context:LayoutContext):Boolean
Called during a postprocessing step that reduces the number of connectors.
MultiPageLayouter
  
routeRestoredEdges(graph:LayoutGraph, selectedEdgesDP:DataProvider, boundingRectangle:YRectangle):void
Called by method removeConnectorPair() to route the restored edges.
MultiPageLayouter
Public Constants
 ConstantDefined By
  EDGE_BUNDLE_DISTINGUISH_DIRECTIONS : int = 2
[static] Edge bundle mode specifier.
MultiPageLayouter
  EDGE_BUNDLE_DISTINGUISH_MULTIEDGES : int = 1
[static] Edge bundle mode specifier.
MultiPageLayouter
  EDGE_BUNDLE_DISTINGUISH_TYPES : int = 4
[static] Edge bundle mode specifier.
MultiPageLayouter
  EDGE_ID_DPKEY : Object = y.layout.multipage.MultiPageLayouter.EDGE_ID_DPKEY
[static] Used to map each edge of the input graph to a unique id.
MultiPageLayouter
  EDGE_LABEL_ID_DPKEY : Object = y.layout.multipage.MultiPageLayouter.EDGE_LABEL_ID_DPKEY
[static] Used to map each edge label of the input graph to a unique id.
MultiPageLayouter
  EDGE_TYPE_DPKEY : Object = y.layout.multipage.MultiPageLayouter.EDGE_TYPE_DPKEY
[static] Allows to specify the edge kind (an object).
MultiPageLayouter
  GROUP_MODE_ALL_NODES : int = 2
[static] Node grouping specifier.
MultiPageLayouter
  GROUP_MODE_IGNORE : int = 0
[static] Node grouping specifier.
MultiPageLayouter
  GROUP_MODE_ORIGINAL_NODES_ONLY : int = 1
[static] Node grouping specifier.
MultiPageLayouter
  NODE_CLUSTER_ID_DPKEY : Object = y.layout.multipage.MultiPageLayouter.NODE_CLUSTER_ID_DPKEY
[static] Allows to specify a cluster id (an object) for each node.
MultiPageLayouter
  NODE_ID_DPKEY : Object = y.layout.multipage.MultiPageLayouter.NODE_ID_DPKEY
[static] Used to map each node of the input graph to a unique id.
MultiPageLayouter
  NODE_LABEL_ID_DPKEY : Object = y.layout.multipage.MultiPageLayouter.NODE_LABEL_ID_DPKEY
[static] Used to map each node label of the input graph to a unique id.
MultiPageLayouter
Property Detail
edgeBundleModeMaskproperty
edgeBundleModeMask:int

Getter: Returns the bit mask that is used to define edge bundles.

Setter: Specifies a bit mask that is used to define edge bundles. All multi-edges (edges with same endpoints) belonging to the same edge bundle are split by the same connector pair (see com.yworks.yfiles.layout.multipage.NodeInfoCompanion.TYPE_CONNECTOR). Possible values are EDGE_BUNDLE_DISTINGUISH_TYPES, EDGE_BUNDLE_DISTINGUISH_DIRECTIONS and EDGE_BUNDLE_DISTINGUISH_MULTIEDGES.


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

See also

elementFactoryproperty 
elementFactory:ElementFactory

Specifies the element factory that is used to create special nodes and edges in a multi-page layout.


Implementation
    public function get elementFactory():ElementFactory
    public function set elementFactory(value:ElementFactory):void

See also

groupModeproperty 
groupMode:int

Specifies how to handle node grouping. Possible values are GROUP_MODE_IGNORE, GROUP_MODE_ALL_NODES and GROUP_MODE_ORIGINAL_NODES_ONLY.


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

See also

labelLayouterproperty 
labelLayouter:LayoutStage

Getter: Returns the algorithm that is used for placing labels. By default an instance of class com.yworks.yfiles.layout.labeling.GreedyMISLabeling will be returned that considers edge labels only.

Setter: Sets the algorithm that is used for placing labels. Note that assigning a new layout stage will not automatically activate it. To activate this stage use labelLayouterEnabled.


Implementation
    public function get labelLayouter():LayoutStage
    public function set labelLayouter(value:LayoutStage):void

See also

labelLayouterEnabledproperty 
labelLayouterEnabled:Boolean

Getter: Returns whether or not the specified labeling stage is enabled.

Setter: Specifies whether or not to enable the labeling stage. By default it is disabled.


Implementation
    public function get labelLayouterEnabled():Boolean
    public function set labelLayouterEnabled(value:Boolean):void

See also

layoutCallbackproperty 
layoutCallback:LayoutCallback

Specifies the callback that is notified upon completion of multi-page layout calculation runs.


Implementation
    public function get layoutCallback():LayoutCallback
    public function set layoutCallback(value:LayoutCallback):void
maxPageSizeproperty 
maxPageSize:YDimension

Specifies the maximum size allowed for a single page. The default value is width = height = 1000. Note that a large page size may increase runtime significantly. To limit runtime use method preferredMaximalDuration.


Implementation
    public function get maxPageSize():YDimension
    public function set maxPageSize(value:YDimension):void

See also

preferredMaximalDurationproperty 
preferredMaximalDuration:LongImpl

Getter: Returns the preferred time limit (in milliseconds) set for the layout algorithm.

Setter: Sets a preferred time limit (in milliseconds) for the layout algorithm. Note that restricting the maximal duration may result in a worse layout quality. Furthermore, the actual runtime may exceed the maximal duration since the layout algorithm still has to find a valid solution.


Implementation
    public function get preferredMaximalDuration():LongImpl
    public function set preferredMaximalDuration(value:LongImpl):void
Constructor Detail
MultiPageLayouter()Constructor
public function MultiPageLayouter(core:Layouter, init:Boolean = true)

Creates an instance of this layouter.

Parameters
core:Layouter — the layouter used to layout a page.
 
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
calcLayout()method
public function calcLayout(graph:LayoutGraph):MultiPageLayout

Calculates a new multi-page layout for the specified graph.

Parameters

graph:LayoutGraph — the input graph.

Returns
MultiPageLayout — an object that represents the results of the layout run.

See also

canLayout()method 
override public function canLayout(graph:LayoutGraph):Boolean

Parameters

graph:LayoutGraph

Returns
Boolean
createElementFactory()method 
protected function createElementFactory():ElementFactory

Creates an element factory for multi-page layouts. Called from elementFactory if no factory has been explicitly set using elementFactory.

Returns
ElementFactory — a com.yworks.yfiles.layout.multipage.DefaultElementFactory instance.

See also

doIncrementalLayout()method 
protected function doIncrementalLayout(graph:LayoutGraph, incrementalNodesDP:DataProvider, context:LayoutContext):void

Called to improve layout results. The marked nodes have to be placed without changing the coordinates of the fixed (non-marked) elements, without exceeding the specified maximum page size and without violating basic layout properties.

Parameters

graph:LayoutGraph — the graph to layout.
 
incrementalNodesDP:DataProvider — a DataProvider that marks nodes that should be placed (nodes for which getBool() returns true). The position of the other nodes is not allowed to change.
 
context:LayoutContext — the current layout context.

See also

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

Calculates a new multi-page layout for the specified graph. This method calls calcLayout() and notifies the registered layout callback (layoutCallback) of the calculated result.

Warning: Unlike other implementations of the com.yworks.yfiles.layout.Layouter.doLayout() method, the result of the layout calculation will not be applied to the input graph.

Parameters

graph:LayoutGraph — the input graph.

See also

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

Returns
Class
initMultiPageLayouter()method 
protected final function initMultiPageLayouter(core:Layouter):void

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

Parameters

core:Layouter

See also

newMultiPageLayouter()method 
public static function newMultiPageLayouter(core:Layouter):MultiPageLayouter

Creates an instance of this layouter.

Parameters

core:Layouter — the layouter used to layout a page.

Returns
MultiPageLayouter
removeConnectorPair()method 
protected function removeConnectorPair(connector1:Node, connector2:Node, originalEdgeIds:YList, context:LayoutContext):Boolean

Called during a postprocessing step that reduces the number of connectors. A pair of connectors can be removed if both connector nodes are placed on the same page. This method removes both connector nodes and restores the original edges. It calls method routeRestoredEdges() to route these edges.

Parameters

connector1:Node — the first connector of the connector pair.
 
connector2:Node — the second connector of the connector pair.
 
originalEdgeIds:YList — the ids of the original edges that have to be restored.
 
context:LayoutContext — the current layout context.

Returns
Boolean — whether or not the removal of the connector pair was successful. If the method returns false the graph was not changed, i.e., the connector pair was not removed.

See also

routeRestoredEdges()method 
protected function routeRestoredEdges(graph:LayoutGraph, selectedEdgesDP:DataProvider, boundingRectangle:YRectangle):void

Called by method removeConnectorPair() to route the restored edges.

Parameters

graph:LayoutGraph — the relevant graph.
 
selectedEdgesDP:DataProvider — marks the edges that should be rerouted.
 
boundingRectangle:YRectangle — the edge routes should be fully contained within this rectangle.

See also

Constant Detail
EDGE_BUNDLE_DISTINGUISH_DIRECTIONSConstant
public static const EDGE_BUNDLE_DISTINGUISH_DIRECTIONS:int = 2

Edge bundle mode specifier. Used to define edge bundles. All multi-edges (edges with same endpoints) belonging to the same edge bundle are split by the same connector pair (see com.yworks.yfiles.layout.multipage.NodeInfoCompanion.TYPE_CONNECTOR). This value specifies that multi-edges should be distinguished if the have different directions.

See also

EDGE_BUNDLE_DISTINGUISH_MULTIEDGESConstant 
public static const EDGE_BUNDLE_DISTINGUISH_MULTIEDGES:int = 1

Edge bundle mode specifier. Used to define edge bundles. All multi-edges (edges with same endpoints) belonging to the same edge bundle are split by the same connector pair (see com.yworks.yfiles.layout.multipage.NodeInfoCompanion.TYPE_CONNECTOR). This value specifies that all multi-edges should be distinguished, i.e., a separate connector pair is used for each multi-edge.

See also

EDGE_BUNDLE_DISTINGUISH_TYPESConstant 
public static const EDGE_BUNDLE_DISTINGUISH_TYPES:int = 4

Edge bundle mode specifier. Used to define edge bundles. All multi-edges (edges with same endpoints) belonging to the same edge bundle are split by the same connector pair (see com.yworks.yfiles.layout.multipage.NodeInfoCompanion.TYPE_CONNECTOR). This value specifies that multi-edges should be distinguished if they are of different (user specified) type, see EDGE_TYPE_DPKEY.

See also

EDGE_ID_DPKEYConstant 
public static const EDGE_ID_DPKEY:Object = y.layout.multipage.MultiPageLayouter.EDGE_ID_DPKEY

Used to map each edge of the input graph to a unique id. Note: this DataProvider has to be specified by the user!

EDGE_LABEL_ID_DPKEYConstant 
public static const EDGE_LABEL_ID_DPKEY:Object = y.layout.multipage.MultiPageLayouter.EDGE_LABEL_ID_DPKEY

Used to map each edge label of the input graph to a unique id. Note: this DataProvider has to be specified by the user!

EDGE_TYPE_DPKEYConstant 
public static const EDGE_TYPE_DPKEY:Object = y.layout.multipage.MultiPageLayouter.EDGE_TYPE_DPKEY

Allows to specify the edge kind (an object). Multi-edges (edges with same endpoints) of different kind are distinguished if edgeBundleModeMask & EDGE_BUNDLE_DISTINGUISH_TYPES == 1.

See also

GROUP_MODE_ALL_NODESConstant 
public static const GROUP_MODE_ALL_NODES:int = 2

Node grouping specifier. This value specifies that special nodes like, e.g., connector and proxy nodes are assigned to group nodes, too.

See also

GROUP_MODE_IGNOREConstant 
public static const GROUP_MODE_IGNORE:int = 0

Node grouping specifier. This value specifies that group nodes are completely ignored.

See also

GROUP_MODE_ORIGINAL_NODES_ONLYConstant 
public static const GROUP_MODE_ORIGINAL_NODES_ONLY:int = 1

Node grouping specifier. This value specifies that only original nodes are assigned in group nodes.

See also

NODE_CLUSTER_ID_DPKEYConstant 
public static const NODE_CLUSTER_ID_DPKEY:Object = y.layout.multipage.MultiPageLayouter.NODE_CLUSTER_ID_DPKEY

Allows to specify a cluster id (an object) for each node. Nodes with the same cluster id should preferably be placed on the same page.

NODE_ID_DPKEYConstant 
public static const NODE_ID_DPKEY:Object = y.layout.multipage.MultiPageLayouter.NODE_ID_DPKEY

Used to map each node of the input graph to a unique id. Note: this DataProvider has to be specified by the user!

NODE_LABEL_ID_DPKEYConstant 
public static const NODE_LABEL_ID_DPKEY:Object = y.layout.multipage.MultiPageLayouter.NODE_LABEL_ID_DPKEY

Used to map each node label of the input graph to a unique id. Note: this DataProvider has to be specified by the user!