source: josm/trunk/src/org/openstreetmap/josm/data/projection/UTM_France_DOM.java@ 5235

Last change on this file since 5235 was 5235, checked in by bastiK, 12 years ago

no rounding for projection bounds, to avoid 42 being dispayed as 41.99999999999

  • Property svn:eol-style set to native
File size: 4.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import org.openstreetmap.josm.data.Bounds;
7import org.openstreetmap.josm.data.coor.LatLon;
8import org.openstreetmap.josm.data.projection.datum.Datum;
9import org.openstreetmap.josm.data.projection.datum.GRS80Datum;
10import org.openstreetmap.josm.data.projection.datum.SevenParameterDatum;
11import org.openstreetmap.josm.data.projection.datum.ThreeParameterDatum;
12import org.openstreetmap.josm.data.projection.proj.ProjParameters;
13
14/**
15 * This class implements all projections for French departements in the Caribbean Sea and
16 * Indian Ocean using the UTM transvers Mercator projection and specific geodesic settings.
17 *
18 */
19public class UTM_France_DOM extends AbstractProjection {
20
21 private final static Bounds FortMarigotBounds = new Bounds( new LatLon(17.6,-63.25), new LatLon(18.5,-62.5), false);
22 private final static Bounds SainteAnneBounds = new Bounds( new LatLon(15.8,-61.9), new LatLon(16.6,-60.9), false);
23 private final static Bounds MartiniqueBounds = new Bounds( new LatLon(14.25,-61.25), new LatLon(15.025,-60.725), false);
24 private final static Bounds ReunionBounds = new Bounds( new LatLon(-25.92,37.58), new LatLon(-10.6, 58.27), false);
25 private final static Bounds GuyaneBounds = new Bounds( new LatLon(2.16 , -54.0), new LatLon(9.06 , -49.62), false);
26 private final static Bounds[] utmBounds = { FortMarigotBounds, SainteAnneBounds, MartiniqueBounds, ReunionBounds, GuyaneBounds };
27
28 private final static Integer FortMarigotEPSG = 2969;
29 private final static Integer SainteAnneEPSG = 2970;
30 private final static Integer MartiniqueEPSG = 2973;
31 private final static Integer ReunionEPSG = 2975;
32 private final static Integer GuyaneEPSG = 2972;
33 public final static Integer[] utmEPSGs = { FortMarigotEPSG, SainteAnneEPSG, MartiniqueEPSG, ReunionEPSG, GuyaneEPSG };
34
35 private final static Datum FortMarigotDatum = new ThreeParameterDatum("FortMarigot Datum", null, Ellipsoid.hayford, 136.596, 248.148, -429.789);
36 private final static Datum SainteAnneDatum = new SevenParameterDatum("SainteAnne Datum", null, Ellipsoid.hayford, -472.29, -5.63, -304.12, 0.4362, -0.8374, 0.2563, 1.8984);
37 private final static Datum MartiniqueDatum = new SevenParameterDatum("Martinique Datum", null, Ellipsoid.hayford, 126.926, 547.939, 130.409, -2.78670, 5.16124, -0.85844, 13.82265);
38 private final static Datum ReunionDatum = GRS80Datum.INSTANCE;
39 private final static Datum GuyaneDatum = GRS80Datum.INSTANCE;
40 private final static Datum[] utmDatums = { FortMarigotDatum, SainteAnneDatum, MartiniqueDatum, ReunionDatum, GuyaneDatum };
41
42 private final static int[] utmZones = { 20, 20, 20, 40, 22 };
43
44 /**
45 * UTM zone (from 1 to 60)
46 */
47 private static int zone;
48 /**
49 * whether north or south hemisphere
50 */
51 private boolean isNorth;
52
53 public static final int DEFAULT_GEODESIC = 0;
54
55 public int currentGeodesic;
56
57
58 public UTM_France_DOM() {
59 this(DEFAULT_GEODESIC);
60 }
61
62 public UTM_France_DOM(int currentGeodesic) {
63 this.currentGeodesic = currentGeodesic;
64 datum = utmDatums[currentGeodesic];
65 ellps = datum.getEllipsoid();
66 proj = new org.openstreetmap.josm.data.projection.proj.TransverseMercator();
67 try {
68 proj.initialize(new ProjParameters() {{ ellps = UTM_France_DOM.this.ellps; }});
69 } catch (ProjectionConfigurationException e) {
70 throw new RuntimeException(e);
71 }
72 isNorth = currentGeodesic != 3;
73 zone = utmZones[currentGeodesic];
74 x_0 = 500000;
75 y_0 = isNorth ? 0.0 : 10000000.0;
76 lon_0 = 6 * zone - 183;
77 k_0 = 0.9996;
78 }
79
80 public int getCurrentGeodesic() {
81 return currentGeodesic;
82 }
83
84 @Override
85 public String toString() {
86 return tr("UTM France (DOM)");
87 }
88
89 @Override
90 public String getCacheDirectoryName() {
91 return this.toString();
92 }
93
94 @Override
95 public Bounds getWorldBoundsLatLon() {
96 return utmBounds[currentGeodesic];
97 }
98
99 @Override
100 public Integer getEpsgCode() {
101 return utmEPSGs[currentGeodesic];
102 }
103
104 @Override
105 public int hashCode() {
106 return getClass().getName().hashCode()+currentGeodesic; // our only real variable
107 }
108
109}
Note: See TracBrowser for help on using the repository browser.