Commit Graph

159 Commits

Author SHA1 Message Date
Alexander Shalamov
3b1a8b8c30 [core] Add unit test for Source::setPrefetchZoomDelta
Test verifies that tile pyramid will request only 4 tiles for
current zoom level, if Source's setPrefetchZoomDelta is 0.
2020-02-11 10:40:30 +02:00
Alexander Shalamov
879c44f661 [core] Modularize FileSource codebase (#15768)
* [core] Introduce FileSourceManager and use it for default platform impl

  - Add `FileSourceManager` interface that provides access to `FileSource`
    instances and means of registering / unregistering `FileSource` factories
  - Split `DefaultFileSource` into smaller parts
  - Add `DatabaseFileSource` interface and it's default implementation
  - Remove inter-dependencies between concrete `FileSource` classes

* [build] Add files to next build system

* [core] Add generic property setters / getters

* [core] Remove setOnlineStatus from OnlineFileSource interface

* [core] Hide threading implementation details from DatabaseFileSource interface

* [core] Make DB file source methods virtual

* [core] Add documentation for DatabaseFileSource and rename one method

* [core] Use simple callback instead of ActorRef

* [core] Remove ActorRef from OnlineFileSource public header

* [core] Add callback to FileSource::forward async API

* [core] Pass OfflineRegionDefinition by value

* [core] Update tests to use modular file sources

* [core] Update unit tests

* [core] Update unit tests after rebase

* [core] Backport low prio fix for cached requests

* [core] Backport pack database

* [core] Return removed factory from unRegisterFileSourceFactory

* [core] Rename shadowed args in onlinefilesource

* [core] Remove simple std::function callback aliases

* [core] Expose online file source property keys in public header file

* [test-runner] Add proxy file source test runner

* [cache] Update mbgl-cache utility to use new file source

* [metrics] Rebaseline binary size metrics

* [offline] Update offline utility

* [core] Update changelog
2020-01-13 10:57:23 +02:00
Juha Alanen
c7c441167d [test] Increase the threshold for Map.Offline test on Android 2020-01-10 17:19:30 +02:00
Peng Liu
236afc0395 [android][core] Add Map::latLngBoundsForCameraUnwrapped and jni binding for getVisibleCoordinateBounds. (#16069)
* [android] Add getVisibleCoordinateBounds method.
* Fix Map::latLngBoundsForCamera, add Android binding for getVisibleRegionBounds.
* Add unit tests for CameraToLatLngBoundsWithRotation and CameraToLatLngBoundsCrossDateLine.
* Move API breaking changes to a new method name latLngBoundsForCameraUnwrapped.
2020-01-09 15:53:23 +02:00
Aleksandar Stojiljkovic
2fd9d4a1fe Include padding when testing camera scale in cameraForLatLngBounds
Repurpose LatLngBoundsToCameraWithBearingAndPitch to test scaling and camera setup, both with and without padding.
This adds testing of path not covered in mapbox/mapbox-gl-native-ios#59.
2019-12-17 16:19:33 +02:00
Ander Conselvan de Oliveira
4c1d03c257 [core] Fix MapSnapshotter build failure on Windows
MSVC implementation of std::promise is buggy and only works with types
that can be default-constructed. To avoid a compilation failure in the
instantiation of ask() inside MapSnapshotter::getRegion(), which creates
a std::promise<LanLngBounds>, make LatLngBounds' default constructor
public.
2019-11-13 13:31:01 +02:00
Mikko Pulkki
a7a7e8cbe2 [render-test] Implement gfx probe for tracking gpu resources 2019-10-30 14:32:27 +02:00
Mikhail Pozdnyakov
f1a28377b5 [core] Add Map.NoHangOnMissingImage unit test 2019-10-28 13:02:32 +02:00
Mikhail Pozdnyakov
d446b3382b [core] Enable move semantics for StyleProperty 2019-09-27 19:17:25 +03:00
Ander Conselvan de Oliveira
bb9b1ab624 [core] Return enum layer property values as string
The output of Layer::getProperty is a mapbox::base::Value which is
equivalent to JSON. When setting the value of an enum property via JSON
its value would be a string, so it would be natural to return a string
too.

Also, the numbers generated depend on the enum definition. They are not
part of the style spec.
2019-09-27 17:09:45 +03:00
Mikhail Pozdnyakov
5304bbc438 [core] Layer::getProperty supports layout properties 2019-09-27 13:08:53 +03:00
Mikhail Pozdnyakov
34ab7be225 [core] Layer::getPaintProperty() -> Layer::getProperty() 2019-09-26 15:54:03 +03:00
Mikhail Pozdnyakov
e78c31c4b5 [core] LayerProperty -> StyleProperty 2019-09-26 11:57:39 +03:00
Mikhail Pozdnyakov
b5862c2127 [core] Add Map.UniversalStyleGetter test 2019-09-26 11:57:39 +03:00
Mikhail Pozdnyakov
6899337f86 [core] Add Map.Issue15342 unit test
The newly added test checks the fix for constant repaint,
caused by `RenderSource::hasFadingTiles()` returning `true` all the time.
2019-09-12 00:40:08 +03:00
Mikhail Pozdnyakov
8af78ddbb9 [core] Update MapObserver::onDidFinishRenderingFrame() API 2019-09-12 00:40:08 +03:00
Aleksandar Stojiljkovic
73d9f26d03 [core] Limit pitch based on edge insets. Fix max Z calculation in getProjMatrix.
Patch partly fixes #15163 in a way that it doesn't allow loading tens of thousands of tiles and attempt to show area above horizon:

Limit pitch based on edge insets. It is not too bad - current limit of 60 degrees stays active until center of perspective is moved towards the bottom, to 84% of screen height. The plan is to split removal of 60 degrees limit to follow up patch.

Fix max Z calculation in getProjMatrix. TransformState::getProjMatrix calculation of farZ was complex with possibility to lead to negative z values. Replacing it with simpler, precise calculation:
furthestDistance = cameraToCenterDistance / (1 - tanFovAboveCenter * std::tan(getPitch()));

TransformState::getProjMatrix calculation of farZ was an aproximation. Replacing it with simpler, but precise calculation.

Related to: #15163
2019-08-01 09:28:36 +03:00
Mikhail Pozdnyakov
be5aa1806b [core] Added unit test for issue 15216 2019-07-26 11:23:13 +03:00
Konstantin Käfer
7f9274035b [core] refactor program object creation 2019-05-28 16:11:05 +02:00
Aleksandar Stojiljkovic
9809c9f8f5 [core] Offset viewport center when edge insets are specified
The change is implemented in TransformState::getProjMatrix, the rest of the code is making sure that existing API contracts stay and there are tests verifyingrendering and render query processing only items within screen and given tolerance around screen edges.

MapView: don't bake edge insets into relalculated camera center. Keep edge insets as property of camera in TransformState (similar to pitch, zoom, bearing) independent from specified camera center. Interpolate edge insets in animation.

iOS Demo app: "Turn On/Off Content Insets" pitch the camera and navigate to convenient location in Denver, where streets are parallel to cardinal directions, to illustrate viewport center offset when edge insets are set.

Tests:
ViewFrustumCulling: although Annotations are deprecated, queryRenderedFeatures related tests in Annotations would need to get ported and decided to add the edge insets related query tests next to them. Verify frustum culling (render+queryRenderedFeatures) With different camera and edge insets setups. TODO: port Annotations tests.

Transform.Padding: Verify that coordinates take proper place on screen after applying edge insets.

LocalGlyphRasterizer: verify text rendering when applying padding.

Related to #11882: both use projection matrix elements [8] and [9].

Alternative approach to this was to increase and offset map origin so that the screen would be a sub-rectangle in larger map viewport. This approach has a drawback of unecessary processing the items that are outside screen area.

Fixes #12107, #12728, navigation-sdks/issues/120
2019-05-28 14:38:01 +03:00
Aleksandar Stojiljkovic
3cd8c6c1fd [core] Refactor HeadlessFrontend/Backend: GL separation and factory (#14692)
Refactor out HeadlessFrontend and HeadlessBackend gl independent code to gfx.
Define gl::HeadlessBackend as subclass, instantiated by gfx::HeadlessBackend static factory method.
GL dependent tests are still using gl::HeadlessBackend directly (not through gfx).
2019-05-21 07:37:49 +03:00
Thiago Marcos P. Santos
06f1dc48a2 [core] Make the BackgroundScheduler a singleton
- Do not carry it over everywhere as parameter, it is a shared
  instance anyway and the lifecycle is pretty much the app lifecycle
  from the moment we instantiate a map.
- Rename to BackgroundScheduler because it is a Scheduler that will
  do tasks in the background, we don't make assumptions if it is a
  thread pool or a single thread.
- Most importantly, remove the dependency from `core` on `platform`.
2019-05-10 14:20:38 +03:00
Konstantin Käfer
3ceabcd3ec [core] clang-tidy fixes 2019-04-05 11:49:17 +02:00
Konstantin Käfer
66c020034e [core] refactor RendererBackend 2019-04-05 11:49:17 +02:00
Konstantin Käfer
a782a6d15b [core] move BackendScope to gfx namespace 2019-04-05 11:49:17 +02:00
Sudarsana Babu Nagineni
7af00a404f [core] Include pixelRatio property in MapOptions
Move pixelRatio property from Map constructor to MapOptions.
2019-03-28 16:41:15 +02:00
Sudarsana Babu Nagineni
f5064e7108 [test] Add unit tests for MapOptions 2019-03-28 16:41:15 +02:00
Sudarsana Babu Nagineni
1cc1d4ea08 [core] Add setter/getter for size property in MapOptions 2019-03-28 16:41:15 +02:00
Łukasz Paczos
419bfbe0eb [core] harden fetching camera for bounds when padding is excessive 2019-03-25 17:53:55 +01:00
Bruno de Oliveira Abinader
d5868d3da8 [core] Remove file source from public Map ctor 2019-03-20 21:30:08 +02:00
Ander Conselvan de Oliveira
5733440747 [core] Group Map LatLngBounds, min and max zoom methods
Group bounds, minimum and maximum zoom related methods together using
the new BoundOptions.

v2: Document that getBounds() initializes all optional fields.
  - Add test for getBounds() on a map with default values.
2019-03-14 18:33:11 +02:00
Ander Conselvan de Oliveira
11de777628 [core] Remove optional from Map::setLatLngBounds()
This is a first step into grouping together bounds related Map methods
into one that takes a "BoundOptions" object. LatLngBounds::unbounded()
replaces an undefined optional<LatLngBounds>.

v2: Document LatLngBounds::unbounded()
2019-03-14 18:33:11 +02:00
Ander Conselvan de Oliveira
a73cc9d8e3 [core] Remove support for setting minimum and maximum pitch
Support for limiting pitch was introduced in commit c4fc89977b ([core]
Added {set,get}{Min,Max}Pitch) in 2017 but was never exposed by the
platform SDKs. Simplify the Map interface by removing this unused
feature.

v2: Add util::PITCH_MIN
2019-03-14 18:33:11 +02:00
Bruno de Oliveira Abinader
8cc100bfd5 [core] Get FileSource via UpdateParameters in Renderer::Impl 2019-03-13 17:56:44 +02:00
Sudarsana Babu Nagineni
5e2b6bf636 [core] Add MapOptions to define properties of Map
To simplify the Map constructor, introduce MapOptions
interface to define the properties that can be set on
a Map.
2019-03-08 18:20:55 +02:00
Sudarsana Babu Nagineni
744d92e763 [core] consolidate Axonometric rendering API
Instead of having individual APIs for setting axonometric
and skew options, create ProjectionMode struct that holds
all the relevant options for Axonometric rendering and
introduce setter/getter on the Map for those options.
2019-03-08 17:36:40 +02:00
Bruno de Oliveira Abinader
bc033ad8d4 [core] util::wrap(): std::fmod is not lossless 2019-03-06 18:09:14 +02:00
Bruno de Oliveira Abinader
586b22c0df [core] Remove map coordinate setters/getters 2019-03-04 14:45:32 +02:00
Bruno de Oliveira Abinader
ba7427b4ac [core] Transform{State}: s/angle/bearing/ 2019-03-04 14:45:32 +02:00
Bruno de Oliveira Abinader
f5f10ec119 [core] Remove map zoom setters/getters 2019-03-04 14:45:32 +02:00
Bruno de Oliveira Abinader
e5ed9d9ddf [core] Use unwrapped longitude for bounds check 2019-02-26 21:17:31 +02:00
Bruno de Oliveira Abinader
7d407175e0 [core] Ensure 'isPanning' is true when panning a full round 2019-02-26 21:17:31 +02:00
Bruno de Oliveira Abinader
20ca1a0418 [core] Cleanup Transform, use {jump,ease}To() instead 2018-11-27 21:38:36 +02:00
Bruno de Oliveira Abinader
52cce7925d [core] Camera center and anchor points are mutually exclusive 2018-11-26 17:15:51 +02:00
Bruno de Oliveira Abinader
db2e1b2e5f [core] Add RendererState::{pixelForLatLng,latLngForPixel} 2018-11-14 12:22:22 +02:00
Bruno de Oliveira Abinader
55710cbb67 [core] Added RendererState::has{Image,Layer,Source} 2018-10-25 16:23:40 +03:00
Konstantin Käfer
8bf66ef7a7 [core] remove some uses of <iostream> and <sstream> 2018-10-23 12:23:40 +02:00
Bruno de Oliveira Abinader
ea51b11dcc [core] Introduce mbgl::RendererState 2018-10-19 12:05:16 +02:00
Bruno de Oliveira Abinader
98c36fc06e [core] CameraOptions receives and outputs angle and pitch as degrees, not radians 2018-10-19 12:05:16 +02:00
Konstantin Käfer
4a3c4edb59 [android] add support for gnustl 2018-09-11 11:43:54 +02:00