QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
qgsquickmapcanvasmap.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsquickmapcanvasmap.h
3 --------------------------------------
4 Date : 10.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 QGSQUICKMAPCANVASMAP_H
17#define QGSQUICKMAPCANVASMAP_H
18
19#include "qgis_quick.h"
20#include "qgsquickmapsettings.h"
21
22#include <QFutureSynchronizer>
23#include <QTimer>
24#include <QtQuick/QQuickItem>
25#include <qgsmapsettings.h>
26#include <qgspoint.h>
27
28#include <memory>
29
33
52class QUICK_EXPORT QgsQuickMapCanvasMap : public QQuickItem
53{
54 Q_OBJECT
55
64 Q_PROPERTY( QgsQuickMapSettings *mapSettings READ mapSettings )
65
66
70 Q_PROPERTY( bool freeze READ freeze WRITE setFreeze NOTIFY freezeChanged )
71
77 Q_PROPERTY( bool isRendering READ isRendering NOTIFY isRenderingChanged )
78
84 Q_PROPERTY( int mapUpdateInterval READ mapUpdateInterval WRITE setMapUpdateInterval NOTIFY mapUpdateIntervalChanged )
85
89 Q_PROPERTY( bool incrementalRendering READ incrementalRendering WRITE setIncrementalRendering NOTIFY incrementalRenderingChanged )
90
91 public:
93 explicit QgsQuickMapCanvasMap( QQuickItem *parent = nullptr );
95
96 QSGNode *updatePaintNode( QSGNode *oldNode, QQuickItem::UpdatePaintNodeData * ) override;
97
99 QgsQuickMapSettings *mapSettings() const;
100
102 bool freeze() const;
103
105 void setFreeze( bool freeze );
106
108 bool isRendering() const;
109
111 int mapUpdateInterval() const;
112
114 void setMapUpdateInterval( int mapUpdateInterval );
115
117 bool incrementalRendering() const;
118
120 void setIncrementalRendering( bool incrementalRendering );
121
122 signals:
123
127 void renderStarting();
128
132 void mapCanvasRefreshed();
133
135 void freezeChanged();
136
138 void isRenderingChanged();
139
141 void mapUpdateIntervalChanged();
142
144 void incrementalRenderingChanged();
145
146 protected:
147#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
148 void geometryChanged( const QRectF &newGeometry, const QRectF &oldGeometry ) override;
149#else
150 void geometryChange( const QRectF &newGeometry, const QRectF &oldGeometry ) override;
151#endif
152
153 public slots:
155 void stopRendering();
156
160 void zoom( QPointF center, qreal scale );
161
165 void pan( QPointF oldPos, QPointF newPos );
166
171 void refresh();
172
176 void clearCache();
177
178 private slots:
179 void refreshMap();
180 void renderJobUpdated();
181 void renderJobFinished();
182 void layerRepaintRequested( bool deferred );
183 void onWindowChanged( QQuickWindow *window );
184 void onScreenChanged( QScreen *screen );
185 void onExtentChanged();
186 void onLayersChanged();
187 void onTemporalStateChanged();
188 void onzRangeChanged();
189
190 private:
191
192 enum class CacheInvalidationType
193 {
194 Temporal = 1 << 0,
195 Elevation = 1 << 1,
196 };
197
201 void destroyJob( QgsMapRendererJob *job );
202 QgsMapSettings prepareMapSettings() const;
203 void updateTransform();
204 void zoomToFullExtent();
205
206 void clearTemporalCache();
207 void clearElevationCache();
208 QFlags<CacheInvalidationType> mCacheInvalidations;
209
210 std::unique_ptr<QgsQuickMapSettings> mMapSettings;
211 bool mPinching = false;
212 QPoint mPinchStartPoint;
213 QgsMapRendererParallelJob *mJob = nullptr;
214 std::unique_ptr<QgsMapRendererCache> mCache;
215 QgsLabelingResults *mLabelingResults = nullptr;
216 QImage mImage;
217 QgsMapSettings mImageMapSettings;
218 QTimer mRefreshTimer;
219 bool mDirty = false;
220 bool mFreeze = false;
221 QList<QMetaObject::Connection> mLayerConnections;
222 QTimer mMapUpdateTimer;
223 bool mIncrementalRendering = false;
224 bool mSilentRefresh = false;
225 bool mDeferredRefreshPending = false;
226
227 QQuickWindow *mWindow = nullptr;
228};
229
230#endif // QGSQUICKMAPCANVASMAP_H
Class that stores computed placement from labeling engine.
This class is responsible for keeping cache of rendered images resulting from a map rendering job.
Abstract base class for map rendering implementations.
Job implementation that renders all layers in parallel.
The QgsMapSettings class contains configuration for rendering of the map.
This class implements a visual Qt Quick Item that does map rendering according to the current map set...
The QgsQuickMapSettings class encapsulates QgsMapSettings class to offer settings of configuration of...