Changeset 8609 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2015-07-21T22:39:57+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r8608 r8609 103 103 /** definition of axis for projection */ 104 104 axis("axis", true), 105 /** UTM zone */ 106 zone("zone", true), 107 /** indicate southern hemisphere for UTM */ 108 south("south", false), 105 109 // JOSM extensions, not present in PROJ.4 106 110 wmssrs("wmssrs", true), … … 185 189 datum = parseDatum(parameters, ellps); 186 190 proj = parseProjection(parameters, ellps); 191 // "utm" is a shortcut for a set of parameters 192 if ("utm".equals(parameters.get(Param.proj.key))) { 193 String zoneStr = parameters.get(Param.zone.key); 194 Integer zone; 195 if (zoneStr == null) 196 throw new ProjectionConfigurationException(tr("UTM projection (''+proj=utm'') requires ''+zone=...'' parameter.")); 197 try { 198 zone = Integer.parseInt(zoneStr); 199 } catch (NumberFormatException e) { 200 zone = null; 201 } 202 if (zone == null || zone < 1 || zone > 60) 203 throw new ProjectionConfigurationException(tr("Expected integer value in range 1-60 for ''+zone=...'' paramter.")); 204 this.lon0 = 6 * zone - 183; 205 this.k0 = 0.9996; 206 this.x0 = 500000; 207 this.y0 = parameters.containsKey(Param.south.key) ? 10000000 : 0; 208 } 187 209 String s = parameters.get(Param.x_0.key); 188 210 if (s != null) { … … 400 422 if (id == null) throw new ProjectionConfigurationException(tr("Projection required (+proj=*)")); 401 423 424 // "utm" is not a real projection, but a shortcut for a set of parameters 425 if ("utm".equals(id)) { 426 id = "tmerc"; 427 } 402 428 Proj proj = Projections.getBaseProjection(id); 403 429 if (proj == null) throw new ProjectionConfigurationException(tr("Unknown projection identifier: ''{0}''", id)); … … 436 462 public static double parseDouble(Map<String, String> parameters, String parameterName) throws ProjectionConfigurationException { 437 463 if (!parameters.containsKey(parameterName)) 438 throw new IllegalArgumentException(tr("Unknown parameter ''{0}''", parameterName));464 throw new ProjectionConfigurationException(tr("Unknown parameter ''{0}''", parameterName)); 439 465 String doubleStr = parameters.get(parameterName); 440 466 if (doubleStr == null)
Note:
See TracChangeset
for help on using the changeset viewer.