Commit bfcb8b20 authored by 纪泽龙's avatar 纪泽龙

视频以及桑额报警器加上text

parent 15dcf7ed
......@@ -79,7 +79,7 @@ class gaodeMap {
// 用来判断点击左边抽屉列表的时候移动才消失
leftListClick = false;
// 报警器移动的时候用来存储经纬度的,用途是判断司徒是否移动
oldLng=[];
oldLng = [];
//构造函数中设置中央点默认值
constructor(center) {
this.markers = [];
......@@ -268,7 +268,7 @@ class gaodeMap {
map.setStatus(options);
});
// this.infoWindowMove(infoWindow);
let marker = new AMap.Marker({
position: [data.longitude, data.latitude],
map: map,
......@@ -333,6 +333,8 @@ class gaodeMap {
}
// 摄像头
if (DEVICE_TYPE.VIDEO == markerType) {
// 摄像头
const {
longitude,
......@@ -351,6 +353,7 @@ class gaodeMap {
pos: [longitude, latitude],
deviceType: type
});
marker.text = this.addText({text:data.videoName,position:[data.longitude, data.latitude]});
marker.markerType = markerType;
marker.data = data;
marker.infoWindow = infoWindow;
......@@ -378,6 +381,7 @@ class gaodeMap {
DEVICE_TYPE.DETECTOR_CM == markerType ||
DEVICE_TYPE.DETECTOR_FM == markerType
) {
marker.text= this.addText({text:data.nickName,position:[data.longitude, data.latitude]});
marker.markerType = markerType;
marker.data = data;
marker.infoWindow = infoWindow;
......@@ -389,7 +393,7 @@ class gaodeMap {
// 报警器用户下的独立报警器
if (DEVICE_TYPE.DETECTOR_ONLY == markerType) {
// 如果报警器用户下的单一报警器
// 先记录当前的this.detcetorMarker
if (this.detcetorMarker) {
this.oldLng = [
......@@ -415,10 +419,10 @@ class gaodeMap {
// 因为报警器会出现同一位置的情况,如果是同一个位置,直接显示infoWindow,
// 如果不是同一位置,移动完了在显示
if (this.oldLng[0] == data.longitude && this.oldLng[1] == data.latitude) {
console.log("原地没动")
console.log("原地没动");
this.detectorOnlyOpen(e);
} else {
console.log("动了")
console.log("动了");
// 回调,先移动,后展示infowindow
this.handleInfoWindowOpenFunc = () => {
......@@ -521,6 +525,7 @@ class gaodeMap {
if (markerType != DEVICE_TYPE.DETECTOR_ONLY) {
// 刚进来所有的设备都是隐藏的
marker.hide();
marker.text?.hide();
this.markers.push(marker);
} else {
}
......@@ -542,7 +547,18 @@ class gaodeMap {
return marker;
}
// 添加文本标记
addText(data){
let text = new AMap.Text({
position: data.position,
anchor: "bottom-center",
offset:new AMap.Pixel(0, -32),
text: data.text,
style: {"font-size":"12px" ,"color":"#fff","background-color":"#063157cc"}
});
this.myMap.add(text);
return text;
}
// 值班人员
wokerManOpen = e => {
this.markerType = e.target.markerType;
......@@ -1511,6 +1527,8 @@ class gaodeMap {
}
}
bool ? item.show() : item.hide();
bool ? item?.text.show() : item?.text.hide();
}
// //console.log("deviceType",deviceType);
});
......@@ -1523,6 +1541,7 @@ class gaodeMap {
})
?.forEach(item => {
bool ? item.show() : item.hide();
bool ? item?.text.show() : item?.text.hide();
// 如果有报警器,就让报警器一起隐藏
if (
this.detcetorMarker &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment