Skip to content

EntityClustering crashes when DataSource is removed #9336

Open
@vividos

Description

@vividos

I'm using some parts of code from the Clustering Sandcastle demo. In my application I have several DataSources (one CustomDataSource, and potentially some CzmlDataSources). I'd like to cluster the elements in the data sources (mostly pins, but also points and labels) and I'm creating one Cesium.EntityCluster object:

https://github.com/vividos/WhereToFly/blob/5cb867c4c9e89e7c6ab0660f5dcd2b13f05b0a45/src/App/Resources/Assets/map/mapView3D.js#L390

I'm setting the EntityCluster object for my CustomDataSource:
https://github.com/vividos/WhereToFly/blob/5cb867c4c9e89e7c6ab0660f5dcd2b13f05b0a45/src/App/Resources/Assets/map/mapView3D.js#L265

Now when adding CZML files to my map view, I'm also setting the clustering property of the just loaded CzmlDataSource:
https://github.com/vividos/WhereToFly/blob/5cb867c4c9e89e7c6ab0660f5dcd2b13f05b0a45/src/App/Resources/Assets/map/mapView3D.js#L963

Clustering works well, and I can even switch it on/off globally.

Now the map view crashes and stops rendering when I remove a CZML data source again:
https://github.com/vividos/WhereToFly/blob/5cb867c4c9e89e7c6ab0660f5dcd2b13f05b0a45/src/App/Resources/Assets/map/mapView3D.js#L1125

As soon as the scene is re-rendered, the following call stack is shown (CesiumUnminified is used here):

An error occurred while rendering. Rendering has stopped.
TypeError: Unable to get property '_textureAtlas' of undefined or null reference
TypeError: Unable to get property '_textureAtlas' of undefined or null reference
   at Billboard.prototype.setImage (.../Cesium/Cesium.js:158459:5)
   at image.set (.../Cesium/Cesium.js:158149:11)
   at BillboardVisualizer.prototype.update (.../Cesium/Cesium.js:93141:9)
   at DataSourceDisplay.prototype.update (.../Cesium/Cesium.js:204161:9)
   at Viewer.prototype._onTick (.../Cesium/Cesium.js:300870:5)
   at Event.prototype.raiseEvent (.../Cesium/Cesium.js:14081:9)
   at Clock.prototype.tick (.../Cesium/Cesium.js:50418:5)
   at CesiumWidget.prototype.render (.../Cesium/Cesium.js:294541:7)
   at render (.../Cesium/Cesium.js:293797:13)

(I shortened the paths a bit).

I also tried setting the clustering property to undefined or to a newly created Cesium.EntityCluster object, but the crash stays the same.

I even tried to "force a re-cluster", just like shown in the sandcastle demo, setting pixelRange to 0 and back to the last value.

From the documentation I got the idea that sharing EntityCluster objects is possible, but maybe I'm just doing something wrong. Thanks for helping in advance!

Browser: This occurs in the UWP WebView (I think it's based on Edge, but I'm not sure), and in the Android WebView, which uses the installed Chrome.

Operating System: Windows 10 / Android 11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions