Package org.jxmapviewer.viewer
Class GeoPosition
java.lang.Object
org.jxmapviewer.viewer.GeoPosition
- All Implemented Interfaces:
java.io.Serializable
public class GeoPosition
extends java.lang.Object
implements java.io.Serializable
An immutable coordinate in the real (geographic) world, composed of a
latitude and a longitude.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description GeoPosition(double[] coords)Creates a new instance of GeoPosition from the specified latitude and longitude as an array of two doubles, with the latitude first.GeoPosition(double latitude, double longitude)Creates a new instance of GeoPosition from the specified latitude and longitude.GeoPosition(int latDegrees, int latMinutes, int latSeconds, int lonDegrees, int lonMinutes, int lonSeconds)Creates a new instance of GeoPosition from the specified latitude and longitude. -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object obj)doublegetLatitude()Get the latitude as decimal degreesdoublegetLongitude()Get the longitude as decimal degreesinthashCode()java.lang.StringtoString()
-
Constructor Details
-
GeoPosition
public GeoPosition(double latitude, double longitude)Creates a new instance of GeoPosition from the specified latitude and longitude. These are double values in decimal degrees, not degrees, minutes, and seconds. Use the other constructor for those.- Parameters:
latitude- a latitude value in decmial degreeslongitude- a longitude value in decimal degrees
-
GeoPosition
public GeoPosition(double[] coords)Creates a new instance of GeoPosition from the specified latitude and longitude as an array of two doubles, with the latitude first. These are double values in decimal degrees, not degrees, minutes, and seconds. Use the other constructor for those.- Parameters:
coords- latitude and longitude as a double array of length two
-
GeoPosition
public GeoPosition(int latDegrees, int latMinutes, int latSeconds, int lonDegrees, int lonMinutes, int lonSeconds)Creates a new instance of GeoPosition from the specified latitude and longitude. Each are specified as degrees, minutes, and seconds; not as decimal degrees. Use the other constructor for those.- Parameters:
latDegrees- the degrees part of the current latitudelatMinutes- the minutes part of the current latitudelatSeconds- the seconds part of the current latitudelonDegrees- the degrees part of the current longitudelonMinutes- the minutes part of the current longitudelonSeconds- the seconds part of the current longitude
-
-
Method Details
-
getLatitude
public double getLatitude()Get the latitude as decimal degrees- Returns:
- the latitude as decimal degrees
-
getLongitude
public double getLongitude()Get the longitude as decimal degrees- Returns:
- the longitude as decimal degrees
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-