Get hit candidates from RTree, then refine result

Now we get exact hits also for lines and polygons.
This commit is contained in:
ahocevar
2013-04-30 13:34:12 +02:00
parent cc1b70c74b
commit 58c8b07ab5
9 changed files with 208 additions and 21 deletions
+18
View File
@@ -56,6 +56,24 @@ ol.geom.MultiPolygon.prototype.getType = function() {
};
/**
* Check whether a given coordinate is inside this multipolygon.
*
* @param {ol.Coordinate} coordinate Coordinate.
* @return {boolean} Whether the coordinate is inside the multipolygon.
*/
ol.geom.MultiPolygon.prototype.containsCoordinate = function(coordinate) {
var containsCoordinate = false;
for (var i = 0, ii = this.components.length; i < ii; ++i) {
if (this.components[i].containsCoordinate(coordinate)) {
containsCoordinate = true;
break;
}
}
return containsCoordinate;
};
/**
* Create a multi-polygon geometry from an array of polygon geometries.
*