16 #ifndef QGSADVANCEDDIGITIZINGDOCK
17 #define QGSADVANCEDDIGITIZINGDOCK
23 #include "ui_qgsadvanceddigitizingdockwidgetbase.h"
63 RelativeCoordinates = 4,
65 Q_DECLARE_FLAGS( CadCapacities, CadCapacity )
66 Q_FLAG( CadCapacities )
85 ReturnPressed, FocusOut, TextEdited
116 CadConstraint( QLineEdit *lineEdit, QToolButton *lockerButton, QToolButton *relativeButton =
nullptr, QToolButton *repeatingLockButton =
nullptr )
117 : mLineEdit( lineEdit )
118 , mLockerButton( lockerButton )
119 , mRelativeButton( relativeButton )
120 , mRepeatingLockButton( repeatingLockButton )
121 , mLockMode( NoLock )
122 , mRepeatingLock( false )
136 bool isLocked()
const {
return mLockMode != NoLock; }
154 double value()
const {
return mValue; }
164 void setLockMode( LockMode mode );
173 void setRepeatingLock(
bool repeating );
178 void setRelative(
bool relative );
185 void setValue(
double value,
bool updateWidget =
true );
195 void toggleRelative();
198 QLineEdit *mLineEdit =
nullptr;
199 QToolButton *mLockerButton =
nullptr;
200 QToolButton *mRelativeButton =
nullptr;
201 QToolButton *mRepeatingLockButton =
nullptr;
221 bool canvasKeyPressEventFilter( QKeyEvent *e );
241 void releaseLocks(
bool releaseRepeatingLocks =
true );
248 void keyPressEvent( QKeyEvent *e )
override;
294 void removePreviousPoint();
303 void setPoints(
const QList<QgsPointXY> &points );
310 QgsPointXY currentPoint(
bool *exists =
nullptr )
const;
317 QgsPointXY previousPoint(
bool *exists =
nullptr )
const;
324 QgsPointXY penultimatePoint(
bool *exists =
nullptr )
const;
334 inline bool snappedToVertex()
const {
return ( mSnapMatch.isValid() && mSnapMatch.hasVertex() ); }
361 void updateCadPaintItem();
371 void setX(
const QString &value, WidgetSetMode mode );
381 void setY(
const QString &value, WidgetSetMode mode );
391 void setAngle(
const QString &value, WidgetSetMode mode );
401 void setDistance(
const QString &value, WidgetSetMode mode );
412 void pushWarning(
const QString &message );
436 void cadEnabledChanged(
bool enabled );
444 void valueXChanged(
const QString &value );
452 void valueYChanged(
const QString &value );
460 void valueAngleChanged(
const QString &value );
468 void valueDistanceChanged(
const QString &value );
476 void lockXChanged(
bool locked );
484 void lockYChanged(
bool locked );
492 void lockAngleChanged(
bool locked );
500 void lockDistanceChanged(
bool locked );
510 void relativeXChanged(
bool relative );
520 void relativeYChanged(
bool relative );
530 void relativeAngleChanged(
bool relative );
543 void enabledChangedX(
bool enabled );
554 void enabledChangedY(
bool enabled );
565 void enabledChangedAngle(
bool enabled );
576 void enabledChangedDistance(
bool enabled );
584 void focusOnXRequested();
592 void focusOnYRequested();
600 void focusOnAngleRequested();
608 void focusOnDistanceRequested();
613 void additionalConstraintClicked(
bool activated );
616 void lockConstraint(
bool activate =
true );
622 void constraintTextEdited(
const QString &textValue );
628 void constraintFocusOut();
631 void setConstraintRelative(
bool activate );
634 void setConstraintRepeatingLock(
bool activate );
640 void activateCad(
bool enabled );
643 void setConstructionMode(
bool enabled );
646 void settingsButtonTriggered( QAction *action );
650 void setCadEnabled(
bool enabled );
656 void updateCapacity(
bool updateUIwithoutChange =
false );
659 void lockAdditionalConstraint( AdditionalConstraint constraint );
666 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
669 void updateCurrentPoint(
const QgsPointXY &point );
676 bool filterKeyPress( QKeyEvent *e );
682 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
685 void triggerMouseMoveEvent();
688 CadConstraint *objectToConstraint(
const QObject *obj )
const;
691 double parseUserInput(
const QString &inputValue,
bool &ok )
const;
699 void updateConstraintValue( CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
702 void updateUnlockedConstraintValues(
const QgsPointXY &point );
707 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
709 CadCapacities mCapacities =
nullptr;
711 bool mCurrentMapToolSupportsCad =
false;
718 bool mCadEnabled =
false;
719 bool mConstructionMode =
false;
722 std::unique_ptr< CadConstraint > mAngleConstraint;
723 std::unique_ptr< CadConstraint > mDistanceConstraint;
724 std::unique_ptr< CadConstraint > mXConstraint;
725 std::unique_ptr< CadConstraint > mYConstraint;
726 AdditionalConstraint mAdditionalConstraint;
727 double mCommonAngleConstraint;
730 QList<QgsPointXY> mCadPointList;
731 QList<QgsPointXY> mSnappedSegment;
733 bool mSessionActive =
false;
736 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
739 QMap< QAction *, double > mCommonAngleActions;
746 bool eventFilter( QObject *obj, QEvent *event );
751 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsAdvancedDigitizingDockWidget::CadCapacities )
753 #endif // QGSADVANCEDDIGITIZINGDOCK_H