16#ifndef QGSADVANCEDDIGITIZINGDOCK
17#define QGSADVANCEDDIGITIZINGDOCK
24#include "ui_qgsadvanceddigitizingdockwidgetbase.h"
65 RelativeCoordinates = 4,
68 Q_DECLARE_FLAGS( CadCapacities, CadCapacity )
69 Q_FLAG( CadCapacities )
109 CadConstraint( QLineEdit *lineEdit, QToolButton *lockerButton, QToolButton *relativeButton =
nullptr, QToolButton *repeatingLockButton =
nullptr )
110 : mLineEdit( lineEdit )
111 , mLockerButton( lockerButton )
112 , mRelativeButton( relativeButton )
113 , mRepeatingLockButton( repeatingLockButton )
114 , mLockMode( NoLock )
115 , mRepeatingLock( false )
129 bool isLocked()
const {
return mLockMode != NoLock; }
147 double value()
const {
return mValue; }
157 void setLockMode( LockMode mode );
166 void setRepeatingLock(
bool repeating );
171 void setRelative(
bool relative );
178 void setValue(
double value,
bool updateWidget =
true );
188 void toggleRelative();
207 QLineEdit *mLineEdit =
nullptr;
208 QToolButton *mLockerButton =
nullptr;
209 QToolButton *mRelativeButton =
nullptr;
210 QToolButton *mRepeatingLockButton =
nullptr;
231 bool canvasKeyPressEventFilter( QKeyEvent *e );
251 void releaseLocks(
bool releaseRepeatingLocks =
true );
258 void keyPressEvent( QKeyEvent *e )
override;
273 void setEnabledZ(
bool enable );
279 void setEnabledM(
bool enable );
344 void clearLockedSnapVertices(
bool force =
true );
362 void removePreviousPoint();
368 void updateCurrentPoint(
const QgsPoint &point );
377 void setPoints(
const QList<QgsPointXY> &points );
386 QgsPoint currentPointV2(
bool *exists =
nullptr )
const;
408 QgsPoint previousPointV2(
bool *exists =
nullptr )
const;
423 QgsPoint penultimatePointV2(
bool *exists =
nullptr )
const;
441 inline bool snappedToVertex()
const {
return ( mSnapMatch.isValid() && ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) ); }
468 void updateCadPaintItem();
478 void setX(
const QString &value, WidgetSetMode mode );
488 void setY(
const QString &value, WidgetSetMode mode );
498 void setZ(
const QString &value, WidgetSetMode mode );
508 void setM(
const QString &value, WidgetSetMode mode );
518 void setAngle(
const QString &value, WidgetSetMode mode );
528 void setDistance(
const QString &value, WidgetSetMode mode );
534 double getLineZ( )
const;
540 double getLineM( )
const;
872 void betweenLineConstraintClicked(
bool activated );
875 void lockConstraint(
bool activate =
true );
878 void lockParameterlessConstraint(
bool activate =
true );
884 void constraintTextEdited(
const QString &textValue );
890 void constraintFocusOut();
893 void setConstraintRelative(
bool activate );
896 void setConstraintRepeatingLock(
bool activate );
902 void activateCad(
bool enabled );
905 void setConstructionMode(
bool enabled );
908 void settingsButtonTriggered( QAction *action );
918 void setCadEnabled(
bool enabled );
924 void updateCapacity(
bool updateUIwithoutChange =
false );
934 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
940 bool filterKeyPress( QKeyEvent *e );
946 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
949 void triggerMouseMoveEvent();
952 CadConstraint *objectToConstraint(
const QObject *obj )
const;
955 double parseUserInput(
const QString &inputValue,
bool &ok )
const;
963 void updateConstraintValue(
CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
966 void updateUnlockedConstraintValues(
const QgsPoint &point );
979 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
981 CadCapacities mCapacities = CadCapacities();
983 bool mCurrentMapToolSupportsCad =
false;
990 bool mCadEnabled =
false;
991 bool mConstructionMode =
false;
994 std::unique_ptr< CadConstraint > mAngleConstraint;
995 std::unique_ptr< CadConstraint > mDistanceConstraint;
996 std::unique_ptr< CadConstraint > mXConstraint;
997 std::unique_ptr< CadConstraint > mYConstraint;
998 std::unique_ptr< CadConstraint > mZConstraint;
999 std::unique_ptr< CadConstraint > mMConstraint;
1000 std::unique_ptr< CadConstraint > mLineExtensionConstraint;
1001 std::unique_ptr< CadConstraint > mXyVertexConstraint;
1003 double mCommonAngleConstraint;
1006 QList<QgsPoint> mCadPointList;
1007 QList<QgsPointXY> mSnappedSegment;
1009 bool mSessionActive =
false;
1012 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
1015 QMap< QAction *, double > mCommonAngleActions;
1016 QAction *mLineExtensionAction;
1017 QAction *mXyVertexAction;
1027 QQueue< QgsPointLocator::Match > mLockedSnapVertices;
1031 bool eventFilter( QObject *obj, QEvent *event );
1036 friend class TestQgsAdvancedDigitizing;
1037 friend class TestQgsAdvancedDigitizingDockWidget;
BetweenLineConstraint
Between line constraints which can be enabled.
LineExtensionSide
Designates whether the line extension constraint is currently soft locked with the previous or next v...
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.
Base class for all map layer types.
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
A class to represent a 2D point.
Point geometry type, with support for z-dimension and m-values.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
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.