Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arvindshekar07 opened this issue Oct 17, 2018 · 4 comments
Open

Comments

@arvindshekar07
Copy link

arvindshekar07 commented Oct 17, 2018

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.

@gberaudo
Copy link
Member

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.

@arvindshekar07
Copy link
Author

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

@gberaudo
Copy link
Member

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

@arvindshekar07
Copy link
Author

arvindshekar07 commented Oct 19, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants