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

Adam Ratcliffe adam at prema.co.nz
Fri Jul 23 03:22:26 EDT 2010


http://trac.openlayers.org/ticket/2749

Cheers
Adam

On 23/07/2010, at 5:49 PM, Tim Schaub wrote:

> 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.
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev




More information about the Dev mailing list