Newer
Older
KaiFengPC / src / views / sponeScreen / gisMF / cesiumMapLegend.js
@jimengfei jimengfei on 25 Nov 14 KB updata
  1. import YSFQ1 from '@/assets/geojson/kaifeng/kaifengPSFQ1.json';
  2. import YSFQ2 from '@/assets/geojson/kaifeng/kaifengPSFQ2.json';
  3. import YSFQ3 from '@/assets/geojson/kaifeng/kaifengPSFQ3.json';
  4. import builtCity from '@/assets/geojson/kaifeng/builtCity.json';
  5. import centerCity from '@/assets/geojson/kaifeng/centerCity.json';
  6. import cityArea from '@/assets/geojson/kaifeng/cityArea.json';
  7. import riverLake from '@/assets/geojson/kaifeng/riverLake.json';
  8. import pipeFlow from '@/assets/geojson/kaifeng/pipeFlow.json';
  9. import kaifengHaiMianSheShi from '@/assets/geojson/kaifeng/kaifengHaiMianSheShi.json';
  10. import { oneMapFacilityPumpList } from '@/api/scada/pumpStationInformation';
  11. import { haiMianfacilitySewagePage } from '@/api/scada/sewage';
  12. import { waterloggingPointList, queryProjectStation, getStationList } from '@/api/sponeScreen/syntherticData.js';
  13. import { realtimeRainfallStatistics } from '@/api/floodSys/oneMap.js';
  14. import { waterCompPage } from '@/api/longoPeration/RiverSection';
  15. import { rtuSiteInfoList } from '@/api/dataAnalysis/AlertService';
  16. import bus from '@/bus';
  17.  
  18. let YSBZ,
  19. WSBZ,
  20. HLBZ,
  21. WSCLC,
  22. waterLogingPoint,
  23. projectStation,
  24. pipeMonitorData,
  25. ysArea,
  26. wsArea,
  27. hsArea,
  28. wscArea,
  29. rainStationData,
  30. rainStationArea,
  31. riverSuperVise,
  32. waterFactory,
  33. spongeFacility;
  34.  
  35. let legendDataList;
  36. export default class cesiumMapCommonLegend {
  37. //获取站点数据
  38. static async getStationData() {
  39. let results = await Promise.all([
  40. oneMapFacilityPumpList(),
  41. haiMianfacilitySewagePage(),
  42. getStationList(),
  43. waterCompPage(),
  44. rtuSiteInfoList(),
  45. ]);
  46. let resRainwater = results[0];
  47. let resWSCLC = results[1];
  48. let stationDataList = results[2];
  49. let waterFactoryDatalist = results[3];
  50. let spongeFacilityDataList = results[4];
  51. console.log('spongeFacilityDataList--', spongeFacilityDataList);
  52. //雨水泵站
  53. let YSBZDataList = resRainwater.data.filter(data => data.pumpType == 'rain_water'); //雨水泵站
  54. let WSBZDataList = resRainwater.data.filter(data => data.pumpType == 'sewage_water'); //污水泵站
  55. let HLBZDataList = resRainwater.data.filter(data => data.pumpType == 'confluence'); //合流泵站
  56.  
  57. let riverDataList = stationDataList.data.filter(data => data.monitorTargetType == 'river'); //河道监测
  58. let spongeFacilityList = spongeFacilityDataList.data.filter(data => data.monitorTargetType == 'drain_outlet'); //海绵设施
  59. YSBZ = this.getGeojsonData(YSBZDataList);
  60. WSBZ = this.getGeojsonData(WSBZDataList);
  61. HLBZ = this.getGeojsonData(spongeFacilityList);
  62. spongeFacility = this.getGeojsonData(HLBZDataList);
  63. riverSuperVise = this.getGeojsonData(riverDataList);
  64. waterFactory = this.getGeojsonData(waterFactoryDatalist.data); //水厂
  65. ysArea = this.getPolygonGeojson(YSBZDataList); //雨水泵站范围
  66. wsArea = this.getPolygonGeojson(WSBZDataList); //污水泵站范围
  67. hsArea = this.getPolygonGeojson(HLBZDataList); //合流泵站范围
  68.  
  69. // 雨量站实时数据
  70. let resRain = await realtimeRainfallStatistics({ monitorTargetType: 'rainfall', orderBy: 'tt desc' }); //雨量站实时数据
  71. let rainDataList = resRain.data; //雨量站
  72. rainStationData = this.getGeojsonData(rainDataList);
  73. rainStationArea = this.getPolygonGeojson(rainDataList); //雨量站范围
  74.  
  75. let WSCLCDataList = resWSCLC.data;
  76. WSCLC = this.getGeojsonData(WSCLCDataList); //污水处理厂
  77. wscArea = this.getPolygonGeojson(WSCLCDataList); //污水处理厂范围
  78.  
  79. // 获取内涝点数据 18个考核点
  80. let waterLogingRes = await waterloggingPointList();
  81. if (waterLogingRes && waterLogingRes.code == 200) {
  82. waterLogingPoint = this.getGeojsonData(waterLogingRes.data); //内涝点
  83. }
  84.  
  85. // 管网水位监测点(和18个内涝点配套的)
  86. // let waterLogingRes = await getStationList({ monitorTargetType: 'waterlogging' });
  87. // if (waterLogingRes && waterLogingRes.code == 200) {
  88. // waterLogingPoint = this.getGeojsonData(waterLogingRes.data); //内涝点
  89. // }
  90.  
  91. // 管网监测点数据
  92. let pipeRes = await getStationList({ monitorTargetType: 'pipeline' });
  93. if (pipeRes && pipeRes.code == 200) {
  94. pipeMonitorData = this.getGeojsonData(pipeRes.data); //管网监测
  95. }
  96. // pipeMonitorData = this.getGeojsonData([
  97. // {
  98. // projectNo: 'JZGW02',
  99. // projectName: '汴京路管网监测点',
  100. // stCode: '2109600028',
  101. // stName: '汴京路管网监测点',
  102. // lonlat: '114.3141225,34.79221',
  103. // },
  104. // ]);
  105.  
  106. // 海绵设施
  107. let params = {};
  108. let projectStationRes = await queryProjectStation(params);
  109. if (projectStationRes && projectStationRes.code == 200) {
  110. projectStation = this.getGeojsonData(projectStationRes.data); //海绵设施
  111. }
  112.  
  113. //发送图例
  114. legendDataList = this.legendData();
  115. bus.emit('cesiumLegendDataList', legendDataList);
  116. }
  117. //雨量站汇水范围json
  118. static getPolygonGeojson(dataList) {
  119. let features = [];
  120. let feature = {};
  121. dataList.forEach(data => {
  122. if (!data.geometrys) return;
  123. feature = turf.feature(Terraformer.WKT.parse(data.geometrys), data);
  124. features.push(feature);
  125. });
  126. return {
  127. type: 'FeatureCollection',
  128. features: features,
  129. };
  130. }
  131. //构建geojson格式
  132. static getGeojsonData(dataList) {
  133. let features = [];
  134. let feature = {};
  135. dataList.forEach(data => {
  136. if (data.lonLat) {
  137. let lonlat = data.lonLat.split(',');
  138. feature = {
  139. type: 'Feature',
  140. geometry: {
  141. type: 'Point',
  142. coordinates: [Number(lonlat[0]), Number(lonlat[1])],
  143. },
  144. properties: data,
  145. };
  146. } else if (data.lonlat) {
  147. let lonlat = data.lonlat.split(',');
  148. feature = {
  149. type: 'Feature',
  150. geometry: {
  151. type: 'Point',
  152. coordinates: [Number(lonlat[0]), Number(lonlat[1])],
  153. },
  154. properties: data,
  155. };
  156. } else if (data.lon && data.lat) {
  157. feature = {
  158. type: 'Feature',
  159. geometry: {
  160. type: 'Point',
  161. coordinates: [Number(data.lon), Number(data.lat)],
  162. },
  163. properties: data,
  164. };
  165. } else if (data.originalX && data.originalY) {
  166. feature = {
  167. type: 'Feature',
  168. geometry: {
  169. type: 'Point',
  170. coordinates: [Number(data.originalX), Number(data.originalY)],
  171. },
  172. properties: data,
  173. };
  174. } else if (data.longitude && data.latitude) {
  175. feature = {
  176. type: 'Feature',
  177. geometry: {
  178. type: 'Point',
  179. coordinates: [Number(data.longitude), Number(data.latitude)],
  180. },
  181. properties: data,
  182. };
  183. }
  184. features.push(feature);
  185. });
  186. return {
  187. type: 'FeatureCollection',
  188. features: features,
  189. };
  190. }
  191. static legendData() {
  192. return [
  193. {
  194. title: '基础图层',
  195. isCheck: false,
  196. children: [
  197. [
  198. {
  199. isCheck: true,
  200. name: '白色地图',
  201. url: 'whiteMap_icon.png',
  202. layername: 'whiteMap',
  203. type: 'background',
  204. },
  205. {
  206. isCheck: false,
  207. name: '蓝色地图',
  208. url: 'blackMap_icon.png',
  209. layername: 'blackMap',
  210. type: 'background',
  211. },
  212. ],
  213. [
  214. {
  215. isCheck: false,
  216. name: '影像图',
  217. url: 'imageMap_icon.png',
  218. layername: 'imageMap',
  219. type: 'background',
  220. },
  221. {
  222. isCheck: false,
  223. name: '行政区划',
  224. url: 'cityArea_icon.png',
  225. layername: 'cityArea',
  226. type: 'polygon',
  227. data: cityArea,
  228. },
  229. ],
  230. [
  231. {
  232. isCheck: false,
  233. name: '建成区',
  234. url: 'builtCity_icon.png',
  235. layername: 'builtCity',
  236. type: 'areaWall',
  237. data: builtCity,
  238. },
  239. {
  240. isCheck: false,
  241. name: '中心城区',
  242. url: 'centerCity_icon.png',
  243. layername: 'centerCity',
  244. type: 'areaWall',
  245. data: centerCity,
  246. },
  247. ],
  248. [
  249. {
  250. isCheck: false,
  251. name: '排水分区一',
  252. url: 'paiShuiArea1_icon.png',
  253. layername: 'cesiumPaishuiArea1',
  254. type: 'cesiumPaishuiArea',
  255. paishuiArea: YSFQ1,
  256. },
  257. {
  258. isCheck: false,
  259. name: '地形地貌',
  260. url: 'topography_icon.png',
  261. layername: 'topography',
  262. type: 'pngImage',
  263. },
  264. ],
  265. [
  266. {
  267. isCheck: false,
  268. name: '排水分区二',
  269. url: 'paiShuiArea2_icon.png',
  270. layername: 'cesiumPaishuiArea2',
  271. type: 'cesiumPaishuiArea',
  272. paishuiArea: YSFQ2,
  273. },
  274. {
  275. isCheck: false,
  276. name: '供水厂',
  277. url: 'waterFactory_icon.png',
  278. layername: 'waterFactory',
  279. type: 'point',
  280. data: waterFactory,
  281. },
  282. ],
  283. [
  284. {
  285. isCheck: false,
  286. name: '排水分区三',
  287. url: 'paiShuiArea3_icon.png',
  288. layername: 'cesiumPaishuiArea3',
  289. type: 'cesiumPaishuiArea',
  290. paishuiArea: YSFQ3,
  291. },
  292. {
  293. isCheck: false,
  294. name: '气象云图',
  295. url: 'paiShuiArea3_icon.png',
  296. layername: 'weather_cloud',
  297. type: 'weather_cloud',
  298. },
  299. ],
  300. ],
  301. },
  302. {
  303. title: '雨水/污水系统',
  304. isCheck: false,
  305. children: [
  306. [
  307. {
  308. isCheck: false,
  309. name: '雨水泵站',
  310. layername: 'YSBZ',
  311. url: 'rainBengZhan_icon.png', //图层+json √
  312. mapUrl: 'paiLaoBeng.png',
  313. type: 'point',
  314. data: YSBZ,
  315. dataArea: ysArea,
  316. },
  317. {
  318. isCheck: false,
  319. name: '污水泵站', //图层+json √
  320. layername: 'WSBZ',
  321. url: 'sewageBenZhan_icon.png',
  322. mapUrl: 'wsBeng.png',
  323. type: 'point',
  324. data: WSBZ,
  325. dataArea: wsArea,
  326. },
  327. ],
  328. [
  329. {
  330. isCheck: false,
  331. name: '合流泵站', //图层+json √
  332. layername: 'combineBengZhan',
  333. url: 'combineBengZhan_icon.png',
  334. mapUrl: 'wsBeng.png',
  335. type: 'point',
  336. data: HLBZ,
  337. dataArea: hsArea,
  338. },
  339. {
  340. isCheck: false,
  341. name: '污水处理厂',
  342. layername: 'sewageFactory', //图层+json √
  343. url: 'sewageFactory_icon.png',
  344. mapUrl: 'WSC.png',
  345. type: 'point',
  346. data: WSCLC,
  347. //data: wuShuiChang,
  348. //dataArea: wscArea,
  349. },
  350. ],
  351. [
  352. {
  353. isCheck: false,
  354. name: '管网流向',
  355. layername: 'pipeline_info_flow',
  356. url: 'pipeLineFlow_icon.png',
  357. type: 'dynamicLine',
  358. //data: pipeFlow,
  359. },
  360. {
  361. isCheck: false,
  362. name: '合流管网',
  363. layername: 'hsLine1', //图层+json √
  364. url: 'combineLine_icon.png',
  365. //mapUrl: 'WSC.png',
  366. type: 'mapServer',
  367. //data: WSCLC,
  368. //data: wuShuiChang,
  369. //dataArea: wscArea,
  370. },
  371. ],
  372. [
  373. {
  374. isCheck: false,
  375. name: '雨水管网',
  376. layername: 'ysLine1', //图层+json √
  377. url: 'rainLine_icon.png',
  378. //mapUrl: 'WSC.png',
  379. type: 'mapServer',
  380. //data: WSCLC,
  381. //data: wuShuiChang,
  382. //dataArea: wscArea,
  383. },
  384. {
  385. isCheck: false,
  386. name: '污水管网',
  387. layername: 'wsLine1', //图层+json √
  388. url: 'sewageLine_icon.png',
  389. //mapUrl: 'WSC.png',
  390. type: 'mapServer',
  391. //data: WSCLC,
  392. //data: wuShuiChang,
  393. //dataArea: wscArea,
  394. },
  395. ],
  396. ],
  397. },
  398. {
  399. title: '感知监测',
  400. isCheck: false,
  401. children: [
  402. [
  403. {
  404. isCheck: false,
  405. name: '内涝积水点',
  406. layername: 'waterLoging', //图层+json √
  407. url: 'waterLoging_icon.png',
  408. mapUrl: 'rain.png',
  409. type: 'point',
  410. data: waterLogingPoint,
  411. },
  412. {
  413. isCheck: false,
  414. name: '河道断面',
  415. layername: 'waterCourse',
  416. url: 'waterCourse_icon.png', //图层+json √
  417. mapUrl: 'KDJZWMX.png',
  418. type: 'point',
  419. data: riverSuperVise,
  420. },
  421. ],
  422. [
  423. {
  424. isCheck: false,
  425. name: '雨量站',
  426. layername: 'rainStation',
  427. url: 'rainStation_icon.png', //图层+json √
  428. mapUrl: 'yuanTou.png',
  429. type: 'rainStation',
  430. rainData: rainStationData,
  431. dataArea: rainStationArea,
  432. },
  433. {
  434. isCheck: false,
  435. name: '源头地块',
  436. layername: 'origine', //图层+json √
  437. url: 'origine_icon.png',
  438. mapUrl: 'rainSupervise.png',
  439. type: 'point',
  440. //data: pipeSupervise,
  441. },
  442. ],
  443. [
  444. {
  445. isCheck: false,
  446. name: '海绵设施',
  447. layername: 'spongeFacility',
  448. url: 'spongeFacility_icon.png', //图层+json √
  449. mapUrl: 'yiLao.png',
  450. type: 'point',
  451. data: spongeFacility,
  452. },
  453. {
  454. isCheck: false,
  455. name: '管网监测',
  456. layername: 'pipeMonitor',
  457. url: 'combineLine_icon.png', //图层+json √
  458. mapUrl: 'YQGXMXs.png',
  459. type: 'point',
  460. data: pipeMonitorData,
  461. },
  462. ],
  463. ],
  464. },
  465. ];
  466. }
  467. }