我的github
     <el-row><el-col :span="9">视角模式</el-col><el-col :span="15">
        <el-select size="mini" v-model="detail.visualAngle" placeholder="请选择视角模式" @change="onChange">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-col></el-row>

 

    handleFlyRoamInputChange(detail,data){
        const { visualAngle, visualClearance, visualHeight } = detail
        let camera = {
          type: "",
          followedX: Number(visualClearance),
          followedZ: Number(visualHeight)
        }
        switch (visualAngle){
          case '':
            camera.type = ""
            camera.followedX = undefined
            camera.followedZ = undefined
            break;
          case 'zdy':
            camera.type = "zdy"
            camera.followedZ = undefined
            break;
          case 'gs':
            camera.type = "gs"
            camera.followedX = undefined
            camera.followedZ = undefined
            break;
          case 'dy':
            camera.type = "dy"
            break;
          case 'sd':
            camera.type = "sd"
            camera.followedX = undefined
            break;
        }
        window.flyLine && window.flyLine.updateStyle({camera});
      },
window.flyLine({camera})&&window.flyLine.updateStyle({camera})
key: "updateAngle",
    value: function updateAngle(isAuto, opts) {
      if (isAuto) {
        this.entity.orientation = this.velocityOrientation; //基于移动位置自动计算方位

        this._heading = null;
        this._pitch = null;
        this._roll = null;
      } else {
        opts = opts || {};

        var position = this.position; //当前点
        var _orientation = this.orientation; //获取当前角度
        if (!position || !_orientation) return null;

        var autoHpr = (0, _matrix.getHeadingPitchRollByOrientation)(position, _orientation, this.viewer.scene.globe.ellipsoid, this._fixedFrameTransform);

        //重新赋值新角度
        var heading = autoHpr.heading;
        var pitch = Cesium.Math.toRadians(Number(opts.pitch || 0.0));
        var roll = Cesium.Math.toRadians(Number(opts.roll || 0.0));

        this._heading = heading;
        this._pitch = pitch;
        this._roll = roll;

        this.entity.orientation = Cesium.Transforms.headingPitchRollQuaternion(position, new Cesium.HeadingPitchRoll(heading, pitch, roll), this.viewer.scene.globe.ellipsoid, this._fixedFrameTransform);
      }
{
    key: "updateStyle",
    value: function updateStyle(params) {
      if (!this.options) return;
      for (var i in params) {
        if (_typeof(params[i]) === "object" && this.options[i]) {
          for (var key2 in params[i]) {
            this.options[i][key2] = params[i][key2];
          }
        } else {
          this.options[i] = params[i];
        }
      }
    }

createPath

lookAtTransform:控制朝向

viewer.scene.preUpdate.addEventListener:https://www.freesion.com/article/57661009683/

 

_this._fixedFrameTransform = Cesium.defaultValue(options.fixedFrameTransform, Cesium.Transforms.eastNorthUpToFixedFrame); //参考系

posted on 2021-12-03 16:46  XiaoNiuFeiTian  阅读(131)  评论(0)    收藏  举报