grass
grass copied to clipboard
wxGUI/mapwin: disable auto-rendering map completely (resize Map Display window event etc.)
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:
- Launch wxGUI
- Display some vector/raster map
- Uncheck Render (Enable/disable auto-rendering) checkbox widget on the Map Display window status bar widget
- Resize Map Display window
- 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 please set the milestone, thanks
https://github.com/OSGeo/grass/commit/915457a639339dbc0193a7a8f46b69015c2dd2b1 rebase.
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.
Summary:
- F6 keyboard shortcut for disable/enable auto-rendering. If auto-rendering is enabled re-render map composition is triggered
- 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 - 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 - Unnecessary
IsAutoRendered()
method calls was removed - 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 would you mind to rebase this PR?
@tmszi Would you mind to rebase this PR?
@tmszi Would you mind to rebase this PR?
Yes, I will do it as soon as I have more free time.
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.