Class Polygon
java.lang.Object
org.apache.tinkerpop.gremlin.structure.geo.Geometry
org.apache.tinkerpop.gremlin.structure.geo.Surface
org.apache.tinkerpop.gremlin.structure.geo.Polygon
- All Implemented Interfaces:
Comparable<Geometry>
A polygon geometry representing an area enclosed by a shell with optional holes.
Polygons are immutable. Each ring must be closed (first and last points equal)
and have at least 4 points.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic Polygonempty()Creates an empty polygon withModel.CARTESIANmodel.static PolygonCreates an empty polygon with the specified model.booleanExact equality: same type, same SRID, same coordinates (including z flag).Returns the exterior ring (shell) of this polygon.inthashCode()Hash code consistent with equals.Returns an unmodifiable list of interior rings (holes).booleanisEmpty()Returns true if this geometry is empty (has no coordinates).static Polygonof(LineString shell, LineString... holes) Creates a polygon from a shell ring and optional hole rings.
-
Method Details
-
of
Creates a polygon from a shell ring and optional hole rings. All rings must be closed (first and last point equal) and have at least 4 points. All rings must have the same SRID and z-dimension flag. A hole ring must not be empty, and an empty shell is only valid for a polygon with no holes.- Parameters:
shell- the exterior ringholes- the interior rings (holes)- Returns:
- the polygon
- Throws:
IllegalArgumentException- ifshellis null, ifholesis null or holds a null element, if a ring that is not empty has fewer than 4 points or does not have equal first and last points, if any hole is empty, ifshellis empty and any hole is given, or if the rings do not all have the same SRID and the same z dimension- Since:
- 4.0.0
-
empty
Creates an empty polygon withModel.CARTESIANmodel.- Returns:
- an empty polygon
- Since:
- 4.0.0
-
empty
Creates an empty polygon with the specified model.- Parameters:
model-Model.CARTESIANorModel.GEOGRAPHIC- Returns:
- an empty polygon
- Throws:
IllegalArgumentException- ifmodelisModel.OTHERor null- Since:
- 4.0.0
-
exteriorRing
Returns the exterior ring (shell) of this polygon.- Returns:
- the exterior ring, an empty line string when this polygon is empty
- Since:
- 4.0.0
-
interiorRings
Returns an unmodifiable list of interior rings (holes).- Returns:
- the holes, an empty list when this polygon has no holes
- Since:
- 4.0.0
-
isEmpty
public boolean isEmpty()Description copied from class:GeometryReturns true if this geometry is empty (has no coordinates). For collections, returns true if all parts are empty. -
equals
Description copied from class:GeometryExact equality: same type, same SRID, same coordinates (including z flag). Coordinates are compared numerically, so -0.0 equals 0.0. -
hashCode
public int hashCode()Description copied from class:GeometryHash code consistent with equals. Zero values are normalized so -0.0 and 0.0 hash alike.
-