summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Bounds <jesse@rebounds.net>2016-12-19 11:45:00 -0800
committerGitHub <noreply@github.com>2016-12-19 11:45:00 -0800
commita174588e6ccb5c0101479c882d399a07ba96ba76 (patch)
tree7813fafc640fffdc403d63ce6068cd63fb502b5a
parente2fde9cc4eff3de5ab2f513d0c24ad5471d147e6 (diff)
downloadqtlocation-mapboxgl-a174588e6ccb5c0101479c882d399a07ba96ba76.tar.gz
[ios, macos] Rename base to interpolationBase (#7486)
-rw-r--r--platform/darwin/src/MGLStyleValue.h32
-rw-r--r--platform/darwin/src/MGLStyleValue.mm24
-rw-r--r--platform/darwin/src/MGLStyleValue_Private.h8
-rw-r--r--platform/darwin/test/MGLStyleValueTests.swift4
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<NSNumber *, MGLStyleValue<T> *> *)stops;
++ (instancetype)valueWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary<NSNumber *, MGLStyleValue<T> *> *)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<NSNumber *, MGLStyleValue<T> *> *)stops;
++ (instancetype)functionWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary<NSNumber *, MGLStyleValue<T> *> *)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<NSNumber *, MGLStyleValue<T> *> *)stops NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary<NSNumber *, MGLStyleValue<T> *> *)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<NSValue *> functionWithBase:mbglValue.asFunction().getBase() stops:stops];
+ return [MGLStyleFunction<NSValue *> 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<MBGLType>({{mbglStops}}, function.base);
+ return mbgl::style::Function<MBGLType>({{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<MBGLEnum>({{mbglStops}}, function.base);
+ return mbgl::style::Function<MBGLEnum>({{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<ObjCType> functionWithBase:mbglFunction.getBase() stops:stops];
+ return [MGLStyleFunction<ObjCType> functionWithInterpolationBase:mbglFunction.getBase() stops:stops];
}
template <typename MBGLEnum = MBGLType,
diff --git a/platform/darwin/test/MGLStyleValueTests.swift b/platform/darwin/test/MGLStyleValueTests.swift
index bf01435114..a787804410 100644
--- a/platform/darwin/test/MGLStyleValueTests.swift
+++ b/platform/darwin/test/MGLStyleValueTests.swift
@@ -32,7 +32,7 @@ extension MGLStyleValueTests {
3: MGLStyleValue(rawValue: true),
4: MGLStyleValue(rawValue: false),
]
- symbolStyleLayer.iconAllowsOverlap = MGLStyleFunction<NSNumber>(base: 1, stops: stops)
- XCTAssertEqual((symbolStyleLayer.iconAllowsOverlap as! MGLStyleFunction<NSNumber>), MGLStyleFunction(base: 1, stops: stops))
+ symbolStyleLayer.iconAllowsOverlap = MGLStyleFunction<NSNumber>(interpolationBase: 1, stops: stops)
+ XCTAssertEqual((symbolStyleLayer.iconAllowsOverlap as! MGLStyleFunction<NSNumber>), MGLStyleFunction(interpolationBase: 1, stops: stops))
}
}