Changeset 23917 in osm for applications
- Timestamp:
- 2010-10-30T16:45:34+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateNode.java
r22445 r23917 45 45 private class NodeHash implements Hash<Object, Object> { 46 46 47 double precision = Main.pref.getDouble("validator.duplicatenodes.precision", 0.); 48 49 private LatLon RoundCoord(Node o) { 50 return new LatLon( 51 Math.round(o.getCoor().lat() / precision) * precision, 52 Math.round(o.getCoor().lon() / precision) * precision 53 ); 54 } 55 47 56 @SuppressWarnings("unchecked") 48 57 private LatLon getLatLon(Object o) { 49 58 if (o instanceof Node) { 50 return ((Node) o).getCoor().getRoundedToOsmPrecision(); 59 if (precision==0) { 60 return ((Node) o).getCoor().getRoundedToOsmPrecision(); 61 } else { 62 return RoundCoord((Node) o); 63 } 51 64 } else if (o instanceof List<?>) { 52 return ((List<Node>) o).get(0).getCoor().getRoundedToOsmPrecision(); 65 if (precision==0) { 66 return ((List<Node>) o).get(0).getCoor().getRoundedToOsmPrecision(); 67 } else { 68 return RoundCoord(((List<Node>) o).get(0)); 69 } 53 70 } else { 54 71 throw new AssertionError(); … … 68 85 protected static int DUPLICATE_NODE = 1; 69 86 protected static int DUPLICATE_NODE_MIXED = 2; 70 protected static int DUPLICATE_NODE_HIGHWAY = 3; 71 protected static int DUPLICATE_NODE_RAILWAY = 3; 72 protected static int DUPLICATE_NODE_WATERWAY = 4; 73 protected static int DUPLICATE_NODE_BOUNDARY = 5; 74 protected static int DUPLICATE_NODE_POWER = 6; 87 protected static int DUPLICATE_NODE_OTHER = 3; 88 protected static int DUPLICATE_NODE_BUILDING = 10; 89 protected static int DUPLICATE_NODE_BOUNDARY = 11; 90 protected static int DUPLICATE_NODE_HIGHWAY = 12; 91 protected static int DUPLICATE_NODE_LANDUSE = 13; 92 protected static int DUPLICATE_NODE_NATURAL = 14; 93 protected static int DUPLICATE_NODE_POWER = 15; 94 protected static int DUPLICATE_NODE_RAILWAY = 16; 95 protected static int DUPLICATE_NODE_WATERWAY = 17; 75 96 76 97 /** The map of potential duplicates. … … 126 147 127 148 Map<String,Boolean> typeMap=new HashMap<String,Boolean>(); 128 String[] types = {"none", "highway", "railway", "waterway", "boundary", "power" };149 String[] types = {"none", "highway", "railway", "waterway", "boundary", "power", "natural", "landuse", "building"}; 129 150 130 151 … … 171 192 errors.add(new TestError( 172 193 parentTest, 173 Severity. ERROR,194 Severity.WARNING, 174 195 tr("Duplicated nodes"), 175 196 tr(msg), … … 233 254 bag.get(tagSet) 234 255 )); 256 } else if (typeMap.get("natural")) { 257 String msg = marktr("Natural duplicated nodes"); 258 errors.add(new TestError( 259 parentTest, 260 Severity.ERROR, 261 tr("Duplicated nodes"), 262 tr(msg), 263 msg, 264 DUPLICATE_NODE_NATURAL, 265 bag.get(tagSet) 266 )); 267 } else if (typeMap.get("building")) { 268 String msg = marktr("Building duplicated nodes"); 269 errors.add(new TestError( 270 parentTest, 271 Severity.ERROR, 272 tr("Duplicated nodes"), 273 tr(msg), 274 msg, 275 DUPLICATE_NODE_BUILDING, 276 bag.get(tagSet) 277 )); 278 } else if (typeMap.get("landuse")) { 279 String msg = marktr("Landuse duplicated nodes"); 280 errors.add(new TestError( 281 parentTest, 282 Severity.ERROR, 283 tr("Duplicated nodes"), 284 tr(msg), 285 msg, 286 DUPLICATE_NODE_LANDUSE, 287 bag.get(tagSet) 288 )); 235 289 } else { 236 errors.add(new TestError( 237 parentTest, 238 Severity.ERROR, 239 tr("Duplicated nodes"), 240 DUPLICATE_NODE, 290 String msg = marktr("Other duplicated nodes"); 291 errors.add(new TestError( 292 parentTest, 293 Severity.WARNING, 294 tr("Duplicated nodes"), 295 tr(msg), 296 msg, 297 DUPLICATE_NODE_OTHER, 241 298 bag.get(tagSet) 242 299 ));
Note:
See TracChangeset
for help on using the changeset viewer.