mousebird-consulting-inc / WhirlyGlobe

WhirlyGlobe Development
Other
828 stars 255 forks source link

Selection of a cluster #976

Closed ChrisLowe-Takor closed 6 years ago

ChrisLowe-Takor commented 7 years ago

I've been playing around with clustering which by the way is amazing! Over 50k points with terrific performance. Very impressive stuff.

The blog post mentions this on cluster selection:

Selection works too. If the user taps on a cluster group, you get all the individual markers back. They're tagged as part of a group too.

When I tap on a cluster it triggers the didSelect method of the MaplyViewControllerDelegate like so:

func maplyViewController(_ viewC: MaplyViewController, didSelect selectedObj: NSObject, atLoc coord: WGCoordinate, onScreen screenPt: CGPoint)

and the selectedObj is of type MaplyScreenMarker. I've tried accessing the user object (which is nil) and everything else I can think of. What I need is the number of points in that cluster, or better yet an array of the individual markers.

Can someone point me in the right direction. Is there a different delegate method I should be using or something I'm not seeing in MaplyScreenObject that I can use?

mousebird commented 7 years ago

There's another delegate to get back more than one selected object. Fill out that one and you'll get an array of them.