ol-cesium icon indicating copy to clipboard operation
ol-cesium copied to clipboard

ol style in 3d does not change on when style function changes .

Open arvindshekar07 opened this issue 7 years ago • 4 comments

Hi I am trying to update the styles of geojson on some toggle action.

       import { Stroke, Style } from 'ol/style';
           public updateLayerStyles(styles: Map<string, Style>,geoJsonLayer:VectorLayer): void {
            const withData = (feature: Feature) => {
                return styles.get(feature.getProperties().type);
            }
            geoJsonLayer.setStyle(withData);
      }

The above function works well with openlayer 2d map but I dont see the changes getting reflected to 3d map .

example only show how to change as with a style object and not with stylefunction. Is this an expected behaviour or will there support for the the future.

arvindshekar07 avatar Oct 17 '18 19:10 arvindshekar07

Yes, there is no way for OL-Cesium to know the function is returning a different result. You can call changed() on the particular feature that changed.

gberaudo avatar Oct 19 '18 13:10 gberaudo

So your saying that I could call changed() for feature wise change or create a new layer attaching the new style function?

arvindshekar07 avatar Oct 19 '18 14:10 arvindshekar07

Yes, anything that would trigger a re-synchronization of the features to their Cesium counterpart.

gberaudo avatar Oct 19 '18 15:10 gberaudo

thanks for the help. I think I shall change the vector layer in that case . I was hoping any invocation to the setStyle() method would retrigger the resynchronization of the layer . If there that not a possibility then I'll close the issue. Thanks.

arvindshekar07 avatar Oct 19 '18 15:10 arvindshekar07