Skip to content

Commit

Permalink
fix polygonIntersectsMultiPolygon
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis committed Feb 29, 2016
1 parent 8bdf3c7 commit 4deefd3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions js/data/feature_tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ function polygonIntersectsMultiPolygon(polygon, multiPolygon) {
for (var i = 0; i < polygon.length; i++) {
if (multiPolygonContainsPoint(multiPolygon, polygon[i])) return true;
}

var polygon_ = [polygon];
for (var m = 0; m < multiPolygon.length; m++) {
var ring = multiPolygon[m];
for (var n = 0; n < ring.length; n++) {
if (multiPolygonContainsPoint(polygon_, ring[n])) return true;
}
}

for (var k = 0; k < multiPolygon.length; k++) {
if (lineIntersectsLine(polygon, multiPolygon[k])) return true;
}
Expand Down

0 comments on commit 4deefd3

Please sign in to comment.