代码拉取完成,页面将自动刷新
function layerControl(){
this.defaultAnchor = BMAP_ANCHOR_TOP_LEFT;
this.defaultOffset = new BMap.Size(15, 197);
}
layerControl.prototype = new BMap.Control();
layerControl.prototype.initialize = function(map){
var i = new Image();
i.src="layer32.png";
i.onclick=showLayers;
map.getContainer().appendChild(i);
return i;
}
var layerCtrl = new layerControl();
map.addControl(layerCtrl);
function layerSelector(){
this.defaultAnchor = BMAP_ANCHOR_TOP_LEFT;
this.defaultOffset = new BMap.Size(50, 0);
}
layerSelector.prototype = new BMap.Control();
var layers={
//xinye:"新叶",leihuo:"雷火",
pregnant:"孕妇",children:"小孩",cure:"收治",definite:"确诊",
helped:"已救助",suspected:"高度疑似",possible:"无法排除",contact:"有接触",passaway:"逝者",all:"全部"}
layerSelector.prototype.initialize = function(map){
var d = document.createElement("DIV");
var html=[]
html.push("<form onchange=layerchange(layer.value)><table>");
for(var t in layers){
if(t!="invalidaddress"){
html.push("<tr><td><input type=radio name=layer id=l_"+t+" value="+t+"><label for=l_"+t+" style='color:"+caseTypes[t].color+"'>"+layers[t]+"</label></td></tr>")
}
}
if(layers["invalidaddress"])html.push("<tr><td>地址不详:"+layers["invalidaddress"]+"</td></tr>")
html.push("</table></form>");
d.innerHTML = html.join("");
with(d.style){
border="1px solid gray";
backgroundColor="#eeeeee"
whiteSpace="nowrap"
fontSize="medium"
left="40px";
}
map.getContainer().appendChild(d);
return d;
}
function showLayers(){
var s = layerSltr
var c = layerCtrl;
if(s.isVisible()){
s.hide()
}else{
s.show()
s.setOffset(new BMap.Size(c.getOffset().width+60,
c.getOffset().height>150?c.getOffset().height-150:0))
}
}
var currentLayer="all"
var layerSltr;
function layerchange(type){
if(!layerSltr){
layerSltr = new layerSelector();
map.addControl(layerSltr);
layerSltr.hide();
}
if(!type) type=currentLayer;
drawMapv(type)
currentLayer=type;
layerSltr.hide();
var t=12;
if(document.getElementsByClassName("BMap_stdMpCtrl").length>0){
t=document.getElementsByClassName("BMap_stdMpCtrl")[0].offsetHeight+12;
}
layerCtrl.setOffset(new BMap.Size(15, t))
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。