I am developing a QGIS plugin in python.
I need to allow the user to select multiple features of the current active layer using an extent.
I am using this code to do that:
self.iface.activeLayer().selectByRect(extent)
selectedFeaturesList = list(self.iface.activeLayer().selectedFeatures())
The problem is my layer is categorized depending on an attribute, and sometimes the user shows/hides some of these categories. And I want the plugin to select only visible features.
So what I want is something like:
for feat in selectedFeaturesList:
if feat.isVisible():
visibleSelectedFeatures.append(feat)
I have searched a lot and couldn't find any way to determine the QgsFeature visibility.