当前位置: 代码迷 >> GIS >> openlayers在通过checkbox传值时怎么刷新显示,而不是新增一个map显示
  详细解决方案

openlayers在通过checkbox传值时怎么刷新显示,而不是新增一个map显示

热度:121   发布时间:2016-05-05 06:21:37.0
openlayers在通过checkbox传值时如何刷新显示,而不是新增一个地图显示
'click':function(node){
              //checkbox怎么获取到
             if(node.attributes["tagName"]=="slayer"){
              showDir(node);
      if (activeTheme == null){
       activeTheme = node.parentNode;
       
      }
      if(activeTheme != node.parentNode){

       for(var ii=0; ii<activeTheme.childNodes.length; ii++){
        var chld = activeTheme.childNodes[ii];
        chld.attributes.checked = false;
         chld.ui.toggleCheck(false);
        visibleLayers.deleted(chld.attributes["layerid"]);
       }
       //clearEye(activeTheme);
       //记录当前活动类别
       activeTheme = node.parentNode;
       visibleLayers.add(node.attributes["layerid"]);
              }
              //显示矢量图层
              init(visibleLayers);
      return;
             }
            }



选中checkbox的时候,把值传到 init(visibleLayers)方法,显示地图.



wmsLayer=new OpenLayers.Layer.WMS("wmsLayer","http://192.16.1.76/service/GovEMap/wms", 
                  {
                    LAYERS:visibleLayers,//获取checkbox传过来的值
                    version:'1.0.0',
                    request:'GetMap',
                    ServiceName:'FZ_VECTMAP_WMS',
                    bbox:'424765,2882137,434662,2889527',
                    format:'image/png',
                    srs:'EPSG:NONE',
                    TRANSPARENT:'false',
                    service:'WMS'
               },
                    {
                    maxExtent:bounds,
  相关解决方案