When we add a label to Polygon with extrudedHeight set, the label’s style will be affected.
Here’s my code
var viewer = new Cesium.Viewer("cesiumContainer");
var redPolygon = viewer.entities.add({
name: "Red polygon on surface",
polygon: {
hierarchy: Cesium.Cartesian3.fromDegreesArray([-115.0,37.0,-115.0,32.0,-107.0,33.0,-102.0,31.0,-102.0,35.0, ]),
material: new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString('#1b2876').withAlpha(0.6)),
},
});
var polyPositions = redPolygon.polygon.hierarchy.getValue(Cesium.JulianDate.now()).positions;
var polyCenter = Cesium.BoundingSphere.fromPoints(polyPositions).center;//中心点
polyCenter = Cesium.Ellipsoid.WGS84.scaleToGeodeticSurface(polyCenter);
redPolygon.position = polyCenter;
redPolygon.polygon.extrudedHeight = new Cesium.ConstantProperty(10000.0);
redPolygon.label={
// position:
text:'Red polygon on surface',
color : Cesium.Color.fromCssColorString('#fff'),
font:'normal 32px MicroSoft YaHei',
scale : 0.5,
horizontalOrigin : Cesium.HorizontalOrigin.LEFT_CLICK,
heightReference:Cesium.HeightReference.RELATIVE_TO_GROUND,
verticalOrigin : Cesium.VerticalOrigin.BASELINE,
disableDepthTestDistance : 10000.0,
//distanceDisplayCondition:new Cesium.DistanceDisplayCondition(10.0, 20000.0)
};
viewer.zoomTo(viewer.entities);
This is the effect
The text should be white, but it is affected by polygon’s texture