[core, ios, osx] cameraThatFitsCoordinateBounds

Added an API to get a camera that you can pass into -[MGLMapView setCamera:] that fits the given coordinate bounds, by analogy with -[MKMapView regionThatFits:] or -[MKMapView mapRectThatFits:edgePadding:].

Added mbgl::Map::getCameraOptions() for getting the current camera options more conveniently.
This commit is contained in:
Minh Nguyễn
2016-04-21 17:23:09 -07:00
committed by Minh Nguyễn
parent 5939dd5b41
commit 466ed55200
10 changed files with 134 additions and 28 deletions

View File

@@ -62,6 +62,16 @@ bool Transform::resize(const std::array<uint16_t, 2> size) {
#pragma mark - Camera
CameraOptions Transform::getCameraOptions(optional<EdgeInsets> padding) const {
CameraOptions camera;
camera.center = getLatLng(padding);
camera.padding = padding;
camera.zoom = getZoom();
camera.angle = getAngle();
camera.pitch = getPitch();
return camera;
}
/**
* Change any combination of center, zoom, bearing, and pitch, without
* a transition. The map will retain the current values for any options