Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

public quadTree object - setQuadTree: method #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ClusterKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down
3 changes: 1 addition & 2 deletions ClusterKit/ClusterKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ FOUNDATION_EXPORT const unsigned char ClusterKitVersionString[];
#import <ClusterKit/CKGridBasedAlgorithm.h>
#import <ClusterKit/CKMap.h>
#import <ClusterKit/CKCluster.h>


#import <ClusterKit/CKQuadTree.h>
7 changes: 7 additions & 0 deletions ClusterKit/Core/CKClusterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#import "CKGridBasedAlgorithm.h"
#import "CKNonHierarchicalDistanceBasedAlgorithm.h"
#import <ClusterKit/CKQuadTree.h>

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -112,6 +113,11 @@ FOUNDATION_EXTERN const double kCKMarginFactorWorld;
*/
@property (nonatomic,copy) NSArray<id<MKAnnotation>> *annotations;

/**
Adds an external QuadTree used as annotations source
*/

- (void)setQuadTree:(id<CKAnnotationTree>) quadTree;
/**
Adds an annotation.

Expand Down Expand Up @@ -202,3 +208,4 @@ FOUNDATION_EXTERN const double kCKMarginFactorWorld;
@end

NS_ASSUME_NONNULL_END

6 changes: 6 additions & 0 deletions ClusterKit/Core/CKClusterManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ - (void)setAnnotations:(NSArray<id<MKAnnotation>> *)annotations {
[self updateClusters];
}

- (void)setQuadTree:(id<CKAnnotationTree>)quadTree {
_tree = quadTree;
_tree.delegate = self;
[self updateClusters];
}

- (NSArray<id<MKAnnotation>> *)annotations {
return self.tree ? self.tree.annotations : @[];
}
Expand Down