2 Star 11 Fork 3

emu/looking4help

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
index.html 5.17 KB
一键复制 编辑 原始数据 按行查看 历史
emu 提交于 2020-02-25 14:57 . update index.html.
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
#map {
width: 100%;
height: 100%;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
</style>
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=4d1f8197ee08aecbbc9ed79ca3adbeb2"></script>
<script type="text/javascript" src="//mapv.baidu.com/build/mapv.js"></script>
<script src="geoHash.js"></script>
<title>武汉求助者分布图</title>
</head>
<body>
<div id="allmap"></div>
<canvas id="canvas"></canvas>
</body>
<script type="text/javascript">
// 百度地图API功能
var map = new BMap.Map("allmap");
// 创建地址解析器实例
var myGeo = new BMap.Geocoder();
// 将地址解析结果显示在地图上,并调整地图视野
var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角,添加比例尺
var top_left_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_LEFT});
map.addControl(top_left_control);
map.addControl(top_left_navigation);
map.centerAndZoom(new BMap.Point(114.3,30.55), 13);
map.addEventListener("zoomstart", function(){map.clearOverlays()})
map.addEventListener("zoomend", function(){drawMapv()})
map.enableScrollWheelZoom(true);
var mapvLayer,mapvData={"all":[]},options={methods: {click:show,tap:show}}
var caseTypes={
xinye:{cn:"新叶",color:"rgba(200, 0, 0, .8)"},
leihuo:{cn:"雷火",color:"rgba(255,0, 0, 1)"},
pregnant:{cn:"孕妇",color:"rgba(255,0,200, .8)"},
children:{cn:"小孩",color:"rgba(0, 128, 255, .9)"},
cure:{cn:"收治",color:"rgba(0, 120,120, .8)"},
definite:{cn:"确诊",color:"rgba(180, 0,0, .8)"},
helped:{cn:"已救助",color:"rgba(0, 200,0, .8)"},
suspected:{cn:"高度疑似",color:"rgba(220,100,100, .8)"},
possible:{cn:"无法排除",color:"rgba(255, 100,100, .8)"},
contact:{cn:"有接触",color:"rgba(255,80,200, .8)"},
passaway:{cn:"逝者",color:"rgba(0, 0, 0, 1)"},
all:{cn:"全部",color:"rgba(200, 0, 0, .8)"},
}
var timer=0;
function fastGetPoint(address,types,extraInfo){
if(!extraInfo)extraInfo={address:address};
extraInfo.types=types;
clearTimeout(timer);
address = getAddress(address)
if(!address) return;
if(geoHash[address]){
addMarker(new BMap.Point(geoHash[address][0],geoHash[address][1]),extraInfo)
}else{
myGeo.getPoint(address,function(address,extraInfo){
return function(point){
geoHash[address]=[point.lng,point.lat];
console.log("\""+address+"\":["+point.lng+","+point.lat+"],")
addMarker(point,extraInfo)
}
}(address,extraInfo),"武汉市")
}
}
var markers = {"all":[]},markerHash={};
function addMarker(point,extraInfo){
var k=point.lng+"|"+point.lat;
if(!markerHash[k]){
var mapv = {
geometry: {
type: 'Point',
coordinates: [point.lng,point.lat]
},
fillStyle: caseTypes[extraInfo.types[extraInfo.types.length-1]].color,
size: /mobile/i.test([navigator.userAgent])?6:3,
extraInfo:extraInfo
}
for(var i=0;i<extraInfo.types.length;i++){
if(!mapvData[extraInfo.types[i]])mapvData[extraInfo.types[i]]=[];
mapvData[extraInfo.types[i]].push(mapv)
}
mapvData["all"].push(mapv)
markerHash[k]=mapv
}else{
var mapv=markerHash[k];
for(i=0;i<extraInfo.types.length;i++){
var t=extraInfo.types[i];
if(mapv.extraInfo.types.indexOf(t)==-1){
mapv.extraInfo.types.push(t);
}
}
}
}
var mapvDataSet;
function drawMapv(type){
if(!type)type=currentLayer
var data = mapvData[type];
var size=map.getZoom()*1.6-17
if(size<1)size=1;
for(var i=0;i<data.length;i++){
data[i].size= size;
}
mapvDataSet=new mapv.DataSet(data);
map.clearOverlays()
mapvLayer = new mapv.baiduMapLayer(map, mapvDataSet, options)
}
var authorized=false;
function show(info){
if(!info || !authorized) return;
if(info.extraInfo) info=info.extraInfo
clearTimeout(timer);
var cols=["详细地址","address","地址","求助人","family","helpSeeker","联系方式","phone","phoneOfHelpSeeker","datauirements","status","求救信息","详细情况","回访情况","具体需求"]
var i=[];
for(var j=0;j<cols.length;j++){
if(info[cols[j]] && /\S/.test(info[cols[j]])){
i.push(info[cols[j]])
}
}
timer = setTimeout(alert,50,i.join("\n"))
}
function times33(str){
for(var i = 0, len = str.length,hash = 5381; i < len; ++i){
hash += (hash << 5) + str.charCodeAt(i);
};
return hash & 0x7fffffff;
}
var s=document.createElement("script");
s.src="//wuhan.citpu.cn/"+(location.hash.length>3?(times33("wu"+location.hash).toString(36)+times33("han"+location.hash).toString(36)):("allcases"))+".js";
document.body.appendChild(s)
</script>
<script src="getAddress.js"></script>
<script src="layer.js"></script>
<script src="callbacks.js"></script>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/stonelf/looking4help.git
[email protected]:stonelf/looking4help.git
stonelf
looking4help
looking4help
master

搜索帮助