16 #ifndef QGSADVANCEDDIGITIZINGDOCK
17 #define QGSADVANCEDDIGITIZINGDOCK
23 #include "ui_qgsadvanceddigitizingdockwidgetbase.h"
63 RelativeCoordinates = 4,
66 Q_DECLARE_FLAGS( CadCapacities, CadCapacity )
67 Q_FLAG( CadCapacities )
117 CadConstraint( QLineEdit *lineEdit, QToolButton *lockerButton, QToolButton *relativeButton =
nullptr, QToolButton *repeatingLockButton =
nullptr )
118 : mLineEdit( lineEdit )
119 , mLockerButton( lockerButton )
120 , mRelativeButton( relativeButton )
121 , mRepeatingLockButton( repeatingLockButton )
122 , mLockMode( NoLock )
123 , mRepeatingLock( false )
137 bool isLocked()
const {
return mLockMode != NoLock; }
155 double value()
const {
return mValue; }
165 void setLockMode( LockMode mode );
174 void setRepeatingLock(
bool repeating );
179 void setRelative(
bool relative );
186 void setValue(
double value,
bool updateWidget =
true );
196 void toggleRelative();
215 QLineEdit *mLineEdit =
nullptr;
216 QToolButton *mLockerButton =
nullptr;
217 QToolButton *mRelativeButton =
nullptr;
218 QToolButton *mRepeatingLockButton =
nullptr;
239 bool canvasKeyPressEventFilter( QKeyEvent *e );
259 void releaseLocks(
bool releaseRepeatingLocks =
true );
266 void keyPressEvent( QKeyEvent *e )
override;
281 void setEnabledZ(
bool enable );
287 void setEnabledM(
bool enable );
342 void removePreviousPoint();
351 void setPoints(
const QList<QgsPointXY> &points );
360 QgsPoint currentPointV2(
bool *exists =
nullptr )
const;
382 QgsPoint previousPointV2(
bool *exists =
nullptr )
const;
397 QgsPoint penultimatePointV2(
bool *exists =
nullptr )
const;
415 inline bool snappedToVertex()
const {
return ( mSnapMatch.isValid() && ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) ); }
442 void updateCadPaintItem();
452 void setX(
const QString &value, WidgetSetMode mode );
462 void setY(
const QString &value, WidgetSetMode mode );
472 void setZ(
const QString &value, WidgetSetMode mode );
482 void setM(
const QString &value, WidgetSetMode mode );
492 void setAngle(
const QString &value, WidgetSetMode mode );
502 void setDistance(
const QString &value, WidgetSetMode mode );
508 double getLineZ( )
const;
514 double getLineM( )
const;
824 void additionalConstraintClicked(
bool activated );
827 void lockConstraint(
bool activate =
true );
833 void constraintTextEdited(
const QString &textValue );
839 void constraintFocusOut();
842 void setConstraintRelative(
bool activate );
845 void setConstraintRepeatingLock(
bool activate );
851 void activateCad(
bool enabled );
854 void setConstructionMode(
bool enabled );
857 void settingsButtonTriggered( QAction *action );
867 void setCadEnabled(
bool enabled );
873 void updateCapacity(
bool updateUIwithoutChange =
false );
883 QList<QgsPointXY> snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped =
nullptr )
const;
886 void updateCurrentPoint(
const QgsPoint &point );
893 bool filterKeyPress( QKeyEvent *e );
899 bool eventFilter( QObject *obj, QEvent *event )
override SIP_SKIP;
902 void triggerMouseMoveEvent();
905 CadConstraint *objectToConstraint(
const QObject *obj )
const;
908 double parseUserInput(
const QString &inputValue,
bool &ok )
const;
916 void updateConstraintValue(
CadConstraint *constraint,
const QString &textValue,
bool convertExpression =
false );
919 void updateUnlockedConstraintValues(
const QgsPoint &point );
924 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
926 CadCapacities mCapacities = CadCapacities();
928 bool mCurrentMapToolSupportsCad =
false;
935 bool mCadEnabled =
false;
936 bool mConstructionMode =
false;
939 std::unique_ptr< CadConstraint > mAngleConstraint;
940 std::unique_ptr< CadConstraint > mDistanceConstraint;
941 std::unique_ptr< CadConstraint > mXConstraint;
942 std::unique_ptr< CadConstraint > mYConstraint;
943 std::unique_ptr< CadConstraint > mZConstraint;
944 std::unique_ptr< CadConstraint > mMConstraint;
946 double mCommonAngleConstraint;
949 QList<QgsPoint> mCadPointList;
950 QList<QgsPointXY> mSnappedSegment;
952 bool mSessionActive =
false;
955 std::unique_ptr<QgsMessageBarItem> mErrorMessage;
958 QMap< QAction *, double > mCommonAngleActions;
966 bool eventFilter( QObject *obj, QEvent *event );
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)
#define SIP_MONKEYPATCH_SCOPEENUM
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.