[OpenLayers-Users] VisibilityChanged event handler

Erik Uzureau erik.uzureau at metacarta.com
Wed Apr 18 11:47:47 EDT 2007


dmitri, since they are all overlays,
I think you must work with the

updateMap() function in layerswitcher.

You can try something like this:

OpenLayers.Control.LayerSwitcher.prototype._updateMap =
    OpenLayers.Control.LayerSwitcher.prototype.updateMap;
OpenLayers.Control.LayerSwitcher.prototype.updateMap =
    function() {
        this._updateMap();

        //make your test, do your action
    };




On 4/18/07, Dmitri Mizerkin <eisberg at gmail.com> wrote:
>
> I'm afraid the "changebaselayer" event won't help me out, because all the
> selectable layers I use are overlays.
> So there's no way to do it, is there? Well, I'll look for a workaround,
> but it would be great if this feature was in the newest release.
>
> Thanks anyway!
>
> Cheers,
> Dmitri
>
> On 4/18/07, Schuyler Erle <sderle at metacarta.com> wrote:
> >
> > Dmitri, I think we would accept a patch for 2.5 if you or anyone else
> > wanted to submit one for this.
> >
> > SDE
> >
> > On Wed, 2007-04-18 at 10:22 -0500, Erik Uzureau wrote:
> > > Hi Dmitri,
> > >
> > > For right now the best solution I can think of is to listen for the
> > > "changebaselayer" event on the map. When the user clicks a different
> > > baselayer, this gets fired.
> > >
> > > Erik
> > >
> > >
> > > On 4/18/07, Dmitri Mizerkin <eisberg at gmail.com> wrote:
> > >         Hello List,
> > >
> > >         I am using layer pairs in my map, one of those for selection.
> > >         I would like to remove the selection layer from the map as
> > >         soon as the user removes the main layer using the layer
> > >         switcher. Is it possible to register some "visibilityChanged"
> > >         event handler, so that it calls a function as soon as its
> > >         visibility parameter changes?
> > >         It could be something like that:
> > >
> > >         layer.events.register("visibilityChanged", layer, function(e)
> > >         {} );
> > >
> > >         Maybe there is some way to register the event in the layer
> > >         switcher control as well, which could call the function as
> > >         soon as it has changes?
> > >
> > >         Thanks in advance!
> > >         Dmitri
> > >         _______________________________________________
> > >         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
> >
> >
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070418/0e88cc1e/attachment.html


More information about the Users mailing list