org.esa.beam.framework.datamodel
Class GeoPos

java.lang.Object
  extended by org.esa.beam.framework.datamodel.GeoPos

public class GeoPos
extends Object

The GeoPos class represents a geographical position measured in longitudes and latitudes.

Version:
$Revision$ $Date$
Author:
Norman Fomferra

Field Summary
 float lat
          The geographical latitude in decimal degree, valid range is -90 to +90.
 float lon
          The geographical longitude in decimal degree, valid range is -180 to +180.
 
Constructor Summary
GeoPos()
          Constructs a new geo-position with latitude and longitude set to zero.
GeoPos(float lat, float lon)
          Constructs a new geo-position with the given latitude and longitude values.
GeoPos(GeoPos geoPos)
          Constructs a new geo-position with latitude and longitude set to that of the given geo-position.
 
Method Summary
static boolean areValid(GeoPos[] a)
          Tests whether or not all given geo-positions are valid.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 float getLat()
          Gets the latitude value.
 String getLatString()
          Returns a string representation of the latitude value.
static String getLatString(float lat)
          Returns a string representation of the given longitude value.
 float getLon()
          Gets the longitude value.
 String getLonString()
          Returns a string representation of the latitude value.
static String getLonString(float lon)
          Returns a string representation of the given longitude value.
 int hashCode()
          Returns a hash code value for the object.
 boolean isValid()
          Tests whether or not this geo-position is valid.
 void normalize()
          Normalizes this position so that its longitude is in the range -180 to +180 degree.
static float normalizeLon(float lon)
          Normalizes the given longitude so that it is in the range -180 to +180 degree and returns it.
 void setInvalid()
          Sets the lat/lon fields so that isValid() will return false.
 void setLocation(float lat, float lon)
          Sets the geographical location of this point.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

lat

public float lat
The geographical latitude in decimal degree, valid range is -90 to +90.


lon

public float lon
The geographical longitude in decimal degree, valid range is -180 to +180.

Constructor Detail

GeoPos

public GeoPos()
Constructs a new geo-position with latitude and longitude set to zero.


GeoPos

public GeoPos(GeoPos 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 be null

GeoPos

public GeoPos(float lat,
              float 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 +90
lon - the geographical longitude in decimal degree, valid range is -180 to +180
Method Detail

getLat

public float getLat()
Gets the latitude value.

Returns:
the geographical latitude in decimal degree

getLon

public float getLon()
Gets the longitude value.

Returns:
the geographical longitude in decimal degree

setLocation

public void setLocation(float lat,
                        float lon)
Sets the geographical location of this point.

Parameters:
lat - the geographical latitude in decimal degree, valid range is -90 to +90
lon - 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

public static boolean areValid(GeoPos[] a)
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 that isValid() will return false.


equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.

toString

public String toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object.

Overrides:
toString in class Object
Returns:
a string representation of the object.

normalize

public void normalize()
Normalizes this position so that its longitude is in the range -180 to +180 degree.


normalizeLon

public static float normalizeLon(float 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

public String getLatString()
Returns a string representation of the latitude value.

Returns:
a string of the form DDD°[MM'[SS"]] [N|S].

getLonString

public String getLonString()
Returns a string representation of the latitude value.

Returns:
a string of the form DDD°[MM'[SS"]] [W|E].

getLatString

public static String getLatString(float lat)
Returns a string representation of the given longitude value.

Parameters:
lat - the geographical latitude in decimal degree
Returns:
a string of the form DDD°[MM'[SS"]] [N|S].

getLonString

public static String getLonString(float lon)
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].


Copyright © 2002-2013 Brockmann Consult GmbH. All Rights Reserved.