- Timestamp:
- 2010-02-02T21:13:35+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java
r2879 r2925 24 24 } 25 25 26 private void printError(String type, String message, Object... args) { 27 writer.println("[" + type + "] " + String.format(message, args)); 28 } 29 26 30 private void checkReferrers() { 27 31 for (Way way:dataSet.getWays()) { … … 29 33 for (Node n:way.getNodes()) { 30 34 if (!n.getReferrers().contains(way)) { 31 writer.println(String.format("%s is part of %s but is not in referrers", n, way));35 printError("WAY NOT IN REFERRERS", "%s is part of %s but is not in referrers", n, way); 32 36 } 33 37 } … … 39 43 for (RelationMember m:relation.getMembers()) { 40 44 if (!m.getMember().getReferrers().contains(relation)) { 41 writer.println(String.format("%s is part of %s but is not in referrers", m.getMember(), relation));45 printError("RELATION NOT IN REFERRERS", "%s is part of %s but is not in referrers", m.getMember(), relation); 42 46 } 43 47 } … … 51 55 for (Node node:way.getNodes()) { 52 56 if (node.isIncomplete()) { 53 writer.println(String.format("%s is usable but contains incomplete node '%s'", way, node));57 printError("USABLE HAS INCOMPLETE", "%s is usable but contains incomplete node '%s'", way, node); 54 58 } 55 59 } … … 61 65 for (Node node:dataSet.getNodes()) { 62 66 if (!node.isIncomplete() && (node.getCoor() == null || node.getEastNorth() == null)) { 63 writer.println(String.format("%s is not incomplete but has null coordinates", node));67 printError("COMPLETE WITHOUT COORDINATES", "%s is not incomplete but has null coordinates", node); 64 68 } 65 69 } … … 72 76 BBox box = new BBox(new LatLon(c.lat() - 0.0001, c.lon() - 0.0001), new LatLon(c.lat() + 0.0001, c.lon() + 0.0001)); 73 77 if (!dataSet.searchNodes(box).contains(n)) { 74 writer.println(String.format("%s not found using Dataset.searchNodes()", n));78 printError("SEARCH NODES", "%s not found using Dataset.searchNodes()", n); 75 79 } 76 80 } … … 81 85 for (Way w:dataSet.getWays()) { 82 86 if (!w.isIncomplete() && !w.isDeleted() && !dataSet.searchWays(w.getBBox()).contains(w)) { 83 writer.println(String.format("%s not found using Dataset.searchWays()", w));87 printError("SEARCH WAYS", "%s not found using Dataset.searchWays()", w); 84 88 } 85 89 } … … 88 92 private void checkReferredPrimitive(OsmPrimitive primitive, OsmPrimitive parent) { 89 93 if (dataSet.getPrimitiveById(primitive) == null) { 90 writer.println(String.format("%s is referenced by %s but not found in dataset", primitive, parent));94 printError("REFERENCED BUT NOT IN DATA", "%s is referenced by %s but not found in dataset", primitive, parent); 91 95 } 92 96 if (dataSet.getPrimitiveById(primitive) != primitive) { 93 writer.println(String.format("%s is different instance that referred by %s", primitive, parent));97 printError("DIFFERENT INSTANCE", "%s is different instance that referred by %s", primitive, parent); 94 98 } 95 99 if (primitive.isDeleted()) { 96 writer.println(String.format("%s refers to deleted primitive %s", parent, primitive));100 printError("DELETED REFERENCED", "%s refers to deleted primitive %s", parent, primitive); 97 101 } 98 102 } … … 112 116 } 113 117 118 114 119 private void checkZeroNodesWays() { 115 120 for (Way way:dataSet.getWays()) { 116 121 if (way.isUsable() && way.getNodesCount() == 0) { 117 writer.println(String.format("Way %s has zero nodes", way));122 printError("WARN - ZERO NODES", "Way %s has zero nodes", way); 118 123 } else if (way.isUsable() && way.getNodesCount() == 1) { 119 writer.println(String.format("Way %s has only one node", way));124 printError("WARN - NO NODES", "Way %s has only one node", way); 120 125 } 121 126 }
Note:
See TracChangeset
for help on using the changeset viewer.