hongfaqiu / cesium-extends

CesiumJS 的扩展库,提供事件订阅、大数据geojson加载、geojson样式、tooltip、popup、缩放控制、绘图工具、测量工具、双屏联动、指南针、热力图等功能
https://extends.opendde.com/
MIT License
217 stars 50 forks source link

AreaSurfaceMeasure绘制报错 #2

Closed jak983464779 closed 1 year ago

jak983464779 commented 1 year ago

const areaSurfaceMeasure = new AreaSurfaceMeasure(this.viewer, { units: "kilometers", labelStyle: { font: "14px sans-serif", fillColor: Color.YELLOW, outlineWidth: 2, style: LabelStyle.FILL_AND_OUTLINE, pixelOffset: new Cartesian2(0, -30), heightReference: HeightReference.CLAMP_TO_GROUND, }, }); areaSurfaceMeasure.start(); 报错信息为Height reference is not supported without a scene and globe. 去掉heightReference 就不会报错了

hongfaqiu commented 1 year ago

@cesium-extends/measure@1.0.3已经修复了呀,你有更新吗

jak983464779 commented 1 year ago

好的,感谢!!!测量面积和距离的label可以搞成自定义的吗?现在默认都是英文

hongfaqiu commented 1 year ago

我改改

hongfaqiu commented 1 year ago

@cesium-extends/measure@1.1.0 已添加locale配置,在线文档中默认是中文的了,参考配置:

new Tool(viewer, {
  units: 'kilometers',
  locale: {
    start: '起点',
    area: '面积',
    total: '总计',
    formatLength: (length, unitedLength) => {
      if (length < 1000) {
        return length + '米';
      }
      return unitedLength + '千米';
    },
    formatArea: (area, unitedArea) => {
      if (area < 1000000) {
        return area + '平方米';
      }
      return unitedArea + '平方千米';
    }
  },
  drawerOptions: {
    tips: {
      init: '点击绘制',
      start: '左键添加点,右键移除点,双击结束绘制',
    }
  }
});
jak983464779 commented 1 year ago

npm install @cesium-extends/measure --save 1.1.0版本安装不上,安装都一直是1.0.3

hongfaqiu commented 1 year ago

运行下面的命令

npm install @cesium-extends/measure@latest --save

如果还是没有更新到最新版,请检查你的npm代理镜像

jak983464779 commented 1 year ago

taobao和npm镜像我都试过了,一直是1.0.3

hongfaqiu commented 1 year ago

npm上确实已经更新了,运行一下下面这条命令指定版本试试

npm install @cesium-extends/measure@1.1.0--save
jak983464779 commented 1 year ago

image

只有这几个版本

jak983464779 commented 1 year ago

image 上面是用yarn安装的,下面这个是用的npm

hongfaqiu commented 1 year ago

很奇怪,1.1.0是一小时前发布的,应该早就已经同步了才是,检查你项目中有没有.npmrc文件配置了局部代理 image

hongfaqiu commented 1 year ago

我更新一下,似乎依赖错了

jak983464779 commented 1 year ago

没有做项目局部代理的

hongfaqiu commented 1 year ago

应该可以了,你再试试,之前CI少发了一个包@cesium-extends/common@1.0.1,手动补上就好了,抱歉

jak983464779 commented 1 year ago

可以了,大佬太给了,期待你的新插件