- Timestamp:
- 2016-01-18T22:48:40+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r9431 r9532 25 25 import org.openstreetmap.josm.data.projection.datum.ThreeParameterDatum; 26 26 import org.openstreetmap.josm.data.projection.datum.WGS84Datum; 27 import org.openstreetmap.josm.data.projection.proj.ICentralMeridianProvider; 27 28 import org.openstreetmap.josm.data.projection.proj.IPolar; 28 29 import org.openstreetmap.josm.data.projection.proj.Mercator; … … 98 99 /** Latitude of second standard parallel */ 99 100 lat_2("lat_2", true), 100 /** Latitude of true scale */ 101 /** Latitude of true scale (Polar Stereographic) */ 101 102 lat_ts("lat_ts", true), 103 /** longitude of the center of the projection (Oblique Mercator) */ 104 lonc("lonc", true), 105 /** azimuth (true) of the center line passing through the center of the 106 * projection (Oblique Mercator) */ 107 alpha("alpha", true), 108 /** rectified bearing of the center line (Oblique Mercator) */ 109 gamma("gamma", true), 110 /** select "Hotine" variant of Oblique Mercator */ 111 no_off("no_off", false), 112 /** legacy alias for no_off */ 113 no_uoff("no_uoff", false), 114 /** longitude of first point (Oblique Mercator) */ 115 lon_1("lon_1", true), 116 /** longitude of second point (Oblique Mercator) */ 117 lon_2("lon_2", true), 102 118 /** the exact proj.4 string will be preserved in the WKT representation */ 103 119 wktext("wktext", false), // ignored … … 232 248 if (s != null) { 233 249 this.lon0 = parseAngle(s, Param.lon_0.key); 250 } 251 if (proj instanceof ICentralMeridianProvider) { 252 this.lon0 = ((ICentralMeridianProvider) proj).getCentralMeridian(); 234 253 } 235 254 s = parameters.get(Param.pm.key); … … 501 520 if (s != null) { 502 521 projParams.lat_ts = parseAngle(s, Param.lat_ts.key); 522 } 523 s = parameters.get(Param.lonc.key); 524 if (s != null) { 525 projParams.lonc = parseAngle(s, Param.lonc.key); 526 } 527 s = parameters.get(Param.alpha.key); 528 if (s != null) { 529 projParams.alpha = parseAngle(s, Param.alpha.key); 530 } 531 s = parameters.get(Param.gamma.key); 532 if (s != null) { 533 projParams.gamma = parseAngle(s, Param.gamma.key); 534 } 535 s = parameters.get(Param.lon_1.key); 536 if (s != null) { 537 projParams.lon1 = parseAngle(s, Param.lon_1.key); 538 } 539 s = parameters.get(Param.lon_2.key); 540 if (s != null) { 541 projParams.lon2 = parseAngle(s, Param.lon_2.key); 542 } 543 if (parameters.containsKey(Param.no_off.key) || parameters.containsKey(Param.no_uoff.key)) { 544 projParams.no_off = true; 503 545 } 504 546 proj.initialize(projParams); -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r9419 r9532 35 35 import org.openstreetmap.josm.data.projection.proj.LonLat; 36 36 import org.openstreetmap.josm.data.projection.proj.Mercator; 37 import org.openstreetmap.josm.data.projection.proj.ObliqueMercator; 37 38 import org.openstreetmap.josm.data.projection.proj.PolarStereographic; 38 39 import org.openstreetmap.josm.data.projection.proj.Proj; … … 88 89 registerBaseProjection("lcc", LambertConformalConic.class, "core"); 89 90 registerBaseProjection("lonlat", LonLat.class, "core"); 91 registerBaseProjection("omerc", ObliqueMercator.class, "core"); 90 92 registerBaseProjection("somerc", SwissObliqueMercator.class, "core"); 91 93 registerBaseProjection("stere", PolarStereographic.class, "core"); -
trunk/src/org/openstreetmap/josm/data/projection/proj/AbstractProj.java
r9432 r9532 25 25 26 26 /** 27 * Difference allowed in iterative computations. 28 */ 29 private static final double ITERATION_TOLERANCE = 1E-10; 30 31 /** 27 32 * Relative iteration precision used in the <code>mlfn</code> method 28 33 */ … … 153 158 154 159 /** 160 * Iteratively solve equation (7-9) from Snyder. 161 */ 162 final double cphi2(final double ts) { 163 final double eccnth = 0.5 * e; 164 double phi = (Math.PI/2) - 2.0 * Math.atan(ts); 165 for (int i=0; i<MAXIMUM_ITERATIONS; i++) { 166 final double con = e * Math.sin(phi); 167 final double dphi = (Math.PI/2) - 2.0*Math.atan(ts * Math.pow((1-con)/(1+con), eccnth)) - phi; 168 phi += dphi; 169 if (Math.abs(dphi) <= ITERATION_TOLERANCE) { 170 return phi; 171 } 172 } 173 throw new RuntimeException("no convergence"); 174 } 175 176 /** 155 177 * Computes function <code>f(s,c,e²) = c/sqrt(1 - s²×e²)</code> needed for the true scale 156 178 * latitude (Snyder 14-15), where <var>s</var> and <var>c</var> are the sine and cosine of -
trunk/src/org/openstreetmap/josm/data/projection/proj/ProjParameters.java
r9419 r9532 14 14 public Double lat1; 15 15 public Double lat2; 16 17 // Polar Stereographic 16 18 public Double lat_ts; 19 20 // Oblique Mercator 21 public Double lonc; 22 public Double alpha; 23 public Double gamma; 24 public Boolean no_off; 25 public Double lon1; 26 public Double lon2; 17 27 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r9246 r9532 739 739 GeneralPath path = new GeneralPath(); 740 740 741 double d = 1.0; 741 742 path.moveTo(p.x, p.y); 742 743 double max = b.getMax().lat(); 743 for (; lat <= max; lat += 1.0) {744 for (; lat <= max; lat += d) { 744 745 p = getPoint(new LatLon(lat >= max ? max : lat, lon)); 745 746 path.lineTo(p.x, p.y); 746 747 } 747 748 lat = max; max = b.getMax().lon(); 748 for (; lon <= max; lon += 1.0) {749 for (; lon <= max; lon += d) { 749 750 p = getPoint(new LatLon(lat, lon >= max ? max : lon)); 750 751 path.lineTo(p.x, p.y); 751 752 } 752 753 lon = max; max = b.getMinLat(); 753 for (; lat >= max; lat -= 1.0) {754 for (; lat >= max; lat -= d) { 754 755 p = getPoint(new LatLon(lat <= max ? max : lat, lon)); 755 756 path.lineTo(p.x, p.y); 756 757 } 757 758 lat = max; max = b.getMinLon(); 758 for (; lon >= max; lon -= 1.0) {759 for (; lon >= max; lon -= d) { 759 760 p = getPoint(new LatLon(lat, lon <= max ? max : lon)); 760 761 path.lineTo(p.x, p.y);
Note:
See TracChangeset
for help on using the changeset viewer.