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.MultiPolygon');
goog.require('ol.extent');
goog.require('ol.geom.Geometry');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.closest');
@@ -59,6 +60,10 @@ goog.inherits(ol.geom.MultiPolygon, ol.geom.Geometry);
*/
ol.geom.MultiPolygon.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.getssMaxSquaredDelta(
this.flatCoordinates, 0, this.endss_, this.stride, 0));