source: josm/trunk/src/org/openstreetmap/josm/data/coor/CoordinateFormat.java@ 11710

Last change on this file since 11710 was 11489, checked in by Don-vip, 7 years ago

error-prone - enums should be immutable, and cannot have non-final fields

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.coor;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6/**
7 * An enumeration of coordinate formats
8 * @since 1990
9 */
10public 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 final String displayName;
33
34 CoordinateFormat(String displayName) {
35 this.displayName = displayName;
36 }
37
38 /**
39 * Replies the display name of the format
40 *
41 * @return the display name
42 */
43 public String getDisplayName() {
44 return displayName;
45 }
46
47 @Override
48 public String toString() {
49 return getDisplayName();
50 }
51
52 private static volatile CoordinateFormat defaultCoordinateFormat = DECIMAL_DEGREES;
53
54 /**
55 * Replies the default coordinate format to be use
56 *
57 * @return the default coordinate format
58 */
59 public static CoordinateFormat getDefaultFormat() {
60 return defaultCoordinateFormat;
61 }
62
63 /**
64 * Sets the default coordinate format
65 *
66 * @param format the default coordinate format
67 */
68 public static void setCoordinateFormat(CoordinateFormat format) {
69 if (format != null) {
70 defaultCoordinateFormat = format;
71 }
72 }
73}
Note: See TracBrowser for help on using the repository browser.