Skip to content

Commit bb9c89a

Browse files
author
timlinux
committedOct 24, 2008
qgsprovidercountcalcevent api cleanups
git-svn-id: http://svn.osgeo.org/qgis/trunk@9538 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent eca978f commit bb9c89a

8 files changed

+23
-23
lines changed
 

‎src/core/qgsprovidercountcalcevent.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
#include "qgsprovidercountcalcevent.h"
2121
#include "qgis.h"
2222

23-
QgsProviderCountCalcEvent::QgsProviderCountCalcEvent( long numberFeatures )
23+
QgsProviderCountCalcEvent::QgsProviderCountCalcEvent( long featuresCounted )
2424
: QEvent( static_cast<QEvent::Type>( QGis::ProviderCountCalcEvent ) ),
25-
n( numberFeatures )
25+
n( featuresCounted )
2626
{
2727
// NO-OP
2828
}
2929

3030

31-
long QgsProviderCountCalcEvent::numberFeatures() const
31+
long QgsProviderCountCalcEvent::featuresCounted() const
3232
{
3333
return n;
3434
}

‎src/core/qgsprovidercountcalcevent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ class CORE_EXPORT QgsProviderCountCalcEvent : public QEvent
4444

4545
public:
4646

47-
QgsProviderCountCalcEvent( long numberFeatures );
47+
QgsProviderCountCalcEvent( long featuresCounted );
4848

49-
long numberFeatures() const;
49+
long featuresCounted() const;
5050

5151

5252
private:

‎src/providers/ogr/qgsogrprovider.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ QgsOgrProvider::QgsOgrProvider( QString const & uri )
111111

112112
// getting the total number of features in the layer
113113
// TODO: This can be expensive, do we really need it!
114-
numberFeatures = OGR_L_GetFeatureCount( ogrLayer, TRUE );
114+
featuresCounted = OGR_L_GetFeatureCount( ogrLayer, TRUE );
115115

116116
// check the validity of the layer
117117

@@ -410,7 +410,7 @@ QGis::WkbType QgsOgrProvider::geometryType() const
410410
*/
411411
long QgsOgrProvider::featureCount() const
412412
{
413-
return numberFeatures;
413+
return featuresCounted;
414414
}
415415

416416
/**
@@ -549,7 +549,7 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )
549549
{
550550
f.setFeatureId( OGR_F_GetFID( feature ) );
551551
}
552-
++numberFeatures;
552+
++featuresCounted;
553553
OGR_F_Destroy( feature );
554554
return returnValue;
555555
}
@@ -568,7 +568,7 @@ bool QgsOgrProvider::addFeatures( QgsFeatureList & flist )
568568

569569
// flush features
570570
OGR_L_SyncToDisk( ogrLayer );
571-
numberFeatures = OGR_L_GetFeatureCount( ogrLayer, TRUE ); //new feature count
571+
featuresCounted = OGR_L_GetFeatureCount( ogrLayer, TRUE ); //new feature count
572572
return returnvalue;
573573
}
574574

@@ -758,7 +758,7 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds & id )
758758
QString layerName = fileName.section( '.', 0, 0 );
759759
QString sql = "REPACK " + layerName;
760760
OGR_DS_ExecuteSQL( ogrDataSource, sql.toLocal8Bit().data(), NULL, NULL );
761-
numberFeatures = OGR_L_GetFeatureCount( ogrLayer, TRUE ); //new feature count
761+
featuresCounted = OGR_L_GetFeatureCount( ogrLayer, TRUE ); //new feature count
762762
return returnvalue;
763763
}
764764

‎src/providers/ogr/qgsogrprovider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class QgsOgrProvider : public QgsVectorDataProvider
243243
//! Flag to indicate that spatial intersect should be used in selecting features
244244
bool mUseIntersect;
245245
int geomType;
246-
long numberFeatures;
246+
long featuresCounted;
247247

248248
//! Selection rectangle
249249
OGRGeometryH mSelectionRectangle;

‎src/providers/postgres/qgspostgrescountthread.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ void QgsPostgresCountThread::run()
9797
QgsDebugMsg( "QgsPostgresCountThread: Query completed." );
9898

9999

100-
numberFeatures = QString( PQgetvalue( result, 0, 0 ) ).toLong();
100+
featuresCounted = QString( PQgetvalue( result, 0, 0 ) ).toLong();
101101
PQclear( result );
102102

103-
QgsDebugMsg( QString( "QgsPostgresCountThread: Exact Number of features: %1" ).arg( numberFeatures ) );
103+
QgsDebugMsg( QString( "QgsPostgresCountThread: Exact Number of features: %1" ).arg( featuresCounted ) );
104104

105105

106106
// Send some events (instead of a signal) as it is thread-safe
@@ -111,7 +111,7 @@ void QgsPostgresCountThread::run()
111111

112112
QgsDebugMsg( QString( "About to create and dispatch event %1 to callback" ).arg( QGis::ProviderCountCalcEvent ) );
113113

114-
QgsProviderCountCalcEvent* e1 = new QgsProviderCountCalcEvent( numberFeatures );
114+
QgsProviderCountCalcEvent* e1 = new QgsProviderCountCalcEvent( featuresCounted );
115115
QApplication::postEvent(( QObject * )callbackObject, e1 );
116116

117117
// QApplication::postEvent(qApp->mainWidget(), e1);

‎src/providers/postgres/qgspostgrescountthread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class QgsPostgresCountThread : public QThread
120120
/**
121121
* Integer that contains the row count (including non-geometry rows) of the layer
122122
*/
123-
long numberFeatures;
123+
long featuresCounted;
124124

125125
};
126126

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
177177
if ( !getGeometryDetails() ) // gets srid and geometry type
178178
{
179179
// the table is not a geometry table
180-
numberFeatures = 0;
180+
featuresCounted = 0;
181181
valid = false;
182182

183183
QgsDebugMsg( "Invalid Postgres layer" );
@@ -686,7 +686,7 @@ QGis::WkbType QgsPostgresProvider::geometryType() const
686686
*/
687687
long QgsPostgresProvider::featureCount() const
688688
{
689-
return numberFeatures;
689+
return featuresCounted;
690690
}
691691

692692
const QgsField &QgsPostgresProvider::field( int index ) const
@@ -2209,11 +2209,11 @@ long QgsPostgresProvider::getFeatureCount()
22092209
QgsDebugMsg( "Approximate Number of features as text: " +
22102210
QString::fromUtf8( PQgetvalue( result, 0, 0 ) ) );
22112211

2212-
numberFeatures = QString::fromUtf8( PQgetvalue( result, 0, 0 ) ).toLong();
2212+
featuresCounted = QString::fromUtf8( PQgetvalue( result, 0, 0 ) ).toLong();
22132213

2214-
QgsDebugMsg( "Approximate Number of features: " + QString::number( numberFeatures ) );
2214+
QgsDebugMsg( "Approximate Number of features: " + QString::number( featuresCounted ) );
22152215

2216-
return numberFeatures;
2216+
return featuresCounted;
22172217
}
22182218

22192219
// TODO: use the estimateExtents procedure of PostGIS and PostgreSQL 8
@@ -2382,9 +2382,9 @@ void QgsPostgresProvider::customEvent( QEvent * e )
23822382

23832383
QgsDebugMsg( "count has been calculated" );
23842384

2385-
numberFeatures = (( QgsProviderCountCalcEvent* ) e )->numberFeatures();
2385+
featuresCounted = (( QgsProviderCountCalcEvent* ) e )->featuresCounted();
23862386

2387-
QgsDebugMsg( "count is " + QString::number( numberFeatures ) );
2387+
QgsDebugMsg( "count is " + QString::number( featuresCounted ) );
23882388

23892389
break;
23902390

‎src/providers/postgres/qgspostgresprovider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
405405
/**
406406
* Number of features in the layer
407407
*/
408-
long numberFeatures;
408+
long featuresCounted;
409409

410410
/**
411411
* Feature queue that GetNextFeature will retrieve from

0 commit comments

Comments
 (0)
Please sign in to comment.