Skip to content

Commit b18b097

Browse files
author
timlinux
committedJan 7, 2010
Refactored capturetool to capturemode and fixed some compile errors
git-svn-id: http://svn.osgeo.org/qgis/trunk@12697 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f0d8aa5 commit b18b097

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed
 

‎src/app/qgsmaptooladdfeature.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <QMouseEvent>
3232
#include <QSettings>
3333

34-
QgsMapToolAddFeature::QgsMapToolAddFeature( QgsMapCanvas* canvas, CaptureTool tool ): QgsMapToolCapture( canvas, tool )
34+
QgsMapToolAddFeature::QgsMapToolAddFeature( QgsMapCanvas* canvas, CaptureMode tool ): QgsMapToolCapture( canvas, tool )
3535
{
3636

3737
}
@@ -85,7 +85,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
8585
}
8686

8787
// POINT CAPTURING
88-
if ( mTool == CapturePoint )
88+
if ( mCaptureMode == CapturePoint )
8989
{
9090
//check we only use this tool for point/multipoint layers
9191
if ( vlayer->geometryType() != QGis::Point )
@@ -209,18 +209,18 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
209209
}
210210

211211
}
212-
else if ( mTool == CaptureLine || mTool == CapturePolygon )
212+
else if ( mCaptureMode == CaptureLine || mCaptureMode == CapturePolygon )
213213
{
214214
//check we only use the line tool for line/multiline layers
215-
if ( mTool == CaptureLine && vlayer->geometryType() != QGis::Line )
215+
if ( mCaptureMode == CaptureLine && vlayer->geometryType() != QGis::Line )
216216
{
217217
QMessageBox::information( 0, tr( "Wrong editing tool" ),
218218
tr( "Cannot apply the 'capture line' tool on this vector layer" ) );
219219
return;
220220
}
221221

222222
//check we only use the polygon tool for polygon/multipolygon layers
223-
if ( mTool == CapturePolygon && vlayer->geometryType() != QGis::Polygon )
223+
if ( mCaptureMode == CapturePolygon && vlayer->geometryType() != QGis::Polygon )
224224
{
225225
QMessageBox::information( 0, tr( "Wrong editing tool" ),
226226
tr( "Cannot apply the 'capture polygon' tool on this vector layer" ) );
@@ -253,7 +253,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
253253
mCapturing = FALSE;
254254

255255
//lines: bail out if there are not at least two vertices
256-
if ( mTool == CaptureLine && mCaptureList.size() < 2 )
256+
if ( mCaptureMode == CaptureLine && mCaptureList.size() < 2 )
257257
{
258258
delete mRubberBand;
259259
mRubberBand = NULL;
@@ -262,7 +262,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
262262
}
263263

264264
//polygons: bail out if there are not at least two vertices
265-
if ( mTool == CapturePolygon && mCaptureList.size() < 3 )
265+
if ( mCaptureMode == CapturePolygon && mCaptureList.size() < 3 )
266266
{
267267
delete mRubberBand;
268268
mRubberBand = NULL;
@@ -276,7 +276,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
276276
int size;
277277
char end = QgsApplication::endian();
278278

279-
if ( mTool == CaptureLine )
279+
if ( mCaptureMode == CaptureLine )
280280
{
281281
if ( layerWKBType == QGis::WKBLineString )
282282
{

‎src/app/qgsmaptoolcapture.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
#include <QMouseEvent>
3737

3838

39-
QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, enum CaptureTool tool )
40-
: QgsMapToolEdit( canvas ), mTool( tool ), mRubberBand( 0 )
39+
QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, enum CaptureMode tool )
40+
: QgsMapToolEdit( canvas ), mCaptureMode( tool ), mRubberBand( 0 )
4141
{
4242
mCapturing = FALSE;
4343

@@ -98,7 +98,7 @@ int QgsMapToolCapture::addVertex( const QPoint& p )
9898

9999
if ( !mRubberBand )
100100
{
101-
mRubberBand = createRubberBand( mTool == CapturePolygon );
101+
mRubberBand = createRubberBand( mCaptureMode == CapturePolygon );
102102
}
103103

104104
QgsPoint digitisedPoint;

‎src/app/qgsmaptoolcapture.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ class QgsMapToolCapture : public QgsMapToolEdit
3131
{
3232
public:
3333

34-
enum CaptureTool
34+
enum CaptureMode
3535
{
3636
CapturePoint,
3737
CaptureLine,
3838
CapturePolygon
3939
};
4040

4141
//! constructor
42-
QgsMapToolCapture( QgsMapCanvas* canvas, CaptureTool tool );
42+
QgsMapToolCapture( QgsMapCanvas* canvas, CaptureMode tool );
4343

4444
//! destructor
4545
virtual ~QgsMapToolCapture();
@@ -71,7 +71,7 @@ class QgsMapToolCapture : public QgsMapToolEdit
7171
protected:
7272

7373
/** which capturing tool is being used */
74-
enum CaptureTool mTool;
74+
enum CaptureMode mCaptureMode;
7575

7676
/** Flag to indicate a map canvas capture operation is taking place */
7777
bool mCapturing;

0 commit comments

Comments
 (0)
Please sign in to comment.