QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
qgsmapoverviewcanvas.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmapoverviewcanvas.h
3  Map canvas subclassed for overview
4  -------------------
5  begin : 09/14/2005
6  copyright : (C) 2005 by Martin Dobias
7  email : won.der at centrum.sk
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSMAPOVERVIEWCANVAS_H
20 #define QGSMAPOVERVIEWCANVAS_H
21 
22 #include <QWidget>
23 #include <QPixmap>
24 
25 class QMouseEvent;
26 class QgsMapCanvas;
27 class QgsPanningWidget; // defined in .cpp
28 class QgsRectangle;
29 
31 #include "qgsmapsettings.h"
32 #include "qgis_gui.h"
33 
38 class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
39 {
40  Q_OBJECT
41 
42  public:
43  QgsMapOverviewCanvas( QWidget *parent SIP_TRANSFERTHIS = nullptr, QgsMapCanvas *mapCanvas = nullptr );
44 
46  void refresh();
47 
49  void setBackgroundColor( const QColor &color );
50 
52  void setLayers( const QList<QgsMapLayer *> &layers );
53 
55  QList<QgsMapLayer *> layers() const;
56 
57  void enableAntiAliasing( bool flag )
58  {
59  mSettings.setFlag( Qgis::MapSettingsFlag::Antialiasing, flag );
60  mSettings.setFlag( Qgis::MapSettingsFlag::HighQualityImageTransforms, flag );
61  }
62 
63  void updateFullExtent();
64 
65  protected slots:
66  void mapRenderingFinished();
67 
71  void layerRepaintRequested( bool deferred = false );
72 
73  protected:
74 
76  void drawExtentRect();
77 
79  void destinationCrsChanged();
80 
82  void transformContextChanged();
83 
85  void paintEvent( QPaintEvent *pe ) override;
86 
88  void showEvent( QShowEvent *e ) override;
89 
91  void resizeEvent( QResizeEvent *e ) override;
92 
94  void mouseMoveEvent( QMouseEvent *e ) override;
95 
97  void mousePressEvent( QMouseEvent *e ) override;
98 
100  void mouseReleaseEvent( QMouseEvent *e ) override;
101 
103  void wheelEvent( QWheelEvent *e ) override;
104 
106  void updatePanningWidget( QPoint pos );
107 
109  QgsPanningWidget *mPanningWidget = nullptr;
110 
113 
115  QgsMapCanvas *mMapCanvas = nullptr;
116 
118  QPixmap mPixmap;
119 
122 
124  QgsMapRendererQImageJob *mJob = nullptr;
125 };
126 
127 
128 #ifndef SIP_RUN
129 
131 // Widget that serves as rectangle showing current extent in overview
132 class QgsPanningWidget : public QWidget
133 {
134  Q_OBJECT
135 
136  QPolygon mPoly;
137 
138  public:
139  explicit QgsPanningWidget( QWidget *parent );
140 
141  void setPolygon( const QPolygon &p );
142 
143  void paintEvent( QPaintEvent *pe ) override;
144 
145 };
147 
148 #endif
149 
150 #endif
@ Antialiasing
Enable anti-aliasing for map rendering.
@ HighQualityImageTransforms
Enable high quality image transformations, which results in better appearance of scaled or rotated ra...
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:93
A widget that displays an overview map.
QPoint mPanningCursorOffset
position of cursor inside panning widget
QPixmap mPixmap
pixmap where the map is stored
void enableAntiAliasing(bool flag)
QgsMapSettings mSettings
map settings used for rendering of the overview map
Intermediate base class adding functionality that allows client to query the rendered image.
The QgsMapSettings class contains configuration for rendering of the map.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53