|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.AbstractLayoutStage
y.layout.multipage.MultiPageLayouter
public class MultiPageLayouter
This layout algorithm subdivides the input graph into several LayoutGraphs (called page graphs) such that the
layout (calculated by the specified core layout algorithm) of each graph fits the
specified maximum page size.
The algorithm adds special nodes to guarantee that no information is lost when splitting edges that connect nodes placed on different pages (for more details take a look at the concept described below).

The input graph is subdivided into two pages with size 500x500.
Circular nodes denote the so-called connectors that split edges to nodes placed on other pages.
The label of a connector corresponds to that of the opposite node of the split edge.
This multi-page layout algorithm subdivides the input graph into several smaller ones and applies
existing layout algorithms to each of them.
Hence, its layout style heavily depends on the selected
core layout algorithm used for each single page.
Furthermore, the algorithm uses several refinement steps to produce more compact results.
Similar to the layout style, the supported feature set mainly depends on the features supported by the specified
core layout algorithm. Note that due to the underlying approach of the
MultiPageLayouter it doesn't support PartitionGrids.
Furthermore, while the MultiPageLayouter is able to support groups (see setGroupMode(byte)),
it doesn't support edges incident to group nodes.
To guarantee that no information is lost, this layout algorithm replaces edges between nodes on different pages by
so-called connector nodes. Furthermore, it may replicate nodes
(the clones are called proxy nodes) and
insert special nodes to refer to such nodes (so-called proxy reference nodes).
Unlike other yFiles layout algorithms, MultiPageLayouter does
not modify its input graph but returns its result as a MultiPageLayout. To be able to
profit as much as possible from existing layout support, this layout algorithm implements the Layouter interface, although method doLayout does not specify a
return value. Therefore, client code has to register a LayoutCallback that is invoked when the algorithm has calculated a new multi-page result.
DataProviders for keys NODE_ID_DPKEY, EDGE_ID_DPKEY,
NODE_LABEL_ID_DPKEY, and EDGE_LABEL_ID_DPKEY before
calling doLayout(y.layout.LayoutGraph) or calcLayout(y.layout.LayoutGraph).![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
static byte |
EDGE_BUNDLE_DISTINGUISH_DIRECTIONS
Edge bundle mode constant that specifies that multi-edges (edges with same endpoints) should be distinguished if they have different directions. |
static byte |
EDGE_BUNDLE_DISTINGUISH_MULTIEDGES
Edge bundle mode constant that specifies that all multi-edges (edges with same endpoints) should be distinguished. |
static byte |
EDGE_BUNDLE_DISTINGUISH_TYPES
Edge bundle mode constant that specifies that multi-edges (edges with same endpoints) should be distinguished if they are of different (user specified) type, see EDGE_TYPE_DPKEY. |
static java.lang.Object |
EDGE_ID_DPKEY
A DataProvider key for mapping each edge of the input graph to a unique ID.
|
static java.lang.Object |
EDGE_LABEL_ID_DPKEY
A DataProvider key for mapping each edge label of the input graph to a unique ID.
|
static java.lang.Object |
EDGE_TYPE_DPKEY
A DataProvider key for specifying the type of multi-edges.
|
static byte |
GROUP_MODE_ALL_NODES
Node grouping specifier used when special nodes like, e.g., connector and proxy nodes (see NodeInfo.TYPE_CONNECTOR and NodeInfo.TYPE_PROXY)
should be assigned to group nodes, too. |
static byte |
GROUP_MODE_IGNORE
Node grouping specifier used when group nodes should be ignored. |
static byte |
GROUP_MODE_ORIGINAL_NODES_ONLY
Node grouping specifier used when only original nodes should be assigned to group nodes. |
static java.lang.Object |
NODE_CLUSTER_ID_DPKEY
A DataProvider key for assigning a cluster ID to common (non-group) nodes.
|
static java.lang.Object |
NODE_ID_DPKEY
A DataProvider key for mapping each node of the input graph to a unique ID.
|
static java.lang.Object |
NODE_LABEL_ID_DPKEY
A DataProvider key for mapping each node label of the input graph to a unique ID.
|
| Fields inherited from interface y.layout.Layouter |
|---|
NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
| Constructor Summary | |
|---|---|
MultiPageLayouter(Layouter core)
Creates a new MultiPageLayouter instance. |
|
| Method Summary | |
|---|---|
MultiPageLayout |
calcLayout(LayoutGraph graph)
Calculates a new multi-page layout for the specified graph. |
boolean |
canLayout(LayoutGraph graph)
First, this method checks if all ID DataProviders are registered
(NODE_ID_DPKEY, EDGE_ID_DPKEY, NODE_LABEL_ID_DPKEY and EDGE_LABEL_ID_DPKEY). |
protected ElementFactory |
createElementFactory()
This method creates the element factory for multi-page layouts. |
protected void |
doIncrementalLayout(LayoutGraph graph,
DataProvider incrementalNodesDP,
LayoutContext context)
This method is called to further improve the layout results. |
void |
doLayout(LayoutGraph graph)
Calculates a new multi-page layout for the specified graph. |
int |
getAdditionalParentCount()
Returns the number of additional tree parent proxies
that the algorithm tries to place on a page. |
int |
getEdgeBundleModeMask()
Returns the bit mask for defining edge bundles. |
ElementFactory |
getElementFactory()
Returns the element factory for creating special nodes and
edges in a multi-page layout. |
byte |
getGroupMode()
Returns how to handle special nodes (like connector and proxy nodes) with respect to groups. |
LayoutStage |
getLabelLayouter()
Returns the LayoutStage that places the labels of the input graph. |
LayoutCallback |
getLayoutCallback()
Returns the callback that is notified upon completion of multi-page
layout calculation runs. |
YDimension |
getMaxPageSize()
Returns the maximum size of a single page. |
long |
getPreferredMaximalDuration()
Returns the preferred time limit (in milliseconds) for the layout algorithm. |
boolean |
isLabelLayouterEnabled()
Returns whether or not the given labeling algorithm
places the labels of the input graph. |
boolean |
isMultipleComponentsOnSinglePagePlacementEnabled()
Returns whether or not different connected components may be placed on a single page. |
boolean |
isProxyReferenceNodeCreationEnabled()
Returns whether or not the algorithm should create proxy reference nodes. |
boolean |
isStrictClusterSeparationEnabled()
Returns whether or not the algorithm should separate nodes with different cluster IDs. |
protected boolean |
removeConnectorPair(Node connector1,
Node connector2,
YList originalEdgeIds,
LayoutContext context)
This method is called during a postprocessing step that reduces the number of connectors. |
protected void |
routeRestoredEdges(LayoutGraph graph,
DataProvider selectedEdgesDP,
YRectangle boundingRectangle)
This method is called whenever some single edges have to be routed without changing the position of nodes (e.g., by removeConnectorPair(y.base.Node, y.base.Node, y.base.YList, LayoutContext)
to route the restored edges). |
void |
setAdditionalParentCount(int additionalParentCount)
Specifies the number of additional tree parent proxies
that the algorithm tries to place on a page. |
void |
setEdgeBundleModeMask(int edgeBundleModeMask)
Specifies the bit mask for defining edge bundles. |
void |
setElementFactory(ElementFactory factory)
Specifies the element factory for creating special nodes and
edges in a multi-page layout. |
void |
setGroupMode(byte groupMode)
Specifies how to handle special nodes (like connector and proxy nodes) with respect to groups. |
void |
setLabelLayouter(LayoutStage labeler)
Specifies the LayoutStage that places the labels of the input graph. |
void |
setLabelLayouterEnabled(boolean labelLayouterEnabled)
Specifies whether or not the given labeling algorithm
places the labels of the input graph. |
void |
setLayoutCallback(LayoutCallback callback)
Specifies the callback that is notified upon completion of multi-page
layout calculation runs. |
void |
setMaxPageSize(YDimension maxPageSize)
Specifies the maximum size of a single page. |
void |
setMultipleComponentsOnSinglePagePlacementEnabled(boolean multipleComponentsOnSinglePagePlacementEnabled)
Specifies whether or not different connected components may be placed on a single page. |
void |
setPreferredMaximalDuration(long preferredMaximalDuration)
Sets the preferred time limit (in milliseconds) for the layout algorithm. |
void |
setProxyReferenceNodeCreationEnabled(boolean proxyReferenceNodeCreationEnabled)
Specifies whether or not the algorithm should create proxy reference nodes. |
void |
setStrictClusterSeparationEnabled(boolean strictClusterSeparationEnabled)
Specifies whether or not the algorithm should separate nodes with different cluster IDs. |
| Methods inherited from class y.layout.AbstractLayoutStage |
|---|
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.Object NODE_CLUSTER_ID_DPKEY
DataProvider key for assigning a cluster ID to common (non-group) nodes.
DataProvider associated with this key, the algorithm assumes that there are no such
preferences.setStrictClusterSeparationEnabled(boolean)public static final java.lang.Object NODE_ID_DPKEY
DataProvider key for mapping each node of the input graph to a unique ID.
DataProvider has to be specified by the user!public static final java.lang.Object EDGE_ID_DPKEY
DataProvider key for mapping each edge of the input graph to a unique ID.
DataProvider has to be specified by the user!public static final java.lang.Object EDGE_LABEL_ID_DPKEY
DataProvider key for mapping each edge label of the input graph to a unique ID.
DataProvider has to be specified by the user!public static final java.lang.Object NODE_LABEL_ID_DPKEY
DataProvider key for mapping each node label of the input graph to a unique ID.
DataProvider has to be specified by the user!public static final java.lang.Object EDGE_TYPE_DPKEY
DataProvider key for specifying the type of multi-edges.
If getEdgeBundleModeMask() & EDGE_BUNDLE_DISTINGUISH_TYPES == 1, multi-edges
(edges with same endpoints) associated with different types (objects) are distinguished, i.e.,
they are split by different connector pairs (see NodeInfo.TYPE_CONNECTOR).
EDGE_BUNDLE_DISTINGUISH_TYPES,
setEdgeBundleModeMask(int)public static final byte GROUP_MODE_IGNORE
setGroupMode(byte),
Constant Field Valuespublic static final byte GROUP_MODE_ORIGINAL_NODES_ONLY
NodeInfo.TYPE_CONNECTOR and NodeInfo.TYPE_PROXY)
are never assigned to group nodes even though the associated node lies within a group.
public static final byte GROUP_MODE_ALL_NODES
NodeInfo.TYPE_CONNECTOR and NodeInfo.TYPE_PROXY)
should be assigned to group nodes, too.
public static final byte EDGE_BUNDLE_DISTINGUISH_MULTIEDGES
NodeInfo.TYPE_CONNECTOR) is used for each of them.
public static final byte EDGE_BUNDLE_DISTINGUISH_DIRECTIONS
NodeInfo.TYPE_CONNECTOR)
if they point in the same direction (i.e., both have the same source and target node).
public static final byte EDGE_BUNDLE_DISTINGUISH_TYPES
EDGE_TYPE_DPKEY.
Hence, two edges with the same endpoints and same type may share a connector pair
(see NodeInfo.TYPE_CONNECTOR).
setEdgeBundleModeMask(int),
EDGE_TYPE_DPKEY,
Constant Field Values| Constructor Detail |
|---|
public MultiPageLayouter(Layouter core)
MultiPageLayouter instance.
core - the layout algorithm used for a single page| Method Detail |
|---|
public boolean isProxyReferenceNodeCreationEnabled()
proxy reference nodes.
If this option is disabled, the algorithm doesn't create proxy reference nodes in which case
the referencing node of a proxy node
corresponds to its represented node.
true if the algorithm creates proxy reference nodes, false otherwisesetProxyReferenceNodeCreationEnabled(boolean),
NodeInfo.TYPE_PROXY_REFERENCE,
NodeInfo.TYPE_PROXY,
NodeInfo.getReferencingNode(),
NodeInfo.getRepresentedNode()public void setProxyReferenceNodeCreationEnabled(boolean proxyReferenceNodeCreationEnabled)
proxy reference nodes.
If this option is disabled, the algorithm doesn't create proxy reference nodes in which case
the referencing node of a proxy node
corresponds to its represented node.
proxyReferenceNodeCreationEnabled - true if the algorithm should create proxy reference nodes,
false otherwiseNodeInfo.TYPE_PROXY_REFERENCE,
NodeInfo.TYPE_PROXY,
NodeInfo.getReferencingNode(),
NodeInfo.getRepresentedNode()public boolean isStrictClusterSeparationEnabled()
cluster IDs. More precisely,
if this option is enabled, the algorithm doesn't place nodes with different cluster IDs onto the same page.
Otherwise, such a placement is possible.
true if the algorithm separates nodes with different cluster IDs,
false otherwiseNODE_CLUSTER_ID_DPKEY,
setStrictClusterSeparationEnabled(boolean)public void setStrictClusterSeparationEnabled(boolean strictClusterSeparationEnabled)
cluster IDs. More precisely,
if this option is enabled, the algorithm doesn't place nodes with different cluster IDs onto the same page.
Otherwise, such a placement is possible.
strictClusterSeparationEnabled - true if the algorithm should separate nodes with different cluster
IDs, false otherwiseNODE_CLUSTER_ID_DPKEYpublic boolean isLabelLayouterEnabled()
labeling algorithm
places the labels of the input graph.
If this option is disabled, the labels are either ignored or
placed by the integrated labeling approach of the core layout algorithm.
true if the given label layouter places the labels,
false otherwisesetLabelLayouter(y.layout.LayoutStage),
setLabelLayouterEnabled(boolean)public void setLabelLayouterEnabled(boolean labelLayouterEnabled)
labeling algorithm
places the labels of the input graph.
If this option is disabled, the labels are either ignored or
placed by the integrated labeling approach of the core layout algorithm.
labelLayouterEnabled - true if the given labeling algorithm should place the labels,
false otherwisesetLabelLayouter(LayoutStage)protected ElementFactory createElementFactory()
element factory for multi-page layouts.
It is called once from getElementFactory() if no factory has been explicitly
set using setElementFactory(ElementFactory).
By default, this method returns an instance of DefaultElementFactory.
Subclasses may create a custom implementation of the element factory.
setElementFactory(ElementFactory),
getElementFactory(),
ElementFactorypublic ElementFactory getElementFactory()
element factory for creating special nodes and
edges in a multi-page layout.
If no element factory is set explicitly (see method setElementFactory(ElementFactory)),
a new instance is created and set by method createElementFactory() during the first layout run.
setElementFactory(ElementFactory),
createElementFactory(),
ElementFactorypublic void setElementFactory(ElementFactory factory)
element factory for creating special nodes and
edges in a multi-page layout.
If no element factory is set explicitly (see method setElementFactory(ElementFactory)),
a new instance is created and set by method createElementFactory() during the first layout run.
DefaultElementFactory. If no element factory is set explicitly, the algorithm uses
an instance of DefaultElementFactory.factory - the element factory for creating special nodes and edgescreateElementFactory(),
ElementFactorypublic LayoutCallback getLayoutCallback()
callback that is notified upon completion of multi-page
layout calculation runs.
LayoutCallback instance that is notifiedsetLayoutCallback(LayoutCallback)public void setLayoutCallback(LayoutCallback callback)
callback that is notified upon completion of multi-page
layout calculation runs.
callback - the LayoutCallback instance that is notifiedLayoutCallbackpublic void setAdditionalParentCount(int additionalParentCount)
proxies
that the algorithm tries to place on a page.
If the input graph is a tree and the core layout
algorithm is an instance of GenericTreeLayouter or TreeLayouter,
the algorithm may place additional parent proxies of the subtree on a page. The number
of these additional parent proxies is limited by this value. Note that these additional nodes are
proxies and, thus, copies of already existing nodes. The reason why it may be
appropriate to add additional proxies is, that you can better identify additional parents of the tree structure.
Furthermore, if the additional count is larger than 0, the algorithm doesn't insert any
connector nodes but uses proxy nodes instead.
core layout
algorithm is an instance of GenericTreeLayouter or TreeLayouter.additionalParentCount - the (non-negative) maximum number of additional tree parent proxies
java.lang.IllegalArgumentException - if the given additional parent count is negativepublic int getAdditionalParentCount()
proxies
that the algorithm tries to place on a page.
If the input graph is a tree and the core layout
algorithm is an instance of GenericTreeLayouter or TreeLayouter,
the algorithm may place additional parent proxies of the subtree on a page. The number
of these additional parent proxies is limited by this value. Note that these additional nodes are
proxies and, thus, copies of already existing nodes. The reason why it may be
appropriate to add additional proxies is, that you can better identify additional parents of the tree structure.
Furthermore, if the additional count is larger than 0, the algorithm doesn't insert any
connector nodes but uses proxy nodes instead.
core layout
algorithm is an instance of GenericTreeLayouter or TreeLayouter.setAdditionalParentCount(int)public int getEdgeBundleModeMask()
NodeInfo.TYPE_CONNECTOR).
setEdgeBundleModeMask(int),
NodeInfo.TYPE_CONNECTORpublic void setEdgeBundleModeMask(int edgeBundleModeMask)
NodeInfo.TYPE_CONNECTOR).
edgeBundleModeMask - the bit mask for defining edge bundlesNodeInfo.TYPE_CONNECTORpublic byte getGroupMode()
MultiPageLayouter is able to handle groups (see setGroupMode(byte)),
it doesn't support edges incident to group nodes.setGroupMode(byte),
NodeInfo.TYPE_CONNECTOR,
NodeInfo.TYPE_PROXYpublic void setGroupMode(byte groupMode)
MultiPageLayouter is able to handle groups (see setGroupMode(byte)),
it doesn't support edges incident to group nodes.GROUP_MODE_ALL_NODES. Special nodes are also assigned to the associated groups.groupMode - the node grouping specifier
java.lang.IllegalArgumentException - if the specified group mode is unknownNodeInfo.TYPE_CONNECTOR,
NodeInfo.TYPE_PROXYpublic long getPreferredMaximalDuration()
setPreferredMaximalDuration(long)public void setPreferredMaximalDuration(long preferredMaximalDuration)
The specified value has to be non-negative.
Long.MAX_VALUE. The layout algorithm runs unrestricted.preferredMaximalDuration - the preferred time limit
java.lang.IllegalArgumentException - if the preferred time limit is negativepublic LayoutStage getLabelLayouter()
LayoutStage that places the labels of the input graph.
LayoutStage needs to be activated in order to take
effect.LayoutStage instancesetLabelLayouter(LayoutStage),
setLabelLayouterEnabled(boolean),
SALabeling,
GreedyMISLabelingpublic void setLabelLayouter(LayoutStage labeler)
LayoutStage that places the labels of the input graph.
LayoutStage needs to be activated in order to take
effect.SALabeling. An instance of SALabeling with
SALabeling.setMaximalDuration(long) set to 0.labeler - the LayoutStage instancesetLabelLayouterEnabled(boolean),
SALabeling,
GreedyMISLabelingpublic boolean isMultipleComponentsOnSinglePagePlacementEnabled()
true if different connected components may be placed on a single page, false
otherwisesetMultipleComponentsOnSinglePagePlacementEnabled(boolean)public void setMultipleComponentsOnSinglePagePlacementEnabled(boolean multipleComponentsOnSinglePagePlacementEnabled)
multipleComponentsOnSinglePagePlacementEnabled - true if different connected components may be placed on
a single page, false otherwisepublic void doLayout(LayoutGraph graph)
calcLayout(y.layout.LayoutGraph) and notifies
the registered layout callback of the
calculated result.
Layouter.doLayout(y.layout.LayoutGraph) method, the result
of the layout calculation will not be applied to the input graph.graph - the input graphLayouter.canLayout(LayoutGraph)public MultiPageLayout calcLayout(LayoutGraph graph)
doLayout(y.layout.LayoutGraph), this method ignores
the registered layout callback and directly returns the
calculated MultiPageLayout.
Layouter.doLayout(y.layout.LayoutGraph) method, the result
of the layout calculation will not be applied to the input graph.graph - the input graph
MultiPageLayout that represents the result of the layout run
java.lang.IllegalArgumentException - if for one of the keys NODE_ID_DPKEY, EDGE_ID_DPKEY,
NODE_LABEL_ID_DPKEY and EDGE_LABEL_ID_DPKEY no
DataProvider is registered with the given graphMultiPageLayout
protected boolean removeConnectorPair(Node connector1,
Node connector2,
YList originalEdgeIds,
LayoutContext context)
routeRestoredEdges(y.layout.LayoutGraph, y.base.DataProvider, y.geom.YRectangle).
Subclasses may implement a custom remove/restore strategy.
false the graph was not
changed, i.e., the connector pair still exists.connector1 - the first connector of the connector pairconnector2 - the second connector of the connector pairoriginalEdgeIds - the IDs of the original edges that have to be restoredcontext - the current layout context
true if the removal of the connector pair was successful, false otherwiserouteRestoredEdges(y.layout.LayoutGraph, y.base.DataProvider, y.geom.YRectangle)public boolean canLayout(LayoutGraph graph)
DataProviders are registered
(NODE_ID_DPKEY, EDGE_ID_DPKEY, NODE_LABEL_ID_DPKEY and EDGE_LABEL_ID_DPKEY).
If not, this method returns false. Otherwise,
it delegates this call to the Layouter.canLayout(y.layout.LayoutGraph) method
of the specified core layouter.
graph - the input graph
true if the partial layout algorithm can be applied to the specified graph, false
otherwiseLayouter.doLayout(LayoutGraph)public YDimension getMaxPageSize()
Both the specified width and height have to be positive.
setPreferredMaximalDuration(long).setMaxPageSize(YDimension),
setPreferredMaximalDuration(long)public void setMaxPageSize(YDimension maxPageSize)
Both the specified width and height have to be positive.
setPreferredMaximalDuration(long).1000.maxPageSize - the maximum size for a single page
java.lang.IllegalArgumentException - if the specified width or height is not positivesetPreferredMaximalDuration(long)![]() Size 250x250 The whole graph fits onto a single page. | ![]() Size 150x250
Circular nodes denote the so-called | ![]() Size 200x200
Circular nodes denote the so-called |
protected void doIncrementalLayout(LayoutGraph graph,
DataProvider incrementalNodesDP,
LayoutContext context)
Subclasses may implement a custom layout strategy for this step.
graph - the input graphincrementalNodesDP - a DataProvider that returns a boolean value indicating whether or not a node is
marked; the positions of the non-marked nodes are not allowed to changecontext - the current layout contextLayoutContext
protected void routeRestoredEdges(LayoutGraph graph,
DataProvider selectedEdgesDP,
YRectangle boundingRectangle)
removeConnectorPair(y.base.Node, y.base.Node, y.base.YList, LayoutContext)
to route the restored edges).
It has to guarantee that the routes are fully contained within the given bounding rectangle.
Subclasses may implement a custom routing strategy for the restored edges.
graph - the relevant graphselectedEdgesDP - a DataProvider that returns a boolean value indicating whether or not an edge
should be reroutedboundingRectangle - the edge routes should be fully contained within this rectangleremoveConnectorPair(y.base.Node, y.base.Node, y.base.YList, LayoutContext)
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||