source: josm/trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTM_France_DOM_ProjectionChoice.java@ 5548

Last change on this file since 5548 was 5548, checked in by bastiK, 11 years ago

remove Projection classes (replaced by data/epsg file)

concludes the projection rework from ealier this year

File size: 2.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.preferences.projection;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.util.Collection;
7import java.util.Collections;
8
9public class UTM_France_DOM_ProjectionChoice extends ListProjectionChoice {
10
11 private final static String FortMarigotName = tr("Guadeloupe Fort-Marigot 1949");
12 private final static String SainteAnneName = tr("Guadeloupe Ste-Anne 1948");
13 private final static String MartiniqueName = tr("Martinique Fort Desaix 1952");
14 private final static String Reunion92Name = tr("Reunion RGR92");
15 private final static String Guyane92Name = tr("Guyane RGFG95");
16 private final static String[] utmGeodesicsNames = { FortMarigotName, SainteAnneName, MartiniqueName, Reunion92Name, Guyane92Name};
17
18 private final static Integer FortMarigotEPSG = 2969;
19 private final static Integer SainteAnneEPSG = 2970;
20 private final static Integer MartiniqueEPSG = 2973;
21 private final static Integer ReunionEPSG = 2975;
22 private final static Integer GuyaneEPSG = 2972;
23 private final static Integer[] utmEPSGs = { FortMarigotEPSG, SainteAnneEPSG, MartiniqueEPSG, ReunionEPSG, GuyaneEPSG };
24
25 public UTM_France_DOM_ProjectionChoice() {
26 super(tr("UTM France (DOM)"), "core:utmfrancedom", utmGeodesicsNames, tr("UTM Geodesic system"));
27 }
28
29 @Override
30 protected String indexToZone(int index) {
31 return Integer.toString(index + 1);
32 }
33
34 @Override
35 protected int zoneToIndex(String zone) {
36 try {
37 return Integer.parseInt(zone) - 1;
38 } catch(NumberFormatException e) {}
39 return defaultIndex;
40 }
41
42 @Override
43 public String getProjectionName() {
44 return utmGeodesicsNames[index];
45 }
46
47 @Override
48 public String getCurrentCode() {
49 return "EPSG:" + utmEPSGs[index];
50 }
51
52 @Override
53 public String[] allCodes() {
54 String[] res = new String[utmEPSGs.length];
55 for (int i=0; i<utmEPSGs.length; ++i) {
56 res[i] = "EPSG:" + utmEPSGs[i];
57 }
58 return res;
59 }
60
61 @Override
62 public Collection<String> getPreferencesFromCode(String code) {
63 for (int i=0; i < utmEPSGs.length; i++ )
64 if (("EPSG:" + utmEPSGs[i]).equals(code))
65 return Collections.singleton(Integer.toString(i+1));
66 return null;
67 }
68
69}
Note: See TracBrowser for help on using the repository browser.