Search this API

y.geom
Class YPointPath

java.lang.Object
  extended by y.geom.YPointPath

public final class YPointPath
extends java.lang.Object

This class represents an ordered list of points in the plane.

 

Field Summary
static YPointPath EMPTY_PATH
          Defines a path with no points.
 
Constructor Summary
YPointPath()
          Creates a new empty path.
YPointPath(java.util.List l)
          Creates a new path from a list of points.
YPointPath(java.util.Vector v)
          Creates a new path from a vector.
YPointPath(YPoint[] path)
          Creates a new path from an array of points.
 
Method Summary
 double calculateLength()
          Calculate the (geometric) length of the path.
 YPointPath createReverse()
          Create a point path with reverse ordering of the points.
 YCursor cursor()
          Get the points in the path.
 YPoint getFirst()
          Get the first point in the path.
 YPoint getLast()
          Get the last point in the path.
 LineSegment getLineSegment(int i)
          Returns a line segment in the path.
 java.util.Iterator iterator()
          Get the points in the path.
 int length()
          Get the number of points in the path.
 int lineSegmentCount()
          Get the number of line segments in the path.
 YLineSegmentCursor lineSegments()
          Get the points in the path.
 YPointCursor points()
          Get the points in the path.
 YPoint[] toArray()
          Get the points in the list as array.
 java.util.List toList()
          Get the points in the path as list.
 java.lang.String toString()
           
 java.util.Vector toVector()
          Get the points in the list as vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_PATH

public static final YPointPath EMPTY_PATH
Defines a path with no points.

Constructor Detail

YPointPath

public YPointPath()
Creates a new empty path.


YPointPath

public YPointPath(java.util.Vector v)
Creates a new path from a vector.


YPointPath

public YPointPath(java.util.List l)
Creates a new path from a list of points.

Parameters:
l - a list of YPoint instances.

YPointPath

public YPointPath(YPoint[] path)
Creates a new path from an array of points.

Method Detail

cursor

public YCursor cursor()
Get the points in the path.


points

public YPointCursor points()
Get the points in the path.


iterator

public java.util.Iterator iterator()
Get the points in the path.


getFirst

public YPoint getFirst()
Get the first point in the path.


getLast

public YPoint getLast()
Get the last point in the path.


toVector

public java.util.Vector toVector()
Get the points in the list as vector.


toList

public java.util.List toList()
Get the points in the path as list.

Returns:
a list of YPoint instances.

toArray

public YPoint[] toArray()
Get the points in the list as array.


createReverse

public YPointPath createReverse()
Create a point path with reverse ordering of the points.


length

public int length()
Get the number of points in the path.


lineSegmentCount

public int lineSegmentCount()
Get the number of line segments in the path.


lineSegments

public YLineSegmentCursor lineSegments()
Get the points in the path.


getLineSegment

public LineSegment getLineSegment(int i)
Returns a line segment in the path.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

calculateLength

public double calculateLength()
Calculate the (geometric) length of the path. The length of the path is the sum of lengths of all line segments making up the path.

Returns:
the (geometric) length of the path

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