Add ol.extent.touches

This commit is contained in:
Éric Lemoine
2013-09-16 15:51:12 +02:00
parent b192335e56
commit 70c66d4cf1
2 changed files with 31 additions and 1 deletions

View File

@@ -337,6 +337,19 @@ ol.extent.toString = function(extent) {
};
/**
* @param {ol.Extent} extent1 Extent 1.
* @param {ol.Extent} extent2 Extent 2.
* @return {boolean} Touches.
*/
ol.extent.touches = function(extent1, extent2) {
var intersects = ol.extent.intersects(extent1, extent2);
return intersects &&
(extent1[0] == extent2[2] || extent1[2] == extent2[0] ||
extent1[1] == extent2[3] || extent1[3] == extent2[1]);
};
/**
* @param {ol.Extent} extent Extent.
* @param {ol.TransformFunction} transformFn Transform function.