Class: QgsElevationProfileCanvas

class qgis.gui.QgsElevationProfileCanvas

Bases: QgsPlotCanvas

A canvas for elevation profiles.

New in version 3.26.

QgsElevationProfileCanvas(parent: QWidget = None) Constructor for QgsElevationProfileCanvas, with the specified parent widget.

Methods

actionEvent

canvasPointToPlotPoint

Converts a canvas point to the equivalent plot point.

centerPlotOn

param x

changeEvent

childEvent

clear

Clears the current profile.

closeEvent

connectNotify

contextMenuEvent

create

crs

rtype

QgsCoordinateReferenceSystem

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

drawBackground

drawForeground

drawFrame

dropEvent

enterEvent

event

eventFilter

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

identify

Identify results visible at the specified plot point.

initPainter

initStyleOption

inputMethodEvent

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.

isSignalConnected

keyPressEvent

keyReleaseEvent

layers

Returns the list of layers included in the profile.

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

param e

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

param event

panContentsBy

param dx

plotArea

Returns the interior rectangle representing the surface of the plot, in canvas coordinates.

plotPointToCanvasPoint

Converts a plot point to the equivalent canvas point.

profileCurve

Returns the profile curve.

receivers

refresh

Triggers a complete regeneration of the profile, causing the profile extraction to perform in the background.

render

Renders a portion of the profile using the specified render context.

resizeEvent

param event

scalePlot

scalePlot(self, xFactor: float, yFactor: float) Scales the plot axis by the given factors.

scrollContentsBy

sender

senderSignalIndex

setCrs

Sets the crs associated with the canvas' map coordinates.

setLayers

Sets the list of layers to include in the profile.

setProfileCurve

Sets the profile curve.

setProject

Sets the project associated with the profile.

setSnappingEnabled

Sets whether snapping of cursor points is enabled.

setTolerance

Sets the profile tolerance (in crs() units).

setViewportMargins

setVisiblePlotRange

Sets the visible area of the plot.

setupViewport

sharedPainter

showEvent

snapToPlot

param point

tabletEvent

timerEvent

toCanvasCoordinates

param point

toMapCoordinates

param point

tolerance

Returns the tolerance of the profile (in crs() units).

updateMicroFocus

viewportEvent

viewportMargins

viewportSizeHint

visibleDistanceRange

Returns the distance range currently visible in the plot.

visibleElevationRange

Returns the elevation range currently visible in the plot.

wheelEvent

wheelZoom

param event

zoomFull

Zooms to the full extent of the profile.

zoomToRect

param rect

Signals

activeJobCountChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

canvasPointHovered

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

actionEvent(self, QActionEvent)
activeJobCountChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL

canvasPointHovered

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL

canvasPointToPlotPoint(self, point: Union[QPointF, QPoint]) QgsProfilePoint

Converts a canvas point to the equivalent plot point.

Parameters

point (Union[QPointF) –

Return type

QgsProfilePoint

centerPlotOn(self, x: float, y: float)
Parameters
  • x (float) –

  • y (float) –

changeEvent(self, QEvent)
childEvent(self, QChildEvent)
clear(self)

Clears the current profile.

closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
crs(self) QgsCoordinateReferenceSystem
Return type

QgsCoordinateReferenceSystem

customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
drawBackground(self, QPainter, QRectF)
drawForeground(self, QPainter, QRectF)
drawFrame(self, QPainter)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, e: QEvent) bool
eventFilter(self, QObject, QEvent) bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, QHideEvent)
identify(self, point: Union[QPointF, QPoint]) List[QgsProfileIdentifyResults]

Identify results visible at the specified plot point.

identify(self, rect: QRectF) -> List[QgsProfileIdentifyResults] Identify results visible within the specified plot rect.

Parameters

point (Union[QPointF) –

Return type

List[QgsProfileIdentifyResults]

initPainter(self, QPainter)
initStyleOption(self, QStyleOptionFrame)
inputMethodEvent(self, QInputMethodEvent)
invalidateCurrentPlotExtent(self)

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.

isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, e: QKeyEvent)
keyReleaseEvent(self, e: QKeyEvent)
layers(self) List[QgsMapLayer]

Returns the list of layers included in the profile.

See also

setLayers()

Return type

List[QgsMapLayer]

leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, e: QMouseEvent)
mouseMoveEvent(self, e: QMouseEvent)
Parameters

e (QMouseEvent) –

mousePressEvent(self, e: QMouseEvent)
mouseReleaseEvent(self, e: QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int]
paintEvent(self, event: QPaintEvent)
Parameters

event (QPaintEvent) –

panContentsBy(self, dx: float, dy: float)
Parameters
  • dx (float) –

  • dy (float) –

plotArea(self) QRectF

Returns the interior rectangle representing the surface of the plot, in canvas coordinates.

Return type

QRectF

plotPointToCanvasPoint(self, point: QgsProfilePoint) QgsPointXY

Converts a plot point to the equivalent canvas point.

Parameters

point (QgsProfilePoint) –

Return type

QgsPointXY

profileCurve(self) QgsCurve

Returns the profile curve.

The CRS associated with the curve is retrieved via crs().

Return type

QgsCurve

receivers(self, PYQT_SIGNAL) int
refresh(self)

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: Qgs2DPlot)

Renders a portion of the profile using the specified render context.

Parameters
resizeEvent(self, event: QResizeEvent)
Parameters

event (QResizeEvent) –

scalePlot(self, factor: float)

scalePlot(self, xFactor: float, yFactor: float) Scales the plot axis by the given factors.

Parameters

factor (float) –

QgsElevationProfileCanvas.scrollContentsBy(self, int, int)
sender(self) QObject
senderSignalIndex(self) int
setCrs(self, crs: QgsCoordinateReferenceSystem)

Sets the crs associated with the canvas’ map coordinates.

See also

crs()

Parameters

crs (QgsCoordinateReferenceSystem) –

setLayers(self, layers: Iterable[QgsMapLayer])

Sets the list of layers to include in the profile.

See also

layers()

Parameters

layers (Iterable[QgsMapLayer]) –

setProfileCurve(self, curve: QgsCurve)

Sets the profile curve.

The CRS associated with curve is set via setCrs().

Ownership is transferred to the plot canvas.

See also

profileCurve()

Parameters

curve (QgsCurve) –

setProject(self, project: QgsProject)

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 (QgsProject) –

setSnappingEnabled(self, enabled: bool)

Sets whether snapping of cursor points is enabled.

Parameters

enabled (bool) –

setTolerance(self, tolerance: float)

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

tolerance()

Parameters

tolerance (float) –

QgsElevationProfileCanvas.setViewportMargins(self, int, int, int, int)
setViewportMargins(self, QMargins) None
setVisiblePlotRange(self, minimumDistance: float, maximumDistance: float, minimumElevation: float, maximumElevation: float)

Sets the visible area of the plot.

Parameters
  • minimumDistance (float) –

  • maximumDistance (float) –

  • minimumElevation (float) –

  • maximumElevation (float) –

setupViewport(self, QWidget)
sharedPainter(self) QPainter
showEvent(self, QShowEvent)
snapToPlot(self, point: QPoint) QgsPointXY
Parameters

point (QPoint) –

Return type

QgsPointXY

tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
toCanvasCoordinates(self, point: QgsPoint) QgsPointXY
Parameters

point (QgsPoint) –

Return type

QgsPointXY

toMapCoordinates(self, point: QgsPointXY) QgsPoint
Parameters

point (QgsPointXY) –

Return type

QgsPoint

tolerance(self) float

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

setTolerance()

Return type

float

updateMicroFocus(self)
viewportEvent(self, event: QEvent) bool
viewportMargins(self) QMargins
viewportSizeHint(self) QSize
visibleDistanceRange(self) QgsDoubleRange

Returns the distance range currently visible in the plot.

Return type

QgsDoubleRange

visibleElevationRange(self) QgsDoubleRange

Returns the elevation range currently visible in the plot.

Return type

QgsDoubleRange

wheelEvent(self, e: QWheelEvent)
wheelZoom(self, event: QWheelEvent)
Parameters

event (QWheelEvent) –

zoomFull(self)

Zooms to the full extent of the profile.

zoomToRect(self, rect: QRectF)
Parameters

rect (QRectF) –