[OpenLayers-Trac] [OpenLayers] #739: Radiobuttons and MouseToolbar for GetFeatureInfo and GetLegendGraphics

OpenLayers trac at openlayers.org
Tue Jun 5 04:50:48 EDT 2007


#739: Radiobuttons and MouseToolbar for GetFeatureInfo and GetLegendGraphics
----------------------------------------------------+-----------------------
 Reporter:  openlayers                              |       Owner:  euzuro     
     Type:  feature                                 |      Status:  new        
 Priority:  trivial                                 |   Milestone:  2.5 Release
Component:  Control.LayerSwitcher                   |     Version:  2.4 RC5    
 Keywords:  WMS, getFeatureInfo, getLegendGraphics  |  
----------------------------------------------------+-----------------------
 For the possibility to select a WMS-Layer in the LayerSwitcher and to
 select the features in the map respectively we need radiobuttons in the
 LayerSwitcher object and a different MouseToolbar.
 Therefore we added radiobuttons with the name "querybutton" in the redraw
 function of the LayerSwitcher Control in LayerSwitcher.js and added a
 Button with the name "get" and Icons "info-on.png"/"info-off.png" to
 switch between getFeatureInfo request mode and zomm or pan mode.

 To use the map click event for sending the GetFeatureInfo request we wrote
 a separate function getfeatureinfo(e) which could be also a part of
 OpenLayers objectlibrary. But which object it may concern? A new
 GetFeatureRequestResponseControl?

 Other functions are discussed and realized in separate functions for the
 first in the project we are involved in like GetLegendGraphics and "create
 pdf" function for printing in heigher resolution.

 Have a look also to the related project FIS-RO Niedersachsen.

 The functions, and files are appended below based on the sourcecode from
 release 2.3. Could you include this in one of the next releases, or is
 there any other activity to implement these functions. I did not found it
 in tickets.

   function getfeatureinfo(e){
     if(map.controls[0].mode == "get"){
       for(i = 0; i < layers.length; i++){
         if(document.getElementsByName("querybutton")[i].checked == true){
                 layer = layers[i];
                 show = true;
         }
       }
       if(show){
         var url =  layer.getFullRequestString({
                           REQUEST: "GetFeatureInfo",
                           EXCEPTIONS: "application/vnd.ogc.se_xml",
                           BBOX: layer.map.getExtent().toBBOX(),
                           X: e.xy.x,
                           Y: e.xy.y,
                           INFO_FORMAT: 'text/html',
                           QUERY_LAYERS: layer.params.LAYERS,
                           WIDTH: layer.map.size.w,
                           HEIGHT: layer.map.size.h});
         featureinfo = window.open(url, "GetFeatureInfo", "dependent=yes,
 height=200, width=800, left=200, top=400");
         featureinfo.focus();
       }
       Event.stop(e);
     }
   }

   function showLegendGrafik(){
                 // durchläuft alle Layer
                 for(i = 0; i < layers.length; i++){
                         // holt sich das Layerformobjekt
                         var layerformobject =
 document.getElementById("aktivlayer"+i);
                         // fragt ab welche Layer aktiv sind
                         if(document.getElementById("input_" +
 layers[i].name).checked==true) {
                                 // trägt für alle aktiven Layer die Links
 für die Legendengrafik ein
                                 layerformobject.value =
 layers[i].getFullRequestString({
 REQUEST: "GetLegendGraphic",
 EXCEPTIONS: "application/vnd.ogc.se_xml"});
                         }
                         else {
                                 // die values von nicht aktiven Layers
 werden geleert
                                 layerformobject.value = "";
                         }
                 }
                 legendgraphic = window.open("about:blank",
 "Legendenfenster", "width=390,height=570,toolbar=no,resizable,status=yes,
 scrollbars=yes");
                 var formlayerstatus =
 document.getElementById("layerstatus");
                 formlayerstatus.submit();
                 legendgraphic.focus();
   }

-- 
Ticket URL: <http://trac.openlayers.org/ticket/739>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list