public class GeoPos extends Object
GeoPos
class represents a geographical position measured in longitudes and latitudes.Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
areValid(GeoPos[] gepPositions)
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.
|
public float lat
public float lon
public GeoPos()
public GeoPos(GeoPos geoPos)
geoPos
- the geo-position providing the latitude and longitude, must not be null
public GeoPos(float lat, float lon)
lat
- the geographical latitude in decimal degree, valid range is -90 to +90lon
- the geographical longitude in decimal degree, valid range is -180 to +180public float getLat()
public float getLon()
public void setLocation(float lat, float lon)
lat
- the geographical latitude in decimal degree, valid range is -90 to +90lon
- the geographical longitude in decimal degree, valid range is -180 to +180public final boolean isValid()
public static boolean areValid(GeoPos[] gepPositions)
public final void setInvalid()
isValid()
will return false.public boolean equals(Object obj)
public int hashCode()
public String toString()
toString
method returns a string that
"textually represents" this object.public void normalize()
public static float normalizeLon(float lon)
lon
- the longitude in degreepublic String getLatString()
public String getLonString()
public static String getLatString(float lat)
lat
- the geographical latitude in decimal degreepublic static String getLonString(float lon)
lon
- the geographical longitude in decimal degreeCopyright © 2002–2014 Brockmann Consult GmbH. All rights reserved.