MGLCompositeStyleFunction
@interface MGLCompositeStyleFunction <T> : MGLStyleFunction<T>
An MGLCompositeStyleFunction
is a value function defining a style value that
changes with the feature attributes at each map zoom level. The layout and paint
attribute properties of an MGLStyleLayer
object can be set to
MGLCompositeStyleFunction
objects. Use composite functions to allow the
appearance of a map feature to change with both its attributes and the map zoom
level.
The MGLCompositeStyleFunction
class takes a generic parameter T
that indicates the
Foundation class being wrapped by this class.
-
Creates and returns an
MGLCompositeStyleFunction
object representing a composite function.Declaration
Objective-C
+ (nonnull instancetype) functionWithInterpolationMode:(MGLInterpolationMode)interpolationMode stops:(nonnull NSDictionary< id, NSDictionary<id, MGLStyleValue<T> *> *> *) stops attributeName:(nonnull NSString *)attributeName options: (nullable NSDictionary<MGLStyleFunctionOption, id> *) options;
Swift
convenience init(interpolationMode: MGLInterpolationMode, stops: [AnyHashable : [AnyHashable : MGLStyleValue
Parameters
interpolationMode
The mode used to interpolate property values over a range of feature attribute values for each outer zoom level.
stops
A dictionary associating feature attributes with style values.
attributeName
Specifies the feature attribute to take as the function input.
options
A dictionary containing
MGLStyleFunctionOption
values that specify how a function is applied.Return Value
An
MGLCompositeStyleFunction
object with the given interpolation mode, composite stops, attribute name, and options.
-
A string that specifies the feature attribute key whose value be used as the function input.
Declaration
Objective-C
@property (readwrite, copy, nonatomic) NSString *_Nonnull attributeName;
Swift
var attributeName: String { get set }
-
A dictionary associating attribute values with style values.
Each of the function’s stops is represented by one key-value pair in the dictionary. Each key in the dictionary is an
NSNumber
object containing a floating-point zoom level. Each value in the dictionary is an inner nested dictionary. Each key in the nested dictionary is an object representing a feature attribute key or interpolation stop. Each value in the nested dictionary is anMGLStyleValue
object containing the value to use when the function is given the associated attribute key. AnMGLStyleFunction
object may not be used recursively as a value inside the nested dictionary.Declaration
Objective-C
@property (readwrite, copy, nonatomic) NSDictionary<id, NSDictionary<id, MGLStyleValue<T> *> *> *_Nonnull stops;
Swift
var stops: [AnyHashable : [AnyHashable : MGLStyleValue
-
An
MGLStyleValue
object containing the default value to use when there is no input to provide to the function.Declaration
Objective-C
@property (assign, readwrite, nonatomic, nullable) MGLStyleValue<T> *defaultValue;
Swift
var defaultValue: MGLStyleValue