Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 @Override
 public void startTest(ProgressMonitor monitor) {
   super.startTest(monitor);
   ways = new HashSet<>();
   endnodes = new QuadBuckets<>();
   endnodesHighway = new QuadBuckets<>();
   middlenodes = new QuadBuckets<>();
   othernodes = new HashSet<>();
   mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0);
   minmiddledist = Main.pref.getDouble(PREFIX + ".way_way_distance", 0.0);
   DataSet dataSet = Main.getLayerManager().getEditDataSet();
   dsArea = dataSet == null ? null : dataSet.getDataSourceArea();
 }
Ejemplo n.º 3
0
 @Override
 public void startTest(ProgressMonitor monitor) {
   super.startTest(monitor);
   multipolygonways = new LinkedList<Way>();
   for (Relation r : Main.main.getCurrentDataSet().getRelations()) {
     if (r.isUsable() && r.isMultipolygon()) {
       for (RelationMember m : r.getMembers()) {
         if (m.getMember() != null
             && m.getMember() instanceof Way
             && m.getMember().isUsable()
             && !m.getMember().isTagged()) {
           multipolygonways.add((Way) m.getMember());
         }
       }
     }
   }
 }
Ejemplo n.º 4
0
 @Override
 public void endTest() {
   addErrors(
       Severity.WARNING, getWayEndNodesNearOtherHighway(), tr("Way end node near other highway"));
   addErrors(Severity.WARNING, getWayEndNodesNearOtherWay(), tr("Way end node near other way"));
   /* the following two use a shorter distance */
   if (minmiddledist > 0.0) {
     addErrors(Severity.OTHER, getWayNodesNearOtherWay(), tr("Way node near other way"));
     addErrors(
         Severity.OTHER,
         getConnectedWayEndNodesNearOtherWay(),
         tr("Connected way end node near other way"));
   }
   ways = null;
   endnodes = null;
   endnodesHighway = null;
   middlenodes = null;
   othernodes = null;
   dsArea = null;
   super.endTest();
 }
Ejemplo n.º 5
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;
  }
Ejemplo n.º 6
0
 @Override
 public void startTest(ProgressMonitor monitor) {
   super.startTest(monitor);
   ways = new MultiMap<WayPair, OsmPrimitive>(1000);
   waysNoTags = new MultiMap<WayPairNoTags, OsmPrimitive>(1000);
 }
Ejemplo n.º 7
0
 @Override
 public void startTest(ProgressMonitor monitor) {
   super.startTest(monitor);
   relations = new MultiMap<RelationPair, OsmPrimitive>(1000);
   relations_nokeys = new MultiMap<List<RelationMember>, OsmPrimitive>(1000);
 }
Ejemplo n.º 8
0
  /**
   * Fixes the error with the appropriate command
   *
   * @return The command to fix the error
   */
  public Command getFix() {
    if (tester == null || !tester.isFixable(this) || primitives.isEmpty()) return null;

    return tester.fixError(this);
  }
Ejemplo n.º 9
0
 /**
  * Returns true if the error can be fixed automatically
  *
  * @return true if the error can be fixed
  */
 public boolean isFixable() {
   return tester != null && tester.isFixable(this);
 }
Ejemplo n.º 10
0
 @Override
 public void endTest() {
   multipolygonways = null;
   super.endTest();
 }