summaryrefslogtreecommitdiff
path: root/platform/darwin/src/NSExpression+MGLAdditions.mm
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2018-04-17 16:15:26 -0400
committerFabian Guerra <fabian.guerra@mapbox.com>2018-04-17 16:15:26 -0400
commit6b97f71bd6e25fc9d1aac7987768f56b78fcf24d (patch)
tree90093a76b3e31d7062c5b8cfe0da9f63304bcce8 /platform/darwin/src/NSExpression+MGLAdditions.mm
parentd830d6dacc428bf4779633b4aa65c6fb2bad577a (diff)
downloadqtlocation-mapboxgl-6b97f71bd6e25fc9d1aac7987768f56b78fcf24d.tar.gz
[ios, macos] Add tangent NSExpresssion operator.
Diffstat (limited to 'platform/darwin/src/NSExpression+MGLAdditions.mm')
-rw-r--r--platform/darwin/src/NSExpression+MGLAdditions.mm10
1 files changed, 10 insertions, 0 deletions
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm
index 8c79fd43f8..e641c79628 100644
--- a/platform/darwin/src/NSExpression+MGLAdditions.mm
+++ b/platform/darwin/src/NSExpression+MGLAdditions.mm
@@ -73,6 +73,7 @@ const MGLExpressionInterpolationMode MGLExpressionInterpolationModeCubicBezier =
INSTALL_METHOD(mgl_asin:);
INSTALL_METHOD(mgl_sin:);
INSTALL_METHOD(mgl_atan:);
+ INSTALL_METHOD(mgl_tan:);
// Install functions that resemble control structures, taking arbitrary
// numbers of arguments. Vararg aftermarket functions need to be declared
@@ -138,6 +139,13 @@ const MGLExpressionInterpolationMode MGLExpressionInterpolationModeCubicBezier =
}
/**
+ Computes the principal value of the tangent.
+ */
+- (NSNumber *)mgl_tan:(NSNumber *)number {
+ return @(tan(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 {
@@ -720,6 +728,7 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) {
@"asin" : @"mgl_asin:",
@"sin" : @"mgl_sin:",
@"atan" : @"mgl_atan:",
+ @"tan" : @"mgl_tan:",
@"floor": @"floor:",
@"ceil": @"ceiling:",
@"^": @"raise:toPower:",
@@ -967,6 +976,7 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) {
@"mgl_asin:" : @"asin",
@"mgl_sin:" : @"sin",
@"mgl_atan:" : @"atan",
+ @"mgl_tan:" : @"tan",
// Vararg aftermarket expressions need to be declared with an explicit and implicit first argument.
@"MGL_LET": @"let",
@"MGL_LET:": @"let",