qgis / QGIS-Enhancement-Proposals

QEP's (QGIS Enhancement Proposals) are used in the process of creating and discussing new enhancements for QGIS
117 stars 37 forks source link

Elevation profile : sub-section indicators #260

Open jmkerloch opened 1 year ago

jmkerloch commented 1 year ago

Elevation profile : sub-section indicators

Date 2023/01/05

Author Oslandia

Contact jean-marie.kerloch at oslandia dot com

maintainer @jmkerloch

Version QGIS 3.28

Summary

In its current iteration, the Elevation Profile allows users to draw connex muti-segmented traces over the canvas which results in connex muti-planar profiles.

These complex, "sub-paneled" profiles are very useful although can be also be fairly confusing when the geometry of the trace counts more than 3-4 vertices.

In order to improve spatial awareness, we intend to add an option to display the coordinates of each trace vertex to the profile view alongside the heading of each sub-panel.

Doing so would make Elevation Profiles fully explicit in their spatial location such that one could be placed back on a map even when the original trace is lost.

Profile trace vertices location indicator (optional checkbox)

Indicate where the profile vertices are located on the profile :

Profile sub-panel heading indicator (optional checkbox)

Indicate the bearing of each sub-panel on the profile:

Proposed Solution

Here is a screenshot of a Proof Of Concept:

image

Display of these indicator will be managed in settings menu of the toolbar, right after the tolerance parameter.

Affected Files

src/gui/elevation/qgselevationprofilecanvas.h
src/gui/elevation/qgselevationprofilecanvas.cpp

Performance Implications

Not Applicable

Further Considerations/Improvements

Not Applicable

Backwards Compatibility

The profile creation should not be changed by this new functionnality.

Issue Tracking ID(s)

Votes

(required)

nyalldawson commented 1 year ago

Sounds like a good option to me!

A couple of notes:

  1. Given that the elevation profiles are being exposed to layouts for 3.30, it would make sense for this option to also be available for plots in layouts. This means the implementation will need to live in the core classes, not gui.
  2. Please use a QgsTextFormat object along with QgsTextRenderer for the heading text font settings, and make public methods for setting/getting this format. Then we can expose control over the appearance of the labels for layout items.
  3. Similarly, use a QgsLineSymbol for the vertical lines and expose getters/setters for this, so that again users can control the appearance of these lines in print layouts
jmkerloch commented 1 year ago

Thanks for the feedback.

In my POC I was creating a QgsElevationProfileCurveVertexItem that inherits QgsPlotCanvasItem like the object mCrossHairsItem.

In the void paint( QPainter *painter ) override method I'm drawing the line of all profile curve vertex.

I don't understand how I should implement this in the core classes.

jmkerloch commented 1 year ago

@nyalldawson I guess the direction of my poc with QgsPlotCanvasItem is not valid if I want to integrate it in the core classes.

Is it possible to provide some guidance to add these lines to the core classes ?

I understand how the profiles are generated with QgsAbstractProfileGenerator but I don't see how I can add other thing to the layouts.

Should I add the render in void QgsProfilePlotRenderer::render( QgsRenderContext &context, double width, double height, double distanceMin, double distanceMax, double zMin, double zMax, const QString &sourceId )