Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new Measure Radius tool to measure map tools #60015

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@
<file>themes/default/stacked-diagram.svg</file>
<file>themes/default/mIconStac.svg</file>
<file>themes/default/mIconQt.svg</file>
<file>themes/default/mActionMeasureRadius.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Expand Down
90 changes: 90 additions & 0 deletions images/themes/default/mActionMeasureRadius.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/app/maptools/qgsappmaptools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ QgsAppMapTools::QgsAppMapTools( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockW
mTools.insert( Tool::Pan, new QgsMapToolPan( canvas ) );
mTools.insert( Tool::Identify, new QgsMapToolIdentifyAction( canvas ) );
mTools.insert( Tool::FeatureAction, new QgsMapToolFeatureAction( canvas ) );
mTools.insert( Tool::MeasureDistance, new QgsMeasureTool( canvas, false /* area */ ) );
mTools.insert( Tool::MeasureArea, new QgsMeasureTool( canvas, true /* area */ ) );
mTools.insert( Tool::MeasureDistance, new QgsMeasureTool( canvas, false, /* area */ false /* radius */ ) );
mTools.insert( Tool::MeasureArea, new QgsMeasureTool( canvas, true, /* area */ false /* radius */ ) );
mTools.insert( Tool::MeasureAngle, new QgsMapToolMeasureAngle( canvas ) );
mTools.insert( Tool::MeasureBearing, new QgsMapToolMeasureBearing( canvas ) );
mTools.insert( Tool::FormAnnotation, new QgsMapToolFormAnnotation( canvas ) );
Expand Down Expand Up @@ -103,6 +103,7 @@ QgsAppMapTools::QgsAppMapTools( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockW
mTools.insert( Tool::ChangeLabelProperties, new QgsMapToolChangeLabelProperties( canvas, cadDock ) );
mTools.insert( Tool::EditMeshFrame, new QgsMapToolEditMeshFrame( canvas ) );
mTools.insert( Tool::AnnotationEdit, new QgsMapToolModifyAnnotation( canvas, cadDock ) );
mTools.insert( Tool::MeasureRadius, new QgsMeasureTool( canvas, false, /* area */ true /* radius */ ) );
}

QgsAppMapTools::~QgsAppMapTools()
Expand Down
3 changes: 2 additions & 1 deletion src/app/maptools/qgsappmaptools.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class QgsAppMapTools
ReverseLine,
TrimExtendFeature,
EditMeshFrame,
AnnotationEdit
AnnotationEdit,
MeasureRadius
};

QgsAppMapTools( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDock );
Expand Down
11 changes: 11 additions & 0 deletions src/app/options/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,13 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
pbnMeasureColor->setContext( QStringLiteral( "gui" ) );
pbnMeasureColor->setDefaultColor( QColor( 222, 155, 67 ) );

// set the default color for the measure radius tool circular rubber band
QColor circularRbColor = QgsSettingsRegistryCore::settingsMeasureRadiusCircularRubberbandColor->value();
pbnMeasureRadiusColor->setColor( circularRbColor );
pbnMeasureRadiusColor->setColorDialogTitle( tr( "Set Measure Radius Tool Color" ) );
pbnMeasureRadiusColor->setContext( QStringLiteral( "gui" ) );
pbnMeasureRadiusColor->setDefaultColor( QColor( 25, 25, 25, 255 ) );

int projOpen = mSettings->value( QStringLiteral( "/qgis/projOpenAtLaunch" ), 0 ).toInt();
mProjectOnLaunchCmbBx->setCurrentIndex( projOpen );
mProjectOnLaunchLineEdit->setText( mSettings->value( QStringLiteral( "/qgis/projOpenAtLaunchPath" ) ).toString() );
Expand Down Expand Up @@ -1736,6 +1743,10 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "/qgis/default_measure_color_green" ), myColor.green() );
mSettings->setValue( QStringLiteral( "/qgis/default_measure_color_blue" ), myColor.blue() );

//set the default color for the measure radius tool circular rubber band
myColor = pbnMeasureRadiusColor->color();
QgsSettingsRegistryCore::settingsMeasureRadiusCircularRubberbandColor->setValue( myColor );

mSettings->setValue( QStringLiteral( "/qgis/zoom_factor" ), zoomFactorValue() );
mSettings->setValue( QStringLiteral( "/qgis/reverse_wheel_zoom" ), reverseWheelZoom->isChecked() );

Expand Down
9 changes: 8 additions & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2980,6 +2980,7 @@ void QgisApp::createActions()
connect( mActionMeasureArea, &QAction::triggered, this, &QgisApp::measureArea );
connect( mActionMeasureAngle, &QAction::triggered, this, &QgisApp::measureAngle );
connect( mActionMeasureBearing, &QAction::triggered, this, [=] { setMapTool( mMapTools->mapTool( QgsAppMapTools::MeasureBearing ) ); } );
connect( mActionMeasureRadius, &QAction::triggered, this, [=] { setMapTool( mMapTools->mapTool( QgsAppMapTools::MeasureRadius ) ); } );
connect( mActionZoomFullExtent, &QAction::triggered, this, &QgisApp::zoomFull );
connect( mActionZoomToLayer, &QAction::triggered, this, &QgisApp::zoomToLayerExtent );
connect( mActionZoomToLayers, &QAction::triggered, this, &QgisApp::zoomToLayerExtent );
Expand Down Expand Up @@ -3294,6 +3295,7 @@ void QgisApp::createActionGroups()
mMapToolGroup->addAction( mActionMeasureArea );
mMapToolGroup->addAction( mActionMeasureAngle );
mMapToolGroup->addAction( mActionMeasureBearing );
mMapToolGroup->addAction( mActionMeasureRadius );
mMapToolGroup->addAction( mActionAddFeature );
mMapToolGroup->addAction( mActionMoveFeature );
mMapToolGroup->addAction( mActionMoveFeatureCopy );
Expand Down Expand Up @@ -3699,6 +3701,7 @@ void QgisApp::createToolBars()
bt->addAction( mActionMeasureArea );
bt->addAction( mActionMeasureBearing );
bt->addAction( mActionMeasureAngle );
bt->addAction( mActionMeasureRadius );

QAction *defMeasureAction = mActionMeasure;
switch ( settings.value( QStringLiteral( "UI/measureTool" ), 0 ).toInt() )
Expand All @@ -3715,6 +3718,9 @@ void QgisApp::createToolBars()
case 3:
defMeasureAction = mActionMeasureAngle;
break;
case 4:
defMeasureAction = mActionMeasureRadius;
break;
}
bt->setDefaultAction( defMeasureAction );
QAction *measureAction = mAttributesToolBar->insertWidget( mActionMapTips, bt );
Expand All @@ -3726,7 +3732,6 @@ void QgisApp::createToolBars()
tbAllEdits->setPopupMode( QToolButton::InstantPopup );

// new layer tool button

bt = new QToolButton();
bt->setPopupMode( QToolButton::MenuButtonPopup );
bt->addAction( mActionNewVectorLayer );
Expand Down Expand Up @@ -4502,6 +4507,7 @@ void QgisApp::setupCanvasTools()
mMapTools->mapTool( QgsAppMapTools::MeasureArea )->setAction( mActionMeasureArea );
mMapTools->mapTool( QgsAppMapTools::MeasureAngle )->setAction( mActionMeasureAngle );
mMapTools->mapTool( QgsAppMapTools::MeasureBearing )->setAction( mActionMeasureBearing );
mMapTools->mapTool( QgsAppMapTools::MeasureRadius )->setAction( mActionMeasureRadius );
mMapTools->mapTool( QgsAppMapTools::FormAnnotation )->setAction( mActionFormAnnotation );
mMapTools->mapTool( QgsAppMapTools::HtmlAnnotation )->setAction( mActionHtmlAnnotation );
mMapTools->mapTool( QgsAppMapTools::AddFeature )->setAction( mActionAddFeature );
Expand Down Expand Up @@ -12419,6 +12425,7 @@ void QgisApp::showOptionsDialog( QWidget *parent, const QString &currentPage, in
mMapTools->mapTool<QgsMeasureTool>( QgsAppMapTools::MeasureArea )->updateSettings();
mMapTools->mapTool<QgsMapToolMeasureAngle>( QgsAppMapTools::MeasureAngle )->updateSettings();
mMapTools->mapTool<QgsMapToolMeasureBearing>( QgsAppMapTools::MeasureBearing )->updateSettings();
mMapTools->mapTool< QgsMeasureTool >( QgsAppMapTools::MeasureRadius )->updateSettings();

#ifdef HAVE_3D
for ( Qgs3DMapCanvasWidget *canvas3D : std::as_const( mOpen3DMapViews ) )
Expand Down
Loading
Loading