summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLVectorStyleLayer.h
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-01-16 11:38:35 -0800
committerMinh Nguyễn <mxn@1ec5.org>2017-01-16 11:38:35 -0800
commit7ef2843e6a62116667be6a2c12de085951fdd5ea (patch)
tree40eca249e044e2706efd1193d617e6eb8e59d708 /platform/darwin/src/MGLVectorStyleLayer.h
parent76301b252cbc4bc3ae1fc84322bcbcdbd26cae8a (diff)
parent13b97dd0cebffe36b187bdb74923910def6bd87b (diff)
downloadqtlocation-mapboxgl-7ef2843e6a62116667be6a2c12de085951fdd5ea.tar.gz
Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.7
Diffstat (limited to 'platform/darwin/src/MGLVectorStyleLayer.h')
-rw-r--r--platform/darwin/src/MGLVectorStyleLayer.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/platform/darwin/src/MGLVectorStyleLayer.h b/platform/darwin/src/MGLVectorStyleLayer.h
index f59ef4bf7f..ca09c11716 100644
--- a/platform/darwin/src/MGLVectorStyleLayer.h
+++ b/platform/darwin/src/MGLVectorStyleLayer.h
@@ -61,11 +61,15 @@ MGL_EXPORT
<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.
+ 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 “Predicate Programming Guide” in Apple
- developer documentation.
+ 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:
@@ -121,15 +125,29 @@ MGL_EXPORT
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 `c`, `d`, and the
- combined `cd` for case and diacritic insensitivity are unsupported for
- comparison and aggregate operators that are used in the predicate.
+ 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"`.
+
+ ### Example
+
+ To filter the layer to include only the features whose `index` attribute is 5
+ or 10 and whose `ele` attribute is at least 1,500, you could create an
+ `NSCompoundPredicate` along these lines:
+
+ ```swift
+ let layer = MGLLineStyleLayer(identifier: "contour", source: terrain)
+ layer.sourceLayerIdentifier = "contours"
+ layer.predicate = NSPredicate(format: "(index == 5 || index == 10) && ele >= 1500.0")
+ mapView.style?.addLayer(layer)
+ ```
*/
@property (nonatomic, nullable) NSPredicate *predicate;