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 minutes/seconds format 99" 99'
|
---|
19 | */
|
---|
20 | DEGREES_MINUTES_SECONDS (tr("Degrees Minutes Seconds"));
|
---|
21 |
|
---|
22 | private String displayName;
|
---|
23 | private CoordinateFormat(String displayName) {
|
---|
24 | this.displayName = displayName;
|
---|
25 | }
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Replies the display name of the format
|
---|
29 | *
|
---|
30 | * @return the display name
|
---|
31 | */
|
---|
32 | public String getDisplayName() {
|
---|
33 | return displayName;
|
---|
34 | }
|
---|
35 |
|
---|
36 | @Override
|
---|
37 | public String toString() {
|
---|
38 | return getDisplayName();
|
---|
39 | }
|
---|
40 |
|
---|
41 | private static CoordinateFormat defaultCoordinateFormat = DECIMAL_DEGREES;
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Replies the default coordinate format to be use
|
---|
45 | *
|
---|
46 | * @return the default coordinate format
|
---|
47 | */
|
---|
48 | static public CoordinateFormat getDefaultFormat() {
|
---|
49 | return defaultCoordinateFormat;
|
---|
50 | }
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Sets the default coordinate format
|
---|
54 | *
|
---|
55 | * @param format the default coordinate format
|
---|
56 | */
|
---|
57 | static public void setCoordinateFormat(CoordinateFormat format) {
|
---|
58 | if (format != null) {
|
---|
59 | defaultCoordinateFormat = format;
|
---|
60 | }
|
---|
61 | }
|
---|
62 | }
|
---|