Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon hierarchy attribute CallbackProperty bug #12474

Open
cnchore opened this issue Feb 10, 2025 · 2 comments
Open

Polygon hierarchy attribute CallbackProperty bug #12474

cnchore opened this issue Feb 10, 2025 · 2 comments

Comments

@cnchore
Copy link

cnchore commented Feb 10, 2025

What happened?

After CallbackProperty is used in the hierarchy value of polygon, two polygons will be rendered if the hightreference attribute value of Polygon is modified again.

`
const viewer = new Cesium.Viewer("cesiumContainer");

const redPolygon = viewer.entities.add({
name: "Red polygon on surface",
polygon: {
hierarchy: new Cesium.CallbackProperty(() => {
const hierarchy = new Cesium.PolygonHierarchy();
hierarchy.positions = [
Cesium.Cartesian3.fromDegrees(-115.0, 37.0, 50000),
Cesium.Cartesian3.fromDegrees(-115.0, 32.0, 50000),
Cesium.Cartesian3.fromDegrees(-107.0, 33.0, 50000),
Cesium.Cartesian3.fromDegrees(-102.0, 31.0, 50000),
Cesium.Cartesian3.fromDegrees(-102.0, 35.0, 50000),
];
hierarchy.holes = [];
return hierarchy;
}, false),
heightReference: Cesium.HeightReference.NONE,
perPositionHeight:true,
material: Cesium.Color.RED,
},
});

setTimeout(()=>{
redPolygon.polygon.material=Cesium.Color.BLUE;
redPolygon.polygon.heightReference=Cesium.HeightReference.CLAMP_TO_GROUND;
redPolygon.polygon.perPositionHeight=false;
},3000);

viewer.zoomTo(viewer.entities);
`

Image

Reproduction steps

Sandcastle example

No response

Environment

Browser:
CesiumJS Version:
Operating System:

@Fav
Copy link

Fav commented Feb 11, 2025

hierarchy: new Cesium.CallbackProperty(() => {
......
}, true),

@ggetz
Copy link
Contributor

ggetz commented Feb 11, 2025

Thanks for the report @cnchore!

The workaround @Fav suggests seems to work. But I don't think it makes sense that this is required for the behavior to work as expected. So I'll leave this issue open.

Fav added a commit to Fav/cesium that referenced this issue Feb 12, 2025
Polygon hierarchy attribute CallbackProperty bug
@Fav Fav mentioned this issue Feb 12, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants