Changeset 5503 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2012-09-07T22:56:01+02:00 (12 years ago)
Author:
Don-vip
Message:

Validator: no warning if all nodes at the same position have a distinct elevation (this happens for example with geodesic points in France)

File:
1 edited

Legend:

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

    r5356 r5503  
    99import java.util.Collections;
    1010import java.util.HashMap;
     11import java.util.HashSet;
    1112import java.util.Iterator;
    1213import java.util.LinkedHashSet;
     
    126127        for (Object v: potentialDuplicates) {
    127128            if (v instanceof Node) {
    128                 // just one node at this position. Nothing to report as
    129                 // error
     129                // just one node at this position. Nothing to report as error
    130130                continue;
    131131            }
    132132
    133             // multiple nodes at the same position -> report errors
    134             //
     133            // multiple nodes at the same position -> check if all nodes have a distinct elevation
    135134            List<Node> nodes = (List<Node>) v;
     135            Set<String> eles = new HashSet<String>();
     136            for (Node n : nodes) {
     137                String ele = n.get("ele");
     138                if (ele != null) {
     139                    eles.add(ele);
     140                }
     141            }
     142            if (eles.size() == nodes.size()) {
     143                // All nodes at this position have a distinct elevation.
     144                // This is normal in some particular cases (for example, geodesic points in France)
     145                // Do not report this as an error
     146                continue;
     147            }
     148           
     149            // report errors
    136150            errors.addAll(buildTestErrors(this, nodes));
    137151        }
Note: See TracChangeset for help on using the changeset viewer.