[core] Added Map::latLngBoundsForCamera

This commit is contained in:
Bruno de Oliveira Abinader
2017-03-23 18:10:16 +02:00
parent e67abfbe67
commit 80915992ab
6 changed files with 57 additions and 0 deletions

View File

@@ -644,6 +644,17 @@ CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, optional
return options;
}
LatLngBounds Map::latLngBoundsForCamera(const CameraOptions& camera) const {
Transform shallow { impl->transform.getState() };
Size size = shallow.getState().getSize();
shallow.jumpTo(camera);
return LatLngBounds::hull(
shallow.screenCoordinateToLatLng({}),
shallow.screenCoordinateToLatLng({ double(size.width), double(size.height) })
);
}
void Map::resetZoom() {
impl->cameraMutated = true;
setZoom(0);