Check closest point against extent

This commit is contained in:
Tom Payne
2013-12-09 11:31:40 +00:00
parent 66f1826358
commit f4fe0046b2
7 changed files with 30 additions and 1 deletions
+5
View File
@@ -1,5 +1,6 @@
goog.provide('ol.geom.MultiLineString');
goog.require('ol.extent');
goog.require('ol.geom.Geometry');
goog.require('ol.geom.LineString');
goog.require('ol.geom.closest');
@@ -47,6 +48,10 @@ goog.inherits(ol.geom.MultiLineString, ol.geom.Geometry);
*/
ol.geom.MultiLineString.prototype.closestPointXY =
function(x, y, closestPoint, minSquaredDistance) {
if (minSquaredDistance <
ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) {
return minSquaredDistance;
}
if (this.maxDeltaRevision_ != this.revision) {
this.maxDelta_ = Math.sqrt(ol.geom.closest.getsMaxSquaredDelta(
this.flatCoordinates, 0, this.ends_, this.stride, 0));