public class HierarchicLayoutCore extends MultiStageLayout
Note that class HierarchicLayout
offers a facade to this class which is easier to use. Hence, we strongly
recommend to not directly use class HierarchicLayoutCore
.
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
Layerer
. 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.
Sequencer
.
In order to customize this layout algorithm, modify the Layerer
,
Sequencer
, PortAllocator
,
DrawingDistanceCalculator
, and NodePlacer
instances.
This layout algorithm is able to incrementally add new elements to an existing drawing of a graph. In order to add
elements incrementally, register a IDataProvider
with the graph using the INCREMENTAL_HINTS_DPKEY
DataProvider key and associate the hints obtained from the IIncrementalHintsFactory
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 IDataProvider
s registered with NODE_LAYOUT_DESCRIPTOR_DPKEY
or
EDGE_LAYOUT_DESCRIPTOR_DPKEY
.
HierarchicLayoutCore
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 layouter 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. 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.
This algorithm specifies a LabelLayoutTranslator
instance as the current Labeling
and configures it such that the node labels are passed to it by setting NodeLabelTranslationEnabled
to true
.
In order to enable integrated edge labeling of this algorithm, make sure LabelLayoutTranslator
is registered and
edge labels are being translated and written back after the layout.
Moreover, this algorithm supports layer and sequence constraints. These constraints can be specified using a ILayerConstraintFactory
and ISequenceConstraintFactory
, respectively.
Modifier and Type | Field and Description |
---|---|
static EdgeDpKey<EdgeLayoutDescriptor> |
EDGE_LAYOUT_DESCRIPTOR_DPKEY
A
DataProvider key for providing layout information for each edge
|
static GraphObjectDpKey<Object> |
INCREMENTAL_HINTS_DPKEY
A
DataProvider key for specifying incremental hints
Incremental hints are created using an incremental hints factory . |
static NodeDpKey<Boolean> |
INCREMENTAL_NODES_DPKEY
A
DataProvider key for internal use only.
|
static NodeDpKey<Integer> |
LAYER_INDEX_DPKEY
A
DataAcceptor key for publishing the layer IDs for all nodes in the graph.
|
static NodeDpKey<NodeLayoutDescriptor> |
NODE_LAYOUT_DESCRIPTOR_DPKEY
A
DataProvider key for providing layout information for each node
|
static NodeDpKey<Integer> |
SEQUENCE_INDEX_DPKEY
A
DataAcceptor key for publishing the index inside their layer for all nodes in the graph.
|
static NodeDpKey<SwimlaneDescriptor> |
SWIMLANE_DESCRIPTOR_DPKEY
A
DataProvider key for providing information about swimlanes
If this key is present during the layout, the layout algorithm will arrange nodes in swimlanes. |
Constructor and Description |
---|
HierarchicLayoutCore()
Creates a new
HierarchicLayoutCore instance with the default settings. |
Modifier and Type | Method and Description |
---|---|
void |
applyLayoutCore(LayoutGraph graph)
Calculates a hierarchic layout of the given graph.
|
protected IDrawingDistanceCalculator |
createDrawingDistanceCalculator()
Factory method that is called lazily upon first usage by
DrawingDistanceCalculator
if the given IDrawingDistanceCalculator instance is null . |
protected IEdgeReverser |
createEdgeReverser()
Factory method called during
applyLayoutCore(LayoutGraph) and reates an appropriate IEdgeReverser
implementation. |
protected GroupingSupport |
createGrouping(LayoutGraph graph)
Factory method that is called during
applyLayoutCore(LayoutGraph) and creates a GroupingSupport
instance in case of a grouped graph. |
IIncrementalHintsFactory |
createIncrementalHintsFactory()
Creates an
IIncrementalHintsFactory implementation used for obtaining hint objects associated with nodes and
edges of the graph prior to the invocation of the layout algorithm. |
protected ILayerer |
createIncrementalLayerer()
Factory method called during
applyLayoutCore(LayoutGraph) and creates an appropriate ILayerer
implementation. |
protected void |
createItemData(LayoutGraph g,
IItemFactory itemFactory)
Callback method that is called during
applyLayoutCore(LayoutGraph) , creates the INodeData and IEdgeData
instances and binds them to the elements using the given itemFactory . |
ILayerConstraintFactory |
createLayerConstraintFactory(Graph graph)
Creates a
layer constraint factory that allows to create hints that affect the
assignment of the nodes to layers. |
protected ILayerer |
createLayerer()
|
protected ILayers |
createLayers(ILayoutDataProvider ldp)
Factory method called during
applyLayoutCore(LayoutGraph) and creates an appropriate ILayers
implementation using the given ILayoutDataProvider instance. |
protected INodePlacer |
createNodePlacer()
Factory method that is called lazily upon first usage by
NodePlacer if the given INodePlacer
instance is null . |
protected IPortAllocator |
createPortAllocator()
Factory method that is called lazily upon first usage by
PortAllocator if the given IPortAllocator
instance is null . |
protected IPortConstraintOptimizer |
createPortConstraintOptimizer()
Factory method that is called lazily upon first usage by
PortConstraintOptimizer
if the given IPortConstraintOptimizer instance is null . |
ISequenceConstraintFactory |
createSequenceConstraintFactory(Graph graph)
Creates sequence constraints that affect the sequence of the nodes within each layer.
|
protected ISequencer |
createSequencer()
Factory method that is called lazily upon first usage by
Sequencer if the given ISequencer
instance is null . |
protected ISequencer |
createSubgraphLayerSequencer()
Factory method called during
applyLayoutCore(LayoutGraph) and creates a ISequencer implementation that
can sequence subgraphs incrementally. |
Object |
getAlgorithmProperty(Object key)
Provides access to implementation specific properties of the algorithms used.
|
protected ILayoutStage |
getCreateLabelLayout()
Factory method called during the initialization of this
HierarchicLayoutCore instance that creates a
label layouter . |
IDrawingDistanceCalculator |
getDrawingDistanceCalculator()
Gets the
IDrawingDistanceCalculator instance responsible for determining the minimum distances between elements
that belong to the same layer. |
protected IDataProvider |
getEdgeLayoutDescriptors(LayoutGraph graph)
Callback method called during
applyLayoutCore(LayoutGraph) and returns a IDataProvider that holds the EdgeLayoutDescriptor
information. |
double |
getGridSpacing()
Gets the equidistant spacing between the horizontal and vertical grid lines.
|
protected IDataProvider |
getIncrementalHints(LayoutGraph graph)
Callback method called during
applyLayoutCore(LayoutGraph) and returns a IDataProvider that holds the
com.yworks.yfiles.layout.hierarchic.HierarchicLayoutCore.IncrementalHint s information. |
ILayerer |
getLayerer()
Gets the
ILayerer instance responsible for generating the layer assignment (first phase of the layout
algorithm). |
long |
getMaximumDuration()
Gets the time limit (in milliseconds) set for the layout algorithm.
|
protected IDataProvider |
getNodeLayoutDescriptors(LayoutGraph graph)
Callback method called during
applyLayoutCore(LayoutGraph) and returns a IDataProvider that holds the NodeLayoutDescriptor
information. |
INodePlacer |
getNodePlacer()
Gets the
INodePlacer instance responsible for the assignment of the x-(sequence) and preliminary y-coordinates
of the nodes. |
IPortAllocator |
getPortAllocator()
Gets the
IPortAllocator instance responsible for assigning port coordinates to the adjacent edges of each node. |
IPortConstraintOptimizer |
getPortConstraintOptimizer()
Gets the
IPortConstraintOptimizer instance responsible for optimizing the assignment of port constraints to the
adjacent edges of each node. |
ISequencer |
getSequencer()
Gets the
ISequencer instance responsible for calculating the sequence of nodes within each layer (second phase
of the layout algorithm). |
protected IDataProvider |
getSwimLaneDescriptors(LayoutGraph graph)
Callback method called during
applyLayoutCore(LayoutGraph) and returns a IDataProvider that holds the SwimlaneDescriptor
information. |
boolean |
isComponentLayoutEnabled()
Gets whether or not the
ComponentLayout should be enabled. |
protected void |
publishLayers(LayoutGraph graph,
ILayers layers)
Callback method that publishes the layering information.
|
protected void |
publishSequences(LayoutGraph graph,
ILayers layers,
ILayoutDataProvider ldp)
Callback method that publishes the sequencing information.
|
protected void |
reduceBendCount(LayoutGraph graph)
Removes the bends which are obviously not necessary.
|
protected void |
reduceBendCount(LayoutGraph graph,
double bendReductionThreshold)
Removes the bends which are obviously not necessary.
|
void |
setAlgorithmProperty(Object key,
Object value)
Provides access to implementation specific properties of the algorithms used.
|
void |
setComponentLayoutEnabled(boolean value)
Sets whether or not the
ComponentLayout should be enabled. |
void |
setDrawingDistanceCalculator(IDrawingDistanceCalculator value)
Sets the
IDrawingDistanceCalculator instance responsible for determining the minimum distances between elements
that belong to the same layer. |
void |
setGridSpacing(double value)
Sets the equidistant spacing between the horizontal and vertical grid lines.
|
void |
setLayerer(ILayerer value)
Sets the
ILayerer instance responsible for generating the layer assignment (first phase of the layout
algorithm). |
void |
setMaximumDuration(long value)
Sets the time limit (in milliseconds) set for the layout algorithm.
|
void |
setNodePlacer(INodePlacer value)
Sets the
INodePlacer instance responsible for the assignment of the x-(sequence) and preliminary y-coordinates
of the nodes. |
void |
setPortAllocator(IPortAllocator value)
Sets the
IPortAllocator instance responsible for assigning port coordinates to the adjacent edges of each node. |
void |
setPortConstraintOptimizer(IPortConstraintOptimizer value)
Sets the
IPortConstraintOptimizer instance responsible for optimizing the assignment of port constraints to the
adjacent edges of each node. |
void |
setSequencer(ISequencer value)
Sets the
ISequencer instance responsible for calculating the sequence of nodes within each layer (second phase
of the layout algorithm). |
appendStage, applyLayout, checkNodeSize, disableAllStages, getComponentLayout, getHideGroupsStage, getLabeling, getLayoutOrientation, getOrientationLayout, getParallelEdgeRouter, getSelfLoopRouter, getSubgraphLayout, isHideGroupsStageEnabled, isLabelingEnabled, isOrientationLayoutEnabled, isParallelEdgeRouterEnabled, isSelfLoopRouterEnabled, isSubgraphLayoutEnabled, prependStage, removeStage, setComponentLayout, setHideGroupsStage, setHideGroupsStageEnabled, setLabeling, setLabelingEnabled, setLayoutOrientation, setOrientationLayout, setOrientationLayoutEnabled, setParallelEdgeRouter, setParallelEdgeRouterEnabled, setSelfLoopRouter, setSelfLoopRouterEnabled, setSubgraphLayout, setSubgraphLayoutEnabled
public static final EdgeDpKey<EdgeLayoutDescriptor> EDGE_LAYOUT_DESCRIPTOR_DPKEY
DataProvider
key for providing layout information for each edge
IEdgeData.getEdgeLayoutDescriptor()
public static final GraphObjectDpKey<Object> INCREMENTAL_HINTS_DPKEY
DataProvider
key for specifying incremental hints
Incremental hints are created using an incremental hints factory
.
INCREMENTAL_HINTS_DPKEY
,
IIncrementalHintsFactory
public static final NodeDpKey<Boolean> INCREMENTAL_NODES_DPKEY
DataProvider
key for internal use only.
public static final NodeDpKey<Integer> LAYER_INDEX_DPKEY
DataAcceptor
key for publishing the layer IDs for all nodes in the graph.
IDataProvider
is registered with this key, the layer information of the nodes is dropped.HierarchicLayout.LAYER_INDEX_DPKEY
public static final NodeDpKey<NodeLayoutDescriptor> NODE_LAYOUT_DESCRIPTOR_DPKEY
DataProvider
key for providing layout information for each node
INodeData.getNodeLayoutDescriptor()
public static final NodeDpKey<Integer> SEQUENCE_INDEX_DPKEY
DataAcceptor
key for publishing the index inside their layer for all nodes in the graph.
IDataProvider
is registered with this key, the sequence information of the nodes is dropped.HierarchicLayout.SEQUENCE_INDEX_DPKEY
public static final NodeDpKey<SwimlaneDescriptor> SWIMLANE_DESCRIPTOR_DPKEY
DataProvider
key for providing information about swimlanes
If this key is present during the layout, the layout algorithm will arrange nodes in swimlanes. The information about the swimlanes is finally written back to the descriptor instances.
Instances can be shared among multiple nodes in the same lane, but don't have to be shared.
public HierarchicLayoutCore()
HierarchicLayoutCore
instance with the default settings.public void applyLayoutCore(LayoutGraph graph)
applyLayoutCore
in class MultiStageLayout
graph
- the input graphprotected IDrawingDistanceCalculator createDrawingDistanceCalculator()
DrawingDistanceCalculator
if the given IDrawingDistanceCalculator
instance is null
.
The default implementation returns a DefaultDrawingDistanceCalculator
instance. It may be overridden to return a
custom DefaultDrawingDistanceCalculator
instance.
IDrawingDistanceCalculator
will make the properties
NodeToNodeDistance
, NodeToEdgeDistance
and EdgeToEdgeDistance
superfluous. Those properties delegate to
DefaultDrawingDistanceCalculator
and will throw an IllegalStateException
if a different class is
used. Adjustments of those distances need to be done directly on the custom implementation of
IDrawingDistanceCalculator
.IDrawingDistanceCalculator
instancegetDrawingDistanceCalculator()
protected IEdgeReverser createEdgeReverser()
applyLayoutCore(LayoutGraph)
and reates an appropriate IEdgeReverser
implementation.
By default, a suitable private implementation of IEdgeReverser
is returned. It may be overridden to return a
custom IEdgeReverser
implementation.
protected GroupingSupport createGrouping(LayoutGraph graph)
applyLayoutCore(LayoutGraph)
and creates a GroupingSupport
instance in case of a grouped graph.graph
- the input graphGroupingSupport
instance or null
if the graph is not groupedpublic IIncrementalHintsFactory createIncrementalHintsFactory()
IIncrementalHintsFactory
implementation used for obtaining hint objects associated with nodes and
edges of the graph prior to the invocation of the layout algorithm.
com.yworks.yfiles.layout.hierarchic.HierarchicLayoutCore.IncrementalHint
s can be obtained from a IDataProvider
that is registered with the graph using key
INCREMENTAL_HINTS_DPKEY
.
IIncrementalHintsFactory
instanceINCREMENTAL_HINTS_DPKEY
protected ILayerer createIncrementalLayerer()
applyLayoutCore(LayoutGraph)
and creates an appropriate ILayerer
implementation.
By default, a ConstraintIncrementalLayerer
instance with a TopologicalLayerer
instance as argument is
returned. This method may be overridden to return a custom ILayerer
implementation.
ILayerer
implementationprotected void createItemData(LayoutGraph g, IItemFactory itemFactory)
applyLayoutCore(LayoutGraph)
, creates the INodeData
and IEdgeData
instances and binds them to the elements using the given itemFactory
.g
- the input graphitemFactory
- the given IItemFactory
instancepublic ILayerConstraintFactory createLayerConstraintFactory(Graph graph)
layer constraint factory
that allows to create hints that affect the
assignment of the nodes to layers.
By default, a suitable private implementation of ILayerConstraintFactory
is returned.
graph
- the given graphILayerConstraintFactory
instanceprotected ILayerer createLayerer()
Layerer
if no ILayerer
instance
is given as input.
The default implementation returns a new MultiComponentLayerer(new WeightedLayerer())
instance. It may be
overridden to return a custom ILayerer
instance.
ILayerer
instancegetLayerer()
,
MultiComponentLayerer
,
WeightedLayerer
protected ILayers createLayers(ILayoutDataProvider ldp)
applyLayoutCore(LayoutGraph)
and creates an appropriate ILayers
implementation using the given ILayoutDataProvider
instance.
By default, a suitable private implementation of ILayers
is returned. It may be overridden to return custom
implementations of the ILayers
interface.
ldp
- the given ILayoutDataProvider
instanceILayers
implementationprotected INodePlacer createNodePlacer()
NodePlacer
if the given INodePlacer
instance is null
.
The default implementation returns a SimplexNodePlacer
instance. It may be overridden to return a custom INodePlacer
instance.
INodePlacer
instancegetNodePlacer()
,
SimplexNodePlacer
protected IPortAllocator createPortAllocator()
PortAllocator
if the given IPortAllocator
instance is null
.
The default implementation returns a DefaultPortAllocator
instance. It may be overridden to return a custom IPortAllocator
instance.
IPortAllocator
instancegetPortAllocator()
protected IPortConstraintOptimizer createPortConstraintOptimizer()
PortConstraintOptimizer
if the given IPortConstraintOptimizer
instance is null
.
The default implementation returns null
. It may be overridden to return a custom IPortConstraintOptimizer
instance.
null
getPortConstraintOptimizer()
public ISequenceConstraintFactory createSequenceConstraintFactory(Graph graph)
By default, a suitable private implementation of ISequenceConstraintFactory
is returned.
graph
- the given graphISequenceConstraintFactory
instanceprotected ISequencer createSequencer()
Sequencer
if the given ISequencer
instance is null
.
The default implementation returns a DefaultLayerSequencer
instance. It may be overridden to return a custom ISequencer
instance.
ISequencer
instancegetSequencer()
,
DefaultLayerSequencer
protected ISequencer createSubgraphLayerSequencer()
applyLayoutCore(LayoutGraph)
and creates a ISequencer
implementation that
can sequence subgraphs incrementally.
By default, a suitable private implementation of ISequencer
is returned. It may be overridden to return custom
implementations of the ISequencer
interface.
ISequencer
implementationpublic Object getAlgorithmProperty(Object key)
Used for internal purposes.
key
- the key to a propertynull
setAlgorithmProperty(Object, Object)
protected ILayoutStage getCreateLabelLayout()
HierarchicLayoutCore
instance that creates a
label layouter
.
In order to use the integrated node label awareness feature one has to use a LabelLayoutTranslator
instance and
set NodeLabelTranslationEnabled
to true
.
Likewise, in order to make use of the integrated edge labeling EdgeLabelTranslationEnabled
must be set to true
and also WritingBackEdgeLabelsEnabled
must be set to true
(which is the default).
LabelLayoutTranslator
instancepublic IDrawingDistanceCalculator getDrawingDistanceCalculator()
IDrawingDistanceCalculator
instance responsible for determining the minimum distances between elements
that belong to the same layer.
To set the default port allocator, see createDrawingDistanceCalculator()
.
IllegalArgumentException
- if the specified IDrawingDistanceCalculator
is null
IDrawingDistanceCalculator
will make the properties
NodeToNodeDistance
, NodeToEdgeDistance
and EdgeToEdgeDistance
superfluous. Those properties delegate to
DefaultDrawingDistanceCalculator
and will throw an IllegalStateException
if a different class is
used. Adjustments of those distances need to be done directly on the custom implementation of
IDrawingDistanceCalculator
.IDrawingDistanceCalculator
instancecreateDrawingDistanceCalculator()
,
setDrawingDistanceCalculator(IDrawingDistanceCalculator)
protected IDataProvider getEdgeLayoutDescriptors(LayoutGraph graph)
applyLayoutCore(LayoutGraph)
and returns a IDataProvider
that holds the EdgeLayoutDescriptor
information.
The IDataProvider
holding the information about the node layout is registered with the graph using key
EDGE_LAYOUT_DESCRIPTOR_DPKEY
.
graph
- the input graphIDataProvider
instance or null
EdgeLayoutDescriptor
,
EDGE_LAYOUT_DESCRIPTOR_DPKEY
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.
IIncrementalHintsFactory
,
setGridSpacing(double)
protected IDataProvider getIncrementalHints(LayoutGraph graph)
applyLayoutCore(LayoutGraph)
and returns a IDataProvider
that holds the
com.yworks.yfiles.layout.hierarchic.HierarchicLayoutCore.IncrementalHint
s information.
The IDataProvider
holding the information about com.yworks.yfiles.layout.hierarchic.HierarchicLayoutCore.IncrementalHint
s is registered with the graph using key
INCREMENTAL_HINTS_DPKEY
.
graph
- the input graphIDataProvider
instance or null
INCREMENTAL_HINTS_DPKEY
public ILayerer getLayerer()
ILayerer
instance responsible for generating the layer assignment (first phase of the layout
algorithm).
To set the default layerer, see createLayerer()
.
IllegalArgumentException
- if the specified ILayerer
is null
ILayerer
instancecreateLayerer()
,
setLayerer(ILayerer)
public long getMaximumDuration()
Values have to be greater than or equal to 0
.
IllegalArgumentException
- if the maximum duration is negativeLong.MAX_VALUE
. The layout algorithm runs unrestricted.setMaximumDuration(long)
protected IDataProvider getNodeLayoutDescriptors(LayoutGraph graph)
applyLayoutCore(LayoutGraph)
and returns a IDataProvider
that holds the NodeLayoutDescriptor
information.
The IDataProvider
holding the information about the node layout is registered with the graph using key
NODE_LAYOUT_DESCRIPTOR_DPKEY
.
graph
- the input graphIDataProvider
instance or null
NodeLayoutDescriptor
,
NODE_LAYOUT_DESCRIPTOR_DPKEY
public INodePlacer getNodePlacer()
INodePlacer
instance responsible for the assignment of the x-(sequence) and preliminary y-coordinates
of the nodes.
To set the default node placer, see createNodePlacer()
.
IllegalArgumentException
- if the specified INodePlacer
is null
INodePlacer
instancecreateNodePlacer()
,
setNodePlacer(INodePlacer)
public IPortAllocator getPortAllocator()
IPortAllocator
instance responsible for assigning port coordinates to the adjacent edges of each node.
To set the default port allocator, see createPortAllocator()
.
IllegalArgumentException
- if the specified IPortAllocator
is null
IPortAllocator
instancecreatePortAllocator()
,
setPortAllocator(IPortAllocator)
public IPortConstraintOptimizer getPortConstraintOptimizer()
IPortConstraintOptimizer
instance responsible for optimizing the assignment of port constraints to the
adjacent edges of each node.
To set the default port allocator, see createPortConstraintOptimizer()
.
IPortConstraintOptimizer
instancecreatePortConstraintOptimizer()
,
setPortConstraintOptimizer(IPortConstraintOptimizer)
public ISequencer getSequencer()
ISequencer
instance responsible for calculating the sequence of nodes within each layer (second phase
of the layout algorithm).
To set the default sequencer, see createSequencer()
.
IllegalArgumentException
- if the specified ISequencer
is null
ISequencer
instancecreateSequencer()
,
setSequencer(ISequencer)
protected IDataProvider getSwimLaneDescriptors(LayoutGraph graph)
applyLayoutCore(LayoutGraph)
and returns a IDataProvider
that holds the SwimlaneDescriptor
information.
The IDataProvider
holding the information about swimlanes is registered with the graph using key
SWIMLANE_DESCRIPTOR_DPKEY
.
graph
- the input graphIDataProvider
instance or null
SwimlaneDescriptor
,
SWIMLANE_DESCRIPTOR_DPKEY
public boolean isComponentLayoutEnabled()
ComponentLayout
should be enabled.isComponentLayoutEnabled
in class MultiStageLayout
false
. ComponentLayout
is disabled.true
if ComponentLayout
is enabled, false
otherwisesetComponentLayoutEnabled(boolean)
protected void publishLayers(LayoutGraph graph, ILayers layers)
The layering information is stored in a IDataProvider
registered with the graph using key
LAYER_INDEX_DPKEY
.
graph
- the input graphlayers
- the ILayers
implementation that provides the layering informationLAYER_INDEX_DPKEY
protected void publishSequences(LayoutGraph graph, ILayers layers, ILayoutDataProvider ldp)
The sequencing information is stored in a IDataProvider
registered with the graph using key
SEQUENCE_INDEX_DPKEY
.
graph
- the input graphlayers
- the ILayers
implementation that provides the layering informationldp
- the ILayoutDataProvider
implementation which provides access to the INodeData
and IEdgeData
instancesLAYER_INDEX_DPKEY
protected void reduceBendCount(LayoutGraph graph)
By default, this method removes collinear bends from the graph. A bend point is considered to be collinear if it lies on a line with its preceding and succeeding bend point. It may be overridden for a custom implementation of bend removal.
graph
- the input graphprotected void reduceBendCount(LayoutGraph graph, double bendReductionThreshold)
By default, this method removes collinear bends from the graph. A bend point is considered to be collinear if it lies on a line with its preceding and succeeding bend point. It may be overridden for a custom implementation of bend removal.
graph
- the input graphbendReductionThreshold
- this method removes a bend, if its horizontal/vertical distance to the closest collinear bend is above this valuepublic void setAlgorithmProperty(Object key, Object value)
Used for internal purposes.
key
- the key to a propertyvalue
- the value to associate with the keysetAlgorithmProperty(Object, Object)
public void setComponentLayoutEnabled(boolean value)
ComponentLayout
should be enabled.setComponentLayoutEnabled
in class MultiStageLayout
false
. ComponentLayout
is disabled.value
- true
if ComponentLayout
is enabled, false
otherwiseisComponentLayoutEnabled()
public void setDrawingDistanceCalculator(IDrawingDistanceCalculator value)
IDrawingDistanceCalculator
instance responsible for determining the minimum distances between elements
that belong to the same layer.
To set the default port allocator, see createDrawingDistanceCalculator()
.
IllegalArgumentException
- if the specified IDrawingDistanceCalculator
is null
IDrawingDistanceCalculator
will make the properties
NodeToNodeDistance
, NodeToEdgeDistance
and EdgeToEdgeDistance
superfluous. Those properties delegate to
DefaultDrawingDistanceCalculator
and will throw an IllegalStateException
if a different class is
used. Adjustments of those distances need to be done directly on the custom implementation of
IDrawingDistanceCalculator
.value
- the given IDrawingDistanceCalculator
instancecreateDrawingDistanceCalculator()
,
getDrawingDistanceCalculator()
public void setGridSpacing(double value)
When the spacing is negative or zero, no grid is defined, otherwise nodes and edges are placed on multiples of the grid spacing.
value
- the grid spacingIIncrementalHintsFactory
,
getGridSpacing()
public void setLayerer(ILayerer value)
ILayerer
instance responsible for generating the layer assignment (first phase of the layout
algorithm).
To set the default layerer, see createLayerer()
.
IllegalArgumentException
- if the specified ILayerer
is null
value
- the current ILayerer
instancecreateLayerer()
,
getLayerer()
public void setMaximumDuration(long value)
Values have to be greater than or equal to 0
.
IllegalArgumentException
- if the maximum duration is negativeLong.MAX_VALUE
. The layout algorithm runs unrestricted.value
- a non-negative value that specifies the time limitgetMaximumDuration()
public void setNodePlacer(INodePlacer value)
INodePlacer
instance responsible for the assignment of the x-(sequence) and preliminary y-coordinates
of the nodes.
To set the default node placer, see createNodePlacer()
.
IllegalArgumentException
- if the specified INodePlacer
is null
value
- the current INodePlacer
instancecreateNodePlacer()
,
getNodePlacer()
public void setPortAllocator(IPortAllocator value)
IPortAllocator
instance responsible for assigning port coordinates to the adjacent edges of each node.
To set the default port allocator, see createPortAllocator()
.
IllegalArgumentException
- if the specified IPortAllocator
is null
value
- the current IPortAllocator
instancecreatePortAllocator()
,
getPortAllocator()
public void setPortConstraintOptimizer(IPortConstraintOptimizer value)
IPortConstraintOptimizer
instance responsible for optimizing the assignment of port constraints to the
adjacent edges of each node.
To set the default port allocator, see createPortConstraintOptimizer()
.
value
- the current IPortConstraintOptimizer
instancecreatePortConstraintOptimizer()
,
getPortConstraintOptimizer()
public void setSequencer(ISequencer value)
ISequencer
instance responsible for calculating the sequence of nodes within each layer (second phase
of the layout algorithm).
To set the default sequencer, see createSequencer()
.
IllegalArgumentException
- if the specified ISequencer
is null
value
- the current ISequencer
instancecreateSequencer()
,
getSequencer()