diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-04-21 17:23:09 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-04-22 16:39:25 -0700 |
commit | 466ed55200ffb3a9bc5954b59d87c7dd5630e5ac (patch) | |
tree | 9daedf21439b49b82ea911883eae04ecd2ae3b79 /src/mbgl/map/transform.cpp | |
parent | 5939dd5b412fcc1ef857711a137589aa865bd442 (diff) | |
download | qtlocation-mapboxgl-466ed55200ffb3a9bc5954b59d87c7dd5630e5ac.tar.gz |
[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.
Diffstat (limited to 'src/mbgl/map/transform.cpp')
-rw-r--r-- | src/mbgl/map/transform.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp index 136209c937..7dcfee65dc 100644 --- a/src/mbgl/map/transform.cpp +++ b/src/mbgl/map/transform.cpp @@ -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 |