for fixed zoom layers, be careful that if the 3rd party tool is not loaded, they wont be able to return a valid getExtent() and therefore neither a valid getResolution(). Make sure those return null without crashing.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1597 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-10-05 17:07:15 +00:00
parent 07ef71b7b0
commit a1a1128ac7

View File

@@ -77,12 +77,18 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
* @type float
*/
getResolution: function() {
var resolution = null;
var viewSize = this.map.getSize();
var extent = this.getExtent();
return Math.max( extent.getWidth() / viewSize.w,
extent.getHeight() / viewSize.h );
},
if ((viewSize != null) && (extent != null)) {
resolution = Math.max( extent.getWidth() / viewSize.w,
extent.getHeight() / viewSize.h );
}
return resolution;
},
/** Calculates using px-> lonlat translation functions on tl and br
* corners of viewport
*