[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);

View File

@@ -22,6 +22,8 @@ public:
ConstrainMode = ConstrainMode::HeightOnly,
ViewportMode = ViewportMode::Default);
Transform(const TransformState &state_) : observer(MapObserver::nullObserver()), state(state_) {}
// Map view
bool resize(Size size);