Changeset 3412 in josm for trunk/src/org/openstreetmap/josm/data/coor
- Timestamp:
- 2010-08-03T23:53:21+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/coor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/CoordinateFormat.java
r3083 r3412 16 16 17 17 /** 18 * the minutes/seconds format99" 99'18 * the degrees/minutes/seconds format 9° 99" 99' 19 19 */ 20 DEGREES_MINUTES_SECONDS (tr("Degrees Minutes Seconds")), 21 20 DEGREES_MINUTES_SECONDS (tr("deg\u00B0 min'' sec\"")), 21 22 /** 23 * the nautical format 24 */ 25 NAUTICAL (tr("deg\u00B0 min'' (Nautical)")), 26 22 27 /** 23 28 * coordinates East/North -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r3411 r3412 35 35 private static DecimalFormat cDmsMinuteFormatter = new DecimalFormat("00"); 36 36 private static DecimalFormat cDmsSecondFormatter = new DecimalFormat("00.0"); 37 private static DecimalFormat cDmMinuteFormatter = new DecimalFormat("00.000"); 37 38 public static DecimalFormat cDdFormatter; 38 39 static { … … 78 79 } 79 80 81 public static String dm(double pCoordinate) { 82 83 double tAbsCoord = Math.abs(pCoordinate); 84 int tDegree = (int) tAbsCoord; 85 double tMinutes = (tAbsCoord - tDegree) * 60; 86 return tDegree + "\u00B0" + cDmMinuteFormatter.format(tMinutes) + "\'"; 87 } 88 80 89 public LatLon(double lat, double lon) { 81 90 super(lon, lat); … … 90 99 } 91 100 101 private final static String SOUTH = trc("compass", "S"); 102 private final static String NORTH = trc("compass", "N"); 92 103 public String latToString(CoordinateFormat d) { 93 104 switch(d) { 94 105 case DECIMAL_DEGREES: return cDdFormatter.format(y); 95 case DEGREES_MINUTES_SECONDS: return dms(y) + ((y < 0) ? 96 /* short symbol for South */ trc("compass", "S") : 97 /* short symbol for North */ trc("compass", "N")); 106 case DEGREES_MINUTES_SECONDS: return dms(y) + ((y < 0) ? SOUTH : NORTH); 107 case NAUTICAL: return dm(y) + ((y < 0) ? SOUTH : NORTH); 98 108 case EAST_NORTH: return cDdFormatter.format(Main.proj.latlon2eastNorth(this).north()); 99 109 default: return "ERR"; … … 105 115 } 106 116 117 private final static String WEST = trc("compass", "W"); 118 private final static String EAST = trc("compass", "E"); 107 119 public String lonToString(CoordinateFormat d) { 108 120 switch(d) { 109 121 case DECIMAL_DEGREES: return cDdFormatter.format(x); 110 case DEGREES_MINUTES_SECONDS: return dms(x) + ((x < 0) ? 111 /* short symbol for West */ trc("compass", "W") : 112 /* short symbol for East */ trc("compass", "E")); 122 case DEGREES_MINUTES_SECONDS: return dms(x) + ((x < 0) ? WEST : EAST); 123 case NAUTICAL: return dm(x) + ((x < 0) ? WEST : EAST); 113 124 case EAST_NORTH: return cDdFormatter.format(Main.proj.latlon2eastNorth(this).east()); 114 125 default: return "ERR";
Note: See TracChangeset
for help on using the changeset viewer.