Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Refactored capturetool to capturemode and fixed some compile errors
git-svn-id: http://svn.osgeo.org/qgis/trunk@12697 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jan 7, 2010
1 parent f0d8aa5 commit b18b097
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions src/app/qgsmaptooladdfeature.cpp
Expand Up @@ -31,7 +31,7 @@
#include <QMouseEvent>
#include <QSettings>

QgsMapToolAddFeature::QgsMapToolAddFeature( QgsMapCanvas* canvas, CaptureTool tool ): QgsMapToolCapture( canvas, tool )
QgsMapToolAddFeature::QgsMapToolAddFeature( QgsMapCanvas* canvas, CaptureMode tool ): QgsMapToolCapture( canvas, tool )
{

}
Expand Down Expand Up @@ -85,7 +85,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
}

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

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

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

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

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

if ( mTool == CaptureLine )
if ( mCaptureMode == CaptureLine )
{
if ( layerWKBType == QGis::WKBLineString )
{
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsmaptoolcapture.cpp
Expand Up @@ -36,8 +36,8 @@
#include <QMouseEvent>


QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, enum CaptureTool tool )
: QgsMapToolEdit( canvas ), mTool( tool ), mRubberBand( 0 )
QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, enum CaptureMode tool )
: QgsMapToolEdit( canvas ), mCaptureMode( tool ), mRubberBand( 0 )
{
mCapturing = FALSE;

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

if ( !mRubberBand )
{
mRubberBand = createRubberBand( mTool == CapturePolygon );
mRubberBand = createRubberBand( mCaptureMode == CapturePolygon );
}

QgsPoint digitisedPoint;
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsmaptoolcapture.h
Expand Up @@ -31,15 +31,15 @@ class QgsMapToolCapture : public QgsMapToolEdit
{
public:

enum CaptureTool
enum CaptureMode
{
CapturePoint,
CaptureLine,
CapturePolygon
};

//! constructor
QgsMapToolCapture( QgsMapCanvas* canvas, CaptureTool tool );
QgsMapToolCapture( QgsMapCanvas* canvas, CaptureMode tool );

//! destructor
virtual ~QgsMapToolCapture();
Expand Down Expand Up @@ -71,7 +71,7 @@ class QgsMapToolCapture : public QgsMapToolEdit
protected:

/** which capturing tool is being used */
enum CaptureTool mTool;
enum CaptureMode mCaptureMode;

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

0 comments on commit b18b097

Please sign in to comment.