mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
parent
b601467d92
commit
25d9936df8
@ -57,6 +57,17 @@ class QgsVectorDataProvider : QgsDataProvider
|
||||
/** Bitmask of all provider's editing capabilities */
|
||||
static const int EditingCapabilities;
|
||||
|
||||
/**
|
||||
* Enumeration of feature count states
|
||||
*/
|
||||
enum FeatureCountState
|
||||
{
|
||||
//! Feature count not yet computed
|
||||
Uncounted = -2,
|
||||
//! Provider returned an unknown feature count
|
||||
UnknownCount = -1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor of the vector provider
|
||||
* @param uri uniform resource locator (URI) for a dataset
|
||||
|
@ -112,6 +112,17 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
|
||||
ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes |
|
||||
RenameAttributes;
|
||||
|
||||
/**
|
||||
* Enumeration of feature count states
|
||||
*/
|
||||
enum FeatureCountState
|
||||
{
|
||||
//! Feature count not yet computed
|
||||
Uncounted = -2,
|
||||
//! Provider returned an unknown feature count
|
||||
UnknownCount = -1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor of the vector provider
|
||||
* \param uri uniform resource locator (URI) for a dataset
|
||||
|
@ -378,7 +378,7 @@ QgsOgrProvider::QgsOgrProvider( QString const &uri )
|
||||
, ogrDriver( nullptr )
|
||||
, mValid( false )
|
||||
, mOGRGeomType( wkbUnknown )
|
||||
, mFeaturesCounted( -1 )
|
||||
, mFeaturesCounted( QgsVectorDataProvider::Uncounted )
|
||||
, mWriteAccess( false )
|
||||
, mWriteAccessPossible( false )
|
||||
, mDynamicWriteAccess( false )
|
||||
@ -450,7 +450,7 @@ bool QgsOgrProvider::setSubsetString( const QString &theSQL, bool updateFeatureC
|
||||
if ( !ogrDataSource )
|
||||
return false;
|
||||
|
||||
if ( theSQL == mSubsetString && mFeaturesCounted >= 0 )
|
||||
if ( theSQL == mSubsetString && mFeaturesCounted != QgsVectorDataProvider::Uncounted )
|
||||
return true;
|
||||
|
||||
OGRLayerH prevLayer = ogrLayer;
|
||||
@ -3300,7 +3300,7 @@ void QgsOgrProvider::recalculateFeatureCount()
|
||||
{
|
||||
if ( !ogrLayer )
|
||||
{
|
||||
mFeaturesCounted = 0;
|
||||
mFeaturesCounted = QgsVectorDataProvider::Uncounted;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3316,6 +3316,10 @@ void QgsOgrProvider::recalculateFeatureCount()
|
||||
if ( mOgrGeometryTypeFilter == wkbUnknown )
|
||||
{
|
||||
mFeaturesCounted = OGR_L_GetFeatureCount( ogrLayer, true );
|
||||
if ( mFeaturesCounted == -1 )
|
||||
{
|
||||
mFeaturesCounted = QgsVectorDataProvider::UnknownCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user