Changeset 2612 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-12-11T22:52:54+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r2570 r2612 2 2 package org.openstreetmap.josm.data.coor; 3 3 4 import static java.lang.Math.PI; 5 import static java.lang.Math.asin; 6 import static java.lang.Math.cos; 7 import static java.lang.Math.sin; 8 import static java.lang.Math.sqrt; 9 import static java.lang.Math.toRadians; 4 10 import static org.openstreetmap.josm.tools.I18n.tr; 5 11 6 12 import java.text.DecimalFormat; 7 13 import java.text.NumberFormat; 8 9 import static java.lang.Math.*;10 14 11 15 import org.openstreetmap.josm.Main; … … 100 104 */ 101 105 public boolean equalsEpsilon(LatLon other) { 102 final double p = 1/Projection.MAX_SERVER_PRECISION;106 final double p = Projection.MAX_SERVER_PRECISION; 103 107 return Math.abs(lat()-other.lat()) <= p && Math.abs(lon()-other.lon()) <= p; 104 108 } … … 132 136 double sinHalfLon = sin(toRadians(other.lon() - this.lon()) / 2); 133 137 double d = 2 * R * asin( 134 sqrt(sinHalfLat*sinHalfLat +135 136 // For points opposite to each other on the sphere, 138 sqrt(sinHalfLat*sinHalfLat + 139 cos(toRadians(this.lat()))*cos(toRadians(other.lat()))*sinHalfLon*sinHalfLon)); 140 // For points opposite to each other on the sphere, 137 141 // rounding errors could make the argument of asin greater than 1 138 142 // (This should almost never happen.) -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r2578 r2612 136 136 NodeData data = new NodeData(); 137 137 saveCommonAttributes(data); 138 data.setCoor(getCoor()); 138 if (!isIncomplete()) { 139 data.setCoor(getCoor()); 140 } 139 141 return data; 140 142 } … … 155 157 return true; 156 158 else if (coor != null && n.coor != null) 157 return coor.equals (n.coor);159 return coor.equalsEpsilon(n.coor); 158 160 else 159 161 return false; -
trunk/src/org/openstreetmap/josm/data/projection/Projection.java
r2511 r2612 15 15 /** 16 16 * Minimum difference in location to not be represented as the same position. 17 * The API returns 7 decimals. 17 18 */ 18 public static final double MAX_SERVER_PRECISION = 1e12;19 public static final double MAX_SERVER_PRECISION = 5e-8; 19 20 20 21 /** -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java
r2512 r2612 326 326 if (myCoords != null && theirCoords == null) return true; 327 327 if (myCoords == null && theirCoords == null) return false; 328 return !myCoords.equals (theirCoords);328 return !myCoords.equalsEpsilon(theirCoords); 329 329 } 330 330 -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java
r2512 r2612 31 31 */ 32 32 public class PropertiesMerger extends JPanel implements Observer { 33 private static DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000 ");33 private static DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000000"); 34 34 35 35 public final static Color BGCOLOR_NO_CONFLICT = new Color(234,234,234);
Note:
See TracChangeset
for help on using the changeset viewer.