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 aLineStringmeeting 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.
GeoPolygondoes not enforce the linear rings requirement. This means that an invalid set ofLineStrings which do not form linear rings may be entered. If you wish to transmit a random list of line strings please useGeoLineStringinstead.- Author:
- Charles W. Rapp
- See Also:
GeoMultiLineString, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGeoPolygon.BuilderBuilder class used to createGeoPolygoninstances.-
Nested classes/interfaces inherited from class net.sf.eBusx.geo.GeoObject
GeoObject.GeoBuilder<F extends GeoObject,B extends GeoObject.GeoBuilder<F,?>>, GeoObject.GeoType
-
-
Field Summary
Fields Modifier and Type Field Description LineString[]linearRingsArray 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.Builderbuilder()Returns a new GeoJSON polygon builder instance.booleanequals(java.lang.Object o)Returnstrueifois a non-nuull GeoPolygonwith a lineear ring array equalingthis GeoPolygolinear ring array.inthashCode()Returns hash code based on contained linear rings.java.lang.StringtoString()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)
Returnstrueifois a non-nuull GeoPolygonwith a lineear ring array equalingthis GeoPolygolinear ring array. Otherwise returnsfalse.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- comparison object.- Returns:
trueifoequalsthisobject.
-
hashCode
public int hashCode()
Returns hash code based on contained linear rings.- Overrides:
hashCodein 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.
-
-