summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-03-19 11:40:37 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-03-19 14:45:59 -0700
commit645d1f38577c1bc24aee7efb005d072f81480670 (patch)
tree936ed40e264758849829384d68269b676f6dd26f
parentae7bd9ac6ac12b37da0272ea7d1836f18a78ec10 (diff)
downloadqtlocation-mapboxgl-645d1f38577c1bc24aee7efb005d072f81480670.tar.gz
Delete unused code
This code appears to be unused and has not been kept in sync with style spec changes.
-rw-r--r--gyp/platform-ios.gypi10
-rw-r--r--include/mbgl/ios/MGLStyleFunctionValue.h23
-rw-r--r--include/mbgl/ios/MGLTypes.h17
-rw-r--r--include/mbgl/ios/NSArray+MGLAdditions.h7
-rw-r--r--include/mbgl/ios/NSDictionary+MGLAdditions.h7
-rw-r--r--include/mbgl/ios/UIColor+MGLAdditions.h11
-rw-r--r--platform/ios/MGLMapView.mm410
-rw-r--r--platform/ios/MGLStyleFunctionValue.m190
-rw-r--r--platform/ios/MGLTypes.m24
-rw-r--r--platform/ios/NSArray+MGLAdditions.m10
-rw-r--r--platform/ios/NSDictionary+MGLAdditions.m10
-rw-r--r--platform/ios/UIColor+MGLAdditions.m167
12 files changed, 0 insertions, 886 deletions
diff --git a/gyp/platform-ios.gypi b/gyp/platform-ios.gypi
index a8a827af65..de73037eb5 100644
--- a/gyp/platform-ios.gypi
+++ b/gyp/platform-ios.gypi
@@ -18,16 +18,6 @@
'../platform/darwin/reachability.m',
'../include/mbgl/ios/MGLMapView.h',
'../platform/ios/MGLMapView.mm',
- '../include/mbgl/ios/MGLStyleFunctionValue.h',
- '../platform/ios/MGLStyleFunctionValue.m',
- '../include/mbgl/ios/MGLTypes.h',
- '../platform/ios/MGLTypes.m',
- '../include/mbgl/ios/NSArray+MGLAdditions.h',
- '../platform/ios/NSArray+MGLAdditions.m',
- '../include/mbgl/ios/NSDictionary+MGLAdditions.h',
- '../platform/ios/NSDictionary+MGLAdditions.m',
- '../include/mbgl/ios/UIColor+MGLAdditions.h',
- '../platform/ios/UIColor+MGLAdditions.m',
],
'variables': {
diff --git a/include/mbgl/ios/MGLStyleFunctionValue.h b/include/mbgl/ios/MGLStyleFunctionValue.h
deleted file mode 100644
index 27a867548b..0000000000
--- a/include/mbgl/ios/MGLStyleFunctionValue.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#import <UIKit/UIKit.h>
-
-@interface MGLStyleFunctionValue : NSObject
-
-+ (instancetype)linearFunctionWithBaseZoomLevel:(CGFloat)zBase
- initialValue:(CGFloat)val
- slope:(CGFloat)slope
- minimumValue:(CGFloat)min
- maximumValue:(CGFloat)max;
-
-+ (instancetype)exponentialFunctionWithBaseZoomLevel:(CGFloat)zBase
- initialValue:(CGFloat)val
- slope:(CGFloat)slope
- minimumValue:(CGFloat)min
- maximumValue:(CGFloat)max;
-
-+ (instancetype)minimumZoomLevelFunction:(CGFloat)minimumZoom;
-
-+ (instancetype)maximumZoomLevelFunction:(CGFloat)maximumZoom;
-
-+ (instancetype)stopsFunctionWithZoomLevelsAndValues:(NSNumber *)firstZoom, ... NS_REQUIRES_NIL_TERMINATION;
-
-@end
diff --git a/include/mbgl/ios/MGLTypes.h b/include/mbgl/ios/MGLTypes.h
deleted file mode 100644
index 7a17445770..0000000000
--- a/include/mbgl/ios/MGLTypes.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#import <Foundation/Foundation.h>
-
-// style property value types
-//
-extern NSString *const MGLStyleValueTypeBoolean;
-extern NSString *const MGLStyleValueTypeNumber;
-extern NSString *const MGLStyleValueTypeNumberPair;
-extern NSString *const MGLStyleValueTypeColor;
-extern NSString *const MGLStyleValueTypeString;
-
-// style property function types
-//
-extern NSString *const MGLStyleValueTypeFunctionMinimumZoom;
-extern NSString *const MGLStyleValueTypeFunctionMaximumZoom;
-extern NSString *const MGLStyleValueTypeFunctionLinear;
-extern NSString *const MGLStyleValueTypeFunctionExponential;
-extern NSString *const MGLStyleValueTypeFunctionStops;
diff --git a/include/mbgl/ios/NSArray+MGLAdditions.h b/include/mbgl/ios/NSArray+MGLAdditions.h
deleted file mode 100644
index 4b87614330..0000000000
--- a/include/mbgl/ios/NSArray+MGLAdditions.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#import <Foundation/Foundation.h>
-
-@interface NSArray (MGLAdditions)
-
-- (NSMutableArray *)deepMutableCopy;
-
-@end
diff --git a/include/mbgl/ios/NSDictionary+MGLAdditions.h b/include/mbgl/ios/NSDictionary+MGLAdditions.h
deleted file mode 100644
index 04c3396d41..0000000000
--- a/include/mbgl/ios/NSDictionary+MGLAdditions.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#import <Foundation/Foundation.h>
-
-@interface NSDictionary (MGLAdditions)
-
-- (NSMutableDictionary *)deepMutableCopy;
-
-@end
diff --git a/include/mbgl/ios/UIColor+MGLAdditions.h b/include/mbgl/ios/UIColor+MGLAdditions.h
deleted file mode 100644
index 3758c04eef..0000000000
--- a/include/mbgl/ios/UIColor+MGLAdditions.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#import <UIKit/UIKit.h>
-
-@interface UIColor (MGLAdditions)
-
-+ (UIColor *)colorWithRGBAString:(NSString *)rgbaString;
-- (NSString *)rgbaStringFromColor;
-
-+ (UIColor *)colorWithHexString:(NSString *)hexString;
-- (NSString *)hexStringFromColor;
-
-@end
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index 0d530ca1cf..e18c5557d9 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -14,14 +14,6 @@
#include <mbgl/storage/network_status.hpp>
#include <mbgl/util/geo.hpp>
-#import "MGLTypes.h"
-#import "MGLStyleFunctionValue.h"
-
-#import "UIColor+MGLAdditions.h"
-#import "NSArray+MGLAdditions.h"
-#import "NSDictionary+MGLAdditions.h"
-
-
// Returns the path to the default cache database on this system.
const std::string &defaultCacheDatabase() {
static const std::string path = []() -> std::string {
@@ -39,17 +31,6 @@ const std::string &defaultCacheDatabase() {
static dispatch_once_t loadGLExtensions;
-extern NSString *const MGLStyleKeyGeneric;
-extern NSString *const MGLStyleKeyFill;
-extern NSString *const MGLStyleKeyLine;
-extern NSString *const MGLStyleKeyIcon;
-extern NSString *const MGLStyleKeyText;
-extern NSString *const MGLStyleKeyRaster;
-extern NSString *const MGLStyleKeyComposite;
-extern NSString *const MGLStyleKeyBackground;
-
-extern NSString *const MGLStyleValueFunctionAllowed;
-
NSTimeInterval const MGLAnimationDuration = 0.3;
#pragma mark - Private -
@@ -67,7 +48,6 @@ NSTimeInterval const MGLAnimationDuration = 0.3;
@property (nonatomic) UIRotationGestureRecognizer *rotate;
@property (nonatomic) UILongPressGestureRecognizer *quickZoom;
@property (nonatomic) NSMutableArray *bundledStyleNames;
-@property (nonatomic, readonly) NSDictionary *allowedStyleTypes;
@property (nonatomic) CGPoint centerPoint;
@property (nonatomic) CGFloat scale;
@property (nonatomic) CGFloat angle;
@@ -77,22 +57,6 @@ NSTimeInterval const MGLAnimationDuration = 0.3;
@end
-@interface MGLStyleFunctionValue (MGLMapViewFriend)
-
-@property (nonatomic) NSString *functionType;
-@property (nonatomic) NSDictionary *stops;
-@property (nonatomic) CGFloat zBase;
-@property (nonatomic) CGFloat val;
-@property (nonatomic) CGFloat slope;
-@property (nonatomic) CGFloat min;
-@property (nonatomic) CGFloat max;
-@property (nonatomic) CGFloat minimumZoom;
-@property (nonatomic) CGFloat maximumZoom;
-
-- (id)rawStyle;
-
-@end
-
@implementation MGLMapView
@synthesize bundledStyleNames=_bundledStyleNames;
@@ -976,47 +940,6 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
}
}
-- (NSArray *)getStyleOrderedLayerNames
-{
- return [[self getRawStyle] valueForKeyPath:@"layers.id"];
-}
-
-- (void)setStyleOrderedLayerNames:(NSArray *)orderedLayerNames
-{
- NSMutableDictionary *style = [[self getRawStyle] deepMutableCopy];
- NSArray *oldLayers = style[@"layers"];
- NSMutableArray *newLayers = [NSMutableArray array];
-
- if ([orderedLayerNames count] != [[oldLayers valueForKeyPath:@"id"] count])
- {
- [NSException raise:@"invalid layer count"
- format:@"new layer count (%lu) should equal existing layer count (%lu)",
- (unsigned long)[orderedLayerNames count],
- (unsigned long)[[oldLayers valueForKeyPath:@"id"] count]];
- }
- else
- {
- for (NSString *newLayerName in orderedLayerNames)
- {
- if ( ! [[oldLayers valueForKeyPath:@"id"] containsObject:newLayerName])
- {
- [NSException raise:@"invalid layer name"
- format:@"layer name %@ unknown",
- newLayerName];
- }
- else
- {
- NSDictionary *newLayer = [oldLayers objectAtIndex:[[oldLayers valueForKeyPath:@"id"] indexOfObject:newLayerName]];
- [newLayers addObject:newLayer];
- }
- }
- }
-
- [style setValue:newLayers forKey:@"layers"];
-
- [self setRawStyle:style];
-}
-
- (NSArray *)getAppliedStyleClasses
{
NSMutableArray *returnArray = [NSMutableArray array];
@@ -1049,339 +972,6 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
mbglMap->setClasses(newAppliedClasses);
}
-- (NSString *)getKeyTypeForLayer:(NSString *)layerName
-{
- NSDictionary *style = [self getRawStyle];
-
- NSString *bucketType;
-
- if ([layerName isEqualToString:@"background"])
- {
- bucketType = @"background";
- }
- else
- {
- for (NSDictionary *layer in style[@"structure"])
- {
- if ([layer[@"name"] isEqualToString:layerName])
- {
- bucketType = style[@"buckets"][layer[@"bucket"]][@"type"];
- break;
- }
- }
- }
-
- NSString *keyType;
-
- if ([bucketType isEqualToString:@"fill"])
- {
- keyType = MGLStyleKeyFill;
- }
- else if ([bucketType isEqualToString:@"line"])
- {
- keyType = MGLStyleKeyLine;
- }
- else if ([bucketType isEqualToString:@"point"])
- {
- keyType = MGLStyleKeyIcon;
- }
- else if ([bucketType isEqualToString:@"text"])
- {
- keyType = MGLStyleKeyText;
- }
- else if ([bucketType isEqualToString:@"raster"])
- {
- keyType = MGLStyleKeyRaster;
- }
- else if ([bucketType isEqualToString:@"composite"])
- {
- keyType = MGLStyleKeyComposite;
- }
- else if ([bucketType isEqualToString:@"background"])
- {
- keyType = MGLStyleKeyBackground;
- }
- else
- {
- [NSException raise:@"invalid bucket type"
- format:@"bucket type %@ unknown",
- bucketType];
- }
-
- return keyType;
-}
-
-- (NSDictionary *)getStyleDescriptionForLayer:(NSString *)layerName inClass:(NSString *)className
-{
- NSDictionary *style = [self getRawStyle];
-
- if ( ! [[style valueForKeyPath:@"classes.name"] containsObject:className])
- {
- [NSException raise:@"invalid class name"
- format:@"class name %@ unknown",
- className];
- }
-
- NSUInteger classNumber = [[style valueForKeyPath:@"classes.name"] indexOfObject:className];
-
- if ( ! [[style[@"classes"][classNumber][@"layers"] allKeys] containsObject:layerName])
- {
- // layer specified in structure, but not styled
- //
- return nil;
- }
-
- NSDictionary *layerStyle = style[@"classes"][classNumber][@"layers"][layerName];
-
- NSMutableDictionary *styleDescription = [NSMutableDictionary dictionary];
-
- for (NSString *keyName in [layerStyle allKeys])
- {
- id value = layerStyle[keyName];
-
- while ([[style[@"constants"] allKeys] containsObject:value])
- {
- value = style[@"constants"][value];
- }
-
- if ([[self.allowedStyleTypes[MGLStyleKeyGeneric] allKeys] containsObject:keyName])
- {
- [styleDescription setValue:[self typedPropertyForKeyName:keyName
- ofType:MGLStyleKeyGeneric
- withValue:value]
- forKey:keyName];
- }
-
- NSString *keyType = [self getKeyTypeForLayer:layerName];
-
- if ([[self.allowedStyleTypes[keyType] allKeys] containsObject:keyName])
- {
- [styleDescription setValue:[self typedPropertyForKeyName:keyName
- ofType:keyType
- withValue:value]
- forKey:keyName];
- }
- }
-
- return styleDescription;
-}
-
-- (NSDictionary *)typedPropertyForKeyName:(NSString *)keyName ofType:(NSString *)keyType withValue:(id)value
-{
- if ( ! [[self.allowedStyleTypes[keyType] allKeys] containsObject:keyName])
- {
- [NSException raise:@"invalid property name"
- format:@"property name %@ unknown",
- keyName];
- }
-
- NSArray *typeInfo = self.allowedStyleTypes[keyType][keyName];
-
- if ([value isKindOfClass:[NSArray class]] && ! [typeInfo containsObject:MGLStyleValueTypeColor])
- {
- if ([typeInfo containsObject:MGLStyleValueFunctionAllowed])
- {
- if ([[(NSArray *)value firstObject] isKindOfClass:[NSString class]])
- {
- NSString *functionType;
-
- if ([[(NSArray *)value firstObject] isEqualToString:@"linear"])
- {
- functionType = MGLStyleValueTypeFunctionLinear;
- }
- else if ([[(NSArray *)value firstObject] isEqualToString:@"stops"])
- {
- functionType = MGLStyleValueTypeFunctionStops;
- }
- else if ([[(NSArray *)value firstObject] isEqualToString:@"exponential"])
- {
- functionType = MGLStyleValueTypeFunctionExponential;
- }
- else if ([[(NSArray *)value firstObject] isEqualToString:@"min"])
- {
- functionType = MGLStyleValueTypeFunctionMinimumZoom;
- }
- else if ([[(NSArray *)value firstObject] isEqualToString:@"max"])
- {
- functionType = MGLStyleValueTypeFunctionMaximumZoom;
- }
-
- if (functionType)
- {
- return @{ @"type" : functionType,
- @"value" : value };
- }
- }
- }
- else if ([typeInfo containsObject:MGLStyleValueTypeNumberPair])
- {
- return @{ @"type" : MGLStyleValueTypeNumberPair,
- @"value" : value };
- }
- }
- else if ([typeInfo containsObject:MGLStyleValueTypeNumber])
- {
- return @{ @"type" : MGLStyleValueTypeNumber,
- @"value" : value };
- }
- else if ([typeInfo containsObject:MGLStyleValueTypeBoolean])
- {
- return @{ @"type" : MGLStyleValueTypeBoolean,
- @"value" : @([(NSString *)value boolValue]) };
- }
- else if ([typeInfo containsObject:MGLStyleValueTypeString])
- {
- return @{ @"type" : MGLStyleValueTypeString,
- @"value" : value };
- }
- else if ([typeInfo containsObject:MGLStyleValueTypeColor])
- {
- UIColor *color;
-
- if ([(NSString *)value hasPrefix:@"#"])
- {
- color = [UIColor colorWithHexString:value];
- }
- else if ([(NSString *)value hasPrefix:@"rgb"])
- {
- color = [UIColor colorWithRGBAString:value];
- }
- else if ([(NSString *)value hasPrefix:@"hsl"])
- {
- [NSException raise:@"invalid color format"
- format:@"HSL color format not yet supported natively"];
- }
- else if ([value isKindOfClass:[NSArray class]] && [(NSArray *)value count] == 4)
- {
- color = [UIColor colorWithRed:[value[0] floatValue]
- green:[value[1] floatValue]
- blue:[value[2] floatValue]
- alpha:[value[3] floatValue]];
- }
- else if ([[UIColor class] respondsToSelector:NSSelectorFromString([NSString stringWithFormat:@"%@Color", [(NSString *)value lowercaseString]])])
- {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
-
- color = [[UIColor class] performSelector:NSSelectorFromString([NSString stringWithFormat:@"%@Color", [(NSString *)value lowercaseString]])];
-
-#pragma clang diagnostic pop
- }
-
- return @{ @"type" : MGLStyleValueTypeColor,
- @"value" : color };
- }
-
- return nil;
-}
-
-- (void)setStyleDescription:(NSDictionary *)styleDescription forLayer:(NSString *)layerName inClass:(NSString *)className
-{
-#pragma unused(className)
-
- NSMutableDictionary *convertedStyle = [NSMutableDictionary dictionary];
-
- for (NSString *key in [styleDescription allKeys])
- {
- NSArray *styleParameters = nil;
-
- if ([[self.allowedStyleTypes[MGLStyleKeyGeneric] allKeys] containsObject:key])
- {
- styleParameters = self.allowedStyleTypes[MGLStyleKeyGeneric][key];
- }
- else
- {
- NSString *keyType = [self getKeyTypeForLayer:layerName];
-
- if ([[self.allowedStyleTypes[keyType] allKeys] containsObject:key])
- {
- styleParameters = self.allowedStyleTypes[keyType][key];
- }
- }
-
- if (styleParameters)
- {
- if ([styleDescription[key][@"value"] isKindOfClass:[MGLStyleFunctionValue class]])
- {
- convertedStyle[key] = [(MGLStyleFunctionValue *)styleDescription[key][@"value"] rawStyle];
- }
- else if ([styleParameters containsObject:styleDescription[key][@"type"]])
- {
- NSString *valueType = styleDescription[key][@"type"];
-
- if ([valueType isEqualToString:MGLStyleValueTypeColor])
- {
- convertedStyle[key] = [@"#" stringByAppendingString:[(UIColor *)styleDescription[key][@"value"] hexStringFromColor]];
- }
- else
- {
- // the rest (bool/number/pair/string) are already JSON-convertible types
- //
- convertedStyle[key] = styleDescription[key][@"value"];
- }
- }
- }
- else
- {
- [NSException raise:@"invalid style description format"
- format:@"unable to parse key '%@'",
- key];
- }
- }
-
-// NSMutableDictionary *style = [[self getRawStyle] deepMutableCopy];
-//
-// NSUInteger classIndex = [[[self getAllStyleClasses] valueForKey:@"name"] indexOfObject:className];
-//
-// style[@"classes"][classIndex][@"layers"][layerName] = convertedStyle;
-//
-// [self setRawStyle:style];
-}
-
-- (NSDictionary *)allowedStyleTypes
-{
- static NSDictionary *MGLStyleAllowedTypes = @{
- MGLStyleKeyGeneric : @{
- @"enabled" : @[ MGLStyleValueTypeBoolean, MGLStyleValueFunctionAllowed ],
- @"translate" : @[ MGLStyleValueTypeNumberPair, MGLStyleValueFunctionAllowed ],
- @"translate-anchor" : @[ MGLStyleValueTypeString, MGLStyleValueFunctionAllowed ],
- @"opacity" : @[ MGLStyleValueTypeNumber, MGLStyleValueFunctionAllowed ],
- @"prerender" : @[ MGLStyleValueTypeBoolean ],
- @"prerender-buffer" : MGLStyleValueTypeNumber,
- @"prerender-size" : @[ MGLStyleValueTypeNumber ],
- @"prerender-blur" : @[ MGLStyleValueTypeNumber ] },
- MGLStyleKeyFill : @{
- @"color" : @[ MGLStyleValueTypeColor ],
- @"stroke" : @[ MGLStyleValueTypeColor ],
- @"antialias" : @[ MGLStyleValueTypeBoolean ],
- @"image" : @[ MGLStyleValueTypeString ] },
- MGLStyleKeyLine : @{
- @"color" : @[ MGLStyleValueTypeColor ],
- @"width" : @[ MGLStyleValueTypeNumber, MGLStyleValueFunctionAllowed ],
- @"dasharray" : @[ MGLStyleValueTypeNumberPair, MGLStyleValueFunctionAllowed ] },
- MGLStyleKeyIcon : @{
- @"color" : @[ MGLStyleValueTypeColor ],
- @"image" : @[ MGLStyleValueTypeString ],
- @"size" : @[ MGLStyleValueTypeNumber, MGLStyleValueFunctionAllowed ],
- @"radius" : @[ MGLStyleValueTypeNumber, MGLStyleValueFunctionAllowed],
- @"blur" : @[ MGLStyleValueTypeNumber, MGLStyleValueFunctionAllowed ] },
- MGLStyleKeyText : @{
- @"color" : @[ MGLStyleValueTypeColor ],
- @"stroke" : @[ MGLStyleValueTypeColor ],
- @"strokeWidth" : @[ MGLStyleValueTypeNumber, MGLStyleValueFunctionAllowed ],
- @"strokeBlur" : @[ MGLStyleValueTypeNumber, MGLStyleValueFunctionAllowed ],
- @"size" : @[ MGLStyleValueTypeNumber, MGLStyleValueFunctionAllowed ],
- @"rotate" : @[ MGLStyleValueTypeNumber, MGLStyleValueFunctionAllowed ],
- @"alwaysVisible" : @[ MGLStyleValueTypeBoolean ] },
- MGLStyleKeyRaster : @{},
- MGLStyleKeyComposite : @{},
- MGLStyleKeyBackground : @{
- @"color" : @[ MGLStyleValueTypeColor ] }
- };
-
- return MGLStyleAllowedTypes;
-}
-
#pragma mark - Utility -
+ (CGFloat)degreesToRadians:(CGFloat)degrees
diff --git a/platform/ios/MGLStyleFunctionValue.m b/platform/ios/MGLStyleFunctionValue.m
deleted file mode 100644
index a319114eef..0000000000
--- a/platform/ios/MGLStyleFunctionValue.m
+++ /dev/null
@@ -1,190 +0,0 @@
-#import "MGLStyleFunctionValue.h"
-
-#import "MGLTypes.h"
-
-@interface MGLStyleFunctionValue ()
-
-@property (nonatomic) NSString *functionType;
-@property (nonatomic) NSDictionary *stops;
-@property (nonatomic) CGFloat zBase;
-@property (nonatomic) CGFloat val;
-@property (nonatomic) CGFloat slope;
-@property (nonatomic) CGFloat min;
-@property (nonatomic) CGFloat max;
-@property (nonatomic) CGFloat minimumZoom;
-@property (nonatomic) CGFloat maximumZoom;
-
-- (NSDictionary *)rawStyle;
-
-@end
-
-@implementation MGLStyleFunctionValue
-
-- (id)initWithFunctionType:(NSString *)functionType
- stops:(NSDictionary *)stops
- zBase:(CGFloat)zBase
- val:(CGFloat)val
- slope:(CGFloat)slope
- min:(CGFloat)min
- max:(CGFloat)max
- minimumZoom:(CGFloat)minimumZoom
- maximumZoom:(CGFloat)maximumZoom
-{
- self = [super init];
-
- if (self)
- {
- _functionType = functionType;
- _stops = stops;
- _zBase = zBase;
- _val = val;
- _slope = slope;
- _min = min;
- _max = max;
- _minimumZoom = minimumZoom;
- _maximumZoom = maximumZoom;
- }
-
- return self;
-}
-
-- (id)rawStyle
-{
- if ([self.functionType isEqualToString:MGLStyleValueTypeFunctionMinimumZoom])
- {
- return @[ @"min", @(self.minimumZoom) ];
- }
- else if ([self.functionType isEqualToString:MGLStyleValueTypeFunctionMaximumZoom])
- {
- return @[ @"max", @(self.maximumZoom) ];
- }
- else if ([self.functionType isEqualToString:MGLStyleValueTypeFunctionLinear])
- {
- return @[ @"linear", @(self.zBase), @(self.val), @(self.slope), @(self.min), @(self.max) ];
- }
- else if ([self.functionType isEqualToString:MGLStyleValueTypeFunctionExponential])
- {
- return @[ @"exponential", @(self.zBase), @(self.val), @(self.slope), @(self.min), @(self.max) ];
- }
- else if ([self.functionType isEqualToString:MGLStyleValueTypeFunctionStops])
- {
- NSMutableArray *returnArray = [NSMutableArray array];
-
- for (NSNumber *z in [self.stops allKeys])
- {
- [returnArray addObject:@{ @"z" : z, @"val" : self.stops[z] }];
- }
-
- [returnArray insertObject:@"stops" atIndex:0];
-
- return returnArray;
- }
-
- return nil;
-}
-
-+ (instancetype)stopsFunctionWithZoomLevelsAndValues:(NSNumber *)firstZoom, ...
-{
- NSMutableArray *numbersArray = [NSMutableArray array];
-
- va_list args;
- va_start(args, firstZoom);
-
- for (NSNumber *arg = firstZoom; arg != nil; arg = va_arg(args, NSNumber *))
- {
- [numbersArray addObject:arg];
- }
-
- va_end(args);
-
- NSAssert([numbersArray count] % 2 == 0, @"invalid number of arguments");
-
- NSMutableDictionary *stops = [NSMutableDictionary dictionary];
-
- for (NSUInteger i = 0; i < [numbersArray count]; i = i + 2)
- {
- stops[numbersArray[i]] = stops[numbersArray[i + 1]];
- }
-
- return [[self alloc] initWithFunctionType:MGLStyleValueTypeFunctionStops
- stops:stops
- zBase:0
- val:0
- slope:0
- min:0
- max:0
- minimumZoom:0
- maximumZoom:0];
-}
-
-+ (instancetype)linearFunctionWithBaseZoomLevel:(CGFloat)zBase
- initialValue:(CGFloat)val
- slope:(CGFloat)slope
- minimumValue:(CGFloat)min
- maximumValue:(CGFloat)max
-{
- NSAssert(zBase >= 0 && zBase <= 18, @"invalid base zoom level");
- NSAssert(min < max, @"minimum value must be less than maximum value");
-
- return [[self alloc] initWithFunctionType:MGLStyleValueTypeFunctionLinear
- stops:nil
- zBase:zBase
- val:val
- slope:slope
- min:min
- max:max
- minimumZoom:0
- maximumZoom:0];
-}
-
-+ (instancetype)exponentialFunctionWithBaseZoomLevel:(CGFloat)zBase
- initialValue:(CGFloat)val
- slope:(CGFloat)slope
- minimumValue:(CGFloat)min
- maximumValue:(CGFloat)max
-{
- NSAssert(zBase >= 0 && zBase <= 18, @"invalid base zoom level");
- NSAssert(min < max, @"minimum value must be less than maximum value");
-
- return [[self alloc] initWithFunctionType:MGLStyleValueTypeFunctionExponential
- stops:nil
- zBase:zBase
- val:val
- slope:slope
- min:min
- max:max
- minimumZoom:0
- maximumZoom:0];
-}
-
-+ (instancetype)minimumZoomLevelFunction:(CGFloat)minimumZoom
-{
- NSAssert(minimumZoom >= 0 && minimumZoom <= 18, @"invalid minimum zoom value");
-
- return [[self alloc] initWithFunctionType:MGLStyleValueTypeFunctionMinimumZoom
- stops:nil
- zBase:0
- val:0
- slope:0
- min:0
- max:0
- minimumZoom:minimumZoom
- maximumZoom:0];
-}
-
-+ (instancetype)maximumZoomLevelFunction:(CGFloat)maximumZoom
-{
- NSAssert(maximumZoom >= 0 && maximumZoom <= 18, @"invalid maximum zoom value");
-
- return [[self alloc] initWithFunctionType:MGLStyleValueTypeFunctionMaximumZoom
- stops:nil
- zBase:0
- val:0
- slope:0
- min:0
- max:0
- minimumZoom:0
- maximumZoom:maximumZoom];
-}
-
-@end
diff --git a/platform/ios/MGLTypes.m b/platform/ios/MGLTypes.m
deleted file mode 100644
index 2928bc2f4c..0000000000
--- a/platform/ios/MGLTypes.m
+++ /dev/null
@@ -1,24 +0,0 @@
-#import "MGLTypes.h"
-
-NSString *const MGLStyleKeyGeneric = @"MGLStyleKeyGeneric";
-NSString *const MGLStyleKeyFill = @"MGLStyleKeyFill";
-NSString *const MGLStyleKeyLine = @"MGLStyleKeyLine";
-NSString *const MGLStyleKeyIcon = @"MGLStyleKeyIcon";
-NSString *const MGLStyleKeyText = @"MGLStyleKeyText";
-NSString *const MGLStyleKeyRaster = @"MGLStyleKeyRaster";
-NSString *const MGLStyleKeyComposite = @"MGLStyleKeyComposite";
-NSString *const MGLStyleKeyBackground = @"MGLStyleKeyBackground";
-
-NSString *const MGLStyleValueTypeBoolean = @"MGLStyleValueTypeBoolean";
-NSString *const MGLStyleValueTypeNumber = @"MGLStyleValueTypeNumber";
-NSString *const MGLStyleValueTypeNumberPair = @"MGLStyleValueTypeNumberPair";
-NSString *const MGLStyleValueTypeColor = @"MGLStyleValueTypeColor";
-NSString *const MGLStyleValueTypeString = @"MGLStyleValueTypeString";
-
-NSString *const MGLStyleValueFunctionAllowed = @"MGLStyleValueFunctionAllowed";
-
-NSString *const MGLStyleValueTypeFunctionMinimumZoom = @"MGLStyleValueTypeFunctionMinimumZoom";
-NSString *const MGLStyleValueTypeFunctionMaximumZoom = @"MGLStyleValueTypeFunctionMaximumZoom";
-NSString *const MGLStyleValueTypeFunctionLinear = @"MGLStyleValueTypeFunctionLinear";
-NSString *const MGLStyleValueTypeFunctionExponential = @"MGLStyleValueTypeFunctionExponential";
-NSString *const MGLStyleValueTypeFunctionStops = @"MGLStyleValueTypeFunctionStops";
diff --git a/platform/ios/NSArray+MGLAdditions.m b/platform/ios/NSArray+MGLAdditions.m
deleted file mode 100644
index 2bac42ce0b..0000000000
--- a/platform/ios/NSArray+MGLAdditions.m
+++ /dev/null
@@ -1,10 +0,0 @@
-#import "NSArray+MGLAdditions.h"
-
-@implementation NSArray (MGLAdditions)
-
-- (NSMutableArray *)deepMutableCopy
-{
- return (NSMutableArray *)CFBridgingRelease(CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (CFArrayRef)self, kCFPropertyListMutableContainersAndLeaves));
-}
-
-@end
diff --git a/platform/ios/NSDictionary+MGLAdditions.m b/platform/ios/NSDictionary+MGLAdditions.m
deleted file mode 100644
index 3228d56533..0000000000
--- a/platform/ios/NSDictionary+MGLAdditions.m
+++ /dev/null
@@ -1,10 +0,0 @@
-#import "NSDictionary+MGLAdditions.h"
-
-@implementation NSDictionary (MGLAdditions)
-
-- (NSMutableDictionary *)deepMutableCopy
-{
- return (NSMutableDictionary *)CFBridgingRelease(CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (CFDictionaryRef)self, kCFPropertyListMutableContainersAndLeaves));
-}
-
-@end
diff --git a/platform/ios/UIColor+MGLAdditions.m b/platform/ios/UIColor+MGLAdditions.m
deleted file mode 100644
index ae40735d15..0000000000
--- a/platform/ios/UIColor+MGLAdditions.m
+++ /dev/null
@@ -1,167 +0,0 @@
-#import "UIColor+MGLAdditions.h"
-
-/* Portions based on Erica Sadun's uicolor-utilities
- https://github.com/erica/uicolor-utilities */
-
-@interface UIColor (MGLAdditionsPrivate)
-
-+ (UIColor *)colorWithRGBHex:(UInt32)hex;
-- (CGColorSpaceModel)colorSpaceModel;
-- (BOOL)canProvideRGBComponents;
-- (BOOL)red:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha;
-- (UInt32)rgbHex;
-
-@end
-
-@implementation UIColor (MGLAdditions)
-
-+ (UIColor *)colorWithRGBAString:(NSString *)rgbaString
-{
- UIColor *color;
-
- NSString *numberString = [rgbaString stringByReplacingOccurrencesOfString:@"rgba("
- withString:@""];
- numberString = [numberString stringByReplacingOccurrencesOfString:@"rgb("
- withString:@""];
- numberString = [numberString stringByReplacingOccurrencesOfString:@")"
- withString:@""];
-
- NSArray *numbers = [numberString componentsSeparatedByString:@","];
-
- if ([rgbaString hasPrefix:@"rgb("] && [numbers count] == 3)
- {
- color = [UIColor colorWithRed:[numbers[0] floatValue] / 255
- green:[numbers[1] floatValue] / 255
- blue:[numbers[2] floatValue] / 255
- alpha:1.0];
- }
- else if ([rgbaString hasPrefix:@"rgba("] && [numbers count] == 4)
- {
- color = [UIColor colorWithRed:[numbers[0] floatValue] / 255
- green:[numbers[1] floatValue] / 255
- blue:[numbers[2] floatValue] / 255
- alpha:[numbers[3] floatValue]];
- }
-
- return color;
-}
-
-- (NSString *)rgbaStringFromColor
-{
- CGFloat r,g,b,a;
-
- [self getRed:&r green:&g blue:&b alpha:&a];
-
- r *= 255;
- g *= 255;
- b *= 255;
- a *= 255;
-
- return [NSString stringWithFormat:@"rgba(%lu,%lu,%lu,%lu)", (unsigned long)r, (unsigned long)g, (unsigned long)b, (unsigned long)a];
-}
-
-+ (UIColor *)colorWithRGBHex:(UInt32)hex
-{
- int r = (hex >> 16) & 0xFF;
- int g = (hex >> 8) & 0xFF;
- int b = (hex) & 0xFF;
-
- return [UIColor colorWithRed:r / 255.0f
- green:g / 255.0f
- blue:b / 255.0f
- alpha:1.0f];
-}
-
-- (CGColorSpaceModel)colorSpaceModel
-{
- return CGColorSpaceGetModel(CGColorGetColorSpace(self.CGColor));
-}
-
-- (BOOL)canProvideRGBComponents
-{
- switch (self.colorSpaceModel)
- {
- case kCGColorSpaceModelRGB:
- case kCGColorSpaceModelMonochrome:
- {
- return YES;
- }
- default:
- {
- return NO;
- }
- }
-}
-
-- (BOOL)red:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha
-{
- const CGFloat *components = CGColorGetComponents(self.CGColor);
-
- CGFloat r,g,b,a;
-
- switch (self.colorSpaceModel)
- {
- case kCGColorSpaceModelMonochrome:
- {
- r = g = b = components[0];
- a = components[1];
-
- break;
- }
- case kCGColorSpaceModelRGB:
- {
- r = components[0];
- g = components[1];
- b = components[2];
- a = components[3];
-
- break;
- }
- default:
- {
- return NO;
- }
- }
-
- if (red) *red = r;
- if (green) *green = g;
- if (blue) *blue = b;
- if (alpha) *alpha = a;
-
- return YES;
-}
-
-- (UInt32)rgbHex
-{
- NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use rgbHex");
-
- CGFloat r, g, b, a;
-
- if ( ! [self red:&r green:&g blue:&b alpha:&a])
- return 0;
-
- r = fminf(fmaxf(r, 0.0f), 1.0f);
- g = fminf(fmaxf(g, 0.0f), 1.0f);
- b = fminf(fmaxf(b, 0.0f), 1.0f);
-
- return (((int)roundf(r * 255)) << 16) | (((int)roundf(g * 255)) << 8) | (((int)roundf(b * 255)));
-}
-
-- (NSString *)hexStringFromColor
-{
- return [NSString stringWithFormat:@"%0.6X", (unsigned int)(self.rgbHex)];
-}
-
-+ (UIColor *)colorWithHexString:(NSString *)hexString
-{
- NSScanner *scanner = [NSScanner scannerWithString:[hexString stringByReplacingOccurrencesOfString:@"#" withString:@""]];
-
- unsigned hexNum;
-
- if ( ! [scanner scanHexInt:&hexNum])
- return nil;
-
- return [UIColor colorWithRGBHex:hexNum];
-}
-
-@end