fix for #168 - getScale() thanks for great patch from Tim Schaub

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1227 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-08-16 01:09:42 +00:00
parent 1baadf57ac
commit 3f19fdd490

View File

@@ -810,6 +810,24 @@ OpenLayers.Map.prototype = {
return resolution;
},
/**
* @returns The current scale denominator of the map.
* If no baselayer is set, returns null.
* @type float
*/
getScale: function () {
var scale = null;
if (this.baseLayer != null) {
var res = this.baseLayer.getResolution();
var units = this.baseLayer.units;
scale = res * OpenLayers.INCHES_PER_UNIT[units] *
OpenLayers.DOTS_PER_INCH;
}
return scale;
},
/**
* @param {OpenLayers.Bounds} bounds
*