Skip to content
Permalink
Browse files
Refactored capturetool to capturemode and fixed some compile errors
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12697 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jan 7, 2010
1 parent ac51bd9 commit 595564639f013e3cc5c8810d93cf6560271ba129
Showing with 14 additions and 14 deletions.
  1. +8 −8 src/app/qgsmaptooladdfeature.cpp
  2. +3 −3 src/app/qgsmaptoolcapture.cpp
  3. +3 −3 src/app/qgsmaptoolcapture.h
@@ -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 )
{

}
@@ -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 )
@@ -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" ) );
@@ -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;
@@ -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;
@@ -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 )
{
@@ -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;

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

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

QgsPoint digitisedPoint;
@@ -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();
@@ -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;

0 comments on commit 5955646

Please sign in to comment.