|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.seisw.util.geom.PolySimple
PolySimple is a simple polygon - contains only one inner polygon.
WARNING: This type of Poly cannot be used for an
inner polygon that is a hole.
| Field Summary | |
protected java.util.List |
m_List
The list of Point2D objects in the polygon. |
| Constructor Summary | |
PolySimple()
Creates a new instance of PolySimple |
|
| Method Summary | |
void |
add(double x,
double y)
Add a point to the first inner polygon. |
void |
add(java.awt.geom.Point2D p)
Add a point to the first inner polygon. |
void |
add(Poly p)
Throws IllegalStateexception if called |
void |
clear()
Remove all of the points. |
boolean |
equals(java.lang.Object obj)
Return true if the given object is equal to this one. |
double |
getArea()
Returns the area of the polygon. |
java.awt.geom.Rectangle2D |
getBounds()
Returns the bounding rectangle of this polygon. |
Poly |
getInnerPoly(int polyIndex)
Returns this if polyIndex = 0, else it throws
IllegalStateException. |
int |
getNumInnerPoly()
Always returns 1. |
int |
getNumPoints()
Return the number points of the first inner polygon |
double |
getX(int index)
Return the X value of the point at the index in the first inner polygon |
double |
getY(int index)
Return the Y value of the point at the index in the first inner polygon |
int |
hashCode()
Return the hashCode of the object. |
Poly |
intersection(Poly p)
Return a Poly that is the intersection of this polygon with the given polygon. |
boolean |
isContributing(int polyIndex)
Return true if the given inner polygon is contributing to the set operation. |
boolean |
isEmpty()
Return true if the polygon is empty |
boolean |
isHole()
Always returns false since PolySimples cannot be holes. |
void |
setContributing(int polyIndex,
boolean contributes)
Set whether or not this inner polygon is constributing to the set operation. |
void |
setIsHole(boolean isHole)
Throws IllegalStateException if called. |
java.lang.String |
toString()
Return a string briefly describing the polygon. |
Poly |
union(Poly p)
Return a Poly that is the union of this polygon with the given polygon. |
Poly |
xor(Poly p)
Return a Poly that is the exclusive-or of this polygon with the given polygon. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.util.List m_List
| Constructor Detail |
public PolySimple()
| Method Detail |
public boolean equals(java.lang.Object obj)
WARNING: This method failse if the first point appears more than once in the list.
public int hashCode()
WARNING:Hash and Equals break contract.
public java.lang.String toString()
public void clear()
clear in interface Poly
public void add(double x,
double y)
add in interface Polypublic void add(java.awt.geom.Point2D p)
add in interface Polypublic void add(Poly p)
add in interface Polypublic boolean isEmpty()
isEmpty in interface Polypublic java.awt.geom.Rectangle2D getBounds()
getBounds in interface Polypublic Poly getInnerPoly(int polyIndex)
this if polyIndex = 0, else it throws
IllegalStateException.
getInnerPoly in interface Polypublic int getNumInnerPoly()
getNumInnerPoly in interface Polypublic int getNumPoints()
getNumPoints in interface Polypublic double getX(int index)
getX in interface Polypublic double getY(int index)
getY in interface Polypublic boolean isHole()
isHole in interface Polypublic void setIsHole(boolean isHole)
setIsHole in interface Polypublic boolean isContributing(int polyIndex)
isContributing in interface Polyjava.lang.IllegalStateException - if polyIndex != 0
public void setContributing(int polyIndex,
boolean contributes)
setContributing in interface Polyjava.lang.IllegalStateException - if polyIndex != 0public Poly intersection(Poly p)
intersection in interface Polypublic Poly union(Poly p)
union in interface Polypublic Poly xor(Poly p)
xor in interface Polypublic double getArea()
The algorithm for the area of a complex polygon was take from code by Joseph O'Rourke author of " Computational Geometry in C".
getArea in interface Poly
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||