QGIS API Documentation  3.23.0-Master (7c4a6de034)
qgscreateannotationitemmaptool_impl.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscreateannotationitemmaptool_impl.h
3  ------------------------
4  Date : September 2021
5  Copyright : (C) 2021 Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSCREATEANNOTATIONITEMMAPTOOLIMPL_H
16 #define QGSCREATEANNOTATIONITEMMAPTOOLIMPL_H
17 
18 #include "qgis_gui.h"
19 #include "qgis_sip.h"
21 #include "qgsmaptoolcapture.h"
22 
23 #define SIP_NO_FILE
24 
26 
27 class QgsMapToolCaptureAnnotationItem: public QgsMapToolCapture, public QgsCreateAnnotationItemMapToolInterface
28 {
29  Q_OBJECT
30  public:
31  QgsMapToolCaptureAnnotationItem( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, CaptureMode mode );
33  QgsMapTool *mapTool() override;
34  QgsMapLayer *layer() const override;
35  QgsMapToolCapture::Capabilities capabilities() const override;
36  bool supportsTechnique( CaptureTechnique technique ) const override;
37 
38  protected:
39 
40  QgsCreateAnnotationItemMapToolHandler *mHandler = nullptr;
41 
42 };
43 
44 class QgsCreatePointTextItemMapTool: public QgsMapToolAdvancedDigitizing, public QgsCreateAnnotationItemMapToolInterface
45 {
46  Q_OBJECT
47 
48  public:
49 
50  QgsCreatePointTextItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
51  ~QgsCreatePointTextItemMapTool() override;
52 
53  void cadCanvasPressEvent( QgsMapMouseEvent *event ) override;
55  QgsMapTool *mapTool() override;
56 
57  private:
58 
59  QgsCreateAnnotationItemMapToolHandler *mHandler = nullptr;
60 
61 };
62 
63 
64 class QgsCreateMarkerItemMapTool: public QgsMapToolCaptureAnnotationItem
65 {
66  Q_OBJECT
67 
68  public:
69 
70  QgsCreateMarkerItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
71 
72  void cadCanvasReleaseEvent( QgsMapMouseEvent *event ) override;
73 
74 };
75 
76 class QgsCreateLineItemMapTool: public QgsMapToolCaptureAnnotationItem
77 {
78  Q_OBJECT
79 
80  public:
81 
82  QgsCreateLineItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
83 
84  void cadCanvasReleaseEvent( QgsMapMouseEvent *e ) override;
85 
86 };
87 
88 class QgsCreatePolygonItemMapTool: public QgsMapToolCaptureAnnotationItem
89 {
90  Q_OBJECT
91 
92  public:
93 
94  QgsCreatePolygonItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
95 
96  void cadCanvasReleaseEvent( QgsMapMouseEvent *e ) override;
97 
98 };
99 
101 
102 #endif // QGSCREATEANNOTATIONITEMMAPTOOLIMPL_H
The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of...
A handler object for map tools which create annotation items.
An interface for map tools which create annotation items.
virtual QgsCreateAnnotationItemMapToolHandler * handler()=0
Returns the handler object for the map tool.
virtual QgsMapTool * mapTool()=0
Returns a reference to the associated map tool.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:90
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.
The QgsMapToolAdvancedDigitizing class is a QgsMapTool which gives event directly in map coordinates ...
virtual void cadCanvasPressEvent(QgsMapMouseEvent *e)
Override this method when subclassing this class.
virtual QgsMapLayer * layer() const
Returns the layer associated with the map tool.
virtual QgsMapToolCapture::Capabilities capabilities() const
Returns flags containing the supported capabilities.
virtual bool supportsTechnique(CaptureTechnique technique) const
Returns true if the tool supports the specified capture technique.
Abstract base class for all map tools.
Definition: qgsmaptool.h:71