add containsPixel() and containsLonLat() functions to OpenLayers.Bounds object. added tests

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1506 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-09-27 20:52:15 +00:00
parent 2255e7d56c
commit b5c6522c2b
2 changed files with 32 additions and 1 deletions

View File

@@ -424,6 +424,30 @@ OpenLayers.Bounds.prototype = {
this.right + x, this.top + y);
},
/**
* @param {OpenLayers.LonLat} ll
* @param {Boolean} inclusive Whether or not to include the border.
* Default is true
*
* @return Whether or not the passed-in lonlat is within this bounds
* @type Boolean
*/
containsLonLat:function(ll, inclusive) {
return this.contains(ll.lon, ll.lat, inclusive);
},
/**
* @param {OpenLayers.Pixel} px
* @param {Boolean} inclusive Whether or not to include the border.
* Default is true
*
* @return Whether or not the passed-in pixel is within this bounds
* @type Boolean
*/
containsPixel:function(px, inclusive) {
return this.contains(px.x, px.y, inclusive);
},
/**
* @param {float} x
* @param {float} y