terriajs icon indicating copy to clipboard operation
terriajs copied to clipboard

Rewrite geojson catalog item using autorun to make it reactive to style changes and fix mobx warnings

Open na9da opened this issue 3 years ago • 1 comments

Currently, loading geojson catalog item throws up a lot mobx warnings and the resulting items also do not react to style changes. This is most probably because we construct the GeoJsonDataSource inside loadMapItems and so will need to call loadMapItems again for any style changes to take effect. Problem with deferring datasource construction to mapItems is that some of the things that happen after the data loading stage are asynchronous, like the reprojectionToGeographic and Cesium.GeoJsonDataSource.load calls. Moving them to mapItems will make mapItems behave asynchronously. So I guess we will need to be more explicit in expressing the reactivity by moving datasource construction inside an autorun.

na9da avatar Dec 02 '20 02:12 na9da

This is done for geojson-vt/mvt GeoJsonMixin renderer - but not cesium primitives or czml template.

More info about renderers here

https://github.com/TerriaJS/terriajs/blob/2bfb9dd44ab4c86a617326e275f22ed4734724c6/lib/ModelMixins/GeojsonMixin.ts#L403-L412

nf-s avatar Jun 23 '22 11:06 nf-s