告警闪烁
This commit is contained in:
BIN
hd-glasses-app/src/assets/map/icon_paishuibeng_h.png
Normal file
BIN
hd-glasses-app/src/assets/map/icon_paishuibeng_h.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
@@ -311,15 +311,6 @@ export default {
|
|||||||
}
|
}
|
||||||
this.selectPoint = coordinate;
|
this.selectPoint = coordinate;
|
||||||
this.coordinate = coordinate;
|
this.coordinate = coordinate;
|
||||||
console.log(JSON.stringify(this.coordinate))
|
|
||||||
if (Object.keys(this.pointLayer).length == 0) {
|
|
||||||
// 创建图层
|
|
||||||
this.pointLayer = new VectorLayer({
|
|
||||||
source: new VectorSource(),
|
|
||||||
});
|
|
||||||
// 图层添加到地图上
|
|
||||||
this.map.addLayer(this.pointLayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建feature要素,一个feature就是一个点坐标信息
|
// 创建feature要素,一个feature就是一个点坐标信息
|
||||||
const feature = new Feature({
|
const feature = new Feature({
|
||||||
@@ -483,8 +474,8 @@ export default {
|
|||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
res.data.result.records.map(record => {
|
res.data.result.records.map(record => {
|
||||||
try {
|
try {
|
||||||
if (record.leastLocation.length > 0) {
|
if (record.leastLocation!=null) {
|
||||||
this.map.removeInteraction(record.leastLocation, "equipment")
|
this.addPointWidthCoordinate(record.leastLocation, "equipment")
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
@@ -504,8 +495,8 @@ export default {
|
|||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
res.data.result.records.map(record => {
|
res.data.result.records.map(record => {
|
||||||
try {
|
try {
|
||||||
if (record.location.length > 0) {
|
if (record.location!=null) {
|
||||||
this.map.removeInteraction(record.location, "alarm")
|
this.addPointWidthCoordinate(record.location, "alarm")
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
@@ -519,7 +510,76 @@ export default {
|
|||||||
location.href = "uniwebview://action?function=switchBigScreen"
|
location.href = "uniwebview://action?function=switchBigScreen"
|
||||||
},
|
},
|
||||||
addPointWidthCoordinate(coordinate, type) {
|
addPointWidthCoordinate(coordinate, type) {
|
||||||
|
coordinate=coordinate.split(",")
|
||||||
|
if(type=='alarm'){
|
||||||
console.log("addPointWidthCoordinate", type, coordinate)
|
console.log("addPointWidthCoordinate", type, coordinate)
|
||||||
|
if (Object.keys(this.alarmLayer).length == 0) {
|
||||||
|
// 创建图层
|
||||||
|
this.alarmLayer = new VectorLayer({
|
||||||
|
source: new VectorSource(),
|
||||||
|
});
|
||||||
|
// 图层添加到地图上
|
||||||
|
this.map.addLayer(this.alarmLayer);
|
||||||
|
var flag=true
|
||||||
|
var animation=setInterval(() => {
|
||||||
|
flag=!flag
|
||||||
|
this.alarmLayer.setVisible(flag)
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
const feature = new Feature({
|
||||||
|
geometry: new Point(coordinate),
|
||||||
|
});
|
||||||
|
// 设置要素的图标
|
||||||
|
feature.setStyle(
|
||||||
|
new Style({
|
||||||
|
// 设置图片效果
|
||||||
|
image: new Icon({
|
||||||
|
src: getStatisFileUrl("/map/icon_paishuibeng_h.png"),
|
||||||
|
// anchor: [0.5, 0.5],
|
||||||
|
scale: 0.4,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
// 要素添加到地图图层上
|
||||||
|
this.alarmLayer.getSource().addFeature(feature);
|
||||||
|
|
||||||
|
}
|
||||||
|
if(type=='equipment'){
|
||||||
|
console.log("addPointWidthCoordinate", type, coordinate)
|
||||||
|
if (Object.keys(this.equipmentLayer).length == 0) {
|
||||||
|
// 创建图层
|
||||||
|
this.equipmentLayer = new VectorLayer({
|
||||||
|
source: new VectorSource(),
|
||||||
|
});
|
||||||
|
// 图层添加到地图上
|
||||||
|
this.map.addLayer(this.equipmentLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
const feature = new Feature({
|
||||||
|
geometry: new Point(coordinate),
|
||||||
|
});
|
||||||
|
// 设置要素的图标
|
||||||
|
feature.setStyle(
|
||||||
|
new Style({
|
||||||
|
// 设置图片效果
|
||||||
|
image: new Icon({
|
||||||
|
src: getStatisFileUrl("/map/icon_paishuibeng_h_2.png"),
|
||||||
|
// anchor: [0.5, 0.5],
|
||||||
|
scale: 0.4,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
// 要素添加到地图图层上
|
||||||
|
|
||||||
|
this.equipmentLayer.getSource().addFeature(feature);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user