[OpenLayers-Users] Re: editing tool on multiple layers

Jørgen S. Nicolaysen jsni at uglandit.com
Mon Apr 18 02:54:33 EDT 2011


You may try something like this:
layer1.events.on( {
  'featureadded': FeatureAdded,
  'scope': layer1
}); 
layer2.events.on( {
  'featureadded': FeatureAdded,
  'scope': layer2
}); 
function FeatureAdded() {
  alert(this.name);
}


The 'scope' property lets you use the keyword 'this' as a reference to the
layer. 
And yes, remember to unregister events if you need to destroy the layer,
with the 'un' function :
layer2.events.un( {
'featureadded': FeatureAdded,
'scope': layer2
}); 



--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/editing-tool-on-multiple-layers-tp6276636p6282577.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110417/d4f59835/attachment.html


More information about the Users mailing list