QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
23 #include <QMouseEvent>
24 #include <QWheelEvent>
25 #include <QWidget>
26 #include <QStringList>
27 #include <QPixmap>
28 
29 class QgsMapCanvas;
30 class QgsPanningWidget; // defined in .cpp
31 class QgsRectangle;
32 
34 #include "qgsmapsettings.h"
35 
39 class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
40 {
41  Q_OBJECT
42 
43  public:
44  QgsMapOverviewCanvas( QWidget * parent = nullptr, QgsMapCanvas* mapCanvas = nullptr );
45 
47 
49  void refresh();
50 
52  void setBackgroundColor( const QColor& color );
53 
55  void setLayerSet( const QStringList& layerSet );
56 
57  QStringList layerSet() const;
58 
59  void enableAntiAliasing( bool flag ) { mSettings.setFlag( QgsMapSettings::Antialiasing, flag ); }
60 
61  void updateFullExtent();
62 
63  public slots:
64 
65  // ### QGIS 3: make protected
67  void drawExtentRect();
68 
69  // ### QGIS 3: rename so it does not look like getter, make protected
70  void hasCrsTransformEnabled( bool flag );
71 
72  // ### QGIS 3: rename Srs to Crs, make protected
73  void destinationSrsChanged();
74 
75  protected slots:
76  void mapRenderingFinished();
77  void layerRepaintRequested();
78 
79  protected:
80 
82  void paintEvent( QPaintEvent * pe ) override;
83 
85  void showEvent( QShowEvent * e ) override;
86 
88  void resizeEvent( QResizeEvent * e ) override;
89 
91  void mouseMoveEvent( QMouseEvent * e ) override;
92 
94  void mousePressEvent( QMouseEvent * e ) override;
95 
97  void mouseReleaseEvent( QMouseEvent * e ) override;
98 
100  void updatePanningWidget( QPoint pos );
101 
103  QgsPanningWidget* mPanningWidget;
104 
107 
110 
113 
116 
119 };
120 
121 
123 // Widget that serves as rectangle showing current extent in overview
124 class QgsPanningWidget : public QWidget
125 {
126  Q_OBJECT
127 
128  QPolygon mPoly;
129 
130  public:
131  explicit QgsPanningWidget( QWidget* parent );
132 
133  void setPolygon( const QPolygon& p );
134 
135  void paintEvent( QPaintEvent* pe ) override;
136 
137 };
139 
140 #endif
QPoint mPanningCursorOffset
position of cursor inside panning widget
A rectangle specified with double values.
Definition: qgsrectangle.h:35
A widget that displays an overview map.
QgsMapCanvas * mMapCanvas
main map canvas - used to get/set extent
QgsMapRendererQImageJob * mJob
for rendering overview
virtual void mouseReleaseEvent(QMouseEvent *event)
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:109
The QgsMapSettings class contains configuration for rendering of the map.
void enableAntiAliasing(bool flag)
virtual void showEvent(QShowEvent *event)
virtual void paintEvent(QPaintEvent *event)
virtual void mousePressEvent(QMouseEvent *event)
QgsPanningWidget * mPanningWidget
widget for panning map in overview
QgsMapSettings mSettings
map settings used for rendering of the overview map
virtual void mouseMoveEvent(QMouseEvent *event)
Enable anti-aliasing for map rendering.
QPixmap mPixmap
pixmap where the map is stored
Intermediate base class adding functionality that allows client to query the rendered image...
virtual void resizeEvent(QResizeEvent *event)
void setBackgroundColor(const QColor &color)