From 5e1909fc91e87941ee61174ce2b632e4bdf9d0ea Mon Sep 17 00:00:00 2001 From: Jacopo Gasparetto Date: Thu, 21 Sep 2017 09:38:33 +0200 Subject: [PATCH] setQuadTree --- ClusterKit.xcodeproj/project.pbxproj | 2 +- ClusterKit/ClusterKit.h | 3 +-- ClusterKit/Core/CKClusterManager.h | 7 +++++++ ClusterKit/Core/CKClusterManager.m | 7 +++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ClusterKit.xcodeproj/project.pbxproj b/ClusterKit.xcodeproj/project.pbxproj index 53499c2..be3757b 100644 --- a/ClusterKit.xcodeproj/project.pbxproj +++ b/ClusterKit.xcodeproj/project.pbxproj @@ -17,7 +17,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 864fa87..d818c76 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. @@ -167,3 +173,4 @@ FOUNDATION_EXTERN const double kCKMarginFactorWorld; @end NS_ASSUME_NONNULL_END + diff --git a/ClusterKit/Core/CKClusterManager.m b/ClusterKit/Core/CKClusterManager.m index 045224f..56bc829 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 : @[]; } @@ -260,3 +266,4 @@ - (BOOL)annotationTree:(id)annotationTree shouldExtractAnnotat } @end +