16 #ifndef QGSADVANCEDDIGITIZINGDOCK
17 #define QGSADVANCEDDIGITIZINGDOCK
23 #include "ui_qgsadvanceddigitizingdockwidgetbase.h"
63 RelativeCoordinates = 4,
65 Q_DECLARE_FLAGS( CadCapacities, CadCapacity )
66 Q_FLAG( CadCapacities )
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() || mSnapMatch.hasLineEndpoint() ) ); }
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 );
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 = CadCapacities();
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;
747 bool eventFilter( QObject *obj, QEvent *event );
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.
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
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)
#define SIP_MONKEYPATCH_SCOPEENUM
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.