[Polylines] Problem when removing multiple polyline with material properties

Hi !

I’m having an issue, detailed here:

https://stackoverflow.com/questions/41381988/how-to-correctly-remove-a-cesium-polyline

This is not my post, but i have the same issue.

**When i try to remove multiple polylines (actually, entities containing polyline and wall) within a for loop, some polyline doesn’t remove. **

Some of the polylines are still displayed, but NOT the wall.

The problem occurs only when the polyline material is dash or outline material.

If i use only Cesium.COLOR it works fine !

I use Cesium 1.37, chrome lastest version.

I’ll try Cesium 1.38 to see if the bug is still here, and update you.

Thanks for looking a this !

Love you work !

Hi Benjamin,

I was able to duplicate this bug in the Polylines Sandcastle example by adding the following loop to remove the polylines:

Sandcastle.addToolbarButton(‘Remove polylines’, function() {

for (var i = 0; i < viewer.entities.values.length; ++i) {

    viewer.entities.remove(viewer.entities.values[i]);

}

});

If I hit that button, not all of the polylines are removed, but if I do it several times, they will be eventually removed.

I opened Issue #5893 to track this, please add any additional info there if you have any.

Thanks!

Gabby

Try this loop to remove them correctly:

Sandcastle.addToolbarButton('Remove polylines', function() {
    while (viewer.entities.values.length > 0) {
        viewer.entities.remove(viewer.entities.values[0]);
    }
});