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