Skip to content

Commit 19a98b2

Browse files
committedAug 31, 2015
Merge pull request #2275 from mhugent/rubberband_fixes
Fix rubberband issues
2 parents a60c8fc + 8b82584 commit 19a98b2

File tree

6 files changed

+50
-8
lines changed

6 files changed

+50
-8
lines changed
 

‎src/core/geometry/qgscircularstringv2.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@ bool QgsCircularStringV2::insertVertex( const QgsVertexId& position, const QgsPo
701701
{
702702
insertVertexBetween( position.vertex, position.vertex + 1, position.vertex - 1 );
703703
}
704+
mBoundingBox = QgsRectangle(); //set bounding box invalid
704705
return true;
705706
}
706707

@@ -749,6 +750,7 @@ bool QgsCircularStringV2::deleteVertex( const QgsVertexId& position )
749750
deleteVertex( position.vertex - 1 );
750751
}
751752

753+
mBoundingBox = QgsRectangle(); //set bounding box invalid
752754
return true;
753755
}
754756

‎src/core/geometry/qgscompoundcurvev2.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,13 @@ bool QgsCompoundCurveV2::insertVertex( const QgsVertexId& position, const QgsPoi
467467
{
468468
return false;
469469
}
470-
return mCurves[curveId]->insertVertex( curveIds.at( 0 ).second, vertex );
470+
471+
bool success = mCurves[curveId]->insertVertex( curveIds.at( 0 ).second, vertex );
472+
if ( success )
473+
{
474+
mBoundingBox = QgsRectangle(); //bbox changed
475+
}
476+
return success;
471477
}
472478

473479
bool QgsCompoundCurveV2::moveVertex( const QgsVertexId& position, const QgsPointV2& newPos )
@@ -478,8 +484,13 @@ bool QgsCompoundCurveV2::moveVertex( const QgsVertexId& position, const QgsPoint
478484
{
479485
mCurves[idIt->first]->moveVertex( idIt->second, newPos );
480486
}
481-
mBoundingBox = QgsRectangle(); //bbox changed
482-
return curveIds.size() > 0;
487+
488+
bool success = curveIds.size() > 0;
489+
if ( success )
490+
{
491+
mBoundingBox = QgsRectangle(); //bbox changed
492+
}
493+
return success;
483494
}
484495

485496
bool QgsCompoundCurveV2::deleteVertex( const QgsVertexId& position )
@@ -490,7 +501,13 @@ bool QgsCompoundCurveV2::deleteVertex( const QgsVertexId& position )
490501
{
491502
mCurves[idIt->first]->deleteVertex( idIt->second );
492503
}
493-
return curveIds.size() > 0;
504+
505+
bool success = curveIds.size() > 0;
506+
if ( success )
507+
{
508+
mBoundingBox = QgsRectangle(); //bbox changed
509+
}
510+
return success;
494511
}
495512

496513
QList< QPair<int, QgsVertexId> > QgsCompoundCurveV2::curveVertexId( const QgsVertexId& id ) const

‎src/core/geometry/qgscurvepolygonv2.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,13 +580,19 @@ bool QgsCurvePolygonV2::insertVertex( const QgsVertexId& vId, const QgsPointV2&
580580
QgsCurveV2* ring = vId.ring == 0 ? mExteriorRing : mInteriorRings[vId.ring - 1];
581581
int n = ring->numPoints();
582582
bool success = ring->insertVertex( QgsVertexId( 0, 0, vId.vertex ), vertex );
583+
if ( !success )
584+
{
585+
return false;
586+
}
587+
583588
// If first or last vertex is inserted, re-sync the last/first vertex
584589
if ( vId.vertex == 0 )
585590
ring->moveVertex( QgsVertexId( 0, 0, n ), vertex );
586591
else if ( vId.vertex == n )
587592
ring->moveVertex( QgsVertexId( 0, 0, 0 ), vertex );
588593

589-
return success;
594+
mBoundingBox = QgsRectangle();
595+
return true;
590596
}
591597

592598
bool QgsCurvePolygonV2::moveVertex( const QgsVertexId& vId, const QgsPointV2& newPos )

‎src/core/geometry/qgsgeometrycollectionv2.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,12 @@ bool QgsGeometryCollectionV2::insertVertex( const QgsVertexId& position, const Q
367367
return false;
368368
}
369369

370-
return mGeometries[position.part]->insertVertex( position, vertex );
370+
bool success = mGeometries[position.part]->insertVertex( position, vertex );
371+
if ( success )
372+
{
373+
mBoundingBox = QgsRectangle(); //set bounding box invalid
374+
}
375+
return success;
371376
}
372377

373378
bool QgsGeometryCollectionV2::moveVertex( const QgsVertexId& position, const QgsPointV2& newPos )
@@ -377,7 +382,12 @@ bool QgsGeometryCollectionV2::moveVertex( const QgsVertexId& position, const Qgs
377382
return false;
378383
}
379384

380-
return mGeometries[position.part]->moveVertex( position, newPos );
385+
bool success = mGeometries[position.part]->moveVertex( position, newPos );
386+
if ( success )
387+
{
388+
mBoundingBox = QgsRectangle(); //set bounding box invalid
389+
}
390+
return success;
381391
}
382392

383393
bool QgsGeometryCollectionV2::deleteVertex( const QgsVertexId& position )
@@ -401,6 +411,10 @@ bool QgsGeometryCollectionV2::deleteVertex( const QgsVertexId& position )
401411
removeGeometry( position.part );
402412
}
403413

414+
if ( success )
415+
{
416+
mBoundingBox = QgsRectangle(); //set bounding box invalid
417+
}
404418
return success;
405419
}
406420

‎src/core/geometry/qgslinestringv2.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ bool QgsLineStringV2::insertVertex( const QgsVertexId& position, const QgsPointV
358358
{
359359
mM.insert( position.vertex, vertex.m() );
360360
}
361+
mBoundingBox = QgsRectangle(); //set bounding box invalid
361362
return true;
362363
}
363364

@@ -397,6 +398,7 @@ bool QgsLineStringV2::deleteVertex( const QgsVertexId& position )
397398
{
398399
mM.remove( position.vertex );
399400
}
401+
mBoundingBox = QgsRectangle(); //set bounding box invalid
400402
return true;
401403
}
402404

@@ -416,6 +418,7 @@ void QgsLineStringV2::addVertex( const QgsPointV2& pt )
416418
{
417419
mM.append( pt.m() );
418420
}
421+
mBoundingBox = QgsRectangle(); //set bounding box invalid
419422
}
420423

421424
double QgsLineStringV2::closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const

‎src/gui/qgsgeometryrubberband.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <QPainter>
2323

2424
QgsGeometryRubberBand::QgsGeometryRubberBand( QgsMapCanvas* mapCanvas, QGis::GeometryType geomType ): QgsMapCanvasItem( mapCanvas ),
25-
mGeometry( 0 ), mIconSize( 5 ), mIconType( ICON_CIRCLE ), mGeometryType( geomType )
25+
mGeometry( 0 ), mIconSize( 5 ), mIconType( ICON_BOX ), mGeometryType( geomType )
2626
{
2727
mPen = QPen( QColor( 255, 0, 0 ) );
2828
mBrush = QBrush( QColor( 255, 0, 0 ) );

0 commit comments

Comments
 (0)
Please sign in to comment.