QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
|
A canvas for elevation profiles. More...
#include <qgselevationprofilecanvas.h>
Public Slots | |
void | clear () |
Clears the current profile. More... | |
void | setSnappingEnabled (bool enabled) |
Sets whether snapping of cursor points is enabled. More... | |
void | zoomFull () |
Zooms to the full extent of the profile. More... | |
Public Slots inherited from QgsPlotCanvas | |
virtual void | refresh () |
Updates and redraws the plot. More... | |
Signals | |
void | activeJobCountChanged (int count) |
Emitted when the number of active background jobs changes. More... | |
void | canvasPointHovered (const QgsPointXY &point, const QgsProfilePoint &profilePoint) |
Emitted when the mouse hovers over the specified point (in canvas coordinates). More... | |
Signals inherited from QgsPlotCanvas | |
void | contextMenuAboutToShow (QMenu *menu, QgsPlotMouseEvent *event) |
Emitted before the canvas context menu will be shown. More... | |
void | plotAreaChanged () |
Emitted whenever the visible area of the plot is changed. More... | |
void | toolChanged (QgsPlotTool *newTool) |
Emitted when the plot tool is changed. More... | |
void | willBeDeleted () |
Emitted in the destructor when the canvas is about to be deleted, but is still in a perfectly valid state. More... | |
Public Member Functions | |
QgsElevationProfileCanvas (QWidget *parent=nullptr) | |
Constructor for QgsElevationProfileCanvas, with the specified parent widget. More... | |
~QgsElevationProfileCanvas () override | |
void | cancelJobs () override |
Cancel any rendering job, in a blocking way. More... | |
QgsProfilePoint | canvasPointToPlotPoint (QPointF point) const |
Converts a canvas point to the equivalent plot point. More... | |
void | centerPlotOn (double x, double y) override |
Centers the plot on the plot point corresponding to x, y in canvas units. More... | |
QgsCoordinateReferenceSystem | crs () const override |
Returns the coordinate reference system (CRS) for map coordinates used by the canvas. More... | |
Qgis::DistanceUnit | distanceUnit () const |
Returns the distance unit used by the canvas. More... | |
QVector< QgsProfileIdentifyResults > | identify (const QRectF &rect) |
Identify results visible within the specified plot rect. More... | |
QVector< QgsProfileIdentifyResults > | identify (QPointF point) |
Identify results visible at the specified plot point. More... | |
void | invalidateCurrentPlotExtent () |
Invalidates the current plot extent, which means that the visible plot area will be recalculated and "zoom full" operation occur when the next profile generation completes. More... | |
QList< QgsMapLayer * > | layers () const |
Returns the list of layers included in the profile. More... | |
bool | lockAxisScales () const |
Returns true if the distance and elevation scales are locked to each other. More... | |
void | mouseMoveEvent (QMouseEvent *e) override |
void | paintEvent (QPaintEvent *event) override |
void | panContentsBy (double dx, double dy) override |
Pans the plot contents by dx, dy in canvas units. More... | |
const Qgs2DPlot & | plot () const |
Returns a reference to the 2D plot used by the widget. More... | |
QRectF | plotArea () const |
Returns the interior rectangle representing the surface of the plot, in canvas coordinates. More... | |
QgsPointXY | plotPointToCanvasPoint (const QgsProfilePoint &point) const |
Converts a plot point to the equivalent canvas point. More... | |
QgsCurve * | profileCurve () const |
Returns the profile curve. More... | |
void | refresh () override |
Triggers a complete regeneration of the profile, causing the profile extraction to perform in the background. More... | |
void | render (QgsRenderContext &context, double width, double height, const Qgs2DPlot &plotSettings) |
Renders a portion of the profile using the specified render context. More... | |
void | resizeEvent (QResizeEvent *event) override |
void | scalePlot (double factor) override |
Scales the plot by a specified scale factor. More... | |
void | scalePlot (double xFactor, double yFactor) |
Scales the plot axis by the given factors. More... | |
void | setCrs (const QgsCoordinateReferenceSystem &crs) |
Sets the crs associated with the canvas' map coordinates. More... | |
void | setDistanceUnit (Qgis::DistanceUnit unit) |
Sets the distance unit used by the canvas. More... | |
void | setLayers (const QList< QgsMapLayer * > &layers) |
Sets the list of layers to include in the profile. More... | |
void | setLockAxisScales (bool lock) |
Sets whether the distance and elevation scales are locked to each other. More... | |
void | setProfileCurve (QgsCurve *curve) |
Sets the profile curve. More... | |
void | setProject (QgsProject *project) |
Sets the project associated with the profile. More... | |
void | setTolerance (double tolerance) |
Sets the profile tolerance (in crs() units). More... | |
void | setVisiblePlotRange (double minimumDistance, double maximumDistance, double minimumElevation, double maximumElevation) |
Sets the visible area of the plot. More... | |
QgsPointXY | snapToPlot (QPoint point) override |
Snap a canvas point to the plot. More... | |
QgsPointXY | toCanvasCoordinates (const QgsPoint &point) const override |
Converts a point in map coordinates to the associated canvas point. More... | |
double | tolerance () const |
Returns the tolerance of the profile (in crs() units). More... | |
QgsPoint | toMapCoordinates (const QgsPointXY &point) const override |
Converts a point on the canvas to the associated map coordinate. More... | |
QgsDoubleRange | visibleDistanceRange () const |
Returns the distance range currently visible in the plot. More... | |
QgsDoubleRange | visibleElevationRange () const |
Returns the elevation range currently visible in the plot. More... | |
void | wheelZoom (QWheelEvent *event) override |
Zoom plot from a mouse wheel event. More... | |
void | zoomToRect (const QRectF &rect) override |
Zooms the plot to the specified rect in canvas units. More... | |
Public Member Functions inherited from QgsPlotCanvas | |
QgsPlotCanvas (QWidget *parent=nullptr) | |
Constructor for QgsPlotCanvas, with the specified parent widget. More... | |
~QgsPlotCanvas () override | |
virtual void | cancelJobs () |
Cancel any rendering job, in a blocking way. More... | |
virtual void | centerPlotOn (double x, double y) |
Centers the plot on the plot point corresponding to x, y in canvas units. More... | |
virtual QgsCoordinateReferenceSystem | crs () const |
Returns the coordinate reference system (CRS) for map coordinates used by the canvas. More... | |
virtual void | panContentsBy (double dx, double dy) |
Pans the plot contents by dx, dy in canvas units. More... | |
virtual void | scalePlot (double factor) |
Scales the plot by a specified scale factor. More... | |
void | setTool (QgsPlotTool *tool) |
Sets the interactive tool currently being used on the canvas. More... | |
virtual QgsPointXY | snapToPlot (QPoint point) |
Snap a canvas point to the plot. More... | |
virtual QgsPointXY | toCanvasCoordinates (const QgsPoint &point) const |
Converts a point in map coordinates to the associated canvas point. More... | |
virtual QgsPoint | toMapCoordinates (const QgsPointXY &point) const |
Converts a point on the canvas to the associated map coordinate. More... | |
QgsPlotTool * | tool () |
Returns the currently active tool. More... | |
void | unsetTool (QgsPlotTool *tool) |
Unset the current tool. More... | |
virtual void | zoomToRect (const QRectF &rect) |
Zooms the plot to the specified rect in canvas units. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from QgsPlotCanvas | |
bool | event (QEvent *e) override |
void | keyPressEvent (QKeyEvent *e) override |
void | keyReleaseEvent (QKeyEvent *e) override |
void | mouseDoubleClickEvent (QMouseEvent *e) override |
void | mouseMoveEvent (QMouseEvent *e) override |
void | mousePressEvent (QMouseEvent *e) override |
void | mouseReleaseEvent (QMouseEvent *e) override |
void | resizeEvent (QResizeEvent *e) override |
bool | viewportEvent (QEvent *event) override |
void | wheelEvent (QWheelEvent *e) override |
virtual void | wheelZoom (QWheelEvent *event) |
Zoom plot from a mouse wheel event. More... | |
A canvas for elevation profiles.
Definition at line 46 of file qgselevationprofilecanvas.h.
PRIVATE QgsElevationProfileCanvas::QgsElevationProfileCanvas | ( | QWidget * | parent = nullptr | ) |
Constructor for QgsElevationProfileCanvas, with the specified parent widget.
Definition at line 369 of file qgselevationprofilecanvas.cpp.
|
override |
Definition at line 392 of file qgselevationprofilecanvas.cpp.
|
signal |
Emitted when the number of active background jobs changes.
|
overridevirtual |
Cancel any rendering job, in a blocking way.
Used for application closing.
Reimplemented from QgsPlotCanvas.
Definition at line 402 of file qgselevationprofilecanvas.cpp.
|
signal |
Emitted when the mouse hovers over the specified point (in canvas coordinates).
The profilePoint argument gives the hovered profile point, which may be snapped.
QgsProfilePoint QgsElevationProfileCanvas::canvasPointToPlotPoint | ( | QPointF | point | ) | const |
Converts a canvas point to the equivalent plot point.
Definition at line 977 of file qgselevationprofilecanvas.cpp.
|
overridevirtual |
Centers the plot on the plot point corresponding to x, y in canvas units.
The default implementation does nothing.
Reimplemented from QgsPlotCanvas.
Definition at line 435 of file qgselevationprofilecanvas.cpp.
|
slot |
Clears the current profile.
Definition at line 1288 of file qgselevationprofilecanvas.cpp.
|
overridevirtual |
Returns the coordinate reference system (CRS) for map coordinates used by the canvas.
May return an invalid CRS if no CRS is associated with the canvas.
Reimplemented from QgsPlotCanvas.
Definition at line 1016 of file qgselevationprofilecanvas.cpp.
Qgis::DistanceUnit QgsElevationProfileCanvas::distanceUnit | ( | ) | const |
Returns the distance unit used by the canvas.
Definition at line 568 of file qgselevationprofilecanvas.cpp.
QVector< QgsProfileIdentifyResults > QgsElevationProfileCanvas::identify | ( | const QRectF & | rect | ) |
Identify results visible within the specified plot rect.
Definition at line 1267 of file qgselevationprofilecanvas.cpp.
QVector< QgsProfileIdentifyResults > QgsElevationProfileCanvas::identify | ( | QPointF | point | ) |
Identify results visible at the specified plot point.
Definition at line 1257 of file qgselevationprofilecanvas.cpp.
void QgsElevationProfileCanvas::invalidateCurrentPlotExtent | ( | ) |
Invalidates the current plot extent, which means that the visible plot area will be recalculated and "zoom full" operation occur when the next profile generation completes.
Definition at line 819 of file qgselevationprofilecanvas.cpp.
QList< QgsMapLayer * > QgsElevationProfileCanvas::layers | ( | ) | const |
Returns the list of layers included in the profile.
Definition at line 1043 of file qgselevationprofilecanvas.cpp.
bool QgsElevationProfileCanvas::lockAxisScales | ( | ) | const |
Returns true
if the distance and elevation scales are locked to each other.
Definition at line 585 of file qgselevationprofilecanvas.cpp.
|
override |
Definition at line 738 of file qgselevationprofilecanvas.cpp.
|
override |
Definition at line 1055 of file qgselevationprofilecanvas.cpp.
|
overridevirtual |
Pans the plot contents by dx, dy in canvas units.
The default implementation does nothing.
Reimplemented from QgsPlotCanvas.
Definition at line 414 of file qgselevationprofilecanvas.cpp.
const Qgs2DPlot & QgsElevationProfileCanvas::plot | ( | ) | const |
Returns a reference to the 2D plot used by the widget.
Definition at line 1199 of file qgselevationprofilecanvas.cpp.
QRectF QgsElevationProfileCanvas::plotArea | ( | ) | const |
Returns the interior rectangle representing the surface of the plot, in canvas coordinates.
Definition at line 767 of file qgselevationprofilecanvas.cpp.
QgsPointXY QgsElevationProfileCanvas::plotPointToCanvasPoint | ( | const QgsProfilePoint & | point | ) | const |
Converts a plot point to the equivalent canvas point.
Definition at line 985 of file qgselevationprofilecanvas.cpp.
QgsCurve * QgsElevationProfileCanvas::profileCurve | ( | ) | const |
Returns the profile curve.
The CRS associated with the curve is retrieved via crs().
Definition at line 1006 of file qgselevationprofilecanvas.cpp.
|
overridevirtual |
Triggers a complete regeneration of the profile, causing the profile extraction to perform in the background.
Reimplemented from QgsPlotCanvas.
Definition at line 772 of file qgselevationprofilecanvas.cpp.
PRIVATE void QgsElevationProfileCanvas::render | ( | QgsRenderContext & | context, |
double | width, | ||
double | height, | ||
const Qgs2DPlot & | plotSettings | ||
) |
Renders a portion of the profile using the specified render context.
Definition at line 1232 of file qgselevationprofilecanvas.cpp.
|
override |
Definition at line 1048 of file qgselevationprofilecanvas.cpp.
|
overridevirtual |
Scales the plot by a specified scale factor.
The default implementation does nothing.
Reimplemented from QgsPlotCanvas.
Definition at line 458 of file qgselevationprofilecanvas.cpp.
void QgsElevationProfileCanvas::scalePlot | ( | double | xFactor, |
double | yFactor | ||
) |
Scales the plot axis by the given factors.
Definition at line 625 of file qgselevationprofilecanvas.cpp.
void QgsElevationProfileCanvas::setCrs | ( | const QgsCoordinateReferenceSystem & | crs | ) |
Sets the crs associated with the canvas' map coordinates.
Definition at line 996 of file qgselevationprofilecanvas.cpp.
void QgsElevationProfileCanvas::setDistanceUnit | ( | Qgis::DistanceUnit | unit | ) |
Sets the distance unit used by the canvas.
Definition at line 573 of file qgselevationprofilecanvas.cpp.
void QgsElevationProfileCanvas::setLayers | ( | const QList< QgsMapLayer * > & | layers | ) |
Sets the list of layers to include in the profile.
Definition at line 1021 of file qgselevationprofilecanvas.cpp.
void QgsElevationProfileCanvas::setLockAxisScales | ( | bool | lock | ) |
Sets whether the distance and elevation scales are locked to each other.
Definition at line 590 of file qgselevationprofilecanvas.cpp.
void QgsElevationProfileCanvas::setProfileCurve | ( | QgsCurve * | curve | ) |
Sets the profile curve.
The CRS associated with curve is set via setCrs().
Ownership is transferred to the plot canvas.
Definition at line 1001 of file qgselevationprofilecanvas.cpp.
void QgsElevationProfileCanvas::setProject | ( | QgsProject * | project | ) |
Sets the project associated with the profile.
This must be set before any layers which utilize terrain based elevation settings can be included in the canvas.
Definition at line 990 of file qgselevationprofilecanvas.cpp.
|
slot |
Sets whether snapping of cursor points is enabled.
Definition at line 1295 of file qgselevationprofilecanvas.cpp.
void QgsElevationProfileCanvas::setTolerance | ( | double | tolerance | ) |
Sets the profile tolerance (in crs() units).
This value determines how far from the profileCurve() is appropriate for inclusion of results. For instance, when a profile is generated for a point vector layer this tolerance distance will dictate how far from the actual profile curve a point can reside within to be included in the results.
Definition at line 1011 of file qgselevationprofilecanvas.cpp.
void QgsElevationProfileCanvas::setVisiblePlotRange | ( | double | minimumDistance, |
double | maximumDistance, | ||
double | minimumElevation, | ||
double | maximumElevation | ||
) |
Sets the visible area of the plot.
Definition at line 1173 of file qgselevationprofilecanvas.cpp.
|
overridevirtual |
Snap a canvas point to the plot.
Returns an empty point if snapping was not possible.
point | point in canvas coordinates |
Reimplemented from QgsPlotCanvas.
Definition at line 611 of file qgselevationprofilecanvas.cpp.
|
overridevirtual |
Converts a point in map coordinates to the associated canvas point.
May return an empty point if the map point cannot be converted to a canvas point.
Reimplemented from QgsPlotCanvas.
Definition at line 1090 of file qgselevationprofilecanvas.cpp.
|
inline |
Returns the tolerance of the profile (in crs() units).
This value determines how far from the profileCurve() is appropriate for inclusion of results. For instance, when a profile is generated for a point vector layer this tolerance distance will dictate how far from the actual profile curve a point can reside within to be included in the results.
Definition at line 165 of file qgselevationprofilecanvas.h.
|
overridevirtual |
Converts a point on the canvas to the associated map coordinate.
May return an empty point if the canvas point cannot be converted to a map point.
Reimplemented from QgsPlotCanvas.
Definition at line 1068 of file qgselevationprofilecanvas.cpp.
QgsDoubleRange QgsElevationProfileCanvas::visibleDistanceRange | ( | ) | const |
Returns the distance range currently visible in the plot.
Definition at line 1189 of file qgselevationprofilecanvas.cpp.
QgsDoubleRange QgsElevationProfileCanvas::visibleElevationRange | ( | ) | const |
Returns the elevation range currently visible in the plot.
Definition at line 1194 of file qgselevationprofilecanvas.cpp.
|
overridevirtual |
Zoom plot from a mouse wheel event.
The default implementation does nothing.
Reimplemented from QgsPlotCanvas.
Definition at line 682 of file qgselevationprofilecanvas.cpp.
|
slot |
Zooms to the full extent of the profile.
Definition at line 1123 of file qgselevationprofilecanvas.cpp.
|
overridevirtual |
Zooms the plot to the specified rect in canvas units.
The default implementation does nothing.
Reimplemented from QgsPlotCanvas.
Definition at line 658 of file qgselevationprofilecanvas.cpp.