Class: QgsElevationProfileCanvas¶
A canvas for elevation profiles.
Added in version 3.26.
Class Hierarchy¶
Base classes¶
Plot canvas is a class for displaying interactive 2d charts and plots. |
|
Methods
Returns the current ratio of horizontal (distance) to vertical (elevation) scale for the plot. |
|
Converts a canvas point to the equivalent plot point. |
|
Clears the current profile. |
|
Returns the distance unit used by the canvas. |
|
Identify results visible at the specified plot point. |
|
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. |
|
Returns the list of layers included in the profile. |
|
Returns |
|
Returns the interior rectangle representing the surface of the plot, in canvas coordinates. |
|
Converts a plot point to the equivalent canvas point. |
|
Returns the profile curve. |
|
Renders a portion of the profile using the specified render context. |
|
Sets the ratio of horizontal (distance) to vertical (elevation) scale for the plot. |
|
Sets the background color to use for the profile canvas. |
|
Sets the crs associated with the canvas' map coordinates. |
|
Sets the distance unit used by the canvas. |
|
Sets the list of layers to include in the profile. |
|
Sets whether the distance and elevation scales are locked to each other. |
|
Sets the profile curve. |
|
Sets the project associated with the profile. |
|
Sets whether snapping of cursor points is enabled. |
|
Sets the symbol used to draw the subsections. |
|
Sets the profile tolerance (in |
|
Sets the visible area of the plot. |
|
Returns the symbol used to draw the subsections. |
|
Returns the tolerance of the profile (in |
|
Returns the distance range currently visible in the plot. |
|
Returns the elevation range currently visible in the plot. |
|
Zooms to the full extent of the profile. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsElevationProfileCanvas. See the FAQ for more details.
Triggers a complete regeneration of the profile, causing the profile extraction to perform in the background. |
|
Signals
Emitted when the number of active background jobs changes. |
|
Emitted when the mouse hovers over the specified point (in canvas coordinates). |
|
Emitted when the plot scale is changed. |
- class qgis.gui.QgsElevationProfileCanvas[source]¶
Bases:
QgsPlotCanvas
- __init__(parent: QWidget | None = None)
Constructor for QgsElevationProfileCanvas, with the specified
parent
widget.- Parameters:
parent (Optional[QWidget] = None)
- signal activeJobCountChanged(count: int)[source]¶
Emitted when the number of active background jobs changes.
- Parameters:
count (int)
- axisScaleRatio(self) float [source]¶
Returns the current ratio of horizontal (distance) to vertical (elevation) scale for the plot.
See also
Added in version 4.0.
- Return type:
float
- signal canvasPointHovered(point: QgsPointXY, profilePoint: QgsProfilePoint)[source]¶
Emitted when the mouse hovers over the specified point (in canvas coordinates).
The
profilePoint
argument gives the hovered profile point, which may be snapped.- Parameters:
point (QgsPointXY)
profilePoint (QgsProfilePoint)
- canvasPointToPlotPoint(self, point: QPointF | QPoint) QgsProfilePoint [source]¶
Converts a canvas point to the equivalent plot point.
See also
- Parameters:
point (Union[QPointF, QPoint])
- Return type:
- distanceUnit(self) Qgis.DistanceUnit [source]¶
Returns the distance unit used by the canvas.
See also
Added in version 3.32.
- Return type:
- identify(self, point: QPointF | QPoint) List[QgsProfileIdentifyResults] ¶
Identify results visible at the specified plot point.
- Parameters:
point (Union[QPointF, QPoint])
- Return type:
- identify(self, rect: QRectF) List[QgsProfileIdentifyResults]
Identify results visible within the specified plot rect.
- Parameters:
rect (QRectF)
- Return type:
- invalidateCurrentPlotExtent(self)[source]¶
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.
- layers(self) List[QgsMapLayer] ¶
Returns the list of layers included in the profile.
See also
- Return type:
List[QgsMapLayer]
- lockAxisScales(self) bool [source]¶
Returns
True
if the distance and elevation scales are locked to each other.See also
Added in version 3.32.
- Return type:
bool
- plotArea(self) QRectF [source]¶
Returns the interior rectangle representing the surface of the plot, in canvas coordinates.
- Return type:
QRectF
- plotPointToCanvasPoint(self, point: QgsProfilePoint) QgsPointXY [source]¶
Converts a plot point to the equivalent canvas point.
See also
- Parameters:
point (QgsProfilePoint)
- Return type:
- profileCurve(self) QgsCurve | None [source]¶
Returns the profile curve.
The CRS associated with the curve is retrieved via
crs()
.See also
- Return type:
Optional[QgsCurve]
- virtual refresh(self)[source]¶
Triggers a complete regeneration of the profile, causing the profile extraction to perform in the background.
- render(self, context: QgsRenderContext, width: float, height: float, plotSettings: Qgs2DXyPlot)[source]¶
Renders a portion of the profile using the specified render
context
.- Parameters:
context (QgsRenderContext)
width (float)
height (float)
plotSettings (Qgs2DXyPlot)
- virtual scalePlot(self, xFactor: float, yFactor: float)[source]
Scales the plot axis by the given factors.
- Parameters:
xFactor (float)
yFactor (float)
- setAxisScaleRatio(self, scale: float)[source]¶
Sets the ratio of horizontal (distance) to vertical (elevation) scale for the plot.
E.g. a
scale
of 3 indicates a ratio of 3:1 for distance vs elevation, whereas a scale of 0.3333 indicates a ratio of 1:3 for distance vs elevation.This will immediately update the visible plot area to match the specified scale.
See also
See also
Added in version 4.0.
- Parameters:
scale (float)
- setBackgroundColor(self, color: QColor | Qt.GlobalColor)[source]¶
Sets the background
color
to use for the profile canvas.The chart text, border and axis color will be automatically updated to ensure readability with the new background color.
Added in version 3.34.
- Parameters:
color (Union[QColor, Qt.GlobalColor])
- setCrs(self, crs: QgsCoordinateReferenceSystem)[source]¶
Sets the
crs
associated with the canvas’ map coordinates.See also
crs()
- Parameters:
- setDistanceUnit(self, unit: Qgis.DistanceUnit)[source]¶
Sets the distance
unit
used by the canvas.See also
Added in version 3.32.
- Parameters:
unit (Qgis.DistanceUnit)
- setLayers(self, layers: Iterable[QgsMapLayer])[source]¶
Sets the list of
layers
to include in the profile.See also
- Parameters:
layers (Iterable[QgsMapLayer])
- setLockAxisScales(self, lock: bool)[source]¶
Sets whether the distance and elevation scales are locked to each other.
See also
Added in version 3.32.
- Parameters:
lock (bool)
- setProfileCurve(self, curve: QgsCurve | None)[source]¶
Sets the profile
curve
.The CRS associated with
curve
is set viasetCrs()
.Ownership is transferred to the plot canvas.
See also
- Parameters:
curve (Optional[QgsCurve])
- setProject(self, project: QgsProject | None)[source]¶
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.
- Parameters:
project (Optional[QgsProject])
- setSnappingEnabled(self, enabled: bool)[source]¶
Sets whether snapping of cursor points is enabled.
- Parameters:
enabled (bool)
- setSubsectionsSymbol(self, symbol: QgsLineSymbol | None)[source]¶
Sets the
symbol
used to draw the subsections. Ifsymbol
isNone
, the subsections are not drawn. Ownership ofsymbol
is transferred.See also
Added in version 3.44.
- Parameters:
symbol (Optional[QgsLineSymbol])
- setTolerance(self, tolerance: float)[source]¶
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.See also
- Parameters:
tolerance (float)
- setVisiblePlotRange(self, minimumDistance: float, maximumDistance: float, minimumElevation: float, maximumElevation: float)[source]¶
Sets the visible area of the plot.
See also
See also
- Parameters:
minimumDistance (float)
maximumDistance (float)
minimumElevation (float)
maximumElevation (float)
- subsectionsSymbol(self) QgsLineSymbol | None [source]¶
Returns the symbol used to draw the subsections.
See also
Added in version 3.44.
- Return type:
Optional[QgsLineSymbol]
- tolerance(self) float [source]¶
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.See also
- Return type:
float
- visibleDistanceRange(self) QgsDoubleRange [source]¶
Returns the distance range currently visible in the plot.
See also
See also
- Return type:
- visibleElevationRange(self) QgsDoubleRange [source]¶
Returns the elevation range currently visible in the plot.
See also
See also
- Return type: