How to create user defined control

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to create user defined control

manish
This post has NOT been accepted by the mailing list yet.
Hello all, I want to create a new control in openlayers. Functionality of new control will be: ============================== 1. there will be two buttons in control. and a container div. All three will be inside another outer (main) div. 2. On click of first button it will show all wfs layers list in div container below that button. 3. On click of second button it will show all wms layers list in div container below that button. 4. After that from the list of (WMS/WFS) layer, user will be able to add any layer on map by selecting that layer from list. I am able to do the same by taking a div element on html page. It is working fine. Also showing the layers on map. I want create a control for the same and distribute to the community, so that anyone can use this control directly. I have checked out the openlayers tree from GIT for the same and going through the code, but not getting much idea to create the same. Please help me to guide for the same. Thanks in advance. Manish
Reply | Threaded
Open this post in threaded view
|

Re: How to create user defined control

pankaj123
This post has NOT been accepted by the mailing list yet.
I also want the same functionality but via extending of openlayers control. I have a html span elememt and a div element inside outer div. I need to show all layers by clicking on that span element. Currently i am doing the same with html div element and showing it right side of my viewer application. I want to do the same via extending of openlayers control like given example: var control = new OpenLayers.Control(); OpenLayers.Util.extend(control, { draw: function () { // this Handler.Box will intercept the shift-mousedown // before Control.MouseDefault gets to see it this.box = new OpenLayers.Handler.Box( control, {"done": this.notice}, {keyMask: OpenLayers.Handler.MOD_SHIFT}); this.box.activate(); }, notice: function (bounds) { OpenLayers.Console.userError(bounds); } }); map.addControl(control); But do not know how to add these div elements with click event and show them inside openlayers map. Please help it is very important task for me. Thanks, Pankaj