diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 8791236cb6..871899c627 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -393,6 +393,30 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { this.gridLayout = null; } }, + + /** + * APIMethod: addOptions + * + * Parameters: + * newOptions - {Object} + * reinitialize - {Boolean} If set to true, and if resolution options of the + * current baseLayer were changed, the map will be recentered to make + * sure that it is displayed with a valid resolution, and a + * changebaselayer event will be triggered. + */ + addOptions: function (newOptions, reinitialize) { + OpenLayers.Layer.HTTPRequest.prototype.addOptions.apply(this, arguments); + if (newOptions.singleTile !== undefined) { + this.clearGrid(); + if (newOptions.singleTile === true) { + this.setTileSize(); + this.initSingleTile(this.map.getExtent()); + } else { + this.tileSize = this.options.tileSize || this.map.getTileSize(); + this.initGriddedTiles(this.map.getExtent()); + } + } + }, /** * APIMethod: clone