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 newGeoJsonPolygonfrom the givenPoints.Creates newGeoJsonPolygonfrom the givenPoints. -
Method Summary
Modifier and TypeMethodDescriptionbooleanThe value of the coordinates member is always anIterable.getType()String value representing the type of theGeoJsonobject.inthashCode()withInnerRing(List<Point> points) Creates a newGeoJsonPolygonwith an inner ring defined be the givenPoints.withInnerRing(GeoJsonLineString lineString) Creates a newGeoJsonPolygonwith an inner ring defined be the givenGeoJsonLineString.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
GeoJsonPolygon
Creates newGeoJsonPolygonfrom the givenPoints.- 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 newGeoJsonPolygonfrom the givenPoints.- Parameters:
points- must not be null.
-
-
Method Details
-
withInnerRing
public GeoJsonPolygon withInnerRing(Point first, Point second, Point third, Point fourth, Point... others) Creates a newGeoJsonPolygonwith an inner ring defined be the givenPoints.- 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 newGeoJsonPolygonwith an inner ring defined be the givenGeoJsonLineString.- Parameters:
lineString- must not be null.- Returns:
- new
GeoJsonPolygon. - Since:
- 1.10
-
getType
Description copied from interface:GeoJsonString value representing the type of theGeoJsonobject.- Specified by:
getTypein interfaceGeoJson<List<GeoJsonLineString>>- Returns:
- will never be null.
- See Also:
-
getCoordinates
Description copied from interface:GeoJsonThe value of the coordinates member is always anIterable. The structure for the elements within is determined byGeoJson.getType()of geometry.- Specified by:
getCoordinatesin interfaceGeoJson<List<GeoJsonLineString>>- Returns:
- will never be null.
- See Also:
-
equals
-
hashCode
public int hashCode()
-