Ticket #18127: 18127.13.patch

File 18127.13.patch, 1.7 KB (added by taylor.smock, 6 months ago)

Add checks to avoid creating errors when we don't want to check for Other errors, and ensure that the Other or the Warning codes can be ignored.

  • src/org/openstreetmap/josm/data/validation/tests/SharpAngles.java

     
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1616import org.openstreetmap.josm.data.osm.Way;
    1717import org.openstreetmap.josm.data.osm.WaySegment;
     18import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper;
    1819import org.openstreetmap.josm.data.validation.Severity;
    1920import org.openstreetmap.josm.data.validation.Test;
    2021import org.openstreetmap.josm.data.validation.TestError;
     
    108109    }
    109110
    110111    private void createNearlyOverlappingError(double angle, Way way, OsmPrimitive primitive) {
    111         TestError.Builder testError = TestError.builder(this, getSeverity(angle), SHARP_ANGLES)
    112                 .primitives(way)
    113                 .highlight(primitive)
    114                 .message(tr("Sharp angle"));
    115         errors.add(testError.build());
     112        Severity severity = getSeverity(angle);
     113        if ((ValidatorPrefHelper.PREF_OTHER.get() || ValidatorPrefHelper.PREF_OTHER_UPLOAD.get()) || !severity.equals(Severity.OTHER)) {
     114            int addCode = severity.equals(Severity.OTHER) ? 1 : 0;
     115            TestError.Builder testError = TestError.builder(this, severity, SHARP_ANGLES + addCode)
     116                    .primitives(way)
     117                    .highlight(primitive)
     118                    .message(tr("Sharp angle"));
     119            errors.add(testError.build());
     120        }
    116121    }
    117122
    118123    private Severity getSeverity(double angle) {