QGIS API Documentation 4.1.0-Master (60fea48833c)
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 ) { Q_UNUSED( event ) }
75
80 virtual void canvasMoveEvent( QgsMapMouseEvent *event ) { Q_UNUSED( event ) }
81
86 virtual void canvasReleaseEvent( QgsMapMouseEvent *event ) { Q_UNUSED( event ) }
87
88 signals:
89
94
95 protected:
97 QPointer<QgsAdvancedDigitizingDockWidget> mCadDockWidget;
98};
99
100#ifndef SIP_RUN
101
109{
110 Q_OBJECT
111
112 public:
120
121 QWidget *createWidget() override;
122 void paint( QPainter *painter ) override;
123
124 void canvasMoveEvent( QgsMapMouseEvent *event ) override;
125 void canvasReleaseEvent( QgsMapMouseEvent *event ) override;
126
127 private:
128 bool eventFilter( QObject *obj, QEvent *event ) override;
129
130 void processParameters();
131
132 void drawCircle( QPainter *painter, double x, double y, double distance );
133 void drawCandidate( QPainter *painter, double x, double y, bool closest );
134
135 QPointer<QWidget> mToolWidget;
136 QToolButton *mCircle1Digitize = nullptr;
137 QgsDoubleSpinBox *mCircle1X = nullptr;
138 QgsDoubleSpinBox *mCircle1Y = nullptr;
139 QgsDoubleSpinBox *mCircle1Distance = nullptr;
140
141 QToolButton *mCircle2Digitize = nullptr;
142 QgsDoubleSpinBox *mCircle2X = nullptr;
143 QgsDoubleSpinBox *mCircle2Y = nullptr;
144 QgsDoubleSpinBox *mCircle2Distance = nullptr;
145
146 QgsPointXY mP1;
147 QgsPointXY mP2;
148 bool mP1Closest = false;
149};
150
151#endif
152
153#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:62