|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectezvcard.util.GeoUri
public class GeoUri
Represents a URI for encoding a geographical position.
Example: geo:12.341,56.784
Field Summary | |
---|---|
static String |
CRS_WGS84
The coordinate reference system used by GPS (the default). |
Constructor Summary | |
---|---|
GeoUri()
Creates an empty geo URI. |
|
GeoUri(Double coordA,
Double coordB,
Double coordC,
String crs,
Double uncertainty)
Creates a geo URI. |
|
GeoUri(String uri)
Parses a geo URI string. |
Method Summary | |
---|---|
void |
addParameter(String name,
String value)
Adds a parameter. |
static NumberFormat |
buildNumberFormat(int decimals)
Builds a number formatter object for displaying latitudes/longitudes as strings. |
Double |
getCoordA()
Gets the first coordinate (latitude). |
Double |
getCoordB()
Gets the second coordinate (longitude). |
Double |
getCoordC()
Gets the third coordinate (altitude). |
String |
getCrs()
Gets the coordinate reference system. |
String |
getParameter(String name)
Gets a parameter value. |
Map<String,String> |
getParameters()
Gets all the parameters. |
Double |
getUncertainty()
Gets the uncertainty (how accurate the coordinates are). |
boolean |
isValid()
Determines if the geo URI is valid or not (in other words, if both the A and B coordinates are present). |
void |
removeParameter(String name)
Removes a parameter. |
void |
setCoordA(Double coordA)
Sets the first coordinate (latitude). |
void |
setCoordB(Double coordB)
Sets the second coordinate (longitude). |
void |
setCoordC(Double coordC)
Sets the third coordinate (altitude). |
void |
setCrs(String crs)
Sets the coordinate reference system. |
void |
setUncertainty(Double uncertainty)
Sets the uncertainty (how accurate the coordinates are). |
String |
toString()
Converts this geo URI to its string representation. |
String |
toString(int decimals)
Converts this geo URI to its string representation. |
URI |
toUri()
Creates a URI object from this geo URI. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String CRS_WGS84
Constructor Detail |
---|
public GeoUri()
public GeoUri(Double coordA, Double coordB, Double coordC, String crs, Double uncertainty)
coordA
- the first coordinate (latitude, required)coordB
- the second coordinate (longitude, required)coordC
- the third coordinate (altitude, optional)crs
- the coordinate system (optional, defaults to WGS-84)uncertainty
- the accuracy of the coordinates (in meters, optional)public GeoUri(String uri)
uri
- the URI string
IllegalArgumentException
- if the string is not a valid geo URIMethod Detail |
---|
public Double getCoordA()
public void setCoordA(Double coordA)
coordA
- the first coordinatepublic Double getCoordB()
public void setCoordB(Double coordB)
coordB
- the second coordinatepublic Double getCoordC()
public void setCoordC(Double coordC)
coordC
- the third coordinate or null to removepublic String getCrs()
public void setCrs(String crs)
crs
- the coordinate reference system (can only contain letters,
numbers, and hyphens) or null to use the default (WGS-84)
IllegalArgumentException
- if the CRS name contains invalid
characterspublic Double getUncertainty()
public void setUncertainty(Double uncertainty)
uncertainty
- the uncertainty (in meters) or null to removepublic void addParameter(String name, String value)
name
- the parameter name (can only contain letters, numbers, and
hyphens)value
- the parameter value
IllegalArgumentException
- if the parameter name contains invalid
characterspublic void removeParameter(String name)
name
- the name of the parameter to removepublic String getParameter(String name)
name
- the parameter name
public Map<String,String> getParameters()
public URI toUri()
URI
object from this geo URI.
URI
objectpublic boolean isValid()
public String toString()
toString
in class Object
public String toString(int decimals)
decimals
- the number of decimals to display for floating point
values
public static NumberFormat buildNumberFormat(int decimals)
decimals
- the number of decimals to display
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |