Skip to content

Commit 8edfaa7

Browse files
lbartolettinyalldawson
authored andcommittedJul 16, 2018
fix double
1 parent 72a7360 commit 8edfaa7

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed
 

‎python/core/auto_generated/qgscadutils.sip.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The QgsCadUtils class provides routines for CAD editing.
5555

5656
QgsPointLocator::Match edgeMatch;
5757

58-
int softLockCommonAngle;
58+
double softLockCommonAngle;
5959
};
6060

6161
static QgsCadUtils::AlignMapPointOutput alignMapPoint( const QgsPointXY &originalMapPoint, const QgsCadUtils::AlignMapPointContext &ctx );

‎src/core/qgscadutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class CORE_EXPORT QgsCadUtils
9696
QgsPointLocator::Match edgeMatch;
9797

9898
//! Angle (in degrees) to which we have soft-locked ourselves (if not set it is -1)
99-
int softLockCommonAngle;
99+
double softLockCommonAngle;
100100
};
101101

102102
/**

‎src/gui/qgsadvanceddigitizingdockwidget.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@
3838
QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget( QgsMapCanvas *canvas, QWidget *parent )
3939
: QgsDockWidget( parent )
4040
, mMapCanvas( canvas )
41-
, mCommonAngleConstraint( QgsSettings().value( QStringLiteral( "/Cad/CommonAngle" ), 90 ).toInt() )
41+
, mCurrentMapToolSupportsCad( false )
42+
, mCadEnabled( false )
43+
, mConstructionMode( false )
44+
, mCommonAngleConstraint( QgsSettings().value( QStringLiteral( "/Cad/CommonAngle" ), 90 ).toDouble() )
45+
, mSnappedToVertex( false )
46+
, mSessionActive( false )
47+
, mErrorMessage( nullptr )
4248
{
4349
setupUi( this );
4450

@@ -113,7 +119,7 @@ QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget( QgsMapCanvas *
113119
commonAngles << QPair<double, QString>( 30, tr( "Snap to 30° angles" ) );
114120
commonAngles << QPair<double, QString>( 45, tr( "Snap to 45° angles" ) );
115121
commonAngles << QPair<double, QString>( 90, tr( "Snap to 90° angles" ) );
116-
for ( QList< QPair<double , QString > >::const_iterator it = commonAngles.constBegin(); it != commonAngles.constEnd(); ++it )
122+
for ( QList< QPair<double, QString > >::const_iterator it = commonAngles.constBegin(); it != commonAngles.constEnd(); ++it )
117123
{
118124
QAction *action = new QAction( it->second, menu );
119125
action->setCheckable( true );

‎src/gui/qgsadvanceddigitizingdockwidget.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private
252252
//! Constraint on the Y coordinate
253253
const CadConstraint *constraintY() const { return mYConstraint.get(); }
254254
//! Constraint on a common angle
255-
bool commonAngleConstraint() const { return mCommonAngleConstraint; }
255+
bool commonAngleConstraint() const { return !qgsDoubleNear( mCommonAngleConstraint, 0.0 ); }
256256

257257
/**
258258
* Removes all points from the CAD point list
@@ -467,7 +467,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private
467467
std::unique_ptr< CadConstraint > mXConstraint;
468468
std::unique_ptr< CadConstraint > mYConstraint;
469469
AdditionalConstraint mAdditionalConstraint;
470-
int mCommonAngleConstraint = 90; // if 0: do not snap to common angles
470+
double mCommonAngleConstraint; // if 0: do not snap to common angles
471471

472472
// point list and current snap point / segment
473473
QList<QgsPointXY> mCadPointList;
@@ -481,7 +481,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private
481481

482482
// UI
483483
QAction *mEnableAction = nullptr;
484-
QMap< QAction *, int > mCommonAngleActions; // map the common angle actions with their angle values
484+
QMap< QAction *, double > mCommonAngleActions; // map the common angle actions with their angle values
485485

486486
private:
487487
#ifdef SIP_RUN

0 commit comments

Comments
 (0)
Please sign in to comment.