-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Viewport rotation support in composer #1882
Conversation
@strk just a note - the code in QgsComposerMap is extremely fragile, so please don't merge any changes before I've had a chance to review them |
@nyalldawson I don't plan to merge this before a deep review and an approval. |
@strk @nyalldawson , I've built and tested this PR and confirm that the rotation works fine, as well as grid and overview who now align flawlessly: IMO, this should be merged before the release of 2.8; I've always considered the lack of implementation within the composer as an implementation gap (which is considered a blocker). |
If you plan to merge this do it as soon as possible, to allow us do extensive tests. |
Travis is failing, I guess some tests would need to be changed to expect the now-correct behavior. |
The travis failures are here: http://dash.orfeo-toolbox.org/testDetails.php?test=28184445&build=170932 That test is particularly unfortunate in that it's using a pretty noisy raster which makes comparing expected/obtained harder than it could be. Ideally the raster would be a neatly defined 2-colors kind of thing... |
I gave it further testing this afternoon (testing it out in the context of an atlas export, adding an overview onto a rotated map, etc.), things are looking good. Used two large projects too, couldn't see any issues. |
If anyone can help with the failing testcases my branch is open for pull requests - https://github.com/strk/qgis/pulls |
See #1884 for the direction I have in mind for the tests... |
ce3aecf
to
3822244
Compare
I've rebased to master after simplifying the test raster. Hopefully now we can see better what fails and how different the results are from the expected (debatable expectances when it comes to center, btw) |
Great, failures seem tolerable: As for the second failure, I think it may be a completely unrelated race condition (presence of the old image in the second test): http://dash.orfeo-toolbox.org/testDetails.php?test=28205995&build=171052 |
See ? now the second test did not fail. Maybe the QVERIFY failure avoids to run the subsequent code, which includes a "removeItem"... In any case, this PR is now succeeding. Anything preventing a merge to master ? |
@strk shouldn't be. Give me 48 hours or so and I'll review and merge. Thanks! |
@strk I think it would be very useful to move the code that calculates polygon of the rotated extent to QgsMapSettings class - the visibleExtent() method only returns bounding box of the rotated extent... |
@wonder-sk I think I'm going to do that as part of the change that fixes the overview map. |
@wonder-sk PR #1888 has the QgsMapSettings method to get possibly rotated map extent, being a new interface I dunno if it's ok to push to master (although completely safe). |
eab95d0
to
5c3623d
Compare
I've squashed the composer commits and rebased on master + visiblePolygon PR (#1888). |
5c3623d
to
31fced4
Compare
Sorry, rebased again, the "visiblePolygon" interface is not really needed for this PR and I don't want to mix things. Better to merge this separately from that, as long as all tests still succeed. |
31fced4
to
0d778b9
Compare
@@ -2055,7 +2032,7 @@ QString QgsComposerMap::displayName() const | |||
void QgsComposerMap::requestedExtent( QgsRectangle& extent ) const | |||
{ | |||
QgsRectangle newExtent = *currentMapExtent(); | |||
if ( mEvaluatedMapRotation == 0 ) | |||
if ( 1 || mEvaluatedMapRotation == 0 ) |
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 don't think this change should be included. It breaks API and affects QgsComposerLegend::updateFilterByMap() potentially causing features to be missed in a legend filtered from a rotated map (although the current behaviour isn't ideal as it potentially includes features which aren't visible, but that's safer then the alternative). Instead, the calls to requestedExtent in cache and paint should be replaced by *currentMapExtent() instead.
@nyalldawson could you add a testcase guarding the API for QgsComposerMap::requestedExtent ? |
There are multiple callers but I can't find a way to trigger all of them. For example, how do I set "plotStyle" to "preview" ? |
@strk it's set by the composition - a composition is in preview mode in the GUI, and print/postscript if it's bring exported. |
I've pushed a fix of the regression you pointed out. Please test again. |
Includes patch by Martin Dobias See http://lists.osgeo.org/pipermail/qgis-developer/2015-January/036309.html Fix qgis#11912
79cb41c
to
f57be5e
Compare
Pushed as a40eca4 |
This is a work in progress, see
http://hub.qgis.org/issues/11912