public static final class TreeLayout.SubtreeShape extends Object
TreeLayout.SubtreeShape represents the position and the borders of a subtree.
INodePlacers will move TreeLayout.SubtreeShapes and use the borders to calculate distances between the subtrees.
When two subtrees are placed in relation to their common root, their
TreeLayout.SubtreeShapes are merged to represent the new subtree.
The borders on each side of the TreeLayout.SubtreeShape are modeled with
BorderLines. The resulting area includes the borders of each node and edge in the corresponding subtree. It
can also contain the bounds of labels belonging to those nodes and edges.
The TreeLayout.SubtreeShape also describes a connector defining the location to which the edge from its parent is attached.
It is possible to add some bends (target points) at the end of this edge and include them in the
TreeLayout.SubtreeShape. During layout calculation, the last target point is the connection point for the edge.
| Modifier and Type | Method and Description |
|---|---|
void |
addBoundsToShape(double x,
double y,
double width,
double height)
Extends this
TreeLayout.SubtreeShape instance by the given rectangle. |
void |
addEdgeSegments(LayoutGraph graph,
Edge edge)
Adds all edge segments of the given edge to this
TreeLayout.SubtreeShape instance. |
void |
addLineSegment(double x1,
double y1,
double x2,
double y2)
Extends this
TreeLayout.SubtreeShape instance by the given segment. |
void |
addTargetPoint(double x,
double y)
Adds another point to the connector.
|
void |
appendTargetPoints(IEdgeLayout edgeLayout)
Appends all target points that have previously been added to this shape to the given
IEdgeLayout instance. |
void |
assignValuesTo(TreeLayout.SubtreeShape toShape,
AbstractRotatableNodePlacer.Matrix modificationMatrix)
Copies the state of this
TreeLayout.SubtreeShape instance to the given shape applying a modification matrix. |
TreeLayout.SubtreeShape |
createCopy(AbstractRotatableNodePlacer.Matrix matrix)
Creates a clone of this
TreeLayout.SubtreeShape instance, modifying it using the provided modification matrix. |
BorderLine |
getBorderLine(int index)
Returns the
BorderLine instance that describes the TreeLayout.SubtreeShape at the given side. |
Rectangle2D |
getBounds()
Gets the current bounds of this
TreeLayout.SubtreeShape instance. |
ConnectorDirection |
getConnectorDirection()
Gets the direction of the last connector segment.
|
double |
getConnectorX()
Gets the current x-coordinate of the connection point to which the layout algorithm connects the ingoing edge.
|
double |
getConnectorY()
Gets the current y-coordinate of the connection point to which the layout algorithm connects the ingoing edge.
|
Rectangle2D |
getCoreBounds()
Gets the bounds of the
INodeLayout of the root node of this TreeLayout.SubtreeShape instance. |
double |
getMaxX()
Gets the current maximum x-coordinate of this
TreeLayout.SubtreeShape instance. |
double |
getMaxY()
Gets the current maximum y-coordinate of this
TreeLayout.SubtreeShape instance. |
double |
getMinX()
Gets the current minimum x-coordinate of this
TreeLayout.SubtreeShape instance. |
double |
getMinY()
Gets the current minimum y-coordinate of this
TreeLayout.SubtreeShape instance. |
double |
getOriginX()
Gets the current x-coordinate of the origin of this
TreeLayout.SubtreeShape instance. |
double |
getOriginY()
Gets the current y-coordinate of the origin of this
TreeLayout.SubtreeShape instance. |
void |
mergeWith(TreeLayout.SubtreeShape other)
Merges the given
TreeLayout.SubtreeShape instance with this TreeLayout.SubtreeShape instance. |
void |
move(double dx,
double dy)
Moves this
TreeLayout.SubtreeShape instance and its connector by the given offsets. |
String |
toString()
Returns a string representation of the
TreeLayout.SubtreeShape instance. |
void |
updateConnectorShape()
Adds the line segments of the connector to the bounds of this
TreeLayout.SubtreeShape instance. |
public final void addBoundsToShape(double x,
double y,
double width,
double height)
TreeLayout.SubtreeShape instance by the given rectangle.
The border lines are updated with this segment.
x - the x-coordinate of the upper-left corner of the rectangley - the y-coordinate of the upper-left corner of the rectanglewidth - the width of the rectangleheight - the height of the rectanglegetBorderLine(int)public final void addEdgeSegments(LayoutGraph graph, Edge edge)
TreeLayout.SubtreeShape instance.
The border lines are updated.
graph - the input graphedge - the given edgegetBorderLine(int),
addLineSegment(double, double, double, double)public final void addLineSegment(double x1,
double y1,
double x2,
double y2)
TreeLayout.SubtreeShape instance by the given segment.
The border lines are updated with this segment.
x1 - the x-coordinate of the first point of the segmenty1 - the y-coordinate of the first point of the segmentx2 - the x-coordinate of the second point of the segmenty2 - the y-coordinate of the second point of the segmentgetBorderLine(int),
addEdgeSegments(LayoutGraph, Edge),
updateConnectorShape()public final void addTargetPoint(double x,
double y)
The points will appear as bend of the incoming edge. Points are added in reverse direction of the edge. Hence, the last target point is further away from the target node than the points before.
x - the current x-coordinate of the pointy - the current y-coordinate of the pointpublic final void appendTargetPoints(IEdgeLayout edgeLayout)
IEdgeLayout instance.
This method is used by INodePlacer instances for the final edge paths.
edgeLayout - the IEdgeLayout that will be modifiedaddTargetPoint(double, double)public final void assignValuesTo(TreeLayout.SubtreeShape toShape, AbstractRotatableNodePlacer.Matrix modificationMatrix)
TreeLayout.SubtreeShape instance to the given shape applying a modification matrix.toShape - the given shape that gets the assigned valuesmodificationMatrix - the matrix that may add geometrical modificationspublic final TreeLayout.SubtreeShape createCopy(AbstractRotatableNodePlacer.Matrix matrix)
TreeLayout.SubtreeShape instance, modifying it using the provided modification matrix.matrix - the matrix that defines the modification for the new instanceTreeLayout.SubtreeShape instanceAbstractRotatableNodePlacer.Matrix.DEFAULTpublic final BorderLine getBorderLine(int index)
BorderLine instance that describes the TreeLayout.SubtreeShape at the given side.IllegalArgumentException - if the given index is invalidindex - one of the predefined borderline directionsBorderLine instance for the given sidepublic final Rectangle2D getBounds()
TreeLayout.SubtreeShape instance.public final ConnectorDirection getConnectorDirection()
public final double getConnectorX()
The connection point can change when target points are added to the TreeLayout.SubtreeShape instance.
addTargetPoint(double, double),
appendTargetPoints(IEdgeLayout)public final double getConnectorY()
The connection point can change when target points are added to the TreeLayout.SubtreeShape instance.
addTargetPoint(double, double),
appendTargetPoints(IEdgeLayout)public final Rectangle2D getCoreBounds()
INodeLayout of the root node of this TreeLayout.SubtreeShape instance.public final double getMaxX()
TreeLayout.SubtreeShape instance.TreeLayout.SubtreeShapepublic final double getMaxY()
TreeLayout.SubtreeShape instance.TreeLayout.SubtreeShapepublic final double getMinX()
TreeLayout.SubtreeShape instance.TreeLayout.SubtreeShapepublic final double getMinY()
TreeLayout.SubtreeShape instance.TreeLayout.SubtreeShapepublic final double getOriginX()
TreeLayout.SubtreeShape instance.
The origin is defined as the upper left corner of the INodeLayout of the local root of this shape.
public final double getOriginY()
TreeLayout.SubtreeShape instance.
The origin is defined as the upper left corner of the INodeLayout of the local root of this shape.
public final void mergeWith(TreeLayout.SubtreeShape other)
TreeLayout.SubtreeShape instance with this TreeLayout.SubtreeShape instance.
The border lines are updated.
other - the TreeLayout.SubtreeShape to be merged with this TreeLayout.SubtreeShapepublic final void move(double dx,
double dy)
TreeLayout.SubtreeShape instance and its connector by the given offsets.
Border lines are updated.
dx - the delta x-offset by which this shape will be moveddy - the delta y-offset by which this shape will be movedpublic String toString()
TreeLayout.SubtreeShape instance.toString in class ObjectTreeLayout.SubtreeShape instancepublic final void updateConnectorShape()
TreeLayout.SubtreeShape instance.
The line segments result from the target points.
addTargetPoint(double, double)