diff options
author | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-04-17 13:59:19 -0400 |
---|---|---|
committer | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-04-17 13:59:19 -0400 |
commit | dd31a1f94ea363311854d47c62150c5744e2bc19 (patch) | |
tree | a26ae5e4c5bc7079684533bacdf051e2ba29a3a1 /platform/darwin/src/NSExpression+MGLAdditions.mm | |
parent | 2eeebe5c38b95758db2c69b38d69b877f5a0de31 (diff) | |
download | qtlocation-mapboxgl-dd31a1f94ea363311854d47c62150c5744e2bc19.tar.gz |
[ios, macos] Add acos NSExpresssion operator.
Diffstat (limited to 'platform/darwin/src/NSExpression+MGLAdditions.mm')
-rw-r--r-- | platform/darwin/src/NSExpression+MGLAdditions.mm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index 54f98c6ab9..9238a291a4 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -68,6 +68,7 @@ const MGLExpressionInterpolationMode MGLExpressionInterpolationModeCubicBezier = INSTALL_METHOD(mgl_step:from:stops:); INSTALL_METHOD(mgl_coalesce:); INSTALL_METHOD(mgl_does:have:); + INSTALL_METHOD(mgl_acos:); // Install functions that resemble control structures, taking arbitrary // numbers of arguments. Vararg aftermarket functions need to be declared @@ -98,6 +99,13 @@ const MGLExpressionInterpolationMode MGLExpressionInterpolationModeCubicBezier = } /** + Computes the principal value of the arc cosine of number. + */ +- (NSNumber *)mgl_acos:(NSNumber *)number { + return @(acos(number.doubleValue)); +} + +/** A placeholder for a method that evaluates an interpolation expression. */ - (id)mgl_interpolate:(id)inputExpression withCurveType:(NSString *)curveType parameters:(NSDictionary *)params stops:(NSDictionary *)stops { @@ -675,6 +683,7 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { @"ln": @"ln:", @"abs": @"abs:", @"round": @"mgl_round:", + @"acos" : @"mgl_acos:", @"floor": @"floor:", @"ceil": @"ceiling:", @"^": @"raise:toPower:", @@ -917,6 +926,7 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { @"lowercase:": @"downcase", @"length:": @"length", @"mgl_round:": @"round", + @"mgl_acos:" : @"acos", // Vararg aftermarket expressions need to be declared with an explicit and implicit first argument. @"MGL_LET": @"let", @"MGL_LET:": @"let", |