[OpenLayers-Users] SelectFeature control: adding dynamically a
selectable layer
Andreas Hocevar
ahocevar at opengeo.org
Sun Jun 21 11:28:32 EDT 2009
Hi,
On Fri, Jun 19, 2009 at 4:12 PM, Simone Gadenz<simone.gadenz at jrc.it> wrote:
> I am using successfully the SelectFeature control with a list of layers but,
> since my application allows the users to add other GeoRSS and KML layers
> dynamically, I would like to make them selectable.
>
> Looking at the code it seems it is not implemented. In your opinion what is
> the best implementation strategy to write this function? So far I though
> only two possibilities:
>
> 2- Implementing the addLayer, removeLayer methods into the
> selectFeature control
>
> I would prefer the second but I cannot understand fully the role of the
> RootContainer. Do I have to destroy it and reinitialize, or are there other
> alternatives?
Have a look at the collectRoots and resetRoots methods of the
RootContainer. The root container collects the SVG/VML root nodes of
the selectable layers and moves them to the top of the layer stack.
This is required to get events on all selectable layers. The
RootContainer layer itself has to be on top of the layer stack, which
is enforced in the SelectFeature control by adding the layer to the
map when activating the control, and removing it when deactivating.
If you want to implement that (or contract someone to implement it for
you) and contribute it back to OpenLayers, you may want to continue
this thread on dev at openlayers.org, and have a look at
http://trac.openlayers.org/wiki/HowToContribute.
> I also found a small bug performing multiple selections through the SHIFT
> key in Firefox. As result it opens a new FF windows, also in the example on
> the official website. Somebody solved that already?
I don't remember that it was reported, so you might want to create a
ticket with a detailled description. See
http://trac.openlayers.org/wiki/FilingTickets for details.
Regards,
Andreas.
>
>
>
> Thank you all
>
>
>
> Simone
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list