尽管指定了图像,但 Cesium GeoJSON 数据源多边形 material 是白色的

Cesium GeoJSON datasource polygon material is white despite an image is specified

我无法找到更改 material of a polygon entity from a GeoJsonDataSource 的方法。我想申请一张图片。

这里是 example 使用颜色的,因为我不知道如何在在线沙堡上嵌入图像:

var viewer = new Cesium.Viewer("cesiumContainer");

const poly = {
    "type": "FeatureCollection",
    "name": "MyPolygon",
    "crs": {"type": "name",
            "properties": {
                "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
    }},
    "features": [
        {"type": "Feature",
         "properties": {},
         "geometry": {
             "type": "Polygon",
             "coordinates": [
                 [[ 10.746500009923748, 48.314700009648320, 500 ],
                  [ 10.747500009924019, 48.315700009648104, 500 ],
                  [ 10.747038310965864, 48.315905422444722, 550 ],
                  [ 10.746038315853207, 48.314905418639555, 550 ],
                  [ 10.746500009923748, 48.314700009648320, 500 ]] 
]}}]};

const Promise0 = async () => {
    try {
        const dataSource = await Cesium.GeoJsonDataSource.load(poly, {
            stroke: Cesium.Color.BLUE,
            strokeWidth: 3
        });
        const Promise1 = async () => {
            try {
                const polygonalFrame = await viewer.dataSources.add(dataSource);
                viewer.zoomTo(polygonalFrame);
                const entities = polygonalFrame.entities.values;
                for (var i = 0; i < entities.length; i++) {
                    const entity = entities[i];
                    entity.polygon.material = new Cesium.Material({
                        fabric : {
                          type : 'Color',
                          uniforms : {
                            color : new Cesium.Color(1.0, 0.0, 0.4, 0.5)
                          }
                        }
                      });
                }
            }
            catch (err) {
                console.log("Error: ", err);
            }
        };
        Promise1();
    }
    catch (e) {
        console.log("Error:", e);
    }
};
Promise0();

多边形保持黄色,这是我认为的默认颜色。

对于图像material,我在本地使用这个定义:

new Cesium.Material({
    fabric : {
        type : 'Image',
        uniforms : {
            image : './image.png'
        }
    }
});

我使用 this way of defining the PolygonGraphics' material in my entity 修复了它:

new Cesium.ImageMaterialProperty({
    image: './image.png',
    alpha: 0.5
});

但我注意到 alpha blending 在我尝试将它应用到整个图像时不起作用...