From 90933052aaeb9d1c0e3fb4dea910b57fa5a3fe23 Mon Sep 17 00:00:00 2001 From: euzuro Date: Thu, 6 Jul 2006 02:19:04 +0000 Subject: [PATCH] give Grid a clone() function. git-svn-id: http://svn.openlayers.org/trunk/openlayers@894 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Grid.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 2111d2f7fd..1345c6a583 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -47,6 +47,27 @@ OpenLayers.Layer.Grid.prototype = OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments); }, + /** + * @param {Object} obj + * + * @returns An exact clone of this OpenLayers.Layer.Grid + * @type OpenLayers.Layer.Grid + */ + clone: function (obj) { + + if (obj == null) { + obj = new OpenLayers.Layer.Grid(this.name, + this.url, + this.params, + this.options); + } + + //set any non-init vars here + + //get all additions from superclasses + return OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this, [obj]); + }, + /** When the layer is added to a map, then we can ask the map for * its default tile size *