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