Changeset 9105 in josm for trunk/src/org
- Timestamp:
- 2015-12-13T01:06:16+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/projection
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/AbstractProjection.java
r8840 r9105 29 29 protected double y0; /* false northing (in meters) */ 30 30 protected double lon0; /* central meridian */ 31 protected double pm; /* prime meridian */ 31 32 protected double k0 = 1.0; /* general scale factor */ 32 33 … … 66 67 public EastNorth latlon2eastNorth(LatLon ll) { 67 68 ll = datum.fromWGS84(ll); 68 double[] en = proj.project(Math.toRadians(ll.lat()), Math.toRadians(ll.lon() - lon0 ));69 double[] en = proj.project(Math.toRadians(ll.lat()), Math.toRadians(ll.lon() - lon0 - pm)); 69 70 return new EastNorth(ellps.a * k0 * en[0] + x0, ellps.a * k0 * en[1] + y0); 70 71 } … … 73 74 public LatLon eastNorth2latlon(EastNorth en) { 74 75 double[] latlon_rad = proj.invproject((en.east() - x0) / ellps.a / k0, (en.north() - y0) / ellps.a / k0); 75 LatLon ll = new LatLon(Math.toDegrees(latlon_rad[0]), Math.toDegrees(latlon_rad[1]) + lon0 );76 LatLon ll = new LatLon(Math.toDegrees(latlon_rad[0]), Math.toDegrees(latlon_rad[1]) + lon0 + pm); 76 77 return datum.toWGS84(ll); 77 78 } -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r8846 r9105 38 38 private static final double METER_PER_UNIT_DEGREE = 2 * Math.PI * 6370997 / 360; 39 39 private static final Map<String, Double> UNITS_TO_METERS = getUnitsToMeters(); 40 private static final Map<String, Double> PRIME_MERIDANS = getPrimeMeridians(); 40 41 41 42 /** … … 64 65 /** Central meridian */ 65 66 lon_0("lon_0", true), 67 /** Prime meridian */ 68 pm("pm", true), 66 69 /** Scaling factor */ 67 70 k_0("k_0", true), … … 222 225 this.lon0 = parseAngle(s, Param.lon_0.key); 223 226 } 227 s = parameters.get(Param.pm.key); 228 if (s != null) { 229 if (PRIME_MERIDANS.containsKey(s)) { 230 this.pm = PRIME_MERIDANS.get(s); 231 } else { 232 this.pm = parseAngle(s, Param.pm.key); 233 } 234 } 224 235 s = parameters.get(Param.k_0.key); 225 236 if (s != null) { … … 626 637 return ret; 627 638 } 639 640 private static Map<String, Double> getPrimeMeridians() { 641 Map<String, Double> ret = new ConcurrentHashMap<>(); 642 try { 643 ret.put("greenwich", 0.0); 644 ret.put("lisbon", parseAngle("9d07'54.862\"W", null)); 645 ret.put("paris", parseAngle("2d20'14.025\"E", null)); 646 ret.put("bogota", parseAngle("74d04'51.3\"W", null)); 647 ret.put("madrid", parseAngle("3d41'16.58\"W", null)); 648 ret.put("rome", parseAngle("12d27'8.4\"E", null)); 649 ret.put("bern", parseAngle("7d26'22.5\"E", null)); 650 ret.put("jakarta", parseAngle("106d48'27.79\"E", null)); 651 ret.put("ferro", parseAngle("17d40'W", null)); 652 ret.put("brussels", parseAngle("4d22'4.71\"E", null)); 653 ret.put("stockholm", parseAngle("18d3'29.8\"E", null)); 654 ret.put("athens", parseAngle("23d42'58.815\"E", null)); 655 ret.put("oslo", parseAngle("10d43'22.5\"E", null)); 656 } catch (ProjectionConfigurationException ex) { 657 throw new RuntimeException(); 658 } 659 return ret; 660 } 628 661 }
Note:
See TracChangeset
for help on using the changeset viewer.