16 #ifndef QGSADVANCEDDIGITIZINGDOCK 17 #define QGSADVANCEDDIGITIZINGDOCK 23 #include "ui_qgsadvanceddigitizingdockwidgetbase.h" 63 RelativeCoordinates = 4,
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; }
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();
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 );
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;
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
A class to represent a 2D point.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
#define SIP_MONKEYPATCH_SCOPEENUM
Map canvas is a class for displaying all GIS data types on a canvas.
The QgsAdvancedDigitizingFloater class is widget that floats next to the mouse pointer, and allow interaction with the AdvancedDigitizing feature.
The QgsAdvancedDigitizingCanvasItem class draws the graphical elements of the CAD tools (...