cesium加载geojson数据实现线面加载

   smcPromise = Cesium.GeoJsonDataSource.load(boundarydata,
              {
                id: 'provinceBoundary',
                clampToGround : true,
                stroke:Cesium.Color.fromCssColorString('#10dbd4').withAlpha(0.8),
                fill: Cesium.Color.fromCssColorString('#10dbd4').withAlpha(0.8),
                strokeWidth: 8
              }
          );
          smcPromise.then(function (dataSource) {
            viewer.dataSources.add(dataSource);
            vectorBoundary.provinceBoundary = dataSource;
            if (currentLevel === 'province') {
              that.addHiddenTroubleAreaAmountData();
            }
            // let entities = dataSource.entities.values;
            // for (let j = 0; j < entities.length; j++) {
            //   let entity = entities[j];
            //   let color = Cesium.Color.fromRandom({alpha: 0.5});
            //   // entity.polygon.material = Cesium.Color.BLUE.withAlpha(0.5);
            //   entity.polygon.material = color;
            //   // entity.polygon.material = new Cesium.Color(16, 219, 212, 0.3);
            //   let lineColor = Cesium.Color.fromCssColorString('#10dbd4');
            //   let lineWidth = 2;
            //   entity.polygon.outlineWidth = lineWidth;
            //   entity.polygon.fill = false;
            //   entity.polygon.outline = false;
            //   entity.polygon.outlineColor = lineColor;
            //   // entity.polygon.closeTop = false;
            //   entity.polygon.extrudedHeight = 5000;
            //   entity.polyline = {
            //     positions: entity.polygon.hierarchy._value.positions,
            //     width: entity.polygon.outlineWidth,
            //     material: lineColor,
            //     clampToGround: true
            //   }
            // }
          })

你可能感兴趣的:(cesium,css3,前端,css)