16 #ifndef QGSADVANCEDDIGITIZINGDOCK 17 #define QGSADVANCEDDIGITIZINGDOCK 23 #include "ui_qgsadvanceddigitizingdockwidgetbase.h" 61 RelativeCoordinates = 4,
64 Q_FLAG( CadCapacities )
103 CadConstraint( QLineEdit *lineEdit, QToolButton *lockerButton, QToolButton *relativeButton =
nullptr, QToolButton *repeatingLockButton =
nullptr )
104 : mLineEdit( lineEdit )
105 , mLockerButton( lockerButton )
106 , mRelativeButton( relativeButton )
107 , mRepeatingLockButton( repeatingLockButton )
108 , mLockMode( NoLock )
109 , mRepeatingLock( false )
123 bool isLocked()
const {
return mLockMode != NoLock; }
141 double value()
const {
return mValue; }
160 void setRepeatingLock(
bool repeating );
165 void setRelative(
bool relative );
172 void setValue(
double value,
bool updateWidget =
true );
182 void toggleRelative();
185 QLineEdit *mLineEdit =
nullptr;
186 QToolButton *mLockerButton =
nullptr;
187 QToolButton *mRelativeButton =
nullptr;
188 QToolButton *mRepeatingLockButton =
nullptr;
205 void hideEvent( QHideEvent * )
override;
213 bool canvasKeyPressEventFilter( QKeyEvent *e );
233 void releaseLocks(
bool releaseRepeatingLocks =
true );
240 void keyPressEvent( QKeyEvent *e )
override;
286 void removePreviousPoint();
295 void setPoints(
const QList<QgsPointXY> &points );
302 QgsPointXY currentPoint(
bool *exists =
nullptr )
const;
309 QgsPointXY previousPoint(
bool *exists =
nullptr )
const;
316 QgsPointXY penultimatePoint(
bool *exists =
nullptr )
const;
326 inline bool snappedToVertex()
const {
return ( mSnapMatch.isValid() && mSnapMatch.hasVertex() ); }
353 void updateCadPaintItem();
362 void pushWarning(
const QString &message );
379 void additionalConstraintClicked(
bool activated );
382 void lockConstraint(
bool activate =
true );
388 void constraintTextEdited(
const QString &textValue );
394 void constraintFocusOut();
397 void setConstraintRelative(
bool activate );
400 void setConstraintRepeatingLock(
bool activate );
406 void activateCad(
bool enabled );
409 void setConstructionMode(
bool enabled );
412 void settingsButtonTriggered( QAction *action );
416 void setCadEnabled(
bool enabled );
422 void updateCapacity(
bool updateUIwithoutChange =
false );
432 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
435 void updateCurrentPoint(
const QgsPointXY &point );
442 bool filterKeyPress( QKeyEvent *e );
448 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
451 void triggerMouseMoveEvent();
454 CadConstraint *objectToConstraint(
const QObject *obj )
const;
457 double parseUserInput(
const QString &inputValue,
bool &ok )
const;
465 void updateConstraintValue(
CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
468 void updateUnlockedConstraintValues(
const QgsPointXY &point );
473 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
475 CadCapacities mCapacities =
nullptr;
477 bool mCurrentMapToolSupportsCad =
false;
481 bool mCadEnabled =
false;
482 bool mConstructionMode =
false;
485 std::unique_ptr< CadConstraint > mAngleConstraint;
486 std::unique_ptr< CadConstraint > mDistanceConstraint;
487 std::unique_ptr< CadConstraint > mXConstraint;
488 std::unique_ptr< CadConstraint > mYConstraint;
490 double mCommonAngleConstraint;
493 QList<QgsPointXY> mCadPointList;
494 QList<QgsPointXY> mSnappedSegment;
496 bool mSessionActive =
false;
499 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
502 QMap< QAction *, double > mCommonAngleActions;
509 bool eventFilter( QObject *obj, QEvent *event );
514 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsAdvancedDigitizingDockWidget::CadCapacities )
516 #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 (...