replace all usage of copyOf() with clone(). Now copyOf() is officially deprecated and unused. supported only if users out there have used it, but we can phase it out in the next official release.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@961 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -56,7 +56,7 @@ OpenLayers.Control.prototype = {
|
|||||||
this.div = OpenLayers.Util.createDiv();
|
this.div = OpenLayers.Util.createDiv();
|
||||||
}
|
}
|
||||||
if (px != null) {
|
if (px != null) {
|
||||||
this.position = px.copyOf();
|
this.position = px.clone();
|
||||||
}
|
}
|
||||||
this.moveTo(this.position);
|
this.moveTo(this.position);
|
||||||
return this.div;
|
return this.div;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
|||||||
*/
|
*/
|
||||||
defaultMouseDown: function (evt) {
|
defaultMouseDown: function (evt) {
|
||||||
if (!Event.isLeftClick(evt)) return;
|
if (!Event.isLeftClick(evt)) return;
|
||||||
this.mouseDragStart = evt.xy.copyOf();
|
this.mouseDragStart = evt.xy.clone();
|
||||||
this.performedDrag = false;
|
this.performedDrag = false;
|
||||||
if (evt.shiftKey) {
|
if (evt.shiftKey) {
|
||||||
this.map.div.style.cursor = "crosshair";
|
this.map.div.style.cursor = "crosshair";
|
||||||
@@ -102,7 +102,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
|||||||
size.h / 2 + deltaY);
|
size.h / 2 + deltaY);
|
||||||
var newCenter = this.map.getLonLatFromViewPortPx( newXY );
|
var newCenter = this.map.getLonLatFromViewPortPx( newXY );
|
||||||
this.map.setCenter(newCenter, null, true);
|
this.map.setCenter(newCenter, null, true);
|
||||||
this.mouseDragStart = evt.xy.copyOf();
|
this.mouseDragStart = evt.xy.clone();
|
||||||
this.map.div.style.cursor = "move";
|
this.map.div.style.cursor = "move";
|
||||||
}
|
}
|
||||||
this.performedDrag = true;
|
this.performedDrag = true;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
*/
|
*/
|
||||||
defaultMouseDown: function (evt) {
|
defaultMouseDown: function (evt) {
|
||||||
if (!Event.isLeftClick(evt)) return;
|
if (!Event.isLeftClick(evt)) return;
|
||||||
this.mouseDragStart = evt.xy.copyOf();
|
this.mouseDragStart = evt.xy.clone();
|
||||||
if (evt.shiftKey && this.mode !="zoombox") {
|
if (evt.shiftKey && this.mode !="zoombox") {
|
||||||
this.switchModeTo("zoombox");
|
this.switchModeTo("zoombox");
|
||||||
} else if (evt.altKey && this.mode !="measure") {
|
} else if (evt.altKey && this.mode !="measure") {
|
||||||
@@ -215,7 +215,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
size.h / 2 + deltaY);
|
size.h / 2 + deltaY);
|
||||||
var newCenter = this.map.getLonLatFromViewPortPx( newXY );
|
var newCenter = this.map.getLonLatFromViewPortPx( newXY );
|
||||||
this.map.setCenter(newCenter, null, true);
|
this.map.setCenter(newCenter, null, true);
|
||||||
this.mouseDragStart = evt.xy.copyOf();
|
this.mouseDragStart = evt.xy.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -147,8 +147,8 @@ OpenLayers.Control.PanZoomBar.prototype =
|
|||||||
if (!Event.isLeftClick(evt)) return;
|
if (!Event.isLeftClick(evt)) return;
|
||||||
this.map.events.register("mousemove", this, this.passEventToSlider);
|
this.map.events.register("mousemove", this, this.passEventToSlider);
|
||||||
this.map.events.register("mouseup", this, this.passEventToSlider);
|
this.map.events.register("mouseup", this, this.passEventToSlider);
|
||||||
this.mouseDragStart = evt.xy.copyOf();
|
this.mouseDragStart = evt.xy.clone();
|
||||||
this.zoomStart = evt.xy.copyOf();
|
this.zoomStart = evt.xy.clone();
|
||||||
this.div.style.cursor = "move";
|
this.div.style.cursor = "move";
|
||||||
Event.stop(evt);
|
Event.stop(evt);
|
||||||
},
|
},
|
||||||
@@ -168,7 +168,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
|||||||
var newTop = parseInt(this.slider.style.top) - deltaY;
|
var newTop = parseInt(this.slider.style.top) - deltaY;
|
||||||
this.slider.style.top = newTop+"px";
|
this.slider.style.top = newTop+"px";
|
||||||
}
|
}
|
||||||
this.mouseDragStart = evt.xy.copyOf();
|
this.mouseDragStart = evt.xy.clone();
|
||||||
}
|
}
|
||||||
Event.stop(evt);
|
Event.stop(evt);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
|
|
||||||
// copy/set any non-init, non-simple values here
|
// copy/set any non-init, non-simple values here
|
||||||
if (this.tileSize != null) {
|
if (this.tileSize != null) {
|
||||||
obj.tileSize = this.tileSize.copyOf();
|
obj.tileSize = this.tileSize.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
// we do not want to copy reference to grid. that should stay at null
|
// we do not want to copy reference to grid. that should stay at null
|
||||||
@@ -98,7 +98,7 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
*/
|
*/
|
||||||
setTileSize: function (size) {
|
setTileSize: function (size) {
|
||||||
if (size) {
|
if (size) {
|
||||||
this.tileSize = size.copyOf();
|
this.tileSize = size.clone();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -357,8 +357,8 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
|
|
||||||
for (var i=0; i < modelRow.length; i++) {
|
for (var i=0; i < modelRow.length; i++) {
|
||||||
var modelTile = modelRow[i];
|
var modelTile = modelRow[i];
|
||||||
var bounds = modelTile.bounds.copyOf();
|
var bounds = modelTile.bounds.clone();
|
||||||
var position = modelTile.position.copyOf();
|
var position = modelTile.position.clone();
|
||||||
bounds.bottom = bounds.bottom + deltaLat;
|
bounds.bottom = bounds.bottom + deltaLat;
|
||||||
bounds.top = bounds.top + deltaLat;
|
bounds.top = bounds.top + deltaLat;
|
||||||
position.y = position.y + deltaY;
|
position.y = position.y + deltaY;
|
||||||
@@ -393,8 +393,8 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
modelTileIndex = (prepend) ? 0 : (row.length - 1);
|
modelTileIndex = (prepend) ? 0 : (row.length - 1);
|
||||||
var modelTile = row[modelTileIndex];
|
var modelTile = row[modelTileIndex];
|
||||||
|
|
||||||
var bounds = modelTile.bounds.copyOf();
|
var bounds = modelTile.bounds.clone();
|
||||||
var position = modelTile.position.copyOf();
|
var position = modelTile.position.clone();
|
||||||
bounds.left = bounds.left + deltaLon;
|
bounds.left = bounds.left + deltaLon;
|
||||||
bounds.right = bounds.right + deltaLon;
|
bounds.right = bounds.right + deltaLon;
|
||||||
position.x = position.x + deltaX;
|
position.x = position.x + deltaX;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ OpenLayers.Layer.WFS.prototype =
|
|||||||
OpenLayers.Layer.Markers.prototype.initialize.apply(this, newArguments);
|
OpenLayers.Layer.Markers.prototype.initialize.apply(this, newArguments);
|
||||||
|
|
||||||
if (options && options['tileSize']) {
|
if (options && options['tileSize']) {
|
||||||
this.tileSize = options['tileSize'].copyOf();
|
this.tileSize = options['tileSize'].clone();
|
||||||
} else {
|
} else {
|
||||||
this.tileSize = new OpenLayers.Size(256, 256);
|
this.tileSize = new OpenLayers.Size(256, 256);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
bounds = this.map.getExtent();
|
bounds = this.map.getExtent();
|
||||||
}
|
}
|
||||||
|
|
||||||
var size = this.map.getSize().copyOf();
|
var size = this.map.getSize().clone();
|
||||||
|
|
||||||
// get the url
|
// get the url
|
||||||
var url = this.getFullRequestString( {BBOX: bounds.toBBOX(),
|
var url = this.getFullRequestString( {BBOX: bounds.toBBOX(),
|
||||||
@@ -186,7 +186,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
*/
|
*/
|
||||||
loadImageDiv: function() {
|
loadImageDiv: function() {
|
||||||
|
|
||||||
var size = this.map.getSize().copyOf();
|
var size = this.map.getSize().clone();
|
||||||
var bounds = this.map.getExtent();
|
var bounds = this.map.getExtent();
|
||||||
|
|
||||||
var url = "";
|
var url = "";
|
||||||
|
|||||||
@@ -478,12 +478,12 @@ OpenLayers.Map.prototype = {
|
|||||||
// (must be done before setting this.center to new value)
|
// (must be done before setting this.center to new value)
|
||||||
this.centerLayerContainer(lonlat);
|
this.centerLayerContainer(lonlat);
|
||||||
}
|
}
|
||||||
this.center = lonlat.copyOf();
|
this.center = lonlat.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
// (re)set the layerContainerDiv's location
|
// (re)set the layerContainerDiv's location
|
||||||
if ((zoomChanged) || (this.layerContainerOrigin == null)) {
|
if ((zoomChanged) || (this.layerContainerOrigin == null)) {
|
||||||
this.layerContainerOrigin = this.center.copyOf();
|
this.layerContainerOrigin = this.center.clone();
|
||||||
this.layerContainerDiv.style.left = "0px";
|
this.layerContainerDiv.style.left = "0px";
|
||||||
this.layerContainerDiv.style.top = "0px";
|
this.layerContainerDiv.style.top = "0px";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
|
|||||||
OpenLayers.Popup.Anchored.prototype.draw.apply(this, arguments);
|
OpenLayers.Popup.Anchored.prototype.draw.apply(this, arguments);
|
||||||
|
|
||||||
// make the content Div
|
// make the content Div
|
||||||
var contentSize = this.size.copyOf();
|
var contentSize = this.size.clone();
|
||||||
contentSize.h -= (2 * OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);
|
contentSize.h -= (2 * OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);
|
||||||
|
|
||||||
var id = this.div.id + "-contentDiv";
|
var id = this.div.id + "-contentDiv";
|
||||||
@@ -72,7 +72,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
|
|||||||
|
|
||||||
if (this.contentDiv != null) {
|
if (this.contentDiv != null) {
|
||||||
|
|
||||||
var contentSize = this.size.copyOf();
|
var contentSize = this.size.clone();
|
||||||
contentSize.h -= (2 * OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);
|
contentSize.h -= (2 * OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);
|
||||||
|
|
||||||
this.contentDiv.style.height = contentSize.h + "px";
|
this.contentDiv.style.height = contentSize.h + "px";
|
||||||
|
|||||||
@@ -75,11 +75,11 @@
|
|||||||
t.ok( bounds.getSize().equals(new OpenLayers.Size(100, 110)), "getCenterPixel() works correctly");
|
t.ok( bounds.getSize().equals(new OpenLayers.Size(100, 110)), "getCenterPixel() works correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_07_Bounds_copyOf(t) {
|
function test_07_Bounds_clone(t) {
|
||||||
t.plan( 6 );
|
t.plan( 6 );
|
||||||
var oldBounds = new OpenLayers.Bounds(1,2,3,4);
|
var oldBounds = new OpenLayers.Bounds(1,2,3,4);
|
||||||
var bounds = oldBounds.copyOf();
|
var bounds = oldBounds.clone();
|
||||||
t.ok( bounds instanceof OpenLayers.Bounds, "copyOf returns new OpenLayers.Bounds object" );
|
t.ok( bounds instanceof OpenLayers.Bounds, "clone returns new OpenLayers.Bounds object" );
|
||||||
t.eq( bounds.left, 1, "bounds.left is set correctly" );
|
t.eq( bounds.left, 1, "bounds.left is set correctly" );
|
||||||
t.eq( bounds.bottom, 2, "bounds.bottom is set correctly" );
|
t.eq( bounds.bottom, 2, "bounds.bottom is set correctly" );
|
||||||
t.eq( bounds.right, 3, "bounds.right is set correctly" );
|
t.eq( bounds.right, 3, "bounds.right is set correctly" );
|
||||||
|
|||||||
@@ -26,11 +26,11 @@
|
|||||||
t.eq( lonlat.toShortString(), "5, 6", "lonlat.toShortString() returns correctly");
|
t.eq( lonlat.toShortString(), "5, 6", "lonlat.toShortString() returns correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_03_LonLat_copyOf(t) {
|
function test_03_LonLat_clone(t) {
|
||||||
t.plan( 4 );
|
t.plan( 4 );
|
||||||
oldLonLat = new OpenLayers.LonLat(5,6);
|
oldLonLat = new OpenLayers.LonLat(5,6);
|
||||||
lonlat = oldLonLat.copyOf();
|
lonlat = oldLonLat.clone();
|
||||||
t.ok( lonlat instanceof OpenLayers.LonLat, "copyOf returns new OpenLayers.LonLat object" );
|
t.ok( lonlat instanceof OpenLayers.LonLat, "clone returns new OpenLayers.LonLat object" );
|
||||||
t.eq( lonlat.lon, 5, "lonlat.lon is set correctly");
|
t.eq( lonlat.lon, 5, "lonlat.lon is set correctly");
|
||||||
t.eq( lonlat.lat, 6, "lonlat.lat is set correctly");
|
t.eq( lonlat.lat, 6, "lonlat.lat is set correctly");
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,11 @@
|
|||||||
t.eq( pixel.toString(), "x=5,y=6", "pixel.toString() returns correctly");
|
t.eq( pixel.toString(), "x=5,y=6", "pixel.toString() returns correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_03_Pixel_copyOf(t) {
|
function test_03_Pixel_clone(t) {
|
||||||
t.plan( 4 );
|
t.plan( 4 );
|
||||||
oldPixel = new OpenLayers.Pixel(5,6);
|
oldPixel = new OpenLayers.Pixel(5,6);
|
||||||
pixel = oldPixel.copyOf();
|
pixel = oldPixel.clone();
|
||||||
t.ok( pixel instanceof OpenLayers.Pixel, "copyOf returns new OpenLayers.Pixel object" );
|
t.ok( pixel instanceof OpenLayers.Pixel, "clone returns new OpenLayers.Pixel object" );
|
||||||
t.eq( pixel.x, 5, "pixel.x is set correctly");
|
t.eq( pixel.x, 5, "pixel.x is set correctly");
|
||||||
t.eq( pixel.y, 6, "pixel.y is set correctly");
|
t.eq( pixel.y, 6, "pixel.y is set correctly");
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,12 @@
|
|||||||
t.eq( size.toString(), "w=5,h=6", "size.toString() returns correctly");
|
t.eq( size.toString(), "w=5,h=6", "size.toString() returns correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_03_Size_copyOf(t) {
|
function test_03_Size_clone(t) {
|
||||||
t.plan( 4 );
|
t.plan( 4 );
|
||||||
|
|
||||||
oldSize = new OpenLayers.Size(5,6);
|
oldSize = new OpenLayers.Size(5,6);
|
||||||
size = oldSize.copyOf();
|
size = oldSize.clone();
|
||||||
t.ok( size instanceof OpenLayers.Size, "copyOf returns new OpenLayers.Size object" );
|
t.ok( size instanceof OpenLayers.Size, "clone returns new OpenLayers.Size object" );
|
||||||
t.eq( size.w, 5, "Size.w is set correctly");
|
t.eq( size.w, 5, "Size.w is set correctly");
|
||||||
t.eq( size.h, 6, "Size.h is set correctly");
|
t.eq( size.h, 6, "Size.h is set correctly");
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,8 @@
|
|||||||
array.remove(3);
|
array.remove(3);
|
||||||
t.eq( array.toString(), "0,1,2,4,5,6", "array.remove works");
|
t.eq( array.toString(), "0,1,2,4,5,6", "array.remove works");
|
||||||
|
|
||||||
copy = array.copyOf();
|
copy = array.clone();
|
||||||
t.eq( copy.toString(), "0,1,2,4,5,6", "array.copyOf() works");
|
t.eq( copy.toString(), "0,1,2,4,5,6", "array.clone() works");
|
||||||
array.append(7);
|
array.append(7);
|
||||||
t.eq( copy.toString(), "0,1,2,4,5,6", "changing a value in the copied array doesnt affect the new array");
|
t.eq( copy.toString(), "0,1,2,4,5,6", "changing a value in the copied array doesnt affect the new array");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user