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

RasterLayer: Properly handle GUI updates when multiple canvas are displayed #59444

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Commits on Nov 22, 2024

  1. introduce qgsrenderedlayerstatistics

    This will be used in the next commits to store the min-max values of a
    raster layer and report them to the main canvas.
    ptitjano committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    bf07a5e View commit details
    Browse the repository at this point in the history
  2. qgsrasterrenderer: Introduce needsRefresh

    This is similar to what is achieved in
    `QgsRasterLayer::refreshRendererIfNeeded()` to check if the renderer
    needs to be refresh according to an extent. It does not perform any
    refresh.
    
    It is not used at the moment. This will replace the logic to refresh a
    renderer in the following commits.
    ptitjano committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    ba285e0 View commit details
    Browse the repository at this point in the history
  3. qgsrasterrenderer: Introduce refresh

    This is similar to what is achieved in
    `QgsRasterLayer::refreshRenderer()` to refresh the renderer according
    to an extent. Contrary to the first one, this method does not perform
    any GUI update or emit any signal.
    
    It is not used at the moment. This will replace the logic to refresh a
    renderer in the following commits.
    ptitjano committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    e8cc65f View commit details
    Browse the repository at this point in the history
  4. qgsrasterlayer: Make computeMinMax public

    This will be used in the next commit to refresh a renderer.
    ptitjano committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    14a5c9f View commit details
    Browse the repository at this point in the history
  5. qgsrasterlayerrenderer: Change the logic to refresh the renderers

    This replaces the existing logic in `QgsRasterLayerRenderer` which
    calls `QgsRasterLayer::refreshRendererIfNeeded()` to refresh the
    renderer associated `QgsRasterLayerRenderer` and the raster associated
    with `QgsRasterLayer`. It also makes GUI updates.
    
    With this approach, the following new logic is done:
     1. `QgsRasterRenderer::needsRefresh()` is called to check if
     `rasterRenderer` needs to be updated.
     2. If a refresh is needed, the new min/max values are computed by
     calling `QgsRasterLayer::computeMinMax()`
     3. The min/max values are used to refresh `rasterRenderer`
     4. The min/max values are stored in a `QgsRenderedLayerStatistics`
     and propagated to `QgisApp`
     5. In QgisApp, `QgsRenderedLayerStatistics` is used to refresh the
     renderer of `QgsRasterLayer` and force a refresh of the style and the
     legend if the change comes from the main canvas.
    ptitjano committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    78780ea View commit details
    Browse the repository at this point in the history
  6. qgsrasterlayer: Remove refresh logic

    This is not used anymore.
    ptitjano committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    a6a76a1 View commit details
    Browse the repository at this point in the history