diff options
Diffstat (limited to 'platform/ios/app/MBXViewController.m')
-rw-r--r-- | platform/ios/app/MBXViewController.m | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 0a76f8c0c5..391af5ea05 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -967,18 +967,20 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { @10.0f: [UIColor redColor], @12.0f: [UIColor greenColor], @14.0f: [UIColor blueColor]}; - waterLayer.fillColor = [NSExpression expressionWithFormat: - @"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", - waterColorStops]; + NSExpression *fillColorExpression = [NSExpression mgl_expressionForInterpolatingExpression:NSExpression.zoomLevelVariableExpression + withCurveType:MGLExpressionInterpolationModeLinear + parameters:nil + stops:[NSExpression expressionForConstantValue:waterColorStops]]; + waterLayer.fillColor = fillColorExpression; NSDictionary *fillAntialiasedStops = @{@11: @YES, @12: @NO, @13: @YES, @14: @NO, @15: @YES}; - waterLayer.fillAntialiased = [NSExpression expressionWithFormat: - @"mgl_step:from:stops:($zoomLevel, false, %@)", - fillAntialiasedStops]; + waterLayer.fillAntialiased = [NSExpression mgl_expressionForSteppingExpression:NSExpression.zoomLevelVariableExpression + fromExpression:[NSExpression expressionForConstantValue:@NO] + stops:[NSExpression expressionForConstantValue:fillAntialiasedStops]]; } - (void)styleRoadLayer @@ -1467,10 +1469,16 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { // source, categorical function that sets any feature with a "fill" attribute value of true to red color and anything without to green MGLFillStyleLayer *fillStyleLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"fill-layer" source:shapeSource]; - fillStyleLayer.fillColor = [NSExpression expressionWithFormat:@"TERNARY(fill == YES, %@, %@)", [UIColor greenColor], [UIColor redColor]]; + fillStyleLayer.fillColor = [NSExpression mgl_expressionForConditional:[NSPredicate predicateWithFormat:@"fill == YES"] + trueExpression:[NSExpression expressionForConstantValue:[UIColor greenColor]] + falseExpresssion:[NSExpression expressionForConstantValue:[UIColor redColor]]]; + + // source, identity function that sets any feature with an "opacity" attribute to use that value and anything without to 1.0 - fillStyleLayer.fillOpacity = [NSExpression expressionWithFormat:@"TERNARY(opacity != nil, opacity, 1.0)"]; + fillStyleLayer.fillOpacity = [NSExpression mgl_expressionForConditional:[NSPredicate predicateWithFormat:@"opacity != nil"] + trueExpression:[NSExpression expressionForKeyPath:@"opacity"] + falseExpresssion:[NSExpression expressionForConstantValue:@1.0]]; [self.mapView.style addLayer:fillStyleLayer]; } |