lion 2 years ago
parent af00286e2a
commit c9c43c087c

@ -661,44 +661,50 @@
} }
}] }]
}); });
panToHospital()
window.setInterval(function() { window.setInterval(function() {
panToHospital(); // panToHospital();
}, 3000); }, 3000);
} }
function panToHospital() { function panToHospital() {
current_hospital++; // current_hospital++;
if (current_hospital == hospitals.length) { // if (current_hospital == hospitals.length) {
current_hospital = 0; // current_hospital = 0;
} // }
var center = new TMap.LatLng(hospitals[current_hospital].lat, hospitals[current_hospital].lng); hospitals.map(item=>{
map.panTo(center); var center = new TMap.LatLng(item.lat, item.lng);
// marker.setMap(null);
// var marker1 = null;
var marker1 = new TMap.MultiMarker({
id: "marker-layer", //图层id
map: map,
styles: { //点标注的相关样式
"marker": new TMap.MarkerStyle({
"width": 25,
"height": 35,
"anchor": {
x: 16,
y: 32
},
"src": "https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/markerDefault.png"
})
},
geometries: [{ //点标注数据数组
"id": "demo",
"styleId": "marker",
"position": center,
"properties": {
"title": "marker"
}
}]
});
marker.push(marker1)
})
// map.panTo(center);
marker.setMap(null);
marker = null;
marker = new TMap.MultiMarker({
id: "marker-layer", //图层id
map: map,
styles: { //点标注的相关样式
"marker": new TMap.MarkerStyle({
"width": 25,
"height": 35,
"anchor": {
x: 16,
y: 32
},
"src": "https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/markerDefault.png"
})
},
geometries: [{ //点标注数据数组
"id": "demo",
"styleId": "marker",
"position": center,
"properties": {
"title": "marker"
}
}]
});
} }
</script> </script>
</body> </body>

Loading…
Cancel
Save