[QGIS Commit] r9538 - in trunk/qgis/src: core providers/ogr providers/postgres

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Oct 24 18:12:40 EDT 2008


Author: timlinux
Date: 2008-10-24 18:12:40 -0400 (Fri, 24 Oct 2008)
New Revision: 9538

Modified:
   trunk/qgis/src/core/qgsprovidercountcalcevent.cpp
   trunk/qgis/src/core/qgsprovidercountcalcevent.h
   trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
   trunk/qgis/src/providers/ogr/qgsogrprovider.h
   trunk/qgis/src/providers/postgres/qgspostgrescountthread.cpp
   trunk/qgis/src/providers/postgres/qgspostgrescountthread.h
   trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
   trunk/qgis/src/providers/postgres/qgspostgresprovider.h
Log:
qgsprovidercountcalcevent api cleanups

Modified: trunk/qgis/src/core/qgsprovidercountcalcevent.cpp
===================================================================
--- trunk/qgis/src/core/qgsprovidercountcalcevent.cpp	2008-10-24 21:59:32 UTC (rev 9537)
+++ trunk/qgis/src/core/qgsprovidercountcalcevent.cpp	2008-10-24 22:12:40 UTC (rev 9538)
@@ -20,15 +20,15 @@
 #include "qgsprovidercountcalcevent.h"
 #include "qgis.h"
 
-QgsProviderCountCalcEvent::QgsProviderCountCalcEvent( long numberFeatures )
+QgsProviderCountCalcEvent::QgsProviderCountCalcEvent( long featuresCounted )
     : QEvent( static_cast<QEvent::Type>( QGis::ProviderCountCalcEvent ) ),
-    n( numberFeatures )
+    n( featuresCounted )
 {
   // NO-OP
 }
 
 
-long QgsProviderCountCalcEvent::numberFeatures() const
+long QgsProviderCountCalcEvent::featuresCounted() const
 {
   return n;
 }

Modified: trunk/qgis/src/core/qgsprovidercountcalcevent.h
===================================================================
--- trunk/qgis/src/core/qgsprovidercountcalcevent.h	2008-10-24 21:59:32 UTC (rev 9537)
+++ trunk/qgis/src/core/qgsprovidercountcalcevent.h	2008-10-24 22:12:40 UTC (rev 9538)
@@ -44,9 +44,9 @@
 
   public:
 
-    QgsProviderCountCalcEvent( long numberFeatures );
+    QgsProviderCountCalcEvent( long featuresCounted );
 
-    long numberFeatures() const;
+    long featuresCounted() const;
 
 
   private:

Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.cpp	2008-10-24 21:59:32 UTC (rev 9537)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.cpp	2008-10-24 22:12:40 UTC (rev 9538)
@@ -111,7 +111,7 @@
 
     // getting the total number of features in the layer
     // TODO: This can be expensive, do we really need it!
-    numberFeatures = OGR_L_GetFeatureCount( ogrLayer, TRUE );
+    featuresCounted = OGR_L_GetFeatureCount( ogrLayer, TRUE );
 
     // check the validity of the layer
 
@@ -410,7 +410,7 @@
  */
 long QgsOgrProvider::featureCount() const
 {
-  return numberFeatures;
+  return featuresCounted;
 }
 
 /**
@@ -549,7 +549,7 @@
   {
     f.setFeatureId( OGR_F_GetFID( feature ) );
   }
-  ++numberFeatures;
+  ++featuresCounted;
   OGR_F_Destroy( feature );
   return returnValue;
 }
@@ -568,7 +568,7 @@
 
   // flush features
   OGR_L_SyncToDisk( ogrLayer );
-  numberFeatures = OGR_L_GetFeatureCount( ogrLayer, TRUE ); //new feature count
+  featuresCounted = OGR_L_GetFeatureCount( ogrLayer, TRUE ); //new feature count
   return returnvalue;
 }
 
@@ -758,7 +758,7 @@
   QString layerName = fileName.section( '.', 0, 0 );
   QString sql = "REPACK " + layerName;
   OGR_DS_ExecuteSQL( ogrDataSource, sql.toLocal8Bit().data(), NULL, NULL );
-  numberFeatures = OGR_L_GetFeatureCount( ogrLayer, TRUE ); //new feature count
+  featuresCounted = OGR_L_GetFeatureCount( ogrLayer, TRUE ); //new feature count
   return returnvalue;
 }
 

Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.h
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.h	2008-10-24 21:59:32 UTC (rev 9537)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.h	2008-10-24 22:12:40 UTC (rev 9538)
@@ -243,7 +243,7 @@
     //! Flag to indicate that spatial intersect should be used in selecting features
     bool mUseIntersect;
     int geomType;
-    long numberFeatures;
+    long featuresCounted;
 
     //! Selection rectangle
     OGRGeometryH mSelectionRectangle;

Modified: trunk/qgis/src/providers/postgres/qgspostgrescountthread.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgrescountthread.cpp	2008-10-24 21:59:32 UTC (rev 9537)
+++ trunk/qgis/src/providers/postgres/qgspostgrescountthread.cpp	2008-10-24 22:12:40 UTC (rev 9538)
@@ -97,10 +97,10 @@
   QgsDebugMsg( "QgsPostgresCountThread: Query completed." );
 
 
-  numberFeatures = QString( PQgetvalue( result, 0, 0 ) ).toLong();
+  featuresCounted = QString( PQgetvalue( result, 0, 0 ) ).toLong();
   PQclear( result );
 
-  QgsDebugMsg( QString( "QgsPostgresCountThread: Exact Number of features: %1" ).arg( numberFeatures ) );
+  QgsDebugMsg( QString( "QgsPostgresCountThread: Exact Number of features: %1" ).arg( featuresCounted ) );
 
 
   // Send some events (instead of a signal) as it is thread-safe
@@ -111,7 +111,7 @@
 
   QgsDebugMsg( QString( "About to create and dispatch event %1 to callback" ).arg( QGis::ProviderCountCalcEvent ) );
 
-  QgsProviderCountCalcEvent* e1 = new QgsProviderCountCalcEvent( numberFeatures );
+  QgsProviderCountCalcEvent* e1 = new QgsProviderCountCalcEvent( featuresCounted );
   QApplication::postEvent(( QObject * )callbackObject, e1 );
 
 //  QApplication::postEvent(qApp->mainWidget(), e1);

Modified: trunk/qgis/src/providers/postgres/qgspostgrescountthread.h
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgrescountthread.h	2008-10-24 21:59:32 UTC (rev 9537)
+++ trunk/qgis/src/providers/postgres/qgspostgrescountthread.h	2008-10-24 22:12:40 UTC (rev 9538)
@@ -120,7 +120,7 @@
     /**
      * Integer that contains the row count (including non-geometry rows) of the layer
      */
-    long numberFeatures;
+    long featuresCounted;
 
 };
 

Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2008-10-24 21:59:32 UTC (rev 9537)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.cpp	2008-10-24 22:12:40 UTC (rev 9538)
@@ -177,7 +177,7 @@
   if ( !getGeometryDetails() ) // gets srid and geometry type
   {
     // the table is not a geometry table
-    numberFeatures = 0;
+    featuresCounted = 0;
     valid = false;
 
     QgsDebugMsg( "Invalid Postgres layer" );
@@ -686,7 +686,7 @@
  */
 long QgsPostgresProvider::featureCount() const
 {
-  return numberFeatures;
+  return featuresCounted;
 }
 
 const QgsField &QgsPostgresProvider::field( int index ) const
@@ -2209,11 +2209,11 @@
   QgsDebugMsg( "Approximate Number of features as text: " +
                QString::fromUtf8( PQgetvalue( result, 0, 0 ) ) );
 
-  numberFeatures = QString::fromUtf8( PQgetvalue( result, 0, 0 ) ).toLong();
+  featuresCounted = QString::fromUtf8( PQgetvalue( result, 0, 0 ) ).toLong();
 
-  QgsDebugMsg( "Approximate Number of features: " + QString::number( numberFeatures ) );
+  QgsDebugMsg( "Approximate Number of features: " + QString::number( featuresCounted ) );
 
-  return numberFeatures;
+  return featuresCounted;
 }
 
 // TODO: use the estimateExtents procedure of PostGIS and PostgreSQL 8
@@ -2382,9 +2382,9 @@
 
       QgsDebugMsg( "count has been calculated" );
 
-      numberFeatures = (( QgsProviderCountCalcEvent* ) e )->numberFeatures();
+      featuresCounted = (( QgsProviderCountCalcEvent* ) e )->featuresCounted();
 
-      QgsDebugMsg( "count is " + QString::number( numberFeatures ) );
+      QgsDebugMsg( "count is " + QString::number( featuresCounted ) );
 
       break;
 

Modified: trunk/qgis/src/providers/postgres/qgspostgresprovider.h
===================================================================
--- trunk/qgis/src/providers/postgres/qgspostgresprovider.h	2008-10-24 21:59:32 UTC (rev 9537)
+++ trunk/qgis/src/providers/postgres/qgspostgresprovider.h	2008-10-24 22:12:40 UTC (rev 9538)
@@ -405,7 +405,7 @@
     /**
      * Number of features in the layer
      */
-    long numberFeatures;
+    long featuresCounted;
 
     /**
      * Feature queue that GetNextFeature will retrieve from



More information about the QGIS-commit mailing list