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

Last change on this file since 12148 was 12148, checked in by bastiK, 7 years ago

see #14794 - javadoc

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