Changeset 17665 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r17624 r17665 43 43 protected static class NodeHash implements Hash<Object, Object> { 44 44 45 /** 46 * Rounding on OSM server and via {@link LatLon#roundToOsmPrecision} sometimes differs in the last digit by 1. 47 * Thus, for the duplicate node test, we reduce the precision by one to find errors before uploading. 48 * @see LatLon#MAX_SERVER_INV_PRECISION 49 */ 50 private final double precision = 51 1 / Config.getPref().getDouble("validator.duplicatenodes.precision", LatLon.MAX_SERVER_PRECISION * 10); 45 private final double precision = Config.getPref().getDouble("validator.duplicatenodes.precision", 0.); 52 46 53 47 /** … … 55 49 * @see LatLon#roundToOsmPrecision 56 50 */ 57 pr otectedLatLon roundCoord(LatLon coor) {51 private LatLon roundCoord(LatLon coor) { 58 52 return new LatLon( 59 Math.round(coor.lat() *precision)/precision,60 Math.round(coor.lon() *precision)/precision53 Math.round(coor.lat() / precision) * precision, 54 Math.round(coor.lon() / precision) * precision 61 55 ); 62 56 } 63 57 64 58 @SuppressWarnings("unchecked") 65 pr ivateLatLon getLatLon(Object o) {59 protected LatLon getLatLon(Object o) { 66 60 if (o instanceof Node) { 67 61 LatLon coor = ((Node) o).getCoor(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java
r17612 r17665 7 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 import org.junit.jupiter.api.Disabled; 9 10 import org.junit.jupiter.api.Test; 10 11 import org.junit.jupiter.api.extension.RegisterExtension; … … 183 184 */ 184 185 @Test 186 @Disabled("fix #18074") // FIXME, see #18074 185 187 void testServerPrecision() { 186 188 DuplicateNode.NodeHash nodeHash = new DuplicateNode.NodeHash(); … … 198 200 assertEquals(new LatLon(-23.5110828, -46.4892643), a.getCoor().getRoundedToOsmPrecision()); 199 201 assertEquals(new LatLon(-23.5110829, -46.4892643), b.getCoor().getRoundedToOsmPrecision()); 200 assertEquals(new LatLon(-23.511083, -46.489264), nodeHash. roundCoord(a.getCoor()));201 assertEquals(new LatLon(-23.511083, -46.489264), nodeHash. roundCoord(b.getCoor()));202 assertEquals(new LatLon(-23.511083, -46.489264), nodeHash.getLatLon(a)); 203 assertEquals(new LatLon(-23.511083, -46.489264), nodeHash.getLatLon(b)); 202 204 performTest(DuplicateNode.DUPLICATE_NODE, ds, false); 203 205 }
Note:
See TracChangeset
for help on using the changeset viewer.