edu.umd.cfar.lamp.viper.geometry
Class PolyLine

java.lang.Object
  extended byedu.umd.cfar.lamp.viper.geometry.PolyList
      extended byedu.umd.cfar.lamp.viper.geometry.PolyLine
All Implemented Interfaces:
java.lang.Cloneable

public class PolyLine
extends PolyList
implements java.lang.Cloneable

This class represents a series of line segments.


Field Summary
protected  BoundingBox bbox
          A BoundingBox that surrounds the set of lines.
 
Fields inherited from class edu.umd.cfar.lamp.viper.geometry.PolyList
area, CARVE_POLYS, composed, originals, polys
 
Constructor Summary
PolyLine()
          Creates an empty polyline
PolyLine(PolyLine old)
          Constructs a PolyLine copy.
PolyLine(java.lang.String S)
          Constructs the polyline from the string list of points.
 
Method Summary
 boolean addVertex(Pnt v)
          Adds the given vertex to the end of the polyline.
 java.lang.Object clone()
          Constructs a copy of this object.
 boolean equals(java.lang.Object o)
          Tests to see if the two objects refer to the same set of line segments.
 BoundingBox getBoundingBox()
          Gets the nearest bounding box that contains the line
 java.util.Iterator getPoints()
          Gets an iterator through all the points on the edge of the polyline.
protected  void initBbox()
          Creates a BoundingBox around this, for use by getBoundingBox, etc.
 java.lang.String toString()
          Gets a list of the points as a String, usually for debugging.
 
Methods inherited from class edu.umd.cfar.lamp.viper.geometry.PolyList
addPoly, area, clearPolyList, contains, getConvexPolygonArray, getFragmentationCount, getIntersection, getOriginals, getPolys, hashCode, intersection, intersects, toStringListOfPoints, union
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

bbox

protected BoundingBox bbox
A BoundingBox that surrounds the set of lines.

Constructor Detail

PolyLine

public PolyLine()
Creates an empty polyline


PolyLine

public PolyLine(PolyLine old)
Constructs a PolyLine copy.

Parameters:
old - The PolyLine to copy.

PolyLine

public PolyLine(java.lang.String S)
         throws BadDataException
Constructs the polyline from the string list of points.

Parameters:
S - the list of points
Throws:
BadDataException - if the string is malformed
Method Detail

clone

public java.lang.Object clone()
Constructs a copy of this object.

Overrides:
clone in class PolyList
Returns:
A new Object that represents the same space.

toString

public java.lang.String toString()
Gets a list of the points as a String, usually for debugging.

Overrides:
toString in class PolyList
Returns:
A bracketed String, with a list of parenthesized lists of points for each convex PolyLine.

initBbox

protected void initBbox()
Description copied from class: PolyList
Creates a BoundingBox around this, for use by getBoundingBox, etc. This is called whenever the bbox is requested and it is currently set to null; the bbox field therefore acts as a dirty bit.

Overrides:
initBbox in class PolyList

getBoundingBox

public BoundingBox getBoundingBox()
Gets the nearest bounding box that contains the line

Overrides:
getBoundingBox in class PolyList
Returns:
the nearest bounding box that contains the line

getPoints

public java.util.Iterator getPoints()
Gets an iterator through all the points on the edge of the polyline. XXX Needs to handle composed case, no points case.

Overrides:
getPoints in class PolyList
Returns:
an Iterator of Pnt objects

equals

public boolean equals(java.lang.Object o)
Tests to see if the two objects refer to the same set of line segments.

Overrides:
equals in class PolyList
Parameters:
o - the set of line segments to compare with
Returns:
true iff they are the same set of line segments

addVertex

public boolean addVertex(Pnt v)
Adds the given vertex to the end of the polyline.

Overrides:
addVertex in class PolyList
Parameters:
v - the new point
Returns:
true if the point is added