Changeset 5239 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/data_nodist/projection-regression-test-data.csv
r5236 r5239 495 495 EPSG:3812 496 496 ll 50.76787953358437 3.4513353977071453 497 en 585284.667765004 6662323.5758590293498 ll2 50.76787953358439 3.45133539770714 53497 en 585284.6677650047 662323.5758590293 498 ll2 50.76787953358439 3.451335397707146 499 499 EPSG:21781 500 500 ll 46.582471410091934 8.159223152110604 … … 523 523 EPSG:27561 524 524 ll 48.687023294540744 9.13470536591202 525 en 1099861.4328694288 132165.34758885 13525 en 1099861.4328694288 132165.3475888506 526 526 ll2 48.687023294540765 9.134705365912021 527 527 EPSG:27562 … … 531 531 EPSG:27563 532 532 ll 46.443136133672226 5.992820527372115 533 en 881070.780534026 1466693.7656533603534 ll2 46.44313613367226 5.99282052737211 4533 en 881070.7805340262 466693.7656533603 534 ll2 46.44313613367226 5.992820527372113 535 535 EPSG:27564 536 536 ll 43.42400252536329 0.5163786716368639 -
trunk/src/org/openstreetmap/josm/data/projection/AbstractProjection.java
r5237 r5239 98 98 99 99 protected static final double convertDegreeMinuteSecond(double degree, double minute, double second) { 100 return degree + convertMinuteSecond(minute, second);100 return degree + (minute/60.0) + (second/3600.0); 101 101 } 102 103 public void dump() { 104 System.err.println("x_0="+x_0); 105 System.err.println("y_0="+y_0); 106 System.err.println("lon_0="+lon_0); 107 System.err.println("k_0="+k_0); 108 System.err.println("ellps="+ellps); 109 System.err.println("proj="+proj); 110 System.err.println("datum="+datum); 111 } 112 102 113 } -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r5237 r5239 16 16 import org.openstreetmap.josm.data.Bounds; 17 17 import org.openstreetmap.josm.data.coor.LatLon; 18 import org.openstreetmap.josm.data.projection.CustomProjection.Param;19 18 import org.openstreetmap.josm.data.projection.datum.CentricDatum; 20 19 import org.openstreetmap.josm.data.projection.datum.Datum; … … 44 43 protected Bounds bounds; 45 44 46 protected static class Param { 45 protected static enum Param { 46 47 x_0("x_0", true), 48 y_0("y_0", true), 49 lon_0("lon_0", true), 50 k_0("k_0", true), 51 ellps("ellps", true), 52 a("a", true), 53 es("es", true), 54 rf("rf", true), 55 f("f", true), 56 b("b", true), 57 datum("datum", true), 58 towgs84("towgs84", true), 59 nadgrids("nadgrids", true), 60 proj("proj", true), 61 lat_0("lat_0", true), 62 lat_1("lat_1", true), 63 lat_2("lat_2", true), 64 wktext("wktext", false), // ignored 65 units("units", true), // ignored 66 no_defs("no_defs", false), 67 init("init", true), 68 // JOSM extension, not present in PROJ.4 69 bounds("bounds", true); 70 47 71 public String key; 48 72 public boolean hasValue; 49 73 50 public final static Param x_0 = new Param("x_0", true);51 public final static Param y_0 = new Param("y_0", true);52 public final static Param lon_0 = new Param("lon_0", true);53 public final static Param k_0 = new Param("k_0", true);54 public final static Param ellps = new Param("ellps", true);55 public final static Param a = new Param("a", true);56 public final static Param es = new Param("es", true);57 public final static Param rf = new Param("rf", true);58 public final static Param f = new Param("f", true);59 public final static Param b = new Param("b", true);60 public final static Param datum = new Param("datum", true);61 public final static Param towgs84 = new Param("towgs84", true);62 public final static Param nadgrids = new Param("nadgrids", true);63 public final static Param proj = new Param("proj", true);64 public final static Param lat_0 = new Param("lat_0", true);65 public final static Param lat_1 = new Param("lat_1", true);66 public final static Param lat_2 = new Param("lat_2", true);67 public final static Param wktext = new Param("wktext", false); // ignored68 public final static Param units = new Param("units", true); // ignored69 public final static Param no_defs = new Param("no_defs", false);70 public final static Param init = new Param("init", true);71 // JOSM extension, not present in PROJ.472 public final static Param bounds = new Param("bounds", true);73 74 public final static Set<Param> params = new HashSet<Param>(Arrays.asList(75 x_0, y_0, lon_0, k_0, ellps, a, es, rf, f, b, datum, towgs84,76 nadgrids, proj, lat_0, lat_1, lat_2, wktext, units, no_defs,77 init, bounds78 ));79 80 74 public final static Map<String, Param> paramsByKey = new HashMap<String, Param>(); 81 75 static { 82 for (Param p : params) {76 for (Param p : Param.values()) { 83 77 paramsByKey.put(p.key, p); 84 78 } 85 79 } 86 80 87 publicParam(String key, boolean hasValue) {81 Param(String key, boolean hasValue) { 88 82 this.key = key; 89 83 this.hasValue = hasValue; … … 116 110 bounds = new Bounds( 117 111 new LatLon(-85.05112877980659, -180.0), 118 new LatLon(85.05112877980659, 180.0)); 112 new LatLon(85.05112877980659, 180.0), true); 119 113 } else { 120 114 Map<String, String> parameters = parseParameterList(pref); … … 384 378 final String FLOAT = "(\\d+(\\.\\d*)?)"; 385 379 boolean dms = false; 380 double deg = 0.0, min = 0.0, sec = 0.0; 386 381 // degrees 387 382 m = Pattern.compile("^"+FLOAT+"d").matcher(s); 388 383 if (m.find()) { 389 384 s = s.substring(m.end()); 390 value += Double.parseDouble(m.group(1));385 deg = Double.parseDouble(m.group(1)); 391 386 dms = true; 392 387 } … … 395 390 if (m.find()) { 396 391 s = s.substring(m.end()); 397 value += Double.parseDouble(m.group(1))/ 60.0;392 min = Double.parseDouble(m.group(1)); 398 393 dms = true; 399 394 } … … 402 397 if (m.find()) { 403 398 s = s.substring(m.end()); 404 value += Double.parseDouble(m.group(1))/ 3600.0;399 sec = Double.parseDouble(m.group(1)); 405 400 dms = true; 406 401 } 407 402 // plain number (in degrees) 408 if (!dms) { 403 if (dms) { 404 value = deg + (min/60.0) + (sec/3600.0); 405 } else { 409 406 m = Pattern.compile("^"+FLOAT).matcher(s); 410 407 if (m.find()) { … … 433 430 } 434 431 435 public void dump() {436 System.err.println("x_0="+x_0);437 System.err.println("y_0="+y_0);438 System.err.println("lon_0="+lon_0);439 System.err.println("k_0="+k_0);440 System.err.println("ellps="+ellps);441 System.err.println("proj="+proj);442 System.err.println("datum="+datum);443 }444 445 432 @Override 446 433 public Integer getEpsgCode() {
Note:
See TracChangeset
for help on using the changeset viewer.