An error has occurred by process() loading CZML file

1. A concise explanation of the problem you’re experiencing.

i want to load CZML file without clear THE data,which last time has loaded.

so i used the function process() by midifying the demo https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=CZML.html&label=DataSources

like this:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var czmldatasource = new Cesium.CzmlDataSource();

viewer.camera.flyHome(0);

viewer.dataSources.add(czmldatasource.process(’…/…/SampleData/Vehicle.czml’));

viewer.dataSources.add(czmldatasource.process(’…/…/SampleData/simple.czml’));

viewer.scene.camera.setView({

destination: Cesium.Cartesian3.fromDegrees(-116.52, 35.02, 95000),

orientation: {

heading: 6

}

});

but, an error has occurred:

An error occurred while rendering. Rendering has stopped.
undefined
DeveloperError: This object was destroyed, i.e., destroy() was called.
Error
at new DeveloperError (http://localhost:8080/Source/Core/DeveloperError.js:43:19)
at VertexArray.throwOnDestroyed (http://localhost:8080/Source/Core/destroyObject.js:45:19)
at continueDraw (http://localhost:8080/Source/Renderer/Context.js:918:12)
at Context.draw (http://localhost:8080/Source/Renderer/Context.js:957:9)
at DrawCommand.execute (http://localhost:8080/Source/Renderer/DrawCommand.js:502:17)
at executeCommand (http://localhost:8080/Source/Scene/Scene.js:1651:21)
at executeTranslucentCommandsSortedMultipass (http://localhost:8080/Source/Scene/OIT.js:558:13)
at OIT.executeCommands (http://localhost:8080/Source/Scene/OIT.js:600:9)
at scene._executeOITFunction (http://localhost:8080/Source/Scene/Scene.js:1848:32)
at executeCommands (http://localhost:8080/Source/Scene/Scene.js:1961:13)

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

i want to keep the loaded data last time when i load new czml file.

4. The Cesium version you’re using, your operating system and browser.

cesium 1.42. windows7, chrome

Thanks!

Hi there,

If you create a new CzmlDataSource object for each time you want to load new data, a new collection of entities will be created, leaving the old ones. So if you comment out the removeAll line in the original example, it keeps the previous dataSource after loading in the new one. (see modified example)

Thanks,

Gabby

it works well.Thanks

在 2018年2月20日星期二 UTC+8上午4:41:00,Gabby Getz写道: