From d0ab1fd219efc385bfb9da40ae0748b2077aeb2f Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 3 Jan 2011 18:18:43 +0000 Subject: [PATCH] fix Bing layer's zoom level management. r=tschaub (closes #2987) git-svn-id: http://svn.openlayers.org/trunk/openlayers@10997 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Bing.js | 65 ++++++++++++------------------------ tests/Layer/Bing.html | 50 ++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 44 deletions(-) diff --git a/lib/OpenLayers/Layer/Bing.js b/lib/OpenLayers/Layer/Bing.js index 592bb91ef2..3fec9eb76d 100644 --- a/lib/OpenLayers/Layer/Bing.js +++ b/lib/OpenLayers/Layer/Bing.js @@ -18,35 +18,6 @@ */ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { - /** - * Constant: RESOLUTIONS - */ - RESOLUTIONS: [ - 78271.517, - 39135.7585, - 19567.87925, - 9783.939625, - 4891.9698125, - 2445.98490625, - 1222.992453125, - 611.4962265625, - 305.74811328125, - 152.874056640625, - 76.4370283203125, - 38.21851416015625, - 19.109257080078127, - 9.554628540039063, - 4.777314270019532, - 2.388657135009766, - 1.194328567504883, - 0.5971642837524415, - 0.29858214187622073, - 0.14929107093811037, - 0.07464553546905518, - 0.03732276773452759, - 0.018661383867263796 - ], - /** * Property: attributionTemplate * {String} @@ -58,12 +29,6 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { 'href="http://www.microsoft.com/maps/product/terms.html">' + 'Terms of Use', - /** - * Property: sphericalMercator - * {Boolean} always true for this layer type - */ - sphericalMercator: true, - /** * Property: metadata * {Object} Metadata for this layer, as returned by the callback script @@ -131,7 +96,14 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { OpenLayers.Layer.Bing.prototype.EVENT_TYPES.concat( OpenLayers.Layer.prototype.EVENT_TYPES ); + + options = OpenLayers.Util.applyDefaults({ + zoomOffset: 1, + maxResolution: 78271.51695, + sphericalMercator: true + }, options) var name = options.name || "Bing " + (options.type || this.type); + var newArgs = [name, null, options]; OpenLayers.Layer.XYZ.prototype.initialize.apply(this, newArgs); this.loadMetadata(this.type); @@ -172,15 +144,22 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { for (var i=0; i