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 *