TileManager dependency management

If the build does not contain TileManager.js, do not create a TileManager
instance for the map. If the build does not contain Layer/Grid.js, do not
try to add Grid layer instances to the list of layers managed by the
TileManager.
This commit is contained in:
ahocevar
2013-06-06 23:07:47 +02:00
committed by Bart van den Eijnden
parent 1c21d9cc15
commit f4f72d5eeb
2 changed files with 10 additions and 10 deletions

View File

@@ -10,7 +10,6 @@
* @requires OpenLayers/Events.js
* @requires OpenLayers/Tween.js
* @requires OpenLayers/Projection.js
* @requires OpenLayers/TileManager.js
*/
/**
@@ -376,11 +375,12 @@ OpenLayers.Map = OpenLayers.Class({
/**
* APIProperty: tileManager
* {<OpenLayers.TileManager>|Object} By default the map will use the TileManager
* to queue image requests and to cache tile image elements. To create a
* map without a TileManager configure the map with tileManager: null.
* To create a TileManager with non-default options, supply the options
* instead or alternatively supply an instance of {<OpenLayers.TileManager>}.
* {<OpenLayers.TileManager>|Object} By default, and if the build contains
* TileManager.js, the map will use the TileManager to queue image requests
* and to cache tile image elements. To create a map without a TileManager
* configure the map with tileManager: null. To create a TileManager with
* non-default options, supply the options instead or alternatively supply
* an instance of {<OpenLayers.TileManager>}.
*/
/**
@@ -615,7 +615,8 @@ OpenLayers.Map = OpenLayers.Class({
);
if (this.tileManager !== null) {
if (!(this.tileManager instanceof OpenLayers.TileManager)) {
if (OpenLayers.TileManager &&
!(this.tileManager instanceof OpenLayers.TileManager)) {
this.tileManager = new OpenLayers.TileManager(this.tileManager);
}
this.tileManager.addMap(this);

View File

@@ -5,7 +5,6 @@
/**
* @requires OpenLayers/Layer/Grid.js
* @requires OpenLayers/Util.js
* @requires OpenLayers/BaseTypes.js
* @requires OpenLayers/BaseTypes/Element.js
@@ -117,7 +116,7 @@ OpenLayers.TileManager = OpenLayers.Class({
* map - {<OpenLayers.Map>}
*/
addMap: function(map) {
if (this._destroyed) {
if (this._destroyed || !OpenLayers.Layer.Grid) {
return;
}
this.maps.push(map);
@@ -143,7 +142,7 @@ OpenLayers.TileManager = OpenLayers.Class({
* map - {<OpenLayers.Map>}
*/
removeMap: function(map) {
if (this._destroyed) {
if (this._destroyed || !OpenLayers.Layer.Grid) {
return;
}
window.clearTimeout(this.tileQueueId[map.id]);