Commit Graph

1919 Commits

Author SHA1 Message Date
John Firebaugh
a7219a77aa [core] Don't crash when removing a shape annotation whose layer was never created 2015-10-30 14:36:07 -07:00
Minh Nguyễn
557b8afb7c [core][iOS] Source iOS styles from default_styles
Moved mbgl::util::default_styles to a more appropriate location, where iOS platform code can also find it. Moved -[MGLMapView bundledStyleURLs] (which is now deprecated) and the style switcher in iosapp to default_styles.

Added a collection of convenience methods for getting style URLs. It makes little sense to layer an enum atop this, as MapKit does, because MGLMapView styles aren’t limited to this set. A good analogy is UIColor. This also makes for a good entry point for future runtime styling APIs.

Introduced independent constants for each default style, because it’s more common to need access to a particular style than to iterate over them. This fact is apparent in the MGLStyle class, which now uses macros and assertions to ensure that it’s kept up-to-date with changes in default_styles.

/ref #1462
2015-10-30 13:09:37 -07:00
John Firebaugh
ddc4251074 [core] Polymorphic bucket creation 2015-10-30 11:19:28 -07:00
John Firebaugh
540c6eca15 [core] Eliminate StyleBucket 2015-10-30 11:19:28 -07:00
John Firebaugh
8c3b3cb792 [core] Use current copy of style layers when reparsing tiles
This fixes adding shape annotations after VectorTileData objects have
been created for annotations already, and will also be necessary for
the dynamic Style API.
2015-10-30 11:17:01 -07:00
John Firebaugh
7669e02062 [core] Monitor annotation tiles, rather than completely invalidating them
Fixes #1688
2015-10-30 11:17:01 -07:00
John Firebaugh
f745f271e3 [core] When reparsing a tile, replace all existing buckets
A tile may go from having particular layers, to not having them.
(Annotation tiles in particular.)
2015-10-30 11:17:01 -07:00
John Firebaugh
f6f5d9608d [core] Separate type for RasterTileParseResult 2015-10-30 11:17:00 -07:00
John Firebaugh
7821dccae5 [core] Polymorphic layout and paint parsing 2015-10-29 16:46:49 -07:00
John Firebaugh
e2dc956eb6 [core] Merge LiveTileData into VectorTileData
To encapsulate the differences, this introduces an abstract
GeometryTileMonitor class, with concrete VectorTileMonitor and
AnnotationTileMonitor implementations, and makes pbf parsing for
VectorTile data happen lazily in getLayer, since we want that to
happen on the worker thread, rather than when VectorTile is created.

Fixes #2792
2015-10-29 12:05:40 -07:00
Thiago Marcos P. Santos
978da4224e [core] Set names to threads on Linux
Makes debugging/profiling easier.
2015-10-29 11:54:43 +02:00
John Firebaugh
d20bcb0795 [core] Workaround for #2808 2015-10-28 15:54:36 -07:00
John Firebaugh
014b517820 [node] Output debug logs when a render test times out 2015-10-28 15:54:34 -07:00
Tom MacWright
c80c823da2 [core] Ensure URL normalization is safe. Fixes #2695 2015-10-28 10:44:33 -04:00
Ansis Brammanis
750c72f324 improve gestures in perspective view
The location under your finger stays under your finger as you pan.
The location you double tap to zoom stays at the same point.
The location at the center of a pinch zoom stays at the center.
The location at the center of a rotation stays at the center.
2015-10-26 12:48:03 -07:00
John Firebaugh
bb6241844a [core] Extract PaintPropertiesMap 2015-10-26 12:00:11 -07:00
Thiago Marcos P. Santos
c65f809651 [core] Move parseCacheControl() up in the class hierarchy
Avoid duplicating it on all the ports.
2015-10-26 18:37:51 +02:00
Konstantin Käfer
75dec6ffac [core] always reparse with the freshest possible placement config
Fixes an issue where updates to stale tiles would remove labels altogether until the map was rotated.
2015-10-26 16:44:55 +01:00
Konstantin Käfer
c0c554e36f [core] reparse tiles when new data arrives
We're now reparsing tiles when they expire. We're also swapping out buckets atomically to avoid flickering data; i.e. we're displaying the old data as long as we don't have a new parsed bucket for that layer yet. The parsed buckets now live in the *TileData objects rather than in the TileWorker; only partially parsed == pending buckets will remain in the TileWorker. Once they're parsed, they're moved to the *TileData object.
2015-10-26 15:54:27 +01:00
Konstantin Käfer
5173bf1bb8 [core] Make response data shared to avoid excessive copying 2015-10-26 15:54:27 +01:00
Konstantin Käfer
4e3503ea6c [core] do not use std::atomic_* with shared_ptrs
It's not implemented in GCC 4.9.2's stdlib (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57250). Instead, we're now always using a mutex to protect access; we previously created a mutex only on cancelation, but since we're always canceling now, it makes sense to allocate it right away.
2015-10-26 15:54:27 +01:00
Konstantin Käfer
9bbd9aba3a [core] set a timer and auto-refresh requests when they expire
When we get a request with an explicit expiration time, we're now starting a timer, and will trigger a refresh once the data expires. This gives requesters a chance to update their data.
2015-10-26 15:54:27 +01:00
Konstantin Käfer
6a7334b882 [core] add support for stale responses
We're now returning stale responses from cache. Those responses will have the `stale` flag set to true. Currently, all requesters in the core code discard stale responses, and cancel the request immediately after they got a non-stale response.
2015-10-26 15:54:27 +01:00
Konstantin Käfer
096a3edf39 [core] use RAII-style lifetime tracking of Request objects 2015-10-26 15:54:27 +01:00
Konstantin Käfer
94a5ac857f [core] all requests have to be canceled explicitly now
By not automatically destroying Request objects after the result has been delivered, we are making sure that we can potentially fire the callback multiple times without adverse effects. This means that you have to hold on to the result of fs->request(), can explicitly cancel it if you don't want to be notified of data changes anymore. Not doing so will monitor the request indefinitely and will prevent the app from exiting.
2015-10-26 15:54:27 +01:00
Thiago Marcos P. Santos
1007dc9754 [core] Initialize attributes before using them
Spotted by valgrind.
2015-10-26 10:41:16 +02:00
John Firebaugh
8d79c25765 [core] Remove MapData dependency from StyleParser
MapData was needed for two things: getting the default transition and
fade durations, and detecting still rendering vs. continuous.

The first is avoided by making transition durations optional, and
supplying the default fallback value at evaluation time. The second did
not fix the still rendering issue, and will be followed up with a
different approach in a later commit.
2015-10-23 13:56:55 -07:00
John Firebaugh
0665b64590 [core] Introduce StyleCalculationParameters
This makes subsequent changes to the the parameter list less intrusive.
2015-10-23 13:56:55 -07:00
John Firebaugh
7a03d734fd [core] Respect source layer z-order for style-sourced annotations 2015-10-23 13:27:14 -07:00
Bruno de Oliveira Abinader
46e2f13e68 [core] Fix integer overflow for high maximum zoom levels 2015-10-23 11:00:52 -07:00
John Firebaugh
1f4144c65a [core] Remove StyleLayer::isBackground() 2015-10-22 17:53:16 -07:00
Bruno de Oliveira Abinader
54858dae8c [core] Added save/restore capabilities to GL config 2015-10-22 16:02:39 -07:00
Bruno de Oliveira Abinader
a1c53d92e5 [core] Added stencilOp, depthFunc and blendFunc to GL config
All GL values are now reset upon Painter setup.
2015-10-22 16:02:39 -07:00
Bruno de Oliveira Abinader
5fa144647d [core] Added GLContextMode to MapData
Adding new mbgl::GLContextMode enum to mbgl::Map ctor, which gets stored
in MapData. In shared GL context environments, we cannot assume that the
GL state that has been left since the last draw is the same, so we reset
the GL configurations to their default values.
2015-10-22 16:02:39 -07:00
John Firebaugh
c46a8254c4 [core] Style-sourced shape annotation properties
This introduces the possibility to source the type and style properties
of a shape annotation from a designated layer in the style.
2015-10-22 15:27:53 -07:00
John Firebaugh
3afc8b4a29 [core] Introduce StyleLayer subclasses 2015-10-22 09:34:40 -07:00
John Firebaugh
df89de5cc5 [core] Rationalize style property classes: <type>{Paint,Layout}Properties 2015-10-22 09:21:30 -07:00
Bruno de Oliveira Abinader
ead4ca599a [core] Fix transition to default style when no classes are applied
Some property transitions were being set to their fallback values when
no classes are being used. This issue is particularly perceived when the
default transition duration is not zero (animated transitions).
2015-10-21 14:02:08 -07:00
Bruno de Oliveira Abinader
6824a24acd [core] Removed time param from Painter::render
Animation time can be obtained directly from MapData.
2015-10-21 11:20:45 -07:00
Bruno de Oliveira Abinader
0045eef00a [core] Moved Painter::setup() to Painter ctor 2015-10-21 11:20:39 -07:00
Bruno de Oliveira Abinader
ad3078e73d [core] Remove redundant setDebug() from Painter
This information can be obtained directly from MapData.
2015-10-21 11:20:20 -07:00
Bruno de Oliveira Abinader
5db4670d78 [core] Added more transform state getters
Some platforms requires specific information that was previously not
available in public API, but stored internally in TransformState object.
2015-10-21 11:06:51 -07:00
Jason Wray
e5aab73b60 [core] only check for mapbox:// at the start of the failed request's URL 2015-10-21 11:38:01 -04:00
Jason Wray
ae5a345cc4 [core] Improve error message when style is not found or is incompatible
Attempting to use a Mapbox-hosted incompatible raster map/style with GL
would throw a simple 404, without any indication of the real issue.

Fix #1724, ref #1841
2015-10-21 11:38:01 -04:00
John Firebaugh
00a1c2343a [core] Remove shape layers from the style (fixes #2405) 2015-10-20 13:54:20 -07:00
John Firebaugh
c5b95032a5 [core] Annotation refactor 2015-10-20 13:54:19 -07:00
John Firebaugh
597b2b4851 [core] Pull annotation typedefs to own header; add AnnotationID 2015-10-20 13:54:19 -07:00
John Firebaugh
8baa804a44 [core] Fix swapped lat/lon in geo.cpp 2015-10-20 13:54:19 -07:00
Bruno de Oliveira Abinader
6a1b9b31a6 [core] MapContext setStyle{URL,JSON} should ignore redundant calls
Our engine should be robust enough to ignore redundant calls and avoid
triggering a whole style update if the style URL and/or JSON are the
same.
2015-10-16 13:16:02 +11:00
Leith Bade
2ee7b02189 [core] [android] Fix InfoWindow topOffsetPixels adjustment when switching styles
Fixes #2599
Make getTopOffsetPixelsForAnnotationSymbol private
Also implements MapChangeWillStartLoadingMap, MapChangeDidFinishLoadingMap
Paritally implements #630
2015-10-16 13:06:49 +11:00