Files
MapLibreParticleLab/platform/darwin/src/MGLVectorStyleLayer.h
Fabian Guerra Soto 62dd097328 [ios, macos] NSPredicate expression filters. (#11587)
* [ios, macos] Add NSAndPredicateType predicate expression filter.

* [ios, macos] Add type to NSPredicate expressions.

* [ios, macos] Add Expression filter support.

* [ios, macos] Update NSPredicate expression based tests.

* [ios, macos] Refactor ExpressionFilters.

* [ios, macos] Add symmetric test to ExpressionFilters.

* [ios, macos] Update NSPredicate test to ExpressionFilters.

* [ios, macos] Re-introduce Filter tests.

* [ios, macos] Remove typed NSComparisonPredicate's comparable values.

* [ios, macos] Update style layers predicate tests.

* [ios, macos] Remove unused predicate conversion code.

* [ios, macos] Update documentation exaple's test.

* [ios, macos] Update Predicate and Expressions guide..

* [ios, macos] Remove mgl_ prefix from variable expressions.

* [ios, macos] Update predicates and expressions documentation.

* [ios, macos] Update changelogs.
2018-04-16 16:51:59 -04:00

59 lines
2.0 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#import <Foundation/Foundation.h>
#import "MGLFoundation.h"
#import "MGLForegroundStyleLayer.h"
NS_ASSUME_NONNULL_BEGIN
/**
`MGLVectorStyleLayer` is an abstract superclass for style layers whose content
is defined by an `MGLShapeSource` or `MGLVectorTileSource` object.
Create instances of `MGLCircleStyleLayer`, `MGLFillStyleLayer`,
`MGLFillExtrusionStyleLayer`, `MGLHeatmapStyleLayer`, `MGLLineStyleLayer`, and
`MGLSymbolStyleLayer` in order to use `MGLVectorStyleLayer`'s properties and
methods. Do not create instances of `MGLVectorStyleLayer` directly, and do not
create your own subclasses of this class.
*/
MGL_EXPORT
@interface MGLVectorStyleLayer : MGLForegroundStyleLayer
#pragma mark Refining a Style Layer’s Content
/**
Identifier of the layer within the source identified by the `sourceIdentifier`
property from which the receiver obtains the data to style.
*/
@property (nonatomic, nullable) NSString *sourceLayerIdentifier;
/**
The style layer’s predicate.
Use the style layer’s predicate to include only the features in the source
layer that satisfy a condition that you define. If the style layer initially
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.
See the “<a href="../predicates-and-expressions.html">Predicates and Expressions</a>”
guide for details about the predicate syntax supported by this class.
### 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) && CAST(ele, 'NSNumber') >= 1500.0")
mapView.style?.addLayer(layer)
```
*/
@property (nonatomic, nullable) NSPredicate *predicate;
@end
NS_ASSUME_NONNULL_END