尽管指定了图像,Cesium GeoJSON数据源多边形材料仍为白色

问题描述

我无法找出从material更改多边形entityGeoJsonDataSource方法。我想应用一张图片

这里是使用颜色的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,[ 10.747038310965864,48.315905422444722,550 ],[ 10.746038315853207,48.314905418639555,[ 10.746500009923748,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();

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

对于图像材料,我在本地使用此定义:

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

解决方法

我使用this在我的PolygonGraphics中定义entity'材料的方式进行了修复:

:

但是我注意到alpha blending在尝试将其应用于整个图片时不起作用...