Changeset 52 in josm for src/org/openstreetmap/josm/data
- Timestamp:
- 2006-02-14T00:52:11+01:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm/data
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/data/GeoPoint.java
r41 r52 80 80 81 81 /** 82 * @return <code>true</code>, if the other GeoPoint has almost the same lat/lon 83 * values, only differ by no more than 1/Projection.MAX_SERVER_PRECISION. 84 */ 85 public boolean equalsLatLonEpsilon(GeoPoint other) { 86 final double p = 1/Projection.MAX_SERVER_PRECISION; 87 return Math.abs(lat-other.lat) <= p && Math.abs(lon-other.lon) <= p && 88 !Double.isNaN(lat) && !Double.isNaN(lon); 89 } 90 91 /** 82 92 * @return <code>true</code>, if the coordinate is outside the world, compared 83 93 * by using lat/lon. -
src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
r50 r52 42 42 if (myNode.modified && !otherNode.modified) 43 43 return; 44 if (!myNode.coor.equalsLatLon (otherNode.coor)) {44 if (!myNode.coor.equalsLatLonEpsilon(otherNode.coor)) { 45 45 myNode.coor = otherNode.coor; 46 46 myNode.modified = otherNode.modified; … … 51 51 /** 52 52 * Merge the line segment if id matches or if both nodes are the same (and the 53 * id is zero of either segment). Nodes are equalwhen they @see match53 * id is zero of either segment). Nodes are the "same" when they @see match 54 54 */ 55 55 public void visit(LineSegment otherLs) { … … 120 120 private boolean match(Node n1, Node n2) { 121 121 if (n1.id == 0 || n2.id == 0) 122 return n1.coor.equalsLatLon (n2.coor);122 return n1.coor.equalsLatLonEpsilon(n2.coor); 123 123 return n1.id == n2.id; 124 124 } … … 153 153 */ 154 154 private void mergeCommon(OsmPrimitive myOsm, OsmPrimitive otherOsm) { 155 if (otherOsm.modified)156 myOsm.modified = true;157 155 if (otherOsm.isDeleted()) 158 156 myOsm.setDeleted(true); 159 157 if (!myOsm.modified || otherOsm.modified) { 160 if ( otherOsm.id != 0 && myOsm.id == 0)158 if (myOsm.id == 0 && otherOsm.id != 0) 161 159 myOsm.id = otherOsm.id; // means not ncessary the object is now modified 160 else if (myOsm.id != 0 && otherOsm.id != 0 && otherOsm.modified) 161 myOsm.modified = true; 162 162 } 163 163 if (myOsm.modifiedProperties && !otherOsm.modifiedProperties) 164 164 return; 165 if (myOsm.keys != null && !myOsm.keys.equals(otherOsm.keys)) { 166 if (myOsm.keys == null) 167 myOsm.keys = otherOsm.keys; 168 else if (otherOsm.keys != null) 169 myOsm.keys.putAll(otherOsm.keys); 170 myOsm.modifiedProperties = true; 171 } 165 if (otherOsm.keys == null) 166 return; 167 if (myOsm.keys != null && myOsm.keys.entrySet().containsAll(otherOsm.keys.entrySet())) 168 return; 169 if (myOsm.keys == null) 170 myOsm.keys = otherOsm.keys; 171 else 172 myOsm.keys.putAll(otherOsm.keys); 173 myOsm.modifiedProperties = true; 172 174 } 173 175 } -
src/org/openstreetmap/josm/data/projection/Epsg4263.java
r51 r52 16 16 17 17 public void xy2latlon(GeoPoint p) { 18 p.lat = Math.round(p.y*MAX_SERVER_PRECISION)/MAX_SERVER_PRECISION;19 p.lon = Math.round(p.x*MAX_SERVER_PRECISION)/MAX_SERVER_PRECISION;18 p.lat = p.y; 19 p.lon = p.x; 20 20 } 21 21 -
src/org/openstreetmap/josm/data/projection/Mercator.java
r51 r52 22 22 p.lon = p.x*180/Math.PI; 23 23 p.lat = Math.atan(Math.sinh(p.y))*180/Math.PI; 24 // round values to maximum server precision25 p.lon = Math.round(p.lon*MAX_SERVER_PRECISION)/MAX_SERVER_PRECISION;26 p.lat = Math.round(p.lat*MAX_SERVER_PRECISION)/MAX_SERVER_PRECISION;27 24 } 28 25
Note:
See TracChangeset
for help on using the changeset viewer.