QGIS API Documentation  3.2.0-Bonn (bc43194)
qgslayoutreportcontext.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutreportcontext.h
3  -------------------
4  begin : July 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #ifndef QGSLAYOUTREPORTCONTEXT_H
17 #define QGSLAYOUTREPORTCONTEXT_H
18 
19 #include "qgis_core.h"
20 #include "qgsfeature.h"
21 #include "qgsvectorlayer.h"
22 #include <QtGlobal>
23 
30 class CORE_EXPORT QgsLayoutReportContext : public QObject
31 {
32 
33  Q_OBJECT
34 
35  public:
36 
41 
51  void setFeature( const QgsFeature &feature );
52 
60  QgsFeature feature() const { return mFeature; }
61 
71  QgsGeometry currentGeometry( const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) const;
72 
77  QgsVectorLayer *layer() const;
78 
86  void setLayer( QgsVectorLayer *layer );
87 
93  void setPredefinedScales( const QVector<qreal> &scales );
94 
99  QVector<qreal> predefinedScales() const { return mPredefinedScales; }
100 
101  signals:
102 
106  void layerChanged( QgsVectorLayer *layer );
107 
112  void changed();
113 
114  private:
115 
116  QgsLayout *mLayout = nullptr;
117 
118  QgsFeature mFeature;
119  QPointer< QgsVectorLayer > mLayer;
120 
121  // projected geometry cache
122  mutable QMap<long, QgsGeometry> mGeometryCache;
123 
124  //list of predefined scales
125  QVector<qreal> mPredefinedScales;
126 
127  friend class QgsLayoutExporter;
128  friend class TestQgsLayout;
129 
130 };
131 
132 #endif //QGSLAYOUTREPORTCONTEXT_H
133 
134 
135 
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
Stores information relating to the current reporting context for a layout.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:104
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:62
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:49
Handles rendering and exports of layouts to various formats.
This class represents a coordinate reference system (CRS).
QgsFeature feature() const
Returns the current feature for evaluating the layout.
Represents a vector layer which manages a vector based data sets.
QVector< qreal > predefinedScales() const
Returns the current list of predefined scales for use with the layout.