Skip to content

Commit

Permalink
bugfix - handle raster layer when getting features
Browse files Browse the repository at this point in the history
  • Loading branch information
oobayly committed Jan 13, 2020
1 parent 710b65d commit f37b6e6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions OpenScope/utilities/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
QgsDistanceArea,
QgsFeature,
QgsGeometry,
QgsMapLayer,
QgsProject,
QgsWkbTypes
)
Expand Down Expand Up @@ -177,11 +178,16 @@ def _getSelectedFeatures():
"""Gets all the selected features"""
features = []

for layer in QgsProject.instance().layerTreeRoot().findLayers():
if not layer.layer().selectedFeatureCount():
for item in QgsProject.instance().layerTreeRoot().findLayers():
layer = item.layer()

if layer.type() != QgsMapLayer.VectorLayer:
continue

if not layer.selectedFeatureCount():
continue

features.extend(layer.layer().selectedFeatures())
features.extend(layer.selectedFeatures())

return features

Expand Down

0 comments on commit f37b6e6

Please sign in to comment.