Skip to content

Commit a3a3635

Browse files
committedApr 23, 2014
Add node points for measure tool
1 parent 3a726b6 commit a3a3635

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
 

‎src/app/qgsmeasuretool.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ QgsMeasureTool::QgsMeasureTool( QgsMapCanvas* canvas, bool measureArea )
3636
mMeasureArea = measureArea;
3737

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

4041
QPixmap myCrossHairQPixmap = QPixmap(( const char ** ) cross_hair_cursor );
4142
mCursor = QCursor( myCrossHairQPixmap, 8, 8 );
@@ -55,6 +56,7 @@ QgsMeasureTool::~QgsMeasureTool()
5556
{
5657
delete mDialog;
5758
delete mRubberBand;
59+
delete mRubberBandPoints;
5860
}
5961

6062

@@ -95,6 +97,7 @@ void QgsMeasureTool::deactivate()
9597
{
9698
mDialog->close();
9799
mRubberBand->reset();
100+
mRubberBandPoints->reset();
98101
QgsMapTool::deactivate();
99102
}
100103

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

106109
mRubberBand->reset( mMeasureArea ? QGis::Polygon : QGis::Line );
110+
mRubberBandPoints->reset( QGis::Point );
107111

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

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

202209
mRubberBand->addPoint( point );
210+
mRubberBandPoints->addPoint( point );
203211
if ( ! mDone )
204212
{
205213
mDialog->addPoint( point );

‎src/app/qgsmeasuretool.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ class APP_EXPORT QgsMeasureTool : public QgsMapTool
8383
//! Rubberband widget tracking the lines being drawn
8484
QgsRubberBand *mRubberBand;
8585

86+
//! Rubberband widget tracking the added nodes to line
87+
QgsRubberBand *mRubberBandPoints;
88+
8689
//! indicates whether we're measuring distances or areas
8790
bool mMeasureArea;
8891

0 commit comments

Comments
 (0)
Please sign in to comment.