Skip to content

Commit e722ed8

Browse files
author
jef
committed
fix rubberband in node tool (probably introduced with r14679)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14723 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8fec610 commit e722ed8

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/app/qgsmaptoolnodetool.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void QgsMapToolNodeTool::createMovingRubberBands()
171171
rb->addPoint( toMapCoordinates( mCanvas->currentLayer(), vertexMap[beforeVertex].point ), false );
172172
mSelectionFeature->setRubberBandValues( beforeVertex, true, lastRubberBand, index );
173173
vertexMap[beforeVertex].inRubberBand = true;
174-
index ++;
174+
index++;
175175
}
176176
while ( vertex != -1 && vertexMap[vertex].selected && !vertexMap[vertex].inRubberBand )
177177
{
@@ -185,18 +185,18 @@ void QgsMapToolNodeTool::createMovingRubberBands()
185185
//setting values about added vertex
186186
mSelectionFeature->setRubberBandValues( vertex, true, lastRubberBand, index );
187187
vertexMap[vertex].inRubberBand = true;
188-
index ++;
188+
index++;
189189
geometry->adjacentVertices( vertex, beforeVertex, vertex );
190190
}
191191
if ( vertex != -1 && !vertexMap[vertex].selected ) //add last point not moving if exists
192192
{
193193
rb->addPoint( toMapCoordinates( mCanvas->currentLayer(), vertexMap[vertex].point ), true );
194194
mSelectionFeature->setRubberBandValues( vertex, true, lastRubberBand, index );
195195
vertexMap[vertex].inRubberBand = true;
196-
index ++;
196+
index++;
197197
}
198198
mQgsRubberBands.append( rb );
199-
lastRubberBand ++;
199+
lastRubberBand++;
200200
}
201201
}
202202
}
@@ -392,7 +392,7 @@ void QgsMapToolNodeTool::canvasMoveEvent( QMouseEvent * e )
392392
double x = mapCoords.x() + posMapCoord.x() - firstCoords.x();
393393
double y = mapCoords.y() + posMapCoord.y() - firstCoords.y();
394394

395-
mQgsRubberBands[vertexMap[i].rubberBandNr]->movePoint( vertexMap[i].index + 1, QgsPoint( x, y ) );
395+
mQgsRubberBands[vertexMap[i].rubberBandNr]->movePoint( vertexMap[i].index, QgsPoint( x, y ) );
396396
if ( vertexMap[i].index == 0 )
397397
{
398398
mQgsRubberBands[vertexMap[i].rubberBandNr]->movePoint( 0, QgsPoint( x, y ) );
@@ -405,16 +405,16 @@ void QgsMapToolNodeTool::canvasMoveEvent( QMouseEvent * e )
405405
double offsetY = posMapCoord.y() - mPosMapCoordBackup.y();
406406
for ( int i = 0; i < mTopologyRubberBand.size(); i++ )
407407
{
408-
for ( int pointIndex = 0; pointIndex < mTopologyRubberBand[i]->numberOfVertices() - 1; pointIndex ++ )
408+
for ( int pointIndex = 0; pointIndex < mTopologyRubberBand[i]->numberOfVertices() - 1; pointIndex++ )
409409
{
410410
if ( mTopologyRubberBandVertexes[i]->contains( pointIndex ) )
411411
{
412-
const QgsPoint* point = mTopologyRubberBand[i]->getPoint( 0, pointIndex + 1 );
412+
const QgsPoint* point = mTopologyRubberBand[i]->getPoint( 0, pointIndex );
413413
if ( point == 0 )
414414
{
415415
break;
416416
}
417-
mTopologyRubberBand[i]->movePoint( pointIndex + 1, QgsPoint( point->x() + offsetX, point->y() + offsetY ) );
417+
mTopologyRubberBand[i]->movePoint( pointIndex, QgsPoint( point->x() + offsetX, point->y() + offsetY ) );
418418
if ( pointIndex == 0 )
419419
{
420420
mTopologyRubberBand[i]->movePoint( pointIndex , QgsPoint( point->x() + offsetX, point->y() + offsetY ) );
@@ -548,7 +548,7 @@ void QgsMapToolNodeTool::canvasPressEvent( QMouseEvent * e )
548548
mSelectAnother = true;
549549
QList<QgsSnappingResult>::iterator it = snapResults.begin();
550550
QgsSnappingResult snapResult;
551-
for ( ; it != snapResults.end() ; ++it )
551+
for ( ; it != snapResults.end(); ++it )
552552
{
553553
if ( it->snappedAtGeometry == mSelectionFeature->featureId() )
554554
{
@@ -985,7 +985,7 @@ void SelectionFeature::deleteSelectedVertexes()
985985
QMultiMap<double, QgsSnappingResult> currentResultList;
986986
mVlayer->beginEditCommand( QObject::tr( "Deleted vertices" ) );
987987
int count = 0;
988-
for ( int i = mVertexMap.size() - 1; i > -1 ; i-- )
988+
for ( int i = mVertexMap.size() - 1; i > -1; i-- )
989989
{
990990
if ( mVertexMap[i].selected )
991991
{
@@ -1053,7 +1053,7 @@ void SelectionFeature::moveSelectedVertexes( double changeX, double changeY )
10531053
mVlayer->beginEditCommand( QObject::tr( "Moved vertices" ) );
10541054
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
10551055
QMultiMap<double, QgsSnappingResult> currentResultList;
1056-
for ( int i = mVertexMap.size() - 1; i > -1 ; i-- )
1056+
for ( int i = mVertexMap.size() - 1; i > -1; i-- )
10571057
{
10581058
if ( mVertexMap[i].selected )
10591059
{
@@ -1191,7 +1191,7 @@ void SelectionFeature::createVertexMapPolygon()
11911191
}
11921192
else //multipolygon
11931193
{
1194-
for ( int i2 = 0 ; i2 < mFeature->geometry()->asMultiPolygon().size(); i2++ )
1194+
for ( int i2 = 0; i2 < mFeature->geometry()->asMultiPolygon().size(); i2++ )
11951195
{ //iterating through polygons
11961196
QgsPolygon poly2 = mFeature->geometry()->asMultiPolygon()[i2];
11971197
for ( int i3 = 0; i3 < poly2.size(); i3++ )
@@ -1357,7 +1357,7 @@ void SelectionFeature::deselectVertex( int vertexNr )
13571357

13581358
void SelectionFeature::deselectAllVertexes()
13591359
{
1360-
for ( int i = 0; i < mVertexMap.size() ; i++ )
1360+
for ( int i = 0; i < mVertexMap.size(); i++ )
13611361
{
13621362
mVertexMap[i].selected = false;
13631363
mVertexMap[i].vertexMarker->setColor( Qt::red );
@@ -1400,7 +1400,7 @@ void SelectionFeature::invertVertexSelection( int vertexNr, bool invert )
14001400
void SelectionFeature::updateVertexMarkersPosition( QgsMapCanvas* canvas )
14011401
{
14021402
//function for on-line updating vertex markers without refresh of canvas
1403-
for ( int i = 0; i < mVertexMap.size() ; i++ )
1403+
for ( int i = 0; i < mVertexMap.size(); i++ )
14041404
{
14051405
mVertexMap[i].vertexMarker->setCenter( mCanvas->mapRenderer()->layerToMapCoordinates( mVlayer, mVertexMap[i].point ) );
14061406
mVertexMap[i].vertexMarker->update();

0 commit comments

Comments
 (0)