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

cesium模型加载-点击-高亮

cesium模型加载-点击-高亮

  1. 模型加载, Cesium3DTileset文档地址

var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({url : 'http://localhost:8002/tilesets/Seattle/tileset.json'
}));
  1. 设置tileset的样式, Cesium3DTileStyle文档地址

tileset.style = new Cesium.Cesium3DTileStyle({color : {conditions : [['${Height} >= 100', 'color("purple", 0.5)'],['${Height} >= 50', 'color("red")'],['true', 'color("blue")']]},show : '${Height} > 0',meta : {description : '"Building id ${id} has height ${Height}."'}
});
  1. 业务需要点击相关数据对于模型id高亮
      // 点击数据获取idconst filterLayer = (id) =>{let that = thislet ids = [1,2,3];// 使用show regexp - 效率稍好const exp = ['${names} !== undefined && ', 'regExp("', ids.join('|'), '")', '.test(${names})'].join('',)const falseExp = ['${names} === undefined || ','!regExp("',ids.join('|'),'")','.test(${names})',].join('')const selExp = ['${names} !== undefined && ','${names} === ','"' + id + '"',].join('')tileset.style = new Cesium.Cesium3DTileStyle({color: {conditions: [[selExp, 'rgba(0,0,0,0)'],[falseExp, 'rgba(255,255,255,0)'],],},// show: exp,})// 如上 falseExp 代表需要隐藏的模型,设置color为透明也会隐藏掉模型, 设置 show: exp 也可以显示和隐藏模型,但是如果设置show为false的同时设置color的颜色会导致模型显示。设置selExp为rgba(0,0,0,0)表示高亮为红色。}

http://www.mrgr.cn/news/14911.html

相关文章:

  • 自定义全局变量在uniapp的Vuex应用
  • 数字三角形
  • BITCN合集(BITCN 、BITCN-GRU、BITCN-BIGRU、BITCN-LSTM、BITCN-BILSTM、BITCN-SVM)
  • 装饰器(Decorators)的实现
  • 基于RK3588+MCU智能清洁车应用解决方案
  • erlang学习:用OTP构建系统2,警报管理
  • CTF密码学小结
  • 面试题集锦:数据库
  • 在随机点实现凸包包围游戏地区
  • 电商模式的解析
  • 【Python机器学习】NLP词频背后的含义——从词频到主题得分
  • 2.3 阿里巴巴-背包问题
  • 跨链互通:Web3如何实现多链互操作性
  • 如何用Java SpringBoot+Vue打造摇滚乐鉴赏网站:从设计到实现全解析
  • helm学习第四篇-微服务组件的加入
  • 从“养老社区、居家健康”迈向“全生活场景”,保险+康养步入3.0时代!
  • centos基础设置
  • k8s探针详细学习笔记
  • MAX_VALUE 和 MAX_SAFE_INTEGER的区别及相关知识
  • vue-router4.2.5 useRouter源码解读