Class Position
java.lang.Object
ch.tocco.nice2.optional.geolocation.api.Position
- All Implemented Interfaces:
Serializable
A geographical position specified by a pair of latitude and longitude coordinates.
The walkXxx
and getBoundingBox
methods calculate good
results for small distances only! Feel free to improve this to support e.g. travelling
around the earth multiple times etc.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondistanceTo
(Position position) boolean
Position[]
getBoundingBox
(Distance dst) Returns a bounding square around this position where this is the center of the square.int
hashCode()
toString()
Returns the position locateddst
eastern from this.Returns the position locateddst
northern from this.Returns the position locateddst
southern from this.Returns the position locateddst
western from this.
-
Field Details
-
RADIUS_EARTH_KM
-
-
Constructor Details
-
Position
-
-
Method Details
-
getLatitude
-
getLongitude
-
distanceTo
-
walkNorth
Returns the position locateddst
northern from this.- Parameters:
dst
- the travelling distance- Returns:
- the new position
dst
northern from this
-
walkSouth
Returns the position locateddst
southern from this.- Parameters:
dst
- the travelling distance- Returns:
- the new position
dst
southern from this
-
walkEast
Returns the position locateddst
eastern from this.- Parameters:
dst
- the travelling distance- Returns:
- the new position
dst
eastern from this
-
walkWest
Returns the position locateddst
western from this.- Parameters:
dst
- the travelling distance- Returns:
- the new position
dst
western from this
-
getBoundingBox
Returns a bounding square around this position where this is the center of the square. Note, the result is the unexacter the larger the distance gets!- Parameters:
dst
- the distance from this position to an edge of the square (so the total width of one side of the bounding box is 2 * dist).- Returns:
- two positions in an array where the fist element is the upper-left corner and the second element is the lower-right corner
-
equals
-
hashCode
public int hashCode() -
toString
-