1
+ #include < mbgl/actor/scheduler.hpp>
1
2
#include < mbgl/layermanager/layer_manager.hpp>
2
3
#include < mbgl/map/map_impl.hpp>
3
4
#include < mbgl/renderer/update_parameters.hpp>
@@ -11,15 +12,17 @@ Map::Impl::Impl(RendererFrontend& frontend_,
11
12
MapObserver& observer_,
12
13
std::shared_ptr<FileSource> fileSource_,
13
14
const MapOptions& mapOptions)
14
- : observer(observer_),
15
- rendererFrontend (frontend_),
16
- transform(observer, mapOptions.constrainMode(), mapOptions.viewportMode()),
17
- mode(mapOptions.mapMode()),
18
- pixelRatio(mapOptions.pixelRatio()),
19
- crossSourceCollisions(mapOptions.crossSourceCollisions()),
20
- fileSource(std::move(fileSource_)),
21
- style(std::make_unique<style::Style>(*fileSource, pixelRatio)),
22
- annotationManager(*style) {
15
+ : observer(observer_),
16
+ rendererFrontend (frontend_),
17
+ transform(observer, mapOptions.constrainMode(), mapOptions.viewportMode()),
18
+ mode(mapOptions.mapMode()),
19
+ pixelRatio(mapOptions.pixelRatio()),
20
+ crossSourceCollisions(mapOptions.crossSourceCollisions()),
21
+ fileSource(std::move(fileSource_)),
22
+ style(std::make_unique<style::Style>(*fileSource, pixelRatio)),
23
+ annotationManager(*style),
24
+ mailbox(std::make_shared<Mailbox>(*Scheduler::GetCurrent ())),
25
+ actor(*this , mailbox) {
23
26
transform.setNorthOrientation (mapOptions.northOrientation ());
24
27
style->impl ->setObserver (this );
25
28
rendererFrontend.setObserver (*this );
@@ -39,12 +42,16 @@ void Map::Impl::onSourceChanged(style::Source& source) {
39
42
}
40
43
41
44
void Map::Impl::onUpdate () {
42
- // Don't load/render anything in still mode until explicitly requested.
43
- if (mode != MapMode::Continuous && !stillImageRequest) {
44
- return ;
45
+ if (mode == MapMode::Continuous) {
46
+ actor.invoke (&Map::Impl::updateInternal, Clock::now ());
47
+ } else if (stillImageRequest) {
48
+ updateInternal (Clock::time_point::max ());
45
49
}
50
+ }
46
51
47
- TimePoint timePoint = mode == MapMode::Continuous ? Clock::now () : Clock::time_point::max ();
52
+ void Map::Impl::updateInternal (TimePoint timePoint) {
53
+ // Don't load/render anything in still mode until explicitly requested.
54
+ assert (mode == MapMode::Continuous || stillImageRequest);
48
55
49
56
transform.updateTransitions (timePoint);
50
57
0 commit comments