Ticket #4141: CoordinateConflictPrecision.patch
| File CoordinateConflictPrecision.patch, 3.5 KB (added by , 16 years ago) |
|---|
-
src/org/openstreetmap/josm/data/coor/LatLon.java
-
src/org/openstreetmap/josm/data/osm/Node.java
@ -99,7 +103,7 @@ * 1 / {@link org.openstreetmap.josm.data.projection.Projection#MAX_SERVER_PRECISION MAX_SERVER_PRECISION}. */ public boolean equalsEpsilon(LatLon other) { - final double p = 1/Projection.MAX_SERVER_PRECISION; + final double p = Projection.MAX_SERVER_PRECISION; return Math.abs(lat()-other.lat()) <= p && Math.abs(lon()-other.lon()) <= p; }135 135 @Override public NodeData save() { 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 } 141 143 … … 154 156 if (coor == null && n.coor == null) 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; 160 162 } -
src/org/openstreetmap/josm/data/projection/Projection.java
14 14 public interface Projection { 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 /** 21 22 * List of all available projections. -
src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java
325 325 if (myCoords == null && theirCoords != null) return true; 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 331 331 /** -
src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java
30 30 * 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); 36 36 public final static Color BGCOLOR_UNDECIDED = new Color(255,197,197);
