Package net.sf.eBusx.geo
Class Position
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject
-
- net.sf.eBus.messages.EField
-
- net.sf.eBusx.geo.Position
-
- All Implemented Interfaces:
java.io.Serializable
public final class Position extends EField
A position is the fundamental geometry construct. The "coordinates" member of a Geometry object is composed of either:- one position in the case of a Point geometry,
- an array of positions in the case of a LineString or MultiPoint geometry,
- an array of LineString or linear ring coordinates in the case of a Polygon or MultiLineString geometry, or
- an array of Polygon coordinates in the case of a MultiPolygon geometry.
Implementations should not extend positions beyond three elements because the semantics of extra elements are unspecified and ambiguous. Historically, some implementations have used a fourth element to carry a linear referencing measure (sometimes denoted as "M") or a numerical timestamp, but in most situations a parser will not be able to properly interpret these values. The interpretation and meaning of additional elements is beyond the scope of this specification, and additional elements may be ignored by parsers.
- Author:
- Charles W. Rapp
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Position.Builder
Position
instances may be created only by using aBuilder
instance.
-
Field Summary
Fields Modifier and Type Field Description java.math.BigDecimal
elevation
Elevation is an optional third parameter and may be set tonull
.java.math.BigDecimal
latitude
Latitude coordinate in degrees (North of equator is positive) using the standard WGS84 projection.java.math.BigDecimal
longitude
Longitude coordinate in degrees (East of Greenwich is positive) using the standard WGS84 projection.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Position.Builder
builder()
Returns a new GeoJSON position builder instance.boolean
equals(java.lang.Object o)
Returnstrue
if eithero
is the samePosition
instance asthis
or is a non-null Position
instance with the same latitude and longitude asthis Position
.int
hashCode()
Returns a hash of the latitude and longitude.java.lang.String
toString()
Returns human-readable text containing the position latitude and longitude.
-
-
-
Field Detail
-
latitude
public final java.math.BigDecimal latitude
Latitude coordinate in degrees (North of equator is positive) using the standard WGS84 projection. Some applications may not accept latitudes above/below ±85 degrees for some projections.
-
longitude
public final java.math.BigDecimal longitude
Longitude coordinate in degrees (East of Greenwich is positive) using the standard WGS84 projection. Note that geographic poles will be exactly at latitude ±90 degrees but in that case the longitude will be set to an arbitrary value within this range.
-
elevation
@Nullable public final java.math.BigDecimal elevation
Elevation is an optional third parameter and may be set tonull
.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
Returnstrue
if eithero
is the samePosition
instance asthis
or is a non-null Position
instance with the same latitude and longitude asthis Position
.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- comparison object.- Returns:
- if
o
is a non-null Position
instance with the same latitude and longitude asthis Position
.
-
hashCode
public int hashCode()
Returns a hash of the latitude and longitude.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hash of the GeoJSON position.
-
toString
public java.lang.String toString()
Returns human-readable text containing the position latitude and longitude.- Overrides:
toString
in classjava.lang.Object
- Returns:
- GeoJSON position as human-readable text.
-
builder
public static Position.Builder builder()
Returns a new GeoJSON position builder instance.- Returns:
- new
Position.Builder
instance.
-
-