Skip to content

avoid infinit request/repaint loop in GPSMarkerTiler

Here is how we could end in an infinite loop (using fake coordinates):

  1. initial map rect ((-10, -5), (10, 5))
  2. TileGrouper calls prepareTiles and ((-10, -5), (10, 5)) is added to rectList
  3. after resizing and zooming map rect becomes ((-5, 3), (5, 8)) and TileGrouper calls prepareTiles
  4. in prepareTiles we find that this rect overlaps with the first and request the remaining ((-5, 5) (5, 8)) and add ((-5, 5),(5,8)) to the rectList
  5. newly requested images come back and from repaint we call TileGrouper which again calls prepareTiles, but we do not realize that we already requested the full rect but find the same overlap and the cycle begins again as this triggers repaint which triggers TileGrouper.

To fix this,

  1. in a first loop we go through all rects to find if we are contained in one.
  2. Remove rects which are contained in the current requested one.
  3. add the current requested rect to the list (not only the part which get requested newly)
  4. as an additional improvement we grow the rect by 5% such that during panning we don't have many subsequent requests.

Merge request reports