QGIS API Documentation  3.4.3-Madeira (2f64a3c)
qgsquickmapsettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsquickmapsettings.h
3  --------------------------------------
4  Date : 27.12.2014
5  Copyright : (C) 2014 by Matthias Kuhn
6  Email : matthias (at) opengis.ch
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 
16 #ifndef QGSQUICKMAPSETTINGS_H
17 #define QGSQUICKMAPSETTINGS_H
18 
19 #include <QObject>
20 
22 #include "qgsmapsettings.h"
23 #include "qgsmapthemecollection.h"
24 #include "qgspoint.h"
25 #include "qgsrectangle.h"
26 
27 #include "qgis_quick.h"
28 
29 class QgsProject;
30 
46 class QUICK_EXPORT QgsQuickMapSettings : public QObject
47 {
48  Q_OBJECT
49 
57  Q_PROPERTY( QgsProject *project READ project WRITE setProject NOTIFY projectChanged )
58 
59 
67  Q_PROPERTY( QgsRectangle extent READ extent WRITE setExtent NOTIFY extentChanged )
69  Q_PROPERTY( QgsRectangle visibleExtent READ visibleExtent NOTIFY visibleExtentChanged )
71  Q_PROPERTY( double mapUnitsPerPixel READ mapUnitsPerPixel NOTIFY mapUnitsPerPixelChanged )
72 
77  Q_PROPERTY( double rotation READ rotation WRITE setRotation NOTIFY rotationChanged )
78 
84  Q_PROPERTY( QSize outputSize READ outputSize WRITE setOutputSize NOTIFY outputSizeChanged )
85 
91  Q_PROPERTY( double outputDpi READ outputDpi WRITE setOutputDpi NOTIFY outputDpiChanged )
92 
98  Q_PROPERTY( QgsCoordinateReferenceSystem destinationCrs READ destinationCrs WRITE setDestinationCrs NOTIFY destinationCrsChanged )
99 
108  Q_PROPERTY( QList<QgsMapLayer *> layers READ layers WRITE setLayers NOTIFY layersChanged )
109 
110  public:
112  QgsQuickMapSettings( QObject *parent = nullptr );
113  ~QgsQuickMapSettings() = default;
114 
116  QgsMapSettings mapSettings() const;
117 
119  QgsRectangle extent() const;
120 
122  void setExtent( const QgsRectangle &extent );
123 
125  void setProject( QgsProject *project );
126 
128  QgsProject *project() const;
129 
131  Q_INVOKABLE void setCenter( const QgsPoint &center );
132 
134  double mapUnitsPerPixel() const;
135 
137  QgsRectangle visibleExtent() const;
138 
140  Q_INVOKABLE QgsCoordinateTransformContext transformContext() const;
141 
149  Q_INVOKABLE QPointF coordinateToScreen( const QgsPoint &point ) const;
150 
151 
159  Q_INVOKABLE QgsPoint screenToCoordinate( const QPointF &point ) const;
160 
162  void setTransformContext( const QgsCoordinateTransformContext &context );
163 
165  double rotation() const;
166 
168  void setRotation( double rotation );
169 
171  QSize outputSize() const;
172 
174  void setOutputSize( const QSize &outputSize );
175 
177  double outputDpi() const;
178 
180  void setOutputDpi( double outputDpi );
181 
183  QgsCoordinateReferenceSystem destinationCrs() const;
184 
186  void setDestinationCrs( const QgsCoordinateReferenceSystem &destinationCrs );
187 
189  QList<QgsMapLayer *> layers() const;
190 
192  void setLayers( const QList<QgsMapLayer *> &layers );
193 
194  signals:
196  void projectChanged();
197 
199  void extentChanged();
200 
202  void destinationCrsChanged();
203 
205  void mapUnitsPerPixelChanged();
206 
208  void rotationChanged();
209 
211  void visibleExtentChanged();
212 
214  void outputSizeChanged();
215 
217  void outputDpiChanged();
218 
220  void layersChanged();
221 
222  private slots:
223 
229  void onReadProject( const QDomDocument &doc );
230 
231  private:
232  QgsProject *mProject = nullptr;
233  QgsMapSettings mMapSettings;
234 
235 };
236 
237 #endif // QGSQUICKMAPSETTINGS_H
A rectangle specified with double values.
Definition: qgsrectangle.h:40
Base class for all map layer types.
Definition: qgsmaplayer.h:63
The QgsQuickMapSettings class encapsulates QgsMapSettings class to offer settings of configuration of...
The QgsMapSettings class contains configuration for rendering of the map.
Reads and writes project states.
Definition: qgsproject.h:89
Contains information about the context in which a coordinate transform is executed.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
This class represents a coordinate reference system (CRS).