part two of #204 -- all that remains is to write some test functions

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1383 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-08-26 10:36:18 +00:00
parent 693eab5cc9
commit 57161a94be
2 changed files with 28 additions and 4 deletions

View File

@@ -336,20 +336,24 @@ OpenLayers.Layer.prototype = {
/** Calculates based on resolution, center, and mapsize
*
* @param {float} resolution Specific resolution to get an extent for.
* If null, this.getResolution() is called
* @returns A Bounds object which represents the lon/lat bounds of the
* current viewPort.
* @type OpenLayers.Bounds
*/
getExtent: function () {
getExtent: function(resolution) {
var extent = null;
var center = this.map.getCenter();
if (center != null) {
var res = this.getResolution();
if (resolution == null) {
resolution = this.getResolution();
}
var size = this.map.getSize();
var w_deg = size.w * res;
var h_deg = size.h * res;
var w_deg = size.w * resolution;
var h_deg = size.h * resolution;
extent = new OpenLayers.Bounds(center.lon - w_deg / 2,
center.lat - h_deg / 2,