import YSFQ1 from '@/assets/geojson/kaifeng/kaifengPSFQ1.json'; import YSFQ2 from '@/assets/geojson/kaifeng/kaifengPSFQ2.json'; import YSFQ3 from '@/assets/geojson/kaifeng/kaifengPSFQ3.json'; import builtCity from '@/assets/geojson/kaifeng/builtCity.json'; import centerCity from '@/assets/geojson/kaifeng/centerCity.json'; import cityArea from '@/assets/geojson/kaifeng/cityArea.json'; import riverLake from '@/assets/geojson/kaifeng/riverLake.json'; import pipeFlow from '@/assets/geojson/kaifeng/pipeFlow.json'; import kaifengHaiMianSheShi from '@/assets/geojson/kaifeng/kaifengHaiMianSheShi.json'; import { oneMapFacilityPumpList } from '@/api/scada/pumpStationInformation'; import { haiMianfacilitySewagePage } from '@/api/scada/sewage'; import { waterloggingPointList, queryProjectStation, getStationList } from '@/api/sponeScreen/syntherticData.js'; import { realtimeRainfallStatistics } from '@/api/floodSys/oneMap.js'; import { waterCompPage } from '@/api/longoPeration/RiverSection'; import bus from '@/bus'; let YSBZ, WSBZ, HLBZ, WSCLC, waterLogingPoint, projectStation, pipeMonitorData, ysArea, wsArea, hsArea, wscArea, rainStationData, rainStationArea, riverSuperVise, waterFactory; let legendDataList; export default class cesiumMapCommonLegend { //获取站点数据 static async getStationData() { let results = await Promise.all([ oneMapFacilityPumpList(), haiMianfacilitySewagePage(), realtimeRainfallStatistics({ monitorTargetType: 'rainfall', orderBy: 'tt desc' }), getStationList(), waterCompPage(), ]); let resRainwater = results[0]; let resWSCLC = results[1]; let rainStation = results[2]; let stationDataList = results[3]; let waterFactoryDatalist = results[4]; // console.log('waterFactoryDatalist--', waterFactoryDatalist); //雨水泵站 let YSBZDataList = resRainwater.data.filter(data => data.pumpType == 'rain_water'); //雨水泵站 let WSBZDataList = resRainwater.data.filter(data => data.pumpType == 'sewage_water'); //污水泵站 let HLBZDataList = resRainwater.data.filter(data => data.pumpType == 'confluence'); //合流泵站 let rainDataList = rainStation.data; //雨量站 let riverDataList = stationDataList.data.filter(data => data.monitorTargetType == 'river'); //河道监测 YSBZ = this.getGeojsonData(YSBZDataList); WSBZ = this.getGeojsonData(WSBZDataList); HLBZ = this.getGeojsonData(HLBZDataList); riverSuperVise = this.getGeojsonData(riverDataList); waterFactory = this.getGeojsonData(waterFactoryDatalist.data); //水厂 ysArea = this.getPolygonGeojson(YSBZDataList); //雨水泵站范围 wsArea = this.getPolygonGeojson(WSBZDataList); //污水泵站范围 hsArea = this.getPolygonGeojson(HLBZDataList); //合流泵站范围 rainStationData = this.getGeojsonData(rainDataList); rainStationArea = this.getPolygonGeojson(rainDataList); //雨量站范围 rainStationArea.features.forEach(feature => { feature.properties.fillcolor = 'rgba(41, 184, 219,0.7)'; }); let WSCLCDataList = resWSCLC.data; WSCLC = this.getGeojsonData(WSCLCDataList); //污水处理厂 wscArea = this.getPolygonGeojson(WSCLCDataList); //污水处理厂范围 // 获取内涝点数据 // let waterLogingRes = await waterloggingPointList(); let waterLogingRes = await getStationList({ monitorTargetType: 'waterlogging' }); if (waterLogingRes && waterLogingRes.code == 200) { waterLogingPoint = this.getGeojsonData(waterLogingRes.data); //内涝点 } // 管网监测点数据 测试用 let pipeRes = await getStationList({ monitorTargetType: 'pipeline' }); if (pipeRes && pipeRes.code == 200) { pipeMonitorData = this.getGeojsonData(pipeRes.data); //管网监测 } // pipeMonitorData = this.getGeojsonData([ // { // projectNo: 'JZGW02', // projectName: '汴京路管网监测点', // stCode: '2109600028', // stName: '汴京路管网监测点', // lonlat: '114.3141225,34.79221', // }, // ]); // 海绵设施 let params = {}; let projectStationRes = await queryProjectStation(params); if (projectStationRes && projectStationRes.code == 200) { projectStation = this.getGeojsonData(projectStationRes.data); //海绵设施 } //发送图例 legendDataList = this.legendData(); bus.emit('cesiumLegendDataList', legendDataList); } //雨量站汇水范围json static getPolygonGeojson(dataList) { let features = []; let feature = {}; dataList.forEach(data => { if (!data.geometrys) return; feature = turf.feature(Terraformer.WKT.parse(data.geometrys), data); features.push(feature); }); return { type: 'FeatureCollection', features: features, }; } //构建geojson格式 static getGeojsonData(dataList) { let features = []; let feature = {}; dataList.forEach(data => { if (data.lonLat) { let lonlat = data.lonLat.split(','); feature = { type: 'Feature', geometry: { type: 'Point', coordinates: [Number(lonlat[0]), Number(lonlat[1])], }, properties: data, }; } else if (data.lonlat) { let lonlat = data.lonlat.split(','); feature = { type: 'Feature', geometry: { type: 'Point', coordinates: [Number(lonlat[0]), Number(lonlat[1])], }, properties: data, }; } else if (data.lon && data.lat) { feature = { type: 'Feature', geometry: { type: 'Point', coordinates: [Number(data.lon), Number(data.lat)], }, properties: data, }; } else if (data.originalX && data.originalY) { feature = { type: 'Feature', geometry: { type: 'Point', coordinates: [Number(data.originalX), Number(data.originalY)], }, properties: data, }; } else if (data.longitude && data.latitude) { feature = { type: 'Feature', geometry: { type: 'Point', coordinates: [Number(data.longitude), Number(data.latitude)], }, properties: data, }; } features.push(feature); }); return { type: 'FeatureCollection', features: features, }; } static legendData() { return [ { title: '基础图层', isCheck: false, children: [ [ { isCheck: true, name: '白色地图', url: 'whiteMap_icon.png', layername: 'whiteMap', type: 'background', }, { isCheck: false, name: '蓝色地图', url: 'blackMap_icon.png', layername: 'blackMap', type: 'background', }, ], [ { isCheck: false, name: '影像图', url: 'imageMap_icon.png', layername: 'imageMap', type: 'background', }, { isCheck: false, name: '行政区划', url: 'cityArea_icon.png', layername: 'cityArea', type: 'polygon', data: cityArea, }, ], [ { isCheck: false, name: '建成区', url: 'builtCity_icon.png', layername: 'builtCity', type: 'areaWall', data: builtCity, }, { isCheck: false, name: '中心城区', url: 'centerCity_icon.png', layername: 'centerCity', type: 'areaWall', data: centerCity, }, ], [ { isCheck: false, name: '排水分区一', url: 'paiShuiArea1_icon.png', layername: 'cesiumPaishuiArea1', type: 'cesiumPaishuiArea', paishuiArea: YSFQ1, }, { isCheck: false, name: '地形地貌', url: 'topography_icon.png', layername: 'topography', type: 'pngImage', }, ], [ { isCheck: false, name: '排水分区二', url: 'paiShuiArea2_icon.png', layername: 'cesiumPaishuiArea2', type: 'cesiumPaishuiArea', paishuiArea: YSFQ2, }, { isCheck: false, name: '供水厂', url: 'waterFactory_icon.png', layername: 'waterFactory', type: 'point', data: waterFactory, }, ], [ { isCheck: false, name: '排水分区三', url: 'paiShuiArea3_icon.png', layername: 'cesiumPaishuiArea3', type: 'cesiumPaishuiArea', paishuiArea: YSFQ3, }, { isCheck: false, name: '气象云图', url: 'paiShuiArea3_icon.png', layername: 'weather_cloud', type: 'weather_cloud', }, ], ], }, { title: '雨水/污水系统', isCheck: false, children: [ [ { isCheck: false, name: '雨水泵站', layername: 'YSBZ', url: 'rainBengZhan_icon.png', //图层+json √ mapUrl: 'paiLaoBeng.png', type: 'point', data: YSBZ, dataArea: ysArea, }, { isCheck: false, name: '污水泵站', //图层+json √ layername: 'WSBZ', url: 'sewageBenZhan_icon.png', mapUrl: 'wsBeng.png', type: 'point', data: WSBZ, dataArea: wsArea, }, ], [ { isCheck: false, name: '合流泵站', //图层+json √ layername: 'combineBengZhan', url: 'combineBengZhan_icon.png', mapUrl: 'wsBeng.png', type: 'point', data: HLBZ, dataArea: hsArea, }, { isCheck: false, name: '污水处理厂', layername: 'sewageFactory', //图层+json √ url: 'sewageFactory_icon.png', mapUrl: 'WSC.png', type: 'point', data: WSCLC, //data: wuShuiChang, //dataArea: wscArea, }, ], [ { isCheck: false, name: '管网流向', layername: 'pipeline_info_flow', url: 'pipeLineFlow_icon.png', type: 'dynamicLine', //data: pipeFlow, }, { isCheck: false, name: '合流管网', layername: 'hsLine1', //图层+json √ url: 'combineLine_icon.png', //mapUrl: 'WSC.png', type: 'mapServer', //data: WSCLC, //data: wuShuiChang, //dataArea: wscArea, }, ], [ { isCheck: false, name: '雨水管网', layername: 'ysLine1', //图层+json √ url: 'rainLine_icon.png', //mapUrl: 'WSC.png', type: 'mapServer', //data: WSCLC, //data: wuShuiChang, //dataArea: wscArea, }, { isCheck: false, name: '污水管网', layername: 'wsLine1', //图层+json √ url: 'sewageLine_icon.png', //mapUrl: 'WSC.png', type: 'mapServer', //data: WSCLC, //data: wuShuiChang, //dataArea: wscArea, }, ], ], }, { title: '感知监测', isCheck: false, children: [ [ { isCheck: false, name: '内涝积水点', layername: 'waterLoging', //图层+json √ url: 'waterLoging_icon.png', mapUrl: 'rain.png', type: 'point', data: waterLogingPoint, }, { isCheck: false, name: '河道断面', layername: 'waterCourse', url: 'waterCourse_icon.png', //图层+json √ mapUrl: 'KDJZWMX.png', type: 'point', data: riverSuperVise, }, ], [ { isCheck: false, name: '雨量站', layername: 'rainStation', url: 'rainStation_icon.png', //图层+json √ mapUrl: 'yuanTou.png', type: 'rainStation', rainData: rainStationData, dataArea: rainStationArea, }, { isCheck: false, name: '源头地块', layername: 'origine', //图层+json √ url: 'origine_icon.png', mapUrl: 'rainSupervise.png', type: 'point', //data: pipeSupervise, }, ], [ { isCheck: false, name: '海绵设施', layername: 'spongeFacility', url: 'spongeFacility_icon.png', //图层+json √ mapUrl: 'yiLao.png', type: 'point', data: kaifengHaiMianSheShi, }, { isCheck: false, name: '管网监测', layername: 'pipeMonitor', url: 'combineLine_icon.png', //图层+json √ mapUrl: 'YQGXMXs.png', type: 'point', data: pipeMonitorData, }, ], ], }, ]; } }