QGIS API Documentation
3.4.15-Madeira (e83d02e274)
|
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>
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 | 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 |
Returns the additional constraints which are used to place perpendicular/parallel segments to snapped segments on the canvas. More... | |
void | addPoint (const QgsPointXY &point) |
Adds point to the CAD point list. More... | |
bool | alignToSegment (QgsMapMouseEvent *e, QgsAdvancedDigitizingDockWidget::CadConstraint::LockMode lockMode=QgsAdvancedDigitizingDockWidget::CadConstraint::HardLock) |
align to segment for additional constraint. More... | |
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... | |
void | clear () |
Clear any cached previous clicks and helper lines. More... | |
void | clearPoints () |
Removes all points from the CAD point list. More... | |
bool | commonAngleConstraint () const |
Returns true if a constraint on a common angle is active. More... | |
const CadConstraint * | constraintAngle () const |
Returns the CadConstraint on the angle. More... | |
const CadConstraint * | constraintDistance () const |
Returns the CadConstraint on the distance. More... | |
const CadConstraint * | constraintX () const |
Returns the CadConstraint on the X coordinate. More... | |
const CadConstraint * | constraintY () const |
Returns the CadConstraint 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 () |
Returns 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 |
QgsPointLocator::Match | mapPointMatch () const |
Returns the point locator match. More... | |
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... | |
void | releaseLocks (bool releaseRepeatingLocks=true) |
unlock all constraints More... | |
void | removePreviousPoint () |
Remove previous point in the CAD point list. More... | |
void | setPoints (const QList< QgsPointXY > &points) |
Configures list of current CAD points. More... | |
QList< QgsPointXY > | snappedSegment () const |
Snapped to a segment. More... | |
bool | snappedToVertex () const |
Is it snapped to a vertex. More... | |
void | updateCadPaintItem () |
Updates canvas item that displays constraints on the ma. More... | |
Public Member Functions inherited from QgsDockWidget | |
QgsDockWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=nullptr) | |
Constructor for QgsDockWidget. More... | |
QgsDockWidget (const QString &title, QWidget *parent=nullptr, Qt::WindowFlags flags=nullptr) | |
Constructor for QgsDockWidget. More... | |
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 | setToggleVisibilityAction (QAction *action) |
Links an action to the dock, so that toggling the action will automatically set the dock's visibility to suit (and changing the dock visibility will update the action's state). More... | |
QAction * | toggleVisibilityAction () |
Returns the action linked to the dock. More... | |
Additional Inherited Members | |
Public Slots inherited from QgsDockWidget | |
void | setUserVisible (bool visible) |
Sets the dock widget as visible to a user, ie both shown and raised to the front. More... | |
void | toggleUserVisible () |
Toggles whether the dock is user visible. More... | |
Protected Member Functions inherited from QgsDockWidget | |
void | closeEvent (QCloseEvent *) override |
void | showEvent (QShowEvent *event) override |
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.
Additional constraints which can be enabled.
Enumerator | |
---|---|
NoConstraint |
No additional constraint. |
Perpendicular |
Perpendicular. |
Parallel |
Parallel. |
Definition at line 69 of file qgsadvanceddigitizingdockwidget.h.
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 57 of file qgsadvanceddigitizingdockwidget.h.
|
explicit |
Create an advanced digitizing dock widget.
canvas | The map canvas on which the widget operates |
parent | The parent |
Definition at line 38 of file qgsadvanceddigitizingdockwidget.cpp.
|
inline |
Returns the additional constraints which are used to place perpendicular/parallel segments to snapped segments on the canvas.
Definition at line 252 of file qgsadvanceddigitizingdockwidget.h.
void QgsAdvancedDigitizingDockWidget::addPoint | ( | const QgsPointXY & | point | ) |
Adds point to the CAD point list.
Definition at line 1023 of file qgsadvanceddigitizingdockwidget.cpp.
bool QgsAdvancedDigitizingDockWidget::alignToSegment | ( | QgsMapMouseEvent * | e, |
QgsAdvancedDigitizingDockWidget::CadConstraint::LockMode | lockMode = QgsAdvancedDigitizingDockWidget::CadConstraint::HardLock |
||
) |
align to segment for additional constraint.
If additional constraints are used, this will determine the angle to be locked depending on the snapped segment.
Definition at line 686 of file qgsadvanceddigitizingdockwidget.cpp.
bool QgsAdvancedDigitizingDockWidget::applyConstraints | ( | QgsMapMouseEvent * | e | ) |
apply the CAD constraints.
The will modify the position of the map event in map coordinates by applying the CAD constraints.
Definition at line 515 of file qgsadvanceddigitizingdockwidget.cpp.
|
inline |
determines if CAD tools are enabled or if map tools behaves "nomally"
Definition at line 243 of file qgsadvanceddigitizingdockwidget.h.
bool QgsAdvancedDigitizingDockWidget::canvasKeyPressEventFilter | ( | QKeyEvent * | e | ) |
Filter key events to e.g.
toggle construction mode or adapt constraints
e | A mouse event (may be modified) |
Definition at line 727 of file qgsadvanceddigitizingdockwidget.cpp.
void QgsAdvancedDigitizingDockWidget::clear | ( | ) |
Clear any cached previous clicks and helper lines.
Definition at line 758 of file qgsadvanceddigitizingdockwidget.cpp.
void QgsAdvancedDigitizingDockWidget::clearPoints | ( | ) |
Removes all points from the CAD point list.
Definition at line 1049 of file qgsadvanceddigitizingdockwidget.cpp.
|
inline |
Returns true if a constraint on a common angle is active.
Definition at line 262 of file qgsadvanceddigitizingdockwidget.h.
|
inline |
Returns the CadConstraint on the angle.
Definition at line 254 of file qgsadvanceddigitizingdockwidget.h.
|
inline |
Returns the CadConstraint on the distance.
Definition at line 256 of file qgsadvanceddigitizingdockwidget.h.
|
inline |
Returns the CadConstraint on the X coordinate.
Definition at line 258 of file qgsadvanceddigitizingdockwidget.h.
|
inline |
Returns the CadConstraint on the Y coordinate.
Definition at line 260 of file qgsadvanceddigitizingdockwidget.h.
|
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 246 of file qgsadvanceddigitizingdockwidget.h.
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 1129 of file qgsadvanceddigitizingdockwidget.cpp.
void QgsAdvancedDigitizingDockWidget::disable | ( | ) |
Disable the widget.
Normally done automatically from QgsMapToolAdvancedDigitizing::deactivate().
Definition at line 1004 of file qgsadvanceddigitizingdockwidget.cpp.
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 978 of file qgsadvanceddigitizingdockwidget.cpp.
|
inline |
Returns the action used to enable/disable the tools.
Definition at line 334 of file qgsadvanceddigitizingdockwidget.h.
|
override |
Disables the CAD tools when hiding the dock.
Definition at line 152 of file qgsadvanceddigitizingdockwidget.cpp.
|
override |
Definition at line 764 of file qgsadvanceddigitizingdockwidget.cpp.
|
inline |
Returns the point locator match.
Definition at line 268 of file qgsadvanceddigitizingdockwidget.h.
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 1149 of file qgsadvanceddigitizingdockwidget.cpp.
|
signal |
Sometimes a constraint may change the current point out of a mouse event.
This happens normally when a constraint is toggled.
point | The last known digitizing point. Can be used to emulate a mouse event. |
|
inline |
The number of points in the CAD point helper list.
Definition at line 321 of file qgsadvanceddigitizingdockwidget.h.
|
signal |
Remove any previously emitted warnings (if any)
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 1139 of file qgsadvanceddigitizingdockwidget.cpp.
|
signal |
Push a warning.
message | An informative message |
void QgsAdvancedDigitizingDockWidget::releaseLocks | ( | bool | releaseRepeatingLocks = true | ) |
unlock all constraints
releaseRepeatingLocks | set to false to preserve the lock for any constraints set to repeating lock mode |
Definition at line 258 of file qgsadvanceddigitizingdockwidget.cpp.
void QgsAdvancedDigitizingDockWidget::removePreviousPoint | ( | ) |
Remove previous point in the CAD point list.
Definition at line 1038 of file qgsadvanceddigitizingdockwidget.cpp.
void QgsAdvancedDigitizingDockWidget::setPoints | ( | const QList< QgsPointXY > & | points | ) |
Configures list of current CAD points.
Some map tools may find it useful to override list of CAD points that is otherwise automatically populated when user clicks with left mouse button on map canvas.
Definition at line 793 of file qgsadvanceddigitizingdockwidget.cpp.
|
inline |
Snapped to a segment.
Definition at line 331 of file qgsadvanceddigitizingdockwidget.h.
|
inline |
Is it snapped to a vertex.
Definition at line 326 of file qgsadvanceddigitizingdockwidget.h.
void QgsAdvancedDigitizingDockWidget::updateCadPaintItem | ( | ) |
Updates canvas item that displays constraints on the ma.
Definition at line 1018 of file qgsadvanceddigitizingdockwidget.cpp.