summaryrefslogtreecommitdiff
path: root/platform/macos/app/MapDocument.m
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-06-16 14:55:15 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-06-17 11:38:03 -0700
commita3318c2ced80a3b79dd898afb9f0fe27f0ce7571 (patch)
tree81992ce9a856cd61aa64cff6a20b29cdf2d561dd /platform/macos/app/MapDocument.m
parent86d768c2af70fb635c645ab117b022b69b686f76 (diff)
downloadqtlocation-mapboxgl-a3318c2ced80a3b79dd898afb9f0fe27f0ce7571.tar.gz
[macos] Add "Add Animated Annotation" to the Debug menu
Diffstat (limited to 'platform/macos/app/MapDocument.m')
-rw-r--r--platform/macos/app/MapDocument.m22
1 files changed, 22 insertions, 0 deletions
diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m
index 5d05bacc5b..a6c9e62829 100644
--- a/platform/macos/app/MapDocument.m
+++ b/platform/macos/app/MapDocument.m
@@ -405,6 +405,25 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
[self.mapView addAnnotation:line];
}
+- (IBAction)drawAnimatedAnnotation:(id)sender {
+ DroppedPinAnnotation *annotation = [[DroppedPinAnnotation alloc] init];
+ [self.mapView addAnnotation:annotation];
+
+ [NSTimer scheduledTimerWithTimeInterval:1.0/60.0
+ target:self
+ selector:@selector(updateAnimatedAnnotation:)
+ userInfo:annotation
+ repeats:YES];
+}
+
+- (void)updateAnimatedAnnotation:(NSTimer *)timer {
+ DroppedPinAnnotation *annotation = timer.userInfo;
+ double angle = timer.fireDate.timeIntervalSinceReferenceDate;
+ annotation.coordinate = CLLocationCoordinate2DMake(
+ sin(angle) * 20,
+ cos(angle) * 20);
+}
+
#pragma mark Offline packs
- (IBAction)addOfflinePack:(id)sender {
@@ -613,6 +632,9 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
if (menuItem.action == @selector(dropManyPins:)) {
return YES;
}
+ if (menuItem.action == @selector(drawAnimatedAnnotation:)) {
+ return YES;
+ }
if (menuItem.action == @selector(removeAllAnnotations:)) {
return self.mapView.annotations.count > 0;
}