source: josm/trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMFranceDOMProjectionChoice.java@ 12223

Last change on this file since 12223 was 12223, checked in by Don-vip, 7 years ago

fix javadoc warnings

  • Property svn:eol-style set to native
File size: 2.8 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
9import org.openstreetmap.josm.Main;
10
11/**
12 * ProjectionChoice for various French overseas territories (EPSG:2969,2970,2972,2973,2975).
13 * <p>
14 * @see <a href="https://fr.wikipedia.org/wiki/Système_de_coordonnées_(cartographie)#Dans_les_d.C3.A9partements_d.27Outre-mer">DOM</a>
15 */
16public class UTMFranceDOMProjectionChoice extends ListProjectionChoice {
17
18 private static final String FortMarigotName = tr("Guadeloupe Fort-Marigot 1949");
19 private static final String SainteAnneName = tr("Guadeloupe Ste-Anne 1948");
20 private static final String MartiniqueName = tr("Martinique Fort Desaix 1952");
21 private static final String Reunion92Name = tr("Reunion RGR92");
22 private static final String Guyane92Name = tr("Guyane RGFG95");
23 private static final String[] utmGeodesicsNames = {FortMarigotName, SainteAnneName, MartiniqueName, Reunion92Name, Guyane92Name};
24
25 private static final Integer FortMarigotEPSG = 2969;
26 private static final Integer SainteAnneEPSG = 2970;
27 private static final Integer MartiniqueEPSG = 2973;
28 private static final Integer ReunionEPSG = 2975;
29 private static final Integer GuyaneEPSG = 2972;
30 private static final Integer[] utmEPSGs = {FortMarigotEPSG, SainteAnneEPSG, MartiniqueEPSG, ReunionEPSG, GuyaneEPSG };
31
32 /**
33 * Constructs a new {@code UTMFranceDOMProjectionChoice}.
34 */
35 public UTMFranceDOMProjectionChoice() {
36 super(tr("UTM France (DOM)"), /* NO-ICON */ "core:utmfrancedom", utmGeodesicsNames, tr("UTM Geodesic system"));
37 }
38
39 @Override
40 protected String indexToZone(int index) {
41 return Integer.toString(index + 1);
42 }
43
44 @Override
45 protected int zoneToIndex(String zone) {
46 try {
47 return Integer.parseInt(zone) - 1;
48 } catch (NumberFormatException e) {
49 Main.warn(e);
50 }
51 return defaultIndex;
52 }
53
54 @Override
55 public String getProjectionName() {
56 return utmGeodesicsNames[index];
57 }
58
59 @Override
60 public String getCurrentCode() {
61 return "EPSG:" + utmEPSGs[index];
62 }
63
64 @Override
65 public String[] allCodes() {
66 String[] res = new String[utmEPSGs.length];
67 for (int i = 0; i < utmEPSGs.length; ++i) {
68 res[i] = "EPSG:" + utmEPSGs[i];
69 }
70 return res;
71 }
72
73 @Override
74 public Collection<String> getPreferencesFromCode(String code) {
75 for (int i = 0; i < utmEPSGs.length; i++) {
76 if (("EPSG:" + utmEPSGs[i]).equals(code))
77 return Collections.singleton(Integer.toString(i+1));
78 }
79 return null;
80 }
81}
Note: See TracBrowser for help on using the repository browser.