林草湿地址、导出echart为word

2.导出

复制代码
 // 导出
    exportDoc () {
      this.loading = true
      let arrRefs = [this.$refs.endChart, this.$refs.processChart, this.$refs.officeEndChart]
      setTimeout(() => {
        Promise.all(arrRefs.map((canvasDom) => {
          return this.html2canvasHandle(canvasDom)
        })).then(res => {
          let arr = res.map(canvas => {
            return canvas.toDataURL('image/png')
          })
          axios.post('/bj_rwgl/business/api/leader/exportStat',
            {
              unitId: this.roleId == 500 || this.roleId == 600 ? "" : this.groupId,
              startTime: Array.isArray(this.form.date) ? this.form.date[0] : '',
              endTime: Array.isArray(this.form.date) ? this.form.date[1] : '',
              name: '',// this.activeName,
              "endChart": arr[0], // 批示办结统计图片
              "processChart": arr[1], // 在办任务进展情况图片
              "officeEndChart": arr[2] // 处室办结情况统计图片
            },
            {
              responseType: "blob",
            }
          ).then(res => {
            if (res.data) {
              let blob = new Blob([res.data], {
                type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
              });
              let downloadElement = document.createElement("a");
              let href = window.URL.createObjectURL(blob); // 创建下载的链接
              downloadElement.href = href;
              downloadElement.download = "统计数据.docx"; // 下载后文件名
              // document.body.appendChild(downloadElement);
              downloadElement.click(); // 点击下载
              // document.body.removeChild(downloadElement); // 下载完成移除元素
              window.URL.revokeObjectURL(href); // 释放掉blob对象
              this.loading = false
              return this.$message.success('导出成功')
            } else {
              this.loading = false
              return this.$message.error('导出失败')
            }
          }).catch(err => {
            this.loading = false
            return this.$message.error('导出失败')
          })
        })
      }, 100);
    }

3.地形夸张

  • 第一种方式:viewer.scene.globe.terrainExaggeration = 2

  • 第二种方式:viewer初始化时设置

    new Cesium.Viewer('container', function () {
    terrainExaggeration: 2
    })

    javascript
    // 创建Cesium Viewer实例
    const viewer = new Cesium.Viewer('cesiumContainer');

    // 设置地形提供者
    viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
    url : Cesium.IonResource.fromAssetId(1) // 替换为您的地形资源
    });

    // 创建并设置地形夸张系数
    const exaggeration = new Cesium.TerrainExaggeration({
    exaggeration : 2.0 // 设置夸张系数为2.0
    });

    // 将夸张系数应用到地形提供者
    viewer.scene.terrainExaggeration = exaggeration.exaggeration;

4.查询entity

复制代码
queryEntityById(id) {
      const entity = this.viewer.entities.getById(id);
      if (entity) {
        console.log(`Found Entity by ID: ${entity.name}`);
      } else {
        console.log(`Entity with ID '${id}' not found.`);
      }
    },
    queryEntityByName(name) {
      const entities = this.viewer.entities.values;
      const foundEntity = entities.find(entity => entity.name === name);
      if (foundEntity) {
        console.log(`Found Entity by Name: ${foundEntity.id}`);
      } else {
        console.log(`Entity with name '${name}' not found.`);
      }
    }

4.cesium切片缓存

法一:

复制代码
// const script1 = document.createElement('script');
      // script1.src = './data/CesiumNetworkPlug.min.js';
      // script1.onload = () => {
      //   // 这里可以放置 CesiumNetworkPlug 脚本加载后的代码
      //   let OfflineCache = window.CesiumNetworkPlug.OfflineCacheController;
      //   OfflineCache.ruleList.add("*");
      // };
      // document.head.appendChild(script1);

法二:

5.地图加载完成监听 e==0

tileLoadProgressEvent 是一个事件,它会在地形或影像瓦片加载过程中被触发。

复制代码
let helper = new Cesium.EventHelper();
helper.add(Cesium3DViewer.scene.globe.tileLoadProgressEvent, function (e) {
  // console.log('每次加载地图服务矢量切片都会进入这个回调', e);
  if (e==0) {
    helper.removeAll();
   // console.log("矢量切片加载完成");
  }
});

6.地形出现底图缝隙-换成火星地形试试

复制代码
let terrainProvider = new Cesium.CesiumTerrainProvider({
        url: "http://data.mars3d.cn/terrain",//"/bj_jsc/dzsp/dem",
        requestWaterMask: true
      });
相关推荐
随心点儿7 分钟前
使用python 将多个docx文件合并为一个word
开发语言·python·多个word合并为一个
不学无术の码农10 分钟前
《Effective Python》第十三章 测试与调试——使用 Mock 测试具有复杂依赖的代码
开发语言·python
tomcsdn3116 分钟前
SMTPman,smtp的端口号是多少全面解析配置
服务器·开发语言·php·smtp·邮件营销·域名邮箱·邮件服务器
试行20 分钟前
C#System.Runtime.InteropServices.ExternalException (0x80004005): GDI+ 中发生一般性错误。
c#
EnigmaCoder20 分钟前
Java多线程:核心技术与实战指南
java·开发语言
大白的编程日记.2 小时前
【计算机基础理论知识】C++篇(二)
开发语言·c++·学习
网小鱼的学习笔记2 小时前
python中MongoDB操作实践:查询文档、批量插入文档、更新文档、删除文档
开发语言·python·mongodb
Q_Q5110082852 小时前
python的保险业务管理与数据分析系统
开发语言·spring boot·python·django·flask·node.js·php
亮1112 小时前
Maven 编译过程中发生了 Java Heap Space 内存溢出(OutOfMemoryError)
java·开发语言·maven
Chef_Chen2 小时前
从0开始学习R语言--Day40--Kruskal-Wallis检验
开发语言·学习·r语言