Skip to content
Permalink
Browse files

Circular string tools: Remove temporary rubber band of parent tool wh…

…en activating circular string tool
  • Loading branch information
mhugent committed Aug 27, 2015
1 parent 7fb27d4 commit 632656ec69d44b43be4bd80466257b4c107231fe
@@ -109,6 +109,16 @@ void QgsMapToolAddCircularString::deactivate()
mPoints.clear();
delete mRubberBand; mRubberBand = 0;
removeCenterPointRubberBand();
QgsMapToolCapture::deactivate();
}

void QgsMapToolAddCircularString::activate()
{
if ( mParentTool )
{
mParentTool->deleteTempRubberBand();
}
QgsMapToolCapture::activate();
}

void QgsMapToolAddCircularString::createCenterPointRubberBand()
@@ -32,6 +32,8 @@ class QgsMapToolAddCircularString: public QgsMapToolCapture

void deactivate();

void activate();

private slots:
void setParentTool( QgsMapTool* newTool, QgsMapTool* oldTool );

@@ -134,6 +134,14 @@ void QgsMapToolCapture::canvasMapMoveEvent( QgsMapMouseEvent * e )
mSnappingMarker->setCenter( point );
}

if ( !mTempRubberBand && mCaptureCurve.numPoints() > 0 )
{
mTempRubberBand = createRubberBand( mCaptureMode == CapturePolygon ? QGis::Polygon : QGis::Line, true );
QgsPointV2 pt = mCaptureCurve.endPoint();
mTempRubberBand->addPoint( QgsPoint( pt.x(), pt.y() ) );
mTempRubberBand->addPoint( point );
}

if ( mCaptureMode != CapturePoint && mTempRubberBand && mCapturing )
{
mTempRubberBand->movePoint( point );
@@ -58,6 +58,8 @@ class APP_EXPORT QgsMapToolCapture : public QgsMapToolEdit

const QgsCompoundCurveV2* captureCurve() const { return &mCaptureCurve; }

void deleteTempRubberBand();

public slots:
void currentLayerChanged( QgsMapLayer *layer );
void addError( QgsGeometry::Error );
@@ -77,7 +79,6 @@ class APP_EXPORT QgsMapToolCapture : public QgsMapToolEdit
void startCapturing();
bool isCapturing() const;
void stopCapturing();
void deleteTempRubberBand();

int size();
QList<QgsPoint> points();
@@ -314,6 +314,11 @@ int QgsCompoundCurveV2::numPoints() const
{
int nPoints = 0;
int nCurves = mCurves.size();
if ( nCurves < 1 )
{
return 0;
}

for ( int i = 0; i < nCurves; ++i )
{
nPoints += mCurves.at( i )->numPoints() - 1; //last vertex is equal to first of next section

0 comments on commit 632656e

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