Package org.esa.snap.core.datamodel
Class GeoPos
java.lang.Object
org.esa.snap.core.datamodel.GeoPos
The
GeoPos
class represents a geographical position measured in longitudes and latitudes.- Version:
- $Revision$ $Date$
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeoPos()
Constructs a new geo-position with latitude and longitude set to zero.GeoPos
(double lat, double lon) Constructs a new geo-position with the given latitude and longitude values.Constructs a new geo-position with latitude and longitude set to that of the given geo-position. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Tests whether or not all given geo-positions are valid.boolean
Indicates whether some other object is "equal to" this one.double
getLat()
Gets the latitude value.Returns a string representation of the latitude value.getLatString
(boolean compassFormat, boolean decimalFormat) Returns a string representation of the latitude value.static String
getLatString
(double lat) Returns a string representation of the given latitude value.static String
getLatString
(double lat, boolean compassFormat, boolean decimalFormat) Returns a string representation of the given latitude value.double
getLon()
Gets the longitude value.Returns a string representation of the latitude value.getLonString
(boolean compassFormat, boolean decimalFormat) Returns a string representation of the longitude value.static String
getLonString
(double lon) Returns a string representation of the given longitude value.static String
getLonString
(double lon, boolean compassFormat, boolean decimalFormat) Returns a string representation of the given longitude value.int
hashCode()
Returns a hash code value for the object.final boolean
isValid()
Tests whether or not this geo-position is valid.void
Normalizes this position so that its longitude is in the range -180 to +180 degree.static double
normalizeLon
(double lon) Normalizes the given longitude so that it is in the range -180 to +180 degree and returns it.final void
Sets the lat/lon fields so thatisValid()
will return false.void
setLocation
(double lat, double lon) Sets the geographical location of this point.toString()
Returns a string representation of the object.
-
Field Details
-
lat
public double latThe geographical latitude in decimal degree, valid range is -90 to +90. -
lon
public double lonThe geographical longitude in decimal degree, valid range is -180 to +180.
-
-
Constructor Details
-
GeoPos
public GeoPos()Constructs a new geo-position with latitude and longitude set to zero. -
GeoPos
Constructs a new geo-position with latitude and longitude set to that of the given geo-position.- Parameters:
geoPos
- the geo-position providing the latitude and longitude, must not benull
-
GeoPos
public GeoPos(double lat, double lon) Constructs a new geo-position with the given latitude and longitude values.- Parameters:
lat
- the geographical latitude in decimal degree, valid range is -90 to +90lon
- the geographical longitude in decimal degree, valid range is -180 to +180
-
-
Method Details
-
getLat
public double getLat()Gets the latitude value.- Returns:
- the geographical latitude in decimal degree
-
getLon
public double getLon()Gets the longitude value.- Returns:
- the geographical longitude in decimal degree
-
setLocation
public void setLocation(double lat, double lon) Sets the geographical location of this point.- Parameters:
lat
- the geographical latitude in decimal degree, valid range is -90 to +90lon
- the geographical longitude in decimal degree, valid range is -180 to +180
-
isValid
public final boolean isValid()Tests whether or not this geo-position is valid.- Returns:
- true, if so
-
areValid
Tests whether or not all given geo-positions are valid.- Returns:
- true, if so
-
setInvalid
public final void setInvalid()Sets the lat/lon fields so thatisValid()
will return false. -
equals
Indicates whether some other object is "equal to" this one. -
hashCode
public int hashCode()Returns a hash code value for the object. -
toString
Returns a string representation of the object. In general, thetoString
method returns a string that "textually represents" this object. -
normalize
public void normalize()Normalizes this position so that its longitude is in the range -180 to +180 degree. -
normalizeLon
public static double normalizeLon(double lon) Normalizes the given longitude so that it is in the range -180 to +180 degree and returns it. Note that -180 will remain as is, although -180 is equivalent to +180 degrees.- Parameters:
lon
- the longitude in degree- Returns:
- the normalized longitude in the range
-
getLatString
Returns a string representation of the latitude value.- Returns:
- a string of the form DDD°[MM'[SS"]] [N|S].
-
getLonString
Returns a string representation of the latitude value.- Returns:
- a string of the form DDD°[MM'[SS"]] [W|E].
-
getLatString
Returns a string representation of the given latitude value.- Parameters:
lat
- the geographical latitude in decimal degree- Returns:
- a string of the form DDD°[MM'[SS"]] [N|S].
-
getLatString
Returns a string representation of the given latitude value.- Parameters:
lat
-compassFormat
- true: "[degrees] [N|S]" false: "+/- [degrees]"decimalFormat
- true: "degrees in decimal" false: "degrees in DDD°[MM'[SS"]]"- Returns:
- a formatted string representing latitude
- Since:
- Sept 2018
-
getLonString
Returns a string representation of the given longitude value.- Parameters:
lon
- the geographical longitude in decimal degree- Returns:
- a string of the form DDD°[MM'[SS"]] [W|E].
-
getLonString
Returns a string representation of the given longitude value.- Parameters:
lon
-compassFormat
- true: "[degrees] [N|S]" false: "+/- [degrees]"decimalFormat
- true: "degrees in decimal" false: "degrees in DDD°[MM'[SS"]]"- Returns:
- a formatted string representing latitude
- Since:
- Sept 2018
-
getLatString
Returns a string representation of the latitude value.- Parameters:
compassFormat
- true: "[degrees] [N|S]" false: "+/- [degrees]"decimalFormat
- true: "degrees in decimal" false: "degrees in DDD°[MM'[SS"]]"- Returns:
- a formatted string representing latitude
- Since:
- Sept 2018
-
getLonString
Returns a string representation of the longitude value.- Parameters:
compassFormat
- true: "[degrees] [N|S]" false: "+/- [degrees]"decimalFormat
- true: "degrees in decimal" false: "degrees in DDD°[MM'[SS"]]"- Returns:
- a formatted string representing longitude
- Since:
- Sept 2018
-