QGIS API Documentation 4.1.0-Master (376402f9aeb)
Loading...
Searching...
No Matches
QgsLayoutGeospatialPdfExporter Class Reference

Handles geospatial PDF export specific setup, cleanup and processing steps. More...

#include <qgslayoutgeopdfexporter.h>

Inheritance diagram for QgsLayoutGeospatialPdfExporter:

Public Member Functions

 QgsLayoutGeospatialPdfExporter (QgsLayout *layout)
 Constructor for QgsLayoutGeospatialPdfExporter, associated with the specified layout.
 ~QgsLayoutGeospatialPdfExporter () override
QMap< QString, QString > customLayerTreeGroups () const
 Returns any custom layer tree groups defined in the layer's settings.
QMap< QString, bool > initialLayerVisibility () const
 Optional map of map layer ID to initial visibility state.
QStringList layerOrder () const
 Optional list of map layer IDs in the order they should be shown in the generated geospatial PDF layer tree.
QStringList layerTreeGroupOrder () const
 Specifies the ordering of layer tree groups in the generated geospatial PDF file.
void restoreMapItemLayersAfterRendering ()
 Restores map item layers after a rendering operation for Geospatial PDFs that follow QGIS layer tree configuration.
bool setMapItemLayersBeforeRendering ()
 Sets QGIS project layers (including invisible ones) to layout item maps before rendering.
Public Member Functions inherited from QgsAbstractGeospatialPdfExporter
 QgsAbstractGeospatialPdfExporter ()=default
virtual ~QgsAbstractGeospatialPdfExporter ()=default
QString errorMessage () const
 Returns the last error message encountered during the export.
bool finalize (const QList< QgsAbstractGeospatialPdfExporter::ComponentLayerDetail > &components, const QString &destinationFile, const ExportDetails &details)
 To be called after the rendering operation is complete.
QString generateTemporaryFilepath (const QString &filename) const
 Returns a file path to use for temporary files required for Geospatial PDF creation.
void pushRenderedFeature (const QString &layerId, const QgsAbstractGeospatialPdfExporter::RenderedFeature &feature, const QString &group=QString())
 Called multiple times during the rendering operation, whenever a feature associated with the specified layerId is rendered.

Friends

class TestQgsLayoutGeospatialPdfExport

Additional Inherited Members

Static Public Member Functions inherited from QgsAbstractGeospatialPdfExporter
static bool compositionModeSupported (QPainter::CompositionMode mode)
 Returns true if the specified composition mode is supported for layers during Geospatial PDF exports.
static QString geospatialPDFAvailabilityExplanation ()
 Returns a user-friendly, translated string explaining why Geospatial PDF export support is not available on the current QGIS build (or an empty string if Geospatial PDF support IS available).
static bool geospatialPDFCreationAvailable ()
 Returns true if the current QGIS build is capable of Geospatial PDF support.
Static Protected Attributes inherited from QgsAbstractGeospatialPdfExporter
static constexpr double DPI_72 = 72
 Hardcode DPI of 72 to get correct page sizes in outputs.

Detailed Description

Handles geospatial PDF export specific setup, cleanup and processing steps.

This class is a low level implementation detail only. Generally, you should use the high level interface exposed by QgsLayoutExporter instead.

Warning
QgsLayoutGeospatialPdfExporter is designed to be a short lived object. It should be created for a single layout export operation only, and then immediately destroyed. Failure to correctly destroy the object after exporting a layout will leave the layout in an inconsistent, unstable state.
Note
Not available in Python bindings
Since
QGIS 3.10

Definition at line 48 of file qgslayoutgeopdfexporter.h.

Constructor & Destructor Documentation

◆ QgsLayoutGeospatialPdfExporter()

QgsLayoutGeospatialPdfExporter::QgsLayoutGeospatialPdfExporter ( QgsLayout * layout)

Constructor for QgsLayoutGeospatialPdfExporter, associated with the specified layout.

Definition at line 107 of file qgslayoutgeopdfexporter.cpp.

◆ ~QgsLayoutGeospatialPdfExporter()

QgsLayoutGeospatialPdfExporter::~QgsLayoutGeospatialPdfExporter ( )
override

Definition at line 169 of file qgslayoutgeopdfexporter.cpp.

Member Function Documentation

◆ customLayerTreeGroups()

QMap< QString, QString > QgsLayoutGeospatialPdfExporter::customLayerTreeGroups ( ) const
inline

Returns any custom layer tree groups defined in the layer's settings.

See also
layerTreeGroupOrder()

Definition at line 63 of file qgslayoutgeopdfexporter.h.

◆ initialLayerVisibility()

QMap< QString, bool > QgsLayoutGeospatialPdfExporter::initialLayerVisibility ( ) const
inline

Optional map of map layer ID to initial visibility state.

If a layer ID is not present in this, it will default to being initially visible when opening the PDF.

Since
QGIS 3.14

Definition at line 71 of file qgslayoutgeopdfexporter.h.

◆ layerOrder()

QStringList QgsLayoutGeospatialPdfExporter::layerOrder ( ) const
inline

Optional list of map layer IDs in the order they should be shown in the generated geospatial PDF layer tree.

Layer IDs earlier in the list will appear higher in the geospatial PDF layer tree.

See also
layerTreeGroupOrder()
Since
QGIS 3.14

Definition at line 80 of file qgslayoutgeopdfexporter.h.

◆ layerTreeGroupOrder()

QStringList QgsLayoutGeospatialPdfExporter::layerTreeGroupOrder ( ) const
inline

Specifies the ordering of layer tree groups in the generated geospatial PDF file.

Groups appearing earlier in the list will show earlier in the geospatial PDF layer tree list.

See also
layerOrder()
customLayerTreeGroups()
Since
QGIS 3.38

Definition at line 92 of file qgslayoutgeopdfexporter.h.

◆ restoreMapItemLayersAfterRendering()

void QgsLayoutGeospatialPdfExporter::restoreMapItemLayersAfterRendering ( )

Restores map item layers after a rendering operation for Geospatial PDFs that follow QGIS layer tree configuration.

See also
setMapItemLayersBeforeRendering()
Since
QGIS 4.2

Definition at line 220 of file qgslayoutgeopdfexporter.cpp.

◆ setMapItemLayersBeforeRendering()

bool QgsLayoutGeospatialPdfExporter::setMapItemLayersBeforeRendering ( )

Sets QGIS project layers (including invisible ones) to layout item maps before rendering.

Only map items that do not follow map themes nor locked layers are altered.

Used by Geospatial PDF exports that should follow QGIS layer tree configuration.

Returns
whether at least one map was found not following map themes nor locked layers.
See also
restoreMapItemLayersAfterRendering()
Since
QGIS 4.2

Definition at line 198 of file qgslayoutgeopdfexporter.cpp.

◆ TestQgsLayoutGeospatialPdfExport

friend class TestQgsLayoutGeospatialPdfExport
friend

Definition at line 135 of file qgslayoutgeopdfexporter.h.


The documentation for this class was generated from the following files: