QGIS API Documentation 3.41.0-Master (cea29feecf2)
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:
49
53 QgsMapCanvas *mapCanvas() const { return mMapCanvas; }
54
58 QgsAdvancedDigitizingDockWidget *cadDockWidget() const { return mCadDockWidget.data(); }
59
64 virtual QWidget *createWidget() { return nullptr; }
65
69 virtual void paint( QPainter *painter ) { Q_UNUSED( painter ) }
70
75 virtual void canvasPressEvent( QgsMapMouseEvent *event )
76 {
77 Q_UNUSED( event )
78 }
79
84 virtual void canvasMoveEvent( QgsMapMouseEvent *event )
85 {
86 Q_UNUSED( event )
87 }
88
93 virtual void canvasReleaseEvent( QgsMapMouseEvent *event )
94 {
95 Q_UNUSED( event )
96 }
97
98 signals:
99
104
105 protected:
106 QgsMapCanvas *mMapCanvas = nullptr;
107 QPointer<QgsAdvancedDigitizingDockWidget> mCadDockWidget;
108};
109
110#ifndef SIP_RUN
111
119{
120 Q_OBJECT
121
122 public:
130
131 QWidget *createWidget() override;
132 void paint( QPainter *painter ) override;
133
134 void canvasMoveEvent( QgsMapMouseEvent *event ) override;
135 void canvasReleaseEvent( QgsMapMouseEvent *event ) override;
136
137 private:
138 bool eventFilter( QObject *obj, QEvent *event ) override;
139
140 void processParameters();
141
142 void drawCircle( QPainter *painter, double x, double y, double distance );
143 void drawCandidate( QPainter *painter, double x, double y, bool closest );
144
145 QPointer<QWidget> mToolWidget;
146 QToolButton *mCircle1Digitize = nullptr;
147 QgsDoubleSpinBox *mCircle1X = nullptr;
148 QgsDoubleSpinBox *mCircle1Y = nullptr;
149 QgsDoubleSpinBox *mCircle1Distance = nullptr;
150
151 QToolButton *mCircle2Digitize = nullptr;
152 QgsDoubleSpinBox *mCircle2X = nullptr;
153 QgsDoubleSpinBox *mCircle2Y = nullptr;
154 QgsDoubleSpinBox *mCircle2Distance = nullptr;
155
156 QgsPointXY mP1;
157 QgsPointXY mP2;
158 bool mP1Closest = false;
159};
160
161#endif
162
163#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.
virtual void canvasMoveEvent(QgsMapMouseEvent *event)
Handles canvas press move.
void paintRequested()
Requests a new painting event to the advanced digitizing canvas item.
QPointer< QgsAdvancedDigitizingDockWidget > mCadDockWidget
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