Ticket #1716 (closed patch: fixed)
improvements to ZoomLast, ZoomNext tools (extent history)
|Reported by:||smizuno||Owned by:||mhugent|
|Priority:||minor: annoyance||Milestone:||Version 1.4.0|
|Must Fix for Release:||No||Awaiting user input:||no|
I have found the addition of the view extent history using the ZoomLast/ZoomNext? tools to be very useful. However, because there was no status indicated on the buttons it was not easy to tell whether there was an extent to zoom to.
Also, I found that loading a project did not set its extent in the history list.
I believe the extent history should be cleared when a project (new or existing) is loaded because the map extent is set to the extent of a project or the first layer loaded making this point the logical beginning for the extent history.
Some people might argue that the previous view extents might be useful with a new project or even an existing project, but I believe that it is more likely that these extents are of little use.
Note that on program start, the map extent is set twice - once by fileNew, then by the command-line extent processing - so there are two extents in the history instead of one.
I provide a patch to do the following:
+ provide a new function to clear the extent history and set the current extent as the first item: QgsMapCanvas::clearExtentHistory()
+ clear the extent history on new project (this is mostly cosmetic as other actions will also clear the history)
+ clear the extent history when the first layer is loaded
+ clear the extent history on project loading (the extent is set in QgsMapRenderer?, but the list of extents wasn't updated)
minor updates in QgsMapCanvas? -
+ in zoomToPreviousExtent() and zoomToNextExtent(): refresh() was moved inside the if block so that it is called only if there is a previous or next extent (this doesn't mean much when the now disabled button won't allow a click event in such a case, but was an unnecessary map redraw before the button got status indication)
+ in zoomToPreviousExtent(): mLastExtentIndex was tested for >1 -- it should be >0.
qgsmapcanvas.sip is updated for the new function and signals, so Python can make use of them.