[OpenLayers-Dev] Issue with Layer.clone()

Tim Schaub tschaub at opengeo.org
Fri Jul 23 01:49:55 EDT 2010


On 7/22/10 8:59 PM, Adam Ratcliffe wrote:
> 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.
>

This is certainly an issue.  Please open a ticket.

Tim

> for(var property in source) { var value = source[property]; if(value
> !== undefined) { if(value.clone) { value = value.clone(); }
> destination[property] = value; } }
>
> Cheers Adam _______________________________________________ Dev
> mailing list Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Dev mailing list