QGIS API Documentation 3.39.0-Master (e62b17dac54)
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
QgsAbstractGeospatialPdfExporter Class Referenceabstract

Abstract base class for Geospatial PDF exporters. More...

#include <qgsabstractgeopdfexporter.h>

Inheritance diagram for QgsAbstractGeospatialPdfExporter:
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 Geospatial PDF 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 Geospatial PDF export. More...
 

Public Member Functions

 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.
 

Static Public Member Functions

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.
 

Friends

class TestQgsGeospatialPdfExport
 
class TestQgsLayoutGeospatialPdfExport
 

Detailed Description

Abstract base class for Geospatial PDF exporters.

The base class handles generic Geospatial PDF 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
QgsAbstractGeospatialPdfExporter 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

◆ QgsAbstractGeospatialPdfExporter()

QgsAbstractGeospatialPdfExporter::QgsAbstractGeospatialPdfExporter ( )
default

◆ ~QgsAbstractGeospatialPdfExporter()

virtual QgsAbstractGeospatialPdfExporter::~QgsAbstractGeospatialPdfExporter ( )
virtualdefault

Member Function Documentation

◆ compositionModeSupported()

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

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

Since
QGIS 3.14

Definition at line 161 of file qgsabstractgeopdfexporter.cpp.

◆ errorMessage()

QString QgsAbstractGeospatialPdfExporter::errorMessage ( ) const
inline

Returns the last error message encountered during the export.

Definition at line 326 of file qgsabstractgeopdfexporter.h.

◆ finalize()

bool QgsAbstractGeospatialPdfExporter::finalize ( const QList< QgsAbstractGeospatialPdfExporter::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 Geospatial PDF 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 84 of file qgsabstractgeopdfexporter.cpp.

◆ generateTemporaryFilepath()

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

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

Definition at line 156 of file qgsabstractgeopdfexporter.cpp.

◆ geospatialPDFAvailabilityExplanation()

QString QgsAbstractGeospatialPdfExporter::geospatialPDFAvailabilityExplanation ( )
static

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).

See also
geospatialPDFCreationAvailable()

Definition at line 55 of file qgsabstractgeopdfexporter.cpp.

◆ geospatialPDFCreationAvailable()

bool QgsAbstractGeospatialPdfExporter::geospatialPDFCreationAvailable ( )
static

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

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

Definition at line 35 of file qgsabstractgeopdfexporter.cpp.

◆ pushRenderedFeature()

void QgsAbstractGeospatialPdfExporter::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.

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 186 of file qgsabstractgeopdfexporter.cpp.

Friends And Related Symbol Documentation

◆ TestQgsGeospatialPdfExport

friend class TestQgsGeospatialPdfExport
friend

Definition at line 394 of file qgsabstractgeopdfexporter.h.

◆ TestQgsLayoutGeospatialPdfExport

friend class TestQgsLayoutGeospatialPdfExport
friend

Definition at line 393 of file qgsabstractgeopdfexporter.h.


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