source: josm/trunk/src/org/openstreetmap/josm/gui/preferences/projection/PuwgProjectionChoice.java@ 6717

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

where applicable, replace System.arraycopy by Arrays.copyOf

File size: 1.7 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.Arrays;
7import java.util.Collection;
8import java.util.Collections;
9
10public class PuwgProjectionChoice extends ListProjectionChoice {
11
12 public static final String[] CODES = {
13 "EPSG:2180",
14 "EPSG:2176",
15 "EPSG:2177",
16 "EPSG:2178",
17 "EPSG:2179"
18 };
19 public static final String[] NAMES = {
20 tr("PUWG 1992 (Poland)"),
21 tr("PUWG 2000 Zone {0} (Poland)", 5),
22 tr("PUWG 2000 Zone {0} (Poland)", 6),
23 tr("PUWG 2000 Zone {0} (Poland)", 7),
24 tr("PUWG 2000 Zone {0} (Poland)", 8)
25 };
26
27 /**
28 * Constructs a new {@code PuwgProjectionChoice}.
29 */
30 public PuwgProjectionChoice() {
31 super(tr("PUWG (Poland)"), "core:puwg", NAMES, tr("PUWG Zone"));
32 }
33
34 @Override
35 public String getCurrentCode() {
36 return CODES[index];
37 }
38
39 @Override
40 public String getProjectionName() {
41 return NAMES[index];
42 }
43
44
45 @Override
46 public String[] allCodes() {
47 return Arrays.copyOf(CODES, CODES.length);
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}
Note: See TracBrowser for help on using the repository browser.