|
|
@ -174,25 +174,47 @@ export default {
|
|
|
|
center: [113.4, 23.35],
|
|
|
|
center: [113.4, 23.35],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
setText(e) {
|
|
|
|
|
|
|
|
let position = e.areaPoints?.length > 0 ? e.areaPoints:e.centerPoint
|
|
|
|
|
|
|
|
if(position.length>0){
|
|
|
|
|
|
|
|
let length = position.length
|
|
|
|
|
|
|
|
let longitudes = e.areaPoints.map(e=>e.longitude).reduce((a,b)=>a+b)
|
|
|
|
|
|
|
|
let latitudes = e.areaPoints.map(e=>e.latitude).reduce((a,b)=>a+b)
|
|
|
|
|
|
|
|
position = [longitudes/length, latitudes/length]
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
position = [e.centerPoint.longitude, e.centerPoint.latitude]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let text = new AMap.Text({
|
|
|
|
|
|
|
|
text: e.deviceCount + (e.abnormalCount ? ('/' + e.abnormalCount) : ''),
|
|
|
|
|
|
|
|
anchor: 'center',
|
|
|
|
|
|
|
|
draggable: true,
|
|
|
|
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
|
|
|
position:position
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
map.add(text)
|
|
|
|
|
|
|
|
},
|
|
|
|
setPolygon(position) {
|
|
|
|
setPolygon(position) {
|
|
|
|
let e = position.map(val => {
|
|
|
|
let e = position.map(val => {
|
|
|
|
return [val.longitude, val.latitude]
|
|
|
|
return [val.longitude, val.latitude]
|
|
|
|
})
|
|
|
|
})
|
|
|
|
let thisPolygon = new AMap.Polygon({path: e});
|
|
|
|
let thisPolygon = new AMap.Polygon({
|
|
|
|
|
|
|
|
path: e,
|
|
|
|
|
|
|
|
fillColor: e ? '#ff0000' : '#1791fc',
|
|
|
|
|
|
|
|
});
|
|
|
|
map.add(thisPolygon)
|
|
|
|
map.add(thisPolygon)
|
|
|
|
map.setFitView()
|
|
|
|
map.setFitView()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
setCircle(center, radius) {
|
|
|
|
setCircle(center, radius, e) {
|
|
|
|
let circle = new AMap.Circle({
|
|
|
|
let circle = new AMap.Circle({
|
|
|
|
center,
|
|
|
|
center,
|
|
|
|
radius,
|
|
|
|
radius,
|
|
|
|
borderWeight: 3,
|
|
|
|
borderWeight: 3,
|
|
|
|
strokeColor: "#FF33FF",
|
|
|
|
strokeColor: e ? '#ff0000' : "#FF33FF",
|
|
|
|
strokeWeight: 6,
|
|
|
|
strokeWeight: 6,
|
|
|
|
strokeOpacity: 0.2,
|
|
|
|
strokeOpacity: 0.2,
|
|
|
|
fillOpacity: 0.4,
|
|
|
|
fillOpacity: 0.4,
|
|
|
|
strokeDasharray: [10, 10],
|
|
|
|
strokeDasharray: [10, 10],
|
|
|
|
fillColor: '#1791fc',
|
|
|
|
fillColor: e ? '#ff0000' : '#1791fc',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
map.add(circle);
|
|
|
|
map.add(circle);
|
|
|
|
map.setFitView()
|
|
|
|
map.setFitView()
|
|
|
@ -269,8 +291,9 @@ export default {
|
|
|
|
this.setPolygon(e.areaPoints)
|
|
|
|
this.setPolygon(e.areaPoints)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (e.centerPoint) {
|
|
|
|
if (e.centerPoint) {
|
|
|
|
this.setCircle([e.centerPoint.longitude, e.centerPoint.latitude], e.radius)
|
|
|
|
this.setCircle([e.centerPoint.longitude, e.centerPoint.latitude], e.radius, e.abnormalCount)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setText(e)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|