Skip to content
Permalink
Browse files

Add node points for measure tool

  • Loading branch information
NathanW2 committed Apr 23, 2014
1 parent 3a726b6 commit a3a36357eca4b2a8a8f91efca36e793b036500e5
Showing with 11 additions and 0 deletions.
  1. +8 −0 src/app/qgsmeasuretool.cpp
  2. +3 −0 src/app/qgsmeasuretool.h
@@ -36,6 +36,7 @@ QgsMeasureTool::QgsMeasureTool( QgsMapCanvas* canvas, bool measureArea )
mMeasureArea = measureArea;

mRubberBand = new QgsRubberBand( canvas, mMeasureArea ? QGis::Polygon : QGis::Line );
mRubberBandPoints = new QgsRubberBand( canvas, QGis::Point );

QPixmap myCrossHairQPixmap = QPixmap(( const char ** ) cross_hair_cursor );
mCursor = QCursor( myCrossHairQPixmap, 8, 8 );
@@ -55,6 +56,7 @@ QgsMeasureTool::~QgsMeasureTool()
{
delete mDialog;
delete mRubberBand;
delete mRubberBandPoints;
}


@@ -95,6 +97,7 @@ void QgsMeasureTool::deactivate()
{
mDialog->close();
mRubberBand->reset();
mRubberBandPoints->reset();
QgsMapTool::deactivate();
}

@@ -104,6 +107,7 @@ void QgsMeasureTool::restart()
mPoints.clear();

mRubberBand->reset( mMeasureArea ? QGis::Polygon : QGis::Line );
mRubberBandPoints->reset( QGis::Point );

// re-read settings
updateSettings();
@@ -122,6 +126,9 @@ void QgsMeasureTool::updateSettings()
int myBlue = settings.value( "/qgis/default_measure_color_blue", 67 ).toInt();
mRubberBand->setColor( QColor( myRed, myGreen, myBlue, 100 ) );
mRubberBand->setWidth( 3 );
mRubberBandPoints->setIcon( QgsRubberBand::ICON_CIRCLE );
mRubberBandPoints->setIconSize( 10 );
mRubberBandPoints->setColor( QColor( myRed, myGreen, myBlue, 150 ) );
mDialog->updateSettings();
}

@@ -200,6 +207,7 @@ void QgsMeasureTool::addPoint( QgsPoint &point )
mPoints.append( pnt );

mRubberBand->addPoint( point );
mRubberBandPoints->addPoint( point );
if ( ! mDone )
{
mDialog->addPoint( point );
@@ -83,6 +83,9 @@ class APP_EXPORT QgsMeasureTool : public QgsMapTool
//! Rubberband widget tracking the lines being drawn
QgsRubberBand *mRubberBand;

//! Rubberband widget tracking the added nodes to line
QgsRubberBand *mRubberBandPoints;

//! indicates whether we're measuring distances or areas
bool mMeasureArea;

0 comments on commit a3a3635

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