cesium 设置polygon.outlineWidth 不起作用

outlineWidth不起作用是因为你没有设置对应面高度,可是设置高度之后贴地就没了。只能在添加entity的时候设置单独设置polyline

 //加载面数据测试
      var geojson = {
          "type": "FeatureCollection",
          "features": [
            {
              "type": "Feature",
              "properties": {},
              "geometry": {
                "type": "Polygon",
                "coordinates": [
                  [
                    [
                      93.6474609375,
                      37.10776507118514
                    ],
                    [
                      93.01025390625,
                      35.17380831799959
                    ],
                    [
                      95.11962890625,
                      33.54139466898275
                    ],
                    [
                      97.53662109375,
                      33.54139466898275
                    ],
                    [
                      99.25048828124999,
                      33.96158628979907
                    ],
                    [
                      99.97558593749999,
                      35.191766965947394
                    ],
                    [
                      99.84374999999999,
                      36.38591277287651
                    ],
                    [
                      98.85498046875,
                      37.45741810262938
                    ],
                    [
                      97.18505859374999,
                      37.90953361677018
                    ],
                    [
                      95.16357421875,
                      37.82280243352756
                    ],
                    [
                      93.6474609375,
                      37.10776507118514
                    ]
                  ]
                ]
              }
            }
          ]
        }
      var promise = Cesium.GeoJsonDataSource.load(geojson,
        {
          camera : viewer.scene.camera,
          canvas : viewer.scene.canvas,
          clampToGround: true//开启贴地
        }
      );
      promise.then(function (dataSource) {
        //Get the array of entities
        var entities = dataSource.entities.values;
        entities.forEach((entitie) => {
          //必须要设置高度边线才有用,可是设置了高度之后贴地就没了
          //entitie.polygon.height = 50;
          entitie.polygon.outline = true;
          entitie.polygon.outlineColor = Cesium.Color.AQUA;
          entitie.polygon.outlineWidth = 50;
          entitie.polygon.closeTop = false;
          //单独设置线条样式
          var positions = entitie.polygon.hierarchy._value.positions;
          entitie.polyline = {
            positions: positions,
            width: 10,
            material: Cesium.Color.BLACK.withAlpha(1),
            clampToGround: true
          }
          viewer.entities.add(entitie);
        })
      })

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值