Package org.netxms.base
Class GeoLocation
java.lang.Object
org.netxms.base.GeoLocation
Geolocation encoding
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionGeoLocation(boolean isGPS) Create geolocation object of type UNSET or GPSGeoLocation(double lat, double lon) Create geolocation object of type MANUALGeoLocation(double lat, double lon, int type, int accuracy, Date timestamp) Create geolocation object of given type, accuracy, and timestampGeoLocation(NXCPMessage msg) Create geolocation object from NXCP messageGeoLocation(NXCPMessage msg, long baseId) Create geolocation object from NXCP message
- 
Method SummaryModifier and TypeMethodDescriptionintcalculateDistance(GeoLocation location) Calculates distance between two location pointsbooleanintGet location accuracy (in meters)Get end timestampdoubleGet latitudedoubleGet longitudefinal DateGet location's time stamp.intgetType()Get location typeinthashCode()booleanReturns true if location was obtained automatically (from GPS or network)booleanisWithinArea(double northBorder, double westBorder, double southBorder, double eastBorder) Check if this location is within given area.booleanisWithinArea(GeoLocation northWest, GeoLocation southEast) Check if this location is within given area.static StringlatitudeToString(double lat) Convert latitude from floating point to text representationstatic StringlongitudeToString(double lon) Convert longitude from floating point to text representationstatic GeoLocationParse geolocation string where latitude and longitude placed together and separated by space(s).static GeoLocationparseGeoLocation(String lat, String lon) Parse geolocation string.voidsetEndTimestamp(Date endTimestamp) Set end timestamptoString()
- 
Field Details- 
UNSETpublic static final int UNSET- See Also:
 
- 
MANUALpublic static final int MANUAL- See Also:
 
- 
GPSpublic static final int GPS- See Also:
 
- 
NETWORKpublic static final int NETWORK- See Also:
 
 
- 
- 
Constructor Details- 
GeoLocationCreate geolocation object from NXCP message- Parameters:
- msg- NXCP message
 
- 
GeoLocationCreate geolocation object from NXCP message- Parameters:
- msg- NXCP message
- baseId- base field ID
 
- 
GeoLocationpublic GeoLocation(boolean isGPS) Create geolocation object of type UNSET or GPS- Parameters:
- isGPS- if true set type to GPS
 
- 
GeoLocationpublic GeoLocation(double lat, double lon) Create geolocation object of type MANUAL- Parameters:
- lat- Latitude
- lon- Longitude
 
- 
GeoLocationCreate geolocation object of given type, accuracy, and timestamp- Parameters:
- lat- Latitude
- lon- Longitude
- type- geolocation type
- accuracy- location accuracy in meters
- timestamp- location timestamp
 
 
- 
- 
Method Details- 
isWithinAreaCheck if this location is within given area.- Parameters:
- northWest- top left (north west) corner of the area
- southEast- bottom right (south east) corner of the area
- Returns:
- true if this location is within given area
 
- 
isWithinAreapublic boolean isWithinArea(double northBorder, double westBorder, double southBorder, double eastBorder) Check if this location is within given area.- Parameters:
- northBorder- north area border (highest latitude)
- westBorder- west area border
- southBorder- south area border (lowest latitude)
- eastBorder- east area border
- Returns:
- true if this location is within given area
 
- 
isAutomaticpublic boolean isAutomatic()Returns true if location was obtained automatically (from GPS or network)- Returns:
- true if location was obtained automatically (from GPS or network)
 
- 
getTypepublic int getType()Get location type- Returns:
- location type
 
- 
getLatitudepublic double getLatitude()Get latitude- Returns:
- the latitude
 
- 
getLongitudepublic double getLongitude()Get longitude- Returns:
- the longitude
 
- 
getAccuracypublic int getAccuracy()Get location accuracy (in meters)- Returns:
- location accuracy (in meters)
 
- 
getTimestampGet location's time stamp. May be null if not known.- Returns:
- the timestamp
 
- 
toString
- 
latitudeToStringConvert latitude from floating point to text representation- Parameters:
- lat- latitude
- Returns:
- text representation of given latitude
 
- 
longitudeToStringConvert longitude from floating point to text representation- Parameters:
- lon- longitude
- Returns:
- text representation of given longitude
 
- 
getLatitudeAsString- Returns:
- latitude as DMS string
 
- 
getLongitudeAsString- Returns:
- longitude as DMS string
 
- 
parseGeoLocationpublic static GeoLocation parseGeoLocation(String lat, String lon) throws GeoLocationFormatException Parse geolocation string. Latitude and longitude must be given either as numeric values or in DMS form.- Parameters:
- lat- latitude string
- lon- longitude string
- Returns:
- geolocation object
- Throws:
- GeoLocationFormatException- if the strings does not contain a parsable geolocation
 
- 
parseGeoLocationParse geolocation string where latitude and longitude placed together and separated by space(s). Latitude and longitude must be given either as numeric values or in DMS form.- Parameters:
- s- geolocation string
- Returns:
- geolocation object
- Throws:
- GeoLocationFormatException- if the string does not contain a parsable geolocation
 
- 
getEndTimestampGet end timestamp- Returns:
- end timestamp
 
- 
setEndTimestampSet end timestamp- Parameters:
- endTimestamp- end timestamp
 
- 
hashCodepublic int hashCode()
- 
equals
- 
calculateDistanceCalculates distance between two location points- Parameters:
- location- second location object
- Returns:
- the distance between two objects
 
 
-