Commit Graph

34 Commits

Author SHA1 Message Date
galinelle
bc45d65c58 Add additional transformState::latLngToScreenCoordinate getter (#16311)
This change adds a latLngToScreenCoordinate overload, to retrieve
the projected vec4 in additional to the ScreenCoordinate object,
that is useful to detect whether the projected latLng is in front
or behind the camera.
2020-03-19 18:53:09 +02:00
Juha Alanen
ba315b4bbb [test] Add test for min and max pitch options 2020-02-25 16:54:44 +02:00
Juha Alanen
a4c4de2828 [test] Fix failing tests on iOS 2020-02-14 12:01:52 +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
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
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
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
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
ba7427b4ac [core] Transform{State}: s/angle/bearing/ 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
Konstantin Käfer
4a3c4edb59 [android] add support for gnustl 2018-09-11 11:43:54 +02:00
Bruno de Oliveira Abinader
1df45a5e42 [core] Check if frameZoom is NaN in Transform::flyTo callback 2017-06-28 20:59:56 +03:00
Bruno de Oliveira Abinader
433e54e636 [core] Clamp to scale boundaries in TransformState::setLatLngZoom 2017-06-28 20:59:56 +03:00
Bruno de Oliveira Abinader
99cfbacdfb [core] Make TransformState LatLngBounds optional 2017-06-01 17:04:09 +03:00
Bruno de Oliveira Abinader
09a2271576 [core] Ignore shortest path in Map::pixelForLatLng 2017-04-14 12:52:20 -07:00
Bruno de Oliveira Abinader
2f4d162deb [core] Tighten geo.hpp ctors 2017-04-14 12:33:13 -07:00
John Firebaugh
f1c06f8d83 [all] Remove redundant scale-related camera methods
We don't need to have two different measurement systems for map zoom.
2017-04-13 10:28:44 -07:00
Bruno de Oliveira Abinader
c4fc89977b [core] Added {set,get}{Min,Max}Pitch 2017-04-11 12:51:09 +03:00
Bruno de Oliveira Abinader
c1c6c1e298 [core] Added Map::{get,set}LatLngBounds 2017-04-11 12:51:09 +03:00
Bruno de Oliveira Abinader
e5aa4d70cd [core] Updated Size::isEmpty and TransformState::valid checks 2017-04-10 18:01:28 +03:00
John Firebaugh
16a2839e23 [all] Make LatLng coordinates read-only 2017-04-06 09:22:51 -07:00
John Firebaugh
0314a46ee4 [core] Tighten LatLng and other geo.hpp classes
* Remove LatLng::null and enforce invariants
* Remove unnecessary operator bool()
2017-04-06 09:22:51 -07:00
Bruno de Oliveira Abinader
fc70cbf1e1 [core] Replace MapChange enum with MapObserver 2017-03-15 14:53:32 +02:00
Konstantin Käfer
62ea1f2185 [core] remove trailing whitespace, add trailing newlines, add space after // 2017-01-27 11:44:16 +01:00
Ansis Brammanis
38b5cb0c77 [core, ios] replace altitude with fov
ported from -js: eb6c6596c6a7a61363d30356674e0002153b1d19

`altitude` was a terribly-named variable that was used to indirectly
control the fov. This should eliminate some confusion.

`altitude` was equivalent to `cameraToCenterDistance / height`
2016-12-21 15:46:36 -08:00
Ivo van Dongen
c810d16f0d [android][build] core tests - initial setup for rendering tests 2016-11-27 18:50:24 +02:00
Bruno de Oliveira Abinader
7b3e24d74a [core] Cleanup TransformState::getIntegerZoom 2016-10-31 16:53:07 +02:00
Konstantin Käfer
62b56b799a [core] change std::array<uint16_t, 2> to mbgl::Size 2016-10-27 18:30:58 -07:00
Konstantin Käfer
3f3fc7b772 [test] add .test.cpp suffix to test case files 2016-09-28 16:34:22 +02:00