![]() |
SWMMVis
6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
|
Renders raster layers into an off-screen QImage on a worker thread. More...
#include <maprenderjob.h>
Signals | |
| void | finished (QImage result) |
| Emitted on the GUI thread when rendering is complete (or cancelled). | |
Public Member Functions | |
| MapRenderJob (const QList< OpenSWMMVisLayer * > &layers, const MapExtent &extent, const QSize &imageSize, qreal devicePixelRatio, SpatialReferenceSystem *srs, const QColor &bgColor, QObject *parent=nullptr) | |
| Constructs a render job. | |
| ~MapRenderJob () override=default | |
| Destructor — non-blocking. | |
| void | start () |
| Queues the render on a QtConcurrent thread. | |
| void | cancel () |
| Signals the worker to skip remaining layers. | |
| bool | isCancelled () const |
| Returns true after cancel() has been called. | |
Renders raster layers into an off-screen QImage on a worker thread.
This class implements the QGIS-style "map render job" pattern:
Cancellation: Call cancel() to skip remaining layers; the partially-rendered image is still delivered via finished() so the canvas always has a buffer.
| MapRenderJob::MapRenderJob | ( | const QList< OpenSWMMVisLayer * > & | layers, |
| const MapExtent & | extent, | ||
| const QSize & | imageSize, | ||
| qreal | devicePixelRatio, | ||
| SpatialReferenceSystem * | srs, | ||
| const QColor & | bgColor, | ||
| QObject * | parent = nullptr |
||
| ) |
Constructs a render job.
| layers | Shallow copy of the raster-layer stack (bottom-to-top order). |
| extent | Geographic extent in canvas-CRS coordinates. |
| imageSize | Pixel dimensions of the output image. |
| srs | Canvas CRS (not owned; must outlive the job). |
| bgColor | Background fill colour for the buffer. |
| parent | Qt parent. |
|
overridedefault |
Destructor — non-blocking.
Worker thread is independent of the job's lifetime: it owns its own copies of all rendering state (snapshot taken in start()) and a shared cancel flag. The job can be deleted any time without freezing the GUI thread or risking use-after-free in the worker.
| void MapRenderJob::cancel | ( | ) |
Signals the worker to skip remaining layers.
|
signal |
Emitted on the GUI thread when rendering is complete (or cancelled).
| result | The composited raster image, sized to imageSize. |
|
inline |
Returns true after cancel() has been called.
| void MapRenderJob::start | ( | ) |
Queues the render on a QtConcurrent thread.
finished() is emitted when done. Calling start() a second time before finished() fires has no effect.