cesium创建图标/图片

创建预警标志

    createWarnBill(uav, warnType) {
      this.$nextTick(() => {
          //避免重复加载
        const warnBillIndex = this.WarnBillList.findIndex(file => file.index === uav.warnId);
        if (warnBillIndex == -1) {
          warnIconDataSource = new Cesium.CustomDataSource('warnIconDataSource')
          this.WarnBillList.push({ dataSource: eqpDataSource, index: uav.warnId })
          window.cesiumViewer.dataSources.add(warnIconDataSource)

          warnIconDataSource.entities.add({
            position: Cesium.Cartesian3.fromDegrees(parseFloat(uav.longitude), parseFloat(uav.latitude), 1000.0),
            billboard: {
              id: `${uav.warnId}_${Math.random()}`,
              // 是否显示
              show: true,
              // 图像地址,URI或Canvas的属性
              image: `http://${window.location.host}/warn.png`,
              height: 32,
              width: 32,
              // 设置与相机的距离,在该距离处禁用深度测试
              disableDepthTestDistance: Number.POSITIVE_INFINITY,
              // 设置贴地
              heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
            },
            label: {
              font: '900 16px MicroSoft YaHei',
              backgroundColor: Cesium.Color.fromCssColorString('#30415645'),
              showBackground: true,
              text: `${warnType}\n${uav.longitude} , ${uav.latitude}`,
              horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
              verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
              pixelOffset: new Cesium.Cartesian2(20, 27),
              disableDepthTestDistance: Number.POSITIVE_INFINITY,
              heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
            },
          });
        }
        this.setMapCenter(uav)
      })
    },
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值