Skip to content
Permalink
Browse files

use a switch

  • Loading branch information
lbartoletti committed Nov 15, 2018
1 parent d40f884 commit 2c12146086efa634d97b9590476d0b2906159c59
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/app/qgsmaptoolrectangle3points.cpp
@@ -78,11 +78,15 @@ void QgsMapToolRectangle3Points::cadCanvasMoveEvent( QgsMapMouseEvent *e )
break;
case 2:
{
if ( mCreateMode == DistanceMode )
setDistance2( mPoints.at( 1 ).distance( point ) );
else if ( mCreateMode == ProjectedMode )
setDistance2( QgsGeometryUtils::perpendicularSegment( point, mPoints.at( 0 ), mPoints.at( 1 ) ).length() );

switch ( mCreateMode )
{
case DistanceMode:
setDistance2( mPoints.at( 1 ).distance( point ) );
break;
case ProjectedMode:
setDistance2( QgsGeometryUtils::perpendicularSegment( point, mPoints.at( 0 ), mPoints.at( 1 ) ).length() );
break;
}
int side = QgsGeometryUtils::leftOfLine( point.x(), point.y(),
mPoints.at( 0 ).x(), mPoints.at( 0 ).y(),
mPoints.at( 1 ).x(), mPoints.at( 1 ).y() );

0 comments on commit 2c12146

Please sign in to comment.
You can’t perform that action at this time.