Skip to content

Commit

Permalink
maptool circular string by point uses temporary rubberband
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDieBln committed Dec 21, 2015
1 parent 8eb8494 commit b4892c1
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/app/qgsmaptoolcircularstringcurvepoint.cpp
Expand Up @@ -30,6 +30,20 @@ void QgsMapToolCircularStringCurvePoint::cadCanvasReleaseEvent( QgsMapMouseEvent
}

if ( mPoints.size() >= 1 )
{
if ( !mTempRubberBand )
{
mTempRubberBand = createGeometryRubberBand(( mode() == CapturePolygon ) ? QGis::Polygon : QGis::Line, true );
mTempRubberBand->show();
}

QgsCircularStringV2* c = new QgsCircularStringV2();
QList< QgsPointV2 > rubberBandPoints = mPoints.mid( mPoints.size() - 1 - ( mPoints.size() + 1 ) % 2 );
rubberBandPoints.append( mapPoint );
c->setPoints( rubberBandPoints );
mTempRubberBand->setGeometry( c );
}
if ( mPoints.size() > 1 && ( mPoints.size() ) % 2 == 1 )
{
if ( !mRubberBand )
{
Expand All @@ -42,9 +56,6 @@ void QgsMapToolCircularStringCurvePoint::cadCanvasReleaseEvent( QgsMapMouseEvent
rubberBandPoints.append( mapPoint );
c->setPoints( rubberBandPoints );
mRubberBand->setGeometry( c );
}
if (( mPoints.size() ) % 2 == 1 )
{
removeCenterPointRubberBand();
}
}
Expand All @@ -64,10 +75,10 @@ void QgsMapToolCircularStringCurvePoint::cadCanvasMoveEvent( QgsMapMouseEvent* e
QgsVertexId idx;
idx.part = 0;
idx.ring = 0;
idx.vertex = mPoints.size();
if ( mRubberBand )
idx.vertex = 1 + ( mPoints.size() + 1 ) % 2;
if ( mTempRubberBand )
{
mRubberBand->moveVertex( idx, mapPoint );
mTempRubberBand->moveVertex( idx, mapPoint );
updateCenterPointRubberBand( mapPoint );
}
}

0 comments on commit b4892c1

Please sign in to comment.