[OpenLayers-Dev] Issue with Layer.clone()
Adam Ratcliffe
adam at prema.co.nz
Thu Jul 22 22:59:47 EDT 2010
Hi,
I'm having an issue with the OpenLayers.Layer.clone() method.
If the layer being cloned is a Vector layer, the source layer's Protocol object will be copied by reference to the clone object. If the cloned layer's destroy() method is called the shared Protocol object will be destroyed and the source layer will cease to function.
A possible solution would be to implement a clone() method on both the Protocol and Strategy interfaces and use this method when cloning the layer e.g.
for(var property in source) {
var value = source[property];
if(value !== undefined) {
if(value.clone) {
value = value.clone();
}
destination[property] = value;
}
}
Cheers
Adam
More information about the Dev
mailing list