gistoolkit.features
Class MultiPolygon

java.lang.Object
  extended bygistoolkit.features.Shape
      extended bygistoolkit.features.MultiPolygon
Direct Known Subclasses:
MultiPolygonM

public class MultiPolygon
extends Shape

Represents a collection of Polygons.


Field Summary
 
Fields inherited from class gistoolkit.features.Shape
EQUAL_LIMIT, LINEARRING, LINESTRING, MULTILINESTRING, MULTIPOINT, MULTIPOLYGON, myEnvelope, NULLSHAPE, POINT, POLYGON, RASTER
 
Constructor Summary
MultiPolygon()
          Creates a new MultiPolygon
MultiPolygon(Polygon[] inPolygons)
          Creates a MultiPolygon from the Polygons
MultiPolygon(Polygon[] inPolygons, Envelope inEnvelope)
          Creates a MultiPolygon from the Polygons and the envelope
 
Method Summary
 int add(double inX, double inY)
          Add the a point to this shape.
 boolean add(int inIndex, double inX, double inY)
          Adds the point to this shape at the given index.
 void addPolygon(int inIndex, Polygon inPolygon)
          Add a Polygon to this MultiPolygonat the given location
 void calculateEnvelope()
          Recalculates the emvelope for the shape.
 java.lang.Object clone()
          Creates a copy of the MultiPolygon.
 boolean contains(Shape inShape)
          returns true if any of the contained polygons contain this shape.
 int getClosestIndex(double inX, double inY)
          Find index of the point within the MultiPolygon closest to this point.
 Point getClosestPoint(double inX, double inY)
          Find the point within the MultiPolygon closest to this point.
 double getDistanceToPoint(double inX, double inY)
          Get the distance from this shape to the given point
 Envelope getEnvelope()
          Return the envelope of this multipolygon.
 int getNumPoints()
          Return the number of points in this shape.
 Point getPoint(int inIndex)
          Get the point at the given index.
 Point[] getPoints()
          Returns an array of points representing this shape.
 Polygon[] getPolygons()
          return the list of Polygons contained within this MultiPolygon.
 java.lang.String getShapeType()
          Return the type of shape this is
 java.lang.String getWKT()
          Returns the OGIS Well Know Text Representation of this shape
 boolean intersects(Shape inShape)
          Determines if the two shapes intersect
 boolean intersectsMultiPolygon(MultiPolygon inMultiPolygon)
          A MultiPolygon intersects another MultiPolygon if any of the constituent polygons intersect.
 boolean intersectsRasterShape(RasterShape inRasterShape)
          A MultiPolygon intersects a RasterShape if the MultiPolygon intersects the envelope of the raster
 boolean remove(int inIndex)
          Delete the given point from the polygon.
 void removePolygon(int inIndex)
          Remove the indicated polygon from this multi polygon.
 void setPoint(int inIndex, double inXCoordinate, double inYCoordinate)
          Set the point at the given index.
 void translate(double inXDistance, double inYDistance)
          Translate the shape the given distance in the X and Y directions
 
Methods inherited from class gistoolkit.features.Shape
distance, getDistance, getDistanceToEnvelope, getDistanceToLine, getDistanceToLine, getLinesIntersect, linesIntersect, linesIntersect, pointOnLine, pointOnLine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiPolygon

public MultiPolygon()
Creates a new MultiPolygon


MultiPolygon

public MultiPolygon(Polygon[] inPolygons)
Creates a MultiPolygon from the Polygons


MultiPolygon

public MultiPolygon(Polygon[] inPolygons,
                    Envelope inEnvelope)
Creates a MultiPolygon from the Polygons and the envelope

Method Detail

getShapeType

public java.lang.String getShapeType()
Return the type of shape this is

Specified by:
getShapeType in class Shape

getNumPoints

public int getNumPoints()
Return the number of points in this shape.

Specified by:
getNumPoints in class Shape

getPoint

public Point getPoint(int inIndex)
Get the point at the given index.

Specified by:
getPoint in class Shape

setPoint

public void setPoint(int inIndex,
                     double inXCoordinate,
                     double inYCoordinate)
Set the point at the given index.

Specified by:
setPoint in class Shape

add

public int add(double inX,
               double inY)
Add the a point to this shape. Returns the location where the point was added. Returns -1 if it could not be added.

Specified by:
add in class Shape

add

public boolean add(int inIndex,
                   double inX,
                   double inY)
Adds the point to this shape at the given index.

Specified by:
add in class Shape

remove

public boolean remove(int inIndex)
Delete the given point from the polygon.

Specified by:
remove in class Shape

calculateEnvelope

public void calculateEnvelope()
Recalculates the emvelope for the shape.

Overrides:
calculateEnvelope in class Shape

getEnvelope

public Envelope getEnvelope()
Return the envelope of this multipolygon.

Specified by:
getEnvelope in class Shape

clone

public java.lang.Object clone()
Creates a copy of the MultiPolygon.

Specified by:
clone in class Shape

contains

public boolean contains(Shape inShape)
returns true if any of the contained polygons contain this shape.

Overrides:
contains in class Shape

getPolygons

public Polygon[] getPolygons()
return the list of Polygons contained within this MultiPolygon.


getPoints

public Point[] getPoints()
Returns an array of points representing this shape. used by things like projections that need to operate on all the points in the shape.

Specified by:
getPoints in class Shape

getWKT

public java.lang.String getWKT()
Returns the OGIS Well Know Text Representation of this shape

Specified by:
getWKT in class Shape

addPolygon

public void addPolygon(int inIndex,
                       Polygon inPolygon)
Add a Polygon to this MultiPolygonat the given location


removePolygon

public void removePolygon(int inIndex)
Remove the indicated polygon from this multi polygon.


getClosestPoint

public Point getClosestPoint(double inX,
                             double inY)
Find the point within the MultiPolygon closest to this point.


getClosestIndex

public int getClosestIndex(double inX,
                           double inY)
Find index of the point within the MultiPolygon closest to this point.

Specified by:
getClosestIndex in class Shape

translate

public void translate(double inXDistance,
                      double inYDistance)
Translate the shape the given distance in the X and Y directions

Specified by:
translate in class Shape

getDistanceToPoint

public double getDistanceToPoint(double inX,
                                 double inY)
Get the distance from this shape to the given point

Specified by:
getDistanceToPoint in class Shape

intersects

public boolean intersects(Shape inShape)
Determines if the two shapes intersect

Specified by:
intersects in class Shape

intersectsMultiPolygon

public boolean intersectsMultiPolygon(MultiPolygon inMultiPolygon)
A MultiPolygon intersects another MultiPolygon if any of the constituent polygons intersect.


intersectsRasterShape

public boolean intersectsRasterShape(RasterShape inRasterShape)
A MultiPolygon intersects a RasterShape if the MultiPolygon intersects the envelope of the raster