ol-cesium
ol-cesium copied to clipboard
ol style in 3d does not change on when style function changes .
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.
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.
So your saying that I could call changed() for feature wise change or create a new layer attaching the new style function?
Yes, anything that would trigger a re-synchronization of the features to their Cesium counterpart.
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.