QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgsmapcanvas.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmapcanvas.h - description
3 -------------------
4 begin : Sun Jun 30 2002
5 copyright : (C) 2002 by Gary E.Sherman
6 email : sherman at mrcc.com
7***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSMAPCANVAS_H
19#define QGSMAPCANVAS_H
20
21#include "qgsconfig.h"
22#include "qgis_sip.h"
23
25#include "qgsrectangle.h"
26#include "qgsfeatureid.h"
27#include "qgsgeometry.h"
30#include "qgsproject.h"
31#include "qgsdistancearea.h"
32#include "qgsmaprendererjob.h"
33
34#include <QDomDocument>
35#include <QGraphicsView>
36
37#include "qgsmapsettings.h" // TEMPORARY
38#include "qgsprevieweffect.h" //for QgsPreviewEffect::PreviewMode
39
40#include <QTimer>
41#include <QGestureEvent>
42#include "qgis_gui.h"
43
44class QWheelEvent;
45class QPixmap;
46class QPaintEvent;
47class QKeyEvent;
48class ResizeEvent;
49
50class QColor;
51class QDomDocument;
52class QPaintDevice;
53class QMouseEvent;
54class QRubberBand;
55class QGraphicsScene;
56
57class QgsMapToPixel;
58class QgsMapLayer;
59class QgsHighlight;
60class QgsVectorLayer;
61
63
66class QgsMapSettings;
67class QgsMapCanvasMap;
69class QgsMapTool;
71class QgsRubberBand;
77
79class QgsScreenHelper;
80
82
83class QMenu;
85
86
92class GUI_EXPORT QgsMapCanvas : public QGraphicsView, public QgsExpressionContextGenerator
93{
94
95#ifdef SIP_RUN
97 if ( qobject_cast<QgsMapCanvas *>( sipCpp ) != nullptr )
98 sipType = sipType_QgsMapCanvas;
99 else
100 sipType = nullptr;
101 SIP_END
102#endif
103
104 Q_OBJECT
105 Q_PROPERTY( QString theme READ theme WRITE setTheme NOTIFY themeChanged )
106 Q_PROPERTY( bool previewJobsEnabled READ previewJobsEnabled WRITE setPreviewJobsEnabled )
107
108 public:
109
111 QgsMapCanvas( QWidget *parent SIP_TRANSFERTHIS = nullptr );
112
113 ~QgsMapCanvas() override;
114
125 void addOverlayWidget( QWidget *widget SIP_TRANSFER, Qt::Edge edge );
126
130 double magnificationFactor() const;
131
142 void setLayers( const QList<QgsMapLayer *> &layers );
143
150 void setFlags( Qgis::MapCanvasFlags flags );
151
158 Qgis::MapCanvasFlags flags() const;
159
160 void setCurrentLayer( QgsMapLayer *layer );
161
165 const QgsMapSettings &mapSettings() const SIP_KEEPREFERENCE;
166
173 QgsMapSettings &mapSettings() SIP_SKIP;
174
181 void setTemporalController( QgsTemporalController *controller );
182
189 const QgsTemporalController *temporalController() const;
190
194 void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
195
199 void setMapSettingsFlags( Qgis::MapSettingsFlags flags );
200
208 const QgsLabelingResults *labelingResults( bool allowOutdatedResults = true ) const;
209
219 const QgsRenderedItemResults *renderedItemResults( bool allowOutdatedResults = true ) const;
220
228 void setCachingEnabled( bool enabled );
229
237 bool isCachingEnabled() const;
238
242 void clearCache();
243
252 QgsMapRendererCache *cache();
253
258 void cancelJobs() SIP_SKIP;
259
268 void waitWhileRendering();
269
273 void setParallelRenderingEnabled( bool enabled );
274
278 bool isParallelRenderingEnabled() const;
279
283 void setMapUpdateInterval( int timeMilliseconds );
284
288 int mapUpdateInterval() const;
289
294 double scale() const;
295
297 double mapUnitsPerPixel() const;
298
300 QgsRectangle extent() const;
301
310 QgsRectangle fullExtent() const;
311
321 QgsRectangle projectExtent() const;
322
334 void setExtent( const QgsRectangle &r, bool magnified = false );
335
344 bool setReferencedExtent( const QgsReferencedRectangle &extent ) SIP_THROW( QgsCsException );
345
349 double rotation() const;
350
354 void setRotation( double degrees );
355
359 void setCenter( const QgsPointXY &center );
360
364 QgsPointXY center() const;
365
371 void zoomToFullExtent();
372
381 void zoomToProjectExtent();
382
384 void zoomToPreviousExtent();
385
387 void zoomToNextExtent();
388
390 void clearExtentHistory();
391
392
398 void zoomToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
399
406 void panToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids, bool alwaysRecenter = true );
407
409 void panToSelected( QgsMapLayer *layer = nullptr );
410
416 void panToSelected( const QList<QgsMapLayer *> &layers );
417
429 void flashFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids,
430 const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
431 int flashes = 3, int duration = 500 );
432
444 void flashGeometries( const QList< QgsGeometry > &geometries, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem(),
445 const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
446 int flashes = 3, int duration = 500 );
447
449 void setMapTool( QgsMapTool *mapTool, bool clean = false );
450
458 void unsetMapTool( QgsMapTool *mapTool );
459
461 QgsMapTool *mapTool() const;
462
468 void setProject( QgsProject *project );
469
476 QgsProject *project();
477
479 void setCanvasColor( const QColor &_newVal );
481 QColor canvasColor() const;
482
486 void setSelectionColor( const QColor &color );
487
491 QColor selectionColor() const;
492
494 void updateScale();
495
497 QgsMapLayer *layer( int index );
498
509 QgsMapLayer *layer( const QString &id );
510
514 int layerCount() const;
515
524 QList<QgsMapLayer *> layers( bool expandGroupLayers = false ) const;
525
526#ifndef SIP_RUN
533 template <typename T>
534 QVector<T> layers() const {return mapSettings().layers<T>();}
535#endif
536
546 void freeze( bool frozen = true );
547
555 bool isFrozen() const;
556
565 bool renderFlag() const { return mRenderFlag; }
566
571 Qgis::DistanceUnit mapUnits() const;
572
577 QMap<QString, QString> layerStyleOverrides() const;
578
589 void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
590
608 void setTheme( const QString &theme );
609
614 QString theme() const { return mTheme; }
615
617 const QgsMapToPixel *getCoordinateTransform();
618
620 bool isDrawing();
621
623 QgsMapLayer *currentLayer();
624
626 void setWheelFactor( double factor );
627
635 void zoomScale( double scale, bool ignoreScaleLock = false );
636
644 void zoomByFactor( double scaleFactor, const QgsPointXY *center = nullptr, bool ignoreScaleLock = false );
645
647 void zoomWithCenter( int x, int y, bool zoomIn );
648
653 void zoomToFeatureExtent( QgsRectangle &rect );
654
659 bool scaleLocked() const { return mScaleLocked;}
660
662 void enableAntiAliasing( bool flag );
663
665 bool antiAliasingEnabled() const;
666
668 void enableMapTileRendering( bool flag );
669
670 // following 2 methods should be moved elsewhere or changed to private
671 // currently used by pan map tool
673 void panActionEnd( QPoint releasePoint );
674
675#ifndef SIP_RUN
676
682 void panActionStart( QPoint releasePoint );
683#endif
684
686 void panAction( QMouseEvent *event );
687
689 QPoint mouseLastXY();
690
696 void setPreviewModeEnabled( bool previewEnabled );
697
704 bool previewModeEnabled() const;
705
714 void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
715
723 QgsPreviewEffect::PreviewMode previewMode() const;
724
732 QgsSnappingUtils *snappingUtils() const;
733
741 void setSnappingUtils( QgsSnappingUtils *utils );
742
752 void setExpressionContextScope( const QgsExpressionContextScope &scope ) { mExpressionContextScope = scope; }
753
761 QgsExpressionContextScope &expressionContextScope() { return mExpressionContextScope; }
762
769 const QgsExpressionContextScope &expressionContextScope() const { return mExpressionContextScope; } SIP_SKIP
770
777 QgsExpressionContextScope *defaultExpressionContextScope() const SIP_FACTORY;
778
779 QgsExpressionContext createExpressionContext() const override;
780
785 void setSegmentationTolerance( double tolerance );
786
791 void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
792
796 QList< QgsMapCanvasAnnotationItem *> annotationItems() const;
797
802 bool annotationsVisible() const { return mAnnotationsVisible; }
803
808 void setAnnotationsVisible( bool visible );
809
813 void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
814
818 const QgsLabelingEngineSettings &labelingEngineSettings() const;
819
827 bool previewJobsEnabled() const;
828
836 void setPreviewJobsEnabled( bool enabled );
837
843 void setCustomDropHandlers( const QVector<QPointer<QgsCustomDropHandler >> &handlers ) SIP_SKIP;
844
855 void setTemporalRange( const QgsDateTimeRange &range );
856
863 const QgsDateTimeRange &temporalRange() const;
864
876 void installInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
877
885 void removeInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
886
892 bool allowInteraction( QgsMapCanvasInteractionBlocker::Interaction interaction ) const;
893
901 void setMapController( QgsAbstract2DMapController *controller SIP_TRANSFER );
902
903 public slots:
904
906 void refresh();
907
916 void refreshAllLayers();
917
926 void redrawAllLayers();
927
929 void selectionChangedSlot();
930
932 void saveAsImage( const QString &fileName, QPixmap *QPixmap = nullptr, const QString & = "PNG" );
933
935 void layerStateChange();
936
944 void setRenderFlag( bool flag );
945
949 void stopRendering();
950
952 void readProject( const QDomDocument & );
953
955 void writeProject( QDomDocument & );
956
964 void setMagnificationFactor( double factor, const QgsPointXY *center = nullptr );
965
970 void setScaleLocked( bool isLocked );
971
973 void zoomIn();
974
976 void zoomOut();
977
982 void zoomToSelected( QgsMapLayer *layer = nullptr );
983
989 void zoomToSelected( const QList<QgsMapLayer *> &layers );
990
996 void setZoomResolutions( const QList<double> &resolutions ) { mZoomResolutions = resolutions; }
997
1001 double zoomInFactor() const;
1002
1006 double zoomOutFactor() const;
1007
1013 const QList<double> &zoomResolutions() const { return mZoomResolutions; }
1014
1023 QgsDoubleRange zRange() const;
1024
1033 void setZRange( const QgsDoubleRange &range );
1034
1035 private slots:
1037 void mapToolDestroyed();
1038
1040 void rendererJobFinished();
1041
1043 void previewJobFinished();
1044
1045 void mapUpdateTimeout();
1046
1047 void refreshMap();
1048
1049 void mapThemeChanged( const QString &theme );
1051 void mapThemeRenamed( const QString &theme, const QString &newTheme );
1052
1053 void updateDevicePixelFromScreen();
1054
1055 void onElevationShadingRendererChanged();
1056
1057 signals:
1058
1063 void xyCoordinates( const QgsPointXY &p );
1064
1066 void scaleChanged( double scale );
1067
1074 void scaleLockChanged( bool locked );
1075
1076
1079
1083 void rotationChanged( double rotation );
1084
1088 void magnificationChanged( double magnification );
1089
1094
1095 // TODO: deprecate when decorations are reimplemented as map canvas items
1096
1107 void renderComplete( QPainter *painter );
1108
1109 // ### QGIS 3: renamte to mapRefreshFinished()
1112
1113 // ### QGIS 3: rename to mapRefreshStarted()
1116
1122
1125
1127 void keyPressed( QKeyEvent *e );
1128
1130 void keyReleased( QKeyEvent *e );
1131
1135 void mapToolSet( QgsMapTool *newTool, QgsMapTool *oldTool );
1136
1143
1145 void zoomLastStatusChanged( bool available );
1146
1148 void zoomNextStatusChanged( bool available );
1149
1154
1159
1164
1169
1174 void themeChanged( const QString &theme );
1175
1177 void messageEmitted( const QString &title, const QString &message, Qgis::MessageLevel level = Qgis::MessageLevel::Info );
1178
1186 void renderErrorOccurred( const QString &error, QgsMapLayer *layer );
1187
1198 void panDistanceBearingChanged( double distance, Qgis::DistanceUnit unit, double bearing );
1199
1204 void tapAndHoldGestureOccurred( const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture );
1205
1212
1222
1229 void contextMenuAboutToShow( QMenu *menu, QgsMapMouseEvent *event );
1230
1231 protected:
1232
1233 bool event( QEvent *e ) override;
1234 void keyPressEvent( QKeyEvent *e ) override;
1235 void keyReleaseEvent( QKeyEvent *e ) override;
1236 void mouseDoubleClickEvent( QMouseEvent *e ) override;
1237 void mouseMoveEvent( QMouseEvent *e ) override;
1238 void mousePressEvent( QMouseEvent *e ) override;
1239 void mouseReleaseEvent( QMouseEvent *e ) override;
1240 void wheelEvent( QWheelEvent *e ) override;
1241 void resizeEvent( QResizeEvent *e ) override;
1242 void paintEvent( QPaintEvent *e ) override;
1243 void dragEnterEvent( QDragEnterEvent *e ) override;
1244 bool viewportEvent( QEvent *event ) override;
1245
1247 void moveCanvasContents( bool reset = false );
1248
1249 void dropEvent( QDropEvent *event ) override;
1250
1251 void showEvent( QShowEvent *event ) override;
1252
1258 void emitExtentsChanged();
1259
1261 class CanvasProperties;
1262
1264 std::unique_ptr<CanvasProperties> mCanvasProperties;
1265
1266#if 0
1267
1272 void connectNotify( const char *signal ) override;
1273#endif
1274
1275 protected slots:
1277 void updateCanvasItemPositions();
1278
1279 private slots:
1280
1281 void layerRepaintRequested( bool deferred );
1282
1283 void autoRefreshTriggered();
1284
1285 void updateAutoRefreshTimer();
1286
1287 void projectThemesChanged();
1288
1289 void startPreviewJob( int number );
1290
1291 void temporalControllerModeChanged();
1292
1293 private:
1294
1295 // Restore scale RAII
1296 class ScaleRestorer
1297 {
1298 public:
1299 ScaleRestorer( QgsMapCanvas *canvas ):
1300 mCanvas( canvas )
1301 {
1302 mLockedScale = mCanvas->mapSettings().scale();
1303 };
1304
1305 ~ScaleRestorer()
1306 {
1307 QgsRectangle newExtent = mCanvas->mapSettings().extent();
1308 newExtent.scale( mLockedScale / mCanvas->mapSettings().scale() );
1309 mCanvas->mSettings.setExtent( newExtent );
1310 };
1311
1312 private:
1313 QgsMapCanvas *mCanvas;
1314 double mLockedScale;
1315 };
1316
1317 enum class CacheInvalidationType
1318 {
1319 Temporal = 1 << 0,
1320 Elevation = 1 << 1,
1321 };
1322
1323 QgsOverlayWidgetLayout *mLayout = nullptr;
1324
1325 Qgis::MapCanvasFlags mFlags;
1326
1328 QgsMapSettings mSettings;
1329
1331 QgsMapCanvasMap *mMap = nullptr;
1332
1333 QgsScreenHelper *mScreenHelper = nullptr;
1334
1339 QgsTemporalController *mController = nullptr;
1340
1342 bool mFrozen = false;
1343
1345 bool mRefreshScheduled = false;
1346
1348 bool mRefreshAfterJob = false;
1349
1351 bool mRenderFlag = true;
1352
1353 QFlags<CacheInvalidationType> mCacheInvalidations;
1354
1356 QPointer< QgsMapLayer > mCurrentLayer;
1357
1359 QGraphicsScene *mScene = nullptr;
1360
1362 QgsMapTool *mMapTool = nullptr;
1363
1365 QgsProject *mProject = nullptr;
1366
1368 QList <QgsRectangle> mLastExtent;
1369 int mLastExtentIndex = -1;
1370
1372 double mWheelZoomFactor = 2.0;
1373
1375 QTimer mMapUpdateTimer;
1376
1378 QgsMapRendererQImageJob *mJob = nullptr;
1379
1381 bool mJobCanceled = false;
1382
1384 std::unique_ptr< QgsLabelingResults > mLabelingResults;
1385
1387 bool mLabelingResultsOutdated = false;
1388
1393 std::unique_ptr< QgsRenderedItemResults > mRenderedItemResults;
1394
1399 std::unique_ptr< QgsRenderedItemResults > mPreviousRenderedItemResults;
1400
1406 bool mRenderedItemResultsOutdated = false;
1407
1409 bool mUseParallelRendering = false;
1410
1412 bool mDrawRenderingStats = false;
1413
1415 QgsMapRendererCache *mCache = nullptr;
1416
1417 QTimer *mResizeTimer = nullptr;
1418 QTimer *mRefreshTimer = nullptr;
1419
1420 QgsPreviewEffect *mPreviewEffect = nullptr;
1421
1422 QgsRectangle imageRect( const QImage &img, const QgsMapSettings &mapSettings );
1423
1424 QgsSnappingUtils *mSnappingUtils = nullptr;
1425
1426 QList< QgsMapRendererQImageJob * > mPreviewJobs;
1427
1429 bool mScaleLocked = false;
1430
1431 QgsExpressionContextScope mExpressionContextScope;
1432
1434 QRect mZoomRect;
1435
1437 bool mZoomDragging = false;
1438
1440 std::unique_ptr< QgsRubberBand > mZoomRubberBand;
1441
1442 QCursor mZoomCursor;
1443
1444 QTimer mAutoRefreshTimer;
1445
1446 QTimer mPreviewTimer;
1447 QMetaObject::Connection mPreviewTimerConnection;
1448
1449 QString mTheme;
1450
1451 QgsPointXY mCursorPoint;
1452
1453 bool mAnnotationsVisible = true;
1454
1455 bool mUsePreviewJobs = false;
1456
1457 QHash< QString, int > mLastLayerRenderTime;
1458
1459 QVector<QPointer<QgsCustomDropHandler >> mDropHandlers;
1460
1461 QgsDistanceArea mDa;
1462 QList<double> mZoomResolutions;
1463
1464 QList< QgsMapCanvasInteractionBlocker * > mInteractionBlockers;
1465
1466 int mBlockItemPositionUpdates = 0;
1467 int mBlockExtentChangedSignal = 0;
1468 int mBlockScaleChangedSignal = 0;
1469
1470 std::unique_ptr< QgsTemporaryCursorOverride > mTemporaryCursorOverride;
1471
1479 QMap <QString, QDateTime> mRendererErrors;
1480
1481
1482 QPointer< QgsAbstract2DMapController > mMapController;
1483
1488 QgsPointXY cursorPoint() const;
1489
1493 void updateMapSize();
1494
1499 void beginZoomRect( QPoint pos );
1500
1505 void endZoomRect( QPoint pos );
1506
1508 void stopZoomRect();
1509
1511 void startPan();
1512
1514 void stopPan();
1515
1524 bool boundingBoxOfFeatureIds( const QgsFeatureIds &ids, QgsVectorLayer *layer, QgsRectangle &bbox, QString &errorMsg ) const;
1525
1532 QgsRectangle optimalExtentForPointLayer( QgsVectorLayer *layer, const QgsPointXY &center, int scaleFactor = 5 );
1533
1534 void setLayersPrivate( const QList<QgsMapLayer *> &layers );
1535
1536 void startPreviewJobs();
1537 void stopPreviewJobs();
1538 void schedulePreviewJob( int number );
1539
1543 bool panOperationInProgress();
1544
1545 int nextZoomLevel( const QList<double> &resolutions, bool zoomIn = true ) const;
1546
1551 void clearTemporalCache();
1552
1556 void clearElevationCache();
1557
1558 void showContextMenu( QgsMapMouseEvent *event );
1559
1564 void notifyRendererErrors( const QgsMapRendererJob::Errors &errors );
1565
1566 friend class TestQgsMapCanvas;
1567
1568}; // class QgsMapCanvas
1569
1570// clazy:excludeall=qstring-allocations
1571
1572#endif
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
DistanceUnit
Units of distance.
Definition qgis.h:4669
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition qgis.h:154
@ Info
Information message.
Definition qgis.h:155
QFlags< MapCanvasFlag > MapCanvasFlags
Flags controlling behavior of map canvases.
Definition qgis.h:3211
Abstract base class for all 2D map controllers.
Abstract base class for all geometries.
This class represents a coordinate reference system (CRS).
Custom exception class for Coordinate Reference System related exceptions.
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
QgsRange which stores a range of double values.
Definition qgsrange.h:231
Abstract interface for generating an expression context.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A geometry is the spatial representation of a feature.
A class for highlight features on the map.
Stores global configuration for labeling engine.
Class that stores computed placement from labeling engine.
An interactive map canvas item which displays a QgsAnnotation.
An interface for objects which block interactions with a QgsMapCanvas.
Interaction
Available interactions to block.
Deprecated to be deleted, stuff from here should be moved elsewhere.
Map canvas is a class for displaying all GIS data types on a canvas.
void contextMenuAboutToShow(QMenu *menu, QgsMapMouseEvent *event)
Emitted before the map canvas context menu will be shown.
void selectionChanged(QgsMapLayer *layer)
Emitted when selection in any layer gets changed.
void extentsChanged()
Emitted when the extents of the map change.
void xyCoordinates(const QgsPointXY &p)
Emits current mouse position.
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
void setZoomResolutions(const QList< double > &resolutions)
Set a list of resolutions (map units per pixel) to which to "snap to" when zooming the map.
QString theme() const
Returns the map's theme shown in the canvas, if set.
QVector< T > layers() const
Returns a list of registered map layers with a specified layer type.
void tapAndHoldGestureOccurred(const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture)
Emitted whenever a tap and hold gesture occurs at the specified map point.
const QList< double > & zoomResolutions() const
void panDistanceBearingChanged(double distance, Qgis::DistanceUnit unit, double bearing)
Emitted whenever the distance or bearing of an in-progress panning operation is changed.
bool scaleLocked() const
Returns whether the scale is locked, so zooming can be performed using magnication.
void zRangeChanged()
Emitted when the map canvas z (elevation) range changes.
void scaleChanged(double scale)
Emitted when the scale of the map changes.
void mapToolSet(QgsMapTool *newTool, QgsMapTool *oldTool)
Emit map tool changed with the old tool.
void canvasColorChanged()
Emitted when canvas background color changes.
void magnificationChanged(double magnification)
Emitted when the scale of the map changes.
void currentLayerChanged(QgsMapLayer *layer)
Emitted when the current layer is changed.
void renderErrorOccurred(const QString &error, QgsMapLayer *layer)
Emitted whenever an error is encountered during a map render operation.
void mapRefreshCanceled()
Emitted when the pending map refresh has been canceled.
void renderStarting()
Emitted when the canvas is about to be rendered.
std::unique_ptr< CanvasProperties > mCanvasProperties
Handle pattern for implementation object.
void keyReleased(QKeyEvent *e)
Emit key release event.
const QgsExpressionContextScope & expressionContextScope() const
Returns a const reference to the expression context scope for the map canvas.
void layerStyleOverridesChanged()
Emitted when the configuration of overridden layer styles changes.
void zoomNextStatusChanged(bool available)
Emitted when zoom next status changed.
void rotationChanged(double rotation)
Emitted when the rotation of the map changes.
void messageEmitted(const QString &title, const QString &message, Qgis::MessageLevel level=Qgis::MessageLevel::Info)
emit a message (usually to be displayed in a message bar)
void scaleLockChanged(bool locked)
Emitted when the scale locked state of the map changes.
bool renderFlag() const
Returns true if canvas render is disabled as a result of user disabling renders via the GUI.
void temporalRangeChanged()
Emitted when the map canvas temporal range changes.
void zoomLastStatusChanged(bool available)
Emitted when zoom last status changed.
void themeChanged(const QString &theme)
Emitted when the canvas has been assigned a different map theme.
void destinationCrsChanged()
Emitted when map CRS has changed.
void transformContextChanged()
Emitted when the canvas transform context is changed.
void keyPressed(QKeyEvent *e)
Emit key press event.
void mapCanvasRefreshed()
Emitted when canvas finished a refresh request.
void layersChanged()
Emitted when a new set of layers has been received.
void renderComplete(QPainter *painter)
Emitted when the canvas has rendered.
void setExpressionContextScope(const QgsExpressionContextScope &scope)
Sets an expression context scope for the map canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:76
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
A widget that displays an overview map.
This class is responsible for keeping cache of rendered images resulting from a map rendering job.
QList< QgsMapRendererJob::Error > Errors
Intermediate base class adding functionality that allows client to query the rendered image.
The QgsMapSettings class contains configuration for rendering of the map.
Perform transforms between map coordinates and device coordinates.
Abstract base class for all map tools.
Definition qgsmaptool.h:71
A custom layout which can be used to overlay child widgets over a parent widget.
A class to represent a 2D point.
Definition qgspointxy.h:60
A graphics effect which can be applied to a widget to simulate various printing and color blindness m...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
A rectangle specified with double values.
void scale(double scaleFactor, const QgsPointXY *c=nullptr)
Scale the rectangle around its center point.
A QgsRectangle with associated coordinate reference system.
Stores collated details of rendered items during a map rendering operation.
A class for drawing transient features (e.g.
A utility class for dynamic handling of changes to screen properties.
This class has all the configuration of snapping and can return answers to snapping queries.
A controller base class for temporal objects, contains a signal for notifying updates of the objects ...
Temporarily sets a cursor override for the QApplication for the lifetime of the object.
Represents a vector layer which manages a vector based data sets.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_KEEPREFERENCE
Definition qgis_sip.h:86
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_THROW(name,...)
Definition qgis_sip.h:203
#define SIP_END
Definition qgis_sip.h:208
QSet< QgsFeatureId > QgsFeatureIds
const QgsCoordinateReferenceSystem & crs