|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.util.GeoPoint
public class GeoPoint
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 |
---|
public static final double EPSILON
public static final double MAX_LATITUDE
public static final double MIN_LATITUDE
public static final double MAX_LONGITUDE
public static final double MIN_LONGITUDE
public static final java.lang.String PointSeparator
public static final char PointSeparatorChar
public static final char[] PointSeparatorChars
public static final int FORMAT_DEC
public static final int FORMAT_DMS
public static final int FORMAT_DM
public static final int FORMAT_NMEA
public static final java.lang.String SFORMAT_DEC_1
public static final java.lang.String SFORMAT_DEC_2
public static final java.lang.String SFORMAT_DEC_3
public static final java.lang.String SFORMAT_DEC_4
public static final java.lang.String SFORMAT_DEC_5
public static final java.lang.String SFORMAT_DEC_6
public static final java.lang.String SFORMAT_DEC_7
public static final java.lang.String SFORMAT_DMS
public static final java.lang.String SFORMAT_DM
public static final java.lang.String SFORMAT_NMEA
public static final char DegreeChar
public static final java.lang.String[] DMS_HTML_SEPARATORS
public static final java.lang.String[] DMS_TEXT_SEPARATORS
public static final java.lang.String DECIMAL_FORMAT_0
public static final java.lang.String DECIMAL_FORMAT_1
public static final java.lang.String DECIMAL_FORMAT_2
public static final java.lang.String DECIMAL_FORMAT_3
public static final java.lang.String DECIMAL_FORMAT_4
public static final java.lang.String DECIMAL_FORMAT_5
public static final java.lang.String DECIMAL_FORMAT_6
public static final java.lang.String DECIMAL_FORMAT_7
public static final GeoPoint INVALID_GEOPOINT
public static final double PI
public static final double RADIANS
public static final double LN2
public static final double EARTH_EQUATORIAL_RADIUS_KM
public static final double EARTH_POLOR_RADIUS_KM
public static final double EARTH_MEAN_RADIUS_KM
public static final double EARTH_MEAN_RADIUS_METERS
public static final double EARTH_CIRCUMFERENCE_KM
public static final double EARTH_ANTIPODAL_KM
public static final double FEET_PER_YARD
public static final double YARDS_PER_FOOT
public static final double FEET_PER_MILE
public static final double MILES_PER_FOOT
public static final double YARDS_PER_MILE
public static final double CENTIMETERS_PER_METER
public static final double METERS_PER_CENTIMETER
public static final double METERS_PER_KILOMETER
public static final double CENTIMETERS_PER_KILOMETER
public static final double KILOMETERS_PER_CENTIMETER
public static final double KILOMETERS_PER_METER
public static final double KILOMETERS_PER_MILE
public static final double MILES_PER_KILOMETER
public static final double METERS_PER_MILE
public static final double MILES_PER_METER
public static final double METERS_PER_FOOT
public static final double FEET_PER_METER
public static final double FEET_PER_KILOMETER
public static final double METERS_PER_YARD
public static final double YARDS_PER_METER
public static final double YARDS_PER_KILOMETER
public static final double KILOMETERS_PER_NAUTICAL_MILE
public static final double NAUTICAL_MILES_PER_KILOMETER
public static final double NAUTICAL_MILES_PER_METER
public static final double MILES_PER_NAUTICAL_MILE
public static final double NAUTICAL_MILES_PER_MILE
public static final double MM_PER_INCH
public static final double INCHES_PER_MM
public static final double SQUARE_METERS_PER_SQUARE_FOOT
public static final double SQUARE_YARDS_PER_ACRE
public static final double SQUARE_FEET_PER_ACRE
public static final double SQUARE_METERS_PER_ACRE
public static final double METERS_PER_ACRE_SIDE
public static final double FEET_PER_ACRE_SIDE
public static final int ENCODE_HIRES_LEN
public static final int ENCODE_LORES_LEN
Constructor Detail |
---|
public GeoPoint()
public GeoPoint(GeoPoint gp)
gp
- The GeoPoint to copy to this constructed GeoPointpublic GeoPoint(double latitude, double longitude)
latitude
- The latitudelongitude
- The longitudepublic GeoPoint(double latDeg, double latMin, double latSec, double lonDeg, double lonMin, double lonSec)
latDeg
- The latitude degreeslatMin
- The latitude minuteslatSec
- The latitude secondslonDeg
- The longitude degreeslonMin
- The longitude minuteslonSec
- The longitude secondspublic GeoPoint(java.lang.String gp)
gp
- The String containing the GeoPoint to parse ("latitude/longitude")public GeoPoint(java.lang.String gp, char sep)
gp
- The String containing the GeoPoint to parse ("latitude/longitude")sep
- The character which separates the latitude from longitudepublic GeoPoint(java.lang.String gp, char[] sep)
gp
- The String containing the GeoPoint to parse ("latitude/longitude")sep
- The character which separates the latitude from longitudeMethod Detail |
---|
public static int GetFormatMask(java.lang.String fmt, boolean isLat)
fmt
- The decimal formatisLat
- True if is longitude, false if is latitude
public static java.lang.String GetDecimalFormat(int fmt)
fmt
- The format mask
public static java.lang.String GetHeadingTitle(java.util.Locale locale)
public static boolean isOrigin(GeoPoint gp)
gp
- The GeoPoint
public static boolean isOrigin(double lat, double lon)
lat
- The latitudelon
- The longitude
public static boolean isValidBounds(double lat, double lon)
lat
- The latitudelon
- The longitude
public static boolean isValid(double lat, double lon)
lat
- The latitudelon
- The longitude
public static boolean isValid(GeoPoint gp)
gp
- The GeoPoint
public static boolean isValid(GeoPointProvider gpp)
gpp
- The GeoPointProvider
public static double parseLatitude(java.lang.String lat, double dft)
lat
- The latitude coordinate Stringdft
- The default value
public static double parseLongitude(java.lang.String lon, double dft)
lon
- The longitude coordinate Stringdft
- The default value
public static double parseCoordinate(java.lang.String loc, boolean isLat, double dft)
loc
- The latitude or longitude coordinate StringisLat
- True if loc
represents a Latitude valuedft
- The default value
public static double getLatitude(GeoPointProvider gpp, double dft)
gpp
- The GeoPointdft
- The default latitude
public static double getLongitude(GeoPointProvider gpp, double dft)
gpp
- The GeoPointdft
- The default longitude
public static GeoPoint NewGeoPoint(RTProperties rtp, java.lang.String key)
rtp
- The RTProperties instancekey
- The RTProperties key containing the GeoPoint data
public static GeoPoint NewGeoPoint(RTProperties rtp, java.lang.String key, GeoPoint dft)
rtp
- The RTProperties instancekey
- The RTProperties key containing the GeoPoint datadft
- The default GeoPoint returned if unable to create a GeoPoint
public static GeoPoint NewGeoPoint(double lat, double lon)
lat
- The latitudelon
- The longitude
public static GeoPoint NewGeoPoint(double lat, double lon, GeoPoint dft)
lat
- The latitudelon
- The longitudedft
- The default GeoPoint returned if unable to create a GeoPoint
public java.lang.Object clone()
clone
in class java.lang.Object
public GeoPoint setImmutable()
public boolean isImmutable()
public GeoPoint getGeoPoint()
getGeoPoint
in interface GeoPointProvider
public boolean isValid()
public void setLatitude(double deg, double min, double sec)
deg
- The degreesmin
- The minutessec
- The secondspublic void setLatitude(double lat)
lat
- The Latitudepublic double getLatitude()
public double getY()
public double getLatitudeRadians()
public java.lang.String getLatitudeString(java.lang.String type, java.util.Locale locale)
type
- The format typelocale
- The locale (only used for DMS)
public java.lang.String getLatitudeString()
public static java.lang.String formatLatitude(double lat, java.lang.String type, java.util.Locale locale)
lat
- The Latitude to formattype
- The format typelocale
- The locale (only used for FORMAT_DMS)
public static java.lang.String formatLatitude(double lat)
lat
- The Latitude to format
public void setLongitude(double deg, double min, double sec)
deg
- The degreesmin
- The minutessec
- The secondspublic void setLongitude(double lon)
lon
- The Longitudepublic double getLongitude()
public double getX()
public double getLongitudeRadians()
public java.lang.String getLongitudeString(java.lang.String type, java.util.Locale locale)
type
- The format typelocale
- The locale (only used for DMS)
public java.lang.String getLongitudeString()
public static java.lang.String formatLongitude(double lon, java.lang.String type, java.util.Locale locale)
lon
- The Longitude to formattype
- The format typelocale
- The locale (only used for FORMAT_DMS)
public static java.lang.String formatLongitude(double lon)
lon
- The Longitude to format
public static byte[] encodeGeoPoint(GeoPoint gp, byte[] enc, int ofs, int len)
gp
- The GeoPoint to encodeenc
- The byte array into which the GeoPoint will be encodedofs
- The offset into the byte array where the encoded GeoPoint will be placedlen
- Either '6', for 6-byte encoding, or '8', for 8-byte encoding
public static GeoPoint decodeGeoPoint(byte[] enc, int ofs, int len)
enc
- The byte array from which the GeoPoint will be decodedofs
- The offset into the byte array where the GeoPoint will be decodedlen
- Either '6', for 6-byte decoding, or '8', for 8-byte decoding
public double radiansToPoint(GeoPoint dest)
dest
- The destination point
public double kilometersToPoint(GeoPoint gp)
gp
- The destination point
public double metersToPoint(GeoPoint gp)
gp
- The destination point
public GeoOffset getRadiusDeltaPoint(double radiusMeters)
radiusMeters
- The radius in meters
public static java.lang.String GetHeadingString(double heading, java.util.Locale locale)
heading
- The compass heading value to convert to a String representationlocale
- The locale
public static java.lang.String GetHeadingDescription(double heading, java.util.Locale locale)
heading
- The compass heading value to convert to a String descriptionlocale
- The locale
public double headingToPoint(GeoPoint dest)
dest
- The destination point
public GeoPoint getHeadingPoint(double distM, double heading)
heading
- The headingdistM
- The distance in meterspublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(char sep)
sep
- The character used to separate the Latitude from the Longitude
public java.lang.String toString(java.lang.String type, java.util.Locale locale)
type
- The format type
public java.lang.String toString(java.lang.String type, char sep, java.util.Locale locale)
type
- The format typesep
- The character used to separate the Latitude from the Longitude
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public static PixelPoint geoPointToPixel(GeoPoint gg, GeoBounds bb, PixelDimension mapDim)
gg
- The GeoPoint to convert to a pixel locationbb
- The GeoBounds representing the bounds of the mapmapDim
- The dimensions of the map image in pixels
public static GeoPoint pixelToGeoPoint(PixelPoint xx, GeoBounds bb, PixelDimension mapDim)
xx
- The PixelPoint to convert to a GeoPoint locationbb
- The GeoBounds representing the bounds of the mapmapDim
- The dimensions of the map image in pixels
public static double convertDmsToDec(int deg, int min, int sec)
deg
- The degreesmin
- The minutessec
- The seconds
public static double convertDmsToDec(double deg, double min, double sec)
deg
- The degreesmin
- The minutessec
- The seconds
protected static java.lang.String _formatCoord(double loc, int fmt, java.util.Locale locale)
loc
- The coordinate to formatfmt
- A degrees/minutes/seconds formatting mask. (logically 'or'ed:
locale
- The locale (only used for FORMAT_DMS/FORMAT_DM)
public static GeozoneChecker getGeozoneChecker()
public static void main(java.lang.String[] argv)
argv
- The command-line arguments.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |