-
Notifications
You must be signed in to change notification settings - Fork 320
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
Performance: hide ol layers when 2D not visible #66
Conversation
…rue) when re-enabling ol3cesium)
I think there will be an impact on vector synchronization if the visibility of the group is modified. |
Oh, you are probably right -- It might affect visibility of the "streamed" vector content, but I think static data should work ok... In the case, we could probably add some |
@gberaudo I tested the existing vectors example (modified to run in the "stacked view") and it does not seem to be affected. Is there any reason why it should be? |
@petrsloup, the vector synchronizer is listening for layer group |
As far as I can tell, the VectorSynchronizer does not interact with the root LayerGroup of the |
@petrsloup, thank you for spotting this bug. |
@ahocevar please comment - whether there is a better way how to stop rendering in ol3 properly or if this PR should be merged now as a temporary solution for improving the performance. |
The only way I could think of for handling this in ol3 would be to give the map a setRenderer method, and create a dummy renderer that does nothing but dispatch render events. The former would be implemented in ol3, the latter could be done on the app (i.e. ol3-cesium) level if we allow applications to subclass |
If the above sounds like too much effort for now, I think we can merge this pull request as a temporary solution. |
Performance: hide ol layers when 2D not visible
Related to #19 (comment).
This optimization hides the root LayerGroup (
ol.Map#getLayerGroup
) viasetVisible(false)
to prevent the underlying layers from being rendered.The Chrome Dev Tools report that the tiles are not even being requested, so the performance gain should be noticeable (please report).
If the developer changes the root LayerGroup (via
setLayerGroup()
) everything works OK, but the original LayerGroup will still havevisible
set tofalse
-- until the ol3cesium is re-enabled.If the developer tries to hide the root LayerGroup when already hidden by ol3cesium, this setting will be overwritten when re-enabling ol3cesium.
These rare issues could be solved by adding some event listeners, but I don't think it's worth the extra code that would be required. Opinions?