16#ifndef QGSADVANCEDDIGITIZINGDOCK
17#define QGSADVANCEDDIGITIZINGDOCK
24#include "ui_qgsadvanceddigitizingdockwidgetbase.h"
65 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 );
1030 void setCadEnabled(
bool enabled );
1036 void updateCapacity(
bool updateUIwithoutChange =
false );
1046 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
1052 bool filterKeyPress( QKeyEvent *e );
1058 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
1061 void triggerMouseMoveEvent();
1064 CadConstraint *objectToConstraint(
const QObject *obj )
const;
1075 void updateConstraintValue(
CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
1078 void updateUnlockedConstraintValues(
const QgsPoint &point );
1090 void resetConstructionGuides();
1096 void updateConstructionGuidesCrs();
1103 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
1107 bool mCurrentMapToolSupportsCad =
false;
1114 bool mCadEnabled =
false;
1115 bool mConstructionMode =
false;
1118 std::unique_ptr<CadConstraint> mAngleConstraint;
1119 std::unique_ptr<CadConstraint> mDistanceConstraint;
1120 std::unique_ptr<CadConstraint> mXConstraint;
1121 std::unique_ptr<CadConstraint> mYConstraint;
1122 std::unique_ptr<CadConstraint> mZConstraint;
1123 std::unique_ptr<CadConstraint> mMConstraint;
1124 std::unique_ptr<CadConstraint> mLineExtensionConstraint;
1125 std::unique_ptr<CadConstraint> mXyVertexConstraint;
1127 double mCommonAngleConstraint;
1130 bool mSnappingPrioritizeFeatures =
false;
1133 QList<QgsPoint> mCadPointList;
1134 QList<QgsPointXY> mSnappedSegment;
1136 bool mSessionActive =
false;
1139 std::unique_ptr<QgsVectorLayer> mConstructionGuidesLayer;
1142 bool mDeferredUpdateConstructionGuidesCrs =
false;
1145 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
1148 QMap<double, QAction *> mCommonAngleActions;
1149 QAction *mLineExtensionAction =
nullptr;
1150 QAction *mXyVertexAction =
nullptr;
1151 QAction *mRecordConstructionGuides =
nullptr;
1152 QAction *mShowConstructionGuides =
nullptr;
1153 QAction *mSnapToConstructionGuides =
nullptr;
1154 QAction *mClearConstructionGuides =
nullptr;
1164 QQueue<QgsPointLocator::Match> mLockedSnapVertices;
1167 QPointer<QgsAdvancedDigitizingTool> mCurrentTool;
1171 bool eventFilter( QObject *obj, QEvent *event );
1176 QMenu *mCommonAngleActionsMenu =
nullptr;
1177 QMenu *mFloaterActionsMenu =
nullptr;
1184 friend class TestQgsAdvancedDigitizing;
1185 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)