Package net.sf.eBusx.geo
Class GeoPolygon
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject
-
- net.sf.eBus.messages.EField
-
- net.sf.eBusx.geo.GeoObject
-
- net.sf.eBusx.geo.GeoPolygon
-
- All Implemented Interfaces:
java.io.Serializable
public final class GeoPolygon extends GeoObject
A polygon is one or more linear rings and a linear ring is aLineString
meeting the following constraints:- Has four or more closed positions.
- First and last positions are equivalent, and must contain identical values; their representation should also be identical.
- Is a boundary of a surface or the boundary of a hole in a surface.
- Must follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise.
Although a linear ring is not explicitly represented as a GeoJSON geometry type, it leads to a canonical formulation of the Polygon geometry type definition as follows:
- For type "Polygon", the "coordinates" member must be an array of linear rings.
- For Polygons with more than one of these rings, the first must be the exterior ring, and any others must be interior rings. The exterior ring bounds the surface, and the interior rings (if present) bound holes within the surface.
GeoPolygon
does not enforce the linear rings requirement. This means that an invalid set ofLineString
s which do not form linear rings may be entered. If you wish to transmit a random list of line strings please useGeoLineString
instead.- Author:
- Charles W. Rapp
- See Also:
GeoMultiLineString
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GeoPolygon.Builder
Builder class used to createGeoPolygon
instances.-
Nested classes/interfaces inherited from class net.sf.eBusx.geo.GeoObject
GeoObject.GeoBuilder<F extends GeoObject>, GeoObject.GeoType
-
-
Field Summary
Fields Modifier and Type Field Description LineString[]
linearRings
Array of one or more linear rings defining polygon.-
Fields inherited from class net.sf.eBusx.geo.GeoObject
boundingBox, MAX_LATITUDE, MAX_LONGITUDE, MIN_LATITUDE, MIN_LONGITUDE, type
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GeoPolygon.Builder
builder()
Returns a new GeoJSON polygon builder instance.boolean
equals(java.lang.Object o)
Returnstrue
ifo
is a non-nuull GeoPolygon
with a lineear ring array equalingthis GeoPolygo
linear ring array.int
hashCode()
Returns hash code based on contained linear rings.java.lang.String
toString()
Returns text containing linear rings defining the polygon.-
Methods inherited from class net.sf.eBusx.geo.GeoObject
validateLatitude, validateLongitude
-
-
-
-
Field Detail
-
linearRings
public final LineString[] linearRings
Array of one or more linear rings defining polygon.
-
-
Method Detail
-
toString
public java.lang.String toString()
Returns text containing linear rings defining the polygon.
-
equals
public boolean equals(java.lang.Object o)
Returnstrue
ifo
is a non-nuull GeoPolygon
with a lineear ring array equalingthis GeoPolygo
linear ring array. Otherwise returnsfalse
.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- comparison object.- Returns:
true
ifo
equalsthis
object.
-
hashCode
public int hashCode()
Returns hash code based on contained linear rings.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- linear rings hash code.
-
builder
public static GeoPolygon.Builder builder()
Returns a new GeoJSON polygon builder instance.- Returns:
- new polygon builder instance.
-
-