QGIS API Documentation  3.27.0-Master (e113457133)
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 #include "qgsmaprendererjob.h"
34 
35 #include <QDomDocument>
36 #include <QGraphicsView>
37 
38 #include "qgsmapsettings.h" // TEMPORARY
39 #include "qgsprevieweffect.h" //for QgsPreviewEffect::PreviewMode
40 
41 #include <QTimer>
42 #include <QGestureEvent>
43 #include "qgis_gui.h"
44 
45 class QWheelEvent;
46 class QPixmap;
47 class QPaintEvent;
48 class QKeyEvent;
49 class ResizeEvent;
50 
51 class QColor;
52 class QDomDocument;
53 class QPaintDevice;
54 class QMouseEvent;
55 class QRubberBand;
56 class QGraphicsScene;
57 
58 class QgsMapToPixel;
59 class QgsMapLayer;
60 class QgsHighlight;
61 class QgsVectorLayer;
62 
63 class QgsLabelingResults;
64 
67 class QgsMapSettings;
68 class QgsMapCanvasMap;
70 class QgsMapTool;
71 class QgsSnappingUtils;
72 class QgsRubberBand;
77 
79 
80 class QMenu;
81 class QgsMapMouseEvent;
82 
83 
89 class GUI_EXPORT QgsMapCanvas : public QGraphicsView, public QgsExpressionContextGenerator
90 {
91 
92 #ifdef SIP_RUN
94  if ( qobject_cast<QgsMapCanvas *>( sipCpp ) != nullptr )
95  sipType = sipType_QgsMapCanvas;
96  else
97  sipType = nullptr;
98  SIP_END
99 #endif
100 
101  Q_OBJECT
102  Q_PROPERTY( QString theme READ theme WRITE setTheme NOTIFY themeChanged )
103  Q_PROPERTY( bool previewJobsEnabled READ previewJobsEnabled WRITE setPreviewJobsEnabled )
104 
105  public:
106 
108  QgsMapCanvas( QWidget *parent SIP_TRANSFERTHIS = nullptr );
109 
110  ~QgsMapCanvas() override;
111 
116  double magnificationFactor() const;
117 
129  void setLayers( const QList<QgsMapLayer *> &layers );
130 
131  void setCurrentLayer( QgsMapLayer *layer );
132 
137  const QgsMapSettings &mapSettings() const SIP_KEEPREFERENCE;
138 
145  void setTemporalController( QgsTemporalController *controller );
146 
153  const QgsTemporalController *temporalController() const;
154 
159  void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
160 
165  void setMapSettingsFlags( Qgis::MapSettingsFlags flags );
166 
175  const QgsLabelingResults *labelingResults( bool allowOutdatedResults = true ) const;
176 
186  const QgsRenderedItemResults *renderedItemResults( bool allowOutdatedResults = true ) const;
187 
192  void setCachingEnabled( bool enabled );
193 
198  bool isCachingEnabled() const;
199 
204  void clearCache();
205 
210  void cancelJobs() SIP_SKIP;
211 
221  void waitWhileRendering();
222 
227  void setParallelRenderingEnabled( bool enabled );
228 
233  bool isParallelRenderingEnabled() const;
234 
239  void setMapUpdateInterval( int timeMilliseconds );
240 
245  int mapUpdateInterval() const;
246 
251  double scale() const;
252 
254  double mapUnitsPerPixel() const;
255 
257  QgsRectangle extent() const;
258 
267  QgsRectangle fullExtent() const;
268 
278  QgsRectangle projectExtent() const;
279 
291  void setExtent( const QgsRectangle &r, bool magnified = false );
292 
301  bool setReferencedExtent( const QgsReferencedRectangle &extent ) SIP_THROW( QgsCsException );
302 
307  double rotation() const;
308 
313  void setRotation( double degrees );
314 
319  void setCenter( const QgsPointXY &center );
320 
325  QgsPointXY center() const;
326 
332  void zoomToFullExtent();
333 
342  void zoomToProjectExtent();
343 
345  void zoomToPreviousExtent();
346 
348  void zoomToNextExtent();
349 
351  void clearExtentHistory();
352 
353 
359  void zoomToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
360 
367  void panToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids, bool alwaysRecenter = true );
368 
370  void panToSelected( QgsVectorLayer *layer = nullptr );
371 
377  void panToSelected( const QList<QgsMapLayer *> &layers );
378 
391  void flashFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids,
392  const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
393  int flashes = 3, int duration = 500 );
394 
407  void flashGeometries( const QList< QgsGeometry > &geometries, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem(),
408  const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
409  int flashes = 3, int duration = 500 );
410 
412  void setMapTool( QgsMapTool *mapTool, bool clean = false );
413 
421  void unsetMapTool( QgsMapTool *mapTool );
422 
424  QgsMapTool *mapTool();
425 
431  void setProject( QgsProject *project );
432 
439  QgsProject *project();
440 
442  void setCanvasColor( const QColor &_newVal );
444  QColor canvasColor() const;
445 
450  void setSelectionColor( const QColor &color );
451 
456  QColor selectionColor() const;
457 
459  void updateScale();
460 
462  QgsMapLayer *layer( int index );
463 
474  QgsMapLayer *layer( const QString &id );
475 
479  int layerCount() const;
480 
489  QList<QgsMapLayer *> layers( bool expandGroupLayers = false ) const;
490 
500  void freeze( bool frozen = true );
501 
509  bool isFrozen() const;
510 
519  bool renderFlag() const { return mRenderFlag; }
520 
525  QgsUnitTypes::DistanceUnit mapUnits() const;
526 
532  QMap<QString, QString> layerStyleOverrides() const;
533 
545  void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
546 
565  void setTheme( const QString &theme );
566 
572  QString theme() const { return mTheme; }
573 
575  const QgsMapToPixel *getCoordinateTransform();
576 
578  bool isDrawing();
579 
581  QgsMapLayer *currentLayer();
582 
584  void setWheelFactor( double factor );
585 
593  void zoomScale( double scale, bool ignoreScaleLock = false );
594 
602  void zoomByFactor( double scaleFactor, const QgsPointXY *center = nullptr, bool ignoreScaleLock = false );
603 
605  void zoomWithCenter( int x, int y, bool zoomIn );
606 
611  void zoomToFeatureExtent( QgsRectangle &rect );
612 
618  bool scaleLocked() const { return mScaleLocked;}
619 
621  void enableAntiAliasing( bool flag );
622 
624  bool antiAliasingEnabled() const;
625 
627  void enableMapTileRendering( bool flag );
628 
629  // following 2 methods should be moved elsewhere or changed to private
630  // currently used by pan map tool
632  void panActionEnd( QPoint releasePoint );
633 
634 #ifndef SIP_RUN
635 
641  void panActionStart( QPoint releasePoint );
642 #endif
643 
645  void panAction( QMouseEvent *event );
646 
648  QPoint mouseLastXY();
649 
656  void setPreviewModeEnabled( bool previewEnabled );
657 
665  bool previewModeEnabled() const;
666 
676  void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
677 
686  QgsPreviewEffect::PreviewMode previewMode() const;
687 
696  QgsSnappingUtils *snappingUtils() const;
697 
706  void setSnappingUtils( QgsSnappingUtils *utils );
707 
718  void setExpressionContextScope( const QgsExpressionContextScope &scope ) { mExpressionContextScope = scope; }
719 
728  QgsExpressionContextScope &expressionContextScope() { return mExpressionContextScope; }
729 
737  const QgsExpressionContextScope &expressionContextScope() const { return mExpressionContextScope; } SIP_SKIP
738 
745  QgsExpressionContextScope *defaultExpressionContextScope() const SIP_FACTORY;
746 
747  QgsExpressionContext createExpressionContext() const override;
748 
753  void setSegmentationTolerance( double tolerance );
754 
759  void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
760 
765  QList< QgsMapCanvasAnnotationItem *> annotationItems() const;
766 
772  bool annotationsVisible() const { return mAnnotationsVisible; }
773 
779  void setAnnotationsVisible( bool visible );
780 
785  void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
786 
791  const QgsLabelingEngineSettings &labelingEngineSettings() const;
792 
801  bool previewJobsEnabled() const;
802 
811  void setPreviewJobsEnabled( bool enabled );
812 
818  void setCustomDropHandlers( const QVector<QPointer<QgsCustomDropHandler >> &handlers ) SIP_SKIP;
819 
830  void setTemporalRange( const QgsDateTimeRange &range );
831 
838  const QgsDateTimeRange &temporalRange() const;
839 
851  void installInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
852 
860  void removeInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
861 
867  bool allowInteraction( QgsMapCanvasInteractionBlocker::Interaction interaction ) const;
868 
869  public slots:
870 
872  void refresh();
873 
883  void refreshAllLayers();
884 
893  void redrawAllLayers();
894 
896  void selectionChangedSlot();
897 
899  void saveAsImage( const QString &fileName, QPixmap *QPixmap = nullptr, const QString & = "PNG" );
900 
902  void layerStateChange();
903 
911  void setRenderFlag( bool flag );
912 
917  void stopRendering();
918 
920  void readProject( const QDomDocument & );
921 
923  void writeProject( QDomDocument & );
924 
933  void setMagnificationFactor( double factor, const QgsPointXY *center = nullptr );
934 
940  void setScaleLocked( bool isLocked );
941 
943  void zoomIn();
944 
946  void zoomOut();
947 
952  void zoomToSelected( QgsVectorLayer *layer = nullptr );
953 
959  void zoomToSelected( const QList<QgsMapLayer *> &layers );
960 
966  void setZoomResolutions( const QList<double> &resolutions ) { mZoomResolutions = resolutions; }
967 
971  double zoomInFactor() const;
972 
976  double zoomOutFactor() const;
977 
983  const QList<double> &zoomResolutions() const { return mZoomResolutions; }
984 
993  QgsDoubleRange zRange() const;
994 
1003  void setZRange( const QgsDoubleRange &range );
1004 
1005  private slots:
1007  void mapToolDestroyed();
1008 
1010  void rendererJobFinished();
1011 
1013  void previewJobFinished();
1014 
1015  void mapUpdateTimeout();
1016 
1017  void refreshMap();
1018 
1019  void mapThemeChanged( const QString &theme );
1021  void mapThemeRenamed( const QString &theme, const QString &newTheme );
1022 
1023  void updateDevicePixelFromScreen();
1024 
1025  signals:
1026 
1031  void xyCoordinates( const QgsPointXY &p );
1032 
1034  void scaleChanged( double );
1035 
1042  void scaleLockChanged( bool locked );
1043 
1044 
1047 
1052  void rotationChanged( double );
1053 
1058  void magnificationChanged( double );
1059 
1065 
1066  // TODO: deprecate when decorations are reimplemented as map canvas items
1067 
1078  void renderComplete( QPainter * );
1079 
1080  // ### QGIS 3: renamte to mapRefreshFinished()
1083 
1084  // ### QGIS 3: rename to mapRefreshStarted()
1087 
1093 
1096 
1098  void keyPressed( QKeyEvent *e );
1099 
1101  void keyReleased( QKeyEvent *e );
1102 
1107  void mapToolSet( QgsMapTool *newTool, QgsMapTool *oldTool );
1108 
1109 
1112 
1115 
1118 
1124 
1130 
1136 
1142 
1148  void themeChanged( const QString &theme );
1149 
1151  void messageEmitted( const QString &title, const QString &message, Qgis::MessageLevel = Qgis::MessageLevel::Info );
1152 
1160  void renderErrorOccurred( const QString &error, QgsMapLayer *layer );
1161 
1172  void panDistanceBearingChanged( double distance, QgsUnitTypes::DistanceUnit unit, double bearing );
1173 
1178  void tapAndHoldGestureOccurred( const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture );
1179 
1186 
1196 
1203  void contextMenuAboutToShow( QMenu *menu, QgsMapMouseEvent *event );
1204 
1205  protected:
1206 
1207  bool event( QEvent *e ) override;
1208  void keyPressEvent( QKeyEvent *e ) override;
1209  void keyReleaseEvent( QKeyEvent *e ) override;
1210  void mouseDoubleClickEvent( QMouseEvent *e ) override;
1211  void mouseMoveEvent( QMouseEvent *e ) override;
1212  void mousePressEvent( QMouseEvent *e ) override;
1213  void mouseReleaseEvent( QMouseEvent *e ) override;
1214  void wheelEvent( QWheelEvent *e ) override;
1215  void resizeEvent( QResizeEvent *e ) override;
1216  void paintEvent( QPaintEvent *e ) override;
1217  void dragEnterEvent( QDragEnterEvent *e ) override;
1218  bool viewportEvent( QEvent *event ) override;
1219 
1221  void moveCanvasContents( bool reset = false );
1222 
1223  void dropEvent( QDropEvent *event ) override;
1224 
1225  void showEvent( QShowEvent *event ) override;
1226 
1228  class CanvasProperties;
1229 
1231  std::unique_ptr<CanvasProperties> mCanvasProperties;
1232 
1233 #if 0
1234 
1239  void connectNotify( const char *signal ) override;
1240 #endif
1241 
1242  protected slots:
1244  void updateCanvasItemPositions();
1245 
1246  private slots:
1247 
1248  void layerRepaintRequested( bool deferred );
1249 
1250  void autoRefreshTriggered();
1251 
1252  void updateAutoRefreshTimer();
1253 
1254  void projectThemesChanged();
1255 
1256  void startPreviewJob( int number );
1257 
1258  void temporalControllerModeChanged();
1259 
1260  private:
1261 
1262  // Restore scale RAII
1263  class ScaleRestorer
1264  {
1265  public:
1266  ScaleRestorer( QgsMapCanvas *canvas ):
1267  mCanvas( canvas )
1268  {
1269  mLockedScale = mCanvas->mapSettings().scale();
1270  };
1271 
1272  ~ScaleRestorer()
1273  {
1274  QgsRectangle newExtent = mCanvas->mapSettings().extent();
1275  newExtent.scale( mLockedScale / mCanvas->mapSettings().scale() );
1276  mCanvas->mSettings.setExtent( newExtent );
1277  };
1278 
1279  private:
1280  QgsMapCanvas *mCanvas;
1281  double mLockedScale;
1282  };
1283 
1285  QgsMapSettings mSettings;
1286 
1288  QgsMapCanvasMap *mMap = nullptr;
1289 
1294  QgsTemporalController *mController = nullptr;
1295 
1297  bool mFrozen = false;
1298 
1300  bool mRefreshScheduled = false;
1301 
1303  bool mRefreshAfterJob = false;
1304 
1306  bool mRenderFlag = true;
1307 
1309  QPointer< QgsMapLayer > mCurrentLayer;
1310 
1312  QGraphicsScene *mScene = nullptr;
1313 
1315  QgsMapTool *mMapTool = nullptr;
1316 
1318  QgsMapTool *mLastNonZoomMapTool = nullptr;
1319 
1321  QgsProject *mProject = nullptr;
1322 
1324  QList <QgsRectangle> mLastExtent;
1325  int mLastExtentIndex = -1;
1326 
1328  double mWheelZoomFactor = 2.0;
1329 
1331  QTimer mMapUpdateTimer;
1332 
1334  QgsMapRendererQImageJob *mJob = nullptr;
1335 
1337  bool mJobCanceled = false;
1338 
1340  std::unique_ptr< QgsLabelingResults > mLabelingResults;
1341 
1343  bool mLabelingResultsOutdated = false;
1344 
1349  std::unique_ptr< QgsRenderedItemResults > mRenderedItemResults;
1350 
1355  std::unique_ptr< QgsRenderedItemResults > mPreviousRenderedItemResults;
1356 
1362  bool mRenderedItemResultsOutdated = false;
1363 
1365  bool mUseParallelRendering = false;
1366 
1368  bool mDrawRenderingStats = false;
1369 
1371  QgsMapRendererCache *mCache = nullptr;
1372 
1373  QTimer *mResizeTimer = nullptr;
1374  QTimer *mRefreshTimer = nullptr;
1375 
1376  QgsPreviewEffect *mPreviewEffect = nullptr;
1377 
1378  QgsRectangle imageRect( const QImage &img, const QgsMapSettings &mapSettings );
1379 
1380  QgsSnappingUtils *mSnappingUtils = nullptr;
1381 
1382  QList< QgsMapRendererQImageJob * > mPreviewJobs;
1383 
1385  bool mScaleLocked = false;
1386 
1387  QgsExpressionContextScope mExpressionContextScope;
1388 
1390  QRect mZoomRect;
1391 
1393  bool mZoomDragging = false;
1394 
1396  std::unique_ptr< QgsRubberBand > mZoomRubberBand;
1397 
1398  QCursor mZoomCursor;
1399 
1400  QTimer mAutoRefreshTimer;
1401 
1402  QTimer mPreviewTimer;
1403  QMetaObject::Connection mPreviewTimerConnection;
1404 
1405  QString mTheme;
1406 
1407  QgsPointXY mCursorPoint;
1408 
1409  bool mAnnotationsVisible = true;
1410 
1411  bool mUsePreviewJobs = false;
1412 
1413  QHash< QString, int > mLastLayerRenderTime;
1414 
1415  QVector<QPointer<QgsCustomDropHandler >> mDropHandlers;
1416 
1417  QgsDistanceArea mDa;
1418  QList<double> mZoomResolutions;
1419 
1420  QList< QgsMapCanvasInteractionBlocker * > mInteractionBlockers;
1421 
1422  int mBlockItemPositionUpdates = 0;
1423 
1424  QMetaObject::Connection mScreenDpiChangedConnection;
1425 
1426  std::unique_ptr< QgsTemporaryCursorOverride > mTemporaryCursorOverride;
1427 
1435  QMap <QString, QDateTime> mRendererErrors;
1436 
1441  QgsPointXY cursorPoint() const;
1442 
1447  void updateMapSize();
1448 
1454  void beginZoomRect( QPoint pos );
1455 
1461  void endZoomRect( QPoint pos );
1462 
1464  void stopZoomRect();
1465 
1467  void startPan();
1468 
1470  void stopPan();
1471 
1480  bool boundingBoxOfFeatureIds( const QgsFeatureIds &ids, QgsVectorLayer *layer, QgsRectangle &bbox, QString &errorMsg ) const;
1481 
1488  QgsRectangle optimalExtentForPointLayer( QgsVectorLayer *layer, const QgsPointXY &center, int scaleFactor = 5 );
1489 
1490  void setLayersPrivate( const QList<QgsMapLayer *> &layers );
1491 
1492  void startPreviewJobs();
1493  void stopPreviewJobs();
1494  void schedulePreviewJob( int number );
1495 
1499  bool panOperationInProgress();
1500 
1501  int nextZoomLevel( const QList<double> &resolutions, bool zoomIn = true ) const;
1502 
1507  void clearTemporalCache();
1508 
1512  void clearElevationCache();
1513 
1514  void showContextMenu( QgsMapMouseEvent *event );
1515 
1520  void notifyRendererErrors( const QgsMapRendererJob::Errors &errors );
1521 
1522  friend class TestQgsMapCanvas;
1523 
1524 }; // class QgsMapCanvas
1525 
1526 // clazy:excludeall=qstring-allocations
1527 
1528 #endif
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:115
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:90
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:983
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:966
QString theme() const
Returns the map's theme shown in the canvas, if set.
Definition: qgsmapcanvas.h:572
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:618
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
Definition: qgsmapcanvas.h:728
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:519
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:737
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:718
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.
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.
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:104
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:198
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:186
#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:203
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:37
const QgsCoordinateReferenceSystem & crs