Skip to content
Permalink
Browse files

maptool circular string by point uses temporary rubberband

  • Loading branch information
SebDieBln committed Dec 21, 2015
1 parent 8eb8494 commit b4892c13e829fe086d0c9ffa56377dfb02f64726
Showing with 17 additions and 6 deletions.
  1. +17 −6 src/app/qgsmaptoolcircularstringcurvepoint.cpp
@@ -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 )
{
@@ -42,9 +56,6 @@ void QgsMapToolCircularStringCurvePoint::cadCanvasReleaseEvent( QgsMapMouseEvent
rubberBandPoints.append( mapPoint );
c->setPoints( rubberBandPoints );
mRubberBand->setGeometry( c );
}
if (( mPoints.size() ) % 2 == 1 )
{
removeCenterPointRubberBand();
}
}
@@ -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.
You can’t perform that action at this time.