Add clone methods to Tile and Tile.Image, and add associated tests. r=crschmidt (closes #1296)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@5854 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Paul Spencer
2008-01-23 20:29:46 +00:00
parent 74bbd0347e
commit ef1af7dee4
4 changed files with 108 additions and 4 deletions

View File

@@ -119,6 +119,30 @@ OpenLayers.Tile = OpenLayers.Class({
this.events.destroy();
this.events = null;
},
/**
* Method: clone
*
* Parameters:
* obj - {<OpenLayers.Tile>} The tile to be cloned
*
* Returns:
* {<OpenLayers.Tile>} An exact clone of this <OpenLayers.Tile>
*/
clone: function (obj) {
if (obj == null) {
obj = new OpenLayers.Tile(this.layer,
this.position,
this.bounds,
this.url,
this.size);
}
// catch any randomly tagged-on properties
OpenLayers.Util.applyDefaults(obj, this);
return obj;
},
/**
* Method: draw