summaryrefslogtreecommitdiff
path: root/include/mbgl
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-01-19 14:47:58 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-01-19 17:56:48 -0800
commit9b62661b07e86fc1d64e308fde3e15527c1cd8c8 (patch)
treec27b37e3f94b53d4fdd5855d1eb68868ce803bae /include/mbgl
parent48cced9e311d5c1cf2a98937eeaf638c94456c8d (diff)
downloadqtlocation-mapboxgl-9b62661b07e86fc1d64e308fde3e15527c1cd8c8.tar.gz
[core] Use experimental optional instead of mapbox::util::optional
Diffstat (limited to 'include/mbgl')
-rw-r--r--include/mbgl/map/camera.hpp23
-rw-r--r--include/mbgl/util/optional.hpp13
2 files changed, 24 insertions, 12 deletions
diff --git a/include/mbgl/map/camera.hpp b/include/mbgl/map/camera.hpp
index 32ad8f019f..a1b9bfe691 100644
--- a/include/mbgl/map/camera.hpp
+++ b/include/mbgl/map/camera.hpp
@@ -1,11 +1,10 @@
#ifndef MBGL_MAP_CAMERA
#define MBGL_MAP_CAMERA
-#include <mapbox/optional.hpp>
-
#include <mbgl/util/geo.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/unitbezier.hpp>
+#include <mbgl/util/optional.hpp>
#include <functional>
@@ -15,27 +14,27 @@ namespace mbgl {
optional. */
struct CameraOptions {
/** Coordinate at the center of the map. */
- mapbox::util::optional<LatLng> center;
+ optional<LatLng> center;
/** Padding around the interior of the view that affects the frame of
reference for `center`. */
- mapbox::util::optional<EdgeInsets> padding;
+ optional<EdgeInsets> padding;
/** Point of reference for `zoom` and `angle`, assuming an origin at the
top-left corner of the view. */
- mapbox::util::optional<PrecisionPoint> anchor;
+ optional<PrecisionPoint> anchor;
/** Zero-based zoom level. Constrained to the minimum and maximum zoom
levels. */
- mapbox::util::optional<double> zoom;
+ optional<double> zoom;
/** Bearing, measured in radians counterclockwise from true north. Wrapped
to [−π rad, π rad). */
- mapbox::util::optional<double> angle;
+ optional<double> angle;
/** Pitch toward the horizon measured in radians, with 0 rad resulting in a
two-dimensional map. */
- mapbox::util::optional<double> pitch;
+ optional<double> pitch;
};
/** Various options for describing a transition between viewpoints with
@@ -43,21 +42,21 @@ struct CameraOptions {
struct is used. */
struct AnimationOptions {
/** Time to animate to the viewpoint defined herein. */
- mapbox::util::optional<Duration> duration;
+ optional<Duration> duration;
/** Average velocity of a flyTo() transition, measured in screenfuls per
second, assuming a linear timing curve.
A <i>screenful</i> is the visible span in pixels. It does not correspond
to a fixed physical distance but rather varies by zoom level. */
- mapbox::util::optional<double> velocity;
+ optional<double> velocity;
/** Zero-based zoom level at the peak of the flyTo() transition’s flight
path. */
- mapbox::util::optional<double> minZoom;
+ optional<double> minZoom;
/** The easing timing curve of the transition. */
- mapbox::util::optional<mbgl::util::UnitBezier> easing;
+ optional<mbgl::util::UnitBezier> easing;
/** A function that is called on each frame of the transition, just before a
screen update, except on the last frame. The first parameter indicates
diff --git a/include/mbgl/util/optional.hpp b/include/mbgl/util/optional.hpp
new file mode 100644
index 0000000000..1063ba84a1
--- /dev/null
+++ b/include/mbgl/util/optional.hpp
@@ -0,0 +1,13 @@
+#ifndef MBGL_UTIL_OPTIONAL
+#define MBGL_UTIL_OPTIONAL
+
+#include <experimental/optional>
+
+namespace mbgl {
+
+template <typename T>
+using optional = std::experimental::optional<T>;
+
+} // namespace mbgl
+
+#endif