16 #ifndef QGSLAYOUTEXPORTER_H 17 #define QGSLAYOUTEXPORTER_H 19 #include "qgis_core.h" 85 void renderPage( QPainter *painter,
int page )
const;
105 QImage renderPageToImage(
int page, QSize imageSize = QSize(),
double dpi = -1 )
const;
114 void renderRegion( QPainter *painter,
const QRectF ®ion )
const;
132 QImage renderRegionToImage(
const QRectF ®ion, QSize imageSize = QSize(),
double dpi = -1 )
const;
176 bool cropToContents =
false;
197 bool generateWorldFile =
false;
205 bool exportMetadata =
true;
211 QgsLayoutRenderContext::Flags flags =
nullptr;
266 bool rasterizeWholeImage =
false;
275 bool forceVectorOutput =
false;
282 bool appendGeoreference =
true;
290 bool exportMetadata =
true;
295 QgsLayoutRenderContext::Flags flags =
nullptr;
311 bool simplifyGeometries =
true;
324 bool writeGeoPdf =
false;
334 bool useIso32000ExtensionFormatGeoreferencing =
true;
345 bool useOgcBestPracticeFormatGeoreferencing =
false;
352 bool includeGeoPdfFeatures =
true;
429 bool rasterizeWholeImage =
false;
434 QgsLayoutRenderContext::Flags flags =
nullptr;
483 bool forceVectorOutput =
false;
489 bool cropToContents =
false;
502 bool exportAsLayers =
false;
512 bool exportLabelsToSeparateLayers =
true;
520 bool exportMetadata =
true;
525 QgsLayoutRenderContext::Flags flags =
nullptr;
541 bool simplifyGeometries =
true;
595 bool georeferenceOutput(
const QString &file,
QgsLayoutItemMap *referenceMap =
nullptr,
596 const QRectF &exportRegion = QRectF(),
double dpi = -1 )
const;
604 void computeWorldFileParameters(
double &a,
double &b,
double &
c,
double &d,
double &e,
double &f,
double dpi = -1 )
const;
611 void computeWorldFileParameters(
const QRectF ®ion,
double &a,
double &b,
double &c,
double &d,
double &e,
double &f,
double dpi = -1 )
const;
624 QPointer< QgsLayout > mLayout;
626 mutable QString mErrorFileName;
628 QImage createImage(
const ImageExportSettings &settings,
int page, QRectF &bounds,
bool &skipPage )
const;
634 static int firstPageToBeExported(
QgsLayout *layout );
639 static bool saveImage(
const QImage &image,
const QString &imageFilename,
const QString &imageFormat,
QgsProject *projectForMetadata );
654 std::unique_ptr<double[]> computeGeoTransform(
const QgsLayoutItemMap *referenceMap =
nullptr,
const QRectF &exportRegion = QRectF(),
double dpi = -1 )
const;
657 void writeWorldFile(
const QString &fileName,
double a,
double b,
double c,
double d,
double e,
double f )
const;
662 static void preparePrintAsPdf(
QgsLayout *layout, QPrinter &printer,
const QString &filePath );
664 static void preparePrint(
QgsLayout *layout, QPrinter &printer,
bool setFirstPageSize =
false );
679 ExportResult printPrivate( QPrinter &printer, QPainter &painter,
bool startNewPage =
false,
double dpi = -1,
bool rasterize =
false );
681 static void updatePrinterPageSize(
QgsLayout *layout, QPrinter &printer,
int page );
684 const QString &filename,
unsigned int svgLayerId,
const QString &layerName,
685 QDomDocument &svg, QDomNode &svgDocRoot,
bool includeMetadata )
const;
687 void appendMetadataToSvg( QDomDocument &svg )
const;
689 bool georeferenceOutputPrivate(
const QString &file,
QgsLayoutItemMap *referenceMap =
nullptr,
690 const QRectF &exportRegion = QRectF(),
double dpi = -1,
bool includeGeoreference =
true,
bool includeMetadata =
false )
const;
695 friend class TestQgsLayout;
696 friend class TestQgsLayoutExporter;
700 #endif // ! QT_NO_PRINTER 702 #endif //QGSLAYOUTEXPORTER_H
Contains settings relating to printing layouts.
QgsMargins cropMargins
Crop to content margins, in layout units.
Unable to allocate memory required to export.
Could not write to destination file, likely due to a lock held by another application.
QString errorFile() const
Returns the file name corresponding to the last error encountered during an export.
QgsMargins cropMargins
Crop to content margins, in pixels.
QVector< qreal > predefinedMapScales
A list of predefined scales to use with the layout.
QList< int > pages
List of specific pages to export, or an empty list to export all pages.
QString directory
Target folder.
Base class for feedback objects to be used for cancellation of something running in a worker thread...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Contains details of a page being exported by the class.
QSize imageSize
Manual size in pixels for output image.
Layout graphical items for displaying a map.
An abstract base class for QgsLayout based classes which can be exported by QgsLayoutExporter.
Always render text using path objects (AKA outlines/curves).
QString extension
File suffix/extension (without the leading '.')
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
QString baseName
Base part of filename (i.e. file name without extension or '.')
Could not create layered SVG file.
ImageExportSettings()
Constructor for ImageExportSettings.
QStringList exportThemes
Optional list of map themes to export as GeoPDF layer groups.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
TextRenderFormat
Options for rendering text.
PrintExportSettings()
Constructor for PrintExportSettings.
PdfExportSettings()
Constructor for PdfExportSettings.
SvgExportSettings()
Constructor for SvgExportSettings.
Handles rendering and exports of layouts to various formats.
Contains settings relating to exporting layouts to PDF.
This class contains information how to simplify geometries fetched from a vector layer.
Contains settings relating to exporting layouts to raster images.
Stores information relating to the current rendering settings for a layout.
QVector< qreal > predefinedMapScales
A list of predefined scales to use with the layout.
QVector< qreal > predefinedMapScales
A list of predefined scales to use with the layout.
Could not start printing to destination device.
QVector< qreal > predefinedMapScales
A list of predefined scales to use with the layout.
Contains details of a particular export layer relating to a layout item.
Contains settings relating to exporting layouts to SVG.
The QgsMargins class defines the four margins of a rectangle.
ExportResult
Result codes for exporting layouts.
Error iterating over layout.