com.partnersoft.geometry
Class PolylineArray

java.lang.Object
  extended by com.partnersoft.data.DataBuffer
      extended by com.partnersoft.geometry.PolylineArray
All Implemented Interfaces:
java.io.Serializable

public class PolylineArray
extends DataBuffer

A list of polylines. Has some handy construction methods to help with clipping etc.

Author:
Paul Reavis Copyright 2002 Partner Software, Inc.
See Also:
Serialized Form

Field Summary
 DoubleBuffer[] array
           
 
Fields inherited from class com.partnersoft.data.DataBuffer
arrayObject, capacity, end, growthCap, growthMin, start
 
Constructor Summary
PolylineArray()
          Creates an empty polyline array.
PolylineArray(int size)
          Creates a polyline array of the given size.
 
Method Summary
 void add(Polyline addMe)
           
 void addAll(PolylineArray nother)
           
 void addPoint(double x, double y)
          Adds a new point, no questions asked.
 void addSegment(double x1, double y1, double x2, double y2)
           
 void addSegment(Line line)
          Adds a new segment.
 void newArray(int size)
          Allocates a new, empty array of the given size and assign it to the arrayObject property.
 void startPolyline()
          Starts a new, empty polyline.
 
Methods inherited from class com.partnersoft.data.DataBuffer
append, clear, clone, copy, copyTo, getSize, insert, isEmpty, makeRoomFor, makeRoomFor, pack, remove, setToMatch, subsection, tidy, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

array

public DoubleBuffer[] array
Constructor Detail

PolylineArray

public PolylineArray()
Creates an empty polyline array. Contents array is left null!


PolylineArray

public PolylineArray(int size)
Creates a polyline array of the given size.

Method Detail

newArray

public final void newArray(int size)
Description copied from class: DataBuffer
Allocates a new, empty array of the given size and assign it to the arrayObject property. It is assumed that subclasses will also set it to a variable of the correct class (e.g. char[]) for ease of access as well. Copying of existing contents is managed by this superclass.

Specified by:
newArray in class DataBuffer

add

public void add(Polyline addMe)

addAll

public final void addAll(PolylineArray nother)

addPoint

public final void addPoint(double x,
                           double y)
Adds a new point, no questions asked. Creates a new polyline if there is none or startNew is true, otherwise adds it to last polyline.


startPolyline

public final void startPolyline()
Starts a new, empty polyline. Use to "lift pen".


addSegment

public final void addSegment(Line line)
Adds a new segment. If there is no polyline, starts one. If there is, and it's empty, just adds it this segment to it. If there is one, and it's not empty, first compares the first point of the segment to see if it matches the last point in the polyline. if so, adds the second point of the segment to the polyline (thus adding the segment). Otherwise, starts a new polyline and adds the segment to it.


addSegment

public final void addSegment(double x1,
                             double y1,
                             double x2,
                             double y2)