Javascript 铯原子中实体多边形和基元多边形的区别
最近我尝试在铯沙堡中创建一个红色多边形。一般来说,绘制多边形有三种方法:从czml文件、从实体和从基本体。然而,来自实体的多边形和来自基本体的多边形是不同的。当我从不同方向观察它们时,基本体中多边形的透明度会改变,而实体中多边形的透明度不会改变。这让我很困惑。我的代码如下:Javascript 铯原子中实体多边形和基元多边形的区别,javascript,polygon,cesium,Javascript,Polygon,Cesium,最近我尝试在铯沙堡中创建一个红色多边形。一般来说,绘制多边形有三种方法:从czml文件、从实体和从基本体。然而,来自实体的多边形和来自基本体的多边形是不同的。当我从不同方向观察它们时,基本体中多边形的透明度会改变,而实体中多边形的透明度不会改变。这让我很困惑。我的代码如下: //create a cyan polygon from entity var cyanPolygon = viewer.entities.add({ name: "cyanPolygon", p
//create a cyan polygon from entity
var cyanPolygon = viewer.entities.add({
name: "cyanPolygon",
polygon: {
hierarchy: Cesium.Cartesian3.fromDegreesArrayHeights([
-72.0, 30.0, 100000,
-64.0, 25.0, 100000,
-72.0, 20.0, 100000
]),
perPositionHeight: true,
material: Cesium.Color.RED.withAlpha(0.3)
},
});
//create a cyan polygon from primitive
var Points = viewer.scene.primitives.add(new Cesium.PrimitiveCollection());
Points.add(new Cesium.Primitive({
geometryInstances: new Cesium.GeometryInstance({
geometry: new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArrayHeights([
-72.0, 40.0, 100000,
-64.0, 35.0, 100000,
-72.0, 30.0, 100000
])
),
perPositionHeight: true,
closeTop:false
}),
id: 'Polygon',
attributes: {
color: new Cesium.ColorGeometryInstanceAttribute(1, 0, 0, 0.3)
}
}),
appearance: new Cesium.PerInstanceColorAppearance({
closed: true
})
}));```
[enter image description here][1]
[enter image description here][2]
[1]: https://i.stack.imgur.com/IeUl6.jpg
[2]: https://i.stack.imgur.com/UofnN.jpg