|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.hierarchic.ConstraintLayerer
public class ConstraintLayerer
Layerer implementation that uses relative and absolute layering constraints.
This layerer can use two sets of constraints:
ConstraintLayerer.ConstraintFactory
instance, which should be created
with createConstraintFactory(y.base.Graph)
for a given graph instance.
Nested Class Summary | |
---|---|
static interface |
ConstraintLayerer.ConstraintFactory
Interface specification for classes that can create suitable constraints for a ConstraintLayerer instance. |
Field Summary | |
---|---|
static String |
EDGE_WEIGHTS_DPKEY
DataProvider key for additional edge weights of type int . |
Constructor Summary | |
---|---|
ConstraintLayerer()
|
|
ConstraintLayerer(Layerer coreLayerer)
|
Method Summary | |
---|---|
void |
assignLayers(LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp)
This method assigns all nodes in the graph to layers and registers them in the Layers instance. |
int |
assignNodeLayer(LayoutGraph g,
NodeMap layer,
EdgeList reversedEdges)
This method assigns the nodes in the graph to layers. |
protected void |
checkConstraints()
Checks if the current set of strong constraints is consistent (i.e. has no cycles) |
static ConstraintLayerer.ConstraintFactory |
createConstraintFactory(Graph g)
Create an instance of ConstraintLayerer.ConstraintFactory that is suitable for this
layerer implementation. |
Layerer |
getCoreLayerer()
Gets the core layerer for this layerer instance. |
boolean |
isAllowSameLayerEdges()
Returns whether same layer edges can be created by this layerer instance. |
void |
setAllowSameLayerEdges(boolean allowSameLayerEdges)
Set whether same layer edges can be created by this layerer instance. |
void |
setCoreLayerer(Layerer coreLayerer)
Sets the core layerer for this layerer instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String EDGE_WEIGHTS_DPKEY
int
.
The Layerer tries to keep edges with higher weights short.
Constructor Detail |
---|
public ConstraintLayerer(Layerer coreLayerer)
public ConstraintLayerer()
Method Detail |
---|
public Layerer getCoreLayerer()
TopologicalLayerer
is used.
public void setCoreLayerer(Layerer coreLayerer)
TopologicalLayerer
is used.
coreLayerer
- the layerer that is used for unconstrained nodespublic boolean isAllowSameLayerEdges()
Default value is false
.
public void setAllowSameLayerEdges(boolean allowSameLayerEdges)
Default value is false
.
allowSameLayerEdges
- true iff unconstrained same layer edges are allowed.public int assignNodeLayer(LayoutGraph g, NodeMap layer, EdgeList reversedEdges)
IllegalArgumentException
- if any strong constraints are inconsistentg
- the graph for which the layers are determined.layer
- here the layers are storedreversedEdges
- here the edges are stored which had been reversed.
protected void checkConstraints()
IllegalArgumentException
- if the constraint network is inconsistentpublic void assignLayers(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
Layerer
Layers
instance. In order to create new layers, the factory
method Layers.insert(byte, int)
must be used.
assignLayers
in interface Layerer
graph
- the graph that contains the nodes that should be distributed
into the layerslayers
- the object that will be filled with the results of the
calculationldp
- LayoutDataProvider that can be used to query information about
the nodes - note that positional information
(see NodeData.getPosition()
and NodeData.getLayer()
) cannot
be available at any time.Layers.insert(byte, int)
,
Layer.add(y.base.Node)
public static ConstraintLayerer.ConstraintFactory createConstraintFactory(Graph g)
ConstraintLayerer.ConstraintFactory
that is suitable for this
layerer implementation.
The ConstraintFactory instance is usually bound to the graph instance g
, i.e. if the input graph for the
layerer changes, a new ConstraintFactory instance must be retrieved. This instance can be used to create
constraints for this graph instance.
You can create a ConstraintFactory without binding it to a graph instance initially by passing a null
parameter. In that case, you must bind the returned instance to the graph instance before calculating a layering:
ConstraintFactory cf = ConstraintLayerer.createConstraintFactory(null); ... Graph g = ...; g.addDataProvider(ConstraintFactory.LAYER_CONSTRAINTS_MEMENTO_DPKEY, DataProviders.createConstantDataProvider(cf.getMemento()));); //Calculate layoutIf you manually registered a DataProvider under
Layouter.NODE_ID_DPKEY
on the graph, you must use the corresponding node ids stored in this DataProvider as arguments for
all methods that create a constraint. Otherwise, you can just use the node instances themselves.
g
- the current graph for the layerer
ConstraintLayerer.ConstraintFactory.getMemento()
,
ConstraintLayerer.ConstraintFactory.LAYER_CONSTRAINTS_MEMENTO_DPKEY
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |