public class ConstraintIncrementalLayerer extends Object implements ILayerer
ILayerer implementation that observes relative and absolute layering constraints defined by the
layer constraint factory.
Furthermore, it can handle the edge directedness as specified by IDataProvider key
HierarchicLayout.EDGE_DIRECTEDNESS_DPKEY.
For a given graph instance, the layer constraint factory can be created using method
HierarchicLayout.createLayerConstraintFactory(Graph). The ILayerer can be used for both common
layering and layering of incremental nodes.
Sample output of applying ConstraintIncrementalLayerer. The red colored node should reside in the topmost layer,
blue nodes in the medium layer while green nodes in the bottommost layer.
Sample output of applying ConstraintIncrementalLayerer on a graph with a
PartitionGrid. Same colors represent nodes that belong to the same partition grid cell and should be layered
with respect to the partition grid cell to which they belong.
ILayerer is always applied automatically if the graph instance has constraints created with the
layering constraint factory.ILayerConstraintFactory,
HierarchicLayout| Modifier and Type | Field and Description |
|---|---|
static EdgeDpKey<Integer> |
ADDITIONAL_EDGE_WEIGHT_DPKEY
A
DataProvider key for assigning additional edge weights
The ILayerer tries to maintain edges with higher weights short. |
| Constructor and Description |
|---|
ConstraintIncrementalLayerer(ILayerer coreLayerer)
Creates a new
ConstraintIncrementalLayerer with the given ILayerer instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
assignLayers(LayoutGraph graph,
ILayers layers,
ILayoutDataProvider ldp)
Assigns all nodes of the graph to layers and adds them to the
ILayers instance based on relative and absolute
layering constraints defined by the given layering constraints. |
protected void |
checkConstraints()
Checks if the current setting of constraints is consistent (i.e.
|
boolean |
isSameLayerEdgesAllowed()
Gets whether or not same-layer edges can be created by this
ILayerer instance. |
void |
setSameLayerEdgesAllowed(boolean value)
Sets whether or not same-layer edges can be created by this
ILayerer instance. |
public ConstraintIncrementalLayerer(ILayerer coreLayerer)
ConstraintIncrementalLayerer with the given ILayerer instance.coreLayerer - the given ILayerer instancepublic void assignLayers(LayoutGraph graph, ILayers layers, ILayoutDataProvider ldp)
ILayers instance based on relative and absolute
layering constraints defined by the given layering constraints.assignLayers in interface ILayererILayers structure will be filled by the ILayerer. If the ILayerer instance is used for
layering incremental nodes, the ILayers structure already has to contain all non-incremental nodes.graph - the input graphlayers - the ILayers instance that will be filled with the results of the calculationldp - the ILayoutDataProvider used for query information about the nodes and edgesILayers.insert(com.yworks.yfiles.layout.hierarchic.LayerType, int),
ILayer.add(com.yworks.yfiles.algorithms.Node)protected void checkConstraints()
the induced constraint graph has no cycles).
IllegalArgumentException - if the constraint graph is inconsistentpublic boolean isSameLayerEdgesAllowed()
ILayerer instance.
This only concerns edges between nodes that have no hard constraints that will force a same-layer edge (i.e. a same-layer constraint).
false. Same-layer edges cannot be created by this ILayerer instance.true if same-layer edges can be created, false otherwisesetSameLayerEdgesAllowed(boolean)public void setSameLayerEdgesAllowed(boolean value)
ILayerer instance.
This only concerns edges between nodes that have no hard constraints that will force a same-layer edge (i.e. a same-layer constraint).
false. Same-layer edges cannot be created by this ILayerer instance.value - true if same-layer edges can be created, false otherwiseisSameLayerEdgesAllowed()