16#ifndef QGSADVANCEDDIGITIZINGDOCK
17#define QGSADVANCEDDIGITIZINGDOCK
24#include "ui_qgsadvanceddigitizingdockwidgetbase.h"
63 RelativeCoordinates = 4,
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; }
144 double value()
const {
return mValue; }
154 void setLockMode( LockMode mode );
162 void setRepeatingLock(
bool repeating );
167 void setRelative(
bool relative );
174 void setValue(
double value,
bool updateWidget =
true );
180 QString displayValue()
const;
190 void toggleRelative();
234 QLineEdit *mLineEdit =
nullptr;
235 QToolButton *mLockerButton =
nullptr;
236 QToolButton *mRelativeButton =
nullptr;
237 QToolButton *mRepeatingLockButton =
nullptr;
260 bool canvasKeyPressEventFilter( QKeyEvent *e );
278 void releaseLocks(
bool releaseRepeatingLocks =
true );
285 void keyPressEvent( QKeyEvent *e )
override;
300 void setEnabledZ(
bool enable );
306 void setEnabledM(
bool enable );
371 void clearLockedSnapVertices(
bool force =
true );
387 void removePreviousPoint();
393 void updateCurrentPoint(
const QgsPoint &point );
401 void setPoints(
const QList<QgsPointXY> &points );
410 QgsPoint currentPointV2(
bool *exists =
nullptr )
const;
432 QgsPoint previousPointV2(
bool *exists =
nullptr )
const;
447 QgsPoint penultimatePointV2(
bool *exists =
nullptr )
const;
465 inline bool snappedToVertex()
const {
return ( mSnapMatch.isValid() && ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) ); }
491 void updateCadPaintItem();
501 void setX(
const QString &value, WidgetSetMode mode );
511 void setY(
const QString &value, WidgetSetMode mode );
521 void setZ(
const QString &value, WidgetSetMode mode );
531 void setM(
const QString &value, WidgetSetMode mode );
541 void setAngle(
const QString &value, WidgetSetMode mode );
551 void setDistance(
const QString &value, WidgetSetMode mode );
557 double getLineZ( )
const;
563 double getLineM( )
const;
575 QString formatCommonAngleSnapping(
double angle );
920 void betweenLineConstraintClicked(
bool activated );
923 void lockConstraint(
bool activate =
true );
926 void lockParameterlessConstraint(
bool activate =
true );
932 void constraintTextEdited(
const QString &textValue );
938 void constraintFocusOut();
941 void setConstraintRelative(
bool activate );
944 void setConstraintRepeatingLock(
bool activate );
950 void activateCad(
bool enabled );
953 void setConstructionMode(
bool enabled );
956 void settingsButtonTriggered( QAction *action );
966 void setCadEnabled(
bool enabled );
972 void updateCapacity(
bool updateUIwithoutChange =
false );
982 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
988 bool filterKeyPress( QKeyEvent *e );
994 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
997 void triggerMouseMoveEvent();
1000 CadConstraint *objectToConstraint(
const QObject *obj )
const;
1011 void updateConstraintValue(
CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
1014 void updateUnlockedConstraintValues(
const QgsPoint &point );
1027 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
1031 bool mCurrentMapToolSupportsCad =
false;
1038 bool mCadEnabled =
false;
1039 bool mConstructionMode =
false;
1042 std::unique_ptr< CadConstraint > mAngleConstraint;
1043 std::unique_ptr< CadConstraint > mDistanceConstraint;
1044 std::unique_ptr< CadConstraint > mXConstraint;
1045 std::unique_ptr< CadConstraint > mYConstraint;
1046 std::unique_ptr< CadConstraint > mZConstraint;
1047 std::unique_ptr< CadConstraint > mMConstraint;
1048 std::unique_ptr< CadConstraint > mLineExtensionConstraint;
1049 std::unique_ptr< CadConstraint > mXyVertexConstraint;
1051 double mCommonAngleConstraint;
1054 bool mSnappingPrioritizeFeatures =
false;
1057 QList<QgsPoint> mCadPointList;
1058 QList<QgsPointXY> mSnappedSegment;
1060 bool mSessionActive =
false;
1063 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
1066 QMap< double, QAction *> mCommonAngleActions;
1067 QAction *mLineExtensionAction;
1068 QAction *mXyVertexAction;
1078 QQueue< QgsPointLocator::Match > mLockedSnapVertices;
1082 bool eventFilter( QObject *obj, QEvent *event );
1087 QMenu *mCommonAngleActionsMenu =
nullptr;
1088 QMenu *mFloaterActionsMenu =
nullptr;
1092 friend class TestQgsAdvancedDigitizing;
1093 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)
#define SIP_ENUM_BASETYPE(type)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)