QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsplottoolzoom.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsplottoolzoom.h
3  ---------------
4  begin : March 2022
5  copyright : (C) 2022 by Nyall Dawson
6  email : nyall dot dawson at gmail dot 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 QGSPLOTTOOLZOOM_H
19 #define QGSPLOTTOOLZOOM_H
20 
21 #include "qgsplottool.h"
22 #include "qgis_gui.h"
23 #include "qgis_sip.h"
24 
26 
27 
34 class GUI_EXPORT QgsPlotToolZoom : public QgsPlotTool
35 {
36 
37  Q_OBJECT
38 
39  public:
40 
45  ~QgsPlotToolZoom() override;
46 
47  void plotPressEvent( QgsPlotMouseEvent *event ) override;
48  void plotMoveEvent( QgsPlotMouseEvent *event ) override;
49  void plotReleaseEvent( QgsPlotMouseEvent *event ) override;
50  void keyPressEvent( QKeyEvent *event ) override;
51  void keyReleaseEvent( QKeyEvent *event ) override;
52  void deactivate() override;
53 
54  protected:
55 
61  virtual QPointF constrainStartPoint( QPointF scenePoint ) const SIP_SKIP;
62 
68  virtual QPointF constrainMovePoint( QPointF scenePoint ) const SIP_SKIP;
69 
75  virtual QRectF constrainBounds( const QRectF &sceneBounds ) const SIP_SKIP;
76 
82  virtual void zoomOutClickOn( QPointF scenePoint ) SIP_SKIP;
83 
89  virtual void zoomInClickOn( QPointF scenePoint ) SIP_SKIP;
90 
92  bool mMarqueeZoom = false;
93 
94  private:
95 
97  QPoint mMousePressStartPos;
98 
99  QPointF mRubberBandStartPos;
100 
102  std::unique_ptr< QgsPlotRectangularRubberBand > mRubberBand;
103 
104  void startMarqueeZoom( QPointF scenePoint );
105 
106 };
107 
108 #endif // QGSPLOTTOOLZOOM_H
QgsPlotRectangularRubberBand
QgsPlotRectangularRubberBand is rectangular rubber band for use within QgsPlotCanvas widgets.
Definition: qgsplotrubberband.h:128
QgsPlotTool::plotMoveEvent
virtual void plotMoveEvent(QgsPlotMouseEvent *event)
Mouse move event for overriding.
Definition: qgsplottool.cpp:102
QgsPlotTool::deactivate
virtual void deactivate()
Called when the tool is being deactivated.
Definition: qgsplottool.cpp:89
QgsPlotTool::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
Key press event for overriding.
Definition: qgsplottool.cpp:127
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsPlotTool::keyReleaseEvent
virtual void keyReleaseEvent(QKeyEvent *event)
Key release event for overriding.
Definition: qgsplottool.cpp:132
qgis_sip.h
QgsPlotTool
Abstract base class for all interactive plot tools.
Definition: qgsplottool.h:57
qgsplottool.h
QgsPlotCanvas
Plot canvas is a class for displaying interactive 2d charts and plots.
Definition: qgsplotcanvas.h:53
QgsPlotToolZoom
Plot tool for zooming into and out of the plot.
Definition: qgsplottoolzoom.h:34
QgsPlotTool::plotReleaseEvent
virtual void plotReleaseEvent(QgsPlotMouseEvent *event)
Mouse release event for overriding.
Definition: qgsplottool.cpp:117
QgsPlotMouseEvent
A QgsPlotMouseEvent is the result of a user interaction with the mouse on a QgsPlotCanvas.
Definition: qgsplotmouseevent.h:39
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsPlotTool::plotPressEvent
virtual void plotPressEvent(QgsPlotMouseEvent *event)
Mouse press event for overriding.
Definition: qgsplottool.cpp:112