Changeset 8510 in josm for trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
- Timestamp:
- 2015-06-20T23:42:21+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r8393 r8510 121 121 } 122 122 123 124 123 @SuppressWarnings("unchecked") 125 124 @Override … … 163 162 List<TestError> errors = new ArrayList<>(); 164 163 165 MultiMap<Map<String, String>, OsmPrimitive> mm = new MultiMap<>();164 MultiMap<Map<String, String>, OsmPrimitive> mm = new MultiMap<>(); 166 165 for (Node n: nodes) { 167 166 mm.put(n.getKeys(), n); 168 167 } 169 168 170 Map<String, Boolean> typeMap=new HashMap<>();169 Map<String, Boolean> typeMap = new HashMap<>(); 171 170 String[] types = {"none", "highway", "railway", "waterway", "boundary", "power", "natural", "landuse", "building"}; 172 171 173 174 // check whether we have multiple nodes at the same position with 175 // the same tag set 176 // 177 for (Iterator<Map<String,String>> it = mm.keySet().iterator(); it.hasNext();) { 178 Map<String,String> tagSet = it.next(); 172 // check whether we have multiple nodes at the same position with the same tag set 173 for (Iterator<Map<String, String>> it = mm.keySet().iterator(); it.hasNext();) { 174 Map<String, String> tagSet = it.next(); 179 175 if (mm.get(tagSet).size() > 1) { 180 176 … … 184 180 185 181 for (OsmPrimitive p : mm.get(tagSet)) { 186 if (p.getType() ==OsmPrimitiveType.NODE) {182 if (p.getType() == OsmPrimitiveType.NODE) { 187 183 Node n = (Node) p; 188 List<OsmPrimitive> lp =n.getReferrers();184 List<OsmPrimitive> lp = n.getReferrers(); 189 185 for (OsmPrimitive sp: lp) { 190 if (sp.getType() ==OsmPrimitiveType.WAY) {186 if (sp.getType() == OsmPrimitiveType.WAY) { 191 187 boolean typed = false; 192 Way w =(Way) sp;188 Way w = (Way) sp; 193 189 Map<String, String> keys = w.getKeys(); 194 190 for (String type: typeMap.keySet()) { 195 191 if (keys.containsKey(type)) { 196 192 typeMap.put(type, true); 197 typed =true;193 typed = true; 198 194 } 199 195 } … … 207 203 } 208 204 209 int nbType =0;205 int nbType = 0; 210 206 for (Entry<String, Boolean> entry: typeMap.entrySet()) { 211 207 if (entry.getValue()) { … … 214 210 } 215 211 216 if (nbType >1) {212 if (nbType > 1) { 217 213 String msg = marktr("Mixed type duplicated nodes"); 218 214 errors.add(new TestError( … … 364 360 // object to keep track of the nodes at this position. 365 361 // 366 Node n1 = (Node) potentialDuplicates.get(n);362 Node n1 = (Node) potentialDuplicates.get(n); 367 363 List<Node> nodes = new ArrayList<>(2); 368 364 nodes.add(n1); … … 372 368 // we have multiple nodes at the same position. 373 369 // 374 List<Node> nodes = (List<Node>) potentialDuplicates.get(n);370 List<Node> nodes = (List<Node>) potentialDuplicates.get(n); 375 371 nodes.add(n); 376 372 } … … 413 409 } 414 410 415 return null; // undoRedo handling done in mergeNodes411 return null; // undoRedo handling done in mergeNodes 416 412 } 417 413
Note:
See TracChangeset
for help on using the changeset viewer.