Commit Graph

40 Commits

Author SHA1 Message Date
Thiago Marcos P. Santos
41dc5e836a Emit the signal on the MapThread
We were previously emitting the signal on the thread parsing the
glyph, but signals can only be trigger from the MapThread
because the observers are living there.
2015-05-18 10:42:05 +03:00
Thiago Marcos P. Santos
f222efb939 Keep a pointer to GlyphStore on ResourceLoader
For now, keep a pointer so we can subscribe/unsubscribe to events. In
the future, we should move this object completely to ResourceLoader, but
we can't do it now because we delete the ResourceLoader when changing
the style.
2015-05-18 10:42:05 +03:00
John Firebaugh
c1d004b8fb Restore sprite load check
This is necessary to ensure that background and fill images are ready
to render.

Fixes #1563
2015-05-14 18:15:54 -07:00
Konstantin Käfer
e274959753 abort rendering early when we don't need to
when rendering still images, we don't need to render until everything is completely loaded
2015-05-13 10:39:22 +02:00
Leith Bade
703e0bc2ee Ignore deactivate when no valid EGL display. Fixes #1435
Initialise NativeMapView's EGL variables before Map

Fix hang

Add check for double pause

Add test for double pause
2015-05-09 12:02:39 +10:00
Thiago Marcos P. Santos
c487c521b4 Move the Sprite handling to ResourceLoader
This is the first concrete step to remove promises from the parsing
pipeline. Buckets depending on the Sprite (i.e. SymbolBucket) won't
be created if the Sprite is not loaded yet. When the Sprite finally gets
loaded, it will fire a signal that will ultimately trigger a reparse.

We still have to expose the Sprite to the Map object as it is needed
for getting offset pixels for annotation symbols, but we can probably
improve that.
2015-05-05 18:10:21 +03:00
Thiago Marcos P. Santos
d726613f6f Update the tiles via ResourceLoader 2015-05-05 18:10:21 +03:00
Thiago Marcos P. Santos
f4baa0ba3e Notify data changes using Observer pattern
This pattern, in contrast with callbacks, allows us to clearly see
the dependency and hierarchy between the objects. It will also help
on writing unit tests as we can count how many times a notification
was triggered.
2015-05-05 18:10:20 +03:00
Thiago Marcos P. Santos
4956da61b9 Introduce the ResourceLoader
ResourceLoader will handle all the tile changes and notifications
through the Source object owned by the Style. This object lives
entirely on the Map thread and should be only accessed by it.

The observer will receive notifications every time the tile data changes
and this will probably trigger a new rendering operation.

This first patch will delegate Source loading to the ResourceLoader.
2015-05-05 18:04:54 +03:00
Konstantin Käfer
5aa0caf5c5 don't trigger cleanups when we're not rendering 2015-05-05 11:53:23 +02:00
Konstantin Käfer
691c305467 add Map::isFullyLoaded()
returns whether the Map is still loading/parsing any assets or whether everything is there and a render will likely be complete
2015-05-05 11:47:23 +02:00
John Firebaugh
00a1f44cfc Ensure no GL commands are executed after pause 2015-05-04 18:27:48 -07:00
John Firebaugh
dac4b7d3c9 Reset previous style before creating new one
This ensures that the worker threads associated with the
style are joined before new worker threads are launched.
I don't know exactly why, but it seems to fix #1384.
2015-05-01 16:29:06 -04:00
John Firebaugh
1d957d6898 Deactivate after cleanup 2015-04-30 09:57:58 -04:00
John Firebaugh
cdb466e7f7 Convert Style to unique_ptr and pass by reference
Fixes #1277
Fixes #1309
2015-04-28 14:32:26 -04:00
John Firebaugh
0c280adebc Move Worker to Style
This ensures that worker tasks are entirely complete by the
time the style is destructed, and enables us to pass Style&
rather than a shared pointer.
2015-04-28 14:32:26 -04:00
John Firebaugh
4ccf246c10 Rewrite Worker in terms of Thread<> 2015-04-28 14:32:26 -04:00
John Firebaugh
59255a3d9e MapContext::updated doesn't need to be atomic 2015-04-28 14:32:25 -04:00
John Firebaugh
8bb7fc64ff Move Environment to MapContext 2015-04-28 14:32:25 -04:00
John Firebaugh
bb7c453b3e Inline getWorker() 2015-04-28 14:32:25 -04:00
John Firebaugh
f8db45f19a Move still image callback to MapContext 2015-04-28 14:32:25 -04:00
John Firebaugh
f0b229730f Move style info to MapContext 2015-04-28 14:32:25 -04:00
John Firebaugh
230027e514 Resize view from map thread 2015-04-28 14:32:24 -04:00
John Firebaugh
a625ba8a09 Remove Map::start/stop
Both Android and iOS now use pause/resume. The map thread is
always running, and be able to receive messages. When paused,
it will just refuse to render.
2015-04-28 14:32:24 -04:00
John Firebaugh
16168abaea Remove redundant Style instantiation
reloadStyle calls loadStyleJSON, which also creates the
style. There is no need to create it in reloadStyle as
well.
2015-04-28 14:32:24 -04:00
John Firebaugh
7cd55a3333 Enforce that transformState belongs to Map thread 2015-04-28 14:32:23 -04:00
John Firebaugh
958142c512 Clean up Sprite
* Provide a callback so MapContext can re-render when it loads.
* Cancel in-progress loading rather than relying on keeping it
  alive with a shared_ptr.
* Remove / privatize as much as possible.
2015-04-28 14:32:23 -04:00
John Firebaugh
ec7588f1fd Implement Style::isLoaded 2015-04-28 14:32:22 -04:00
John Firebaugh
6c7a01a503 Following kkaefer's view changes 2015-04-28 14:32:22 -04:00
John Firebaugh
75ae956b0e WIP: Use Thread<MapContext> 2015-04-28 14:32:22 -04:00
John Firebaugh
41a44280ca Prepare for using Thread<MapContext> 2015-04-28 14:32:22 -04:00
John Firebaugh
fc9b958bb8 updateAnnotationTiles is called within invoke* 2015-04-28 14:32:22 -04:00
John Firebaugh
025eb013d7 Privatize remaining MapContext members 2015-04-28 14:32:21 -04:00
John Firebaugh
424dae0a2c Move run() to MapContext 2015-04-28 14:32:21 -04:00
Konstantin Käfer
b0a30943b4 move most private Map code to MapContext 2015-04-28 14:32:20 -04:00
Konstantin Käfer
9dc51e7f80 move rendering mode enum to MapData object 2015-04-28 14:32:20 -04:00
Konstantin Käfer
fa272b3aaa move asyncRender to MapContext 2015-04-28 14:32:20 -04:00
Konstantin Käfer
f8600d8d97 move getSprite to MapContext 2015-04-28 14:32:20 -04:00
Konstantin Käfer
f272d13dea move worker to MapContext 2015-04-28 14:32:19 -04:00
Konstantin Käfer
67fa80f5e9 move MapContext to its own file 2015-04-28 14:32:19 -04:00