Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

waiting for scene to be fully rendered in cesium

when loading kml datasource, I want to display a loading image until it can be visualized in the viewer or scene. I tried to handle:

  • viewer.dataSources.dataSourceAdded event but it is fired very early, that is to say, the loading image disappears before the datasource can be visualized
  • the issue is the same with

    viewer.dataSources.add(datasource).then(function(){ clearLoader(); } )

Please anyone can help Thanks Regards

like image 936
Valimo Ral Avatar asked May 07 '15 07:05

Valimo Ral


1 Answers

Try this instead:

viewer.dataSource.add(datasource); // add empty datasource.
datasource.load(url).then(function () { clearLoader(); });

The .add function returns immediately, even with an empty data source. But the .load function returns a promise that will resolve once the data source is loaded.

like image 88
emackey Avatar answered Nov 15 '22 23:11

emackey