diff --git a/ClusterKit.xcodeproj/project.pbxproj b/ClusterKit.xcodeproj/project.pbxproj index 290a042..d3b7862 100644 --- a/ClusterKit.xcodeproj/project.pbxproj +++ b/ClusterKit.xcodeproj/project.pbxproj @@ -18,7 +18,7 @@ 9C53CD201E03F51C000AD9B8 /* CKClusterManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C53CD0B1E03F51C000AD9B8 /* CKClusterManager.m */; }; 9C53CD211E03F51C000AD9B8 /* CKMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C53CD0C1E03F51C000AD9B8 /* CKMap.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9C53CD221E03F51C000AD9B8 /* CKAnnotationTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C53CD0E1E03F51C000AD9B8 /* CKAnnotationTree.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C53CD231E03F51C000AD9B8 /* CKQuadTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C53CD0F1E03F51C000AD9B8 /* CKQuadTree.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 9C53CD231E03F51C000AD9B8 /* CKQuadTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C53CD0F1E03F51C000AD9B8 /* CKQuadTree.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9C53CD241E03F51C000AD9B8 /* CKQuadTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C53CD101E03F51C000AD9B8 /* CKQuadTree.m */; }; 9C53CD291E03F51C000AD9B8 /* MKMapView+ClusterKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C53CD171E03F51C000AD9B8 /* MKMapView+ClusterKit.h */; settings = {ATTRIBUTES = (Private, ); }; }; 9C53CD2A1E03F51C000AD9B8 /* MKMapView+ClusterKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C53CD181E03F51C000AD9B8 /* MKMapView+ClusterKit.m */; }; diff --git a/ClusterKit/ClusterKit.h b/ClusterKit/ClusterKit.h index 8b2f8fc..9f1a84c 100644 --- a/ClusterKit/ClusterKit.h +++ b/ClusterKit/ClusterKit.h @@ -35,5 +35,4 @@ FOUNDATION_EXPORT const unsigned char ClusterKitVersionString[]; #import #import #import - - +#import diff --git a/ClusterKit/Core/CKClusterManager.h b/ClusterKit/Core/CKClusterManager.h index 3de5de5..06cf873 100644 --- a/ClusterKit/Core/CKClusterManager.h +++ b/ClusterKit/Core/CKClusterManager.h @@ -24,6 +24,7 @@ #import "CKGridBasedAlgorithm.h" #import "CKNonHierarchicalDistanceBasedAlgorithm.h" +#import NS_ASSUME_NONNULL_BEGIN @@ -112,6 +113,11 @@ FOUNDATION_EXTERN const double kCKMarginFactorWorld; */ @property (nonatomic,copy) NSArray> *annotations; +/** + Adds an external QuadTree used as annotations source + */ + +- (void)setQuadTree:(id) quadTree; /** Adds an annotation. @@ -202,3 +208,4 @@ FOUNDATION_EXTERN const double kCKMarginFactorWorld; @end NS_ASSUME_NONNULL_END + diff --git a/ClusterKit/Core/CKClusterManager.m b/ClusterKit/Core/CKClusterManager.m index 5f3fb75..b6aaf91 100644 --- a/ClusterKit/Core/CKClusterManager.m +++ b/ClusterKit/Core/CKClusterManager.m @@ -105,6 +105,12 @@ - (void)setAnnotations:(NSArray> *)annotations { [self updateClusters]; } +- (void)setQuadTree:(id)quadTree { + _tree = quadTree; + _tree.delegate = self; + [self updateClusters]; +} + - (NSArray> *)annotations { return self.tree ? self.tree.annotations : @[]; }