|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.organic.SplitEdgeLayoutStage
public class SplitEdgeLayoutStage
This layout stage replaces edges by a path of split-edges with a specified length
before it calls a core layout algorithm
.
Each edge segment (or only segments that belong to a particular subset of edges) in the input graph will be split up
into several segments such that all segments have a maximum length defined by the specified split segment length
. If an edge segment is already shorter than the split segment length, then it will not be split up.
At each split location, a dummy node (the so-called split-node) will be inserted. Split-nodes inserted for the same original edge and the actual source and target node of the original edge will be connected by so called split-edges. In consequence, the original source and target node are not connected by a single edge but by a path consisting of split-edges. Furthermore, all edges are simple straight lines.
After this replacement step, the core layout algorithm
will be invoked.
When the core layout algorithm has finished, the split-nodes will be removed from the graph and the original edge will be restored. The coordinates of the bends will be the center-coordinates of the corresponding split-node.
The DataProvider
registered with key getSplitNodesDpKey()
can be used by the
core layout algorithm
to determine whether or not a certain node is a split-node
that was created by this stage. This information may be useful when providing a custom core
layout algorithm which should handle split-nodes in a different way than normal nodes. If no DataProvider
is registered with this key, this information is dropped.
By registering a DataProvider
with key getSplitEdgesDpKey()
, the subset of edges
that should be split by this layout stage can be specified. If no DataProvider
with this key is registered,
all edges of the input graph will be split by the layout stage.
The amount of split-nodes replacing a single original edge can be controlled via the
split segment length
. The smaller the value, the more split-nodes
this stage will insert.
core layout algorithm
and execute
this stage.Field Summary |
---|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
SplitEdgeLayoutStage()
Creates a new SplitEdgeLayoutStage with default settings. |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts general graphs without exception. |
void |
doLayout(LayoutGraph graph)
Replaces the edges of the given graph by a path of split-edges, executes the core layout algorithm and restores the original edges, introducing bends
at the locations of the split-nodes. |
Layouter |
getCoreLayouter()
Returns the core layout algorithm. |
double |
getProxyNodeSize()
Returns the size of the split-nodes that are inserted when splitting edges. |
java.lang.Object |
getSplitEdgesDpKey()
Returns the DataProvider key to determine which edges are to be split by this layout stage. |
java.lang.Object |
getSplitNodesDpKey()
Returns the DataProvider key for marking the nodes that were
created by splitting edges, i.e., the split-nodes. |
double |
getSplitSegmentLength()
Returns the maximum length for a split-edge. |
void |
setCoreLayouter(Layouter l)
Specifies the core layout algorithm. |
void |
setProxyNodeSize(double splitNodeSize)
Specifies the size of the split-nodes that are inserted when splitting edges. |
void |
setSplitEdgesDpKey(java.lang.Object key)
Specifies the DataProvider key to determine which edges are to be split by this layout stage. |
void |
setSplitNodesDpKey(java.lang.Object key)
Specifies the DataProvider key for marking the nodes that were
created by splitting edges, i.e., the split-nodes. |
void |
setSplitSegmentLength(double splitSegmentLength)
Specifies the maximum length for a split-edge. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SplitEdgeLayoutStage()
SplitEdgeLayoutStage
with default settings.
Method Detail |
---|
public java.lang.Object getSplitEdgesDpKey()
DataProvider
key to determine which edges are to be split by this layout stage.
If no DataProvider
is registered with this key, all edges will be split.
DataProvider
key for marking edges that should be splitsetSplitEdgesDpKey(Object)
public void setSplitEdgesDpKey(java.lang.Object key)
DataProvider
key to determine which edges are to be split by this layout stage.
If no DataProvider
is registered with this key, all edges will be split.
Layouter.SELECTED_EDGES
key
- the DataProvider
key for marking edges that should be split
java.lang.IllegalArgumentException
- if the specified key is null
getSplitEdgesDpKey()
public java.lang.Object getSplitNodesDpKey()
DataProvider
key for marking the nodes that were
created by splitting edges, i.e., the split-nodes.
The information provided by the DataProvider
registered with this key is useful for the
core layout algorithm
to know whether or not some node is a (dummy) split-node.
After doLayout(LayoutGraph)
finishes, the split-nodes will have been removed and this information
will not be available anymore.
DataProvider
registered with this key, information about marked nodes will
be ignored by the stage during the layout process. However, this information will be restored after the
layout has finished. However, it is recommended to specify a custom key - only used for this purpose - if the
core layout algorithm should be able to clearly distinguish the newly created split-nodes.DataProvider
key for marking newly created split-nodessetSplitNodesDpKey(Object)
public void setSplitNodesDpKey(java.lang.Object key)
DataProvider
key for marking the nodes that were
created by splitting edges, i.e., the split-nodes.
The information provided by the DataProvider
registered with this key is useful for the
core layout algorithm
to know whether or not some node is a (dummy) split-node.
After doLayout(LayoutGraph)
finishes, the split-nodes will have been removed and this information
will not be available anymore.
DataProvider
registered with this key, information about marked nodes will
be ignored by the stage during the layout process. However, this information will be restored after the
layout has finished. However, it is recommended to specify a custom key - only used for this purpose - if the
core layout algorithm should be able to clearly distinguish the newly created split-nodes.Layouter.SELECTED_NODES
key
- the DataProvider
key for marking newly created split-nodes
java.lang.IllegalArgumentException
- if the specified key is null
getSplitNodesDpKey()
public void setSplitSegmentLength(double splitSegmentLength)
The length of the original edge path divided by the given split segment length yields the number of nodes on the new path.
The split segment length must be a strictly positive value.
splitSegmentLength
- the split segment length
java.lang.IllegalArgumentException
- if the given split segment length is smaller than or equal to zeropublic double getSplitSegmentLength()
The length of the original edge path divided by the given split segment length yields the number of nodes on the new path.
The split segment length must be a strictly positive value.
setSplitSegmentLength(double)
public double getProxyNodeSize()
The given size will be used for defining the height and the width of the split-nodes.
core layout algorithm
.setProxyNodeSize(double)
public void setProxyNodeSize(double splitNodeSize)
The given size will be used for defining the height and the width of the split-nodes.
core layout algorithm
.splitNodeSize
- the size the inserted split nodes will have
java.lang.IllegalArgumentException
- if the given size is negativepublic boolean canLayout(LayoutGraph graph)
canLayout
in interface Layouter
graph
- the input graph
true
for all inputsLayouter.doLayout(LayoutGraph)
public void doLayout(LayoutGraph graph)
core layout algorithm
and restores the original edges, introducing bends
at the locations of the split-nodes.
doLayout
in interface Layouter
graph
- the input graphLayouter.canLayout(LayoutGraph)
public Layouter getCoreLayouter()
LayoutStage
Layouter.doLayout(LayoutGraph)
. The LayoutStage
may add pre- and post-processing steps before and after calling the core layout algorithm.
getCoreLayouter
in interface LayoutStage
public void setCoreLayouter(Layouter l)
LayoutStage
Layouter.doLayout(LayoutGraph)
. The LayoutStage
may add pre- and post-processing steps before and after calling the core layout algorithm.
setCoreLayouter
in interface LayoutStage
l
- the core layout algorithm
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |