-
-
Save incanus/d84f8079660458ff4df7865d4ba64326 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m | |
index feebb59..443265d 100644 | |
--- a/platform/ios/app/MBXViewController.m | |
+++ b/platform/ios/app/MBXViewController.m | |
@@ -170,6 +170,28 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { | |
} | |
[self presentViewController:alertController animated:YES completion:nil]; | |
} | |
+ | |
+ [self performSelector:@selector(addTestShapes) withObject:nil afterDelay:1]; | |
+} | |
+ | |
+- (void)mapViewRegionIsChanging:(MGLMapView *)mapView | |
+{ | |
+ // update tail coordinate | |
+// CLLocationCoordinate2D center = mapView.centerCoordinate; | |
+// MGLPolyline *line = (MGLPolyline *)mapView.annotations.firstObject; | |
+// CLLocationCoordinate2D *coordinates = malloc(2 * sizeof(CLLocationCoordinate2D)); | |
+// [line getCoordinates:coordinates range:NSMakeRange(0, 2)]; | |
+// coordinates[1] = center; | |
+// [line setCoordinates:coordinates range:NSMakeRange(0, 2)]; | |
+// free(coordinates); | |
+ | |
+ // append coordinate to tail | |
+ CLLocationCoordinate2D center = mapView.centerCoordinate; | |
+ MGLPolyline *line = (MGLPolyline *)mapView.annotations.firstObject; | |
+ CLLocationCoordinate2D *coordinates = malloc(1 * sizeof(CLLocationCoordinate2D)); | |
+ coordinates[0] = center; | |
+ [line setCoordinates:coordinates range:NSMakeRange(line.pointCount, 1)]; | |
+ free(coordinates); | |
} | |
- (void)saveState:(__unused NSNotification *)notification | |
@@ -539,6 +561,24 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { | |
- (void)addTestShapes | |
{ | |
+ CLLocationCoordinate2D center = self.mapView.centerCoordinate; | |
+ CLLocationCoordinate2D lineCoordinates[2] = { | |
+ CLLocationCoordinate2DMake(45, -122), | |
+ center | |
+ }; | |
+ MGLPolyline *line = [MGLPolyline polylineWithCoordinates:lineCoordinates count:2]; | |
+ [self.mapView addAnnotation:line]; | |
+ | |
+// CLLocationCoordinate2D polygonCoordinates[3] = { | |
+// CLLocationCoordinate2DMake(44, -122), | |
+// CLLocationCoordinate2DMake(46, -122), | |
+// center | |
+// }; | |
+// MGLPolygon *shape = [MGLPolygon polygonWithCoordinates:polygonCoordinates count:3]; | |
+// [self.mapView addAnnotation:shape]; | |
+ | |
+ return; | |
+ | |
// Pacific Northwest triangle | |
// | |
CLLocationCoordinate2D triangleCoordinates[3] = |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment