Commit Graph

1168 Commits

Author SHA1 Message Date
Justin R. Miller
2916ae2735 formatting & docs changes
Ran this through `./ios/docs/install_docs.sh` to double-check things.

 * Less-specific initializers above more-specific per Apple convention.
 * Shores up `accessToken` docs as property, not a method.
 * Edited comments for consistency and/or to keep them out of the docs.
2015-04-03 12:40:51 -07:00
Minh Nguyễn
836de8bc1c Made lat/lon/zoom inspectable
Declared these IB-specific inspectables in a separate category that developers are not expected to import. Currently these inspectables are order-dependent due to #1181.

Ref #929
2015-04-03 12:34:36 -07:00
Minh Nguyễn
da13225a81 Made MGLMapView designable in IB
When an access token is set in the Attributes inspector (or as a user-defined runtime attribute), we draw some lovely Mapbox branding so the view shows up. (Manipulating invisible rectangles is a frustrating exercise, I’m told.) In the absence of an access token, the view displays a helpful message with directions for obtaining and setting the access token.

Along the way, completely opt out of `MGLMapboxEvents` when targeting Interface Builder, because touching Core Location throws an exception in that environment and it doesn’t make sense to record any metrics when designing on the Interface Builder canvas. Also, don’t start `mbgl::Map` at all (and don’t update it) because none of the runtime drawing code should ever be run in the designable. Normally these chunks of code would be excluded in IB using the TARGET_INTERFACE_BUILDER preprocessor macro. However, Mapbox GL is being packaged as a static library, so the macro is only evaluated when the library is prebuilt, even if the library eventually makes its way into the CocoaPods-generated framework. Instead, we detect that we’re being run by the IBDesignablesAgentCocoaTouch process.

Overrode `-[MGLMapView initWithFrame:]` to call `-commonInit`. We’ve marked this initializer unavailable in the header, but IB still calls it regardless.

Fixes #929.
2015-04-03 12:16:00 -07:00
Minh Nguyễn
e18e4b0de5 Removed redundant initializers and setters
This change removes most of the ways you used to be able to apply a style to the map. Building on #1163, `styleURL` (HTTP(S), mapbox:, asset:) is the canonical way to apply a style, and `mapID` is a convenient shorthand for Mapbox-hosted styles. A relative style URL is interpreted as a path relative to the app’s main bundle. We now construct asset: URLs in lieu of “bundled style names”.
2015-04-03 12:14:51 -07:00
Minh Nguyễn
6a1e7d5707 Fixed race condition after setting access token
`Map` should be able to deal with having no access token or JSON even while it’s running. Most of `Map` accounts for this situation, but `reloadStyle()` incorrectly assumes that one or the other is set. This change corrects the assumption in `reloadStyle()`.

Also expose the access token and style name to clients as ordinary KVO-compliant properties. Actually, they’re not so ordinary because they’re inspectable!

Ref #1070, #1147
2015-04-03 12:07:53 -07:00
Brad Leege
8413da0d68 #1195 - Adding speed and course attributes to location event 2015-04-03 11:10:35 -05:00
Justin R. Miller
dafce83acd Merge pull request #1192 from mapbox/location-and-docs-tweaks
improvements to iOS docs & user location framework
2015-04-02 17:50:32 -07:00
Justin R. Miller
dbd22ae61a reverting to title/subtitle setters for user location 2015-04-02 17:12:05 -07:00
Justin R. Miller
9a416c449c Improvements to docs & user location framework.
* Cleans up & documents more APIs, especially in location.
 * Moves `coordinate` internal and makes use of `location` to retrieve it.
 * Moves `title` & `subtitle` internal since part of `MGLAnnotation` protocol.
 * Enables `isUpdating` by privately associating weakly with a map view.
2015-04-02 16:58:24 -07:00
John Firebaugh
12c07b916b Rework easing transition code
This brings the easing transition code a bit closer to how easings work
in gl-js. Instead of having an array of individual transitions for scale,
rotate, and pan, there is a single transition function that does all the
required calculations. This permits us to:

* Eliminate the "timeout" transition. (Fixes #126)
* Replace start/stopPanning() et al with setGestureInProgress(). Apps or
  SDKs are expected to make paired calls to setGestureInProgress(). This
  state will be ORed with the active easing state to determine when to
  use texture interpolation. (Fixes #79)
* Run style recalculations only when an ease transition that affects the
  zoom is in progress. (Fixes #1155)
2015-04-02 16:12:29 -07:00
John Firebaugh
9e38d7cc2b Move Update to its own header file 2015-04-02 15:30:13 -07:00
John Firebaugh
9331acf8e6 Add typedefs for std::chrono::steady_clock types 2015-04-02 12:28:12 +02:00
John Firebaugh
5264982ba7 Eliminate StyleLayerGroup 2015-04-01 11:14:20 -07:00
Justin R. Miller
af0c89c2aa expose style URL setting 2015-03-30 22:37:00 -07:00
Justin R. Miller
2782a8ce5b refs #892: Cocoa support for map ID style URLs 2015-03-30 22:09:47 -07:00
Brad Leege
a325cb98b5 #1134 - Removing enabled.email metric and supporting infrastructure 2015-03-27 19:25:59 -05:00
Justin R. Miller
2066e201ea Merge remote-tracking branch 'origin/master' into 1128-convert-booleans 2015-03-27 09:00:07 -07:00
Konstantin Käfer
a2629393b3 dispatch all AnnotationManager calls to the map thread
calls that return a value block until the operation was executed
2015-03-27 12:56:41 +01:00
Justin R. Miller
1a8d6445d1 convert metrics BOOLs to strings internally 2015-03-27 00:17:42 -07:00
Justin R. Miller
bf3c87b17f more metrics magic strings removals 2015-03-26 23:31:08 -07:00
Justin R. Miller
83f083c7b5 fixes #1116: metrics stability & performance refactor 2015-03-26 21:27:56 -07:00
Minh Nguyễn
32aa865f14 Merge branch 'ios-unused'
Left in MGLTypes.h, which is now a platform-neutral (iOS + OS X) place for MGLUserTrackingMode.
2015-03-26 15:12:15 -07:00
Justin R. Miller
f3058dbc9a closes #1082, refs #756: user dot on map in iOS 2015-03-25 17:48:22 -07:00
Justin R. Miller
10a30daed6 refs #894, fixes #1074: callout views for iOS 2015-03-24 18:43:24 -07:00
Brad Leege
88398b2545 Merge branch 'master' of github.com:mapbox/mapbox-gl-native into 1033-metrics
Conflicts:
	platform/ios/MGLMapView.mm
2015-03-24 15:15:27 -05:00
Brad Leege
3e062d0e20 #1033 - Flush all events to server when app enters background 2015-03-24 10:02:13 -05:00
Justin R. Miller
c5597ad6f1 annotations perf improvements & iOS app testing
squash of #1061
2015-03-23 20:49:02 -07:00
Justin R. Miller
486a385f98 Merge branch 'master' into 1022-annotations-thread-safety 2015-03-23 11:13:51 -07:00
Brad Leege
044d1fc3c2 Merge branch 'master' of github.com:mapbox/mapbox-gl-native into 1033-metrics
Conflicts:
	gyp/platform-ios.gypi
	platform/ios/MGLMapView.mm
	styles
2015-03-23 10:52:27 -05:00
Konstantin Käfer
d2faca1861 move style classes to MapData object and make thread safe 2015-03-23 11:02:21 +01:00
Konstantin Käfer
3d2dcbb6ef move accessToken to MapData 2015-03-23 11:02:21 +01:00
Konstantin Käfer
9637176711 move defaultTransitionDuration to MapData 2015-03-23 11:02:19 +01:00
Konstantin Käfer
268975d4c2 move animationTime to MapData store 2015-03-23 11:01:39 +01:00
Konstantin Käfer
03e400e002 make the debug flag atomic and move to MapData 2015-03-23 11:01:02 +01:00
Konstantin Käfer
ebd2985f78 make style updates a little more threadsafe
- we're now always loading and parsing styles in the map thread
- adds an atomic enum that stores the actual updates we need to perform
- adds a MapData object that mutexes access to variables used from both threads
2015-03-23 11:01:01 +01:00
Justin R. Miller
0e2d6c8277 fixes #1053: umbrella Cocoa header 2015-03-22 12:25:10 -07:00
Justin R. Miller
ecb8e2800d Cocoa annotations API 2015-03-22 00:53:36 -07:00
Brad Leege
33f4dfffd2 #1033 - Removing BackgroundStatus analytic 2015-03-20 17:14:25 -05:00
Brad Leege
ec304d37ac #1033 - Integrating MapboxEvents class. 2015-03-20 16:01:52 -05:00
Konstantin Käfer
61fa436193 coalesce buffer deletions and run them in bulk during rendering
On iOS, the main thread does framebuffer operations just before it requests a rerender of the view contents. This means that GL operations on the Map thread will interfere with that and cause a crash. While most GL operations happen throughout rendering (which is synchronized with the main thread), deletion of shared_ptrs release in turn their OpenGL objects. This may happen at any time and isn't synced with rendering.

This patch changes this so instead of deleting all objects immediately, we are collecting all abandoned IDs and delete them in bulk once the main thread has given us permission to use OpenGL calls (i.e. during render()).
2015-03-20 19:47:54 +01:00
Brad Leege
253643f57d #1033 - Renaming MBLocationManager to MGLMetricsLocationManager to better comply with naming scheme. 2015-03-20 11:37:50 -05:00
Brad Leege
c42e83fcc6 #1033 - Moving MBLocationManager to Core GL from app specific instance. 2015-03-20 11:11:06 -05:00
Konstantin Käfer
f73dfc73f1 make more things const and refs, and add mutexes 2015-03-20 13:14:00 +01:00
John Firebaugh
645d1f3857 Delete unused code
This code appears to be unused and has not been kept in sync with style
spec changes.
2015-03-19 14:45:59 -07:00
Minh Nguyễn
0cdf21c62d Merge pull request #1020 from mapbox/init-bundled-style
API for initializing with bundled style
2015-03-19 13:39:05 -07:00
Minh Nguyễn
3d195b467a Added API for initializing with bundled style
As a best practice for the beta and a workaround for #1014.

Also reversed the argument order of the existing init method. Reads better this way, but you’ll likely have to change your initialization to match the new signatures.
2015-03-19 10:29:04 -07:00
Thiago Marcos P. Santos
3254cdc85c Log the Environment ID and the Thread name
To make it easier to debug, add the Environment ID and the Thread name
to the log messages. For instance log messages from the TileParser will look like:

[WARNING] {0}{TileWorker_15/18653/9486}[ParseTile]: some relevant warning message
   |       |             |                  |
   |       |             |                  +-> Component
   |       |             +--------------------> Thread name
   |       +----------------------------------> Environment ID
   +------------------------------------------> Severity level

Log messages that are not inside an Environment::Scope will work
normally and will look like:

[WARNING] [JNI]: some relevant warning message

Fixes #882.
2015-03-18 12:51:33 +01:00
Thiago Marcos P. Santos
b5facd35bc Scope the Map thread to an Environment
Also, replace manual thread type checks with Environment::currentlyOn().
2015-03-18 12:51:33 +01:00
Justin R. Miller
e049ce6df1 refs #893 #992: point annotations API 2015-03-17 17:30:24 -07:00
Konstantin Käfer
48c55af5c1 fix sprites for pixel ratios that are not 1 and 2
- OpenGL ES 2 doesn't allow NPOT textures with wrap-around
- The Sprite object reported the map's pixelRatio, even though it loaded @2x assets
- Copying icons from the sprite into the atlas now uses bilinear scaling to scale up to the actual size
2015-03-17 12:30:40 +01:00