Skip to content
Permalink
Browse files
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 ecd27aef7f0384b2a24147ab9257a4af59137ba0
@@ -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 );
@@ -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 );
@@ -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 );
@@ -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 );
@@ -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(
@@ -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(
@@ -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 );

0 comments on commit ecd27ae

Please sign in to comment.