TFMapUitl.ts 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. import bw from '../assets/images/bw.png';
  2. declare const TFMap;
  3. declare const Cesium;
  4. class TFMapUitl {
  5. PointLocation_listImg = '../assets/images/bw.png';
  6. PointLocation_listId = 'PointLocation_listId*';
  7. bwImg = '../assets/images/bw.png';
  8. bwClass = 'PointLocation_listId*';
  9. entiListId = [];
  10. bwEntiListId = []; //波纹实体数组
  11. specialControl = {
  12. //特殊图层的识别码
  13. zdgzzhd: 'layerControl_zdgzzhd*', //"重点关注灾害点"
  14. pczhd: 'layerControl_pczhd*', //"普查灾害点"
  15. hllx: 'hllx', //河流流向
  16. zhjcsb: 'layerControl_zhjcsb*', //
  17. zhfwsyt: 'dzdfw_geojson*,dzdfw_geojson_fw*', //地灾范围是特殊情况使用两个进行控制
  18. dzfb: 'layerControl_dzfbsb*', //电站分布-工程
  19. shuiwenzhan: 'layerControl_shuiwenzhan*', //水文站,
  20. shuiweizhan: 'layerControl_shuiweizhan*', //水位站,
  21. yuliangzhan: 'layerControl_yuliangzhan*', //雨量站,
  22. yibanqixiangzhan: 'layerControl_yibanqixiangzhan*', //一般气象站,
  23. biaozhunqixiangzhan: 'layerControl_biaozhunqixiangzhan*', //标准气象站,
  24. tanshuitongliangzhan: 'layerControl_tanshuitongliangzhan*', //碳水通量站,
  25. gc: 'layerControl_gc*', //工程点,
  26. yuliangfenqu: 'yuliangfenqu'
  27. };
  28. /**
  29. * 本方法用于判断传入值是否有效,为null、undefined、""返回false
  30. * */
  31. valueIsEmpty(vale) {
  32. const typeValue = typeof vale;
  33. if (typeValue == 'undefined') {
  34. return false;
  35. } else if (typeValue == 'object' || typeValue == 'string') {
  36. if (!vale) {
  37. return false;
  38. } else {
  39. return true;
  40. }
  41. } else {
  42. return true;
  43. }
  44. }
  45. /**
  46. * 地图定位,该定位适用于系统首页-工程列表,地址灾害-地址点,协同监测监测设备点
  47. * @param option entity定位实体, x坐标,y坐标,z高度,time定位时间,complete定位后的回调,map定位使用的地图,offset定位点偏移[x,y]
  48. */
  49. mapPointLocation_list2(option: {
  50. entity?: any;
  51. x: Number;
  52. y: Number;
  53. z?: Number;
  54. complete?: Function;
  55. time?: Number;
  56. map: any;
  57. offset?: Array<Number>;
  58. }) {
  59. option.map.viewer.entities.removeById(this.PointLocation_listId);
  60. if (option.entity) {
  61. const tempEntity = new Cesium.Entity({
  62. id: this.PointLocation_listId,
  63. position: option.entity.position,
  64. billboard: option.entity.billboard,
  65. });
  66. tempEntity.billboard.image = bw;
  67. if (option.offset) {
  68. tempEntity.billboard.pixelOffset = new Cesium.Cartesian2(option.offset[0], option.offset[1]);
  69. }
  70. option.map.viewer.entities.add(tempEntity);
  71. }
  72. // let cartesian = option.map.viewer.camera.pickEllipsoid(option.entity.position.getValue());
  73. // let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  74. // option.x = option.x||Cesium.Math.toDegrees(cartographic.longitude); // 经度
  75. // option.y = option.y||Cesium.Math.toDegrees(cartographic.latitude); // 纬度
  76. this.mapPointLocation(option);
  77. }
  78. /**
  79. * 清空实体波纹
  80. */
  81. clearBwList(map) {
  82. if (this.bwEntiListId && this.bwEntiListId.length > 0) {
  83. this.bwEntiListId.forEach((item) => {
  84. map.viewer.entities.removeById(item);
  85. });
  86. }
  87. this.bwEntiListId = [];
  88. }
  89. /**
  90. * 给实体添加波纹
  91. * */
  92. addBw(map, entityList) {
  93. this.clearBwList(map);
  94. entityList.forEach((item, index) => {
  95. const id = this.PointLocation_listId + '_' + index;
  96. let tempEn = item;
  97. if (item.entity) {
  98. tempEn = item.entity;
  99. }
  100. const tempEntity = new Cesium.Entity({
  101. id: id,
  102. position: tempEn.position,
  103. billboard: tempEn.billboard,
  104. });
  105. tempEntity.billboard.image = bw;
  106. map.viewer.entities.add(tempEntity);
  107. this.bwEntiListId.push(id);
  108. });
  109. }
  110. /**
  111. * 设置空数据的显示
  112. * */
  113. setEmptyValue(value) {
  114. if (!this.valueIsEmpty(value)) {
  115. return '';
  116. } else {
  117. return value;
  118. }
  119. }
  120. // mapPointLocation_list(option: {
  121. // entity?: any;
  122. // x: Number;
  123. // y: Number;
  124. // z?: Number;
  125. // complete?: Function;
  126. // time?: Number;
  127. // map: any;
  128. // offset?: Array<Number>;
  129. // }) {
  130. // this.mapPointLocation(option);
  131. // // let cartesian = option.map.viewer.camera.pickEllipsoid(option.entity.position.getValue());
  132. // // let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  133. // // option.x = option.x||Cesium.Math.toDegrees(cartographic.longitude); // 经度
  134. // // option.y = option.y||Cesium.Math.toDegrees(cartographic.latitude); // 纬度
  135. // }
  136. mapPointLocation_list(p, callback, offX = 0, offY = 15) {
  137. this.clearPointLocation_list(map);
  138. map.addOverlay(
  139. new TFMap.Marker(p, bw, {
  140. pixelOffset: new Cesium.Cartesian2(offX, offY),
  141. })
  142. .init()
  143. .setClassify(this.bwClass)
  144. );
  145. }
  146. mapLocation(p, callback, offX = 0, offY = 15) {
  147. map.removeOverlay(this.bwClass);
  148. map.addOverlay(
  149. new TFMap.Marker(p, bw, {
  150. pixelOffset: new Cesium.Cartesian2(offX, offY),
  151. })
  152. .init()
  153. .flyTo({
  154. offset: { heading: 6.213256405596909, pitch: -0.43673551853473613, range: 8000 },
  155. duration: 1,
  156. // complete: callback && callback(),
  157. })
  158. .setClassify(this.bwClass)
  159. );
  160. setTimeout(() => callback && callback(), 1500);
  161. }
  162. /**
  163. * 动态扩散圆
  164. * @param map定位使用的地图
  165. */
  166. trends3(p, callback, fly) {
  167. map.removeOverlay(this.bwClass);
  168. var c = new TFMap.Ellipse(p, 580, 580, 89).init().img('./static/img/dizuo.png').rotation().setClassify(this.bwClass);
  169. if (!fly) {
  170. c.flyTo({
  171. offset: { heading: 6.152030498572154, pitch: -0.7056602336022602, range: 7231 },
  172. duration: 1,
  173. });
  174. }
  175. map.addOverlay(c);
  176. setTimeout(() => callback && callback(), 1500);
  177. // map.addOverlay(new TFMap.Ellipse(p, 100, 100, 0, '#00ff00').init().ripple(3000).setClassify('trends*'));
  178. }
  179. /**
  180. * 动态扩散圆
  181. * @param map定位使用的地图
  182. */
  183. trends2(p, callback, fly) {
  184. map.removeOverlay(this.bwClass);
  185. map.addOverlay(new TFMap.Circle(p, 100, '#057cf3').init().spread(1500).setClassify(this.bwClass));
  186. var c = new TFMap.Circle(p, 200, '#057cf3').init().spread(3000).setClassify(this.bwClass);
  187. if (!fly) {
  188. c.flyTo({
  189. offset: { heading: 6.152030498572154, pitch: -0.7056602336022602, range: 7231 },
  190. duration: 1,
  191. });
  192. }
  193. map.addOverlay(c);
  194. setTimeout(() => callback && callback(), 1500);
  195. // map.addOverlay(new TFMap.Ellipse(p, 100, 100, 0, '#00ff00').init().ripple(3000).setClassify('trends*'));
  196. }
  197. /**
  198. * 清空实体波纹
  199. */
  200. trends(p, callback, fly) {
  201. map.removeOverlay(this.bwClass);
  202. //Ellipse(p, 50, 50)
  203. var c = new TFMap.Ellipse(p, 0.00001, 0.00001).init().img('./static/img/dizuo.png').rotation(0.2).setClassify(this.bwClass);
  204. if (!fly) {
  205. c.flyTo({
  206. offset: { heading: 6.152030498572154, pitch: -0.7056602336022602, range: 7231 },
  207. duration: 1,
  208. });
  209. }
  210. map.addOverlay(c);
  211. setTimeout(() => callback && callback(), 1500);
  212. }
  213. active(id) {
  214. if (window.activeMarker) window.activeMarker.update(), (window.activeMarker = null);
  215. if (id) window.activeMarker = map.findOverlay(id);
  216. if (window.activeMarker) window.activeMarker.update();
  217. }
  218. /**
  219. * 通过实体列表与实体id列表进行定位,
  220. * @param map定位使用的地图
  221. */
  222. mapPointLocation_list3(map, entiListId: Array<any>) {
  223. this.clearPointLocation_list(map);
  224. const entList = [];
  225. if (entiListId && entiListId.length > 0) {
  226. this.entiListId = entiListId;
  227. } else {
  228. return;
  229. }
  230. this.entiListId.forEach((item) => {
  231. entList.push(map.findOverlay(item));
  232. });
  233. if (entList.length > 0) {
  234. entList.map((m) => (m.entity.billboard.scale = 1.5));
  235. this.addBw(map, entList);
  236. map.flyToRectangle(entList, 0.1, {
  237. complete: () => {
  238. this.entiListId.forEach((itemId) => {
  239. map.showOverlay(itemId, true);
  240. });
  241. },
  242. });
  243. }
  244. }
  245. /**
  246. * 清空定位点
  247. * @param map定位使用的地图
  248. */
  249. clearPointLocation_list(map) {
  250. if(window.breathMarker){
  251. window.breathMarker.update()
  252. window.breathMarker.breathe()
  253. window.breathMarker=null
  254. }
  255. window.impointFlag=true
  256. if(!window.isThematicMap){
  257. window.getImportSites()
  258. }
  259. this.active();
  260. map.viewer.entities.removeById(this.PointLocation_listId);
  261. map.removeOverlay(this.bwClass);
  262. if (this.entiListId.length > 0) {
  263. this.entiListId.forEach((itemId) => {
  264. const temp = map.findOverlay(itemId);
  265. if (temp && temp.entity) {
  266. temp.entity.billboard.scale = 1;
  267. }
  268. });
  269. }
  270. this.clearBwList(map);
  271. }
  272. /**
  273. * 地图定位
  274. * @param option x坐标,y坐标,z高度,time定位时间,complete定位后的回调,map定位使用的地图,entity实体
  275. */
  276. mapPointLocation(option: {
  277. entity?: any;
  278. x: Number;
  279. y: Number;
  280. z?: Number;
  281. id: String;
  282. offset?: Array<Number>;
  283. complete?: Function;
  284. time?: Number;
  285. map: any;
  286. }) {
  287. if (!this.valueIsEmpty(option.z)) {
  288. option.z = 8000;
  289. }
  290. if (!this.valueIsEmpty(option.time)) {
  291. option.time = 0;
  292. }
  293. if (!this.valueIsEmpty(option.time)) {
  294. option.complete = (e) => { };
  295. }
  296. option.map.flyTo(
  297. {
  298. destination: {
  299. x: option.x,
  300. y: option.y,
  301. z: option.z,
  302. },
  303. orientation: {
  304. heading: 6.283185307179586,
  305. pitch: -1.5688928482139568,
  306. roll: 0,
  307. },
  308. },
  309. option.time,
  310. (e) => {
  311. this.getEntityBy(option.map, option.id, (e) => {
  312. this.addLocaltion(option.map, e, option.offset);
  313. });
  314. if (option.complete) {
  315. option.complete(e);
  316. }
  317. }
  318. );
  319. }
  320. /**
  321. * 定位图标添加
  322. */
  323. addLocaltion(map, Entity, offset) {
  324. map.viewer.entities.removeById(this.PointLocation_listId);
  325. if (Entity) {
  326. const tempEntity = new Cesium.Entity({
  327. id: this.PointLocation_listId,
  328. position: Entity.entity.position,
  329. billboard: Entity.entity.billboard,
  330. });
  331. tempEntity.billboard.image = bw;
  332. if (offset) {
  333. tempEntity.billboard.pixelOffset = new Cesium.Cartesian2(offset[0], offset[1]);
  334. }
  335. map.viewer.entities.add(tempEntity);
  336. }
  337. }
  338. /**
  339. * 根据id获取实体
  340. */
  341. getId(type: string, id: any): string {
  342. if (type == 'dzd' || type == '地灾点') {
  343. return `dzdmarker&&${id}`;
  344. } else if (type == 'dzdfw' || type == '地灾范围') {
  345. return `dzdRegion&&${id}`;
  346. } else if (type == 'gcd' || type == '工程') {
  347. return `gcdmarker&&${id}`;
  348. } else if (type == 'sbd' || type == '设备') {
  349. return `sbdmarker&&${id}`;
  350. } else if (type == 'ly' || type == '流域') {
  351. return `lymarker&&${id}`;
  352. } else if (type == 'yj' || type == '预警') {
  353. return `yjmarker&&${id}`;
  354. } else if (type == 'drainageBasin') {
  355. return `drainageBasin&&${id}`;
  356. } else if (type == 'drainageBasinStart') {
  357. return `drainageBasinStart&&${id}`;
  358. } else if (type == 'drainageBasinEnd') {
  359. return `drainageBasinEnd&&${id}`;
  360. }
  361. }
  362. // gcdMarkerDom(i) {
  363. // const data = JSON.stringify(i).replace(/\"/g, "'");
  364. // return `<div class="popup">
  365. // <h3>工程信息</h3>
  366. // <ul style="padding: 0 0px 0px 0px;background: transparent;margin-bottom: 5px;">
  367. // <li><span>工程名称:</span> <b>${i.st_name}</b></li>
  368. // <li><span>工程位置:</span> <b>${i.gcwz || '暂无数据'}</b></li>
  369. // <li><span>挡水建筑物类型:</span> <b>${i.dsjzwlx || '暂无数据'}</b></li>
  370. // <li><span>挡水建筑物最大高度(m):</span> <b>${i.dsjzwzdgd || '暂无数据'}</b></li>
  371. // <li><span>库容(m³):</span> <b>${i.zkr || '暂无数据'}</b></li>
  372. // <li><span>查看详情:</span> <b class="see" onclick="openEngineeringModel(${data})" style="color: rgba(21, 254, 254, 1)">查看>></b></li>
  373. // </ul>
  374. // <div class='popupBut'>
  375. // <img title='绕点飞行' onclick="aroundPoint(${i.x},${i.y},${i.z})" src='./static/img/view_rd.png' />
  376. // <img title='保存视角' onclick="saveView(${i.id},'gc')" src='./static/img/save_view.png' />
  377. // </div>
  378. // </div>`;
  379. // }
  380. gcdMarkerDom(i) {
  381. const data = JSON.stringify(i).replace(/\"/g, "'");
  382. let str = `<div class="popup">
  383. <div style="display:flex;align-items: center;">
  384. <span style="font-family: Source Han Sans CN;
  385. font-size: 16px;
  386. font-weight: 500;
  387. line-height: 36px;color: #FFFFFF;margin-right:10px;
  388. white-space: nowrap;
  389. overflow: hidden;
  390. text-overflow: ellipsis;"
  391. title="${i.st_name + i.typeName}"
  392. >${i.st_name + i.typeName}</span>
  393. <img style="display: inline-block;width:12px" title='查看详情' onclick="siteDetail(${data})" src='./static/img/detailArrow.png' />
  394. </div>
  395. <ul style="background: transparent; overflow: auto;height:150px">`
  396. let str2 = ''
  397. let str3 = `</ul>
  398. </div>`;
  399. for (let j = 0; j < i.sensor?.length; j++) {
  400. str2 += `<li><span> ${i.sensor[j].sensor_name} </span> <br/>
  401. <span style=" display: inline-block;"><span style="font-size:17px;color:#00A2FF; display: inline-block;margin-right:5px"> ${i.sensor[j].sensor_name.indexOf('风向') ==-1 ? i.sensor[j].real_value : this.setWd(i.sensor[j].real_value)}</span><span style="font-size:14px; display: inline-block;margin-right:10px"> ${i.sensor[j].sensor_name.indexOf('风向') ==-1 ? i.sensor[j].dchar : ''}</span> ${i.sensor[j].real_time?.slice(5, 16)}</span></li>`
  402. }
  403. return str + str2 + str3
  404. }
  405. // 重要测站点
  406. impotPointDom(i) {
  407. const data = JSON.stringify(i).replace(/\"/g, "'");
  408. let str =
  409. `<div class="impopup">
  410. <div class="impopup-content">`
  411. let str2 = ''
  412. for (let j = 0; j < i.data_real?.length; j++) {
  413. str2 += `
  414. <div style="height:52px; display:flex;align-items: center; flex-direction: column;justify-content: space-evenly;">
  415. <div style="display:flex;align-items: center;justify-content: space-between;width:100%">
  416. <span style="font-family: Source Han Sans CN;
  417. font-size: 14px;
  418. font-weight: 500;
  419. color: #FFFFFF;margin-right:10px;"><span style="margin-right:10px">${i.st_name}</span> ${i.data_real[j].real_time?.slice(5, 16)}</span>
  420. <img style="display: inline-block;width:12px" title='查看详情' onclick="siteDetail(${data})" src='./static/img/detailArrow.png' />
  421. </div>
  422. <div style="width:100%">
  423. <span style=" display: inline-block;color: rgba(255, 255, 255, 1);">
  424. <span style="color: #FFFFFF; margin-right:10px"> ${i.data_real[j].sensor_name}</span>
  425. <span style="font-size:14px; display: inline-block;margin-right:2px"> ${i.data_real[j].real_value}</span>
  426. <span style="font-size:14px; display: inline-block;"> ${ i.data_real[j].dchar}</span>
  427. </span></div>
  428. </div>
  429. `
  430. }
  431. let str3 = `</div></div>`;
  432. // return str
  433. // <ul style="background: transparent; overflow: auto;height:150px">`
  434. // let str2 = ''
  435. // let str3 = `</ul>
  436. // </div>`;
  437. // for (let j = 0; j < i.data_real?.length; j++) {
  438. // str2 += `<li><span> ${i.data_real[j].sensor_name} </span> <br/>
  439. // <span style=" display: inline-block;"><span style="font-size:17px;color:#00A2FF; display: inline-block;margin-right:5px"> ${i.data_real[j].real_value}</span><span style="font-size:14px; display: inline-block;margin-right:10px"> ${ i.data_real[j].dchar}</span> ${i.data_real[j].real_time?.slice(11, 16)}</span></li>`
  440. // }
  441. return str + str2 + str3
  442. }
  443. setWd(wds) {
  444. let wd = wds*1
  445. if (wd >= 348.76 || wd <= 11.25) {
  446. return 'N';
  447. }
  448. if (wd >= 11.26 && wd <= 33.75) {
  449. return 'NNE';
  450. }
  451. if (wd >= 33.76 && wd <= 56.25) {
  452. return 'NE';
  453. }
  454. if (wd >= 56.26 && wd <= 78.75) {
  455. return 'ENE';
  456. }
  457. if (wd >= 78.76 && wd <= 101.25) {
  458. return 'E';
  459. }
  460. if (wd >= 101.26 && wd <= 123.75) {
  461. return 'ESE';
  462. }
  463. if (wd >= 123.76 && wd <= 146.25) {
  464. return 'SE';
  465. }
  466. if (wd >= 146.26 && wd <= 168.75) {
  467. return 'SSE';
  468. }
  469. if (wd >= 168.76 && wd <= 191.25) {
  470. return 'S';
  471. }
  472. if (wd >= 191.26 && wd <= 213.75) {
  473. return 'SSW';
  474. }
  475. if (wd >= 213.76 && wd <= 236.25) {
  476. return 'SW';
  477. }
  478. if (wd >= 236.26 && wd <= 258.75) {
  479. return 'WSW';
  480. }
  481. if (wd >= 258.76 && wd <= 281.25) {
  482. return 'W';
  483. }
  484. if (wd >= 281.76 && wd <= 303.75) {
  485. return 'WNW';
  486. }
  487. if (wd >= 303.76 && wd <= 326.25) {
  488. return 'NW';
  489. }
  490. if (wd >= 326.26 && wd <= 348.75) {
  491. return 'NNW';
  492. }
  493. }
  494. dzdMarkerDom(i) {
  495. console.log('dzdMarkerDom', i);
  496. console.log('dzdMarkerDom', i.id);
  497. // <li><span>地理位置:</span> <b>${i.dqwz || '暂无数据'}</b></li>
  498. return `<div class="popup">
  499. <h3>灾害点信息</h3>
  500. <ul style="padding: 10px 0px 0px 0px;background: transparent;">
  501. <li><span>灾害名称:</span> <b>${i.dzmc}</b></li>
  502. <li><span>灾害类型:</span> <b>${i.dzlxmc || '暂无数据'}</b></li>
  503. <li><span>危险性分级:</span> <b>${i.wxxfjmc || '暂无数据'}</b></li>
  504. <li><span>当前状态:</span> <b>${i.dqzt || '暂无数据'}</b></li>
  505. <li><span>查看详情:</span> <b class="see" onclick="openModelDzd('${i.id}')" style="color: rgba(21, 254, 254, 1)">查看>></b></li>
  506. </ul>
  507. <div class='popupBut'>
  508. <img title='绕点飞行' onclick="aroundPoint(${i.x},${i.y},${i.z})" src='./static/img/view_rd.png' />
  509. <img title='保存视角' onclick="saveView(${i.id},'dz')" src='./static/img/save_view.png' />
  510. </div>
  511. </div>`;
  512. }
  513. sbdMarkerDom(i) {
  514. const iTemp = JSON.parse(JSON.stringify(i));
  515. delete iTemp.tableCellIcon;
  516. const data = JSON.stringify(iTemp).replace(/\"/g, "'");
  517. let state = '';
  518. if (iTemp.online_dictText) {
  519. state = iTemp.online_dictText;
  520. } else {
  521. state = this.valueIsEmpty(iTemp.videoIsOnline) ? (iTemp.videoIsOnline == '0' ? '离线' : '在线') : '暂无数据';
  522. }
  523. console.log('sbdMarkerDom:', iTemp);
  524. if (i.deviceKind == 'L4SP') {
  525. return `<div class="popup">
  526. <h3>监测设备信息</h3>
  527. <ul style="padding: 0 0px 0px 0px;background: transparent;">
  528. <li><span>设备名称:</span> <b>${iTemp.deviceName || '暂无数据'}</b></li>
  529. <li><span>设备类型:</span> <b>${'视频监测仪'}</b></li>
  530. <li><span>设备状态:</span> <b>${state}</b></li>
  531. <li><span>安装位置:</span> <b>${iTemp.location || '暂无数据'}</b></li>
  532. <li><span>视频预览:</span>
  533. <b class="see" onclick="openModelVideo(${data})" style="color: rgba(21, 254, 254, 1)">查看</b>
  534. <b class="see" onclick="editVideo(${data})" style="color: rgba(21, 254, 254, 1)">编辑</b>
  535. <b class="see" onclick="playVideo(${data})" style="color: rgba(21, 254, 254, 1)">融合</b>
  536. </li>
  537. </ul>
  538. <div class='popupBut'>
  539. <img title='保存视角' onclick="saveView(${iTemp.deviceCode},'sb')" src='./static/img/save_view.png' />
  540. </div>
  541. </div>`;
  542. } else {
  543. return `<div class="popup">
  544. <h3>监测设备信息</h3>
  545. <ul style="padding: 0 0px 0px 0px;background: transparent;">
  546. <li><span>设备名称:</span> <b>${iTemp.deviceName || '暂无数据'}</b></li>
  547. <li><span>设备类型:</span> <b>${iTemp.deviceKind_dictText || '暂无数据'}</b></li>
  548. <li><span>设备状态:</span> <b>${iTemp.online_dictText || '暂无数据'}</b></li>
  549. <li><span>传感器数量:</span> <b>${iTemp.sensorCount || '暂无数据'}</b></li>
  550. <li><span>查看详情:</span> <b class="see" onclick="openModel(${data})" style="color: rgba(21, 254, 254, 1)">查看>></b></li>
  551. </ul>
  552. <div class='popupBut'>
  553. <img title='保存视角' onclick="saveView(${iTemp.deviceCode},'sb')" src='./static/img/save_view.png' />
  554. </div>
  555. </div>`;
  556. }
  557. }
  558. waterMarkerDom(i) {
  559. const iTemp = JSON.parse(JSON.stringify(i));
  560. delete iTemp.tableCellIcon;
  561. iTemp.deviceName = iTemp.hydrologyDeviceName;
  562. iTemp.deviceKind = iTemp.hydrologyDeviceKind;
  563. iTemp.deviceKind_dictText = iTemp.hydrologyDeviceKind;
  564. iTemp.monitorPointName = iTemp.hydrologyDeviceLocation;
  565. iTemp.online_dictText = iTemp.hydrologyDeviceonline_dictText;
  566. iTemp.startMonitorTime = iTemp.createTime;
  567. iTemp.deviceCode = iTemp.hydrologyDeviceCode;
  568. iTemp.isWater = true;
  569. const data = JSON.stringify(iTemp).replace(/\"/g, "'");
  570. let state = '';
  571. if (iTemp.online_dictText) {
  572. state = iTemp.online_dictText;
  573. } else {
  574. state = this.valueIsEmpty(iTemp.videoIsOnline) ? (iTemp.videoIsOnline == '0' ? '离线' : '在线') : '暂无数据';
  575. }
  576. console.log('waterMarkerDom:', iTemp);
  577. console.log('data:', data);
  578. if (i.deviceKind == 'L4SP') {
  579. return `<div class="popup">
  580. <h3>监测设备信息</h3>
  581. <ul style="padding: 0 0px 0px 0px;background: transparent;">
  582. <li><span>设备名称:</span> <b>${iTemp.deviceName || '暂无数据'}</b></li>
  583. <li><span>设备类型:</span> <b>${'视频监测仪'}</b></li>
  584. <li><span>设备状态:</span> <b>${iTemp.hydrologyDeviceonline}</b></li>
  585. <li><span>安装位置:</span> <b>${iTemp.location || '暂无数据'}</b></li>
  586. <li><span>视频预览:</span> <b class="see" onclick="openModelVideo(${data})" style="color: rgba(21, 254, 254, 1)">查看>></b></li>
  587. <li><span>视频融合:</span> <b class="see" onclick="playVideo(${data})" style="color: rgba(21, 254, 254, 1)">查看>></b></li>
  588. </ul>
  589. <div class='popupBut'>
  590. <img title='保存视角' onclick="saveView(${iTemp.deviceCode},'sb')" src='./static/img/save_view.png' />
  591. </div>
  592. </div>`;
  593. } else {
  594. return `<div class="popup">
  595. <h3>监测设备信息</h3>
  596. <ul style="padding: 0 0px 0px 0px;background: transparent;">
  597. <li><span>设备名称:</span> <b>${iTemp.hydrologyDeviceName || '暂无数据'}</b></li>
  598. <li><span>设备类型:</span> <b>${iTemp.hydrologyDeviceKind || '暂无数据'}</b></li>
  599. <li><span>设备状态:</span> <b>${iTemp.hydrologyDeviceonline || '暂无数据'}</b></li>
  600. <li><span>传感器数量:</span> <b>${iTemp.hydrologyDeviceonline || '暂无数据'}</b></li>
  601. <li><span>查看详情:</span> <b class="see" onclick="openModel(${data})" style="color: rgba(21, 254, 254, 1)">查看>></b></li>
  602. </ul>
  603. <div class='popupBut'>
  604. <img title='保存视角' onclick="saveView(${iTemp.deviceCode},'sb')" src='./static/img/save_view.png' />
  605. </div>
  606. </div>`;
  607. }
  608. }
  609. waterDevMarkerDom(i) {
  610. console.log('这个是传感器弹窗');
  611. const iTemp = JSON.parse(JSON.stringify(i));
  612. delete iTemp.tableCellIcon;
  613. iTemp.deviceName = '';
  614. iTemp.deviceKind = '';
  615. iTemp.deviceKind_dictText = '';
  616. // iTemp.monitorPointName=''
  617. iTemp.online_dictText = iTemp.state;
  618. iTemp.startMonitorTime = iTemp.onlineTime;
  619. iTemp.isWater = true;
  620. const data = JSON.stringify(iTemp).replace(/\"/g, "'");
  621. let state = '';
  622. if (iTemp.online_dictText) {
  623. state = iTemp.online_dictText;
  624. } else {
  625. state = this.valueIsEmpty(iTemp.videoIsOnline) ? (iTemp.videoIsOnline == '0' ? '离线' : '在线') : '暂无数据';
  626. }
  627. console.log('waterMarkerDom:', iTemp);
  628. console.log('data:', data);
  629. if (i.deviceKind == 'L4SP') {
  630. return `<div class="popup">
  631. <h3>传感器信息</h3>
  632. <ul style="padding: 0 0px 0px 0px;background: transparent;">
  633. <li><span>传感器名称:</span> <b>${iTemp.monitorPointName || '暂无数据'}</b></li>
  634. <li><span>传感器类型:</span> <b>${'视频监测仪'}</b></li>
  635. <li><span>传感器状态:</span> <b>${iTemp.deviceOnline}</b></li>
  636. <li><span>采集时间:</span> <b>${iTemp.location || '暂无数据'}</b></li>
  637. <li><span>视频预览:</span> <b class="see" onclick="openModelVideo(${data})" style="color: rgba(21, 254, 254, 1)">查看>></b></li>
  638. <li><span>视频融合:</span> <b class="see" onclick="playVideo(${data})" style="color: rgba(21, 254, 254, 1)">查看>></b></li>
  639. </ul>
  640. <div class='popupBut'>
  641. <img title='保存视角' onclick="saveView(${iTemp.deviceCode},'sb')" src='./static/img/save_view.png' />
  642. </div>
  643. </div>`;
  644. } else {
  645. return `<div class="popup">
  646. <h3>传感器信息</h3>
  647. <ul style="padding: 0 0px 0px 0px;background: transparent;">
  648. <li><span>传感器名称:</span> <b>${iTemp.sensorSiteCode || '暂无数据'}</b></li>
  649. <li><span>传感器类型:</span> <b>${iTemp.sensorType}</b></li>
  650. <li><span>传感器状态:</span> <b>${iTemp.deviceOnline}</b></li>
  651. <li><span>查看详情:</span> <b class="see" onclick="openModel(${data})" style="color: rgba(21, 254, 254, 1)">查看>></b></li>
  652. </ul>
  653. <div class='popupBut'>
  654. <img title='保存视角' onclick="saveView(${iTemp.deviceCode},'sb')" src='./static/img/save_view.png' />
  655. </div>
  656. </div>`;
  657. }
  658. // <li><span>采集时间:</span> <b>${iTemp.location || '暂无数据'}</b></li>
  659. }
  660. getOffset(type: string, id: any): Array<number> {
  661. if (type == 'dzd' || type == '地灾点') {
  662. return [0, 15];
  663. } else if (type == 'gcd' || type == '工程') {
  664. return [0, 15];
  665. } else if (type == 'sbd' || type == '设备') {
  666. return [0, 15];
  667. } else if (type == 'ly' || type == '流域') {
  668. return [0, 15];
  669. } else if (type == 'yj' || type == '预警') {
  670. return [0, 15];
  671. } else {
  672. return [];
  673. }
  674. }
  675. /**
  676. * @description 传感器弹窗 => HTML
  677. */
  678. sensorMarkerDom(i) {
  679. if (i.hydrologyDeviceCode) {
  680. i.isWater = true
  681. console.log('这是水文站');
  682. }
  683. const iTemp = JSON.parse(JSON.stringify(i));
  684. delete iTemp.tableCellIcon;
  685. const data = JSON.stringify(iTemp).replace(/\"/g, "'");
  686. console.log(data, '');
  687. return `<div class="popup">
  688. <h3>传感器信息</h3>
  689. <ul style="padding: 0 0px 0px 0px;background: transparent;">
  690. <li><span>传感器名称:</span> <b>${iTemp.sensorSiteCode || '暂无数据'}</b></li>
  691. <li><span>传感器类型:</span> <b title='${iTemp.sensorType}'>${iTemp.sensorType || '暂无数据'}</b></li>
  692. <li><span>传感器状态:</span> <b>${iTemp.state || '暂无数据'}</b></li>
  693. <li><span>查看详情:</span> <b class="see" onclick="openModel(${data})" style="color: rgba(21, 254, 254, 1)">查看>></b></li>
  694. </ul>
  695. </div>`;
  696. }
  697. // <li><span>采集时间:</span> <b title='${iTemp.onlineTime}'>${iTemp.onlineTime || '暂无数据'}</b></li>
  698. /**
  699. *使用定时任务确保实体的获取,最多循环5次
  700. */
  701. getEntityBy(map, id, callBack) {
  702. let tempNumber = 0;
  703. const maxNumber = 5; //最多循环5次
  704. const tempEvent = window.setTimeout((e) => {
  705. const tempData = map.findOverlay(id);
  706. tempNumber++;
  707. if (tempData || tempNumber == maxNumber) {
  708. window.clearInterval(tempEvent);
  709. callBack(tempData);
  710. }
  711. }, 200);
  712. }
  713. /**
  714. * 清空数组数据
  715. */
  716. clearArray(data: Array<any>) {
  717. data.splice(0, data.length);
  718. return data;
  719. }
  720. /**
  721. * 清空数组数据
  722. */
  723. clearObject(data: Object) {
  724. for (let item in data) {
  725. data[item];
  726. }
  727. return data;
  728. }
  729. /**
  730. * 所有点位点击事件后的弹框
  731. */
  732. setSTMarkerPopup(e) {
  733. if(window.breathMarker){
  734. window.breathMarker.update()
  735. window.breathMarker.breathe()
  736. window.breathMarker=null
  737. }
  738. if (e && e.graphic && e.graphic.overlay) {
  739. e.graphic.overlay.update()
  740. e.graphic.overlay.breathe(0,0)
  741. window.breathMarker=e.graphic.overlay
  742. }
  743. window.clearImpoint()
  744. var i = e.graphic.overlay.info
  745. map.openInfoWindowHtml(this.gcdMarkerDom(i), { position: [i.lng, i.lat, i.high] }, () => this.clearPointLocation_list(map));
  746. map.popup.setOffset(-185, 50);
  747. }
  748. }
  749. const tFMapUitl = new TFMapUitl();
  750. export default tFMapUitl;