Search this API

y.layout.tree
Class GenericTreeLayouter.SubtreeShape

java.lang.Object
  extended by y.layout.tree.GenericTreeLayouter.SubtreeShape
Enclosing class:
GenericTreeLayouter

public static final class GenericTreeLayouter.SubtreeShape
extends Object

Instances of this class are used to represent the shape of subtrees during the layout.


Field Summary
static int BORDERLINE_EAST
          Side constant used by getBorderLine(int).
static int BORDERLINE_NORTH
          Side constant used by getBorderLine(int).
static int BORDERLINE_SOUTH
          Side constant used by getBorderLine(int).
static int BORDERLINE_WEST
          Side constant used by getBorderLine(int).
static byte DIRECTION_EAST
          Direction constant used by getConnectorDirection().
static byte DIRECTION_NORTH
          Direction constant used by getConnectorDirection().
static byte DIRECTION_SOUTH
          Direction constant used by getConnectorDirection().
static byte DIRECTION_WEST
          Direction constant used by getConnectorDirection().
 
Method Summary
 void addBoundsToShape(double x, double y, double width, double height)
          Adds a rectangular shape to the current shape.
 void addEdgeSegments(LayoutGraph lg, Edge e)
          Helper method that takes all edge segments of the given Edge instance and updates the shape bounds with that information.
 void addLineSegment(double x1, double y1, double x2, double y2)
          Convenience method that updates the shape to respect the given line segment.
 void addTargetPoint(double x, double y)
          Adds another point to the connecting edge (away from the target node).
 void appendTargetPoints(EdgeLayout el)
          Appends all target points that have previously been added to this shape to the given EdgeLayout instance.
 void assignValuesTo(GenericTreeLayouter.SubtreeShape toShape, AbstractRotatableNodePlacer.Matrix modificationMatrix)
          Copies this instance to another shape, applying a modification matrix.
 GenericTreeLayouter.SubtreeShape createCopy(AbstractRotatableNodePlacer.Matrix matrix)
          Creates a clone of this instance, modifying it using the provided matrix.
 BorderLine getBorderLine(int index)
          Returns the BorderLine instance for the given direction.
 Rectangle2D getBounds()
          Returns the current bounds of this SubtreeShape
 byte getConnectorDirection()
          Returns the direction byte constant as defined in this class, that indicates the direction of the last connecting edge segment.
 double getConnectorX()
          Returns the current x coordinate of the connection point where the layout algorithm should connect the ingoing edge to.
 double getConnectorY()
          Returns the current y coordinate of the connection point where the layout algorithm should connect the ingoing edge to.
 Rectangle2D.Double getCoreBounds()
          Yields the bounds of the NodeLayout of the root node.
 double getMaxX()
          Returns the current maximum x coordinate of this shape.
 double getMaxY()
          Returns the current maximum y coordinate of this shape.
 double getMinX()
          Returns the current minimal x coordinate of this shape.
 double getMinY()
          Returns the current minimal y coordinate of this shape.
 double getOriginX()
          Returns the current x coordinate of the origin of this shape.
 double getOriginY()
          Returns the current y coordinate of the origin of this shape.
 void mergeWith(GenericTreeLayouter.SubtreeShape other)
          Merges the given SubtreeShape with this shape's bounds.
 void move(double dx, double dy)
          Moves this shape and its connector by the given offsets.
 String toString()
           
 void updateConnectorShape()
          Adds the line segments of the connector shape to the bounds and borderlines of this SubTreeShape
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DIRECTION_NORTH

public static final byte DIRECTION_NORTH
Direction constant used by getConnectorDirection().

See Also:
Constant Field Values

DIRECTION_EAST

public static final byte DIRECTION_EAST
Direction constant used by getConnectorDirection().

See Also:
Constant Field Values

DIRECTION_SOUTH

public static final byte DIRECTION_SOUTH
Direction constant used by getConnectorDirection().

See Also:
Constant Field Values

DIRECTION_WEST

public static final byte DIRECTION_WEST
Direction constant used by getConnectorDirection().

See Also:
Constant Field Values

BORDERLINE_NORTH

public static final int BORDERLINE_NORTH
Side constant used by getBorderLine(int).

See Also:
Constant Field Values

BORDERLINE_EAST

public static final int BORDERLINE_EAST
Side constant used by getBorderLine(int).

See Also:
Constant Field Values

BORDERLINE_SOUTH

public static final int BORDERLINE_SOUTH
Side constant used by getBorderLine(int).

See Also:
Constant Field Values

BORDERLINE_WEST

public static final int BORDERLINE_WEST
Side constant used by getBorderLine(int).

See Also:
Constant Field Values
Method Detail

getCoreBounds

public Rectangle2D.Double getCoreBounds()
Yields the bounds of the NodeLayout of the root node.


getBounds

public Rectangle2D getBounds()
Returns the current bounds of this SubtreeShape

Returns:
the current bounds

getConnectorX

public double getConnectorX()
Returns the current x coordinate of the connection point where the layout algorithm should connect the ingoing edge to.

Returns:
the current x coordinate

getConnectorY

public double getConnectorY()
Returns the current y coordinate of the connection point where the layout algorithm should connect the ingoing edge to.

Returns:
the current y coordinate

updateConnectorShape

public void updateConnectorShape()
Adds the line segments of the connector shape to the bounds and borderlines of this SubTreeShape


addTargetPoint

public void addTargetPoint(double x,
                           double y)
Adds another point to the connecting edge (away from the target node).

Parameters:
x - the current x coordinate of the point
y - the current x coordinate of the point

addEdgeSegments

public void addEdgeSegments(LayoutGraph lg,
                            Edge e)
Helper method that takes all edge segments of the given Edge instance and updates the shape bounds with that information.

Parameters:
lg - the LayoutGraph that contains the edge
e - the edge whose path will be used to update the shape

appendTargetPoints

public void appendTargetPoints(EdgeLayout el)
Appends all target points that have previously been added to this shape to the given EdgeLayout instance. Used by NodePlacer instances for the final edge connections.

Parameters:
el - the EdgeLayout that will be modified

getConnectorDirection

public byte getConnectorDirection()
Returns the direction byte constant as defined in this class, that indicates the direction of the last connecting edge segment.

Returns:
one of DIRECTION_NORTH DIRECTION_EAST DIRECTION_SOUTH DIRECTION_WEST

addLineSegment

public void addLineSegment(double x1,
                           double y1,
                           double x2,
                           double y2)
Convenience method that updates the shape to respect the given line segment.


addBoundsToShape

public void addBoundsToShape(double x,
                             double y,
                             double width,
                             double height)
Adds a rectangular shape to the current shape.


mergeWith

public void mergeWith(GenericTreeLayouter.SubtreeShape other)
Merges the given SubtreeShape with this shape's bounds.

Parameters:
other - the shape to be merged with this shape

getMinX

public double getMinX()
Returns the current minimal x coordinate of this shape.


getMinY

public double getMinY()
Returns the current minimal y coordinate of this shape.


getMaxX

public double getMaxX()
Returns the current maximum x coordinate of this shape.


getMaxY

public double getMaxY()
Returns the current maximum y coordinate of this shape.


getBorderLine

public BorderLine getBorderLine(int index)
Returns the BorderLine instance for the given direction.

Parameters:
index - the direction index where BORDERLINE_NORTH is north, BORDERLINE_EAST is east, BORDERLINE_SOUTH is south, and BORDERLINE_WEST is west.
Returns:
the current BorderLine instance

move

public void move(double dx,
                 double dy)
Moves this shape and its connector by the given offsets. This is a cheap operation and does not depend on the size or complexity of the shape or connector.

Parameters:
dx - the delta x offset this shape will be moved by
dy - the delta y offset this shape will be moved by

getOriginX

public double getOriginX()
Returns the current x coordinate of the origin of this shape. The origin is defined as the upper left corner of the NodeLayout of the local root of this shape.

Returns:
the current x coordinate

getOriginY

public double getOriginY()
Returns the current y coordinate of the origin of this shape. The origin is defined as the upper left corner of the NodeLayout of the local root of this shape.

Returns:
the current y coordinate

createCopy

public GenericTreeLayouter.SubtreeShape createCopy(AbstractRotatableNodePlacer.Matrix matrix)
Creates a clone of this instance, modifying it using the provided matrix.


assignValuesTo

public void assignValuesTo(GenericTreeLayouter.SubtreeShape toShape,
                           AbstractRotatableNodePlacer.Matrix modificationMatrix)
Copies this instance to another shape, applying a modification matrix.


toString

public String toString()
Overrides:
toString in class Object

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.