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();
371 void setPoints(
const QList<QgsPointXY> &points );
380 QgsPoint currentPointV2(
bool *exists =
nullptr )
const;
402 QgsPoint previousPointV2(
bool *exists =
nullptr )
const;
417 QgsPoint penultimatePointV2(
bool *exists =
nullptr )
const;
435 inline bool snappedToVertex()
const {
return ( mSnapMatch.isValid() && ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) ); }
462 void updateCadPaintItem();
472 void setX(
const QString &value, WidgetSetMode mode );
482 void setY(
const QString &value, WidgetSetMode mode );
492 void setZ(
const QString &value, WidgetSetMode mode );
502 void setM(
const QString &value, WidgetSetMode mode );
512 void setAngle(
const QString &value, WidgetSetMode mode );
522 void setDistance(
const QString &value, WidgetSetMode mode );
528 double getLineZ( )
const;
534 double getLineM( )
const;
866 void betweenLineConstraintClicked(
bool activated );
869 void lockConstraint(
bool activate =
true );
872 void lockParameterlessConstraint(
bool activate =
true );
878 void constraintTextEdited(
const QString &textValue );
884 void constraintFocusOut();
887 void setConstraintRelative(
bool activate );
890 void setConstraintRepeatingLock(
bool activate );
896 void activateCad(
bool enabled );
899 void setConstructionMode(
bool enabled );
902 void settingsButtonTriggered( QAction *action );
912 void setCadEnabled(
bool enabled );
918 void updateCapacity(
bool updateUIwithoutChange =
false );
928 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
931 void updateCurrentPoint(
const QgsPoint &point );
938 bool filterKeyPress( QKeyEvent *e );
944 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
947 void triggerMouseMoveEvent();
950 CadConstraint *objectToConstraint(
const QObject *obj )
const;
953 double parseUserInput(
const QString &inputValue,
bool &ok )
const;
961 void updateConstraintValue(
CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
964 void updateUnlockedConstraintValues(
const QgsPoint &point );
977 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
979 CadCapacities mCapacities = CadCapacities();
981 bool mCurrentMapToolSupportsCad =
false;
988 bool mCadEnabled =
false;
989 bool mConstructionMode =
false;
992 std::unique_ptr< CadConstraint > mAngleConstraint;
993 std::unique_ptr< CadConstraint > mDistanceConstraint;
994 std::unique_ptr< CadConstraint > mXConstraint;
995 std::unique_ptr< CadConstraint > mYConstraint;
996 std::unique_ptr< CadConstraint > mZConstraint;
997 std::unique_ptr< CadConstraint > mMConstraint;
998 std::unique_ptr< CadConstraint > mLineExtensionConstraint;
999 std::unique_ptr< CadConstraint > mXyVertexConstraint;
1001 double mCommonAngleConstraint;
1004 QList<QgsPoint> mCadPointList;
1005 QList<QgsPointXY> mSnappedSegment;
1007 bool mSessionActive =
false;
1010 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
1013 QMap< QAction *, double > mCommonAngleActions;
1014 QAction *mLineExtensionAction;
1015 QAction *mXyVertexAction;
1025 QQueue< QgsPointLocator::Match > mLockedSnapVertices;
1029 bool eventFilter( QObject *obj, QEvent *event );
1034 friend class TestQgsAdvancedDigitizing;
1035 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.