QGIS API Documentation  2.99.0-Master (009e47e)
Classes | Public Types | Signals | Public Member Functions | Static Public Member Functions | List of all members
QgsAdvancedDigitizingDockWidget Class Reference

The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of a selection of map tools. More...

#include <qgsadvanceddigitizingdockwidget.h>

Inheritance diagram for QgsAdvancedDigitizingDockWidget:
Inheritance graph
[legend]

Classes

class  CadConstraint
 The CadConstraint is an abstract class for all basic constraints (angle/distance/x/y). More...
 

Public Types

enum  AdditionalConstraint { NoConstraint, Perpendicular, Parallel }
 Additional constraints which can be enabled. More...
 
enum  AdvancedDigitizingMode { SinglePoint, TwoPoints, ManyPoints }
 Determines if the dock has to record one, two or many points. More...
 
enum  CadCapacity { AbsoluteAngle = 1, RelativeAngle = 2, RelativeCoordinates = 4 }
 The CadCapacity enum defines the possible constraints to be set depending on the number of points in the CAD point list (the list of points currently digitized) More...
 

Signals

void pointChanged (const QgsPointXY &point)
 Sometimes a constraint may change the current point out of a mouse event. More...
 
void popWarning ()
 Remove any previously emitted warnings (if any) More...
 
void pushWarning (const QString &message)
 Push a warning. More...
 
- Signals inherited from QgsDockWidget
void closed ()
 Emitted when dock widget is closed. More...
 
void closedStateChanged (bool wasClosed)
 Emitted when dock widget is closed (or opened). More...
 
void opened ()
 Emitted when dock widget is opened. More...
 
void openedStateChanged (bool wasOpened)
 Emitted when dock widget is opened (or closed). More...
 

Public Member Functions

 QgsAdvancedDigitizingDockWidget (QgsMapCanvas *canvas, QWidget *parent=nullptr)
 Create an advanced digitizing dock widget. More...
 
AdditionalConstraint additionalConstraint () const
 Additional constraints are used to place perpendicular/parallel segments to snapped segments on the canvas. More...
 
virtual bool applyConstraints (QgsMapMouseEvent *e)
 apply the CAD constraints. More...
 
bool cadEnabled () const
 determines if CAD tools are enabled or if map tools behaves "nomally" More...
 
bool canvasKeyPressEventFilter (QKeyEvent *e)
 Filter key events to e.g. More...
 
bool canvasMoveEvent (QgsMapMouseEvent *e)
 Will react on a canvas move event. More...
 
bool canvasPressEvent (QgsMapMouseEvent *e)
 Will react on a canvas press event. More...
 
bool canvasReleaseEvent (QgsMapMouseEvent *e, AdvancedDigitizingMode mode)
 Will react on a canvas release event. More...
 
void clear ()
 Clear any cached previous clicks and helper lines. More...
 
bool commonAngleConstraint () const
 Constraint on a common angle. More...
 
const CadConstraintconstraintAngle () const
 Constraint on the angle. More...
 
const CadConstraintconstraintDistance () const
 Constraint on the distance. More...
 
const CadConstraintconstraintX () const
 Constraint on the X coordinate. More...
 
const CadConstraintconstraintY () const
 Constraint on the Y coordinate. More...
 
bool constructionMode () const
 construction mode is used to draw intermediate points. These points won't be given any further (i.e. to the map tools) More...
 
QgsPointXY currentPoint (bool *exists=nullptr) const
 The last point. More...
 
void disable ()
 Disable the widget. More...
 
void enable ()
 Enables the tool (call this when an appropriate map tool is set and in the condition to make use of cad digitizing) Normally done automatically from QgsMapToolAdvancedDigitizing::activate() but may need to be fine tuned if the map tool depends on preconditions like a feature selection. More...
 
QAction * enableAction ()
 return the action used to enable/disable the tools More...
 
void hideEvent (QHideEvent *) override
 Disables the CAD tools when hiding the dock. More...
 
void keyPressEvent (QKeyEvent *e) override
 
QgsPointXY penultimatePoint (bool *exists=nullptr) const
 The penultimate point. More...
 
int pointsCount () const
 The number of points in the CAD point helper list. More...
 
QgsPointXY previousPoint (bool *exists=nullptr) const
 The previous point. More...
 
QList< QgsPointXYsnappedSegment () const
 Snapped to a segment. More...
 
bool snappedToVertex () const
 Is it snapped to a vertex. More...
 
QgsMapMouseEvent::SnappingMode snappingMode ()
 The snapping mode. More...
 
- Public Member Functions inherited from QgsDockWidget
 QgsDockWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=0)
 Constructor for QgsDockWidget. More...
 
 QgsDockWidget (const QString &title, QWidget *parent=nullptr, Qt::WindowFlags flags=0)
 Constructor for QgsDockWidget. More...
 

Static Public Member Functions

static bool lineCircleIntersection (const QgsPointXY &center, const double radius, const QList< QgsPointXY > &segment, QgsPointXY &intersection)
 performs the intersection of a circle and a line More...
 

Additional Inherited Members

- Public Slots inherited from QgsDockWidget
bool isUserVisible () const
 Returns true if the dock is both opened and raised to the front (ie not hidden by any other tabs. More...
 
void setUserVisible (bool visible)
 Sets the dock widget as visible to a user, ie both shown and raised to the front. More...
 
- Protected Member Functions inherited from QgsDockWidget
virtual void closeEvent (QCloseEvent *) override
 
virtual void showEvent (QShowEvent *event) override
 

Detailed Description

The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of a selection of map tools.

It handles both the UI and the constraints. Constraints are applied by implementing filters called from QgsMapToolAdvancedDigitizing.

Definition at line 46 of file qgsadvanceddigitizingdockwidget.h.

Member Enumeration Documentation

◆ AdditionalConstraint

Additional constraints which can be enabled.

Enumerator
NoConstraint 

No additional constraint.

Perpendicular 

Perpendicular.

Parallel 

Parallel.

Definition at line 69 of file qgsadvanceddigitizingdockwidget.h.

◆ AdvancedDigitizingMode

Determines if the dock has to record one, two or many points.

Enumerator
SinglePoint 

Capture a single point (e.g. for point digitizing)

TwoPoints 

Capture two points (e.g. for translation)

ManyPoints 

Capture two or more points (e.g. line or polygon digitizing)

Definition at line 79 of file qgsadvanceddigitizingdockwidget.h.

◆ CadCapacity

The CadCapacity enum defines the possible constraints to be set depending on the number of points in the CAD point list (the list of points currently digitized)

Enumerator
AbsoluteAngle 

Azimuth.

RelativeAngle 

Also for parallel and perpendicular.

RelativeCoordinates 

This corresponds to distance and relative coordinates.

Definition at line 58 of file qgsadvanceddigitizingdockwidget.h.

Constructor & Destructor Documentation

◆ QgsAdvancedDigitizingDockWidget()

QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget ( QgsMapCanvas canvas,
QWidget *  parent = nullptr 
)
explicit

Create an advanced digitizing dock widget.

Parameters
canvasThe map canvas on which the widget operates
parentThe parent

Definition at line 91 of file qgsadvanceddigitizingdockwidget.cpp.

Member Function Documentation

◆ additionalConstraint()

AdditionalConstraint QgsAdvancedDigitizingDockWidget::additionalConstraint ( ) const
inline

Additional constraints are used to place perpendicular/parallel segments to snapped segments on the canvas.

Definition at line 274 of file qgsadvanceddigitizingdockwidget.h.

◆ applyConstraints()

bool QgsAdvancedDigitizingDockWidget::applyConstraints ( QgsMapMouseEvent e)
virtual

apply the CAD constraints.

The will modify the position of the map event in map coordinates by applying the CAD constraints.

Returns
false if no solution was found (invalid constraints)

Definition at line 591 of file qgsadvanceddigitizingdockwidget.cpp.

◆ cadEnabled()

bool QgsAdvancedDigitizingDockWidget::cadEnabled ( ) const
inline

determines if CAD tools are enabled or if map tools behaves "nomally"

Definition at line 268 of file qgsadvanceddigitizingdockwidget.h.

◆ canvasKeyPressEventFilter()

bool QgsAdvancedDigitizingDockWidget::canvasKeyPressEventFilter ( QKeyEvent *  e)

Filter key events to e.g.

toggle construction mode or adapt constraints

Parameters
eA mouse event (may be modified)
Returns
If the event is hidden (construction mode hides events from the maptool)

Definition at line 1006 of file qgsadvanceddigitizingdockwidget.cpp.

◆ canvasMoveEvent()

bool QgsAdvancedDigitizingDockWidget::canvasMoveEvent ( QgsMapMouseEvent e)

Will react on a canvas move event.

Parameters
eA mouse event (may be modified)
Returns
If the event is hidden (construction mode hides events from the maptool)

Definition at line 984 of file qgsadvanceddigitizingdockwidget.cpp.

◆ canvasPressEvent()

bool QgsAdvancedDigitizingDockWidget::canvasPressEvent ( QgsMapMouseEvent e)

Will react on a canvas press event.

Parameters
eA mouse event (may be modified)
Returns
If the event is hidden (construction mode hides events from the maptool)

Definition at line 937 of file qgsadvanceddigitizingdockwidget.cpp.

◆ canvasReleaseEvent()

bool QgsAdvancedDigitizingDockWidget::canvasReleaseEvent ( QgsMapMouseEvent e,
AdvancedDigitizingMode  mode 
)

Will react on a canvas release event.

Parameters
eA mouse event (may be modified)
modedetermines if the dock has to record one, two or many points.
Returns
If the event is hidden (construction mode hides events from the maptool)

Definition at line 943 of file qgsadvanceddigitizingdockwidget.cpp.

◆ clear()

void QgsAdvancedDigitizingDockWidget::clear ( )

Clear any cached previous clicks and helper lines.

Definition at line 1037 of file qgsadvanceddigitizingdockwidget.cpp.

◆ commonAngleConstraint()

bool QgsAdvancedDigitizingDockWidget::commonAngleConstraint ( ) const
inline

Constraint on a common angle.

Definition at line 284 of file qgsadvanceddigitizingdockwidget.h.

◆ constraintAngle()

const CadConstraint* QgsAdvancedDigitizingDockWidget::constraintAngle ( ) const
inline

Constraint on the angle.

Definition at line 276 of file qgsadvanceddigitizingdockwidget.h.

◆ constraintDistance()

const CadConstraint* QgsAdvancedDigitizingDockWidget::constraintDistance ( ) const
inline

Constraint on the distance.

Definition at line 278 of file qgsadvanceddigitizingdockwidget.h.

◆ constraintX()

const CadConstraint* QgsAdvancedDigitizingDockWidget::constraintX ( ) const
inline

Constraint on the X coordinate.

Definition at line 280 of file qgsadvanceddigitizingdockwidget.h.

◆ constraintY()

const CadConstraint* QgsAdvancedDigitizingDockWidget::constraintY ( ) const
inline

Constraint on the Y coordinate.

Definition at line 282 of file qgsadvanceddigitizingdockwidget.h.

◆ constructionMode()

bool QgsAdvancedDigitizingDockWidget::constructionMode ( ) const
inline

construction mode is used to draw intermediate points. These points won't be given any further (i.e. to the map tools)

Definition at line 271 of file qgsadvanceddigitizingdockwidget.h.

◆ currentPoint()

QgsPointXY QgsAdvancedDigitizingDockWidget::currentPoint ( bool *  exists = nullptr) const

The last point.

Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both "normal" points and intermediate points (construction mode).

Definition at line 1355 of file qgsadvanceddigitizingdockwidget.cpp.

◆ disable()

void QgsAdvancedDigitizingDockWidget::disable ( )

Disable the widget.

Normally done automatically from QgsMapToolAdvancedDigitizing::deactivate().

Definition at line 1237 of file qgsadvanceddigitizingdockwidget.cpp.

◆ enable()

void QgsAdvancedDigitizingDockWidget::enable ( )

Enables the tool (call this when an appropriate map tool is set and in the condition to make use of cad digitizing) Normally done automatically from QgsMapToolAdvancedDigitizing::activate() but may need to be fine tuned if the map tool depends on preconditions like a feature selection.

Definition at line 1210 of file qgsadvanceddigitizingdockwidget.cpp.

◆ enableAction()

QAction* QgsAdvancedDigitizingDockWidget::enableAction ( )
inline

return the action used to enable/disable the tools

Definition at line 323 of file qgsadvanceddigitizingdockwidget.h.

◆ hideEvent()

void QgsAdvancedDigitizingDockWidget::hideEvent ( QHideEvent *  )
override

Disables the CAD tools when hiding the dock.

Definition at line 229 of file qgsadvanceddigitizingdockwidget.cpp.

◆ keyPressEvent()

void QgsAdvancedDigitizingDockWidget::keyPressEvent ( QKeyEvent *  e)
override

Definition at line 1043 of file qgsadvanceddigitizingdockwidget.cpp.

◆ lineCircleIntersection()

bool QgsAdvancedDigitizingDockWidget::lineCircleIntersection ( const QgsPointXY center,
const double  radius,
const QList< QgsPointXY > &  segment,
QgsPointXY intersection 
)
static

performs the intersection of a circle and a line

Note
from the two solutions, the intersection will be set to the closest point

Definition at line 40 of file qgsadvanceddigitizingdockwidget.cpp.

◆ penultimatePoint()

QgsPointXY QgsAdvancedDigitizingDockWidget::penultimatePoint ( bool *  exists = nullptr) const

The penultimate point.

Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both "normal" points and intermediate points (construction mode).

Definition at line 1375 of file qgsadvanceddigitizingdockwidget.cpp.

◆ pointChanged

void QgsAdvancedDigitizingDockWidget::pointChanged ( const QgsPointXY point)
signal

Sometimes a constraint may change the current point out of a mouse event.

This happens normally when a constraint is toggled.

Parameters
pointThe last known digitizing point. Can be used to emulate a mouse event.

◆ pointsCount()

int QgsAdvancedDigitizingDockWidget::pointsCount ( ) const
inline

The number of points in the CAD point helper list.

Definition at line 310 of file qgsadvanceddigitizingdockwidget.h.

◆ popWarning

void QgsAdvancedDigitizingDockWidget::popWarning ( )
signal

Remove any previously emitted warnings (if any)

◆ previousPoint()

QgsPointXY QgsAdvancedDigitizingDockWidget::previousPoint ( bool *  exists = nullptr) const

The previous point.

Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both "normal" points and intermediate points (construction mode).

Definition at line 1365 of file qgsadvanceddigitizingdockwidget.cpp.

◆ pushWarning

void QgsAdvancedDigitizingDockWidget::pushWarning ( const QString &  message)
signal

Push a warning.

Parameters
messageAn informative message

◆ snappedSegment()

QList<QgsPointXY> QgsAdvancedDigitizingDockWidget::snappedSegment ( ) const
inline

Snapped to a segment.

Definition at line 320 of file qgsadvanceddigitizingdockwidget.h.

◆ snappedToVertex()

bool QgsAdvancedDigitizingDockWidget::snappedToVertex ( ) const
inline

Is it snapped to a vertex.

Definition at line 315 of file qgsadvanceddigitizingdockwidget.h.

◆ snappingMode()

QgsMapMouseEvent::SnappingMode QgsAdvancedDigitizingDockWidget::snappingMode ( )
inline

The snapping mode.

Returns
Snapping mode

Definition at line 263 of file qgsadvanceddigitizingdockwidget.h.


The documentation for this class was generated from the following files: