Skip to content
Permalink
Browse files

added a temporary rubberband to the circular maptools

(but it is not used yet)
  • Loading branch information
SebDieBln committed Dec 17, 2015
1 parent 6a2af5d commit e0b14a5e0a5ca0feca9c4838e5ef83c5496470a7
Showing with 14 additions and 3 deletions.
  1. +8 −3 src/app/qgsmaptooladdcircularstring.cpp
  2. +6 −0 src/app/qgsmaptooladdcircularstring.h
@@ -28,6 +28,7 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapToolCapture* par
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode )
, mParentTool( parentTool )
, mRubberBand( nullptr )
, mTempRubberBand( nullptr )
, mShowCenterPointRubberBand( false )
, mCenterPointRubberBand( nullptr )
{
@@ -41,6 +42,7 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapCanvas* canvas )
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget() )
, mParentTool( nullptr )
, mRubberBand( nullptr )
, mTempRubberBand( nullptr )
, mShowCenterPointRubberBand( false )
, mCenterPointRubberBand( nullptr )
{
@@ -53,6 +55,7 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapCanvas* canvas )
QgsMapToolAddCircularString::~QgsMapToolAddCircularString()
{
delete mRubberBand;
delete mTempRubberBand;
removeCenterPointRubberBand();
}

@@ -117,6 +120,8 @@ void QgsMapToolAddCircularString::deactivate()
mPoints.clear();
delete mRubberBand;
mRubberBand = nullptr;
delete mTempRubberBand;
mTempRubberBand = nullptr;
removeCenterPointRubberBand();
QgsMapToolCapture::deactivate();
}
@@ -156,15 +161,15 @@ void QgsMapToolAddCircularString::createCenterPointRubberBand()
mCenterPointRubberBand = createGeometryRubberBand( QGis::Polygon );
mCenterPointRubberBand->show();

if ( mRubberBand )
if ( mTempRubberBand )
{
const QgsAbstractGeometryV2* rubberBandGeom = mRubberBand->geometry();
const QgsAbstractGeometryV2* rubberBandGeom = mTempRubberBand->geometry();
if ( rubberBandGeom )
{
QgsVertexId idx;
idx.part = 0;
idx.ring = 0;
idx.vertex = mPoints.size();
idx.vertex = 2;
QgsPointV2 pt = rubberBandGeom->vertexAt( idx );
updateCenterPointRubberBand( pt );
}
@@ -40,10 +40,16 @@ class QgsMapToolAddCircularString: public QgsMapToolCapture
protected:
explicit QgsMapToolAddCircularString( QgsMapCanvas* canvas ); //forbidden

/** The parent map tool, e.g. the add feature tool.
* Completed circular strings will be added to this tool by calling its addCurve() method.
* */
QgsMapToolCapture* mParentTool;
/** Circular string points (in map coordinates)*/
QList< QgsPointV2 > mPoints;
//! The rubberband to show the already completed circular strings
QgsGeometryRubberBand* mRubberBand;
//! The rubberband to show the circular string currently working on
QgsGeometryRubberBand* mTempRubberBand;

//center point rubber band
bool mShowCenterPointRubberBand;

0 comments on commit e0b14a5

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