diff options
author | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2017-10-04 10:03:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-04 10:03:03 -0400 |
commit | f01588cac78b5e5411385faa451080a74320500b (patch) | |
tree | 1f0540cf5c71475f0ae6714d70b909338fed9b5f /platform/ios/app | |
parent | 6a846ce5a8ff1d62f4eafa3ef5bd0427096ca9e6 (diff) | |
download | qtlocation-mapboxgl-f01588cac78b5e5411385faa451080a74320500b.tar.gz |
[ios, macos] Improve snap shotter documentation. (#10020)
* [ios, macos] Improve snap shotter documentation.
* [macos] Save snapshots in correct format
* [macos] Renamed snapshot item to Export Image
* [ios, macos] Clarify Snapshotter documentation.
* [ios] Fix snapshot scale
* [macOS] Fix snapshotter 4x scaling.
* [ios] Fix snapshotter final image scale.
* [ios, macos] Update snapshotter size documentation.
* [ios, macos] Throw an exception when the snapshotter has already started.
* [ios, macos] Add snapshotter header example.
* [ios, macos] Use one of the predefined Foundation's exception names.
Diffstat (limited to 'platform/ios/app')
-rw-r--r-- | platform/ios/app/MBXSnapshotsViewController.m | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/platform/ios/app/MBXSnapshotsViewController.m b/platform/ios/app/MBXSnapshotsViewController.m index d26479f085..ab5ad97c90 100644 --- a/platform/ios/app/MBXSnapshotsViewController.m +++ b/platform/ios/app/MBXSnapshotsViewController.m @@ -18,27 +18,27 @@ @implementation MBXSnapshotsViewController { // Top row - MGLMapSnapshotter* snapshotterTL; - MGLMapSnapshotter* snapshotterTM; - MGLMapSnapshotter* snapshotterTR; + MGLMapSnapshotter* topLeftSnapshotter; + MGLMapSnapshotter* topCenterSnapshotter; + MGLMapSnapshotter* topRightSnapshotter; // Bottom row - MGLMapSnapshotter* snapshotterBL; - MGLMapSnapshotter* snapshotterBM; - MGLMapSnapshotter* snapshotterBR; + MGLMapSnapshotter* bottomLeftSnapshotter; + MGLMapSnapshotter* bottomCenterSnapshotter; + MGLMapSnapshotter* bottomRightSnapshotter; } - (void)viewDidLoad { [super viewDidLoad]; // Start snapshotters - snapshotterTL = [self startSnapshotterForImageView:_snapshotImageViewTL coordinates:CLLocationCoordinate2DMake(37.7184, -122.4365)]; - snapshotterTM = [self startSnapshotterForImageView:_snapshotImageViewTM coordinates:CLLocationCoordinate2DMake(38.8936, -77.0146)]; - snapshotterTR = [self startSnapshotterForImageView:_snapshotImageViewTR coordinates:CLLocationCoordinate2DMake(-13.1356, -74.2442)]; + topLeftSnapshotter = [self startSnapshotterForImageView:_snapshotImageViewTL coordinates:CLLocationCoordinate2DMake(37.7184, -122.4365)]; + topCenterSnapshotter = [self startSnapshotterForImageView:_snapshotImageViewTM coordinates:CLLocationCoordinate2DMake(38.8936, -77.0146)]; + topRightSnapshotter = [self startSnapshotterForImageView:_snapshotImageViewTR coordinates:CLLocationCoordinate2DMake(-13.1356, -74.2442)]; - snapshotterBL = [self startSnapshotterForImageView:_snapshotImageViewBL coordinates:CLLocationCoordinate2DMake(52.5072, 13.4247)]; - snapshotterBM = [self startSnapshotterForImageView:_snapshotImageViewBM coordinates:CLLocationCoordinate2DMake(60.2118, 24.6754)]; - snapshotterBR = [self startSnapshotterForImageView:_snapshotImageViewBR coordinates:CLLocationCoordinate2DMake(31.2780, 121.4286)]; + bottomLeftSnapshotter = [self startSnapshotterForImageView:_snapshotImageViewBL coordinates:CLLocationCoordinate2DMake(52.5072, 13.4247)]; + bottomCenterSnapshotter = [self startSnapshotterForImageView:_snapshotImageViewBM coordinates:CLLocationCoordinate2DMake(60.2118, 24.6754)]; + bottomRightSnapshotter = [self startSnapshotterForImageView:_snapshotImageViewBR coordinates:CLLocationCoordinate2DMake(31.2780, 121.4286)]; } - (MGLMapSnapshotter*) startSnapshotterForImageView:(UIImageView*) imageView coordinates:(CLLocationCoordinate2D) coordinates { @@ -46,8 +46,8 @@ MGLMapCamera* mapCamera = [[MGLMapCamera alloc] init]; mapCamera.pitch = 20; mapCamera.centerCoordinate = coordinates; - MGLMapSnapshotOptions* options = [[MGLMapSnapshotOptions alloc] initWithStyleURL:[NSURL URLWithString:@"mapbox://styles/mapbox/traffic-day-v2"] camera:mapCamera size:CGSizeMake(imageView.frame.size.width, imageView.frame.size.height)]; - options.zoom = 10; + MGLMapSnapshotOptions* options = [[MGLMapSnapshotOptions alloc] initWithStyleURL:[MGLStyle satelliteStreetsStyleURL] camera:mapCamera size:CGSizeMake(imageView.frame.size.width, imageView.frame.size.height)]; + options.zoomLevel = 10; // Create and start the snapshotter MGLMapSnapshotter* snapshotter = [[MGLMapSnapshotter alloc] initWithOptions:options]; |