Skip to content

Commit

Permalink
fix double
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Jul 16, 2018
1 parent 72a7360 commit 8edfaa7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion python/core/auto_generated/qgscadutils.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The QgsCadUtils class provides routines for CAD editing.

QgsPointLocator::Match edgeMatch;

int softLockCommonAngle;
double softLockCommonAngle;
};

static QgsCadUtils::AlignMapPointOutput alignMapPoint( const QgsPointXY &originalMapPoint, const QgsCadUtils::AlignMapPointContext &ctx );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscadutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class CORE_EXPORT QgsCadUtils
QgsPointLocator::Match edgeMatch;

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

/**
Expand Down
10 changes: 8 additions & 2 deletions src/gui/qgsadvanceddigitizingdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@
QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget( QgsMapCanvas *canvas, QWidget *parent )
: QgsDockWidget( parent )
, mMapCanvas( canvas )
, mCommonAngleConstraint( QgsSettings().value( QStringLiteral( "/Cad/CommonAngle" ), 90 ).toInt() )
, mCurrentMapToolSupportsCad( false )
, mCadEnabled( false )
, mConstructionMode( false )
, mCommonAngleConstraint( QgsSettings().value( QStringLiteral( "/Cad/CommonAngle" ), 90 ).toDouble() )
, mSnappedToVertex( false )
, mSessionActive( false )
, mErrorMessage( nullptr )
{
setupUi( this );

Expand Down Expand Up @@ -113,7 +119,7 @@ QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget( QgsMapCanvas *
commonAngles << QPair<double, QString>( 30, tr( "Snap to 30° angles" ) );
commonAngles << QPair<double, QString>( 45, tr( "Snap to 45° angles" ) );
commonAngles << QPair<double, QString>( 90, tr( "Snap to 90° angles" ) );
for ( QList< QPair<double , QString > >::const_iterator it = commonAngles.constBegin(); it != commonAngles.constEnd(); ++it )
for ( QList< QPair<double, QString > >::const_iterator it = commonAngles.constBegin(); it != commonAngles.constEnd(); ++it )
{
QAction *action = new QAction( it->second, menu );
action->setCheckable( true );
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsadvanceddigitizingdockwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private
//! Constraint on the Y coordinate
const CadConstraint *constraintY() const { return mYConstraint.get(); }
//! Constraint on a common angle
bool commonAngleConstraint() const { return mCommonAngleConstraint; }
bool commonAngleConstraint() const { return !qgsDoubleNear( mCommonAngleConstraint, 0.0 ); }

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

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

// UI
QAction *mEnableAction = nullptr;
QMap< QAction *, int > mCommonAngleActions; // map the common angle actions with their angle values
QMap< QAction *, double > mCommonAngleActions; // map the common angle actions with their angle values

private:
#ifdef SIP_RUN
Expand Down

0 comments on commit 8edfaa7

Please sign in to comment.