public class PolygonShape
extends java.lang.Object
implements java.awt.Shape
Shape
which represents a polygon which may contain holes.
Provided because the standard AWT Polygon class does not support holes.Modifier and Type | Field and Description |
---|---|
private java.awt.geom.GeneralPath |
polygonPath |
private java.awt.geom.GeneralPath |
ringPath |
Constructor and Description |
---|
PolygonShape() |
PolygonShape(Coordinate[] shellVertices,
java.util.Collection holeVerticesCollection)
Creates a new polygon
Shape . |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addToRing(java.awt.geom.Point2D p) |
boolean |
contains(double x,
double y) |
boolean |
contains(double x,
double y,
double w,
double h) |
boolean |
contains(java.awt.geom.Point2D p) |
boolean |
contains(java.awt.geom.Rectangle2D r) |
(package private) void |
endRing() |
java.awt.Rectangle |
getBounds() |
java.awt.geom.Rectangle2D |
getBounds2D() |
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at) |
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at,
double flatness) |
boolean |
intersects(double x,
double y,
double w,
double h) |
boolean |
intersects(java.awt.geom.Rectangle2D r) |
private java.awt.geom.GeneralPath |
toPath(Coordinate[] coordinates)
Creates a GeneralPath representing a polygon ring
having the given coordinate sequence.
|
private java.awt.geom.GeneralPath polygonPath
private java.awt.geom.GeneralPath ringPath
public PolygonShape(Coordinate[] shellVertices, java.util.Collection holeVerticesCollection)
Shape
.shellVertices
- the vertices of the shellholeVerticesCollection
- a collection of Coordinate[] for each holepublic PolygonShape()
void addToRing(java.awt.geom.Point2D p)
void endRing()
private java.awt.geom.GeneralPath toPath(Coordinate[] coordinates)
coordinates
- a coordinate sequencepublic java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
public java.awt.geom.Rectangle2D getBounds2D()
getBounds2D
in interface java.awt.Shape
public boolean contains(double x, double y)
contains
in interface java.awt.Shape
public boolean contains(java.awt.geom.Point2D p)
contains
in interface java.awt.Shape
public boolean intersects(double x, double y, double w, double h)
intersects
in interface java.awt.Shape
public boolean intersects(java.awt.geom.Rectangle2D r)
intersects
in interface java.awt.Shape
public boolean contains(double x, double y, double w, double h)
contains
in interface java.awt.Shape
public boolean contains(java.awt.geom.Rectangle2D r)
contains
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
getPathIterator
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
getPathIterator
in interface java.awt.Shape