-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 entity after delay causes entities to not display #2514
Comments
Thanks for the report. This is definitely a bug and related to a similar issue I cam across recently that involves updating static data in quick succession. I'll try and see if I can fix it for the next release (but I can't garuantee anything until I look more into it). (But I'm leaning towards a simple fix). In the mean time, if you know when your updates are about to start and finish, then you should call Here's a slightly modified version of your example that does this. Comment out the two calls and the problem reappears. var viewer = new Cesium.Viewer('cesiumContainer');
function line(lat,color) {
viewer.entities.add({
polyline : {
positions : Cesium.Cartesian3.fromDegreesArray([-75, lat, -125, lat]),
width : 5,
material : color
}
});
}
// zero delay: both lines show
// small delay (5 or so), none
// large delay (5000 or so), both
var delay = 5;
// a zero value: both lines are shown
if (delay === 0) {
line(30, Cesium.Color.RED);
line(37, Cesium.Color.BLUE);
viewer.zoomTo(viewer.entities);
}
// a >0 value: none, one, or both
else {
viewer.entities.suspendEvents();
window.setTimeout(function () {
line(30, Cesium.Color.RED);
viewer.entities.resumeEvents();
viewer.zoomTo(viewer.entities);
}, delay);
line(37, Cesium.Color.BLUE);
} |
Fixes #2514 (and other related issues as discussed [on the forum](https://groups.google.com/d/msg/cesium-dev/JOUCjnqeFKg/q5aAZb2faAMJ)). The problem was that when static entities were updated, we would create a primitive to batch them. However, if the entities were updated again before the primitive was ready, we didn't remove it.
@asimps thanks again for the report. The fix will be in Cesium 1.7, which will be released shortly. |
Many thanks to you guys! |
Entities do not appear if an entity is added after a short delay following viewer creation. If an entity is added after a delay of 5ms or so, it causes one or all of the other entities to not appear. With a very large delay (like 5000ms), things seem to work correctly.
In our environment, the delay happens because we make an AJAX request to the server to retrieve additional data points.
Paste the following code into sandcastle. We’re simulating our scenario by adding a delay with setTimeout to the creation of one of the polylines. We’ve been able to elicit this problem on Windows/Chrome, Mac/Chrome, and Mac/Firefox.
Vary the delay variable. The results we get are:
delay = 0 ---- both lines appear
delay = 5 (or so) --- no lines appear
delay = 5000 --- both lines appear
The text was updated successfully, but these errors were encountered: