QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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 "qgsquickmapsettings.h"
37
38
40 : QQuickItem( parent )
41 , mMapSettings( std::make_unique<QgsQuickMapSettings>() )
42 , mCache( std::make_unique<QgsMapRendererCache>() )
43{
44 connect( this, &QQuickItem::windowChanged, this, &QgsQuickMapCanvasMap::onWindowChanged );
45 connect( &mRefreshTimer, &QTimer::timeout, this, [ = ] { refreshMap(); } );
46 connect( &mMapUpdateTimer, &QTimer::timeout, this, &QgsQuickMapCanvasMap::renderJobUpdated );
47
48 connect( mMapSettings.get(), &QgsQuickMapSettings::extentChanged, this, &QgsQuickMapCanvasMap::onExtentChanged );
49 connect( mMapSettings.get(), &QgsQuickMapSettings::layersChanged, this, &QgsQuickMapCanvasMap::onLayersChanged );
50 connect( mMapSettings.get(), &QgsQuickMapSettings::temporalStateChanged, this, &QgsQuickMapCanvasMap::onTemporalStateChanged );
51 connect( mMapSettings.get(), &QgsQuickMapSettings::zRangeChanged, this, &QgsQuickMapCanvasMap::onzRangeChanged );
52
55
56 mMapUpdateTimer.setSingleShot( false );
57 mMapUpdateTimer.setInterval( 250 );
58 mRefreshTimer.setSingleShot( true );
59 setTransformOrigin( QQuickItem::TopLeft );
60 setFlags( QQuickItem::ItemHasContents );
61}
62
64
66{
67 return mMapSettings.get();
68}
69
70void QgsQuickMapCanvasMap::zoom( QPointF center, qreal scale )
71{
72 QgsRectangle extent = mMapSettings->extent();
73 QgsPoint oldCenter( extent.center() );
74 QgsPoint mousePos( mMapSettings->screenToCoordinate( center ) );
75
76 QgsPointXY newCenter( mousePos.x() + ( ( oldCenter.x() - mousePos.x() ) * scale ),
77 mousePos.y() + ( ( oldCenter.y() - mousePos.y() ) * scale ) );
78
79 // same as zoomWithCenter (no coordinate transformations are needed)
80 extent.scale( scale, &newCenter );
81 mMapSettings->setExtent( extent );
82}
83
84void QgsQuickMapCanvasMap::pan( QPointF oldPos, QPointF newPos )
85{
86 QgsPoint start = mMapSettings->screenToCoordinate( oldPos.toPoint() );
87 QgsPoint end = mMapSettings->screenToCoordinate( newPos.toPoint() );
88
89 double dx = end.x() - start.x();
90 double dy = end.y() - start.y();
91
92 // modify the extent
93 QgsRectangle extent = mMapSettings->extent();
94
95 extent.setXMinimum( extent.xMinimum() + dx );
96 extent.setXMaximum( extent.xMaximum() + dx );
97 extent.setYMaximum( extent.yMaximum() + dy );
98 extent.setYMinimum( extent.yMinimum() + dy );
99
100 mMapSettings->setExtent( extent );
101}
102
103void QgsQuickMapCanvasMap::refreshMap()
104{
105 stopRendering(); // if any...
106
107 QgsMapSettings mapSettings = mMapSettings->mapSettings();
108 if ( !mapSettings.hasValidSettings() )
109 return;
110
111 //build the expression context
112 QgsExpressionContext expressionContext;
113 expressionContext << QgsExpressionContextUtils::globalScope()
115
116 QgsProject *project = mMapSettings->project();
117 if ( project )
118 {
119 expressionContext << QgsExpressionContextUtils::projectScope( project );
120
121 mapSettings.setLabelingEngineSettings( project->labelingEngineSettings() );
122
123 // render main annotation layer above all other layers
124 QList<QgsMapLayer *> allLayers = mapSettings.layers();
125 allLayers.insert( 0, project->mainAnnotationLayer() );
126 mapSettings.setLayers( allLayers );
127 }
128
129 mapSettings.setExpressionContext( expressionContext );
130
131 // enables on-the-fly simplification of geometries to spend less time rendering
133 // with incremental rendering - enables updates of partially rendered layers (good for WMTS, XYZ layers)
134 mapSettings.setFlag( Qgis::MapSettingsFlag::RenderPartialOutput, mIncrementalRendering );
135
136 // create the renderer job
137 Q_ASSERT( !mJob );
139
140 if ( mIncrementalRendering )
141 mMapUpdateTimer.start();
142
143 connect( mJob, &QgsMapRendererJob::renderingLayersFinished, this, &QgsQuickMapCanvasMap::renderJobUpdated );
144 connect( mJob, &QgsMapRendererJob::finished, this, &QgsQuickMapCanvasMap::renderJobFinished );
145 mJob->setCache( mCache.get() );
146
147 mJob->start();
148
149 if ( !mSilentRefresh )
150 {
151 emit renderStarting();
152 }
153}
154
155void QgsQuickMapCanvasMap::renderJobUpdated()
156{
157 if ( !mJob )
158 return;
159
160 mImage = mJob->renderedImage();
161 mImageMapSettings = mJob->mapSettings();
162 mDirty = true;
163 // Temporarily freeze the canvas, we only need to reset the geometry but not trigger a repaint
164 bool freeze = mFreeze;
165 mFreeze = true;
166 updateTransform();
167 mFreeze = freeze;
168
169 update();
170}
171
172void QgsQuickMapCanvasMap::renderJobFinished()
173{
174 if ( !mJob )
175 return;
176
177 const QgsMapRendererJob::Errors errors = mJob->errors();
178 for ( const QgsMapRendererJob::Error &error : errors )
179 {
180 QgsMessageLog::logMessage( QStringLiteral( "%1 :: %2" ).arg( error.layerID, error.message ), tr( "Rendering" ) );
181 }
182
183 // take labeling results before emitting renderComplete, so labeling map tools
184 // connected to signal work with correct results
185 delete mLabelingResults;
186 mLabelingResults = mJob->takeLabelingResults();
187
188 mImage = mJob->renderedImage();
189 mImageMapSettings = mJob->mapSettings();
190
191 // now we are in a slot called from mJob - do not delete it immediately
192 // so the class is still valid when the execution returns to the class
193 mJob->deleteLater();
194 mJob = nullptr;
195 mDirty = true;
196 mMapUpdateTimer.stop();
197
198 // Temporarily freeze the canvas, we only need to reset the geometry but not trigger a repaint
199 bool freeze = mFreeze;
200 mFreeze = true;
201 updateTransform();
202 mFreeze = freeze;
203
204 update();
205 if ( !mSilentRefresh )
206 {
207 emit mapCanvasRefreshed();
208 }
209 else
210 {
211 mSilentRefresh = false;
212 }
213
214 if ( mDeferredRefreshPending )
215 {
216 mDeferredRefreshPending = false;
217 mSilentRefresh = true;
218 refresh();
219 }
220}
221
222void QgsQuickMapCanvasMap::layerRepaintRequested( bool deferred )
223{
224 if ( mMapSettings->outputSize().isNull() )
225 return; // the map image size has not been set yet
226
227 if ( !mFreeze )
228 {
229 if ( deferred )
230 {
231 if ( !mJob )
232 {
233 mSilentRefresh = true;
234 refresh();
235 }
236 else
237 {
238 mDeferredRefreshPending = true;
239 }
240 }
241 else
242 {
243 refresh();
244 }
245 }
246}
247
248void QgsQuickMapCanvasMap::onWindowChanged( QQuickWindow *window )
249{
250 if ( mWindow == window )
251 return;
252
253 if ( mWindow )
254 disconnect( mWindow, &QQuickWindow::screenChanged, this, &QgsQuickMapCanvasMap::onScreenChanged );
255
256 if ( window )
257 {
258 connect( window, &QQuickWindow::screenChanged, this, &QgsQuickMapCanvasMap::onScreenChanged );
259 onScreenChanged( window->screen() );
260 }
261
262 mWindow = window;
263}
264
265void QgsQuickMapCanvasMap::onScreenChanged( QScreen *screen )
266{
267 if ( screen )
268 {
269 if ( screen->devicePixelRatio() > 0 )
270 {
271 mMapSettings->setDevicePixelRatio( screen->devicePixelRatio() );
272 }
273 mMapSettings->setOutputDpi( screen->physicalDotsPerInch() );
274 }
275}
276
277void QgsQuickMapCanvasMap::onExtentChanged()
278{
279 updateTransform();
280
281 // And trigger a new rendering job
282 refresh();
283}
284
285void QgsQuickMapCanvasMap::onTemporalStateChanged()
286{
287 clearTemporalCache();
288
289 // And trigger a new rendering job
290 refresh();
291}
292
293void QgsQuickMapCanvasMap::onzRangeChanged()
294{
295 clearElevationCache();
296
297 // And trigger a new rendering job
298 refresh();
299}
300
301void QgsQuickMapCanvasMap::updateTransform()
302{
303 QgsRectangle imageExtent = mImageMapSettings.visibleExtent();
304 QgsRectangle newExtent = mMapSettings->mapSettings().visibleExtent();
305 setScale( imageExtent.width() / newExtent.width() );
306
307 QgsPointXY pixelPt = mMapSettings->coordinateToScreen( QgsPoint( imageExtent.xMinimum(), imageExtent.yMaximum() ) );
308 setX( pixelPt.x() );
309 setY( pixelPt.y() );
310}
311
313{
314 return mMapUpdateTimer.interval();
315}
316
318{
319 if ( mMapUpdateTimer.interval() == mapUpdateInterval )
320 return;
321
322 mMapUpdateTimer.setInterval( mapUpdateInterval );
323
325}
326
328{
329 return mIncrementalRendering;
330}
331
332void QgsQuickMapCanvasMap::setIncrementalRendering( bool incrementalRendering )
333{
334 if ( incrementalRendering == mIncrementalRendering )
335 return;
336
337 mIncrementalRendering = incrementalRendering;
339}
340
342{
343 return mFreeze;
344}
345
347{
348 if ( freeze == mFreeze )
349 return;
350
351 mFreeze = freeze;
352
353 if ( mFreeze )
355 else
356 refresh();
357
358 emit freezeChanged();
359}
360
362{
363 return mJob;
364}
365
366QSGNode *QgsQuickMapCanvasMap::updatePaintNode( QSGNode *oldNode, QQuickItem::UpdatePaintNodeData * )
367{
368 if ( mDirty )
369 {
370 delete oldNode;
371 oldNode = nullptr;
372 mDirty = false;
373 }
374
375 if ( mImage.isNull() )
376 {
377 return nullptr;
378 }
379
380 QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode *>( oldNode );
381 if ( !node )
382 {
383 node = new QSGSimpleTextureNode();
384 QSGTexture *texture = window()->createTextureFromImage( mImage );
385 node->setTexture( texture );
386 node->setOwnsTexture( true );
387 }
388
389 QRectF rect( boundingRect() );
390 QSizeF size = mImage.size();
391 if ( !size.isEmpty() )
392 size /= mMapSettings->devicePixelRatio();
393
394 // Check for resizes that change the w/h ratio
395 if ( !rect.isEmpty() && !size.isEmpty() && !qgsDoubleNear( rect.width() / rect.height(), ( size.width() ) / static_cast<double>( size.height() ), 3 ) )
396 {
397 if ( qgsDoubleNear( rect.height(), mImage.height() ) )
398 {
399 rect.setHeight( rect.width() / size.width() * size.height() );
400 }
401 else
402 {
403 rect.setWidth( rect.height() / size.height() * size.width() );
404 }
405 }
406
407 node->setRect( rect );
408
409 return node;
410}
411
412#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
413void QgsQuickMapCanvasMap::geometryChanged( const QRectF &newGeometry, const QRectF &oldGeometry )
414{
415 QQuickItem::geometryChanged( newGeometry, oldGeometry );
416#else
417void QgsQuickMapCanvasMap::geometryChange( const QRectF &newGeometry, const QRectF &oldGeometry )
418{
419 QQuickItem::geometryChange( newGeometry, oldGeometry );
420#endif
421 if ( newGeometry.size() != oldGeometry.size() )
422 {
423 mMapSettings->setOutputSize( newGeometry.size().toSize() );
424 refresh();
425 }
426}
427
428void QgsQuickMapCanvasMap::onLayersChanged()
429{
430 if ( mMapSettings->extent().isEmpty() )
431 zoomToFullExtent();
432
433 for ( const QMetaObject::Connection &conn : std::as_const( mLayerConnections ) )
434 {
435 disconnect( conn );
436 }
437 mLayerConnections.clear();
438
439 const QList<QgsMapLayer *> layers = mMapSettings->layers();
440 for ( QgsMapLayer *layer : layers )
441 {
442 mLayerConnections << connect( layer, &QgsMapLayer::repaintRequested, this, &QgsQuickMapCanvasMap::layerRepaintRequested );
443 }
444
445 refresh();
446}
447
448void QgsQuickMapCanvasMap::destroyJob( QgsMapRendererJob *job )
449{
450 job->cancel();
451 job->deleteLater();
452}
453
455{
456 if ( mJob )
457 {
458 disconnect( mJob, &QgsMapRendererJob::renderingLayersFinished, this, &QgsQuickMapCanvasMap::renderJobUpdated );
459 disconnect( mJob, &QgsMapRendererJob::finished, this, &QgsQuickMapCanvasMap::renderJobFinished );
460
461 mJob->cancelWithoutBlocking();
462 mJob = nullptr;
463 }
464}
465
466void QgsQuickMapCanvasMap::zoomToFullExtent()
467{
468 QgsRectangle extent;
469 const QList<QgsMapLayer *> layers = mMapSettings->layers();
470 for ( QgsMapLayer *layer : layers )
471 {
472 if ( mMapSettings->destinationCrs() != layer->crs() )
473 {
474 QgsCoordinateTransform transform( layer->crs(), mMapSettings->destinationCrs(), mMapSettings->transformContext() );
475 try
476 {
477 extent.combineExtentWith( transform.transformBoundingBox( layer->extent() ) );
478 }
479 catch ( const QgsCsException &exp )
480 {
481 // Ignore extent if it can't be transformed
482 }
483 }
484 else
485 {
486 extent.combineExtentWith( layer->extent() );
487 }
488 }
489 mMapSettings->setExtent( extent );
490
491 refresh();
492}
493
495{
496 if ( mMapSettings->outputSize().isNull() )
497 return; // the map image size has not been set yet
498
499 if ( !mFreeze )
500 mRefreshTimer.start( 1 );
501}
502
504{
505 if ( mCache )
506 mCache->clear();
507}
508
509void QgsQuickMapCanvasMap::clearTemporalCache()
510{
511 if ( mCache )
512 {
513 bool invalidateLabels = false;
514 const QList<QgsMapLayer *> layerList = mMapSettings->mapSettings().layers();
515 for ( QgsMapLayer *layer : layerList )
516 {
517 bool alreadyInvalidatedThisLayer = false;
518 if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) )
519 {
520 if ( vl->renderer() && QgsSymbolLayerUtils::rendererFrameRate( vl->renderer() ) > -1 )
521 {
522 // layer has an animated symbol assigned, so we have to redraw it regardless of whether
523 // or not it has temporal settings
524 mCache->invalidateCacheForLayer( layer );
525 alreadyInvalidatedThisLayer = true;
526 // we can't shortcut and "continue" here, as we still need to check whether the layer
527 // will cause label invalidation using the logic below
528 }
529 }
530
531 if ( layer->temporalProperties() && layer->temporalProperties()->isActive() )
532 {
533 if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) )
534 {
535 if ( vl->labelsEnabled() || vl->diagramsEnabled() )
536 invalidateLabels = true;
537 }
538
539 if ( layer->temporalProperties()->flags() & QgsTemporalProperty::FlagDontInvalidateCachedRendersWhenRangeChanges )
540 continue;
541
542 if ( !alreadyInvalidatedThisLayer )
543 mCache->invalidateCacheForLayer( layer );
544 }
545 else if ( QgsGroupLayer *gl = qobject_cast<QgsGroupLayer *>( layer ) )
546 {
547 const QList<QgsMapLayer *> childLayerList = gl->childLayers();
548 for ( QgsMapLayer *childLayer : childLayerList )
549 {
550 if ( childLayer->temporalProperties() && childLayer->temporalProperties()->isActive() )
551 {
552 if ( childLayer->temporalProperties()->flags() & QgsTemporalProperty::FlagDontInvalidateCachedRendersWhenRangeChanges )
553 continue;
554
555 mCache->invalidateCacheForLayer( layer );
556 break;
557 }
558 }
559 }
560 }
561
562 if ( invalidateLabels )
563 {
564 mCache->clearCacheImage( QStringLiteral( "_labels_" ) );
565 mCache->clearCacheImage( QStringLiteral( "_preview_labels_" ) );
566 }
567 }
568}
569
570void QgsQuickMapCanvasMap::clearElevationCache()
571{
572 if ( mCache )
573 {
574 bool invalidateLabels = false;
575 const QList<QgsMapLayer *> layerList = mMapSettings->mapSettings().layers();
576 for ( QgsMapLayer *layer : layerList )
577 {
578 if ( layer->elevationProperties() && layer->elevationProperties()->hasElevation() )
579 {
580 if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) )
581 {
582 if ( vl->labelsEnabled() || vl->diagramsEnabled() )
583 invalidateLabels = true;
584 }
585
587 continue;
588
589 mCache->invalidateCacheForLayer( layer );
590 }
591 else if ( QgsGroupLayer *gl = qobject_cast<QgsGroupLayer *>( layer ) )
592 {
593 const QList<QgsMapLayer *> childLayerList = gl->childLayers();
594 for ( QgsMapLayer *childLayer : childLayerList )
595 {
596 if ( childLayer->elevationProperties() && childLayer->elevationProperties()->hasElevation() )
597 {
598 if ( childLayer->elevationProperties()->flags() & QgsMapLayerElevationProperties::FlagDontInvalidateCachedRendersWhenRangeChanges )
599 continue;
600
601 mCache->invalidateCacheForLayer( layer );
602 break;
603 }
604 }
605 }
606 }
607
608 if ( invalidateLabels )
609 {
610 mCache->clearCacheImage( QStringLiteral( "_labels_" ) );
611 mCache->clearCacheImage( QStringLiteral( "_preview_labels_" ) );
612 }
613 }
614}
@ 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.
Definition: qgsexception.h:67
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...
Definition: qgsgrouplayer.h:42
@ FlagDontInvalidateCachedRendersWhenRangeChanges
Any cached rendering will not be invalidated when z range context is modified.
Base class for all map layer types.
Definition: qgsmaplayer.h:75
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
Q_GADGET double x
Definition: qgspointxy.h:63
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:49
Q_GADGET 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.
Definition: qgsrectangle.h:42
void scale(double scaleFactor, const QgsPointXY *c=nullptr)
Scale the rectangle around its center point.
Definition: qgsrectangle.h:267
double xMinimum() const
Returns the x minimum value (left side of rectangle).
Definition: qgsrectangle.h:201
void setYMinimum(double y)
Set the minimum y value.
Definition: qgsrectangle.h:159
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
Definition: qgsrectangle.h:211
void setXMinimum(double x)
Set the minimum x value.
Definition: qgsrectangle.h:149
double width() const
Returns the width of the rectangle.
Definition: qgsrectangle.h:236
double xMaximum() const
Returns the x maximum value (right side of rectangle).
Definition: qgsrectangle.h:196
double yMaximum() const
Returns the y maximum value (top side of rectangle).
Definition: qgsrectangle.h:206
void setYMaximum(double y)
Set the maximum y value.
Definition: qgsrectangle.h:164
QgsPointXY center() const
Returns the center point of the rectangle.
Definition: qgsrectangle.h:262
void setXMaximum(double x)
Set the maximum x value.
Definition: qgsrectangle.h:154
void combineExtentWith(const QgsRectangle &rect)
Expands the rectangle so that it covers both the original rectangle and the given rectangle.
Definition: qgsrectangle.h:413
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:5207