|
@@ -25,7 +25,12 @@ |
|
@@ -25,7 +25,12 @@ |
25
|
- (void)addAnnotation:(RMAnnotation *)annotation;
|
25
|
- (void)addAnnotation:(RMAnnotation *)annotation;
|
26
|
- (void)removeAnnotation:(RMAnnotation *)annotation;
|
26
|
- (void)removeAnnotation:(RMAnnotation *)annotation;
|
27
|
|
27
|
|
28
|
-- (void)addAnnotationsInBoundingBox:(RMProjectedRect)aBoundingBox toMutableArray:(NSMutableArray *)someArray createClusterAnnotations:(BOOL)createClusterAnnotations withClusterSize:(RMProjectedSize)clusterSize findGravityCenter:(BOOL)findGravityCenter;
|
28
|
+- (void)addAnnotationsInBoundingBox:(RMProjectedRect)aBoundingBox
|
|
|
29
|
+ toMutableArray:(NSMutableArray *)someArray
|
|
|
30
|
+ createClusterAnnotations:(BOOL)createClusterAnnotations
|
|
|
31
|
+ withProjectedClusterSize:(RMProjectedSize)clusterSize
|
|
|
32
|
+ andProjectedClusterMarkerSize:(RMProjectedSize)clusterMarkerSize
|
|
|
33
|
+ findGravityCenter:(BOOL)findGravityCenter;
|
29
|
|
34
|
|
30
|
- (void)removeUpwardsAllCachedClusterAnnotations;
|
35
|
- (void)removeUpwardsAllCachedClusterAnnotations;
|
31
|
|
36
|
|
|
@@ -363,7 +368,12 @@ |
|
@@ -363,7 +368,12 @@ |
363
|
return clusteredAnnotations;
|
368
|
return clusteredAnnotations;
|
364
|
}
|
369
|
}
|
365
|
|
370
|
|
366
|
-- (void)addAnnotationsInBoundingBox:(RMProjectedRect)aBoundingBox toMutableArray:(NSMutableArray *)someArray createClusterAnnotations:(BOOL)createClusterAnnotations withClusterSize:(RMProjectedSize)clusterSize findGravityCenter:(BOOL)findGravityCenter
|
371
|
+- (void)addAnnotationsInBoundingBox:(RMProjectedRect)aBoundingBox
|
|
|
372
|
+ toMutableArray:(NSMutableArray *)someArray
|
|
|
373
|
+ createClusterAnnotations:(BOOL)createClusterAnnotations
|
|
|
374
|
+ withProjectedClusterSize:(RMProjectedSize)clusterSize
|
|
|
375
|
+ andProjectedClusterMarkerSize:(RMProjectedSize)clusterMarkerSize
|
|
|
376
|
+ findGravityCenter:(BOOL)findGravityCenter
|
367
|
{
|
377
|
{
|
368
|
if (createClusterAnnotations)
|
378
|
if (createClusterAnnotations)
|
369
|
{
|
379
|
{
|
|
@@ -455,16 +465,17 @@ |
|
@@ -455,16 +465,17 @@ |
455
|
averageX /= (double)enclosedAnnotationsCount;
|
465
|
averageX /= (double)enclosedAnnotationsCount;
|
456
|
averageY /= (double) enclosedAnnotationsCount;
|
466
|
averageY /= (double) enclosedAnnotationsCount;
|
457
|
|
467
|
|
458
|
- double halfClusterWidth = clusterSize.width / 2.0, halfClusterHeight = clusterSize.height / 2.0;
|
468
|
+ double halfClusterMarkerWidth = clusterMarkerSize.width / 2.0,
|
|
|
469
|
+ halfClusterMarkerHeight = clusterMarkerSize.height / 2.0;
|
459
|
|
470
|
|
460
|
- if (averageX - halfClusterWidth < boundingBox.origin.x)
|
|
|
461
|
- averageX = boundingBox.origin.x + halfClusterWidth;
|
|
|
462
|
- if (averageX + halfClusterWidth > boundingBox.origin.x + boundingBox.size.width)
|
|
|
463
|
- averageX = boundingBox.origin.x + boundingBox.size.width - halfClusterWidth;
|
|
|
464
|
- if (averageY - halfClusterHeight < boundingBox.origin.y)
|
|
|
465
|
- averageY = boundingBox.origin.y + halfClusterHeight;
|
|
|
466
|
- if (averageY + halfClusterHeight > boundingBox.origin.y + boundingBox.size.height)
|
|
|
467
|
- averageY = boundingBox.origin.y + boundingBox.size.height - halfClusterHeight;
|
471
|
+ if (averageX - halfClusterMarkerWidth < boundingBox.origin.x)
|
|
|
472
|
+ averageX = boundingBox.origin.x + halfClusterMarkerWidth;
|
|
|
473
|
+ if (averageX + halfClusterMarkerWidth > boundingBox.origin.x + boundingBox.size.width)
|
|
|
474
|
+ averageX = boundingBox.origin.x + boundingBox.size.width - halfClusterMarkerWidth;
|
|
|
475
|
+ if (averageY - halfClusterMarkerHeight < boundingBox.origin.y)
|
|
|
476
|
+ averageY = boundingBox.origin.y + halfClusterMarkerHeight;
|
|
|
477
|
+ if (averageY + halfClusterMarkerHeight > boundingBox.origin.y + boundingBox.size.height)
|
|
|
478
|
+ averageY = boundingBox.origin.y + boundingBox.size.height - halfClusterMarkerHeight;
|
468
|
|
479
|
|
469
|
// TODO: anchorPoint
|
480
|
// TODO: anchorPoint
|
470
|
clusterMarkerPosition = RMProjectedPointMake(averageX, averageY);
|
481
|
clusterMarkerPosition = RMProjectedPointMake(averageX, averageY);
|
|
@@ -515,13 +526,13 @@ |
|
@@ -515,13 +526,13 @@ |
515
|
}
|
526
|
}
|
516
|
|
527
|
|
517
|
if (RMProjectedRectIntersectsProjectedRect(aBoundingBox, northWestBoundingBox))
|
528
|
if (RMProjectedRectIntersectsProjectedRect(aBoundingBox, northWestBoundingBox))
|
518
|
- [northWest addAnnotationsInBoundingBox:aBoundingBox toMutableArray:someArray createClusterAnnotations:createClusterAnnotations withClusterSize:clusterSize findGravityCenter:findGravityCenter];
|
529
|
+ [northWest addAnnotationsInBoundingBox:aBoundingBox toMutableArray:someArray createClusterAnnotations:createClusterAnnotations withProjectedClusterSize:clusterSize andProjectedClusterMarkerSize:clusterMarkerSize findGravityCenter:findGravityCenter];
|
519
|
if (RMProjectedRectIntersectsProjectedRect(aBoundingBox, northEastBoundingBox))
|
530
|
if (RMProjectedRectIntersectsProjectedRect(aBoundingBox, northEastBoundingBox))
|
520
|
- [northEast addAnnotationsInBoundingBox:aBoundingBox toMutableArray:someArray createClusterAnnotations:createClusterAnnotations withClusterSize:clusterSize findGravityCenter:findGravityCenter];
|
531
|
+ [northEast addAnnotationsInBoundingBox:aBoundingBox toMutableArray:someArray createClusterAnnotations:createClusterAnnotations withProjectedClusterSize:clusterSize andProjectedClusterMarkerSize:clusterMarkerSize findGravityCenter:findGravityCenter];
|
521
|
if (RMProjectedRectIntersectsProjectedRect(aBoundingBox, southWestBoundingBox))
|
532
|
if (RMProjectedRectIntersectsProjectedRect(aBoundingBox, southWestBoundingBox))
|
522
|
- [southWest addAnnotationsInBoundingBox:aBoundingBox toMutableArray:someArray createClusterAnnotations:createClusterAnnotations withClusterSize:clusterSize findGravityCenter:findGravityCenter];
|
533
|
+ [southWest addAnnotationsInBoundingBox:aBoundingBox toMutableArray:someArray createClusterAnnotations:createClusterAnnotations withProjectedClusterSize:clusterSize andProjectedClusterMarkerSize:clusterMarkerSize findGravityCenter:findGravityCenter];
|
523
|
if (RMProjectedRectIntersectsProjectedRect(aBoundingBox, southEastBoundingBox))
|
534
|
if (RMProjectedRectIntersectsProjectedRect(aBoundingBox, southEastBoundingBox))
|
524
|
- [southEast addAnnotationsInBoundingBox:aBoundingBox toMutableArray:someArray createClusterAnnotations:createClusterAnnotations withClusterSize:clusterSize findGravityCenter:findGravityCenter];
|
535
|
+ [southEast addAnnotationsInBoundingBox:aBoundingBox toMutableArray:someArray createClusterAnnotations:createClusterAnnotations withProjectedClusterSize:clusterSize andProjectedClusterMarkerSize:clusterMarkerSize findGravityCenter:findGravityCenter];
|
525
|
|
536
|
|
526
|
@synchronized (annotations)
|
537
|
@synchronized (annotations)
|
527
|
{
|
538
|
{
|
|
@@ -616,16 +627,16 @@ |
|
@@ -616,16 +627,16 @@ |
616
|
|
627
|
|
617
|
- (NSArray *)annotationsInProjectedRect:(RMProjectedRect)boundingBox
|
628
|
- (NSArray *)annotationsInProjectedRect:(RMProjectedRect)boundingBox
|
618
|
{
|
629
|
{
|
619
|
- return [self annotationsInProjectedRect:boundingBox createClusterAnnotations:NO withClusterSize:RMProjectedSizeMake(0.0, 0.0) findGravityCenter:NO];
|
630
|
+ return [self annotationsInProjectedRect:boundingBox createClusterAnnotations:NO withProjectedClusterSize:RMProjectedSizeMake(0.0, 0.0) andProjectedClusterMarkerSize:RMProjectedSizeMake(0.0, 0.0) findGravityCenter:NO];
|
620
|
}
|
631
|
}
|
621
|
|
632
|
|
622
|
-- (NSArray *)annotationsInProjectedRect:(RMProjectedRect)boundingBox createClusterAnnotations:(BOOL)createClusterAnnotations withClusterSize:(RMProjectedSize)clusterSize findGravityCenter:(BOOL)findGravityCenter
|
633
|
+- (NSArray *)annotationsInProjectedRect:(RMProjectedRect)boundingBox createClusterAnnotations:(BOOL)createClusterAnnotations withProjectedClusterSize:(RMProjectedSize)clusterSize andProjectedClusterMarkerSize:(RMProjectedSize)clusterMarkerSize findGravityCenter:(BOOL)findGravityCenter
|
623
|
{
|
634
|
{
|
624
|
NSMutableArray *annotations = [NSMutableArray array];
|
635
|
NSMutableArray *annotations = [NSMutableArray array];
|
625
|
|
636
|
|
626
|
@synchronized (self)
|
637
|
@synchronized (self)
|
627
|
{
|
638
|
{
|
628
|
- [rootNode addAnnotationsInBoundingBox:boundingBox toMutableArray:annotations createClusterAnnotations:createClusterAnnotations withClusterSize:clusterSize findGravityCenter:findGravityCenter];
|
639
|
+ [rootNode addAnnotationsInBoundingBox:boundingBox toMutableArray:annotations createClusterAnnotations:createClusterAnnotations withProjectedClusterSize:clusterSize andProjectedClusterMarkerSize:clusterMarkerSize findGravityCenter:findGravityCenter];
|
629
|
}
|
640
|
}
|
630
|
|
641
|
|
631
|
return annotations;
|
642
|
return annotations;
|