|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.umd.cfar.lamp.viper.geometry.PolyList edu.umd.cfar.lamp.viper.geometry.Polygon
This class represents a series of line segments.
Field Summary |
Fields inherited from class edu.umd.cfar.lamp.viper.geometry.PolyList |
area, bbox, CARVE_POLYS, composed, originals, polys |
Fields inherited from interface edu.umd.cfar.lamp.viper.geometry.Moveable |
EAST, NORTH, NORTHEAST, NORTHWEST, SOUTH, SOUTHEAST, SOUTHWEST, WEST |
Constructor Summary | |
Polygon()
Constructs an empty, closed polygon. |
|
Polygon(java.awt.geom.Point2D[] list)
Converts a list of points into a polygon. |
|
Polygon(Polygon old)
Constructs a Polygon copy. |
|
Polygon(java.lang.String S)
Constructs a polygon from a list of points. |
Method Summary | |
boolean |
addVertex(Pnt v)
Adds the point to the end of the polygon as a point on its exterior. |
java.lang.Object |
clone()
Constructs a copy of this object. |
boolean |
equals(java.lang.Object o)
Tests to see if the other object contains the same region as this polygon. |
BoundingBox |
getBoundingBox()
Gets the closest bounding box surrounding this polygon. |
Pnt |
getCentroid()
Gets a copy of the centroid. |
java.util.Iterator |
getPoints()
Gets all the points around the outside of the polygon. |
protected void |
initBbox()
Creates a BoundingBox around this, for use by getBoundingBox, etc. |
Moveable |
move(int direction,
int distance)
Creates a new copy of this movable item, shifted in the given direction by the given number of pixels. |
Moveable |
shift(int x,
int y)
Shifts the moveable by the given amount. |
java.lang.String |
toString()
Gets a list of the points as a String, usually for debugging. |
static Polygon |
valueOf(java.lang.String S)
Constructs a polygon from a list of points. |
Methods inherited from class edu.umd.cfar.lamp.viper.geometry.PolyList |
addPoly, area, clearPolyList, contains, getConvexPolygonArray, getFragmentationCount, getIntersection, getOriginals, getPolys, hashCode, intersection, intersects, toStringListOfPoints, union |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Polygon()
public Polygon(Polygon old)
old
- The Polygon to copy.public Polygon(java.awt.geom.Point2D[] list)
list
- ordered set of points for the polygonpublic Polygon(java.lang.String S) throws BadDataException
S
- a polygon is a list of parenthestized int pairs, and
a set of polygons is delimited by brackets
BadDataException
- if the string isn't formatted properlyMethod Detail |
public static Polygon valueOf(java.lang.String S)
S
- a polygon is a list of parenthestized int pairs, and
a set of polygons is delimited by brackets
public boolean equals(java.lang.Object o)
equals
in class PolyList
o
- the PolyList or Polygon to compare with
public java.lang.Object clone()
clone
in class PolyList
public java.lang.String toString()
toString
in class PolyList
protected void initBbox()
initBbox
in class PolyList
public BoundingBox getBoundingBox()
getBoundingBox
in class PolyList
public java.util.Iterator getPoints()
getPoints
in class PolyList
public boolean addVertex(Pnt v)
addVertex
in class PolyList
v
- the point to add to the edge list
public Pnt getCentroid()
HasCentroid
getCentroid
in interface HasCentroid
HasCentroid.getCentroid()
public Moveable move(int direction, int distance)
move
in interface Moveable
direction
- the direction to move the itemdistance
- the distance to move it
public Moveable shift(int x, int y)
shift
in interface Moveable
x
- y
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |