QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgsadvanceddigitizingtools.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsadvanceddigitizingtools.h
3 ----------------------
4 begin : May 2024
5 copyright : (C) Mathieu Pellerin
6 email : mathieu at opengis dot ch
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
16#ifndef QGSADVANCEDDIGITIZINGTOOLS
17#define QGSADVANCEDDIGITIZINGTOOLS
18
19#include <QWidget>
20#include <QString>
21
23#include "qgis_gui.h"
24#include "qgis_sip.h"
25#include "qgsmapmouseevent.h"
26
27#include <QPointer>
28
31class QgsMapCanvas;
32
38class GUI_EXPORT QgsAdvancedDigitizingTool : public QObject
39{
40 Q_OBJECT
41
42 public:
43
50
54 QgsMapCanvas *mapCanvas() const { return mMapCanvas; }
55
59 QgsAdvancedDigitizingDockWidget *cadDockWidget() const { return mCadDockWidget.data(); }
60
65 virtual QWidget *createWidget() { return nullptr; }
66
70 virtual void paint( QPainter *painter ) { Q_UNUSED( painter ) }
71
76 virtual void canvasPressEvent( QgsMapMouseEvent *event )
77 {
78 Q_UNUSED( event )
79 }
80
85 virtual void canvasMoveEvent( QgsMapMouseEvent *event )
86 {
87 Q_UNUSED( event )
88 }
89
94 virtual void canvasReleaseEvent( QgsMapMouseEvent *event )
95 {
96 Q_UNUSED( event )
97 }
98
99 signals:
100
105
106 protected:
107
108 QgsMapCanvas *mMapCanvas = nullptr;
109 QPointer< QgsAdvancedDigitizingDockWidget > mCadDockWidget;
110};
111
112#ifndef SIP_RUN
113
121{
122 Q_OBJECT
123
124 public:
125
133
134 QWidget *createWidget() override;
135 void paint( QPainter *painter ) override;
136
137 void canvasMoveEvent( QgsMapMouseEvent *event ) override;
138 void canvasReleaseEvent( QgsMapMouseEvent *event ) override;
139
140 private:
141 bool eventFilter( QObject *obj, QEvent *event ) override;
142
143 void processParameters();
144
145 void drawCircle( QPainter *painter, double x, double y, double distance );
146 void drawCandidate( QPainter *painter, double x, double y, bool closest );
147
148 QPointer<QWidget> mToolWidget;
149 QToolButton *mCircle1Digitize = nullptr;
150 QgsDoubleSpinBox *mCircle1X = nullptr;
151 QgsDoubleSpinBox *mCircle1Y = nullptr;
152 QgsDoubleSpinBox *mCircle1Distance = nullptr;
153
154 QToolButton *mCircle2Digitize = nullptr;
155 QgsDoubleSpinBox *mCircle2X = nullptr;
156 QgsDoubleSpinBox *mCircle2Y = nullptr;
157 QgsDoubleSpinBox *mCircle2Distance = nullptr;
158
159 QgsPointXY mP1;
160 QgsPointXY mP2;
161 bool mP1Closest = false;
162};
163
164#endif
165
166#endif // QGSADVANCEDDIGITIZINGTOOLS
A advanced digitizing tools to handle the selection of a point at the intersection of two circles.
The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of...
An abstract class for advanced digitizing tools.
QgsAdvancedDigitizingDockWidget * cadDockWidget() const
Returns the advanced digitizing widget associated with the tool.
virtual void canvasReleaseEvent(QgsMapMouseEvent *event)
Handles canvas release event.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the tool.
QPointer< QgsAdvancedDigitizingDockWidget > mCadDockWidget
virtual void canvasMoveEvent(QgsMapMouseEvent *event)
Handles canvas press move.
void paintRequested()
Requests a new painting event to the advanced digitizing canvas item.
virtual void paint(QPainter *painter)
Paints tool content onto the advanced digitizing canvas item.
virtual void canvasPressEvent(QgsMapMouseEvent *event)
Handles canvas press event.
virtual QWidget * createWidget()
Returns a widget to control the tool.
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
Map canvas is a class for displaying all GIS data types on a canvas.
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
A class to represent a 2D point.
Definition qgspointxy.h:60