Class: QgsProfileExporterTask¶
- class qgis.core.QgsProfileExporterTask¶
Bases:
QgsTask
Handles exports of elevation profiles in various formats in a background task.
New in version 3.32.
QgsProfileExporterTask(sources: Iterable[QgsAbstractProfileSource], request:
QgsProfileRequest
, type: Qgis.ProfileExportType, destination: str, transformContext:QgsCoordinateTransformContext
) Constructor forQgsProfileExporterTask
, saving results to the specifieddestination
file.If
destination
is an empty string then the profile results will be generated only and can be retrieved by callingtakeLayers()
.Enums
Bases:
enum.IntEnum
Methods
Returns a list of layer files created during the export.
Returns a descriptive error message, if available.
If the task is managed by a
QgsTaskManager
, this will be called after the task has finished (whether through successful completion or via early termination).Will return
True
if task should terminate ASAP.Returns the result of the export operation.
- rtype:
bool
Sets the task's current progress.
Returns a list of vector layer containing the exported profile results.
- class ExportResult(value)¶
Bases:
enum.IntEnum
Results of exporting the profile.
Success
: Successful exportEmpty
: Results were emptyDeviceError
: Could not open output file deviceDxfExportFailed
: Generic error when outputting to DXFLayerExportFailed
: Generic error when outputting to filesCanceled
: Export was canceled
- Canceled = 5¶
- DeviceError = 2¶
- DxfExportFailed = 3¶
- Empty = 1¶
- LayerExportFailed = 4¶
- Success = 0¶
- baseClass¶
alias of
QgsProfileExporterTask
- cancel(self)¶
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- createdFiles(self) List[str] ¶
Returns a list of layer files created during the export.
- Return type:
List[str]
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- error(self) str ¶
Returns a descriptive error message, if available.
- Return type:
str
- finished(self, result: bool)¶
If the task is managed by a
QgsTaskManager
, this will be called after the task has finished (whether through successful completion or via early termination). The result argument reflects whether the task was successfully completed or not. This method is always called from the main thread, so it is safe to create widgets and perform other operations which require the main thread. However, the GUI will be blocked for the duration of this method so tasks should avoid performing any lengthy operations here.
- isCanceled(self) bool ¶
Will return
True
if task should terminate ASAP. If the task reports the CanCancel flag, then derived classes’run()
methods should periodically check this and terminate in a safe manner.
- isSignalConnected(self, QMetaMethod) bool ¶
- receivers(self, PYQT_SIGNAL) int ¶
- result(self) QgsProfileExporterTask.ExportResult ¶
Returns the result of the export operation.
See also
- Return type:
- run(self) bool ¶
- Return type:
bool
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setProgress(self, progress: float)¶
Sets the task’s current progress. The derived class should call this method whenever the task wants to update its progress. Calling will automatically emit the progressChanged signal.
- Parameters:
progress – percent of progress, from 0.0 - 100.0
- takeLayers(self) List[QgsVectorLayer] ¶
Returns a list of vector layer containing the exported profile results.
While this method attempts to condense all results into a single layer, multiple layers may be returned when the geometry types of exported features differs.
Ownership of the returned layers is transferred to the caller.
- Return type:
List[QgsVectorLayer]
- timerEvent(self, QTimerEvent)¶