Ticket #2749 (new bug)

Opened 3 years ago

Last modified 17 months ago

OpenLayers.Layer.clone() does not clone properties of Object type correctly

Reported by: aratcliffe Owned by: crschmidt
Priority: major Milestone: 2.13 Release
Component: Layer.Vector Version: 2.9
Keywords: Cc: adube, zjames, belug
State:

Description

When cloning a Vector layer the source layer's protocol and any configured strategies will be copied by reference to the clone object. If the cloned layer's destroy() method is called the shared protocol and strategy objects 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;

}

}

Attachments

wfs_clone_2749.patch Download (7.3 KB) - added by zjames 21 months ago.
patch against [12346]

Change History

Changed 3 years ago by fredj

  • milestone changed from 2.10 Release to 2.11 Release

No patch, bumping.

Changed 22 months ago by adube

  • cc adube added

Changed 21 months ago by zjames

patch against [12346]

Changed 21 months ago by zjames

Attached a patch that resolves the problem but may not be a good approach to the broader problem. Rather than testing for clone methods on contained objects, perhaps Util should have a deep copy function that could be used in place of applyDefaults when cloning.

Changed 21 months ago by zjames

  • cc zjames added

Changed 17 months ago by belug

  • cc belug added
Note: See TracTickets for help on using tickets.