1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.coor;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * An enumeration of coordinate formats
|
---|
8 | *
|
---|
9 | */
|
---|
10 | public enum CoordinateFormat {
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * the decimal format 999.999
|
---|
14 | */
|
---|
15 | DECIMAL_DEGREES(tr("Decimal Degrees")),
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * the degrees/minutes/seconds format 9 deg 99 min 99 sec
|
---|
19 | */
|
---|
20 | DEGREES_MINUTES_SECONDS(tr("deg\u00B0 min'' sec\"")),
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * the nautical format
|
---|
24 | */
|
---|
25 | NAUTICAL(tr("deg\u00B0 min'' (Nautical)")),
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * coordinates East/North
|
---|
29 | */
|
---|
30 | EAST_NORTH(tr("Projected Coordinates"));
|
---|
31 |
|
---|
32 | private String displayName;
|
---|
33 | CoordinateFormat(String displayName) {
|
---|
34 | this.displayName = displayName;
|
---|
35 | }
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Replies the display name of the format
|
---|
39 | *
|
---|
40 | * @return the display name
|
---|
41 | */
|
---|
42 | public String getDisplayName() {
|
---|
43 | return displayName;
|
---|
44 | }
|
---|
45 |
|
---|
46 | @Override
|
---|
47 | public String toString() {
|
---|
48 | return getDisplayName();
|
---|
49 | }
|
---|
50 |
|
---|
51 | private static volatile CoordinateFormat defaultCoordinateFormat = DECIMAL_DEGREES;
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Replies the default coordinate format to be use
|
---|
55 | *
|
---|
56 | * @return the default coordinate format
|
---|
57 | */
|
---|
58 | public static CoordinateFormat getDefaultFormat() {
|
---|
59 | return defaultCoordinateFormat;
|
---|
60 | }
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Sets the default coordinate format
|
---|
64 | *
|
---|
65 | * @param format the default coordinate format
|
---|
66 | */
|
---|
67 | public static void setCoordinateFormat(CoordinateFormat format) {
|
---|
68 | if (format != null) {
|
---|
69 | defaultCoordinateFormat = format;
|
---|
70 | }
|
---|
71 | }
|
---|
72 | }
|
---|