[OpenLayers-Users] adding custom controls to layer switcher?
Franz Buchinger
fbuchinger at gmail.com
Wed Aug 4 04:11:49 EDT 2010
Hi Imran,
if you want to extent the layer switcher with custom functionality, the
cleanest way is to derive your own CustomLayerSwitcher class from
Control.LayerSwitcher.
You just need to redefine the redraw() method, where all the HTML of the
Control is assembled.
OpenLayers.Control.MyCustomLayerSwitcher =
OpenLayers.Class(OpenLayers.Control.LayerSwitcher,{
redraw: function (){
//copy this method from lib/openlayers/control/layerswitcher.js and
change it to your needs
},
CLASSNAME: "OpenLayers.Control.MyCustomLayerSwitcher"
});
you would then use your layerswitcher like so:
mylayerswitcher = new OpenLayers.Control.MyCustomLayerSwitcher();
mymap.addControl(mylayerswitcher);
kind regards,
Franz
2010/8/4 Imran Rajjad <rajjad at gmail.com>
> Hi list,
>
> is it possible to add checkbox and text to the layer switcher which
> have custom functionality , I have a set of checkboxes that when
> interacted with apply filters to a wms layer..i want these check boxes
> to appear beneath that layer instead of somewhere outside, so i was
> wondering , if ther;s a way to add these checkboxes and there text to
> layer switcher..is it possible to get that div by classname and append
> custom controls in it?
>
> regards,
> Imran
>
> --
> I.R
> _______________________________________________
> 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/20100804/0430734b/attachment.html
More information about the Users
mailing list