Commit Graph

115 Commits

Author SHA1 Message Date
Konstantin Käfer
61920071cd [core] split headless_view.cpp into implementation-specific files
also adds a EAGL implementation for iOS
2016-03-22 11:56:01 -07:00
Minh Nguyễn
6b7d635d04 [ios, osx] Elaborate dependencies
Also avoid referring to Mapbox SDKs with Apple’s SDK names.
2016-03-21 11:49:51 -07:00
Tom MacWright
544780f237 Add Darwin readme 2016-03-21 14:02:27 -04:00
Minh Nguyễn
f6c21a0efe [ios, osx] Allow null completion handlers in MGLOfflineStorage 2016-03-14 11:54:31 -07:00
Minh Nguyễn
7e4dce0ca4 [ios, osx] Removed pack nil check from MGLOfflineRegionObserver
Due to ARC, MGLOfflinePack can be deallocated at any time following its initialization. -dealloc ensures that the offline region observer is unset, but that step is asynchronous; there is no guarantee that it completes before the first status change update. In fact, the pack is deallocated before the first status change update unless it is captured outside of the MGLOfflinePackAdditionCompletionHandler. The pack nil check is unnecessary because the subsequent code would be a no-op.
2016-03-14 11:24:31 -07:00
Minh Nguyễn
ff9c3a57b0 [ios, osx] Renamed MGLOfflineTask to MGLOfflinePack
“Offline pack” more effectively communicates the persistent nature of the downloaded content.
2016-03-10 17:14:14 -08:00
Minh Nguyễn
ee20fd8fd8 [ios, osx] Avoid unregistering observer for invalid task 2016-03-10 17:14:14 -08:00
Minh Nguyễn
7fa3b92429 [ios, osx] Tightened offline task state
Fixed a race condition that could occur if a progress update comes after a call to remove the task but before the removal is complete. Avoid synchronously setting the task’s state inside -resume and -suspend; instead, rely on the observer to set the state asynchronously.
2016-03-10 17:14:14 -08:00
Minh Nguyễn
77d99584ce [ios, osx] Distinguish between unknown and inactive state 2016-03-10 17:08:58 -08:00
Minh Nguyễn
68ba0712f7 [ios, osx] Privatized offline region observer 2016-03-10 17:08:58 -08:00
Minh Nguyễn
c335847451 [ios, osx] Invalidate task immediately upon removal 2016-03-10 17:08:58 -08:00
Minh Nguyễn
e218728f3a [ios, osx] Fixed crash interacting with MGLOfflineTask
Added a missing conditional to the invalidation checking macro that I factored out at the last minute.
2016-03-10 17:08:58 -08:00
Minh Nguyễn
8824237e2d [ios, osx] Documented offline APIs
Also categorized offline symbols for jazzy and moved styleURL from MGLOfflineRegion to MGLTilePyramidOfflineRegion, since you never know if there will be a region type not constrained by a style in the future.
2016-03-10 17:08:58 -08:00
Minh Nguyễn
f5ac63dfec [ios, osx] Renamed offline classes
Renamed SDK classes related to offline viewing to more closely match the terminology used by mbgl and the Android SDK while remaining consistent with Cocoa naming principles.
2016-03-10 17:08:58 -08:00
Minh Nguyễn
e36218a866 [osx] Added OS X support for offline downloads 2016-03-10 17:08:58 -08:00
Minh Nguyễn
77657b3896 [ios] Implemented offline API in iOS SDK
Fixes #3892.
2016-03-10 17:08:58 -08:00
Jason Wray
64b163ee5d [ios] Add description strings to constituent classes 2016-03-10 13:48:00 -05:00
John Firebaugh
e4b2ea0982 [ios, osx] Don't delete a mutex with an active lock
The lock is in place to enforce that `async` is not accessed if the request has been, cancelled. Therefore it's not necessary to hold the lock beyond setting cancelled to true, and in fact it's unsafe to so: if this is the last remaining shared reference, `delete this` will destroy the mutex. If the lock was held, it would then be orphaned.
2016-02-19 10:11:27 -08:00
John Firebaugh
5ca625ba0d [ios, osx] Adjust HTTPNSURLRequest so that it may always delete itself immediately 2016-02-16 12:48:50 -08:00
Tom MacWright
14f81dbed5 Fix coordinate bounds documentation.
4-space indentation was being intepreted as a Markdown code block
2016-02-15 12:43:04 -05:00
John Firebaugh
13e2acbc75 [ios, osx] Consolidate remaining files in platform/{ios,osx} 2016-02-12 14:53:52 -08:00
John Firebaugh
ff15bd51b9 [core] Throttle the number of concurrent requests to 20 2016-02-10 15:40:20 -08:00
John Firebaugh
e9302c797f [all] Don't interpret 404s on non-tile resources as "no content" 2016-02-10 15:40:20 -08:00
John Firebaugh
7eb1a91c4e [all] Do not set Response data for 404s
For AssetFileSource and the node FileSource this was already the case; this makes the other implementations consistent.
2016-02-10 15:40:20 -08:00
John Firebaugh
4d29c7d5ce [core] Remove Response::Error::Reason::Canceled
There is no such thing as a cancelled response, only cancelled requests. A request that is cancelled does not have its callback called with a Response.
2016-02-04 13:18:14 -08:00
John Firebaugh
37c27f3a8f [core] Improve LatLngBounds API
* Use "named constructors": empty, world, hull
* Make the two-argument constructor lenient (i.e., it is a hull operation)
* Add various accessors
* Enforce a single empty representation
2016-02-02 23:04:18 -08:00
John Firebaugh
a877b9b192 [core] Include prior values of caching headers in Resource
This allows the FileSource interface itself to support revalidation. We could (and probably should) now rewrite HTTPContextBase implementations as FileSource implementations.
2016-01-22 18:42:53 -08:00
John Firebaugh
cef5c331fe [core] Merge rfc1123, iso8601, and parse_date into chrono.hpp and fix their API 2016-01-22 18:41:54 -08:00
John Firebaugh
1c21d0fd4c [core] Use better types for modified / expires / etag 2016-01-21 11:22:11 -08:00
John Firebaugh
1766d7dcbf [core] Eliminate RequestBase
HTTPRequestBase can now itself be the base class.
2016-01-21 11:22:11 -08:00
Minh Nguyễn
bd4611107d [ios] Reset user tracking, respect content inset in resetPosition 2016-01-20 11:02:31 -08:00
Thiago Marcos P. Santos
adcd0eaaac [osx] Fix loop closing with pending requests
The main loop will now wait for all the requests to
complete before closing.

This will make the FileSource on OSX block longer than
it should at shutdown.
2016-01-20 19:54:20 +02:00
John Firebaugh
f62d41ae05 [core] Restore existing response body
Until #2721 lands we still need this.
2016-01-14 18:38:56 -08:00
John Firebaugh
2aafdbc1b8 [core] Add an explicit "not modified" indicator to Response 2016-01-14 13:46:03 -08:00
John Firebaugh
5a7d2fd60e [core] Eliminate platform::assetRoot()
I regenerated assets.zip so that all file paths have an `assets/` prefix, as the Android AssetFileSource implementation asserts, and removed `TEST_DATA` from the paths.
2016-01-13 13:40:31 -08:00
Minh Nguyễn
5eaf7a6211 [ios, osx] Fixed Xcode 7.3 build
Fixed a compiler error that’s new in Xcode 7.3. Also corrected a typo in MGLMapView on OS X.
2016-01-11 14:21:15 -08:00
John Firebaugh
c972a251da [core] Remove Resource dependency from low-level classes
These classes should not be coupled to domain-specific resource types.
2015-12-23 14:30:20 -08:00
Minh Nguyễn
b7223f249d [ios, osx] Avoid transition to current camera
Fixes #2456.
2015-12-20 03:57:51 -08:00
Minh Nguyễn
d668c0fa84 [ios, osx] Better zoom level–altitude conversion
Greatly simplified conversions between zoom level and altitude. Adjusted field of view to more closely match MapKit. Conversions are now well within the same order of magnitude as MapKit at all latitudes.

Fixes #2266.
2015-12-20 03:57:28 -08:00
Minh Nguyễn
182380c4b1 [ios, osx] Corrected MGLMapCamera debug description
It’s MGLMapCamera (or a subclass), not MKMapCamera.
2015-12-19 20:08:07 -08:00
Minh Nguyễn
0fb2b855a4 [osx] Map camera
Shared MGLMapCamera between iOS and OS X. Unfortunately -camera and -setCamera: implementations need to be copy-pasted for now.
2015-12-13 17:26:53 -08:00
Minh Nguyễn
ea57be5598 [osx] Documentation comments for public classes
Added documentation comments for all the public headers that aren’t being shared with iOS.

Removed an animated: parameter from -selectAnnotation: and -deselectAnnotation:: because callout popovers may extend beyond the entire window, there is no need to scroll the map to make the entire callout visible.

Added missing geometric conversion methods.

Renamed -mapView:regionWillChangeAnimated: et al. to say “camera” instead of “region”. “Region” leaves ambiguity about whether properties like rotation and pitch trigger this method. “Camera” associates these methods with the camera property, which seems apt.
2015-12-13 17:26:53 -08:00
Minh Nguyễn
73324ae2f8 [osx] Commented private headers and implementation files 2015-12-13 17:26:53 -08:00
Minh Nguyễn
1598330a93 [osx] Added inline comments to MGLMapView 2015-12-13 17:26:53 -08:00
Minh Nguyễn
0cab7809eb [osx] Rewrote platform-osx and osxapp
platform-osx now vends a real NSView subclass, MGLMapView, that is readily embedded inside a Cocoa application for OS X. MGLMapView is backed by an NSOpenGLLayer for optimal performance and integration with other layer-backed views. It supports keyboard shortcuts and several gestures and hosts attribution, zooming, and rotation controls as subviews. osxapp is now a bona fide Cocoa application that embeds MGLMapView inside a XIB. osxapp has preferences and a share button for tight integration with custom styles.

Enabling asynchronous rendering would be more consistent with iOS but increases CPU usage so much, even when idle, that it isn’t worth any performance gain. The bigger issue is that VAOs aren’t being used.

make xpackage creates a static library similar to the one created by make ipackage. make clean cleans additional places where build output ends up.

The OS X minimum deployment target has been increased from 10.9 to 10.10. osxapp’s window has a full size content view, which requires 10.10. Lightweight generics require iOS 9+ and OS X 10.11 regardless, because it was only in that release that Foundation collection classes started adopting lightweight generics.

Shuffled files around and refactored annotations so that iOS and OS X share a good chunk of the annotations code, which now takes advantage of polymorphism. MGLMapView can now display annotations but cannot yet select them. In osxapp, a long press drops a pin, and so does the map view’s context menu.

Annotations have NSPopovers as callouts, and their view controllers can be customized. Annotation image alignment rects are respected for hit testing purposes and for positioning the callout anchor. Callouts in osxapp demonstrate the use of bindings to keep callouts in sync with underlying model objects.
2015-12-13 17:17:35 -08:00
Bruno de Oliveira Abinader
0cc31e1dda [osx] Removed libuv dependency from HTTPNSUrl* 2015-12-01 11:49:02 +02:00
Bruno de Oliveira Abinader
31fd2822f5 [core] Replace time_t with std::chrono::seconds
Added aliases for std::chrono typedefs (eg. 'Seconds' for
std::chrono::seconds). These aliases are used together with templated
helper functions to replace time_t with std::chrono::seconds for most
cases, in particular for 'modified' and 'expires' values in Response.
2015-11-27 17:47:02 +02:00
John Firebaugh
1d33790dc0 [core] Fix image type of Map::renderStill
It's a premultiplied image. This implies that we were misusing encodePNG
in most cases, as we were passing premultiplied pixels which were then
interpreted as unmultiplied. I changed encodePNG to accept premultipled
pixels, and unpremultiply in the implementations.
2015-11-25 15:57:37 -08:00
John Firebaugh
0c1e378bc9 [core] Rewrite image handling
* Consolidate Image and StillImage
* Typecheck unassociated vs premultiplied images
* Rewrite default platform image decoding implementation
2015-11-25 15:57:36 -08:00
John Firebaugh
36081f6486 [core] For binary image data use uint8_t, not char 2015-11-23 17:28:44 -08:00