Skip to content

Commit

Permalink
add more common angles
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Jul 16, 2018
1 parent 97d28d4 commit 72a7360
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/gui/qgsadvanceddigitizingdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,18 @@ QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget( QgsMapCanvas *
QMenu *menu = new QMenu( this );
// common angles
QActionGroup *angleButtonGroup = new QActionGroup( menu ); // actions are exclusive for common angles
mCommonAngleActions = QMap<QAction *, int>();
QList< QPair< int, QString > > commonAngles;
commonAngles << QPair<int, QString>( 0, tr( "Do Not Snap to Common Angles" ) );
commonAngles << QPair<int, QString>( 30, tr( "Snap to 30° Angles" ) );
commonAngles << QPair<int, QString>( 45, tr( "Snap to 45° Angles" ) );
commonAngles << QPair<int, QString>( 90, tr( "Snap to 90° Angles" ) );
for ( QList< QPair< int, QString > >::const_iterator it = commonAngles.constBegin(); it != commonAngles.constEnd(); ++it )
mCommonAngleActions = QMap<QAction *, double>();
QList< QPair< double, QString > > commonAngles;
commonAngles << QPair<double, QString>( 0, tr( "Do not snap to common angles" ) );
commonAngles << QPair<double, QString>( 5, tr( "Snap to 5° angles" ) );
commonAngles << QPair<double, QString>( 10, tr( "Snap to 10° angles" ) );
commonAngles << QPair<double, QString>( 15, tr( "Snap to 15° angles" ) );
commonAngles << QPair<double, QString>( 18, tr( "Snap to 18° angles" ) );
commonAngles << QPair<double, QString>( 22.5, tr( "Snap to 22.5° angles" ) );
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 )
{
QAction *action = new QAction( it->second, menu );
action->setCheckable( true );
Expand Down Expand Up @@ -242,7 +247,7 @@ void QgsAdvancedDigitizingDockWidget::setConstructionMode( bool enabled )
void QgsAdvancedDigitizingDockWidget::settingsButtonTriggered( QAction *action )
{
// common angles
QMap<QAction *, int>::const_iterator ica = mCommonAngleActions.constFind( action );
QMap<QAction *, double>::const_iterator ica = mCommonAngleActions.constFind( action );
if ( ica != mCommonAngleActions.constEnd() )
{
ica.key()->setChecked( true );
Expand Down

0 comments on commit 72a7360

Please sign in to comment.