Class GeoJsonPolygon
java.lang.Object
org.springframework.data.geo.Polygon
org.springframework.data.mongodb.core.geo.GeoJsonPolygon
- All Implemented Interfaces:
Serializable
,Iterable<Point>
,Shape
,GeoJson<List<GeoJsonLineString>>
GeoJson
representation of Polygon
. Unlike Polygon
the GeoJsonPolygon
requires a
closed border. Which means that the first and last Point
have to have same coordinate pairs.- Since:
- 1.7
- Author:
- Christoph Strobl, Mark Paluch
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGeoJsonPolygon
(List<Point> points) Creates newGeoJsonPolygon
from the givenPoint
s.Creates newGeoJsonPolygon
from the givenPoint
s. -
Method Summary
Modifier and TypeMethodDescriptionboolean
The value of the coordinates member is always anIterable
.getType()
String value representing the type of theGeoJson
object.int
hashCode()
withInnerRing
(List<Point> points) Creates a newGeoJsonPolygon
with an inner ring defined be the givenPoint
s.withInnerRing
(GeoJsonLineString lineString) Creates a newGeoJsonPolygon
with an inner ring defined be the givenGeoJsonLineString
.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
GeoJsonPolygon
Creates newGeoJsonPolygon
from the givenPoint
s.- Parameters:
first
- must not be null.second
- must not be null.third
- must not be null.fourth
- must not be null.others
- can be empty.
-
GeoJsonPolygon
Creates newGeoJsonPolygon
from the givenPoint
s.- Parameters:
points
- must not be null.
-
-
Method Details
-
withInnerRing
public GeoJsonPolygon withInnerRing(Point first, Point second, Point third, Point fourth, Point... others) Creates a newGeoJsonPolygon
with an inner ring defined be the givenPoint
s.- Parameters:
first
- must not be null.second
- must not be null.third
- must not be null.fourth
- must not be null.others
- can be empty.- Returns:
- new
GeoJsonPolygon
. - Since:
- 1.10
-
withInnerRing
- Parameters:
points
- must not be null.- Returns:
- new
GeoJsonPolygon
.
-
withInnerRing
Creates a newGeoJsonPolygon
with an inner ring defined be the givenGeoJsonLineString
.- Parameters:
lineString
- must not be null.- Returns:
- new
GeoJsonPolygon
. - Since:
- 1.10
-
getType
Description copied from interface:GeoJson
String value representing the type of theGeoJson
object.- Specified by:
getType
in interfaceGeoJson<List<GeoJsonLineString>>
- Returns:
- will never be null.
- See Also:
-
getCoordinates
Description copied from interface:GeoJson
The value of the coordinates member is always anIterable
. The structure for the elements within is determined byGeoJson.getType()
of geometry.- Specified by:
getCoordinates
in interfaceGeoJson<List<GeoJsonLineString>>
- Returns:
- will never be null.
- See Also:
-
equals
-
hashCode
public int hashCode()
-