From 0224d04dcb9e07bcdcaf717bae112b4eca11c0df Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Thu, 25 Jan 2024 14:06:05 +0800 Subject: [PATCH] up --- public/dashboard/index.html | 43 ++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/public/dashboard/index.html b/public/dashboard/index.html index 6ea4c2f..1e012c4 100644 --- a/public/dashboard/index.html +++ b/public/dashboard/index.html @@ -638,29 +638,7 @@ center: center, //设置地图中心点坐标 }); //初始化marker - 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" - } - }] - }); + panToHospital() window.setInterval(function() { // panToHospital(); @@ -672,6 +650,7 @@ // if (current_hospital == hospitals.length) { // current_hospital = 0; // } + var geometriesArr = [] hospitals.map(item=>{ var center = new TMap.LatLng(item.lat, item.lng); // marker.setMap(null); @@ -684,9 +663,25 @@ "title": "marker" } } - marker.geometries.push(mark) + geometriesArr.push(mark) }) + 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: geometriesArr + }); // map.panTo(center);