Package com.mongodb.client.model.geojson
Class Polygon
-
- com.mongodb.client.model.geojson.Geometry
-
- com.mongodb.client.model.geojson.Polygon
-
public final class Polygon extends Geometry
A representation of a GeoJSON Polygon.- Since:
- 3.1
-
-
Constructor Summary
Constructors Constructor Description Polygon(CoordinateReferenceSystem coordinateReferenceSystem, PolygonCoordinates coordinates)
Construct an instance with the given coordinates and coordinate reference system.Polygon(PolygonCoordinates coordinates)
Construct an instance with the given coordinates.<Position> exterior, <Position>... holes)
Construct an instance with the given coordinates.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
o)
PolygonCoordinates
getCoordinates()
Gets the GeoJSON coordinates of the polygon<Position>
getExterior()
Gets the exterior coordinates.<<Position>>
getHoles()
Get the holes in this polygon.GeoJsonObjectType
getType()
Gets the GeoJSON object type.int
hashCode()
toString()
-
Methods inherited from class com.mongodb.client.model.geojson.Geometry
getCoordinateReferenceSystem, toJson
-
-
-
-
Constructor Detail
-
Polygon
public Polygon(<Position> exterior, <Position>... holes)
Construct an instance with the given coordinates.- Parameters:
exterior
- the exterior ring of the polygonholes
- optional interior rings of the polygon
-
Polygon
public Polygon(PolygonCoordinates coordinates)
Construct an instance with the given coordinates.- Parameters:
coordinates
- the coordinates
-
Polygon
public Polygon(@Nullable CoordinateReferenceSystem coordinateReferenceSystem, PolygonCoordinates coordinates)
Construct an instance with the given coordinates and coordinate reference system.- Parameters:
coordinateReferenceSystem
- the coordinate reference systemcoordinates
- the coordinates
-
-
Method Detail
-
getType
public GeoJsonObjectType getType()
Description copied from class:Geometry
Gets the GeoJSON object type.
-
getCoordinates
public PolygonCoordinates getCoordinates()
Gets the GeoJSON coordinates of the polygon- Returns:
- the coordinates, which must have at least one element
-
getExterior
public <Position> getExterior()
Gets the exterior coordinates.- Returns:
- the exterior coordinates
-
getHoles
public <<Position>> getHoles()
Get the holes in this polygon.- Returns:
- the possibly-empty list of holes
-
toString
public toString()
- Overrides:
in class
-
-