-
-
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
Add scale method option for layout scale bars #58904
base: master
Are you sure you want to change the base?
Conversation
This pull request has been tagged for the changelog.
You can edit the description. Format available for credits
Thank you! |
@nyalldawson A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
Tests failed for Qt 6One or more tests failed using the build from commit 73f1f3f layoutscalebar_singlebox (singleBox)layoutscalebar_singleboxTest failed at singleBox at tests/src/core/testqgslayoutscalebar.cpp:120 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_singlebox/expected_layoutscalebar_singlebox.png (found 186 pixels different) layoutscalebar_singlebox_linesymbol (singleBoxLineSymbol)layoutscalebar_singlebox_linesymbolTest failed at singleBoxLineSymbol at tests/src/core/testqgslayoutscalebar.cpp:162 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_singlebox_linesymbol/expected_layoutscalebar_singlebox_linesymbol.png (found 290 pixels different) layoutscalebar_singlebox_fillsymbol (singleBoxFillSymbol)layoutscalebar_singlebox_fillsymbolTest failed at singleBoxFillSymbol at tests/src/core/testqgslayoutscalebar.cpp:203 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_singlebox_fillsymbol/expected_layoutscalebar_singlebox_fillsymbol.png (found 256 pixels different) layoutscalebar_singlebox_labelbelowsegment (singleBoxLabelBelowSegment)layoutscalebar_singlebox_labelbelowsegmentTest failed at singleBoxLabelBelowSegment at tests/src/core/testqgslayoutscalebar.cpp:233 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_singlebox_labelbelowsegment/expected_layoutscalebar_singlebox_labelbelowsegment.png (found 287 pixels different) layoutscalebar_singlebox_alpha (singleBoxAlpha)layoutscalebar_singlebox_alphaTest failed at singleBoxAlpha at tests/src/core/testqgslayoutscalebar.cpp:272 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_singlebox_alpha/expected_layoutscalebar_singlebox_alpha.png (found 134 pixels different) layoutscalebar_doublebox (doubleBox)layoutscalebar_doubleboxTest failed at doubleBox at tests/src/core/testqgslayoutscalebar.cpp:308 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_doublebox/expected_layoutscalebar_doublebox.png (found 146 pixels different) layoutscalebar_doublebox_linesymbol (doubleBoxLineSymbol)layoutscalebar_doublebox_linesymbolTest failed at doubleBoxLineSymbol at tests/src/core/testqgslayoutscalebar.cpp:350 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_doublebox_linesymbol/expected_layoutscalebar_doublebox_linesymbol.png (found 307 pixels different) layoutscalebar_doublebox_fillsymbol (doubleBoxFillSymbol)layoutscalebar_doublebox_fillsymbolTest failed at doubleBoxFillSymbol at tests/src/core/testqgslayoutscalebar.cpp:391 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_doublebox_fillsymbol/expected_layoutscalebar_doublebox_fillsymbol.png (found 266 pixels different) layoutscalebar_doublebox_labelcenteredsegment (doubleBoxLabelCenteredSegment)layoutscalebar_doublebox_labelcenteredsegmentTest failed at doubleBoxLabelCenteredSegment at tests/src/core/testqgslayoutscalebar.cpp:430 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_doublebox_labelcenteredsegment/expected_layoutscalebar_doublebox_labelcenteredsegment.png (found 564 pixels different) layoutscalebar_tick (tick)layoutscalebar_tickTest failed at tick at tests/src/core/testqgslayoutscalebar.cpp:498 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_tick/expected_layoutscalebar_tick.png (found 147 pixels different) layoutscalebar_tick_linesymbol (tickLineSymbol)layoutscalebar_tick_linesymbolTest failed at tickLineSymbol at tests/src/core/testqgslayoutscalebar.cpp:544 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_tick_linesymbol/expected_layoutscalebar_tick_linesymbol.png (found 277 pixels different) layoutscalebar_datadefined (dataDefined)layoutscalebar_datadefinedTest failed at dataDefined at tests/src/core/testqgslayoutscalebar.cpp:616 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_datadefined/expected_layoutscalebar_datadefined.png (found 221 pixels different) layoutscalebar_textformat (textFormat)layoutscalebar_textformatTest failed at textFormat at tests/src/core/testqgslayoutscalebar.cpp:673 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_textformat/expected_layoutscalebar_textformat.png (found 276 pixels different) layoutscalebar_numericformat (numericFormat)layoutscalebar_numericformatTest failed at numericFormat at tests/src/core/testqgslayoutscalebar.cpp:707 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_numericformat/expected_layoutscalebar_numericformat.png (found 222 pixels different) layoutscalebar_stepped (steppedLine)layoutscalebar_steppedTest failed at steppedLine at tests/src/core/testqgslayoutscalebar.cpp:750 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_stepped/expected_layoutscalebar_stepped.png (found 335 pixels different) layoutscalebar_hollow (hollow)layoutscalebar_hollowTest failed at hollow at tests/src/core/testqgslayoutscalebar.cpp:807 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_hollow/expected_layoutscalebar_hollow.png (found 314 pixels different) layoutscalebar_tick_subdivisions (tickSubdivisions)layoutscalebar_tick_subdivisionsTest failed at tickSubdivisions at tests/src/core/testqgslayoutscalebar.cpp:907 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_layoutscalebar_tick_subdivisions/expected_layoutscalebar_tick_subdivisions.png (found 289 pixels different) scalebar_method (methodTop)scalebar_methodTest failed at methodTop at tests/src/core/testqgslayoutscalebar.cpp:1076 Rendered image did not match tests/testdata/control_images/layout_scalebar/expected_scalebar_method/expected_scalebar_method.png (found 18426 pixels different) The full test report (included comparison of rendered vs expected images) can be found here. Further documentation on the QGIS test infrastructure can be found in the Developer's Guide. |
Instead of always calculating the scale along the bottom of the map, expose a choice of methods to the user (along bottom, middle, top, or average of the three measurements) For new scalebars, default to the average method, which better handles the scenario where the scale at the top or bottom of the map cannot be calculated (eg when the top/bottom of the map falls just outside valid areas for the map's crs) This fixes one of the most common scenarios which cause scale bar widths to blow out to massive sizes Refs qgis#55240
73f1f3f
to
66f0e26
Compare
Instead of always calculating the scale along the bottom of the
map, expose a choice of methods to the user (along bottom,
middle, top, or average of the three measurements)
For new scalebars, default to the average method, which better
handles the scenario where the scale at the top or bottom of
the map cannot be calculated (eg when the top/bottom of the map
falls just outside valid areas for the map's crs)
This fixes one of the most common scenarios which cause scale
bar widths to blow out to massive sizes
Refs #55240