hulab / ClusterKit

An iOS map clustering framework targeting MapKit, Google Maps and Mapbox.
MIT License
512 stars 86 forks source link

public quadTree object - setQuadTree: method #24

Open jacogasp opened 7 years ago

jacogasp commented 7 years ago

quadTree.h header now public. Method setQuadTree: for clusterManager to specify which quadTree it should use.

How to use: create a quadTree object and fill it with an annotationsArray

var quadTree = CKQuadTree()
quadTree = CKQuadTree(annotations: annotationsArray)

Then, instead to set the clusterManager annotations, set the quadTree

let algorithm = CKNonHierarchicalDistanceBasedAlgorithm()
algorithm.cellSize = 300
mapView.clusterManager.algorithm = algorithm
mapView.clusterManager.marginFactor = 1
mapView.clusterManager.setQuadTree(quadTree)

Use the clusterManager as usual, but query the quadTree to get annotations in a certain area

let annotationsInRect = quadTree.annotations(in: rect)
jacogasp commented 5 years ago

Hello @maxep, I see you tried to push this branch two time.

At this point, this branch is open since two years. What are the plans for it?