Commit Graph

3180 Commits

Author SHA1 Message Date
Minh Nguyễn
aef36956ee [ios, macos] Cleaned up expression conversion 2017-01-04 08:52:41 -08:00
Minh Nguyễn
e6132d248b [ios, macos] Rewrote predicate/filter conversion
When converting predicates to filters, symmetric comparison predicates can now compare a value to a key in addition to the usual key-to-value order. Added error checking for unhandled combinations like key-to-key. Fixed a crash converting a CONTAINS predicate into a filter. Added support for constant value expressions inside aggregate expressions. Allow sets as aggregate expressions just like arrays, except in BETWEEN predicates where order matters. Flatten NOT predicates into more specialized filters.

When converting filters to predicates, use constant value expressions inside aggregate expressions. Convert to a BETWEEN predicate when possible.

Replaced predicate round-tripping integration tests with systematic unit tests for converting in either direction, plus unit tests for round-tripping and symmetry.

Refined exception names and messages. Realphabetized files in groups.
2017-01-04 08:52:41 -08:00
Eric Wolfe
01717af59f [ios] Adds guides to documentation sidebar (#7488)
Initial set of guides focused on runtime styling
2017-01-03 14:40:14 -08:00
Fredrik Karlsson
1aab26e315 Implement MGLForegroundStyleLayer.sourceIdentifier (#7570)
* [ios, macos] sourceIdentifier accessor methods

* [ios, macos] generate style code
2017-01-03 10:25:17 +01:00
Minh Nguyễn
d35f235dae [ios, macos] Aliased MGLMultiPointFeature to MGLPointCollectionFeature 2017-01-02 12:34:39 -08:00
Jason Wray
f03cfd8bd5 [ios] Document that offline pack resource removal is not guaranteed (#7522)
Text adapted from: https://www.mapbox.com/help/mobile-offline/#removing-offline-regions
2016-12-23 19:40:54 -05:00
Minh Nguyễn
a66b1f7599 [ios, macos] Fixed iosbench build
Fixed a stale include in iosbench. MGLMapView(Private) forward-declares mbgl::Map instead of including mbgl.hpp, which iosbench has no access to.
2016-12-23 15:17:03 -08:00
Jesse Bounds
b134215895 [ios] Release beta 6 (#7535) 2016-12-23 08:33:27 -08:00
Minh Nguyễn
2c62f0a15b [ios, macos] Fixed null expression crash
Convert NSNull into an mbgl null value.
2016-12-23 03:36:55 -08:00
Minh Nguyễn
077cbb5e4b [ios, macos] Updated changelogs 2016-12-23 03:09:09 -08:00
Justin R. Miller
f0d54947b2 [ios, macos] Expand documentation on MGLTileSource URL templates (#7213)
* provide better docs for MGLTileSet template strings

* clean up docs

* line breaks

* [ios, macos] Rewrote tile URL template docs
2016-12-22 11:15:12 -08:00
Fredrik Karlsson
2c7569b879 [ios, macos] features and annotations now conforms to NSSecureCoding 2016-12-22 13:58:45 +01:00
Fredrik Karlsson
916cd6c310 [ios, macos] reversed MGLStyle.layers 2016-12-22 13:35:09 +01:00
Jason Wray
56eb9fa615 [ios] Correct formatting and typos in MGLStyleValue documentation (#7515) 2016-12-21 22:23:03 -05:00
Eric Wolfe
f80237576b [ios, macos] Reorder classes in jazzy docs sidebar (#7338) 2016-12-21 10:36:19 -08:00
Eric Wolfe
9faa4af1c3 [ios] Add inline examples in documentation (#7337) 2016-12-21 10:22:13 -08:00
Minh Nguyễn
b27dabfe47 [ios, macos] Removed trailing whitespace 2016-12-21 09:50:51 -08:00
Minh Nguyễn
f431b1b73b [macos] Refactored label localization
Localize only Mapbox Streets v6–v7, and do so more systematically than before.
2016-12-20 21:05:40 -08:00
Minh Nguyễn
224fe6b96f [ios, macos] Added URL accessor to MGLTileSource 2016-12-20 21:05:40 -08:00
Minh Nguyễn
906d700ccd [ios, macos] Indicate protocols, abstract classes in documentation navigation (#7478)
* [ios, macos] Italicize protocols, abstract classes in doc nav

Italicize protocols and abstract classes in the generated documentation’s navigation sidebar.

* [ios, macos] Denote protocols, abstract classes with glosses

Instead of oblique text, use a parenthetical gloss to denote a protocol or abstract class.
2016-12-20 17:32:06 -08:00
Minh Nguyễn
20b82c8fd1 [ios, macos] Omit perspectiveSkew from drawing context struct 2016-12-20 17:17:51 -08:00
Minh Nguyễn
1254bcdb40 [ios, macos] Update and reformat documentation for runtime styling (#7475)
* [ios, macos] Optimized changelog for runtime styling

Changelog entries related to style JSON now lead off with the analogous portion of the runtime styling API.

* [ios, macos] Autolink cross-class property references in docs

jazzy can autolink `Class.property` references in documentation comments.

* [ios, macos] Removed extra blank lines

* [ios, macos] Corrected typo in MGLMultiPoint docs

* [ios, macos] Rewrote shape and feature docs

Rewrote documentation about MGLShape, its subclasses, and MGLFeature to emphasize runtime styling uses over annotation uses, associate each type with real-world concepts, cross-reference related style layer classes, and cross-reference related or easily confused shape classes. Links to the GeoJSON specification have been updated to RFC 7946.

* [ios, macos] Expanded style layer docs

With this change, documentation about style layer classes is nominally based on the documentation in the style specification. However, all the existing layer types’ documentation has been overridden to explain what the layer looks like, relate the layer to a real-world concept, and cross-reference related geometry classes. This change also corrects the description of MGLBackgroundStyleLayer, which erroneously stated that the identifier must be “background”, whereas that only happens to be true by default for Studio template styles.

* [ios, macos] Wrap style layer docs

* [ios, macos] Removed unused code

* [ios, macos] Corrected symbol references in docs

* [ios, macos] Corrected typo in abstract class exception
2016-12-20 16:11:05 -08:00
Jesse Bounds
a174588e6c [ios, macos] Rename base to interpolationBase (#7486) 2016-12-19 11:45:00 -08:00
Eric Wolfe
e2fde9cc4e [ios, macos] Document when it's safe to call runtime styling functions (#7335)
* Add notes to wait for map to finish loading before adding sources or layers

* Move style loading notes to class documentation
2016-12-18 01:53:38 -08:00
Minh Nguyễn
e3a6857937 [ios, macos] Highlight current topic in documentation (#7468)
* [ios, macos] Highlight current topic in docs

* highlight style
2016-12-16 17:56:45 -08:00
Maya Gao
7f67a2926d iOS jazzy theme improvements (#7422)
some small improvements to the theme
2016-12-16 16:11:47 -08:00
Minh Nguyễn
3f26e88c49 Use appropriate part of speech for properties (#7457)
* [ios, macos] Use appropriate part of speech for properties

Fixed overridden property references in requirements lists. Boolean-typed properties can now have getters beginning with “is”.

Renamed a number of layout properties according to the following rules: Boolean-typed properties should include a verb; other properties must be noun phrases; all properties must be grammatical.

* [ios, macos] Added style spec names as unavailable aliases

Renamed properties now have aliases based on their style specification names, marked unavailable, for wayfinding purposes.

* [ios, macos] Fixed autosynthesis warnings

* [ios, macos] Moved style layer test template to test folder

* [ios, macos] Customized iconOptional getter

* [ios, macos] Avoid autosynthesis of aliases

* [ios, macos] Test that property names are grammatical

Run property getter names through a basic battery of tests to see if they’re grammatical. Most part-of-speech tagging tests are guarded by a compile-time flag, off by default, because NSLinguisticTagger does a poor job of telling nouns from verbs, and we’ve intentionally kept many words in property names that could be read as either verbs or nouns (like “transform” or “scale”).
2016-12-16 08:09:42 -08:00
Minh Nguyễn
b8466946e5 [ios, macos] Corrected return type of MGLShape factory method 2016-12-16 07:58:48 -08:00
Tom MacWright
74f39c0120 [ios] [osx] Make theme configurable (#7420)
* Make theme configurable

* [ios][osx] Make jazzy theme configurable
2016-12-15 10:30:45 -08:00
Jason Wray
78efb2d451 [ios] Remove last remnants of appledoc & docsets (#7418)
These scripts are broken and no longer useful in a post-jazzy world.
2016-12-14 18:19:52 -08:00
Jesse Bounds
da44db915c [ios] Updated changelog for iOS 3.4.0 beta 5 2016-12-14 12:49:32 -08:00
Jesse Bounds
b46373da8a [ios] Update podspec for release 3.4.0 beta 5 2016-12-14 12:49:32 -08:00
Jesse Bounds
afd14cbfe5 [ios] Fix dequeue view variable scope (#7423)
Fix a bug where an annotation view variable was incorrectly
re-declared which caused annotation views to not appear
in some cases. This also refactors the guard that spot
checks that annotation view are or are not visible.
2016-12-14 10:24:06 -08:00
Jesse Bounds
0eac5ea91e [ios]] Remove transaction in callout view update (#7425) 2016-12-14 10:22:02 -08:00
Minh Nguyễn
d34356ce39 [ios, macos] Streamlined a string format 2016-12-13 17:37:44 -08:00
Minh Nguyễn
ef71597932 [ios, macos] Simplify MGLSource and subclasses (#7377)
* [ios, macos] Audited source headers for nullability

* [macos] Made MGLTileSet public

* [ios, macos] Replaced MGLTileSet with MGLTileSource

MGLRasterSource and MGLVectorSource now share a common abstract superclass, MGLTileSource. MGLTileSet has been removed. MGLTileSource is modeled after mbgl::style::RasterSource and mbgl::style::VectorSource. It has initializers that incorporate the parameters of MGLTileSet’s initializers, but it lacks getters for everything but the attribution string. MGLTileSet’s properties have been converted into options that can be passed into MGLTileSource’s initializers in a dictionary.

Properly implement rawSource as a covariant property so that it doesn’t end up getting autosynthesized as a shadow ivar. This prevents concrete subclasses of MGLSource from setting _rawSource directly but getting a different value out of self.rawSource.

Marked -[MGLSource init] as unavailable and ensured that concrete subclasses of MGLSource have the right set of initializers marked as designated initializers.

Documentation comments for each concrete source class identify the corresponding source type in the style specification. Clarified the purpose of MGLTileSetScheme, now known as MGLTileCoordinateSystem.

* [ios, macos] Clarified tile size interpretation

Sticking to a default value of 256 for mapbox: URLs, but other URLs get the standard 512 value.

* [ios, macos] rawSource is always set

* [ios, macos] Cleaned up MGLShapeSource initialization

rawSource is never nil, so there’s no need for a -commonInit method. Extracted -geoJSONOptions from MGLShapeSource into a standalone function for easier testing.

* [ios, macos] Synchronized headers in project

Realphabetized headers in groups. Added headers missing from one project or the other.

* [ios, macos] Added MGLShape methods to (de)serialize GeoJSON data

Added a class initializer and instance method to MGLShape that deserialize and serialize the shape as GeoJSON data, respectively. The new initializer handles parsing errors gracefully.

Removed methods specific to GeoJSON data from MGLShapeSource, in an effort to reduce parallel state. Developers are now expected to go through the new MGLShape initializer to get an MGLShape representation. Alternatively, a local file URL can be passed into the other MGLShapeSource initializer.

* [ios, macos] Typo in assertion message

* [ios, macos] Simplified GeoJSON serialization

Every MGLShape now knows its most specific mbgl::GeoJSON representation.

* [ios, macos] Reremoved MGLFeaturePrivate

mbgl::GeoJSON, which is a variant, allows a single GeoJSON representation method to traffic in whatever type is needed for a particular shape class. This change removes some hidden private protocols, which are a bug waiting to happen.

* [ios, macos] Fixed covariant rawLayer property

Properly implement rawLayer as a covariant property so that it doesn’t end up getting autosynthesized as a shadow ivar. This prevents concrete subclasses of MGLStyleLayer from setting _rawLayer directly but getting a different value out of self.rawLayer.

* [ios, macos] Use MGLAttributionInfo for source attribution

Made MGLAttributionInfo public. Replaced MGLTileSource’s attribution property with an attributionInfos property set to an array of MGLAttributionInfo objects. Added an MGLTileSourceOption for specifying an array of MGLAttributionInfo objects instead of an HTML string (either is acceptable when creating an MGLTileSource).

* [ios, macos] Corrected method references in documentation
2016-12-13 17:36:15 -08:00
Minh Nguyễn
2d52dd8c0f [ios] Fixed crash on launch in iosapp
Use NSLocaleLanguageCode instead of -[NSLocale languageCode], which is newer than the minimum deployment target.
2016-12-13 10:30:04 -08:00
Jesse Bounds
9f4dd1c5f4 [ios] Fix iosapp runtime styling examples (#7395)
This fixes a few bugs in our iosapp examples that were exposed by
recent refinements to the APIs they use.
2016-12-13 10:09:54 -08:00
Ivo van Dongen
d3895b47ef [ios, macos] handle duplicate layer error 2016-12-13 10:03:05 -08:00
Ivo van Dongen
18730d598d [core] use raii to guard backend deactivation 2016-12-13 10:03:05 -08:00
Minh Nguyễn
1ab791c3dc [ios, macos] Override references to property names in property requirements lists (#7391)
* [ios, macos] Refer to template images in documentation

SDF icons are known as template images in AppKit and UIKit.

* [ios, macos] Override property names in requirements
2016-12-12 23:05:09 -08:00
Jesse Bounds
e38b4b590d [ios, macos] Load features into shape source if possible (#7339)
This checks the kind of MGLShape passed into the source and, if it
is a feature, it mbgl feature objects to pass to core. This keeps the
feature id and attributes data intact. If the shape is a
`MGLShapeCollectionFeature` it creates an `mbgl::FeatureCollection`
object (also to keep feature properties). If the shape is not any
sort of feature, it passes along just the geometry.

This also uses the MGLFeatureFromMBGLFeature converter for the case where
GeoJSON data passed in to a source contains a single feature. The
converter has logic to keep the id and attributes properties intact.
Before, these properties were lost because only geometry conversion
was done.

Finally, logic to handle (and associated tests) of nested shape
collection features is removed since that is not supported by
the GeoJSON spec or the core implementation.

[ios] Add test of drawing plain shape to iosapp
2016-12-12 10:38:49 -08:00
Minh Nguyễn
3fed3c10ed [ios, macos] Expanded source documentation
Also fixed a few stray references to GeoJSON sources.
2016-12-10 14:58:01 -08:00
Jesse Bounds
7f75eb5d6a [ios, macos] Rename MGLGeoJSONSource to MGLShapeSource (#7334) 2016-12-09 16:09:10 -08:00
Jesse Bounds
ce1d9ff5ee [ios, macos] Silence -Wc++11-narrowing warning in open gl layer (#7355) 2016-12-09 09:58:44 -08:00
Minh Nguyễn
fe53af7de0 [ios, macos] Source-driven attribution (#5999)
* [ios, macos] Source-driven attribution

Refactored MGLSource initialization. Implemented a new private class, MGLAttributionInfo, that parses an HTML attribution string from TileJSON and stores the resulting structured data. Added methods to MGLTileSet and MGLStyle to aggregate MGLAttributionInfos.

On macOS, update the attribution view as soon as the source attribution changes. On iOS, fetch the current attribution information when displaying the action sheet.

Removed hard-coded attribution strings.

* [macos] Respect inline formatting in attribution HTML

Apply a default font and color to attribution HTML as it is imported into an attributed string. Pass the attributed string into MGLAttributionButton as is, without stripping formatting. Avoid overriding the font and color after importing the HTML, in case these attributes are explicitly specified rather than intrinsic to a hyperlink.

Constrain the top of the attribution view to all the attribution buttons, in case one of them needs additional headspace.

* [ios, macos] Display unlinked attribution strings

Unlinked attribution strings are represented on macOS as buttons that have the default cursor and do nothing when clicked. On iOS, they are action sheet buttons that do nothing but dismiss the action sheet.

* [macos] Fixed random Auto Layout exception

Auto Layout randomly finds itself unable to satisfy constraints when updating attribution, due to some spurious constraints between attribution buttons. Regenerate the entire attribution view every time the source attribution changes.

* [ios, macos] Thoroughly dedupe attribution infos

Also added a test to verify parity with the GL JS implementation. This implementation avoids sorting.

* [ios, macos] Trim whitespace from attribution strings

Also added parsing tests.

* [ios, macos] Added attribution parsing tests for styles

Included an emoji test to ensure that attribution strings are interpreted as UTF-8, to avoid mojibake. Included a test of removing the underline from a leading copyright symbol.

* [ios, macos] Derive feedback link from source

MGLAttributionInfo now detects feedback links in the attribution HTML code, and it is responsible for tailoring the feedback URL to the current viewport.

Removed the hard-coded feedback action from the attribution sheet on iOS in favor of a source-derived feedback title and URL. Moved the feedback action from macosapp to MGLMapView; applications are now expected to hook an Improve This Map menu item to an MGLMapView action.
2016-12-08 17:43:17 -08:00
Fredrik Karlsson
89d4c40d92 [ios, macos] renamed raster-hue-rotate 2016-12-08 11:36:39 +01:00
Jesse Bounds
01ff94a6eb [ios, macos] Warn about special characters in predicates (#7317) 2016-12-07 14:06:02 -08:00
Jesse Bounds
497953c34e [ios, macos] Fix typo in exception name for style source identifier (#7315) 2016-12-07 10:47:06 -08:00
Fredrik Karlsson
508f020eb5 Prevent stopless functions (#7309)
* [ios, macos] prevent stopless functions

* [ios, macos] removed unused bridging header and fixed naming
2016-12-07 17:19:15 +01:00