Skip to content
Permalink
Browse files

replace mPoints.size() < 1 by mPoints.empty() and fix logic with rubb…

…er band
  • Loading branch information
lbartoletti authored and nyalldawson committed Feb 3, 2020
1 parent 2331b8e commit 3f737d558a876fbcae7797d7c2a194f9454fe198
@@ -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();
@@ -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();
@@ -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();
@@ -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();
@@ -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();
@@ -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();
@@ -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();
@@ -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 )
@@ -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 )

0 comments on commit 3f737d5

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