|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.seisw.util.geom.PolyDefault
PolyDefault is a default Poly implementation.
It provides support for both complex and simple polygons. A complex polygon
is a polygon that consists of more than one polygon. A simple polygon is a
more traditional polygon that contains of one inner polygon and is just a
collection of points.
Implementation Note: If a point is added to an empty PolyDefault
object, it will create an inner polygon of type PolySimple.
PolySimple| Field Summary | |
protected java.util.List |
m_List
|
| Constructor Summary | |
PolyDefault()
Creates a new instance of PolyDefault |
|
PolyDefault(boolean isHole)
|
|
| 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)
Add an inner polygon to this polygon - assumes that adding polygon does not have any inner polygons. |
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()
Return the area of the polygon in square units. |
java.awt.geom.Rectangle2D |
getBounds()
Returns the bounding rectangle of this polygon. |
Poly |
getInnerPoly(int polyIndex)
Returns the polygon at this index. |
int |
getNumInnerPoly()
Returns the number of inner polygons - inner polygons are assumed to return one here. |
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()
Return true if this polygon is a hole. |
void |
setContributing(int polyIndex,
boolean contributes)
Set whether or not this inner polygon is constributing to the set operation. |
void |
setIsHole(boolean isHole)
Set whether or not this polygon is a hole. |
java.lang.String |
toString()
|
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 PolyDefault()
public PolyDefault(boolean isHole)
| Method Detail |
public boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.String toString()
public void clear()
clear in interface Poly
public void add(double x,
double y)
Implementation Note: If a point is added to an empty PolyDefault object,
it will create an inner polygon of type PolySimple.
add in interface Polypublic void add(java.awt.geom.Point2D p)
Implementation Note: If a point is added to an empty PolyDefault object,
it will create an inner polygon of type PolySimple.
add in interface Polypublic void add(Poly p)
add in interface Polyjava.lang.IllegalStateException - if the number of inner polygons is greater than
zero and this polygon was designated a hole. This would break the assumption
that only simple polygons can be holes.public boolean isEmpty()
isEmpty in interface Polypublic java.awt.geom.Rectangle2D getBounds()
getBounds in interface Polypublic Poly getInnerPoly(int polyIndex)
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 Polyjava.lang.IllegalStateException - if called on a complex polygon.public void setIsHole(boolean isHole)
setIsHole in interface Polyjava.lang.IllegalStateException - if called on a complex polygon.public boolean isContributing(int polyIndex)
isContributing in interface Poly
public void setContributing(int polyIndex,
boolean contributes)
setContributing in interface Polyjava.lang.IllegalStateException - if called on a complex polygonpublic 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()
getArea in interface Poly
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||