Skip to content

Commit

Permalink
replace mPoints.size() < 1 by mPoints.empty() and fix logic with rubb…
Browse files Browse the repository at this point in the history
…er band
  • Loading branch information
lbartoletti authored and nyalldawson committed Feb 5, 2020
1 parent 1dd2c31 commit f16ae2a
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolcircle2points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ void QgsMapToolCircle2Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

if ( e->button() == Qt::LeftButton )
{
if ( mPoints.size() < 1 )
if ( mPoints.isEmpty() )
mPoints.append( point );

if ( !mPoints.isEmpty() && !mTempRubberBand )
if ( !mTempRubberBand )
{
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolcirclecenterpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ void QgsMapToolCircleCenterPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

if ( e->button() == Qt::LeftButton )
{
if ( mPoints.size() < 1 )
if ( mPoints.empty() )
mPoints.append( point );

if ( !mPoints.isEmpty() && !mTempRubberBand )
if ( !mTempRubberBand )
{
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolellipsecenterpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ void QgsMapToolEllipseCenterPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

if ( e->button() == Qt::LeftButton )
{
if ( mPoints.size() < 1 )
if ( mPoints.empty() )
mPoints.append( point );

if ( !mPoints.isEmpty() && !mTempRubberBand )
if ( !mTempRubberBand )
{
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolellipseextent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ void QgsMapToolEllipseExtent::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

if ( e->button() == Qt::LeftButton )
{
if ( mPoints.size() < 1 )
if ( mPoints.empty() )
mPoints.append( point );

if ( !mPoints.isEmpty() && !mTempRubberBand )
if ( !mTempRubberBand )
{
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolellipsefoci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void QgsMapToolEllipseFoci::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( mPoints.size() < 2 )
mPoints.append( point );

if ( !mPoints.isEmpty() && !mTempRubberBand )
if ( !mTempRubberBand )
{
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolrectanglecenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ void QgsMapToolRectangleCenter::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

if ( e->button() == Qt::LeftButton )
{
if ( mPoints.size() < 1 )
if ( mPoints.empty() )
mPoints.append( point );

if ( !mPoints.isEmpty() && !mTempRubberBand )
if ( !mTempRubberBand )
{
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolrectangleextent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ void QgsMapToolRectangleExtent::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

if ( e->button() == Qt::LeftButton )
{
if ( mPoints.size() < 1 )
if ( mPoints.empty() )
mPoints.append( point );

if ( !mPoints.isEmpty() && !mTempRubberBand )
if ( !mTempRubberBand )
{
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();
Expand Down
13 changes: 5 additions & 8 deletions src/app/qgsmaptoolregularpolygon2points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,15 @@ void QgsMapToolRegularPolygon2Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e

if ( e->button() == Qt::LeftButton )
{
if ( mPoints.size() < 1 )
if ( mPoints.empty() )
mPoints.append( point );

if ( !mPoints.isEmpty() )
if ( !mTempRubberBand )
{
if ( !mTempRubberBand )
{
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();

createNumberSidesSpinBox();
}
createNumberSidesSpinBox();
}
}
else if ( e->button() == Qt::RightButton )
Expand Down
13 changes: 5 additions & 8 deletions src/app/qgsmaptoolregularpolygoncentercorner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,15 @@ void QgsMapToolRegularPolygonCenterCorner::cadCanvasReleaseEvent( QgsMapMouseEve

if ( e->button() == Qt::LeftButton )
{
if ( mPoints.size() < 1 )
if ( mPoints.empty() )
mPoints.append( point );

if ( !mPoints.isEmpty() )
if ( !mTempRubberBand )
{
if ( !mTempRubberBand )
{
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();
mTempRubberBand = createGeometryRubberBand( mLayerType, true );
mTempRubberBand->show();

createNumberSidesSpinBox();
}
createNumberSidesSpinBox();
}
}
else if ( e->button() == Qt::RightButton )
Expand Down

0 comments on commit f16ae2a

Please sign in to comment.