diff --git a/public/static/libs/mapbox/style/floodOneMap.json b/public/static/libs/mapbox/style/floodOneMap.json index cb490a9..4e52bf1 100644 --- a/public/static/libs/mapbox/style/floodOneMap.json +++ b/public/static/libs/mapbox/style/floodOneMap.json @@ -417,6 +417,51 @@ }, { "id": "", + "key": "warning_monitor1", + "type": "PointLayer", + "show": true, + "params": { + "zIndex": 0, + "blend": "additive" + }, + "methods": [ + { + "name": "shape", + "params": [ + "circle" + ] + }, + { + "name": "color", + "params": [ + "#e64032" + ] + }, + { + "name": "size", + "params": [ + "size", + "''||function(v){return v}" + ] + }, + { + "name": "animate", + "params": [ + true + ] + }, + { + "name": "style", + "params": [ + { + "unit": "meter" + } + ] + } + ] + }, + { + "id": "", "key": "highlight_linestring", "type": "LineLayer", "show": true, @@ -933,6 +978,8 @@ ], "warning_monitor", "warning_monitor", + "warning_monitor1", + "warning_monitor1", "success_monitor", "success_monitor", "error_monitor", diff --git a/public/static/libs/mapbox/style/floodOneMap.json b/public/static/libs/mapbox/style/floodOneMap.json index cb490a9..4e52bf1 100644 --- a/public/static/libs/mapbox/style/floodOneMap.json +++ b/public/static/libs/mapbox/style/floodOneMap.json @@ -417,6 +417,51 @@ }, { "id": "", + "key": "warning_monitor1", + "type": "PointLayer", + "show": true, + "params": { + "zIndex": 0, + "blend": "additive" + }, + "methods": [ + { + "name": "shape", + "params": [ + "circle" + ] + }, + { + "name": "color", + "params": [ + "#e64032" + ] + }, + { + "name": "size", + "params": [ + "size", + "''||function(v){return v}" + ] + }, + { + "name": "animate", + "params": [ + true + ] + }, + { + "name": "style", + "params": [ + { + "unit": "meter" + } + ] + } + ] + }, + { + "id": "", "key": "highlight_linestring", "type": "LineLayer", "show": true, @@ -933,6 +978,8 @@ ], "warning_monitor", "warning_monitor", + "warning_monitor1", + "warning_monitor1", "success_monitor", "success_monitor", "error_monitor", diff --git a/src/views/oneMap/index.vue b/src/views/oneMap/index.vue index b6a4878..946a0cf 100644 --- a/src/views/oneMap/index.vue +++ b/src/views/oneMap/index.vue @@ -241,8 +241,35 @@ () => useSocket.chatMessage.value, (newVal, oldVal) => { console.log('更新---------', newVal); + bus.emit('removeMapDatas', ['warning_monitor1']); if (newVal.type == 'warnInfo') { // 地图操作 + if (!newVal.content.length) return; + let warningFeatures = []; + newVal.content.forEach(element => { + if (element.location) { + let warningFeature = turf.point(element.location.split(',').map(Number), element); + warningFeature.properties.name = element.assessment; + warningFeature.properties.size = 1000; + warningFeatures.push(warningFeature); + } + }); + let warningFeaturesGeojson = turf.featureCollection(warningFeatures); + let key = 'warning_monitor1'; + bus.emit('getGeojsonByType', { + type: key, + callback: geojson => { + if (!!!geojson.features.length) bus.emit('setGeoJSON', { json: warningFeaturesGeojson, key: 'warning_monitor1' }); + bus.emit('setLayerVisible', { type: 'point', layername: key, isCheck: true }); + }, + }); + let warningPoint = newfiberMapbox.getLayers().filter(feature => feature.newfiberId == 'warning_monitor1')[0]; + if (warningPoint) { + warningPoint.on('click', e => { + let popupData = e.feature.properties; + console.log('popupData---', '告警12.19---------', popupData); + }); + } } }, {