|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.AbstractLayoutStage y.layout.multipage.MultiPageLayouter
public class MultiPageLayouter
Layout algorithm that subdivides the input graph into several
LayoutGraph
s (called page graphs) such that the layout of each graph
fits the specified maximum page
size
.
To guarantee that no information is lost, the layout algorithm replaces edges
between nodes on different pages by so-called connector nodes
(see NodeInfo.TYPE_CONNECTOR
).
Furthermore, it may replicate (proxy) nodes and insert elements called proxy
reference nodes to refers to such proxies (see NodeInfo.TYPE_PROXY
and NodeInfo.TYPE_PROXY_REFERENCE
).
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, MultiPageLayouter
implements the Layouter
interface although method
doLayout
does not specify a
return value. Therefore client code has to
register
a 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(y.layout.LayoutGraph)
or
calcLayout(y.layout.LayoutGraph)
.
Field Summary | |
---|---|
static byte |
EDGE_BUNDLE_DISTINGUISH_DIRECTIONS
Edge bundle mode specifier. |
static byte |
EDGE_BUNDLE_DISTINGUISH_MULTIEDGES
Edge bundle mode specifier. |
static byte |
EDGE_BUNDLE_DISTINGUISH_TYPES
Edge bundle mode specifier. |
static Object |
EDGE_ID_DPKEY
Used to map each edge of the input graph to a unique id. |
static Object |
EDGE_LABEL_ID_DPKEY
Used to map each edge label of the input graph to a unique id. |
static Object |
EDGE_TYPE_DPKEY
Allows to specify the edge kind (an object). |
static byte |
GROUP_MODE_ALL_NODES
Node grouping specifier. |
static byte |
GROUP_MODE_IGNORE
Node grouping specifier. |
static byte |
GROUP_MODE_ORIGINAL_NODES_ONLY
Node grouping specifier. |
static Object |
NODE_CLUSTER_ID_DPKEY
Allows to specify a cluster id (an object) for each node. |
static Object |
NODE_ID_DPKEY
Used to map each node of the input graph to a unique id. |
static Object |
NODE_LABEL_ID_DPKEY
Used to map each node label of the input graph to a unique id. |
Fields inherited from interface y.layout.Layouter |
---|
SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
MultiPageLayouter(Layouter core)
Creates an instance of this layouter. |
Method Summary | |
---|---|
MultiPageLayout |
calcLayout(LayoutGraph graph)
Calculates a new multi-page layout for the specified graph. |
boolean |
canLayout(LayoutGraph graph)
Returns true iff the given graph can be laid
out by this algorithm. |
protected ElementFactory |
createElementFactory()
Creates an element factory for multi-page layouts. |
protected void |
doIncrementalLayout(LayoutGraph graph,
DataProvider incrementalNodesDP,
LayoutContext context)
Called to improve layout results. |
void |
doLayout(LayoutGraph graph)
Calculates a new multi-page layout for the specified graph. |
int |
getEdgeBundleModeMask()
Returns the bit mask that is used to define edge bundles. |
ElementFactory |
getElementFactory()
Returns the element factory that is used to create special nodes and edges in a multi-page layout. |
byte |
getGroupMode()
Returns how to handle node grouping. |
LayoutStage |
getLabelLayouter()
Returns the algorithm that is used for placing labels. |
LayoutCallback |
getLayoutCallback()
Returns the callback that is notified upon completion of multi-page layout calculation runs. |
YDimension |
getMaxPageSize()
Returns the maximum size allowed for a single page. |
long |
getPreferredMaximalDuration()
Returns the preferred time limit (in milliseconds) set for the layout algorithm. |
boolean |
isLabelLayouterEnabled()
Returns whether or not the specified labeling stage is enabled. |
protected boolean |
removeConnectorPair(Node connector1,
Node connector2,
YList originalEdgeIds,
LayoutContext context)
Called during a postprocessing step that reduces the number of connectors. |
protected void |
routeRestoredEdges(LayoutGraph graph,
DataProvider selectedEdgesDP,
YRectangle boundingRectangle)
Called by method removeConnectorPair(y.base.Node, y.base.Node, y.base.YList, LayoutContext)
to route the restored edges. |
void |
setEdgeBundleModeMask(int edgeBundleModeMask)
Specifies a bit mask that is used to define edge bundles. |
void |
setElementFactory(ElementFactory factory)
Specifies the element factory that is used to create special nodes and edges in a multi-page layout. |
void |
setGroupMode(byte groupMode)
Specifies how to handle node grouping. |
void |
setLabelLayouter(LayoutStage labeler)
Sets the algorithm that is used for placing labels. |
void |
setLabelLayouterEnabled(boolean labelLayouterEnabled)
Specifies whether or not to enable the labeling stage. |
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 allowed for a single page. |
void |
setPreferredMaximalDuration(long preferredMaximalDuration)
Sets a preferred time limit (in milliseconds) for the layout algorithm. |
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 Object NODE_CLUSTER_ID_DPKEY
public static final Object NODE_ID_DPKEY
public static final Object EDGE_ID_DPKEY
public static final Object EDGE_LABEL_ID_DPKEY
public static final Object NODE_LABEL_ID_DPKEY
public static final Object EDGE_TYPE_DPKEY
getEdgeBundleModeMask()
& EDGE_BUNDLE_DISTINGUISH_TYPES
== 1.
EDGE_BUNDLE_DISTINGUISH_TYPES
,
setEdgeBundleModeMask(int)
public static final byte GROUP_MODE_IGNORE
setGroupMode(byte)
,
getGroupMode()
,
Constant Field Valuespublic static final byte GROUP_MODE_ORIGINAL_NODES_ONLY
setGroupMode(byte)
,
getGroupMode()
,
Constant Field Valuespublic static final byte GROUP_MODE_ALL_NODES
setGroupMode(byte)
,
getGroupMode()
,
Constant Field Valuespublic static final byte EDGE_BUNDLE_DISTINGUISH_MULTIEDGES
NodeInfo.TYPE_CONNECTOR
).
This value specifies that all multi-edges should be distinguished, i.e., a separate connector pair is used for each
multi-edge.
setEdgeBundleModeMask(int)
,
getEdgeBundleModeMask()
,
Constant Field Valuespublic static final byte EDGE_BUNDLE_DISTINGUISH_DIRECTIONS
NodeInfo.TYPE_CONNECTOR
).
This value specifies that multi-edges should be distinguished if the have different directions.
setEdgeBundleModeMask(int)
,
getEdgeBundleModeMask()
,
Constant Field Valuespublic static final byte EDGE_BUNDLE_DISTINGUISH_TYPES
NodeInfo.TYPE_CONNECTOR
).
This value specifies that multi-edges should be distinguished if they are of different (user specified) type, see
EDGE_TYPE_DPKEY
.
setEdgeBundleModeMask(int)
,
getEdgeBundleModeMask()
,
Constant Field ValuesConstructor Detail |
---|
public MultiPageLayouter(Layouter core)
core
- the layouter used to layout a page.Method Detail |
---|
public boolean isLabelLayouterEnabled()
setLabelLayouter(y.layout.LayoutStage)
,
setLabelLayouterEnabled(boolean)
public void setLabelLayouterEnabled(boolean labelLayouterEnabled)
setLabelLayouter(y.layout.LayoutStage)
protected ElementFactory createElementFactory()
getElementFactory()
if no factory has been explicitly
set using setElementFactory(ElementFactory)
.
DefaultElementFactory
instance.public ElementFactory getElementFactory()
setElementFactory(ElementFactory)
,
createElementFactory()
,
ElementFactory
public void setElementFactory(ElementFactory factory)
factory
- the factory instance to use.getElementFactory()
,
createElementFactory()
,
ElementFactory
public LayoutCallback getLayoutCallback()
public void setLayoutCallback(LayoutCallback callback)
callback
- the LayoutCallback
instance that is notified.
May be null
.public int getEdgeBundleModeMask()
setEdgeBundleModeMask(int)
public void setEdgeBundleModeMask(int edgeBundleModeMask)
NodeInfo.TYPE_CONNECTOR
).
Possible values are EDGE_BUNDLE_DISTINGUISH_TYPES
, EDGE_BUNDLE_DISTINGUISH_DIRECTIONS
and
EDGE_BUNDLE_DISTINGUISH_MULTIEDGES
.
edgeBundleModeMask
- the bit mask that defines edge bundles.getEdgeBundleModeMask()
public byte getGroupMode()
setGroupMode(byte)
public void setGroupMode(byte groupMode)
GROUP_MODE_IGNORE
, GROUP_MODE_ALL_NODES
and
GROUP_MODE_ORIGINAL_NODES_ONLY
.
groupMode
- the node grouping specifier.getGroupMode()
public long getPreferredMaximalDuration()
setPreferredMaximalDuration(long)
public void setPreferredMaximalDuration(long preferredMaximalDuration)
preferredMaximalDuration
- the preferred time limit.getPreferredMaximalDuration()
public LayoutStage getLabelLayouter()
GreedyMISLabeling
will be returned that considers edge labels only.
public void setLabelLayouter(LayoutStage labeler)
setLabelLayouterEnabled(boolean)
.
public void doLayout(LayoutGraph graph)
calcLayout(y.layout.LayoutGraph)
and notifies
the registered layout callback
of the
calculated result.
Warning:
Unlike other implementations of the
Layouter.doLayout(y.layout.LayoutGraph)
method, the result
of the layout calculation will not be applied to the input graph.
graph
- the input graph.public MultiPageLayout calcLayout(LayoutGraph graph)
graph
- the input graph.
MultiPageLayout
protected boolean removeConnectorPair(Node connector1, Node connector2, YList originalEdgeIds, LayoutContext context)
routeRestoredEdges(y.layout.LayoutGraph, y.base.DataProvider, y.geom.YRectangle)
to route these edges.
connector1
- the first connector of the connector pair.connector2
- the second connector of the connector pair.originalEdgeIds
- the ids of the original edges that have to be restored.context
- the current layout context.
routeRestoredEdges(y.layout.LayoutGraph, y.base.DataProvider, y.geom.YRectangle)
public boolean canLayout(LayoutGraph graph)
Layouter
true
iff the given graph can be laid
out by this algorithm. Calling doLayout
with
the given graph as its argument will only success if
this method returns true
.
public YDimension getMaxPageSize()
public void setMaxPageSize(YDimension maxPageSize)
setPreferredMaximalDuration(long)
.
maxPageSize
- the maximum size for a single page.setPreferredMaximalDuration(long)
protected void doIncrementalLayout(LayoutGraph graph, DataProvider incrementalNodesDP, LayoutContext context)
graph
- the graph to layout.incrementalNodesDP
- 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
- the current layout context.LayoutContext
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.
graph
- the relevant graph.selectedEdgesDP
- marks the edges that should be rerouted.boundingRectangle
- the edge routes should be fully contained within this rectangle.removeConnectorPair(y.base.Node, y.base.Node, y.base.YList, LayoutContext)
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |