From 55732b8934b0f7deac7ebde2cdf939f23fff291a Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Tue, 16 May 2006 22:26:47 +0000 Subject: [PATCH] Added setTileSize() method to Layer.Grid. Also, added clone() method to Layer.WMS to make up for lack of a separate data source class. git-svn-id: http://svn.openlayers.org/trunk/openlayers@63 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Grid.js | 8 ++++++-- lib/OpenLayers/Layer/WMS.js | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index a90721bd75..35998adf4a 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -14,7 +14,7 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), { // this is an array of rows, each row is an array of tiles grid: null, - DEFAULT_TILE_SIZE: new OpenLayers.Size(256,256), + tileSize: new OpenLayers.Size(256,256), /** * @param {str} name @@ -25,8 +25,12 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), { OpenLayers.Layer.prototype.initialize.apply(this, [name]); this.url = url; this.params = params; - this.tileSize = this.DEFAULT_TILE_SIZE; }, + + setTileSize: function (size) { + this.tileSize = size.copyOf(); + }, + /** * moveTo * moveTo is a function called whenever the map is moved. All the moving diff --git a/lib/OpenLayers/Layer/WMS.js b/lib/OpenLayers/Layer/WMS.js index 12c01032d0..93fdc5816b 100644 --- a/lib/OpenLayers/Layer/WMS.js +++ b/lib/OpenLayers/Layer/WMS.js @@ -21,6 +21,18 @@ OpenLayers.Layer.WMS.prototype = Object.extend(this.params, this.DEFAULT_PARAMS); }, + /** + * @param + */ + clone: function (name, params) { + var mergedParams = {} + Object.extend(mergedParams, this.params); + Object.extend(mergedParams, params); + var obj = new OpenLayers.Layer.WMS(name, this.url, mergedParams); + obj.setTileSize( this.tileSize ); + return obj; + }, + /** * addTile creates a tile, initializes it (via 'draw' in this case), and * adds it to the layer div. THe tile itself is then returned so that info