com.moximedia.aims
Class AimsPolygon2D

java.lang.Object
  extended bycom.moximedia.aims.AimsPolygon2D
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, java.awt.Shape

public class AimsPolygon2D
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, java.awt.Shape

Utility class to provide polygon processing functions.

See Also:
Serialized Form

Field Summary
 int npoints
           
 double[] xpoints
           
 double[] ypoints
           
 
Constructor Summary
AimsPolygon2D()
           
AimsPolygon2D(AimsPoints pts)
           
AimsPolygon2D(double[] xpoints, double[] ypoints, int npoints)
           
AimsPolygon2D(int[] xpoints, int[] ypoints, int npoints)
           
AimsPolygon2D(java.awt.geom.PathIterator it)
           
AimsPolygon2D(java.awt.Rectangle r)
           
AimsPolygon2D(java.awt.Shape s)
           
 
Method Summary
 void addPoint(double x, double y)
           
 boolean contains(double x, double y)
           
 boolean contains(double x, double y, double w, double h)
           
 boolean contains(java.awt.geom.Point2D pt)
           
 boolean contains(java.awt.geom.Rectangle2D r)
           
 void cut(AimsPolygon2D p)
          Cut the specified Polygon2D out of the current Polygon2D.
 AimsPoints getAimsPoints()
           
 AimsPolygon getAimsPolygon()
           
 java.awt.Rectangle getBounds()
          Deprecated. should use getBounds2D instead.
 java.awt.geom.Rectangle2D getBounds2D()
           
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform tx)
           
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform tx, double p2)
           
 boolean intersects(AimsPolygon2D p)
           
 boolean intersects(double x, double y, double w, double h)
           
 boolean intersects(java.awt.geom.Rectangle2D r)
           
 boolean isClosed()
          Check whether this polygon is a closed polygon or not.
 void merge(AimsPolygon2D p)
          Try to merge the current Polygon2D with the specified Polygon2D.
 void setClosed(boolean flag)
          Set whether this polygon is a closed polygon or not.
 void setToPathIterator(java.awt.geom.PathIterator it)
          Clear out the old polygon, set the polygon to be the specified PathIterator.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

npoints

public int npoints

xpoints

public double[] xpoints

ypoints

public double[] ypoints
Constructor Detail

AimsPolygon2D

public AimsPolygon2D()

AimsPolygon2D

public AimsPolygon2D(AimsPoints pts)

AimsPolygon2D

public AimsPolygon2D(java.awt.Rectangle r)

AimsPolygon2D

public AimsPolygon2D(java.awt.Shape s)

AimsPolygon2D

public AimsPolygon2D(java.awt.geom.PathIterator it)

AimsPolygon2D

public AimsPolygon2D(int[] xpoints,
                     int[] ypoints,
                     int npoints)

AimsPolygon2D

public AimsPolygon2D(double[] xpoints,
                     double[] ypoints,
                     int npoints)
Method Detail

getAimsPolygon

public AimsPolygon getAimsPolygon()

getAimsPoints

public AimsPoints getAimsPoints()

addPoint

public void addPoint(double x,
                     double y)

contains

public boolean contains(java.awt.geom.Rectangle2D r)
Specified by:
contains in interface java.awt.Shape

cut

public void cut(AimsPolygon2D p)
Cut the specified Polygon2D out of the current Polygon2D. Does nothing if the two do not intersect, or if one of the two is not closed.


intersects

public boolean intersects(java.awt.geom.Rectangle2D r)
Specified by:
intersects in interface java.awt.Shape

isClosed

public boolean isClosed()
Check whether this polygon is a closed polygon or not.


contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(double x,
                        double y)
Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(java.awt.geom.Point2D pt)
Specified by:
contains in interface java.awt.Shape

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform tx)
Specified by:
getPathIterator in interface java.awt.Shape

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform tx,
                                                  double p2)
Specified by:
getPathIterator in interface java.awt.Shape

getBounds

public java.awt.Rectangle getBounds()
Deprecated. should use getBounds2D instead.

Specified by:
getBounds in interface java.awt.Shape

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Specified by:
getBounds2D in interface java.awt.Shape

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Specified by:
intersects in interface java.awt.Shape

merge

public void merge(AimsPolygon2D p)
Try to merge the current Polygon2D with the specified Polygon2D. Does nothing if the two do not intersect, or if one of the two is not closed.


intersects

public boolean intersects(AimsPolygon2D p)

setClosed

public void setClosed(boolean flag)
Set whether this polygon is a closed polygon or not.


setToPathIterator

public void setToPathIterator(java.awt.geom.PathIterator it)
Clear out the old polygon, set the polygon to be the specified PathIterator.
 4 = PathIterator.SEG_CLOSE
 3 = PathIterator.SEG_CUBICTO
 2 = PathIterator.SEG_QUADTO
 1 = PathIterator.SEG_LINETO
 0 = PathIterator.SEG_MOVETO
 1 = PathIterator.WIND_NON_ZERO
 0 = PathIterator.WIND_EVEN_ODD
 


toString

public java.lang.String toString()