ArcIMS layer does not have a proper clone method. patch=bartvde,
r=me, tests pass in Safari and IE, (Closes #2490) git-svn-id: http://svn.openlayers.org/trunk/openlayers@10666 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -420,6 +420,29 @@ OpenLayers.Layer.ArcIMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: clone
|
||||||
|
* Create a clone of this layer
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {<OpenLayers.Layer.ArcIMS>} An exact clone of this layer
|
||||||
|
*/
|
||||||
|
clone: function (obj) {
|
||||||
|
|
||||||
|
if (obj == null) {
|
||||||
|
obj = new OpenLayers.Layer.ArcIMS(this.name,
|
||||||
|
this.url,
|
||||||
|
this.getOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
//get all additions from superclasses
|
||||||
|
obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]);
|
||||||
|
|
||||||
|
// copy/set any non-init, non-simple values here
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: addTile
|
* Method: addTile
|
||||||
|
|||||||
+35
-1
@@ -83,7 +83,41 @@
|
|||||||
t.eq( typeof layer.options.layers[0].query.where, "string", "where query is a string" );
|
t.eq( typeof layer.options.layers[0].query.where, "string", "where query is a string" );
|
||||||
t.eq( layer.options.layers[0].query.where, querydef.where, "where query matches" );
|
t.eq( layer.options.layers[0].query.where, querydef.where, "where query matches" );
|
||||||
}
|
}
|
||||||
|
function test_Layer_ArcIMS_clone (t) {
|
||||||
|
t.plan(5);
|
||||||
|
|
||||||
|
var url = imsUrl;
|
||||||
|
var options = {
|
||||||
|
serviceName: serviceName,
|
||||||
|
async: false,
|
||||||
|
displayOutsideMaxExtent: true
|
||||||
|
};
|
||||||
|
var map = new OpenLayers.Map('map', {controls: []});
|
||||||
|
var layer = new OpenLayers.Layer.ArcIMS(name, url, options);
|
||||||
|
map.addLayer(layer);
|
||||||
|
|
||||||
|
layer.grid = [ [6, 7],
|
||||||
|
[8, 9]];
|
||||||
|
|
||||||
|
var clone = layer.clone();
|
||||||
|
|
||||||
|
t.ok( clone.grid != layer.grid, "clone does not copy grid");
|
||||||
|
|
||||||
|
t.ok( clone.tileSize.equals(layer.tileSize), "tileSize correctly cloned");
|
||||||
|
|
||||||
|
t.eq( clone.params.serviceName, layer.params.serviceName, "serviceName copied correctly");
|
||||||
|
|
||||||
|
t.eq( clone.async, layer.async, "async copied correctly");
|
||||||
|
|
||||||
|
t.eq( clone.url, layer.url, "url copied correctly");
|
||||||
|
|
||||||
|
layer.grid = null;
|
||||||
|
map.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
</html>
|
<body>
|
||||||
|
<div id="map" style="width:500px;height:550px"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user