16 #ifndef QGSADVANCEDDIGITIZINGDOCK
17 #define QGSADVANCEDDIGITIZINGDOCK
24 #include "ui_qgsadvanceddigitizingdockwidgetbase.h"
65 RelativeCoordinates = 4,
68 Q_DECLARE_FLAGS( CadCapacities, CadCapacity )
69 Q_FLAG( CadCapacities )
78 ReturnPressed, FocusOut, TextEdited
109 CadConstraint( QLineEdit *lineEdit, QToolButton *lockerButton, QToolButton *relativeButton =
nullptr, QToolButton *repeatingLockButton =
nullptr )
110 : mLineEdit( lineEdit )
111 , mLockerButton( lockerButton )
112 , mRelativeButton( relativeButton )
113 , mRepeatingLockButton( repeatingLockButton )
114 , mLockMode( NoLock )
115 , mRepeatingLock( false )
129 bool isLocked()
const {
return mLockMode != NoLock; }
147 double value()
const {
return mValue; }
157 void setLockMode( LockMode mode );
166 void setRepeatingLock(
bool repeating );
171 void setRelative(
bool relative );
178 void setValue(
double value,
bool updateWidget =
true );
188 void toggleRelative();
207 QLineEdit *mLineEdit =
nullptr;
208 QToolButton *mLockerButton =
nullptr;
209 QToolButton *mRelativeButton =
nullptr;
210 QToolButton *mRepeatingLockButton =
nullptr;
231 bool canvasKeyPressEventFilter( QKeyEvent *e );
251 void releaseLocks(
bool releaseRepeatingLocks =
true );
258 void keyPressEvent( QKeyEvent *e )
override;
273 void setEnabledZ(
bool enable );
279 void setEnabledM(
bool enable );
344 void clearLockedSnapVertices(
bool force =
true );
362 void removePreviousPoint();
371 void setPoints(
const QList<QgsPointXY> &points );
380 QgsPoint currentPointV2(
bool *exists =
nullptr )
const;
402 QgsPoint previousPointV2(
bool *exists =
nullptr )
const;
417 QgsPoint penultimatePointV2(
bool *exists =
nullptr )
const;
435 inline bool snappedToVertex()
const {
return ( mSnapMatch.isValid() && ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) ); }
462 void updateCadPaintItem();
472 void setX(
const QString &value, WidgetSetMode mode );
482 void setY(
const QString &value, WidgetSetMode mode );
492 void setZ(
const QString &value, WidgetSetMode mode );
502 void setM(
const QString &value, WidgetSetMode mode );
512 void setAngle(
const QString &value, WidgetSetMode mode );
522 void setDistance(
const QString &value, WidgetSetMode mode );
528 double getLineZ( )
const;
534 double getLineM( )
const;
549 void pushWarning(
const QString &message );
563 void pointChangedV2(
const QgsPoint &point );
583 void cadEnabledChanged(
bool enabled );
591 void valueXChanged(
const QString &value );
599 void valueYChanged(
const QString &value );
607 void valueZChanged(
const QString &value );
615 void valueMChanged(
const QString &value );
623 void valueAngleChanged(
const QString &value );
631 void valueDistanceChanged(
const QString &value );
639 void lockXChanged(
bool locked );
647 void lockYChanged(
bool locked );
655 void lockZChanged(
bool locked );
663 void lockMChanged(
bool locked );
671 void lockAngleChanged(
bool locked );
679 void lockDistanceChanged(
bool locked );
689 void relativeXChanged(
bool relative );
699 void relativeYChanged(
bool relative );
709 void relativeZChanged(
bool relative );
719 void relativeMChanged(
bool relative );
729 void relativeAngleChanged(
bool relative );
737 void softLockLineExtensionChanged(
bool locked );
745 void softLockXyChanged(
bool locked );
758 void enabledChangedX(
bool enabled );
769 void enabledChangedY(
bool enabled );
780 void enabledChangedZ(
bool enabled );
791 void enabledChangedM(
bool enabled );
802 void enabledChangedAngle(
bool enabled );
813 void enabledChangedDistance(
bool enabled );
821 void focusOnXRequested();
829 void focusOnYRequested();
837 void focusOnZRequested();
845 void focusOnMRequested();
853 void focusOnAngleRequested();
861 void focusOnDistanceRequested();
866 void betweenLineConstraintClicked(
bool activated );
869 void lockConstraint(
bool activate =
true );
872 void lockParameterlessConstraint(
bool activate =
true );
878 void constraintTextEdited(
const QString &textValue );
884 void constraintFocusOut();
887 void setConstraintRelative(
bool activate );
890 void setConstraintRepeatingLock(
bool activate );
896 void activateCad(
bool enabled );
899 void setConstructionMode(
bool enabled );
902 void settingsButtonTriggered( QAction *action );
912 void setCadEnabled(
bool enabled );
918 void updateCapacity(
bool updateUIwithoutChange =
false );
928 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
931 void updateCurrentPoint(
const QgsPoint &point );
938 bool filterKeyPress( QKeyEvent *e );
944 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
947 void triggerMouseMoveEvent();
950 CadConstraint *objectToConstraint(
const QObject *obj )
const;
953 double parseUserInput(
const QString &inputValue,
bool &ok )
const;
961 void updateConstraintValue( CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
964 void updateUnlockedConstraintValues(
const QgsPoint &point );
977 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
979 CadCapacities mCapacities = CadCapacities();
981 bool mCurrentMapToolSupportsCad =
false;
988 bool mCadEnabled =
false;
989 bool mConstructionMode =
false;
992 std::unique_ptr< CadConstraint > mAngleConstraint;
993 std::unique_ptr< CadConstraint > mDistanceConstraint;
994 std::unique_ptr< CadConstraint > mXConstraint;
995 std::unique_ptr< CadConstraint > mYConstraint;
996 std::unique_ptr< CadConstraint > mZConstraint;
997 std::unique_ptr< CadConstraint > mMConstraint;
998 std::unique_ptr< CadConstraint > mLineExtensionConstraint;
999 std::unique_ptr< CadConstraint > mXyVertexConstraint;
1001 double mCommonAngleConstraint;
1004 QList<QgsPoint> mCadPointList;
1005 QList<QgsPointXY> mSnappedSegment;
1007 bool mSessionActive =
false;
1010 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
1013 QMap< QAction *, double > mCommonAngleActions;
1014 QAction *mLineExtensionAction;
1015 QAction *mXyVertexAction;
1025 QQueue< QgsPointLocator::Match > mLockedSnapVertices;
1028 bool eventFilter( QObject *obj, QEvent *event );
1034 friend class TestQgsAdvancedDigitizing;
1035 friend class TestQgsAdvancedDigitizingDockWidget;
1040 #endif // QGSADVANCEDDIGITIZINGDOCK_H