当前位置: 首页 > news >正文

Vue.js2+Cesium1.103.0 十六、多模型轨迹运动

Vue.js2+Cesium1.103.0 十六、多模型轨迹运动

Demo

<template><div id="cesium-container" style="width: 100%; height: 100%;"><ul class="ul"><li v-for="(item, index) of deviceInfo" :key="index" class="li" :class="{ active: lock === item.id }"@click="handleClick(item)">{{ `飞机${item.id}` }}</li></ul></div>
</template><script>
/* eslint-disable no-undef */
/* eslint-disable new-cap */
import DrawDeviceUtil from '@/utils/DrawDevice.js'
const mock = require('./mock.json')
const mock2 = require('./mock2.json')
const mock3 = require('./mock3.json')
const mock4 = require('./mock4.json')
const mock5 = require('./mock5.json')
export default {name: 'FlightAnimation',data () {return {lock: '',deviceInfo: [{id: 1,uri: 'model/Cesium_Air.glb',scale: 1,position: {longitude: mock[0].longitude,latitude: mock[0].latitude,altitude: mock[0].altitude}},{id: 2,uri: 'model/Cesium_Air.glb',scale: 0.9,position: {longitude: mock2[mock2.length - 1].longitude,latitude: mock2[mock2.length - 1].latitude,altitude: mock2[mock2.length - 1].altitude}},{id: 3,uri: 'model/Cesium_Air.glb',scale: 0.8,position: {longitude: mock3[mock3.length - 1].longitude,latitude: mock3[mock3.length - 1].latitude,altitude: mock3[mock3.length - 1].altitude}},{id: 4,uri: 'model/Cesium_Air.glb',scale: 1,position: {longitude: mock4[mock4.length - 1].longitude,latitude: mock4[mock4.length - 1].latitude,altitude: mock4[mock4.length - 1].altitude}},{id: 5,uri: 'model/Cesium_Air.glb',scale: 1,position: {longitude: mock5[mock5.length - 1].longitude,latitude: mock5[mock5.length - 1].latitude,altitude: mock5[mock5.length - 1].altitude}}],$DrawDeviceUtil: null}},computed: {},watch: {},mounted () {// returnwindow.$InitMap()viewer.camera.flyTo({destination: Cesium.Rectangle.fromDegrees(100, 10, 120, 70)})this.$DrawDeviceUtil = new DrawDeviceUtil()// * 添加设备this.$DrawDeviceUtil.AddDevices(this.deviceInfo)// * 模拟 ws 上报实时位置信息let count = 0setInterval(() => {count += 1const position = mock[count]const position2 = mock2[count]const position3 = mock3[count]const position4 = mock4[count]const position5 = mock5[count]// * 更新位置this.$DrawDeviceUtil.UpdatePosition(1, position)this.$DrawDeviceUtil.UpdatePosition(2, position2)this.$DrawDeviceUtil.UpdatePosition(3, position3)this.$DrawDeviceUtil.UpdatePosition(4, position4)this.$DrawDeviceUtil.UpdatePosition(5, position5)}, 300)// 鼠标事件const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas)handler.setInputAction(function (event) { },Cesium.ScreenSpaceEventType.LEFT_CLICK)},methods: {handleClick (data) {this.lock = this.lock === data.id ? '' : data.idif (this.lock) {this.$DrawDeviceUtil.LockEntity(this.lock)} else {this.$DrawDeviceUtil.UnLockEntity()}}}
}
</script>
<style lang="scss" scoped>
.ul {position: absolute;right: 50px;top: 50px;z-index: 999;color: #fff;.li {cursor: pointer;&.active {color: red;}}
}
</style>
http://www.lryc.cn/news/358129.html

相关文章:

  • Matlab|基于PMU相量测量单元进行电力系统电压幅值和相角状态估计
  • 【C++】---二叉搜索树
  • FastAPI - 依赖注入3
  • 【网络运维的重要性】
  • YOLOv5改进 | 注意力机制 | 添加双重注意力机制 DoubleAttention【附代码/涨点能手】
  • 自用网站合集
  • 【Golang】gin框架如何在中间件中捕获响应并修改后返回
  • 电脑同时配置两个版本mysql数据库常见问题
  • Java | Leetcode Java题解之第112题路径总和
  • HaloDB 的 Oracle 兼容模式
  • 【Python】解决Python报错:TypeError: ‘xxx‘ object does not support item assignment
  • Spring-注解
  • 旧手机翻身成为办公利器——PalmDock的介绍也使用
  • 期货交易的雷区
  • 东方通TongWeb结合Spring-Boot使用
  • 6.S081的Lab学习——Lab5: xv6 lazy page allocation
  • 在WHM中如何调整max_post_size参数大小
  • 智能监控技术助力山林生态养鸡:打造智慧安全的养殖新模式
  • 那些不起眼但很好玩的API合辑
  • java —— 克隆对象、枚举
  • STM32-GPIO八种输入输出模式
  • windows镜像虚拟机创建共享文件夹详细步骤 -- 和本地电脑传输文件
  • 通关!游戏设计之道Day18
  • 写Python时不用import,你会遭遇什么
  • java网络:过滤器修改请求头
  • yolov10 快速使用及训练
  • CSS变量 -- var() 使用教程
  • python基础-数据结构-leetcode刷题必看-queue---队列-python的底层构建
  • 深入理解Spring Security:保护你的Web应用程序
  • 【车载开发系列】Vector工具链的安装