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:
@@ -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"
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user