Displaying all icons and labels on a map can make it messy and hard to read. Therefore, we need an algorithm to detect overlaps and hide icons and labels with lower priority.
The current overlap algorithm is too primitive and memory-intensive. It checks for overlaps by iterating over all objects for each object.
Proposed approach:
- Divide the plane into 4 rectangles.
- Subdivide each rectangle into 4 smaller rectangles.
- Repeat this process until a specified threshold is reached.
- Assign each object to the rectangle it belongs to.
- Check for overlaps only among objects within the same rectangle or neighboring rectangles.
Displaying all icons and labels on a map can make it messy and hard to read. Therefore, we need an algorithm to detect overlaps and hide icons and labels with lower priority.
The current overlap algorithm is too primitive and memory-intensive. It checks for overlaps by iterating over all objects for each object.
Proposed approach: