|
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 layout algorithm arranges graphs in a hierarchic fashion.
The nodes are distributed into layers so that most of the edges point to the main layout direction.
The order of the nodes within the layers ensures that the number of edge crossings is as small as possible. There
are different edge routing styles available. Edges can be orthogonal, polyline, octilinear or curved (see
RoutingStyle
for details).
Hierarchical diagrams are commonly used for the visualization of hierarchical data, since they facilitate the identification of dependencies and relationships among the nodes of the graph. Possible application domains are the following: workflow visualization, call graph visualization, entity-relationship diagrams, biochemical pathways and network management.
Hierarchic Layout obtained with default settings
The layout algorithm runs in three main phases:
getFromScratchLayerer()
or getFixedElementsLayerer()
, respectively. If the layout orientation is top-to-bottom, the nodes in
each layer are arranged horizontally while the layers are ordered vertically top-to-bottom.
setFromScratchSequencer(Sequencer)
or setFixedElementsSequencer(Sequencer)
.
This layout algorithm is able to 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 the layout mode to
LAYOUT_MODE_INCREMENTAL
. Then register a DataProvider
(e.g. use Maps.createHashedDataMap()
)
with the graph using the INCREMENTAL_HINTS_DPKEY
DataProvider key and associate the hints
obtained from the IncrementalHintsFactory
with the elements to be added incrementally.
NodeLayoutDescriptor
and EdgeLayoutDescriptor
instances can be used for specifying individual
information (e.g. distances or routing styles) for each node and edge in the graph. The descriptors are bound to the
graph using DataProvider
s registered with HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY
or
HierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
. If there is no descriptor assigned to some nodes/edges, a
default descriptor will be used. To set default descriptors use
setNodeLayoutDescriptor(NodeLayoutDescriptor)
and setEdgeLayoutDescriptor(EdgeLayoutDescriptor)
.
IncrementalHierarchicLayouter
supports two approaches to connect edges on a specific side or even an exact location
to a node. PortConstraint
s define a single constraint for the ports of an edge. To realize more
complex port restrictions, several PortCandidate
s or PortCandidateSet
s can be
assigned to edges or nodes. If an edge with registered PortCandidate
s connects to nodes with PortCandidateSet
s,
the algorithm will try to match both collections to find an appropriate port. In case there is no matching port
candidate, a PortCandidate
specified for the edge is preferred. For the matching to work properly,
the candidates in both collection need to be the same instances.
Since their simultaneous existence at the same node may be ambiguous, it is not recommended to use a combination of
PortConstraint
s and PortCandidate
s in the same layout.
Furthermore, PortCandidate
s with multiple directions (e.g. EAST or WEST) are not supported. To model
that an edge should connect at one of several sides, define multiple candidates instead, where each candidate
has a single direction.
The edge grouping feature of this layout algorithm is restricted to normal, hierarchic edges. Edges with
recursive edge style
EdgeLayoutDescriptor.RECURSIVE_EDGE_STYLE_DIRECTED
or
EdgeLayoutDescriptor.RECURSIVE_EDGE_STYLE_UNDIRECTED
will not be grouped.
They are also not grouped when enabling automatic edge grouping
.
The port grouping feature (see PortConstraintKeys.SOURCE_PORT_GROUP_ID_DPKEY
and
PortConstraintKeys.TARGET_PORT_GROUP_ID_DPKEY
)
allows to specify edges that share the same port location at their source/target.
However, unlike as for edge grouping, edges with port groups will be routed independently without sharing segments.
Port grouping has similar restrictions as the edge grouping feature.
In addition, port grouping is not considered for self-loops.
The IncrementalHierarchicLayouter
also supports
node types
as a subordinate criterion during the sequencing of nodes within their layer.
More precisely, the sequencing algorithm prefers to place nodes of the same type next to each other if this does not
induce additional crossings or conflicts with other constraints (like node groups,
swimlanes
, or
sequence constraints
).
The algorithm uses an additional local optimization heuristic to improve the placement with respect to
node types and, thus, does not guarantee optimal results. Furthermore, this additional step may increase the required runtime.
Note that node types do not affect the layer assignment.
IncrementalHierarchicLayouter
allows restricting the maximum duration
which
may be a suitable option to reduce the runtime required for large graphs. Note that restricting the maximum duration
may result in a lower layout quality. Furthermore, the actual runtime may exceed the maximum duration since the
layout algorithm still has to find a valid solution.
IncrementalHierarchicLayouter
only considers weak PortConstraint
s.Field Summary | |
---|---|
static java.lang.Object |
ALTERNATIVE_EDGE_PATH_DPKEY
A DataProvider key for associating alternative paths for edges connecting to groups, group content or folder nodes.
|
static java.lang.Object |
ALTERNATIVE_GROUP_BOUNDS_DPKEY
A DataProvider key for associating an alternative bounds with the collapsed/expanded group.
|
static java.lang.Object |
BUS_DESCRIPTOR_DPKEY
A DataProvider key for specifying the bus to which an edge belongs to.
|
static byte |
COMPONENT_ARRANGEMENT_COMPACT
A component arrangement policy that achieves a 1:1 aspect ratio for the graph. |
static byte |
COMPONENT_ARRANGEMENT_TOPMOST
A component arrangement policy that aligns the components with their topmost layer. |
static java.lang.Object |
CRITICAL_EDGE_DPKEY
A DataProvider key for defining the priority of critical edges.
|
static java.lang.Object |
EDGE_CROSSING_COST_DPKEY
A DataProvider key for specifying individual crossing costs of the edges.
|
static java.lang.Object |
EDGE_DIRECTEDNESS_DPKEY
A DataProvider key for specifying the directedness of edges.
|
static java.lang.Object |
EDGE_THICKNESS_DPKEY
A DataProvider key for specifying the thickness of the edges.
|
static java.lang.Object |
FOLDER_NODES_DPKEY
A DataProvider key for marking folder nodes.
|
static java.lang.Object |
GROUP_BORDER_CROSSING_COST_DPKEY
A DataProvider key for specifying individual crossing costs for vertical borders of group nodes.
|
static java.lang.Object |
INCREMENTAL_HINTS_DPKEY
A DataProvider key for specifying incremental hints.
|
static java.lang.Object |
LAYER_VALUE_HOLDER_DPKEY
A DataAcceptor key for publishing the layer IDs for all nodes in the graph.
|
static byte |
LAYERING_STRATEGY_BFS
A layering strategy based on a breadth first search (BFS). |
static byte |
LAYERING_STRATEGY_FROM_SKETCH
A layering strategy which derives the layers from the initial coordinates of the nodes. |
static byte |
LAYERING_STRATEGY_HIERARCHICAL_DOWNSHIFT
A layering strategy which applies a fast heuristic that improves the layering done by LAYERING_STRATEGY_HIERARCHICAL_TOPMOST by shifting
some nodes down. |
static byte |
LAYERING_STRATEGY_HIERARCHICAL_OPTIMAL
A layering strategy which places each node in the optimal layer to minimize the layer distances. |
static byte |
LAYERING_STRATEGY_HIERARCHICAL_TIGHT_TREE
A layering strategy which applies a heuristic to approximate the optimal layering . |
static byte |
LAYERING_STRATEGY_HIERARCHICAL_TOPMOST
A layering strategy which places each node in the highest possible layer without passing its predecessor in the topological order of nodes. |
static byte |
LAYERING_STRATEGY_UNKNOWN
A dummy layering strategy which describes a strategy that is not part of the default strategies. |
static byte |
LAYERING_STRATEGY_USER_DEFINED
A layering strategy which uses a layer assignment specified by the user. |
static byte |
LAYOUT_MODE_FROM_SCRATCH
A layout mode that will recompute the complete layout from scratch. |
static byte |
LAYOUT_MODE_INCREMENTAL
A layout mode that allows to keep some nodes fixed and insert the remaining nodes incrementally. |
static byte |
POLICY_ALIGN_GROUPS_BOTTOM
A group layering alignment strategy which aligns groups and normal nodes that occupy the same layer to the bottom with respect to their inner layers. |
static byte |
POLICY_ALIGN_GROUPS_CENTER
A group layering alignment strategy which aligns groups and normal nodes that occupy the same layer to the center with respect to their inner layers. |
static byte |
POLICY_ALIGN_GROUPS_TOP
A group layering alignment strategy which aligns groups and normal nodes that occupy the same layer to the top with respect to their inner layers. |
static java.lang.Object |
SEQUENCE_VALUE_HOLDER_DPKEY
A DataAcceptor key for publishing the index inside their layer for all nodes in the graph.
|
static java.lang.Object |
SUB_COMPONENT_ID_DPKEY
A DataProvider key for specifying custom sub-components of the input graph.
|
static java.lang.Object |
SUB_COMPONENT_LAYOUT_ALGORITHM_DPKEY
A DataProvider key for specifying a layout algorithm for each sub-component.
|
static java.lang.Object |
SWIMLANE_DESCRIPTOR_DPKEY
A DataProvider key for defining swimlanes for the nodes.
|
static java.lang.Object |
UNIFORM_PORT_ASSIGNMENT_GROUPS_DPKEY
A DataProvider key for specifying whether or not the ports of edges incident to a specific group node should
be uniformly distributed.
|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
IncrementalHierarchicLayouter()
Creates a new IncrementalHierarchicLayouter instance with the default settings. |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Accepts general graphs without exceptions. |
protected void |
configureCoreLayout(LayoutGraph graph,
HierarchicLayouter coreLayouter)
Configures the core layout algorithm with the settings of this IncrementalHierarchicLayouter instance. |
protected EdgeLayoutDescriptor |
createEdgeLayoutDescriptor()
Returns a new EdgeLayoutDescriptor instance that will be used during the various
phases of the layout algorithm to determine the drawing details of the edges of the graph. |
protected HierarchicLayouter |
createHierarchicLayouter()
Returns a new HierarchicLayouter instance. |
IncrementalHintsFactory |
createIncrementalHintsFactory()
Returns a IncrementalHintsFactory instance that must be used
to obtain hints to be associated with graph elements that
should be laid out incrementally. |
LayerConstraintFactory |
createLayerConstraintFactory(Graph graph)
Returns a LayerConstraintFactory instance that can be used for specifying layer constraints for the given
graph. |
protected NodeLayoutDescriptor |
createNodeLayoutDescriptor()
Returns a new NodeLayoutDescriptor instance that will be used during the various
phases of the layout algorithm to determine the drawing details of the nodes of the graph. |
SequenceConstraintFactory |
createSequenceConstraintFactory(LayoutGraph graph)
Returns a SequenceConstraintFactory
instance that can be used for specifying sequence constraints for the given
graph. |
void |
doLayout(LayoutGraph graph)
Calculates a hierarchic layout of the given graph. |
void |
doLayoutCore(LayoutGraph graph)
Delegates the calculation of the hierarchic layout to a configured HierarchicLayouter instance. |
byte |
getComponentArrangementPolicy()
Returns the policy that specifies how 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 directly consecutive edges that pass through the same layer. |
Layerer |
getFixedElementsLayerer()
Returns the Layerer instance that obtains the layering
for fixed nodes during the incremental layout run. |
Sequencer |
getFixedElementsSequencer()
Returns the Sequencer instance that calculates the sequence
of the fixed nodes during the incremental layout run. |
Layerer |
getFromScratchLayerer()
Returns the Layerer instance that obtains the layering
for the nodes if the layout algorithm runs in From Scratch mode . |
byte |
getFromScratchLayeringStrategy()
Returns a predefined layering strategy for the from scratch layerer. |
Sequencer |
getFromScratchSequencer()
Returns the Sequencer instance that calculates the node
sequence if the layout algorithm runs in From Scratch mode . |
double |
getGridSpacing()
Returns the equidistant spacing between the horizontal and vertical grid lines. |
byte |
getGroupAlignmentPolicy()
Returns the group layer alignment strategy used for recursive group layering. |
HierarchicLayouter |
getHierarchicLayouter()
Returns the current layout algorithm instance. |
byte |
getLayoutMode()
Returns the layout mode this layouter should use for upcoming layouts. |
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 mirror mask of the orientation layouter . |
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 calculate the
final node placement of the layout. |
double |
getNodeToEdgeDistance()
Returns the minimum distance between an edge and an adjacent node in one layer. |
double |
getNodeToNodeDistance()
Returns the minimum distance between two adjacent nodes in one layer. |
static Edge |
getOriginalEdge(Edge edge,
LayoutDataProvider layoutDataProvider)
Returns the corresponding original edge instance for a given edge. |
boolean |
isAutomaticEdgeGroupingEnabled()
Returns whether or not edges are grouped automatically. |
boolean |
isBackloopRoutingEnabled()
Returns whether or not reversed edges should be routed as back-loops. |
boolean |
isBackloopRoutingForSelfloopsEnabled()
Returns whether or not self-loops should be routed in a similar manner as back-loops. |
boolean |
isConsiderNodeLabelsEnabled()
Returns whether or not the layout algorithm considers node labels when calculating node positions to avoid overlaps. |
boolean |
isGroupCompactionEnabled()
Returns whether or not layer compaction for recursive group layering is active. |
boolean |
isIntegratedEdgeLabelingEnabled()
Returns whether or not the layout algorithm reserves space for labels and places them. |
boolean |
isLayerSeparationEnabled()
Returns whether or not to separate layers. |
boolean |
isOrthogonallyRouted()
Returns whether or not edges should be routed orthogonally. |
boolean |
isRecursiveGroupLayeringEnabled()
Returns whether or not groups are respected during the layering stage. |
boolean |
isStopAfterLayeringEnabled()
Specifies whether or not to stop the layout algorithm after the layering step. |
boolean |
isStopAfterSequencingEnabled()
Returns whether or not to stop the layout algorithm after the sequencing step. |
void |
setAutomaticEdgeGroupingEnabled(boolean automaticEdgeGroupingEnabled)
Specifies whether or not edges are grouped automatically. |
void |
setBackloopRoutingEnabled(boolean backLoopRoutingEnabled)
Specifies whether or not reversed edges should be routed as back-loops. |
void |
setBackloopRoutingForSelfloopsEnabled(boolean backLoopRoutingForSelfLoopsEnabled)
Specifies whether or not self-loops should be routed in a similar manner as back-loops. |
void |
setComponentArrangementPolicy(byte policy)
Specifies the policy that specifies how to arrange connected components. |
void |
setConsiderNodeLabelsEnabled(boolean enabled)
Specifies whether or not the layout algorithm considers node labels when calculating node positions to avoid overlaps. |
void |
setEdgeLayoutDescriptor(EdgeLayoutDescriptor edgeLayoutDescriptor)
Specifies the EdgeLayoutDescriptor instance used for all those
edges that do not have a specific layout descriptor assigned. |
void |
setEdgeToEdgeDistance(double distance)
Sets the minimum distance between two directly consecutive edges that pass through the same layer. |
void |
setFixedElementsLayerer(Layerer fixedElementsLayerer)
Specifies the Layerer instance that obtains the layering
for fixed nodes during the incremental layout run. |
void |
setFixedElementsSequencer(Sequencer fixedElementsSequencer)
Specifies the Sequencer instance that calculates the sequence
of the fixed nodes during the incremental layout run. |
void |
setFromScratchLayerer(Layerer layerer)
Specifies the Layerer instance that obtains the layering
for the nodes if the layout algorithm runs in From Scratch mode . |
void |
setFromScratchLayeringStrategy(byte strategy)
Specifies a predefined layering strategy for the from scratch layerer . |
void |
setFromScratchSequencer(Sequencer sequencer)
Specifies the Sequencer instance that calculates the node
sequence if the layout algorithm runs in From Scratch mode . |
void |
setGridSpacing(double gridSpacing)
Specifies the equidistant spacing between the horizontal and vertical grid lines. |
void |
setGroupAlignmentPolicy(byte groupAlignmentPolicy)
Specifies the group layer alignment strategy used for recursive group layering. |
void |
setGroupCompactionEnabled(boolean groupCompactionEnabled)
Specifies whether or not layer compaction for recursive group layering is active. |
void |
setIntegratedEdgeLabelingEnabled(boolean enabled)
Specifies whether or not the layout algorithm reserves space for labels and places them. |
void |
setLayerSeparationEnabled(boolean layerSeparationEnabled)
Specifies whether or not to separate layers. |
void |
setLayoutMode(byte layoutMode)
Specifies the layout mode this layouter should use for upcoming layouts. |
void |
setMaximalDuration(long maximalDuration)
Specifies the time limit (in milliseconds) set for the layout algorithm. |
void |
setMinimumLayerDistance(double distance)
Sets the minimum distance between two adjacent layers. |
void |
setNodeLayoutDescriptor(NodeLayoutDescriptor nodeLayoutDescriptor)
Specifies the NodeLayoutDescriptor instance used for all those
nodes that do not have a specific layout descriptor assigned. |
void |
setNodePlacer(NodePlacer nodePlacer)
Specifies the NodePlacer instance that will calculate 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 distance)
Sets the minimum distance between two adjacent nodes in one layer. |
void |
setOrthogonallyRouted(boolean orthogonal)
Specifies whether or not edges should be routed orthogonally. |
void |
setRecursiveGroupLayeringEnabled(boolean recursiveGroupLayeringEnabled)
Specifies whether or not groups are respected during the layering stage. |
void |
setStopAfterLayeringEnabled(boolean stopAfterLayering)
Specifies whether or not to stop the layout algorithm after the layering step. |
void |
setStopAfterSequencingEnabled(boolean stopAfterSequencing)
Specifies whether or not to stop the layout algorithm after the sequencing step. |
protected void |
unconfigureCoreLayout(LayoutGraph graph,
HierarchicLayouter coreLayouter)
Disposes of the core layout algorithm. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Object EDGE_DIRECTEDNESS_DPKEY
DataProvider
key for specifying the directedness of edges.
Generally, the hierarchic layout algorithm assigns nodes to layers such that most of the edges point in the
main layout direction
.
The directedness of an edge specifies whether it should comply with this strategy. More precisely, a value of
1
means that the edge should fully comply, a value of -1
that it should comply
inversely (the edge should point against the main layout direction), and a value of 0
means
that the direction doesn't matter at all and the endpoints of the edges may be placed at the same layer.
If there are conflicting preferences, edges with higher absolute
values are more likely to point in the desired direction.
DataProvider
is registered with this key, the algorithm assumes that all
edges have directedness 1
.IncrementalHierarchicLayouter
ignores the specified
layerer
and automatically switches to
the ConstraintIncrementalLayerer
in such cases.Layout result when dashed edges are undirected, i.e., have directedness 0 | Layout result when all edges are directed, i.e., have directedness 1 |
public static final java.lang.Object EDGE_CROSSING_COST_DPKEY
DataProvider
key for specifying individual crossing costs of the edges.
The crossing costs of the edges are considered during the crossing minimization phase. The total crossing costs are minimized using a heuristic where the cost of a crossing between two edges is defined as the product of the edges' crossing costs.
If no individual crossing costs are defined, each crossing has a cost of 1
.
A crossing with an edge that has a cost of zero is cost-free and such a crossing will therefore not be avoided.
critical edges
, as
critical edges are not automatically favored during the crossing minimization phase.public static final java.lang.Object GROUP_BORDER_CROSSING_COST_DPKEY
DataProvider
key for specifying individual crossing costs for vertical borders of group nodes.
Like edge crossing costs
, these costs are considered during the crossing
minimization phase. The total costs are minimized using a heuristic where the cost of a crossing between a
group node border and an edge is defined as the product of the respective group border crossing cost and the
edge crossing cost.
If no individual crossing costs are defined, the cost for crossing a group node border is 5
.
This means that by default, a crossing between an edge and a group node border is more expensive than a
crossing between two edges. Also note that a crossing with a group node border that has a cost of zero is
cost-free and such a crossing will therefore not be avoided.
EDGE_CROSSING_COST_DPKEY
public static final java.lang.Object CRITICAL_EDGE_DPKEY
DataProvider
key for defining the priority of critical edges.
Critical edges highlight different edge paths that are relevant for a user. The layouter tries to vertically align each node pair that is connected by a critical edge. Conflicts between different critical edges are always resolved in favor of the higher priority.
Critical edges do not automatically affect the result of the crossing minimization phase. If crossings
between critical edges should be avoided, one can assign individual crossing costs by using
EDGE_CROSSING_COST_DPKEY
. Critical edges need to get a larger crossing cost than other,
non-critical edges. This is recommended if critical edges should not only highlight a relevant path but
also crossings with them should be avoided. Note, however, that the crossing minimization is only a
heuristic and there is no guarantee for an optimal solution in all cases.
public static final java.lang.Object EDGE_THICKNESS_DPKEY
DataProvider
key for specifying the thickness of the edges.
The specified non-negative thickness is considered when calculating minimum distances so that
there are no overlaps between edges and other graph elements.
By default, each edge has thickness 0
.
public static final java.lang.Object BUS_DESCRIPTOR_DPKEY
DataProvider
key for specifying the bus to which an edge belongs to.
All edges with the same BusDescriptor
instance adjacent to a specific
node (the root) and having the same direction are arranged in a compact, bus-like way. The
edge directedness
is also considered here. The direction defines the
placement of the bus structure in the following way:
The bus substructures are arranged using a style that yields more compact layout results. Edges to the child nodes, the so-called bus nodes, are routed using a shared segment that connects to the common root node. The bus nodes are arranged using several layers above or below the root node such that the whole substructure has a compact area. By default, each bus layer contains equally many bus nodes, bus nodes of adjacent layers are center-aligned and the shared bus segment is routed in the middle of the nodes. This produces compact, symmetric arrangements of the bus structures.
The arrangement can also be customized for each bus individually, by using the settings offered
by BusDescriptor
. It allows to configure the number
of bus nodes before and after the common bus segment.
There apply some restrictions for bus structures:
partition grid cell
or
same swimlane
as the root node are included in the bus structure.
LabelLayoutConstants.PLACE_AT_SOURCE_PORT
and
LabelLayoutConstants.PLACE_AT_TARGET_PORT
).
incremental layout mode
, the bus edges are always treated in
an incremental way such that the bus-style routing remains consistent (e.g. if a fixed bus edge
contains bends that suggest another route, they are ignored). The reason is that the bus-style layout
of the structures has higher priority. Furthermore, the location of the bus segment relative to the elements
is not derived from the sketch but depends on the settings
BusDescriptor.getMaximumNodesBeforeBus()
and
BusDescriptor.getMaximumNodesAfterBus()
as well as the before/after
constraints (see BusDescriptor.PLACE_BEFORE_BUS_DPKEY
).
This means that it can happen that a fixed bus node which was placed before the bus in the input drawing
may be placed after the bus if the bus was enlarged due to the insertion of incremental bus nodes.
incremental group hint
.
Fixed bus nodes inside such a group are not necessarily kept fix but are treated like an
incrementally inserted node.
BusDescriptor
, only one
edge will be treated as a bus edge.LayerConstraintFactory
, they are not considered
for bus nodes because the bus structure is layered independently.BusDescriptor
,
BusDescriptor.PLACE_BEFORE_BUS_DPKEY
,
BusDescriptor.ROOT_OFFSET_DPKEY
public static final java.lang.Object INCREMENTAL_HINTS_DPKEY
DataProvider
key for specifying incremental hints.
Incremental hints are created using an incremental hints factory
.
HierarchicLayouter.INCREMENTAL_HINTS_DPKEY
,
IncrementalHintsFactory
public static final java.lang.Object LAYER_VALUE_HOLDER_DPKEY
DataAcceptor
key for publishing the layer IDs for all nodes in the graph.
For each non-group node, the index of the node's layer will be stored
in this DataAcceptor
after the layout run.
DataAcceptor
also a DataProvider
storing values of type
IntValueHolder
can be registered. Then the
IntValueHolder
instance gets filled with the layer information
of the corresponding nodes.DataProvider
is registered with this key, the layer information of the nodes is dropped.HierarchicLayouter.LAYER_VALUE_HOLDER_DPKEY
public static final java.lang.Object SEQUENCE_VALUE_HOLDER_DPKEY
DataAcceptor
key for publishing the index inside their layer for all nodes in the graph.
For each non-group node, the index (position) of the node within its layer will be stored
in this DataAcceptor
after the layout run.
DataAcceptor
also a DataProvider
storing values of type
IntValueHolder
can be registered. Then the
IntValueHolder
instance gets filled with the sequence information
of the corresponding nodes.DataProvider
is registered with this key, the sequence information of the nodes is dropped.HierarchicLayouter.SEQUENCE_VALUE_HOLDER_DPKEY
public static final java.lang.Object SWIMLANE_DESCRIPTOR_DPKEY
DataProvider
key for defining swimlanes for the nodes.
The layout algorithm will arrange nodes in swimlanes according to the registered descriptors.
Layout information about the swimlanes is finally written back to the descriptor instances. Instances can be shared among multiple nodes in the same lane.
HierarchicLayouter.SWIMLANE_DESCRIPTOR_DPKEY
public static final java.lang.Object ALTERNATIVE_GROUP_BOUNDS_DPKEY
DataProvider
key for associating an alternative bounds with the collapsed/expanded group.
When running in incremental
layout mode
,
the alternative bounds of the collapsed/expanded group will be used
during the layering and sequencing phase of the algorithm.
alternative edge paths
for edges adjacent to such groups.
In addition, recursive group layering
should
be enabled and recursive
edge style
should be set to EdgeLayoutDescriptor.RECURSIVE_EDGE_STYLE_DIRECTED
.
Edges that end at a group itself or a folder node should not have
port candidates
or port constraints
at this end
(because this may destroy the recursive directed edge style required to obtain stable results).ALTERNATIVE_EDGE_PATH_DPKEY
public static final java.lang.Object ALTERNATIVE_EDGE_PATH_DPKEY
DataProvider
key for associating alternative paths for edges connecting to groups, group content or folder nodes.
When running in incremental
layout mode
,
the alternative edge paths are considered during the routing of fixed (i.e., non-incremental) edges.
The alternative paths should be used in conjunction with alternative
group bounds
to achieve more stable layout results when collapsing/expanding a group node as follows:
ALTERNATIVE_GROUP_BOUNDS_DPKEY
public static final java.lang.Object FOLDER_NODES_DPKEY
DataProvider
key for marking folder nodes.
When using recursive edge styles in incremental mode, edges will also start at the bottom and end at the top of marked folder nodes. This will keep the edge routes more stable since the connection sides won't change.
public static final java.lang.Object SUB_COMPONENT_ID_DPKEY
DataProvider
key for specifying custom sub-components of the input graph.
A sub-component is arranged by another layout algorithm
and its layout is finally
embedded into the global hierarchical layout. This feature allows, for example, to highlight special
sub-structures by arranging them in a different fashion. The sub-layout algorithm must be specified by
a DataProvider
registered with the graph with key SUB_COMPONENT_LAYOUT_ALGORITHM_DPKEY
.
The first found Layouter
instance bound to any node of a sub-component is applied as
algorithm for that sub-component.
Carefully note that nodes of a sub-component can be connected to nodes of another sub-component as well as to nodes that are not part of any sub-component. Edges that model these connections are so-called inter-edges. For inter-edges there apply some restrictions with respect to the supported features:
RoutingStyle
settings.
backloop routing
style is not applied for
the part of an inter-edge that connects to a sub-component node.
minimum first segment length
and
the minimum last segment length
can not
always be fulfilled for the side of an inter-edge that lies inside a sub-component. It is still
kept on the side outside of sub-components.
node-to-edge distance
can not always be kept between inter-edges and
nodes inside a sub-component. This will mostly appear if a sub-component has a rather large number of
inter-edges connecting to it.
integrated edge labeling
does not guarantee full support
for all PreferredPlacementDescriptor
configurations for inter-edges. This affects the
side of the inter-edge that lies inside a sub-component and when the label should be placed near the
component node, i.e., using settings LabelLayoutConstants.PLACE_AT_SOURCE
,
LabelLayoutConstants.PLACE_AT_SOURCE_PORT
,
LabelLayoutConstants.PLACE_AT_TARGET
or
LabelLayoutConstants.PLACE_AT_TARGET_PORT
.
Sub-components can be defined on grouped graphs with the following restrictions:
When running in incremental mode
, it is
still up to the sub-layout algorithm to decide whether to treat a sub-component element as incremental or
fixed. If the given layout of the sub-component should be considered, then the from-sketch mode of
the used layout algorithm needs to be enabled (if such a mode is supported).
Layering and sequencing constraints are supported for sub-components in the following way: all constraints
from the sub-component nodes are transferred to the component itself.
Constraints between nodes of the same component are ignored.
In the same way, a given layering provided by GivenLayersLayerer
is supported for sub-components.
IncrementalHierarchicLayouter
instance as layout algorithm
responsible for a sub-component. This way, different hierarchical layout styles can be conveniently combined
into one layout (e.g. layouts with different orientations). The best layout results are achieved if a
sub-component is connected to other parts only by very few inter-edges.SUB_COMPONENT_LAYOUT_ALGORITHM_DPKEY
public static final java.lang.Object SUB_COMPONENT_LAYOUT_ALGORITHM_DPKEY
DataProvider
key for specifying a layout algorithm for each sub-component.
A sub-component is arranged by the layout algorithm defined by this mapping and its layout is finally
embedded into the global hierarchical layout.
The first non-null
instance mapped to any sub-component node is used for the whole sub-component.
For more details about this feature and how to define sub-components, please see SUB_COMPONENT_ID_DPKEY
.
SUB_COMPONENT_ID_DPKEY
public static final java.lang.Object UNIFORM_PORT_ASSIGNMENT_GROUPS_DPKEY
DataProvider
key for specifying whether or not the ports of edges incident to a specific group node should
be uniformly distributed.
This setting only affects the two sides of a group node that are in flow and against the flow
of the layout orientation. For example, for orientation LayoutOrientation.TOP_TO_BOTTOM
only the edges incident to the top and bottom group node side are considered but not the edges at the left
and right side.
If no DataProvider
is registered with this key, then the ports at group nodes are not explicitly
distributed in a uniform way.
The uniform group port assignment considers the
edge-to-edge distance
such that two ports keep the specified distance to each
other. Group nodes may in consequence be enlarged to satisfy that constraints, potentially generating less
compact layouts. The distance from the group node border to the first/last port on each group side may
be influenced by using group node insets
.
Importantly, it is not guaranteed that the group node ports of a specific side can be uniformly distributed. In the following cases ports of a specific side are not uniformly distributed:
maximum duration
is restricted and there is no time left.false for all group nodes | true for all group nodes |
public static final byte COMPONENT_ARRANGEMENT_COMPACT
1:1
aspect ratio for the graph.
After layering the single components with the core layerer, the components will be merged such that an 1:1 aspect ratio is fulfilled best.
public static final byte COMPONENT_ARRANGEMENT_TOPMOST
After layering the single components with the core layerer, the components are aligned with their topmost layer.
public static final byte LAYOUT_MODE_INCREMENTAL
Fixed elements will be handled by the fixed elements sequencer
and fixed elements layerer
. Incremental elements
will be added during the layering or the sequencing phase. They are handled by
from scratch layerer
and fixed elements layerer
respectively.
IncrementalHintsFactory.createLayerIncrementallyHint(Object)
,
setLayoutMode(byte)
,
setFixedElementsSequencer(Sequencer)
,
setFixedElementsLayerer(Layerer)
,
Constant Field Valuespublic static final byte LAYOUT_MODE_FROM_SCRATCH
All elements will be handled by the same layerer
and
sequencer
.
setLayoutMode(byte)
,
setFromScratchSequencer(Sequencer)
,
setFromScratchLayerer(Layerer)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_HIERARCHICAL_TOPMOST
All nodes with indegree zero will be assigned to the topmost layer of the layout. The number of separate layers will be as small as possible.
public static final byte LAYERING_STRATEGY_HIERARCHICAL_OPTIMAL
The layer distance of an edge is the absolute difference between the layer numbers of its source and target node. The layer assignment will minimize the overall sum of the layer distances of all edges in the layout.
public static final byte LAYERING_STRATEGY_HIERARCHICAL_TIGHT_TREE
optimal layering
.
The quality of the result may not be as good as with optimal layering
but it is usually achieved faster.
public static final byte LAYERING_STRATEGY_HIERARCHICAL_DOWNSHIFT
LAYERING_STRATEGY_HIERARCHICAL_TOPMOST
by shifting
some nodes down.
The quality of the result is usually worse than the one produced by
LAYERING_STRATEGY_HIERARCHICAL_TIGHT_TREE
.
public static final byte LAYERING_STRATEGY_BFS
All edges will span at most one layer in the resulting drawing. Edges between nodes that belong to the same layer are possible.
The nodes that will be placed in the first layer can be provided by a
data provider bound to the input graph using the key BFSLayerer.CORE_NODES
.
If this data provider is not given, then nodes that have no incoming edges are placed
in the first layer.
public static final byte LAYERING_STRATEGY_FROM_SKETCH
It tries to find a layering that is similar to the one in the input graph. The layout algorithm may place nodes in the same layer, even though they are connected by an edge.
In a vertically oriented layout, nodes that overlap vertically are placed in the same layer. The same holds for a horizontally oriented layout in the case where the nodes overlap horizontally.
setFromScratchLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_USER_DEFINED
The nodes' layer assignment must be provided by a data provider bound to the input graph
using the key GivenLayersLayerer.LAYER_ID_KEY
.
This layering strategy allows edges whose source and target share a layer.
setFromScratchLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_UNKNOWN
getFromScratchLayeringStrategy()
,
Constant Field Valuespublic static final byte POLICY_ALIGN_GROUPS_TOP
public static final byte POLICY_ALIGN_GROUPS_CENTER
public static final byte POLICY_ALIGN_GROUPS_BOTTOM
Constructor Detail |
---|
public IncrementalHierarchicLayouter()
IncrementalHierarchicLayouter
instance with the default settings.
Method Detail |
---|
public byte getGroupAlignmentPolicy()
setGroupAlignmentPolicy(byte)
,
setRecursiveGroupLayeringEnabled(boolean)
public void setGroupAlignmentPolicy(byte groupAlignmentPolicy)
POLICY_ALIGN_GROUPS_CENTER
. Groups and normal nodes are center aligned.groupAlignmentPolicy
- one of the default group alignment policies
java.lang.IllegalArgumentException
- if an unknown group alignment policy is givengetGroupAlignmentPolicy()
,
setRecursiveGroupLayeringEnabled(boolean)
public boolean isGroupCompactionEnabled()
The number of node layers is decreased if possible without reversing edge directions. The resulting layering tries to keep the layer span of a group node low (i.e., the height of a group for layout orientation top-to-bottom). Note that a lower number of layers usually leads to an increased overall width (for layout orientation top-to-bottom).
TopologicalLayerer
is used for
layer assignment. If this feature is enabled, an alignment policy that is set with
setGroupAlignmentPolicy(byte)
is ignored.SimplexNodePlacer.setGroupCompactionStrategy(int)
.true
if group compaction is active, false
otherwisesetRecursiveGroupLayeringEnabled(boolean)
,
setGroupCompactionEnabled(boolean)
,
SimplexNodePlacer.setGroupCompactionStrategy(int)
public void setGroupCompactionEnabled(boolean groupCompactionEnabled)
The number of node layers is decreased if possible without reversing edge directions. The resulting layering tries to keep the layer span of a group node low (i.e., the height of a group for layout orientation top-to-bottom). Note that a lower number of layers usually leads to an increased overall width (for layout orientation top-to-bottom).
TopologicalLayerer
is used for
layer assignment. If this feature is enabled, an alignment policy that is set with
setGroupAlignmentPolicy(byte)
is ignored.SimplexNodePlacer.setGroupCompactionStrategy(int)
.groupCompactionEnabled
- true
if group compaction is active, false
otherwiseisGroupCompactionEnabled()
,
setRecursiveGroupLayeringEnabled(boolean)
,
SimplexNodePlacer.setGroupCompactionStrategy(int)
false | true |
public byte getComponentArrangementPolicy()
setComponentArrangementPolicy(byte)
public void setComponentArrangementPolicy(byte policy)
COMPONENT_ARRANGEMENT_TOPMOST
. Connected components are aligned with their first layer.policy
- one of the default component arrangement policies
java.lang.IllegalArgumentException
- if the specified policy does not match a default component arrangement policygetComponentArrangementPolicy()
public long getMaximalDuration()
Values have to be greater or equal to 0
.
setMaximalDuration(long)
public void setMaximalDuration(long maximalDuration)
Values have to be greater or equal to 0
.
Long.MAX_VALUE
. The layout algorithm runs unrestricted.maximalDuration
- a non-negative value that specifies the time limit
java.lang.IllegalArgumentException
- if the maximum duration is negativegetMaximalDuration()
public boolean isRecursiveGroupLayeringEnabled()
If this option is enabled, groups are layered recursively, i.e.
If the graph is flat, this setting is ignored.
true
if group information is used, false
otherwisesetRecursiveGroupLayeringEnabled(boolean)
,
setGroupCompactionEnabled(boolean)
public void setRecursiveGroupLayeringEnabled(boolean recursiveGroupLayeringEnabled)
If this option is enabled, groups are layered recursively, i.e.
If the graph is flat, this setting is ignored.
recursiveGroupLayeringEnabled
- true
if group information is used, false
otherwiseisRecursiveGroupLayeringEnabled()
,
setGroupCompactionEnabled(boolean)
false | true |
public double getGridSpacing()
When the spacing is negative or zero, no grid is defined, otherwise nodes and edges are placed on multiples of the grid spacing.
setGridSpacing(double)
,
IncrementalHintsFactory
public void setGridSpacing(double gridSpacing)
When the spacing is negative or zero, no grid is defined, otherwise nodes and edges are placed on multiples of the grid spacing.
public boolean isBackloopRoutingEnabled()
When this option is enabled, back-loops attach to the same node sides as the other edges, i.e., for layout orientation top-to-bottom, they leave their source at the bottom and enter their target at the top.
recursive edge styles
EdgeLayoutDescriptor.RECURSIVE_EDGE_STYLE_DIRECTED
and
EdgeLayoutDescriptor.RECURSIVE_EDGE_STYLE_UNDIRECTED
, including
edges where source or target are not inside a group node.true
if back-loop routing is applied, false
otherwisesetBackloopRoutingEnabled(boolean)
public void setBackloopRoutingEnabled(boolean backLoopRoutingEnabled)
When this option is enabled, back-loops attach to the same node sides as the other edges, i.e., for layout orientation top-to-bottom, they leave their source at the bottom and enter their target at the top.
recursive edge styles
EdgeLayoutDescriptor.RECURSIVE_EDGE_STYLE_DIRECTED
and
EdgeLayoutDescriptor.RECURSIVE_EDGE_STYLE_UNDIRECTED
, including
edges where source or target are not inside a group node.backLoopRoutingEnabled
- true
if back-loop routing should be applied, false
otherwisefalse | true |
public boolean isBackloopRoutingForSelfloopsEnabled()
Self-loops will start at the bottom of their attached nodes and end at the top of them.
true
if self-loops should be routed like
back-loops, false
otherwisesetBackloopRoutingForSelfloopsEnabled(boolean)
,
isBackloopRoutingEnabled()
public void setBackloopRoutingForSelfloopsEnabled(boolean backLoopRoutingForSelfLoopsEnabled)
Self-loops will start at the bottom of their attached nodes and end at the top of them.
backLoopRoutingForSelfLoopsEnabled
- true
if self-loops should be routed like
back-loops, false
otherwiseisBackloopRoutingForSelfloopsEnabled()
,
isBackloopRoutingEnabled()
false | true |
public boolean isAutomaticEdgeGroupingEnabled()
The automatic edge grouping tries to group a high number of edges without changing the semantic of the graph, i.e., it groups edges either at a common source node or a common target node. Edge groupings often allow more compact layouts since grouped edges are routed in a bus-style manner.
port constraints
, port candidates
or port group ids (see PortConstraintKeys.SOURCE_PORT_GROUP_ID_DPKEY
and
PortConstraintKeys.TARGET_PORT_GROUP_ID_DPKEY
) at this node. Furthermore, edges cannot be grouped at a node with
specified port candidate set
.true
if the edge grouping should be applied, false
otherwisesetAutomaticEdgeGroupingEnabled(boolean)
public void setAutomaticEdgeGroupingEnabled(boolean automaticEdgeGroupingEnabled)
The automatic edge grouping tries to group a high number of edges without changing the semantic of the graph, i.e., it groups edges either at a common source node or a common target node. Edge groupings often allow more compact layouts since grouped edges are routed in a bus-style manner.
port constraints
, port candidates
or port group ids (see PortConstraintKeys.SOURCE_PORT_GROUP_ID_DPKEY
and
PortConstraintKeys.TARGET_PORT_GROUP_ID_DPKEY
) at this node. Furthermore, edges cannot be grouped at a node with
specified port candidate set
.automaticEdgeGroupingEnabled
- true
if the edge grouping should be applied, false
otherwiseisAutomaticEdgeGroupingEnabled()
false | true |
public void setOrthogonallyRouted(boolean orthogonal)
When orthogonal routing is enabled, all resulting edge paths will be composed of vertical and horizontal segments, only.
default edge layout descriptor
to orthogonal.orthogonal
- true
if edges are routed orthogonally, false
otherwiseisOrthogonallyRouted()
false | true |
public boolean isOrthogonallyRouted()
When orthogonal routing is enabled, all resulting edge paths will be composed of vertical and horizontal segments, only.
default edge layout descriptor
to orthogonal.true
if edges are routed orthogonally, false
otherwisesetOrthogonallyRouted(boolean)
public void setIntegratedEdgeLabelingEnabled(boolean enabled)
To define the desired placement for each label add a PreferredPlacementDescriptor
on
EdgeLabelLayout
.
This method is a convenience method that assures that the
labeling algorithm
is of type LabelLayoutTranslator
and LabelLayoutTranslator.setTranslateEdgeLabelsEnabled(boolean)
is set to true
.
labeling algorithm
will be
overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property
CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean)
. Therefore, it is recommended to only use this convenience property
instead of manually changing the mentioned other properties.enabled
- true
if integrated edge labeling should be enabled, false
otherwise
java.lang.IllegalStateException
- if integrated labeling should be enabled but the current labeling algorithm
is not of type LabelLayoutTranslator
isIntegratedEdgeLabelingEnabled()
disabled | true |
public boolean isIntegratedEdgeLabelingEnabled()
To define the desired placement for each label add a PreferredPlacementDescriptor
on
EdgeLabelLayout
.
This method is a convenience method that assures that the
labeling algorithm
is of type LabelLayoutTranslator
and LabelLayoutTranslator.setTranslateEdgeLabelsEnabled(boolean)
is set to true
.
labeling algorithm
will be
overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property
CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean)
. Therefore, it is recommended to only use this convenience property
instead of manually changing the mentioned other properties.true
if integrated edge labeling is enabled, false
otherwise
java.lang.IllegalStateException
- if no properly configured LabelLayoutTranslator
is registered even though
integrated labeling was enabled earlier (can happen when manually specifying
the labeling algorithm
).setIntegratedEdgeLabelingEnabled(boolean)
public void setConsiderNodeLabelsEnabled(boolean enabled)
This method is a convenience method that assures that the
labeling algorithm
is of type LabelLayoutTranslator
and
LabelLayoutTranslator.setTranslateNodeLabelsEnabled(boolean)
is set
to true
.
enabled
- true
if the layout algorithm should take the node labels into account, false
otherwise
java.lang.IllegalStateException
- if this property should be enabled but the current labeling algorithm
is not of type LabelLayoutTranslator
false | true |
public boolean isConsiderNodeLabelsEnabled()
This method is a convenience method that assures that the
labeling algorithm
is of type LabelLayoutTranslator
and
LabelLayoutTranslator.setTranslateNodeLabelsEnabled(boolean)
is set
to true
.
true
if the layout algorithm takes the node labels into account, false
otherwise
java.lang.IllegalStateException
- if no properly configured LabelLayoutTranslator
is registered even though
this property was enabled earlier (can happen when manually specifying
the labeling algorithm
).setConsiderNodeLabelsEnabled(boolean)
public void setMinimumLayerDistance(double distance)
The specified distance should have a non-negative value.
public double getMinimumLayerDistance()
The distance should have a non-negative value.
setMinimumLayerDistance(double)
public boolean isStopAfterLayeringEnabled()
By then, each node will be assigned to a layer. Since the sequencing and drawing phases are skipped, the order of the nodes within a layer matches the initial order of the nodes, edges won't be routed and the nodes won't get coordinates assigned.
The calculated layering information can be retrieved from the DataProvider
registered with the key
LAYER_VALUE_HOLDER_DPKEY
.
1
.
Similarly, rows
and columns
of a partition grid do not get proper computed positions and computed height/width values.true
if the layout algorithm should stop after the layering phase,
false
if the complete layout should be calculatedsetStopAfterLayeringEnabled(boolean)
,
LAYER_VALUE_HOLDER_DPKEY
public void setStopAfterLayeringEnabled(boolean stopAfterLayering)
By then, each node will be assigned to a layer. Since the sequencing and drawing phases are skipped, the order of the nodes within a layer matches the initial order of the nodes, edges won't be routed and the nodes won't get coordinates assigned.
The calculated layering information can be retrieved from the DataProvider
registered with the key
LAYER_VALUE_HOLDER_DPKEY
.
1
.
Similarly, rows
and columns
of a partition grid do not get proper computed positions and computed height/width values.stopAfterLayering
- true
if the layout algorithm should stop after the layering phase,
false
if the complete layout should be calculatedLAYER_VALUE_HOLDER_DPKEY
public boolean isStopAfterSequencingEnabled()
By then, each node will be assigned to a layer and will have a place in the sequence of nodes in this layer. Since the drawing phase is skipped, edges won't be routed and the nodes won't get coordinates assigned.
The calculated layering and sequencing information can be retrieved from the DataProvider
s registered
with the keys LAYER_VALUE_HOLDER_DPKEY
and SEQUENCE_VALUE_HOLDER_DPKEY
.
1
.
Similarly, rows
and columns
of a partition grid do not get proper computed positions and computed height/width values.true
if the layout algorithm should stop after the sequencing phase,
false
if the complete layout should be calculatedsetStopAfterSequencingEnabled(boolean)
,
SEQUENCE_VALUE_HOLDER_DPKEY
,
LAYER_VALUE_HOLDER_DPKEY
public void setStopAfterSequencingEnabled(boolean stopAfterSequencing)
By then, each node will be assigned to a layer and will have a place in the sequence of nodes in this layer. Since the drawing phase is skipped, edges won't be routed and the nodes won't get coordinates assigned.
The calculated layering and sequencing information can be retrieved from the DataProvider
s registered
with the keys LAYER_VALUE_HOLDER_DPKEY
and SEQUENCE_VALUE_HOLDER_DPKEY
.
1
.
Similarly, rows
and columns
of a partition grid do not get proper computed positions and computed height/width values.stopAfterSequencing
- true
if the layout algorithm should stop after the sequencing phase,
false
if the complete layout should be calculatedSEQUENCE_VALUE_HOLDER_DPKEY
,
LAYER_VALUE_HOLDER_DPKEY
public void setNodeToNodeDistance(double distance)
All values have to be greater than or equal to 0
.
NodeLayoutDescriptor
instances (see HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY
) with custom
minimum distance
values.distance
- the non-negative minimum distance
java.lang.IllegalArgumentException
- if the distance is negative
java.lang.IllegalStateException
- if the current DrawingDistanceCalculator
is not an instance of
DefaultDrawingDistanceCalculator
getNodeToNodeDistance()
Node distance 10 | Node distance 100 |
public double getNodeToNodeDistance()
All values have to be greater than or equal to 0
.
NodeLayoutDescriptor
instances (see HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY
) with custom
minimum distance
values.setNodeToNodeDistance(double)
public void setNodeToEdgeDistance(double d)
All values have to be greater than or equal to 0
.
NodeLayoutDescriptor
/EdgeLayoutDescriptor
instances (see HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY
and HierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
) with custom minimum distance values.d
- the non-negative minimum distance
java.lang.IllegalArgumentException
- if the distance is negative
java.lang.IllegalStateException
- if the current DrawingDistanceCalculator
is not an instance of
DefaultDrawingDistanceCalculator
getNodeToEdgeDistance()
Node-edge distance 10 | Node-edge distance 100 |
public double getNodeToEdgeDistance()
All values have to be greater than or equal to 0
.
NodeLayoutDescriptor
/EdgeLayoutDescriptor
instances (see HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY
and HierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
) with custom minimum distance values.setNodeToEdgeDistance(double)
public void setEdgeToEdgeDistance(double distance)
All values have to be greater than or equal to 0
.
EdgeLayoutDescriptor
instances (see HierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
) with custom
minimum distance
values.distance
- the non-negative minimum distance
java.lang.IllegalArgumentException
- if the distance is negative
java.lang.IllegalStateException
- if the current DrawingDistanceCalculator
is not an instance of
DefaultDrawingDistanceCalculator
getEdgeToEdgeDistance()
Edge distance 10 | Edge distance 100 |
public double getEdgeToEdgeDistance()
All values have to be greater than or equal to 0
.
EdgeLayoutDescriptor
instances (see HierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
) with custom
minimum distance
values.setEdgeToEdgeDistance(double)
public void setLayerSeparationEnabled(boolean layerSeparationEnabled)
In case layers are not separated, nodes of a layer may extend into adjacent layers. Otherwise, nodes of different layers are strictly separated, i.e., layers are placed below each other.
public boolean isLayerSeparationEnabled()
In case layers are not separated, nodes of a layer may extend into adjacent layers. Otherwise, nodes of different layers are strictly separated, i.e., layers are placed below each other.
true
if layers are separated, false
otherwisesetLayerSeparationEnabled(boolean)
protected DefaultDrawingDistanceCalculator getDefaultDrawingDistanceCalculator()
DefaultDrawingDistanceCalculator
that is registered
with the layout algorithm by default.
DefaultDrawingDistanceCalculator
instance
java.lang.IllegalStateException
- if the current instance returned by HierarchicLayouter.getDrawingDistanceCalculator()
is not an instance of DefaultDrawingDistanceCalculator
protected HierarchicLayouter createHierarchicLayouter()
HierarchicLayouter
instance.
This method may be overridden to create a new HierarchicLayouter
object with different configuration settings.
This factory method provides the initial HierarchicLayouter
instance.
HierarchicLayouter
instancepublic HierarchicLayouter getHierarchicLayouter()
By default, this method will return a HierarchicLayouter
instance created with
createHierarchicLayouter()
.
HierarchicLayouter
instancecreateHierarchicLayouter()
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.
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 such that as much edges of the graph as possible will point to the main layout direction, i.e., the start nodes of the edges will be in a layer with a smaller number than the corresponding end nodes. Also, a hierarchical layering will never put two connected nodes in the same layer.
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.
LAYERING_STRATEGY_HIERARCHICAL_OPTIMAL
strategy
- one of the predefined layering strategies
java.lang.IllegalArgumentException
- if an unknown strategy is givengetFromScratchLayeringStrategy()
public byte getFromScratchLayeringStrategy()
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.
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 such that as much edges of the graph as possible will point to the main layout direction, i.e., the start nodes of the edges will be in a layer with a smaller number than the corresponding end nodes. Also, a hierarchical layering will never put two connected nodes in the same layer.
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.
setFromScratchLayeringStrategy(byte)
public static Edge getOriginalEdge(Edge edge, LayoutDataProvider layoutDataProvider)
This convenience method allows to retrieve the original edge - which is part of the input graph - when customizing the hierarchic layout algorithm and dealing with potentially artificial dummy edges which are inserted during the hierarchical layout procedure.
edge
- the edge for which the original input edge is retrievedlayoutDataProvider
- the layout data provider holding layout information of the hierarchical layout
public boolean canLayoutCore(LayoutGraph graph)
canLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
true
for all input graphspublic void doLayout(LayoutGraph graph)
doLayout
in interface Layouter
doLayout
in class CanonicMultiStageLayouter
graph
- the input graphCanonicMultiStageLayouter.appendStage(LayoutStage)
,
CanonicMultiStageLayouter.prependStage(LayoutStage)
,
CanonicMultiStageLayouter.doLayoutCore(LayoutGraph)
public void doLayoutCore(LayoutGraph graph)
HierarchicLayouter
instance.
IncrementalHierarchicLayouter
applies its own configuration to HierarchicLayouter
and also
prepares the graph for layout.
doLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graphprotected int getMirrorMask()
orientation layouter
.
It may be overridden in order to configure a different mirror mask.
protected void configureCoreLayout(LayoutGraph graph, HierarchicLayouter coreLayouter)
IncrementalHierarchicLayouter
instance.
This method is called by doLayoutCore(LayoutGraph)
before the actual layout is calculated.
It may be overridden in order to manually reconfigure the core layout algorithm.
This implementation will temporarily set a PCListOptimizer
if a DataProvider
is registered with
PortCandidateSet.NODE_DP_KEY
and no HierarchicLayouter.getPortConstraintOptimizer()
is assigned.
unconfigureCoreLayout(LayoutGraph, HierarchicLayouter)
.graph
- the input graphcoreLayouter
- the given core layout algorithm instanceprotected void unconfigureCoreLayout(LayoutGraph graph, HierarchicLayouter coreLayouter)
This method is called by doLayoutCore(LayoutGraph)
after the actual layout is calculated.
It may be overridden in order to revert a custom configuration made in
configureCoreLayout(LayoutGraph, HierarchicLayouter)
.
This implementation will remove the PCListOptimizer
that was created in case a DataProvider
is
registered with PortCandidateSet.NODE_DP_KEY
and no
HierarchicLayouter.getPortConstraintOptimizer()
was initially assigned.
configureCoreLayout(LayoutGraph, HierarchicLayouter)
needs to be removed here.graph
- the input graphcoreLayouter
- the given core layout algorithm instancepublic IncrementalHintsFactory createIncrementalHintsFactory()
IncrementalHintsFactory
instance that must be used
to obtain hints to be associated with graph elements that
should be laid out incrementally.
Use this factory and a DataProvider
that is registered to the graph
using the INCREMENTAL_HINTS_DPKEY
key to associate
appropriate hints with the graph elements that should be laid out
incrementally by the algorithm.
IncrementalHintsFactory
instanceHierarchicLayouter.createIncrementalHintsFactory()
,
INCREMENTAL_HINTS_DPKEY
,
Graph.addDataProvider(Object,DataProvider)
,
setLayoutMode(byte)
,
LAYOUT_MODE_INCREMENTAL
public SequenceConstraintFactory createSequenceConstraintFactory(LayoutGraph graph)
SequenceConstraintFactory
instance that can be used for specifying sequence constraints for the given
graph.
For these sequence constraints to have any effect, the
Sequencer
that determines the
in-layer node order (sequence) has to support constraints. Both,
DefaultLayerSequencer
and the incremental sequencer used internally support sequence constraints.
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 layout:
IncrementalHierarchicLayouter ihl = ...; SequenceConstraintFactory cf = ihl.createSequenceConstraintFactory(null); ... Graph g = ...; g.addDataProvider(SequenceConstraintFactory.SEQUENCE_CONSTRAINTS_MEMENTO_DPKEY, DataProviders.createConstantDataProvider(cf.getMemento())); //Calculate layout
SequenceConstraintFactory
instances have to be
disposed of
after use.
Disposing of the factory will also remove all constraints previously specified for the factory's associated
graph. Creating sequence constraints with a disposed of factory will throw an IllegalStateException
.graph
- the input graph
SequenceConstraintFactory
instancesetFromScratchSequencer(Sequencer)
,
setFixedElementsSequencer(Sequencer)
A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node. | After defining appropriate sequence constraints and running the layout again, the labeled nodes now have their intended placement. |
public LayerConstraintFactory createLayerConstraintFactory(Graph graph)
LayerConstraintFactory
instance that can be used for specifying layer constraints for the given
graph.
The instance is usually bound to Graph
instance graph
, i.e., if the input
graph for the layerer changes, a new instance must be retrieved. This instance can be
used for creating constraints for this graph instance.
You can create an instance 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,
see LayerConstraintFactory.LAYER_CONSTRAINTS_MEMENTO_DPKEY
and
LayerConstraintFactory.getMemento()
.
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 layering constraints with a disposed factory will throw an IllegalStateException
.graph
- the input graph
LayerConstraintFactory
instanceA graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node. | After defining appropriate layer constraints and running the layout again, the labeled nodes now have their intended placement. |
public Layerer getFromScratchLayerer()
Layerer
instance that obtains the layering
for the nodes if the layout algorithm runs in From Scratch mode
.
If the graph consists of multiple components, then the Layerer
instance should be wrapped in
MultiComponentLayerer
.
Layerer
instancesetFromScratchLayerer(Layerer)
,
setLayoutMode(byte)
public void setFromScratchLayerer(Layerer layerer)
Layerer
instance that obtains the layering
for the nodes if the layout algorithm runs in From Scratch mode
.
If the graph consists of multiple components, then the Layerer
instance should be wrapped in
MultiComponentLayerer
.
WeightedLayerer
layerer
- the Layerer
instance
java.lang.IllegalArgumentException
- if the Layerer
is null
setLayoutMode(byte)
public Sequencer getFromScratchSequencer()
Sequencer
instance that calculates the node
sequence if the layout algorithm runs in From Scratch mode
.
Sequencer
instancegetFromScratchLayerer()
,
setLayoutMode(byte)
,
setFromScratchSequencer(Sequencer)
public void setFromScratchSequencer(Sequencer sequencer)
Sequencer
instance that calculates the node
sequence if the layout algorithm runs in From Scratch mode
.
DefaultLayerSequencer
sequencer
- the Sequencer
instance
java.lang.IllegalArgumentException
- if the Sequencer
is null
setFromScratchLayerer(Layerer)
,
setLayoutMode(byte)
public NodePlacer getNodePlacer()
NodePlacer
instance that will calculate the
final node placement of the layout.
NodePlacer
instancesetNodePlacer(NodePlacer)
public void setNodePlacer(NodePlacer nodePlacer)
NodePlacer
instance that will calculate the
final node placement of the layout.
SimplexNodePlacer
nodePlacer
- the NodePlacer
instance
java.lang.IllegalArgumentException
- if the NodePlacer
is null
getNodePlacer()
public Layerer getFixedElementsLayerer()
Layerer
instance that obtains the layering
for fixed nodes during the incremental layout run.
Layerer
instance used for fixed nodessetFixedElementsLayerer(Layerer)
,
setLayoutMode(byte)
public void setFixedElementsLayerer(Layerer fixedElementsLayerer)
Layerer
instance that obtains the layering
for fixed nodes during the incremental layout run.
AsIsLayerer
fixedElementsLayerer
- the Layerer
instance used for fixed nodes
java.lang.IllegalArgumentException
- if the Layerer
is null
setLayoutMode(byte)
public Sequencer getFixedElementsSequencer()
Sequencer
instance that calculates the sequence
of the fixed nodes during the incremental layout run.
Sequencer
instance used for fixed elementssetFixedElementsSequencer(Sequencer)
,
setLayoutMode(byte)
public void setFixedElementsSequencer(Sequencer fixedElementsSequencer)
Sequencer
instance that calculates the sequence
of the fixed nodes during the incremental layout run.
AsIsSequencer
fixedElementsSequencer
- the Sequencer
instance used for fixed elements
java.lang.IllegalArgumentException
- if the given Sequencer
is null
setLayoutMode(byte)
public byte getLayoutMode()
Depending on the mode the layout algorithm will use different
Layerer
and Sequencer
implementations.
setLayoutMode(byte)
,
getFromScratchLayerer()
,
getFromScratchSequencer()
,
getFixedElementsLayerer()
,
getFixedElementsSequencer()
public void setLayoutMode(byte layoutMode)
Depending on the mode the layout algorithm will use different
Layerer
and Sequencer
implementations.
LAYOUT_MODE_FROM_SCRATCH
layoutMode
- the new layout mode
java.lang.IllegalArgumentException
- if the given layout mode is unknowngetLayoutMode()
,
getFromScratchLayerer()
,
getFromScratchSequencer()
,
getFixedElementsLayerer()
,
getFixedElementsSequencer()
protected EdgeLayoutDescriptor createEdgeLayoutDescriptor()
EdgeLayoutDescriptor
instance that will be used during the various
phases of the layout algorithm to determine the drawing details of the edges of the graph.
This method may be overridden to create a new EdgeLayoutDescriptor
instance with
different configuration settings.
EdgeLayoutDescriptor
instancepublic EdgeLayoutDescriptor getEdgeLayoutDescriptor()
EdgeLayoutDescriptor
instance used for all those
edges that do not have a specific layout descriptor assigned.
By default, this method will return a EdgeLayoutDescriptor
instance created with
createEdgeLayoutDescriptor()
.
EdgeLayoutDescriptor
instancesetEdgeLayoutDescriptor(EdgeLayoutDescriptor)
,
HierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
public void setEdgeLayoutDescriptor(EdgeLayoutDescriptor edgeLayoutDescriptor)
EdgeLayoutDescriptor
instance used for all those
edges that do not have a specific layout descriptor assigned.
EdgeLayoutDescriptor
edgeLayoutDescriptor
- the current EdgeLayoutDescriptor
instance
java.lang.IllegalArgumentException
- if the EdgeLayoutDescriptor
is null
HierarchicLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
protected NodeLayoutDescriptor createNodeLayoutDescriptor()
NodeLayoutDescriptor
instance that will be used during the various
phases of the layout algorithm to determine the drawing details of the nodes of the graph.
This method may be overridden to create a new NodeLayoutDescriptor
instance with
different configuration settings.
NodeLayoutDescriptor
instancepublic NodeLayoutDescriptor getNodeLayoutDescriptor()
NodeLayoutDescriptor
instance used for all those
nodes that do not have a specific layout descriptor assigned.
By default, this method will return a NodeLayoutDescriptor
instance created with
createNodeLayoutDescriptor()
.
NodeLayoutDescriptor
instancesetNodeLayoutDescriptor(NodeLayoutDescriptor)
,
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.
NodeLayoutDescriptor
nodeLayoutDescriptor
- the current NodeLayoutDescriptor
instance
java.lang.IllegalArgumentException
- if the given NodeLayoutDescriptor
is null
HierarchicLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY
,
createNodeLayoutDescriptor()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |