Revision 8c4bbd4f
Added by Niels Hoffmann over 13 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/location/Point.java | ||
---|---|---|
139 | 139 |
public static final class CoordinateParser { |
140 | 140 |
|
141 | 141 |
/** |
142 |
* Pattern zum parsen von Sexagesimalen Grad: 145?
|
|
142 |
* Pattern zum parsen von Sexagesimalen Grad: 145°
|
|
143 | 143 |
*/ |
144 |
private static final String DEGREE_REGEX = "([0-9]*)?";
|
|
144 |
private static final String DEGREE_REGEX = "([0-9]*)\u00B0";
|
|
145 | 145 |
/** |
146 | 146 |
* Pattern zum parsen von Sexagesimalen Minuten: 65' |
147 | 147 |
*/ |
... | ... | |
151 | 151 |
*/ |
152 | 152 |
private static final String SECONDS_REGEX = "(?:([0-9]*)(?:''|\"))?"; |
153 | 153 |
/** |
154 |
* Himmelsrichtung L?ngengrad
|
|
154 |
* Himmelsrichtung Längengrad
|
|
155 | 155 |
*/ |
156 | 156 |
private static final String LONGITUDE_DIRECTION_REGEX = "([OEW])"; |
157 | 157 |
/** |
... | ... | |
167 | 167 |
+ LATITUDE_DIRECTION_REGEX); |
168 | 168 |
|
169 | 169 |
/** |
170 |
* Pattern zum Parsen von L?ngengraden.
|
|
170 |
* Pattern zum Parsen von Längengraden.
|
|
171 | 171 |
*/ |
172 | 172 |
private static final Pattern LONGITUDE_PATTERN = Pattern |
173 | 173 |
.compile(DEGREE_REGEX + MINUTES_REGEX + SECONDS_REGEX |
... | ... | |
179 | 179 |
|
180 | 180 |
/** |
181 | 181 |
* Parst einen Breitengrad der Form<br> |
182 |
* G?M'S""(OEW)<br>
|
|
182 |
* G°M'S""(OEW)<br>
|
|
183 | 183 |
* Die Formen<br> |
184 |
* G?(OEW)<br>
|
|
185 |
* G?M'(OEW)<br>
|
|
184 |
* G°(OEW)<br>
|
|
185 |
* G°M'(OEW)<br>
|
|
186 | 186 |
* sind ebenfalls erlaubt. |
187 | 187 |
* |
188 | 188 |
* @param strg |
... | ... | |
196 | 196 |
} |
197 | 197 |
|
198 | 198 |
/** |
199 |
* Parst einen L?ngengrad der Form<br>
|
|
200 |
* G?M'S"(NS)<br>
|
|
199 |
* Parst einen Längengrad der Form<br>
|
|
200 |
* G°M'S"(NS)<br>
|
|
201 | 201 |
* Die Formen<br> |
202 |
* G?(NS)<br>
|
|
203 |
* G?M'(NS)<br>
|
|
202 |
* G°(NS)<br>
|
|
203 |
* G°M'(NS)<br>
|
|
204 | 204 |
* sind ebenfalls erlaubt. |
205 | 205 |
* |
206 | 206 |
* @param strg |
... | ... | |
334 | 334 |
} |
335 | 335 |
} |
336 | 336 |
|
337 |
// Decimal in ?'" umrechnen
|
|
337 |
// Decimal in \u00B0'" umrechnen
|
|
338 | 338 |
double d = Math.abs(decimalDegree); |
339 | 339 |
d += HALF_SECOND; // add a second for rounding |
340 | 340 |
sexagesimal.degree = (int) Math.floor(d); |
... | ... | |
371 | 371 |
} |
372 | 372 |
public String toString(boolean includeEmptySeconds){ |
373 | 373 |
String result; |
374 |
result = String.valueOf(CdmUtils.Nz(degree)) + "?";
|
|
374 |
result = String.valueOf(CdmUtils.Nz(degree)) + "\u00B0";
|
|
375 | 375 |
if (seconds != null || minutes != null){ |
376 | 376 |
result += String.valueOf(CdmUtils.Nz(minutes)) + "'"; |
377 | 377 |
} |
Also available in: Unified diff
UTF8 for Coordinate Conversion