index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. <template>
  2. <div class="container">
  3. <div id="modeltooltip">左键单击确认</div>
  4. <el-row style="height: 40px">
  5. <div class="myHeader">
  6. <el-button :type="this.dimension == 2 ? 'success' : 'danger'" @click="dimensionswitch(2)" round>二维</el-button>
  7. <el-button :type="this.dimension == 3 ? 'success' : 'danger'" @click="dimensionswitch(3)" round>三维</el-button>
  8. <el-button :type="this.dimension == 5 ? 'success' : 'danger'" @click="dimensionswitch(5)" round>
  9. 一体化
  10. </el-button>
  11. </div>
  12. </el-row>
  13. <el-row id="map" style="height: 790px; width: 100%; display: flex; position: relative">
  14. <el-col style="height: 100%; position: relative" :span="this.leftwidth">
  15. <div class="main-layout" v-on:mouseover="changeActive('3D')">
  16. <div id="3DcesiumContainer" class="map"></div>
  17. </div>
  18. </el-col>
  19. <el-col style="height: 100%; position: relative" :span="24 - this.leftwidth">
  20. <div class="main-layout" v-on:mouseover="changeActive('2D')">
  21. <div id="2DcesiumContainer" class="map"></div>
  22. </div>
  23. </el-col>
  24. <el-tabs
  25. type="border-card"
  26. v-model="activeName"
  27. tab-position="left"
  28. class="menu"
  29. :stretch="true"
  30. @tab-click="legendClick"
  31. >
  32. <el-tab-pane name="first">
  33. <span slot="label">
  34. <el-modeltooltip class="item" effect="dark" content="标绘" placement="left">
  35. <i class="el-icon-wind-power"></i>
  36. </el-modeltooltip>
  37. </span>
  38. </el-tab-pane>
  39. <el-tab-pane name="second">
  40. <span slot="label">
  41. <el-modeltooltip class="item" effect="dark" content="模型" placement="left">
  42. <i class="el-icon-receiving"></i>
  43. </el-modeltooltip>
  44. </span>
  45. <el-radio-group v-model="whosmodel" style="margin: 0 auto" size="mini">
  46. <el-radio-button label="red">红方</el-radio-button>
  47. <el-radio-button label="blue">蓝方</el-radio-button>
  48. </el-radio-group>
  49. <div v-if="whosmodel == 'blue'" class="model">
  50. <div :class="{ active: this.modelType == 'ThadRocket' }" @click="selectmodel('ThadRocket')">
  51. <el-image style="width: 100px; height: 80px; margin: 0 auto" :src="url" fit="fill"></el-image>
  52. <div style="text-align: center">Thad拦截导弹</div>
  53. </div>
  54. <div :class="{ active: this.modelType == 'interceptRadar' }" @click="selectmodel('interceptRadar')">
  55. <el-image style="width: 100px; height: 80px; margin: 0 auto" :src="url" fit="fill"></el-image>
  56. <div style="text-align: center">拦截雷达</div>
  57. </div>
  58. <div :class="{ active: this.modelType == 'interceptSatellite' }" @click="selectmodel('interceptSatellite')">
  59. <el-image style="width: 100px; height: 80px; margin: 0 auto" :src="url" fit="fill"></el-image>
  60. <div style="text-align: center">拦截卫星</div>
  61. </div>
  62. </div>
  63. <div v-else class="model">
  64. <div :class="{ active: this.modelType == 'rocket' }" @click="selectmodel('rocket')">
  65. <el-image style="width: 100px; height: 80px; margin: 0 auto" :src="url" fit="fill"></el-image>
  66. <div style="text-align: center">弹道导弹</div>
  67. </div>
  68. <div :class="{ active: this.modelType == 'radarTrap' }" @click="selectmodel('radarTrap')">
  69. <el-image style="width: 100px; height: 80px; margin: 0 auto" :src="url" fit="fill"></el-image>
  70. <div style="text-align: center">雷达诱饵</div>
  71. </div>
  72. <div :class="{ active: this.modelType == 'GRradar' }" @click="selectmodel('GRradar')">
  73. <el-image style="width: 100px; height: 80px; margin: 0 auto" :src="url" fit="fill"></el-image>
  74. <div style="text-align: center">干扰雷达</div>
  75. </div>
  76. </div>
  77. </el-tab-pane>
  78. <el-tab-pane name="third">
  79. <span slot="label">
  80. <el-modeltooltip class="item" effect="dark" content="测量" placement="left">
  81. <i class="el-icon-discount"></i>
  82. </el-modeltooltip>
  83. </span>
  84. </el-tab-pane>
  85. <el-tab-pane name="fouth">
  86. <span slot="label">
  87. <el-modeltooltip class="item" effect="dark" content="测想定" placement="left">
  88. <i class="el-icon-house"></i>
  89. </el-modeltooltip>
  90. </span>
  91. <el-table :data="situation">
  92. <el-table-column label="名称" prop="xdname"></el-table-column>
  93. <el-table-column label="操作">
  94. <template slot-scope="scope">
  95. <el-button type="primary" @click="getJson(scope.row)">导入</el-button>
  96. <el-button type="primary" @click="saveJson(scope.row)">保存</el-button>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. </el-tab-pane>
  101. </el-tabs>
  102. <div class="buttons">
  103. <el-button icon="el-icon-full-screen" circle @click="ismax()"></el-button>
  104. <!-- <el-button icon="el-icon-coin" circle></el-button> -->
  105. <!-- <el-button icon="el-icon-bangzhu" @click="Fly()" circle></el-button> -->
  106. <el-button icon="el-icon-house" circle @click="home()"></el-button>
  107. <el-button icon="el-icon-plus" circle @click="big()"></el-button>
  108. <el-button icon="el-icon-minus" circle @click="small()"></el-button>
  109. </div>
  110. </el-row>
  111. </div>
  112. </template>
  113. <script>
  114. import screenfull from "screenfull";
  115. import fireController from "../../api/fireController";
  116. import { getToken } from "@/utils";
  117. import axios from "axios";
  118. export default {
  119. computed: {},
  120. data() {
  121. return {
  122. situation: [],
  123. unit: [],
  124. satellite: [],
  125. center: [],
  126. viewer2D: null,
  127. viewer3D: null,
  128. dimension: 3,
  129. leftwidth: 24,
  130. mousevalue: null,
  131. shouldAnimate: false,
  132. activeName: null,
  133. currentLab: {
  134. index: -1,
  135. isActive: false
  136. },
  137. whosmodel: "red",
  138. modelType: null,
  139. url: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
  140. };
  141. },
  142. created() {
  143. this.getData();
  144. },
  145. mounted() {
  146. this.cesiumInit();
  147. },
  148. methods: {
  149. async saveJson(row) {
  150. await axios
  151. .post("http://localhost:8084/admin/online/onlineOperation/updateDatasource/main", {
  152. params: {
  153. datasourceId: "1656243335922192384",
  154. masterData: row,
  155. slaveData: {}
  156. }
  157. })
  158. .then((res) => {
  159. console.log("update successfully ");
  160. });
  161. },
  162. async getJson(row) {
  163. let redunit = [];
  164. let blueunit = [];
  165. let satellite = [];
  166. let center = [];
  167. let fileInfoStr = row.blueunit;
  168. let fileInfoArr = JSON.parse(fileInfoStr);
  169. for (let i = 0; i < fileInfoArr.length; i++) {
  170. await axios
  171. .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  172. params: {
  173. datasourceId: "1656243335922192384",
  174. fieldName: "blueunit",
  175. asImage: false,
  176. dataId: row.id,
  177. filename: fileInfoArr[i].filename,
  178. Authorization: getToken(),
  179. MenuId: "1656244747347431424"
  180. }
  181. })
  182. .then((response) => {
  183. // 处理成功的响应
  184. blueunit.push(response.data);
  185. })
  186. .catch((error) => {
  187. // 处理错误
  188. console.error(error);
  189. });
  190. }
  191. fileInfoStr = row.redunit;
  192. fileInfoArr = JSON.parse(fileInfoStr);
  193. for (let i = 0; i < fileInfoArr.length; i++) {
  194. await axios
  195. .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  196. params: {
  197. datasourceId: "1656243335922192384",
  198. fieldName: "redunit",
  199. asImage: false,
  200. dataId: row.id,
  201. filename: fileInfoArr[i].filename,
  202. Authorization: getToken(),
  203. MenuId: "1656244747347431424"
  204. }
  205. })
  206. .then((response) => {
  207. // 处理成功的响应
  208. redunit.push(response.data);
  209. })
  210. .catch((error) => {
  211. // 处理错误
  212. console.error(error);
  213. });
  214. }
  215. fileInfoStr = row.center;
  216. fileInfoArr = JSON.parse(fileInfoStr);
  217. for (let i = 0; i < fileInfoArr.length; i++) {
  218. await axios
  219. .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  220. params: {
  221. datasourceId: "1656243335922192384",
  222. fieldName: "center",
  223. asImage: false,
  224. dataId: row.id,
  225. filename: fileInfoArr[i].filename,
  226. Authorization: getToken(),
  227. MenuId: "1656244747347431424"
  228. }
  229. })
  230. .then((response) => {
  231. // 处理成功的响应
  232. center.push(response.data);
  233. })
  234. .catch((error) => {
  235. // 处理错误
  236. console.error(error);
  237. });
  238. }
  239. fileInfoStr = row.satellite;
  240. fileInfoArr = JSON.parse(fileInfoStr);
  241. for (let i = 0; i < fileInfoArr.length; i++) {
  242. await axios
  243. .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  244. params: {
  245. datasourceId: "1656243335922192384",
  246. fieldName: "satellite",
  247. asImage: false,
  248. dataId: row.id,
  249. filename: fileInfoArr[i].filename,
  250. Authorization: getToken(),
  251. MenuId: "1656244747347431424"
  252. }
  253. })
  254. .then((response) => {
  255. // 处理成功的响应
  256. satellite.push(response.data);
  257. })
  258. .catch((error) => {
  259. // 处理错误
  260. console.error(error);
  261. });
  262. }
  263. const jsonData = {
  264. id: row.id,
  265. xdname: row.xdname,
  266. type: row.type,
  267. creator: row.creator,
  268. createtime: row.createtime,
  269. bluecnt: row.bluecnt,
  270. target: row.target,
  271. starttime: row.starttime,
  272. steptime: row.steptime,
  273. blueunit: blueunit,
  274. redunit: redunit,
  275. satellite: satellite,
  276. center: center
  277. };
  278. console.log("jsonData :>> ", jsonData);
  279. },
  280. //获取所有数据
  281. getData() {
  282. this.getCenter();
  283. this.getSatellite();
  284. this.getUnit();
  285. this.getSituation();
  286. },
  287. // 获取场景想定数据
  288. getSituation() {
  289. let params = {
  290. datasourceId: "1656243335922192384",
  291. filterDtoList: [],
  292. pageParam: {
  293. pageNum: 1,
  294. pageSize: 10
  295. }
  296. };
  297. fireController.situation(this, params).then((res) => {
  298. this.situation = res.data.dataList;
  299. });
  300. },
  301. // 获取作战单元数据
  302. getUnit() {
  303. let params = {
  304. datasourceId: "1657931215497334784",
  305. filterDtoList: [],
  306. pageParam: {
  307. pageNum: 1,
  308. pageSize: 10
  309. }
  310. };
  311. fireController.unit(this, params).then((res) => {
  312. this.unit = res.data.dataList;
  313. });
  314. },
  315. // 获取指挥中心数据
  316. getCenter() {
  317. let params = {
  318. datasourceId: "1654421731512684544",
  319. filterDtoList: [],
  320. pageParam: {
  321. pageNum: 1,
  322. pageSize: 10
  323. }
  324. };
  325. fireController.center(this, params).then((res) => {
  326. this.center = res.data.dataList;
  327. });
  328. },
  329. // 获取预警卫星数据
  330. getSatellite() {
  331. let params = {
  332. datasourceId: "1654424480958648320",
  333. filterDtoList: [],
  334. pageParam: {
  335. pageNum: 1,
  336. pageSize: 10
  337. }
  338. };
  339. fireController.satellite(this, params).then((res) => {
  340. this.satellite = res.data.dataList;
  341. });
  342. },
  343. cesiumInit() {
  344. this.viewer2D = new this.Cesium.Viewer("2DcesiumContainer", {
  345. sceneMode: this.Cesium.SceneMode.SCENE2D,
  346. animation: false, // 是否显示时间轴动画
  347. baseLayerPicker: false,
  348. homeButton: false,
  349. geocoder: false,
  350. timeline: false,
  351. fullscreenButton: false,
  352. sceneModePicker: false,
  353. navigationHelpButton: false,
  354. selectionIndicator: false,
  355. imageryProvider: new this.Cesium.UrlTemplateImageryProvider({
  356. url: "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",
  357. layer: "tdtVecBasicLayer",
  358. style: "default",
  359. format: "image/png",
  360. tileMatrixSetID: "GoogleMapsCompatible",
  361. show: false
  362. })
  363. });
  364. this.viewer3D = new this.Cesium.Viewer("3DcesiumContainer", {
  365. animation: false, // 是否显示时间轴动画
  366. baseLayerPicker: false,
  367. homeButton: false,
  368. geocoder: false,
  369. timeline: false,
  370. fullscreenButton: false,
  371. sceneModePicker: false,
  372. navigationHelpButton: false,
  373. selectionIndicator: false,
  374. // imageryProvider: new this.Cesium.WebMapServiceImageryProvider({
  375. // url: '/geoserver/map/wms',
  376. // // 这里是自定义的图层名称
  377. // layers: 'map',
  378. // parameters: {
  379. // service: 'WMS',
  380. // format: 'image/png',
  381. // transparent: true
  382. // }
  383. // }),
  384. imageryProvider:
  385. // new this.Cesium.WebMapTileServiceImageryProvider({
  386. // url: "http://10.170.16.95:8080/geoserver/gwc/service/wmts/rest/map:map/{style}/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png",
  387. // layer: 'map:map',
  388. // style: 'raster',
  389. // format: 'image/png',
  390. // tileMatrixSetID: 'EPSG:900913', //一般使用EPSG:3857坐标系
  391. // }),
  392. new this.Cesium.UrlTemplateImageryProvider({
  393. url: "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",
  394. layer: "tdtVecBasicLayer",
  395. style: "default",
  396. format: "image/png",
  397. tileMatrixSetID: "GoogleMapsCompatible",
  398. show: false
  399. })
  400. });
  401. this.viewer3D._cesiumWidget._creditContainer.style.display = "none";
  402. this.viewer2D._cesiumWidget._creditContainer.style.display = "none";
  403. this.viewer3D.camera.setView({
  404. destination: new this.Cesium.Cartesian3.fromDegrees(117.918977, 25.0, 1500000)
  405. // 方向,俯视和仰视的视角
  406. // orientation:{
  407. // heading: this.Cesium.Math.toRadians(90),//坐标系旋转90度
  408. // pitch: this.Cesium.Math.toRadians(-45) ,//设置俯仰角度为-45度
  409. // }
  410. });
  411. this.viewer2D.camera.setView({
  412. destination: new this.Cesium.Cartesian3.fromDegrees(117.918977, 25.0, 1500000)
  413. // 方向,俯视和仰视的视角
  414. // orientation:{
  415. // heading: this.Cesium.Math.toRadians(90),//坐标系旋转90度
  416. // pitch: this.Cesium.Math.toRadians(-45) ,//设置俯仰角度为-45度
  417. // }
  418. });
  419. // this.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 1500000; //相机高度的最大值
  420. this.viewer2D.camera.percentageChanged = 0.01;
  421. this.viewer2D.camera.changed.addEventListener(this.sync);
  422. this.viewer3D.camera.percentageChanged = 0.01;
  423. this.viewer3D.camera.changed.addEventListener(this.sync);
  424. },
  425. removeAllModel() {
  426. this.viewer.entities.removeAll(); // 移除全部模型
  427. },
  428. sync() {
  429. if (this.mousevalue == "3D") {
  430. // 三维地图中心点
  431. let center = new this.Cesium.Cartesian2(
  432. Math.floor(this.viewer3D.canvas.clientWidth / 2),
  433. Math.floor(this.viewer3D.canvas.clientHeight / 2)
  434. );
  435. // 转为世界坐标系
  436. let position = this.viewer3D.scene.camera.pickEllipsoid(center);
  437. console.log(position);
  438. // 判断中心点是否在椭球体上
  439. if (this.Cesium.defined(position)) {
  440. // 获取三维地图中心点与相机之间的距离
  441. let distance = this.Cesium.Cartesian3.distance(position, this.viewer3D.scene.camera.positionWC);
  442. position = this.convertWorldToCartographic(position);
  443. // 更新二维地图
  444. this.viewer2D.scene.camera.setView({
  445. destination: new this.Cesium.Cartesian3.fromDegrees(position.longitude, position.latitude, distance)
  446. });
  447. console.log(distance);
  448. }
  449. }
  450. if (this.mousevalue == "2D") {
  451. // 二维地图中心点
  452. let center = new this.Cesium.Cartesian2(
  453. Math.floor(this.viewer2D.canvas.clientWidth / 2),
  454. Math.floor(this.viewer2D.canvas.clientHeight / 2)
  455. );
  456. // 转为世界坐标系
  457. let position = this.viewer2D.scene.camera.pickEllipsoid(center);
  458. console.log(position);
  459. // 判断中心点是否在椭球体上
  460. if (this.Cesium.defined(position)) {
  461. // 获取三维地图中心点与相机之间的距离
  462. let distance = this.viewer2D.scene.camera.positionCartographic.height;
  463. position = this.convertWorldToCartographic(position);
  464. // 更新三维地图
  465. this.viewer3D.scene.camera.setView({
  466. destination: new this.Cesium.Cartesian3.fromDegrees(position.longitude, position.latitude, distance)
  467. });
  468. console.log(this.viewer2D.scene.camera.positionWC);
  469. }
  470. }
  471. },
  472. // 将世界坐标系转换为经纬度坐标系
  473. convertWorldToCartographic(worldPosition) {
  474. const ellipsoid = this.viewer2D.scene.globe.ellipsoid;
  475. const cartographic = ellipsoid.cartesianToCartographic(worldPosition);
  476. const longitude = this.Cesium.Math.toDegrees(cartographic.longitude);
  477. const latitude = this.Cesium.Math.toDegrees(cartographic.latitude);
  478. const height = cartographic.height;
  479. return { longitude, latitude, height };
  480. },
  481. // 监听地图变化
  482. changeActive(value) {
  483. this.mousevalue = value;
  484. console.log(value);
  485. },
  486. dimensionswitch(value) {
  487. this.dimension = value;
  488. if (value == 3) {
  489. this.leftwidth = 24;
  490. } else if (value == 2) {
  491. this.leftwidth = 0;
  492. } else {
  493. this.leftwidth = 12;
  494. }
  495. },
  496. // 全屏缩小
  497. ismax() {
  498. if (screenfull.isEnabled && screenfull.isFullscreen) {
  499. screenfull.exit();
  500. } else {
  501. screenfull.request();
  502. }
  503. },
  504. /* 获取camera中心点坐标 */
  505. getCenterPosition(is3D = false) {
  506. let viewer = is3D ? this.viewer3D : this.viewer2D;
  507. let result = viewer.camera.pickEllipsoid(
  508. new this.Cesium.Cartesian2(viewer.canvas.clientWidth / 2, viewer.canvas.clientHeight / 2)
  509. );
  510. let curPosition = this.Cesium.Ellipsoid.WGS84.cartesianToCartographic(result);
  511. let lon = (curPosition.longitude * 180) / Math.PI;
  512. let lat = (curPosition.latitude * 180) / Math.PI;
  513. let height = viewer.camera.positionCartographic.height;
  514. return {
  515. lon: lon,
  516. lat: lat,
  517. height: height
  518. };
  519. },
  520. /* 地图放大 */
  521. big() {
  522. let { lon, lat, height } = this.getCenterPosition(this.dimension === 3);
  523. let viewer = this.dimension === 3 ? this.viewer3D : this.viewer2D;
  524. // 镜头拉进
  525. viewer.camera.flyTo({
  526. destination: this.Cesium.Cartesian3.fromDegrees(lon, lat, height / 1.8),
  527. duration: 1.0
  528. });
  529. },
  530. /* 地图缩小 */
  531. small() {
  532. let { lon, lat, height } = this.getCenterPosition(this.dimension === 3);
  533. let viewer = this.dimension === 3 ? this.viewer3D : this.viewer2D;
  534. // 镜头远离
  535. viewer.camera.flyTo({
  536. destination: this.Cesium.Cartesian3.fromDegrees(lon, lat, height * 1.2),
  537. duration: 1.0
  538. });
  539. },
  540. home() {
  541. let viewer = this.dimension === 3 ? this.viewer3D : this.viewer2D;
  542. viewer.camera.flyTo({
  543. destination: this.Cesium.Cartesian3.fromDegrees(117.918977, 25.0, 1500000),
  544. duration: 2.0
  545. });
  546. },
  547. Fly() {
  548. this.shouldAnimate = !this.shouldAnimate;
  549. this.viewer2D.clock.shouldAnimate = true;
  550. this.viewer3D.clock.shouldAnimate = true;
  551. if (this.shouldAnimate == true) {
  552. this.startRun({ multiplier: 2000 });
  553. } else {
  554. this.stopRun();
  555. }
  556. },
  557. startRun(option = { multiplier: 1 }) {
  558. // 监听每次渲染前执行矩阵求解
  559. this.viewer3D.scene.postUpdate.addEventListener(this.rotateSetting);
  560. // 根据option修改一些参数
  561. if (this.viewer3D.clock) {
  562. const keys = Object.keys(option);
  563. for (let k of keys) {
  564. this.viewer3D.clock[k] = option[k];
  565. }
  566. }
  567. },
  568. stopRun() {
  569. let viewer = this.viewer3D;
  570. viewer.clock.multiplier = 1;
  571. viewer.scene.postUpdate.removeEventListener(this.rotateSetting);
  572. },
  573. rotateSetting() {
  574. let Cesium = this.Cesium;
  575. let viewer = this.viewer3D;
  576. if (!viewer || viewer.scene.mode !== Cesium.SceneMode.SCENE3D) {
  577. return;
  578. }
  579. const icrfToFixed = Cesium.Transforms.computeIcrfToFixedMatrix(viewer.clock.currentTime);
  580. // icrfToFixed 在上面的方法中,若没加载好所需的计算资源会返回undefined,判断下
  581. if (Cesium.defined(icrfToFixed)) {
  582. const camera = viewer.camera;
  583. const offset = Cesium.Cartesian3.clone(camera.position);
  584. const transform = Cesium.Matrix4.fromRotationTranslation(icrfToFixed);
  585. camera.lookAtTransform(transform, offset);
  586. }
  587. },
  588. /// / tabs 切换点击
  589. legendClick(tab, event) {
  590. var tab_content = document.querySelectorAll(".menu .el-tabs__content");
  591. if (this.currentLab.index == tab.index) {
  592. tab_content[0].style.display == "none" || ""
  593. ? (tab_content[0].style.display = "block")
  594. : (tab_content[0].style.display = "none");
  595. }
  596. if (this.currentLab.index != tab.index) {
  597. this.currentLab.index = tab.index;
  598. tab_content[0].style.display = "block";
  599. }
  600. },
  601. selectmodel(modelType) {
  602. if (this.modelType == modelType) {
  603. this.modelType == null;
  604. } else {
  605. this.modelType = modelType;
  606. var map = document.getElementById("map");
  607. map.style.cursor = "crosshair";
  608. document.addEventListener("mousemove", function (event) {
  609. var modeltooltip = document.getElementById("modeltooltip");
  610. modeltooltip.style.display = "block";
  611. modeltooltip.style.left = event.clientX - 180 + "px";
  612. modeltooltip.style.top = event.clientY - 100 + "px";
  613. });
  614. document.addEventListener("mouseout", function () {
  615. var modeltooltip = document.getElementById("modeltooltip");
  616. modeltooltip.style.display = "none";
  617. });
  618. }
  619. }
  620. }
  621. };
  622. </script>
  623. <style scoped>
  624. .myHeader {
  625. background-color: #1c222b !important;
  626. color: #fff;
  627. height: 100%;
  628. display: flex;
  629. flex-direction: row;
  630. align-items: center; /*由于flex-direction: column,因此align-items代表的是水平方向*/
  631. justify-content: center; /*由于flex-direction: column,因此justify-content代表的是垂直方向*/
  632. }
  633. .myHeader .el-button {
  634. width: 100px;
  635. height: 20px;
  636. padding: 1px 23px;
  637. }
  638. .box-card {
  639. min-height: 100%;
  640. height: 100%;
  641. }
  642. /deep/ .el-card__body {
  643. height: 100% !important;
  644. padding: 0px !important;
  645. }
  646. .main-layout {
  647. height: 100%;
  648. width: 100%;
  649. }
  650. .container {
  651. height: 100%;
  652. }
  653. .map {
  654. width: 100%;
  655. height: 100%;
  656. }
  657. .menu {
  658. position: absolute;
  659. height: 400px;
  660. z-index: 999;
  661. left: 20px;
  662. top: 20px;
  663. }
  664. /deep/.el-tabs--left .el-tabs__header.is-left {
  665. margin-right: 0px !important;
  666. }
  667. .buttons {
  668. display: flex;
  669. flex-direction: column;
  670. align-items: center;
  671. justify-items: center;
  672. position: absolute;
  673. z-index: 999;
  674. right: 20px;
  675. top: 20px;
  676. }
  677. .el-button {
  678. margin: 5px !important;
  679. }
  680. /deep/.el-tabs--border-card > .el-tabs__content {
  681. width: 300px;
  682. display: none;
  683. }
  684. .model {
  685. display: flex;
  686. width: 100%;
  687. flex-wrap: wrap;
  688. }
  689. .model > div {
  690. width: 50%;
  691. height: 120px;
  692. padding: 5px;
  693. }
  694. .model > div:hover {
  695. border: 2px solid blue;
  696. }
  697. .model > div:active {
  698. border: 2px solid red;
  699. }
  700. .active {
  701. border: 2px solid red !important;
  702. }
  703. .model .el-image {
  704. display: block !important;
  705. }
  706. /deep/ .el-image .el-image__inner {
  707. border: 1px solid #ddd;
  708. border-radius: 5px;
  709. }
  710. #modeltooltip {
  711. position: absolute;
  712. display: none;
  713. padding: 5px;
  714. color: #fff;
  715. font-size: 20px;
  716. pointer-events: none;
  717. z-index: 999;
  718. }
  719. </style>