2021-04-12

作者: 阿群1986 | 来源:发表于2021-04-12 08:56 被阅读0次
  • Cesium3DTileset:用于流式传输大量的异构3D地理空间数据集;

  • Cesium3DTileStyle:瓦片集样式;

  • Cesium3DTile:数据集中的一个瓦片;

  • Cesium3DTileContent:瓦片内容;

  • Cesium3DTileFeature:瓦片集要素,用于访问Tile中批量表中的属性数据,可通过scene.pick方法来获取一个 BATCH,即三维要素。

    • Cesium3DTileFeature.getPropertyNames() 方法获取批量表中所有属性名;

    • Cesium3DTileFeature.getProperty(string Name) 来获取对应属性名的属性值。

例1. 加载3DTiles

   var viewer = new Cesium.Viewer("cesiumContainer");
   // 添加3D Tiles
   var tileset = viewer.scene.primitives.add(
     new Cesium.Cesium3DTileset({
       url: "./data/Cesium3DTiles/Tilesets/Tileset/tileset.json",
       // maximumScreenSpaceError: 2, //最大的屏幕空间误差
       // maximumNumberOfLoadedTiles: 1000, //最大加载瓦片个数
     })
   );

例2.

//设置样式

       var properties = tileset.properties;
       if (Cesium.defined(properties) && Cesium.defined(properties.Height)) {
         tileset.style = new Cesium.Cesium3DTileStyle({
           color: {
             conditions: [
               ["${Height} >= 83", "color('purple', 0.5)"],
               ["${Height} >= 80", "color('red')"],
               ["${Height} >= 70", "color('orange')"],
               ["${Height} >= 12", "color('yellow')"],
               ["${Height} >= 7", "color('lime')"],
               ["${Height} >= 1", "color('cyan')"],
               ["true", "color('blue')"],
             ],
           },
         });
       }

//位置调整  

       var cartographic = Cesium.Cartographic.fromCartesian(
         tileset.boundingSphere.center
       );
       var surface = Cesium.Cartesian3.fromRadians(
         cartographic.longitude,
         cartographic.latitude,
         0.0
       );
       var offset = Cesium.Cartesian3.fromRadians(
         cartographic.longitude,
         cartographic.latitude,
         height
       );
       var translation = Cesium.Cartesian3.subtract(
         offset,
         surface,
         new Cesium.Cartesian3()
       );
       tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
     })
     .otherwise(function (error) {
       console.log(error);
     });

//拾取要素

    var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
    handler.setInputAction(function (movement) {
      var feature = viewer.scene.pick(movement.position);
      if (Cesium.defined(feature) && feature instanceof Cesium.Cesium3DTileFeature) {
        var propertyNames = feature.getPropertyNames();
        var length = propertyNames.length;
        for (var i = 0; i < length; ++i) {
          var propertyName = propertyNames[i];
          console.log(propertyName + ": " + feature.getProperty(propertyName));
        }
      }
    }, Cesium.ScreenSpaceEventType.LEFT_CLICK);

相关文章

  • 猴子可以用意念玩游戏了

    This Monkey Is Playing Pong With Its Mind 2021-04-12 346词...

  • 卢浮宫开通线上浏览

    Louvre Puts Entire Collection Online 2021-04-12 382词 六级/考...

  • 青花瓷

    青花瓷 (美国洛杉矶《中国日报》2021-04-12日发表,副刊C5版 ) 一尘 / 2021-03-17 一九九...

  • 给予自己

    我怎么如此幸运-99将帅挑战赛36-重生219-戴红霞(2021-04-12) 我怎么如此幸运-给予自己 1.我怎...

  • 漫步在江南的春天里

    杭州。苏州。南京。 2021-04-12 三十岁时我很恐慌,担心我的人生过半时,依然碌碌无为。 之后我开始走出自己...

  • 班主任日记2

    2021-04-12 星期一 又是一个星期的开始。 班上的问题层出不穷。 去体检一个上午,下午午读课还未...

  • 2021-04-12

    接着昨天的话题继续。 怎么感觉周末的时光分外的快,感觉还没有开始就匆匆划过。这两天的时间几乎都是在球馆...

  • 2021-04-12

    善良的心 房子买在湖心岛上,看来是买对了。 春天里,只要我一回到家,便立刻跑到湖边去看花。 春天最泛滥的就是花,遍...

  • 2021-04-12

    这是一个值得纪念的日子。 去年的这一天我头披红纱,与韩先生携手走进婚姻的殿堂。一切都是这麽的顺理成章,水到渠成。 ...

  • 2021-04-12

    昨天的日更不知道为什么没有发出来,其实已经不重要了。 今天早上上了两节大课,感觉还不错不知道会员怎么样。第二节课有...

网友评论

    本文标题:2021-04-12

    本文链接:https://www.haomeiwen.com/subject/ehptlltx.html