Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix rubberband in node tool (probably introduced with r14679)
git-svn-id: http://svn.osgeo.org/qgis/trunk@14723 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Nov 20, 2010
1 parent 172d13a commit 6e11ab6
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/app/qgsmaptoolnodetool.cpp
Expand Up @@ -171,7 +171,7 @@ void QgsMapToolNodeTool::createMovingRubberBands()
rb->addPoint( toMapCoordinates( mCanvas->currentLayer(), vertexMap[beforeVertex].point ), false );
mSelectionFeature->setRubberBandValues( beforeVertex, true, lastRubberBand, index );
vertexMap[beforeVertex].inRubberBand = true;
index ++;
index++;
}
while ( vertex != -1 && vertexMap[vertex].selected && !vertexMap[vertex].inRubberBand )
{
Expand All @@ -185,18 +185,18 @@ void QgsMapToolNodeTool::createMovingRubberBands()
//setting values about added vertex
mSelectionFeature->setRubberBandValues( vertex, true, lastRubberBand, index );
vertexMap[vertex].inRubberBand = true;
index ++;
index++;
geometry->adjacentVertices( vertex, beforeVertex, vertex );
}
if ( vertex != -1 && !vertexMap[vertex].selected ) //add last point not moving if exists
{
rb->addPoint( toMapCoordinates( mCanvas->currentLayer(), vertexMap[vertex].point ), true );
mSelectionFeature->setRubberBandValues( vertex, true, lastRubberBand, index );
vertexMap[vertex].inRubberBand = true;
index ++;
index++;
}
mQgsRubberBands.append( rb );
lastRubberBand ++;
lastRubberBand++;
}
}
}
Expand Down Expand Up @@ -392,7 +392,7 @@ void QgsMapToolNodeTool::canvasMoveEvent( QMouseEvent * e )
double x = mapCoords.x() + posMapCoord.x() - firstCoords.x();
double y = mapCoords.y() + posMapCoord.y() - firstCoords.y();

mQgsRubberBands[vertexMap[i].rubberBandNr]->movePoint( vertexMap[i].index + 1, QgsPoint( x, y ) );
mQgsRubberBands[vertexMap[i].rubberBandNr]->movePoint( vertexMap[i].index, QgsPoint( x, y ) );
if ( vertexMap[i].index == 0 )
{
mQgsRubberBands[vertexMap[i].rubberBandNr]->movePoint( 0, QgsPoint( x, y ) );
Expand All @@ -405,16 +405,16 @@ void QgsMapToolNodeTool::canvasMoveEvent( QMouseEvent * e )
double offsetY = posMapCoord.y() - mPosMapCoordBackup.y();
for ( int i = 0; i < mTopologyRubberBand.size(); i++ )
{
for ( int pointIndex = 0; pointIndex < mTopologyRubberBand[i]->numberOfVertices() - 1; pointIndex ++ )
for ( int pointIndex = 0; pointIndex < mTopologyRubberBand[i]->numberOfVertices() - 1; pointIndex++ )
{
if ( mTopologyRubberBandVertexes[i]->contains( pointIndex ) )
{
const QgsPoint* point = mTopologyRubberBand[i]->getPoint( 0, pointIndex + 1 );
const QgsPoint* point = mTopologyRubberBand[i]->getPoint( 0, pointIndex );
if ( point == 0 )
{
break;
}
mTopologyRubberBand[i]->movePoint( pointIndex + 1, QgsPoint( point->x() + offsetX, point->y() + offsetY ) );
mTopologyRubberBand[i]->movePoint( pointIndex, QgsPoint( point->x() + offsetX, point->y() + offsetY ) );
if ( pointIndex == 0 )
{
mTopologyRubberBand[i]->movePoint( pointIndex , QgsPoint( point->x() + offsetX, point->y() + offsetY ) );
Expand Down Expand Up @@ -548,7 +548,7 @@ void QgsMapToolNodeTool::canvasPressEvent( QMouseEvent * e )
mSelectAnother = true;
QList<QgsSnappingResult>::iterator it = snapResults.begin();
QgsSnappingResult snapResult;
for ( ; it != snapResults.end() ; ++it )
for ( ; it != snapResults.end(); ++it )
{
if ( it->snappedAtGeometry == mSelectionFeature->featureId() )
{
Expand Down Expand Up @@ -985,7 +985,7 @@ void SelectionFeature::deleteSelectedVertexes()
QMultiMap<double, QgsSnappingResult> currentResultList;
mVlayer->beginEditCommand( QObject::tr( "Deleted vertices" ) );
int count = 0;
for ( int i = mVertexMap.size() - 1; i > -1 ; i-- )
for ( int i = mVertexMap.size() - 1; i > -1; i-- )
{
if ( mVertexMap[i].selected )
{
Expand Down Expand Up @@ -1053,7 +1053,7 @@ void SelectionFeature::moveSelectedVertexes( double changeX, double changeY )
mVlayer->beginEditCommand( QObject::tr( "Moved vertices" ) );
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
QMultiMap<double, QgsSnappingResult> currentResultList;
for ( int i = mVertexMap.size() - 1; i > -1 ; i-- )
for ( int i = mVertexMap.size() - 1; i > -1; i-- )
{
if ( mVertexMap[i].selected )
{
Expand Down Expand Up @@ -1191,7 +1191,7 @@ void SelectionFeature::createVertexMapPolygon()
}
else //multipolygon
{
for ( int i2 = 0 ; i2 < mFeature->geometry()->asMultiPolygon().size(); i2++ )
for ( int i2 = 0; i2 < mFeature->geometry()->asMultiPolygon().size(); i2++ )
{ //iterating through polygons
QgsPolygon poly2 = mFeature->geometry()->asMultiPolygon()[i2];
for ( int i3 = 0; i3 < poly2.size(); i3++ )
Expand Down Expand Up @@ -1357,7 +1357,7 @@ void SelectionFeature::deselectVertex( int vertexNr )

void SelectionFeature::deselectAllVertexes()
{
for ( int i = 0; i < mVertexMap.size() ; i++ )
for ( int i = 0; i < mVertexMap.size(); i++ )
{
mVertexMap[i].selected = false;
mVertexMap[i].vertexMarker->setColor( Qt::red );
Expand Down Expand Up @@ -1400,7 +1400,7 @@ void SelectionFeature::invertVertexSelection( int vertexNr, bool invert )
void SelectionFeature::updateVertexMarkersPosition( QgsMapCanvas* canvas )
{
//function for on-line updating vertex markers without refresh of canvas
for ( int i = 0; i < mVertexMap.size() ; i++ )
for ( int i = 0; i < mVertexMap.size(); i++ )
{
mVertexMap[i].vertexMarker->setCenter( mCanvas->mapRenderer()->layerToMapCoordinates( mVlayer, mVertexMap[i].point ) );
mVertexMap[i].vertexMarker->update();
Expand Down

0 comments on commit 6e11ab6

Please sign in to comment.