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

Vue.js2+Cesium1.103.0 七、Primitive 绘制航线元素

Vue.js2+Cesium1.103.0 七、Primitive 绘制航线元素

用 Primitive 绘制航线元素,包括航点图标,航线线段,线段距离标注,航点序号,海拔标注,总航程等信息。

  • 可同时绘制多条航线;
  • 可根据 id 清除指定的某条航线;
  • 设置航点图标;
  • 设置航线颜色;
  • 绘制时可同时将视角跳转到航线所在位置处。

Demo

<template><div style="width: 100%; height: 100%;"><div id="cesium-container" style="width: 100%; height: 100%;" /><div class="ul"><div v-for="(item, index) of list" :key="index" class="li":class="{ active: checkedList.findIndex(_ => _.id === item.id) > -1 }" @click="handleClick(item, index)">{{ item.name }}</div></div></div>
</template>
<script>
/* eslint-disable no-undef */
import {AddRouteGraphic,ClearRouteGraphic
} from '@/utils/CesiumUtils/DrawRoute'
export default {data() {return {colors: ['#D0021B', '#F8E71C', '#7ED321', '#4A90E2', '#BD10E0'],active: '',checkedList: [],list: []}},computed: {},watch: {},mounted() {window.$InitMap()this.list = require('./routes.json')viewer.camera.flyTo({destination: Cesium.Rectangle.fromDegrees(117.70714705967534, 39.074587204563336, 117.72382214389826, 39.08476744905917)})},methods: {handleClick(item, index) {if (this.checkedList.findIndex(_ => _.id === item.id) === -1) {this.checkedList.push(item)} else {const spliceIndex = this.checkedList.findIndex(_ => _.id === item.id)this.checkedList.splice(spliceIndex, 1)}for (let index = 0; index < this.list.length; index++) {const element = this.list[index]ClearRouteGraphic('Route' + element.id)}for (let index = 0; index < this.checkedList.length; index++) {const element = this.checkedList[index]AddRouteGraphic({id: 'Route' + element.id, // 航线所有元素 ID 前缀(用于多处绘制/清除航线)list: element.list, // 航点数据wayPointImage: require('@/assets/images/waypoint.png'), // 航点图标indexReverse: false, // 序号翻转// color: '#ff0000',color: this.colors[index], // 航线,航点颜色lineVisible: true, // 航线pointVisible: true, // 航点altitudeVisible: true, // 海拔distanceVisible: true, // 线段距离planeTimeVisible: true, // 预计飞行时间fly: true // 是否定位到航线处})}}}
}
</script>
<style lang="scss" scoped>
.ul {position: fixed;right: 50px;top: 100px;.li {padding: 10px 0;cursor: pointer;color: #fff;&.active {color: red;}}
}
</style>
http://www.lryc.cn/news/125016.html

相关文章:

  • Mybatis 源码 ④ :TypeHandler
  • RabbitMQ和JMeter,一个完美的组合!优化你的中间件处理方式
  • WARNING: IPv4 forwarding is disabled. Networking will not work
  • SpringBoot复习:(40)@EnableConofigurationProperties注解的用法
  • Live Market是如何做跨境客户服务的?哪些技术赋能?
  • 2023年7月京东洗衣机行业品牌销售排行榜(京东数据分析软件)
  • 【0214】postgres后端进程session退出,如何通过日志分析其会话信息
  • Rust 重载运算符|复数结构的“加减乘除”四则运算
  • Oracle删除表空间
  • Mysql - 配置Mysql主从复制-keepalived高可用-读写分离集群
  • Qt QLineEdit输入时限制,采用正则表达式
  • 【CSS】文本效果
  • Django快速上手,写一个简单的页面,快来看看吧~
  • 【Express.js】数据库初始化
  • 【数理知识】三维空间旋转矩阵的欧拉角表示法,四元数表示法,两者之间的转换,Matlab 代码实现
  • 【业务功能篇63】Springboot聊聊 过滤器和拦截器
  • 提高学生学习效率的模拟考试系统
  • 解决QWebEngineView在linux下加载本地html失败的问题
  • 如何使用Redis实现内容推送功能
  • 怎么对视频进行压缩?
  • redisson配置类---SpringBoot集成、redis单机和集群模式配置
  • 瓴羊发布All in One 产品,零售SaaS的尽头是DaaS?
  • win10中Docker安装、构建镜像、创建容器、Vscode连接实例
  • 贝锐蒲公英:快速搭建连锁门店监控体系,赋能企业高效管理
  • c++ WinInet InternetOpenUrl下载中文文件
  • 算法通过村第三关-数组青铜笔记|单调数组
  • Springboot MultipartFile文件上传与下载
  • js this变量
  • Ubuntu ip冲突,修改静态IP方法
  • windows下dll文件的创建详细教程