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

[layouts] Use nicer number formatting for dynamic map scale labels #51768

Merged
merged 1 commit into from
Feb 21, 2023

Conversation

nyalldawson
Copy link
Collaborator

Fixes #51764

@github-actions github-actions bot added this to the 3.30.0 milestone Feb 8, 2023
src/gui/layout/qgslayoutlabelwidget.cpp Outdated Show resolved Hide resolved
@uclaros
Copy link
Contributor

uclaros commented Mar 29, 2023

@nyalldawson why does the scale need rounding though, while the user explicitly sets a round scale number?

@nyalldawson
Copy link
Collaborator Author

@uclaros

Cos of floating point precision -- without it you'll get scales like 29999.99999999999

@uclaros
Copy link
Contributor

uclaros commented Mar 30, 2023

Cos of floating point precision -- without it you'll get scales like 29999.99999999999

Well, what is not that obvious to me is why the scale is calculated when the user explicitly sets 30000, which should be nicely representable by doubles. And furthermore, why it is not rounded upon calculation (the variable map_scale is still 29999.99999999999) and only rounded on the dynamic label?

@nyalldawson
Copy link
Collaborator Author

@uclaros

That's a very good question! For reasons which predate my time in qgis (ie > 15 years) map items have always used extent+map dimensions as the canonical property from which all other properties (including scale and center) are derived. So entering a specific fixed scale doesn't actually store that scale -- it recalculates the visible extent and stores that, and re-derives the scale from that.

I... don't like.... this approach.

I would love to see an enum setting allowing the center + scale to be the canonical map property, with the extent derived from that. And then this new setting becoming the default going forward....

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.

Add Dynamic Text -> Scale on layout not inserting correct scale
4 participants