[OpenLayers-Users] How connect the editing toolbar to a layer
on the fly
Arnd Wippermann
arnd.wippermann at web.de
Thu Oct 4 19:22:06 EDT 2007
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: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Tim Schaub
Gesendet: Donnerstag, 4. Oktober 2007 21:41
An: users at openlayers.org
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
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list