Instead of calculating feature count (which may add extra overhead),
let's directly try to build index for layers. Only when a certain limit
of features is reached (currently 1 million), the indexing is cancelled
and layer is marked as non-indexable.
The maintenance of three R-trees was too complicated, using a lot of memory
and the performance benefit was questionable :)
The approach with just one R-tree leads to much simpler code
Removed k-NN queries in the process - they were not used in QGIS code. They can be
reintroduced later, but there is not much use for them right now...