Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove unreachable code
At all these points of calling addVertex we are guaranteed to have
a vector layer anyway, so the code will never be reached.
  • Loading branch information
nyalldawson committed Sep 8, 2021
1 parent d43c575 commit ecd27ae
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 42 deletions.
7 changes: 1 addition & 6 deletions src/app/qgsmaptooladdpart.cpp
Expand Up @@ -114,12 +114,7 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( e->button() == Qt::LeftButton )
{
const int error = addVertex( e->mapPoint(), e->mapPointMatch() );
if ( error == 1 )
{
QgsDebugMsg( QStringLiteral( "current layer is not a vector layer" ) );
return;
}
else if ( error == 2 )
if ( error == 2 )
{
//problem with coordinate transformation
emit messageEmitted( tr( "Coordinate transform error. Cannot transform the point to the layers coordinate system" ), Qgis::MessageLevel::Warning );
Expand Down
7 changes: 1 addition & 6 deletions src/app/qgsmaptooladdring.cpp
Expand Up @@ -71,12 +71,7 @@ void QgsMapToolAddRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( e->button() == Qt::LeftButton )
{
const int error = addVertex( e->mapPoint(), e->mapPointMatch() );
if ( error == 1 )
{
//current layer is not a vector layer
return;
}
else if ( error == 2 )
if ( error == 2 )
{
//problem with coordinate transformation
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system." ), Qgis::MessageLevel::Warning );
Expand Down
7 changes: 1 addition & 6 deletions src/app/qgsmaptoolfillring.cpp
Expand Up @@ -73,12 +73,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
// add point to list and to rubber band

const int error = addVertex( e->mapPoint() );
if ( error == 1 )
{
// current layer is not a vector layer
return;
}
else if ( error == 2 )
if ( error == 2 )
{
// problem with coordinate transformation
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), Qgis::MessageLevel::Warning );
Expand Down
7 changes: 1 addition & 6 deletions src/app/qgsmaptoolreshape.cpp
Expand Up @@ -50,12 +50,7 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( e->button() == Qt::LeftButton )
{
const int error = addVertex( e->mapPoint(), e->mapPointMatch() );
if ( error == 1 )
{
//current layer is not a vector layer
return;
}
else if ( error == 2 )
if ( error == 2 )
{
//problem with coordinate transformation
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), Qgis::MessageLevel::Warning );
Expand Down
7 changes: 1 addition & 6 deletions src/app/qgsmaptoolsplitfeatures.cpp
Expand Up @@ -76,12 +76,7 @@ void QgsMapToolSplitFeatures::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}

const int error = addVertex( e->mapPoint(), e->mapPointMatch() );
if ( error == 1 )
{
//current layer is not a vector layer
return;
}
else if ( error == 2 )
if ( error == 2 )
{
//problem with coordinate transformation
QgisApp::instance()->messageBar()->pushMessage(
Expand Down
7 changes: 1 addition & 6 deletions src/app/qgsmaptoolsplitparts.cpp
Expand Up @@ -77,12 +77,7 @@ void QgsMapToolSplitParts::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}

const int error = addVertex( e->mapPoint() );
if ( error == 1 )
{
//current layer is not a vector layer
return;
}
else if ( error == 2 )
if ( error == 2 )
{
//problem with coordinate transformation
QgisApp::instance()->messageBar()->pushMessage(
Expand Down
7 changes: 1 addition & 6 deletions src/gui/qgsmaptooldigitizefeature.cpp
Expand Up @@ -245,12 +245,7 @@ void QgsMapToolDigitizeFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( e->button() == Qt::LeftButton )
{
const int error = addVertex( e->mapPoint(), e->mapPointMatch() );
if ( error == 1 )
{
//current layer is not a vector layer
return;
}
else if ( error == 2 )
if ( error == 2 )
{
//problem with coordinate transformation
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), Qgis::MessageLevel::Warning );
Expand Down

0 comments on commit ecd27ae

Please sign in to comment.