This patch, a work in progress, attempts to implement a proper, non-boundingbox, "Select overlapping" feature for UV mapping. Parts of this implementation were inspired by the comments on this patch here: D2865 -- namely the comment to use bvhtrees to detect the overlapping faces. Along the way I also needed to add multi-object support as well.
Unfortunately my implementation here does not work. If devtalk is a better place for this, you can find the discussion here which contains pictures of my UV map test cases for context:
https://devtalk.blender.org/t/implementing-select-overlapping-for-the-uv-editor-re-work-of-d2865/1553/2
The bvhtree approach seems to work, however it detects UV faces which are adjacent to each other (shared verts) and I've yet to find a way to easily exclude those without impacting real cases that can occur (see below). Basically there's a difference between a UV face which is adjacent but does not overlap (except for the shared edge) and a UV face which is adjacent and does overlap; I'm having trouble detecting the difference here. There's a TODO listed in the code below where I think I would have to deal with it.
Is the approach to use a bvhtree correct for this task?