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