16#ifndef QGSADVANCEDDIGITIZINGDOCK
17#define QGSADVANCEDDIGITIZINGDOCK
24#include "ui_qgsadvanceddigitizingdockwidgetbase.h"
66 RelativeCoordinates = 4,
110 CadConstraint( QLineEdit *lineEdit, QToolButton *lockerButton, QToolButton *relativeButton =
nullptr, QToolButton *repeatingLockButton =
nullptr )
111 : mLineEdit( lineEdit )
112 , mLockerButton( lockerButton )
113 , mRelativeButton( relativeButton )
114 , mRepeatingLockButton( repeatingLockButton )
115 , mLockMode( NoLock )
116 , mRepeatingLock( false )
130 bool isLocked()
const {
return mLockMode != NoLock; }
147 double value()
const {
return mValue; }
157 void setLockMode( LockMode mode );
165 void setRepeatingLock(
bool repeating );
170 void setRelative(
bool relative );
177 void setValue(
double value,
bool updateWidget =
true );
183 QString displayValue()
const;
193 void toggleRelative();
237 QLineEdit *mLineEdit =
nullptr;
238 QToolButton *mLockerButton =
nullptr;
239 QToolButton *mRelativeButton =
nullptr;
240 QToolButton *mRepeatingLockButton =
nullptr;
265 bool canvasKeyPressEventFilter( QKeyEvent *e );
310 void releaseLocks(
bool releaseRepeatingLocks =
true );
317 void keyPressEvent( QKeyEvent *e )
override;
332 void setEnabledZ(
bool enable );
338 void setEnabledM(
bool enable );
356 bool showConstructionGuides()
const;
362 bool snapToConstructionGuides()
const;
368 bool recordConstructionGuides()
const;
417 void toggleConstraintDistance();
436 void clearLockedSnapVertices(
bool force =
true );
452 void removePreviousPoint();
458 void updateCurrentPoint(
const QgsPoint &point );
466 void setPoints(
const QList<QgsPointXY> &points );
475 QgsPoint currentPointV2(
bool *exists =
nullptr )
const;
497 QgsPoint previousPointV2(
bool *exists =
nullptr )
const;
512 QgsPoint penultimatePointV2(
bool *exists =
nullptr )
const;
530 inline bool snappedToVertex()
const {
return ( mSnapMatch.isValid() && ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) ); }
556 void updateCadPaintItem();
566 void setX(
const QString &value, WidgetSetMode mode );
576 void setY(
const QString &value, WidgetSetMode mode );
586 void setZ(
const QString &value, WidgetSetMode mode );
596 void setM(
const QString &value, WidgetSetMode mode );
606 void setAngle(
const QString &value, WidgetSetMode mode );
616 void setDistance(
const QString &value, WidgetSetMode mode );
622 double getLineZ( )
const;
628 double getLineM( )
const;
640 QString formatCommonAngleSnapping(
double angle );
985 void betweenLineConstraintClicked(
bool activated );
988 void lockConstraint(
bool activate =
true );
991 void lockParameterlessConstraint(
bool activate =
true );
997 void constraintTextEdited(
const QString &textValue );
1003 void constraintFocusOut();
1006 void setConstraintRelative(
bool activate );
1009 void setConstraintRepeatingLock(
bool activate );
1015 void activateCad(
bool enabled );
1018 void setConstructionMode(
bool enabled );
1021 void settingsButtonTriggered( QAction *action );
1031 void setCadEnabled(
bool enabled );
1037 void updateCapacity(
bool updateUIwithoutChange =
false );
1047 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
1053 bool filterKeyPress( QKeyEvent *e );
1059 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
1062 void triggerMouseMoveEvent();
1065 CadConstraint *objectToConstraint(
const QObject *obj )
const;
1076 void updateConstraintValue(
CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
1079 void updateUnlockedConstraintValues(
const QgsPoint &point );
1091 void resetConstructionGuides();
1097 void updateConstructionGuidesCrs();
1104 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
1108 bool mCurrentMapToolSupportsCad =
false;
1115 bool mCadEnabled =
false;
1116 bool mConstructionMode =
false;
1119 std::unique_ptr< CadConstraint > mAngleConstraint;
1120 std::unique_ptr< CadConstraint > mDistanceConstraint;
1121 std::unique_ptr< CadConstraint > mXConstraint;
1122 std::unique_ptr< CadConstraint > mYConstraint;
1123 std::unique_ptr< CadConstraint > mZConstraint;
1124 std::unique_ptr< CadConstraint > mMConstraint;
1125 std::unique_ptr< CadConstraint > mLineExtensionConstraint;
1126 std::unique_ptr< CadConstraint > mXyVertexConstraint;
1128 double mCommonAngleConstraint;
1131 bool mSnappingPrioritizeFeatures =
false;
1134 QList<QgsPoint> mCadPointList;
1135 QList<QgsPointXY> mSnappedSegment;
1137 bool mSessionActive =
false;
1140 std::unique_ptr<QgsVectorLayer> mConstructionGuidesLayer;
1143 bool mDeferredUpdateConstructionGuidesCrs =
false;
1146 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
1149 QMap< double, QAction *> mCommonAngleActions;
1150 QAction *mLineExtensionAction =
nullptr;
1151 QAction *mXyVertexAction =
nullptr;
1152 QAction *mRecordConstructionGuides =
nullptr;
1153 QAction *mShowConstructionGuides =
nullptr;
1154 QAction *mSnapToConstructionGuides =
nullptr;
1155 QAction *mClearConstructionGuides =
nullptr;
1165 QQueue< QgsPointLocator::Match > mLockedSnapVertices;
1168 QPointer<QgsAdvancedDigitizingTool> mCurrentTool;
1172 bool eventFilter( QObject *obj, QEvent *event );
1177 QMenu *mCommonAngleActionsMenu =
nullptr;
1178 QMenu *mFloaterActionsMenu =
nullptr;
1185 friend class TestQgsAdvancedDigitizing;
1186 friend class TestQgsAdvancedDigitizingDockWidget;
CadConstraintType
Advanced digitizing constraint type.
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,...
Line string geometry type, with support for z-dimension and m-values.
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.
A boolean settings entry.
Represents a vector layer which manages a vector based data sets.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
#define SIP_ENUM_BASETYPE(type)
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)