0

I use MapView and need to display complex pins on it. I add pin on map using addView() with MapView.LayoutParams with MODE_MAP. So, views on map moving with map.

I add about 20 pins and when I reduce map zoom, pins overlap each other.

How can I merge overlapping pins in one pin?

UPD 1:

For each pin I know rect which it place on MapView. There is fast algorithm to find rects overlapping?

Nik
  • 7,114
  • 8
  • 51
  • 75

1 Answers1

0

You can test reactangle overlaping with:

Rect rect1, rect2;
if(rect1.intersect(rect2)
  //do something

On this message is a nice algothim to merge pins when they overlap: Merging Pins

good luck.

Community
  • 1
  • 1
Luis
  • 11,978
  • 3
  • 27
  • 35
  • Merging Pins algoritm not applicable for my case, I can not override draw method i.e. I not use overlay for adding items to map. rect1.intersect(rect2) - I know this method, but I need test 20 or more (up to 200) rects overlaping and I need fast algoritm for it. – Nik Oct 05 '12 at 06:20