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
+19
View File
@@ -55,6 +55,25 @@ ol.geom.MultiLineString.prototype.getType = function() {
};
/**
* Calculate the distance from a coordinate to this multilinestring. This is
* the closest distance of the coordinate to one of this multilinestring's
* components.<
*
* @param {ol.Coordinate} coordinate Coordinate.
* @return {number} Distance from the coordinate to this multilinestring.
*/
ol.geom.MultiLineString.prototype.distanceFromCoordinate =
function(coordinate) {
var distance = Infinity;
for (var i = 0, ii = this.components.length; i < ii; ++i) {
distance = Math.min(distance,
this.components[i].distanceFromCoordinate(coordinate));
}
return distance;
};
/**
* Create a multi-linestring geometry from an array of linestring geometries.
*