Skip to content
Permalink
Browse files

Fix rubberband issues

  • Loading branch information
mhugent committed Aug 28, 2015
1 parent ebf3bac commit 8b8258442ac5ddb2f4feeb6c3cd3f4548ac43416
@@ -701,6 +701,7 @@ bool QgsCircularStringV2::insertVertex( const QgsVertexId& position, const QgsPo
{
insertVertexBetween( position.vertex, position.vertex + 1, position.vertex - 1 );
}
mBoundingBox = QgsRectangle(); //set bounding box invalid
return true;
}

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

mBoundingBox = QgsRectangle(); //set bounding box invalid
return true;
}

@@ -467,7 +467,13 @@ bool QgsCompoundCurveV2::insertVertex( const QgsVertexId& position, const QgsPoi
{
return false;
}
return mCurves[curveId]->insertVertex( curveIds.at( 0 ).second, vertex );

bool success = mCurves[curveId]->insertVertex( curveIds.at( 0 ).second, vertex );
if ( success )
{
mBoundingBox = QgsRectangle(); //bbox changed
}
return success;
}

bool QgsCompoundCurveV2::moveVertex( const QgsVertexId& position, const QgsPointV2& newPos )
@@ -478,8 +484,13 @@ bool QgsCompoundCurveV2::moveVertex( const QgsVertexId& position, const QgsPoint
{
mCurves[idIt->first]->moveVertex( idIt->second, newPos );
}
mBoundingBox = QgsRectangle(); //bbox changed
return curveIds.size() > 0;

bool success = curveIds.size() > 0;
if ( success )
{
mBoundingBox = QgsRectangle(); //bbox changed
}
return success;
}

bool QgsCompoundCurveV2::deleteVertex( const QgsVertexId& position )
@@ -490,7 +501,13 @@ bool QgsCompoundCurveV2::deleteVertex( const QgsVertexId& position )
{
mCurves[idIt->first]->deleteVertex( idIt->second );
}
return curveIds.size() > 0;

bool success = curveIds.size() > 0;
if ( success )
{
mBoundingBox = QgsRectangle(); //bbox changed
}
return success;
}

QList< QPair<int, QgsVertexId> > QgsCompoundCurveV2::curveVertexId( const QgsVertexId& id ) const
@@ -580,13 +580,19 @@ bool QgsCurvePolygonV2::insertVertex( const QgsVertexId& vId, const QgsPointV2&
QgsCurveV2* ring = vId.ring == 0 ? mExteriorRing : mInteriorRings[vId.ring - 1];
int n = ring->numPoints();
bool success = ring->insertVertex( QgsVertexId( 0, 0, vId.vertex ), vertex );
if ( !success )
{
return false;
}

// If first or last vertex is inserted, re-sync the last/first vertex
if ( vId.vertex == 0 )
ring->moveVertex( QgsVertexId( 0, 0, n ), vertex );
else if ( vId.vertex == n )
ring->moveVertex( QgsVertexId( 0, 0, 0 ), vertex );

return success;
mBoundingBox = QgsRectangle();
return true;
}

bool QgsCurvePolygonV2::moveVertex( const QgsVertexId& vId, const QgsPointV2& newPos )
@@ -367,7 +367,12 @@ bool QgsGeometryCollectionV2::insertVertex( const QgsVertexId& position, const Q
return false;
}

return mGeometries[position.part]->insertVertex( position, vertex );
bool success = mGeometries[position.part]->insertVertex( position, vertex );
if ( success )
{
mBoundingBox = QgsRectangle(); //set bounding box invalid
}
return success;
}

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

return mGeometries[position.part]->moveVertex( position, newPos );
bool success = mGeometries[position.part]->moveVertex( position, newPos );
if ( success )
{
mBoundingBox = QgsRectangle(); //set bounding box invalid
}
return success;
}

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

if ( success )
{
mBoundingBox = QgsRectangle(); //set bounding box invalid
}
return success;
}

@@ -358,6 +358,7 @@ bool QgsLineStringV2::insertVertex( const QgsVertexId& position, const QgsPointV
{
mM.insert( position.vertex, vertex.m() );
}
mBoundingBox = QgsRectangle(); //set bounding box invalid
return true;
}

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

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

double QgsLineStringV2::closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const
@@ -22,7 +22,7 @@
#include <QPainter>

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

0 comments on commit 8b82584

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