add tests and finish off the functionality for switching between singleTile true and false

This commit is contained in:
Bart van den Eijnden
2013-01-04 15:10:48 +01:00
parent 5114ecbaee
commit 1e1ce54e5b
2 changed files with 45 additions and 9 deletions
+19 -9
View File
@@ -311,14 +311,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
this.tileQueue = [];
this._removeBackBuffer = OpenLayers.Function.bind(this.removeBackBuffer, this);
if (this.removeBackBufferDelay === null) {
this.removeBackBufferDelay = this.singleTile ? 0 : 2500;
}
if (this.className === null) {
this.className = this.singleTile ? 'olLayerGridSingleTile' :
'olLayerGrid';
}
this.initProperties();
if (!OpenLayers.Animation.isNative) {
this.deferMoveGriddedTiles = OpenLayers.Function.bind(function() {
@@ -330,6 +323,22 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
this.rowSign = this.tileOriginCorner.substr(0, 1) === "t" ? 1 : -1;
},
/**
* Method: initProperties
* Set any properties that depend on the value of singleTile.
* Currently sets removeBackBufferDelay and className
*/
initProperties: function() {
if (this.options.removeBackBufferDelay === undefined) {
this.removeBackBufferDelay = this.singleTile ? 0 : 2500;
}
if (this.options.className === undefined) {
this.className = this.singleTile ? 'olLayerGridSingleTile' :
'olLayerGrid';
}
},
/**
* Method: setMap
*
@@ -406,7 +415,8 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
*/
addOptions: function (newOptions, reinitialize) {
OpenLayers.Layer.HTTPRequest.prototype.addOptions.apply(this, arguments);
if (newOptions.singleTile !== undefined) {
if (this.map && newOptions.singleTile !== undefined) {
this.initProperties();
this.clearGrid();
if (newOptions.singleTile === true) {
this.setTileSize();