'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,
projection:'EPSG:NONE',
singleTile:true,//是否瓦片图
buffer:0,//默认为2,0下载更快
reproject: true,
opacity: "0.8",
isBaseLayer: true//确定该图层是否是基础图层
}
);
map.addLayers([wmsLayer]);
现在选中checkbox的时候可以显示地图,但每次选中的checkbox的时候都会新生出一个图层来显示地图,不是在原有的地图上刷新显示.
如何才能让它在选择checkbox的时候刷新显示地图呢?
希望能够得到大家的帮助,谢谢!
------解决方案--------------------
不知道 lz的前一段代码是什么意思
如果是要刷新图层的话 layer里面有个方法redraw
------解决方案--------------------
学习了....