Cesium 三维模型在线调整工具

20 篇文章 0 订阅
18 篇文章 6 订阅

古有卖炭翁,伐薪烧炭南山中。
今有读书郎,辛勤牧鸭北山坡。
皆为生计所迫耳!

http://123.56.67.147/ts-sdk-platform/

<script>
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {
      tileset: null,
      url: "http://localhost:8888/cesiumdemo/data/teapot/tileset.json",
      form: {
        lon: 0,
        lat: 0,
        height: 0,
        scaleX: 1,
        scaleY: 1,
        scaleZ: 1,
        heading: 0,
        pitch: 0,
        roll: 0
      },
      preForm:{},
      originForm: {},
      tilesetJson: {}
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    init() {
      this.$nextTick(() => {
        this.loaddata();
        this.loadJson();
      });
    },
    loadJson() {
      Cesium.Resource.fetchJson({
        url: this.url
      }).then(jsonData => {
        this.tilesetJson = jsonData;
      });
    },
    ok() {
     
    },
    reset() {
      this.form = Cesium.clone(this.originForm, true);
      this.ok();
      // this.dingwei();
    },
    dingwei() {
      if (this.check()) {
        this.t.flyTo();
      }
    },
    check() {
      if (!this.t) {
        alert("请先加载模型再执行这个操作!");
        return false;
      }
      return true;
    },
    downJson() {
      let newTilesetRootTransformArray = Cesium.Matrix4.pack(
        this.tileset.root.transform,
        []
      ); //矩阵转数组
      this.tilesetJson.root.transform = newTilesetRootTransformArray;
      let content = JSON.stringify(this.tilesetJson);
      this.downLoadText(content);
    },
  },
  //生命周期 - 创建完成(可以访问当前this实例)
  created() {},
  //生命周期 - 挂载完成(可以访问DOM元素)
  mounted() {
    this.init();
  },
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
};
</script>
<style scoped>
.leftpanel {
  position: absolute;
  left: 10px;
  top: 70px;
  width: 500px;
  margin-bottom: 50px;
  background-color: #e6ebee;
  overflow-y: auto;
  max-height: calc(100% - 120px);
}

.box-card {
  margin: 5px;
  margin-bottom: 0;
}

.el-from {
  background-color: #e6ebee;
}

.leftpanel >>> .el-card__body,
.el-main {
  padding: 10px;
}

span {
  display: inline-block;
  margin-left: 5px;
  margin-top: 10px;
  font-size: 18px;
}

.bottom {
  margin: 0 auto;
  text-align: right;
  margin: 10px;
}

.el-form-item {
  margin-bottom: 0;
}

.main >>> .el-card__body {
  padding: 10px;
}
</style>

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

苹果园dog

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值