Navigation Menu

Skip to content

Commit

Permalink
use a switch
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Nov 15, 2018
1 parent d40f884 commit 2c12146
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/app/qgsmaptoolrectangle3points.cpp
Expand Up @@ -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() );
Expand Down

0 comments on commit 2c12146

Please sign in to comment.