- Timestamp:
- 2010-06-08T15:38:59+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r3300 r3316 268 268 allPrimitives.remove(primitive); 269 269 primitive.setDataset(null); 270 errors.remove(primitive);271 270 firePrimitivesRemoved(Collections.singletonList(primitive), false); 272 271 } … … 906 905 allPrimitives.clear(); 907 906 } 908 909 // TODO Should be completely part of validator910 private Map<OsmPrimitive, List<String>> errors = new HashMap<OsmPrimitive, List<String>>();911 912 public void addError(OsmPrimitive primitive, String error) {913 List<String> perrors = errors.get(primitive);914 if (perrors == null) {915 perrors = new ArrayList<String>();916 }917 perrors.add(error);918 errors.put(primitive, perrors);919 }920 921 /**922 * Replies the list of errors registered for this primitive.923 *924 * @param primitive the primitive for which errors are queried925 * @return the list of errors. Never null.926 * @deprecated should be moved to the validator plugin927 */928 @Deprecated929 public List<String> getErrors(OsmPrimitive primitive) {930 List<String> ret = errors.get(primitive);931 if (ret == null) {932 ret = Collections.emptyList();933 }934 return ret;935 }936 937 public void clearErrors()938 {939 errors.clear();940 }941 907 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintVisitor.java
r3307 r3316 177 177 { 178 178 painter.drawArea(getPolygon(w), (data.isSelected(w) ? paintSettings.getSelectedColor() : areaStyle.color), painter.getAreaName(w)); 179 if(!w.isClosed()) {180 putError(w, tr("Area style way is not closed."), true);181 }182 179 } 183 180 areaStyle.getLineStyle().paintPrimitive(w, paintSettings, painter, data.isSelected(w), false); … … 256 253 257 254 if("from".equals(m.getRole())) { 258 if(fromWay != null) { 259 putError(r, tr("More than one \"from\" way found."), true); 260 } else { 255 if(fromWay == null) 261 256 fromWay = w; 262 }263 257 } else if("to".equals(m.getRole())) { 264 if(toWay != null) { 265 putError(r, tr("More than one \"to\" way found."), true); 266 } else { 258 if(toWay == null) 267 259 toWay = w; 268 }269 260 } else if("via".equals(m.getRole())) { 270 if(via != null) { 271 putError(r, tr("More than one \"via\" found."), true); 272 } else { 261 if(via == null) 273 262 via = w; 274 }275 } else {276 putError(r, tr("Unknown role ''{0}''.", m.getRole()), true);277 263 } 278 264 } … … 280 266 { 281 267 Node n = m.getNode(); 282 if("via".equals(m.getRole())) 283 { 284 if(via != null) { 285 putError(r, tr("More than one \"via\" found."), true); 286 } else { 287 via = n; 288 } 289 } else { 290 putError(r, tr("Unknown role ''{0}''.", m.getRole()), true); 291 } 292 } else { 293 putError(r, tr("Unknown member type for ''{0}''.", m.getMember().getDisplayName(DefaultNameFormatter.getInstance())), true); 294 } 295 } 296 } 297 298 if (fromWay == null) { 299 putError(r, tr("No \"from\" way found."), true); 268 if("via".equals(m.getRole()) && via == null) 269 via = n; 270 } 271 } 272 } 273 274 if (fromWay == null || toWay == null || via == null) 300 275 return; 301 }302 if (toWay == null) {303 putError(r, tr("No \"to\" way found."), true);304 return;305 }306 if (via == null) {307 putError(r, tr("No \"via\" node or way found."), true);308 return;309 }310 276 311 277 Node viaNode; … … 314 280 viaNode = (Node) via; 315 281 if(!fromWay.isFirstLastNode(viaNode)) { 316 putError(r, tr("The \"from\" way does not start or end at a \"via\" node."), true);317 282 return; 318 }319 if(!toWay.isFirstLastNode(viaNode)) {320 putError(r, tr("The \"to\" way does not start or end at a \"via\" node."), true);321 283 } 322 284 } … … 349 311 viaNode = lastNode; 350 312 } else { 351 putError(r, tr("The \"from\" way does not start or end at the \"via\" way."), true);352 313 return; 353 }354 if(!toWay.isFirstLastNode(viaNode == firstNode ? lastNode : firstNode)) {355 putError(r, tr("The \"to\" way does not start or end at the \"via\" way."), true);356 314 } 357 315 } … … 447 405 448 406 if (nodeStyle == null) { 449 putError(r, tr("Style for restriction {0} not found.", r.get("restriction")), true);450 407 return; 451 408 } … … 520 477 if(wayStyle.equals(innerStyle)) 521 478 { 522 putError(r, tr("Style for inner way ''{0}'' equals multipolygon.",523 wInner.getDisplayName(DefaultNameFormatter.getInstance())), false);524 479 if(!data.isSelected(r)) { 525 480 wInner.mappaintDrawnAreaCode = paintid; … … 545 500 else 546 501 { 547 if(outerStyle instanceof AreaElemStyle548 && !wayStyle.equals(outerStyle))549 {550 putError(r, tr("Style for outer way ''{0}'' mismatches.",551 wOuter.getDisplayName(DefaultNameFormatter.getInstance())), true);552 }553 502 if(data.isSelected(r)) 554 503 { … … 660 609 this.painter = new MapPainter(paintSettings, g, inactive, nc, virtual, dist, circum); 661 610 662 data.clearErrors();663 664 665 611 if (fillAreas > dist && styles != null && styles.hasAreas()) { 666 612 Collection<Way> noAreaWays = new LinkedList<Way>(); … … 743 689 } 744 690 745 public void putError(OsmPrimitive p, String text, boolean isError)746 {747 data.addError(p, isError ? tr("Error: {0}", text) : tr("Warning: {0}", text));748 }749 750 691 public void setGraphics(Graphics2D g) { 751 692 this.g = g;
Note:
See TracChangeset
for help on using the changeset viewer.