3
3
from functools import partial
4
4
from typing import TYPE_CHECKING
5
5
6
- from qgis .core import QgsFeature , QgsFeatureRequest , QgsPointXY , QgsRectangle , QgsSpatialIndex , QgsVectorLayer
6
+ from qgis .core import QgsFeature , QgsFeatureRequest , QgsPointXY , QgsRectangle , QgsVectorLayer
7
7
from qgis .gui import QgsMapCanvas , QgsMapMouseEvent , QgsMapTool , QgsRubberBand
8
8
from qgis .PyQt .QtCore import QPoint , Qt , QTimer , pyqtSignal
9
9
from qgis .PyQt .QtGui import QColor
@@ -24,18 +24,12 @@ def __init__(self, canvas: QgsMapCanvas, layer_classes: list[PlanFeatureLayer]):
24
24
25
25
self .layer_classes = layer_classes
26
26
self .layers = [cls .get_from_project () for cls in layer_classes ]
27
- self .spatial_indexes : dict [str , QgsSpatialIndex ] = {}
28
27
29
28
self .highlighted : tuple [QgsFeature , str ] | None = None
30
29
self .highlight_rubber_band : QgsRubberBand | None = None
31
30
32
31
def activate (self ):
33
32
super ().activate ()
34
- self .rebuild_spatial_indexes ()
35
-
36
- def rebuild_spatial_indexes (self ):
37
- for layer in self .layers :
38
- self .spatial_indexes [layer .id ()] = QgsSpatialIndex (layer .getFeatures ())
39
33
40
34
def create_highlight_rubberband (self , feature : QgsFeature , layer : QgsVectorLayer ):
41
35
self .highlight_rubber_band = QgsRubberBand (self .canvas , layer .geometryType ())
0 commit comments