[core] Fix MapSnapshotter build failure on Windows
MSVC implementation of std::promise is buggy and only works with types that can be default-constructed. To avoid a compilation failure in the instantiation of ask() inside MapSnapshotter::getRegion(), which creates a std::promise<LanLngBounds>, make LatLngBounds' default constructor public.
This commit is contained in:
Binary file not shown.
@@ -105,14 +105,12 @@ public:
|
||||
return bounds;
|
||||
}
|
||||
|
||||
/// Returns an infinite bound, a bound for which the constrain method returns its
|
||||
/// Construct an infinite bound, a bound for which the constrain method returns its
|
||||
/// input unmodified.
|
||||
///
|
||||
/// Note: this is different than LatLngBounds::world() since arbitrary unwrapped
|
||||
/// coordinates are also inside the bounds.
|
||||
static LatLngBounds unbounded() {
|
||||
return {};
|
||||
}
|
||||
LatLngBounds() : sw({-90, -180}), ne({90, 180}), bounded(false) {}
|
||||
|
||||
// Constructs a LatLngBounds object with the tile's exact boundaries.
|
||||
LatLngBounds(const CanonicalTileID&);
|
||||
@@ -172,9 +170,6 @@ private:
|
||||
|
||||
LatLngBounds(LatLng sw_, LatLng ne_) : sw(sw_), ne(ne_) {}
|
||||
|
||||
LatLngBounds()
|
||||
: sw({-90, -180}), ne({90, 180}), bounded(false) {}
|
||||
|
||||
bool containsLatitude(double latitude) const;
|
||||
bool containsLongitude(double longitude, LatLng::WrapMode wrap) const;
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ void NativeMapView::setLatLngBounds(jni::JNIEnv& env, const jni::Object<mbgl::an
|
||||
if (jBounds) {
|
||||
bounds.withLatLngBounds(mbgl::android::LatLngBounds::getLatLngBounds(env, jBounds));
|
||||
} else {
|
||||
bounds.withLatLngBounds(mbgl::LatLngBounds::unbounded());
|
||||
bounds.withLatLngBounds(mbgl::LatLngBounds());
|
||||
}
|
||||
map->setBounds(bounds);
|
||||
}
|
||||
|
||||
@@ -288,11 +288,10 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
|
||||
break;
|
||||
case GLFW_KEY_D: {
|
||||
static const std::vector<mbgl::LatLngBounds> bounds = {
|
||||
mbgl::LatLngBounds::hull(mbgl::LatLng { -45.0, -170.0 }, mbgl::LatLng { 45.0, 170.0 }), // inside
|
||||
mbgl::LatLngBounds::hull(mbgl::LatLng { -45.0, -200.0 }, mbgl::LatLng { 45.0, -160.0 }), // left IDL
|
||||
mbgl::LatLngBounds::hull(mbgl::LatLng { -45.0, 160.0 }, mbgl::LatLng { 45.0, 200.0 }), // right IDL
|
||||
mbgl::LatLngBounds::unbounded()
|
||||
};
|
||||
mbgl::LatLngBounds::hull(mbgl::LatLng{-45.0, -170.0}, mbgl::LatLng{45.0, 170.0}), // inside
|
||||
mbgl::LatLngBounds::hull(mbgl::LatLng{-45.0, -200.0}, mbgl::LatLng{45.0, -160.0}), // left IDL
|
||||
mbgl::LatLngBounds::hull(mbgl::LatLng{-45.0, 160.0}, mbgl::LatLng{45.0, 200.0}), // right IDL
|
||||
mbgl::LatLngBounds()};
|
||||
static size_t nextBound = 0u;
|
||||
static mbgl::AnnotationID boundAnnotationID = std::numeric_limits<mbgl::AnnotationID>::max();
|
||||
|
||||
@@ -301,7 +300,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
|
||||
|
||||
view->map->setBounds(mbgl::BoundOptions().withLatLngBounds(bound));
|
||||
|
||||
if (bound == mbgl::LatLngBounds::unbounded()) {
|
||||
if (bound == mbgl::LatLngBounds()) {
|
||||
view->map->removeAnnotation(boundAnnotationID);
|
||||
boundAnnotationID = std::numeric_limits<mbgl::AnnotationID>::max();
|
||||
} else {
|
||||
|
||||
@@ -83,14 +83,14 @@ void Transform::jumpTo(const CameraOptions& camera) {
|
||||
*/
|
||||
void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& animation) {
|
||||
Duration duration = animation.duration.value_or(Duration::zero());
|
||||
if (state.bounds == LatLngBounds::unbounded() && !isGestureInProgress() && duration != Duration::zero()) {
|
||||
if (state.bounds == LatLngBounds() && !isGestureInProgress() && duration != Duration::zero()) {
|
||||
// reuse flyTo, without exaggerated animation, to achieve constant ground speed.
|
||||
return flyTo(camera, animation, true);
|
||||
}
|
||||
const EdgeInsets& padding = camera.padding.value_or(state.edgeInsets);
|
||||
LatLng startLatLng = getLatLng(LatLng::Unwrapped);
|
||||
const LatLng& unwrappedLatLng = camera.center.value_or(startLatLng);
|
||||
const LatLng& latLng = state.bounds != LatLngBounds::unbounded() ? unwrappedLatLng : unwrappedLatLng.wrapped();
|
||||
const LatLng& latLng = state.bounds != LatLngBounds() ? unwrappedLatLng : unwrappedLatLng.wrapped();
|
||||
double zoom = camera.zoom.value_or(getZoom());
|
||||
double bearing = camera.bearing ? -*camera.bearing * util::DEG2RAD : getBearing();
|
||||
double pitch = camera.pitch ? *camera.pitch * util::DEG2RAD : getPitch();
|
||||
@@ -102,7 +102,7 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.bounds == LatLngBounds::unbounded()) {
|
||||
if (state.bounds == LatLngBounds()) {
|
||||
if (isGestureInProgress()) {
|
||||
// If gesture in progress, we transfer the wrap rounds from the end longitude into
|
||||
// start, so the "scroll effect" of rounding the world is the same while assuring the
|
||||
|
||||
@@ -10,11 +10,7 @@
|
||||
namespace mbgl {
|
||||
|
||||
TransformState::TransformState(ConstrainMode constrainMode_, ViewportMode viewportMode_)
|
||||
: bounds(LatLngBounds::unbounded())
|
||||
, constrainMode(constrainMode_)
|
||||
, viewportMode(viewportMode_)
|
||||
{
|
||||
}
|
||||
: bounds(LatLngBounds()), constrainMode(constrainMode_), viewportMode(viewportMode_) {}
|
||||
|
||||
#pragma mark - Matrix
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ TEST(Map, DefaultBoundOptions) {
|
||||
|
||||
EXPECT_EQ(*bounds.minZoom, util::MIN_ZOOM);
|
||||
EXPECT_EQ(*bounds.maxZoom, util::DEFAULT_MAX_ZOOM);
|
||||
EXPECT_EQ(*bounds.bounds, LatLngBounds::unbounded());
|
||||
EXPECT_EQ(*bounds.bounds, LatLngBounds());
|
||||
}
|
||||
|
||||
TEST(Map, MapOptions) {
|
||||
@@ -1053,4 +1053,4 @@ TEST(Map, NoHangOnMissingImage) {
|
||||
test.map.jumpTo(test.map.getStyle().getDefaultCamera());
|
||||
// The test passes if the following call does not hang.
|
||||
test.frontend.render(test.map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ TEST(Transform, LatLngBounds) {
|
||||
transform.jumpTo(CameraOptions().withCenter(LatLng()).withZoom(transform.getState().getMaxZoom()));
|
||||
|
||||
// Default bounds.
|
||||
ASSERT_EQ(transform.getState().getLatLngBounds(), LatLngBounds::unbounded());
|
||||
ASSERT_EQ(transform.getState().getLatLngBounds(), LatLngBounds());
|
||||
ASSERT_EQ(transform.getLatLng(), nullIsland);
|
||||
|
||||
// Invalid bounds.
|
||||
@@ -617,7 +617,7 @@ TEST(Transform, LatLngBounds) {
|
||||
transform.setLatLngBounds(LatLngBounds::empty());
|
||||
ASSERT_TRUE(false) << "Should throw";
|
||||
} catch (...) {
|
||||
ASSERT_EQ(transform.getState().getLatLngBounds(), LatLngBounds::unbounded());
|
||||
ASSERT_EQ(transform.getState().getLatLngBounds(), LatLngBounds());
|
||||
}
|
||||
|
||||
transform.jumpTo(CameraOptions().withCenter(sanFrancisco));
|
||||
|
||||
Reference in New Issue
Block a user