Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Fix flyTo trajectory; port to OS X #3301

Merged
merged 5 commits into from
Dec 15, 2015
Merged

Fix flyTo trajectory; port to OS X #3301

merged 5 commits into from
Dec 15, 2015

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Dec 15, 2015

This PR fixes the trajectory of mbgl::Map::flyTo() to stay within the Earth’s atmosphere. When this function was originally ported from GL JS, there was apparently some confusion between zoom level and scale.

flyTo() now transitions the pitch in addition to the position and bearing; calls transition frame/finish callback functions, allowing client code to chain animations; and recognizes the same speed and curve parameters as GL JS. Unfortunately, these two parameters appear to be specific to the animation formulae and not expressed in physical units; I haven’t exposed them publicly because I don’t know of a good way to explain them other than “numbers that you fiddle with”. (They come from mapbox/mapbox-gl-js@983ae5e.)

A -flyToCamera:withDuration:completionHandler: method has been added to the OS X version of MGLMapView. It works just like the iOS version, which I refactored to accommodate future variations that specify speed, easing, etc. In the osxapp demo application, the Debug menu now has a “World tour” command that takes you on a grand tour of the world by air, demonstrating flyTo functionality. The same demonstration is available in iosapp via the gear menu.

Fixes #3296, fixes #3297.

/cc @adam-mapbox @friedbunny @zugaldia @incanus @bleege

@1ec5 1ec5 added bug GL JS parity For feature parity with Mapbox GL JS iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS labels Dec 15, 2015
@1ec5 1ec5 self-assigned this Dec 15, 2015
@1ec5 1ec5 added this to the ios-v3.1.0 milestone Dec 15, 2015
@bleege bleege mentioned this pull request Dec 15, 2015
@bleege
Copy link
Contributor

bleege commented Dec 15, 2015

Running make iproj on this branch results in the following. Will try the OS X build make xproj next.

Brads-MacBook-Pro:mapbox-gl-ios brad$ make iproj
build: osx/x86_64
host: ios/all
libs: headless=none  platform=ios  asset=fs  http=nsurl  cache=sqlite
* Recreating project...
This build is within a git repository
* Using Python 2.7.10
* Already installed at /Users/brad/development/mapbox-gl-ios/mason_packages/headers/boost/1.59.0
* Not using boost_libprogram_options
* Not using openssl
* Not using libcurl
* Not using glfw
* Not using libpng
* Not using jpeg
* Installed system-provided sqlite 3.8.10.2
* Linking sqlite system dynamically
* Downloading binary package ios-9.2/libuv/1.7.5.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (22) The requested URL returned error: 403 Forbidden
* Binary not available yet for ios-9.2/libuv/1.7.5.tar.gz
* Downloading https://github.com/libuv/libuv/archive/v1.7.5.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   119    0   119    0     0    331      0 --:--:-- --:--:-- --:--:--   332
100 1016k  100 1016k    0     0   869k      0  0:00:01  0:00:01 --:--:-- 1556k
* Building for Platform 'ios/9.2'...
./autogen.sh: line 28: automake: command not found
./autogen.sh: line 33: test: : integer expression expected
./autogen.sh: line 34: test: : integer expression expected
+ glibtoolize
glibtoolize: putting auxiliary files in '.'.
glibtoolize: linking file './ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
glibtoolize: linking file 'm4/libtool.m4'
glibtoolize: linking file 'm4/ltoptions.m4'
glibtoolize: linking file 'm4/ltsugar.m4'
glibtoolize: linking file 'm4/ltversion.m4'
glibtoolize: linking file 'm4/lt~obsolete.m4'
+ aclocal -I m4
./autogen.sh: line 44: aclocal: command not found
make[1]: *** [config/ios-all.gypi] Error 127
make: *** [Xcode/ios] Error 2
Brads-MacBook-Pro:mapbox-gl-ios brad$ 

@bleege
Copy link
Contributor

bleege commented Dec 15, 2015

make xproj worked as expected and I took the amazing "World Tour" ride (you should consider charging for tickets @1ec5 ). The only issue that I encountered were slow loading and display of tiles when panning from one city to the next (see screenshot below). Otherwise, this is exactly what we need and should merge in sooner rather than later so that other platforms (iOS and Android) can build bindings to flyTo.

screen shot 2015-12-15 at 10 43 03 am
Slow Loading / Display Of Tiles When Flying

screen shot 2015-12-15 at 10 42 45 am
Mapbox Garage in DC

@1ec5
Copy link
Contributor Author

1ec5 commented Dec 15, 2015

The make iproj failure looks unrelated to this change. If you haven't run that lately, you may need to make clean && make distclean first.

@1ec5
Copy link
Contributor Author

1ec5 commented Dec 15, 2015

The only issue that I encountered were slow loading and display of tiles when panning from one city to the next (see screenshot below).

I believe this is simply the fact that we're loading lots of tiles at high zoom levels along the flight path. #2006 will help, but #1626 is the main reason for the experience being worse than in GL JS.

@bleege
Copy link
Contributor

bleege commented Dec 15, 2015

If you haven't run that lately, you may need to make clean && make distclean first.

Just ran them both and tried again. Same error message. FWIW, the first attempt I ran make clean before trying.

@bleege
Copy link
Contributor

bleege commented Dec 15, 2015

@1ec5 found the problem. Turns out I didn't have automake installed on my Mac as it was a recent addition to the dependencies list. Once installed via homebrew I was able to run make clean, make distclean, and then make iproj and everything worked as expected. The only thing I didn't see in the iOS app was a way to start the "World Tour" via the UI. That's likely not built though as the focus of this PR is / was OS X.

@1ec5
Copy link
Contributor Author

1ec5 commented Dec 15, 2015

I didn't include the world tour on iOS because we're out of room to add more gear menu options without scrolling, but it would be trivial to do so.

1ec5 added 5 commits December 15, 2015 12:52
Corrected some fairly opaque code that was incorrectly ported from GL JS the first time around in #3171, causing the trajectory to extend far into the Earth’s orbit. Also transition pitch while flying, call transition frame/finish callback functions, and recognize the same “speed” and “curve” parameters that GL JS does.

Fixes #3296, fixes #3297.
A new Debug menu command takes you on a tour of the world by air.
@1ec5 1ec5 force-pushed the 1ec5-direct-flight-3296 branch from dc3af1f to 4e0e816 Compare December 15, 2015 20:52
@1ec5 1ec5 merged commit 4e0e816 into master Dec 15, 2015
@1ec5 1ec5 removed the in progress label Dec 15, 2015
@1ec5 1ec5 deleted the 1ec5-direct-flight-3296 branch December 15, 2015 21:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug GL JS parity For feature parity with Mapbox GL JS iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flyTo doesn’t call transition frame/finish callbacks flyTo launches into geosynchronous orbit
2 participants