|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.CanonicMultiStageLayouter y.layout.hierarchic.IncrementalHierarchicLayouter
public class IncrementalHierarchicLayouter
This class is a variant of the classic HierarchicLayouter
implementation. It serves as a facade to HierarchicLayouter
.
Instances can be used to simply create hierarchic layouts from scratch or add
new elements to the existing sketch drawing incrementally.
In order to add elements incrementally to the current sketch or let the algorithm
optimize certain elements in the current sketch, set its mode to
LAYOUT_MODE_INCREMENTAL
and
add a DataProvider
(e.g. use Maps.createHashedDataMap()
) using the
INCREMENTAL_HINTS_DPKEY
DataProvider key to the graph and associate the marks
obtained from the IncrementalHintsFactory
with the elements to be
added incrementally.
Many settings of the layout can be controlled using the EdgeLayoutDescriptor
and NodeLayoutDescriptor
instances. The ones that are used during the
layout run can be obtained from getEdgeLayoutDescriptor()
and
getNodeLayoutDescriptor()
respectively.
If at the time of the invocation DataProvider instances are bound to the graph
using either the HierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
or
HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY
keys, they will be wrapped
and whenever they do not provide values the ones set in this instance will be used as fall-back values.
Here is a sample layout output:
The following example shows the result of an incremental layout with lots of port constraints (For clarity colored layers have been added to the diagram):
The last example shows the result of a layout run that considered swim lanes. Nodes with the same label have been placed into the same swim lane. Swim lanes have been ordered in ascending order of the label names. (For clarity lines have been added to the diagram that depict the bounds of the swim lanes):
setLayoutMode(byte)
,
INCREMENTAL_HINTS_DPKEY
,
createIncrementalHintsFactory()
,
HierarchicLayouter
Field Summary | |
---|---|
static byte |
COMPONENT_ARRANGEMENT_COMPACT
Component arrangement constant that can be used in setComponentArrangementPolicy(byte) }. |
static byte |
COMPONENT_ARRANGEMENT_TOPMOST
Component arrangement constant that can be used in setComponentArrangementPolicy(byte) }. |
static Object |
CRITICAL_EDGE_DPKEY
DataProvider key used to store the priority (integer values) for "critical" edges. |
static Object |
INCREMENTAL_HINTS_DPKEY
DataProvider key used to store incremental layout hints
that can be retrieved from the IncrementalHintsFactory
which itself can be obtained from the
createIncrementalHintsFactory() method. |
static Object |
LAYER_VALUE_HOLDER_DPKEY
Used for publishing the final layering information. |
static byte |
LAYERING_STRATEGY_BFS
Layering strategy specifier. |
static byte |
LAYERING_STRATEGY_FROM_SKETCH
Layering strategy specifier. |
static byte |
LAYERING_STRATEGY_HIERARCHICAL_DOWNSHIFT
Layering strategy specifier. |
static byte |
LAYERING_STRATEGY_HIERARCHICAL_OPTIMAL
Layering strategy specifier. |
static byte |
LAYERING_STRATEGY_HIERARCHICAL_TIGHT_TREE
Layering strategy specifier. |
static byte |
LAYERING_STRATEGY_HIERARCHICAL_TOPMOST
Layering strategy constant. |
static byte |
LAYERING_STRATEGY_UNKNOWN
Dummy layering strategy specifier. |
static byte |
LAYERING_STRATEGY_USER_DEFINED
Layering strategy specifier. |
static byte |
LAYOUT_MODE_FROM_SCRATCH
Layout mode constant that can be used in setLayoutMode(byte) . |
static byte |
LAYOUT_MODE_INCREMENTAL
Layout mode constant that can be used in setLayoutMode(byte) . |
static byte |
POLICY_ALIGN_GROUPS_BOTTOM
Group layering alignment strategy specifier. |
static byte |
POLICY_ALIGN_GROUPS_CENTER
Group layering alignment strategy specifier. |
static byte |
POLICY_ALIGN_GROUPS_TOP
Group layering alignment strategy specifier. |
static Object |
SEQUENCE_VALUE_HOLDER_DPKEY
Used for publishing the final sequencing information. |
static Object |
SWIMLANE_DESCRIPTOR_DPKEY
DataProvider key used to store SwimLaneDescriptor
instances for each node in the graph. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
IncrementalHierarchicLayouter()
Creates a new IncrementalHierarchicLayouter instance which is set to LAYOUT_MODE_FROM_SCRATCH initially |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Determines whether this layouter can perform the core layout on the given graph. |
protected void |
configureCoreLayout(LayoutGraph graph,
HierarchicLayouter ihl)
Called before the actual layout is performed. |
protected EdgeLayoutDescriptor |
createEdgeLayoutDescriptor()
Factory method that creates the default EdgeLayoutDescriptor. |
protected HierarchicLayouter |
createHierarchicLayouter()
Factory method that creates the internally used HierarchicLayouter
instance. |
IncrementalHintsFactory |
createIncrementalHintsFactory()
Returns a IncrementalHintsFactory instance that must be used
to obtain marks that can be associated with elements in the graph that
will be laid out incrementally. |
LayerConstraintFactory |
createLayerConstraintFactory(Graph graph)
Returns a LayerConstraintFactory
instance that can be used to specify layer constraints for the given
graph. |
protected NodeLayoutDescriptor |
createNodeLayoutDescriptor()
Factory method that creates the default NodeLayoutDescriptor. |
SequenceConstraintFactory |
createSequenceConstraintFactory(LayoutGraph graph)
Returns a SequenceConstraintFactory
instance that can be used to specify sequence constraints for the given
graph. |
void |
doLayoutCore(LayoutGraph g)
Performs the actual layout using the currently set mode. |
byte |
getComponentArrangementPolicy()
Returns the policy that is used to arrange connected components. |
protected DefaultDrawingDistanceCalculator |
getDefaultDrawingDistanceCalculator()
Returns the DefaultDrawingDistanceCalculator that is registered
with the layout algorithm by default. |
EdgeLayoutDescriptor |
getEdgeLayoutDescriptor()
Returns the EdgeLayoutDescriptor instance used for all those
edges, that do not have a specific layout descriptor assigned. |
double |
getEdgeToEdgeDistance()
Returns the minimum distance between two adjacent edges in one layer. |
Layerer |
getFixedElementsLayerer()
Returns the Layerer instance that is used to obtain the layering
for those nodes that are not marked to be laid out incrementally
if the layouter is set to LAYOUT_MODE_INCREMENTAL . |
Sequencer |
getFixedElementsSequencer()
Returns the Sequencer instance that is used to calculated the sequence
of the nodes that are not marked to be laid out incrementally
if the layouter is set to LAYOUT_MODE_INCREMENTAL . |
Layerer |
getFromScratchLayerer()
Returns the Layerer instance that is used to obtain the layering
for the nodes if the layouter is set to LAYOUT_MODE_FROM_SCRATCH . |
byte |
getFromScratchLayeringStrategy()
Returns the currently set layering strategy for the from scratch layering. |
Sequencer |
getFromScratchSequencer()
Returns the Sequencer instance that is used to calculate the node
sequence if the layouter is set to LAYOUT_MODE_FROM_SCRATCH . |
byte |
getGroupAlignmentPolicy()
Get the group layer alignment strategy used for recursive group layering. |
HierarchicLayouter |
getHierarchicLayouter()
Returns the internally used HierarchicLayouter instance. |
byte |
getLayoutMode()
Returns the layout mode this layouter is currently in. |
long |
getMaximalDuration()
Returns the time limit (in milliseconds) set for the layout algorithm. |
double |
getMinimumLayerDistance()
Returns the minimum distance between two adjacent layers. |
protected int |
getMirrorMask()
Returns the orientation layouter 's mirror mask. |
NodeLayoutDescriptor |
getNodeLayoutDescriptor()
Returns the NodeLayoutDescriptor instance used for all those
nodes, that do not have a specific layout descriptor assigned. |
NodePlacer |
getNodePlacer()
Returns the NodePlacer instance that will be used to calculated the
final node placement of the layout. |
double |
getNodeToEdgeDistance()
Returns the minimum distance between two adjacent nodes in one layer. |
double |
getNodeToNodeDistance()
Returns the minimum distance between two adjacent nodes in one layer. |
boolean |
isAutomaticEdgeGroupingEnabled()
Whether or not automatic edge grouping should be applied. |
boolean |
isBackloopRoutingEnabled()
Whether or not backloop routing should be applied. |
boolean |
isConsiderNodeLabelsEnabled()
Returns whether or not node labels are taken into account when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps). |
boolean |
isGroupCompactionEnabled()
Return whether layer compaction for recursive group layering is active. |
boolean |
isIntegratedEdgeLabelingEnabled()
Returns whether integrated edge labeling is enabled. |
boolean |
isOrthogonallyRouted()
Returns whether or not edges should be routed orthogonally. |
boolean |
isRecursiveGroupLayeringEnabled()
Return whether groups are respected during the layering stage. |
void |
setAutomaticEdgeGroupingEnabled(boolean automaticEdgeGroupingEnabled)
If this option is set, edges are grouped automatically. |
void |
setBackloopRoutingEnabled(boolean backloopRoutingEnabled)
If this option is set, reversed edges are routed in a backloop style, i.e., such that they attach to the same vertex sides as the other edges. |
void |
setComponentArrangementPolicy(byte policy)
Sets the policy used for arranging connected components. |
void |
setConsiderNodeLabelsEnabled(boolean enabled)
Specifies whether or not to consider node labels when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps). |
void |
setEdgeLayoutDescriptor(EdgeLayoutDescriptor edgeLayoutDescriptor)
Sets the EdgeLayoutDescriptor instance used for all those
edges, that do not have a specific layout descriptor assigned. |
void |
setEdgeToEdgeDistance(double d)
Sets the minimum distance between two adjacent edges in one layer. |
void |
setFixedElementsLayerer(Layerer fixedElementsLayerer)
Sets the Layerer instance that is used to obtain the layering
for those nodes that are not marked to be laid out incrementally
if the layouter is set to LAYOUT_MODE_INCREMENTAL . |
void |
setFixedElementsSequencer(Sequencer fixedElementsSequencer)
Sets the Sequencer instance that is used to calculated the sequence
of the nodes that are not marked to be laid out incrementally
if the layouter is set to LAYOUT_MODE_INCREMENTAL . |
void |
setFromScratchLayerer(Layerer layerer)
Sets the Layerer instance that is used to obtain the layering
for the nodes if the layouter is set to LAYOUT_MODE_FROM_SCRATCH . |
void |
setFromScratchLayeringStrategy(byte strategy)
Convenience method that sets a predefined layering strategy for the from scratch layerer. |
void |
setFromScratchSequencer(Sequencer sequencer)
Sets the Sequencer instance that is used to calculate the node
sequence if the layouter is set to LAYOUT_MODE_FROM_SCRATCH . |
void |
setGroupAlignmentPolicy(byte groupAlignmentPolicy)
Set the group layer alignment strategy used for recursive group layering. |
void |
setGroupCompactionEnabled(boolean groupCompactionEnabled)
Set whether layer compaction for recursive group layering should be used. |
void |
setIntegratedEdgeLabelingEnabled(boolean enabled)
Specifies whether or not to use integrated edge labeling. |
void |
setLayoutMode(byte layoutMode)
Sets the layout mode this layouter should use for upcoming layouts. |
void |
setMaximalDuration(long maximalDuration)
Sets a preferred time limit (in milliseconds) for the layout algorithm. |
void |
setMinimumLayerDistance(double d)
Sets the minimum distance between two adjacent layers. |
void |
setNodeLayoutDescriptor(NodeLayoutDescriptor nodeLayoutDescriptor)
Sets the NodeLayoutDescriptor instance used for all those
nodes, that do not have a specific layout descriptor assigned. |
void |
setNodePlacer(NodePlacer nodePlacer)
Sets the NodePlacer instance that will be used to calculated the
final node placement of the layout. |
void |
setNodeToEdgeDistance(double d)
Sets the minimum distance between an edge and an adjacent node in one layer. |
void |
setNodeToNodeDistance(double d)
Sets the minimum distance between two adjacent nodes in one layer. |
void |
setOrthogonallyRouted(boolean orthogonal)
Determines whether or not edges should be routed orthogonally. |
void |
setRecursiveGroupLayeringEnabled(boolean recursiveGroupLayeringEnabled)
Specifies whether groups are respected during the layering stage. |
protected void |
unconfigureCoreLayout(LayoutGraph graph,
HierarchicLayouter ihl)
Called after the actual layout is performed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object CRITICAL_EDGE_DPKEY
DataProvider
key used to store the priority (integer values) for "critical" edges.
The layouter tries to vertically align each node pair that is connected by a critical edge (integer value > 0).
This feature can for example be utilized to highlight different edge paths that are relevant for a user. Conflicts
between different critical edges are always resolved in favor of the higher priority.
Note: "critical" edges do no affect the result of the crossing minimization
(Sequencer
) phase. Hence, there may be crossings between two "critical" edges.
public static final Object INCREMENTAL_HINTS_DPKEY
DataProvider
key used to store incremental layout hints
that can be retrieved from the IncrementalHintsFactory
which itself can be obtained from the
createIncrementalHintsFactory()
method.
HierarchicLayouter.INCREMENTAL_HINTS_DPKEY
public static final Object LAYER_VALUE_HOLDER_DPKEY
DataProvider
associated to this key is also a
DataAcceptor
, the integer layer id of each node is stored
using the acceptor's setInt
method.
Otherwise, the provider's values should be of type
IntValueHolder
and the value holder's
setValue
method is used to store the integer layer ids of each node.
HierarchicLayouter.LAYER_VALUE_HOLDER_DPKEY
public static final Object SEQUENCE_VALUE_HOLDER_DPKEY
DataProvider
associated to this key is also a
DataAcceptor
, the sequence order number of each node is
stored using the acceptor's
setInt
method.
Otherwise, the provider's values should be of type
IntValueHolder
and the value holder's
setValue
method is used to store the sequence order number of each node.
HierarchicLayouter.SEQUENCE_VALUE_HOLDER_DPKEY
public static final Object SWIMLANE_DESCRIPTOR_DPKEY
DataProvider
key used to store SwimLaneDescriptor
instances for each node in the graph. If this key is present during the layout.
The layout algorithm will arrange nodes in swim lanes. The information about the
swim lanes is finally written back into the descriptor instances.
Instances can be shared among multiple nodes in the same lane, but don't have to be shared.
HierarchicLayouter.SWIMLANE_DESCRIPTOR_DPKEY
public static final byte COMPONENT_ARRANGEMENT_COMPACT
setComponentArrangementPolicy(byte)
}.
If the graph consists of multiple components this constant specifies that, after layering the single components with
the core layerer, the components will all be merged such that an 1:1 aspect ratio is fulfilled best.
setComponentArrangementPolicy(byte)
,
getComponentArrangementPolicy()
,
Constant Field Valuespublic static final byte COMPONENT_ARRANGEMENT_TOPMOST
setComponentArrangementPolicy(byte)
}.
If the graph consists of multiple components this constant specifies that, after layering the single components with
the core layerer, the components are aligned with their topmost layer.
setComponentArrangementPolicy(byte)
,
getComponentArrangementPolicy()
,
Constant Field Valuespublic static final byte LAYOUT_MODE_INCREMENTAL
setLayoutMode(byte)
.
This constant sets the layout algorithm to incremental mode, i.e.
fixed elements will be handled by the fixedElementsSequencer
and fixedElementsLayerer
and elements marked for incremental
layout will be added to the drawing later.
IncrementalHintsFactory.createLayerIncrementallyHint(Object)
,
setLayoutMode(byte)
,
getLayoutMode()
,
setFixedElementsSequencer(Sequencer)
,
setFixedElementsLayerer(Layerer)
,
Constant Field Valuespublic static final byte LAYOUT_MODE_FROM_SCRATCH
setLayoutMode(byte)
.
This constant sets the layout algorithm to "from scratch mode", i.e.
the algorithm will recompute the layout from scratch.
setLayoutMode(byte)
,
getLayoutMode()
,
setFromScratchSequencer(Sequencer)
,
setFromScratchLayerer(Layerer)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_HIERARCHICAL_TOPMOST
setFromScratchLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_HIERARCHICAL_OPTIMAL
setFromScratchLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_HIERARCHICAL_TIGHT_TREE
LAYERING_STRATEGY_HIERARCHICAL_OPTIMAL
.
setFromScratchLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_HIERARCHICAL_DOWNSHIFT
LAYERING_STRATEGY_HIERARCHICAL_TOPMOST
by down shifting
some nodes in the layering. The quality is usually worse than the
one produced by Tight Tree Heuristic.
setFromScratchLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_BFS
BFSLayerer.CORE_NODES
.
If this data provider is not given, then nodes that have no incoming edges are placed
in the first layer.
setFromScratchLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_FROM_SKETCH
setFromScratchLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_USER_DEFINED
GivenLayersLayerer.LAYER_ID_KEY
. Like
LAYERING_STRATEGY_FROM_SKETCH
this layering allows inner layer edges.
setFromScratchLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_UNKNOWN
getFromScratchLayeringStrategy()
if the current strategy
is not known.
public static final byte POLICY_ALIGN_GROUPS_TOP
setGroupAlignmentPolicy(byte)
,
setRecursiveGroupLayeringEnabled(boolean)
,
Constant Field Valuespublic static final byte POLICY_ALIGN_GROUPS_CENTER
setGroupAlignmentPolicy(byte)
,
setRecursiveGroupLayeringEnabled(boolean)
,
Constant Field Valuespublic static final byte POLICY_ALIGN_GROUPS_BOTTOM
setGroupAlignmentPolicy(byte)
,
setRecursiveGroupLayeringEnabled(boolean)
,
Constant Field ValuesConstructor Detail |
---|
public IncrementalHierarchicLayouter()
LAYOUT_MODE_FROM_SCRATCH
initially
setLayoutMode(byte)
Method Detail |
---|
public byte getGroupAlignmentPolicy()
Default value is POLICY_ALIGN_GROUPS_CENTER
.
setGroupAlignmentPolicy(byte)
,
POLICY_ALIGN_GROUPS_TOP
,
POLICY_ALIGN_GROUPS_CENTER
,
POLICY_ALIGN_GROUPS_BOTTOM
,
setRecursiveGroupLayeringEnabled(boolean)
public void setGroupAlignmentPolicy(byte groupAlignmentPolicy)
Default value is POLICY_ALIGN_GROUPS_CENTER
.
groupAlignmentPolicy
- a layering strategy specifier for relative group layer alignment, one of
POLICY_ALIGN_GROUPS_TOP
, POLICY_ALIGN_GROUPS_CENTER
or POLICY_ALIGN_GROUPS_BOTTOM
getGroupAlignmentPolicy()
,
POLICY_ALIGN_GROUPS_TOP
,
POLICY_ALIGN_GROUPS_CENTER
,
POLICY_ALIGN_GROUPS_BOTTOM
,
setRecursiveGroupLayeringEnabled(boolean)
public boolean isGroupCompactionEnabled()
true
iff group compaction is active.setRecursiveGroupLayeringEnabled(boolean)
,
setGroupCompactionEnabled(boolean)
public void setGroupCompactionEnabled(boolean groupCompactionEnabled)
true
, the recursive layering is compacted, i.e. node
ranks are decreased if possible without reversing edge directions.
This differs from non-recursive layering, where groups are ignored completely.
The resulting layering tries to keep the layer span of a group node minimal,
while minimizing the overall vertical space.
By default, this feature is disabled.
Note:
This feature works best when a instance of
TopologicalLayerer
is used for layer assignment.
If this feature is enabled, an alignment policy that is set with
setGroupAlignmentPolicy(byte)
is ignored.
groupCompactionEnabled
- true
iff group compaction is active.isGroupCompactionEnabled()
,
setRecursiveGroupLayeringEnabled(boolean)
public byte getComponentArrangementPolicy()
Defaults to COMPONENT_ARRANGEMENT_TOPMOST
.
setComponentArrangementPolicy(byte)
public void setComponentArrangementPolicy(byte policy)
Defaults to COMPONENT_ARRANGEMENT_TOPMOST
.
IllegalArgumentException
- if the specified policy does not match
one component arrangement policy constants.policy
- one of
getComponentArrangementPolicy()
public long getMaximalDuration()
setMaximalDuration(long)
public void setMaximalDuration(long maximalDuration)
maximalDuration
- the time limit.getMaximalDuration()
public boolean isRecursiveGroupLayeringEnabled()
true
iff group information is usedsetRecursiveGroupLayeringEnabled(boolean)
public void setRecursiveGroupLayeringEnabled(boolean recursiveGroupLayeringEnabled)
If set to true
(and group compaction
is not enabled), groups are layered recursively, i.e.
By default, this feature is enabled.
recursiveGroupLayeringEnabled
- true
iff group information is usedisRecursiveGroupLayeringEnabled()
public boolean isBackloopRoutingEnabled()
setBackloopRoutingEnabled(boolean)
public void setBackloopRoutingEnabled(boolean backloopRoutingEnabled)
backloopRoutingEnabled
- whether or not backloop routing should be applied.public boolean isAutomaticEdgeGroupingEnabled()
setAutomaticEdgeGroupingEnabled(boolean)
public void setAutomaticEdgeGroupingEnabled(boolean automaticEdgeGroupingEnabled)
PortCandidateSet
).
User specified edge groups are not considered.
automaticEdgeGroupingEnabled
- whether or not automatic edge grouping should be applied.public void setOrthogonallyRouted(boolean orthogonal)
true
all resulting edge paths will be composed of vertical and horizontal segments, only.
Default is false
.
Note that this is a convenience method delegates to
getEdgeLayoutDescriptor()
.EdgeLayoutDescriptor.setOrthogonallyRouted(boolean)
.
orthogonal
- whether to route this edge orthogonallyisOrthogonallyRouted()
public boolean isOrthogonallyRouted()
true
signals that all resulting edge paths will be composed of vertical and horizontal segments, only.
Default is false
.
Note that this is a convenience method delegates to
getEdgeLayoutDescriptor()
.EdgeLayoutDescriptor.isOrthogonallyRouted()
.
setOrthogonallyRouted(boolean)
public void setIntegratedEdgeLabelingEnabled(boolean enabled)
label layouter
is of type LabelLayoutTranslator
and
LabelLayoutTranslator.setTranslateEdgeLabelsEnabled(boolean)
is set
to true
IllegalStateException
- if the current label layouter is not of type
LabelLayoutTranslator
.enabled
- whether to enable this featurepublic boolean isIntegratedEdgeLabelingEnabled()
label layouter
is of type LabelLayoutTranslator
and
LabelLayoutTranslator.isTranslateEdgeLabelsEnabled()
returns
true
.
false
.
IllegalStateException
- if the current label layouter is not of type
LabelLayoutTranslator
.
public void setConsiderNodeLabelsEnabled(boolean enabled)
label layouter
is of type LabelLayoutTranslator
and
LabelLayoutTranslator.setTranslateNodeLabelsEnabled(boolean)
is set
to true
.
Note that setting this option may overwrite the currently set label layouter. Hence, to combine this option with
a generic edge labeling algorithm, the generic labeling has to be applied in an additional step after calculating the layout.
IllegalStateException
- if the current label layouter is not of type
LabelLayoutTranslator
.enabled
- whether to enable this featurepublic boolean isConsiderNodeLabelsEnabled()
label layouter
is of type LabelLayoutTranslator
and
LabelLayoutTranslator.isTranslateNodeLabelsEnabled()
returns
true
.
false
.
IllegalStateException
- if the current label layouter is not of type
LabelLayoutTranslator
.
public void setMinimumLayerDistance(double d)
d
- the minimum distance to usepublic double getMinimumLayerDistance()
20.0d
.
public void setNodeToNodeDistance(double d)
NodeLayoutDescriptor.getMinimumDistance()
for related settings.
d
- the minimum distance to usepublic double getNodeToNodeDistance()
30.0d
.
public void setNodeToEdgeDistance(double d)
NodeLayoutDescriptor.getMinimumDistance()
and
EdgeLayoutDescriptor.getMinimumDistance()
for related settings.
d
- the minimum distance to usepublic double getNodeToEdgeDistance()
15.0d
.
public void setEdgeToEdgeDistance(double d)
EdgeLayoutDescriptor.getMinimumDistance()
for related settings.
d
- the minimum distance to usepublic double getEdgeToEdgeDistance()
EdgeLayoutDescriptor.getMinimumDistance()
for related settings.
protected DefaultDrawingDistanceCalculator getDefaultDrawingDistanceCalculator()
DefaultDrawingDistanceCalculator
that is registered
with the layout algorithm by default.
IllegalStateException
- if the current instance returned
by HierarchicLayouter.getDrawingDistanceCalculator()
is not an instance of DefaultDrawingDistanceCalculator
.
protected HierarchicLayouter createHierarchicLayouter()
HierarchicLayouter
instance.
new y.layout.hierarchic.incremental.HierarchicLayouter()
public HierarchicLayouter getHierarchicLayouter()
HierarchicLayouter
instance.
createHierarchicLayouter()
public void setFromScratchLayeringStrategy(byte strategy)
from scratch
layerer.
The layouter assigns the nodes to separate layers. The nodes within each layer will be
placed on the same horizontal layer.
The layers will be arranged vertically starting with the small-numbered layers.
The rank of a node is the number of the layer it belongs to.
An important layering strategy for the hierarchic layout style is called Hierarchical Layering.
A hierarchical layering tries to assign nodes to layers in a way that as much as possible
edges of the graph will point to the main layout direction, i.e. the start nodes of the edges will
have a smaller rank than the corresponding end nodes. Also, a hierarchical layering
will never put two connected nodes in the same layer.
By default the layering strategy LAYERING_STRATEGY_HIERARCHICAL_OPTIMAL
is set.
This method wraps the internal implementations into a MultiComponentLayerer
instance so that it is possible to specify the behavior of the algorithm if the
component layouter
is disabled.
strategy
- one of
LAYERING_STRATEGY_HIERARCHICAL_TOPMOST
, LAYERING_STRATEGY_HIERARCHICAL_DOWNSHIFT
,
LAYERING_STRATEGY_HIERARCHICAL_TIGHT_TREE
, LAYERING_STRATEGY_HIERARCHICAL_OPTIMAL
,
LAYERING_STRATEGY_FROM_SKETCH
, LAYERING_STRATEGY_USER_DEFINED
or
LAYERING_STRATEGY_BFS
.public byte getFromScratchLayeringStrategy()
from scratch
layering.
LAYERING_STRATEGY_UNKNOWN
if
the strategy is unknown.setFromScratchLayeringStrategy(byte)
public boolean canLayoutCore(LayoutGraph graph)
canLayoutCore
in class CanonicMultiStageLayouter
public void doLayoutCore(LayoutGraph g)
doLayoutCore
in class CanonicMultiStageLayouter
setLayoutMode(byte)
,
getLayoutMode()
,
configureCoreLayout(LayoutGraph,y.layout.hierarchic.incremental.HierarchicLayouter)
,
unconfigureCoreLayout(LayoutGraph,y.layout.hierarchic.incremental.HierarchicLayouter)
protected int getMirrorMask()
orientation layouter
's mirror mask.
protected void configureCoreLayout(LayoutGraph graph, HierarchicLayouter ihl)
PortCandidateSet.NODE_DP_KEY
is registered with the layout graph and
there is no HierarchicLayouter.getPortConstraintOptimizer()
registered, PCListOptimizer
will be temporarily configured with the instance.
graph
- the graph to be laid outihl
- the instance used for the core layout.protected void unconfigureCoreLayout(LayoutGraph graph, HierarchicLayouter ihl)
PortCandidateSet.NODE_DP_KEY
is registered with the layout graph and
PCListOptimizer
was registered with the instance during
configureCoreLayout(y.layout.LayoutGraph,y.layout.hierarchic.incremental.HierarchicLayouter)
it will be removed by this method.
graph
- the graph to be laid outihl
- the instance used for the core layout.public IncrementalHintsFactory createIncrementalHintsFactory()
IncrementalHintsFactory
instance that must be used
to obtain marks that can be associated with elements in the graph that
will be laid out incrementally. DataProvider
that is bound to the graph
using the INCREMENTAL_HINTS_DPKEY
DataProvider key to associate
appropriate hints with the elements in the graph that should be laid out
incrementally by the algorithm.
HierarchicLayouter.createIncrementalHintsFactory()
,
INCREMENTAL_HINTS_DPKEY
,
Graph.addDataProvider(Object,DataProvider)
,
setLayoutMode(byte)
,
LAYOUT_MODE_INCREMENTAL
public SequenceConstraintFactory createSequenceConstraintFactory(LayoutGraph graph)
SequenceConstraintFactory
instance that can be used to specify sequence constraints for the given
graph. For these sequence constraints to have any effect, the
Sequencer
used to determine the
in-layer node order (sequence) has to support constraints. Both,
DefaultLayerSequencer
and the incremental sequencer used internally support sequence constraints.
Note:
SequenceConstraintFactory
instances have to be
disposed
after use. Disposing the factory will also remove all constraints
previously specified for the factory's associated graph.
Creating a new constraint factory for a graph will render all previously created factories (including any constraints specified) for that graph useless. Therefore a new constraint factory should only be created after previously used factories have been properly disposed.
You can create a SequenceConstraintFactory 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:
IncrementalHierarchicLayouter ihl; SequenceConstraintFactory cf = ihl.createSequenceConstraintFactory(null); ... Graph g = ...; g.addDataProvider(SequenceConstraintFactory.SEQUENCE_CONSTRAINTS_MEMENTO_DPKEY, DataProviders.createConstantDataProvider(cf.getMemento())); //Calculate layout
graph
-
setFromScratchSequencer(y.layout.hierarchic.incremental.Sequencer)
,
setFixedElementsSequencer(y.layout.hierarchic.incremental.Sequencer)
public LayerConstraintFactory createLayerConstraintFactory(Graph graph)
LayerConstraintFactory
instance that can be used to specify layer constraints for the given
graph.
Note:
LayerConstraintFactory
instances have to be
disposed
after use. Disposing the factory will also remove all constraints
previously specified for the factory's associated graph.
Creating a new constraint factory for a graph will render all previously created factories (including any constraints specified) for that graph useless. Therefore a new constraint factory should only be created after previously used factories have been properly disposed.
graph
- the given graph.
public Layerer getFromScratchLayerer()
Layerer
instance that is used to obtain the layering
for the nodes if the layouter is set to LAYOUT_MODE_FROM_SCRATCH
.
LAYOUT_MODE_FROM_SCRATCH
mode.setFromScratchLayerer(Layerer)
,
setLayoutMode(byte)
public void setFromScratchLayerer(Layerer layerer)
Layerer
instance that is used to obtain the layering
for the nodes if the layouter is set to LAYOUT_MODE_FROM_SCRATCH
.
NullPointerException
- if the argument is null
layerer
- the new layerer instancesetLayoutMode(byte)
public Sequencer getFromScratchSequencer()
Sequencer
instance that is used to calculate the node
sequence if the layouter is set to LAYOUT_MODE_FROM_SCRATCH
.
LAYOUT_MODE_FROM_SCRATCH
mode.setFromScratchSequencer(Sequencer)
,
setLayoutMode(byte)
public void setFromScratchSequencer(Sequencer sequencer)
Sequencer
instance that is used to calculate the node
sequence if the layouter is set to LAYOUT_MODE_FROM_SCRATCH
.
NullPointerException
- if the argument is null
sequencer
- the new sequencer instancesetFromScratchLayerer(Layerer)
,
setLayoutMode(byte)
public NodePlacer getNodePlacer()
NodePlacer
instance that will be used to calculated the
final node placement of the layout.
setNodePlacer(NodePlacer)
public void setNodePlacer(NodePlacer nodePlacer)
NodePlacer
instance that will be used to calculated the
final node placement of the layout.
NullPointerException
- if the argument is null
nodePlacer
- the new instancepublic Layerer getFixedElementsLayerer()
Layerer
instance that is used to obtain the layering
for those nodes that are not marked to be laid out incrementally
if the layouter is set to LAYOUT_MODE_INCREMENTAL
.
LAYOUT_MODE_INCREMENTAL
mode.setFixedElementsLayerer(Layerer)
,
setLayoutMode(byte)
public void setFixedElementsLayerer(Layerer fixedElementsLayerer)
Layerer
instance that is used to obtain the layering
for those nodes that are not marked to be laid out incrementally
if the layouter is set to LAYOUT_MODE_INCREMENTAL
.
NullPointerException
- if the argument is null
fixedElementsLayerer
- the new layerer instancesetLayoutMode(byte)
public Sequencer getFixedElementsSequencer()
Sequencer
instance that is used to calculated the sequence
of the nodes that are not marked to be laid out incrementally
if the layouter is set to LAYOUT_MODE_INCREMENTAL
.
LAYOUT_MODE_INCREMENTAL
mode.setFixedElementsSequencer(Sequencer)
,
setLayoutMode(byte)
public void setFixedElementsSequencer(Sequencer fixedElementsSequencer)
Sequencer
instance that is used to calculated the sequence
of the nodes that are not marked to be laid out incrementally
if the layouter is set to LAYOUT_MODE_INCREMENTAL
.
NullPointerException
- if the argument is null
fixedElementsSequencer
- the sequencer for LAYOUT_MODE_INCREMENTAL
mode.setLayoutMode(byte)
public byte getLayoutMode()
Layerer
and Sequencer
implementations. LAYOUT_MODE_FROM_SCRATCH
.
public void setLayoutMode(byte layoutMode)
Layerer
and Sequencer
implementations.
IllegalArgumentException
- if the mode is unknownlayoutMode
- the new mode constantprotected EdgeLayoutDescriptor createEdgeLayoutDescriptor()
new EdgeLayoutDescriptor()
)public EdgeLayoutDescriptor getEdgeLayoutDescriptor()
EdgeLayoutDescriptor
instance used for all those
edges, that do not have a specific layout descriptor assigned.
HierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
,
createEdgeLayoutDescriptor()
public void setEdgeLayoutDescriptor(EdgeLayoutDescriptor edgeLayoutDescriptor)
EdgeLayoutDescriptor
instance used for all those
edges, that do not have a specific layout descriptor assigned.
NullPointerException
- if the argument is null
edgeLayoutDescriptor
- the new descriptorHierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
protected NodeLayoutDescriptor createNodeLayoutDescriptor()
new NodeLayoutDescriptor()
)public NodeLayoutDescriptor getNodeLayoutDescriptor()
NodeLayoutDescriptor
instance used for all those
nodes, that do not have a specific layout descriptor assigned.
HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY
,
createNodeLayoutDescriptor()
public void setNodeLayoutDescriptor(NodeLayoutDescriptor nodeLayoutDescriptor)
NodeLayoutDescriptor
instance used for all those
nodes, that do not have a specific layout descriptor assigned.
NullPointerException
- if the argument is null
nodeLayoutDescriptor
- the new descriptorHierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_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 |