Commit Graph

1297 Commits

Author SHA1 Message Date
Konstantin Käfer
0ecdbebb09 [core] consolidate database opening workflow
Before this change, we've tried to open the database in read/write, but not create mode. In situations where the database didn't exist yet, this logged an error to the console, and we proceeded to opening it again in read/write/create mode, which actually created the file. The reason we did this is so that we could detect really old caching databases from January 2016 in case a developer upgraded from an older SDK (iOS v3.1 and earlier, Android v3.2 and earlier) that didn't have https://github.com/mapbox/mapbox-gl-native/pull/3715 yet.

However, these error messages, while innocent, look scary in the console and some users suspect that it's a bug. This change opens the file directly in read/write/create mode, omitting the first failed attempt. To handle old cache databases, we're now deleting the `http_cache` table, which was the only table in those old databases, and create the new schema, rather than deleting the entire file and recreating the Database object. In most scenarios, this will lead to one fewer opening attempt, while the database migration will continue to work for the few users who upgrade all the way from a January 2016 SDK.

Additionally, this fixes a mismatch between the Qt and non-Qt implementation: Qt doesn't support opening a file in read/write mode without the create flag. This means that we've seen a different control flow on Qt compared to the non-Qt implementation when opening a database.
2018-06-12 17:41:16 +02:00
Konstantin Käfer
4477dd4119 [core] support moving Database object during a Transaction 2018-06-12 17:41:16 +02:00
Konstantin Käfer
a50493ea51 [test] verify log messages of OfflineDatabase tests 2018-06-12 17:41:16 +02:00
Konstantin Käfer
bed86b98f1 [test] add partial message matching support to FixtureLog 2018-06-12 17:41:16 +02:00
Konstantin Käfer
1fbf3f2d48 [test] standardize on database file name and move I/O functions to util 2018-06-12 17:41:16 +02:00
Konstantin Käfer
31953c4c83 [test] pull out using namespace mbgl to reduce verbosity 2018-06-12 17:41:16 +02:00
Konstantin Käfer
9af5172f98 [core] fix undefined behavior in LineAtlas::addDash 2018-06-12 10:55:46 +02:00
Anand Thakker
2da57bd157 [core] Fix crash due to mixing legacy filters and expressions (#12065)
* Fix crash due to mixing legacy filters and expressions

In some cases, (invalid) nested filters that used a mix of legacy filter
syntax and expression syntax caused a crash due to a failure to
propagate parsing errors from deeper within the filter expression.

These errors went undetected in part because these conversion functions
returned unique_ptr<Expression> values (or vectors thereof), using
{nullptr} to represent a parsing error, but the core expression classes
expect unique_ptr<Expression> that are never null.

This changes over to using expression::ParseResult (aka
optional<unique_ptr<Expression>>), to represent conversion failure
the same way we do in the rest of the expression system.

* Fix clang 3.8 / gcc 4.9 issue
2018-06-06 11:26:08 -04:00
Ivo van Dongen
d928908ec8 [core] offline database - batch region resource inserts 2018-06-04 12:09:32 +03:00
Konstantin Käfer
2694c0df03 [build] disable parts of the build that require node when WITH_NODEJS=OFF is set 2018-05-24 21:50:29 +02:00
Konstantin Käfer
4067a61c80 [core] wrap glGetString in MBGL_CHECK_ERROR too 2018-05-24 11:19:59 +02:00
Anand Thakker
464fefab18 Accept constant expressions in non-dds properties (#11960)
Closes #11940
2018-05-23 09:54:49 -04:00
Asheem Mamoowala
78fdf5c771 Clamp TileJSON.bounds latitudes to [-90, 90] (#11964)
Fixes #11963.
2018-05-21 14:59:54 -07:00
John Firebaugh
a84ac4c8d7 [core] Align URL token replacement behavior with GL JS
I.e. preserve unknown tokens in URLs rather than replacing them with an empty string.
2018-05-18 17:19:45 -07:00
Fabian Guerra
30376f3ce1 Merge branch 'release-boba' into master
# Conflicts:
#	mapbox-gl-js
#	platform/android/CHANGELOG.md
#	platform/android/MapboxGLAndroidSDK/gradle.properties
#	platform/android/gradle/dependencies.gradle
#	platform/darwin/src/MGLVectorTileSource.mm
#	platform/darwin/src/MGLVectorTileSource_Private.h
#	platform/ios/CHANGELOG.md
#	src/mbgl/style/expression/compound_expression.cpp
2018-05-17 11:47:31 -04:00
Lauren Budorick
62c875e01b [core] Rework spec function/expression taxonomy
Ports https://github.com/mapbox/mapbox-gl-js/pull/6521, updating codegen scripts to parse new expression taxonomy.
2018-05-14 12:38:14 -07:00
Lucas Wojciechowski
a4e2c1af1f [core] Convert "legacy" filters directly into expressions (#11610)
Ports the specialized filter-* expressions from GL JS, adding them to src/mbgl/style/expression/compound_expression.cpp
2018-05-10 12:37:14 -07:00
John Firebaugh
a1195f6a9d Avoid exceptions for flow control during database creation
Unfortuntely, it's difficult to avoid all exceptions, because sqlite3_open_v2 does not reliably return SQLITE_NOTADB if the file is not a database. However, this should avoid cases where developers misinterpret the SQLITE_CANTOPEN exception as a crash, which is the common case.
2018-05-09 07:32:16 -07:00
Chris Loer
27b21363e6 [core] Only run placement for first layer per SymbolBucket
Native version of mapbox/mapbox-gl-js#6548.
Port of mapbox/mapbox-gl-js#6550.
Prevents symbols that share the same layout properties from colliding against each other.

Bump GL JS pin to get regression test.
Rename "bucketName" -> "bucketLeaderID" to make it clearer what it represents.
2018-05-03 14:17:25 -07:00
Chris Loer
65a4ee2373 [core] Port is-supported-script to native.
Native port is much simpler because RTL text support is always enabled.
2018-04-27 16:05:14 -07:00
Asheem Mamoowala
4344812ef5 [core] Streaming TileCover for polygonal regions (#11267)
A per-tile streaming algorithm for tile cover on points, lines, and polygons. Works for individual zoom levels, and not zoom ranges.
2018-04-26 07:43:38 -07:00
Chris Loer
60cce56d46 Bump GL JS pin to get tests for global symbol querying.
- Pulls over an update to line.vertex.glsl (looks like a no-op?)
 - Add test ignores for collator, is-supported-script, line-gradient
 - Exclude collator, is-supported-script, line-gradient from code generation.
2018-04-25 14:39:03 -07:00
Fabian Guerra
e08b6fe87f Merge branch 'release-boba' into master
# Conflicts:
#	circle.yml
#	include/mbgl/style/expression/let.hpp
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
#	platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java
#	platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
#	platform/android/gradle/dependencies.gradle
#	platform/android/src/example_custom_layer.cpp
#	platform/android/src/geojson/point.cpp
#	platform/darwin/src/NSPredicate+MGLAdditions.mm
#	platform/darwin/test/MGLExpressionTests.mm
#	platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec
#	platform/ios/Mapbox-iOS-SDK-symbols.podspec
#	platform/ios/Mapbox-iOS-SDK.podspec
#	platform/ios/app/MBXViewController.m
#	src/mbgl/renderer/layers/render_custom_layer.cpp
#	src/mbgl/style/conversion/filter.cpp
#	src/mbgl/style/expression/interpolate.cpp
#	src/mbgl/style/expression/value.cpp
#	test/style/filter.test.cpp
2018-04-23 10:44:02 -04:00
Anand Thakker
352d63d2ce Don't enforce ["zoom"] constraints for filters (#11672)
* Don't enforce ["zoom"] constraints for filters

Fixes #11594

* Add a couple of comments

* Fix ambiguous constructor call

* ParsingContext(optional<Type>) => ParsingContext(Type)
2018-04-12 16:02:48 -04:00
Asheem Mamoowala
099fcc3b3c Use a host interface for CustomLayer instead of function pointers (#11553)
Use a host interface for CustomLayer instead of function pointers

Co-authored-by: Julian Rex <julian.rex@mapbox.com>
2018-04-02 16:15:25 -07:00
Chris Loer
7f42e3970e [core] Convert GeometryTileWorker to "one-phase" loading
Modest simplification refactoring (issue #10457).
Also, fixes issue #11538, which was caused in part by a hole in the vestigial two-phase loading.
2018-04-02 10:39:22 -07:00
Minh Nguyễn
f4d9fb816d [core] Round-trip linear interpolators 2018-03-30 15:36:30 -07:00
Bruno de Oliveira Abinader
c6b8d9dbb4 [test] Update Map.PrefetchTiles 2018-03-30 01:45:52 -04:00
John Firebaugh
2912a1423d [core] Stringify expression syntax, not function syntax 2018-03-14 15:26:28 -07:00
Jason Wray
11d506f803 Merge tag 'ios-v3.7.6' into master 2018-03-14 12:48:30 -04:00
Asheem Mamoowala
a57be420b0 [core] TileJSON conversion clamps bounds longitude to [-180,180], per spec 2018-03-09 12:00:12 -08:00
Lucas Wojciechowski
8a3deab733 [core] Add expression filter support (#11251)
* WIP

* WIP

* WIP

* Remove Filter::operator()(const Feature&)

* WIP

* WIP

* WIP

* WIP

* Hook up expression filter evaluator

* Replace `shared_ptr` with &reference

* Fill in implementation of `void operator()(const ExpressionFilter&)`

* Fix failing tests

* Switch back to a shared_ptr per chat with @anandthakker

* Fix benchmark compilation

* Shot in the dark to fix CI

* Shot in the dark to fix CI (part 2)

* Shot in the dark to fix CI (part 3)

* In src/mbgl/style/conversion/filter.cpp, add a port of isExpressionFilter and use it to decide in Converter<Filter>::operator() whether to parse the incoming JSON as an ExpressionFilter or one of the legacy filter types

* Remove bool Filter::operator()(const GeometryTileFeature&) const

*  Ensure the map zoom is passed into filtering operations wherever applicable

* Add expression filter tests

* Addressed PR feedback

* Implement `NSPredicate *operator()(mbgl::style::ExpressionFilter filter)`

* Fix formatting& nit
2018-03-09 11:12:14 +01:00
Lucas Wojciechowski
5b3ebc4a24 [core] Add expression filter support (#11251)
* WIP

* WIP

* WIP

* Remove Filter::operator()(const Feature&)

* WIP

* WIP

* WIP

* WIP

* Hook up expression filter evaluator

* Replace `shared_ptr` with &reference

* Fill in implementation of `void operator()(const ExpressionFilter&)`

* Fix failing tests

* Switch back to a shared_ptr per chat with @anandthakker

* Fix benchmark compilation

* Shot in the dark to fix CI

* Shot in the dark to fix CI (part 2)

* Shot in the dark to fix CI (part 3)

* In src/mbgl/style/conversion/filter.cpp, add a port of isExpressionFilter and use it to decide in Converter<Filter>::operator() whether to parse the incoming JSON as an ExpressionFilter or one of the legacy filter types

* Remove bool Filter::operator()(const GeometryTileFeature&) const

*  Ensure the map zoom is passed into filtering operations wherever applicable

* Add expression filter tests

* Addressed PR feedback

* Implement `NSPredicate *operator()(mbgl::style::ExpressionFilter filter)`

* Fix formatting& nit
2018-03-08 15:48:08 -08:00
Asheem Mamoowala
7df451def6 [core] TileJSON conversion clamps bounds longitude to [-180,180], per spec 2018-03-08 13:49:56 -08:00
Asheem Mamoowala
c54035afb1 [core] Support a range of zooms in TileRange. Accounts for TilePyramid requesting parent tiles of ideal zoom tiles. 2018-03-08 13:49:56 -08:00
Konstantin Käfer
136e536159 [core, qt] move self-resetting Statement/Query object to shared header 2018-03-02 14:26:25 +01:00
Konstantin Käfer
5ca38bbde9 [core] refactor SQLite error/status codes 2018-03-02 14:26:25 +01:00
Bruno de Oliveira Abinader
48744d51d8 [test] Update Map.PrefetchTiles 2018-02-28 11:54:37 +02:00
Konstantin Käfer
aacd55c64b [core] continue loading style even if we mutate it
When we load a stale style from cache, and the user immediately starts mutating it, we should continue loading the style so that we'll get a fresh copy of the data into our cache and avoid perpetually showing the stale style.
2018-02-27 17:22:54 +01:00
Thiago Marcos P. Santos
869799a716 [tests] Added a test for getting resources from the database
This test would have flagged the Qt regression.
2018-02-26 14:43:32 +02:00
Konstantin Käfer
dfeb5b25d3 [core] continue loading style even if we mutate it
When we load a stale style from cache, and the user immediately starts mutating it, we should continue loading the style so that we'll get a fresh copy of the data into our cache and avoid perpetually showing the stale style.
2018-02-23 16:55:22 +01:00
Konstantin Käfer
5de373fff0 [core] continue loading style even if we mutate it
When we load a stale style from cache, and the user immediately starts mutating it, we should continue loading the style so that we'll get a fresh copy of the data into our cache and avoid perpetually showing the stale style.
2018-02-23 11:29:15 +01:00
Asheem Mamoowala
054d4d5ad6 [core] Support a range of zooms in TileRange. Accounts for TilePyramid requesting parent tiles of ideal zoom tiles. 2018-02-20 14:23:42 -05:00
Asheem Mamoowala
2cef23e3ff [core] Support a range of zooms in TileRange. Accounts for TilePyramid requesting parent tiles of ideal zoom tiles. 2018-02-19 11:07:54 -08:00
Molly Lloyd
8a283b0306 [core] add support for mapzen terrarium (#11154)
* add support for mapzen terrarium

* Encoding --> DEMEncoding, avoid if statement when unpacking elevation values

* add Terrarium test

* update submodule

* remove redundant checks
2018-02-14 13:17:55 -08:00
Asheem Mamoowala
aefc3daeed TileJSON Bounds allows values inclusive of world extents 2018-02-12 16:56:20 -08:00
Asheem Mamoowala
560afaf1fb Cherry pick #11176 for Agua patch 2018-02-12 13:29:22 -08:00
Asheem Mamoowala
64374711a0 Support TileJSON bounds property (#10701)
* [core] Parse TileJSON bounds property
* [core] Add TileRange and LatLngBounds::contains(CanonicalTileID)
Move LatLngBounds::contains impl to cpp file
* [core] Skip tile creation outside of tileset bounds
* [core] Fix TileRange for wrapped bounds and use for CustomTileLoader instead of LatLngBounds comparisons for tiles.
2018-02-08 12:39:30 -08:00
Konstantin Käfer
26a00f6a31 [core] prioritize Thread::pause() calls 2018-02-06 18:49:06 +01:00
Konstantin Käfer
191c0124c7 [core] don't force downloading of Open Sans fonts
When a SymbolLayer doesn't have a text-font defined, we automatically add Open Sans/Arial Unicode MS. However, when the SymbolLayer is only used for rendering icons, it doesn't have text-field defined either. In those cases, we still force downloading Open Sans/Arial Unicode MS during offline pack creation. If the user doesn't use this font, this change should save ~15MB and a few seconds in download time.
2018-01-25 17:21:18 -08:00