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

@@ -91,6 +91,34 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
OpenLayers.Tile.prototype.destroy.apply(this, arguments);
},
/**
* Method: clone
*
* Parameters:
* obj - {<OpenLayers.Tile.Image>} The tile to be cloned
*
* Returns:
* {<OpenLayers.Tile.Image>} An exact clone of this <OpenLayers.Tile.Image>
*/
clone: function (obj) {
if (obj == null) {
obj = new OpenLayers.Tile.Image(this.layer,
this.position,
this.bounds,
this.url,
this.size);
}
//pick up properties from superclass
obj = OpenLayers.Tile.prototype.clone.apply(this, [obj]);
//dont want to directly copy the image div
obj.imgDiv = null;
return obj;
},
/**
* Method: draw
* Check that a tile should be drawn, and draw it.