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

View File

@@ -579,6 +579,10 @@ OpenLayers.Map = OpenLayers.Class({
this, this.viewPortDiv, null, this.fallThrough,
{includeXY: true}
);
if (this.tileManager) {
this.tileManager.addMap(this);
}
// the layerContainerDiv is the one that holds all the layers
id = this.id + "_OpenLayers_Container";
@@ -778,6 +782,11 @@ OpenLayers.Map = OpenLayers.Class({
this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);
}
this.viewPortDiv = null;
if (this.tileManager) {
this.tileManager.removeMap(this);
this.tileManager = null;
}
if(this.eventListeners) {
this.events.un(this.eventListeners);