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 | import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager;
|
---|
7 | import org.openstreetmap.josm.data.coor.conversion.DMSCoordinateFormat;
|
---|
8 | import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat;
|
---|
9 | import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat;
|
---|
10 | import org.openstreetmap.josm.data.coor.conversion.NauticalCoordinateFormat;
|
---|
11 | import org.openstreetmap.josm.data.coor.conversion.ProjectedCoordinateFormat;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * An enumeration of coordinate formats
|
---|
15 | * @since 1990
|
---|
16 | * @deprecated use {@link CoordinateFormatManager}
|
---|
17 | */
|
---|
18 | @Deprecated
|
---|
19 | public enum CoordinateFormat {
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * the decimal format 999.999
|
---|
23 | */
|
---|
24 | DECIMAL_DEGREES(tr("Decimal Degrees"), DecimalDegreesCoordinateFormat.INSTANCE),
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * the degrees/minutes/seconds format 9 deg 99 min 99 sec
|
---|
28 | */
|
---|
29 | DEGREES_MINUTES_SECONDS(tr("deg\u00B0 min'' sec\""), DMSCoordinateFormat.INSTANCE),
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * the nautical format
|
---|
33 | */
|
---|
34 | NAUTICAL(tr("deg\u00B0 min'' (Nautical)"), NauticalCoordinateFormat.INSTANCE),
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * coordinates East/North
|
---|
38 | */
|
---|
39 | EAST_NORTH(tr("Projected Coordinates"), ProjectedCoordinateFormat.INSTANCE);
|
---|
40 |
|
---|
41 | private final String displayName;
|
---|
42 | private final ICoordinateFormat migration;
|
---|
43 |
|
---|
44 | CoordinateFormat(String displayName, ICoordinateFormat migration) {
|
---|
45 | this.displayName = displayName;
|
---|
46 | this.migration = migration;
|
---|
47 | }
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Replies the display name of the format
|
---|
51 | *
|
---|
52 | * @return the display name
|
---|
53 | */
|
---|
54 | public String getDisplayName() {
|
---|
55 | return displayName;
|
---|
56 | }
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Returns the corresponding {@link ICoordinateFormat} instance for
|
---|
60 | * migration.
|
---|
61 | * @return the corresponding {@link ICoordinateFormat} instance for
|
---|
62 | * migration
|
---|
63 | */
|
---|
64 | public ICoordinateFormat getICoordinateFormat() {
|
---|
65 | return migration;
|
---|
66 | }
|
---|
67 |
|
---|
68 | @Override
|
---|
69 | public String toString() {
|
---|
70 | return getDisplayName();
|
---|
71 | }
|
---|
72 |
|
---|
73 | private static volatile CoordinateFormat defaultCoordinateFormat = DECIMAL_DEGREES;
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Replies the default coordinate format to be use
|
---|
77 | *
|
---|
78 | * @return the default coordinate format
|
---|
79 | */
|
---|
80 | public static CoordinateFormat getDefaultFormat() {
|
---|
81 | return defaultCoordinateFormat;
|
---|
82 | }
|
---|
83 |
|
---|
84 | /**
|
---|
85 | * Sets the default coordinate format
|
---|
86 | *
|
---|
87 | * @param format the default coordinate format
|
---|
88 | */
|
---|
89 | public static void setCoordinateFormat(CoordinateFormat format) {
|
---|
90 | if (format != null) {
|
---|
91 | defaultCoordinateFormat = format;
|
---|
92 | }
|
---|
93 | }
|
---|
94 | }
|
---|