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 classPosition.BuilderPositioninstances may be created only by using aBuilderinstance.
-
Field Summary
Fields Modifier and Type Field Description java.math.BigDecimalelevationElevation is an optional third parameter and may be set tonull.java.math.BigDecimallatitudeLatitude coordinate in degrees (North of equator is positive) using the standard WGS84 projection.java.math.BigDecimallongitudeLongitude 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.Builderbuilder()Returns a new GeoJSON position builder instance.booleanequals(java.lang.Object o)Returnstrueif eitherois the samePositioninstance asthisor is a non-null Positioninstance with the same latitude and longitude asthis Position.inthashCode()Returns a hash of the latitude and longitude.java.lang.StringtoString()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)
Returnstrueif eitherois the samePositioninstance asthisor is a non-null Positioninstance with the same latitude and longitude asthis Position.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- comparison object.- Returns:
- if
ois a non-null Positioninstance with the same latitude and longitude asthis Position.
-
hashCode
public int hashCode()
Returns a hash of the latitude and longitude.- Overrides:
hashCodein 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:
toStringin 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.Builderinstance.
-
-