Class LatLonParser
- java.lang.Object
-
- org.openstreetmap.josm.data.coor.conversion.LatLonParser
-
public final class LatLonParser extends Object
Support for parsing aLatLon
object from a string.- Since:
- 12792
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
LatLonParser.LatLonHolder
-
Field Summary
Fields Modifier and Type Field Description private static String
DEG
private static String
DMS
Degree-Minute-Second patternprivate static char
E_TR
static String
EAST
Character denoting East, as stringprivate static String
FLOAT
private static String
MIN
private static char
N_TR
static String
NORTH
Character denoting North, as stringprivate static Pattern
P
private static Pattern
P_DMS
private static Pattern
P_XML
private static char
S_TR
private static String
SEC
static String
SOUTH
Character denoting South, as stringprivate static char
W_TR
static String
WEST
Character denoting West, as string
-
Constructor Summary
Constructors Modifier Constructor Description private
LatLonParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LatLon
parse(String coord)
Parses the given string as lat/lon.static double
parseCoordinate(String angleStr)
Parse string coordinate from floating point or DMS format.private static void
setLatLon(LatLonParser.LatLonHolder latLon, double coordDeg, double coordMin, double coordSec, String card)
private static void
setLatLon(LatLonParser.LatLonHolder latLon, double coord1deg, double coord1min, double coord1sec, String card1, double coord2deg, double coord2min, double coord2sec, String card2)
private static void
setLatLonObj(LatLonParser.LatLonHolder latLon, Object coord1deg, Object coord1min, Object coord1sec, Object card1, Object coord2deg, Object coord2min, Object coord2sec, Object card2)
-
-
-
Field Detail
-
N_TR
private static final char N_TR
-
S_TR
private static final char S_TR
-
E_TR
private static final char E_TR
-
W_TR
private static final char W_TR
-
DEG
private static final String DEG
- See Also:
- Constant Field Values
-
MIN
private static final String MIN
- See Also:
- Constant Field Values
-
SEC
private static final String SEC
- See Also:
- Constant Field Values
-
FLOAT
private static final String FLOAT
- See Also:
- Constant Field Values
-
DMS
private static final String DMS
Degree-Minute-Second pattern- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LatLonParser
private LatLonParser()
-
-
Method Detail
-
parse
public static LatLon parse(String coord)
Parses the given string as lat/lon.- Parameters:
coord
- String to parse- Returns:
- parsed lat/lon
- Since:
- 12792 (moved from
LatLon
, there since 11045)
-
setLatLonObj
private static void setLatLonObj(LatLonParser.LatLonHolder latLon, Object coord1deg, Object coord1min, Object coord1sec, Object card1, Object coord2deg, Object coord2min, Object coord2sec, Object card2)
-
setLatLon
private static void setLatLon(LatLonParser.LatLonHolder latLon, double coord1deg, double coord1min, double coord1sec, String card1, double coord2deg, double coord2min, double coord2sec, String card2)
-
setLatLon
private static void setLatLon(LatLonParser.LatLonHolder latLon, double coordDeg, double coordMin, double coordSec, String card)
-
parseCoordinate
public static double parseCoordinate(String angleStr)
Parse string coordinate from floating point or DMS format.- Parameters:
angleStr
- the string to parse as coordinate e.g. -1.1 or 50d10'3"W- Returns:
- the value, in degrees
- Throws:
IllegalArgumentException
- in case parsing fails- Since:
- 12792
-
-