Skip to content

Commit

Permalink
Better function naming
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 7, 2022
1 parent 39817d2 commit b6b9ab8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/app/gps/qgsappgpsdigitizing.cpp
Expand Up @@ -124,7 +124,7 @@ void QgsAppGpsDigitizing::addVertex()
emit trackIsEmptyChanged( false );
}

void QgsAppGpsDigitizing::resetFeature()
void QgsAppGpsDigitizing::resetTrack()
{
mBlockGpsStateChanged++;
createRubberBand(); //deletes existing rubberband
Expand All @@ -137,7 +137,7 @@ void QgsAppGpsDigitizing::resetFeature()
emit trackIsEmptyChanged( true );
}

void QgsAppGpsDigitizing::addFeature()
void QgsAppGpsDigitizing::createFeature()
{
QgsVectorLayer *vlayer = QgsProject::instance()->gpsSettings()->destinationLayer();
if ( !vlayer )
Expand Down
4 changes: 2 additions & 2 deletions src/app/gps/qgsappgpsdigitizing.h
Expand Up @@ -52,8 +52,8 @@ class APP_EXPORT QgsAppGpsDigitizing: public QObject

public slots:
void addVertex();
void resetFeature();
void addFeature();
void resetTrack();
void createFeature();

void setTimeStampDestination( const QString &fieldName );

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -1403,9 +1403,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipBadLayers
addToolBar( mGpsToolBar );

mGpsDigitizing = new QgsAppGpsDigitizing( mGpsConnection, mMapCanvas, this );
connect( mGpsToolBar, &QgsGpsToolBar::addFeatureClicked, mGpsDigitizing, &QgsAppGpsDigitizing::addFeature );
connect( mGpsToolBar, &QgsGpsToolBar::addFeatureClicked, mGpsDigitizing, &QgsAppGpsDigitizing::createFeature );
connect( mGpsToolBar, &QgsGpsToolBar::addVertexClicked, mGpsDigitizing, &QgsAppGpsDigitizing::addVertex );
connect( mGpsToolBar, &QgsGpsToolBar::resetFeatureClicked, mGpsDigitizing, &QgsAppGpsDigitizing::resetFeature );
connect( mGpsToolBar, &QgsGpsToolBar::resetFeatureClicked, mGpsDigitizing, &QgsAppGpsDigitizing::resetTrack );

mGpsCanvasBridge = new QgsGpsCanvasBridge( mGpsConnection, mMapCanvas );
mGpsCanvasBridge->setLocationMarkerVisible( mGpsSettingsMenu->locationMarkerVisible() );
Expand Down
16 changes: 8 additions & 8 deletions tests/src/app/testqgsgpsintegration.cpp
Expand Up @@ -113,7 +113,7 @@ QDateTime TestQgsGpsIntegration::_testWrite( QgsVectorLayer *vlayer, QgsAppGpsDi
vlayer->startEditing();
gpsDigitizing.setTimeStampDestination( fieldName );
gpsDigitizing.mTimeStampSpec = timeSpec;
gpsDigitizing.addFeature();
gpsDigitizing.createFeature();
const auto fids { vlayer->allFeatureIds() };
const auto fid { std::min_element( fids.begin(), fids.end() ) };
const QgsFeature f { vlayer->getFeature( *fid ) };
Expand Down Expand Up @@ -345,15 +345,15 @@ void TestQgsGpsIntegration::testMultiPartLayers()
multiLineString->startEditing();

// not possible, no points
gpsDigitizing.addFeature();
gpsDigitizing.createFeature();
QCOMPARE( multiLineString->featureCount(), 0L );
// need at least 2 points
gpsDigitizing.addVertex();
gpsDigitizing.addFeature();
gpsDigitizing.createFeature();
QCOMPARE( multiLineString->featureCount(), 0L );

gpsDigitizing.addVertex();
gpsDigitizing.addFeature();
gpsDigitizing.createFeature();
QCOMPARE( multiLineString->featureCount(), 1L );
QgsFeature f;
QVERIFY( multiLineString->getFeatures().nextFeature( f ) );
Expand All @@ -369,19 +369,19 @@ void TestQgsGpsIntegration::testMultiPartLayers()
multiPolygon->startEditing();

// not possible, no points
gpsDigitizing.addFeature();
gpsDigitizing.createFeature();
QCOMPARE( multiPolygon->featureCount(), 0L );

// need at least 3 points
gpsDigitizing.addVertex();
gpsDigitizing.addFeature();
gpsDigitizing.createFeature();
QCOMPARE( multiPolygon->featureCount(), 0L );
gpsDigitizing.addVertex();
gpsDigitizing.addFeature();
gpsDigitizing.createFeature();
QCOMPARE( multiPolygon->featureCount(), 0L );

gpsDigitizing.addVertex();
gpsDigitizing.addFeature();
gpsDigitizing.createFeature();
QCOMPARE( multiPolygon->featureCount(), 1L );
QVERIFY( multiPolygon->getFeatures().nextFeature( f ) );
QCOMPARE( f.geometry().wkbType(), QgsWkbTypes::MultiPolygon );
Expand Down

0 comments on commit b6b9ab8

Please sign in to comment.