Cesium测量优化1
2024-10-22 07:40:00
简介:优化绘制点、线,面鼠标位置获取精度。支持3dties,gltf model,以及box等Geometry Entity上的位置拾取。
测试代码
<template>
<div class="dog">
<div id="cesiumContainer" style="width: 100%; height: 100%"></div>
<MeasureAnalysis ref="analysis_measure"></MeasureAnalysis>
<div id="toolTip"></div>
</div>
</template> <script>
import MeasureAnalysis from "./components/measureAnalysis";
export default {
data() {
return {};
}, components: {
MeasureAnalysis,
}, computed: {}, created() {}, mounted() {
TS.ready(() => {
Cesium.Camera.DEFAULT_VIEW_RECTANGLE = Cesium.Rectangle.fromDegrees(
92.0,
25.0,
119.0,
33.0
); window.viewer = new Cesium.Viewer("cesiumContainer", {
// terrainProvider : Cesium.createWorldTerrain()
});
this.$refs.analysis_measure.init();
// 添加三维模型到球儿上
const tileset = viewer.scene.primitives.add(
new Cesium.Cesium3DTileset({
url: "http://localhost:8080/tileset.json",
})
);
viewer.flyTo(tileset); // 添加box
const blueBox = viewer.entities.add({
name: "Blue box",
position: Cesium.Cartesian3.fromDegrees(115.99992822, 39.00004025, 2.5),
box: {
dimensions: new Cesium.Cartesian3(5.0, 5.0, 5.0),
material: Cesium.Color.BLUE,
},
});
// viewer.flyTo(blueBox); // 添加model glb
function createModel(url, height) {
//viewer.entities.removeAll(); const position = Cesium.Cartesian3.fromDegrees(
116.00005686,
39.00001029,
height
);
const heading = Cesium.Math.toRadians(0);
const pitch = 0;
const roll = 0;
const hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
const orientation = Cesium.Transforms.headingPitchRollQuaternion(
position,
hpr
); const entity = viewer.entities.add({
name: 'glb',
position: position,
orientation: orientation,
model: {
uri: url,
minimumPixelSize: 128,
maximumScale: 20000,
},
}); //viewer.trackedEntity = entity;
}
// createModel("./assets/CesiumMilkTruck/CesiumMilkTruck.glb", 0);
createModel('http://localhost:8081/CesiumMilkTruck/CesiumMilkTruck.glb',0);
最新文章
- HTML之一 符号实体
- insert---插入记录
- OCP prepare 20140626
- oracle_根据ID(字符型)建立分区表
- 《自己动手写CPU》写书评获赠书活动结果
- 基于redis的cas实现
- PM学习梳理--搭建产品架构
- Javascript高级编程学习笔记(18)—— 引用类型(7)单体内置对象
- MT【207】|ax^2+bx+c|中判别式$\Delta$的含义
- jackson的自动检测机制
- linux log
- ix 混合索引
- websocket搭建错误
- 如何在虚拟机安装的Win10系统里快速打开【此电脑】图标?(图文详解)
- 将项目托管到GitHub实现步骤
- HDU 5700 区间交 离线线段树
- 微软Azure DevOps自动化部署
- ansible api常用模块与参数
- oracle 12C安装问题
- POJ 3087 Shuffle&;#39;m Up(模拟)
热门文章
- 「Python实用秘技13」Python中临时文件的妙用
- 使用express设置静态目录,创建服务,响应get请求
- java HashMap的四种获取key,value的方式
- 人工智能,丹青圣手,全平台(原生/Docker)构建Stable-Diffusion-Webui的AI绘画库教程(Python3.10/Pytorch1.13.0)
- 第六周作业-N67044-张铭扬
- C# DevExpress GridControl下动态创建列的方法
- ESModule导入
- vue 状态类展示使用红绿圆点
- VUE学习-:class &; :style
- lbaas