18#ifndef QGSMAPRENDERERTASK_H
19#define QGSMAPRENDERERTASK_H
52 ImageAllocationFail = 1,
54 ImageUnsupportedFormat
68 const QString &fileName,
69 const QString &fileFormat = QString(
"PNG" ),
70 bool forceRaster =
false,
81 const QString &fileName,
82 const QString &fileFormat = QString(
"PNG" ),
83 bool forceRaster =
false,
98 void addAnnotations(
const QList<QgsAnnotation *> &annotations );
103 void addDecorations(
const QList<QgsMapDecoration *> &decorations );
132 void finished(
bool result )
override;
138 bool mErrored =
false;
143 std::unique_ptr< QgsMapRendererJob > mJob;
145 std::unique_ptr< QgsAbstractGeoPdfExporter > mGeoPdfExporter;
146 std::unique_ptr< QgsRenderedFeatureHandlerInterface > mRenderedFeatureHandler;
148 QPainter *mPainter =
nullptr;
149 QPainter *mDestPainter =
nullptr;
151 std::unique_ptr< QPdfWriter > mPdfWriter;
153 std::unique_ptr< QPainter > mTempPainter;
157 bool mForceRaster =
false;
158 bool mSaveWorldFile =
false;
159 bool mExportMetadata =
false;
160 bool mGeoPDF =
false;
163 QList< QgsAnnotation * > mAnnotations;
164 QList< QgsMapDecoration * > mDecorations;
165 QMap< QString, QString> mLayerIdToLayerNameMap;
166 QStringList mMapLayerOrder;
Abstract base class for GeoPDF exporters.
Job implementation that renders everything sequentially using a custom painter.
QgsTask task which draws a map to an image file or a painter as a background task.
void errorOccurred(int error)
Emitted when map rendering failed.
@ ImageSaveFail
Image save failure.
void setSaveWorldFile(bool save)
Sets whether the image file will be georeferenced (embedded or via a world file).
void setExportMetadata(bool exportMetadata)
Sets whether metadata such as title and subject will be exported whenever possible.
~QgsMapRendererTask() override
void renderingComplete()
Emitted when the map rendering is successfully completed.
The QgsMapSettings class contains configuration for rendering of the map.
Abstract base class for long running background tasks.
virtual void finished(bool result)
If the task is managed by a QgsTaskManager, this will be called after the task has finished (whether ...
virtual bool run()=0
Performs the task's operation.
virtual void cancel()
Notifies the task that it should terminate.
@ CanCancel
Task can be canceled.