QGIS API Documentation 3.35.0-Master (f6e073f0eed)
Loading...
Searching...
No Matches
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 "qgis_quick.h"
20
21#include <QObject>
22
24#include "qgsmaplayer.h"
25#include "qgsmapsettings.h"
26#include "qgspoint.h"
27#include "qgsrectangle.h"
28#include "qgsproject.h"
29
45class QUICK_EXPORT QgsQuickMapSettings : public QObject
46{
47 Q_OBJECT
48
56 Q_PROPERTY( QgsProject *project READ project WRITE setProject NOTIFY projectChanged )
57
58
61 Q_PROPERTY( QgsPoint center READ center WRITE setCenter NOTIFY extentChanged )
62
71 Q_PROPERTY( QgsRectangle extent READ extent WRITE setExtent NOTIFY extentChanged )
73 Q_PROPERTY( QgsRectangle visibleExtent READ visibleExtent NOTIFY visibleExtentChanged )
75 Q_PROPERTY( double mapUnitsPerPixel READ mapUnitsPerPixel NOTIFY mapUnitsPerPixelChanged )
77 Q_PROPERTY( double mapUnitsPerPoint READ mapUnitsPerPoint NOTIFY mapUnitsPerPointChanged )
78
83 Q_PROPERTY( double rotation READ rotation WRITE setRotation NOTIFY rotationChanged )
84
90 Q_PROPERTY( QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged )
91
97 Q_PROPERTY( QSize outputSize READ outputSize WRITE setOutputSize NOTIFY outputSizeChanged )
98
104 Q_PROPERTY( double outputDpi READ outputDpi WRITE setOutputDpi NOTIFY outputDpiChanged )
105
111 Q_PROPERTY( QgsCoordinateReferenceSystem destinationCrs READ destinationCrs WRITE setDestinationCrs NOTIFY destinationCrsChanged )
112
121 Q_PROPERTY( QList<QgsMapLayer *> layers READ layers WRITE setLayers NOTIFY layersChanged )
122
126 Q_PROPERTY( bool isTemporal READ isTemporal WRITE setIsTemporal NOTIFY temporalStateChanged )
127
131 Q_PROPERTY( QDateTime temporalBegin READ temporalBegin WRITE setTemporalBegin NOTIFY temporalStateChanged )
132
136 Q_PROPERTY( QDateTime temporalEnd READ temporalEnd WRITE setTemporalEnd NOTIFY temporalStateChanged )
137
138 public:
140 explicit QgsQuickMapSettings( QObject *parent = nullptr );
142
144 QgsMapSettings mapSettings() const;
145
147 QgsRectangle extent() const;
148
150 void setExtent( const QgsRectangle &extent );
151
153 void setProject( QgsProject *project );
154
156 QgsProject *project() const;
157
159 QgsPoint center() const;
160
162 Q_INVOKABLE void setCenter( const QgsPoint &center );
163
165 double mapUnitsPerPixel() const;
166
168 Q_INVOKABLE void setCenterToLayer( QgsMapLayer *layer, bool shouldZoom = true );
169
171 double mapUnitsPerPoint() const;
172
174 QgsRectangle visibleExtent() const;
175
177 Q_INVOKABLE QgsCoordinateTransformContext transformContext() const;
178
186 Q_INVOKABLE QPointF coordinateToScreen( const QgsPoint &point ) const;
187
195 Q_INVOKABLE QgsPoint screenToCoordinate( const QPointF &point ) const;
196
198 void setTransformContext( const QgsCoordinateTransformContext &context );
199
201 double rotation() const;
202
204 void setRotation( double rotation );
205
207 QColor backgroundColor() const;
208
210 void setBackgroundColor( const QColor &color );
211
217 QSize outputSize() const;
218
224 void setOutputSize( QSize outputSize );
225
227 double outputDpi() const;
228
230 void setOutputDpi( double outputDpi );
231
233 QgsCoordinateReferenceSystem destinationCrs() const;
234
236 void setDestinationCrs( const QgsCoordinateReferenceSystem &destinationCrs );
237
245 QList<QgsMapLayer *> layers() const;
246
256 void setLayers( const QList<QgsMapLayer *> &layers );
257
263 qreal devicePixelRatio() const;
264
265
271 void setDevicePixelRatio( const qreal &devicePixelRatio );
272
274 bool isTemporal() const;
275
277 void setIsTemporal( bool temporal );
278
280 QDateTime temporalBegin() const;
281
283 void setTemporalBegin( const QDateTime &begin );
284
286 QDateTime temporalEnd() const;
287
289 void setTemporalEnd( const QDateTime &end );
290
291 signals:
293 void projectChanged();
294
296 void extentChanged();
297
299 void destinationCrsChanged();
300
302 void mapUnitsPerPixelChanged();
304 void mapUnitsPerPointChanged();
305
307 void rotationChanged();
308
310 void backgroundColorChanged();
311
313 void visibleExtentChanged();
314
316 void outputSizeChanged();
317
319 void outputDpiChanged();
320
322 void layersChanged();
323
330 void temporalStateChanged();
331
333 void devicePixelRatioChanged();
334
335 private slots:
336
342 void onReadProject( const QDomDocument &doc );
343
347 void onCrsChanged();
348
349 private:
350 QgsProject *mProject = nullptr;
351 QgsMapSettings mMapSettings;
352 qreal mDevicePixelRatio = 1.0;
353};
354
355#endif // QGSQUICKMAPSETTINGS_H
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Base class for all map layer types.
Definition qgsmaplayer.h:75
The QgsMapSettings class contains configuration for rendering of the map.
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
The QgsQuickMapSettings class encapsulates QgsMapSettings class to offer settings of configuration of...
A rectangle specified with double values.