[OpenLayers-Users] LayerSwitcher

Bart van den Eijnden bartvde at osgis.nl
Thu Feb 25 11:57:38 EST 2010


Hanno,

the constructor takes 1 argument, so use:

new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('mapSwitcher'), roundedCorner:false});

Best regards,
Bart

On Feb 25, 2010, at 9:32 AM, Rahn Hanno (rahn) wrote:

> hello again,
>  
> I try to realise Barts tips, but I have a little problem it doesn't work and I don't see my fault. I can't "delete" the rounded Corners of my layerswitcher. Perhaps somebody can give me a code example?
> I try it like this in my openlayers side:
>  
> //create the layerswitcher
> map.addControl(new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('mapSwitcher')},{roundedCorner:false}));
> //make the background not transparent and gray
>    if (navigator.appName == 'Microsoft Internet Explorer') {
>     document.getElementById('OpenLayers.Control.LayerSwitcher_32_layersDiv').style.filter ="alpha(opacity = 100)";
>    }
>    if (navigator.appName == 'Netscape') {
>  
>     document.getElementById('OpenLayers.Control.LayerSwitcher_32_layersDiv').style.opacity ="1";
>    }
>    document.getElementById('OpenLayers.Control.LayerSwitcher_32_layersDiv').style.backgroundColor="#e9e9e4";
>  
> // to place the layerswitcher div  
>  OpenLayers.Util.getElement('mapSwitcher').style.width = "200";
>    OpenLayers.Util.getElement('mapSwitcher').style.color = "black";
>    OpenLayers.Util.getElement('mapSwitcher').style.position = "absolute";
>    OpenLayers.Util.getElement('mapSwitcher').style.top = "400";
>    OpenLayers.Util.getElement('mapSwitcher').style.left = "5";
>  
> you can see my side here:
>  
> http://webgis.hsw.ch/GINES_V1.2/Start.php
>  
> Greetings and a lot of thanks
>  
> Hanno Rahn
> ------------------------------------------ 
> Hanno Rahn, Dipl.-Ing. (FH) Geoinformatik 
> ZHAW Zürcher Hochschule für Angewandte Wissenschaften Umwelt und Natürliche Ressourcen 
> Fachstelle Geoinformatik 
> Grüental, Postfach CH-8820 Wädenswil 
> Tel +41 (0)58 934 5592 
> Fax +41 (0)58 934 5580 
> hanno.rahn at zhaw.ch 
> www.iunr.zhaw.ch/geoinformatik
> 
> 
>  
> 
>  
> 
> Von: Bart van den Eijnden [mailto:bartvde at osgis.nl] 
> Gesendet: Donnerstag, 25. Februar 2010 07:43
> An: Rahn Hanno (rahn)
> Cc: users at openlayers.org
> Betreff: Re: [OpenLayers-Users] LayerSwitcher
> 
> Hi,
> 
> the layerswitcher.html example already shows how to place it in another div.
> 
> Wrt the other question, set the following API properties:
> 
>     /**
>      * APIProperty: roundedCorner
>      * {Boolean} If true the Rico library is used for rounding the corners
>      *     of the layer switcher div, defaults to true.
>      */
>     roundedCorner: true,
> 
>     /**
>      * APIProperty: roundedCornerColor
>      * {String} The color of the rounded corners, only applies if roundedCorner
>      *     is true, defaults to "darkblue".
>      */
>     roundedCornerColor: "darkblue",
> 
> Best regards,
> Bart
> 
> On Feb 25, 2010, at 7:32 AM, Rahn Hanno (rahn) wrote:
> 
>> 
>> Hello list,
>> 
>> Perhaps you can help me with another question. I try to make the layerswitcher more individual. First I want to show it at another place in an extra div and not at the right border. But I can't find where I have to do this. Then I want to change the color of the div. The darkblue is not good for my webside. I try to make it with css directly in my page. It works but I always get terrible blue span tags over the div and under the div object with the layer switcher. Can perhaps somebody help me to arrange the layerswitcher somewhere else on the screen with a width of 200px and a height of 500px. And can somebody tell me how to change the color of the div and the layernames?
>> 
>> Thank you for your help.
>> 
>> Greetings 
>> Hanno 
>>   
>> ------------------------------------------ 
>> Hanno Rahn, Dipl.-Ing. (FH) Geoinformatik 
>> ZHAW Zürcher Hochschule für Angewandte Wissenschaften Umwelt und Natürliche Ressourcen 
>> Fachstelle Geoinformatik 
>> Grüental, Postfach CH-8820 Wädenswil 
>> Tel +41 (0)58 934 5592 
>> Fax +41 (0)58 934 5580 
>> hanno.rahn at zhaw.ch 
>> www.iunr.zhaw.ch/geoinformatik
>> 
>> 
>>  
>> 
>> _______________________________________________
>> 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/20100225/d8b10af0/attachment.html


More information about the Users mailing list