Skip to content
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

[Bugfix] Fix MeasureTool when DestinationCRS changes (fixes #15182) #3262

Merged
merged 1 commit into from
Jul 6, 2016

Conversation

ahuarte47
Copy link
Contributor

MeasureTool fails when the user changes the destination crs of the MapCanvas while the user is digitizing a measure.

The MeasureDialog shows wrong measures and the digitised geometries disappear of the map.

This pull fixes the issue https://hub.qgis.org/issues/15182

@nyalldawson
Copy link
Collaborator

@ahuarte47 nice! There's already a test case for the measure dialog, do you mind adding a test fit this?

@ahuarte47
Copy link
Contributor Author

Done!

QgsPoint n0 = tool2->points()[0];
QgsPoint n1 = tool2->points()[1];

QVERIFY( qgsDoubleNear( p0.x(), n0.x(), 0.001 ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's now QGSCOMPARENEAR which is nicer if it comes to debugging

e95a8a9#diff-9aafa4a9dec16b6386ec6feacf94e2f9R608

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @m-kuhn !

@ahuarte47 ahuarte47 force-pushed the Issue_MeasureDialog branch 2 times, most recently from 1885ecf to 5319202 Compare June 30, 2016 15:08

Q_FOREACH ( const QgsPoint& previousPoint, points )
{
QgsPoint point = ct.transform( previousPoint );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - one last thing. You should probably catch any QgsCsExceptions here and skip the point

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nyalldawson !

@nyalldawson nyalldawson merged commit 8eeceb0 into qgis:master Jul 6, 2016
@nyalldawson
Copy link
Collaborator

Good fix - thanks! One thing I noticed during testing is that the rubber band points/lines aren't redrawn if the measure points have been finished. So the dialog values are correctly updated, but the measured line isn't redrawn in the new projection.

@ahuarte47
Copy link
Contributor Author

Hi @nyalldawson, you are right, I created another pull to fix it.

#3279

Thanks to all for your advices!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants