16#ifndef QGSADVANCEDDIGITIZINGDOCK
17#define QGSADVANCEDDIGITIZINGDOCK
24#include "ui_qgsadvanceddigitizingdockwidgetbase.h"
63 RelativeCoordinates = 4,
66 Q_DECLARE_FLAGS( CadCapacities, CadCapacity )
67 Q_FLAG( CadCapacities )
107 CadConstraint( QLineEdit *lineEdit, QToolButton *lockerButton, QToolButton *relativeButton =
nullptr, QToolButton *repeatingLockButton =
nullptr )
108 : mLineEdit( lineEdit )
109 , mLockerButton( lockerButton )
110 , mRelativeButton( relativeButton )
111 , mRepeatingLockButton( repeatingLockButton )
112 , mLockMode( NoLock )
113 , mRepeatingLock( false )
127 bool isLocked()
const {
return mLockMode != NoLock; }
145 double value()
const {
return mValue; }
155 void setLockMode( LockMode mode );
164 void setRepeatingLock(
bool repeating );
169 void setRelative(
bool relative );
176 void setValue(
double value,
bool updateWidget =
true );
182 QString displayValue()
const;
192 void toggleRelative();
236 QLineEdit *mLineEdit =
nullptr;
237 QToolButton *mLockerButton =
nullptr;
238 QToolButton *mRelativeButton =
nullptr;
239 QToolButton *mRepeatingLockButton =
nullptr;
262 bool canvasKeyPressEventFilter( QKeyEvent *e );
282 void releaseLocks(
bool releaseRepeatingLocks =
true );
289 void keyPressEvent( QKeyEvent *e )
override;
304 void setEnabledZ(
bool enable );
310 void setEnabledM(
bool enable );
375 void clearLockedSnapVertices(
bool force =
true );
393 void removePreviousPoint();
399 void updateCurrentPoint(
const QgsPoint &point );
408 void setPoints(
const QList<QgsPointXY> &points );
417 QgsPoint currentPointV2(
bool *exists =
nullptr )
const;
439 QgsPoint previousPointV2(
bool *exists =
nullptr )
const;
454 QgsPoint penultimatePointV2(
bool *exists =
nullptr )
const;
472 inline bool snappedToVertex()
const {
return ( mSnapMatch.isValid() && ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) ); }
499 void updateCadPaintItem();
509 void setX(
const QString &value, WidgetSetMode mode );
519 void setY(
const QString &value, WidgetSetMode mode );
529 void setZ(
const QString &value, WidgetSetMode mode );
539 void setM(
const QString &value, WidgetSetMode mode );
549 void setAngle(
const QString &value, WidgetSetMode mode );
559 void setDistance(
const QString &value, WidgetSetMode mode );
565 double getLineZ( )
const;
571 double getLineM( )
const;
583 QString formatCommonAngleSnapping(
double angle );
928 void betweenLineConstraintClicked(
bool activated );
931 void lockConstraint(
bool activate =
true );
934 void lockParameterlessConstraint(
bool activate =
true );
940 void constraintTextEdited(
const QString &textValue );
946 void constraintFocusOut();
949 void setConstraintRelative(
bool activate );
952 void setConstraintRepeatingLock(
bool activate );
958 void activateCad(
bool enabled );
961 void setConstructionMode(
bool enabled );
964 void settingsButtonTriggered( QAction *action );
974 void setCadEnabled(
bool enabled );
980 void updateCapacity(
bool updateUIwithoutChange =
false );
990 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
996 bool filterKeyPress( QKeyEvent *e );
1002 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
1005 void triggerMouseMoveEvent();
1008 CadConstraint *objectToConstraint(
const QObject *obj )
const;
1019 void updateConstraintValue(
CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
1022 void updateUnlockedConstraintValues(
const QgsPoint &point );
1035 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
1037 CadCapacities mCapacities = CadCapacities();
1039 bool mCurrentMapToolSupportsCad =
false;
1046 bool mCadEnabled =
false;
1047 bool mConstructionMode =
false;
1050 std::unique_ptr< CadConstraint > mAngleConstraint;
1051 std::unique_ptr< CadConstraint > mDistanceConstraint;
1052 std::unique_ptr< CadConstraint > mXConstraint;
1053 std::unique_ptr< CadConstraint > mYConstraint;
1054 std::unique_ptr< CadConstraint > mZConstraint;
1055 std::unique_ptr< CadConstraint > mMConstraint;
1056 std::unique_ptr< CadConstraint > mLineExtensionConstraint;
1057 std::unique_ptr< CadConstraint > mXyVertexConstraint;
1059 double mCommonAngleConstraint;
1062 bool mSnappingPrioritizeFeatures =
false;
1065 QList<QgsPoint> mCadPointList;
1066 QList<QgsPointXY> mSnappedSegment;
1068 bool mSessionActive =
false;
1071 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
1074 QMap< double, QAction *> mCommonAngleActions;
1075 QAction *mLineExtensionAction;
1076 QAction *mXyVertexAction;
1086 QQueue< QgsPointLocator::Match > mLockedSnapVertices;
1090 bool eventFilter( QObject *obj, QEvent *event );
1095 QMenu *mCommonAngleActionsMenu =
nullptr;
1096 QMenu *mFloaterActionsMenu =
nullptr;
1100 friend class TestQgsAdvancedDigitizing;
1101 friend class TestQgsAdvancedDigitizingDockWidget;
CadConstraintType
Advanced digitizing constraint type.
BetweenLineConstraint
Between line constraints which can be enabled.
LineExtensionSide
Designates whether the line extension constraint is currently soft locked with the previous or next v...
The QgsAdvancedDigitizingCanvasItem class draws the graphical elements of the CAD tools (.
The QgsAdvancedDigitizingFloater class is widget that floats next to the mouse pointer,...
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
A class to represent a 2D point.
Point geometry type, with support for z-dimension and m-values.
A boolean settings entry.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)