blob: 2e20a6386f3f5afb9293c73f5cbc335be750d68b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#ifndef MBGL_MAP_CAMERA
#define MBGL_MAP_CAMERA
#include <mbgl/util/geo.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/unitbezier.hpp>
#include <mbgl/util/optional.hpp>
#include <functional>
namespace mbgl {
/** Various options for describing the viewpoint of a map. All fields are
optional. */
struct CameraOptions {
/** Coordinate at the center of the map. */
optional<LatLng> center;
/** Padding around the interior of the view that affects the frame of
reference for `center`. */
optional<EdgeInsets> padding;
/** Point of reference for `zoom` and `angle`, assuming an origin at the
top-left corner of the view. */
optional<ScreenCoordinate> anchor;
/** Zero-based zoom level. Constrained to the minimum and maximum zoom
levels. */
optional<double> zoom;
/** Bearing, measured in radians counterclockwise from true north. Wrapped
to [−π rad, π rad). */
optional<double> angle;
/** Pitch toward the horizon measured in radians, with 0 rad resulting in a
two-dimensional map. */
optional<double> pitch;
};
/** Various options for describing a transition between viewpoints with
animation. All fields are optional; the default values depend on how this
struct is used. */
struct AnimationOptions {
/** Time to animate to the viewpoint defined herein. */
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. */
optional<double> velocity;
/** Zero-based zoom level at the peak of the flyTo() transition’s flight
path. */
optional<double> minZoom;
/** The easing timing curve of the transition. */
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
the elapsed time as a percentage of the duration. */
std::function<void(double)> transitionFrameFn;
/** A function that is called once on the last frame of the transition, just
before the corresponding screen update. */
std::function<void()> transitionFinishFn;
/** Creates an animation with no options specified. */
inline AnimationOptions() {}
/** Creates an animation with the specified duration. */
inline AnimationOptions(Duration d)
: duration(d) {}
};
} // namespace mbgl
#endif /* MBGL_MAP_CAMERA */
|