QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
QgsAbstractGeoPdfExporter Class Referenceabstract

Abstract base class for GeoPDF exporters. More...

#include <qgsabstractgeopdfexporter.h>

Inheritance diagram for QgsAbstractGeoPdfExporter:
Inheritance graph
[legend]

Classes

struct  ComponentLayerDetail
 Contains details of a particular input component to be used during PDF composition. More...
 
struct  ControlPoint
 Contains details of a control point used during georeferencing GeoPDF outputs. More...
 
struct  ExportDetails
 
struct  GeoReferencedSection
 
struct  RenderedFeature
 Contains information about a feature rendered inside the PDF. More...
 
struct  VectorComponentDetail
 Contains information relating to a single PDF layer in the GeoPDF export. More...
 

Public Member Functions

 QgsAbstractGeoPdfExporter ()=default
 Constructor for QgsAbstractGeoPdfExporter. More...
 
virtual ~QgsAbstractGeoPdfExporter ()=default
 
QString errorMessage ()
 Returns the last error message encountered during the export. More...
 
bool finalize (const QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > &components, const QString &destinationFile, const ExportDetails &details)
 To be called after the rendering operation is complete. More...
 
QString generateTemporaryFilepath (const QString &filename) const
 Returns a file path to use for temporary files required for GeoPDF creation. More...
 
void pushRenderedFeature (const QString &layerId, const QgsAbstractGeoPdfExporter::RenderedFeature &feature, const QString &group=QString())
 Called multiple times during the rendering operation, whenever a feature associated with the specified layerId is rendered. More...
 

Static Public Member Functions

static bool compositionModeSupported (QPainter::CompositionMode mode)
 Returns true if the specified composition mode is supported for layers during GeoPDF exports. More...
 
static QString geoPDFAvailabilityExplanation ()
 Returns a user-friendly, translated string explaining why GeoPDF export support is not available on the current QGIS build (or an empty string if GeoPDF support IS available). More...
 
static bool geoPDFCreationAvailable ()
 Returns true if the current QGIS build is capable of GeoPDF support. More...
 

Friends

class TestQgsGeoPdfExport
 
class TestQgsLayoutGeoPdfExport
 

Detailed Description

Abstract base class for GeoPDF exporters.

The base class handles generic GeoPDF export setup, cleanup and processing steps.

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

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

Definition at line 55 of file qgsabstractgeopdfexporter.h.

Constructor & Destructor Documentation

◆ QgsAbstractGeoPdfExporter()

QgsAbstractGeoPdfExporter::QgsAbstractGeoPdfExporter ( )
default

Constructor for QgsAbstractGeoPdfExporter.

◆ ~QgsAbstractGeoPdfExporter()

virtual QgsAbstractGeoPdfExporter::~QgsAbstractGeoPdfExporter ( )
virtualdefault

Member Function Documentation

◆ compositionModeSupported()

bool QgsAbstractGeoPdfExporter::compositionModeSupported ( QPainter::CompositionMode  mode)
static

Returns true if the specified composition mode is supported for layers during GeoPDF exports.

Since
QGIS 3.14

Definition at line 129 of file qgsabstractgeopdfexporter.cpp.

◆ errorMessage()

QString QgsAbstractGeoPdfExporter::errorMessage ( )
inline

Returns the last error message encountered during the export.

Definition at line 308 of file qgsabstractgeopdfexporter.h.

◆ finalize()

bool QgsAbstractGeoPdfExporter::finalize ( const QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > &  components,
const QString &  destinationFile,
const ExportDetails details 
)

To be called after the rendering operation is complete.

Will export the list of PDF layer components to a new PDF file at destinationFile. The components argument gives a list of additional layers to include in the generated PDF file. These must have already been created, e.g. as a result of rendering layers to separate PDF source files.

Any features previously collected by calls to pushRenderedFeature() will be included automatically in the GeoPDF export.

Returns true if the operation was successful, or false if an error occurred. If an error occurred, it can be retrieved by calling errorMessage().

Definition at line 78 of file qgsabstractgeopdfexporter.cpp.

◆ generateTemporaryFilepath()

QString QgsAbstractGeoPdfExporter::generateTemporaryFilepath ( const QString &  filename) const

Returns a file path to use for temporary files required for GeoPDF creation.

Definition at line 124 of file qgsabstractgeopdfexporter.cpp.

◆ geoPDFAvailabilityExplanation()

QString QgsAbstractGeoPdfExporter::geoPDFAvailabilityExplanation ( )
static

Returns a user-friendly, translated string explaining why GeoPDF export support is not available on the current QGIS build (or an empty string if GeoPDF support IS available).

See also
geoPDFCreationAvailable()

Definition at line 58 of file qgsabstractgeopdfexporter.cpp.

◆ geoPDFCreationAvailable()

bool QgsAbstractGeoPdfExporter::geoPDFCreationAvailable ( )
static

Returns true if the current QGIS build is capable of GeoPDF support.

If false is returned, a user-friendly explanation why can be retrieved via geoPDFAvailabilityExplanation().

Definition at line 38 of file qgsabstractgeopdfexporter.cpp.

◆ pushRenderedFeature()

void QgsAbstractGeoPdfExporter::pushRenderedFeature ( const QString &  layerId,
const QgsAbstractGeoPdfExporter::RenderedFeature feature,
const QString &  group = QString() 
)

Called multiple times during the rendering operation, whenever a feature associated with the specified layerId is rendered.

The optional group argument can be used to differentiate features from the same layer exported multiple times as part of different layer groups.

Definition at line 154 of file qgsabstractgeopdfexporter.cpp.

Friends And Related Function Documentation

◆ TestQgsGeoPdfExport

friend class TestQgsGeoPdfExport
friend

Definition at line 376 of file qgsabstractgeopdfexporter.h.

◆ TestQgsLayoutGeoPdfExport

friend class TestQgsLayoutGeoPdfExport
friend

Definition at line 375 of file qgsabstractgeopdfexporter.h.


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