|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opensha.commons.geo.Location
public class Location
A Location represents a point with reference to the earth's
ellipsoid. It is expressed in terms of latitude, longitude, and depth. As in
seismology, the convention adopted in OpenSHA is for depth to be
positive-down, always. All utility methods in this package assume this to be
the case.
For computational cenvenience, latitude and longitude values are converted
and stored internally in radians. Special get***Rad() methods
are provided to access this native format.
Location instances are immutable.
| Field Summary | |
|---|---|
static String |
XML_METADATA_DEPTH
|
static String |
XML_METADATA_LATITUDE
|
static String |
XML_METADATA_LONGITUDE
|
static String |
XML_METADATA_NAME
|
| Constructor Summary | |
|---|---|
Location(double lat,
double lon)
Constructs a new Location with the supplied latitude and
longitude and sets the depth to 0. |
|
Location(double lat,
double lon,
double depth)
Constructs a new Location with the supplied latitude,
longitude, and depth values. |
|
| Method Summary | |
|---|---|
Location |
clone()
|
int |
compareTo(Location loc)
Compares this Location to another and sorts first by
latitude, then by longitude. |
boolean |
equals(Object obj)
|
static Location |
fromXMLMetadata(Element root)
|
double |
getDepth()
Returns the depth of this Location. |
double |
getLatitude()
Returns the latitude of this Location. |
double |
getLatRad()
Returns the latitude of this Location. |
double |
getLongitude()
Returns the longitude of this Location. |
double |
getLonRad()
Returns the longitude of this Location. |
int |
hashCode()
|
String |
toKML()
Returns this Location formatted as a "lon,lat,depth"
String for use in KML documents. |
String |
toString()
|
Element |
toXMLMetadata(Element root)
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String XML_METADATA_NAME
public static final String XML_METADATA_LONGITUDE
public static final String XML_METADATA_LATITUDE
public static final String XML_METADATA_DEPTH
| Constructor Detail |
|---|
public Location(double lat,
double lon)
Location with the supplied latitude and
longitude and sets the depth to 0.
lat - latitude in decimal degrees to setlon - longitude in decimal degrees to set
IllegalArgumentException - if any supplied values are out of rangeGeoTools
public Location(double lat,
double lon,
double depth)
Location with the supplied latitude,
longitude, and depth values.
lat - latitude in decimal degrees to setlon - longitude in decimal degrees to setdepth - in km to set (positive down)
IllegalArgumentException - if any supplied values are out of rangeGeoTools| Method Detail |
|---|
public double getDepth()
Location.
Location depth in kmpublic double getLatitude()
Location.
Location latitude in decimal degreespublic double getLongitude()
Location.
Location longitude in decimal degreespublic double getLatRad()
Location.
Location latitude in radianspublic double getLonRad()
Location.
Location longitude in radianspublic String toKML()
Location formatted as a "lon,lat,depth"
String for use in KML documents. This differs from
toString() in that the output lat-lon order are
reversed.
String for use with KML markuppublic String toString()
toString in class Objectpublic Location clone()
clone in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic int compareTo(Location loc)
Location to another and sorts first by
latitude, then by longitude. When sorting a list of randomized but
evenly spaced grid of Locations, the resultant ordering
will be left to right across rows of uniform latitude, ascending to
the leftmost next higher latitude at the end of each row (left-to-right,
bottom-to-top).
compareTo in interface Comparable<Location>loc - Location to compare this to
Location is less than, equal to, or greater than
the specified Location.public Element toXMLMetadata(Element root)
toXMLMetadata in interface XMLSaveablepublic static Location fromXMLMetadata(Element root)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||