Skip to content

Commit

Permalink
Disable Z/M parts when layer is not 3D or Measure
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Sep 12, 2021
1 parent 5dbc3f6 commit 29d95c7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
Expand Up @@ -214,7 +214,7 @@ Clear any cached previous clicks and helper lines
determines if CAD tools are enabled or if map tools behaves "nomally" determines if CAD tools are enabled or if map tools behaves "nomally"
%End %End


void switchZM( ); void switchZM( void );
%Docstring %Docstring
Determines if Z or M will be enabled. Determines if Z or M will be enabled.


Expand Down
20 changes: 1 addition & 19 deletions src/gui/qgsadvanceddigitizingdockwidget.cpp
Expand Up @@ -317,7 +317,7 @@ void QgsAdvancedDigitizingDockWidget::setCadEnabled( bool enabled )
} }




void QgsAdvancedDigitizingDockWidget::switchZM( ) void QgsAdvancedDigitizingDockWidget::switchZM( void )
{ {
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mMapCanvas->currentLayer() ); QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mMapCanvas->currentLayer() );
if ( vlayer ) if ( vlayer )
Expand Down Expand Up @@ -1377,24 +1377,6 @@ void QgsAdvancedDigitizingDockWidget::enable()
mErrorLabel->hide(); mErrorLabel->hide();
mCadWidget->show(); mCadWidget->show();


QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mMapCanvas->currentLayer() );
if ( vlayer )
{

const QgsWkbTypes::Type type = vlayer->wkbType();
mRelativeZButton->setEnabled( QgsWkbTypes::hasZ( type ) );
mZLabel->setEnabled( QgsWkbTypes::hasZ( type ) );
mZLineEdit->setEnabled( QgsWkbTypes::hasZ( type ) );
mLockZButton->setEnabled( QgsWkbTypes::hasZ( type ) );
mRepeatingLockZButton->setEnabled( QgsWkbTypes::hasZ( type ) );

mRelativeMButton->setEnabled( QgsWkbTypes::hasM( type ) );
mMLabel->setEnabled( QgsWkbTypes::hasM( type ) );
mMLineEdit->setEnabled( QgsWkbTypes::hasM( type ) );
mLockMButton->setEnabled( QgsWkbTypes::hasM( type ) );
mRepeatingLockMButton->setEnabled( QgsWkbTypes::hasM( type ) );
}

mCurrentMapToolSupportsCad = true; mCurrentMapToolSupportsCad = true;


if ( mSessionActive && !isVisible() ) if ( mSessionActive && !isVisible() )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsadvanceddigitizingdockwidget.h
Expand Up @@ -254,7 +254,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private
* Determines if Z or M will be enabled. * Determines if Z or M will be enabled.
* \since QgIS 3.20 * \since QgIS 3.20
*/ */
void switchZM( ); void switchZM( void );


//! construction mode is used to draw intermediate points. These points won't be given any further (i.e. to the map tools) //! construction mode is used to draw intermediate points. These points won't be given any further (i.e. to the map tools)
bool constructionMode() const { return mConstructionMode; } bool constructionMode() const { return mConstructionMode; }
Expand Down

0 comments on commit 29d95c7

Please sign in to comment.