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

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

checkstyle: enable relevant whitespace checks and fix them

  • Property svn:eol-style set to native
File size: 1.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.tools.Utils;
10
11public class PuwgProjectionChoice extends ListProjectionChoice {
12
13 private static final String[] CODES = {
14 "EPSG:2180",
15 "EPSG:2176",
16 "EPSG:2177",
17 "EPSG:2178",
18 "EPSG:2179"
19 };
20
21 private static final String[] NAMES = {
22 tr("PUWG 1992 (Poland)"),
23 tr("PUWG 2000 Zone {0} (Poland)", 5),
24 tr("PUWG 2000 Zone {0} (Poland)", 6),
25 tr("PUWG 2000 Zone {0} (Poland)", 7),
26 tr("PUWG 2000 Zone {0} (Poland)", 8)
27 };
28
29 /**
30 * Constructs a new {@code PuwgProjectionChoice}.
31 */
32 public PuwgProjectionChoice() {
33 super(tr("PUWG (Poland)"), /* NO-ICON */ "core:puwg", NAMES, tr("PUWG Zone"));
34 }
35
36 @Override
37 public String getCurrentCode() {
38 return CODES[index];
39 }
40
41 @Override
42 public String getProjectionName() {
43 return NAMES[index];
44 }
45
46 @Override
47 public String[] allCodes() {
48 return Utils.copyArray(CODES);
49 }
50
51 @Override
52 public Collection<String> getPreferencesFromCode(String code) {
53 for (String code2 : CODES) {
54 if (code.equals(code2))
55 return Collections.singleton(code2);
56 }
57 return null;
58 }
59
60 @Override
61 protected String indexToZone(int index) {
62 return CODES[index];
63 }
64
65 @Override
66 protected int zoneToIndex(String zone) {
67 for (int i = 0; i < CODES.length; i++) {
68 if (zone.equals(CODES[i])) {
69 return i;
70 }
71 }
72 return defaultIndex;
73 }
74}
Note: See TracBrowser for help on using the repository browser.