Configure maps with TileManger instances (and not the other way around)

This resolves issues with destroying caches on window unload, and makes
cache sharing among maps less confusing to configure.
This commit is contained in:
ahocevar
2012-11-30 10:14:08 -06:00
parent 9609bb1449
commit 781f2ac73d
5 changed files with 146 additions and 121 deletions
+2 -2
View File
@@ -3,7 +3,7 @@
var apiKey = "AqTGBsziZHIJYYxgivLBf0hVdrAk9mWO5cQcb8Yux8sW5M8c8opEC2lZqKR1ZZXf";
// initialize map when page ready
var map, tileManager;
var map;
var gg = new OpenLayers.Projection("EPSG:4326");
var sm = new OpenLayers.Projection("EPSG:900913");
@@ -42,6 +42,7 @@ var init = function (onSelectFeatureFunction) {
theme: null,
projection: sm,
numZoomLevels: 18,
tileManager: new OpenLayers.TileManager(),
controls: [
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.TouchNavigation({
@@ -85,7 +86,6 @@ var init = function (onSelectFeatureFunction) {
center: new OpenLayers.LonLat(0, 0),
zoom: 1
});
tileManager = new OpenLayers.TileManager({map: map});
var style = {
fillOpacity: 0.1,
+2 -2
View File
@@ -1,4 +1,4 @@
var map, tileManager;
var map;
(function() {
// Set document language for css content
@@ -99,6 +99,7 @@ var map, tileManager;
maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34],
maxResolution: 156543.0339,
numZoomLevels: 20,
tileManager: new OpenLayers.TileManager(),
controls: [
new OpenLayers.Control.Navigation({
mouseWheelOptions: {
@@ -124,7 +125,6 @@ var map, tileManager;
}
}
});
tileManager = new OpenLayers.TileManager({map: map});
layerPanel.activateControl(mapButton);
layerPanel.activateControl(labelButton);