QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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 "qgis_gui.h"
20#include "qgis_sip.h"
22#include "qgsmapmouseevent.h"
23
24#include <QPointer>
25#include <QString>
26#include <QWidget>
27
30class QgsMapCanvas;
31
37class GUI_EXPORT QgsAdvancedDigitizingTool : public QObject
38{
39 Q_OBJECT
40
41 public:
48
52 QgsMapCanvas *mapCanvas() const { return mMapCanvas; }
53
58
63 virtual QWidget *createWidget() { return nullptr; }
64
68 virtual void paint( QPainter *painter ) { Q_UNUSED( painter ) }
69
74 virtual void canvasPressEvent( QgsMapMouseEvent *event )
75 {
76 Q_UNUSED( event )
77 }
78
83 virtual void canvasMoveEvent( QgsMapMouseEvent *event )
84 {
85 Q_UNUSED( event )
86 }
87
92 virtual void canvasReleaseEvent( QgsMapMouseEvent *event )
93 {
94 Q_UNUSED( event )
95 }
96
97 signals:
98
103
104 protected:
106 QPointer<QgsAdvancedDigitizingDockWidget> mCadDockWidget;
107};
108
109#ifndef SIP_RUN
110
118{
119 Q_OBJECT
120
121 public:
129
130 QWidget *createWidget() override;
131 void paint( QPainter *painter ) override;
132
133 void canvasMoveEvent( QgsMapMouseEvent *event ) override;
134 void canvasReleaseEvent( QgsMapMouseEvent *event ) override;
135
136 private:
137 bool eventFilter( QObject *obj, QEvent *event ) override;
138
139 void processParameters();
140
141 void drawCircle( QPainter *painter, double x, double y, double distance );
142 void drawCandidate( QPainter *painter, double x, double y, bool closest );
143
144 QPointer<QWidget> mToolWidget;
145 QToolButton *mCircle1Digitize = nullptr;
146 QgsDoubleSpinBox *mCircle1X = nullptr;
147 QgsDoubleSpinBox *mCircle1Y = nullptr;
148 QgsDoubleSpinBox *mCircle1Distance = nullptr;
149
150 QToolButton *mCircle2Digitize = nullptr;
151 QgsDoubleSpinBox *mCircle2X = nullptr;
152 QgsDoubleSpinBox *mCircle2Y = nullptr;
153 QgsDoubleSpinBox *mCircle2Distance = nullptr;
154
155 QgsPointXY mP1;
156 QgsPointXY mP2;
157 bool mP1Closest = false;
158};
159
160#endif
161
162#endif // QGSADVANCEDDIGITIZINGTOOLS
void canvasReleaseEvent(QgsMapMouseEvent *event) override
Handles canvas release event.
QWidget * createWidget() override
Returns a widget to control the tool.
QgsAdvancedDigitizingCirclesIntersectionTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
The advanced digitizing's circles intersection tool constructor.
void canvasMoveEvent(QgsMapMouseEvent *event) override
Handles canvas press move.
void paint(QPainter *painter) override
Paints tool content onto the advanced digitizing canvas item.
A dockable widget used to handle the CAD tools on top of a selection of map 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.
QgsAdvancedDigitizingTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
The advanced digitizing tool constructor.
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 mouse event which is the result of a user interaction with a QgsMapCanvas.
Represents a 2D point.
Definition qgspointxy.h:60