CompositeEntityCollection

It is unclear how to use a composite entity collection. Our purpose is to be able to quickly add/remove groups of entities (we have over 10,000 across the entire globe)

here is a code sample:

createCustomDataSource: function() {

    var scope = this;

   

    scope.viewer = this.getCmp()._cesium;

   

    //create datasource

    scope._CoTDataSource = new Cesium.CustomDataSource();

    //add data source

    scope.viewer.dataSources.add(scope._CoTDataSource);

    //create composite entity collection

    scope.collections = new Cesium.CompositeEntityCollection();

    scope._CoTDataSource.entityCollections = scope.collections;

    scope.defaultCollection = new Cesium.EntityCollection();

    scope.collections.addCollection(scope.defaultCollection);

   

    scope.viewer.clock.onTick.addEventListener(function() {

        scope.processData();

    });

},

Hello,

I’m not sure what your exact use case is, but if you’re just trying to show/hide groups of entities, you could use a parent entity for each group. See this example: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Show%20or%20Hide%20Entities.html&label=Beginner

CustomDataSource does not have an entityCollections property. It has an entities property to get the EntityCollection, but that is read only.

In order to have CustomDataSource use a CompositeEntityCollection, you will have to make changes to the code: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/DataSources/CustomDataSource.js#L41

Best,

Hannah

That is a perfect solution! Thanks