|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.geotools.renderer.geom.Geometry
org.geotools.renderer.geom.Polyline
org.geotools.renderer.geom.Polygon
A polygon bounded by one exterior ring (the "shell") and zero or more interior rings
(the "holes"). Shell and holes are stored as Polyline objects.
| Field Summary |
| Fields inherited from class org.geotools.renderer.geom.Geometry |
DEFAULT_COORDINATE_SYSTEM |
| Constructor Summary | |
Polygon(Polyline shell)
Construct a polygon from the specified polyline. |
|
Polygon(java.awt.geom.Rectangle2D rectangle,
CoordinateSystem coordinateSystem)
Construct a polygon from the specified rectangle. |
|
| Method Summary | |
void |
addHole(Polyline hole)
Add a hole to this polygon. |
Geometry |
clip(Clipper clipper)
Returns a polygon approximately equal to this polygon clipped to the specified bounds. |
java.lang.Object |
clone()
Return a clone of this geometry. |
float |
compress(CompressionLevel level)
Compress this polygon. |
boolean |
contains(double x,
double y)
Tests if the specified coordinates are inside the boundary of this polygon. |
boolean |
contains(java.awt.Shape shape)
Test if the interior of this polygon entirely contains the given shape. |
boolean |
equals(java.lang.Object object)
Compare the specified object with this polygon for equality. |
java.lang.String |
getName(java.util.Locale locale)
Returns the localized name for this polygon. |
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform transform)
Returns a path iterator for this polyline. |
int |
getPointCount()
Return the number of points in this polygon. |
Statistics |
getResolution()
Returns the polygon's resolution. |
int |
hashCode()
Returns a hash code for this polygon. |
boolean |
intersects(java.awt.Shape shape)
Tests if the interior of this polygon intersects the interior of a specified shape. |
void |
reverse()
Reverse point order in this polygon. |
void |
setCoordinateSystem(CoordinateSystem coordinateSystem)
Set the polygon's coordinate system. |
void |
setName(java.lang.String name)
Set a default name for this polygon. |
void |
setRenderingResolution(float resolution)
Hints this polygon that the specified resolution is sufficient for rendering. |
void |
setResolution(double resolution)
Sets the polygon's resolution. |
| Methods inherited from class org.geotools.renderer.geom.Polyline |
append, append, appendBorder, close, contains, contains, getBounds2D, getCachedPointCount, getCoordinateSystem, getFirstPoint, getFirstPoints, getLastPoint, getLastPoints, getPoints, getRenderingResolution, intersects, isClosed, isEmpty, prependBorder, print, print, print, readObject, subpoly, toArray |
| Methods inherited from class org.geotools.renderer.geom.Geometry |
contains, getBounds, getID, getPathIterator, getStyle, getUserObject, intersects, setID, setStyle, setUserObject, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Polygon(Polyline shell)
shell - The exterior ring.
public Polygon(java.awt.geom.Rectangle2D rectangle,
CoordinateSystem coordinateSystem)
NaN value.
rectangle - Rectangle to copy in the new Polygon.coordinateSystem - The rectangle's coordinate system, or null if unknown.| Method Detail |
public java.lang.String getName(java.util.Locale locale)
setName(java.lang.String).
getName in class Geometrylocale - The desired locale. If no name is available
for this locale, a default locale will be used.
public void setName(java.lang.String name)
null if this polygon is unnamed.
public void setCoordinateSystem(CoordinateSystem coordinateSystem)
throws org.opengis.referencing.operation.TransformException,
UnmodifiableGeometryException
setCoordinateSystem in class PolylinecoordinateSystem - The new coordinate system. A null value reset
the default coordinate system (usually the one that best fits internal data).
org.opengis.referencing.operation.TransformException - If a transformation failed. In case of failure,
the state of this object will stay unchanged, as if this method has
never been invoked.
UnmodifiableGeometryException - if modifying this geometry would corrupt a container.
To avoid this exception, clone this geometry before to modify it.
public void addHole(Polyline hole)
throws org.opengis.referencing.operation.TransformException,
UnmodifiableGeometryException
hole - The hole to add.
org.opengis.referencing.operation.TransformException - if the hole uses an incompatible coordinate system.
java.lang.IllegalArgumentException - if the hole is not inside the exterior ring.
UnmodifiableGeometryException - if modifying this geometry would corrupt a container.
To avoid this exception, clone this geometry before to modify it.public void reverse()
reverse in class Polylinepublic int getPointCount()
Polyline.getPoints(), which
contains the points in the exterior ring only.
getPointCount in class PolylinePolyline.isEmpty(),
Polyline.getPoints(),
Polyline.getFirstPoint(java.awt.geom.Point2D),
Polyline.getFirstPoints(java.awt.geom.Point2D[]),
Polyline.getLastPoint(java.awt.geom.Point2D),
Polyline.getLastPoints(java.awt.geom.Point2D[]),
Polyline.toArray(float)
public boolean contains(double x,
double y)
contains in interface java.awt.Shapecontains in class Polylinex - the specified x coordinates in this polygon coordinate system.y - the specified y coordinates in this polygon coordinate system.
true if the specified coordinates are inside the polygon
boundary and outside any hole; false otherwise.public boolean contains(java.awt.Shape shape)
false if the given shape intersects a hole.
contains in class Polylinepublic boolean intersects(java.awt.Shape shape)
false if the given shape in entirely contained in a hole.
intersects in class Polyline
public float compress(CompressionLevel level)
throws org.opengis.referencing.operation.TransformException
level argument specify the algorithm,
which may be desctructive (i.e. data may loose precision).
compress in class Polylinelevel - The compression level (or algorithm) to use. See the CompressionLevel
javadoc for an explanation of available algorithms.
org.opengis.referencing.operation.TransformException - If an error has come up during a cartographic projection.public Statistics getResolution()
getResolution in class Polyline
public void setResolution(double resolution)
throws org.opengis.referencing.operation.TransformException
setResolution in class Polylineresolution - Desired resolution, in the same units as Polyline.getResolution().
org.opengis.referencing.operation.TransformException - If some coordinate transformations were needed and failed.
There is no guarantee on polygon's state in case of failure.public void setRenderingResolution(float resolution)
setRenderingResolution in class Polylineresolution - The resolution to use at rendering time, in units of this polyline's
coordinate system (linear or angular units).public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform transform)
getPathIterator in interface java.awt.ShapegetPathIterator in class Polylinepublic Geometry clip(Clipper clipper)
this. If this polygon doesn't intersect the clip area, then this
method returns null. Otherwise, a new polygon is created and returned. The new
polyline will try to share as much internal data as possible with this in order
to keep memory footprint low.
clip in class Polylineclipper - The clip area.
null if this polygon doesn't intersect the clip, this
if no clip has been performed, or a new clipped polygon otherwise.public final java.lang.Object clone()
final for implementation reason.
clone in interface org.opengis.util.Cloneableclone in class Polylinepublic boolean equals(java.lang.Object object)
equals in class Polylinepublic int hashCode()
hashCode in class Polyline
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||