Changeset 5550 in josm for trunk


Ignore:
Timestamp:
2012-11-01T21:07:40+01:00 (11 years ago)
Author:
bastiK
Message:

applied #7259 - Validation Enhancements for water features (patch by oldtopos, slightly modified)

Location:
trunk/src/org/openstreetmap/josm/data/validation/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java

    r5293 r5550  
    4242     */
    4343    public CrossingWays() {
    44         super(tr("Crossing ways"),
     44        super(tr("Crossing ways."),
    4545                tr("This test checks if two roads, railways, waterways or buildings crosses in the same layer, but are not connected by a node."));
    4646    }
     
    139139                        if (isBuilding) {
    140140                            message = tr("Crossing buildings");
     141                        } else if ((es1.waterway != null && es2.waterway != null)) {
     142                            message = tr("Crossing waterways");
    141143                        } else if ((es1.waterway != null && es2.ws.way.get("highway") != null)
    142144                                || (es2.waterway != null && es1.ws.way.get("highway") != null)) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingAreas.java

    r5490 r5550  
    33import static org.openstreetmap.josm.tools.I18n.tr;
    44
     5import java.util.ArrayList;
    56import java.util.Collection;
    67import java.util.Collections;
     
    4950                    });
    5051            if (!overlaps.isEmpty()) {
    51                 errors.add(new TestError(this, Severity.OTHER, tr("Overlapping Areas"),
    52                         OVERLAPPING_AREAS, Collections.singletonList(w), overlaps));
     52                Collection<Way> overlapsWater = new ArrayList<Way>();
     53                Collection<Way> overlapsOther = new ArrayList<Way>();
     54
     55                String natural1 = w.get("natural");
     56                String landuse1 = w.get("landuse");
     57                boolean isWaterArea = "water".equals(natural1) || "wetland".equals(natural1) || "coastline".equals(natural1) || "reservoir".equals(landuse1);
     58                boolean isWaterArea2 = false;
     59
     60                for (Way wayOther : overlaps) {
     61                    String natural2 = wayOther.get("natural");
     62                    String landuse2 = wayOther.get("landuse");
     63                    boolean isWaterAreaTest = "water".equals(natural2) || "wetland".equals(natural2) || "coastline".equals(natural2) || "reservoir".equals(landuse2);
     64
     65                    if (!isWaterArea2) {
     66                        isWaterArea2 = isWaterAreaTest;
     67                    }
     68
     69                    if (isWaterArea && isWaterAreaTest) {
     70                        overlapsWater.add(wayOther);
     71                    } else {
     72                        overlapsOther.add(wayOther);
     73                    }
     74                }
     75
     76                if (!overlapsWater.isEmpty()) {
     77                    errors.add(new TestError(this, Severity.WARNING, tr("Overlapping Water Areas"),
     78                            OVERLAPPING_AREAS, Collections.singletonList(w), overlapsWater));
     79                }
     80
     81                if (!overlapsOther.isEmpty()) {
     82                    errors.add(new TestError(this, Severity.OTHER, tr("Overlapping Areas"),
     83                            OVERLAPPING_AREAS, Collections.singletonList(w), overlapsOther));
     84                }
    5385            }
    5486        }
Note: See TracChangeset for help on using the changeset viewer.