001 // License: GPL. For details, see LICENSE file. 002 package org.openstreetmap.josm.data.coor; 003 004 import static org.openstreetmap.josm.tools.I18n.tr; 005 006 /** 007 * An enumeration of coordinate formats 008 * 009 */ 010 public enum CoordinateFormat { 011 012 /** 013 * the decimal format 999.999 014 */ 015 DECIMAL_DEGREES (tr("Decimal Degrees")), 016 017 /** 018 * the degrees/minutes/seconds format 9 deg 99 min 99 sec 019 */ 020 DEGREES_MINUTES_SECONDS (tr("deg\u00B0 min'' sec\"")), 021 022 /** 023 * the nautical format 024 */ 025 NAUTICAL (tr("deg\u00B0 min'' (Nautical)")), 026 027 /** 028 * coordinates East/North 029 */ 030 EAST_NORTH (tr("Projected Coordinates")); 031 032 private String displayName; 033 private CoordinateFormat(String displayName) { 034 this.displayName = displayName; 035 } 036 037 /** 038 * Replies the display name of the format 039 * 040 * @return the display name 041 */ 042 public String getDisplayName() { 043 return displayName; 044 } 045 046 @Override 047 public String toString() { 048 return getDisplayName(); 049 } 050 051 private static CoordinateFormat defaultCoordinateFormat = DECIMAL_DEGREES; 052 053 /** 054 * Replies the default coordinate format to be use 055 * 056 * @return the default coordinate format 057 */ 058 static public CoordinateFormat getDefaultFormat() { 059 return defaultCoordinateFormat; 060 } 061 062 /** 063 * Sets the default coordinate format 064 * 065 * @param format the default coordinate format 066 */ 067 static public void setCoordinateFormat(CoordinateFormat format) { 068 if (format != null) { 069 defaultCoordinateFormat = format; 070 } 071 } 072 }