Package org.locationtech.jts.geom
Class MultiPolygon
- java.lang.Object
-
- org.locationtech.jts.geom.Geometry
-
- org.locationtech.jts.geom.GeometryCollection
-
- org.locationtech.jts.geom.MultiPolygon
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,Polygonal
public class MultiPolygon extends GeometryCollection implements Polygonal
Models a collection ofPolygon
s.As per the OGC SFS specification, the Polygons in a MultiPolygon may not overlap, and may only touch at single points. This allows the topological point-set semantics to be well-defined.
- Version:
- 1.7
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.locationtech.jts.geom.Geometry
TYPENAME_GEOMETRYCOLLECTION, TYPENAME_LINEARRING, TYPENAME_LINESTRING, TYPENAME_MULTILINESTRING, TYPENAME_MULTIPOINT, TYPENAME_MULTIPOLYGON, TYPENAME_POINT, TYPENAME_POLYGON
-
-
Constructor Summary
Constructors Constructor Description MultiPolygon(Polygon[] polygons, GeometryFactory factory)
MultiPolygon(Polygon[] polygons, PrecisionModel precisionModel, int SRID)
Deprecated.Use GeometryFactory instead
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equalsExact(Geometry other, double tolerance)
Returns true if the twoGeometry
s are exactly equal, up to a specified distance tolerance.Geometry
getBoundary()
Computes the boundary of this geometryint
getBoundaryDimension()
Returns the dimension of thisGeometry
s inherent boundary.int
getDimension()
Returns the dimension of this geometry.java.lang.String
getGeometryType()
Returns the name of this Geometry's actual class.Geometry
reverse()
Deprecated.-
Methods inherited from class org.locationtech.jts.geom.GeometryCollection
apply, apply, apply, apply, clone, getArea, getCoordinate, getCoordinates, getGeometryN, getLength, getNumGeometries, getNumPoints, isEmpty, normalize
-
Methods inherited from class org.locationtech.jts.geom.Geometry
buffer, buffer, buffer, compareTo, compareTo, contains, convexHull, copy, coveredBy, covers, crosses, difference, disjoint, distance, equals, equals, equalsExact, equalsNorm, equalsTopo, geometryChanged, getCentroid, getEnvelope, getEnvelopeInternal, getFactory, getInteriorPoint, getPrecisionModel, getSRID, getUserData, hashCode, intersection, intersects, isRectangle, isSimple, isValid, isWithinDistance, norm, overlaps, relate, relate, setSRID, setUserData, symDifference, toString, toText, touches, union, union, within
-
-
-
-
Constructor Detail
-
MultiPolygon
public MultiPolygon(Polygon[] polygons, PrecisionModel precisionModel, int SRID)
Deprecated.Use GeometryFactory insteadConstructs aMultiPolygon
.- Parameters:
polygons
- thePolygon
s for thisMultiPolygon
, ornull
or an empty array to create the empty geometry. Elements may be emptyPolygon
s, but notnull
s. The polygons must conform to the assertions specified in the OpenGIS Simple Features Specification for SQL .precisionModel
- the specification of the grid of allowable points for thisMultiPolygon
SRID
- the ID of the Spatial Reference System used by thisMultiPolygon
-
MultiPolygon
public MultiPolygon(Polygon[] polygons, GeometryFactory factory)
- Parameters:
polygons
- thePolygon
s for thisMultiPolygon
, ornull
or an empty array to create the empty geometry. Elements may be emptyPolygon
s, but notnull
s. The polygons must conform to the assertions specified in the OpenGIS Simple Features Specification for SQL.
-
-
Method Detail
-
getDimension
public int getDimension()
Description copied from class:Geometry
Returns the dimension of this geometry. The dimension of a geometry is is the topological dimension of its embedding in the 2-D Euclidean plane. In the JTS spatial model, dimension values are in the set {0,1,2}.Note that this is a different concept to the dimension of the vertex
Coordinate
s. The geometry dimension can never be greater than the coordinate dimension. For example, a 0-dimensional geometry (e.g. a Point) may have a coordinate dimension of 3 (X,Y,Z).- Overrides:
getDimension
in classGeometryCollection
- Returns:
- the topological dimension of this geometry.
-
getBoundaryDimension
public int getBoundaryDimension()
Description copied from class:Geometry
Returns the dimension of thisGeometry
s inherent boundary.- Overrides:
getBoundaryDimension
in classGeometryCollection
- Returns:
- the dimension of the boundary of the class implementing this
interface, whether or not this object is the empty geometry. Returns
Dimension.FALSE
if the boundary is the empty geometry.
-
getGeometryType
public java.lang.String getGeometryType()
Description copied from class:Geometry
Returns the name of this Geometry's actual class.- Overrides:
getGeometryType
in classGeometryCollection
- Returns:
- the name of this
Geometry
s actual class
-
getBoundary
public Geometry getBoundary()
Computes the boundary of this geometry- Overrides:
getBoundary
in classGeometryCollection
- Returns:
- a lineal geometry (which may be empty)
- See Also:
Geometry.getBoundary()
-
equalsExact
public boolean equalsExact(Geometry other, double tolerance)
Description copied from class:Geometry
Returns true if the twoGeometry
s are exactly equal, up to a specified distance tolerance. Two Geometries are exactly equal within a distance tolerance if and only if:- they have the same structure
- they have the same values for their vertices, within the given tolerance distance, in exactly the same order.
GeometryFactory
, theSRID
, or theuserData
fields.To properly test equality between different geometries, it is usually necessary to
Geometry.normalize()
them first.- Overrides:
equalsExact
in classGeometryCollection
- Parameters:
other
- theGeometry
with which to compare thisGeometry
tolerance
- distance at or below which twoCoordinate
s are considered equal- Returns:
true
if this and the otherGeometry
have identical structure and point values, up to the distance tolerance.- See Also:
Geometry.equalsExact(Geometry)
,Geometry.normalize()
,Geometry.norm()
-
reverse
public Geometry reverse()
Deprecated.Creates aMultiPolygon
with every component reversed. The order of the components in the collection are not reversed.- Overrides:
reverse
in classGeometryCollection
- Returns:
- a MultiPolygon in the reverse order
-
-