当前位置:网站首页>Cesium快速上手4-Polylines图元使用讲解

Cesium快速上手4-Polylines图元使用讲解

2022-08-10 14:59:00 在人间负债^

1. Polyline & Cesium.PolylineCollection

http://localhost:8080/Apps/Sandcastle/index.html?src=development%2FPolylines.html&label=Development
在这里插入图片描述

  // A simple polyline with two points.
  const polyline = polylines.add({
    
    positions: Cesium.PolylinePipeline.generateCartesianArc({
    
      positions: Cesium.Cartesian3.fromDegreesArray([
        -120.0,
        40.0,
        -110.0,
        30.0,
      ]),
    }),
    material: Cesium.Material.fromType("Color", {
    
      color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),
    }),
  });

2. PolylineGeometry

http://localhost:8080/Apps/Sandcastle/gallery/development%2FPolyline.html
在这里插入图片描述

3. SimplePolylineGeometry

http://localhost:8080/Apps/Sandcastle/index.html?src=development%2FSimple%20Polyline.html&label=Development
在这里插入图片描述
特点:SimplePolylineGeometry没有width属性

4. GroundPolylineGeometry

http://localhost:8080/Apps/Sandcastle/gallery/development%2FGround%20Polyline%20Material.html
在这里插入图片描述
http://localhost:8080/Apps/Sandcastle/gallery/development%2FPolylines%20On%20Terrain.html
在这里插入图片描述
注意:必须用GroundPolylinePrimitive来创建,而不能用GroundPrimitive创建

5. 综合比较

PolylineCollection可以同时渲染多条折线,性能较高;其他类型都是单独渲染某个折线的,会导致多了的话,渲染性能受影响。

原网站

版权声明
本文为[在人间负债^]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_52354698/article/details/126261022