QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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( QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged )
85 
91  Q_PROPERTY( QSize outputSize READ outputSize WRITE setOutputSize NOTIFY outputSizeChanged )
92 
98  Q_PROPERTY( double outputDpi READ outputDpi WRITE setOutputDpi NOTIFY outputDpiChanged )
99 
105  Q_PROPERTY( QgsCoordinateReferenceSystem destinationCrs READ destinationCrs WRITE setDestinationCrs NOTIFY destinationCrsChanged )
106 
115  Q_PROPERTY( QList<QgsMapLayer *> layers READ layers WRITE setLayers NOTIFY layersChanged )
116 
117  public:
119  QgsQuickMapSettings( QObject *parent = nullptr );
120  ~QgsQuickMapSettings() = default;
121 
123  QgsMapSettings mapSettings() const;
124 
126  QgsRectangle extent() const;
127 
129  void setExtent( const QgsRectangle &extent );
130 
132  void setProject( QgsProject *project );
133 
135  QgsProject *project() const;
136 
138  Q_INVOKABLE void setCenter( const QgsPoint &center );
139 
141  double mapUnitsPerPixel() const;
142 
144  QgsRectangle visibleExtent() const;
145 
147  Q_INVOKABLE QgsCoordinateTransformContext transformContext() const;
148 
156  Q_INVOKABLE QPointF coordinateToScreen( const QgsPoint &point ) const;
157 
158 
166  Q_INVOKABLE QgsPoint screenToCoordinate( const QPointF &point ) const;
167 
169  void setTransformContext( const QgsCoordinateTransformContext &context );
170 
172  double rotation() const;
173 
175  void setRotation( double rotation );
176 
178  QColor backgroundColor() const;
179 
181  void setBackgroundColor( const QColor &color );
182 
184  QSize outputSize() const;
185 
187  void setOutputSize( const QSize &outputSize );
188 
190  double outputDpi() const;
191 
193  void setOutputDpi( double outputDpi );
194 
196  QgsCoordinateReferenceSystem destinationCrs() const;
197 
199  void setDestinationCrs( const QgsCoordinateReferenceSystem &destinationCrs );
200 
202  QList<QgsMapLayer *> layers() const;
203 
205  void setLayers( const QList<QgsMapLayer *> &layers );
206 
207  signals:
209  void projectChanged();
210 
212  void extentChanged();
213 
215  void destinationCrsChanged();
216 
218  void mapUnitsPerPixelChanged();
219 
221  void rotationChanged();
222 
224  void backgroundColorChanged();
225 
227  void visibleExtentChanged();
228 
230  void outputSizeChanged();
231 
233  void outputDpiChanged();
234 
236  void layersChanged();
237 
238  private slots:
239 
245  void onReadProject( const QDomDocument &doc );
246 
247  private:
248  QgsProject *mProject = nullptr;
249  QgsMapSettings mMapSettings;
250 
251 };
252 
253 #endif // QGSQUICKMAPSETTINGS_H
QgsCoordinateTransformContext
Definition: qgscoordinatetransformcontext.h:57
qgsrectangle.h
qgsmapthemecollection.h
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
qgscoordinatetransformcontext.h
qgspoint.h
qgsmapsettings.h
QgsRectangle
Definition: qgsrectangle.h:41
QgsProject
Definition: qgsproject.h:92
QgsQuickMapSettings
Definition: qgsquickmapsettings.h:46
QgsCoordinateReferenceSystem
Definition: qgscoordinatereferencesystem.h:206
QgsMapLayer
Definition: qgsmaplayer.h:81
QgsMapSettings
Definition: qgsmapsettings.h:86