QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgsquickmapcanvasmap.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsquickmapcanvasmap.cpp
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#include <QQuickWindow>
17#include <QSGSimpleTextureNode>
18#include <QScreen>
19
20#include "qgis.h"
21#include "qgsannotationlayer.h"
23#include "qgsgrouplayer.h"
24#include "qgslabelingresults.h"
27#include "qgsmaprenderercache.h"
29#include "qgsmessagelog.h"
30#include "qgspallabeling.h"
31#include "qgsproject.h"
32#include "qgssymbollayerutils.h"
33#include "qgsvectorlayer.h"
34
36#include "moc_qgsquickmapcanvasmap.cpp"
37#include "qgsquickmapsettings.h"
38
39
41 : QQuickItem( parent )
42 , mMapSettings( std::make_unique<QgsQuickMapSettings>() )
43 , mCache( std::make_unique<QgsMapRendererCache>() )
44{
45 connect( this, &QQuickItem::windowChanged, this, &QgsQuickMapCanvasMap::onWindowChanged );
46 connect( &mRefreshTimer, &QTimer::timeout, this, [ = ] { refreshMap(); } );
47 connect( &mMapUpdateTimer, &QTimer::timeout, this, &QgsQuickMapCanvasMap::renderJobUpdated );
48
49 connect( mMapSettings.get(), &QgsQuickMapSettings::extentChanged, this, &QgsQuickMapCanvasMap::onExtentChanged );
50 connect( mMapSettings.get(), &QgsQuickMapSettings::layersChanged, this, &QgsQuickMapCanvasMap::onLayersChanged );
51 connect( mMapSettings.get(), &QgsQuickMapSettings::temporalStateChanged, this, &QgsQuickMapCanvasMap::onTemporalStateChanged );
52 connect( mMapSettings.get(), &QgsQuickMapSettings::zRangeChanged, this, &QgsQuickMapCanvasMap::onzRangeChanged );
53
56
57 mMapUpdateTimer.setSingleShot( false );
58 mMapUpdateTimer.setInterval( 250 );
59 mRefreshTimer.setSingleShot( true );
60 setTransformOrigin( QQuickItem::TopLeft );
61 setFlags( QQuickItem::ItemHasContents );
62}
63
65
67{
68 return mMapSettings.get();
69}
70
71void QgsQuickMapCanvasMap::zoom( QPointF center, qreal scale )
72{
73 QgsRectangle extent = mMapSettings->extent();
74 QgsPoint oldCenter( extent.center() );
75 QgsPoint mousePos( mMapSettings->screenToCoordinate( center ) );
76
77 QgsPointXY newCenter( mousePos.x() + ( ( oldCenter.x() - mousePos.x() ) * scale ),
78 mousePos.y() + ( ( oldCenter.y() - mousePos.y() ) * scale ) );
79
80 // same as zoomWithCenter (no coordinate transformations are needed)
81 extent.scale( scale, &newCenter );
82 mMapSettings->setExtent( extent );
83}
84
85void QgsQuickMapCanvasMap::pan( QPointF oldPos, QPointF newPos )
86{
87 QgsPoint start = mMapSettings->screenToCoordinate( oldPos.toPoint() );
88 QgsPoint end = mMapSettings->screenToCoordinate( newPos.toPoint() );
89
90 double dx = end.x() - start.x();
91 double dy = end.y() - start.y();
92
93 // modify the extent
94 QgsRectangle extent = mMapSettings->extent();
95
96 extent.setXMinimum( extent.xMinimum() + dx );
97 extent.setXMaximum( extent.xMaximum() + dx );
98 extent.setYMaximum( extent.yMaximum() + dy );
99 extent.setYMinimum( extent.yMinimum() + dy );
100
101 mMapSettings->setExtent( extent );
102}
103
104void QgsQuickMapCanvasMap::refreshMap()
105{
106 stopRendering(); // if any...
107
108 if ( mCacheInvalidations.testFlag( CacheInvalidationType::Temporal ) )
109 {
110 clearTemporalCache();
111 mCacheInvalidations &= ~( static_cast< int >( CacheInvalidationType::Temporal ) );
112 }
113 if ( mCacheInvalidations.testFlag( CacheInvalidationType::Elevation ) )
114 {
115 clearElevationCache();
116 mCacheInvalidations &= ~( static_cast< int >( CacheInvalidationType::Elevation ) );
117 }
118
119 QgsMapSettings mapSettings = mMapSettings->mapSettings();
120 if ( !mapSettings.hasValidSettings() )
121 return;
122
123 //build the expression context
124 QgsExpressionContext expressionContext;
125 expressionContext << QgsExpressionContextUtils::globalScope()
127
128 QgsProject *project = mMapSettings->project();
129 if ( project )
130 {
131 expressionContext << QgsExpressionContextUtils::projectScope( project );
132
133 mapSettings.setLabelingEngineSettings( project->labelingEngineSettings() );
134
135 // render main annotation layer above all other layers
136 QList<QgsMapLayer *> allLayers = mapSettings.layers();
137 allLayers.insert( 0, project->mainAnnotationLayer() );
138 mapSettings.setLayers( allLayers );
139 }
140
141 mapSettings.setExpressionContext( expressionContext );
142
143 // enables on-the-fly simplification of geometries to spend less time rendering
145 // with incremental rendering - enables updates of partially rendered layers (good for WMTS, XYZ layers)
146 mapSettings.setFlag( Qgis::MapSettingsFlag::RenderPartialOutput, mIncrementalRendering );
147
148 // create the renderer job
149 Q_ASSERT( !mJob );
151
152 if ( mIncrementalRendering )
153 mMapUpdateTimer.start();
154
155 connect( mJob, &QgsMapRendererJob::renderingLayersFinished, this, &QgsQuickMapCanvasMap::renderJobUpdated );
156 connect( mJob, &QgsMapRendererJob::finished, this, &QgsQuickMapCanvasMap::renderJobFinished );
157 mJob->setCache( mCache.get() );
158
159 mJob->start();
160
161 if ( !mSilentRefresh )
162 {
163 emit renderStarting();
164 }
165}
166
167void QgsQuickMapCanvasMap::renderJobUpdated()
168{
169 if ( !mJob )
170 return;
171
172 mImage = mJob->renderedImage();
173 mImageMapSettings = mJob->mapSettings();
174 mDirty = true;
175 // Temporarily freeze the canvas, we only need to reset the geometry but not trigger a repaint
176 bool freeze = mFreeze;
177 mFreeze = true;
178 updateTransform();
179 mFreeze = freeze;
180
181 update();
182}
183
184void QgsQuickMapCanvasMap::renderJobFinished()
185{
186 if ( !mJob )
187 return;
188
189 const QgsMapRendererJob::Errors errors = mJob->errors();
190 for ( const QgsMapRendererJob::Error &error : errors )
191 {
192 QgsMessageLog::logMessage( QStringLiteral( "%1 :: %2" ).arg( error.layerID, error.message ), tr( "Rendering" ) );
193 }
194
195 // take labeling results before emitting renderComplete, so labeling map tools
196 // connected to signal work with correct results
197 delete mLabelingResults;
198 mLabelingResults = mJob->takeLabelingResults();
199
200 mImage = mJob->renderedImage();
201 mImageMapSettings = mJob->mapSettings();
202
203 // now we are in a slot called from mJob - do not delete it immediately
204 // so the class is still valid when the execution returns to the class
205 mJob->deleteLater();
206 mJob = nullptr;
207 mDirty = true;
208 mMapUpdateTimer.stop();
209
210 // Temporarily freeze the canvas, we only need to reset the geometry but not trigger a repaint
211 bool freeze = mFreeze;
212 mFreeze = true;
213 updateTransform();
214 mFreeze = freeze;
215
216 update();
217 if ( !mSilentRefresh )
218 {
219 emit mapCanvasRefreshed();
220 }
221 else
222 {
223 mSilentRefresh = false;
224 }
225
226 if ( mDeferredRefreshPending )
227 {
228 mDeferredRefreshPending = false;
229 mSilentRefresh = true;
230 refresh();
231 }
232}
233
234void QgsQuickMapCanvasMap::layerRepaintRequested( bool deferred )
235{
236 if ( mMapSettings->outputSize().isNull() )
237 return; // the map image size has not been set yet
238
239 if ( !mFreeze )
240 {
241 if ( deferred )
242 {
243 if ( !mJob )
244 {
245 mSilentRefresh = true;
246 refresh();
247 }
248 else
249 {
250 mDeferredRefreshPending = true;
251 }
252 }
253 else
254 {
255 refresh();
256 }
257 }
258}
259
260void QgsQuickMapCanvasMap::onWindowChanged( QQuickWindow *window )
261{
262 if ( mWindow == window )
263 return;
264
265 if ( mWindow )
266 disconnect( mWindow, &QQuickWindow::screenChanged, this, &QgsQuickMapCanvasMap::onScreenChanged );
267
268 if ( window )
269 {
270 connect( window, &QQuickWindow::screenChanged, this, &QgsQuickMapCanvasMap::onScreenChanged );
271 onScreenChanged( window->screen() );
272 }
273
274 mWindow = window;
275}
276
277void QgsQuickMapCanvasMap::onScreenChanged( QScreen *screen )
278{
279 if ( screen )
280 {
281 if ( screen->devicePixelRatio() > 0 )
282 {
283 mMapSettings->setDevicePixelRatio( screen->devicePixelRatio() );
284 }
285 mMapSettings->setOutputDpi( screen->physicalDotsPerInch() );
286 }
287}
288
289void QgsQuickMapCanvasMap::onExtentChanged()
290{
291 updateTransform();
292
293 // And trigger a new rendering job
294 refresh();
295}
296
297void QgsQuickMapCanvasMap::onTemporalStateChanged()
298{
299 mCacheInvalidations |= CacheInvalidationType::Temporal;
300
301 // And trigger a new rendering job
302 refresh();
303}
304
305void QgsQuickMapCanvasMap::onzRangeChanged()
306{
307 mCacheInvalidations |= CacheInvalidationType::Elevation;
308
309 // And trigger a new rendering job
310 refresh();
311}
312
313void QgsQuickMapCanvasMap::updateTransform()
314{
315 QgsRectangle imageExtent = mImageMapSettings.visibleExtent();
316 QgsRectangle newExtent = mMapSettings->mapSettings().visibleExtent();
317 setScale( imageExtent.width() / newExtent.width() );
318
319 QgsPointXY pixelPt = mMapSettings->coordinateToScreen( QgsPoint( imageExtent.xMinimum(), imageExtent.yMaximum() ) );
320 setX( pixelPt.x() );
321 setY( pixelPt.y() );
322}
323
325{
326 return mMapUpdateTimer.interval();
327}
328
330{
331 if ( mMapUpdateTimer.interval() == mapUpdateInterval )
332 return;
333
334 mMapUpdateTimer.setInterval( mapUpdateInterval );
335
337}
338
340{
341 return mIncrementalRendering;
342}
343
344void QgsQuickMapCanvasMap::setIncrementalRendering( bool incrementalRendering )
345{
346 if ( incrementalRendering == mIncrementalRendering )
347 return;
348
349 mIncrementalRendering = incrementalRendering;
351}
352
354{
355 return mFreeze;
356}
357
359{
360 if ( freeze == mFreeze )
361 return;
362
363 mFreeze = freeze;
364
365 if ( mFreeze )
367 else
368 refresh();
369
370 emit freezeChanged();
371}
372
374{
375 return mJob;
376}
377
378QSGNode *QgsQuickMapCanvasMap::updatePaintNode( QSGNode *oldNode, QQuickItem::UpdatePaintNodeData * )
379{
380 if ( mDirty )
381 {
382 delete oldNode;
383 oldNode = nullptr;
384 mDirty = false;
385 }
386
387 if ( mImage.isNull() )
388 {
389 return nullptr;
390 }
391
392 QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode *>( oldNode );
393 if ( !node )
394 {
395 node = new QSGSimpleTextureNode();
396 QSGTexture *texture = window()->createTextureFromImage( mImage );
397 node->setTexture( texture );
398 node->setOwnsTexture( true );
399 }
400
401 QRectF rect( boundingRect() );
402 QSizeF size = mImage.size();
403 if ( !size.isEmpty() )
404 size /= mMapSettings->devicePixelRatio();
405
406 // Check for resizes that change the w/h ratio
407 if ( !rect.isEmpty() && !size.isEmpty() && !qgsDoubleNear( rect.width() / rect.height(), ( size.width() ) / static_cast<double>( size.height() ), 3 ) )
408 {
409 if ( qgsDoubleNear( rect.height(), mImage.height() ) )
410 {
411 rect.setHeight( rect.width() / size.width() * size.height() );
412 }
413 else
414 {
415 rect.setWidth( rect.height() / size.height() * size.width() );
416 }
417 }
418
419 node->setRect( rect );
420
421 return node;
422}
423
424#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
425void QgsQuickMapCanvasMap::geometryChanged( const QRectF &newGeometry, const QRectF &oldGeometry )
426{
427 QQuickItem::geometryChanged( newGeometry, oldGeometry );
428#else
429void QgsQuickMapCanvasMap::geometryChange( const QRectF &newGeometry, const QRectF &oldGeometry )
430{
431 QQuickItem::geometryChange( newGeometry, oldGeometry );
432#endif
433 if ( newGeometry.size() != oldGeometry.size() )
434 {
435 mMapSettings->setOutputSize( newGeometry.size().toSize() );
436 refresh();
437 }
438}
439
440void QgsQuickMapCanvasMap::onLayersChanged()
441{
442 if ( mMapSettings->extent().isEmpty() )
443 zoomToFullExtent();
444
445 for ( const QMetaObject::Connection &conn : std::as_const( mLayerConnections ) )
446 {
447 disconnect( conn );
448 }
449 mLayerConnections.clear();
450
451 const QList<QgsMapLayer *> layers = mMapSettings->layers();
452 for ( QgsMapLayer *layer : layers )
453 {
454 mLayerConnections << connect( layer, &QgsMapLayer::repaintRequested, this, &QgsQuickMapCanvasMap::layerRepaintRequested );
455 }
456
457 refresh();
458}
459
460void QgsQuickMapCanvasMap::destroyJob( QgsMapRendererJob *job )
461{
462 job->cancel();
463 job->deleteLater();
464}
465
467{
468 if ( mJob )
469 {
470 disconnect( mJob, &QgsMapRendererJob::renderingLayersFinished, this, &QgsQuickMapCanvasMap::renderJobUpdated );
471 disconnect( mJob, &QgsMapRendererJob::finished, this, &QgsQuickMapCanvasMap::renderJobFinished );
472
473 mJob->cancelWithoutBlocking();
474 mJob = nullptr;
475 }
476}
477
478void QgsQuickMapCanvasMap::zoomToFullExtent()
479{
480 QgsRectangle extent;
481 const QList<QgsMapLayer *> layers = mMapSettings->layers();
482 for ( QgsMapLayer *layer : layers )
483 {
484 if ( mMapSettings->destinationCrs() != layer->crs() )
485 {
486 QgsCoordinateTransform transform( layer->crs(), mMapSettings->destinationCrs(), mMapSettings->transformContext() );
487 try
488 {
489 extent.combineExtentWith( transform.transformBoundingBox( layer->extent() ) );
490 }
491 catch ( const QgsCsException &exp )
492 {
493 // Ignore extent if it can't be transformed
494 }
495 }
496 else
497 {
498 extent.combineExtentWith( layer->extent() );
499 }
500 }
501 mMapSettings->setExtent( extent );
502
503 refresh();
504}
505
507{
508 if ( mMapSettings->outputSize().isNull() )
509 return; // the map image size has not been set yet
510
511 if ( !mFreeze )
512 mRefreshTimer.start( 1 );
513}
514
516{
517 if ( mCache )
518 mCache->clear();
519}
520
521void QgsQuickMapCanvasMap::clearTemporalCache()
522{
523 if ( mCache )
524 {
525 bool invalidateLabels = false;
526 const QList<QgsMapLayer *> layerList = mMapSettings->mapSettings().layers();
527 for ( QgsMapLayer *layer : layerList )
528 {
529 bool alreadyInvalidatedThisLayer = false;
530 if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) )
531 {
532 if ( vl->renderer() && QgsSymbolLayerUtils::rendererFrameRate( vl->renderer() ) > -1 )
533 {
534 // layer has an animated symbol assigned, so we have to redraw it regardless of whether
535 // or not it has temporal settings
536 mCache->invalidateCacheForLayer( layer );
537 alreadyInvalidatedThisLayer = true;
538 // we can't shortcut and "continue" here, as we still need to check whether the layer
539 // will cause label invalidation using the logic below
540 }
541 }
542
543 if ( layer->temporalProperties() && layer->temporalProperties()->isActive() )
544 {
545 if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) )
546 {
547 if ( vl->labelsEnabled() || vl->diagramsEnabled() )
548 invalidateLabels = true;
549 }
550
551 if ( layer->temporalProperties()->flags() & QgsTemporalProperty::FlagDontInvalidateCachedRendersWhenRangeChanges )
552 continue;
553
554 if ( !alreadyInvalidatedThisLayer )
555 mCache->invalidateCacheForLayer( layer );
556 }
557 else if ( QgsGroupLayer *gl = qobject_cast<QgsGroupLayer *>( layer ) )
558 {
559 const QList<QgsMapLayer *> childLayerList = gl->childLayers();
560 for ( QgsMapLayer *childLayer : childLayerList )
561 {
562 if ( childLayer->temporalProperties() && childLayer->temporalProperties()->isActive() )
563 {
564 if ( childLayer->temporalProperties()->flags() & QgsTemporalProperty::FlagDontInvalidateCachedRendersWhenRangeChanges )
565 continue;
566
567 mCache->invalidateCacheForLayer( layer );
568 break;
569 }
570 }
571 }
572 }
573
574 if ( invalidateLabels )
575 {
576 mCache->clearCacheImage( QStringLiteral( "_labels_" ) );
577 mCache->clearCacheImage( QStringLiteral( "_preview_labels_" ) );
578 }
579 }
580}
581
582void QgsQuickMapCanvasMap::clearElevationCache()
583{
584 if ( mCache )
585 {
586 bool invalidateLabels = false;
587 const QList<QgsMapLayer *> layerList = mMapSettings->mapSettings().layers();
588 for ( QgsMapLayer *layer : layerList )
589 {
590 if ( layer->elevationProperties() && layer->elevationProperties()->hasElevation() )
591 {
592 if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) )
593 {
594 if ( vl->labelsEnabled() || vl->diagramsEnabled() )
595 invalidateLabels = true;
596 }
597
599 continue;
600
601 mCache->invalidateCacheForLayer( layer );
602 }
603 else if ( QgsGroupLayer *gl = qobject_cast<QgsGroupLayer *>( layer ) )
604 {
605 const QList<QgsMapLayer *> childLayerList = gl->childLayers();
606 for ( QgsMapLayer *childLayer : childLayerList )
607 {
608 if ( childLayer->elevationProperties() && childLayer->elevationProperties()->hasElevation() )
609 {
610 if ( childLayer->elevationProperties()->flags() & QgsMapLayerElevationProperties::FlagDontInvalidateCachedRendersWhenRangeChanges )
611 continue;
612
613 mCache->invalidateCacheForLayer( layer );
614 break;
615 }
616 }
617 }
618 }
619
620 if ( invalidateLabels )
621 {
622 mCache->clearCacheImage( QStringLiteral( "_labels_" ) );
623 mCache->clearCacheImage( QStringLiteral( "_preview_labels_" ) );
624 }
625 }
626}
@ UseRenderingOptimization
Enable vector simplification and other rendering optimizations.
@ RenderPartialOutput
Whether to make extra effort to update map image with partially rendered layers (better for interacti...
Class for doing transforms between two map coordinate systems.
Custom exception class for Coordinate Reference System related exceptions.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A map layer which consists of a set of child layers, where all component layers are rendered as a sin...
@ FlagDontInvalidateCachedRendersWhenRangeChanges
Any cached rendering will not be invalidated when z range context is modified.
Base class for all map layer types.
Definition qgsmaplayer.h:76
void repaintRequested(bool deferredUpdate=false)
By emitting this signal the layer tells that either appearance or content have been changed and any v...
This class is responsible for keeping cache of rendered images resulting from a map rendering job.
Abstract base class for map rendering implementations.
void setCache(QgsMapRendererCache *cache)
Assign a cache to be used for reading and storing rendered images of individual layers.
Errors errors() const
List of errors that happened during the rendering job - available when the rendering has been finishe...
void renderingLayersFinished()
Emitted when the layers are rendered.
const QgsMapSettings & mapSettings() const
Returns map settings with which this job was started.
void finished()
emitted when asynchronous rendering is finished (or canceled).
void start()
Start the rendering job and immediately return.
QList< QgsMapRendererJob::Error > Errors
virtual void cancel()=0
Stop the rendering job - does not return until the job has terminated.
Job implementation that renders all layers in parallel.
QgsLabelingResults * takeLabelingResults() override
Gets pointer to internal labeling engine (in order to get access to the results).
void cancelWithoutBlocking() override
Triggers cancellation of the rendering job without blocking.
QImage renderedImage() override
Gets a preview/resulting image.
The QgsMapSettings class contains configuration for rendering of the map.
QgsRectangle visibleExtent() const
Returns the actual extent derived from requested extent that takes output image size into account.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
A class to represent a 2D point.
Definition qgspointxy.h:60
double y
Definition qgspointxy.h:64
double x
Definition qgspointxy.h:63
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
double x
Definition qgspoint.h:52
double y
Definition qgspoint.h:53
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
QgsAnnotationLayer * mainAnnotationLayer()
Returns the main annotation layer associated with the project.
const QgsLabelingEngineSettings & labelingEngineSettings() const
Returns project's global labeling engine settings.
void freezeChanged()
When freeze property is set to true, the map canvas does not refresh.
bool isRendering
The isRendering property is set to true while a rendering job is pending for this map canvas map.
void mapCanvasRefreshed()
Signal is emitted when a canvas is refreshed.
void incrementalRenderingChanged()
When the incrementalRendering property is set to true, the automatic refresh of map canvas during ren...
int mapUpdateInterval
Interval in milliseconds after which the map canvas will be updated while a rendering job is ongoing.
void setMapUpdateInterval(int mapUpdateInterval)
Interval in milliseconds after which the map canvas will be updated while a rendering job is ongoing.
void pan(QPointF oldPos, QPointF newPos)
Set map setting's extent (pan the map) based on the difference of positions.
void renderStarting()
Signal is emitted when a rendering is starting.
void stopRendering()
Stop map rendering.
void zoom(QPointF center, qreal scale)
Set map setting's extent (zoom the map) on the center by given scale.
void setIncrementalRendering(bool incrementalRendering)
When the incrementalRendering property is set to true, the automatic refresh of map canvas during ren...
void clearCache()
Clears rendering cache.
void setFreeze(bool freeze)
When freeze property is set to true, the map canvas does not refresh.
QgsQuickMapSettings * mapSettings
The mapSettings property contains configuration for rendering of the map.
void refresh()
Refresh the map canvas.
QSGNode * updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *) override
void mapUpdateIntervalChanged()
Interval in milliseconds after which the map canvas will be updated while a rendering job is ongoing.
bool incrementalRendering
When the incrementalRendering property is set to true, the automatic refresh of map canvas during ren...
bool freeze
When freeze property is set to true, the map canvas does not refresh.
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
QgsQuickMapCanvasMap(QQuickItem *parent=nullptr)
Create map canvas map.
void isRenderingChanged()
The isRendering property is set to true while a rendering job is pending for this map canvas map.
The QgsQuickMapSettings class encapsulates QgsMapSettings class to offer settings of configuration of...
void extentChanged()
Geographical coordinates of the rectangle that should be rendered.
void layersChanged()
Set list of layers for map rendering.
void temporalStateChanged()
Emitted when the temporal state has changed.
void setLayers(const QList< QgsMapLayer * > &layers)
Sets the list of layers to render in the map.
QList< QgsMapLayer * > layers
Set list of layers for map rendering.
void zRangeChanged()
Emitted when the Z range has changed.
A rectangle specified with double values.
void scale(double scaleFactor, const QgsPointXY *c=nullptr)
Scale the rectangle around its center point.
double xMinimum() const
Returns the x minimum value (left side of rectangle).
void setYMinimum(double y)
Set the minimum y value.
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
void setXMinimum(double x)
Set the minimum x value.
double width() const
Returns the width of the rectangle.
double xMaximum() const
Returns the x maximum value (right side of rectangle).
double yMaximum() const
Returns the y maximum value (top side of rectangle).
void setYMaximum(double y)
Set the maximum y value.
QgsPointXY center() const
Returns the center point of the rectangle.
void setXMaximum(double x)
Set the maximum x value.
void combineExtentWith(const QgsRectangle &rect)
Expands the rectangle so that it covers both the original rectangle and the given rectangle.
static double rendererFrameRate(const QgsFeatureRenderer *renderer)
Calculates the frame rate (in frames per second) at which the given renderer must be redrawn.
@ FlagDontInvalidateCachedRendersWhenRangeChanges
Any cached rendering will not be invalidated when temporal range context is modified.
Represents a vector layer which manages a vector based data sets.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition qgis.h:5917