18 #include <QCoreApplication>
44 , mMapCanvas( canvas )
46 , mCommonAngleConstraint(
QgsSettings().value( QStringLiteral(
"/Cad/CommonAngle" ), 0.0 ).toDouble() )
52 mAngleConstraint.reset(
new CadConstraint( mAngleLineEdit, mLockAngleButton, mRelativeAngleButton, mRepeatingLockAngleButton ) );
53 mDistanceConstraint.reset(
new CadConstraint( mDistanceLineEdit, mLockDistanceButton,
nullptr, mRepeatingLockDistanceButton ) );
54 mXConstraint.reset(
new CadConstraint( mXLineEdit, mLockXButton, mRelativeXButton, mRepeatingLockXButton ) );
55 mYConstraint.reset(
new CadConstraint( mYLineEdit, mLockYButton, mRelativeYButton, mRepeatingLockYButton ) );
58 mMapCanvas->installEventFilter(
this );
59 mAngleLineEdit->installEventFilter(
this );
60 mDistanceLineEdit->installEventFilter(
this );
61 mXLineEdit->installEventFilter(
this );
62 mYLineEdit->installEventFilter(
this );
65 connect( mEnableAction, &QAction::triggered,
this, &QgsAdvancedDigitizingDockWidget::activateCad );
66 connect( mConstructionModeAction, &QAction::triggered,
this, &QgsAdvancedDigitizingDockWidget::setConstructionMode );
67 connect( mParallelAction, &QAction::triggered,
this, &QgsAdvancedDigitizingDockWidget::additionalConstraintClicked );
68 connect( mPerpendicularAction, &QAction::triggered,
this, &QgsAdvancedDigitizingDockWidget::additionalConstraintClicked );
69 connect( mLockAngleButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::lockConstraint );
70 connect( mLockDistanceButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::lockConstraint );
71 connect( mLockXButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::lockConstraint );
72 connect( mLockYButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::lockConstraint );
73 connect( mRelativeAngleButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::setConstraintRelative );
74 connect( mRelativeXButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::setConstraintRelative );
75 connect( mRelativeYButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::setConstraintRelative );
76 connect( mRepeatingLockDistanceButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::setConstraintRepeatingLock );
77 connect( mRepeatingLockAngleButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::setConstraintRepeatingLock );
78 connect( mRepeatingLockXButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::setConstraintRepeatingLock );
79 connect( mRepeatingLockYButton, &QAbstractButton::clicked,
this, &QgsAdvancedDigitizingDockWidget::setConstraintRepeatingLock );
80 connect( mAngleLineEdit, &QLineEdit::returnPressed,
this, [ = ]() { lockConstraint(); } );
81 connect( mDistanceLineEdit, &QLineEdit::returnPressed,
this, [ = ]() { lockConstraint(); } );
82 connect( mXLineEdit, &QLineEdit::returnPressed,
this, [ = ]() { lockConstraint(); } );
83 connect( mYLineEdit, &QLineEdit::returnPressed,
this, [ = ]() { lockConstraint(); } );
84 connect( mAngleLineEdit, &QLineEdit::textEdited,
this, &QgsAdvancedDigitizingDockWidget::constraintTextEdited );
85 connect( mDistanceLineEdit, &QLineEdit::textEdited,
this, &QgsAdvancedDigitizingDockWidget::constraintTextEdited );
86 connect( mXLineEdit, &QLineEdit::textEdited,
this, &QgsAdvancedDigitizingDockWidget::constraintTextEdited );
87 connect( mYLineEdit, &QLineEdit::textEdited,
this, &QgsAdvancedDigitizingDockWidget::constraintTextEdited );
99 QMenu *menu =
new QMenu(
this );
101 QActionGroup *angleButtonGroup =
new QActionGroup( menu );
102 mCommonAngleActions = QMap<QAction *, double>();
103 QList< QPair< double, QString > > commonAngles;
105 QList<double> anglesDouble( { 0.0, 5.0, 10.0, 15.0, 18.0, 22.5, 30.0, 45.0, 90.0} );
106 for ( QList<double>::const_iterator it = anglesDouble.constBegin(); it != anglesDouble.constEnd(); ++it )
109 menuText = tr(
"Do Not Snap to Common Angles" );
111 menuText = QString( tr(
"%1, %2, %3, %4°…" ) ).arg( *it, 0,
'f', 1 ).arg( *it * 2, 0,
'f', 1 ).arg( *it * 3, 0,
'f', 1 ).arg( *it * 4, 0,
'f', 1 );
112 commonAngles << QPair<double, QString>( *it, menuText );
114 for ( QList< QPair<double, QString > >::const_iterator it = commonAngles.constBegin(); it != commonAngles.constEnd(); ++it )
116 QAction *action =
new QAction( it->second, menu );
117 action->setCheckable(
true );
118 action->setChecked( it->first == mCommonAngleConstraint );
119 menu->addAction( action );
120 angleButtonGroup->addAction( action );
121 mCommonAngleActions.insert( action, it->first );
124 qobject_cast< QToolButton *>( mToolbar->widgetForAction( mSettingsAction ) )->setPopupMode( QToolButton::InstantPopup );
125 mSettingsAction->setMenu( menu );
126 connect( menu, &QMenu::triggered,
this, &QgsAdvancedDigitizingDockWidget::settingsButtonTriggered );
129 mConstructionModeAction->setToolTip(
"<b>" + tr(
"Construction mode" ) +
"</b><br>(" + tr(
"press c to toggle on/off" ) +
")" );
130 mDistanceLineEdit->setToolTip(
"<b>" + tr(
"Distance" ) +
"</b><br>(" + tr(
"press d for quick access" ) +
")" );
131 mLockDistanceButton->setToolTip(
"<b>" + tr(
"Lock distance" ) +
"</b><br>(" + tr(
"press Ctrl + d for quick access" ) +
")" );
132 mRepeatingLockDistanceButton->setToolTip(
"<b>" + tr(
"Continuously lock distance" ) +
"</b>" );
134 mRelativeAngleButton->setToolTip(
"<b>" + tr(
"Toggles relative angle to previous segment" ) +
"</b><br>(" + tr(
"press Shift + a for quick access" ) +
")" );
135 mAngleLineEdit->setToolTip(
"<b>" + tr(
"Angle" ) +
"</b><br>(" + tr(
"press a for quick access" ) +
")" );
136 mLockAngleButton->setToolTip(
"<b>" + tr(
"Lock angle" ) +
"</b><br>(" + tr(
"press Ctrl + a for quick access" ) +
")" );
137 mRepeatingLockAngleButton->setToolTip(
"<b>" + tr(
"Continuously lock angle" ) +
"</b>" );
139 mRelativeXButton->setToolTip(
"<b>" + tr(
"Toggles relative x to previous node" ) +
"</b><br>(" + tr(
"press Shift + x for quick access" ) +
")" );
140 mXLineEdit->setToolTip(
"<b>" + tr(
"X coordinate" ) +
"</b><br>(" + tr(
"press x for quick access" ) +
")" );
141 mLockXButton->setToolTip(
"<b>" + tr(
"Lock x coordinate" ) +
"</b><br>(" + tr(
"press Ctrl + x for quick access" ) +
")" );
142 mRepeatingLockXButton->setToolTip(
"<b>" + tr(
"Continuously lock x coordinate" ) +
"</b>" );
144 mRelativeYButton->setToolTip(
"<b>" + tr(
"Toggles relative y to previous node" ) +
"</b><br>(" + tr(
"press Shift + y for quick access" ) +
")" );
145 mYLineEdit->setToolTip(
"<b>" + tr(
"Y coordinate" ) +
"</b><br>(" + tr(
"press y for quick access" ) +
")" );
146 mLockYButton->setToolTip(
"<b>" + tr(
"Lock y coordinate" ) +
"</b><br>(" + tr(
"press Ctrl + y for quick access" ) +
")" );
147 mRepeatingLockYButton->setToolTip(
"<b>" + tr(
"Continuously lock y coordinate" ) +
"</b>" );
158 mToggleFloaterAction->setChecked( mFloater->
active() );
160 updateCapacity(
true );
168 mXLineEdit->setText( value );
169 if ( mode == WidgetSetMode::ReturnPressed )
171 mXLineEdit->returnPressed();
173 else if ( mode == WidgetSetMode::FocusOut )
175 QEvent *e =
new QEvent( QEvent::FocusOut );
176 QCoreApplication::postEvent( mXLineEdit, e );
178 else if ( mode == WidgetSetMode::TextEdited )
180 mXLineEdit->textEdited( value );
185 mYLineEdit->setText( value );
186 if ( mode == WidgetSetMode::ReturnPressed )
188 mYLineEdit->returnPressed();
190 else if ( mode == WidgetSetMode::FocusOut )
192 QEvent *e =
new QEvent( QEvent::FocusOut );
193 QCoreApplication::postEvent( mYLineEdit, e );
195 else if ( mode == WidgetSetMode::TextEdited )
197 mYLineEdit->textEdited( value );
202 mAngleLineEdit->setText( value );
203 if ( mode == WidgetSetMode::ReturnPressed )
205 mAngleLineEdit->returnPressed();
207 else if ( mode == WidgetSetMode::FocusOut )
209 QEvent *e =
new QEvent( QEvent::FocusOut );
210 QCoreApplication::postEvent( mAngleLineEdit, e );
212 else if ( mode == WidgetSetMode::TextEdited )
214 mAngleLineEdit->textEdited( value );
219 mDistanceLineEdit->setText( value );
220 if ( mode == WidgetSetMode::ReturnPressed )
222 mDistanceLineEdit->returnPressed();
224 else if ( mode == WidgetSetMode::FocusOut )
226 QEvent *e =
new QEvent( QEvent::FocusOut );
227 QCoreApplication::postEvent( mDistanceLineEdit, e );
229 else if ( mode == WidgetSetMode::TextEdited )
231 mDistanceLineEdit->textEdited( value );
236 void QgsAdvancedDigitizingDockWidget::setCadEnabled(
bool enabled )
238 mCadEnabled = enabled;
239 mEnableAction->setChecked( enabled );
240 mConstructionModeAction->setEnabled( enabled );
241 mParallelAction->setEnabled( enabled );
242 mPerpendicularAction->setEnabled( enabled );
243 mSettingsAction->setEnabled( enabled );
244 mInputWidgets->setEnabled( enabled );
245 mToggleFloaterAction->setEnabled( enabled );
248 setConstructionMode(
false );
253 void QgsAdvancedDigitizingDockWidget::activateCad(
bool enabled )
255 enabled &= mCurrentMapToolSupportsCad;
257 mSessionActive = enabled;
259 if ( enabled && !isVisible() )
264 setCadEnabled( enabled );
267 void QgsAdvancedDigitizingDockWidget::additionalConstraintClicked(
bool activated )
273 if ( sender() == mParallelAction )
277 else if ( sender() == mPerpendicularAction )
283 void QgsAdvancedDigitizingDockWidget::setConstraintRelative(
bool activate )
285 if ( sender() == mRelativeAngleButton )
287 mAngleConstraint->setRelative( activate );
290 else if ( sender() == mRelativeXButton )
292 mXConstraint->setRelative( activate );
295 else if ( sender() == mRelativeYButton )
297 mYConstraint->setRelative( activate );
302 void QgsAdvancedDigitizingDockWidget::setConstraintRepeatingLock(
bool activate )
304 if ( sender() == mRepeatingLockDistanceButton )
306 mDistanceConstraint->setRepeatingLock( activate );
308 else if ( sender() == mRepeatingLockAngleButton )
310 mAngleConstraint->setRepeatingLock( activate );
312 else if ( sender() == mRepeatingLockXButton )
314 mXConstraint->setRepeatingLock( activate );
316 else if ( sender() == mRepeatingLockYButton )
318 mYConstraint->setRepeatingLock( activate );
322 void QgsAdvancedDigitizingDockWidget::setConstructionMode(
bool enabled )
324 mConstructionMode = enabled;
325 mConstructionModeAction->setChecked( enabled );
328 void QgsAdvancedDigitizingDockWidget::settingsButtonTriggered( QAction *action )
331 QMap<QAction *, double>::const_iterator ica = mCommonAngleActions.constFind( action );
332 if ( ica != mCommonAngleActions.constEnd() )
334 ica.key()->setChecked(
true );
335 mCommonAngleConstraint = ica.value();
347 if ( releaseRepeatingLocks || !mAngleConstraint->isRepeatingLock() )
352 if ( releaseRepeatingLocks || !mDistanceConstraint->isRepeatingLock() )
357 if ( releaseRepeatingLocks || !mXConstraint->isRepeatingLock() )
362 if ( releaseRepeatingLocks || !mYConstraint->isRepeatingLock() )
370 void QgsAdvancedDigitizingDockWidget::emit pointChanged()
373 QPoint globalPos = mMapCanvas->cursor().pos();
374 QPoint pos = mMapCanvas->mapFromGlobal( globalPos );
375 QMouseEvent *e =
new QMouseEvent( QEvent::MouseMove, pos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier );
376 mCurrentMapTool->canvasMoveEvent( e );
382 CadConstraint *constraint =
nullptr;
383 if ( obj == mAngleLineEdit || obj == mLockAngleButton )
385 constraint = mAngleConstraint.get();
387 else if ( obj == mDistanceLineEdit || obj == mLockDistanceButton )
389 constraint = mDistanceConstraint.get();
391 else if ( obj == mXLineEdit || obj == mLockXButton )
393 constraint = mXConstraint.get();
395 else if ( obj == mYLineEdit || obj == mLockYButton )
397 constraint = mYConstraint.get();
402 double QgsAdvancedDigitizingDockWidget::parseUserInput(
const QString &inputValue,
bool &ok )
const
414 QVariant result = expr.evaluate();
415 if ( expr.hasEvalError() )
418 value = result.toDouble( &ok );
423 void QgsAdvancedDigitizingDockWidget::updateConstraintValue( CadConstraint *constraint,
const QString &textValue,
bool convertExpression )
425 if ( !constraint || textValue.isEmpty() )
434 double value = parseUserInput( textValue, ok );
438 constraint->setValue( value, convertExpression );
443 void QgsAdvancedDigitizingDockWidget::lockConstraint(
bool activate )
445 CadConstraint *constraint = objectToConstraint( sender() );
453 QString textValue = constraint->lineEdit()->text();
454 if ( !textValue.isEmpty() )
457 double value = parseUserInput( textValue, ok );
460 constraint->setValue( value );
474 if ( constraint == mXConstraint.get() )
478 else if ( constraint == mYConstraint.get() )
482 else if ( constraint == mDistanceConstraint.get() )
486 else if ( constraint == mAngleConstraint.get() )
494 if ( constraint == mAngleConstraint.get() )
504 void QgsAdvancedDigitizingDockWidget::constraintTextEdited(
const QString &textValue )
506 CadConstraint *constraint = objectToConstraint( sender() );
512 updateConstraintValue( constraint, textValue,
false );
515 void QgsAdvancedDigitizingDockWidget::constraintFocusOut()
517 QLineEdit *lineEdit = qobject_cast< QLineEdit * >( sender()->parent() );
521 CadConstraint *constraint = objectToConstraint( lineEdit );
527 updateConstraintValue( constraint, lineEdit->text(),
true );
530 void QgsAdvancedDigitizingDockWidget::lockAdditionalConstraint( AdditionalConstraint constraint )
532 mAdditionalConstraint = constraint;
537 void QgsAdvancedDigitizingDockWidget::updateCapacity(
bool updateUIwithoutChange )
539 CadCapacities newCapacities = CadCapacities();
541 if ( mCadPointList.count() > 1 )
545 if ( mCadPointList.count() > 2 )
549 if ( !updateUIwithoutChange && newCapacities == mCapacities )
559 bool relativeAngle = mCadEnabled && newCapacities.testFlag(
RelativeAngle );
560 bool absoluteAngle = mCadEnabled && newCapacities.testFlag(
AbsoluteAngle );
563 mPerpendicularAction->setEnabled( absoluteAngle && snappingEnabled );
564 mParallelAction->setEnabled( absoluteAngle && snappingEnabled );
567 if ( !snappingEnabled )
569 mPerpendicularAction->setToolTip( tr(
"Snapping must be enabled to utilize perpendicular mode" ) );
570 mParallelAction->setToolTip( tr(
"Snapping must be enabled to utilize parallel mode" ) );
574 mPerpendicularAction->setToolTip(
"<b>" + tr(
"Perpendicular" ) +
"</b><br>(" + tr(
"press p to switch between perpendicular, parallel and normal mode" ) +
")" );
575 mParallelAction->setToolTip(
"<b>" + tr(
"Parallel" ) +
"</b><br>(" + tr(
"press p to switch between perpendicular, parallel and normal mode" ) +
")" );
579 if ( !absoluteAngle )
585 mLockAngleButton->setEnabled( absoluteAngle );
586 mRelativeAngleButton->setEnabled( relativeAngle );
587 mAngleLineEdit->setEnabled( absoluteAngle );
589 if ( !absoluteAngle )
593 if ( !relativeAngle )
595 mAngleConstraint->setRelative(
false );
598 else if ( relativeAngle && !mCapacities.testFlag(
RelativeAngle ) )
601 mAngleConstraint->setRelative(
true );
606 mLockDistanceButton->setEnabled( relativeCoordinates );
607 mDistanceLineEdit->setEnabled( relativeCoordinates );
609 if ( !relativeCoordinates )
614 mRelativeXButton->setEnabled( relativeCoordinates );
615 mRelativeYButton->setEnabled( relativeCoordinates );
618 mCapacities = newCapacities;
627 constr.
value =
c->value();
636 context.
xConstraint = _constraint( mXConstraint.get() );
637 context.
yConstraint = _constraint( mYConstraint.get() );
648 bool res = output.
valid;
650 mSnappedSegment.clear();
655 mSnappedSegment << edgePt0 << edgePt1;
672 mSnapIndicator->setMatch( output.
snapMatch );
673 mSnapIndicator->setVisible(
true );
677 mSnapIndicator->setVisible(
false );
695 updateCurrentPoint( point );
697 updateUnlockedConstraintValues( point );
705 emit
pushWarning( tr(
"Some constraints are incompatible. Resulting point might be incorrect." ) );
712 void QgsAdvancedDigitizingDockWidget::updateUnlockedConstraintValues(
const QgsPointXY &point )
714 bool previousPointExist, penulPointExist;
719 if ( !mAngleConstraint->isLocked() && previousPointExist )
722 if ( penulPointExist && mAngleConstraint->relative() )
725 angle = std::atan2( previousPt.
y() - penultimatePt.
y(),
726 previousPt.
x() - penultimatePt.
x() );
728 angle = ( std::atan2( point.
y() - previousPt.
y(),
729 point.
x() - previousPt.
x()
730 ) -
angle ) * 180 / M_PI;
733 mAngleConstraint->setValue(
angle );
736 if ( !mDistanceConstraint->isLocked() && previousPointExist )
738 mDistanceConstraint->setValue( std::sqrt( previousPt.
sqrDist( point ) ) );
741 if ( !mXConstraint->isLocked() )
743 if ( previousPointExist && mXConstraint->relative() )
745 mXConstraint->setValue( point.
x() - previousPt.
x() );
749 mXConstraint->setValue( point.
x() );
753 if ( !mYConstraint->isLocked() )
755 if ( previousPointExist && mYConstraint->relative() )
757 mYConstraint->setValue( point.
y() - previousPt.
y() );
761 mYConstraint->setValue( point.
y() );
767 QList<QgsPointXY> QgsAdvancedDigitizingDockWidget::snapSegmentToAllLayers(
const QgsPointXY &originalMapPoint,
bool *snapped )
const
769 QList<QgsPointXY> segment;
782 match = snappingUtils->
snapToMap( originalMapPoint,
nullptr,
true );
784 snappingUtils->
setConfig( canvasConfig );
789 segment << pt1 << pt2;
794 *snapped = segment.count() == 2;
807 bool previousPointExist, penulPointExist, snappedSegmentExist;
810 mSnappedSegment = snapSegmentToAllLayers( e->
originalMapPoint(), &snappedSegmentExist );
812 if ( !previousPointExist || !snappedSegmentExist )
817 double angle = std::atan2( mSnappedSegment[0].y() - mSnappedSegment[1].y(), mSnappedSegment[0].x() - mSnappedSegment[1].x() );
819 if ( mAngleConstraint->relative() && penulPointExist )
821 angle -= std::atan2( previousPt.
y() - penultimatePt.
y(), previousPt.
x() - penultimatePt.
x() );
831 mAngleConstraint->setValue(
angle );
832 mAngleConstraint->setLockMode( lockMode );
850 case Qt::Key_Backspace:
887 case Qt::Key_Backspace:
910 const auto constPoints = points;
917 bool QgsAdvancedDigitizingDockWidget::eventFilter( QObject *obj, QEvent *event )
921 return QgsDockWidget::eventFilter( obj, event );
929 if ( event->type() == QEvent::ShortcutOverride || event->type() == QEvent::KeyPress )
931 if ( QKeyEvent *keyEvent =
dynamic_cast<QKeyEvent *
>( event ) )
933 return filterKeyPress( keyEvent );
936 return QgsDockWidget::eventFilter( obj, event );
939 bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
945 QEvent::Type type = e->type();
951 if ( type == QEvent::ShortcutOverride && ( e->modifiers() == Qt::AltModifier || e->modifiers() == Qt::ControlModifier ) )
953 mXConstraint->toggleLocked();
958 else if ( type == QEvent::ShortcutOverride && e->modifiers() == Qt::ShiftModifier )
962 mXConstraint->toggleRelative();
969 else if ( type == QEvent::KeyPress )
971 mXLineEdit->setFocus();
972 mXLineEdit->selectAll();
981 if ( type == QEvent::ShortcutOverride && ( e->modifiers() == Qt::AltModifier || e->modifiers() == Qt::ControlModifier ) )
983 mYConstraint->toggleLocked();
988 else if ( type == QEvent::ShortcutOverride && e->modifiers() == Qt::ShiftModifier )
992 mYConstraint->toggleRelative();
999 else if ( type == QEvent::KeyPress )
1001 mYLineEdit->setFocus();
1002 mYLineEdit->selectAll();
1011 if ( type == QEvent::ShortcutOverride && ( e->modifiers() == Qt::AltModifier || e->modifiers() == Qt::ControlModifier ) )
1015 mAngleConstraint->toggleLocked();
1021 else if ( type == QEvent::ShortcutOverride && e->modifiers() == Qt::ShiftModifier )
1025 mAngleConstraint->toggleRelative();
1032 else if ( type == QEvent::KeyPress )
1034 mAngleLineEdit->setFocus();
1035 mAngleLineEdit->selectAll();
1044 if ( type == QEvent::ShortcutOverride && ( e->modifiers() == Qt::AltModifier || e->modifiers() == Qt::ControlModifier ) )
1048 mDistanceConstraint->toggleLocked();
1055 else if ( type == QEvent::KeyPress )
1057 mDistanceLineEdit->setFocus();
1058 mDistanceLineEdit->selectAll();
1066 if ( type == QEvent::KeyPress )
1068 setConstructionMode( !mConstructionMode );
1075 if ( type == QEvent::KeyPress )
1077 bool parallel = mParallelAction->isChecked();
1078 bool perpendicular = mPerpendicularAction->isChecked();
1080 if ( !parallel && !perpendicular )
1084 else if ( perpendicular )
1101 return e->isAccepted();
1109 mErrorLabel->setText( tr(
"CAD tools can not be used on geographic coordinates. Change the coordinates system in the project properties." ) );
1110 mErrorLabel->show();
1111 mEnableAction->setEnabled(
false );
1112 setCadEnabled(
false );
1116 mEnableAction->setEnabled(
true );
1117 mErrorLabel->hide();
1120 mCurrentMapToolSupportsCad =
true;
1122 if ( mSessionActive && !isVisible() )
1126 setCadEnabled( mSessionActive );
1134 mEnableAction->setEnabled(
false );
1135 mErrorLabel->setText( tr(
"CAD tools are not enabled for the current map tool" ) );
1136 mErrorLabel->show();
1139 mCurrentMapToolSupportsCad =
false;
1141 setCadEnabled(
false );
1146 mCadPaintItem->update();
1153 mCadPointList << point;
1157 mCadPointList.insert( 0, point );
1170 mCadPointList.removeAt( i );
1177 mCadPointList.clear();
1178 mSnappedSegment.clear();
1184 void QgsAdvancedDigitizingDockWidget::updateCurrentPoint(
const QgsPointXY &point )
1188 mCadPointList << point;
1193 mCadPointList[0] = point;
1202 mLockerButton->setChecked( mode ==
HardLock );
1203 if ( mRepeatingLockButton )
1207 mRepeatingLockButton->setEnabled(
true );
1211 mRepeatingLockButton->setChecked(
false );
1212 mRepeatingLockButton->setEnabled(
false );
1225 mRepeatingLock = repeating;
1226 if ( mRepeatingLockButton )
1227 mRepeatingLockButton->setChecked( repeating );
1232 mRelative = relative;
1233 if ( mRelativeButton )
1235 mRelativeButton->setChecked( relative );
1243 mLineEdit->setText( QLocale().toString( value,
'f', 6 ) );
1248 setLockMode( mLockMode == HardLock ? NoLock : HardLock );
1253 setRelative( !mRelative );
1261 return mCadPointList.value( 0 );
1271 return mCadPointList.value( 1 );
1281 return mCadPointList.value( 2 );