Search this API

y.layout
Interface EdgeLayout

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

public interface EdgeLayout

An EdgeLayout 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()
          Removes all control points from this edge layout.
 YPoint getPoint(int index)
          Returns the control point at the given position in the sequence of control points.
 YPoint getSourcePoint()
          Returns the relative coordinates of the first end point of this layout.
 YPoint getTargetPoint()
          Returns the relative coordinates of the second end point of this layout.
 int pointCount()
          Returns the number of control points of the edge.
 void setPoint(int index, double x, double y)
          Sets the absolute coordinates of the control point at the given position in the sequence of control points.
 void setSourcePoint(YPoint point)
          Sets the relative coordinates of the first end point of this layout.
 void setTargetPoint(YPoint point)
          Sets the relative coordinates of the second end point of this layout.
 

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 the given position in the sequence of control points.

The first control point in the sequence has index 0 and the last control point has index pointCount() -1.

Parameters:
index - the 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 absolute coordinates of the control point at the given position in the sequence of control points.

The first control point in the sequence has index 0 and the last control point has index pointCount() -1.

Parameters:
index - the position of the changing control point in the sequence
x - the new absolute x-coordinate of the control point at the given index
y - the new 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 new control point
y - the absolute y-coordinate of the new control point

clearPoints

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

The EdgeLayout still keeps the source point and the target point.


getSourcePoint

YPoint getSourcePoint()
Returns the relative coordinates of the first end point of this layout.

These coordinates are relative to the center location of the edge's source node. To obtain the absolute coordinates of the end point, the relative coordinates have to be added to the center coordinates of the source NodeLayout.

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

getTargetPoint

YPoint getTargetPoint()
Returns the relative coordinates of the second end point of this layout.

These coordinates are relative to the center location of the edge's target node. To obtain the absolute coordinates of the end point, the relative coordinates have to be added to the center coordinates of the target NodeLayout.

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

setSourcePoint

void setSourcePoint(YPoint point)
Sets the relative coordinates of the first end point of this layout.

These coordinates are relative to the center location of the edge's source node. To obtain the absolute coordinates of the end point, the relative coordinates have to be added to the center coordinates of the source NodeLayout.

Parameters:
point - the new relative coordinates of the source point
See Also:
LayoutGraph.getCenterX(y.base.Node), LayoutGraph.getCenterY(y.base.Node), NodeLayout.getX(), NodeLayout.getY()

setTargetPoint

void setTargetPoint(YPoint point)
Sets the relative coordinates of the second end point of this layout.

These coordinates are relative to the center location of the edge's target node. To obtain the absolute coordinates of the end point, the relative coordinates have to be added to the center coordinates of the target NodeLayout.

Parameters:
point - the new relative coordinates of the target point
See Also:
LayoutGraph.getCenterX(y.base.Node), LayoutGraph.getCenterY(y.base.Node), NodeLayout.getX(), NodeLayout.getY()

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