Changeset 12040 in josm


Ignore:
Timestamp:
2017-05-03T00:00:50+02:00 (7 years ago)
Author:
michael2402
Message:

Long segment test: Make condition for using nodes/ways easier to read.

File:
1 edited

Legend:

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

    r12037 r12040  
    127127    @Override
    128128    public boolean isPrimitiveUsable(OsmPrimitive p) {
    129         if (!p.isUsable()) {
    130             return false;
    131         } else if (p instanceof Way && ((Way) p).getNodesCount() > 1) {
    132             // test only Ways with at least 2 nodes
    133             return true;
    134         } else if (p instanceof Node && p.isDrawable()) {
    135             // test all nodes - ways referred by them may not be checked automatically.
    136             return true;
    137         } else {
    138             return false;
    139         }
     129        return p.isUsable() && (isUsableWay(p) || isUsableNode(p));
     130    }
     131
     132    private boolean isUsableNode(OsmPrimitive p) {
     133        // test changed nodes - ways referred by them may not be checked automatically.
     134        return p instanceof Node && p.isDrawable();
     135    }
     136
     137    private boolean isUsableWay(OsmPrimitive p) {
     138        // test only Ways with at least 2 nodes
     139        return p instanceof Way && ((Way) p).getNodesCount() > 1;
    140140    }
    141141}
Note: See TracChangeset for help on using the changeset viewer.