[2512] | 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 | /**
|
---|
[3438] | 18 | * the degrees/minutes/seconds format 9 deg 99 min 99 sec
|
---|
[2512] | 19 | */
|
---|
[3412] | 20 | DEGREES_MINUTES_SECONDS (tr("deg\u00B0 min'' sec\"")),
|
---|
[3530] | 21 |
|
---|
[3067] | 22 | /**
|
---|
[3530] | 23 | * the nautical format
|
---|
[3412] | 24 | */
|
---|
| 25 | NAUTICAL (tr("deg\u00B0 min'' (Nautical)")),
|
---|
[3530] | 26 |
|
---|
[3412] | 27 | /**
|
---|
[3067] | 28 | * coordinates East/North
|
---|
| 29 | */
|
---|
| 30 | EAST_NORTH (tr("Projected Coordinates"));
|
---|
| 31 |
|
---|
[2512] | 32 | private String displayName;
|
---|
[8674] | 33 | CoordinateFormat(String displayName) {
|
---|
[2512] | 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 |
|
---|
[8126] | 51 | private static volatile CoordinateFormat defaultCoordinateFormat = DECIMAL_DEGREES;
|
---|
[2512] | 52 |
|
---|
| 53 | /**
|
---|
| 54 | * Replies the default coordinate format to be use
|
---|
| 55 | *
|
---|
| 56 | * @return the default coordinate format
|
---|
| 57 | */
|
---|
[6883] | 58 | public static CoordinateFormat getDefaultFormat() {
|
---|
[2512] | 59 | return defaultCoordinateFormat;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | /**
|
---|
| 63 | * Sets the default coordinate format
|
---|
| 64 | *
|
---|
| 65 | * @param format the default coordinate format
|
---|
| 66 | */
|
---|
[6883] | 67 | public static void setCoordinateFormat(CoordinateFormat format) {
|
---|
[2512] | 68 | if (format != null) {
|
---|
| 69 | defaultCoordinateFormat = format;
|
---|
| 70 | }
|
---|
| 71 | }
|
---|
| 72 | }
|
---|