adding determineQuadrant() function to OpenLayers.Bounds. Tests included.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@334 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-24 23:43:09 +00:00
parent 3ece5e35fd
commit b55debdd48
2 changed files with 33 additions and 0 deletions

View File

@@ -413,6 +413,24 @@ OpenLayers.Bounds.prototype = {
: (inTop && inLeft && inBottom && inRight);
},
/**
* @param {OpenLayers.LonLat} lonlat
*
* @returns The quadrant ("br" "tr" "tl" "bl") of the bounds in which
* the coordinate lies.
* @type String
*/
determineQuadrant: function(lonlat) {
var quadrant = "";
var center = this.getCenterLonLat();
quadrant += (lonlat.lat < center.lat) ? "b" : "t";
quadrant += (lonlat.lon < center.lon) ? "l" : "r";
return quadrant;
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Bounds"
};