1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.preferences.projection;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.util.Collection;
|
---|
7 | import java.util.Collections;
|
---|
8 |
|
---|
9 | public class PuwgProjectionChoice extends ListProjectionChoice {
|
---|
10 |
|
---|
11 | public static final String[] CODES = {
|
---|
12 | "EPSG:2180",
|
---|
13 | "EPSG:2176",
|
---|
14 | "EPSG:2177",
|
---|
15 | "EPSG:2178",
|
---|
16 | "EPSG:2179"
|
---|
17 | };
|
---|
18 | public static final String[] NAMES = {
|
---|
19 | tr("PUWG 1992 (Poland)"),
|
---|
20 | tr("PUWG 2000 Zone {0} (Poland)", 5),
|
---|
21 | tr("PUWG 2000 Zone {0} (Poland)", 6),
|
---|
22 | tr("PUWG 2000 Zone {0} (Poland)", 7),
|
---|
23 | tr("PUWG 2000 Zone {0} (Poland)", 8)
|
---|
24 | };
|
---|
25 |
|
---|
26 | public PuwgProjectionChoice() {
|
---|
27 | super(tr("PUWG (Poland)"), "core:puwg", NAMES, tr("PUWG Zone"));
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public String getCurrentCode() {
|
---|
32 | return CODES[index];
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | public String getProjectionName() {
|
---|
37 | return NAMES[index];
|
---|
38 | }
|
---|
39 |
|
---|
40 |
|
---|
41 | @Override
|
---|
42 | public String[] allCodes() {
|
---|
43 | String[] zones = new String[CODES.length];
|
---|
44 | for (int idx = 0; idx < CODES.length; idx++) {
|
---|
45 | zones[idx] = CODES[idx];
|
---|
46 | }
|
---|
47 | return zones;
|
---|
48 | }
|
---|
49 |
|
---|
50 | @Override
|
---|
51 | public Collection<String> getPreferencesFromCode(String code) {
|
---|
52 | for (String code2 : CODES) {
|
---|
53 | if (code.equals(code2))
|
---|
54 | return Collections.singleton(code2);
|
---|
55 | }
|
---|
56 | return null;
|
---|
57 | }
|
---|
58 |
|
---|
59 | @Override
|
---|
60 | protected String indexToZone(int index) {
|
---|
61 | return CODES[index];
|
---|
62 | }
|
---|
63 |
|
---|
64 | @Override
|
---|
65 | protected int zoneToIndex(String zone) {
|
---|
66 | for (int i=0; i<CODES.length; i++) {
|
---|
67 | if (zone.equals(CODES[i])) {
|
---|
68 | return i;
|
---|
69 | }
|
---|
70 | }
|
---|
71 | return defaultIndex;
|
---|
72 | }
|
---|
73 |
|
---|
74 | }
|
---|