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:
committed by
Bart van den Eijnden
parent
1c21d9cc15
commit
f4f72d5eeb
@@ -10,7 +10,6 @@
|
|||||||
* @requires OpenLayers/Events.js
|
* @requires OpenLayers/Events.js
|
||||||
* @requires OpenLayers/Tween.js
|
* @requires OpenLayers/Tween.js
|
||||||
* @requires OpenLayers/Projection.js
|
* @requires OpenLayers/Projection.js
|
||||||
* @requires OpenLayers/TileManager.js
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -376,11 +375,12 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: tileManager
|
* APIProperty: tileManager
|
||||||
* {<OpenLayers.TileManager>|Object} By default the map will use the TileManager
|
* {<OpenLayers.TileManager>|Object} By default, and if the build contains
|
||||||
* to queue image requests and to cache tile image elements. To create a
|
* TileManager.js, the map will use the TileManager to queue image requests
|
||||||
* map without a TileManager configure the map with tileManager: null.
|
* and to cache tile image elements. To create a map without a TileManager
|
||||||
* To create a TileManager with non-default options, supply the options
|
* configure the map with tileManager: null. To create a TileManager with
|
||||||
* instead or alternatively supply an instance of {<OpenLayers.TileManager>}.
|
* 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 !== null) {
|
||||||
if (!(this.tileManager instanceof OpenLayers.TileManager)) {
|
if (OpenLayers.TileManager &&
|
||||||
|
!(this.tileManager instanceof OpenLayers.TileManager)) {
|
||||||
this.tileManager = new OpenLayers.TileManager(this.tileManager);
|
this.tileManager = new OpenLayers.TileManager(this.tileManager);
|
||||||
}
|
}
|
||||||
this.tileManager.addMap(this);
|
this.tileManager.addMap(this);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires OpenLayers/Layer/Grid.js
|
|
||||||
* @requires OpenLayers/Util.js
|
* @requires OpenLayers/Util.js
|
||||||
* @requires OpenLayers/BaseTypes.js
|
* @requires OpenLayers/BaseTypes.js
|
||||||
* @requires OpenLayers/BaseTypes/Element.js
|
* @requires OpenLayers/BaseTypes/Element.js
|
||||||
@@ -117,7 +116,7 @@ OpenLayers.TileManager = OpenLayers.Class({
|
|||||||
* map - {<OpenLayers.Map>}
|
* map - {<OpenLayers.Map>}
|
||||||
*/
|
*/
|
||||||
addMap: function(map) {
|
addMap: function(map) {
|
||||||
if (this._destroyed) {
|
if (this._destroyed || !OpenLayers.Layer.Grid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.maps.push(map);
|
this.maps.push(map);
|
||||||
@@ -143,7 +142,7 @@ OpenLayers.TileManager = OpenLayers.Class({
|
|||||||
* map - {<OpenLayers.Map>}
|
* map - {<OpenLayers.Map>}
|
||||||
*/
|
*/
|
||||||
removeMap: function(map) {
|
removeMap: function(map) {
|
||||||
if (this._destroyed) {
|
if (this._destroyed || !OpenLayers.Layer.Grid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.clearTimeout(this.tileQueueId[map.id]);
|
window.clearTimeout(this.tileQueueId[map.id]);
|
||||||
|
|||||||
Reference in New Issue
Block a user