Search this API

y.layout
Interface EdgeLayout

All Known Implementing Classes:
ArcEdgeRealizer, BezierEdgeRealizer, DefaultEdgeLayout, EdgeRealizer, GenericEdgeRealizer, PolyLineEdgeRealizer, QuadCurveEdgeRealizer, SplineEdgeRealizer

public interface EdgeLayout

This interface encapsulates the layout information for an edge. The layout information consists of the two end points of the edge layout and a sequence of control points that determine the visual path of the edge.


Method Summary
 void addPoint(double x, double y)
          Adds a control point to the end of the control point sequence.
 void clearPoints()
          Remove all control points from this edge layout.
 YPoint getPoint(int index)
          Returns the control point at position index of the sequence.
 YPoint getSourcePoint()
          Returns the relative coordinates of the first end point of this layout that is associated with the source node of the edge.
 YPoint getTargetPoint()
          Returns the relative coordinates of the second end point of this layout that is associated with the target node of the edge.
 int pointCount()
          Returns the number of control points of the edge.
 void setPoint(int index, double x, double y)
          Sets the coordinates of the control point at position index of the sequence.
 void setSourcePoint(YPoint point)
          Sets the relative coordinates of the first end point of this layout that is associated with the source node of the edge.
 void setTargetPoint(YPoint point)
          Sets the relative coordinates of the second end point of this layout that is associated with the target node of the edge.
 

Method Detail

pointCount

int pointCount()
Returns the number of control points of the edge. The source and target points are not included in the point count.

Returns:
the number of control points

getPoint

YPoint getPoint(int index)
Returns the control point at position index of the sequence.

Parameters:
index - position of the control point in the control point sequence.
Returns:
the absolute coordinates of the control point at the given index.
See Also:
setPoint(int, double, double)

setPoint

void setPoint(int index,
              double x,
              double y)
Sets the coordinates of the control point at position index of the sequence. The first control point in the sequence has index 0 and the last control point has index pointCount() - 1.

Parameters:
index - position of the control point in the control point sequence.
x - absolute x-coordinate of the control point at the given index.
y - absolute y-coordinate of the control point at the given index.

addPoint

void addPoint(double x,
              double y)
Adds a control point to the end of the control point sequence.

Parameters:
x - the absolute x-coordinate of the control point.
y - the absolute y-coordinate of the control point.

clearPoints

void clearPoints()
Remove all control points from this edge layout.


getSourcePoint

YPoint getSourcePoint()
Returns the relative coordinates of the first end point of this layout that is associated with the source node of the edge. The returned coordinates are relative to the center location of the source node of the edge. To obtain the absolute coordinates of the end point it is therefore necessary to add the center coordinates of the source node layout to the returned value.

Returns:
the relative coordinates of the source point.
See Also:
LayoutGraph.getCenterX(y.base.Node), LayoutGraph.getCenterY(y.base.Node), NodeLayout.getX(), NodeLayout.getWidth()

getTargetPoint

YPoint getTargetPoint()
Returns the relative coordinates of the second end point of this layout that is associated with the target node of the edge. The returned coordinates are relative to the center location of the target node of the edge. To obtain the absolute coordinates of the end point it is therefore necessary to add the center coordinates of the target node layout to the returned value.

Returns:
the relative coordinates of the target point.
See Also:
LayoutGraph.getCenterX(y.base.Node), LayoutGraph.getCenterY(y.base.Node), NodeLayout.getX(), NodeLayout.getWidth()

setSourcePoint

void setSourcePoint(YPoint point)
Sets the relative coordinates of the first end point of this layout that is associated with the source node of the edge. The given coordinates must be relative to the center location of the source node of the edge.

Parameters:
point - the relative coordinates of the source point.
See Also:
getTargetPoint()

setTargetPoint

void setTargetPoint(YPoint point)
Sets the relative coordinates of the second end point of this layout that is associated with the target node of the edge. The given coordinates must be relative to the center location of the target node of the edge.

Parameters:
point - the relative coordinates of the source point.
See Also:
getTargetPoint()

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