18#ifndef QGSMAPRENDERERTASK_H
19#define QGSMAPRENDERERTASK_H
70 const QString &fileName,
71 const QString &fileFormat = QString(
"PNG" ),
72 bool forceRaster =
false,
83 const QString &fileName,
84 const QString &fileFormat = QString(
"PNG" ),
85 bool forceRaster =
false,
105 void addDecorations(
const QList<QgsMapDecoration *> &decorations );
134 void finished(
bool result )
override;
140 bool mErrored =
false;
145 std::unique_ptr< QgsMapRendererJob > mJob;
147 std::unique_ptr< QgsAbstractGeospatialPdfExporter > mGeospatialPdfExporter;
148 std::unique_ptr< QgsRenderedFeatureHandlerInterface > mRenderedFeatureHandler;
150 QPainter *mPainter =
nullptr;
151 QPainter *mDestPainter =
nullptr;
153 std::unique_ptr< QPdfWriter > mPdfWriter;
155 std::unique_ptr< QPainter > mTempPainter;
159 bool mForceRaster =
false;
160 bool mSaveWorldFile =
false;
161 bool mExportMetadata =
false;
162 bool mGeospatialPDF =
false;
165 QList< QgsAnnotation * > mAnnotations;
166 QList< QgsMapDecoration * > mDecorations;
167 QMap< QString, QString> mLayerIdToLayerNameMap;
168 QStringList mMapLayerOrder;
Abstract base class for Geospatial PDF 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 addDecorations(const QList< QgsMapDecoration * > &decorations)
Adds decorations to be rendered on the map.
void errorOccurred(int error)
Emitted when map rendering failed.
@ ImageUnsupportedFormat
Format is unsupported on the platform.
@ ImageSaveFail
Image save failure.
@ ImageAllocationFail
Image allocation 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(const QgsMapSettings &ms, const QString &fileName, const QString &fileFormat=QString("PNG"), bool forceRaster=false, QgsTask::Flags flags=QgsTask::CanCancel, bool geospatialPdf=false, const QgsAbstractGeospatialPdfExporter::ExportDetails &geospatialPdfExportDetails=QgsAbstractGeospatialPdfExporter::ExportDetails())
Constructor for QgsMapRendererTask to render a map to an image file.
void addAnnotations(const QList< QgsAnnotation * > &annotations)
Adds annotations to be rendered on the map.
~QgsMapRendererTask() override
void renderingComplete()
Emitted when the map rendering is successfully completed.
Contains configuration for rendering maps.
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.
QgsTask(const QString &description=QString(), QgsTask::Flags flags=AllFlags)
Constructor for QgsTask.
@ CanCancel
Task can be canceled.