Commit Graph

1381 Commits

Author SHA1 Message Date
Konstantin Käfer
2831073f85 Merge pull request #1295 from mapbox/1199-whee
Ensure correct spin direction
2015-04-20 12:01:46 +02:00
Minh Nguyễn
8b44cfeb76 Ensure correct spin direction
Ported mapbox/mapbox-gl-js#821 as well as `util.wrap()` from mapbox-gl-js.

Fixes #1199.
2015-04-18 22:14:39 -07:00
Konstantin Käfer
71d127220b rename Mode::Static => Mode::Still 2015-04-17 17:55:24 +02:00
Konstantin Käfer
9072df709d make the request header public as the node module requires it 2015-04-17 15:23:36 +02:00
Konstantin Käfer
60a0e8a4be don't record Debug events to log observers 2015-04-17 13:40:43 +02:00
Konstantin Käfer
5d769f9b62 explicitly call .discard() to resize the view on static renders
- this is only a stopgap; we need to properly pass state between threads
- doesn't fix changing the pixel ratio
2015-04-17 13:40:42 +02:00
Konstantin Käfer
1c920c4332 don't throw an exception in the map thread for bad styles 2015-04-17 13:40:42 +02:00
Konstantin Käfer
46bf226910 align static render mode and still image render mode
- static rendering now also runs in a separate thread; you have to start it with map.start(Map::Mode::Static) and join the thread with map.stop() before destructing the Map object
- map.renderStill() takes a callback with will be invoked on the *map* thread, so you'll have to figure out your own method of dispatching back to the main thread.
2015-04-17 13:40:42 +02:00
Justin R. Miller
14e972ad97 don't auto-resize & fill cache with zeros 2015-04-16 12:14:35 -07:00
Konstantin Käfer
645f7c0cd4 use std::unique_ptr<> as a movable-only container directly instead of wrapping in another class 2015-04-16 17:52:58 +02:00
John Firebaugh
7000a4faf0 Merge pull request #1250 from mapbox/1250-separate-thread-object
Separate objects from Thread management
2015-04-16 08:50:24 -07:00
Justin R. Miller
190709c6b1 fixes #1157, #1255: cache parsed tiles in memory 2015-04-16 01:15:41 -07:00
Justin R. Miller
c49e6157f1 add comment 2015-04-15 22:21:04 -07:00
Justin R. Miller
d29534e437 fixes #1267: properly break reference cycle with live tile data & style 2015-04-15 22:16:18 -07:00
John Firebaugh
5fa0512be2 Shorten method names 2015-04-15 20:38:25 -07:00
John Firebaugh
1eaf6b8c18 Stricter Thread<> interface
Implements a Thread<>::invoke interface that only permits calling
member functions with bound arguments.

Also introduce invokeWithResult, which accepts a callback and invokes
it, passing the result, on the invoking thread's RunLoop. This closes
the loop of two evented threads doing message passing.
2015-04-15 20:38:25 -07:00
Mike Morris
5972a7d16e make environment.hpp header public 2015-04-15 17:14:36 +02:00
Konstantin Käfer
452d12e6e6 make implementation files private headers 2015-04-13 18:28:18 +02:00
Konstantin Käfer
16849a341b hide Thread<> and separate the Implementation object 2015-04-13 17:57:45 +02:00
John Firebaugh
3efbb69e0c Ensure that ~TileData happens on map thread
Fixes #1251
2015-04-10 17:28:39 -07:00
Konstantin Käfer
0f79a89502 don't shadow variable names 2015-04-10 23:19:35 +02:00
Konstantin Käfer
4c7132337f convert DefaultFileSource to use util::Thread<> 2015-04-10 22:37:27 +02:00
Konstantin Käfer
bba3d9838a add Thread<T> and RunLoop
Thread<T> is a generic thread management object that starts a thread, creates an object T in that thread and calls its .start() function. When the Thread<T> object is destructed (which must happen in the thread that created it), it'll call the object's .stop() function, and wait for thread termination. The .stop() function must somehow get the thread to terminate. Note that object T's constructor/destructor/start()/stop() must be protected/private, and Thread<T> must be declared as a friend class. All public functions may be called from any thread and are exposed through operator->().

RunLoop encapsulates a libuv runloop and has a facility of dispatching function objects to the thread. It can be used either as a worker thread class by itself, or it can be derived from. This commit converts SQLiteCache to derive from RunLoop and removes the custom code used previously for managing the cache thread.
2015-04-10 15:36:32 +02:00
John Firebaugh
566c6718d7 Merge pull request #1244 from mapbox/uv
Replace uv_messenger with AsyncQueue; rewrite remaining uv_* in C++
2015-04-09 15:59:38 -07:00
John Firebaugh
0c087603e6 Replace uv_messenger with AsyncQueue; rewrite remaining uv_* in C++ 2015-04-09 15:30:58 -07:00
Konstantin Käfer
ec94e03a8e set the correct v7 default font
- also skip layers with empty font names
2015-04-09 22:29:05 +02:00
Ansis Brammanis
9b0376e58e fix angle of icons along lines
fixes https://github.com/mapbox/mapbox-gl-native/issues/1242
2015-04-09 12:05:16 -07:00
John Firebaugh
0b779eaa8b Remove unnecessary use of weak_ptr
The request callback runs in the same thread as ~TileData, and is not run
if the request is cancelled. So either ~TileData runs first and cancels
the request, or the callback runs first, before TileData is destructed.
Therefore the weak pointer and lock() check is unnecessary; `this` can
be used instead.
2015-04-09 11:10:51 -07:00
John Firebaugh
691756d7dd Move ClipID to clip_id.hpp/cpp 2015-04-09 10:58:11 -07:00
Konstantin Käfer
4b66c490b4 guard against invalid database files 2015-04-08 14:55:47 +02:00
Konstantin Käfer
7d58a41de5 make sqlite storage more resilient to sporadic errors
- catch SQLite exceptions and report them
- failed statements are ignored, we're really just caching here, so if it fails we're handling it gracefully elsewhere
- handle cases where the database file goes away after we opened it
- handle cases where the schema wasn't created after the database file was opened successfully
- add tests
2015-04-07 18:04:23 +02:00
John Firebaugh
c73309ef5f Remove unused 2015-04-06 15:55:28 -07:00
John Firebaugh
872cf07683 Move tileCover to its own file 2015-04-06 13:58:56 -07:00
John Firebaugh
d8411f26d2 Tile::ID ⇢ TileID
This allows making both Tile and TileID private.
2015-04-06 13:58:56 -07:00
John Firebaugh
c5292b7536 Remove always-true conditional 2015-04-06 12:59:47 -07:00
John Firebaugh
5ec04c0474 Bounds-check array access at source 2015-04-06 12:59:46 -07:00
John Firebaugh
d2314aedc6 Extract SourceInfo::tileURL 2015-04-06 12:58:52 -07:00
John Firebaugh
15969f1369 Remove Map dependency from Source::invalidateTiles 2015-04-06 10:30:02 -07:00
John Firebaugh
750cfb6f58 Remove Map dependency from Source::load 2015-04-06 10:30:01 -07:00
John Firebaugh
e72ee04482 Move SourceInfo into source.hpp/cpp 2015-04-06 10:30:01 -07:00
John Firebaugh
7e0e55e542 Eliminate StyleSource
Fixes #695
2015-04-06 10:30:01 -07:00
John Firebaugh
41c4d50f8a Remove unused 2015-04-03 13:51:33 -07:00
John Firebaugh
cca7f6978a Remove unused 2015-04-03 13:51:33 -07:00
Minh Nguyễn
6a1e7d5707 Fixed race condition after setting access token
`Map` should be able to deal with having no access token or JSON even while it’s running. Most of `Map` accounts for this situation, but `reloadStyle()` incorrectly assumes that one or the other is set. This change corrects the assumption in `reloadStyle()`.

Also expose the access token and style name to clients as ordinary KVO-compliant properties. Actually, they’re not so ordinary because they’re inspectable!

Ref #1070, #1147
2015-04-03 12:07:53 -07:00
Justin R. Miller
0a736c3a76 fixes #1181: fix lat/lng & zoom ordering problems 2015-04-02 19:56:47 -07:00
John Firebaugh
12c07b916b Rework easing transition code
This brings the easing transition code a bit closer to how easings work
in gl-js. Instead of having an array of individual transitions for scale,
rotate, and pan, there is a single transition function that does all the
required calculations. This permits us to:

* Eliminate the "timeout" transition. (Fixes #126)
* Replace start/stopPanning() et al with setGestureInProgress(). Apps or
  SDKs are expected to make paired calls to setGestureInProgress(). This
  state will be ORed with the active easing state to determine when to
  use texture interpolation. (Fixes #79)
* Run style recalculations only when an ease transition that affects the
  zoom is in progress. (Fixes #1155)
2015-04-02 16:12:29 -07:00
John Firebaugh
7f58840991 Remove unused 2015-04-02 15:30:12 -07:00
Konstantin Käfer
5ab6274f8b some cleanup 2015-04-02 15:45:39 +02:00
John Firebaugh
9331acf8e6 Add typedefs for std::chrono::steady_clock types 2015-04-02 12:28:12 +02:00
John Firebaugh
13991cf786 Rename methods to match gl-js 2015-04-01 12:37:41 -07:00