Search this API

y.layout
Class DefaultEdgeLayout

java.lang.Object
  extended by y.layout.DefaultEdgeLayout
All Implemented Interfaces:
EdgeLayout

public class DefaultEdgeLayout
extends java.lang.Object
implements EdgeLayout

DefaultEdgeLayout is the default implementation of the EdgeLayout interface.

The layout information consists of the two end points of the EdgeLayout and a sequence of control points that determine the visual path of the edge.

 

Constructor Summary
DefaultEdgeLayout()
          Creates a new DefaultEdgeLayout instance.
DefaultEdgeLayout(EdgeLayout layout)
          Creates a new DefaultEdgeLayout which copies the given EdgeLayout.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEdgeLayout

public DefaultEdgeLayout()
Creates a new DefaultEdgeLayout instance.


DefaultEdgeLayout

public DefaultEdgeLayout(EdgeLayout layout)
Creates a new DefaultEdgeLayout which copies the given EdgeLayout.

Parameters:
layout - the EdgeLayout that is copied
Method Detail

pointCount

public int pointCount()
Description copied from interface: EdgeLayout
Returns the number of control points of the edge.

The source and target points are not included in the point count.

Specified by:
pointCount in interface EdgeLayout
Returns:
the number of control points

getPoint

public YPoint getPoint(int index)
Description copied from interface: EdgeLayout
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 EdgeLayout.pointCount() -1.

Specified by:
getPoint in interface EdgeLayout
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:
EdgeLayout.setPoint(int, double, double)

setPoint

public void setPoint(int index,
                     double x,
                     double y)
Description copied from interface: EdgeLayout
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 EdgeLayout.pointCount() -1.

Specified by:
setPoint in interface EdgeLayout
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

public void addPoint(double x,
                     double y)
Description copied from interface: EdgeLayout
Adds a control point to the end of the control point sequence.

Specified by:
addPoint in interface EdgeLayout
Parameters:
x - the absolute x-coordinate of the new control point
y - the absolute y-coordinate of the new control point

clearPoints

public void clearPoints()
Description copied from interface: EdgeLayout
Removes all control points from this edge layout.

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

Specified by:
clearPoints in interface EdgeLayout

getSourcePoint

public YPoint getSourcePoint()
Description copied from interface: EdgeLayout
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.

Specified by:
getSourcePoint in interface EdgeLayout
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

public YPoint getTargetPoint()
Description copied from interface: EdgeLayout
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.

Specified by:
getTargetPoint in interface EdgeLayout
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

public void setSourcePoint(YPoint point)
Description copied from interface: EdgeLayout
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.

Specified by:
setSourcePoint in interface EdgeLayout
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

public void setTargetPoint(YPoint point)
Description copied from interface: EdgeLayout
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.

Specified by:
setTargetPoint in interface EdgeLayout
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.