[QGIS Commit] r12697 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Jan 7 14:03:15 EST 2010


Author: timlinux
Date: 2010-01-07 14:03:14 -0500 (Thu, 07 Jan 2010)
New Revision: 12697

Modified:
   trunk/qgis/src/app/qgsmaptooladdfeature.cpp
   trunk/qgis/src/app/qgsmaptoolcapture.cpp
   trunk/qgis/src/app/qgsmaptoolcapture.h
Log:
Refactored capturetool to capturemode and fixed some compile errors

Modified: trunk/qgis/src/app/qgsmaptooladdfeature.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptooladdfeature.cpp	2010-01-07 18:34:04 UTC (rev 12696)
+++ trunk/qgis/src/app/qgsmaptooladdfeature.cpp	2010-01-07 19:03:14 UTC (rev 12697)
@@ -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 @@
   }
 
   // POINT CAPTURING
-  if ( mTool == CapturePoint )
+  if ( mCaptureMode == CapturePoint )
   {
     //check we only use this tool for point/multipoint layers
     if ( vlayer->geometryType() != QGis::Point )
@@ -209,10 +209,10 @@
     }
 
   }
-  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" ) );
@@ -220,7 +220,7 @@
     }
 
     //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 @@
       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 @@
       }
 
       //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 @@
       int size;
       char end = QgsApplication::endian();
 
-      if ( mTool == CaptureLine )
+      if ( mCaptureMode == CaptureLine )
       {
         if ( layerWKBType == QGis::WKBLineString )
         {

Modified: trunk/qgis/src/app/qgsmaptoolcapture.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolcapture.cpp	2010-01-07 18:34:04 UTC (rev 12696)
+++ trunk/qgis/src/app/qgsmaptoolcapture.cpp	2010-01-07 19:03:14 UTC (rev 12697)
@@ -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 @@
 
   if ( !mRubberBand )
   {
-    mRubberBand = createRubberBand( mTool == CapturePolygon );
+    mRubberBand = createRubberBand( mCaptureMode == CapturePolygon );
   }
 
   QgsPoint digitisedPoint;

Modified: trunk/qgis/src/app/qgsmaptoolcapture.h
===================================================================
--- trunk/qgis/src/app/qgsmaptoolcapture.h	2010-01-07 18:34:04 UTC (rev 12696)
+++ trunk/qgis/src/app/qgsmaptoolcapture.h	2010-01-07 19:03:14 UTC (rev 12697)
@@ -31,7 +31,7 @@
 {
   public:
 
-    enum CaptureTool
+    enum CaptureMode
     {
       CapturePoint,
       CaptureLine,
@@ -39,7 +39,7 @@
     };
 
     //! constructor
-    QgsMapToolCapture( QgsMapCanvas* canvas, CaptureTool tool );
+    QgsMapToolCapture( QgsMapCanvas* canvas, CaptureMode tool );
 
     //! destructor
     virtual ~QgsMapToolCapture();
@@ -71,7 +71,7 @@
   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;



More information about the QGIS-commit mailing list