first step of deprecating copyOf() functions, to be replaced with clone()

git-svn-id: http://svn.openlayers.org/trunk/openlayers@943 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-14 12:59:08 +00:00
parent a3aa327d2f
commit eb6c2a6346
+64 -15
View File
@@ -41,9 +41,18 @@ OpenLayers.Pixel.prototype = {
}, },
/** /**
* @type OpenLayers.Pixel * @deprecated
*/ *
* @type OpenLayers.Pixel
*/
copyOf:function() { copyOf:function() {
return this.clone();
},
/**
* @type OpenLayers.Pixel
*/
clone:function() {
return new OpenLayers.Pixel(this.x, this.y); return new OpenLayers.Pixel(this.x, this.y);
}, },
@@ -124,10 +133,20 @@ OpenLayers.Size.prototype = {
}, },
/** /**
* @return New OpenLayers.Size object with the same w and h values * @deprecated
* @type OpenLayers.Size *
*/ * @return New OpenLayers.Size object with the same w and h values
* @type OpenLayers.Size
*/
copyOf:function() { copyOf:function() {
return this.clone();
},
/**
* @return New OpenLayers.Size object with the same w and h values
* @type OpenLayers.Size
*/
clone:function() {
return new OpenLayers.Size(this.w, this.h); return new OpenLayers.Size(this.w, this.h);
}, },
@@ -193,10 +212,20 @@ OpenLayers.LonLat.prototype = {
}, },
/** /**
* @return New OpenLayers.LonLat object with the same lon and lat values * @deprecated
* @type OpenLayers.LonLat *
*/ * @return New OpenLayers.LonLat object with the same lon and lat values
* @type OpenLayers.LonLat
*/
copyOf:function() { copyOf:function() {
return this.clone();
},
/**
* @return New OpenLayers.LonLat object with the same lon and lat values
* @type OpenLayers.LonLat
*/
clone:function() {
return new OpenLayers.LonLat(this.lon, this.lat); return new OpenLayers.LonLat(this.lon, this.lat);
}, },
@@ -288,10 +317,20 @@ OpenLayers.Bounds.prototype = {
}, },
/** /**
* @returns A fresh copy of the bounds * @deprecated
* @type OpenLayers.Bounds *
*/ * @returns A fresh copy of the bounds
* @type OpenLayers.Bounds
*/
copyOf:function() { copyOf:function() {
return this.clone();
},
/**
* @returns A fresh copy of the bounds
* @type OpenLayers.Bounds
*/
clone:function() {
return new OpenLayers.Bounds(this.left, this.bottom, return new OpenLayers.Bounds(this.left, this.bottom,
this.right, this.top); this.right, this.top);
}, },
@@ -609,16 +648,26 @@ Array.prototype.remove = function(item) {
return this; return this;
} }
/**
* @deprecated
*
* @returns A fresh copy of the array
* @type Array
*/
Array.prototype.copyOf = function() {
return this.clone();
};
/** /**
* @returns A fresh copy of the array * @returns A fresh copy of the array
* @type Array * @type Array
*/ */
Array.prototype.copyOf = function() { Array.prototype.clone = function() {
var copy = new Array(); var clone = new Array();
for (var i = 0; i < this.length; i++) { for (var i = 0; i < this.length; i++) {
copy[i] = this[i]; clone[i] = this[i];
} }
return copy; return clone;
}; };
/** /**