Toggle navigation
Toggle navigation
This project
Loading...
Sign in
尹诚
/
Mapbox-iOS-SDK
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Thomas Rasch
13 years ago
Commit
e18aa0f3ec8dccceaf997d689b98770fe6dcf33a
1 parent
4073ada4
o Don't add unclusterable annotations to the cluster markers
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
MapView/Map/RMQuadTree.h
MapView/Map/RMQuadTree.m
MapView/Map/RMQuadTree.h
View file @
e18aa0f
...
...
@@ -53,7 +53,6 @@ typedef enum {
// Operations on this node and all subnodes
@property
(
nonatomic
,
readonly
)
NSArray
*
enclosedAnnotations
;
@property
(
nonatomic
,
readonly
)
NSUInteger
countEnclosedAnnotations
;
@property
(
nonatomic
,
readonly
)
NSArray
*
unclusteredAnnotations
;
@end
...
...
MapView/Map/RMQuadTree.m
View file @
e18aa0f
...
...
@@ -296,11 +296,6 @@
[
annotation
release
];
}
-
(
NSUInteger
)
countEnclosedAnnotations
{
return
[
self
.
enclosedAnnotations
count
];
}
-
(
NSArray
*
)
enclosedAnnotations
{
if
(
!
cachedEnclosedAnnotations
)
...
...
@@ -339,6 +334,18 @@
return
cachedUnclusteredAnnotations
;
}
-
(
NSArray
*
)
enclosedWithoutUnclusteredAnnotations
{
NSArray
*
unclusteredAnnotations
=
self
.
unclusteredAnnotations
;
if
(
!
unclusteredAnnotations
||
[
unclusteredAnnotations
count
]
==
0
)
return
self
.
enclosedAnnotations
;
NSMutableArray
*
enclosedAnnotations
=
[
NSMutableArray
arrayWithArray
:
self
.
enclosedAnnotations
];
[
enclosedAnnotations
removeObjectsInArray
:
unclusteredAnnotations
];
return
enclosedAnnotations
;
}
-
(
RMAnnotation
*
)
clusterAnnotation
{
return
cachedClusterAnnotation
;
...
...
@@ -360,14 +367,15 @@
{
if
(
createClusterAnnotations
)
{
double
halfWidth
=
boundingBox
.
size
.
width
/
2
.
0
;
double
halfWidth
=
boundingBox
.
size
.
width
/
2
.
0
;
BOOL
forceClustering
=
(
boundingBox
.
size
.
width
>=
clusterSize
.
width
&&
halfWidth
<
clusterSize
.
width
);
NSArray
*
enclosedAnnotations
=
nil
;
// Leaf clustering
if
(
!
forceClustering
&&
nodeType
==
nodeTypeLeaf
&&
[
annotations
count
]
>
1
)
if
(
forceClustering
==
NO
&&
nodeType
==
nodeTypeLeaf
&&
[
annotations
count
]
>
1
)
{
NSMutableArray
*
annotationsToCheck
=
[
NSMutableArray
arrayWithArray
:
self
.
enclosedAnnotations
];
NSMutableArray
*
annotationsToCheck
=
[
NSMutableArray
arrayWithArray
:
[
self
enclosedWithoutUnclusteredAnnotations
]
];
for
(
NSInteger
i
=
[
annotationsToCheck
count
]
-
1
;
i
>
0
;
--
i
)
{
...
...
@@ -394,7 +402,7 @@
}
}
forceClustering
=
[
annotationsToCheck
count
]
>
0
;
forceClustering
=
([
annotationsToCheck
count
]
>
0
)
;
if
(
forceClustering
)
{
...
...
@@ -411,7 +419,7 @@
if
(
forceClustering
)
{
if
(
!
enclosedAnnotations
)
enclosedAnnotations
=
self
.
enclosedAnnotations
;
enclosedAnnotations
=
[
self
enclosedWithoutUnclusteredAnnotations
]
;
@synchronized
(
cachedClusterAnnotation
)
{
...
...
Please
register
or
login
to post a comment