[OpenLayers-Users] How connect the editing toolbar to a layer on the fly

Arnd Wippermann arnd.wippermann at web.de
Sat Oct 6 17:31:20 EDT 2007


Hello Pierre,

Building my own edit control with use of the panel control works great. With
thi control I also have managed to swap  the control on the fly between
layers in the way I have previous tried.

Thanks for the hint.

Mit freundlichen Grüssen

Arnd Wippermann
http://gis.ibbeck.de/ginfo/

-----Ursprüngliche Nachricht-----
Von: bluecarto at gmail.com [mailto:bluecarto at gmail.com] 
Gesendet: Samstag, 6. Oktober 2007 00:31
An: Arnd Wippermann
Cc: users at openlayers.org
Betreff: Re: [OpenLayers-Users] How connect the editing toolbar to a layer
on the fly

I don't really know how you added buttons to the existing toolbar, but you
might want to have a look at the panel control.
This would allow you to build your own toolbar, including the controls you
need.
http://openlayers.org/dev/examples/panel.html

And, as editingToolbar is "a" panel, you can also add controls to it :

var p = new OpenLayers.Control.EditingToolbar(vlayer);
p.addControls(new OpenLayers.Control.SelectFeature(vlayer,
{'multiple':true}));

Regards

On 10/4/07, Arnd Wippermann <arnd.wippermann at web.de> wrote:
> 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
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>




More information about the Users mailing list