In parts I have managed in a easy way to swap the control from one layer to another.
editControl.destroy(); var lyr = map.layers[AktLyr]; editControl = new OpenLayers.Control.EditingToolbar(lyr); map.addControl(editControl); But I have used the editingtoolbar.js, have it modified to insert a button for selectFeature and modifyFeature. When I first add the toolbar to the "Editable" layer, all buttons work. When I swap to another layer, it works also. But when I swap a second time the two added buttons works for the previous layer and not for the new one. This means, I can draw features on one layer, but I'm not able to select this features. Mit freundlichen Grüssen Arnd Wippermann http://gis.ibbeck.de/ginfo/ -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Tim Schaub Gesendet: Donnerstag, 4. Oktober 2007 21:41 An: [email protected] Betreff: Re: [OpenLayers-Users] How connect the editing toolbar to a layer on the fly Hey- Christopher Schmidt wrote: > On Thu, Oct 04, 2007 at 03:28:19PM +0200, Arnd Wippermann wrote: >> Is there a way to connect the editing toolbar to a specific layer on >> the fly. > > Doesn't look like it. It looks like you could break the abstraction > barrier, dive in, and change the layer property on each of the > controls > -- if you weren't editing at the time, that might work. I'm not sure. This should be made easier. If you want to see how I've done it, take a look at the (not for production, not to be considered stable, for demonstration purposes only) FeatureEditor control with a change layer method: http://trac.openlayers.org/browser/sandbox/tschaub/wfsv/lib/OpenLayers/Contr ol/FeatureEditor.js#L162 All that should be cleaner. Basically, you need a way to swap out the handler that the draw/modify controls use. Tim > > Regards, _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
