org.opengts.util
Class GeoPoint

java.lang.Object
  extended by org.opengts.util.GeoPoint
All Implemented Interfaces:
java.lang.Cloneable, GeoPointProvider

public class GeoPoint
extends java.lang.Object
implements java.lang.Cloneable, GeoPointProvider

A container for a single latitude/longitude value pair


Nested Class Summary
static class GeoPoint.CompassHeading
          CompassHeading enumerated type
static class GeoPoint.DistanceUnits
          DistanceUnits enumerated type
 
Field Summary
static double CENTIMETERS_PER_KILOMETER
           
static double CENTIMETERS_PER_METER
           
static java.lang.String DECIMAL_FORMAT_0
           
static java.lang.String DECIMAL_FORMAT_1
           
static java.lang.String DECIMAL_FORMAT_2
           
static java.lang.String DECIMAL_FORMAT_3
           
static java.lang.String DECIMAL_FORMAT_4
           
static java.lang.String DECIMAL_FORMAT_5
           
static java.lang.String DECIMAL_FORMAT_6
           
static java.lang.String DECIMAL_FORMAT_7
           
static char DegreeChar
           
static java.lang.String[] DMS_HTML_SEPARATORS
           
static java.lang.String[] DMS_TEXT_SEPARATORS
           
static double EARTH_ANTIPODAL_KM
           
static double EARTH_CIRCUMFERENCE_KM
           
static double EARTH_EQUATORIAL_RADIUS_KM
           
static double EARTH_MEAN_RADIUS_KM
           
static double EARTH_MEAN_RADIUS_METERS
           
static double EARTH_POLOR_RADIUS_KM
           
static int ENCODE_HIRES_LEN
           
static int ENCODE_LORES_LEN
           
static double EPSILON
           
static double FEET_PER_ACRE_SIDE
           
static double FEET_PER_KILOMETER
           
static double FEET_PER_METER
           
static double FEET_PER_MILE
           
static double FEET_PER_YARD
           
static int FORMAT_DEC
           
static int FORMAT_DM
           
static int FORMAT_DMS
           
static int FORMAT_NMEA
           
static double INCHES_PER_MM
           
static GeoPoint INVALID_GEOPOINT
          An immutable invalid GeoPoint
static double KILOMETERS_PER_CENTIMETER
           
static double KILOMETERS_PER_METER
           
static double KILOMETERS_PER_MILE
           
static double KILOMETERS_PER_NAUTICAL_MILE
           
static double LN2
           
static double MAX_LATITUDE
           
static double MAX_LONGITUDE
           
static double METERS_PER_ACRE_SIDE
           
static double METERS_PER_CENTIMETER
           
static double METERS_PER_FOOT
           
static double METERS_PER_KILOMETER
           
static double METERS_PER_MILE
           
static double METERS_PER_YARD
           
static double MILES_PER_FOOT
           
static double MILES_PER_KILOMETER
           
static double MILES_PER_METER
           
static double MILES_PER_NAUTICAL_MILE
           
static double MIN_LATITUDE
           
static double MIN_LONGITUDE
           
static double MM_PER_INCH
           
static double NAUTICAL_MILES_PER_KILOMETER
           
static double NAUTICAL_MILES_PER_METER
           
static double NAUTICAL_MILES_PER_MILE
           
static double PI
           
static java.lang.String PointSeparator
           
static char PointSeparatorChar
           
static char[] PointSeparatorChars
           
static double RADIANS
           
static java.lang.String SFORMAT_DEC_1
           
static java.lang.String SFORMAT_DEC_2
           
static java.lang.String SFORMAT_DEC_3
           
static java.lang.String SFORMAT_DEC_4
           
static java.lang.String SFORMAT_DEC_5
           
static java.lang.String SFORMAT_DEC_6
           
static java.lang.String SFORMAT_DEC_7
           
static java.lang.String SFORMAT_DM
           
static java.lang.String SFORMAT_DMS
           
static java.lang.String SFORMAT_NMEA
           
static double SQUARE_FEET_PER_ACRE
           
static double SQUARE_METERS_PER_ACRE
           
static double SQUARE_METERS_PER_SQUARE_FOOT
           
static double SQUARE_YARDS_PER_ACRE
           
static double YARDS_PER_FOOT
           
static double YARDS_PER_KILOMETER
           
static double YARDS_PER_METER
           
static double YARDS_PER_MILE
           
 
Constructor Summary
GeoPoint()
          Constructor.
GeoPoint(double latitude, double longitude)
          Constructor.
GeoPoint(double latDeg, double latMin, double latSec, double lonDeg, double lonMin, double lonSec)
          Constructor.
GeoPoint(GeoPoint gp)
          Copy Constructor.
GeoPoint(java.lang.String gp)
          Constructor.
GeoPoint(java.lang.String gp, char sep)
          Constructor.
GeoPoint(java.lang.String gp, char[] sep)
          Constructor.
 
Method Summary
protected static java.lang.String _formatCoord(double loc, int fmt, java.util.Locale locale)
          Formats the specified coordinate based on the default decimal format value.
 java.lang.Object clone()
          Retruns a clone of this GeoPoint instance
static double convertDmsToDec(double deg, double min, double sec)
          Converts the specified degrees/minutes/seconds into degrees
static double convertDmsToDec(int deg, int min, int sec)
          Converts the specified degrees/minutes/seconds into degrees
static GeoPoint decodeGeoPoint(byte[] enc, int ofs, int len)
          Decodes a GeoPoint from the specified byte array
static byte[] encodeGeoPoint(GeoPoint gp, byte[] enc, int ofs, int len)
          Encodes the specified GeoPoint into a byte array
 boolean equals(java.lang.Object other)
          Returns true if this GeoPoint is equivalent to the other Object
static java.lang.String formatLatitude(double lat)
          Formats and returns a String representation of the specified Latitude
static java.lang.String formatLatitude(double lat, java.lang.String type, java.util.Locale locale)
          Formats and returns a String representation of the specified Latitude
static java.lang.String formatLongitude(double lon)
          Formats and returns a String representation of the specified Longitude
static java.lang.String formatLongitude(double lon, java.lang.String type, java.util.Locale locale)
          Formats and returns a String representation of the specified Longitude
static PixelPoint geoPointToPixel(GeoPoint gg, GeoBounds bb, PixelDimension mapDim)
          Returns the pixel location for the specified GeoPoint
static java.lang.String GetDecimalFormat(int fmt)
          Decodes format mask to decimal format
static int GetFormatMask(java.lang.String fmt, boolean isLat)
          Encode decimal format to format mask
 GeoPoint getGeoPoint()
          GeoPointProvider interface inplementation.
Returns this GeoPoint
static GeozoneChecker getGeozoneChecker()
          Returns an object that implements the GeozoneChecker interface implementing a point/radius geozone check.
static java.lang.String GetHeadingDescription(double heading, java.util.Locale locale)
          Returns a String description of the spedified compass heading value
 GeoPoint getHeadingPoint(double distM, double heading)
          Return a new point which is the specified distance (in meters) from this point toward the specified heading
static java.lang.String GetHeadingString(double heading, java.util.Locale locale)
          Returns a String representation of the spedified compass heading value
static java.lang.String GetHeadingTitle(java.util.Locale locale)
          Return the "Heading" title
 double getLatitude()
          Gets the Latitude in degrees
static double getLatitude(GeoPointProvider gpp, double dft)
          Returns the latitude component of the specified GeoPoint
 double getLatitudeRadians()
          Gets the Latitude in radians
 java.lang.String getLatitudeString()
          Gets the default String representation of the Latitude
 java.lang.String getLatitudeString(java.lang.String type, java.util.Locale locale)
          Gets the String representation of the Latitude
 double getLongitude()
          Gets the Longitude in degrees
static double getLongitude(GeoPointProvider gpp, double dft)
          Returns the longitude component of the specified GeoPoint
 double getLongitudeRadians()
          Gets the Longitude in radians
 java.lang.String getLongitudeString()
          Gets the default String representation of the Longitude
 java.lang.String getLongitudeString(java.lang.String type, java.util.Locale locale)
          Gets the String representation of the Longitude
 GeoOffset getRadiusDeltaPoint(double radiusMeters)
          Returns a GeoOffset object containing 'delta' Latitude/Longitude values which represent a 'bounding-box' for this GeoPoint with the specified radius (in meters).
 double getX()
          Gets the 'X' coordinate (same as Longitude)
 double getY()
          Gets the 'Y' coordinate (same as Latitude)
 double headingToPoint(GeoPoint dest)
          Returns the compass heading that would be followed if travelling from this GeoPoint to the specified GeoPoint
 boolean isImmutable()
          Returns true if this GeoPoint is immutable
static boolean isOrigin(double lat, double lon)
          Returns true if the specified latitude/longitude are at the origin 0.0,0.0
static boolean isOrigin(GeoPoint gp)
          Returns true if the specified GeoPoint is at the origin 0.0,0.0
 boolean isValid()
          Returns true if the latitude/longitude contained by the GeoPoint is valid
static boolean isValid(double lat, double lon)
          Returns true if the specified latitude/longitude are valid, false otherwise
static boolean isValid(GeoPoint gp)
          Returns true if the specified GeoPoint is valid, false otherwise
static boolean isValid(GeoPointProvider gpp)
          Returns true if the specified GeoPointProvider is valid, false otherwise
static boolean isValidBounds(double lat, double lon)
          Returns true if the specified latitude/longitude is within valid bounds, false otherwise
 double kilometersToPoint(GeoPoint gp)
          Returns the distance to the specified point, in kilometers
static void main(java.lang.String[] argv)
          Testing/debugging command-line entry point
 double metersToPoint(GeoPoint gp)
          Returns the distance to the specified point, in meters
static GeoPoint NewGeoPoint(double lat, double lon)
          Creates a new GeoPoint from the specified RTProperties instance and key
static GeoPoint NewGeoPoint(double lat, double lon, GeoPoint dft)
          Creates a new GeoPoint from the specified RTProperties instance and key
static GeoPoint NewGeoPoint(RTProperties rtp, java.lang.String key)
          Creates a new GeoPoint from the specified RTProperties instance and key
static GeoPoint NewGeoPoint(RTProperties rtp, java.lang.String key, GeoPoint dft)
          Creates a new GeoPoint from the specified RTProperties instance and key
static double parseCoordinate(java.lang.String loc, boolean isLat, double dft)
          Parse latitude/longitude coordinate and return as degrees
static double parseLatitude(java.lang.String lat, double dft)
          Parse latitude coordinate and return as degrees
static double parseLongitude(java.lang.String lon, double dft)
          Parse longitude coordinate and return as degrees
static GeoPoint pixelToGeoPoint(PixelPoint xx, GeoBounds bb, PixelDimension mapDim)
          Returns the GeoPoint location for the specified Pixel location within the map bounds
 double radiansToPoint(GeoPoint dest)
          Returns the distance to the specified point, in radians
 GeoPoint setImmutable()
          Set this GeoPoint as Immutable
 void setLatitude(double lat)
          Sets the Latitude in degrees
 void setLatitude(double deg, double min, double sec)
          Sets the Latitude in degrees/minutes/seconds
 void setLongitude(double lon)
          Sets the Longitude in degrees
 void setLongitude(double deg, double min, double sec)
          Sets the Longitude in degrees/minutes/seconds
 java.lang.String toString()
          Returns a String representation of this GeoPoint
 java.lang.String toString(char sep)
          Returns a String representation of this GeoPoint
 java.lang.String toString(java.lang.String type, char sep, java.util.Locale locale)
          Returns a String representation of this GeoPoint
 java.lang.String toString(java.lang.String type, java.util.Locale locale)
          Returns a String representation of this GeoPoint
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EPSILON

public static final double EPSILON
See Also:
Constant Field Values

MAX_LATITUDE

public static final double MAX_LATITUDE
See Also:
Constant Field Values

MIN_LATITUDE

public static final double MIN_LATITUDE
See Also:
Constant Field Values

MAX_LONGITUDE

public static final double MAX_LONGITUDE
See Also:
Constant Field Values

MIN_LONGITUDE

public static final double MIN_LONGITUDE
See Also:
Constant Field Values

PointSeparator

public static final java.lang.String PointSeparator
See Also:
Constant Field Values

PointSeparatorChar

public static final char PointSeparatorChar
See Also:
Constant Field Values

PointSeparatorChars

public static final char[] PointSeparatorChars

FORMAT_DEC

public static final int FORMAT_DEC
See Also:
Constant Field Values

FORMAT_DMS

public static final int FORMAT_DMS
See Also:
Constant Field Values

FORMAT_DM

public static final int FORMAT_DM
See Also:
Constant Field Values

FORMAT_NMEA

public static final int FORMAT_NMEA
See Also:
Constant Field Values

SFORMAT_DEC_1

public static final java.lang.String SFORMAT_DEC_1
See Also:
Constant Field Values

SFORMAT_DEC_2

public static final java.lang.String SFORMAT_DEC_2
See Also:
Constant Field Values

SFORMAT_DEC_3

public static final java.lang.String SFORMAT_DEC_3
See Also:
Constant Field Values

SFORMAT_DEC_4

public static final java.lang.String SFORMAT_DEC_4
See Also:
Constant Field Values

SFORMAT_DEC_5

public static final java.lang.String SFORMAT_DEC_5
See Also:
Constant Field Values

SFORMAT_DEC_6

public static final java.lang.String SFORMAT_DEC_6
See Also:
Constant Field Values

SFORMAT_DEC_7

public static final java.lang.String SFORMAT_DEC_7
See Also:
Constant Field Values

SFORMAT_DMS

public static final java.lang.String SFORMAT_DMS
See Also:
Constant Field Values

SFORMAT_DM

public static final java.lang.String SFORMAT_DM
See Also:
Constant Field Values

SFORMAT_NMEA

public static final java.lang.String SFORMAT_NMEA
See Also:
Constant Field Values

DegreeChar

public static final char DegreeChar
See Also:
Constant Field Values

DMS_HTML_SEPARATORS

public static final java.lang.String[] DMS_HTML_SEPARATORS

DMS_TEXT_SEPARATORS

public static final java.lang.String[] DMS_TEXT_SEPARATORS

DECIMAL_FORMAT_0

public static final java.lang.String DECIMAL_FORMAT_0
See Also:
Constant Field Values

DECIMAL_FORMAT_1

public static final java.lang.String DECIMAL_FORMAT_1
See Also:
Constant Field Values

DECIMAL_FORMAT_2

public static final java.lang.String DECIMAL_FORMAT_2
See Also:
Constant Field Values

DECIMAL_FORMAT_3

public static final java.lang.String DECIMAL_FORMAT_3
See Also:
Constant Field Values

DECIMAL_FORMAT_4

public static final java.lang.String DECIMAL_FORMAT_4
See Also:
Constant Field Values

DECIMAL_FORMAT_5

public static final java.lang.String DECIMAL_FORMAT_5
See Also:
Constant Field Values

DECIMAL_FORMAT_6

public static final java.lang.String DECIMAL_FORMAT_6
See Also:
Constant Field Values

DECIMAL_FORMAT_7

public static final java.lang.String DECIMAL_FORMAT_7
See Also:
Constant Field Values

INVALID_GEOPOINT

public static final GeoPoint INVALID_GEOPOINT
An immutable invalid GeoPoint


PI

public static final double PI
See Also:
Constant Field Values

RADIANS

public static final double RADIANS
See Also:
Constant Field Values

LN2

public static final double LN2
See Also:
Constant Field Values

EARTH_EQUATORIAL_RADIUS_KM

public static final double EARTH_EQUATORIAL_RADIUS_KM
See Also:
Constant Field Values

EARTH_POLOR_RADIUS_KM

public static final double EARTH_POLOR_RADIUS_KM
See Also:
Constant Field Values

EARTH_MEAN_RADIUS_KM

public static final double EARTH_MEAN_RADIUS_KM
See Also:
Constant Field Values

EARTH_MEAN_RADIUS_METERS

public static final double EARTH_MEAN_RADIUS_METERS
See Also:
Constant Field Values

EARTH_CIRCUMFERENCE_KM

public static final double EARTH_CIRCUMFERENCE_KM
See Also:
Constant Field Values

EARTH_ANTIPODAL_KM

public static final double EARTH_ANTIPODAL_KM
See Also:
Constant Field Values

FEET_PER_YARD

public static final double FEET_PER_YARD
See Also:
Constant Field Values

YARDS_PER_FOOT

public static final double YARDS_PER_FOOT
See Also:
Constant Field Values

FEET_PER_MILE

public static final double FEET_PER_MILE
See Also:
Constant Field Values

MILES_PER_FOOT

public static final double MILES_PER_FOOT
See Also:
Constant Field Values

YARDS_PER_MILE

public static final double YARDS_PER_MILE
See Also:
Constant Field Values

CENTIMETERS_PER_METER

public static final double CENTIMETERS_PER_METER
See Also:
Constant Field Values

METERS_PER_CENTIMETER

public static final double METERS_PER_CENTIMETER
See Also:
Constant Field Values

METERS_PER_KILOMETER

public static final double METERS_PER_KILOMETER
See Also:
Constant Field Values

CENTIMETERS_PER_KILOMETER

public static final double CENTIMETERS_PER_KILOMETER
See Also:
Constant Field Values

KILOMETERS_PER_CENTIMETER

public static final double KILOMETERS_PER_CENTIMETER
See Also:
Constant Field Values

KILOMETERS_PER_METER

public static final double KILOMETERS_PER_METER
See Also:
Constant Field Values

KILOMETERS_PER_MILE

public static final double KILOMETERS_PER_MILE
See Also:
Constant Field Values

MILES_PER_KILOMETER

public static final double MILES_PER_KILOMETER
See Also:
Constant Field Values

METERS_PER_MILE

public static final double METERS_PER_MILE
See Also:
Constant Field Values

MILES_PER_METER

public static final double MILES_PER_METER
See Also:
Constant Field Values

METERS_PER_FOOT

public static final double METERS_PER_FOOT
See Also:
Constant Field Values

FEET_PER_METER

public static final double FEET_PER_METER
See Also:
Constant Field Values

FEET_PER_KILOMETER

public static final double FEET_PER_KILOMETER
See Also:
Constant Field Values

METERS_PER_YARD

public static final double METERS_PER_YARD
See Also:
Constant Field Values

YARDS_PER_METER

public static final double YARDS_PER_METER
See Also:
Constant Field Values

YARDS_PER_KILOMETER

public static final double YARDS_PER_KILOMETER
See Also:
Constant Field Values

KILOMETERS_PER_NAUTICAL_MILE

public static final double KILOMETERS_PER_NAUTICAL_MILE
See Also:
Constant Field Values

NAUTICAL_MILES_PER_KILOMETER

public static final double NAUTICAL_MILES_PER_KILOMETER
See Also:
Constant Field Values

NAUTICAL_MILES_PER_METER

public static final double NAUTICAL_MILES_PER_METER
See Also:
Constant Field Values

MILES_PER_NAUTICAL_MILE

public static final double MILES_PER_NAUTICAL_MILE
See Also:
Constant Field Values

NAUTICAL_MILES_PER_MILE

public static final double NAUTICAL_MILES_PER_MILE
See Also:
Constant Field Values

MM_PER_INCH

public static final double MM_PER_INCH
See Also:
Constant Field Values

INCHES_PER_MM

public static final double INCHES_PER_MM
See Also:
Constant Field Values

SQUARE_METERS_PER_SQUARE_FOOT

public static final double SQUARE_METERS_PER_SQUARE_FOOT
See Also:
Constant Field Values

SQUARE_YARDS_PER_ACRE

public static final double SQUARE_YARDS_PER_ACRE
See Also:
Constant Field Values

SQUARE_FEET_PER_ACRE

public static final double SQUARE_FEET_PER_ACRE
See Also:
Constant Field Values

SQUARE_METERS_PER_ACRE

public static final double SQUARE_METERS_PER_ACRE
See Also:
Constant Field Values

METERS_PER_ACRE_SIDE

public static final double METERS_PER_ACRE_SIDE

FEET_PER_ACRE_SIDE

public static final double FEET_PER_ACRE_SIDE

ENCODE_HIRES_LEN

public static final int ENCODE_HIRES_LEN
See Also:
Constant Field Values

ENCODE_LORES_LEN

public static final int ENCODE_LORES_LEN
See Also:
Constant Field Values
Constructor Detail

GeoPoint

public GeoPoint()
Constructor. This creates a GeoPoint with latitude=0.0, and longitude=0.0


GeoPoint

public GeoPoint(GeoPoint gp)
Copy Constructor. This copies the specified argument GeoPoint to this constructed GeoPoint

Parameters:
gp - The GeoPoint to copy to this constructed GeoPoint

GeoPoint

public GeoPoint(double latitude,
                double longitude)
Constructor. This creates a new GeoPoint with the specified latitude/longitude.

Parameters:
latitude - The latitude
longitude - The longitude

GeoPoint

public GeoPoint(double latDeg,
                double latMin,
                double latSec,
                double lonDeg,
                double lonMin,
                double lonSec)
Constructor. This creates a new GeoPoint with the specified latitude/longitude.

Parameters:
latDeg - The latitude degrees
latMin - The latitude minutes
latSec - The latitude seconds
lonDeg - The longitude degrees
lonMin - The longitude minutes
lonSec - The longitude seconds

GeoPoint

public GeoPoint(java.lang.String gp)
Constructor. This creates a new GeoPoint with the latitude/longitude parsed from the specified String

Parameters:
gp - The String containing the GeoPoint to parse ("latitude/longitude")

GeoPoint

public GeoPoint(java.lang.String gp,
                char sep)
Constructor. This creates a new GeoPoint with the latitude/longitude parsed from the specified String

Parameters:
gp - The String containing the GeoPoint to parse ("latitude/longitude")
sep - The character which separates the latitude from longitude

GeoPoint

public GeoPoint(java.lang.String gp,
                char[] sep)
Constructor. This creates a new GeoPoint with the latitude/longitude parsed from the specified String

Parameters:
gp - The String containing the GeoPoint to parse ("latitude/longitude")
sep - The character which separates the latitude from longitude
Method Detail

GetFormatMask

public static int GetFormatMask(java.lang.String fmt,
                                boolean isLat)
Encode decimal format to format mask

Parameters:
fmt - The decimal format
isLat - True if is longitude, false if is latitude
Returns:
encoded format mask

GetDecimalFormat

public static java.lang.String GetDecimalFormat(int fmt)
Decodes format mask to decimal format

Parameters:
fmt - The format mask
Returns:
The decimal format

GetHeadingTitle

public static java.lang.String GetHeadingTitle(java.util.Locale locale)
Return the "Heading" title

Returns:
The "Heading" title

isOrigin

public static boolean isOrigin(GeoPoint gp)
Returns true if the specified GeoPoint is at the origin 0.0,0.0

Parameters:
gp - The GeoPoint
Returns:
True if the specified GeoPoint is at the origin 0.0,0.0

isOrigin

public static boolean isOrigin(double lat,
                               double lon)
Returns true if the specified latitude/longitude are at the origin 0.0,0.0

Parameters:
lat - The latitude
lon - The longitude
Returns:
True if the specified latitude/longitude are at the origin 0.0,0.0

isValidBounds

public static boolean isValidBounds(double lat,
                                    double lon)
Returns true if the specified latitude/longitude is within valid bounds, false otherwise

Parameters:
lat - The latitude
lon - The longitude
Returns:
True if the specified latitude/longitude is within valid bounds, false otherwise

isValid

public static boolean isValid(double lat,
                              double lon)
Returns true if the specified latitude/longitude are valid, false otherwise

Parameters:
lat - The latitude
lon - The longitude
Returns:
True if the specified latitude/longitude are valid, false otherwise

isValid

public static boolean isValid(GeoPoint gp)
Returns true if the specified GeoPoint is valid, false otherwise

Parameters:
gp - The GeoPoint
Returns:
True if the specified GeoPoint is valid, false otherwise

isValid

public static boolean isValid(GeoPointProvider gpp)
Returns true if the specified GeoPointProvider is valid, false otherwise

Parameters:
gpp - The GeoPointProvider
Returns:
True if the specified GeoPointProvider is valid, false otherwise

parseLatitude

public static double parseLatitude(java.lang.String lat,
                                   double dft)
Parse latitude coordinate and return as degrees

Parameters:
lat - The latitude coordinate String
dft - The default value
Returns:
The value of the latitude expressed in degrees

parseLongitude

public static double parseLongitude(java.lang.String lon,
                                    double dft)
Parse longitude coordinate and return as degrees

Parameters:
lon - The longitude coordinate String
dft - The default value
Returns:
The value of the longitude expressed in degrees

parseCoordinate

public static double parseCoordinate(java.lang.String loc,
                                     boolean isLat,
                                     double dft)
Parse latitude/longitude coordinate and return as degrees

Parameters:
loc - The latitude or longitude coordinate String
isLat - True if loc represents a Latitude value
dft - The default value
Returns:
The value of the coordinate expressed in degrees

getLatitude

public static double getLatitude(GeoPointProvider gpp,
                                 double dft)
Returns the latitude component of the specified GeoPoint

Parameters:
gpp - The GeoPoint
dft - The default latitude
Returns:
The latitude component of the specified GeoPoint

getLongitude

public static double getLongitude(GeoPointProvider gpp,
                                  double dft)
Returns the longitude component of the specified GeoPoint

Parameters:
gpp - The GeoPoint
dft - The default longitude
Returns:
The longitude component of the specified GeoPoint

NewGeoPoint

public static GeoPoint NewGeoPoint(RTProperties rtp,
                                   java.lang.String key)
Creates a new GeoPoint from the specified RTProperties instance and key

Parameters:
rtp - The RTProperties instance
key - The RTProperties key containing the GeoPoint data
Returns:
The created GeoPoint, or INVALID_GEOPOINT if unable to create a GeoPoint

NewGeoPoint

public static GeoPoint NewGeoPoint(RTProperties rtp,
                                   java.lang.String key,
                                   GeoPoint dft)
Creates a new GeoPoint from the specified RTProperties instance and key

Parameters:
rtp - The RTProperties instance
key - The RTProperties key containing the GeoPoint data
dft - The default GeoPoint returned if unable to create a GeoPoint
Returns:
The created GeoPoint, or the default if unable to create a GeoPoint

NewGeoPoint

public static GeoPoint NewGeoPoint(double lat,
                                   double lon)
Creates a new GeoPoint from the specified RTProperties instance and key

Parameters:
lat - The latitude
lon - The longitude
Returns:
The created GeoPoint, or INVALID_GEOPOINT if lat/lon is invalid.

NewGeoPoint

public static GeoPoint NewGeoPoint(double lat,
                                   double lon,
                                   GeoPoint dft)
Creates a new GeoPoint from the specified RTProperties instance and key

Parameters:
lat - The latitude
lon - The longitude
dft - The default GeoPoint returned if unable to create a GeoPoint
Returns:
The created GeoPoint, or the default if lat/lon is invalid.

clone

public java.lang.Object clone()
Retruns a clone of this GeoPoint instance

Overrides:
clone in class java.lang.Object
Returns:
A clone of this GeoPoint

setImmutable

public GeoPoint setImmutable()
Set this GeoPoint as Immutable

Returns:
This GeoPoint

isImmutable

public boolean isImmutable()
Returns true if this GeoPoint is immutable

Returns:
True if this GeoPoint is immutable, false otherwise.

getGeoPoint

public GeoPoint getGeoPoint()
GeoPointProvider interface inplementation.
Returns this GeoPoint

Specified by:
getGeoPoint in interface GeoPointProvider
Returns:
This GeoPoint

isValid

public boolean isValid()
Returns true if the latitude/longitude contained by the GeoPoint is valid

Returns:
True if the latitude/longitude contained by the GeoPoint is valid

setLatitude

public void setLatitude(double deg,
                        double min,
                        double sec)
Sets the Latitude in degrees/minutes/seconds

Parameters:
deg - The degrees
min - The minutes
sec - The seconds

setLatitude

public void setLatitude(double lat)
Sets the Latitude in degrees

Parameters:
lat - The Latitude

getLatitude

public double getLatitude()
Gets the Latitude in degrees

Returns:
The Latitude in degrees

getY

public double getY()
Gets the 'Y' coordinate (same as Latitude)

Returns:
The 'Y' coordinate

getLatitudeRadians

public double getLatitudeRadians()
Gets the Latitude in radians

Returns:
The Latitude in radians

getLatitudeString

public java.lang.String getLatitudeString(java.lang.String type,
                                          java.util.Locale locale)
Gets the String representation of the Latitude

Parameters:
type - The format type
locale - The locale (only used for DMS)
Returns:
The String representation of the Latitude

getLatitudeString

public java.lang.String getLatitudeString()
Gets the default String representation of the Latitude

Returns:
The String representation of the Latitude

formatLatitude

public static java.lang.String formatLatitude(double lat,
                                              java.lang.String type,
                                              java.util.Locale locale)
Formats and returns a String representation of the specified Latitude

Parameters:
lat - The Latitude to format
type - The format type
locale - The locale (only used for FORMAT_DMS)
Returns:
The String representation of the Latitude

formatLatitude

public static java.lang.String formatLatitude(double lat)
Formats and returns a String representation of the specified Latitude

Parameters:
lat - The Latitude to format
Returns:
The String representation of the Latitude

setLongitude

public void setLongitude(double deg,
                         double min,
                         double sec)
Sets the Longitude in degrees/minutes/seconds

Parameters:
deg - The degrees
min - The minutes
sec - The seconds

setLongitude

public void setLongitude(double lon)
Sets the Longitude in degrees

Parameters:
lon - The Longitude

getLongitude

public double getLongitude()
Gets the Longitude in degrees

Returns:
The Longitude in degrees

getX

public double getX()
Gets the 'X' coordinate (same as Longitude)

Returns:
The 'X' coordinate

getLongitudeRadians

public double getLongitudeRadians()
Gets the Longitude in radians

Returns:
The Longitude in radians

getLongitudeString

public java.lang.String getLongitudeString(java.lang.String type,
                                           java.util.Locale locale)
Gets the String representation of the Longitude

Parameters:
type - The format type
locale - The locale (only used for DMS)
Returns:
The String representation of the Longitude

getLongitudeString

public java.lang.String getLongitudeString()
Gets the default String representation of the Longitude

Returns:
The String representation of the Longitude

formatLongitude

public static java.lang.String formatLongitude(double lon,
                                               java.lang.String type,
                                               java.util.Locale locale)
Formats and returns a String representation of the specified Longitude

Parameters:
lon - The Longitude to format
type - The format type
locale - The locale (only used for FORMAT_DMS)
Returns:
The String representation of the Longitude

formatLongitude

public static java.lang.String formatLongitude(double lon)
Formats and returns a String representation of the specified Longitude

Parameters:
lon - The Longitude to format
Returns:
The String representation of the Longitude

encodeGeoPoint

public static byte[] encodeGeoPoint(GeoPoint gp,
                                    byte[] enc,
                                    int ofs,
                                    int len)
Encodes the specified GeoPoint into a byte array

Parameters:
gp - The GeoPoint to encode
enc - The byte array into which the GeoPoint will be encoded
ofs - The offset into the byte array where the encoded GeoPoint will be placed
len - Either '6', for 6-byte encoding, or '8', for 8-byte encoding
Returns:
The byte array into which the GeoPoint was encoded

decodeGeoPoint

public static GeoPoint decodeGeoPoint(byte[] enc,
                                      int ofs,
                                      int len)
Decodes a GeoPoint from the specified byte array

Parameters:
enc - The byte array from which the GeoPoint will be decoded
ofs - The offset into the byte array where the GeoPoint will be decoded
len - Either '6', for 6-byte decoding, or '8', for 8-byte decoding
Returns:
The decoded GeoPoint

radiansToPoint

public double radiansToPoint(GeoPoint dest)
Returns the distance to the specified point, in radians

Parameters:
dest - The destination point
Returns:
The distance to the specified point, in radians

kilometersToPoint

public double kilometersToPoint(GeoPoint gp)
Returns the distance to the specified point, in kilometers

Parameters:
gp - The destination point
Returns:
The distance to the specified point, in kilometers

metersToPoint

public double metersToPoint(GeoPoint gp)
Returns the distance to the specified point, in meters

Parameters:
gp - The destination point
Returns:
The distance to the specified point, in meters

getRadiusDeltaPoint

public GeoOffset getRadiusDeltaPoint(double radiusMeters)
Returns a GeoOffset object containing 'delta' Latitude/Longitude values which represent a 'bounding-box' for this GeoPoint with the specified radius (in meters). That is, this GeoOffset Latitude/Longitude +/- the returned 'delta' Latitude/Longitude, represent a bounding area for this GeoPoint and the specified meter radius.

Parameters:
radiusMeters - The radius in meters
Returns:
The 'delta' Latitude/Longitude GeoOffset

GetHeadingString

public static java.lang.String GetHeadingString(double heading,
                                                java.util.Locale locale)
Returns a String representation of the spedified compass heading value

Parameters:
heading - The compass heading value to convert to a String representation
locale - The locale
Returns:
A String representation of the compass heading (ie. "N", "NE", "E", "SE", "S", "SW", "W", "NW")

GetHeadingDescription

public static java.lang.String GetHeadingDescription(double heading,
                                                     java.util.Locale locale)
Returns a String description of the spedified compass heading value

Parameters:
heading - The compass heading value to convert to a String description
locale - The locale
Returns:
A String description of the compass heading (ie. "North", "NorthEast", "East", "SouthEast", "South", "SouthWest", "West", "NorthWest")

headingToPoint

public double headingToPoint(GeoPoint dest)
Returns the compass heading that would be followed if travelling from this GeoPoint to the specified GeoPoint

Parameters:
dest - The destination point
Returns:
The compass heading in degrees

getHeadingPoint

public GeoPoint getHeadingPoint(double distM,
                                double heading)
Return a new point which is the specified distance (in meters) from this point toward the specified heading

Parameters:
heading - The heading
distM - The distance in meters

toString

public java.lang.String toString()
Returns a String representation of this GeoPoint

Overrides:
toString in class java.lang.Object
Returns:
A String representation of this GeoPoint

toString

public java.lang.String toString(char sep)
Returns a String representation of this GeoPoint

Parameters:
sep - The character used to separate the Latitude from the Longitude
Returns:
A String representation of this GeoPoint

toString

public java.lang.String toString(java.lang.String type,
                                 java.util.Locale locale)
Returns a String representation of this GeoPoint

Parameters:
type - The format type
Returns:
A String representation of this GeoPoint

toString

public java.lang.String toString(java.lang.String type,
                                 char sep,
                                 java.util.Locale locale)
Returns a String representation of this GeoPoint

Parameters:
type - The format type
sep - The character used to separate the Latitude from the Longitude
Returns:
A String representation of this GeoPoint

equals

public boolean equals(java.lang.Object other)
Returns true if this GeoPoint is equivalent to the other Object

Overrides:
equals in class java.lang.Object
Returns:
True if this GeoPoint is equivalent to the other Object

geoPointToPixel

public static PixelPoint geoPointToPixel(GeoPoint gg,
                                         GeoBounds bb,
                                         PixelDimension mapDim)
Returns the pixel location for the specified GeoPoint

Parameters:
gg - The GeoPoint to convert to a pixel location
bb - The GeoBounds representing the bounds of the map
mapDim - The dimensions of the map image in pixels
Returns:
The Pixel location

pixelToGeoPoint

public static GeoPoint pixelToGeoPoint(PixelPoint xx,
                                       GeoBounds bb,
                                       PixelDimension mapDim)
Returns the GeoPoint location for the specified Pixel location within the map bounds

Parameters:
xx - The PixelPoint to convert to a GeoPoint location
bb - The GeoBounds representing the bounds of the map
mapDim - The dimensions of the map image in pixels
Returns:
The GeoPoint location

convertDmsToDec

public static double convertDmsToDec(int deg,
                                     int min,
                                     int sec)
Converts the specified degrees/minutes/seconds into degrees

Parameters:
deg - The degrees
min - The minutes
sec - The seconds
Returns:
Decimal degrees

convertDmsToDec

public static double convertDmsToDec(double deg,
                                     double min,
                                     double sec)
Converts the specified degrees/minutes/seconds into degrees

Parameters:
deg - The degrees
min - The minutes
sec - The seconds
Returns:
Decimal degrees

_formatCoord

protected static java.lang.String _formatCoord(double loc,
                                               int fmt,
                                               java.util.Locale locale)
Formats the specified coordinate based on the default decimal format value.

Parameters:
loc - The coordinate to format
fmt - A degrees/minutes/seconds formatting mask. (logically 'or'ed:
  • 'FORMAT_DM' to format in degrees/minutes format,
  • 'FORMAT_DMS' to format in degrees/minutes/seconds format,
  • 'FORMAT_NMEA' to format in NMEA-0183 format,
  • 'FORMAT_LATITUDE' to include N/S specification on Latitude,
  • 'FORMAT_LONGITUDE' to include E/W specification on Latitude.)
locale - The locale (only used for FORMAT_DMS/FORMAT_DM)
Returns:
The String formatted coordinate

getGeozoneChecker

public static GeozoneChecker getGeozoneChecker()
Returns an object that implements the GeozoneChecker interface implementing a point/radius geozone check.

Returns:
A object implementing the GeozoneChecker interface.

main

public static void main(java.lang.String[] argv)
Testing/debugging command-line entry point

Parameters:
argv - The command-line arguments.