Search this API

y.layout.hierarchic.incremental
Class ConstraintIncrementalLayerer

java.lang.Object
  extended by y.layout.hierarchic.incremental.ConstraintIncrementalLayerer
All Implemented Interfaces:
Layerer

public class ConstraintIncrementalLayerer
extends java.lang.Object
implements Layerer

This class is a Layerer implementation that observes relative and absolute layering constraints defined by the layer constraint factory. Furthermore, it can handle the edge directedness as specified by DataProvider key IncrementalHierarchicLayouter.EDGE_DIRECTEDNESS_DPKEY.

For a given graph instance, the layer constraint factory can be created using method IncrementalHierarchicLayouter.createLayerConstraintFactory(y.base.Graph). The Layerer 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.

 
This Layerer is always applied automatically if the graph instance has constraints created with the layering constraint factory.
See Also:
LayerConstraintFactory, IncrementalHierarchicLayouter
 

Field Summary
static java.lang.String EDGE_WEIGHTS_DPKEY
          A DataProvider key for assigning additional edge weights The Layerer tries to maintain edges with higher weights short.
 
Constructor Summary
ConstraintIncrementalLayerer(Layerer coreLayerer)
          Creates a new ConstraintIncrementalLayerer with the given Layerer instance.
 
Method Summary
 void assignLayers(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
          Assigns all nodes of the graph to layers and adds them to the Layers 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, that is, the induced constraint graph has no cycles.
 boolean isAllowSameLayerEdges()
          Returns whether or not same-layer edges can be created by this Layerer instance.
 void setAllowSameLayerEdges(boolean allowSameLayerEdges)
          Specifies whether or not same-layer edges can be created by this Layerer instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDGE_WEIGHTS_DPKEY

public static final java.lang.String EDGE_WEIGHTS_DPKEY
A DataProvider key for assigning additional edge weights

The Layerer tries to maintain edges with higher weights short.

See Also:
Constant Field Values
Constructor Detail

ConstraintIncrementalLayerer

public ConstraintIncrementalLayerer(Layerer coreLayerer)
Creates a new ConstraintIncrementalLayerer with the given Layerer instance.

Parameters:
coreLayerer - the given Layerer instance
Method Detail

isAllowSameLayerEdges

public boolean isAllowSameLayerEdges()
Returns whether or not same-layer edges can be created by this Layerer 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).

Returns:
true if same-layer edges can be created, false otherwise

setAllowSameLayerEdges

public void setAllowSameLayerEdges(boolean allowSameLayerEdges)
Specifies whether or not same-layer edges can be created by this Layerer 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).

Default Value:
The default value is false. Same-layer edges cannot be created by this Layerer instance.
Parameters:
allowSameLayerEdges - true if same-layer edges can be created, false otherwise

assignLayers

public void assignLayers(LayoutGraph graph,
                         Layers layers,
                         LayoutDataProvider ldp)
Assigns all nodes of the graph to layers and adds them to the Layers instance based on relative and absolute layering constraints defined by the given layering constraints.

Specified by:
assignLayers in interface Layerer
 
A Layers structure will be filled by the Layerer. If the Layerer instance is used for layering incremental nodes, the Layers structure already has to contain all non-incremental nodes.
Parameters:
graph - the input graph
layers - the Layers instance that will be filled with the results of the calculation
ldp - the LayoutDataProvider used for query information about the nodes and edges
See Also:
Layers.insert(byte, int), Layer.add(y.base.Node)

checkConstraints

protected void checkConstraints()
Checks if the current setting of constraints is consistent, that is, the induced constraint graph has no cycles.

Throws:
java.lang.IllegalArgumentException - if the constraint graph is inconsistent

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.