QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsalgorithmlayoutatlastopdf.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsalgorithmlayoutatlastopdf.h
3  ---------------------
4  begin : August 2020
5  copyright : (C) 2020 by Mathieu Pellerin
6  email : nirvn dot asia at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSALGORITHMLAYOUTATLASTOPDF_H
19 #define QGSALGORITHMLAYOUTATLASTOPDF_H
20 
21 #define SIP_NO_FILE
22 
23 #include "qgis_sip.h"
24 #include "qgsprocessingalgorithm.h"
25 #include "qgslayoutexporter.h"
26 
27 class QgsLayoutAtlas;
28 
30 
34 class QgsLayoutAtlasToPdfAlgorithmBase : public QgsProcessingAlgorithm
35 {
36 
37  public:
38 
39  QgsLayoutAtlasToPdfAlgorithmBase() = default;
40  void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
41  Flags flags() const override;
42  QStringList tags() const override;
43  QString group() const override;
44  QString groupId() const override;
45 
46  QgsLayoutAtlas *atlas();
47  QgsLayoutExporter exporter();
49  QString error();
50 
51  protected:
52 
53  QVariantMap processAlgorithm( const QVariantMap &parameters,
54  QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
55 
56  virtual QVariantMap exportAtlas( QgsLayoutAtlas *atlas, const QgsLayoutExporter &exporter, const QgsLayoutExporter::PdfExportSettings &settings,
57  const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) = 0;
58 
59 };
60 
61 
65 class QgsLayoutAtlasToPdfAlgorithm : public QgsLayoutAtlasToPdfAlgorithmBase
66 {
67 
68  public:
69 
70  QgsLayoutAtlasToPdfAlgorithm() = default;
71  void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
72  QString name() const override;
73  QString displayName() const override;
74  QString shortDescription() const override;
75  QString shortHelpString() const override;
76  QgsLayoutAtlasToPdfAlgorithm *createInstance() const override SIP_FACTORY;
77 
78  protected:
79  QVariantMap exportAtlas( QgsLayoutAtlas *atlas, const QgsLayoutExporter &exporter, const QgsLayoutExporter::PdfExportSettings &settings,
80  const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
81 
82 };
83 
87 class QgsLayoutAtlasToMultiplePdfAlgorithm : public QgsLayoutAtlasToPdfAlgorithmBase
88 {
89 
90  public:
91 
92  QgsLayoutAtlasToMultiplePdfAlgorithm() = default;
93  void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
94  QString name() const override;
95  QString displayName() const override;
96  QString shortDescription() const override;
97  QString shortHelpString() const override;
98  QgsLayoutAtlasToMultiplePdfAlgorithm *createInstance() const override SIP_FACTORY;
99 
100  protected:
101  QVariantMap exportAtlas( QgsLayoutAtlas *atlas, const QgsLayoutExporter &exporter, const QgsLayoutExporter::PdfExportSettings &settings,
102  const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
103 
104 };
105 
107 
108 #endif // QGSALGORITHMLAYOUTATLASTOPDF_H
109 
110 
QgsProcessingFeedback
Base class for providing feedback from a processing algorithm.
Definition: qgsprocessingfeedback.h:37
QgsProcessingAlgorithm::groupId
virtual QString groupId() const
Returns the unique ID of the group this algorithm belongs to.
Definition: qgsprocessingalgorithm.h:234
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
qgslayoutexporter.h
QgsProcessingAlgorithm::processAlgorithm
virtual QVariantMap processAlgorithm(const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback) SIP_THROW(QgsProcessingException)=0
Runs the algorithm using the specified parameters.
QgsProcessingContext
Contains information about the context in which a processing algorithm is executed.
Definition: qgsprocessingcontext.h:46
qgsprocessingalgorithm.h
qgis_sip.h
QgsLayoutExporter
Handles rendering and exports of layouts to various formats.
Definition: qgslayoutexporter.h:46
QgsProcessingAlgorithm
Abstract base class for processing algorithms.
Definition: qgsprocessingalgorithm.h:52
QgsProcessingAlgorithm::group
virtual QString group() const
Returns the name of the group this algorithm belongs to.
Definition: qgsprocessingalgorithm.h:225
QgsLayoutExporter::PdfExportSettings
Contains settings relating to exporting layouts to PDF.
Definition: qgslayoutexporter.h:253
QgsProcessingAlgorithm::flags
virtual Flags flags() const
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
Definition: qgsprocessingalgorithm.cpp:90
QgsLayoutAtlas
Class used to render QgsLayout as an atlas, by iterating over the features from an associated vector ...
Definition: qgslayoutatlas.h:41
QgsProcessingAlgorithm::tags
virtual QStringList tags() const
Returns a list of tags which relate to the algorithm, and are used to assist users in searching for s...
Definition: qgsprocessingalgorithm.h:181
QgsProcessingAlgorithm::initAlgorithm
virtual void initAlgorithm(const QVariantMap &configuration=QVariantMap())=0
Initializes the algorithm using the specified configuration.