When removing items, we perform a two-pass removal, checking first
for the cached rectangle collision. Then, if we do not find the item
being removed, we perform a second, more expensive pass over the full
tree. This second pass is required as we cannot be certain that an
item's bbox has not been modified between insertion and deletion. In
which case, keeping stale pointers in the tree will lead to segfaults.
Fixes: lp:1777246
* https://bugs.launchpad.net/kicad/+bug/1777246
Connectivity searches were slow for large, complex boards. This was
partly due to the need to search all lists for possible connections
between anchors.
We remove this requirement by creating an RTree based on items' bounding
boxes similar to the PNS router. Then we get both the colliding items
and search forward/backward to see if there are connections between the
anchors and the other item.
Because we use RTree, we no longer need the maintenance overhead of multiple
item lists and an anchor list in the connectivity class.
Fixes: lp:1701791
* https://bugs.launchpad.net/kicad/+bug/1701791
Fixes: lp:1769408
* https://bugs.launchpad.net/kicad/+bug/1769408
Fixes: lp:1761989
* https://bugs.launchpad.net/kicad/+bug/1761989