public class DefaultLayeredComponentsMerger extends Object implements ILayeredComponentsMerger
ILayeredComponentsMerger
that provides simple default behaviors.
Instances of this class are used internally by HierarchicLayoutCore
and MultiComponentLayerer
when e.g.
the graph is grouped or it consists of more than one connected component.
Constructor and Description |
---|
DefaultLayeredComponentsMerger()
Creates a new instance of
DefaultLayeredComponentsMerger with default settings. |
DefaultLayeredComponentsMerger(MergingPolicy policy)
Creates a new instance of
DefaultLayeredComponentsMerger using the given merging policy. |
Modifier and Type | Method and Description |
---|---|
MergingPolicy |
getPolicy()
Gets the merging policy constant as defined in
DefaultLayeredComponentsMerger . |
void |
merge(LayoutGraph graph,
ILayoutDataProvider ldp,
ILayers srcLayers,
ILayers targetLayers)
Merges two
ILayers instances. |
void |
setPolicy(MergingPolicy value)
Sets the merging policy constant as defined in
DefaultLayeredComponentsMerger . |
public DefaultLayeredComponentsMerger()
DefaultLayeredComponentsMerger
with default settings.public DefaultLayeredComponentsMerger(MergingPolicy policy)
DefaultLayeredComponentsMerger
using the given merging policy.IllegalArgumentException
- if an unknown policy is givenpolicy
- one of the predefined merging constantspublic MergingPolicy getPolicy()
DefaultLayeredComponentsMerger
.IllegalArgumentException
- if an unknown policy is givenMergingPolicy.ADD_RIGHT_TOP_ALIGNED
. Nodes of the source layering
are to the right of the target
layering
and all nodes are top-aligned.setPolicy(MergingPolicy)
public void merge(LayoutGraph graph, ILayoutDataProvider ldp, ILayers srcLayers, ILayers targetLayers)
ILayeredComponentsMerger
ILayers
instances.
All nodes that belong to the source and target ILayers
are part of the graph at the moment of invocation.
The state of the source ILayers
instance is discarded after this call and does not need to be updated to reflect
the changes. The target ILayers
instance must be updated accordingly.
merge
in interface ILayeredComponentsMerger
graph
- the graph containing the nodes of source and target ILayers
instancesldp
- the ILayoutDataProvider
used for querying the layer indicessrcLayers
- the source ILayers
instance that will be merged into the target ILayers
instancetargetLayers
- the ILayers
instance that will be modified to contain the resulting layeringpublic void setPolicy(MergingPolicy value)
DefaultLayeredComponentsMerger
.IllegalArgumentException
- if an unknown policy is givenMergingPolicy.ADD_RIGHT_TOP_ALIGNED
. Nodes of the source layering
are to the right of the target
layering
and all nodes are top-aligned.value
- one of the predefined merging policy constantsgetPolicy()