QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsprojectviewsettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprojectviewsettings.h
3  ---------------------------
4  begin : October 2019
5  copyright : (C) 2019 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSPROJECTVIEWSETTINGS_H
16 #define QGSPROJECTVIEWSETTINGS_H
17 
18 #include "qgis_core.h"
19 #include "qgsreferencedgeometry.h"
20 #include <QObject>
21 #include <QVector>
22 
23 class QDomElement;
25 class QDomDocument;
26 class QgsProject;
27 
35 class CORE_EXPORT QgsProjectViewSettings : public QObject
36 {
37  Q_OBJECT
38 
39  public:
40 
46  QgsProjectViewSettings( QgsProject *project = nullptr );
47 
51  void reset();
52 
65  QgsReferencedRectangle defaultViewExtent() const;
66 
79  void setDefaultViewExtent( const QgsReferencedRectangle &extent );
80 
92  QgsReferencedRectangle presetFullExtent() const;
93 
105  void setPresetFullExtent( const QgsReferencedRectangle &extent );
106 
119  QgsReferencedRectangle fullExtent() const;
120 
130  void setMapScales( const QVector<double> &scales );
131 
141  QVector<double> mapScales() const;
142 
152  void setUseProjectScales( bool enabled );
153 
163  bool useProjectScales() const;
164 
169  bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
170 
175  QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
176 
177  signals:
178 
186 
193 
194  private:
195 
196  QgsProject *mProject = nullptr;
197  QVector<double> mMapScales;
198  bool mUseProjectScales = false;
199  QgsReferencedRectangle mDefaultViewExtent;
200  QgsReferencedRectangle mPresetFullExtent;
201 };
202 
203 #endif // QGSPROJECTVIEWSETTINGS_H
Contains settings and properties relating to how a QgsProject should be displayed inside map canvas,...
void presetFullExtentChanged()
Emitted whenever the presetFullExtent() is changed.
void mapScalesChanged()
Emitted when the list of custom project map scales changes.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:99
The class is used as a container of context for various read/write operations on other objects.
A QgsRectangle with associated coordinate reference system.