diff --git a/images/images.qrc b/images/images.qrc
index f6ace0b2ca6..5c19d19807f 100644
--- a/images/images.qrc
+++ b/images/images.qrc
@@ -581,6 +581,7 @@
themes/default/multieditChangedValues.svg
themes/default/multieditMixedValues.svg
themes/default/multieditSameValues.svg
+ themes/default/locked_repeating.svg
qgis_tips/symbol_levels.png
diff --git a/images/themes/default/locked_repeating.svg b/images/themes/default/locked_repeating.svg
new file mode 100644
index 00000000000..4b57d717f7c
--- /dev/null
+++ b/images/themes/default/locked_repeating.svg
@@ -0,0 +1,434 @@
+
+
+
+
\ No newline at end of file
diff --git a/python/gui/qgsadvanceddigitizingdockwidget.sip b/python/gui/qgsadvanceddigitizingdockwidget.sip
index ed993eb90e9..93f8ed0f0f9 100644
--- a/python/gui/qgsadvanceddigitizingdockwidget.sip
+++ b/python/gui/qgsadvanceddigitizingdockwidget.sip
@@ -67,7 +67,7 @@ class QgsAdvancedDigitizingDockWidget : QDockWidget
HardLock
};
- CadConstraint( QLineEdit* lineEdit, QToolButton* lockerButton, QToolButton* relativeButton = 0 );
+ CadConstraint( QLineEdit* lineEdit, QToolButton* lockerButton, QToolButton* relativeButton = nullptr, QToolButton* repeatingLockButton = nullptr );
/**
* The current lock mode of this constraint
@@ -78,6 +78,14 @@ class QgsAdvancedDigitizingDockWidget : QDockWidget
* Is any kind of lock mode enabled
*/
bool isLocked() const;
+
+ /** Returns true if a repeating lock is set for the constraint. Repeating locks are not
+ * automatically cleared after a new point is added.
+ * @note added in QGIS 2.16
+ * @see setRepeatingLock()
+ */
+ bool isRepeatingLock() const;
+
/**
* Is the constraint in relative mode
*/
@@ -97,6 +105,14 @@ class QgsAdvancedDigitizingDockWidget : QDockWidget
*/
void setLockMode( LockMode mode );
+ /** Sets whether a repeating lock is set for the constraint. Repeating locks are not
+ * automatically cleared after a new point is added.
+ * @param repeating set to true to set the lock to repeat automatically
+ * @note added in QGIS 2.16
+ * @see isRepeatingLock()
+ */
+ void setRepeatingLock( bool repeating );
+
/**
* Set if the constraint should be treated relative
*/
@@ -284,7 +300,8 @@ class QgsAdvancedDigitizingDockWidget : QDockWidget
void lockConstraint( bool activate = true );
//! unlock all constraints
- void releaseLocks();
+ //! @param releaseRepeatingLocks set to false to preserve the lock for any constraints set to repeating lock mode
+ void releaseLocks( bool releaseRepeatingLocks = true );
//! set the relative properties of constraints
void setConstraintRelative( bool activate );
diff --git a/src/gui/qgsadvanceddigitizingdockwidget.cpp b/src/gui/qgsadvanceddigitizingdockwidget.cpp
index 7fa5e9c296d..7297c41d4f4 100644
--- a/src/gui/qgsadvanceddigitizingdockwidget.cpp
+++ b/src/gui/qgsadvanceddigitizingdockwidget.cpp
@@ -103,10 +103,10 @@ QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget( QgsMapCanvas*
mCadPaintItem = new QgsAdvancedDigitizingCanvasItem( canvas, this ) ;
- mAngleConstraint = new CadConstraint( mAngleLineEdit, mLockAngleButton, mRelativeAngleButton );
- mDistanceConstraint = new CadConstraint( mDistanceLineEdit, mLockDistanceButton ) ;
- mXConstraint = new CadConstraint( mXLineEdit, mLockXButton, mRelativeXButton );
- mYConstraint = new CadConstraint( mYLineEdit, mLockYButton, mRelativeYButton ) ;
+ mAngleConstraint = new CadConstraint( mAngleLineEdit, mLockAngleButton, mRelativeAngleButton, mRepeatingLockAngleButton );
+ mDistanceConstraint = new CadConstraint( mDistanceLineEdit, mLockDistanceButton, nullptr, mRepeatingLockDistanceButton ) ;
+ mXConstraint = new CadConstraint( mXLineEdit, mLockXButton, mRelativeXButton, mRepeatingLockXButton );
+ mYConstraint = new CadConstraint( mYLineEdit, mLockYButton, mRelativeYButton, mRepeatingLockYButton ) ;
mAdditionalConstraint = NoConstraint ;
mMapCanvas->installEventFilter( this );
@@ -135,6 +135,10 @@ QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget( QgsMapCanvas*
connect( mRelativeAngleButton, SIGNAL( clicked( bool ) ), this, SLOT( setConstraintRelative( bool ) ) );
connect( mRelativeXButton, SIGNAL( clicked( bool ) ), this, SLOT( setConstraintRelative( bool ) ) );
connect( mRelativeYButton, SIGNAL( clicked( bool ) ), this, SLOT( setConstraintRelative( bool ) ) );
+ connect( mRepeatingLockDistanceButton, SIGNAL( clicked( bool ) ), this, SLOT( setConstraintRepeatingLock( bool ) ) );
+ connect( mRepeatingLockAngleButton, SIGNAL( clicked( bool ) ), this, SLOT( setConstraintRepeatingLock( bool ) ) );
+ connect( mRepeatingLockXButton, SIGNAL( clicked( bool ) ), this, SLOT( setConstraintRepeatingLock( bool ) ) );
+ connect( mRepeatingLockYButton, SIGNAL( clicked( bool ) ), this, SLOT( setConstraintRepeatingLock( bool ) ) );
connect( mAngleLineEdit, SIGNAL( returnPressed() ), this, SLOT( lockConstraint() ) );
connect( mDistanceLineEdit, SIGNAL( returnPressed() ), this, SLOT( lockConstraint() ) );
connect( mXLineEdit, SIGNAL( returnPressed() ), this, SLOT( lockConstraint() ) );
@@ -262,6 +266,26 @@ void QgsAdvancedDigitizingDockWidget::setConstraintRelative( bool activate )
}
}
+void QgsAdvancedDigitizingDockWidget::setConstraintRepeatingLock( bool activate )
+{
+ if ( sender() == mRepeatingLockDistanceButton )
+ {
+ mDistanceConstraint->setRepeatingLock( activate );
+ }
+ else if ( sender() == mRepeatingLockAngleButton )
+ {
+ mAngleConstraint->setRepeatingLock( activate );
+ }
+ else if ( sender() == mRepeatingLockXButton )
+ {
+ mXConstraint->setRepeatingLock( activate );
+ }
+ else if ( sender() == mRepeatingLockYButton )
+ {
+ mYConstraint->setRepeatingLock( activate );
+ }
+}
+
void QgsAdvancedDigitizingDockWidget::setConstructionMode( bool enabled )
{
mConstructionMode = enabled;
@@ -291,16 +315,20 @@ void QgsAdvancedDigitizingDockWidget::settingsButtonTriggered( QAction* action )
}
}
-void QgsAdvancedDigitizingDockWidget::releaseLocks()
+void QgsAdvancedDigitizingDockWidget::releaseLocks( bool releaseRepeatingLocks )
{
// release all locks except construction mode
lockAdditionalConstraint( NoConstraint );
- mAngleConstraint->setLockMode( CadConstraint::NoLock );
- mDistanceConstraint->setLockMode( CadConstraint::NoLock );
- mXConstraint->setLockMode( CadConstraint::NoLock );
- mYConstraint->setLockMode( CadConstraint::NoLock );
+ if ( releaseRepeatingLocks || !mAngleConstraint->isRepeatingLock() )
+ mAngleConstraint->setLockMode( CadConstraint::NoLock );
+ if ( releaseRepeatingLocks || !mDistanceConstraint->isRepeatingLock() )
+ mDistanceConstraint->setLockMode( CadConstraint::NoLock );
+ if ( releaseRepeatingLocks || !mXConstraint->isRepeatingLock() )
+ mXConstraint->setLockMode( CadConstraint::NoLock );
+ if ( releaseRepeatingLocks || !mYConstraint->isRepeatingLock() )
+ mYConstraint->setLockMode( CadConstraint::NoLock );
}
#if 0
@@ -899,7 +927,7 @@ bool QgsAdvancedDigitizingDockWidget::canvasReleaseEvent( QgsMapMouseEvent* e, b
addPoint( e->mapPoint() );
- releaseLocks();
+ releaseLocks( false );
if ( e->button() == Qt::LeftButton )
{
@@ -947,7 +975,7 @@ bool QgsAdvancedDigitizingDockWidget::canvasKeyPressEventFilter( QKeyEvent* e )
case Qt::Key_Delete:
{
removePreviousPoint();
- releaseLocks();
+ releaseLocks( false );
break;
}
case Qt::Key_Escape:
@@ -984,7 +1012,7 @@ void QgsAdvancedDigitizingDockWidget::keyPressEvent( QKeyEvent *e )
case Qt::Key_Delete:
{
removePreviousPoint();
- releaseLocks();
+ releaseLocks( false );
break;
}
case Qt::Key_Escape:
@@ -1228,6 +1256,18 @@ void QgsAdvancedDigitizingDockWidget::CadConstraint::setLockMode( LockMode mode
{
mLockMode = mode;
mLockerButton->setChecked( mode == HardLock );
+ if ( mRepeatingLockButton )
+ {
+ if ( mode == HardLock )
+ {
+ mRepeatingLockButton->setEnabled( true );
+ }
+ else
+ {
+ mRepeatingLockButton->setChecked( false );
+ mRepeatingLockButton->setEnabled( false );
+ }
+ }
if ( mode == NoLock )
{
@@ -1235,6 +1275,13 @@ void QgsAdvancedDigitizingDockWidget::CadConstraint::setLockMode( LockMode mode
}
}
+void QgsAdvancedDigitizingDockWidget::CadConstraint::setRepeatingLock( bool repeating )
+{
+ mRepeatingLock = repeating;
+ if ( mRepeatingLockButton )
+ mRepeatingLockButton->setChecked( repeating );
+}
+
void QgsAdvancedDigitizingDockWidget::CadConstraint::setRelative( bool relative )
{
mRelative = relative;
diff --git a/src/gui/qgsadvanceddigitizingdockwidget.h b/src/gui/qgsadvanceddigitizingdockwidget.h
index d91142c51b8..e0362f343e9 100644
--- a/src/gui/qgsadvanceddigitizingdockwidget.h
+++ b/src/gui/qgsadvanceddigitizingdockwidget.h
@@ -89,11 +89,13 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U
HardLock
};
- CadConstraint( QLineEdit* lineEdit, QToolButton* lockerButton, QToolButton* relativeButton = nullptr )
+ CadConstraint( QLineEdit* lineEdit, QToolButton* lockerButton, QToolButton* relativeButton = nullptr, QToolButton* repeatingLockButton = nullptr )
: mLineEdit( lineEdit )
, mLockerButton( lockerButton )
, mRelativeButton( relativeButton )
+ , mRepeatingLockButton( repeatingLockButton )
, mLockMode( NoLock )
+ , mRepeatingLock( false )
, mRelative( false )
, mValue( 0.0 )
{}
@@ -107,6 +109,14 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U
* Is any kind of lock mode enabled
*/
bool isLocked() const { return mLockMode != NoLock; }
+
+ /** Returns true if a repeating lock is set for the constraint. Repeating locks are not
+ * automatically cleared after a new point is added.
+ * @note added in QGIS 2.16
+ * @see setRepeatingLock()
+ */
+ bool isRepeatingLock() const { return mRepeatingLock; }
+
/**
* Is the constraint in relative mode
*/
@@ -126,6 +136,14 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U
*/
void setLockMode( LockMode mode );
+ /** Sets whether a repeating lock is set for the constraint. Repeating locks are not
+ * automatically cleared after a new point is added.
+ * @param repeating set to true to set the lock to repeat automatically
+ * @note added in QGIS 2.16
+ * @see isRepeatingLock()
+ */
+ void setRepeatingLock( bool repeating );
+
/**
* Set if the constraint should be treated relative
*/
@@ -152,7 +170,9 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U
QLineEdit* mLineEdit;
QToolButton* mLockerButton;
QToolButton* mRelativeButton;
+ QToolButton* mRepeatingLockButton;
LockMode mLockMode;
+ bool mRepeatingLock;
bool mRelative;
double mValue;
};
@@ -329,11 +349,15 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U
void constraintFocusOut();
//! unlock all constraints
- void releaseLocks();
+ //! @param releaseRepeatingLocks set to false to preserve the lock for any constraints set to repeating lock mode
+ void releaseLocks( bool releaseRepeatingLocks = true );
//! set the relative properties of constraints
void setConstraintRelative( bool activate );
+ //! Set the repeating lock property of constraints
+ void setConstraintRepeatingLock( bool activate );
+
//! activate/deactivate tools. It is called when tools are activated manually (from the GUI)
//! it will call setCadEnabled to properly update the UI.
void activateCad( bool enabled );
diff --git a/src/ui/qgsadvanceddigitizingdockwidgetbase.ui b/src/ui/qgsadvanceddigitizingdockwidgetbase.ui
index 223e83c7747..ab3fb4df381 100644
--- a/src/ui/qgsadvanceddigitizingdockwidgetbase.ui
+++ b/src/ui/qgsadvanceddigitizingdockwidgetbase.ui
@@ -45,7 +45,16 @@
-
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -78,7 +87,16 @@
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
@@ -188,30 +206,39 @@
-
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
3
-
-
-
-
- X coordinate
+
-
+
+
+ y
- -
-
+
-
+
- Distance
+ Y coordinate
- -
-
+
-
+
- Lock distance
+ Lock y coordinate
...
@@ -225,6 +252,40 @@
+ -
+
+
+ Lock x coordinate
+
+
+ ...
+
+
+
+ :/images/themes/default/cadtools/lock.png:/images/themes/default/cadtools/lock.png
+
+
+ true
+
+
+
+ -
+
+
+ Toggles relative y to previous node
+
+
+ ...
+
+
+
+ :/images/themes/default/cadtools/delta.png:/images/themes/default/cadtools/delta.png
+
+
+ true
+
+
+
-
@@ -242,34 +303,24 @@
- -
-
+
-
+
- Lock y coordinate
-
-
- ...
-
-
-
- :/images/themes/default/cadtools/lock.png:/images/themes/default/cadtools/lock.png
-
-
- true
+ X coordinate
- -
-
+
-
+
- d
+ a
- -
-
+
-
+
- Toggles relative y to previous node
+ Toggles relative angle to previous segment
...
@@ -281,12 +332,8 @@
true
-
-
- -
-
-
- a
+
+ true
@@ -304,10 +351,34 @@
- -
-
+
-
+
+
+ d
+
+
+
+ -
+
- Y coordinate
+ Lock distance
+
+
+ ...
+
+
+
+ :/images/themes/default/cadtools/lock.png:/images/themes/default/cadtools/lock.png
+
+
+ true
+
+
+
+ -
+
+
+ Distance
@@ -328,46 +399,70 @@
- -
-
-
- y
-
-
-
- -
-
+
-
+
- Lock x coordinate
+ Continuously lock distance
...
- :/images/themes/default/cadtools/lock.png:/images/themes/default/cadtools/lock.png
+ :/images/themes/default/locked_repeating.svg:/images/themes/default/locked_repeating.svg
true
- -
-
+
-
+
- Toggles relative angle to previous segment
+ Continuously lock angle
...
- :/images/themes/default/cadtools/delta.png:/images/themes/default/cadtools/delta.png
+ :/images/themes/default/locked_repeating.svg:/images/themes/default/locked_repeating.svg
true
-
+
+
+ -
+
+
+ Continuously lock x coordinate
+
+
+ ...
+
+
+
+ :/images/themes/default/locked_repeating.svg:/images/themes/default/locked_repeating.svg
+
+
+ true
+
+
+
+ -
+
+
+ Continuously lock y coordinate
+
+
+ ...
+
+
+
+ :/images/themes/default/locked_repeating.svg:/images/themes/default/locked_repeating.svg
+
+
true
@@ -404,19 +499,23 @@
mSettingsButton
mDistanceLineEdit
mLockDistanceButton
+ mRepeatingLockDistanceButton
mRelativeAngleButton
mAngleLineEdit
mLockAngleButton
+ mRepeatingLockAngleButton
mRelativeXButton
mXLineEdit
mLockXButton
+ mRepeatingLockXButton
mRelativeYButton
mYLineEdit
mLockYButton
+ mRepeatingLockYButton
-
+