Changeset 17665 in josm for trunk


Ignore:
Timestamp:
2021-03-25T21:32:02+01:00 (4 years ago)
Author:
simon04
Message:

see #18074 - Revert "Duplicate Node: detect errors caused by different rounding in JOSM and on OSM server"

This reverts commit r17624.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java

    r17624 r17665  
    4343    protected static class NodeHash implements Hash<Object, Object> {
    4444
    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.);
    5246
    5347        /**
     
    5549         * @see LatLon#roundToOsmPrecision
    5650         */
    57         protected LatLon roundCoord(LatLon coor) {
     51        private LatLon roundCoord(LatLon coor) {
    5852            return new LatLon(
    59                     Math.round(coor.lat() * precision) / precision,
    60                     Math.round(coor.lon() * precision) / precision
     53                    Math.round(coor.lat() / precision) * precision,
     54                    Math.round(coor.lon() / precision) * precision
    6155                    );
    6256        }
    6357
    6458        @SuppressWarnings("unchecked")
    65         private LatLon getLatLon(Object o) {
     59        protected LatLon getLatLon(Object o) {
    6660            if (o instanceof Node) {
    6761                LatLon coor = ((Node) o).getCoor();
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java

    r17612 r17665  
    77import static org.junit.jupiter.api.Assertions.assertTrue;
    88
     9import org.junit.jupiter.api.Disabled;
    910import org.junit.jupiter.api.Test;
    1011import org.junit.jupiter.api.extension.RegisterExtension;
     
    183184     */
    184185    @Test
     186    @Disabled("fix #18074") // FIXME, see #18074
    185187    void testServerPrecision() {
    186188        DuplicateNode.NodeHash nodeHash = new DuplicateNode.NodeHash();
     
    198200        assertEquals(new LatLon(-23.5110828, -46.4892643), a.getCoor().getRoundedToOsmPrecision());
    199201        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));
    202204        performTest(DuplicateNode.DUPLICATE_NODE, ds, false);
    203205    }
Note: See TracChangeset for help on using the changeset viewer.