Ticket #5181: Projection.patch
File Projection.patch, 6.2 KB (added by , 15 years ago) |
---|
-
org/openstreetmap/josm/data/projection/Lambert.java
18 18 import org.openstreetmap.josm.data.coor.EastNorth; 19 19 import org.openstreetmap.josm.data.coor.LatLon; 20 20 import org.openstreetmap.josm.tools.GBC; 21 import org.openstreetmap.josm.tools.ImageProvider; 21 22 22 23 /** 23 24 * This class provides the two methods <code>latlon2eastNorth</code> and <code>eastNorth2latlon</code> … … 261 262 p.add(GBC.glue(1, 0), GBC.std().fill(GBC.HORIZONTAL)); 262 263 /* Note: we use component position 2 below to find this again */ 263 264 p.add(prefcb, GBC.eop().fill(GBC.HORIZONTAL)); 265 p.add(new JLabel(ImageProvider.get("data/projection", "Departements_Lambert4Zones.png")), GBC.eol().fill(GBC.HORIZONTAL)); 264 266 p.add(GBC.glue(1, 1), GBC.eol().fill(GBC.BOTH)); 265 267 } 266 268 -
org/openstreetmap/josm/data/projection/UTM_France_DOM.java
26 26 private static String SainteAnneName = tr("Guadeloupe Ste-Anne 1948"); 27 27 private static String MartiniqueName = tr("Martinique Fort Desaix 1952"); 28 28 private static String Reunion92Name = tr("Reunion RGR92"); 29 public static String[] utmGeodesicsNames = { FortMarigotName, SainteAnneName, MartiniqueName, Reunion92Name}; 29 private static String Guyane92Name = tr("Guyane RGFG95"); 30 public static String[] utmGeodesicsNames = { FortMarigotName, SainteAnneName, MartiniqueName, Reunion92Name, Guyane92Name}; 30 31 31 32 private Bounds FortMarigotBounds = new Bounds( new LatLon(17.6,-63.25), new LatLon(18.5,-62.5)); 32 33 private Bounds SainteAnneBounds = new Bounds( new LatLon(15.8,-61.9), new LatLon(16.6,-60.9)); 33 34 private Bounds MartiniqueBounds = new Bounds( new LatLon(14.25,-61.25), new LatLon(15.025,-60.725)); 34 35 private Bounds ReunionBounds = new Bounds( new LatLon(-25.92,37.58), new LatLon(-10.6, 58.27)); 35 private Bounds[] utmBounds = { FortMarigotBounds, SainteAnneBounds, MartiniqueBounds, ReunionBounds}; 36 private Bounds GuyaneBounds = new Bounds( new LatLon(2.16 , -54.0), new LatLon(9.06 , -49.62)); 37 private Bounds[] utmBounds = { FortMarigotBounds, SainteAnneBounds, MartiniqueBounds, ReunionBounds, GuyaneBounds}; 36 38 37 39 private String FortMarigotEPSG = "EPSG::2969"; 38 40 private String SainteAnneEPSG = "EPSG::2970"; 39 41 private String MartiniqueEPSG = "EPSG::2973"; 40 42 private String ReunionEPSG = "EPSG::2975"; 41 private String[] utmEPSGs = { FortMarigotEPSG, SainteAnneEPSG, MartiniqueEPSG, ReunionEPSG}; 43 private String GuyaneEPSG = "EPSG::2972"; 44 private String[] utmEPSGs = { FortMarigotEPSG, SainteAnneEPSG, MartiniqueEPSG, ReunionEPSG, GuyaneEPSG}; 42 45 43 46 /** 44 47 * false east in meters (constant) … … 102 105 new double[]{0.6006, 76.7946, -10.5788}, 103 106 -32.3241E-6 104 107 , false, 40); 108 } else if (currentGeodesic == 4) { // UTM_22N_Guyane_RGFG95 (translation only required for re-projections from CSG67) 109 set7ParametersTranslation(new double[]{-193.066 , 236.993, 105.447}, 110 new double[]{0.4814, -0.8074, 0.1276}, 111 1.5649E-6 112 , true, 22); 105 113 } 106 114 } 107 115 … … 119 127 } 120 128 121 129 public EastNorth latlon2eastNorth(LatLon p) { 122 if (currentGeodesic != 3) {130 if (currentGeodesic < 3 ) { 123 131 // translate ellipsoid GRS80 (WGS83) => reference ellipsoid geographic 124 132 LatLon geo = GRS802Hayford(p); 125 133 // reference ellipsoid geographic => UTM projection 126 134 return MTProjection(geo, Ellipsoid.hayford.a, Ellipsoid.hayford.e); 127 } else { // UTM_40S_Reunion_RGR92 135 } else { // UTM_40S_Reunion_RGR92 or UTM_22N_Guyane_RGFG95 128 136 LatLon geo = new LatLon(Math.toRadians(p.lat()), Math.toRadians(p.lon())); 129 137 return MTProjection(geo, Ellipsoid.GRS80.a, Ellipsoid.GRS80.e); 130 138 } … … 232 240 } 233 241 234 242 public LatLon eastNorth2latlon(EastNorth p) { 235 if (currentGeodesic !=3) {243 if (currentGeodesic < 3) { 236 244 MTProjection(p.east(), p.north(), zone, isNorth); 237 245 LatLon geo = Geographic(p, Ellipsoid.hayford.a, Ellipsoid.hayford.e, 0.0 /* z */); 238 246 … … 247 255 LatLon wgs = cart2LatLon(coord[0], coord[1], coord[2], Ellipsoid.GRS80); 248 256 return new LatLon(Math.toDegrees(wgs.lat()), Math.toDegrees(wgs.lon())); 249 257 } else { 250 // UTM_40S_Reunion_RGR92 258 // UTM_40S_Reunion_RGR92 or UTM_22N_Guyane_RGFG95 251 259 LatLon geo = Geographic(p, Ellipsoid.GRS80.a, Ellipsoid.GRS80.e, 0.0 /* z */); 252 260 double N = Ellipsoid.GRS80.a / (Math.sqrt(1.0 - Ellipsoid.GRS80.e2 * Math.sin(geo.lat()) * Math.sin(geo.lat()))); 253 261 double X = (N /*+ h*/) * Math.cos(geo.lat()) * Math.cos(geo.lon()); … … 407 415 } 408 416 409 417 @Override public String toString() { 410 return (tr("UTM 20N (France)"));418 return (tr("UTM France (DOM)")); 411 419 } 412 420 413 421 public int getCurrentGeodesic() { … … 419 427 420 428 prefcb.setSelectedIndex(currentGeodesic); 421 429 p.setLayout(new GridBagLayout()); 422 p.add(new JLabel(tr("UTM 20 NorthGeodesic system")), GBC.std().insets(5,5,0,5));430 p.add(new JLabel(tr("UTM Geodesic system")), GBC.std().insets(5,5,0,5)); 423 431 p.add(GBC.glue(1, 0), GBC.std().fill(GBC.HORIZONTAL)); 424 432 p.add(prefcb, GBC.eop().fill(GBC.HORIZONTAL)); 425 433 p.add(GBC.glue(1, 1), GBC.eol().fill(GBC.BOTH)); … … 448 456 for(String s : args) 449 457 { 450 458 currentGeodesic = Integer.parseInt(s)-1; 451 if(currentGeodesic < 0 || currentGeodesic > 3) {459 if(currentGeodesic < 0 || currentGeodesic > 4) { 452 460 currentGeodesic = DEFAULT_GEODESIC; 453 461 } 454 462 break;