BMKClusterManager.m 887 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // BMKClusterManager.m
  3. // IphoneMapSdkDemo
  4. //
  5. // Created by wzy on 15/9/15.
  6. // Copyright © 2015年 Baidu. All rights reserved.
  7. //
  8. #import "BMKClusterManager.h"
  9. @interface BMKClusterManager () {
  10. BMKClusterAlgorithm *_algorithm;
  11. }
  12. @end
  13. @implementation BMKClusterManager
  14. - (id)init {
  15. self = [super init];
  16. if (self) {
  17. _algorithm = [[BMKClusterAlgorithm alloc] init];
  18. }
  19. return self;
  20. }
  21. ///添加item
  22. - (void)addClusterItem:(BMKClusterItem*)clusterItem {
  23. @synchronized(_algorithm) {
  24. [_algorithm addItem:clusterItem];
  25. }
  26. }
  27. ///清除items
  28. - (void)clearClusterItems {
  29. @synchronized(_algorithm) {
  30. [_algorithm clearItems];
  31. }
  32. }
  33. /**
  34. * 获取聚合后的标注
  35. * @param zoomLevel map的级别
  36. * @return BMKCluster数组
  37. */
  38. - (NSArray*)getClusters:(CGFloat) zoomLevel {
  39. return [_algorithm getClusters:zoomLevel];
  40. }
  41. @end