import { mainMap,layuiObj } from "../index.js"; import { stopDeviceSosAudio } from "../../audio/audio.js"; import { setMdevAlarmResive } from "../showAlarmListTable.js"; import { mdevAlarmHandleDrawCircle, getMoveDeviceInfoWindowDiv } from "./moveDeviceMarker.js"; var moveDeviceAlarmMarker={}; function delMoveDeviceAlarmMarker(id){ if(id in moveDeviceAlarmMarker){ mainMap.removeLayer(moveDeviceAlarmMarker[id]); delete moveDeviceAlarmMarker[id] } } function addMoveDeviceAlarmMarker(obj){ var deviceid=obj['deviceid']; var longitude=obj["longitude"]; var latitude=obj["latitude"]; var address=obj["address"]; var iconObj=getMoveDeviceAlarmIcon(obj) let marker=L.marker([latitude,longitude],{ icon: iconObj,//将marker设置为上面引用的图形 title:address, riseOnHover:false, zIndexOffset:1000 }) if(!(deviceid in moveDeviceAlarmMarker)){ moveDeviceAlarmMarker[deviceid]=marker } marker.bindTooltip(address).openTooltip(); marker.on('click',function(e){ showAlarmMoveDeviceInfoWindow(obj); }) //把 Marker 添加到图层 mainMap.addLayer(marker); setMdevMarkerCenter(); } //设置中心点 function setMdevMarkerCenter(){ let length = Object.keys(moveDeviceAlarmMarker).length; if(length<2){ for(var i in moveDeviceAlarmMarker){ var lnglat=moveDeviceAlarmMarker[i].getLatLng(); mainMap.setView(lnglat, 18); } } } function showAlarmMoveDeviceInfoWindow(obj){ var deviceid=obj["deviceid"]; if(deviceid in moveDeviceAlarmMarker){ moveDeviceAlarmMarker[deviceid].unbindPopup(); moveDeviceAlarmMarker[deviceid].bindPopup(`
姓名:${obj["showname"]}
联系方式:${obj["username"]}/${obj["userphone"]}