add Bounds.intersectsBounds() function and tests

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1529 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-10-02 23:49:19 +00:00
parent 36a76054a4
commit 07fc49ab31
2 changed files with 59 additions and 2 deletions

View File

@@ -474,7 +474,27 @@ OpenLayers.Bounds.prototype = {
}
return contains;
},
/**
* @param {OpenLayers.Bounds} bounds
* @param {Boolean} inclusive Whether or not to include the border.
* Default is true
*
* @return Whether or not the passed-in OpenLayers.Bounds object intersects
* this bounds. Simple math just check if either contains the other,
* allowing for partial.
* @type Boolean
*/
intersectsBounds:function(bounds, inclusive) {
if (inclusive == null) {
inclusive = true;
}
return (this.containsBounds(bounds, true, inclusive) ||
bounds.containsBounds(this, true, inclusive));
},
/**
* @param {OpenLayers.Bounds} bounds
* @param {Boolean} partial If true, only part of passed-in