Changeset 8320 in josm


Ignore:
Timestamp:
2015-05-04T19:05:13+02:00 (10 years ago)
Author:
stoecker
Message:

fix #11405 - warn about very long segments (>15km for now)

Location:
trunk/src/org/openstreetmap/josm/data
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r8291 r8320  
    685685
    686686    /**
     687     * Replies the length of the longest segement of the way, in metres, as computed by {@link LatLon#greatCircleDistance}.
     688     * @return The length of the segment, in metres
     689     * @since 4138
     690     */
     691    public double getLongestSegmentLength() {
     692        double length = 0;
     693        Node lastN = null;
     694        for (Node n:nodes) {
     695            if (lastN != null) {
     696                LatLon lastNcoor = lastN.getCoor();
     697                LatLon coor = n.getCoor();
     698                if (lastNcoor != null && coor != null) {
     699                    double l = coor.greatCircleDistance(lastNcoor);
     700                    if (l > length) {
     701                        length = l;
     702                    }
     703                }
     704            }
     705            lastN = n;
     706        }
     707        return length;
     708    }
     709
     710    /**
    687711     * Tests if this way is a oneway.
    688712     * @return {@code 1} if the way is a oneway,
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r8126 r8320  
    4040import org.openstreetmap.josm.data.validation.tests.InternetTags;
    4141import org.openstreetmap.josm.data.validation.tests.Lanes;
     42import org.openstreetmap.josm.data.validation.tests.LongSegment;
    4243import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
    4344import org.openstreetmap.josm.data.validation.tests.MultipolygonTest;
     
    125126        InternetTags.class, // 3300 .. 3399
    126127        ApiCapabilitiesTest.class, // 3400 .. 3499
     128        LongSegment.class, // 3500 .. 3599
    127129    };
    128130
Note: See TracChangeset for help on using the changeset viewer.