Subgroup: Map
Class: QgsMapRendererJob¶
-
class
qgis.core.
QgsMapRendererJob
¶ Bases:
PyQt5.QtCore.QObject
Abstract base class for map rendering implementations.
The API is designed in a way that rendering is done asynchronously, therefore the caller is not blocked while the rendering is in progress. Non-blocking operation is quite important because the rendering can take considerable amount of time.
Common use case: 0. prepare QgsMapSettings with rendering configuration (extent, layer, map size, …) 1. create QgsMapRendererJob subclass with QgsMapSettings instance 2. connect to job’s finished() signal 3. call start(). Map rendering will start in background, the function immediately returns 4. at some point, slot connected to finished() signal is called, map rendering is done
It is possible to cancel the rendering job while it is active by calling cancel() function.
The following subclasses are available: - QgsMapRendererSequentialJob - renders map in one background thread to an image - QgsMapRendererParallelJob - renders map in multiple background threads to an image - QgsMapRendererCustomPainterJob - renders map with given QPainter in one background thread
New in version 2.4: Methods
blockSignals
cancel
Stop the rendering job - does not return until the job has terminated. cancelWithoutBlocking
Triggers cancelation of the rendering job without blocking. childEvent
children
connectNotify
customEvent
deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
errors
List of errors that happened during the rendering job - available when the rendering has been finished event
eventFilter
featureFilterProvider
New in version 3.0.
findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] inherits
installEventFilter
isActive
Tell whether the rendering job is currently running in background. isSignalConnected
isWidgetType
isWindowType
killTimer
mapSettings
Return map settings with which this job was started. metaObject
moveToThread
objectName
parent
property
pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. receivers
removeEventFilter
renderingTime
Returns the total time it took to finish the job (in milliseconds). sender
senderSignalIndex
setCache
Assign a cache to be used for reading and storing rendered images of individual layers. setFeatureFilterProvider
New in version 3.0.
setObjectName
setParent
setProperty
signalsBlocked
start
Start the rendering job and immediately return. startTimer
takeLabelingResults
Get pointer to internal labeling engine (in order to get access to the results). thread
timerEvent
tr
usedCachedLabels
Returns true if the render job was able to use a cached labeling solution. waitForFinished
Block until the job has finished. Attributes
destroyed
destroyed(self, QObject = None) [signal] finished
emitted when asynchronous rendering is finished (or canceled). [signal] objectNameChanged
objectNameChanged(self, str) [signal] renderingLayersFinished
Emitted when the layers are rendered. staticMetaObject
-
class
Error
(lid: str, msg: str)¶ Bases:
sip.wrapper
QgsMapRendererJob.Error(QgsMapRendererJob.Error)
-
layerID
¶
-
message
¶
-
-
cancel
(self)¶ Stop the rendering job - does not return until the job has terminated. Does nothing if the rendering is not active.
-
cancelWithoutBlocking
(self)¶ Triggers cancelation of the rendering job without blocking. The render job will continue to operate until it is able to cancel, at which stage the finished() signal will be emitted. Does nothing if the rendering is not active.
-
childEvent
()¶
-
connectNotify
()¶
-
customEvent
()¶
-
disconnectNotify
()¶
-
errors
(self) → object¶ List of errors that happened during the rendering job - available when the rendering has been finished
-
featureFilterProvider
(self) → QgsFeatureFilterProvider¶ New in version 3.0.
Returns the feature filter provider used by the QgsRenderContext of each LayerRenderJob.
-
finished
¶ emitted when asynchronous rendering is finished (or canceled). [signal]
-
isActive
(self) → bool¶ Tell whether the rendering job is currently running in background.
-
isSignalConnected
()¶
-
mapSettings
(self) → QgsMapSettings¶ Return map settings with which this job was started.
Returns: A QgsMapSettings instance with render settings New in version 2.8.
-
receivers
()¶
-
renderingLayersFinished
¶ Emitted when the layers are rendered. Rendering labels is not yet done. If the fully rendered layer including labels is required use finished() instead.
New in version 3.0: [signal]
-
renderingTime
(self) → int¶ Returns the total time it took to finish the job (in milliseconds).
See also
perLayerRenderingTime()
-
sender
()¶
-
senderSignalIndex
()¶
-
setCache
(self, cache: QgsMapRendererCache)¶ Assign a cache to be used for reading and storing rendered images of individual layers. Does not take ownership of the object.
-
setFeatureFilterProvider
(self, f: QgsFeatureFilterProvider)¶ New in version 3.0.
Set the feature filter provider used by the QgsRenderContext of each LayerRenderJob. Ownership is not transferred and the provider must not be deleted before the render job.
-
start
(self)¶ Start the rendering job and immediately return. Does nothing if the rendering is already in progress.
-
takeLabelingResults
(self) → QgsLabelingResults¶ Get pointer to internal labeling engine (in order to get access to the results). This should not be used if cached labeling was redrawn - see usedCachedLabels().
See also
-
timerEvent
()¶
-
usedCachedLabels
(self) → bool¶ Returns true if the render job was able to use a cached labeling solution. If so, any previously stored labeling results (see takeLabelingResults()) should be retained.
See also
New in version 3.0.
-
waitForFinished
(self)¶ Block until the job has finished.
-
class