Class: QgsVectorLayerFeatureCounter¶
-
class
qgis.core.
QgsVectorLayerFeatureCounter
(layer: QgsVectorLayer, context: QgsExpressionContext = QgsExpressionContext(), storeSymbolFids: bool = False)¶ Bases:
QgsTask
Create a new feature counter for
layer
.- Parameters
layer (QgsVectorLayer) – Target
QgsVectorLayer
to perform counting on.context (
QgsExpressionContext
= QgsExpressionContext()) – SpecificQgsExpressionContext
to use during the rendering step.storeSymbolFids (bool = False) – If
True
will store the feature ids (fids), otherwise will only count the number of features per symbol. DefaultFalse
.
Counts the features in a
QgsVectorLayer
in task. You should most likely not use this directly and instead call QgsVectorLayer.countSymbolFeatures() and connect to the signalQgsVectorLayer.symbolFeatureCountMapChanged()
Methods
Returns the feature count for a particular
legendKey
.Returns the feature Ids for a particular
legendKey
.Calculates the feature count and Ids per symbol
Signals
Emitted when the symbols have been counted.
-
childEvent
()¶
-
connectNotify
()¶
-
customEvent
()¶
-
disconnectNotify
()¶
-
featureCount
(self, legendKey: str) → int¶ Returns the feature count for a particular
legendKey
. If the key has not been found, -1 will be returned.- Parameters
legendKey (str) –
- Return type
int
-
featureIds
(self, symbolkey: str) → object¶ Returns the feature Ids for a particular
legendKey
. If the key has not been found an empty QSet will be returned.New in version 3.10.
- Parameters
symbolkey (str) –
- Return type
object
-
finished
()¶
-
isCanceled
()¶
-
isSignalConnected
()¶
-
receivers
()¶
-
run
(self) → bool¶ Calculates the feature count and Ids per symbol
- Return type
bool
-
sender
()¶
-
senderSignalIndex
()¶
-
setProgress
()¶
-
symbolsCounted
¶ Emitted when the symbols have been counted. [signal]
-
timerEvent
()¶