Changeset 1857 in josm for trunk/src/org/openstreetmap/josm/data/projection
 Timestamp:
 20090726T22:52:23+02:00 (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/data/projection/Lambert.java
r1849 r1857 13 13 import org.openstreetmap.josm.data.coor.LatLon; 14 14 import org.openstreetmap.josm.data.Bounds; 15 import org.openstreetmap.josm.gui.OptionPaneUtil; 15 16 16 17 public class Lambert implements Projection { … … 52 53 53 54 public static final double zoneLimits[] = { Math.toRadians(53.5 * 0.9), // between Zone 1 and Zone 2 (in grad *0.9) 54 55 56 55 Math.toRadians(50.5 * 0.9), // between Zone 2 and Zone 3 56 Math.toRadians(47.51963 * 0.9), // between Zone 3 and Zone 4 57 Math.toRadians(46.17821 * 0.9) };// lowest latitude of Zone 4 57 58 58 59 public static final double cMinLonZones = Math.toRadians(4.9074074074074059 * 0.9); … … 84 85 if (lt >= zoneLimits[3] && lt <= cMaxLatZone1 && lg >= cMinLonZones && lg <= cMaxLonZones) { 85 86 // zone I 86 if (lt > zoneLimits[0]) 87 if (lt > zoneLimits[0]) { 87 88 currentZone = 0; 88 // zone II 89 else if (lt > zoneLimits[1]) 89 } else if (lt > zoneLimits[1]) { 90 90 currentZone = 1; 91 // zone III 92 else if (lt > zoneLimits[2]) 91 } else if (lt > zoneLimits[2]) { 93 92 currentZone = 2; 94 // zone III or IV 95 else if (lt > zoneLimits[3]) 93 } else if (lt > zoneLimits[3]) 96 94 // Note: zone IV is dedicated to Corsica island and extends from 47.8 to 97 95 // 45.9 degrees of latitude. There is an overlap with zone III that can be 98 96 // solved only with longitude (covers Corsica if lon > 7.2 degree) 99 if (lg < Math.toRadians(8 * 0.9)) 97 if (lg < Math.toRadians(8 * 0.9)) { 100 98 currentZone = 2; 101 else99 } else { 102 100 currentZone = 3; 101 } 103 102 } else { 104 103 outOfLambertZones = true; // possible when MAX_LAT is used … … 109 108 } else if (layoutZone != currentZone) { 110 109 if ((currentZone < layoutZone && Math.abs(zoneLimits[currentZone]  lt) > cMaxOverlappingZones) 111  (currentZone > layoutZone && Math.abs(zoneLimits[layoutZone]  lt) > cMaxOverlappingZones)) { 112 JOptionPane.showMessageDialog(Main.parent, 113 tr("IMPORTANT : data positioned far away from\n" 114 + "the current Lambert zone limits.\n" 115 + "Do not upload any data after this message.\n" 116 + "Undo your last action, save your work\n" 117 + "and start a new layer on the new zone.")); 110  (currentZone > layoutZone && Math.abs(zoneLimits[layoutZone]  lt) > cMaxOverlappingZones)) { 111 OptionPaneUtil.showMessageDialog(Main.parent, 112 tr("IMPORTANT : data positioned far away from\n" 113 + "the current Lambert zone limits.\n" 114 + "Do not upload any data after this message.\n" 115 + "Undo your last action, save your work\n" 116 + "and start a new layer on the new zone."), 117 tr("Warning"), 118 JOptionPane.WARNING_MESSAGE); 118 119 layoutZone = 1; 119 120 } else { … … 130 131 public LatLon eastNorth2latlon(EastNorth p) { 131 132 LatLon geo; 132 if (layoutZone == 1) 133 if (layoutZone == 1) { 133 134 // possible until the Lambert zone is determined by latlon2eastNorth() with a valid LatLon 134 135 geo = Geographic(p, Xs[currentZone], Ys[currentZone], c[currentZone], n[currentZone]); 135 else136 } else { 136 137 geo = Geographic(p, Xs[layoutZone], Ys[layoutZone], c[layoutZone], n[layoutZone]); 138 } 137 139 // translate ellipsoid Clark => GRS80 (WGS83) 138 140 LatLon wgs = Clark2GRS80(geo); … … 197 199 double eslt = Ellipsoid.clarke.e * Math.sin(lat); 198 200 double nlt = 2.0 * Math.atan(Math.pow((1.0 + eslt) / (1.0  eslt), Ellipsoid.clarke.e / 2.0) * l)  Math.PI 199 201 / 2.0; 200 202 delta = Math.abs(nlt  lat); 201 203 lat = nlt; … … 261 263 s2 *= s2; 262 264 double l = Math.atan((Z / norm) 263 / (1.0  (ell.a * ell.e2 * Math.cos(lt) / (norm * Math.sqrt(1.0  ell.e2 * s2)))));265 / (1.0  (ell.a * ell.e2 * Math.cos(lt) / (norm * Math.sqrt(1.0  ell.e2 * s2))))); 264 266 delta = Math.abs(l  lt); 265 267 lt = l;
Note: See TracChangeset
for help on using the changeset viewer.