com.partnersoft.geometry
Class Polyline

java.lang.Object
  extended by com.partnersoft.geometry.Polyline
All Implemented Interfaces:
java.io.Serializable

public class Polyline
extends java.lang.Object
implements java.io.Serializable

A single, DoubleBuffer-based polyline.

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

Field Summary
 DoubleBuffer coords
           
 
Constructor Summary
Polyline()
           
Polyline(DoubleBuffer buffy)
           
Polyline(int size)
           
 
Method Summary
 void addPoint(double x, double y)
           
 void clear()
           
 PolylineArray clipOutRectangle(double x, double y, double width, double height)
          Clips a rectangle out of the polyline to a rectangle, producing zero or more resultant polylines that are outside the rectangle.
 PolylineArray clipOutRectangle(Rectangle rectangle)
           
 void clipOutRectangle(Rectangle rectangle, PolylineArray results)
          This is the fastest public clipOutRectangle variation - passing a reuseable PolylineArray can reduce allocation overhead.
 PolylineArray clipOutRectangles(Rectangle[] rectangles)
          Cuts a collection of rectangular holes out.
 java.lang.Object clone()
           
static boolean containsDegenerateSegments(DoubleBuffer coords)
           
 Point getCentroid()
           
 Rectangle getExtents()
           
 double getLength()
           
 int getNumberOfPoints()
           
 boolean isDegenerate()
           
static boolean isDegenerate(DoubleBuffer coords)
           
 void reduceDetail(double granularity)
           
static void reduceDetail(DoubleBuffer coords, double granularity)
          Attempts to reduce the complexity of the line by eliminating points which add nothing to the detail at a certain granularity.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coords

public DoubleBuffer coords
Constructor Detail

Polyline

public Polyline()

Polyline

public Polyline(int size)

Polyline

public Polyline(DoubleBuffer buffy)
Method Detail

addPoint

public void addPoint(double x,
                     double y)

reduceDetail

public final void reduceDetail(double granularity)

getNumberOfPoints

public int getNumberOfPoints()

clear

public void clear()

reduceDetail

public static final void reduceDetail(DoubleBuffer coords,
                                      double granularity)
Attempts to reduce the complexity of the line by eliminating points which add nothing to the detail at a certain granularity. Granularity is defined as a discretizing parameter - it sets up a grid of that cell size and points which fall into the same grid cell are regarded as identical. May reduce it to a single point, so watch out.


isDegenerate

public final boolean isDegenerate()

isDegenerate

public static final boolean isDegenerate(DoubleBuffer coords)

containsDegenerateSegments

public static final boolean containsDegenerateSegments(DoubleBuffer coords)

getCentroid

public final Point getCentroid()

getLength

public final double getLength()

getExtents

public final Rectangle getExtents()

clipOutRectangle

public final PolylineArray clipOutRectangle(double x,
                                            double y,
                                            double width,
                                            double height)
Clips a rectangle out of the polyline to a rectangle, producing zero or more resultant polylines that are outside the rectangle.


clipOutRectangle

public final PolylineArray clipOutRectangle(Rectangle rectangle)

clipOutRectangle

public final void clipOutRectangle(Rectangle rectangle,
                                   PolylineArray results)
This is the fastest public clipOutRectangle variation - passing a reuseable PolylineArray can reduce allocation overhead. The others eventually call this.


clipOutRectangles

public final PolylineArray clipOutRectangles(Rectangle[] rectangles)
Cuts a collection of rectangular holes out.


clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object