使用官方github包,部分解释来源于Viewer - Cesium Documentation
 
 
 Cesium.Ion.defaultAccessToken =
        "token";
      const viewer = new Cesium.Viewer("cesiumContainer");
      viewer.entities.add({
        //entities获取实体集合
        id: "red rectangle,zIndex 1",
        rectangle: {
          //设置或者获取矩形
          coordinates: Cesium.Rectangle.fromDegrees(-110.0, 20, -100.5, 30.0), //左下角经纬右上角经纬
          material: Cesium.Color.RED,
          zIndex: 1, //一个属性,指定用于排序地面几何的 zIndex。仅当矩形为常量且未指定
//height 或 extrudedHeight 时才有效。
        },
      });
      viewer.entities.add({
        id: "Textured rectangle, zIndex 2",
        rectangle: {
          coordinates: Cesium.Rectangle.fromDegrees(-112.0, 25.0, -102.5, 35.0),
          material: "../images/Cesium_Logo_Color.jpg",
          zIndex: 2,
        },
      });
      viewer.entities.add({
        id: "Blue rectangle, zIndex 3",
        rectangle: {
          coordinates: Cesium.Rectangle.fromDegrees(-110.0, 31.0, -100.5, 41.0),
          material: Cesium.Color.BLUE,
          zIndex: 3,
        },
      });
      viewer.entities.add({
        id: "Textured rectangle, zIndex 3",
        rectangle: {
          coordinates: Cesium.Rectangle.fromDegrees(-99.5, 20.0, -90.0, 30.0),
          material: "../images/Cesium_Logo_Color.jpg",
          zIndex: 3,
        },
      });
      viewer.entities.add({
        id: "Green rectangle, zIndex 2",
        rectangle: {
          coordinates: Cesium.Rectangle.fromDegrees(-97.5, 25.0, -88.0, 35.0),
          material: Cesium.Color.GREEN,
          zIndex: 2,
        },
      });
      viewer.entities.add({
        id: "Blue rectangle, zIndex 1",
        rectangle: {
          coordinates: Cesium.Rectangle.fromDegrees(-99.5, 31.0, -90.0, 41.0),
          material: Cesium.Color.BLUE,
          zIndex: 1,
        },
      });
      if (!Cesium.Entity.supportsPolylinesOnTerrain(viewer.scene)) {
        //检查给定场景是否支持夹在地形或 3D 平铺上的折线。
        //如果不支持此功能,具有折线图形的实体将在提供的高度处使用顶点进行渲染,
        //并使用 `arcType` 参数而不是固定在地面上。
        window.alert(
          "Polylines on terrain are not supported on this platform ,Z-index will be ignored"
        );
      }
      if (!Cesium.Entity.supportsMaterialsforEntitiesOnTerrain(viewer.scene)) {
        //检查给定场景是否支持覆盖在地形或 3D 平铺上的实体上的颜色以外的材质。
        //如果不支持此功能,则具有非颜色材质但没有'高度'的实体将被渲染为高度为 0。
        window.alert(
          "Textured materials on terrain polygons are not
supported on this platform, Z-index will be ignored"
        );
      }
      viewer.entities.add({
        id: "Polyline, zIndex 2",
        polyline: {
          positions: Cesium.Cartesian3.fromDegreesArray([
            -120.0, 22.0, -80.0, 22.0,
          ]), //指定定义线带的 Cartesian3 位置数组
          width: 8.0,
          material: new Cesium.PolylineGlowMaterialProperty({
            //映射到折线发光 Material
            glowPower: 0.2, //发光强度,占总线宽的百分比
            color: Cesium.Color.BLUE,
            //taperPower:一个数字属性,指定锥形效果的强度,
            //以总线条长度的百分比表示。如果为 1.0 或更高,则不使用锥形效果。
          }),
          zIndex: 2,//深度信息
          clampToGround: true,
          //指定折线是否应固定在地面上。
        },
      });
      viewer.zoomTo(viewer.entities);
      //zoomTo (target, offset(可选) )
      //异步设置相机以查看提供的实体、实体或数据源。
      //如果数据源仍在加载过程中或可视化仍在加载中,则此方法在执行缩放之前等待数据准备好。
      //偏移量是本地东西北上参考系中的航向/俯仰/范围,以边界球的中心为中心。
      //航向角和俯仰角在当地东西北上参考系中定义。航向是从 y 轴到 x 轴增加的角度。俯仰是从 xy 平面的旋转。
//正俯仰角在平面上方。
      //负俯仰角位于平面下方。范围是到中心的距离。如果范围为零,则将计算范围以使整个边界球体可见。
      //在 2D 中,必须有自上而下的视图。摄像机将放置在目标上方向下看。目标上方的高度将是范围。
/ /航向将根据偏移量确定。如果无法根据偏移量确定航向,则航向将为北。

案例(一) Z-Indexing Geometry的更多相关文章

  1. Calculating Stereo Pairs

    Calculating Stereo Pairs Written by Paul BourkeJuly 1999 Introduction The following discusses comput ...

  2. 使用three.js创建3D机房模型-分享一

    序:前段时间公司一次研讨会上,一市场部同事展现了同行业其他公司的3D机房,我司领导觉得这个可以研究研究,为了节约成本,我们在网上大量检索,最后找到一位前辈的博文[TWaver的技术博客],在那篇博文的 ...

  3. WPF MultiDataTrigger

    huhu <Style x:Key="Cell" TargetType="{x:Type Button}"> <Setter Property ...

  4. OGR SQL (GEOM)

    The OGRDataSource supports executing commands against a datasource via the OGRDataSource::ExecuteSQL ...

  5. WebGL three.js学习笔记 自定义顶点建立几何体

    自定义顶点建立几何体与克隆 Three.js本身已经有很多的网格模型,基本已经够我们的使用,但是如果我们还是想自己根据顶点坐标来建立几何模型的话,Three.js也是可以的. 基本效果如图: 点击查看 ...

  6. path-control demo js

    THREE.Spline = function(a) { function b(a, b, c, d, e, f, g) { a = 0.5 * (c - a); d = 0.5 * (d - b); ...

  7. 使用webgl(three.js)搭建一个3D智慧园区、3D建筑,3D消防模拟,web版3D,bim管理系统——第四课

    序:这段时间忙于奔波,好久没有更新了,今天更新一下,继续上节课的完善讲解,算是对前段时间的一个总结吧.披星戴月的时光也算有点应用效果了. 对于webgl(three.js)性能这一块我在上节课< ...

  8. 使用webgl(three.js)创建3D机房(升级版)-普通机房

    序: 目前市面上的数据中心主要分两大类,一类属于普通数据中心,机柜按照XY轴 有序排放,一类属于微模块集合的数据中心,多个机柜组合而成的微模块.  本节课主要详细讲解普通数据中心的可视化展示,浏览器直 ...

  9. 初探three.js几何体

    今天说说three.js的几何体,常见的几何体今天就不说了,今天说一说如何画直线,圆弧线,以及高级几何体. 1. 画一条直线 画直线我们使用THREE.Geometry()对象. //给空白几何体添加 ...

  10. 云端js动态效果

    效果图: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 ...

随机推荐

  1. chatGpt启示

    在应用软件领域实现自动化编程,我现在确实不怀疑了,只是还要等几年的问题.所以我的建议是:如果还想撸代码,可以往基础软件方向走,或者直接去大公司做 AI 工具:不想搞软件了,就去多了解业务吧.早做准备早 ...

  2. js之对象处理

    数据拼接一: 原始数据为对象 { 0grade: "" 0home: "萍钢四切(边部钩痕)" 0price: "3200" 0produc ...

  3. nvm在windows下安装与使用

    1.卸载本地已经安装的所有node 2.nvm下载 下载地址https://github.com/coreybutler/nvm-windows ,选择nvm-noinstall.zip 放在本地盘, ...

  4. C++ 函数与数组

    C++ 函数与数组 #include<iostream> using namespace std; const int ArSize = 8; int sum_arr(int arr[], ...

  5. 获取客户端ip,请求头伪造ip,解决办法

    可以在请求头加入 X-Forwarder-For 来伪造访问的ip地址 //Nginx支持X-Forwarded-For 配置 proxy_set_header X-Forwarded-For $pr ...

  6. spring管理配置文件实现注入

    创建配置文件 写入以下内容: 创建配置文件的bean: <bean id="configProperties" class="org.springframework ...

  7. egret tween 屏幕震动动画 ts

    let orig = { x: this.x, y: this.y }; var dir = 1; var tox = 0; var toy = 0; var count = 40; // if (n ...

  8. SpringBoot为什么是默认单例的:

    好处: 1)提升性能,减少了新生成实例的消耗 新生成实例消耗包括两方面,第一,spring会通过反射或者cglib来生成bean实例, 其次,给对象分配内存也会涉及复杂算法,这些都是消耗性能的操作. ...

  9. Linux系列(8)-添加用户并设置密码

    #添加用户[root@iZm5ehnt0e8indgne1hibuZ ~]# useradd -m linsiyu #设置用户密码[root@iZm5ehnt0e8indgne1hibuZ ~]# p ...

  10. C Ⅸ

    数组例子:统计个数  #include <stdio.h> ​ int main(void) {     int x;     int count[10];     int i;      ...