QGIS API Documentation 3.39.0-Master (d85f3c2a281)
Loading...
Searching...
No Matches
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#include "qgssettingstree.h"
23
24#define SIP_NO_FILE
25
28
30
31class QgsMapToolCaptureAnnotationItem: public QgsMapToolCapture, public QgsCreateAnnotationItemMapToolInterface
32{
33 Q_OBJECT
34 public:
35 QgsMapToolCaptureAnnotationItem( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, CaptureMode mode );
37 QgsMapTool *mapTool() override;
38 QgsMapLayer *layer() const override;
40 bool supportsTechnique( Qgis::CaptureTechnique technique ) const override;
41
42 protected:
43
44 QgsCreateAnnotationItemMapToolHandler *mHandler = nullptr;
45
46};
47
48class QgsCreatePointTextItemMapTool: public QgsMapToolAdvancedDigitizing, public QgsCreateAnnotationItemMapToolInterface
49{
50 Q_OBJECT
51
52 public:
53
54 QgsCreatePointTextItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
55 ~QgsCreatePointTextItemMapTool() override;
56
57 void cadCanvasPressEvent( QgsMapMouseEvent *event ) override;
59 QgsMapTool *mapTool() override;
60
61 private:
62
63 QgsCreateAnnotationItemMapToolHandler *mHandler = nullptr;
64
65};
66
67
68class QgsCreateMarkerItemMapTool: public QgsMapToolCaptureAnnotationItem
69{
70 Q_OBJECT
71
72 public:
73
74 QgsCreateMarkerItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
75
76 void cadCanvasReleaseEvent( QgsMapMouseEvent *event ) override;
77
78};
79
80class QgsCreateLineItemMapTool: public QgsMapToolCaptureAnnotationItem
81{
82 Q_OBJECT
83
84 public:
85
86 QgsCreateLineItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
87
88 private slots:
89 void lineCaptured( const QgsCurve *line ) override;
90};
91
92class QgsCreatePolygonItemMapTool: public QgsMapToolCaptureAnnotationItem
93{
94 Q_OBJECT
95
96 public:
97
98 QgsCreatePolygonItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
99
100 private slots:
101 void polygonCaptured( const QgsCurvePolygon *polygon ) override;
102};
103
104
105class QgsCreateRectangleTextItemMapTool: public QgsMapToolAdvancedDigitizing, public QgsCreateAnnotationItemMapToolInterface
106{
107 Q_OBJECT
108
109 public:
110
111 QgsCreateRectangleTextItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
112
113 void cadCanvasPressEvent( QgsMapMouseEvent *event ) override;
114 void cadCanvasMoveEvent( QgsMapMouseEvent *event ) override;
115 void keyPressEvent( QKeyEvent *event ) override;
116
118 QgsMapTool *mapTool() override;
119
120 private:
121
122 QgsCreateAnnotationItemMapToolHandler *mHandler = nullptr;
123
124 QRectF mRect;
125 QgsPointXY mFirstPoint;
127};
128
129
130class QgsCreatePictureItemMapTool: public QgsMapToolAdvancedDigitizing, public QgsCreateAnnotationItemMapToolInterface
131{
132 Q_OBJECT
133
134 public:
135 static inline QgsSettingsTreeNode *sTreePicture = QgsCreateAnnotationItemMapToolInterface::sTreeAnnotationTools->createChildNode( QStringLiteral( "picture-item" ) );
136 static const QgsSettingsEntryString *settingLastSourceFolder;
137
138 QgsCreatePictureItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
139
140 void cadCanvasPressEvent( QgsMapMouseEvent *event ) override;
141 void cadCanvasMoveEvent( QgsMapMouseEvent *event ) override;
142 void keyPressEvent( QKeyEvent *event ) override;
143
145 QgsMapTool *mapTool() override;
146
147 private:
148
149 QgsCreateAnnotationItemMapToolHandler *mHandler = nullptr;
150
151 QRectF mRect;
152 QgsPointXY mFirstPoint;
154};
155
156
157class QgsCreateLineTextItemMapTool: public QgsMapToolCaptureAnnotationItem
158{
159 Q_OBJECT
160
161 public:
162
163 QgsCreateLineTextItemMapTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
164
165 private slots:
166 void lineCaptured( const QgsCurve *line ) override;
167};
168
170
171#endif // QGSCREATEANNOTATIONITEMMAPTOOLIMPL_H
CaptureTechnique
Capture technique.
Definition qgis.h:376
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.
Curve polygon geometry type.
Abstract base class for curved geometry type.
Definition qgscurve.h:35
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:76
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 cadCanvasMoveEvent(QgsMapMouseEvent *e)
Override this method when subclassing this class.
virtual void cadCanvasPressEvent(QgsMapMouseEvent *e)
Override this method when subclassing this class.
virtual QgsMapLayer * layer() const
Returns the layer associated with the map tool.
QgsMapToolCapture is a base class capable of capturing point, lines and polygons.
QFlags< Capability > Capabilities
virtual bool supportsTechnique(Qgis::CaptureTechnique technique) const
Returns true if the tool supports the specified capture technique.
virtual QgsMapToolCapture::Capabilities capabilities() const
Returns flags containing the supported capabilities.
Abstract base class for all map tools.
Definition qgsmaptool.h:71
virtual void keyPressEvent(QKeyEvent *e)
Key event for overriding. Default implementation does nothing.
A class to represent a 2D point.
Definition qgspointxy.h:60
A string settings entry.
QgsSettingsTreeNode is a tree node for the settings tree to help organizing and introspecting the tre...
QgsSettingsTreeNode * createChildNode(const QString &key)
Creates a normal tree node It will return the existing child node if it exists at the given key.