MGLStyleFunction
@interface MGLStyleFunction <T> : MGLStyleValue<T>
An MGLStyleFunction
is a is an abstract superclass for functions that are
defined by an MGLCameraStyleFunction
, MGLSourceStyleFunction
, or
MGLCompositeStyleFunction
object.
Create instances of MGLCameraStyleFunction
, MGLSourceStyleFunction
, and
MGLCompositeStyleFunction
in order to use MGLStyleFunction
‘s methods. Do
not create instances of MGLStyleFunction
directly, and do not create your
own subclasses of this class.
The MGLStyleFunction
class takes a generic parameter T
that indicates the
Foundation class being wrapped by this class.
-
Creates and returns an
MGLCameraStyleFunction
object representing a camera function with a linear interpolation curve.Note
Do not create function instances using this method unless it is required for backwards compatiblity with your application code.
Declaration
Objective-C
+ (nonnull instancetype)functionWithStops: (nonnull NSDictionary<NSNumber *, MGLStyleValue<T> *> *)stops;
Swift
convenience init(stops: [NSNumber : MGLStyleValue
Parameters
stops
A dictionary associating zoom levels with style values.
Return Value
An
MGLCameraStyleFunction
object with the given stops. -
Creates and returns an
MGLCameraStyleFunction
object representing a camera function with an interpolation curve controlled by the provided interpolation base.Note
Do not create function instances using this method unless it is required for backwards compatiblity with your application code.
Declaration
Objective-C
+ (nonnull instancetype) functionWithInterpolationBase:(CGFloat)interpolationBase stops:(nonnull NSDictionary<NSNumber *, MGLStyleValue<T> *> *)stops;
Parameters
interpolationBase
The exponential base of the interpolation curve.
stops
A dictionary associating zoom levels with style values.
Return Value
An
MGLCameraStyleFunction
object with the given interpolation base and stops.
-
Returns an
MGLStyleFunction
object representing a camera function. If the function is set as a style layer property value, it will be interpreted as a camera function with an interpolation curve controlled by the provided interpolation base.Note
Do not create instances of
MGLStyleFunction
unless it is required for backwards compatiblity with your application code. You should create and use instances ofMGLCameraStyleFunction
to specify how properties will be visualized at different zoom levels.Declaration
Objective-C
- (nonnull instancetype) initWithInterpolationBase:(CGFloat)interpolationBase stops: (nonnull NSDictionary<NSNumber *, MGLStyleValue<T> *> *) stops;
Swift
init(interpolationBase: CGFloat, stops: [NSNumber : MGLStyleValue
Parameters
interpolationBase
The exponential base of the interpolation curve.
stops
A dictionary associating zoom levels with style values.
Return Value
An
MGLStyleFunction
object with the given interpolation base and stops.
-
The modes used to interpolate property values between map zoom level changes or over a range of feature attribute values.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLInterpolationMode interpolationMode;
Swift
var interpolationMode: MGLInterpolationMode { get set }
-
A dictionary associating zoom levels with style values.
Declaration
Objective-C
@property (readwrite, copy, nonatomic, nullable) NSDictionary *stops;
Swift
var stops: [AnyHashable : Any]? { get set }
-
The exponential interpolation base of the function’s interpolation curve.
Note
This property specifies the exponential base of the interpolation curve ofMGLCameraStyleFunction
andMGLSourceStyleFunction
functions that use aMGLInterpolationModeExponential
interpolationMode
. Otherwise, it is ignored.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CGFloat interpolationBase;
Swift
var interpolationBase: CGFloat { get set }