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 );
324 bool showConstructionGuides()
const;
330 bool snapToConstructionGuides()
const;
336 bool recordConstructionGuides()
const;
398 void clearLockedSnapVertices(
bool force =
true );
414 void removePreviousPoint();
420 void updateCurrentPoint(
const QgsPoint &point );
428 void setPoints(
const QList<QgsPointXY> &points );
437 QgsPoint currentPointV2(
bool *exists =
nullptr )
const;
459 QgsPoint previousPointV2(
bool *exists =
nullptr )
const;
474 QgsPoint penultimatePointV2(
bool *exists =
nullptr )
const;
492 inline bool snappedToVertex()
const {
return ( mSnapMatch.isValid() && ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) ); }
518 void updateCadPaintItem();
528 void setX(
const QString &value, WidgetSetMode mode );
538 void setY(
const QString &value, WidgetSetMode mode );
548 void setZ(
const QString &value, WidgetSetMode mode );
558 void setM(
const QString &value, WidgetSetMode mode );
568 void setAngle(
const QString &value, WidgetSetMode mode );
578 void setDistance(
const QString &value, WidgetSetMode mode );
584 double getLineZ( )
const;
590 double getLineM( )
const;
602 QString formatCommonAngleSnapping(
double angle );
947 void betweenLineConstraintClicked(
bool activated );
950 void lockConstraint(
bool activate =
true );
953 void lockParameterlessConstraint(
bool activate =
true );
959 void constraintTextEdited(
const QString &textValue );
965 void constraintFocusOut();
968 void setConstraintRelative(
bool activate );
971 void setConstraintRepeatingLock(
bool activate );
977 void activateCad(
bool enabled );
980 void setConstructionMode(
bool enabled );
983 void settingsButtonTriggered( QAction *action );
993 void setCadEnabled(
bool enabled );
999 void updateCapacity(
bool updateUIwithoutChange =
false );
1009 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
1015 bool filterKeyPress( QKeyEvent *e );
1021 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
1024 void triggerMouseMoveEvent();
1027 CadConstraint *objectToConstraint(
const QObject *obj )
const;
1038 void updateConstraintValue(
CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
1041 void updateUnlockedConstraintValues(
const QgsPoint &point );
1053 void resetConstructionGuides();
1059 void updateConstructionGuidesCrs();
1064 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
1068 bool mCurrentMapToolSupportsCad =
false;
1075 bool mCadEnabled =
false;
1076 bool mConstructionMode =
false;
1079 std::unique_ptr< CadConstraint > mAngleConstraint;
1080 std::unique_ptr< CadConstraint > mDistanceConstraint;
1081 std::unique_ptr< CadConstraint > mXConstraint;
1082 std::unique_ptr< CadConstraint > mYConstraint;
1083 std::unique_ptr< CadConstraint > mZConstraint;
1084 std::unique_ptr< CadConstraint > mMConstraint;
1085 std::unique_ptr< CadConstraint > mLineExtensionConstraint;
1086 std::unique_ptr< CadConstraint > mXyVertexConstraint;
1088 double mCommonAngleConstraint;
1091 bool mSnappingPrioritizeFeatures =
false;
1094 QList<QgsPoint> mCadPointList;
1095 QList<QgsPointXY> mSnappedSegment;
1097 bool mSessionActive =
false;
1100 std::unique_ptr<QgsVectorLayer> mConstructionGuidesLayer;
1103 bool mDeferredUpdateConstructionGuidesCrs =
false;
1106 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
1109 QMap< double, QAction *> mCommonAngleActions;
1110 QAction *mLineExtensionAction =
nullptr;
1111 QAction *mXyVertexAction =
nullptr;
1112 QAction *mRecordConstructionGuides =
nullptr;
1113 QAction *mShowConstructionGuides =
nullptr;
1114 QAction *mSnapToConstructionGuides =
nullptr;
1115 QAction *mClearConstructionGuides =
nullptr;
1125 QQueue< QgsPointLocator::Match > mLockedSnapVertices;
1129 bool eventFilter( QObject *obj, QEvent *event );
1134 QMenu *mCommonAngleActionsMenu =
nullptr;
1135 QMenu *mFloaterActionsMenu =
nullptr;
1142 friend class TestQgsAdvancedDigitizing;
1143 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,...
Line string geometry type, with support for z-dimension and m-values.
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.
Represents a vector layer which manages a vector based data sets.
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)
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)