QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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 
24 #include "qgsexpressioncontext.h"
25 #include "qgsrectangle.h"
26 #include "qgsfeatureid.h"
27 #include "qgsgeometry.h"
28 #include "qgscustomdrophandler.h"
29 #include "qgstemporalrangeobject.h"
31 #include "qgsproject.h"
32 #include "qgsdistancearea.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 
44 class QWheelEvent;
45 class QPixmap;
46 class QPaintEvent;
47 class QKeyEvent;
48 class ResizeEvent;
49 
50 class QColor;
51 class QDomDocument;
52 class QPaintDevice;
53 class QMouseEvent;
54 class QRubberBand;
55 class QGraphicsScene;
56 
57 class QgsMapToPixel;
58 class QgsMapLayer;
59 class QgsHighlight;
60 class QgsVectorLayer;
61 
62 class QgsLabelingResults;
63 
66 class QgsMapSettings;
67 class QgsMapCanvasMap;
69 class QgsMapTool;
70 class QgsSnappingUtils;
71 class QgsRubberBand;
76 
78 
79 class QMenu;
80 class QgsMapMouseEvent;
81 
82 
88 class GUI_EXPORT QgsMapCanvas : public QGraphicsView, public QgsExpressionContextGenerator
89 {
90 
91 #ifdef SIP_RUN
93  if ( qobject_cast<QgsMapCanvas *>( sipCpp ) != nullptr )
94  sipType = sipType_QgsMapCanvas;
95  else
96  sipType = nullptr;
97  SIP_END
98 #endif
99 
100  Q_OBJECT
101  Q_PROPERTY( QString theme READ theme WRITE setTheme NOTIFY themeChanged )
102  Q_PROPERTY( bool previewJobsEnabled READ previewJobsEnabled WRITE setPreviewJobsEnabled )
103 
104  public:
105 
107  QgsMapCanvas( QWidget *parent SIP_TRANSFERTHIS = nullptr );
108 
109  ~QgsMapCanvas() override;
110 
115  double magnificationFactor() const;
116 
128  void setLayers( const QList<QgsMapLayer *> &layers );
129 
130  void setCurrentLayer( QgsMapLayer *layer );
131 
136  const QgsMapSettings &mapSettings() const SIP_KEEPREFERENCE;
137 
144  void setTemporalController( QgsTemporalController *controller );
145 
152  const QgsTemporalController *temporalController() const;
153 
158  void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
159 
164  void setMapSettingsFlags( Qgis::MapSettingsFlags flags );
165 
174  const QgsLabelingResults *labelingResults( bool allowOutdatedResults = true ) const;
175 
185  const QgsRenderedItemResults *renderedItemResults( bool allowOutdatedResults = true ) const;
186 
191  void setCachingEnabled( bool enabled );
192 
197  bool isCachingEnabled() const;
198 
203  void clearCache();
204 
209  void cancelJobs() SIP_SKIP;
210 
220  void waitWhileRendering();
221 
226  void setParallelRenderingEnabled( bool enabled );
227 
232  bool isParallelRenderingEnabled() const;
233 
238  void setMapUpdateInterval( int timeMilliseconds );
239 
244  int mapUpdateInterval() const;
245 
250  double scale() const;
251 
253  double mapUnitsPerPixel() const;
254 
256  QgsRectangle extent() const;
257 
266  QgsRectangle fullExtent() const;
267 
277  QgsRectangle projectExtent() const;
278 
290  void setExtent( const QgsRectangle &r, bool magnified = false );
291 
300  bool setReferencedExtent( const QgsReferencedRectangle &extent ) SIP_THROW( QgsCsException );
301 
306  double rotation() const;
307 
312  void setRotation( double degrees );
313 
318  void setCenter( const QgsPointXY &center );
319 
324  QgsPointXY center() const;
325 
331  void zoomToFullExtent();
332 
341  void zoomToProjectExtent();
342 
344  void zoomToPreviousExtent();
345 
347  void zoomToNextExtent();
348 
350  void clearExtentHistory();
351 
352 
358  void zoomToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
359 
366  void panToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids, bool alwaysRecenter = true );
367 
369  void panToSelected( QgsVectorLayer *layer = nullptr );
370 
376  void panToSelected( const QList<QgsMapLayer *> &layers );
377 
390  void flashFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids,
391  const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
392  int flashes = 3, int duration = 500 );
393 
406  void flashGeometries( const QList< QgsGeometry > &geometries, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem(),
407  const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
408  int flashes = 3, int duration = 500 );
409 
411  void setMapTool( QgsMapTool *mapTool, bool clean = false );
412 
420  void unsetMapTool( QgsMapTool *mapTool );
421 
423  QgsMapTool *mapTool();
424 
430  void setProject( QgsProject *project );
431 
438  QgsProject *project();
439 
441  void setCanvasColor( const QColor &_newVal );
443  QColor canvasColor() const;
444 
449  void setSelectionColor( const QColor &color );
450 
455  QColor selectionColor() const;
456 
458  void updateScale();
459 
461  QgsMapLayer *layer( int index );
462 
473  QgsMapLayer *layer( const QString &id );
474 
476  int layerCount() const;
477 
482  QList<QgsMapLayer *> layers() const;
483 
493  void freeze( bool frozen = true );
494 
502  bool isFrozen() const;
503 
512  bool renderFlag() const { return mRenderFlag; }
513 
518  QgsUnitTypes::DistanceUnit mapUnits() const;
519 
525  QMap<QString, QString> layerStyleOverrides() const;
526 
538  void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
539 
558  void setTheme( const QString &theme );
559 
565  QString theme() const { return mTheme; }
566 
568  const QgsMapToPixel *getCoordinateTransform();
569 
571  bool isDrawing();
572 
574  QgsMapLayer *currentLayer();
575 
577  void setWheelFactor( double factor );
578 
586  void zoomScale( double scale, bool ignoreScaleLock = false );
587 
595  void zoomByFactor( double scaleFactor, const QgsPointXY *center = nullptr, bool ignoreScaleLock = false );
596 
598  void zoomWithCenter( int x, int y, bool zoomIn );
599 
604  void zoomToFeatureExtent( QgsRectangle &rect );
605 
611  bool scaleLocked() const { return mScaleLocked;}
612 
614  void enableAntiAliasing( bool flag );
615 
617  bool antiAliasingEnabled() const;
618 
620  void enableMapTileRendering( bool flag );
621 
622  // following 2 methods should be moved elsewhere or changed to private
623  // currently used by pan map tool
625  void panActionEnd( QPoint releasePoint );
626 
627 #ifndef SIP_RUN
628 
634  void panActionStart( QPoint releasePoint );
635 #endif
636 
638  void panAction( QMouseEvent *event );
639 
641  QPoint mouseLastXY();
642 
649  void setPreviewModeEnabled( bool previewEnabled );
650 
658  bool previewModeEnabled() const;
659 
669  void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
670 
679  QgsPreviewEffect::PreviewMode previewMode() const;
680 
689  QgsSnappingUtils *snappingUtils() const;
690 
699  void setSnappingUtils( QgsSnappingUtils *utils );
700 
711  void setExpressionContextScope( const QgsExpressionContextScope &scope ) { mExpressionContextScope = scope; }
712 
721  QgsExpressionContextScope &expressionContextScope() { return mExpressionContextScope; }
722 
730  const QgsExpressionContextScope &expressionContextScope() const { return mExpressionContextScope; } SIP_SKIP
731 
738  QgsExpressionContextScope *defaultExpressionContextScope() const SIP_FACTORY;
739 
740  QgsExpressionContext createExpressionContext() const override;
741 
746  void setSegmentationTolerance( double tolerance );
747 
752  void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
753 
758  QList< QgsMapCanvasAnnotationItem *> annotationItems() const;
759 
765  bool annotationsVisible() const { return mAnnotationsVisible; }
766 
772  void setAnnotationsVisible( bool visible );
773 
778  void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
779 
784  const QgsLabelingEngineSettings &labelingEngineSettings() const;
785 
794  bool previewJobsEnabled() const;
795 
804  void setPreviewJobsEnabled( bool enabled );
805 
811  void setCustomDropHandlers( const QVector<QPointer<QgsCustomDropHandler >> &handlers ) SIP_SKIP;
812 
823  void setTemporalRange( const QgsDateTimeRange &range );
824 
831  const QgsDateTimeRange &temporalRange() const;
832 
844  void installInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
845 
853  void removeInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
854 
860  bool allowInteraction( QgsMapCanvasInteractionBlocker::Interaction interaction ) const;
861 
862  public slots:
863 
865  void refresh();
866 
876  void refreshAllLayers();
877 
886  void redrawAllLayers();
887 
889  void selectionChangedSlot();
890 
892  void saveAsImage( const QString &fileName, QPixmap *QPixmap = nullptr, const QString & = "PNG" );
893 
895  void layerStateChange();
896 
904  void setRenderFlag( bool flag );
905 
910  void stopRendering();
911 
913  void readProject( const QDomDocument & );
914 
916  void writeProject( QDomDocument & );
917 
926  void setMagnificationFactor( double factor, const QgsPointXY *center = nullptr );
927 
933  void setScaleLocked( bool isLocked );
934 
936  void zoomIn();
937 
939  void zoomOut();
940 
945  void zoomToSelected( QgsVectorLayer *layer = nullptr );
946 
952  void zoomToSelected( const QList<QgsMapLayer *> &layers );
953 
959  void setZoomResolutions( const QList<double> &resolutions ) { mZoomResolutions = resolutions; }
960 
964  double zoomInFactor() const;
965 
969  double zoomOutFactor() const;
970 
976  const QList<double> &zoomResolutions() const { return mZoomResolutions; }
977 
986  QgsDoubleRange zRange() const;
987 
996  void setZRange( const QgsDoubleRange &range );
997 
998  private slots:
1000  void mapToolDestroyed();
1001 
1003  void rendererJobFinished();
1004 
1006  void previewJobFinished();
1007 
1008  void mapUpdateTimeout();
1009 
1010  void refreshMap();
1011 
1012  void mapThemeChanged( const QString &theme );
1014  void mapThemeRenamed( const QString &theme, const QString &newTheme );
1015 
1016  void updateDevicePixelFromScreen();
1017 
1018  signals:
1019 
1024  void xyCoordinates( const QgsPointXY &p );
1025 
1027  void scaleChanged( double );
1028 
1035  void scaleLockChanged( bool locked );
1036 
1037 
1040 
1045  void rotationChanged( double );
1046 
1051  void magnificationChanged( double );
1052 
1058 
1059  // TODO: deprecate when decorations are reimplemented as map canvas items
1060 
1071  void renderComplete( QPainter * );
1072 
1073  // ### QGIS 3: renamte to mapRefreshFinished()
1076 
1077  // ### QGIS 3: rename to mapRefreshStarted()
1080 
1086 
1089 
1091  void keyPressed( QKeyEvent *e );
1092 
1094  void keyReleased( QKeyEvent *e );
1095 
1100  void mapToolSet( QgsMapTool *newTool, QgsMapTool *oldTool );
1101 
1102 
1105 
1108 
1111 
1117 
1123 
1129 
1135 
1141  void themeChanged( const QString &theme );
1142 
1144  void messageEmitted( const QString &title, const QString &message, Qgis::MessageLevel = Qgis::MessageLevel::Info );
1145 
1153  void renderErrorOccurred( const QString &error, QgsMapLayer *layer );
1154 
1165  void panDistanceBearingChanged( double distance, QgsUnitTypes::DistanceUnit unit, double bearing );
1166 
1171  void tapAndHoldGestureOccurred( const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture );
1172 
1179 
1189 
1196  void contextMenuAboutToShow( QMenu *menu, QgsMapMouseEvent *event );
1197 
1198  protected:
1199 
1200  bool event( QEvent *e ) override;
1201  void keyPressEvent( QKeyEvent *e ) override;
1202  void keyReleaseEvent( QKeyEvent *e ) override;
1203  void mouseDoubleClickEvent( QMouseEvent *e ) override;
1204  void mouseMoveEvent( QMouseEvent *e ) override;
1205  void mousePressEvent( QMouseEvent *e ) override;
1206  void mouseReleaseEvent( QMouseEvent *e ) override;
1207  void wheelEvent( QWheelEvent *e ) override;
1208  void resizeEvent( QResizeEvent *e ) override;
1209  void paintEvent( QPaintEvent *e ) override;
1210  void dragEnterEvent( QDragEnterEvent *e ) override;
1211  bool viewportEvent( QEvent *event ) override;
1212 
1214  void moveCanvasContents( bool reset = false );
1215 
1216  void dropEvent( QDropEvent *event ) override;
1217 
1218  void showEvent( QShowEvent *event ) override;
1219 
1221  class CanvasProperties;
1222 
1224  std::unique_ptr<CanvasProperties> mCanvasProperties;
1225 
1226 #if 0
1227 
1232  void connectNotify( const char *signal ) override;
1233 #endif
1234 
1235  protected slots:
1237  void updateCanvasItemPositions();
1238 
1239  private slots:
1240 
1241  void layerRepaintRequested( bool deferred );
1242 
1243  void autoRefreshTriggered();
1244 
1245  void updateAutoRefreshTimer();
1246 
1247  void projectThemesChanged();
1248 
1249  void startPreviewJob( int number );
1250 
1251  private:
1252 
1253  // Restore scale RAII
1254  class ScaleRestorer
1255  {
1256  public:
1257  ScaleRestorer( QgsMapCanvas *canvas ):
1258  mCanvas( canvas )
1259  {
1260  mLockedScale = mCanvas->mapSettings().scale();
1261  };
1262 
1263  ~ScaleRestorer()
1264  {
1265  QgsRectangle newExtent = mCanvas->mapSettings().extent();
1266  newExtent.scale( mLockedScale / mCanvas->mapSettings().scale() );
1267  mCanvas->mSettings.setExtent( newExtent );
1268  };
1269 
1270  private:
1271  QgsMapCanvas *mCanvas;
1272  double mLockedScale;
1273  };
1274 
1276  QgsMapSettings mSettings;
1277 
1279  QgsMapCanvasMap *mMap = nullptr;
1280 
1285  QgsTemporalController *mController = nullptr;
1286 
1288  bool mFrozen = false;
1289 
1291  bool mRefreshScheduled = false;
1292 
1294  bool mRefreshAfterJob = false;
1295 
1297  bool mRenderFlag = true;
1298 
1300  QPointer< QgsMapLayer > mCurrentLayer;
1301 
1303  QGraphicsScene *mScene = nullptr;
1304 
1306  QgsMapTool *mMapTool = nullptr;
1307 
1309  QgsMapTool *mLastNonZoomMapTool = nullptr;
1310 
1312  QgsProject *mProject = nullptr;
1313 
1315  QList <QgsRectangle> mLastExtent;
1316  int mLastExtentIndex = -1;
1317 
1319  double mWheelZoomFactor = 2.0;
1320 
1322  QTimer mMapUpdateTimer;
1323 
1325  QgsMapRendererQImageJob *mJob = nullptr;
1326 
1328  bool mJobCanceled = false;
1329 
1331  std::unique_ptr< QgsLabelingResults > mLabelingResults;
1332 
1334  bool mLabelingResultsOutdated = false;
1335 
1340  std::unique_ptr< QgsRenderedItemResults > mRenderedItemResults;
1341 
1346  std::unique_ptr< QgsRenderedItemResults > mPreviousRenderedItemResults;
1347 
1353  bool mRenderedItemResultsOutdated = false;
1354 
1356  bool mUseParallelRendering = false;
1357 
1359  bool mDrawRenderingStats = false;
1360 
1362  QgsMapRendererCache *mCache = nullptr;
1363 
1364  QTimer *mResizeTimer = nullptr;
1365  QTimer *mRefreshTimer = nullptr;
1366 
1367  QgsPreviewEffect *mPreviewEffect = nullptr;
1368 
1369  QgsRectangle imageRect( const QImage &img, const QgsMapSettings &mapSettings );
1370 
1371  QgsSnappingUtils *mSnappingUtils = nullptr;
1372 
1373  QList< QgsMapRendererQImageJob * > mPreviewJobs;
1374 
1376  bool mScaleLocked = false;
1377 
1378  QgsExpressionContextScope mExpressionContextScope;
1379 
1381  QRect mZoomRect;
1382 
1384  bool mZoomDragging = false;
1385 
1387  std::unique_ptr< QgsRubberBand > mZoomRubberBand;
1388 
1389  QCursor mZoomCursor;
1390 
1391  QTimer mAutoRefreshTimer;
1392 
1393  QTimer mPreviewTimer;
1394  QMetaObject::Connection mPreviewTimerConnection;
1395 
1396  QString mTheme;
1397 
1398  QgsPointXY mCursorPoint;
1399 
1400  bool mAnnotationsVisible = true;
1401 
1402  bool mUsePreviewJobs = false;
1403 
1404  QHash< QString, int > mLastLayerRenderTime;
1405 
1406  QVector<QPointer<QgsCustomDropHandler >> mDropHandlers;
1407 
1408  QgsDistanceArea mDa;
1409  QList<double> mZoomResolutions;
1410 
1411  QList< QgsMapCanvasInteractionBlocker * > mInteractionBlockers;
1412 
1413  int mBlockItemPositionUpdates = 0;
1414 
1415  QMetaObject::Connection mScreenDpiChangedConnection;
1416 
1417  std::unique_ptr< QgsTemporaryCursorOverride > mTemporaryCursorOverride;
1418 
1423  QgsPointXY cursorPoint() const;
1424 
1429  void updateMapSize();
1430 
1436  void beginZoomRect( QPoint pos );
1437 
1443  void endZoomRect( QPoint pos );
1444 
1453  bool boundingBoxOfFeatureIds( const QgsFeatureIds &ids, QgsVectorLayer *layer, QgsRectangle &bbox, QString &errorMsg ) const;
1454 
1461  QgsRectangle optimalExtentForPointLayer( QgsVectorLayer *layer, const QgsPointXY &center, int scaleFactor = 5 );
1462 
1463  void setLayersPrivate( const QList<QgsMapLayer *> &layers );
1464 
1465  void startPreviewJobs();
1466  void stopPreviewJobs();
1467  void schedulePreviewJob( int number );
1468 
1472  bool panOperationInProgress();
1473 
1474  int nextZoomLevel( const QList<double> &resolutions, bool zoomIn = true ) const;
1475 
1480  void clearTemporalCache();
1481 
1485  void clearElevationCache();
1486 
1487  void showContextMenu( QgsMapMouseEvent *event );
1488 
1489  friend class TestQgsMapCanvas;
1490 
1491 }; // class QgsMapCanvas
1492 
1493 // clazy:excludeall=qstring-allocations
1494 
1495 #endif
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:106
Abstract base class for all geometries.
This class represents a coordinate reference system (CRS).
Custom exception class for Coordinate Reference System related exceptions.
Definition: qgsexception.h:66
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
QgsRange which stores a range of double values.
Definition: qgsrange.h:203
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 class for highlight features on the map.
Definition: qgshighlight.h:62
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.
Definition: qgsmapcanvas.h:89
void messageEmitted(const QString &title, const QString &message, Qgis::MessageLevel=Qgis::MessageLevel::Info)
emit a message (usually to be displayed in a message bar)
void contextMenuAboutToShow(QMenu *menu, QgsMapMouseEvent *event)
Emitted before the map canvas context menu will be shown.
const QList< double > & zoomResolutions() const
Definition: qgsmapcanvas.h:976
void extentsChanged()
Emitted when the extents of the map change.
void xyCoordinates(const QgsPointXY &p)
Emits current mouse position.
void magnificationChanged(double)
Emitted when the scale of the map changes.
void setZoomResolutions(const QList< double > &resolutions)
Set a list of resolutions (map units per pixel) to which to "snap to" when zooming the map.
Definition: qgsmapcanvas.h:959
QString theme() const
Returns the map's theme shown in the canvas, if set.
Definition: qgsmapcanvas.h:565
void renderComplete(QPainter *)
Emitted when the canvas has rendered.
void tapAndHoldGestureOccurred(const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture)
Emitted whenever a tap and hold gesture occurs at the specified map point.
void zoomNextStatusChanged(bool)
Emitted when zoom next status changed.
void rotationChanged(double)
Emitted when the rotation of the map changes.
void selectionChanged(QgsVectorLayer *layer)
Emitted when selection in any layer gets changed.
bool scaleLocked() const
Returns whether the scale is locked, so zooming can be performed using magnication.
Definition: qgsmapcanvas.h:611
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
Definition: qgsmapcanvas.h:721
void zRangeChanged()
Emitted when the map canvas z (elevation) range changes.
void mapToolSet(QgsMapTool *newTool, QgsMapTool *oldTool)
Emit map tool changed with the old tool.
void canvasColorChanged()
Emitted when canvas background color 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.
void layerStyleOverridesChanged()
Emitted when the configuration of overridden layer styles changes.
void scaleChanged(double)
Emitted when the scale of the map changes.
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.
Definition: qgsmapcanvas.h:512
void panDistanceBearingChanged(double distance, QgsUnitTypes::DistanceUnit unit, double bearing)
Emitted whenever the distance or bearing of an in-progress panning operation is changed.
void temporalRangeChanged()
Emitted when the map canvas temporal range changes.
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 zoomLastStatusChanged(bool)
Emitted when zoom last status changed.
const QgsExpressionContextScope & expressionContextScope() const
Returns a const reference to the expression context scope for the map canvas.
Definition: qgsmapcanvas.h:730
void layersChanged()
Emitted when a new set of layers has been received.
void setExpressionContextScope(const QgsExpressionContextScope &scope)
Sets an expression context scope for the map canvas.
Definition: qgsmapcanvas.h:711
Base class for all map layer types.
Definition: qgsmaplayer.h:73
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.
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.
Definition: qgsmaptopixel.h:39
Abstract base class for all map tools.
Definition: qgsmaptool.h:71
A class to represent a 2D point.
Definition: qgspointxy.h:59
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:101
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:256
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.
Definition: qgsrubberband.h:52
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.
Definition: qgsguiutils.h:221
DistanceUnit
Units of distance.
Definition: qgsunittypes.h:68
Represents a vector layer which manages a vector based data sets.
#define SIP_THROW(name)
Definition: qgis_sip.h:189
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:177
#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_FACTORY
Definition: qgis_sip.h:76
#define SIP_END
Definition: qgis_sip.h:194
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:37
const QgsCoordinateReferenceSystem & crs