cesium沿着路线飞行&_createEntity


(1)cesium加载轨迹数据json文件

(2)飞机沿着路线飞行,视角也跟着移动

参考1:https://blog.csdn.net/A873054267/article/details/86231494(cesium轨迹回放,按路径飞行)

飞机在动。。但是视角没有跟着动。(第一视角)

value: function _createEntity() {
      var _this2 = this;

      var entityAttr = {
        name: this.name,
        position: new Cesium.CallbackProperty(function (time) {
          return _this2.position;
        }, false),
        orientation: this.velocityOrientation,
        point: {
          //必须有对象,否则viewer.trackedEntity无法跟随(无model时使用)
          show: !(this.options.model && this.options.model.show),
          color: Cesium.Color.fromCssColorString("#ffffff").withAlpha(0.01),
          pixelSize: 1
          // show: false
        } };

      if (this.options.label && this.options.label.show) {
        this.options.label.text = this.options.label.text || this.name;
        entityAttr.label = drawAttr.label.style2Entity(this.options.label, null, this);
      }
      if (this.options.billboard && this.options.billboard.show) {
        entityAttr.billboard = drawAttr.billboard.style2Entity(this.options.billboard);
      }
      if (this.options.point && this.options.point.show) {
        entityAttr.point = drawAttr.point.style2Entity(this.options.point);
      }
      if (this.options.model && this.options.model.show) {
        entityAttr.model = drawAttr.model.style2Entity(this.options.model);
      }
      if (this.options.path && this.options.path.show) {
        var pathAttr = drawAttr.polyline.style2Entity(this.options.path);
        if (!pathAttr.isAll) {
          pathAttr.leadTime = 0; //只显示飞过的路线
          pathAttr.trailTime = this.alltimes * 10;
        }
        entityAttr.path = pathAttr;
        entityAttr.position = this.property; //path时需要为直接property
      }
      if (this.options.circle && this.options.circle.show) {
        entityAttr.ellipse = drawAttr.circle.style2Entity(this.options.circle);
      }
      this.entity = this.viewer.entities.add(new Cesium.Entity(entityAttr));

      this.entity.eventTarget = this;
      if (this.popup) this.entity.popup = this.popup;
      if (this.tooltip) this.entity.tooltip = this.tooltip;
    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM