cesium加载倾斜影像数据(模拟雨、雪、雾、无人机飞行、测距、箭头标绘、电子围栏等)

实现效果如下:

功能菜单如下:

加载倾斜影像核心代码:

      var palaceTileset = new Cesium.Cesium3DTileset({
        url: 'http://127.0.0.1:9002/tileset.json',
        //控制切片视角显示的数量,可调整性能
        maximumScreenSpaceError: 0.1,
        maximumNumberOfLoadedTiles: 10000,
      })
      //添加到场景
      viewer.scene.primitives.add(palaceTileset);
      //控制模型的位置
      palaceTileset.readyPromise.then(function (palaceTileset) {
        viewer.scene.primitives.add(palaceTileset);
        var terrainProvider = new Cesium.EllipsoidTerrainProvider();
        viewer.terrainProvider = terrainProvider;
        var heightOffset = -370; //改变3Dtiles的高度
        var boundingSphere = palaceTileset.boundingSphere;
        var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
        var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
        var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);
        var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
        palaceTileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
        viewer.zoomTo(palaceTileset, new Cesium.HeadingPitchRange(0.5, -0.2, palaceTileset.boundingSphere.radius *
          1.0));
      });

无人机特定方向飞行(按钮实现):

function jxuTime() {

  // 创建 SampledPositionProperty 对象
  var positionProperty = new Cesium.SampledPositionProperty();

  // 添加一系列位置和时间样本
  positionProperty.addSample(Cesium.JulianDate.now(), Cesium.Cartesian3.fromDegrees(108.927007, 34.256505, 50));
  positionProperty.addSample(Cesium.JulianDate.addSeconds(Cesium.JulianDate.now(), 5, new Cesium.JulianDate()), Cesium.Cartesian3.fromDegrees(108.929620, 34.252350, 50));

  // 创建实体并设置模型
  var entity = viewer.entities.add({
    name: 'plane',
    position: positionProperty,
    model: {
      uri: ".//Apps//SampleData//image2d//air.glb",
      scale: 2,
      minimumPixelSize: 128,
      maximumScale: 2000,
      runAnimations: true,
      clampAnimations: true,
      show: true
    }
  });
}

电子围栏:

//绘制电子围栏
function GetRoute4() {
  function PolylineTrailLinkMaterialProperty(color, duration) {
    this._definitionChanged = new Cesium.Event();
    this._color = undefined;
    this._colorSubscription = undefined;
    this.color = color;
    this.duration = duration;
    this._time = (new Date()).getTime();
  }

  Object.defineProperties(PolylineTrailLinkMaterialProperty.prototype, {
    isConstant: {
      get: function () {
        return false;
      }
    },
    definitionChanged: {
      get: function () {
        return this._definitionChanged;
      }
    },
    color: Cesium.createPropertyDescriptor('color')
  });

  PolylineTrailLinkMaterialProperty.prototype.getType = function (time) {
    return 'PolylineTrailLink';
  }
  PolylineTrailLinkMaterialProperty.prototype.getValue = function (time, result) {
    if (!Cesium.defined(result)) {
      result = {};
    }
    result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.WHITE, result.color);
    result.image = Cesium.Material.PolylineTrailLinkImage;
    result.time = (((new Date()).getTime() - this._time) % this.duration) / this.duration;
    return result;
  }
  PolylineTrailLinkMaterialProperty.prototype.equals = function (other) {
    return this === other || (other instanceof PolylineTrailLinkMaterialProperty && Property.equals(this._color, other._color))
  };

  Cesium.PolylineTrailLinkMaterialProperty = PolylineTrailLinkMaterialProperty;
  Cesium.Material.PolylineTrailLinkType = 'PolylineTrailLink';
  Cesium.Material.PolylineTrailLinkImage = "../Cesium-1.75/img/colors1.png";//图片
  Cesium.Material.PolylineTrailLinkSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n\
 {\n\
     czm_material material = czm_getDefaultMaterial(materialInput);\n\
     vec2 st = materialInput.st;\n\
     vec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t));\n\
     material.alpha = colorImage.a * color.a;\n\
     material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\
     return material;\n\
 }"/*"czm_material czm_getMaterial(czm_materialInput materialInput)\n\
    {\n\
        czm_material material = czm_getDefaultMaterial(materialInput);\n\
        vec2 st = materialInput.st;\n\
        vec4 colorImage = texture2D(image, vec2(fract(st.t - time), st.t));\n\
        material.alpha = colorImage.a * color.a;\n\
        material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\
        return material;\n\
    }" //从下向上*/
  // 着色器从上到下
  /* "czm_material czm_getMaterial(czm_materialInput materialInput)\n\
   {\n\
       czm_material material = czm_getDefaultMaterial(materialInput);\n\
       vec2 st = materialInput.st;\n\
       vec4 colorImage = texture2D(image, vec2(fract(-(st.t + time)), st.t));\n\
       material.alpha = colorImage.a * color.a;\n\
       material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\
       return material;\n\
   }"
   //顺时针
   "czm_material czm_getMaterial(czm_materialInput materialInput)\n\
 {\n\
     czm_material material = czm_getDefaultMaterial(materialInput);\n\
     vec2 st = materialInput.st;\n\
     vec4 colorImage = texture2D(image, vec2(fract(-(st.s + time)), st.t));\n\
     material.alpha = colorImage.a * color.a;\n\
     material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\
     return material;\n\
 }";
 //逆时针
 "czm_material czm_getMaterial(czm_materialInput materialInput)\n\
 {\n\
     czm_material material = czm_getDefaultMaterial(materialInput);\n\
     vec2 st = materialInput.st;\n\
     vec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t));\n\
     material.alpha = colorImage.a * color.a;\n\
     material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\
     return material;\n\
 }"
   */

  Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineTrailLinkType, {
    fabric: {
      type: Cesium.Material.PolylineTrailLinkType,
      uniforms: {
        color: new Cesium.Color(1.0, 0.0, 0.0, 0.9),
        image: Cesium.Material.PolylineTrailLinkImage,
        time: 2
      },
      source: Cesium.Material.PolylineTrailLinkSource
    },
    translucent: function (material) {
      return true;
    }
  })

  three = viewer.entities.add({
    name: 'yscNoNeedEntity',
    wall: {
      positions: Cesium.Cartesian3.fromDegreesArrayHeights([
        108.92536, 34.25199, 130.0,//左下
        108.92990, 34.25200, 130.0,//右下
        108.92973, 34.25477, 130.0,//右上
        108.92510, 34.25476, 130.0,//左上
        108.92536, 34.25199, 130.0,//左下
      ]),
      material: new Cesium.PolylineTrailLinkMaterialProperty(Cesium.Color.BLUE, 3000),
    }
  })

  viewer.flyTo(three)
}

下次再续写吧,忙了!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/552872.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Real3DPortrait照片对口型,数字人,音频/视频驱动数字人

先看效果 上传一张图片和一段音频,照片如下: 合成后效果如下: 照片对口型-音频驱动 支持音频驱动和视频驱动,视频可以使照片有参照视频中的口型和和动作。 项目地址 https://github.com/yerfor/Real3DPortrait 我的环境 win…

CentOS-Stream-9升级openssh9.7p

CentOS Stream 9 ssh -V需要的RPM包 openssh-9.7p1-1.el9.x86_64.rpm openssh-clients-9.7p1-1.el9.x86_64.rpm openssh-server-9.7p1-1.el9.x86_64.rpm 编译openssh openssh官方只提供源码包,我们选择自己将源码编译为rpm包来升级环境的openssh,需要…

UE5 C++ 使用TimeLine时间轴实现开关门

一.添加门头文件 和 声明 #include "Components/TimelineComponent.h" #include"Components/BoxComponent.h" UPROPERTY(EditAnywhere,BlueprintReadWrite,Category "MyCurve")UCurveFloat* MyCurveFloat;UPROPERTY(EditAnywhere, BlueprintR…

前端网络---http缓存

什么是http缓存? 1、HTTP 缓存会存储与请求关联的响应,并将存储的响应复用于后续请求。 2、缓存的原理是在首次请求后保存一份请求资源的响应副本,当用户再次发起相同请求时,判断缓存是否命中,如果命中则将前面的响应…

如何保障UDP传输中数据文件不丢失?

UDP协议因其低时延和高速传输的特性,在实时应用和大量数据传输领域中发挥着不可或缺的作用。但是,由于UDP是一种无连接的通讯协议,它并不确保数据包的顺序、完整性和可靠性。 为了解决UDP传输中数据一致性的问题,技术专家们进行了…

HTML不常用的文本标签

1.标签如下&#xff1a; 代码及相关内容 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>不常用的文…

2024第二十一届五一数学建模C题思路 五一杯建模思路

文章目录 1 赛题思路2 比赛日期和时间3 组织机构4 建模常见问题类型4.1 分类问题4.2 优化问题4.3 预测问题4.4 评价问题 5 建模资料 1 赛题思路 (赛题出来以后第一时间在CSDN分享) https://blog.csdn.net/dc_sinor?typeblog 2 比赛日期和时间 报名截止时间&#xff1a;2024…

大数据测试:构建Hadoop和Spark分布式HA运行环境

随着大数据技术的不断发展&#xff0c;Hadoop和Spark已成为处理大规模数据的热门框架。在生产环境中&#xff0c;高可用性&#xff08;HA&#xff09;是至关重要的&#xff0c;以确保数据处理和分析任务不受中断。本文将详细介绍如何构建 Hadoop和Spark分布式HA运行环境&#x…

Ubuntu 22.04 配置VirtualBox安装Windows 10虚拟机

Ubuntu 22.04 配置VirtualBox安装Windows 10虚拟机 文章目录 Ubuntu 22.04 配置VirtualBox安装Windows 10虚拟机1.安装virtualbox2.下载Window.iso文件并载入3.问题解决3.1 Kernel driver not installed (rc-1908)3.2 VT-x is disabled in the BIOS for all CPU modes 4.安装Wi…

中文编程入门(Lua5.4.6中文版)第十三章 Lua 文件操作

在《Lua世界》的冒险旅途中&#xff0c;勇士们时常需要与神秘的文本卷轴打交道。为了更好地掌握这些知识宝藏&#xff0c;Lua I/O库提供了两种强大的探索模式&#xff1a;简单模式和完全模式&#xff0c;助你轻松应对各类文献挑战。 简单模式&#xff1a;初识卷轴 简单模式如…

如何精心挑选合适的软件公司

选择一家合适的软件公司对于小程序商城的开发与运营而言&#xff0c;具有举足轻重的意义。面对市场上琳琅满目的软件公司&#xff0c;如何找到那个真正适合自己的合作伙伴呢&#xff1f;接下来&#xff0c;我们将从需求分析、公司资质、项目案例、服务态度和成本效益五个方面&a…

Linux0.11 源码中的内存分页机制

学习Linux的源码&#xff0c;《深入linux 内核架构》这本书看起来就让人害怕&#xff0c;然后就想着看看早期的linux版本的源码&#xff0c;从网上查看资料发现linux0.11 这个版本有很多人拿来当成教学版本&#xff0c;而且也有很多的参考书以这个版本作为基础来讲解&#xff0…

【数据挖掘】实验8:分类与预测建模

实验8&#xff1a;分类与预测建模 一&#xff1a;实验目的与要求 1&#xff1a;学习和掌握回归分析、决策树、人工神经网络、KNN算法、朴素贝叶斯分类等机器学习算法在R语言中的应用。 2&#xff1a;了解其他分类与预测算法函数。 3&#xff1a;学习和掌握分类与预测算法的评…

UTS iOS插件

1、UTS插件无法出现 再uniapp x中使用时&#xff0c;必须给这个插件高度和宽度&#xff0c;否则出不来&#xff01; <uts-hello-view buttonText"点击按钮内容" style"width:375px;height: 375px;background-color: aqua;"></uts-hello-view>…

关于外网java后端服务访问内网minio中间件,因连接minio超时,启动失败问题

注&#xff1a;服务器情况&#xff1a;2台服务器&#xff0c;内网服务器包含&#xff08;activemq、minio、nginx、redis、mysql、后端java服务&#xff09;。外网服务器只有后端java服务&#xff0c;访问内网的中间件&#xff08;内网服务器开放了部分指定端口&#xff09; 问…

技术速递|.NET 智能组件简介 – AI 驱动的 UI 控件

作者&#xff1a;Daniel Roth 排版&#xff1a;Alan Wang AI 的最新进展有望彻底改变我们与软件交互和使用软件的方式。然而&#xff0c;将 AI 功能集成到现有软件中可能面临一些挑战。因此&#xff0c;我们开发了新的 .NET 智能组件&#xff0c;这是一组真正有用的 AI 支持的 …

无法连接到本地主机上的MySQL服务器???

如果你在连接工具上连接mysql连接&#xff0c;如下 可能是本地数据库没有启动 使用管理员身份打开cmd窗口&#xff0c;输入net start mysql命令&#xff0c;关闭数据库输入命令net stop mysql 然后在打开连接工具连接mysql就可以了

Java之JVM、JUC面试题笔记(持续更新)

CountDownLatch和CyclicBarrier JUC 并发编程_juc并发编程-CSDN博客 java 类加载机制&#xff1f;如何实现自定义类加载器&#xff1f;findClass 与 loadClass 的区别&#xff1f; 在Java中&#xff0c;自定义类加载器通常是通过继承java.lang.ClassLoader类并重写其findClas…

《机器学习by周志华》学习笔记-线性模型-02

1、对数几率回归 1.1、背景 上一节我们考虑了线性模型的回归学习,但是想要做分类任务就需要用到上文中的广义线性模型。 当联系函数连续且充分光滑,考虑单调可微函数,令: 1.2、概念 找一个单调可谓函数,将分类任务的真实标记与线性回归模型的预测值联系起来,也叫做「…

机器学习实验二-----决策树构建

决策树是机器学习中一种基本的分类和回归算法&#xff0c;是依托于策略抉择而建立起来的树。本文学习的是决策树的分类 1. 构建决策树流程 选择算法&#xff1a;常用的算法包括ID3、C4.5、CART等。 划分节点&#xff1a;根据数据特征和算法选择&#xff0c;递归地划分节点&…