removing the restrictedMinZoom property, and allow for restricting zoom levels with maxResolution and numZoomLevels. Thanks tschaub for the doc, test and examples improvements. r=tschaub (see #3338)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12106 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -25,6 +25,21 @@ OpenLayers.Layer.GoogleNG = OpenLayers.Class(OpenLayers.Layer.XYZ, {
|
||||
*/
|
||||
SUPPORTED_TRANSITIONS: [],
|
||||
|
||||
/**
|
||||
* Property: serverResolutions
|
||||
* {Array} the resolutions provided by the Google API.
|
||||
*/
|
||||
serverResolutions: [
|
||||
156543.03390625, 78271.516953125, 39135.7584765625,
|
||||
19567.87923828125, 9783.939619140625, 4891.9698095703125,
|
||||
2445.9849047851562, 1222.9924523925781, 611.4962261962891,
|
||||
305.74811309814453, 152.87405654907226, 76.43702827453613,
|
||||
38.218514137268066, 19.109257068634033, 9.554628534317017,
|
||||
4.777314267158508, 2.388657133579254, 1.194328566789627,
|
||||
0.5971642833948135, 0.29858214169740677, 0.14929107084870338,
|
||||
0.07464553542435169, 0.037322767712175846
|
||||
],
|
||||
|
||||
/**
|
||||
* Property: attributionTemplate
|
||||
* {String}
|
||||
@@ -94,7 +109,6 @@ OpenLayers.Layer.GoogleNG = OpenLayers.Class(OpenLayers.Layer.XYZ, {
|
||||
var newArgs = [options.name, null, options];
|
||||
OpenLayers.Layer.XYZ.prototype.initialize.apply(this, newArgs);
|
||||
|
||||
this.options.numZoomLevels = options.numZoomLevels;
|
||||
if (!OpenLayers.Layer.GoogleNG.mapObject) {
|
||||
OpenLayers.Layer.GoogleNG.mapObject =
|
||||
new google.maps.Map(document.createElement("div"));
|
||||
@@ -121,26 +135,16 @@ OpenLayers.Layer.GoogleNG = OpenLayers.Class(OpenLayers.Layer.XYZ, {
|
||||
this.setName("Google " + mapType.name);
|
||||
}
|
||||
|
||||
var numZoomLevels = mapType.maxZoom + 1;
|
||||
if (this.options.numZoomLevels != null) {
|
||||
numZoomLevels = Math.min(numZoomLevels, this.options.numZoomLevels);
|
||||
}
|
||||
var restrictedMinZoom;
|
||||
if (this.restrictedMinZoom || mapType.minZoom) {
|
||||
restrictedMinZoom = Math.max(
|
||||
mapType.minZoom || 0, this.restrictedMinZoom || 0
|
||||
);
|
||||
}
|
||||
|
||||
var minZoom = mapType.minZoom || 0;
|
||||
this.addOptions({
|
||||
restrictedMinZoom: restrictedMinZoom,
|
||||
numZoomLevels: numZoomLevels,
|
||||
tileSize: new OpenLayers.Size(
|
||||
mapType.tileSize.width, mapType.tileSize.height
|
||||
maxResolution: Math.min(
|
||||
this.serverResolutions[minZoom], this.maxResolution
|
||||
),
|
||||
zoomOffset: minZoom,
|
||||
numZoomLevels: Math.min(
|
||||
mapType.maxZoom + 1 - minZoom, this.numZoomLevels
|
||||
)
|
||||
});
|
||||
// redraw to populate tiles with content
|
||||
this.redraw();
|
||||
}, true);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user