mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Improve docs and python bindings for feature count
This commit is contained in:
parent
d452f7f21e
commit
ed747edc94
@ -843,9 +843,17 @@ Return the provider type for this layer
|
||||
|
||||
bool countSymbolFeatures();
|
||||
%Docstring
|
||||
Count features for symbols. Feature counts may be get by featureCount().
|
||||
\param showProgress show progress dialog
|
||||
:return: true if calculated, false if failed or was canceled by user
|
||||
Count features for symbols.
|
||||
The method will return immediately. You will need to connect to the
|
||||
symbolFeatureCountMapChanged() signal to be notified when the freshly updated
|
||||
feature counts are ready.
|
||||
|
||||
.. note::
|
||||
|
||||
If you need to wait for the results, create and start your own QgsVectorLayerFeatureCounter
|
||||
task and call waitForFinished().
|
||||
|
||||
.. versionadded:: 3.0
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
|
@ -32,6 +32,13 @@ class QgsVectorLayerFeatureCounter : QgsTask
|
||||
virtual bool run();
|
||||
|
||||
|
||||
long featureCount( const QString &legendKey ) const;
|
||||
%Docstring
|
||||
Get the feature count for a particular ``legendKey``.
|
||||
If the key has not been found, -1 will be returned.
|
||||
:rtype: long
|
||||
%End
|
||||
|
||||
signals:
|
||||
|
||||
void symbolsCounted();
|
||||
|
@ -807,9 +807,15 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
|
||||
void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false );
|
||||
|
||||
/**
|
||||
* Count features for symbols. Feature counts may be get by featureCount().
|
||||
* \param showProgress show progress dialog
|
||||
* \returns true if calculated, false if failed or was canceled by user
|
||||
* Count features for symbols.
|
||||
* The method will return immediately. You will need to connect to the
|
||||
* symbolFeatureCountMapChanged() signal to be notified when the freshly updated
|
||||
* feature counts are ready.
|
||||
*
|
||||
* \note If you need to wait for the results, create and start your own QgsVectorLayerFeatureCounter
|
||||
* task and call waitForFinished().
|
||||
*
|
||||
* \since This is asynchroneous since QGIS 3.0
|
||||
*/
|
||||
bool countSymbolFeatures();
|
||||
|
||||
|
@ -77,3 +77,8 @@ QHash<QString, long> QgsVectorLayerFeatureCounter::symbolFeatureCountMap() const
|
||||
{
|
||||
return mSymbolFeatureCountMap;
|
||||
}
|
||||
|
||||
long QgsVectorLayerFeatureCounter::featureCount( const QString &legendKey ) const
|
||||
{
|
||||
return mSymbolFeatureCountMap.value( legendKey, -1 );
|
||||
}
|
||||
|
@ -36,6 +36,12 @@ class CORE_EXPORT QgsVectorLayerFeatureCounter : public QgsTask
|
||||
*/
|
||||
QHash<QString, long> symbolFeatureCountMap() const SIP_SKIP;
|
||||
|
||||
/**
|
||||
* Get the feature count for a particular \a legendKey.
|
||||
* If the key has not been found, -1 will be returned.
|
||||
*/
|
||||
long featureCount( const QString &legendKey ) const;
|
||||
|
||||
signals:
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user