From a174588e6ccb5c0101479c882d399a07ba96ba76 Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Mon, 19 Dec 2016 11:45:00 -0800 Subject: [ios, macos] Rename base to interpolationBase (#7486) --- platform/darwin/src/MGLStyleValue.h | 32 +++++++++++++-------------- platform/darwin/src/MGLStyleValue.mm | 24 ++++++++++---------- platform/darwin/src/MGLStyleValue_Private.h | 8 +++---- platform/darwin/test/MGLStyleValueTests.swift | 4 ++-- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/platform/darwin/src/MGLStyleValue.h b/platform/darwin/src/MGLStyleValue.h index ab5e76bbe3..1952e6a9e8 100644 --- a/platform/darwin/src/MGLStyleValue.h +++ b/platform/darwin/src/MGLStyleValue.h @@ -49,13 +49,13 @@ NS_ASSUME_NONNULL_BEGIN /** Creates and returns an `MGLStyleFunction` object representing a zoom level - function with an exponential base and any number of stops. + function with an exponential interpolation base and any number of stops. - @param base The exponential base of the interpolation curve. + @param interpolationBase The exponential base of the interpolation curve. @param stops A dictionary associating zoom levels with style values. - @return An `MGLStyleFunction` object with the given base and stops. + @return An `MGLStyleFunction` object with the given interpolation base and stops. */ -+ (instancetype)valueWithBase:(CGFloat)base stops:(NSDictionary *> *)stops; ++ (instancetype)valueWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary *> *)stops; @end @@ -126,38 +126,38 @@ NS_ASSUME_NONNULL_BEGIN /** Creates and returns an `MGLStyleFunction` object representing a zoom level - function with an exponential base and any number of stops. + function with an exponential interpolation base and any number of stops. - @param base The exponential base of the interpolation curve. + @param interpolationBase The exponential base of the interpolation curve. @param stops A dictionary associating zoom levels with style values. - @return An `MGLStyleFunction` object with the given base and stops. + @return An `MGLStyleFunction` object with the given interpolation base and stops. */ -+ (instancetype)functionWithBase:(CGFloat)base stops:(NSDictionary *> *)stops; ++ (instancetype)functionWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary *> *)stops; #pragma mark Initializing a Style Function /** Returns an `MGLStyleFunction` object representing a zoom level function with an - exponential base and any number of stops. + exponential interpolation base and any number of stops. - @param base The exponential base of the interpolation curve. + @param interpolationBase The exponential base of the interpolation curve. @param stops A dictionary associating zoom levels with style values. - @return An `MGLStyleFunction` object with the given base and stops. + @return An `MGLStyleFunction` object with the given interpolation base and stops. */ -- (instancetype)initWithBase:(CGFloat)base stops:(NSDictionary *> *)stops NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary *> *)stops NS_DESIGNATED_INITIALIZER; #pragma mark Accessing the Parameters of a Function /** - The exponential base of the function’s interpolation curve. + The exponential interpolation base of the function’s interpolation curve. - The exponential base controls the rate at which the function’s output values + The exponential interpolation base controls the rate at which the function’s output values increase. A value of 1 causes the function to increase linearly by zoom level. - A higher exponential base causes the function’s output values to vary + A higher exponential interpolation base causes the function’s output values to vary exponentially, increasing more rapidly towards the high end of the function’s range. The default value of this property is 1, for a linear curve. */ -@property (nonatomic) CGFloat base; +@property (nonatomic) CGFloat interpolationBase; /** A dictionary associating zoom levels with style values. diff --git a/platform/darwin/src/MGLStyleValue.mm b/platform/darwin/src/MGLStyleValue.mm index 6ced819cd1..9e77114378 100644 --- a/platform/darwin/src/MGLStyleValue.mm +++ b/platform/darwin/src/MGLStyleValue.mm @@ -6,8 +6,8 @@ return [MGLStyleConstantValue valueWithRawValue:rawValue]; } -+ (instancetype)valueWithBase:(CGFloat)base stops:(NSDictionary *)stops { - return [MGLStyleFunction functionWithBase:base stops:stops]; ++ (instancetype)valueWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary *)stops { + return [MGLStyleFunction functionWithInterpolationBase:interpolationBase stops:stops]; } + (instancetype)valueWithStops:(NSDictionary *)stops { @@ -49,44 +49,44 @@ @implementation MGLStyleFunction -+ (instancetype)functionWithBase:(CGFloat)base stops:(NSDictionary *)stops { - return [[self alloc] initWithBase:base stops:stops]; ++ (instancetype)functionWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary *)stops { + return [[self alloc] initWithInterpolationBase:interpolationBase stops:stops]; } + (instancetype)functionWithStops:(NSDictionary *)stops { - return [[self alloc] initWithBase:1 stops:stops]; + return [[self alloc] initWithInterpolationBase:1 stops:stops]; } - (instancetype)init { - return [self initWithBase:1 stops:@{}]; + return [self initWithInterpolationBase:1 stops:@{}]; } -- (instancetype)initWithBase:(CGFloat)base stops:(NSDictionary *)stops { +- (instancetype)initWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary *)stops { if (self = [super init]) { if (!stops.count) { [NSException raise:NSInvalidArgumentException format:@"%@ requires at least one stop.", self]; } - _base = base; + _interpolationBase = interpolationBase; _stops = stops; } return self; } - (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p, base = %f; stops = %@>", + return [NSString stringWithFormat:@"<%@: %p, interpolationBase = %f; stops = %@>", NSStringFromClass([self class]), (void *)self, - self.base, + self.interpolationBase, self.stops]; } - (BOOL)isEqual:(MGLStyleFunction *)other { - return ([other isKindOfClass:[self class]] && other.base == self.base + return ([other isKindOfClass:[self class]] && other.interpolationBase == self.interpolationBase && [other.stops isEqualToDictionary:self.stops]); } - (NSUInteger)hash { - return self.base + self.stops.hash; + return self.interpolationBase + self.stops.hash; } @end diff --git a/platform/darwin/src/MGLStyleValue_Private.h b/platform/darwin/src/MGLStyleValue_Private.h index 492ce20f1a..e35c0d8008 100644 --- a/platform/darwin/src/MGLStyleValue_Private.h +++ b/platform/darwin/src/MGLStyleValue_Private.h @@ -42,7 +42,7 @@ public: for (const auto &mbglStop : mbglStops) { stops[@(mbglStop.first)] = toEnumStyleConstantValue<>(mbglStop.second); } - return [MGLStyleFunction functionWithBase:mbglValue.asFunction().getBase() stops:stops]; + return [MGLStyleFunction functionWithInterpolationBase:mbglValue.asFunction().getBase() stops:stops]; } else { return nil; } @@ -62,7 +62,7 @@ public: NSCAssert(mbglStopValue.isConstant(), @"Stops must be constant"); mbglStops.emplace_back(zoomKey.floatValue, mbglStopValue.asConstant()); }]; - return mbgl::style::Function({{mbglStops}}, function.base); + return mbgl::style::Function({{mbglStops}}, function.interpolationBase); } else if (value) { [NSException raise:@"MGLAbstractClassException" format: @"The style value %@ cannot be applied to the style. " @@ -92,7 +92,7 @@ public: NSCAssert(mbglStopValue.isConstant(), @"Stops must be constant"); mbglStops.emplace_back(zoomKey.floatValue, mbglStopValue.asConstant()); }]; - return mbgl::style::Function({{mbglStops}}, function.base); + return mbgl::style::Function({{mbglStops}}, function.interpolationBase); } else if (value) { [NSException raise:@"MGLAbstractClassException" format: @"The style value %@ cannot be applied to the style. " @@ -118,7 +118,7 @@ private: auto rawValue = toMGLRawStyleValue(mbglStop.second); stops[@(mbglStop.first)] = [MGLStyleValue valueWithRawValue:rawValue]; } - return [MGLStyleFunction functionWithBase:mbglFunction.getBase() stops:stops]; + return [MGLStyleFunction functionWithInterpolationBase:mbglFunction.getBase() stops:stops]; } template (base: 1, stops: stops) - XCTAssertEqual((symbolStyleLayer.iconAllowsOverlap as! MGLStyleFunction), MGLStyleFunction(base: 1, stops: stops)) + symbolStyleLayer.iconAllowsOverlap = MGLStyleFunction(interpolationBase: 1, stops: stops) + XCTAssertEqual((symbolStyleLayer.iconAllowsOverlap as! MGLStyleFunction), MGLStyleFunction(interpolationBase: 1, stops: stops)) } } -- cgit v1.2.1