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
1fedfba82272d846ccdd76cd77cda66489f58b91
1 parent
30bf2276
o Updated the MarkerMurder sample app with clustering
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
11 deletions
samples/MarkerMurder/Classes/MainViewController.m
samples/MarkerMurder/Classes/MainViewController.m
View file @
1fedfba
...
...
@@ -41,7 +41,6 @@
UIImage
*
redMarkerImage
=
[
UIImage
imageNamed
:
@"marker-red.png"
];
UIImage
*
blueMarkerImage
=
[
UIImage
imageNamed
:
@"marker-blue.png"
];
UIImage
*
xMarkerImage
=
[
UIImage
imageNamed
:
@"marker-X.png"
];
markerPosition
.
latitude
=
center
.
latitude
-
((
kNumberRows
-
1
)
/
2
.
0
*
kSpacing
);
int
i
,
j
;
...
...
@@ -51,23 +50,25 @@
for
(
j
=
0
;
j
<
kNumberColumns
;
j
++
)
{
markerPosition
.
longitude
+=
kSpacing
;
NSLog
(
@"Add marker @ {%f,%f}"
,
markerPosition
.
longitude
,
markerPosition
.
latitude
);
RMAnnotation
*
annotation
=
[
RMAnnotation
annotationWithMapView
:
mapView
coordinate
:
markerPosition
andTitle
:[
NSString
stringWithFormat
:
@"%4.1f"
,
markerPosition
.
longitude
]];
if
((
markerPosition
.
longitude
<
-
180
)
||
(
markerPosition
.
longitude
>
0
))
{
if
((
markerPosition
.
longitude
<
-
180
)
||
(
markerPosition
.
longitude
>
0
))
{
annotation
.
annotationIcon
=
redMarkerImage
;
annotation
.
anchorPoint
=
CGPointMake
(
0
.
5
,
1
.
0
);
}
else
{
}
else
{
annotation
.
annotationIcon
=
blueMarkerImage
;
annotation
.
anchorPoint
=
CGPointMake
(
0
.
5
,
1
.
0
);
}
[
mapView
addAnnotation
:
annotation
];
annotation
=
[
RMAnnotation
annotationWithMapView
:
mapView
coordinate
:
markerPosition
andTitle
:
nil
];
annotation
.
annotationIcon
=
xMarkerImage
;
annotation
.
anchorPoint
=
CGPointMake
(
0
.
5
,
0
.
5
);
[
mapView
addAnnotation
:
annotation
];
}
markerPosition
.
latitude
+=
kSpacing
;
}
}
...
...
@@ -76,8 +77,10 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
mapView
setDelegate
:
self
];
mapView
.
tileSource
=
[[[
RMOpenStreetMapSource
alloc
]
init
]
autorelease
];
mapView
.
enableClustering
=
YES
;
center
.
latitude
=
47
.
5635
;
center
.
longitude
=
10
.
20981
;
...
...
@@ -135,15 +138,25 @@
[
self
updateInfo
];
}
-
(
void
)
tapOnAnnotation
:
(
RMAnnotation
*
)
annotation
onMap
:
(
RMMapView
*
)
map
{
if
([
annotation
.
annotationType
isEqualToString
:
kRMClusterAnnotationTypeName
])
{
[
map
zoomInToNextNativeZoomAt
:[
map
coordinateToPixel
:
annotation
.
coordinate
]
animated
:
YES
];
}
}
-
(
RMMapLayer
*
)
mapView
:
(
RMMapView
*
)
mapView
layerForAnnotation
:
(
RMAnnotation
*
)
annotation
{
RMMarker
*
marker
=
nil
;
if
([
annotation
.
annotationType
isEqualToString
:
kRMClusterAnnotationTypeName
])
{
if
([
annotation
.
annotationType
isEqualToString
:
kRMClusterAnnotationTypeName
])
{
marker
=
[[[
RMMarker
alloc
]
initWithUIImage
:[
UIImage
imageNamed
:
@"marker-blue.png"
]
anchorPoint
:
annotation
.
anchorPoint
]
autorelease
];
if
(
annotation
.
title
)
[
marker
changeLabelUsingText
:
annotation
.
title
];
}
else
{
}
else
{
marker
=
[[[
RMMarker
alloc
]
initWithUIImage
:
annotation
.
annotationIcon
anchorPoint
:
annotation
.
anchorPoint
]
autorelease
];
if
(
annotation
.
title
)
[
marker
changeLabelUsingText
:
annotation
.
title
];
...
...
Please
register
or
login
to post a comment