grass icon indicating copy to clipboard operation
grass copied to clipboard

wxGUI/mapwin: disable auto-rendering map completely (resize Map Display window event etc.)

Open tmszi opened this issue 3 years ago • 7 comments

Describe the bug If you display some vector/raster map and uncheck Render (Enable/disable auto-rendering) checkbox widget on the Map Display window status bar widget and try resize Map Display window, map composition is re-rendered.

To Reproduce Steps to reproduce the behavior:

  1. Launch wxGUI
  2. Display some vector/raster map
  3. Uncheck Render (Enable/disable auto-rendering) checkbox widget on the Map Display window status bar widget
  4. Resize Map Display window
  5. Displayed maps are re-rendered

Expected behavior If auto-rendering is disabled, maps composition should not be re-rendered (Map Display window resize event, zoom in/out etc.)

Additional context From my point of view as tilled window manager user which control the layout of the windows with keyboard shortcuts is this function very useful especially if I want change Map Display window size and I have multiple vector maps displayed (e.g. with many features > 300 000), when re-rendering map composition is slow each time the Map Display window is resized. I also added a keyboard shortcut F6 to enable or disable auto-rendering with this PR.

tmszi avatar Dec 15 '21 08:12 tmszi

@tmszi please set the milestone, thanks

neteler avatar Dec 17 '21 21:12 neteler

https://github.com/OSGeo/grass/commit/915457a639339dbc0193a7a8f46b69015c2dd2b1 rebase.

tmszi avatar Dec 18 '21 09:12 tmszi

One problem with this is that now when you press rerender tool in map display toolbar, it won't rerender, which seems like a bug. Additionally, if I understand this correctly, all the IsAutoRendered calls are not needed anymore, because it would be now handled internally in BufferedWindow. I think handling this inside UpdateMap makes sense.

petrasovaa avatar Dec 19 '21 03:12 petrasovaa

Summary:

  1. F6 keyboard shortcut for disable/enable auto-rendering. If auto-rendering is enabled re-render map composition is triggered
  2. When auto-rendering is disabled and Render map toolbar tool (e.g. wxGUI g.gui.iclass, g.gui.gcp) is activated (mouse, keyboard shortcut F5/Ctrl+R), map compositions is re-rendered
  3. When auto-rendering is disabled and Display map toolbar tool (has e.g. wxGUI g.gui.iclass, g.gui.gcp) is activated (mouse), map is displayed
  4. Unnecessary IsAutoRendered() method calls was removed
  5. This line code prevent drag map error if auto-rendering is disabled
    • launch wxGUI, Map Display Window with width e.g. 500 px
    • display some vector/raster map
    • disable auto-rendering
    • increase Map Display Window width size e.g. to 600 px
    • activate Pan toolbar tool and try drag map e.g. to lower bottom corner
    • you get error message and wxGUI freeze
Traceback (most recent call last):
  File "/usr/lib64/grass80/gui/wxpython/mapwin/buffered.py", line 1421, in MouseActions
    self.OnDragging(event)
  File "/usr/lib64/grass80/gui/wxpython/mapwin/buffered.py", line 1508, in OnDragging
    self.DragMap(move)
  File "/usr/lib64/grass80/gui/wxpython/mapwin/buffered.py", line 1115, in DragMap
    self.dragimg.BeginDrag((0, 0), self)
wx._core.wxAssertionError: C++ assertion "!wxMouseCapture::IsInCaptureStack(this)" failed at /tmp/pip-req-build-oxkmg2wi/ext/wxWidgets/src/common/wincmn.cpp(3270) in CaptureMouse(): Recapturing the mouse in the same window?

tmszi avatar Dec 20 '21 12:12 tmszi

@tmszi would you mind to rebase this PR?

neteler avatar Mar 25 '22 10:03 neteler

@tmszi Would you mind to rebase this PR?

neteler avatar Oct 04 '23 21:10 neteler

@tmszi Would you mind to rebase this PR?

Yes, I will do it as soon as I have more free time.

tmszi avatar Oct 06 '23 03:10 tmszi

This works well, I have only a small suggestion to remove IsAutoRendered method and its mentioning in the MapPanelBase documentation.

Suggestion was incorporated, commit https://github.com/OSGeo/grass/pull/2018/commits/4941143700a5288bbb7d907d0030acab2b7bb79b.

tmszi avatar Jun 16 '24 06:06 tmszi