[OpenLayers-Users] visibilitychanged event

Vidal, Antoni antoni.vidal at icc.cat
Fri Jun 5 09:21:43 EDT 2009


Hello,

 

I need to saw an alert when user active a wms layer when a specific baseLayer is active. With the following code I get twice, but I don't undestand why.

 

 ct1m.events.register("visibilitychanged",this,function(event){

   alert("vis: "+ct1m.getVisibility());

var capaBase = this.map.baseLayer.params.LAYERS;

      if(capaBase == "orto"){

            ct1m.events.unregister("visibilitychanged",this,function(event){alert("hello");});

            ct1m.setVisibility(false);

            alert("Layer not available");

      }else{

          ct1m.events.register("moveend", this, function(event){

              var res = this.map.getResolution();

              if(res == 0.25) ct1m.setOpacity(1);

              else ct1m.setOpacity(0.7);

          });

}

});

 

 

The sequence is, Vis: true -> Vis: false  -> Layer not available -> Layer not available 

 

Any idea?

 

Thank's in advance.

 

Antoni Vidal

Unitat d'Aplicacions SIG-WEB
Institut Cartogràfic de Catalunya <http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392> 
Parc de Montjuïc, E-08038 Barcelona
Tel. (+34) 93 567 15 00 (ext. 3228)
www.icc.cat <http://www.icc.cat/> 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090605/69f405eb/attachment.html


More information about the Users mailing list