Changeset 33171 in osm for applications/editors/josm


Ignore:
Timestamp:
2017-02-27T12:30:17+01:00 (8 years ago)
Author:
upliner
Message:

splinex: limit depth in SplineHitTest

Location:
applications/editors/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/splinex/src/org/openstreetmap/josm/plugins/Splinex/SplineHitTest.java

    r32918 r33171  
    2626
    2727    public boolean checkCurve(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
     28        return checkCurve(x1, y1, x2, y2, x3, y3, x4, y4, 32);
     29    }
     30    public boolean checkCurve(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, int depth) {
    2831        if (Main.isDebugEnabled()) {
    2932            Main.debug("checkCurve {0} {1} {2} {3} {4} {5} {6} {7}", x1, y1, x2, y2, x3, y3, x4, y4);
     
    7780        if (checkPoint(x1234, y1234))
    7881            return true;
    79         return checkCurve(x1, y1, x12, y12, x123, y123, x1234, y1234)
    80             || checkCurve(x1234, y1234, x234, y234, x34, y34, x4, y4);
     82        if (depth <= 0)
     83            return false;
     84        return checkCurve(x1, y1, x12, y12, x123, y123, x1234, y1234, depth - 1)
     85            || checkCurve(x1234, y1234, x234, y234, x34, y34, x4, y4, depth - 1);
    8186    }
    8287}
Note: See TracChangeset for help on using the changeset viewer.