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

Profile tool: Add support for subsections indicator #61010

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

ptitjano
Copy link
Collaborator

Description

This PR allows to display subsections indicator as vertical lines in the profile tool. This is based on the ideas discussed in qgis/QGIS-Enhancement-Proposals#260
It works on the Elevation Profile and the Print Layout. In both cases, it is possible to change the symbology of the lines. For the elevation profile, theses new options are added to the options menu.

Screenshots

Capture d’écran du 2025-03-14 18-21-39

Elevation Profile

Capture d’écran du 2025-03-14 18-20-56

Capture d’écran du 2025-03-14 18-22-04

Layout

Capture d’écran du 2025-03-14 18-23-24

Capture d’écran du 2025-03-14 18-25-36

cc @Simon-Lopez @T4mmi @Djedouas
Funded by BRGM

@ptitjano ptitjano self-assigned this Mar 14, 2025
@github-actions github-actions bot added this to the 3.44.0 milestone Mar 14, 2025
@ptitjano ptitjano force-pushed the profile-tool-sub-sections branch from b736693 to da654e6 Compare March 14, 2025 17:53
Copy link

github-actions bot commented Mar 14, 2025

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 0a48791)

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 0a48791)

@ptitjano ptitjano force-pushed the profile-tool-sub-sections branch from da654e6 to 41eb429 Compare March 14, 2025 19:40
Copy link

github-actions bot commented Mar 14, 2025

Tests failed for Qt 6

One or more tests failed using the build from commit 9bd135e

vector_profile_with_subsections

vector_profile_with_subsections

Test failed at testRenderProfileWithSubsections at tests/src/python/test_qgsvectorlayerprofilegenerator.py:2749

Rendered image did not match tests/testdata/control_images/profile_chart/expected_vector_profile_with_subsections/expected_vector_profile_with_subsections.png (found 720 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.

Copy link

github-actions bot commented Mar 14, 2025

Tests failed for Qt 5

One or more tests failed using the build from commit 9bd135e

vector_profile_with_subsections

vector_profile_with_subsections

Test failed at testRenderProfileWithSubsections at tests/src/python/test_qgsvectorlayerprofilegenerator.py:2749

Rendered image did not match tests/testdata/control_images/profile_chart/expected_vector_profile_with_subsections/expected_vector_profile_with_subsections.png (found 720 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.

@ptitjano ptitjano force-pushed the profile-tool-sub-sections branch 2 times, most recently from 1d6fdcb to d4ca754 Compare March 15, 2025 20:42
@nyalldawson
Copy link
Collaborator

Can you also add a test for print layout items rendering with subsections too? (and also a test that the subsections settings are correctly saved/restored for print layouts )

@ptitjano ptitjano force-pushed the profile-tool-sub-sections branch from d4ca754 to d93d1d5 Compare March 17, 2025 13:33
@ptitjano ptitjano force-pushed the profile-tool-sub-sections branch from d93d1d5 to 6794419 Compare March 17, 2025 17:12
@ptitjano
Copy link
Collaborator Author

Can you also add a test for print layout items rendering with subsections too? (and also a test that the subsections settings are correctly saved/restored for print layouts )

Done.

@ptitjano ptitjano force-pushed the profile-tool-sub-sections branch 4 times, most recently from 047eb45 to 9bd135e Compare March 18, 2025 22:51
This adds support to display vertices lines over the profile graph to
display indicator at the location of the curve's vertices.

This is achieved with mainly 2 changes:
- `QgsProfilePlotRenderer::setSubsectionsSymbol()` allows to set the
line symbol of the vertical lines
- `renderSubsectionsIndicator` generates and renders the vertical
lines. It is called by `QgsProfilePlotRenderer::renderToImage()`.
This adds support to display vertices lines over the profile graph to
display indicator at the location of the vertices of the trace.

This is mainly achieved by adding
`QgsElevationProfileCanvas::setSubsectionsSymbol()`. This method
allows to set the line symbol of the vertical lines. Then, It sets the
subsections symbol of the profile renderer of the plot item. It the
renderer does not exist yet, the subsections symbol is set when a new
profile renderer is created.
This introduces two new actions in the options menu:
- an action to display or the hide the subsections indicator
- an action to to set the lines' symbology.
This adds support to display vertices lines over the profile graph to
display indicator at the location of the curve's vertices.

This is achieved with mainly 2 changes:
- `setSubsectionsSymbol()` allows to set the line symbol of the
vertical lines
- Call `renderSubsectionsIndicator` on the `QgsProfilePlotRenderer`
This adds some new customization associated with the introduction of
subsections indicator:
- it allows to display or hide them
- it allows to change the associated symbology
@ptitjano ptitjano force-pushed the profile-tool-sub-sections branch from 9bd135e to 0a48791 Compare March 19, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants