16 #ifndef QGSADVANCEDDIGITIZINGDOCK 17 #define QGSADVANCEDDIGITIZINGDOCK 23 #include "ui_qgsadvanceddigitizingdockwidgetbase.h" 60 RelativeCoordinates = 4,
63 Q_FLAG( CadCapacities )
102 CadConstraint( QLineEdit *lineEdit, QToolButton *lockerButton, QToolButton *relativeButton =
nullptr, QToolButton *repeatingLockButton =
nullptr )
103 : mLineEdit( lineEdit )
104 , mLockerButton( lockerButton )
105 , mRelativeButton( relativeButton )
106 , mRepeatingLockButton( repeatingLockButton )
107 , mLockMode( NoLock )
108 , mRepeatingLock( false )
122 bool isLocked()
const {
return mLockMode != NoLock; }
140 double value()
const {
return mValue; }
159 void setRepeatingLock(
bool repeating );
164 void setRelative(
bool relative );
171 void setValue(
double value,
bool updateWidget =
true );
181 void toggleRelative();
184 QLineEdit *mLineEdit =
nullptr;
185 QToolButton *mLockerButton =
nullptr;
186 QToolButton *mRelativeButton =
nullptr;
187 QToolButton *mRepeatingLockButton =
nullptr;
204 void hideEvent( QHideEvent * )
override;
212 bool canvasKeyPressEventFilter( QKeyEvent *e );
232 void releaseLocks(
bool releaseRepeatingLocks =
true );
239 void keyPressEvent( QKeyEvent *e )
override;
288 void setPoints(
const QList<QgsPointXY> &points );
295 QgsPointXY currentPoint(
bool *exists =
nullptr )
const;
302 QgsPointXY previousPoint(
bool *exists =
nullptr )
const;
309 QgsPointXY penultimatePoint(
bool *exists =
nullptr )
const;
346 void updateCadPaintItem();
355 void pushWarning(
const QString &message );
372 void additionalConstraintClicked(
bool activated );
375 void lockConstraint(
bool activate =
true );
381 void constraintTextEdited(
const QString &textValue );
387 void constraintFocusOut();
390 void setConstraintRelative(
bool activate );
393 void setConstraintRepeatingLock(
bool activate );
399 void activateCad(
bool enabled );
402 void setConstructionMode(
bool enabled );
405 void settingsButtonTriggered( QAction *action );
409 void setCadEnabled(
bool enabled );
415 void updateCapacity(
bool updateUIwithoutChange =
false );
425 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
428 void updateCurrentPoint(
const QgsPointXY &point );
430 void removePreviousPoint();
436 bool filterKeyPress( QKeyEvent *e );
442 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
445 void triggerMouseMoveEvent();
448 CadConstraint *objectToConstraint(
const QObject *obj )
const;
451 double parseUserInput(
const QString &inputValue,
bool &ok )
const;
459 void updateConstraintValue(
CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
462 void updateUnlockedConstraintValues(
const QgsPointXY &point );
467 CadCapacities mCapacities =
nullptr;
469 bool mCurrentMapToolSupportsCad =
false;
473 bool mCadEnabled =
false;
474 bool mConstructionMode =
false;
477 std::unique_ptr< CadConstraint > mAngleConstraint;
478 std::unique_ptr< CadConstraint > mDistanceConstraint;
479 std::unique_ptr< CadConstraint > mXConstraint;
480 std::unique_ptr< CadConstraint > mYConstraint;
482 double mCommonAngleConstraint;
485 QList<QgsPointXY> mCadPointList;
486 QList<QgsPointXY> mSnappedSegment;
487 bool mSnappedToVertex =
false;
489 bool mSessionActive =
false;
492 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
495 QMap< QAction *, double > mCommonAngleActions;
502 bool eventFilter( QObject *obj, QEvent *event );
507 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsAdvancedDigitizingDockWidget::CadCapacities )
509 #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.
Map canvas is a class for displaying all GIS data types on a canvas.
The QgsAdvancedDigitizingCanvasItem class draws the graphical elements of the CAD tools (...