예제 #1
0
 @Override
 public void endTest() {
   super.endTest();
   for (Set<OsmPrimitive> duplicated : relations.values()) {
     if (duplicated.size() > 1) {
       TestError testError =
           new TestError(
               this, Severity.ERROR, tr("Duplicated relations"), DUPLICATE_RELATION, duplicated);
       errors.add(testError);
     }
   }
   relations = null;
   for (Set<OsmPrimitive> duplicated : relations_nokeys.values()) {
     if (duplicated.size() > 1) {
       TestError testError =
           new TestError(
               this,
               Severity.WARNING,
               tr("Relations with same members"),
               SAME_RELATION,
               duplicated);
       errors.add(testError);
     }
   }
   relations_nokeys = null;
 }
예제 #2
0
  @Override
  public void endTest() {
    super.endTest();
    for (Set<OsmPrimitive> duplicated : ways.values()) {
      if (duplicated.size() > 1) {
        TestError testError =
            new TestError(this, Severity.ERROR, tr("Duplicated ways"), DUPLICATE_WAY, duplicated);
        errors.add(testError);
      }
    }

    for (Set<OsmPrimitive> sameway : waysNoTags.values()) {
      if (sameway.size() > 1) {
        // Report error only if at least some tags are different, as otherwise the error was already
        // reported as duplicated ways
        Map<String, String> tags0 = null;
        boolean skip = true;

        for (OsmPrimitive o : sameway) {
          if (tags0 == null) {
            tags0 = o.getKeys();
            removeUninterestingKeys(tags0);
          } else {
            Map<String, String> tagsCmp = o.getKeys();
            removeUninterestingKeys(tagsCmp);
            if (!tagsCmp.equals(tags0)) {
              skip = false;
              break;
            }
          }
        }
        if (skip) continue;
        TestError testError =
            new TestError(this, Severity.WARNING, tr("Ways with same position"), SAME_WAY, sameway);
        errors.add(testError);
      }
    }
    ways = null;
    waysNoTags = null;
  }