Map.vue 92 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451
  1. <!--
  2. * @Author: sjl
  3. * @Date: 2021-09-08 16:19:24
  4. * @Descripttion:
  5. -->
  6. <template>
  7. <div>
  8. <!-- 弹窗暂用 -->
  9. <Dialog :width="'1300px'" :height="900" :dialogVisable="dialogvisable" :title="title" @visible-change="closeModal">
  10. <div>
  11. <mapDialog :detailInfo="detailInfo" :title="title"/>
  12. </div>
  13. </Dialog>
  14. <changeMap @changeMap="changeMapBack" />
  15. <toolBox />
  16. <legendImg />
  17. <!-- <ToolMenu @map23changeEvent="map23change" /> -->
  18. <!-- <ToolMenuBot /> -->
  19. <div id="mapDiv" :style="addDoubleScreen ? 'width:50%' : 'width:100%'">
  20. <div id="leftMapMfasking" class="mapMfasking" v-if="mapStore.leftSideMenu"></div>
  21. <div id="rightMapMfasking" class="mapMfasking" v-if="mapStore.rightSideMenu"></div>
  22. <!-- <div style="display: inline-block;font-size: 16px;padding-top: 0px;top: 100px; left: 300px; background-color: white; color: #000; position: absolute; z-index: 999;height: 24px;"><div >这里显示标题</div></div>
  23. <div style="display: inline-block;font-size: 16px;padding-top: 0px;top: 100px; left: 1200px; background-color: white; color: #000; position: absolute; z-index: 999;height: 24px;"><div >这里显示标题</div></div> -->
  24. </div>
  25. <!-- <doubleScreen v-if="addDoubleScreen" /> -->
  26. <!-- <Curve ref="curve" /> -->
  27. <!-- 经纬度 -->
  28. <div class="jwd">
  29. <div>经度: &nbsp;{{ lat ? lat : '暂无数据' }}</div>
  30. <div>纬度: &nbsp;{{ lng ? lng : '暂无数据' }}</div>
  31. </div>
  32. </div>
  33. <!-- <div style="width:100vh,height:100%">
  34. <BasicInformation />
  35. </div> -->
  36. <!-- <detailsInfo /> -->
  37. </template>
  38. <script>
  39. import Dialog from '/@/components/Dialog/index.vue';
  40. import mapDialog from '/@/components/Dialog/mapDialog.vue';
  41. import { defineComponent, ref, watch,onBeforeUnmount } from 'vue';
  42. import jquery from 'jquery';
  43. import Curve from './Curve.vue';
  44. import BasicInformation from '/@/views/map/EngineeringModel/index.vue';
  45. import { useGeologicalStore } from '/@/store/modules/geological';
  46. import { useMonitorDevicesStore } from '/@/store/modules/monitorDevices';
  47. import eventBus from '/@/utils/eventBus';
  48. import ToolMenu from './ToolMenu.vue';
  49. import ToolMenuBot from './ToolMenuBot.vue';
  50. import dxh from '../../assets/json/dxh.json';
  51. import TFMapUitl from '/@/utils/TFMapUitl.ts';
  52. import { getColorVal, getWdColorVal } from '/@/utils/getcolor.js';
  53. import doubleScreen from './doubleScreen.vue';
  54. import dzdSvg from '../../assets/images/dzd.svg';
  55. import { useMapStore } from '/@/store/modules/map';
  56. import LINGZHI from '../../assets/json/lingzhi.js';
  57. import { getStrUnicode } from '/@/utils/fnUtils.ts';
  58. import detailsInfo from '/@/views/map/detailsInfo/index.vue';
  59. import ybjJson from './ybj.json';
  60. import toolBox from './toolBox.vue';
  61. import changeMap from './changeMap.vue';
  62. import legendImg from './legend.vue';
  63. // 基础测站点
  64. import { useBasicStore } from '/@/store/modules/basicData';
  65. import { rainMap, rainMapfq, wdMap, gcSite, getStDetailInfo, changeHeight,getImportPoint } from '/@/api/swHome/index';
  66. import fenquData from './fenqu.json';
  67. import { useMessage } from '/@/hooks/web/useMessage';
  68. import './range.js'
  69. let dzdxInfoList = null;
  70. let gcInfoList = null;
  71. let monitorSensorsList = null;
  72. let monitorDevicesList = null;
  73. let dzgcMarkerIdList = new Object();
  74. const { createMessage } = useMessage();
  75. export default defineComponent({
  76. name: 'Map',
  77. components: {
  78. ToolMenu,
  79. ToolMenuBot,
  80. Curve,
  81. doubleScreen,
  82. BasicInformation,
  83. detailsInfo,
  84. toolBox,
  85. changeMap,
  86. legendImg,
  87. Dialog,
  88. mapDialog,
  89. },
  90. setup() {
  91. const mapStore = useMapStore();
  92. const basicStore = useBasicStore();
  93. const dialogvisable = ref(false);
  94. const title = ref('羊村水文站(9061000183)');
  95. const closeModal = (i) => {
  96. dialogvisable.value = i;
  97. };
  98. const rainData = ref([]);
  99. const rainDatafq = ref([
  100. { name: '羊村—米林', value: 0 },
  101. { name: '米林—尼西—玉松', value: 0 },
  102. { name: '排龙站以上流域', value: 0 },
  103. { name: '金珠藏布流域', value: 0 },
  104. { name: '玉松—排龙—希让', value: 0 },
  105. { name: '白马西路河流域', value: 0 },
  106. ]);
  107. // 存放气象站数据
  108. const qixiangData = ref([]);
  109. const changeMapBack = (val) => {
  110. map.removeOverlay('rainMap*');
  111. map.removeOverlay('fqPolygon');
  112. map.removeOverlay('wdMap*');
  113. map.removeOverlay('fxMap*');
  114. if(window.iso){
  115. iso.remove()
  116. }
  117. rainData.value = basicStore.getStDetailInfo.st_rain;
  118. qixiangData.value = [...basicStore.getStDetailInfo.st_wea_general, ...basicStore.getStDetailInfo.st_wea_standard];
  119. // 关闭基础图层
  120. if (val.flag) {
  121. window.clearImpoint()
  122. map.showOverlay('shuiwenzhan*', false);
  123. map.showOverlay('shuiweizhan*', false);
  124. map.showOverlay('yuliangzhan*', false);
  125. map.showOverlay('yibanqixiangzhan*', false);
  126. map.showOverlay('biaozhunqixiangzhan*', false);
  127. map.showOverlay('tanshuitongliangzhan*', false);
  128. map.showOverlay('gc*', false);
  129. map.showOverlay('fqPolygon', false);
  130. // map.showLayer2D('yuliangfenqu', false);
  131. map.showLayer2D('sx', false);
  132. if (val.maptype == 1) {
  133. rainMap({ start_time: val.start_time, end_time: val.end_time }).then((res) => {
  134. // 添加value
  135. if (res.code == 200 && res.data?.length > 0) {
  136. let arr=[]
  137. rainData.value.forEach((item) => {
  138. res.data.forEach((item2) => {
  139. if (item.stcd == item2.stcd) {
  140. item.value = item2.value;
  141. arr.push(item2.value)
  142. }
  143. });
  144. });
  145. eventBus.emit('rainLegend', {max:Math.max(...arr),min:Math.min(...arr)});
  146. // 更新点
  147. uprainLayer();
  148. }
  149. });
  150. // 面雨量图
  151. } else if (val.maptype == 0) {
  152. rainMap({ start_time: val.start_time, end_time: val.end_time }).then((res) => {
  153. // 添加value
  154. if (res.code == 200 && res.data?.length > 0) {
  155. let arr=[]
  156. rainData.value.forEach((item) => {
  157. res.data.forEach((item2) => {
  158. if (item.stcd == item2.stcd) {
  159. item.value = item2.value;
  160. arr.push(item2.value)
  161. }
  162. });
  163. });
  164. eventBus.emit('rainLegend', {max:Math.max(...arr),min:Math.min(...arr)});
  165. // 更新点
  166. uprainAreaLayer()
  167. }
  168. });
  169. } else if (val.maptype == 2) {
  170. rainMapfq({ start_time: val.start_time, end_time: val.end_time }).then((res) => {
  171. // 添加value
  172. if (res.code == 200 && res.data?.length > 0) {
  173. let arr=[]
  174. rainDatafq.value.forEach((item) => {
  175. res.data.forEach((item2) => {
  176. if (item.name == item2.name) {
  177. item.value = item2.value;
  178. arr.push(item2.value)
  179. }
  180. });
  181. });
  182. eventBus.emit('rainLegend', {max:Math.max(...arr),min:Math.min(...arr)});
  183. // 更新分区
  184. loadFenquLayers();
  185. }
  186. });
  187. // 温度
  188. } else if (val.maptype == 3) {
  189. qixiangData.value = [...basicStore.getStDetailInfo.st_wea_general, ...basicStore.getStDetailInfo.st_wea_standard];
  190. wdMap({ time: val.end_time }).then((res) => {
  191. if (res.code == 200 && res.data?.st_temp?.length > 0) {
  192. let arr=[]
  193. qixiangData.value.forEach((item) => {
  194. res.data.st_temp.forEach((item2) => {
  195. if (item.stcd == item2.stcd) {
  196. item.value = item2.value;
  197. item.cunzai = true;
  198. arr.push(item2.value)
  199. }
  200. });
  201. });
  202. eventBus.emit('wdLegend', {max:Math.max(...arr),min:Math.min(...arr)});
  203. // 更新点
  204. upwdLayer();
  205. }
  206. });
  207. // 风速风向
  208. } else if (val.maptype == 4) {
  209. qixiangData.value = [...basicStore.getStDetailInfo.st_wea_general, ...basicStore.getStDetailInfo.st_wea_standard];
  210. wdMap({ time: val.end_time }).then((res) => {
  211. if (res.code == 200 && res.data?.wind_info?.length > 0) {
  212. qixiangData.value.forEach((item) => {
  213. res.data.wind_info.forEach((item2) => {
  214. if (item.stcd == item2.stcd) {
  215. item.ws = item2.ws;
  216. item.wd = item2.wd;
  217. item.cunzai = true;
  218. }
  219. });
  220. });
  221. // 更新点
  222. upfxLayer();
  223. }
  224. });
  225. }
  226. } else {
  227. // 获取重要测站点
  228. window.impointFlag=true
  229. window.getImportSites()
  230. map.showOverlay('shuiwenzhan*', true);
  231. map.showOverlay('shuiweizhan*', true);
  232. map.showOverlay('yuliangzhan*', true);
  233. map.showOverlay('yibanqixiangzhan*', true);
  234. map.showOverlay('biaozhunqixiangzhan*', true);
  235. map.showOverlay('tanshuitongliangzhan*', true);
  236. map.showOverlay('gc*', true);
  237. map.showOverlay('fqPolygon', true);
  238. // map.showLayer2D('sx', true);
  239. }
  240. };
  241. const detailInfo = ref([]);
  242. const uprainLayer = () => {
  243. rainData.value.forEach((i) => {
  244. i.typeName = '雨量站';
  245. if (i.lat && i.lng) {
  246. let canvas = document.createElement('canvas');
  247. let context = canvas.getContext('2d');
  248. let textWidth = 14;
  249. canvas.width = 20;
  250. canvas.height = 20;
  251. let x = 0.8;
  252. let y = 0.8;
  253. let w = canvas.width;
  254. let h = canvas.height;
  255. let r = 5;
  256. // 缩放
  257. context.scale(0.8, 0.8);
  258. // context.fillStyle = 'rgba(0,0,0,0.5)'
  259. context.fillStyle = getColorVal(i.value);
  260. // context.fillStyle = 'rgba(231, 231, 231,0.9)'
  261. // 阴影
  262. context.shadowOffsetX = 5;
  263. context.shadowOffsetY = 5;
  264. context.shadowBlur = 2;
  265. context.shadowColor = 'rgba(0,0,0,0.5)';
  266. // 绘制圆角矩形
  267. context.beginPath();
  268. context.arc(w, h, r, 0, 2 * Math.PI);
  269. context.closePath();
  270. context.fill();
  271. var marker = new TFMap.Marker({ x: i.lng, y: i.lat, z: i.high }, canvas, {
  272. scale: 1.5,
  273. })
  274. // .action('./static/img/gc2.png')
  275. .init()
  276. .pierce();
  277. marker.setId('rain&' + i.stcd);
  278. const tempClass = TFMapUitl.getId('gcd', i.stcd) + '*' + ',' + 'rainMap*';
  279. marker.setClassify(tempClass);
  280. dzgcMarkerIdList[marker.id] = marker;
  281. marker.label(i.st_name + ' ' + i.value + 'mm', '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 20, 'rgba(6,161,239,0)');
  282. marker.info = i;
  283. // console.log(marker.info, 74);
  284. marker.addListener(map, (e) => {
  285. if(window.breathMarker){
  286. window.breathMarker.breathe()
  287. window.breathMarker=null
  288. }
  289. if (e && e.graphic && e.graphic.overlay) {
  290. e.graphic.breathe(0,0.3)
  291. window.breathMarker=e.graphic.overlay
  292. }
  293. var i = e.graphic.overlay.info
  294. map.openInfoWindowHtml(TFMapUitl.gcdMarkerDom(i), { position: [i.lng, i.lat, i.high] }, () => TFMapUitl.clearPointLocation_list(map));
  295. map.popup.setOffset(-182, 64);
  296. });
  297. map.addOverlay(marker);
  298. }
  299. });
  300. };
  301. const colors = [
  302. { min: 2000, max: 99999, color: "#ffffff" },
  303. { min: 250, max: 2000, color: "#84003f" },
  304. { min: 100, max: 250, color: "#fa00fa" },
  305. { min: 50, max: 100, color: "#0000fe" },
  306. { min: 25, max: 50, color: "#61b8ff" },
  307. { min: 10, max: 25, color: "#3db93d" },
  308. { min: 1, max: 10, color: "#a6f28e" },
  309. { min: 0, max: 1, color: "rgba(0,0,0,0)" },
  310. ]
  311. // 更新面雨量分布图
  312. const uprainAreaLayer = () => {
  313. // window.mapConfig.isosurfaceUrl='http://106.12.170.138:4001/isosurface'
  314. rainData.value.forEach(i=>{
  315. if(Number(i.value)){
  316. i.value=Number(i.value)
  317. }else{
  318. i.value=0
  319. }
  320. })
  321. const key = 'updatable';
  322. createMessage.loading({ content: '正在进行面雨量分布图计算,请勿进行其他操作', key, duration: 0 });
  323. window.iso = new TFMap.Isosurface(map, rainData.value, range,colors,()=>{
  324. createMessage.success({ content: '面雨量分布图计算完成', key, duration: 2 });
  325. });
  326. iso.init();
  327. };
  328. // 温度图
  329. const upwdLayer = () => {
  330. qixiangData.value.forEach((i) => {
  331. i.typeName = '气象站';
  332. if (i.lat && i.lng && i.cunzai) {
  333. let canvas = document.createElement('canvas');
  334. let context = canvas.getContext('2d');
  335. let textWidth = 14;
  336. canvas.width = 20;
  337. canvas.height = 20;
  338. let x = 0.8;
  339. let y = 0.8;
  340. let w = canvas.width;
  341. let h = canvas.height;
  342. let r = 5;
  343. // 缩放
  344. context.scale(0.8, 0.8);
  345. // context.fillStyle = 'rgba(0,0,0,0.5)'
  346. context.fillStyle = getWdColorVal(i.value);
  347. // context.fillStyle = 'rgba(231, 231, 231,0.9)'
  348. // 阴影
  349. context.shadowOffsetX = 5;
  350. context.shadowOffsetY = 5;
  351. context.shadowBlur = 2;
  352. context.shadowColor = 'rgba(0,0,0,0.5)';
  353. // 绘制圆角矩形
  354. context.beginPath();
  355. context.arc(w, h, r, 0, 2 * Math.PI);
  356. context.closePath();
  357. context.fill();
  358. var marker = new TFMap.Marker({ x: i.lng, y: i.lat, z: i.high }, canvas, {
  359. scale: 1.5,
  360. })
  361. // .action('./static/img/gc2.png')
  362. .init()
  363. .pierce();
  364. marker.setId('wd&' + i.stcd);
  365. const tempClass = TFMapUitl.getId('gcd', i.stcd) + '*' + ',' + 'wdMap*';
  366. marker.setClassify(tempClass);
  367. dzgcMarkerIdList[marker.id] = marker;
  368. marker.label(i.st_name + ' ' + i.value + '℃', '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 20, 'rgba(6,161,239,0)');
  369. marker.info = i;
  370. // console.log(marker.info, 74);
  371. marker.addListener(map, (e) => {
  372. if(window.breathMarker){
  373. window.breathMarker.breathe()
  374. window.breathMarker=null
  375. }
  376. if (e && e.graphic && e.graphic.overlay) {
  377. e.graphic.overlay.breathe(0,0.3)
  378. window.breathMarker=e.graphic.overlay
  379. }
  380. var i = e.graphic.overlay.info
  381. map.openInfoWindowHtml(TFMapUitl.gcdMarkerDom(i), { position: [i.lng, i.lat, i.high] }, () => TFMapUitl.clearPointLocation_list(map));
  382. map.popup.setOffset(-182, 64);
  383. });
  384. map.addOverlay(marker);
  385. }
  386. });
  387. };
  388. // 风速风向图
  389. const upfxLayer = () => {
  390. qixiangData.value.forEach((i) => {
  391. i.typeName = '气象站';
  392. if (i.lat && i.lng && i.cunzai) {
  393. let canvas = document.createElement('canvas');
  394. let context = canvas.getContext('2d');
  395. let textWidth = 14;
  396. canvas.width = 20;
  397. canvas.height = 20;
  398. let x = 0.8;
  399. let y = 0.8;
  400. let w = canvas.width;
  401. let h = canvas.height;
  402. let r = 5;
  403. // 缩放
  404. context.scale(0.8, 0.8);
  405. // context.fillStyle = 'rgba(0,0,0,0.5)'
  406. context.fillStyle = '#fff';
  407. // context.fillStyle = 'rgba(231, 231, 231,0.9)'
  408. // 阴影
  409. context.shadowOffsetX = 5;
  410. context.shadowOffsetY = 5;
  411. context.shadowBlur = 2;
  412. context.shadowColor = 'rgba(0,0,0,0.5)';
  413. // 绘制圆角矩形
  414. context.beginPath();
  415. context.arc(w, h, r, 0, 2 * Math.PI);
  416. context.closePath();
  417. context.fill();
  418. var marker = new TFMap.Marker({ x: i.lng, y: i.lat, z: i.high }, canvas, {
  419. scale: 1,
  420. })
  421. // .action('./static/img/gc2.png')
  422. .init()
  423. .pierce();
  424. marker.setId('fs&' + i.stcd);
  425. const tempClass = TFMapUitl.getId('gcd', i.stcd) + '*' + ',' + 'fxMap*';
  426. marker.setClassify(tempClass);
  427. dzgcMarkerIdList[marker.id] = marker;
  428. marker.label(i.st_name + ' ' + '风速' + i.ws + '级', '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 18, 'rgba(6,161,239,0)');
  429. marker.info = i;
  430. // console.log(marker.info, 74);
  431. marker.addListener(map, (e) => {
  432. var i = e.graphic.overlay.info
  433. map.openInfoWindowHtml(TFMapUitl.gcdMarkerDom(i), { position: [i.lng, i.lat, i.high] }, () => TFMapUitl.clearPointLocation_list(map));
  434. map.popup.setOffset(-182, 64);
  435. });
  436. map.addOverlay(marker);
  437. var marker2 = new TFMap.Marker({ x: i.lng, y: i.lat, z: i.high }, './static/img/siteimg/fengxiang.png', {
  438. scale: 0.6,
  439. rotation: Cesium.Math.toRadians(-i.wd),
  440. pixelOffset: new Cesium.Cartesian2(5, -5),
  441. horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
  442. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  443. })
  444. // .action('./static/img/gc2.png')
  445. .init()
  446. .pierce();
  447. marker2.setId('fx&' + i.stcd);
  448. const tempClass2 = TFMapUitl.getId('sbd', i.stcd) + '*' + ',' + 'fxMap*';
  449. marker2.setClassify(tempClass2);
  450. // dzgcMarkerIdList[marker2.id] = marker2;
  451. // marker2.label(i.st_name + ' ' + '风速'+i.ws+'级', '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, -80, 'rgba(6,161,239,0)');
  452. // marker2.info = i;
  453. // console.log(marker.info, 71);
  454. // marker2.addListener(map, (e) => {
  455. // var html = TFMapUitl.gcdMarkerDom(e.graphic.overlay.info);
  456. // map.openInfoWindowHtml(html, e, () => TFMapUitl.clearPointLocation_list(map));
  457. // map.popup.setOffset(-270, -30);
  458. // TFMapUitl.active(e.graphic.overlay.id);
  459. // TFMapUitl.trends(e.graphic.overlay.points, null, true);
  460. // });
  461. map.addOverlay(marker2);
  462. }
  463. });
  464. };
  465. const loadFenquLayers = () => {
  466. let geo = new TFMap.GeoPolygon(fenquData, 10000, '#fffff7', '#000000', true);
  467. geo.data.features.forEach((i) => {
  468. // i.properties.color='#fff';
  469. i.properties.fontColor = '#377DFF';
  470. i.properties.fontSize = 18;
  471. rainDatafq.value.forEach((item) => {
  472. if (item.name == i.properties.nameKey) {
  473. i.properties.color = getColorVal(item.value);
  474. i.properties.name = item.name + ' ' + item.value + 'mm';
  475. console.log(i.properties.name,8282)
  476. } else if (i.properties.nameKey == '尼西站以上') {
  477. i.properties.color = '#fffff7';
  478. }
  479. });
  480. });
  481. geo.label({
  482. font: 'normal 18px MicroSoft YaHei',
  483. fillColor: Cesium.Color.fromCssColorString('#377DFF'),
  484. style: Cesium.LabelStyle.FILL_AND_OUTLINE, //有填充和边框
  485. outlineColor: Cesium.Color.WHITE,
  486. outlineWidth:5 });
  487. // console.log(geo,87)
  488. geo.setClassify('fqPolygon'); //写一个类名也可不行,写了可以使用这个名字进行删除
  489. geo.addListener(map, (e) => {
  490. console.log('e:', e);
  491. });
  492. map.addOverlay(geo);
  493. };
  494. eventBus.on('mapjump', (e) => {
  495. console.log(e, 76);
  496. basicStore.getStDetailArrStore.forEach((i) => {
  497. if (i.st_name == e.pageTitle) {
  498. console.log(i,887)
  499. // siteDetail(i);
  500. // 高亮点
  501. window.breathMarker&& window.breathMarker.breathe();window.breathMarker=null
  502. window.breathMarker=map.findOverlay(`gcd&${i.stcd}`)
  503. window.breathMarker.breathe(0,0.3)
  504. }
  505. });
  506. map.flyTo(
  507. {
  508. destination: {
  509. x: e.lng,
  510. y: e.lat,
  511. z: 5000,
  512. },
  513. orientation: {
  514. heading: 6.283185307179586,
  515. pitch: -1.5688928482139568,
  516. roll: 0,
  517. },
  518. },
  519. 1,
  520. () => {
  521. // siteDetail(i);
  522. }
  523. );
  524. });
  525. // 更新站点高程
  526. eventBus.on('updateSTHeight', () => {
  527. updateStHeightInfo();
  528. });
  529. watch(
  530. () => mapStore.stInfo,
  531. (newV) => {
  532. basicStore.getStDetailArrStore.forEach((i) => {
  533. if (i.stcd == newV.stcd) {
  534. console.log(i,887)
  535. map.flyTo(
  536. {
  537. destination: {
  538. x: i.lng,
  539. y: i.lat,
  540. z: 5000,
  541. },
  542. orientation: {
  543. heading: 6.283185307179586,
  544. pitch: -1.5688928482139568,
  545. roll: 0,
  546. },
  547. },
  548. 1,
  549. () => {
  550. // siteDetail(i);
  551. // 高亮点
  552. window.breathMarker&& window.breathMarker.breathe();window.breathMarker=null
  553. window.breathMarker=map.findOverlay(`gcd&${i.stcd}`)
  554. if(i.st_type == 1||i.st_type==2||i.st_type==4){
  555. window.breathMarker.breathe(0,0.3)
  556. }else{
  557. window.breathMarker.breathe()
  558. }
  559. }
  560. );
  561. }
  562. });
  563. }
  564. );
  565. onBeforeUnmount(() => {
  566. window.impointInterval&&clearInterval(window.impointInterval)
  567. });
  568. return {
  569. mapStore,
  570. dialogvisable,
  571. title,
  572. closeModal,
  573. detailInfo,
  574. changeMapBack,
  575. uprainLayer,
  576. loadFenquLayers,
  577. };
  578. },
  579. data() {
  580. return {
  581. markerAddType: true,
  582. markerAddSBType: true,
  583. markerAddCGQType: true,
  584. markerAddWordType: true,
  585. layerAddType: true,
  586. visible: false,
  587. addDoubleScreen: false,
  588. map23changeType: false,
  589. stDetailArrStore: [],
  590. lat: null,
  591. lng: null,
  592. };
  593. },
  594. mounted() {
  595. window.impointFlag=true
  596. const geologicalStore = useGeologicalStore();
  597. const monitorDevicesStore = useMonitorDevicesStore();
  598. this.init(() => { });
  599. setTimeout(() => {
  600. this.initWinWay();
  601. const basicStore = useBasicStore();
  602. // 测站信息
  603. // console.log(basicStore.getStDetailArrStore, 65);
  604. this.getMapConfig(geologicalStore);
  605. this.getStDetailInfoAxios();
  606. this.getGCSite();
  607. // rainMap({"start_time":"2023-07-05 10:00:00","end_time":"2023-07-05 01:00:00"})
  608. // //地灾点
  609. // this.getDzdxInfo(geologicalStore);
  610. // //工程
  611. // this.getGcInfo(geologicalStore);
  612. // //传感器
  613. // this.getMonitorSensorsList(monitorDevicesStore);
  614. // //设备点
  615. // setTimeout(() => {
  616. // this.getMonitorDevicesList(monitorDevicesStore);
  617. // this.getWater(monitorDevicesStore);
  618. // this.getWaterDev(monitorDevicesStore);
  619. // }, 2000);
  620. // // this.gnssLine(monitorDevicesStore);
  621. // this.getDzdxInfoTxData(geologicalStore);
  622. this.controlMarker();
  623. this.addHL();
  624. map.event.wheel(() => this.controlMarker(true));
  625. // map.event.camera(() => this.controlMarker(true));
  626. map.event.moveEnd(() => setTimeout(() => this.controlMarker(true), 500));
  627. this.mapHover();
  628. // eventBus.on('doubleScreenControl', () => {
  629. // this.addDoubleScreen = !this.addDoubleScreen;
  630. // if (this.addDoubleScreen) {
  631. // this.hideAll();
  632. // } else {
  633. // setTimeout(() => this.controlMarker(true), 500);
  634. // }
  635. // });
  636. // eventBus.on('map23changeEvent', () => {
  637. // this.map23changeType = !this.map23changeType;
  638. // if (dzdxInfoList) this.dzdxInfoMarker(dzdxInfoList);
  639. // if (gcInfoList) this.gcInfoMarker(gcInfoList);
  640. // if (monitorDevicesList) this.devicesMarker(monitorDevicesList);
  641. // if (monitorDevicesList) this.devicesMarkerWord(monitorDevicesList);
  642. // this.controlMarker();
  643. // });
  644. // ybjJson.features.map((i) => {
  645. // map.addOverlay(
  646. // new TFMap.Line(i.geometry.coordinates, 'rgba(0,63,255,1)', 40).init().setFlow('#6fcfff', 10000).stream(map).setClassify('gnss_arrow_line*')
  647. // );
  648. // });
  649. }, 3000);
  650. },
  651. methods: {
  652. // 获取重要测站点
  653. getImportSites(){
  654. getImportPoint().then(res=>{
  655. console.log(this.stDetailArrStore,366)
  656. if(res.code==200&&res.data){
  657. window.impoint=[]
  658. res.data.forEach(i=>{
  659. this.stDetailArrStore.forEach(j=>{
  660. if(i.stcd==j.stcd){
  661. let markerWindow= new TFMap.HTMLElementOverLay(
  662. { x:Number(i.dlon) , y: Number(i.dlat),z:Number(j.high) },
  663. TFMapUitl.impotPointDom(i)
  664. ).init().setOff(-230, -130)
  665. markerWindow.setId('imp&' + i.stcd);
  666. markerWindow.setClassify('impoint_marker*')
  667. window.impoint.push(markerWindow)
  668. map.addOverlay(markerWindow)
  669. console.log(markerWindow,7737)
  670. }
  671. })
  672. })
  673. }
  674. })
  675. },
  676. getMapConfig(geologicalStore) {
  677. geologicalStore
  678. .MapConfig({
  679. pages: 1,
  680. size: 1000,
  681. // bq: '1',
  682. 'orders[0].column': 'fzxh',
  683. 'orders[0].asc': 'true',
  684. 'orders[1].column': 'fwxh',
  685. 'orders[1].asc': 'true',
  686. })
  687. .then((res) => {
  688. var layerAdminList = [];
  689. var list = res.records;
  690. var list = res.records.sort(function (a, b) {
  691. if (!a.jzxh) return 1;
  692. if (!b.jzxh) return -1;
  693. return a.jzxh - b.jzxh;
  694. });
  695. console.log('地图的配置接口数据:', res);
  696. for (var i = 0; i < list.length; i++) {
  697. var o = list[i];
  698. if (!o.jclx) {
  699. var jzxh = o.jzxh + 1;
  700. if (o.code && o.fbdz && o.code == o.fbdz) {
  701. //特殊图层
  702. layerAdminList.push({
  703. id: o.code,
  704. title: o.zymc, //code,epsg,type,show,fbdz,bq,fwfz,fwxh,xh,scene
  705. epsg: o.epsg,
  706. type: '',
  707. show: o.show,
  708. url: o.fbdz,
  709. bq: o.bq,
  710. fwfz: o.fwfz,
  711. fwxh: o.fwxh,
  712. fzxh: o.fzxh,
  713. alpha: o.tmd,
  714. index: jzxh,
  715. });
  716. } else if (o.scene == 1) {
  717. mapConfig.demUrl = mapConfig.demUrl || o.fbdz;
  718. mapConfig.isSct = true;
  719. } else if (o.scene == 2 && o.bq == 1 && o.fwfz != '测试') {
  720. var layer = {
  721. id: o.code,
  722. title: o.zymc, //code,epsg,type,show,fbdz,bq,fwfz,fwxh,xh,scene
  723. epsg: o.epsg,
  724. type: o.type == '超图' ? 'SUPER' : o.type == '百度' ? 'BD' : o.type == '高德' ? 'GD' : 'SUPER_3D',
  725. show: o.show,
  726. url: o.fbdz,
  727. bq: o.bq,
  728. fwfz: o.fwfz,
  729. fzxh: o.fzxh,
  730. fwxh: o.fwxh,
  731. alpha: o.tmd,
  732. index: jzxh,
  733. };
  734. if (layer.id.indexOf('_bz') > -1) {
  735. layer.gamma = 0.5;
  736. }
  737. if (layer && layer.id != 'baseyx') {
  738. if (layer.title != '江面') {
  739. map.layer2d.add(layer);
  740. } else {
  741. Cesium.when(map.viewer.scene.open(layer.url), function (e) {
  742. //查找水面图层
  743. if (e && e.length) {
  744. var waterLayer = e[0];
  745. var style = new Cesium.Style3D();
  746. style.bottomAltitude = 12;
  747. waterLayer.style3D = style;
  748. waterLayer.refresh();
  749. const tempData = {
  750. destination: { x: 94.44066857601297, y: 26.00104492171595, z: 666896.88999354467 },
  751. orientation: { heading: 6.283185307179586, pitch: -1.0182023771170687, roll: 6.283185307179586 },
  752. };
  753. map.setView(tempData);
  754. }
  755. });
  756. }
  757. mapConfig.layers2D.push(layer);
  758. layerAdminList.push(layer);
  759. }
  760. } else if (o.bq == '0') {
  761. var layer = {
  762. id: o.code,
  763. title: o.zymc,
  764. epsg: o.epsg,
  765. type: o.type == '超图' ? 'SUPER' : o.type == '百度' ? 'BD' : o.type == '高德' ? 'GD' : 'SUPER_3D',
  766. show: o.show,
  767. url: o.fbdz,
  768. bq: o.bq,
  769. fwfz: o.fbdz || o.fwfz,
  770. alpha: o.tmd,
  771. fzxh: o.fzxh,
  772. fwxh: o.fwxh,
  773. index: jzxh,
  774. };
  775. map.layer2d.add(layer);
  776. mapConfig.layers2D.push(layer);
  777. }
  778. }
  779. }
  780. console.log('读取接口数据完成:', mapConfig);
  781. console.log('图层管理的数据:', layerAdminList);
  782. eventBus.emit('mapConfig', layerAdminList);
  783. });
  784. },
  785. // 获取测站
  786. getStDetailInfoAxios() {
  787. getStDetailInfo().then((res) => {
  788. const Obj = JSON.parse(JSON.stringify(res.data));
  789. this.stDetailArrStore = [];
  790. let objArr = [];
  791. for (const i in Obj) {
  792. objArr = [...objArr, ...Obj[i]];
  793. }
  794. objArr.forEach((element) => {
  795. this.stDetailArrStore.push(element);
  796. });
  797. // 加载测站
  798. this.setSTMarker(this.stDetailArrStore);
  799. // 获取重要测站点
  800. window.getImportSites()
  801. });
  802. },
  803. map23change() {
  804. this.map23changeType = !this.map23changeType;
  805. },
  806. init(callback) {
  807. window.map = TFMC.initMap('mapDiv');
  808. // map.mapLoadEnd((e) => {
  809. // if (e == 2) callback && callback();
  810. // });
  811. map.setView({
  812. destination: { x: 93.8, y: 26.02060211195423, z: 666896.88999354467 },
  813. orientation: { heading: 6.283185307179586, pitch: -1.0182023771170687, roll: 6.283185307179586 },
  814. });
  815. this.addMapElement();
  816. // map.mouseNowLevelCoordinate(4);
  817. map.updateOverlayEvent();
  818. // map.cluster('dzdOverlayLayer', true);
  819. // 设置经纬度样式
  820. map.event.mousemove((i) => {
  821. this.lat = i.position?.x.toFixed(4);
  822. this.lng = i.position?.y.toFixed(4);
  823. // console.log(i.position)
  824. });
  825. },
  826. setLegibility(id) {
  827. // 获取当前的图层
  828. let layer = viewer.scene.imageryLayers.get(id);
  829. // 改变当前地图的组织结构
  830. layer.minificationFilter = Cesium.TextyreMinificationFiler.NEAREST;
  831. layer.magnificationFilter = Cesium.TextureMagnificationFilter.NEAREST;
  832. },
  833. addMapElement() {
  834. const pos = {
  835. x: 95.19195431367271,
  836. y: 29.286442746934686,
  837. z: 2000.388319131086,
  838. };
  839. //添加遮罩
  840. new TFMap.MaskRegion(map, LINGZHI, 'rgba(3,22,51,0.5)', 'rgba(5, 239, 238,0)', 5);
  841. // var url = 'http://221.182.8.141:15000/iserver/services/3D-jiangmian/rest/realspace';
  842. // var promise = map.viewer.scene.open(url);
  843. // Cesium.when(promise, function (e) {
  844. // //查找水面图层
  845. // console.log('查找水面图层:', e);
  846. // });
  847. // var p = [
  848. // { x: 95.18070909269822, y: 29.26003526267188, z: 1122.076286944328 },
  849. // { x: 95.1435908284088, y: 29.249506598514103, z: 1253.656464931965 },
  850. // { x: 95.16379989840375, y: 29.226347165740222, z: 1336.4578721033515 },
  851. // { x: 95.19797174941132, y: 29.240678818976612, z: 1286.692241515867 },
  852. // ];
  853. // map.addOverlay(new TFMap.WaterPrimitive(p).init().setClassify('heliu*'));
  854. //添加动态圆圈
  855. // map.addOverlay(
  856. // new TFMap.Ellipse(pos, 580000, 580000, 8900)
  857. // .init()
  858. // .img('./static/img/circular_03.png')
  859. // .rotation()
  860. // .setClassify('Ellipse*')
  861. // );
  862. // map.viewer.camera.moveStart.addEventListener((e) => {
  863. // console.log('1111:', e);
  864. // });
  865. // map.viewer.camera.changed.addEventListener(() => {
  866. // console.log('111111');
  867. // });
  868. //添加范围墙
  869. // fetch('./static/json/lingzhi.json')
  870. // .then(function (e) {
  871. // return e.json();
  872. // })
  873. // .then(function (t) {
  874. // var r = new TFMap.RegionWall(
  875. // t,
  876. // './static/img/top.png' || 'rgba(3,22,51,0)',
  877. // './static/img/wall.png',
  878. // 35000
  879. // )
  880. // .init()
  881. // .setClassify('RegionWall*')
  882. // .setAttr('polygon', 'scale', '0.5');
  883. // map.addOverlay(r);
  884. // });
  885. //添加光柱
  886. // [
  887. // { x: 93.45315732121456, y: 29.81648129505731, z: 35515.62049538095 },
  888. // { x: 95.35242730377918, y: 29.922564437470662, z: 35593.60647778936 },
  889. // { x: 94.09114807467088, y: 28.724140215045367, z: 35634.98999112331 },
  890. // { x: 95.41300154867866, y: 28.411940956038322, z: 35692.68875426455 },
  891. // { x: 96.47729188621418, y: 28.563591229514525, z: 35623.52302594622 },
  892. // { x: 97.67456081254306, y: 28.746049506060256, z: 35763.01771823281 },
  893. // { x: 96.03951832224743, y: 29.424846985291925, z: 35856.12499749074 },
  894. // { x: 94.30220043303984, y: 29.63903809376401, z: 35661.36712589557 },
  895. // ].map((i) => {
  896. // map.addOverlay(new TFMap.ConeGlow(i, 'rgba(19,91,239,0.9)', 80000, 10000).init());
  897. // });
  898. },
  899. getDzdxInfo(geologicalStore) {
  900. geologicalStore
  901. .DzdxInfo({
  902. type: 'all',
  903. })
  904. .then((res) => {
  905. dzdxInfoList = res;
  906. this.dzdxInfoMarker(dzdxInfoList);
  907. this.controlMarker();
  908. });
  909. },
  910. getGcInfo(geologicalStore) {
  911. geologicalStore
  912. .GcInfo({
  913. pages: 1,
  914. size: 1000,
  915. })
  916. .then((res) => {
  917. gcInfoList = res.records;
  918. this.gcInfoMarker(gcInfoList);
  919. });
  920. },
  921. // //获取地灾范围
  922. // getGeoDisRegList(monitorDevicesStore) {
  923. // monitorDevicesStore
  924. // .LiGongMonitorSensorsList({
  925. // pageNo: 1,
  926. // pageSize: 1000,
  927. // })
  928. // .then((res) => {
  929. // console.log('获取传感器列表:', res);
  930. // monitorSensorsList = res.result.records;
  931. // this.controlMarker();
  932. // });
  933. // },
  934. //获取设备列表
  935. getMonitorDevicesList(s) {
  936. s.LiGongMonitorDevicesList({
  937. pageNo: 1,
  938. pageSize: 1000,
  939. }).then((res) => {
  940. monitorDevicesList = res.result.records;
  941. this.devicesMarker(monitorDevicesList);
  942. this.devicesMarkerWord(monitorDevicesList);
  943. // setTimeout(() => this.controlMarker(), 2000);
  944. });
  945. },
  946. //获取设备列表
  947. getWaterDev(monitorDevicesStore) {
  948. // monitorDevicesStore
  949. // .waterDeviceStatus({
  950. // pageNo: 1,
  951. // pageSize: 1000,
  952. // })
  953. // .then((res) => {
  954. // console.log('获取水文cgq列表???????????:', res);
  955. // monitorDevicesList = res.result.records;
  956. // this.devicesMarker(monitorDevicesList);
  957. // this.devicesMarkerWord(monitorDevicesList);
  958. // setTimeout(() => this.controlMarker(), 2000);
  959. // });
  960. },
  961. getWater(monitorDevicesStore) {
  962. monitorDevicesStore
  963. .waterDevice({
  964. pageNo: 1,
  965. pageSize: 1000,
  966. })
  967. .then((res) => {
  968. console.log('', res);
  969. let devRes = {
  970. success: true,
  971. message: '',
  972. code: 200,
  973. result: {
  974. records: [
  975. {
  976. id: '90610001',
  977. createBy: 'sw',
  978. createTime: '2023-07-11 14:48:12',
  979. updateBy: null,
  980. updateTime: '2023-07-13 00:00:01',
  981. hydrologyDeviceName: '羊村水文站',
  982. hydrologyDeviceCode: '90610001',
  983. hydrologyDeviceKind: 'L3SW',
  984. hydrologyDeviceLocation: '西藏自治区山南市桑日县羊村',
  985. hydrologyDeviceLon: 91.816667,
  986. hydrologyDeviceLat: 29.266667,
  987. hydrologyDeviceonline: 0,
  988. catchmentArea: 153191,
  989. isNew: 0,
  990. hydrologyDeviceKind_dictText: '水文站',
  991. hydrologyDeviceonline_dictText: '离线',
  992. },
  993. {
  994. id: '90610002',
  995. createBy: 'sw',
  996. createTime: '2023-07-11 14:48:12',
  997. updateBy: null,
  998. updateTime: '2023-07-13 00:00:01',
  999. hydrologyDeviceName: '朗县水文站',
  1000. hydrologyDeviceCode: '90610002',
  1001. hydrologyDeviceKind: 'L3SW',
  1002. hydrologyDeviceLocation: null,
  1003. hydrologyDeviceLon: 93.033333,
  1004. hydrologyDeviceLat: 29.05,
  1005. hydrologyDeviceonline: 0,
  1006. catchmentArea: 162844,
  1007. isNew: 0,
  1008. hydrologyDeviceKind_dictText: '水文站',
  1009. hydrologyDeviceonline_dictText: '离线',
  1010. },
  1011. {
  1012. id: '90610003',
  1013. createBy: 'sw',
  1014. createTime: '2023-07-11 14:48:12',
  1015. updateBy: null,
  1016. updateTime: '2023-07-13 00:00:01',
  1017. hydrologyDeviceName: 'ML水文站',
  1018. hydrologyDeviceCode: '90610003',
  1019. hydrologyDeviceKind: 'L3SW',
  1020. hydrologyDeviceLocation: '西藏自治区林芝市米林县扎西绕登乡甲玛村',
  1021. hydrologyDeviceLon: 94.233333,
  1022. hydrologyDeviceLat: 29.233333,
  1023. hydrologyDeviceonline: 1,
  1024. catchmentArea: 172170,
  1025. isNew: 0,
  1026. hydrologyDeviceKind_dictText: '水文站',
  1027. hydrologyDeviceonline_dictText: '在线',
  1028. },
  1029. {
  1030. id: '90610004',
  1031. createBy: 'sw',
  1032. createTime: '2023-07-11 14:48:12',
  1033. updateBy: null,
  1034. updateTime: '2023-07-13 00:00:01',
  1035. hydrologyDeviceName: '派镇水文站',
  1036. hydrologyDeviceCode: '90610004',
  1037. hydrologyDeviceKind: 'L3SW',
  1038. hydrologyDeviceLocation: null,
  1039. hydrologyDeviceLon: 94.866667,
  1040. hydrologyDeviceLat: 29.516667,
  1041. hydrologyDeviceonline: 0,
  1042. catchmentArea: 192977,
  1043. isNew: 0,
  1044. hydrologyDeviceKind_dictText: '水文站',
  1045. hydrologyDeviceonline_dictText: '离线',
  1046. },
  1047. {
  1048. id: '90610005',
  1049. createBy: 'sw',
  1050. createTime: '2023-07-11 14:48:12',
  1051. updateBy: null,
  1052. updateTime: '2023-07-13 00:00:01',
  1053. hydrologyDeviceName: '排龙水文站',
  1054. hydrologyDeviceCode: '90610005',
  1055. hydrologyDeviceKind: 'L3SW',
  1056. hydrologyDeviceLocation: '西藏自治区波密县境内',
  1057. hydrologyDeviceLon: 95.05,
  1058. hydrologyDeviceLat: 30.066667,
  1059. hydrologyDeviceonline: 1,
  1060. catchmentArea: 25656,
  1061. isNew: 0,
  1062. hydrologyDeviceKind_dictText: '水文站',
  1063. hydrologyDeviceonline_dictText: '在线',
  1064. },
  1065. {
  1066. id: '90610006',
  1067. createBy: 'sw',
  1068. createTime: '2023-07-11 14:48:12',
  1069. updateBy: null,
  1070. updateTime: '2023-07-13 00:00:01',
  1071. hydrologyDeviceName: '汗密水文站',
  1072. hydrologyDeviceCode: '90610006',
  1073. hydrologyDeviceKind: 'L3SW',
  1074. hydrologyDeviceLocation: '西藏自治区林芝市墨脱县背崩乡汗密',
  1075. hydrologyDeviceLon: 95.133333,
  1076. hydrologyDeviceLat: 29.366667,
  1077. hydrologyDeviceonline: 1,
  1078. catchmentArea: 126,
  1079. isNew: 0,
  1080. hydrologyDeviceKind_dictText: '水文站',
  1081. hydrologyDeviceonline_dictText: '在线',
  1082. },
  1083. {
  1084. id: '90610007',
  1085. createBy: 'sw',
  1086. createTime: '2023-07-11 14:48:12',
  1087. updateBy: null,
  1088. updateTime: '2023-07-13 00:00:01',
  1089. hydrologyDeviceName: '德兴水文站',
  1090. hydrologyDeviceCode: '90610007',
  1091. hydrologyDeviceKind: 'L3SW',
  1092. hydrologyDeviceLocation: '西藏自治区林芝市墨脱县德兴乡德兴村',
  1093. hydrologyDeviceLon: 95.3,
  1094. hydrologyDeviceLat: 29.316667,
  1095. hydrologyDeviceonline: 1,
  1096. catchmentArea: 225871,
  1097. isNew: 0,
  1098. hydrologyDeviceKind_dictText: '水文站',
  1099. hydrologyDeviceonline_dictText: '在线',
  1100. },
  1101. {
  1102. id: '90610008',
  1103. createBy: 'sw',
  1104. createTime: '2023-07-11 14:48:13',
  1105. updateBy: null,
  1106. updateTime: '2023-07-13 00:00:01',
  1107. hydrologyDeviceName: '希让水文站',
  1108. hydrologyDeviceCode: '90610008',
  1109. hydrologyDeviceKind: 'L3SW',
  1110. hydrologyDeviceLocation: '西藏自治区林芝市墨脱县背崩乡希让村',
  1111. hydrologyDeviceLon: 95.016667,
  1112. hydrologyDeviceLat: 29.166667,
  1113. hydrologyDeviceonline: 0,
  1114. catchmentArea: 227409,
  1115. isNew: 0,
  1116. hydrologyDeviceKind_dictText: '水文站',
  1117. hydrologyDeviceonline_dictText: '离线',
  1118. },
  1119. {
  1120. id: '90610009',
  1121. createBy: 'sw',
  1122. createTime: '2023-07-11 14:48:13',
  1123. updateBy: null,
  1124. updateTime: '2023-07-13 00:00:01',
  1125. hydrologyDeviceName: '扎西绕登水文站',
  1126. hydrologyDeviceCode: '90610009',
  1127. hydrologyDeviceKind: 'L3SW',
  1128. hydrologyDeviceLocation: '西藏自治区林芝市米林县扎西绕登乡',
  1129. hydrologyDeviceLon: 94.033333,
  1130. hydrologyDeviceLat: 29.266667,
  1131. hydrologyDeviceonline: 0,
  1132. catchmentArea: 1050,
  1133. isNew: 1,
  1134. hydrologyDeviceKind_dictText: '水文站',
  1135. hydrologyDeviceonline_dictText: '离线',
  1136. },
  1137. {
  1138. id: '90610010',
  1139. createBy: 'sw',
  1140. createTime: '2023-07-11 14:48:13',
  1141. updateBy: null,
  1142. updateTime: '2023-07-13 00:00:01',
  1143. hydrologyDeviceName: '尼西水文站',
  1144. hydrologyDeviceCode: '90610010',
  1145. hydrologyDeviceKind: 'L3SW',
  1146. hydrologyDeviceLocation: '西藏自治区林芝市巴宜区尼西村',
  1147. hydrologyDeviceLon: 94.2,
  1148. hydrologyDeviceLat: 29.75,
  1149. hydrologyDeviceonline: 0,
  1150. catchmentArea: 16148,
  1151. isNew: 1,
  1152. hydrologyDeviceKind_dictText: '水文站',
  1153. hydrologyDeviceonline_dictText: '离线',
  1154. },
  1155. ],
  1156. total: 94,
  1157. size: 10,
  1158. current: 1,
  1159. orders: [],
  1160. optimizeCountSql: true,
  1161. searchCount: true,
  1162. countId: null,
  1163. maxLimit: null,
  1164. pages: 10,
  1165. },
  1166. timestamp: 1689238515268,
  1167. };
  1168. monitorDevicesList = devRes.result.records;
  1169. monitorDevicesList.map((e) => {
  1170. e.deviceKind = e.hydrologyDeviceKind;
  1171. e.deviceLon = e.hydrologyDeviceLon;
  1172. e.deviceLat = e.hydrologyDeviceLat;
  1173. e.online = e.hydrologyDeviceonline;
  1174. e.deviceName = e.hydrologyDeviceName;
  1175. e.elevation = '0';
  1176. e.deviceCode = e.hydrologyDeviceCode;
  1177. });
  1178. // i.deviceLon, i.deviceLat, map.terrain ? i.elevation : 0
  1179. this.waterMarker(monitorDevicesList);
  1180. this.devicesMarkerWord(monitorDevicesList);
  1181. setTimeout(() => this.controlMarker(), 2000);
  1182. });
  1183. },
  1184. //获取传感器列表
  1185. getMonitorSensorsList(monitorDevicesStore) {
  1186. monitorDevicesStore
  1187. .LiGongMonitorSensorsList({
  1188. pageNo: 1,
  1189. pageSize: 1000,
  1190. })
  1191. .then((res) => {
  1192. console.log('获取传感器列表:', res);
  1193. monitorSensorsList = res.result.records;
  1194. this.controlMarker();
  1195. });
  1196. },
  1197. findSensorInnerCode(id) {
  1198. var obj = monitorSensorsList.find((item) => item.deviceCode === id);
  1199. if (obj) {
  1200. return obj.sensorInnerCode;
  1201. } else {
  1202. return null;
  1203. }
  1204. },
  1205. //通过设备ID获取传感器列表
  1206. idGetSensorsList(i) {
  1207. const monitorDevicesStore = useMonitorDevicesStore();
  1208. monitorDevicesStore
  1209. .LiGongMonitorSensorsList({
  1210. pageNo: 1,
  1211. pageSize: 1000,
  1212. deviceId: i.id,
  1213. })
  1214. .then((res) => {
  1215. if (res && res.result && res.result.records.length) {
  1216. var obj = res.result.records[res.result.records.length - 1];
  1217. if (i.deviceLon && i.deviceLat && obj.sensorLon && obj.sensorLat) {
  1218. var dot = [
  1219. [i.deviceLon, i.deviceLat],
  1220. [obj.sensorLon, obj.sensorLat],
  1221. ];
  1222. map.addOverlay(new TFMap.Line(dot, 'rgba(255,255,0,1)', 5).init().setArrow().setClassify('gnss_arrow_line*'));
  1223. }
  1224. }
  1225. });
  1226. },
  1227. devicesMarker(list) {
  1228. list.map((i) => {
  1229. if (i.deviceLon && i.deviceLat) {
  1230. // i.sensorInnerCode = this.findSensorInnerCode(i.deviceCode);
  1231. let temp = null;
  1232. let temp2 = null;
  1233. if (i.online == 0) {
  1234. temp = `./static/img/offLine/${i.deviceKind}.png`;
  1235. temp2 = `./static/img/offLine2/${i.deviceKind}.png`;
  1236. } else if (i.online == 1) {
  1237. temp = `./static/img/onLine/${i.deviceKind}.png`;
  1238. temp2 = `./static/img/onLine2/${i.deviceKind}.png`;
  1239. }
  1240. var marker = new TFMap.Marker([i.deviceLon, i.deviceLat, map.terrain ? i.elevation : 0], temp, {
  1241. show: false,
  1242. }).init();
  1243. marker.setId(TFMapUitl.getId('sbd', i.id));
  1244. marker.setClassify(`sbdmarker,sbd${i.online}marker,sbd${i.deviceKind}marker*,${TFMapUitl.specialControl.zhjcsb}`);
  1245. marker.action(temp2);
  1246. marker.pierce();
  1247. marker.label(i.deviceName, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 10);
  1248. marker.info = i;
  1249. marker.addListener(map, (e) => {
  1250. var html = TFMapUitl.sbdMarkerDom(e.graphic.overlay.info);
  1251. map.openInfoWindowHtml(html, e, () => TFMapUitl.clearPointLocation_list(map));
  1252. map.popup.setOffset(-235, 120);
  1253. TFMapUitl.active(e.graphic.overlay.id);
  1254. TFMapUitl.trends(e.graphic.overlay.points, null, true);
  1255. });
  1256. map.addOverlay(marker);
  1257. }
  1258. });
  1259. },
  1260. waterMarker(list) {
  1261. list.map((i) => {
  1262. if (i.deviceLon && i.deviceLat) {
  1263. // i.sensorInnerCode = this.findSensorInnerCode(i.deviceCode);
  1264. let temp = null;
  1265. let temp2 = null;
  1266. if (i.online == 0) {
  1267. temp = `./static/img/offLine/${i.deviceKind}.png`;
  1268. temp2 = `./static/img/offLine2/${i.deviceKind}.png`;
  1269. } else if (i.online == 1) {
  1270. temp = `./static/img/onLine/${i.deviceKind}.png`;
  1271. temp2 = `./static/img/onLine2/${i.deviceKind}.png`;
  1272. }
  1273. var marker = new TFMap.Marker([i.deviceLon, i.deviceLat, map.terrain ? i.elevation : 0], temp).init();
  1274. marker.setId(TFMapUitl.getId('sbd', i.id));
  1275. marker.setClassify(`sbdmarker,sbd${i.online}marker,sbd${i.deviceKind}marker*,${TFMapUitl.specialControl.zhjcsb}`);
  1276. marker.action(temp2);
  1277. marker.pierce();
  1278. marker.label(i.deviceName, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 10);
  1279. marker.info = i;
  1280. marker.addListener(map, (e) => {
  1281. var html = TFMapUitl.waterMarkerDom(e.graphic.overlay.info);
  1282. map.openInfoWindowHtml(html, e, () => TFMapUitl.clearPointLocation_list(map));
  1283. map.popup.setOffset(-235, 120);
  1284. TFMapUitl.active(e.graphic.overlay.id);
  1285. TFMapUitl.trends(e.graphic.overlay.points, null, true);
  1286. });
  1287. map.addOverlay(marker);
  1288. }
  1289. });
  1290. },
  1291. devicesMarkerWord(list) {
  1292. list.map((i) => {
  1293. if (i.deviceLon && i.deviceLat) {
  1294. var color = 'rgba(255,255,255,0)';
  1295. var bg = 'rgba(6,161,239,0)';
  1296. var font = '12pt Source Han Sans CN';
  1297. var word = new TFMap.Word([i.deviceLon, i.deviceLat], i.deviceName, color, bg, font, 0, -50)
  1298. .init()
  1299. .setClassify('devicesWord*')
  1300. .updateHeight()
  1301. .setAttr('label', 'heightReference', Cesium.HeightReference.CLAMP_TO_GROUND);
  1302. // .setAttr('label', 'distanceDisplayCondition', new Cesium.DistanceDisplayCondition(0, 10000));
  1303. map.addOverlay(word);
  1304. }
  1305. });
  1306. },
  1307. hideAll() {
  1308. if (map.popup) map.popup.remove();
  1309. this.markerAddType = true;
  1310. this.markerAddWordType = true;
  1311. this.markerAddSBType = true;
  1312. map.showOverlay('dzdmarker*', false);
  1313. map.showOverlay('gcdmarker*', false);
  1314. map.showOverlay('dzdRegion*', false);
  1315. map.showOverlay('sbdmarker*', false);
  1316. map.showOverlay('geojson_line_dxh', false);
  1317. eventBus.emit('TailBaseLine', false);
  1318. for (var i in dzgcMarkerIdList) {
  1319. var marker = dzgcMarkerIdList[i];
  1320. if (i && marker && marker.entity) {
  1321. marker.entity.label.fillColor.setValue(Cesium.Color.fromCssColorString('rgba(255,255,255,0)'));
  1322. marker.entity.label.backgroundColor.setValue(Cesium.Color.fromCssColorString('rgba(6,161,239,0)'));
  1323. }
  1324. }
  1325. map.setOverlay('devicesWord*', 'label', {
  1326. fillColor: 'rgba(255,255,255,0)',
  1327. backgroundColor: 'rgba(6,161,239,0)',
  1328. });
  1329. map.showOverlay('dzdfw_geojson_fw*', false);
  1330. map.showOverlay('dzdfw_geojson*', false);
  1331. },
  1332. controlMarker(type) {
  1333. if (this.addDoubleScreen) return;
  1334. const level = map.getLevel();
  1335. if (this.level == level) return;
  1336. this.level = level;
  1337. if (level) {
  1338. if (this.markerAddType) {
  1339. this.markerAddType = false;
  1340. if (window.mapConfig.layerList) {
  1341. //根据图层控制来限制是否展示范围
  1342. try {
  1343. if (window.mapConfig.layerList[TFMapUitl.specialControl.zdgzzhd].type) {
  1344. map.showOverlay(TFMapUitl.specialControl.zdgzzhd, true);
  1345. }
  1346. if (window.mapConfig.layerList[TFMapUitl.specialControl.pczhd].type) {
  1347. map.showOverlay(TFMapUitl.specialControl.pczhd, true);
  1348. }
  1349. if (window.mapConfig.layerList[TFMapUitl.specialControl.dzfb].type) {
  1350. map.showOverlay(TFMapUitl.specialControl.dzfb, true);
  1351. }
  1352. // if (window.mapConfig.layerList[TFMapUitl.specialControl.shuiwenzhan].type) {
  1353. // map.showOverlay(TFMapUitl.specialControl.shuiwenzhan, true);
  1354. // }
  1355. if (window.mapConfig.layerList[TFMapUitl.specialControl.pczhd].type) {
  1356. map.showOverlay(TFMapUitl.specialControl.pczhd, true);
  1357. }
  1358. } catch (error) {
  1359. console.log('error:', error);
  1360. }
  1361. } else {
  1362. map.showOverlay(TFMapUitl.specialControl.zdgzzhd, true);
  1363. map.showOverlay(TFMapUitl.specialControl.pczhd, false);
  1364. map.showOverlay(TFMapUitl.specialControl.dzfb, true);
  1365. }
  1366. }
  1367. } else {
  1368. this.markerAddType = true;
  1369. map.showOverlay(TFMapUitl.specialControl.zdgzzhd, false);
  1370. map.showOverlay(TFMapUitl.specialControl.pczhd, false);
  1371. map.showOverlay('gcdmarker*', false);
  1372. }
  1373. //控制旋转的圆
  1374. // if (level > 10) {
  1375. // map.showOverlay('Ellipse*', false);
  1376. // } else {
  1377. // map.showOverlay('Ellipse*', true);
  1378. // }
  1379. // if (this.markerAddWordType && monitorDevicesList && level > 16) {
  1380. // this.markerAddWordType = false;
  1381. // // this.devicesMarkerWord(monitorDevicesList);
  1382. // // map.showOverlay('devicesWord*', true);
  1383. // map.setOverlay('devicesWord*', 'label', {
  1384. // fillColor: 'rgba(255,255,255,1)',
  1385. // backgroundColor: 'rgba(6,161,239,0)',
  1386. // });
  1387. // } else if (level < 16 || level == 16) {
  1388. // this.markerAddWordType = true;
  1389. // // map.removeOverlay('devicesWord*');
  1390. // // map.showOverlay('devicesWord*', false);
  1391. // map.setOverlay('devicesWord*', 'label', {
  1392. // fillColor: 'rgba(255,255,255,0)',
  1393. // backgroundColor: 'rgba(6,161,239,0)',
  1394. // });
  1395. // }
  1396. // if (level > 11) {
  1397. // if (i.graphic && i.graphic.id && i.graphic.id.id.indexOf('devices') > -1) {
  1398. // i.graphic.id.label.fillColor.setValue(
  1399. // Cesium.Color.fromCssColorString('rgba(255,255,255,1)')
  1400. // );
  1401. // }
  1402. //控制河流和河流尾迹线
  1403. if (type && level > 9) {
  1404. map.showOverlay('geojson_line_dxh', false);
  1405. eventBus.emit('TailBaseLine', false);
  1406. } else if (type) {
  1407. map.showOverlay('geojson_line_dxh', true);
  1408. eventBus.emit('TailBaseLine', true);
  1409. }
  1410. // //地灾工程文字控制
  1411. // if (level > 13) {
  1412. // for (var i in dzgcMarkerIdList) {
  1413. // var marker = dzgcMarkerIdList[i];
  1414. // if (i && marker && marker.entity) {
  1415. // marker.entity.label.fillColor.setValue(Cesium.Color.fromCssColorString('rgba(255,255,255,1)'));
  1416. // marker.entity.label.backgroundColor.setValue(Cesium.Color.fromCssColorString('rgba(6,161,239,0.6)'));
  1417. // }
  1418. // }
  1419. // } else {
  1420. // for (var i in dzgcMarkerIdList) {
  1421. // var marker = dzgcMarkerIdList[i];
  1422. // if (i && marker && marker.entity) {
  1423. // marker.entity.label.fillColor.setValue(Cesium.Color.fromCssColorString('rgba(255,255,255,0)'));
  1424. // marker.entity.label.backgroundColor.setValue(Cesium.Color.fromCssColorString('rgba(6,161,239,0)'));
  1425. // }
  1426. // }
  1427. // }
  1428. const tempFun3 = () => {
  1429. if (level > 13) {
  1430. if (this.markerAddSBType && monitorDevicesList) {
  1431. this.markerAddSBType = false;
  1432. // this.devicesMarker(monitorDevicesList);
  1433. map.showOverlay('sbdmarker*', true);
  1434. }
  1435. } else if (level < 15) {
  1436. this.markerAddSBType = true;
  1437. map.showOverlay('sbdmarker*', false);
  1438. }
  1439. };
  1440. const tempFun2 = () => {
  1441. //地灾工程文字控制
  1442. if (level > 10) {
  1443. for (var i in dzgcMarkerIdList) {
  1444. var marker = dzgcMarkerIdList[i];
  1445. if (i && marker && marker.entity) {
  1446. marker.entity.label.fillColor.setValue(Cesium.Color.fromCssColorString('rgba(255,255,255,1)'));
  1447. marker.entity.label.backgroundColor.setValue(Cesium.Color.fromCssColorString('rgba(6,161,239,0.6)'));
  1448. }
  1449. }
  1450. } else {
  1451. for (var i in dzgcMarkerIdList) {
  1452. var marker = dzgcMarkerIdList[i];
  1453. if (i && marker && marker.entity) {
  1454. marker.entity.label.fillColor.setValue(Cesium.Color.fromCssColorString('rgba(255,255,255,0)'));
  1455. marker.entity.label.backgroundColor.setValue(Cesium.Color.fromCssColorString('rgba(6,161,239,0)'));
  1456. }
  1457. }
  1458. }
  1459. };
  1460. tempFun2();
  1461. const tempFun = () => {
  1462. //变形体文字控制
  1463. if (level > 14) {
  1464. map.showOverlay('dzdfw_geojson_fw*', true);
  1465. map.showOverlay('dzdfw_geojson*', true);
  1466. } else {
  1467. map.showOverlay('dzdfw_geojson_fw*', false);
  1468. map.showOverlay('dzdfw_geojson*', false);
  1469. }
  1470. };
  1471. // if (window.mapConfig.layerList) {
  1472. // //根据图层控制来限制是否展示范围
  1473. // if (window.mapConfig.layerList[TFMapUitl.specialControl.zhfwsyt].type) {
  1474. // tempFun();
  1475. // }
  1476. // if (window.mapConfig.layerList[TFMapUitl.specialControl.dzfb].type) {
  1477. // tempFun2();
  1478. // }
  1479. // if (window.mapConfig.layerList[TFMapUitl.specialControl.zhjcsb].type) {
  1480. // tempFun3();
  1481. // }
  1482. // } else {
  1483. // tempFun2();
  1484. // tempFun();
  1485. // tempFun3;
  1486. // }
  1487. // if (this.layerAddType && level > 12) {
  1488. // this.layerAddType = false;
  1489. // map.showLayer2D('wrjyx', true);
  1490. // map.showLayer2D('tdtjb', false);
  1491. // } else if (!this.layerAddType && level < 12) {
  1492. // this.layerAddType = true;
  1493. // map.showLayer2D('wrjyx', false);
  1494. // map.showLayer2D('tdtjb', true);
  1495. // }
  1496. },
  1497. setLingth() {
  1498. // 获取 Scene 实例
  1499. const scene = map.viewer.scene;
  1500. // 开启深度测试和光照漫反射
  1501. scene.globe.depthTestAgainstTerrain = true;
  1502. scene.globe.enableLighting = true;
  1503. // 配置光照效果
  1504. // scene.lightingModel = Cesium.LightingModel.PBR;
  1505. // scene.light.direction = new Cesium.Cartesian3.fromArray([
  1506. // -1.0, -1.0, -1.0,
  1507. // ]);
  1508. scene.light.color = new Cesium.Color.fromBytes(255, 255, 255, 255);
  1509. scene.light.intensity = 2.0;
  1510. },
  1511. addHL() {
  1512. const geo = new TFMap.GeoPolyline([dxh], 5, 'rgba(11,161,236,1)');
  1513. geo.setClassify('geojson_line_dxh');
  1514. map.addOverlay(geo);
  1515. },
  1516. dzdxInfoMarker(list) {
  1517. if (!list) return;
  1518. list.map((i, index) => {
  1519. //地灾点地图加载
  1520. if (i.x && i.y) {
  1521. let url = '';
  1522. let url2 = '';
  1523. let otherClass = '';
  1524. let id = TFMapUitl.getId('dzd', i.id);
  1525. if (i.gztyp == '重点关注') {
  1526. url = `./static/img/dzd/${i.dzlx}_zd.png`;
  1527. url2 = `./static/img/dzd2/${i.dzlx}.png`;
  1528. otherClass = TFMapUitl.specialControl.zdgzzhd;
  1529. } else {
  1530. url = `./static/img/dzd/${i.dzlx}.png`;
  1531. url2 = `./static/img/dzd2/${i.dzlx}.png`;
  1532. otherClass = TFMapUitl.specialControl.pczhd;
  1533. }
  1534. var marker = new TFMap.Marker({ x: i.x, y: i.y, z: map.terrain ? i.z : 0 }, url || dzdSvg, {
  1535. show: otherClass == TFMapUitl.specialControl.pczhd ? false : true,
  1536. // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
  1537. // height: 0,
  1538. // heightDisplayCondition: new Cesium.HeightDisplayCondition(0, 1000),
  1539. // distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000), //设置可见距离 500-10000米可见
  1540. })
  1541. .init()
  1542. .action(url2)
  1543. .pierce();
  1544. marker.setId(id);
  1545. let tempClass = id + getStrUnicode(i.dzlxmc) + '*' + ',' + otherClass;
  1546. marker.setClassify(tempClass);
  1547. dzgcMarkerIdList[marker.id] = marker;
  1548. marker.label(i.dzmc, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, -60, 'rgba(6,161,239,0)');
  1549. marker.info = i;
  1550. marker.addListener(map, (e) => {
  1551. var html = TFMapUitl.dzdMarkerDom(e.graphic.overlay.info);
  1552. map.openInfoWindowHtml(html, e, () => TFMapUitl.clearPointLocation_list(map));
  1553. map.popup.setOffset(-235, 120);
  1554. TFMapUitl.active(e.graphic.overlay.id);
  1555. TFMapUitl.trends(e.graphic.overlay.points, null, true);
  1556. });
  1557. map.addOverlay(marker);
  1558. }
  1559. });
  1560. // map.showOverlay(TFMapUitl.specialControl.pczhd, false);
  1561. // var arr = map.findOverlay('dzdmarker*');
  1562. // console.log('arr:', arr);
  1563. // var a = map.billboardCluster(arr);
  1564. // var maxDistance = 5000000000;
  1565. // var image = '/path/to/aggregated-image.png';
  1566. // var aggregatedBillboards = map.createAggregatedBillboards(arr, maxDistance, image);
  1567. // console.log('聚合算法:', aggregatedBillboards);
  1568. // map.markerJH(arr, {
  1569. // clusterRadius: 50, // 聚合半径F
  1570. // pixelRange: 10, // 屏幕像素误差
  1571. // aggregateImage: './images/cluster.png', // 聚合后的图标
  1572. // });
  1573. // map.markerJH2(arr);
  1574. // map.markerGather(arr);
  1575. // map.makerJH4(arr);
  1576. },
  1577. gcInfoMarker(list) {
  1578. list.map((i) => {
  1579. if (i.x && i.y) {
  1580. var marker = new TFMap.Marker({ x: i.x, y: i.y }, './static/img/gc1.png', {
  1581. scale: 0.8,
  1582. })
  1583. .action('./static/img/gc2.png')
  1584. .init()
  1585. .pierce();
  1586. marker.setId('gcd&' + i.id);
  1587. const tempClass = TFMapUitl.getId('gcd', i.id) + '*' + ',' + TFMapUitl.specialControl.dzfb;
  1588. marker.setClassify(tempClass);
  1589. dzgcMarkerIdList[marker.id] = marker;
  1590. marker.label(i.gcmc, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, -60, 'rgba(6,161,239,0)');
  1591. marker.info = i;
  1592. marker.addListener(map, (e) => {
  1593. var html = TFMapUitl.gcdMarkerDom(e.graphic.overlay.info);
  1594. map.openInfoWindowHtml(html, e, () => TFMapUitl.clearPointLocation_list(map));
  1595. map.popup.setOffset(-235, 120);
  1596. TFMapUitl.active(e.graphic.overlay.id);
  1597. TFMapUitl.trends(e.graphic.overlay.points, null, true);
  1598. });
  1599. map.addOverlay(marker);
  1600. }
  1601. });
  1602. },
  1603. getGCSite() {
  1604. gcSite().then((res) => {
  1605. if (res.code == 200 && res.data?.length > 0) {
  1606. let gcList = res.data;
  1607. gcList.forEach((i) => {
  1608. i.typeName = '工程点';
  1609. if (i.lat && i.lng) {
  1610. var marker = new TFMap.Marker({ x: i.lng, y: i.lat }, './static/img/siteimg/gc.png', {
  1611. scale: 0.8,
  1612. })
  1613. // .action('./static/img/gc2.png')
  1614. .init()
  1615. .pierce();
  1616. marker.setId('gcd&' + i.stcd);
  1617. const tempClass = TFMapUitl.getId('gcd', i.stcd) + '*' + ',' + TFMapUitl.specialControl.gc;
  1618. marker.setClassify(tempClass);
  1619. dzgcMarkerIdList[marker.id] = marker;
  1620. marker.label(i.name, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 20, 'rgba(6,161,239,0)');
  1621. marker.info = i;
  1622. // console.log(marker.info, 71);
  1623. marker.addListener(map, (e) => {
  1624. // if(window.breathMarker){
  1625. // window.breathMarker.breathe()
  1626. // window.breathMarker=null
  1627. // }
  1628. // if (e && e.graphic && e.graphic.overlay) {
  1629. // e.graphic.overlay.breathe()
  1630. // window.breathMarker=e.graphic.overlay
  1631. // TFMapUitl.clearPointLocation_list(map)
  1632. // }
  1633. // var html = TFMapUitl.gcdMarkerDom(e.graphic.overlay.info);
  1634. // map.openInfoWindowHtml(html, e, () => TFMapUitl.clearPointLocation_list(map));
  1635. // map.popup.setOffset(-270, -30);
  1636. // TFMapUitl.active(e.graphic.overlay.id);
  1637. // TFMapUitl.trends(e.graphic.overlay.points, null, true);
  1638. });
  1639. map.addOverlay(marker);
  1640. }
  1641. });
  1642. }
  1643. });
  1644. },
  1645. // 加载测站点
  1646. setSTMarker(list) {
  1647. // console.log(list,88)
  1648. // 4.测站类型:1(水文站),2(水位站),4(雨量站),5(一般气象站),6(碳水通量站),7(标准气象站)
  1649. list.forEach((i) => {
  1650. // console.log(i);
  1651. if (i.st_type == 1) {
  1652. i.typeName = '水文站';
  1653. if (i.lat && i.lng) {
  1654. var marker = new TFMap.Marker({ x: i.lng, y: i.lat, z: i.high }, './static/img/siteimg/shuiwen.png', {
  1655. scale: 0.8,
  1656. rotation: Cesium.Math.toRadians(-i.angle),
  1657. })
  1658. // .action('./static/img/gc2.png')
  1659. .init()
  1660. .pierce();
  1661. marker.setId('gcd&' + i.stcd);
  1662. const tempClass = TFMapUitl.getId('gcd', i.stcd) + '*' + ',' + TFMapUitl.specialControl.shuiwenzhan;
  1663. marker.setClassify(tempClass);
  1664. dzgcMarkerIdList[marker.id] = marker;
  1665. marker.label(i.st_name, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 20, 'rgba(6,161,239,0)');
  1666. marker.info = i;
  1667. marker.addListener(map, e => {
  1668. if(window.breathMarker){
  1669. window.breathMarker.breathe()
  1670. window.breathMarker=null
  1671. }
  1672. if (e && e.graphic && e.graphic.overlay) {
  1673. e.graphic.overlay.breathe(0,0.3)
  1674. window.breathMarker=e.graphic.overlay
  1675. }
  1676. var i = e.graphic.overlay.info
  1677. map.openInfoWindowHtml(TFMapUitl.gcdMarkerDom(i), { position: [i.lng, i.lat, i.high] }, () => TFMapUitl.clearPointLocation_list(map));
  1678. map.popup.setOffset(-191, 70);
  1679. window.clearImpoint()
  1680. });
  1681. map.addOverlay(marker);
  1682. }
  1683. } else if (i.st_type == 2) {
  1684. i.typeName = '水位站';
  1685. if (i.lat && i.lng) {
  1686. var marker = new TFMap.Marker({ x: i.lng, y: i.lat, z: i.high }, './static/img/siteimg/shuiwei.png', {
  1687. scale: 0.8,
  1688. rotation: Cesium.Math.toRadians(-i.angle),
  1689. })
  1690. // .action('./static/img/gc2.png')
  1691. .init()
  1692. .pierce();
  1693. marker.setId('gcd&' + i.stcd);
  1694. const tempClass = TFMapUitl.getId('gcd', i.stcd) + '*' + ',' + TFMapUitl.specialControl.shuiweizhan;
  1695. marker.setClassify(tempClass);
  1696. dzgcMarkerIdList[marker.id] = marker;
  1697. marker.label(i.st_name, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 20, 'rgba(6,161,239,0)');
  1698. marker.info = i;
  1699. marker.addListener(map, e =>{
  1700. if(window.breathMarker){
  1701. window.breathMarker.breathe()
  1702. window.breathMarker=null
  1703. }
  1704. if (e && e.graphic && e.graphic.overlay) {
  1705. e.graphic.overlay.breathe(0,0.3)
  1706. window.breathMarker=e.graphic.overlay
  1707. }
  1708. var i = e.graphic.overlay.info
  1709. map.openInfoWindowHtml(TFMapUitl.gcdMarkerDom(i), { position: [i.lng, i.lat, i.high] }, () => TFMapUitl.clearPointLocation_list(map));
  1710. map.popup.setOffset(-191, 70);
  1711. window.clearImpoint()
  1712. });
  1713. map.addOverlay(marker);
  1714. }
  1715. } else if (i.st_type == 4) {
  1716. i.typeName = '雨量站';
  1717. if (i.lat && i.lng) {
  1718. let canvas = document.createElement('canvas');
  1719. let context = canvas.getContext('2d');
  1720. let textWidth = 14;
  1721. canvas.width = 20;
  1722. canvas.height = 20;
  1723. let x = 0.8;
  1724. let y = 0.8;
  1725. let w = canvas.width;
  1726. let h = canvas.height;
  1727. let r = 5;
  1728. // 缩放
  1729. context.scale(0.8, 0.8);
  1730. // context.fillStyle = 'rgba(0,0,0,0.5)'
  1731. context.fillStyle = '#e7e7e7';
  1732. // context.fillStyle = 'rgba(231, 231, 231,0.9)'
  1733. // 阴影
  1734. context.shadowOffsetX = 5;
  1735. context.shadowOffsetY = 5;
  1736. context.shadowBlur = 2;
  1737. context.shadowColor = 'rgba(0,0,0,0.5)';
  1738. // 绘制圆角矩形
  1739. context.beginPath();
  1740. context.arc(w, h, r, 0, 2 * Math.PI);
  1741. context.closePath();
  1742. context.fill();
  1743. var marker = new TFMap.Marker({ x: i.lng, y: i.lat, z: i.high }, canvas, {
  1744. scale: 1.2,
  1745. })
  1746. // .action('./static/img/gc2.png')
  1747. .init()
  1748. .pierce();
  1749. marker.setId('gcd&' + i.stcd);
  1750. const tempClass = TFMapUitl.getId('gcd', i.stcd) + '*' + ',' + TFMapUitl.specialControl.yuliangzhan;
  1751. marker.setClassify(tempClass);
  1752. dzgcMarkerIdList[marker.id] = marker;
  1753. marker.label(i.st_name, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 20, 'rgba(6,161,239,0)');
  1754. marker.info = i;
  1755. marker.addListener(map, e => {
  1756. if(window.breathMarker){
  1757. window.breathMarker.breathe()
  1758. window.breathMarker=null
  1759. }
  1760. if (e && e.graphic && e.graphic.overlay) {
  1761. e.graphic.overlay.breathe(0,0.3)
  1762. window.breathMarker=e.graphic.overlay
  1763. }
  1764. var i = e.graphic.overlay.info
  1765. map.openInfoWindowHtml(TFMapUitl.gcdMarkerDom(i), { position: [i.lng, i.lat, i.high] }, () => TFMapUitl.clearPointLocation_list(map));
  1766. map.popup.setOffset(-182, 68);
  1767. window.clearImpoint()
  1768. });
  1769. map.addOverlay(marker);
  1770. }
  1771. } else if (i.st_type == 5) {
  1772. i.typeName = '一般气象站';
  1773. if (i.lat && i.lng) {
  1774. var marker = new TFMap.Marker({ x: i.lng, y: i.lat, z: i.high }, './static/img/siteimg/qixiang.png', {
  1775. scale: 0.8,
  1776. })
  1777. // .action('./static/img/gc2.png')
  1778. .init()
  1779. .pierce();
  1780. marker.setId('gcd&' + i.stcd);
  1781. const tempClass = TFMapUitl.getId('gcd', i.stcd) + '*' + ',' + TFMapUitl.specialControl.yibanqixiangzhan;
  1782. marker.setClassify(tempClass);
  1783. dzgcMarkerIdList[marker.id] = marker;
  1784. marker.label(i.st_name, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, -10, 'rgba(6,161,239,0)');
  1785. marker.info = i;
  1786. marker.addListener(map, e => TFMapUitl.setSTMarkerPopup(e));
  1787. map.addOverlay(marker);
  1788. }
  1789. } else if (i.st_type == 6) {
  1790. i.typeName = '碳水通量站';
  1791. if (i.lat && i.lng) {
  1792. var marker = new TFMap.Marker({ x: i.lng, y: i.lat, z: i.high }, './static/img/siteimg/tanshui.png', {
  1793. scale: 1,
  1794. })
  1795. // .action('./static/img/gc2.png')
  1796. .init()
  1797. .pierce();
  1798. marker.setId('gcd&' + i.stcd);
  1799. const tempClass = TFMapUitl.getId('gcd', i.stcd) + '*' + ',' + TFMapUitl.specialControl.tanshuitongliangzhan;
  1800. marker.setClassify(tempClass);
  1801. dzgcMarkerIdList[marker.id] = marker;
  1802. marker.label(i.st_name, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 20, 'rgba(6,161,239,0)');
  1803. marker.info = i;
  1804. marker.addListener(map, e => {
  1805. if(window.breathMarker){
  1806. window.breathMarker.breathe()
  1807. window.breathMarker=null
  1808. }
  1809. if (e && e.graphic && e.graphic.overlay) {
  1810. e.graphic.overlay.breathe(0,0.3)
  1811. window.breathMarker=e.graphic.overlay
  1812. }
  1813. var i = e.graphic.overlay.info
  1814. map.openInfoWindowHtml(TFMapUitl.gcdMarkerDom(i), { position: [i.lng, i.lat, i.high] }, () => TFMapUitl.clearPointLocation_list(map));
  1815. map.popup.setOffset(-185, 70);
  1816. window.clearImpoint()
  1817. });
  1818. map.addOverlay(marker);
  1819. }
  1820. } else if (i.st_type == 7) {
  1821. i.typeName = '标准气象站';
  1822. if (i.lat && i.lng) {
  1823. var marker = new TFMap.Marker({ x: i.lng, y: i.lat, z: i.high }, './static/img/siteimg/qixiang2.png', {
  1824. scale: 0.9,
  1825. })
  1826. // .action('./static/img/gc2.png')
  1827. .init()
  1828. .pierce();
  1829. marker.setId('gcd&' + i.stcd);
  1830. const tempClass = TFMapUitl.getId('gcd', i.stcd) + '*' + ',' + TFMapUitl.specialControl.biaozhunqixiangzhan;
  1831. marker.setClassify(tempClass);
  1832. dzgcMarkerIdList[marker.id] = marker;
  1833. marker.label(i.st_name, '12pt Source Han Sans CN', 'rgba(255,255,255,0)', 0, 14, 'rgba(6,161,239,0)');
  1834. marker.info = i;
  1835. marker.addListener(map, e => {
  1836. if(window.breathMarker){
  1837. window.breathMarker.breathe()
  1838. window.breathMarker=null
  1839. }
  1840. if (e && e.graphic && e.graphic.overlay) {
  1841. e.graphic.overlay.breathe(0,0)
  1842. window.breathMarker=e.graphic.overlay
  1843. }
  1844. var i = e.graphic.overlay.info
  1845. map.openInfoWindowHtml(TFMapUitl.gcdMarkerDom(i), { position: [i.lng, i.lat, i.high] }, () => TFMapUitl.clearPointLocation_list(map));
  1846. map.popup.setOffset(-185, 58);
  1847. window.clearImpoint()
  1848. });
  1849. map.addOverlay(marker);
  1850. }
  1851. }
  1852. });
  1853. },
  1854. gnssLine(monitorDevicesStore) {
  1855. monitorDevicesStore
  1856. .LigongDeviceSensor({
  1857. pageNo: 1,
  1858. pageSize: 1000,
  1859. })
  1860. .then((res) => {
  1861. console.log('gnss:', res);
  1862. if (!res) return;
  1863. res.result.records.map((i) => {
  1864. if (i.value1 && i.value2) {
  1865. const gnssOffsetScale = 1;
  1866. const x = i.value2 * gnssOffsetScale;
  1867. const y = i.value1 * gnssOffsetScale;
  1868. var s = Cesium.Cartesian3.fromDegrees(Number(i.sensorLon), Number(i.sensorLat), Number(0));
  1869. const e = Cesium.Cartesian3.add(s, new Cesium.Cartesian3(x, y, 0), new Cesium.Cartesian3());
  1870. map.addOverlay(
  1871. new TFMap.Line([s, e], 'rgba(255,255,0,1)').init().label(e, Cesium.Cartesian3.distance(s, e)).setClassify('arrow_line*').setArrow()
  1872. );
  1873. }
  1874. });
  1875. });
  1876. },
  1877. getDzdxInfoTxData(store) {
  1878. store.GetDzdxInfoTxData().then((res) => {
  1879. if (!res) return;
  1880. res.map((i) => {
  1881. if (i.txjson) {
  1882. const l = new TFMap.GeoPolygon(JSON.parse(i.txjson), 0, 'rgba(255,255,255,0)', 'rgba(255,255,0,1)', 0.01)
  1883. .setId('dzdfw_geojson_fw')
  1884. .setClassify('dzdfw_geojson*')
  1885. .label({ name: 'name', show: false, color: 'rgba(255,255,0,1)' }, 'line', 'line_segment');
  1886. map.addOverlay(l);
  1887. }
  1888. });
  1889. });
  1890. },
  1891. mapHover() {
  1892. let label = null;
  1893. map.event.mousemove((i) => {
  1894. const level = map.getLevel();
  1895. if (level > 10) return;
  1896. if (label) {
  1897. label.fillColor.setValue(Cesium.Color.fromCssColorString('rgba(255,255,255,0)'));
  1898. label.backgroundColor.setValue(Cesium.Color.fromCssColorString('rgba(6,161,239,0)'));
  1899. }
  1900. if (
  1901. i.graphic &&
  1902. i.graphic.id &&
  1903. (i.graphic.id.id.indexOf('dzdmarker') > -1 ||
  1904. i.graphic.id.id.indexOf('gcd') > -1 ||
  1905. i.graphic.id.id.indexOf('rain') > -1 ||
  1906. i.graphic.id.id.indexOf('wd') > -1 ||
  1907. i.graphic.id.id.indexOf('fs') > -1)
  1908. ) {
  1909. label = i.graphic.id.label;
  1910. label.fillColor.setValue(Cesium.Color.fromCssColorString('rgba(255,255,255,1)'));
  1911. label.backgroundColor.setValue(Cesium.Color.fromCssColorString('rgba(6,161,239,0.6)'));
  1912. return;
  1913. }
  1914. });
  1915. },
  1916. getUrl(x, y) {
  1917. return new Promise((resolve, reject) => {
  1918. var url = window.mapConfig.updateHeight;
  1919. var data = {
  1920. geometries: [{ type: 'POINT3D', x: x, y: y, z: 0 }],
  1921. sceneName: window.mapConfig.sceneName,
  1922. layerName: window.mapConfig.layerName,
  1923. interpolationDistance: 0,
  1924. };
  1925. fetch(url, {
  1926. method: 'post',
  1927. body: JSON.stringify(data),
  1928. headers: {
  1929. 'Content-Type': 'application/json',
  1930. },
  1931. })
  1932. .then(function (e) {
  1933. return e.json();
  1934. })
  1935. .then((n) => {
  1936. resolve(n);
  1937. });
  1938. });
  1939. },
  1940. getPoint(n) {
  1941. return new Promise((resolve, reject) => {
  1942. fetch(n.newResourceLocation + '.json')
  1943. .then((e) => {
  1944. return e.json();
  1945. })
  1946. .then((n) => {
  1947. resolve(n);
  1948. });
  1949. });
  1950. },
  1951. initWinWay() {
  1952. const geologicalStore = useGeologicalStore();
  1953. const monitorDevicesStore = useMonitorDevicesStore();
  1954. const _this = this;
  1955. function getUrl(x, y) {
  1956. return new Promise((resolve, reject) => {
  1957. var url = window.mapConfig.updateHeight;
  1958. var data = {
  1959. geometries: [{ type: 'POINT3D', x: x, y: y, z: 0 }],
  1960. sceneName: window.mapConfig.sceneName,
  1961. layerName: window.mapConfig.layerName,
  1962. interpolationDistance: 0,
  1963. };
  1964. fetch(url, {
  1965. method: 'post',
  1966. body: JSON.stringify(data),
  1967. headers: {
  1968. 'Content-Type': 'application/json',
  1969. },
  1970. })
  1971. .then(function (e) {
  1972. return e.json();
  1973. })
  1974. .then((n) => {
  1975. resolve(n);
  1976. });
  1977. });
  1978. }
  1979. function getPoint(n) {
  1980. return new Promise((resolve, reject) => {
  1981. fetch(n.newResourceLocation + '.json')
  1982. .then((e) => {
  1983. return e.json();
  1984. })
  1985. .then((n) => {
  1986. resolve(n);
  1987. });
  1988. });
  1989. }
  1990. // 获取重要测站点
  1991. window.getImportSites=function (){
  1992. window.impointInterval&&clearInterval(window.impointInterval)
  1993. window.impointFlowInterval&&clearInterval(window.impointFlowInterval)
  1994. if(window.impointFlag&&!window.impointNotShow){
  1995. getImportPoint().then(res=>{
  1996. if(res.code==200&&res.data){
  1997. if(window.impoint&&window.impoint.length){
  1998. window.impoint.forEach(j=>{
  1999. map.removeOverlay(j);
  2000. })
  2001. window.impoint=[]
  2002. }
  2003. window.impoint=[]
  2004. // 记录指标数组长度
  2005. window.impointDataLength= res.data[0].data_real.length
  2006. window.impointDataLengthNow=0
  2007. res.data.forEach(i=>{
  2008. _this.stDetailArrStore.forEach(j=>{
  2009. if(i.stcd==j.stcd){
  2010. let data=j
  2011. data.dlat=i.dlat
  2012. data.dlon=i.dlon
  2013. data.data_real=i.data_real
  2014. data.st_name=i.st_name
  2015. console.log(i,j,3663)
  2016. let markerWindow= new TFMap.HTMLElementOverLay(
  2017. { x:Number(data.dlon) , y: Number(data.dlat),z:Number(data.high) },
  2018. TFMapUitl.impotPointDom(data)
  2019. ).init().setOff(-52, -0)
  2020. markerWindow.setId('imp&' + data.stcd);
  2021. markerWindow.setClassify('impoint_marker*')
  2022. markerWindow.info = data;
  2023. window.impoint.push(markerWindow)
  2024. map.addOverlay(markerWindow)
  2025. }
  2026. })
  2027. })
  2028. // 单独记录每一个的指标数量和当前滚动位置
  2029. window.indexNumInfo=[]
  2030. window.impoint&&window.impoint.forEach(i=>{
  2031. // console.log(i,'8383')
  2032. window.indexNumInfo.push({
  2033. impointDataLengthNow:0,
  2034. impointDataLength:i.info.sensor.length?i.info.sensor.length:0
  2035. })
  2036. })
  2037. // 指标滚动
  2038. window.impointFlowInterval=
  2039. setInterval(()=>{
  2040. window.indexNumInfo&&window.indexNumInfo.forEach((i,index)=>{
  2041. if(i.impointDataLengthNow<i.impointDataLength-1){
  2042. i.impointDataLengthNow++
  2043. }else{
  2044. i.impointDataLengthNow=0
  2045. }
  2046. jquery(`.impopup`).eq(index).children().css({'margin-top':`-${52*i.impointDataLengthNow}px`})
  2047. })
  2048. // if(window.impointDataLength){
  2049. // if(window.impointDataLengthNow<window.impointDataLength-1){
  2050. // window.impointDataLengthNow++
  2051. // }else{
  2052. // window.impointDataLengthNow=0
  2053. // }
  2054. // jquery('.impopup-content').css({'margin-top':`-${52*window.impointDataLengthNow}px`})
  2055. // }
  2056. },5000)
  2057. }
  2058. })
  2059. window.impointInterval=
  2060. setInterval(
  2061. ()=>{
  2062. window.impointFlowInterval&&clearInterval(window.impointFlowInterval)
  2063. if(window.impoint&&window.impoint.length){
  2064. window.impoint.forEach(j=>{
  2065. map.removeOverlay(j);
  2066. })
  2067. window.impoint=[]
  2068. }
  2069. if(window.impointFlag){
  2070. getImportPoint().then(res=>{
  2071. if(res.code==200&&res.data){
  2072. if(window.impoint&&window.impoint.length){
  2073. window.impoint.forEach(j=>{
  2074. map.removeOverlay(j);
  2075. })
  2076. window.impoint=[]
  2077. }
  2078. window.impoint=[]
  2079. // 记录指标数组长度
  2080. window.impointDataLength= res.data[0].data_real.length
  2081. window.impointDataLengthNow=0
  2082. res.data.forEach(i=>{
  2083. _this.stDetailArrStore.forEach(j=>{
  2084. if(i.stcd==j.stcd){
  2085. let data=j
  2086. data.dlat=i.dlat
  2087. data.dlon=i.dlon
  2088. data.data_real=i.data_real
  2089. data.st_name=i.st_name
  2090. // console.log(i,j,3663)
  2091. let markerWindow= new TFMap.HTMLElementOverLay(
  2092. { x:Number(data.dlon) , y: Number(data.dlat),z:Number(data.high) },
  2093. TFMapUitl.impotPointDom(data)
  2094. ).init().setOff(-52, -0)
  2095. markerWindow.setId('imp&' + data.stcd);
  2096. markerWindow.setClassify('impoint_marker*')
  2097. markerWindow.info = data;
  2098. window.impoint.push(markerWindow)
  2099. map.addOverlay(markerWindow)
  2100. }
  2101. })
  2102. })
  2103. // 单独记录每一个的指标数量和当前滚动位置
  2104. window.indexNumInfo=[]
  2105. window.impoint&&window.impoint.forEach(i=>{
  2106. // console.log(i,'8383')
  2107. window.indexNumInfo.push({
  2108. impointDataLengthNow:0,
  2109. impointDataLength:i.info.sensor.length?i.info.sensor.length:0
  2110. })
  2111. })
  2112. // 指标滚动
  2113. window.impointFlowInterval=
  2114. setInterval(()=>{
  2115. window.indexNumInfo&&window.indexNumInfo.forEach((i,index)=>{
  2116. if(i.impointDataLengthNow<i.impointDataLength-1){
  2117. i.impointDataLengthNow++
  2118. }else{
  2119. i.impointDataLengthNow=0
  2120. }
  2121. jquery(`.impopup`).eq(index).children().css({'margin-top':`-${52*i.impointDataLengthNow}px`})
  2122. })
  2123. // if(window.impointDataLength){
  2124. // if(window.impointDataLengthNow<window.impointDataLength-1){
  2125. // window.impointDataLengthNow++
  2126. // }else{
  2127. // window.impointDataLengthNow=0
  2128. // }
  2129. // jquery('.impopup-content').css({'margin-top':`-${52*window.impointDataLengthNow}px`})
  2130. // }
  2131. },5000)
  2132. }
  2133. })
  2134. }
  2135. },5*60*1000
  2136. )
  2137. }else{
  2138. if(window.impoint&&window.impoint.length){
  2139. window.impoint.forEach(j=>{
  2140. map.removeOverlay(j);
  2141. })
  2142. window.impoint=[]
  2143. }
  2144. }
  2145. }
  2146. window.clearImpoint=function(){
  2147. window.impointInterval&&clearInterval(window.impointInterval)
  2148. window.impointFlowInterval&&clearInterval(window.impointFlowInterval)
  2149. window.impointFlag=false
  2150. if(window.impoint&&window.impoint.length){
  2151. window.impoint.forEach(j=>{
  2152. map.removeOverlay(j);
  2153. })
  2154. window.impoint=[]
  2155. }
  2156. }
  2157. //
  2158. // 获取测站并更新测站高程
  2159. window.updateStHeightInfo = async function () {
  2160. const key = 'updatable';
  2161. createMessage.loading({ content: '更新站点高程中,请稍后', key, duration: 0 });
  2162. // console.log(765)
  2163. let res = await getStDetailInfo();
  2164. if (res.code == 200) {
  2165. const Obj = JSON.parse(JSON.stringify(res.data));
  2166. _this.stDetailArrStore = [];
  2167. let objArr = [];
  2168. for (const i in Obj) {
  2169. objArr = [...objArr, ...Obj[i]];
  2170. }
  2171. for (var i = 0; i < objArr.length; i++) {
  2172. let data = await map.iserver.getHeight(objArr[i].lng, objArr[i].lat);
  2173. if (data && data.geometries && data.geometries.length) {
  2174. objArr[i].high = data.geometries[0].z;
  2175. _this.stDetailArrStore.push(objArr[i]);
  2176. // 修改高程
  2177. let re = await changeHeight({ stcd: objArr[i].stcd, high: objArr[i].high });
  2178. console.log('更新高度:', re);
  2179. }
  2180. }
  2181. // 重新加载站点
  2182. createMessage.success({ content: '更新站点高程成功,重新加载测站点', key, duration: 2 });
  2183. // 移除测站点
  2184. map.removeOverlay('shuiwenzhan*', false);
  2185. map.removeOverlay('shuiweizhan*', false);
  2186. map.removeOverlay('yuliangzhan*', false);
  2187. map.removeOverlay('yibanqixiangzhan*', false);
  2188. map.removeOverlay('biaozhunqixiangzhan*', false);
  2189. map.removeOverlay('tanshuitongliangzhan*', false);
  2190. // 加载测站
  2191. _this.setSTMarker(_this.stDetailArrStore);
  2192. } else {
  2193. createMessage.error({ content: '获取站点失败', key, duration: 2 });
  2194. }
  2195. };
  2196. window.updateDZ = async function () {
  2197. var list = map.findOverlay('dzdmarker*');
  2198. for (var i = 0; i < list.length; i++) {
  2199. var info = list[i].info;
  2200. if (!info.z) {
  2201. var data = await getPoint(await getUrl(info.x, info.y));
  2202. if (data && data.geometries && data.geometries.length) {
  2203. var f = new FormData();
  2204. f.append('id', info.id);
  2205. f.append('z', data.geometries[0].position.z);
  2206. var re = await geologicalStore.UpdateDzdxInfo(f);
  2207. console.log('更新高度:', re);
  2208. }
  2209. }
  2210. }
  2211. };
  2212. window.updateGC = async function () {
  2213. var list = map.findOverlay('gcdmarker*');
  2214. for (var i = 0; i < list.length; i++) {
  2215. var info = list[i].info;
  2216. if (!info.z) {
  2217. var data = await getPoint(await getUrl(info.x, info.y));
  2218. if (data && data.geometries && data.geometries.length) {
  2219. var f = new FormData();
  2220. f.append('id', info.id);
  2221. f.append('z', data.geometries[0].position.z);
  2222. var re = await geologicalStore.UpdateGcdxInfo(f);
  2223. console.log('工程更新高度:', re);
  2224. }
  2225. }
  2226. }
  2227. };
  2228. window.updateSB = async function () {
  2229. var list = map.findOverlay('sbdmarker*');
  2230. for (var i = 0; i < list.length; i++) {
  2231. var info = list[i].info;
  2232. if (!info.elevation) {
  2233. var data = await getPoint(await getUrl(info.deviceLon, info.deviceLat));
  2234. if (data && data.geometries && data.geometries.length) {
  2235. var re = await monitorDevicesStore.updateElevation({
  2236. id: info.id,
  2237. elevation: data.geometries[0].position.z,
  2238. });
  2239. console.log('更新高度:', re);
  2240. }
  2241. }
  2242. }
  2243. };
  2244. window.saveView = function (id, type) {
  2245. var user = JSON.parse(sessionStorage.getItem('user'));
  2246. geologicalStore.Visualangle({
  2247. type: type,
  2248. typeId: id + '',
  2249. createdBy: user.userId,
  2250. visualAngle: map.getView(),
  2251. });
  2252. };
  2253. window.aroundPoint = function (x, y, z) {
  2254. map.rotateAroundPoint([x, y, z], null, 5);
  2255. };
  2256. window.siteDetail = (i) => {
  2257. _this.detailInfo = i;
  2258. _this.title = i.st_name + i.typeName + '(' + i.stcd + ')';
  2259. _this.dialogvisable = true;
  2260. };
  2261. // var video = new TFMap.VideoFuse(map, null);
  2262. // window.playVideo = function (p) {
  2263. // window.openModelVideo(p, true);
  2264. // geologicalStore
  2265. // .getVideoprojection({
  2266. // deviceId: p.id,
  2267. // })
  2268. // .then((r) => {
  2269. // if (!r) return;
  2270. // setTimeout(() => {
  2271. // var dom = jquery('.fmp4-player canvas');
  2272. // if (dom && dom.length) {
  2273. // window.video2 = video.polygonWay(r, dom[0]);
  2274. // } else {
  2275. // // window.video2 = video.polygonWay(r);
  2276. // }
  2277. // }, 1000);
  2278. // });
  2279. // };
  2280. window.editVideo = (r) => {
  2281. map.draw('polygon', (e) => {
  2282. geologicalStore
  2283. .Videoprojection({
  2284. deviceId: r.id,
  2285. projectionPoint: JSON.stringify(e.getPosition()),
  2286. })
  2287. .then(() => {
  2288. if (map.drawObj) map.drawObj.remove();
  2289. });
  2290. });
  2291. };
  2292. },
  2293. },
  2294. });
  2295. </script>
  2296. <style lang="less">
  2297. ::v-deep .cesium-roller-blind {
  2298. z-index: 0;
  2299. }
  2300. #leftMapMfasking {
  2301. position: absolute;
  2302. left: 0px;
  2303. // width: 960px;
  2304. width: 500px;
  2305. background-image: url('../../assets/images/zuo.png');
  2306. background-size: 100% 100%;
  2307. }
  2308. #rightMapMfasking {
  2309. background-size: 100% 100%;
  2310. position: absolute;
  2311. right: 0px;
  2312. // width: 960px;
  2313. width: 500px;
  2314. background-image: url('../../assets/images/you.png');
  2315. }
  2316. #mapDiv2 {
  2317. background-image: url('../../assets/images/map.jpg');
  2318. }
  2319. #mapMfasking {
  2320. background-image: url('../../assets/images/bg2.png');
  2321. }
  2322. #mapMfasking1 {
  2323. background-image: url('../../assets/images/zuo.png');
  2324. }
  2325. #mapMfasking2 {
  2326. background-image: url('../../assets/images/you.png');
  2327. }
  2328. .mapMfasking {
  2329. height: 100%;
  2330. width: 1920px;
  2331. position: absolute;
  2332. pointer-events: none;
  2333. z-index: 1;
  2334. }
  2335. .mfasking1 {
  2336. box-shadow: inset 420px 100px 100px rgba(0, 0, 0, 0.5);
  2337. }
  2338. .mfasking2 {
  2339. opacity: 1;
  2340. box-shadow: inset -420px -100px 100px rgba(0, 0, 0, 0.5);
  2341. }
  2342. .mfasking22 {
  2343. opacity: 1;
  2344. box-shadow: inset -420px -100px 100px rgba(0, 0, 0, 0.5);
  2345. background: url('../../assets/images/bj.png') no-repeat center center;
  2346. background-size: 100% 100%;
  2347. }
  2348. .mfasking3 {
  2349. background: rgba(0, 0, 0, 0);
  2350. }
  2351. #mapDiv {
  2352. height: 100vh;
  2353. position: relative;
  2354. float: left;
  2355. }
  2356. .jwd {
  2357. position: absolute;
  2358. right: 450px;
  2359. bottom: 18px;
  2360. z-index: 10;
  2361. color: #fff;
  2362. font-size: 12px;
  2363. }
  2364. </style>