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

Adding new entity may break entity.show #2686

Closed
mramato opened this issue May 5, 2015 · 0 comments · Fixed by #2756
Closed

Adding new entity may break entity.show #2686

mramato opened this issue May 5, 2015 · 0 comments · Fixed by #2756

Comments

@mramato
Copy link
Contributor

mramato commented May 5, 2015

Add reported on the forum, hiding all entities and then adding a new one can cause some entities to reappear. Here's a Sandcastle example that shows the problem (hit Hide and then Add Entity).

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

var greenPolygon = viewer.entities.add({
    name : 'Green extruded polygon',
    polygon : {
        hierarchy : Cesium.Cartesian3.fromDegreesArray([-108.0, 42.0,
                                                        -100.0, 42.0,
                                                        -104.0, 40.0]),
        extrudedHeight: 500000.0,
        material : Cesium.Color.GREEN
    }
});

var bluePolygon = viewer.entities.add({
    name : 'Blue polygon with holes and outline',
    polygon : {
        hierarchy : {
            positions : Cesium.Cartesian3.fromDegreesArray([-99.0, 30.0,
                                                            -85.0, 30.0,
                                                            -85.0, 40.0,
                                                            -99.0, 40.0]),
            holes : [{
                positions : Cesium.Cartesian3.fromDegreesArray([
                    -97.0, 31.0,
                    -97.0, 39.0,
                    -87.0, 39.0,
                    -87.0, 31.0
                ]),
                holes : [{
                    positions : Cesium.Cartesian3.fromDegreesArray([
                        -95.0, 33.0,
                        -89.0, 33.0,
                        -89.0, 37.0,
                        -95.0, 37.0
                    ]),
                    holes : [{
                        positions : Cesium.Cartesian3.fromDegreesArray([
                            -93.0, 34.0,
                            -91.0, 34.0,
                            -91.0, 36.0,
                            -93.0, 36.0
                        ])
                    }]
                }]
            }]
        },
        material : Cesium.Color.BLUE,
        outline : true,
        outlineColor : Cesium.Color.BLACK
    }
});

Sandcastle.addToolbarButton('Hide', function(){
    viewer.entities.values.forEach(function (entity) {
        entity.show = false;
    });

});

Sandcastle.addToolbarButton('Add entity', function(){
    viewer.entities.add({
        name : 'AADA',
    position : Cesium.Cartesian3.fromDegrees(-65.59777, 35.03883),

    polygon : {
        hierarchy : Cesium.Cartesian3.fromDegreesArray([-115.0, 40.0,
                                                        -125.0, 35.0]),
        material : Cesium.Color.RED
    }
    });
});

viewer.zoomTo(viewer.entities);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant