public class DendrogramNodePlacer extends Object implements IFromSketchNodePlacer
DendrogramNodePlacer
arranges subtrees as dendrograms.
INodePlacer
arranges nodes from top to bottom. It arranges subtrees in such a way
that all subtrees of a single local root are aligned with their bottom border.
Note: This implementation does not support PortConstraint
s.
Constructor and Description |
---|
DendrogramNodePlacer()
Creates a new
DendrogramNodePlacer instance with default settings. |
Modifier and Type | Method and Description |
---|---|
Comparator<Object> |
createComparator()
Creates a
Comparator that sorts outgoing edges according to the x-coordinate of their target nodes. |
Comparator<Object> |
createFromSketchComparator()
Creates a
Comparator for the edges which takes the initial x-coordinates of the nodes into account. |
IProcessor |
createProcessor(TreeLayout layouter,
LayoutGraph graph,
Node currentRoot)
Creates an optional
IProcessor for pre- and post-processing. |
void |
determineChildConnectors(Node localRoot,
IDataMap connectorMap)
Provides
ParentConnectorDirection.NORTH for all children. |
double |
getMinimumRootDistance()
Gets the minimum distance between the
TreeLayout.SubtreeShape of a root node and the bus connecting to all of
its children. |
double |
getMinimumSubtreeDistance()
Gets the minimum horizontal distance between adjacent
SubtreeShapes . |
TreeLayout.SubtreeShape |
placeSubtree(IDataProvider nodeShapeProvider,
IDataProvider subtreeShapeProvider,
LayoutGraph graph,
Node localRoot,
ParentConnectorDirection parentConnectorDirection)
Arranges the
SubtreeShapes of the local root and its children as a dendrogram. |
void |
setMinimumRootDistance(double value)
Sets the minimum distance between the
TreeLayout.SubtreeShape of a root node and the bus connecting to all of
its children. |
void |
setMinimumSubtreeDistance(double value)
Sets the minimum horizontal distance between adjacent
SubtreeShapes . |
public DendrogramNodePlacer()
DendrogramNodePlacer
instance with default settings.public Comparator<Object> createComparator()
Comparator
that sorts outgoing edges according to the x-coordinate of their target nodes.
This Comparator
can be used for achieving a From Sketch layout.
Comparator
createFromSketchComparator()
public Comparator<Object> createFromSketchComparator()
Comparator
for the edges which takes the initial x-coordinates of the nodes into account.
This implementation delegates to createComparator()
.
createFromSketchComparator
in interface IFromSketchNodePlacer
Comparator
for the edgescreateComparator()
public IProcessor createProcessor(TreeLayout layouter, LayoutGraph graph, Node currentRoot)
IProcessor
for pre- and post-processing.
This implementation returns null
. Hence, no pre- or post-processing is done.
createProcessor
in interface INodePlacer
layouter
- the current TreeLayout
instancegraph
- the input graphcurrentRoot
- the root node handled by this INodePlacer
null
public void determineChildConnectors(Node localRoot, IDataMap connectorMap)
ParentConnectorDirection.NORTH
for all children.
Edges will always connect to the top of the child nodes.
determineChildConnectors
in interface INodePlacer
localRoot
- the local root nodeconnectorMap
- the map that is used for storing the direction specifiers of the child nodespublic double getMinimumRootDistance()
TreeLayout.SubtreeShape
of a root node and the bus connecting to all of
its children.
The distance needs to be non-negative.
IllegalArgumentException
- if the specified distance is negativesetMinimumRootDistance(double)
public double getMinimumSubtreeDistance()
SubtreeShapes
.
The distance needs to be non-negative.
IllegalArgumentException
- if the specified distance is negativeTreeLayout.SubtreeShape
ssetMinimumSubtreeDistance(double)
public TreeLayout.SubtreeShape placeSubtree(IDataProvider nodeShapeProvider, IDataProvider subtreeShapeProvider, LayoutGraph graph, Node localRoot, ParentConnectorDirection parentConnectorDirection)
SubtreeShapes
of the local root and its children as a dendrogram.placeSubtree
in interface INodePlacer
nodeShapeProvider
- the IDataProvider
for obtaining an initial shape of the root nodesubtreeShapeProvider
- the IDataProvider
for accessing the pre-calculated shapes of the subtreesgraph
- the input graphlocalRoot
- the root of the subtree that should be arranged by this methodparentConnectorDirection
- the direction specifier for the connector of the local root node to its parent nodepublic void setMinimumRootDistance(double value)
TreeLayout.SubtreeShape
of a root node and the bus connecting to all of
its children.
The distance needs to be non-negative.
IllegalArgumentException
- if the specified distance is negativevalue
- the minimum distance between the root and the busgetMinimumRootDistance()
public void setMinimumSubtreeDistance(double value)
SubtreeShapes
.
The distance needs to be non-negative.
IllegalArgumentException
- if the specified distance is negativevalue
- the minimum distance between two adjacent TreeLayout.SubtreeShape
sgetMinimumSubtreeDistance()