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