Navigation Menu

Skip to content

Commit

Permalink
added a temporary rubberband to the circular maptools
Browse files Browse the repository at this point in the history
(but it is not used yet)
  • Loading branch information
SebDieBln committed Dec 21, 2015
1 parent 6a2af5d commit e0b14a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/app/qgsmaptooladdcircularstring.cpp
Expand Up @@ -28,6 +28,7 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapToolCapture* par
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode )
, mParentTool( parentTool )
, mRubberBand( nullptr )
, mTempRubberBand( nullptr )
, mShowCenterPointRubberBand( false )
, mCenterPointRubberBand( nullptr )
{
Expand All @@ -41,6 +42,7 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapCanvas* canvas )
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget() )
, mParentTool( nullptr )
, mRubberBand( nullptr )
, mTempRubberBand( nullptr )
, mShowCenterPointRubberBand( false )
, mCenterPointRubberBand( nullptr )
{
Expand All @@ -53,6 +55,7 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapCanvas* canvas )
QgsMapToolAddCircularString::~QgsMapToolAddCircularString()
{
delete mRubberBand;
delete mTempRubberBand;
removeCenterPointRubberBand();
}

Expand Down Expand Up @@ -117,6 +120,8 @@ void QgsMapToolAddCircularString::deactivate()
mPoints.clear();
delete mRubberBand;
mRubberBand = nullptr;
delete mTempRubberBand;
mTempRubberBand = nullptr;
removeCenterPointRubberBand();
QgsMapToolCapture::deactivate();
}
Expand Down Expand Up @@ -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 );
}
Expand Down
6 changes: 6 additions & 0 deletions src/app/qgsmaptooladdcircularstring.h
Expand Up @@ -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;
Expand Down

0 comments on commit e0b14a5

Please sign in to comment.