Includes widget to show and set map rotation. Handle rotation in vector and raster renderers. Ensure correct behavior of panning and zooming actions. Drop compile-time defines for ARM and ANDROID, leaving only the qreal based function to transform in place. Update expected test results after eye comparison.
- Loading branch information
There are no files selected for viewing
11 comments
on commit ce8a9ba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strk Thanks for tackling this important change - it's much appreciated, especially if I can swap over the composer map rotation to use this better implementation instead.
There's a couple of issues with this commit which need to be addressed:
- Firstly, it's missing updates to the sip bindings for the header file changes.
- Given that rotation is stored as a double, I think all the checks for "!rotation" should be replaced by "!qgsDoubleNear( rotation, 0.0 )" -- that should be a bit safer.
- A change to core components like this really needs to be accompanied by new unit tests. Is this on your todo list? I'd suggest at a minimum numeric tests for the QgsMapToPixel changes, and render tests for both vectors and rasters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strk some more issues I've run into when testing this:
- Identify tool doesn't correctly shade identified points. It works if I first identify a feature, and then change the rotation, but not if I identify a feature on an already rotated map
- Selection tools are broken - try using the rectangular selection tool on a rotated map. They should be ignoring the rotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strk nice, nice.
Few comments (using a rotation value of 45, in case that is specific to what I see):
- One thing needs fixing as a priority: the rotation spin box in the status bar need to allow for values containing decimal (i.e. 45.5 degrees)
- In addition to the rotated selection tool issue raised by Nyall, I noticed the single click feature selection isn't working (i.e. select the rectangular selection tool, mouse over a feature, click on it, notice it doesn't get selected)
It'd be nice for you to put up a TODO list of what hasn't been implemented yet (north arrow, grid, etc.) as a comment to this commit.
Also, maybe a pro like @wonder-sk could give his seal of approval on this significant code change :)
Cheers and thanks again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me. In addition to @nyalldawson 's comments, I would just add:
- it is probably worth constructing the transform matrix in QgsMapToPixel once and storing it in the instance. Common pattern is to create MTP object once and do transforms many times
Regarding your questions map center vs extent... I would be in favor of using map center + resolution (map units per pixel) as a canonical definition of the view. As you can see, the current solution that recognizes "requested" extent and "visible" extent is becoming even more clumsy now with rotation - as the "visible" extent does not mean anymore that everything inside it is actually visible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more UX related thing - could we have the map rotation configuration in a less prominent place than the status bar? (e.g. project properties). IMHO the status bar is already quite busy and the rotation is not really something that users commonly need access to all the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strk , I spotted a regression; zoom to mouse cursor is broken (even on 0 degree rotation value).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I open tickets for this issues, or you will?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strk , @gioman , I've filed a blocker on this: http://hub.qgis.org/issues/11811
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nyalldawson the check for 0.0 doesn't need tolerance as it really only meant as a trick to avoid subtle differences in the existing rendering tests. There's no problem to always use the full matrix otherwise. A unit test for QgsMapToPixel is on my TODO list as well as a refactoring to construct the matrix once and use multiple times. I'd actually like to completely deprecate the methods to set individual components of it, what do you think ?
For issues (identify/selection tool) please file tickets on hub.
@Nirv thanks for the ticket.
@wonder-sk could you please use hub also for UX issues ? I was actually thinking to give QDial a try too, but completely dropping from status would seem unfair to me. Wouldn't it be nice to get the defining triplet over there (center,resolution,rotation) ? Anyway, better move this to list or specific tickets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should probably read myWidth-1 and myHeight-1 ?