Changeset 2699 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-12-29T06:25:40+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r2694 r2699 15 15 import org.openstreetmap.josm.Main; 16 16 import org.openstreetmap.josm.data.Bounds; 17 import org.openstreetmap.josm.data.projection.Projection;18 17 19 18 /** … … 26 25 public class LatLon extends Coordinate { 27 26 27 /** 28 * Minimum difference in location to not be represented as the same position. 29 * The API returns 7 decimals. 30 */ 31 public static final double MAX_SERVER_PRECISION = 1e-7; 32 28 33 private static DecimalFormat cDmsMinuteFormatter = new DecimalFormat("00"); 29 34 private static DecimalFormat cDmsSecondFormatter = new DecimalFormat("00.0"); … … 101 106 * @return <code>true</code> if the other point has almost the same lat/lon 102 107 * values, only differing by no more than 103 * 1 / {@link org.openstreetmap.josm.data.projection.Projection#MAX_SERVER_PRECISION MAX_SERVER_PRECISION}.108 * 1 / {@link #MAX_SERVER_PRECISION MAX_SERVER_PRECISION}. 104 109 */ 105 110 public boolean equalsEpsilon(LatLon other) { 106 final double p = Projection.MAX_SERVER_PRECISION;111 double p = MAX_SERVER_PRECISION / 2; 107 112 return Math.abs(lat()-other.lat()) <= p && Math.abs(lon()-other.lon()) <= p; 108 113 } … … 197 202 /** 198 203 * Replies a clone of this lat LatLon, rounded to OSM precisions, i.e. to 199 * 10^-7204 * MAX_SERVER_PRECISION 200 205 * 201 206 * @return a clone of this lat LatLon … … 203 208 public LatLon getRoundedToOsmPrecision() { 204 209 return new LatLon( 205 Math.round(lat() * 10e6) / 10e6d,206 Math.round(lon() * 10e6) / 10e6d210 Math.round(lat() / MAX_SERVER_PRECISION) * MAX_SERVER_PRECISION, 211 Math.round(lon() / MAX_SERVER_PRECISION) * MAX_SERVER_PRECISION 207 212 ); 208 213 } -
trunk/src/org/openstreetmap/josm/data/projection/Projection.java
r2612 r2699 13 13 */ 14 14 public interface Projection { 15 /**16 * Minimum difference in location to not be represented as the same position.17 * The API returns 7 decimals.18 */19 public static final double MAX_SERVER_PRECISION = 5e-8;20 21 15 /** 22 16 * List of all available projections.
Note:
See TracChangeset
for help on using the changeset viewer.