1. I've instantiated a Viewer, created a CustomDataSource, and added said CustomDataSource to the Viewer's DataSourceCollection (Viewer.dataSources) and currently have no Entities added to the CustomDataSource's EntityCollection (CustomDataSource.entities).
I then add some Entities to the CustomDataSource's EntityCollection, but they do not show up in the viewer.
I can get around this by first removing the CustomDataSource from the Viewer's DataSourceCollection, adding the Entities to the CustomDataSource's EntityCollection, THEN adding the CustomDataSource back to the Viewer's DataSourceCollection.
My question is, is this standard practice? Is there a way to add Entities to a DataSource after it has already been added to a Viewer's DataSourceCollection.
(P.S. I am waiting for the Promise to resolve after adding the CustomDataSource to the Viewer before I add Entities to the CustomDataSource's EntityCollection without success)
2.
var viewer = new Cesium.Viewer('cesiumContainer', {
animation : false,
timeline : false
})
var dataSource = new Cesium.CustomDataSource('exampleDataSource')
// METHOD 1: entity added this way appears:
dataSource.entities.add(new Cesium.Entity({ name: 'exampleEntity' }))
viewer.dataSources.add(dataSource)
// METHOD 2: entity added this way does not appear:
viewer.dataSources.add(dataSource).then(function(datasource) {
datasource.entities.add(new Cesium.Entity({ name: 'exampleEntity' }))
})
3. Trying to create a custom Cesium widget and would like a better understanding of how the Viewer, DataSources, and Entities work together.
4. Cesium 1.42.1, Ubuntu 16.04.3 LTS, Chrome Version 61.0.3163.100 (Official Build) (64-bit)