Commit Graph

211 Commits

Author SHA1 Message Date
Justin R. Miller
01b94de107 fixes #5957: automatically call update() for iOS runtime style API 2016-08-16 11:29:26 -07:00
Minh Nguyễn
dcd9e1016c [ios, macos] Removed MGLSource.sourceType (#6028)
Fixes #6027.
2016-08-16 02:10:56 -07:00
Minh Nguyễn
1daba5d04b [ios, macos] Accept absolute file paths as style URLs (#6026)
It turns out that mbgl::AssetFileSource supports absolute file URLs in addition to relative file URLs. So replace the file: scheme with asset: while percent-escaping as necessary.

Also added amsterdam.geojson to macos.xcodeproj for consistency with ios.xcodeproj.
2016-08-16 10:17:11 +02:00
Minh Nguyễn
6675e813ce [ios, macos] Replaced testAAALoadPacks with a setUp method (#6007)
XCTest apparently no longer executes tests in alphabetical order, so naming the test testAAALoadPacks doesn’t ensure it gets run first. Instead, put the pack loading test inside -setUp, but also put it inside a dispatch_once() block to ensure that it only gets run before the first offline storage test that gets run in the current process.
2016-08-15 08:27:59 -07:00
Fredrik Karlsson
2354c87411 Runtime styling API for iOS/macOS (#5727)
* [ios] wip runtime styling

* [ios, macos] Outlined header templates

* [ios, macos] cleanup and use appropiate data types

* [ios, macos] removed refs to mbgl and added convenient color methods on UIColor and NSColor

* [ios, macos] updated header template, included doc string

* [ios, macos] outlined template for layer implementation files

* [ios, macos] moved script to platform/darwin and updated comments

* [ios, macos] Cleaned up the implementation template

* [ios, macos] removed unused function and added support for more datatypes

* [ios, macos] overhauling the type protocols

* [ios, macos] removed unnecessary style classes

* [ios, macos] added support for more types

* [ios, macos] fixed string and number prop values

* [ios, macos] enum getters

* [ios, macos] added removeLayer() and removed unused layer ref

* [ios, macos] fixed remaining layer types and converted style layer into a protocol

* [ios, macos] fixed addLayer() and added example for line layer

* [ios] GeoJSON source now works

* [ios] fixed raster layer and raster source

* [ios] fixed attr prop number and outlined prop function

* [ios] wip functions

* [ios] bool and float function fix

* [ios] cleanup

* [macos] fixed support for macos

* [ios] fixed string functions

* [ios] extended array functions

* [ios] added tests and fixed a few bugs

* [ios] less verbose functions and improved tests

* [ios, macos] Removed unnecessary use of default arguments

Default arguments aren’t supported in Node v4, and they aren’t needed here anyways, because we’re only testing for truthiness.

* [ios, macos] Enum setters

Rely on a macro instead of category methods to specialize the setter implementation for enum attributes, since generic types are disallowed in Objective-C method signatures and mbgl::style::PropertyType must be type-qualified.

* [ios, macos] Got macOS closer to parity w/ iOS

Added various classes and test classes to the macOS workspace. Also fixed lots of compiler errors and updated macosapp runtime styling example to use the new dictionary syntax for function stops.

Updated all conversions from Objective-C stops to C++ stops to enumerate over the dictionary. Fixed compiler errors in enum setter implementations.

Also corrected path to script in generated file comments.

* [ios, macos] Added EJS templates to project

* [ios, macos] Code formatting

Made code format more consistent.

* [ios, macos] Spelled out ID

Cocoa convention is to always spell out “ID” as “identifier”, in part to avoid confusion with the id keyword. Also, URL is capitalized in most contexts, including property names.

* [ios, macos] Grouped related headers together

* [ios, macos] Cleaned up layer transformation

Also added support for converting background layers into Objective-C.

* [ios, macos] Cleaned up tests

Also made the tests work on macOS by introducing a new window to host the map.

* [ios, macos] Replaced TODOs with #warnings

* [ios] convert array based property values

* [ios, macos] color function/undefined getter

* [ios, macos] fixed function/undefined getters for bool and float properties

* [ios, macos] more function/undefined property getters

* [ios, macos] more type conversion and cleanup

* [ios, macos] disable macos runtime styling tests for now

* [ios, macos] cleaned up style code script

* [ios, macos] more type conversion

* [ios] added a base layer to handle visibility min/max zoom

* [macos] fixed base layer

* [ios, macos] use accessor methods

* [ios, macos] cleanup

* [ios, macos] add geojson to ios and macos

* [macos] rebase fix

* [ios, macos] fixed enum getters and added tests for enums

* [ios, macos] added an update method to base layer

* [ios, macos] added some documentation

* [ios, macos] docs

* [ios, macos] removed refs to filters for now

* [ios, macos] various tail work

* [ios, macos] missing import and incorrect type
2016-08-11 13:14:45 -04:00
Minh Nguyễn
1bc4f0e027 [ios, macos] Offline storage size API
Added a property to MGLOfflineStorage that indicates the disk space occupied by all cached and offline resources.

Fixes #5580.
2016-07-18 22:04:33 -07:00
John Firebaugh
da35ef9f49 [core] Add support for $id key to filters
https://github.com/mapbox/mapbox-gl-style-spec/issues/391
2016-07-18 12:37:36 -07:00
Thiago Marcos P. Santos
e23d8adf8c [core] Clean-up threading #ifdefs 2016-07-16 10:38:42 +03:00
Minh Nguyễn
244700e560 Merge branch 'release-ios-v3.3.0' 2016-07-14 16:31:08 -07:00
Bruno de Oliveira Abinader
44406e91de [ios,macos] Partially revert 06af75
Use static_cast<float> to convert from CGfloat when creating
PropertyValue<float> and avoid breaking backwards-compatibility.
2016-07-14 16:27:25 +03:00
Bruno de Oliveira Abinader
06af750d23 [ios,macos] Update {Line,Fill}Annotation properties setter 2016-07-13 11:57:09 +03:00
Jason Wray
2f3d77538b [ios, macos] Reorganize jazzy’s navigation categories; cleanup docs (#5660)
An attempt to better surface relevant information. Includes slight cleanups of inline documentation.

- Demotes MGLMapDebugMaskOptions to "Other Enums”.
- Demotes MGLMapViewDecelerationRate* and MGLStyleDefaultVersion to "Other Constants”.
- Demotes MGLOfflinePack's less significant global types.
- Demotes MGLAnnotationVerticalAlignment and documents its usage caveat.
- Demotes MGLAnnotationViewDragState and removes extra asterisk.
- Adds note to `MGLUserTrackingMode` about usage with `MGLMapView.userTrackingMode`.
- MGLAccountManager is currently only used for access tokens.
- Adds missing closing bracket.
2016-07-12 14:19:44 -04:00
Minh Nguyễn
8ca8e2c509 [ios, macos] Updated MGLFeature ID documentation
Since #5514, feature IDs may be integers, unsigned integers, floating-point numbers, or strings, not just unsigned integers.
2016-07-10 15:03:42 -07:00
Jesse Bounds
23caa9f7aa Merge branch 'release-ios-v3.3.0' into master 2016-07-07 15:40:07 -07:00
Jason Wray
3fa4f9379d [ios] Move cache.db to a subdirectory (#5601)
We cannot guarantee that the offline/ambient tile cache (cache.db) will be created in a timely manner, so it's safer to set the backup exclusion key on its containing directory.

But, because we placed cache.db in the base of the app's Application Support directory (where backups are expected to be allowed), we need to move cache.db into a directory that we control and can exclude from backups with impunity.

This is an amalgam of https://github.com/mapbox/mapbox-gl-native/pull/5578 (directory exclusion) and https://github.com/mapbox/mapbox-gl-native/pull/5585 (refactored URL methods, but without the new database size method).

Also:
* Prefix mapbox subdirectory with dot, for extra safety
* Update changelog entry with new ticket, less speculation
2016-07-07 12:11:08 -04:00
Young Hahn
71a3b1d0db [core] geometry@0.8.0 / geojsonvt@6.0.0 (#5514)
* [core] geometry.hpp 0.8.0

* geojsonvt @ 6.0.0

* Update platform deps, build scripts

* Perf optimizations/cleanup

* Rebase in geometry@080

* D.R.Y. etc

* Ensure fill annotation geometries have closed rings.

* Optimizations

* Update to geojsonvt @ 6.1.0 for clean handoff between geojson parsing and geojsonvt

* Apply close multi/poly geoms for line annotations as well
2016-07-06 17:29:34 -04:00
Fredrik Karlsson
546469459f [ios] #3979 compress telemetry events (#5490)
* [ios] #3979 wip gzip telemetry events

* [ios] expose compression from core instead of adding a new dependency

* [ios] #3979 Exposed decompress from mbgl and added a test case

* [ios] #3979 cleanup

* [ios] #3979 cleaned up test case

* [ios] #3979 cleanup

* [ios] #3979 gzip -> deflate
2016-07-05 22:46:04 +02:00
Jason Wray
bacf8eee70 [ios, macos] Add Mapbox Jazzy theme
- Based on Jazzy's "full width" theme.
- Add ellipsis to overlong items in navigation menu.
- Set minimum width for navigation menu.
- Use Open Sans font face.
- Inline GitHub header icon as SVG.
- Center images by default.
- Add GitHub SVG icon to 'show on github' link.
- Wrap overlong method names on class pages.
2016-07-01 14:44:51 -04:00
Jesse Bounds
f7b646cac5 [ios, macos] Use common instead of default mode for run loop source (#5503)
The map events instigated by certain actions
(i.e. updates from a UIScrollView) are not processed by the run loop
with `kCFRunLoopDefaultMode`until the thread is idle. This changes
the mode to `kCFRunLoopCommonModes` to avoid this issue.
2016-06-29 11:14:34 -07:00
Minh Nguyễn
061854990f [macos] Renamed OS X SDK to macOS SDK
Also renamed as many references to OS X as possible to macOS in documentation.

Cherry-picked from b9702ef41a.
2016-06-18 14:58:07 -07:00
Young Hahn
24b66bc8cd Color class (#5361)
* Color class

* Switch to list initialization
2016-06-15 11:38:22 -04:00
Minh Nguyễn
b9702ef41a [macos] Renamed OS X SDK to macOS SDK
Also renamed as many references to OS X as possible to macOS in documentation.
2016-06-14 10:02:06 +02:00
John Firebaugh
282e626ac1 [core] Make enum ↔ string conversion more generic-friendly
Rewrite enum.hpp in such a way that parseConstant can be defined generically for all enumerated types.

While there, properly validated enumerated property values.
2016-06-13 17:22:05 -07:00
Bruno de Oliveira Abinader
92f605df32 [tidy] Check modernize-use-nullptr
Ref: http://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2016-06-13 23:32:05 +03:00
Konstantin Käfer
2bdecdf9f9 [core] fix pedantic warning messages 2016-06-13 11:16:19 +02:00
John Firebaugh
574dd14420 [ios, osx] Add an assertion to -[MGLMultiPoint annotationObjectWithDelegate:] 2016-06-01 17:37:01 -07:00
John Firebaugh
0fba70d5a8 [all] Rationalize annotation API 2016-06-01 17:37:01 -07:00
John Firebaugh
8985b1311b [core] Use geometry.hpp types for shape annotations 2016-06-01 17:36:50 -07:00
Minh Nguyễn
b94a125ff2 [osx] Relegated “selection” to context menu
Moved feature selection to the context menu and restored the press gesture for dropping a pin. Bust complex features into simple shapes to feed into MGLMapView as overlays.
2016-05-27 21:42:39 -07:00
Minh Nguyễn
974e669698 [ios, osx] Ignore compound shape types as annotations
Ignore any multipolyline, multipolygon, or shape collection object passed into -addAnnotation: or -addAnnotations:. Previously, these methods broke apart the compound shape into its constituent shapes in order to recursively add them to the map. But that broke assumptions about a one-to-one correspondence between annotations and their contexts during selection and deletion.
2016-05-27 21:42:39 -07:00
Minh Nguyễn
bacf1f59ca [ios, osx] Cleaned up evaluators
Removed a level of indirection when creating Objective-C collections from C++ collections. Adopted mbgl typedefs for geometry.hpp types. Factored out MGLPolygon construction.
2016-05-27 21:42:39 -07:00
Minh Nguyễn
de905ab64c [ios, osx] Holes in polygons
MGLPolygon (and by extension MGLMultiPolygon) now supports interior rings. The data is preserved in feature querying results, and interior rings are respected when adding polygon overlays to the map.

Fixes #1729.

[ios, osx] Updated changelog
2016-05-27 21:42:38 -07:00
Minh Nguyễn
4ab98387f1 [ios, osx] MGLFeature tests 2016-05-27 21:42:38 -07:00
Minh Nguyễn
ff0cc1c9ef [ios, osx] Streamlined conversion to MGLFeature
Made writability of MGLFeature properties private, to avoid having to awkwardly explain that changes to the properties don’t change the map (maybe someday they will). This allows the identifier and attributes to be set in only one place, avoiding copy-pasta.
2016-05-27 21:42:38 -07:00
Minh Nguyễn
c6683ee1d3 [ios, osx] Feature querying; complex geometry classes
Added methods to MGLMapView that return the rendered features at a visible point or within a visible rectangle on the map, optionally restricted to a set of layers, plus voluminous documentation.

Added several new geometry classes corresponding to distinct geometry types supported by geometry.hpp. Added parallel “feature” classes to represent these geometries along with tags (IDs) and attributes (properties) from the source.

Grouped classes in the Foundation and SDK groups by theme.

In iosapp, dropped pins’ callout views now display the name of the topmost named feature at that point.

In osxapp, a long press on the map highlights the features under the cursor. Dropping a pin via the menu or context menu item shows the usual dropped pin, but the pin’s title is now the name of a feature under the cursor, if available, rather than “Dropped Pin”.

Fixes the iOS/OS X side of #352.
2016-05-27 21:42:31 -07:00
Jason Wray
9c9140595e [ios] Set backup exclusion flag after initializing DefaultFileSource (#5124)
Speculatively fixes #511, where apps mistakenly backup the offline/ambient cache.
2016-05-24 22:00:52 -04:00
Jason Wray
22447373ae [ios] Make MGLCoordinateInCoordinateBounds() public (#5053)
Bounds should always be in NE, SW order — any other coordinate order (e.g., NW, SE) will give false results.
2016-05-17 11:02:22 -04:00
Konstantin Käfer
cd65a43855 [core] move from microsecond precision timestamp to integer second precision 2016-05-13 17:24:22 +02:00
Minh Nguyễn
02f89b23b8 Merge branch 'release-ios-v3.2.2' into 1ec5-release-ios-v3.2.2-master 2016-05-10 13:11:47 -07:00
Minh Nguyễn
1634058b51 [ios, osx] Reformatted documentation comments
Reformatted documentation comments in public headers in the OS X SDK and public headers shared between the iOS and OS X SDKs to wrap at column 80 and avoid excessive indentation that causes SourceKitten to detect code blocks.
2016-05-10 09:59:04 -07:00
Minh Nguyễn
6f981e9ba8 [ios, osx] Revised style descriptions
Revised style descriptions to be more consistent with how the styles are described on www.mapbox.com.

Cherry-picked from 5035dc8418.
2016-05-06 17:17:29 -07:00
Minh Nguyễn
ca76b5b803 [ios, osx] Renamed version constant, linked to more info
Renamed MGLStyleCurrentVersion to MGLStyleDefaultVersion to emphasize the constant’s role as an indicator of the default version used by SDK classes, which may be behind depending on release schedules. In the documentation for each style URL method, include the actual version number instead of the constant. In unit tests, verify that this documentation is in sync with the constant.

Link each style URL method’s documentation to a forthcoming webpage on mapbox.com that describes the style in rich detail.

Cherry-picked from 2ec95bc490.
2016-05-06 17:17:17 -07:00
Minh Nguyễn
bac6fb4f84 [ios, osx] Renamed Hybrid to Satellite Streets
The style ID has also changed, but the unversioned method will continue to point to the old v8 style ID.

Cherry-picked from 5ccb43477f.
2016-05-06 17:17:06 -07:00
Minh Nguyễn
f7f6f775f4 [ios, osx] Pin unversioned style URL APIs to v8 styles
Cherry-picked from 4a112c00f1.
2016-05-06 17:16:55 -07:00
Minh Nguyễn
1d37eb3903 [core, ios, osx] Version default style URL APIs; deprecated Emerald
Updated default styles from v8 to v9. Deprecated the MGLMapView class methods in favor of new methods that take a version parameter. Deprecated Emerald outright in favor of Outdoors. Replaced usage of the unversioned MGLStyle methods with the corresponding versioned methods and MGLStyleCurrentVersion to ensure consistency.

Expanded MGLStyle unit tests to also assert that MGLStyle has the right number of style URL methods and that they’re all public. Linked the OS X SDK unit test bundle to libmbgl-core.a. Removed an unnecessary dependency on osxapp.

Replaced Emerald with Outdoors in iosapp and osxapp.

Fixes the iOS and OS X side of #4577 and #4702.

Cherry-picked from 2a4eeadb29.
2016-05-06 17:16:29 -07:00
Minh Nguyễn
5035dc8418 [ios, osx] Revised style descriptions
Revised style descriptions to be more consistent with how the styles are described on www.mapbox.com.
2016-05-06 11:06:52 -07:00
Minh Nguyễn
2ec95bc490 [ios, osx] Renamed version constant, linked to more info
Renamed MGLStyleCurrentVersion to MGLStyleDefaultVersion to emphasize the constant’s role as an indicator of the default version used by SDK classes, which may be behind depending on release schedules. In the documentation for each style URL method, include the actual version number instead of the constant. In unit tests, verify that this documentation is in sync with the constant.

Link each style URL method’s documentation to a forthcoming webpage on mapbox.com that describes the style in rich detail.
2016-05-06 11:06:52 -07:00
Minh Nguyễn
5ccb43477f [ios, osx] Renamed Hybrid to Satellite Streets
The style ID has also changed, but the unversioned method will continue to point to the old v8 style ID.
2016-05-06 11:06:51 -07:00
Minh Nguyễn
4a112c00f1 [ios, osx] Pin unversioned style URL APIs to v8 styles 2016-05-06 11:06:51 -07:00
Minh Nguyễn
2a4eeadb29 [core, ios, osx] Version default style URL APIs; deprecated Emerald
Updated default styles from v8 to v9. Deprecated the MGLMapView class methods in favor of new methods that take a version parameter. Deprecated Emerald outright in favor of Outdoors. Replaced usage of the unversioned MGLStyle methods with the corresponding versioned methods and MGLStyleCurrentVersion to ensure consistency.

Expanded MGLStyle unit tests to also assert that MGLStyle has the right number of style URL methods and that they’re all public. Linked the OS X SDK unit test bundle to libmbgl-core.a. Removed an unnecessary dependency on osxapp.

Replaced Emerald with Outdoors in iosapp and osxapp.

Fixes the iOS and OS X side of #4577 and #4702.
2016-05-06 10:57:54 -07:00