[OpenLayers-Users] setVisibility VS visibility:false

Eric Lemoine eric.c2c at gmail.com
Fri Jan 30 00:45:24 EST 2009


Hi

It does make any difference at creation time as far as I know. I
personally find it more elegant to pass the initial visibility as a
config option.

Eric

2009/1/29, Alexandre Dube <adube at mapgears.com>:
> Sorry, I meant only on layer creation only.  I see in some examples this
> kind of practice :
>
>         var twms = new OpenLayers.Layer.WMS("base_world",
>             "http://world.freemap.in/cgi-bin/mapserv?",
>             {
>                 map: '/www/freemap.in/world/map/factbooktrans.map',
>                 layers: 'factbook',
>                 format: 'image/png'
>             }
>         );
>         twms.setVisibility(false);
>         map.addLayer(twms);
>
> ... insead of using {visibility:false}. I guess there's no particular
> reason for that or did someone had an issue using {visibility:false} ?
>
>
> Eric Lemoine wrote:
>> On Thu, Jan 29, 2009 at 9:00 PM, Alexandre Dube <adube at mapgears.com>
>> wrote:
>>
>>> Hi list,
>>>
>>>  Is there a difference between layer.setVisibility(false) and the
>>> {visibility:false} option directly specified in the layer ?  Is one a
>>> better practice than the other ?
>>>
>>
>> You'll use setVisibility if you need to change the visibility after
>> the layer creation, when some button is clicked for example.
>>
>> --
>> Eric
>>
>
>
> --
> Alexandre Dubé
> Mapgears
> www.mapgears.com
>
>



More information about the Users mailing list