Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

MGLMapView printouts should respect pagination #10611

Open
1ec5 opened this issue Dec 1, 2017 · 1 comment
Open

MGLMapView printouts should respect pagination #10611

1ec5 opened this issue Dec 1, 2017 · 1 comment
Labels
macOS Mapbox Maps SDK for macOS MapKit parity For feature parity with MapKit on iOS or macOS refactor

Comments

@1ec5
Copy link
Contributor

1ec5 commented Dec 1, 2017

The macOS SDK implementation of MGLMapView currently implements printing with a little bit of custom drawing code. While elegant, it means a document containing the map view can only print the exact viewport currently visible in the map view. Instead, MGLMapView or macosapp should use MGLMapSnapshotter, which is capable of rendering a map at an arbitrary size and scale. This will allow the printout to respect the page boundaries and pagination.

if (_isPrinting) {
_isPrinting = NO;
NSImage *image = [[NSImage alloc] initWithMGLPremultipliedImage:_mbglView->readStillImage()];
[self performSelector:@selector(printWithImage:) withObject:image afterDelay:0];
}

mbgl::PremultipliedImage readStillImage() {
return readFramebuffer(nativeView.framebufferSize);
}

We may want to wait until #9914 lands in order to preserve any annotations and other style modifications in the printed map. Alternatively, we could use MGLMapSnapshot’s coordinate conversion methods to manually add the annotations to the map, but it would be a fair amount of work for MGLOverlays.

/cc @fabian-guerra

@1ec5 1ec5 added macOS Mapbox Maps SDK for macOS MapKit parity For feature parity with MapKit on iOS or macOS refactor labels Dec 1, 2017
@1ec5 1ec5 added this to the macos-v0.8.0 milestone Dec 1, 2017
@1ec5 1ec5 modified the milestones: macos-v0.7.0, macos-v0.8.0 Apr 16, 2018
@1ec5 1ec5 modified the milestones: macos-v0.8.0, macos-v0.9.0 Jun 20, 2018
@1ec5 1ec5 modified the milestones: macos-v0.9.0, macos-v0.10.0 Jul 18, 2018
@1ec5 1ec5 modified the milestones: macos-v0.10.0, macos-v0.11.0 Aug 16, 2018
@1ec5 1ec5 removed this from the macos-v0.12.0-horchata milestone Nov 8, 2018
@stale stale bot added the archived Archived because of inactivity label May 7, 2019
@stale
Copy link

stale bot commented May 7, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed May 7, 2019
@fabian-guerra fabian-guerra reopened this May 7, 2019
@stale stale bot removed the archived Archived because of inactivity label May 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
macOS Mapbox Maps SDK for macOS MapKit parity For feature parity with MapKit on iOS or macOS refactor
Projects
None yet
Development

No branches or pull requests

2 participants