QGIS API Documentation 3.41.0-Master (3440c17df1d)
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
548 void freeze( bool frozen = true );
549
559 bool isFrozen() const;
560
571 bool renderFlag() const { return mRenderFlag; }
572
577 Qgis::DistanceUnit mapUnits() const;
578
583 QMap<QString, QString> layerStyleOverrides() const;
584
595 void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
596
614 void setTheme( const QString &theme );
615
620 QString theme() const { return mTheme; }
621
623 const QgsMapToPixel *getCoordinateTransform();
624
626 bool isDrawing();
627
629 QgsMapLayer *currentLayer();
630
632 void setWheelFactor( double factor );
633
641 void zoomScale( double scale, bool ignoreScaleLock = false );
642
650 void zoomByFactor( double scaleFactor, const QgsPointXY *center = nullptr, bool ignoreScaleLock = false );
651
653 void zoomWithCenter( int x, int y, bool zoomIn );
654
659 void zoomToFeatureExtent( QgsRectangle &rect );
660
665 bool scaleLocked() const { return mScaleLocked;}
666
668 void enableAntiAliasing( bool flag );
669
671 bool antiAliasingEnabled() const;
672
674 void enableMapTileRendering( bool flag );
675
676 // following 2 methods should be moved elsewhere or changed to private
677 // currently used by pan map tool
679 void panActionEnd( QPoint releasePoint );
680
681#ifndef SIP_RUN
682
688 void panActionStart( QPoint releasePoint );
689#endif
690
692 void panAction( QMouseEvent *event );
693
695 QPoint mouseLastXY();
696
702 void setPreviewModeEnabled( bool previewEnabled );
703
710 bool previewModeEnabled() const;
711
720 void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
721
729 QgsPreviewEffect::PreviewMode previewMode() const;
730
738 QgsSnappingUtils *snappingUtils() const;
739
747 void setSnappingUtils( QgsSnappingUtils *utils );
748
758 void setExpressionContextScope( const QgsExpressionContextScope &scope ) { mExpressionContextScope = scope; }
759
767 QgsExpressionContextScope &expressionContextScope() { return mExpressionContextScope; }
768
775 const QgsExpressionContextScope &expressionContextScope() const { return mExpressionContextScope; } SIP_SKIP
776
783 QgsExpressionContextScope *defaultExpressionContextScope() const SIP_FACTORY;
784
785 QgsExpressionContext createExpressionContext() const override;
786
791 void setSegmentationTolerance( double tolerance );
792
797 void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
798
802 QList< QgsMapCanvasAnnotationItem *> annotationItems() const;
803
808 bool annotationsVisible() const { return mAnnotationsVisible; }
809
814 void setAnnotationsVisible( bool visible );
815
819 void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
820
824 const QgsLabelingEngineSettings &labelingEngineSettings() const;
825
833 bool previewJobsEnabled() const;
834
842 void setPreviewJobsEnabled( bool enabled );
843
849 void setCustomDropHandlers( const QVector<QPointer<QgsCustomDropHandler >> &handlers ) SIP_SKIP;
850
861 void setTemporalRange( const QgsDateTimeRange &range );
862
869 const QgsDateTimeRange &temporalRange() const;
870
882 void installInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
883
891 void removeInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
892
898 bool allowInteraction( QgsMapCanvasInteractionBlocker::Interaction interaction ) const;
899
907 void setMapController( QgsAbstract2DMapController *controller SIP_TRANSFER );
908
909 public slots:
910
912 void refresh();
913
922 void refreshAllLayers();
923
932 void redrawAllLayers();
933
935 void selectionChangedSlot();
936
938 void saveAsImage( const QString &fileName, QPixmap *QPixmap = nullptr, const QString & = "PNG" );
939
941 void layerStateChange();
942
952 void setRenderFlag( bool flag );
953
957 void stopRendering();
958
960 void readProject( const QDomDocument & );
961
963 void writeProject( QDomDocument & );
964
972 void setMagnificationFactor( double factor, const QgsPointXY *center = nullptr );
973
978 void setScaleLocked( bool isLocked );
979
981 void zoomIn();
982
984 void zoomOut();
985
990 void zoomToSelected( QgsMapLayer *layer = nullptr );
991
997 void zoomToSelected( const QList<QgsMapLayer *> &layers );
998
1004 void setZoomResolutions( const QList<double> &resolutions ) { mZoomResolutions = resolutions; }
1005
1009 double zoomInFactor() const;
1010
1014 double zoomOutFactor() const;
1015
1021 const QList<double> &zoomResolutions() const { return mZoomResolutions; }
1022
1031 QgsDoubleRange zRange() const;
1032
1041 void setZRange( const QgsDoubleRange &range );
1042
1043 private slots:
1045 void mapToolDestroyed();
1046
1048 void rendererJobFinished();
1049
1051 void previewJobFinished();
1052
1053 void mapUpdateTimeout();
1054
1055 void refreshMap();
1056
1057 void mapThemeChanged( const QString &theme );
1059 void mapThemeRenamed( const QString &theme, const QString &newTheme );
1060
1061 void updateDevicePixelFromScreen();
1062
1063 void onElevationShadingRendererChanged();
1064
1065 signals:
1066
1071 void xyCoordinates( const QgsPointXY &p );
1072
1074 void scaleChanged( double scale );
1075
1082 void scaleLockChanged( bool locked );
1083
1084
1087
1091 void rotationChanged( double rotation );
1092
1096 void magnificationChanged( double magnification );
1097
1102
1103 // TODO: deprecate when decorations are reimplemented as map canvas items
1104
1115 void renderComplete( QPainter *painter );
1116
1117 // ### QGIS 3: renamte to mapRefreshFinished()
1120
1121 // ### QGIS 3: rename to mapRefreshStarted()
1124
1130
1133
1135 void keyPressed( QKeyEvent *e );
1136
1138 void keyReleased( QKeyEvent *e );
1139
1143 void mapToolSet( QgsMapTool *newTool, QgsMapTool *oldTool );
1144
1151
1153 void zoomLastStatusChanged( bool available );
1154
1156 void zoomNextStatusChanged( bool available );
1157
1162
1167
1172
1177
1182 void themeChanged( const QString &theme );
1183
1185 void messageEmitted( const QString &title, const QString &message, Qgis::MessageLevel level = Qgis::MessageLevel::Info );
1186
1194 void renderErrorOccurred( const QString &error, QgsMapLayer *layer );
1195
1206 void panDistanceBearingChanged( double distance, Qgis::DistanceUnit unit, double bearing );
1207
1212 void tapAndHoldGestureOccurred( const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture );
1213
1220
1230
1237 void contextMenuAboutToShow( QMenu *menu, QgsMapMouseEvent *event );
1238
1239 protected:
1240
1241 bool event( QEvent *e ) override;
1242 void keyPressEvent( QKeyEvent *e ) override;
1243 void keyReleaseEvent( QKeyEvent *e ) override;
1244 void mouseDoubleClickEvent( QMouseEvent *e ) override;
1245 void mouseMoveEvent( QMouseEvent *e ) override;
1246 void mousePressEvent( QMouseEvent *e ) override;
1247 void mouseReleaseEvent( QMouseEvent *e ) override;
1248 void wheelEvent( QWheelEvent *e ) override;
1249 void resizeEvent( QResizeEvent *e ) override;
1250 void paintEvent( QPaintEvent *e ) override;
1251 void dragEnterEvent( QDragEnterEvent *e ) override;
1252 bool viewportEvent( QEvent *event ) override;
1253
1255 void moveCanvasContents( bool reset = false );
1256
1257 void dropEvent( QDropEvent *event ) override;
1258
1259 void showEvent( QShowEvent *event ) override;
1260
1266 void emitExtentsChanged();
1267
1269 class CanvasProperties;
1270
1272 std::unique_ptr<CanvasProperties> mCanvasProperties;
1273
1274#if 0
1275
1280 void connectNotify( const char *signal ) override;
1281#endif
1282
1283 protected slots:
1285 void updateCanvasItemPositions();
1286
1287 private slots:
1288
1289 void layerRepaintRequested( bool deferred );
1290
1291 void autoRefreshTriggered();
1292
1293 void updateAutoRefreshTimer();
1294
1295 void projectThemesChanged();
1296
1297 void startPreviewJob( int number );
1298
1299 void temporalControllerModeChanged();
1300
1301 private:
1302
1303 // Restore scale RAII
1304 class ScaleRestorer
1305 {
1306 public:
1307 ScaleRestorer( QgsMapCanvas *canvas ):
1308 mCanvas( canvas )
1309 {
1310 mLockedScale = mCanvas->mapSettings().scale();
1311 };
1312
1313 ~ScaleRestorer()
1314 {
1315 QgsRectangle newExtent = mCanvas->mapSettings().extent();
1316 newExtent.scale( mLockedScale / mCanvas->mapSettings().scale() );
1317 mCanvas->mSettings.setExtent( newExtent );
1318 };
1319
1320 private:
1321 QgsMapCanvas *mCanvas;
1322 double mLockedScale;
1323 };
1324
1325 enum class CacheInvalidationType
1326 {
1327 Temporal = 1 << 0,
1328 Elevation = 1 << 1,
1329 };
1330
1331 QgsOverlayWidgetLayout *mLayout = nullptr;
1332
1333 Qgis::MapCanvasFlags mFlags;
1334
1336 QgsMapSettings mSettings;
1337
1339 QgsMapCanvasMap *mMap = nullptr;
1340
1341 QgsScreenHelper *mScreenHelper = nullptr;
1342
1347 QgsTemporalController *mController = nullptr;
1348
1350 bool mFrozen = false;
1351
1353 bool mRefreshScheduled = false;
1354
1356 bool mRefreshAfterJob = false;
1357
1359 bool mRenderFlag = true;
1360
1361 QFlags<CacheInvalidationType> mCacheInvalidations;
1362
1364 QPointer< QgsMapLayer > mCurrentLayer;
1365
1367 QGraphicsScene *mScene = nullptr;
1368
1370 QgsMapTool *mMapTool = nullptr;
1371
1373 QgsProject *mProject = nullptr;
1374
1376 QList <QgsRectangle> mLastExtent;
1377 int mLastExtentIndex = -1;
1378
1380 double mWheelZoomFactor = 2.0;
1381
1383 QTimer mMapUpdateTimer;
1384
1386 QgsMapRendererQImageJob *mJob = nullptr;
1387
1389 bool mJobCanceled = false;
1390
1392 std::unique_ptr< QgsLabelingResults > mLabelingResults;
1393
1395 bool mLabelingResultsOutdated = false;
1396
1401 std::unique_ptr< QgsRenderedItemResults > mRenderedItemResults;
1402
1407 std::unique_ptr< QgsRenderedItemResults > mPreviousRenderedItemResults;
1408
1414 bool mRenderedItemResultsOutdated = false;
1415
1417 bool mUseParallelRendering = false;
1418
1420 bool mDrawRenderingStats = false;
1421
1423 QgsMapRendererCache *mCache = nullptr;
1424
1425 QTimer *mResizeTimer = nullptr;
1426 QTimer *mRefreshTimer = nullptr;
1427
1428 QgsPreviewEffect *mPreviewEffect = nullptr;
1429
1430 QgsRectangle imageRect( const QImage &img, const QgsMapSettings &mapSettings );
1431
1432 QgsSnappingUtils *mSnappingUtils = nullptr;
1433
1434 QList< QgsMapRendererQImageJob * > mPreviewJobs;
1435
1437 bool mScaleLocked = false;
1438
1439 QgsExpressionContextScope mExpressionContextScope;
1440
1442 QRect mZoomRect;
1443
1445 bool mZoomDragging = false;
1446
1448 std::unique_ptr< QgsRubberBand > mZoomRubberBand;
1449
1450 QCursor mZoomCursor;
1451
1452 QTimer mAutoRefreshTimer;
1453
1454 QTimer mPreviewTimer;
1455 QMetaObject::Connection mPreviewTimerConnection;
1456
1457 QString mTheme;
1458
1459 QgsPointXY mCursorPoint;
1460
1461 bool mAnnotationsVisible = true;
1462
1463 bool mUsePreviewJobs = false;
1464
1465 QHash< QString, int > mLastLayerRenderTime;
1466
1467 QVector<QPointer<QgsCustomDropHandler >> mDropHandlers;
1468
1469 QgsDistanceArea mDa;
1470 QList<double> mZoomResolutions;
1471
1472 QList< QgsMapCanvasInteractionBlocker * > mInteractionBlockers;
1473
1474 int mBlockItemPositionUpdates = 0;
1475 int mBlockExtentChangedSignal = 0;
1476 int mBlockScaleChangedSignal = 0;
1477
1478 std::unique_ptr< QgsTemporaryCursorOverride > mTemporaryCursorOverride;
1479
1487 QMap <QString, QDateTime> mRendererErrors;
1488
1489
1490 QPointer< QgsAbstract2DMapController > mMapController;
1491
1496 QgsPointXY cursorPoint() const;
1497
1501 void updateMapSize();
1502
1507 void beginZoomRect( QPoint pos );
1508
1513 void endZoomRect( QPoint pos );
1514
1516 void stopZoomRect();
1517
1519 void startPan();
1520
1522 void stopPan();
1523
1532 bool boundingBoxOfFeatureIds( const QgsFeatureIds &ids, QgsVectorLayer *layer, QgsRectangle &bbox, QString &errorMsg ) const;
1533
1540 QgsRectangle optimalExtentForPointLayer( QgsVectorLayer *layer, const QgsPointXY &center, int scaleFactor = 5 );
1541
1542 void setLayersPrivate( const QList<QgsMapLayer *> &layers );
1543
1544 void startPreviewJobs();
1545 void stopPreviewJobs();
1546 void schedulePreviewJob( int number );
1547
1551 bool panOperationInProgress();
1552
1553 int nextZoomLevel( const QList<double> &resolutions, bool zoomIn = true ) const;
1554
1559 void clearTemporalCache();
1560
1564 void clearElevationCache();
1565
1566 void showContextMenu( QgsMapMouseEvent *event );
1567
1572 void notifyRendererErrors( const QgsMapRendererJob::Errors &errors );
1573
1574 friend class TestQgsMapCanvas;
1575
1576}; // class QgsMapCanvas
1577
1578// clazy:excludeall=qstring-allocations
1579
1580#endif
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
DistanceUnit
Units of distance.
Definition qgis.h:4677
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:3219
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