Ignore:
Timestamp:
2010-06-08T15:38:59+02:00 (14 years ago)
Author:
stoecker
Message:

removed remaining paint error handling

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  
    268268        allPrimitives.remove(primitive);
    269269        primitive.setDataset(null);
    270         errors.remove(primitive);
    271270        firePrimitivesRemoved(Collections.singletonList(primitive), false);
    272271    }
     
    906905        allPrimitives.clear();
    907906    }
    908 
    909     // TODO Should be completely part of validator
    910     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 queried
    925      * @return the list of errors. Never null.
    926      * @deprecated should be moved to the validator plugin
    927      */
    928     @Deprecated
    929     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     }
    941907}
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintVisitor.java

    r3307 r3316  
    177177            {
    178178                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                 }
    182179            }
    183180            areaStyle.getLineStyle().paintPrimitive(w, paintSettings, painter, data.isSelected(w), false);
     
    256253
    257254                    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)
    261256                            fromWay = w;
    262                         }
    263257                    } 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)
    267259                            toWay = w;
    268                         }
    269260                    } 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)
    273262                            via = w;
    274                         }
    275                     } else {
    276                         putError(r, tr("Unknown role ''{0}''.", m.getRole()), true);
    277263                    }
    278264                }
     
    280266                {
    281267                    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)
    300275            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         }
    310276
    311277        Node viaNode;
     
    314280            viaNode = (Node) via;
    315281            if(!fromWay.isFirstLastNode(viaNode)) {
    316                 putError(r, tr("The \"from\" way does not start or end at a \"via\" node."), true);
    317282                return;
    318             }
    319             if(!toWay.isFirstLastNode(viaNode)) {
    320                 putError(r, tr("The \"to\" way does not start or end at a \"via\" node."), true);
    321283            }
    322284        }
     
    349311                viaNode = lastNode;
    350312            } else {
    351                 putError(r, tr("The \"from\" way does not start or end at the \"via\" way."), true);
    352313                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);
    356314            }
    357315        }
     
    447405
    448406        if (nodeStyle == null) {
    449             putError(r, tr("Style for restriction {0} not found.", r.get("restriction")), true);
    450407            return;
    451408        }
     
    520477                    if(wayStyle.equals(innerStyle))
    521478                    {
    522                         putError(r, tr("Style for inner way ''{0}'' equals multipolygon.",
    523                                 wInner.getDisplayName(DefaultNameFormatter.getInstance())), false);
    524479                        if(!data.isSelected(r)) {
    525480                            wInner.mappaintDrawnAreaCode = paintid;
     
    545500                else
    546501                {
    547                     if(outerStyle instanceof AreaElemStyle
    548                             && !wayStyle.equals(outerStyle))
    549                     {
    550                         putError(r, tr("Style for outer way ''{0}'' mismatches.",
    551                                 wOuter.getDisplayName(DefaultNameFormatter.getInstance())), true);
    552                     }
    553502                    if(data.isSelected(r))
    554503                    {
     
    660609        this.painter = new MapPainter(paintSettings, g, inactive, nc, virtual, dist, circum);
    661610
    662         data.clearErrors();
    663 
    664 
    665611        if (fillAreas > dist && styles != null && styles.hasAreas()) {
    666612            Collection<Way> noAreaWays = new LinkedList<Way>();
     
    743689    }
    744690
    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 
    750691    public void setGraphics(Graphics2D g) {
    751692        this.g = g;
Note: See TracChangeset for help on using the changeset viewer.