summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLVectorStyleLayer.h
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2018-01-24 00:04:02 -0800
committerGitHub <noreply@github.com>2018-01-24 00:04:02 -0800
commitfb5b8d34f20b696319cfc16838243265143ba972 (patch)
treebdbb9a02e89c84e26cdabd38add1a6d6f805b4d0 /platform/darwin/src/MGLVectorStyleLayer.h
parentd4ed8d1a4474e43241e42610001403261353466f (diff)
downloadqtlocation-mapboxgl-fb5b8d34f20b696319cfc16838243265143ba972.tar.gz
Reimplement style values atop NSExpression (#10726)
* [ios, macos] Import headers, not implementation files * [core] Added accessors for various expression parameters Added missing parameter accessors to various expression operator classes, as well as a method on InterpolatorBase and Step that enumerates the stops and their values. * [ios, macos] Silenced warning in test of error condition * [ios, macos] Made MGLSphericalPosition boxable * [ios, macos] Implemented array enumeration during conversion * [ios, macos] Temporarily ignore heatmap layer type * [ios, macos] Migrated MGLSymbolStyleLayer.text to NSExpression MGLSymbolStyleLayer.text is now of type NSExpression instead of MGLStyleValue, as a first step toward migrating the entire layer API from style values to expressions. Implemented conversions from NSExpression to JSON arrays and vice versa. The most common NSExpression functions are now converted into style expressions, but not all of the most common style expression operators are supported yet. * [ios, macos] Implemented string coercion * [ios, macos] Color literals * [ios, macos] Null constant expressions * [ios, macos] Convert dictionary literals * [ios, macos] Interpolation expressions * [ios, macos] to-boolean, to-number, get from object * [ios, macos] Variable expressions Implemented custom expression functions for assigning and referring to variables within the context of an expression. Variables are assigned via a “context dictionary” and applied to an subexpression that is given as another argument to the same expression. Also implemented built-in variable expressions for zoom level and heatmap density. * [ios, macos] Convert colors, offsets, padding in expressions to JSON objects * [ios, macos] Expression-based style property getters Implemented a conversion from mbgl::style::PropertyValues to Objective-C JSON objects, which are then converted to NSExpressions. * [ios, macos] Consolidated property value–expression conversion in MGLStyleValueTransformer * [ios, macos] Predicate and expression guide Extracted documentation about predicates from a documentation comment in MGLVectorStyleLayer.h to a new jazzy guide. Added details about NSExpression support as well. Began updating the “For Style Authors” guide to reflect the transition from style values to expressions. * [ios, macos] Updated style authoring guide Updated the Information for Style Authors guide to discuss expressions instead of style functions. Included a table mapping style specification expression operators to NSExpression syntaxes. * [ios, macos] Migrated codegen templates to expressions * [ios, macos] Applied expression changes via codegen Ran make darwin-style-code. * [macos] Migrated macosapp to expressions * [ios, macos] Updated style function guide This guide needs to be thoroughly rewritten, but for now the example code has been migrated to expressions. * [ios, macos] Eviscerated style function tests * [ios, macos] Updated changelogs * [ios] Migrated iosapp to expressions * [ios, macos] Exposed JSON conversion methods publicly * [ios, macos] Removed MGLStyleValue, MGLStyleFunction
Diffstat (limited to 'platform/darwin/src/MGLVectorStyleLayer.h')
-rw-r--r--platform/darwin/src/MGLVectorStyleLayer.h105
1 files changed, 3 insertions, 102 deletions
diff --git a/platform/darwin/src/MGLVectorStyleLayer.h b/platform/darwin/src/MGLVectorStyleLayer.h
index 6603570e25..7780a34c7f 100644
--- a/platform/darwin/src/MGLVectorStyleLayer.h
+++ b/platform/darwin/src/MGLVectorStyleLayer.h
@@ -34,108 +34,9 @@ MGL_EXPORT
comes from the style, its predicate corresponds to the
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#layer-filter">`filter`</a>
property in the style JSON.
-
- The following comparison operators are supported.
-
- <ul>
- <li><code>NSEqualToPredicateOperatorType</code> (<code>=</code>, <code>==</code>)</li>
- <li><code>NSGreaterThanOrEqualToPredicateOperatorType</code> (<code>>=</code>, <code>=></code>)</li>
- <li><code>NSLessThanOrEqualToPredicateOperatorType</code> (<code><=</code>, <code>=<</code>)</li>
- <li><code>NSGreaterThanPredicateOperatorType</code> (<code>></code>)</li>
- <li><code>NSLessThanPredicateOperatorType</code> (<code><</code>)</li>
- <li><code>NSNotEqualToPredicateOperatorType</code> (<code>!=</code>, <code><></code>)</li>
- <li><code>NSBetweenPredicateOperatorType</code> (<code>BETWEEN</code>)</li>
- </ul>
-
- The following compound operators are supported:
-
- <ul>
- <li><code>NSAndPredicateType</code> (<code>AND</code>, <code>&&</code>)</li>
- <li><code>NSOrPredicateType</code> (<code>OR</code>, <code>||</code>)</li>
- <li><code>NSNotPredicateType</code> (<code>NOT</code>, <code>!</code>)</li>
- </ul>
-
- The following aggregate operators are supported:
-
- <ul>
- <li><code>NSInPredicateOperatorType</code> (<code>IN</code>)</li>
- <li><code>NSContainsPredicateOperatorType</code> (<code>CONTAINS</code>)</li>
- </ul>
-
- To test whether a feature has or lacks a specific attribute, compare the
- attribute to `NULL` or `NIL`. Predicates created using the
- `+[NSPredicate predicateWithValue:]` method are also supported. String
- operators and custom operators are not supported.
-
- For details about the predicate format string syntax, consult the “Predicate
- Format String Syntax” chapter of the
- “<a href="https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/">Predicate Programming Guide</a>”
- in Apple developer documentation.
-
- The predicate's left-hand expression must be a string that identifies a feature
- attribute or, alternatively, one of the following special attributes:
-
- <table>
- <thead>
- <tr><th>Attribute</th><th>Meaning</th></tr>
- </thead>
- <tbody>
- <tr>
- <td><code>$id</code></td>
- <td>
- A value that uniquely identifies the feature in the containing source.
- For details on the types of values that may be associated with this key,
- consult the documentation for the <code>MGLFeature</code> protocol’s
- <code>identifier</code> property.
- </td>
- </tr>
- <tr>
- <td><code>$type</code></td>
- <td>
- The type of geometry represented by the feature. A feature’s type is
- guaranteed to be one of the following strings:
- <ul>
- <li>
- <code>Point</code> for point features, corresponding to the
- <code>MGLPointAnnotation</code> class
- </li>
- <li>
- <code>LineString</code> for polyline features, corresponding to
- the <code>MGLPolyline</code> class
- </li>
- <li>
- <code>Polygon</code> for polygon features, corresponding to the
- <code>MGLPolygon</code> class
- </li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><code>point_count</code></td>
- <td>The number of point features in a given cluster.</td>
- </tr>
- </tbody>
- </table>
-
- The predicate’s right-hand expression must be an `NSString` (to match strings)
- or `NSNumber` (to match numbers, including Boolean values) or an array of
- `NSString`s or `NSNumber`s, depending on the operator and the type of values
- expected for the attribute being tested. For floating-point values, use
- `-[NSNumber numberWithDouble:]` instead of `-[NSNumber numberWithFloat:]`
- to avoid precision issues.
-
- Automatic type casting is not performed. Therefore, a feature only matches this
- predicate if its value for the attribute in question is of the same type as the
- value specified in the predicate. Also, operator modifiers such as `c` (for
- case insensitivity), `d` (for diacritic insensitivity), and `l` (for locale
- sensitivity) are unsupported for comparison and aggregate operators that are
- used in the predicate.
-
- It is possible to create expressions that contain special characters in the
- predicate format syntax. This includes the `$` in the `$id` and `$type` special
- style attributes and also `hyphen-minus` and `tag:subtag`. However, you must use
- `%K` in the format string to represent these variables:
- `@"%K == 'LineString'", @"$type"`.
+
+ See the “<a href="../predicates-and-expressions.html">Predicates and Expressions</a>”
+ guide for details about the predicate syntax supported by this class.
### Example