Formatting Objective-C and Objective-C++ (#2492)
This commit is contained in:
@@ -19,4 +19,5 @@ Language: Cpp
|
||||
---
|
||||
Language: ObjC
|
||||
BasedOnStyle: Google
|
||||
ObjCSpaceAfterProperty: true
|
||||
...
|
||||
|
||||
@@ -9,7 +9,7 @@ repos:
|
||||
hooks:
|
||||
- id: clang-format
|
||||
files: '.*\.(hpp|cpp|h)'
|
||||
exclude: '(vendor/.*|platform/(ios|darwin|macos)/.*|test/ios/.*|render-test/ios/.*|benchmark/ios/.*)'
|
||||
exclude: '(vendor/.*|darwin/include/mbgl/storage/reachability.h)'
|
||||
- repo: https://github.com/keith/pre-commit-buildifier
|
||||
rev: 6.4.0
|
||||
hooks:
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
NSString *dataDir = @"benchmark-data";
|
||||
NSString *resultFilePath = @"benchmark/results.json";
|
||||
|
||||
__attribute__((visibility ("default")))
|
||||
__attribute__((visibility("default")))
|
||||
@interface IosTestRunner : NSObject
|
||||
|
||||
- (NSString*) getResultPath;
|
||||
- (BOOL) getTestStatus;
|
||||
- (NSString *)getResultPath;
|
||||
- (BOOL)getTestStatus;
|
||||
|
||||
@end
|
||||
|
||||
@@ -26,9 +26,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@end
|
||||
|
||||
#define MLN_APPLE_EXPORT __attribute__((visibility ("default")))
|
||||
#define MLN_APPLE_EXPORT __attribute__((visibility("default")))
|
||||
|
||||
@interface MLNNativeNetworkManager: NSObject
|
||||
@interface MLNNativeNetworkManager : NSObject
|
||||
|
||||
+ (MLNNativeNetworkManager *)sharedManager;
|
||||
|
||||
|
||||
@@ -19,13 +19,14 @@ namespace {
|
||||
|
||||
template <typename HandleType, typename ReleaserArgumentType, void (*Releaser)(ReleaserArgumentType)>
|
||||
struct CFHandle {
|
||||
CFHandle(HandleType handle_): handle(handle_) {}
|
||||
CFHandle(HandleType handle_)
|
||||
: handle(handle_) {}
|
||||
~CFHandle() { Releaser(handle); }
|
||||
HandleType operator*() { return handle; }
|
||||
operator bool() { return handle; }
|
||||
|
||||
private:
|
||||
HandleType handle;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Options for `MLNAttributedExpression.attributes`. */
|
||||
typedef NSString * MLNAttributedExpressionKey NS_TYPED_ENUM;
|
||||
typedef NSString *MLNAttributedExpressionKey NS_TYPED_ENUM;
|
||||
|
||||
/** The font name string array expression used to format the text. */
|
||||
FOUNDATION_EXTERN MLN_EXPORT MLNAttributedExpressionKey const MLNFontNamesAttribute;
|
||||
|
||||
/** The font scale number expression relative to `MLNSymbolStyleLayer.textFontSize` used to format the text. */
|
||||
/** The font scale number expression relative to `MLNSymbolStyleLayer.textFontSize` used to format
|
||||
* the text. */
|
||||
FOUNDATION_EXTERN MLN_EXPORT MLNAttributedExpressionKey const MLNFontScaleAttribute;
|
||||
|
||||
/** The font color expression used to format the text. */
|
||||
@@ -22,10 +23,10 @@ FOUNDATION_EXTERN MLN_EXPORT MLNAttributedExpressionKey const MLNFontColorAttrib
|
||||
```swift
|
||||
let redColor = UIColor.red
|
||||
let expression = NSExpression(forConstantValue: "Foo")
|
||||
let attributes: [MLNAttributedExpressionKey: NSExpression] = [.fontNamesAttribute : NSExpression(forConstantValue: ["DIN Offc Pro Italic",
|
||||
"Arial Unicode MS Regular"]),
|
||||
.fontScaleAttribute: NSExpression(forConstantValue: 1.2),
|
||||
.fontColorAttribute: NSExpression(forConstantValue: redColor)]
|
||||
let attributes: [MLNAttributedExpressionKey: NSExpression] = [.fontNamesAttribute :
|
||||
NSExpression(forConstantValue: ["DIN Offc Pro Italic", "Arial Unicode MS Regular"]),
|
||||
.fontScaleAttribute:
|
||||
NSExpression(forConstantValue: 1.2), .fontColorAttribute: NSExpression(forConstantValue: redColor)]
|
||||
let attributedExpression = MLNAttributedExpression(expression, attributes:attributes)
|
||||
```
|
||||
|
||||
@@ -48,7 +49,8 @@ MLN_EXPORT
|
||||
`MLNFontColorAttribute` | An `NSExpression` evaluating to an `UIColor`.
|
||||
|
||||
*/
|
||||
@property (strong, nonatomic, readonly) NSDictionary<MLNAttributedExpressionKey, NSExpression *> *attributes;
|
||||
@property (strong, nonatomic, readonly)
|
||||
NSDictionary<MLNAttributedExpressionKey, NSExpression *> *attributes;
|
||||
#else
|
||||
/**
|
||||
The formatting attributes dictionary.
|
||||
@@ -58,29 +60,39 @@ MLN_EXPORT
|
||||
`MLNFontScaleAttribute` | An `NSExpression` evaluating to an `NSNumber` value.
|
||||
`MLNFontColorAttribute` | An `NSExpression` evaluating to an `NSColor` on macos.
|
||||
*/
|
||||
@property (strong, nonatomic, readonly) NSDictionary<MLNAttributedExpressionKey, NSExpression *> *attributes;
|
||||
@property (strong, nonatomic, readonly)
|
||||
NSDictionary<MLNAttributedExpressionKey, NSExpression *> *attributes;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
Returns an `MLNAttributedExpression` object initialized with an expression and no attribute information.
|
||||
Returns an `MLNAttributedExpression` object initialized with an expression and no attribute
|
||||
information.
|
||||
*/
|
||||
- (instancetype)initWithExpression:(NSExpression *)expression;
|
||||
|
||||
/**
|
||||
Returns an `MLNAttributedExpression` object initialized with an expression and text format attributes.
|
||||
Returns an `MLNAttributedExpression` object initialized with an expression and text format
|
||||
attributes.
|
||||
*/
|
||||
- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary <MLNAttributedExpressionKey, NSExpression *> *)attrs;
|
||||
- (instancetype)
|
||||
initWithExpression:(NSExpression *)expression
|
||||
attributes:(nonnull NSDictionary<MLNAttributedExpressionKey, NSExpression *> *)attrs;
|
||||
|
||||
/**
|
||||
Creates an `MLNAttributedExpression` object initialized with an expression and the format attributes for font names and font size.
|
||||
Creates an `MLNAttributedExpression` object initialized with an expression and the format
|
||||
attributes for font names and font size.
|
||||
*/
|
||||
+ (instancetype)attributedExpression:(NSExpression *)expression fontNames:(nullable NSArray<NSString*> *)fontNames fontScale:(nullable NSNumber *)fontScale;
|
||||
+ (instancetype)attributedExpression:(NSExpression *)expression
|
||||
fontNames:(nullable NSArray<NSString *> *)fontNames
|
||||
fontScale:(nullable NSNumber *)fontScale;
|
||||
|
||||
/**
|
||||
Creates an `MLNAttributedExpression` object initialized with an expression and the format attributes dictionary.
|
||||
Creates an `MLNAttributedExpression` object initialized with an expression and the format
|
||||
attributes dictionary.
|
||||
*/
|
||||
+ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary <MLNAttributedExpressionKey, NSExpression *> *)attrs;
|
||||
+ (instancetype)
|
||||
attributedExpression:(NSExpression *)expression
|
||||
attributes:(nonnull NSDictionary<MLNAttributedExpressionKey, NSExpression *> *)attrs;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNTypes.h"
|
||||
@@ -11,18 +11,18 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
The attribution info is represented in the longest format available.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, MLNAttributionInfoStyle) {
|
||||
/**
|
||||
Specifies a short attribution info style.
|
||||
*/
|
||||
MLNAttributionInfoStyleShort = 1,
|
||||
/**
|
||||
Specifies a medium attribution info style.
|
||||
*/
|
||||
MLNAttributionInfoStyleMedium,
|
||||
/**
|
||||
Specifies a long attribution info style.
|
||||
*/
|
||||
MLNAttributionInfoStyleLong
|
||||
/**
|
||||
Specifies a short attribution info style.
|
||||
*/
|
||||
MLNAttributionInfoStyleShort = 1,
|
||||
/**
|
||||
Specifies a medium attribution info style.
|
||||
*/
|
||||
MLNAttributionInfoStyleMedium,
|
||||
/**
|
||||
Specifies a long attribution info style.
|
||||
*/
|
||||
MLNAttributionInfoStyleLong
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNAttributionInfo.h"
|
||||
|
||||
@@ -16,9 +16,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@param fontSize The default text size in points.
|
||||
@param linkColor The default link color.
|
||||
*/
|
||||
+ (NSArray<MLNAttributionInfo *> *)attributionInfosFromHTMLString:(nullable NSString *)htmlString fontSize:(CGFloat)fontSize linkColor:(nullable MLNColor *)linkColor;
|
||||
+ (NSArray<MLNAttributionInfo *> *)attributionInfosFromHTMLString:(nullable NSString *)htmlString
|
||||
fontSize:(CGFloat)fontSize
|
||||
linkColor:(nullable MLNColor *)linkColor;
|
||||
|
||||
+ (NSAttributedString *)attributedStringForAttributionInfos:(NSArray<MLNAttributionInfo *> *)attributionInfos;
|
||||
+ (NSAttributedString *)attributedStringForAttributionInfos:
|
||||
(NSArray<MLNAttributionInfo *> *)attributionInfos;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -2,18 +2,16 @@
|
||||
|
||||
#import <MetalKit/MetalKit.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
MTKView *mtkView;
|
||||
id <MTLDevice> device;
|
||||
id<MTLDevice> device;
|
||||
MTLRenderPassDescriptor *renderPassDescriptor;
|
||||
id <MTLCommandBuffer> commandBuffer;
|
||||
id<MTLCommandBuffer> commandBuffer;
|
||||
} MLNBackendResource;
|
||||
|
||||
#else
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
} MLNBackendResource;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
@@ -39,7 +39,9 @@ MLN_EXPORT
|
||||
/**
|
||||
This method is not supported for the `MLNDirectionFormatter` class.
|
||||
*/
|
||||
- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error;
|
||||
- (BOOL)getObjectValue:(out id __nullable *__nullable)obj
|
||||
forString:(NSString *)string
|
||||
errorDescription:(out NSString *__nullable *__nullable)error;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
@@ -36,7 +36,9 @@ MLN_EXPORT
|
||||
/**
|
||||
This method is not supported for the `MLNDirectionFormatter` class.
|
||||
*/
|
||||
- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error;
|
||||
- (BOOL)getObjectValue:(out id __nullable *__nullable)obj
|
||||
forString:(NSString *)string
|
||||
errorDescription:(out NSString *__nullable *__nullable)error;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNGeometry.h"
|
||||
#import "MLNTypes.h"
|
||||
#import "MLNShapeSource.h"
|
||||
#import "MLNTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -50,7 +50,9 @@ FOUNDATION_EXTERN MLN_EXPORT MLNExceptionName const MLNInvalidDatasourceExceptio
|
||||
@param y Tile Y coordinate.
|
||||
@param zoomLevel Tile zoom level.
|
||||
*/
|
||||
- (NSArray<MLNShape <MLNFeature> *>*)featuresInTileAtX:(NSUInteger)x y:(NSUInteger)y zoomLevel:(NSUInteger)zoomLevel;
|
||||
- (NSArray<MLNShape<MLNFeature> *> *)featuresInTileAtX:(NSUInteger)x
|
||||
y:(NSUInteger)y
|
||||
zoomLevel:(NSUInteger)zoomLevel;
|
||||
|
||||
/**
|
||||
Fetch features for a tile. This method will not be invoked on the main queue, it
|
||||
@@ -58,7 +60,8 @@ FOUNDATION_EXTERN MLN_EXPORT MLNExceptionName const MLNInvalidDatasourceExceptio
|
||||
@param bounds The bounds to fetch data for.
|
||||
@param zoomLevel Tile zoom level.
|
||||
*/
|
||||
- (NSArray<MLNShape <MLNFeature> *>*)featuresInCoordinateBounds:(MLNCoordinateBounds)bounds zoomLevel:(NSUInteger)zoomLevel;
|
||||
- (NSArray<MLNShape<MLNFeature> *> *)featuresInCoordinateBounds:(MLNCoordinateBounds)bounds
|
||||
zoomLevel:(NSUInteger)zoomLevel;
|
||||
|
||||
@end
|
||||
|
||||
@@ -103,7 +106,9 @@ MLN_EXPORT
|
||||
@param identifier A string that uniquely identifies the source.
|
||||
@param options An `NSDictionary` of options for this source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
Returns a custom shape data source initialized with an identifier, data source, and a
|
||||
@@ -122,7 +127,9 @@ MLN_EXPORT
|
||||
@param identifier A string that uniquely identifies the source.
|
||||
@param options An `NSDictionary` of options for this source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier dataSource:(id<MLNComputedShapeSourceDataSource>)dataSource options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
dataSource:(id<MLNComputedShapeSourceDataSource>)dataSource
|
||||
options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options;
|
||||
|
||||
/**
|
||||
Invalidates all the features and properties intersecting with or contained in
|
||||
@@ -130,7 +137,7 @@ MLN_EXPORT
|
||||
`MLNComputedShapeSourceDataSource`.
|
||||
@param bounds Coordinate bounds to invalidate.
|
||||
*/
|
||||
- (void) invalidateBounds:(MLNCoordinateBounds)bounds;
|
||||
- (void)invalidateBounds:(MLNCoordinateBounds)bounds;
|
||||
|
||||
/**
|
||||
Invalidates all the feautres and properties of a given tile. A new fetch request
|
||||
@@ -139,7 +146,7 @@ MLN_EXPORT
|
||||
@param y Tile Y coordinate.
|
||||
@param zoomLevel Tile zoom level.
|
||||
*/
|
||||
- (void) invalidateTileAtX:(NSUInteger)x y:(NSUInteger)y zoomLevel:(NSUInteger)zoomLevel;
|
||||
- (void)invalidateTileAtX:(NSUInteger)x y:(NSUInteger)y zoomLevel:(NSUInteger)zoomLevel;
|
||||
|
||||
/**
|
||||
Set a new set of features for a tile. This method can be invkoed from background threads.
|
||||
@@ -150,10 +157,14 @@ MLN_EXPORT
|
||||
@param y Tile Y coordinate.
|
||||
@param zoomLevel Tile zoom level.
|
||||
*/
|
||||
- (void) setFeatures:(NSArray<MLNShape <MLNFeature> *>*)features inTileAtX:(NSUInteger)x y:(NSUInteger)y zoomLevel:(NSUInteger)zoomLevel;
|
||||
- (void)setFeatures:(NSArray<MLNShape<MLNFeature> *> *)features
|
||||
inTileAtX:(NSUInteger)x
|
||||
y:(NSUInteger)y
|
||||
zoomLevel:(NSUInteger)zoomLevel;
|
||||
|
||||
/**
|
||||
An object that implements the `MLNComputedShapeSourceDataSource` protocol that will be queried for tile data.
|
||||
An object that implements the `MLNComputedShapeSourceDataSource` protocol that will be queried for
|
||||
tile data.
|
||||
*/
|
||||
@property (nonatomic, weak, nullable) id<MLNComputedShapeSourceDataSource> dataSource;
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#import "MLNComputedShapeSource.h"
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNTypes.h"
|
||||
#import "MLNComputedShapeSource.h"
|
||||
|
||||
#include <mbgl/style/sources/custom_geometry_source.hpp>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
MLN_EXPORT
|
||||
mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDictionary(NSDictionary<MLNShapeSourceOption, id> *options);
|
||||
mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDictionary(
|
||||
NSDictionary<MLNShapeSourceOption, id> *options);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -8,164 +8,165 @@ namespace conversion {
|
||||
|
||||
// A wrapper class for `id`, so as not to confuse ARC.
|
||||
class Holder {
|
||||
public:
|
||||
Holder(const id v) : value(v) {}
|
||||
const id value;
|
||||
public:
|
||||
Holder(const id v) : value(v) {}
|
||||
const id value;
|
||||
};
|
||||
|
||||
template <>
|
||||
class ConversionTraits<Holder> {
|
||||
public:
|
||||
static bool isUndefined(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
return !value || value == [NSNull null];
|
||||
}
|
||||
public:
|
||||
static bool isUndefined(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
return !value || value == [NSNull null];
|
||||
}
|
||||
|
||||
static bool isArray(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
return [value isKindOfClass:[NSArray class]];
|
||||
}
|
||||
static bool isArray(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
return [value isKindOfClass:[NSArray class]];
|
||||
}
|
||||
|
||||
static bool isObject(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
return [value isKindOfClass:[NSDictionary class]];
|
||||
}
|
||||
static bool isObject(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
return [value isKindOfClass:[NSDictionary class]];
|
||||
}
|
||||
|
||||
static std::size_t arrayLength(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
NSCAssert([value isKindOfClass:[NSArray class]], @"Value must be an NSArray for getLength().");
|
||||
NSArray *array = value;
|
||||
auto length = [array count];
|
||||
NSCAssert(length <= std::numeric_limits<size_t>::max(), @"Array length out of bounds.");
|
||||
return length;
|
||||
}
|
||||
static std::size_t arrayLength(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
NSCAssert([value isKindOfClass:[NSArray class]], @"Value must be an NSArray for getLength().");
|
||||
NSArray* array = value;
|
||||
auto length = [array count];
|
||||
NSCAssert(length <= std::numeric_limits<size_t>::max(), @"Array length out of bounds.");
|
||||
return length;
|
||||
}
|
||||
|
||||
static Holder arrayMember(const Holder& holder, std::size_t i) {
|
||||
const id value = holder.value;
|
||||
NSCAssert([value isKindOfClass:[NSArray class]], @"Value must be an NSArray for get(int).");
|
||||
NSCAssert(i < NSUIntegerMax, @"Index must be less than NSUIntegerMax");
|
||||
return {[value objectAtIndex: i]};
|
||||
}
|
||||
static Holder arrayMember(const Holder& holder, std::size_t i) {
|
||||
const id value = holder.value;
|
||||
NSCAssert([value isKindOfClass:[NSArray class]], @"Value must be an NSArray for get(int).");
|
||||
NSCAssert(i < NSUIntegerMax, @"Index must be less than NSUIntegerMax");
|
||||
return {[value objectAtIndex:i]};
|
||||
}
|
||||
|
||||
static std::optional<Holder> objectMember(const Holder& holder, const char *key) {
|
||||
const id value = holder.value;
|
||||
NSCAssert([value isKindOfClass:[NSDictionary class]], @"Value must be an NSDictionary for get(string).");
|
||||
NSObject *member = [value objectForKey: @(key)];
|
||||
if (member && member != [NSNull null]) {
|
||||
return {member};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
static std::optional<Holder> objectMember(const Holder& holder, const char* key) {
|
||||
const id value = holder.value;
|
||||
NSCAssert([value isKindOfClass:[NSDictionary class]],
|
||||
@"Value must be an NSDictionary for get(string).");
|
||||
NSObject* member = [value objectForKey:@(key)];
|
||||
if (member && member != [NSNull null]) {
|
||||
return {member};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// Compiler is wrong about `Fn` parameter missing a nullability specifier.
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wnullability-completeness"
|
||||
template <class Fn>
|
||||
static std::optional<Error> eachMember(const Holder& holder, Fn&& visit) {
|
||||
template <class Fn>
|
||||
static std::optional<Error> eachMember(const Holder& holder, Fn&& visit) {
|
||||
#pragma clang diagnostic pop
|
||||
[holder.value enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
|
||||
auto result = visit(std::string(static_cast<const char *>([key UTF8String])), obj);
|
||||
if (result) {
|
||||
*stop = YES;
|
||||
}
|
||||
[holder.value
|
||||
enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL* _Nonnull stop) {
|
||||
auto result = visit(std::string(static_cast<const char*>([key UTF8String])), obj);
|
||||
if (result) {
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
return {};
|
||||
}
|
||||
|
||||
static std::optional<bool> toBool(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
if (_isBool(value)) {
|
||||
return ((NSNumber*)value).boolValue;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
static std::optional<float> toNumber(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
if (_isNumber(value)) {
|
||||
return ((NSNumber*)value).floatValue;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
static std::optional<double> toDouble(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
if (_isNumber(value)) {
|
||||
return ((NSNumber*)value).doubleValue;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
static std::optional<std::string> toString(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
if (_isString(value)) {
|
||||
return std::string(static_cast<const char*>([value UTF8String]));
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
static std::optional<mbgl::Value> toValue(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
if (isUndefined(value)) {
|
||||
return {};
|
||||
} else if (_isBool(value)) {
|
||||
return {*toBool(holder)};
|
||||
} else if (_isString(value)) {
|
||||
return {*toString(holder)};
|
||||
} else if (_isNumber(value)) {
|
||||
return {*toDouble(holder)};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
static std::optional<GeoJSON> toGeoJSON(const Holder& holder, Error& error) {
|
||||
id object = holder.value;
|
||||
if ([object isKindOfClass:[NSDictionary class]]) {
|
||||
NSError* serializationError;
|
||||
NSData* data = [NSJSONSerialization dataWithJSONObject:object
|
||||
options:0
|
||||
error:&serializationError];
|
||||
if (serializationError) {
|
||||
error = {std::string(serializationError.localizedDescription.UTF8String)};
|
||||
return {};
|
||||
}
|
||||
NSString* string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
||||
return mapbox::geojson::parse(string.UTF8String);
|
||||
} else {
|
||||
error = {std::string(
|
||||
[NSString stringWithFormat:@"%@ is not a GeoJSON object.", object].UTF8String)};
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
static std::optional<bool> toBool(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
if (_isBool(value)) {
|
||||
return ((NSNumber *)value).boolValue;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
private:
|
||||
static bool _isBool(const id value) {
|
||||
if (![value isKindOfClass:[NSNumber class]]) return false;
|
||||
// char: 32-bit boolean
|
||||
// BOOL: 64-bit boolean
|
||||
NSNumber* number = value;
|
||||
return ((strcmp([number objCType], @encode(char)) == 0) ||
|
||||
(strcmp([number objCType], @encode(BOOL)) == 0));
|
||||
}
|
||||
|
||||
static std::optional<float> toNumber(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
if (_isNumber(value)) {
|
||||
return ((NSNumber *)value).floatValue;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
static bool _isNumber(const id value) {
|
||||
return [value isKindOfClass:[NSNumber class]] && !_isBool(value);
|
||||
}
|
||||
|
||||
static std::optional<double> toDouble(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
if (_isNumber(value)) {
|
||||
return ((NSNumber *)value).doubleValue;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
static std::optional<std::string> toString(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
if (_isString(value)) {
|
||||
return std::string(static_cast<const char *>([value UTF8String]));
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
static std::optional<mbgl::Value> toValue(const Holder& holder) {
|
||||
const id value = holder.value;
|
||||
if (isUndefined(value)) {
|
||||
return {};
|
||||
} else if (_isBool(value)) {
|
||||
return { *toBool(holder) };
|
||||
} else if ( _isString(value)) {
|
||||
return { *toString(holder) };
|
||||
} else if (_isNumber(value)) {
|
||||
return { *toDouble(holder) };
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
static std::optional<GeoJSON> toGeoJSON(const Holder& holder, Error& error) {
|
||||
id object = holder.value;
|
||||
if ([object isKindOfClass:[NSDictionary class]]) {
|
||||
NSError *serializationError;
|
||||
NSData *data = [NSJSONSerialization dataWithJSONObject:object options:0 error:&serializationError];
|
||||
if (serializationError) {
|
||||
error = { std::string(serializationError.localizedDescription.UTF8String) };
|
||||
return {};
|
||||
}
|
||||
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
||||
return mapbox::geojson::parse(string.UTF8String);
|
||||
} else {
|
||||
error = { std::string([NSString stringWithFormat:@"%@ is not a GeoJSON object.", object].UTF8String) };
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static bool _isBool(const id value) {
|
||||
if (![value isKindOfClass:[NSNumber class]]) return false;
|
||||
// char: 32-bit boolean
|
||||
// BOOL: 64-bit boolean
|
||||
NSNumber *number = value;
|
||||
return ((strcmp([number objCType], @encode(char)) == 0) ||
|
||||
(strcmp([number objCType], @encode(BOOL)) == 0));
|
||||
}
|
||||
|
||||
static bool _isNumber(const id value) {
|
||||
return [value isKindOfClass:[NSNumber class]] && !_isBool(value);
|
||||
}
|
||||
|
||||
static bool _isString(const id value) {
|
||||
return [value isKindOfClass:[NSString class]];
|
||||
}
|
||||
static bool _isString(const id value) { return [value isKindOfClass:[NSString class]]; }
|
||||
};
|
||||
|
||||
inline Convertible makeConvertible(const id value) {
|
||||
return Convertible(Holder(value));
|
||||
}
|
||||
inline Convertible makeConvertible(const id value) { return Convertible(Holder(value)); }
|
||||
|
||||
} // namespace conversion
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
} // namespace conversion
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
@@ -49,7 +49,9 @@ MLN_EXPORT
|
||||
/**
|
||||
This method is not supported for the `MLNCoordinateFormatter` class.
|
||||
*/
|
||||
- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error;
|
||||
- (BOOL)getObjectValue:(out id __nullable *__nullable)obj
|
||||
forString:(NSString *)string
|
||||
errorDescription:(out NSString *__nullable *__nullable)error;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNStyleValue.h"
|
||||
#import "MLNStyleLayer.h"
|
||||
#import "MLNGeometry.h"
|
||||
#import "MLNStyleLayer.h"
|
||||
#import "MLNStyleValue.h"
|
||||
|
||||
MLN_EXPORT
|
||||
@interface MLNCustomDrawableStyleLayer : MLNStyleLayer
|
||||
|
||||
@@ -12,4 +12,4 @@ class CustomDrawableStyleLayerPeerFactory : public LayerPeerFactory, public mbgl
|
||||
virtual MLNStyleLayer* createPeer(style::Layer*) final;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNStyleValue.h"
|
||||
#import "MLNStyleLayer.h"
|
||||
#import "MLNGeometry.h"
|
||||
#import "MLNStyleLayer.h"
|
||||
#import "MLNStyleValue.h"
|
||||
|
||||
#if MLN_RENDER_BACKEND_METAL
|
||||
#import <MetalKit/MetalKit.h>
|
||||
@@ -17,13 +17,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@class MLNStyle;
|
||||
|
||||
typedef struct MLNStyleLayerDrawingContext {
|
||||
CGSize size;
|
||||
CLLocationCoordinate2D centerCoordinate;
|
||||
double zoomLevel;
|
||||
CLLocationDirection direction;
|
||||
CGFloat pitch;
|
||||
CGFloat fieldOfView;
|
||||
MLNMatrix4 projectionMatrix;
|
||||
CGSize size;
|
||||
CLLocationCoordinate2D centerCoordinate;
|
||||
double zoomLevel;
|
||||
CLLocationDirection direction;
|
||||
CGFloat pitch;
|
||||
CGFloat fieldOfView;
|
||||
MLNMatrix4 projectionMatrix;
|
||||
} MLNStyleLayerDrawingContext;
|
||||
|
||||
MLN_EXPORT
|
||||
|
||||
@@ -12,4 +12,4 @@ class CustomStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::Custom
|
||||
virtual MLNStyleLayer* createPeer(style::Layer*) final;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -13,12 +13,12 @@ MLN_EXPORT
|
||||
/**
|
||||
The style URL
|
||||
*/
|
||||
@property (nonatomic,retain) NSURL* url;
|
||||
@property (nonatomic, retain) NSURL* url;
|
||||
|
||||
/**
|
||||
The style name
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* name;
|
||||
@property (nonatomic, retain) NSString* name;
|
||||
|
||||
/**
|
||||
The style version
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNCluster.h"
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNPolyline.h"
|
||||
#import "MLNPolygon.h"
|
||||
#import "MLNPointAnnotation.h"
|
||||
#import "MLNPointCollection.h"
|
||||
#import "MLNPolygon.h"
|
||||
#import "MLNPolyline.h"
|
||||
#import "MLNShapeCollection.h"
|
||||
#import "MLNCluster.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -50,7 +50,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
In vector tiles loaded by `MLNVectorTileSource` objects, the identifier
|
||||
corresponds to the
|
||||
<a href="https://github.com/mapbox/vector-tile-spec/tree/master/2.1#42-features">feature identifier</a>
|
||||
<a href="https://github.com/mapbox/vector-tile-spec/tree/master/2.1#42-features">feature
|
||||
identifier</a>
|
||||
(`id`). If the source does not specify the feature’s identifier, the value of
|
||||
this property is `nil`. If specified, the identifier may be an integer,
|
||||
floating-point number, or string. These data types are mapped to instances of
|
||||
@@ -61,9 +62,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
<tr><th>In the tile source</th><th>This property</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>Integer</td> <td><code>NSNumber</code> (use the <code>unsignedLongLongValue</code> or <code>longLongValue</code> property)</td></tr>
|
||||
<tr><td>Floating-point number</td> <td><code>NSNumber</code> (use the <code>doubleValue</code> property)</td></tr>
|
||||
<tr><td>String</td> <td><code>NSString</code></td></tr>
|
||||
<tr><td>Integer</td> <td><code>NSNumber</code> (use the
|
||||
<code>unsignedLongLongValue</code> or <code>longLongValue</code> property)</td></tr>
|
||||
<tr><td>Floating-point number</td> <td><code>NSNumber</code> (use the <code>doubleValue</code>
|
||||
property)</td></tr> <tr><td>String</td> <td><code>NSString</code></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -120,10 +122,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>Null</td> <td><code>NSNull</code></td></tr>
|
||||
<tr><td>Boolean</td> <td><code>NSNumber</code> (use the <code>boolValue</code> property)</td></tr>
|
||||
<tr><td>Integer</td> <td><code>NSNumber</code> (use the <code>unsignedLongLongValue</code> or <code>longLongValue</code> property)</td></tr>
|
||||
<tr><td>Floating-point number</td> <td><code>NSNumber</code> (use the <code>doubleValue</code> property)</td></tr>
|
||||
<tr><td>String</td> <td><code>NSString</code></td></tr>
|
||||
<tr><td>Boolean</td> <td><code>NSNumber</code> (use the <code>boolValue</code>
|
||||
property)</td></tr> <tr><td>Integer</td> <td><code>NSNumber</code> (use the
|
||||
<code>unsignedLongLongValue</code> or <code>longLongValue</code> property)</td></tr>
|
||||
<tr><td>Floating-point number</td> <td><code>NSNumber</code> (use the <code>doubleValue</code>
|
||||
property)</td></tr> <tr><td>String</td> <td><code>NSString</code></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNFeature.h"
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNShape.h"
|
||||
|
||||
#import <mbgl/util/geo.hpp>
|
||||
#import <mbgl/util/feature.hpp>
|
||||
#import <mbgl/style/conversion/geojson.hpp>
|
||||
#import <mbgl/util/feature.hpp>
|
||||
#import <mbgl/util/geo.hpp>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -13,73 +13,79 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
vector tile features.
|
||||
*/
|
||||
MLN_EXPORT
|
||||
NSArray<MLNShape <MLNFeature> *> *MLNFeaturesFromMBGLFeatures(const std::vector<mbgl::Feature> &features);
|
||||
NSArray<MLNShape<MLNFeature> *> *MLNFeaturesFromMBGLFeatures(
|
||||
const std::vector<mbgl::Feature> &features);
|
||||
|
||||
/**
|
||||
Returns an array of `MLNFeature` objects converted from the given vector of
|
||||
vector tile features.
|
||||
*/
|
||||
MLN_EXPORT
|
||||
NSArray<MLNShape <MLNFeature> *> *MLNFeaturesFromMBGLFeatures(const std::vector<mbgl::GeoJSONFeature> &features);
|
||||
NSArray<MLNShape<MLNFeature> *> *MLNFeaturesFromMBGLFeatures(
|
||||
const std::vector<mbgl::GeoJSONFeature> &features);
|
||||
|
||||
/**
|
||||
Returns an `MLNFeature` object converted from the given mbgl::GeoJSONFeature
|
||||
*/
|
||||
MLN_EXPORT
|
||||
id <MLNFeature> MLNFeatureFromMBGLFeature(const mbgl::GeoJSONFeature &feature);
|
||||
id<MLNFeature> MLNFeatureFromMBGLFeature(const mbgl::GeoJSONFeature &feature);
|
||||
|
||||
/**
|
||||
Returns an `MLNShape` representing the given geojson. The shape can be
|
||||
a feature, a collection of features, or a geometry.
|
||||
*/
|
||||
MLNShape* MLNShapeFromGeoJSON(const mapbox::geojson::geojson &geojson);
|
||||
MLNShape *MLNShapeFromGeoJSON(const mapbox::geojson::geojson &geojson);
|
||||
|
||||
/**
|
||||
Takes an `mbgl::GeoJSONFeature` object, an identifer, and attributes dictionary and
|
||||
returns the feature object with converted `mbgl::FeatureIdentifier` and
|
||||
`mbgl::PropertyMap` properties.
|
||||
*/
|
||||
mbgl::GeoJSONFeature mbglFeature(mbgl::GeoJSONFeature feature, id identifier, NSDictionary * attributes);
|
||||
mbgl::GeoJSONFeature mbglFeature(mbgl::GeoJSONFeature feature, id identifier,
|
||||
NSDictionary *attributes);
|
||||
|
||||
/**
|
||||
Returns an `NSDictionary` representation of an `MLNFeature`.
|
||||
*/
|
||||
NSDictionary<NSString *, id> *NSDictionaryFeatureForGeometry(NSDictionary *geometry, NSDictionary *attributes, id identifier);
|
||||
NSDictionary<NSString *, id> *NSDictionaryFeatureForGeometry(NSDictionary *geometry,
|
||||
NSDictionary *attributes,
|
||||
id identifier);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#define MLN_DEFINE_FEATURE_INIT_WITH_CODER() \
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder { \
|
||||
if (self = [super initWithCoder:decoder]) { \
|
||||
NSSet<Class> *identifierClasses = [NSSet setWithArray:@[[NSString class], [NSNumber class]]]; \
|
||||
identifier = [decoder decodeObjectOfClasses:identifierClasses forKey:@"identifier"]; \
|
||||
_attributes = [decoder decodeObjectOfClass:[NSDictionary class] forKey:@"attributes"]; \
|
||||
} \
|
||||
return self; \
|
||||
}
|
||||
#define MLN_DEFINE_FEATURE_INIT_WITH_CODER() \
|
||||
-(instancetype)initWithCoder : (NSCoder *)decoder { \
|
||||
if (self = [super initWithCoder:decoder]) { \
|
||||
NSSet<Class> *identifierClasses = \
|
||||
[NSSet setWithArray:@[ [NSString class], [NSNumber class] ]]; \
|
||||
identifier = [decoder decodeObjectOfClasses:identifierClasses forKey:@"identifier"]; \
|
||||
_attributes = [decoder decodeObjectOfClass:[NSDictionary class] forKey:@"attributes"]; \
|
||||
} \
|
||||
return self; \
|
||||
}
|
||||
|
||||
#define MLN_DEFINE_FEATURE_ENCODE() \
|
||||
- (void)encodeWithCoder:(NSCoder *)coder { \
|
||||
[super encodeWithCoder:coder]; \
|
||||
[coder encodeObject:identifier forKey:@"identifier"]; \
|
||||
[coder encodeObject:_attributes forKey:@"attributes"]; \
|
||||
}
|
||||
#define MLN_DEFINE_FEATURE_ENCODE() \
|
||||
-(void)encodeWithCoder : (NSCoder *)coder { \
|
||||
[super encodeWithCoder:coder]; \
|
||||
[coder encodeObject:identifier forKey:@"identifier"]; \
|
||||
[coder encodeObject:_attributes forKey:@"attributes"]; \
|
||||
}
|
||||
|
||||
#define MLN_DEFINE_FEATURE_IS_EQUAL() \
|
||||
- (BOOL)isEqual:(id)other { \
|
||||
if (other == self) return YES; \
|
||||
if (![other isKindOfClass:[self class]]) return NO; \
|
||||
__typeof(self) otherFeature = other; \
|
||||
return [super isEqual:other] && [self geoJSONObject] == [otherFeature geoJSONObject]; \
|
||||
} \
|
||||
- (NSUInteger)hash { \
|
||||
return [super hash] + [[self geoJSONDictionary] hash]; \
|
||||
}
|
||||
#define MLN_DEFINE_FEATURE_IS_EQUAL() \
|
||||
-(BOOL)isEqual : (id)other { \
|
||||
if (other == self) return YES; \
|
||||
if (![other isKindOfClass:[self class]]) return NO; \
|
||||
__typeof(self) otherFeature = other; \
|
||||
return [super isEqual:other] && [self geoJSONObject] == [otherFeature geoJSONObject]; \
|
||||
} \
|
||||
-(NSUInteger)hash { \
|
||||
return [super hash] + [[self geoJSONDictionary] hash]; \
|
||||
}
|
||||
|
||||
#define MLN_DEFINE_FEATURE_ATTRIBUTES_GETTER() \
|
||||
- (NSDictionary *) attributes { \
|
||||
if (!_attributes) { \
|
||||
return @{}; \
|
||||
} \
|
||||
return _attributes; \
|
||||
}
|
||||
-(NSDictionary *)attributes { \
|
||||
if (!_attributes) { \
|
||||
return @{}; \
|
||||
} \
|
||||
return _attributes; \
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ MLN_EXPORT
|
||||
|
||||
// MARK: Initializing a Style Layer
|
||||
|
||||
- (instancetype)init __attribute__((unavailable("Use -init methods of concrete subclasses instead.")));
|
||||
- (instancetype)init
|
||||
__attribute__((unavailable("Use -init methods of concrete subclasses instead.")));
|
||||
|
||||
// MARK: Specifying a Style Layer’s Content
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define MLN_EXPORT __attribute__((visibility ("default")))
|
||||
#define MLN_EXPORT __attribute__((visibility("default")))
|
||||
|
||||
@@ -5,15 +5,14 @@
|
||||
void MLNInitializeRunLoop();
|
||||
|
||||
/* Using a compound statement (GNU Extension, supported by clang) */
|
||||
#define MLN_OBJC_DYNAMIC_CAST(object, type) \
|
||||
({ \
|
||||
__typeof__( object ) temp##__LINE__ = (object); \
|
||||
(type *)([temp##__LINE__ isKindOfClass:[type class]] ? temp##__LINE__ : nil); \
|
||||
})
|
||||
|
||||
#define MLN_OBJC_DYNAMIC_CAST_AS_PROTOCOL(object, proto) \
|
||||
({ \
|
||||
__typeof__( object ) temp##__LINE__ = (object); \
|
||||
(id< proto >)([temp##__LINE__ conformsToProtocol:@protocol( proto )] ? temp##__LINE__ : nil); \
|
||||
})
|
||||
#define MLN_OBJC_DYNAMIC_CAST(object, type) \
|
||||
({ \
|
||||
__typeof__(object) temp##__LINE__ = (object); \
|
||||
(type *)([temp##__LINE__ isKindOfClass:[type class]] ? temp##__LINE__ : nil); \
|
||||
})
|
||||
|
||||
#define MLN_OBJC_DYNAMIC_CAST_AS_PROTOCOL(object, proto) \
|
||||
({ \
|
||||
__typeof__(object) temp##__LINE__ = (object); \
|
||||
(id<proto>)([temp##__LINE__ conformsToProtocol:@protocol(proto)] ? temp##__LINE__ : nil); \
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
@@ -8,59 +8,61 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** Defines the area spanned by an `MLNCoordinateBounds`. */
|
||||
typedef struct __attribute__((objc_boxable)) MLNCoordinateSpan {
|
||||
/** Latitudes spanned by an `MLNCoordinateBounds`. */
|
||||
CLLocationDegrees latitudeDelta;
|
||||
/** Longitudes spanned by an `MLNCoordinateBounds`. */
|
||||
CLLocationDegrees longitudeDelta;
|
||||
/** Latitudes spanned by an `MLNCoordinateBounds`. */
|
||||
CLLocationDegrees latitudeDelta;
|
||||
/** Longitudes spanned by an `MLNCoordinateBounds`. */
|
||||
CLLocationDegrees longitudeDelta;
|
||||
} MLNCoordinateSpan;
|
||||
|
||||
/* Defines a point on the map in Mercator projection for a specific zoom level. */
|
||||
typedef struct __attribute__((objc_boxable)) MLNMapPoint {
|
||||
/** X coordinate representing a longitude in Mercator projection. */
|
||||
CGFloat x;
|
||||
/** Y coordinate representing a latitide in Mercator projection. */
|
||||
CGFloat y;
|
||||
/** Zoom level at which the X and Y coordinates are valid. */
|
||||
CGFloat zoomLevel;
|
||||
/** X coordinate representing a longitude in Mercator projection. */
|
||||
CGFloat x;
|
||||
/** Y coordinate representing a latitide in Mercator projection. */
|
||||
CGFloat y;
|
||||
/** Zoom level at which the X and Y coordinates are valid. */
|
||||
CGFloat zoomLevel;
|
||||
} MLNMapPoint;
|
||||
|
||||
/* Defines a 4x4 matrix. */
|
||||
typedef struct MLNMatrix4 {
|
||||
double m00, m01, m02, m03;
|
||||
double m10, m11, m12, m13;
|
||||
double m20, m21, m22, m23;
|
||||
double m30, m31, m32, m33;
|
||||
double m00, m01, m02, m03;
|
||||
double m10, m11, m12, m13;
|
||||
double m20, m21, m22, m23;
|
||||
double m30, m31, m32, m33;
|
||||
} MLNMatrix4;
|
||||
|
||||
/**
|
||||
Creates a new `MLNCoordinateSpan` from the given latitudinal and longitudinal
|
||||
deltas.
|
||||
*/
|
||||
NS_INLINE MLNCoordinateSpan MLNCoordinateSpanMake(CLLocationDegrees latitudeDelta, CLLocationDegrees longitudeDelta) {
|
||||
MLNCoordinateSpan span;
|
||||
span.latitudeDelta = latitudeDelta;
|
||||
span.longitudeDelta = longitudeDelta;
|
||||
return span;
|
||||
NS_INLINE MLNCoordinateSpan MLNCoordinateSpanMake(CLLocationDegrees latitudeDelta,
|
||||
CLLocationDegrees longitudeDelta) {
|
||||
MLNCoordinateSpan span;
|
||||
span.latitudeDelta = latitudeDelta;
|
||||
span.longitudeDelta = longitudeDelta;
|
||||
return span;
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a new `MLNMapPoint` from the given X and Y coordinates, and zoom level.
|
||||
*/
|
||||
NS_INLINE MLNMapPoint MLNMapPointMake(CGFloat x, CGFloat y, CGFloat zoomLevel) {
|
||||
MLNMapPoint point;
|
||||
point.x = x;
|
||||
point.y = y;
|
||||
point.zoomLevel = zoomLevel;
|
||||
return point;
|
||||
MLNMapPoint point;
|
||||
point.x = x;
|
||||
point.y = y;
|
||||
point.zoomLevel = zoomLevel;
|
||||
return point;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns `YES` if the two coordinate spans represent the same latitudinal change
|
||||
and the same longitudinal change.
|
||||
*/
|
||||
NS_INLINE BOOL MLNCoordinateSpanEqualToCoordinateSpan(MLNCoordinateSpan span1, MLNCoordinateSpan span2) {
|
||||
return (span1.latitudeDelta == span2.latitudeDelta &&
|
||||
span1.longitudeDelta == span2.longitudeDelta);
|
||||
NS_INLINE BOOL MLNCoordinateSpanEqualToCoordinateSpan(MLNCoordinateSpan span1,
|
||||
MLNCoordinateSpan span2) {
|
||||
return (span1.latitudeDelta == span2.latitudeDelta &&
|
||||
span1.longitudeDelta == span2.longitudeDelta);
|
||||
}
|
||||
|
||||
/** An area of zero width and zero height. */
|
||||
@@ -68,10 +70,10 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNCoordinateSpan MLNCoordinateSpanZero;
|
||||
|
||||
/** A rectangular area as measured on a two-dimensional map projection. */
|
||||
typedef struct __attribute__((objc_boxable)) MLNCoordinateBounds {
|
||||
/** Coordinate at the southwest corner. */
|
||||
CLLocationCoordinate2D sw;
|
||||
/** Coordinate at the northeast corner. */
|
||||
CLLocationCoordinate2D ne;
|
||||
/** Coordinate at the southwest corner. */
|
||||
CLLocationCoordinate2D sw;
|
||||
/** Coordinate at the northeast corner. */
|
||||
CLLocationCoordinate2D ne;
|
||||
} MLNCoordinateBounds;
|
||||
|
||||
/**
|
||||
@@ -81,39 +83,42 @@ typedef struct __attribute__((objc_boxable)) MLNCoordinateBounds {
|
||||
The coordinates are described in counter clockwise order from top left.
|
||||
*/
|
||||
typedef struct MLNCoordinateQuad {
|
||||
/** Coordinate at the top left corner. */
|
||||
CLLocationCoordinate2D topLeft;
|
||||
/** Coordinate at the bottom left corner. */
|
||||
CLLocationCoordinate2D bottomLeft;
|
||||
/** Coordinate at the bottom right corner. */
|
||||
CLLocationCoordinate2D bottomRight;
|
||||
/** Coordinate at the top right corner. */
|
||||
CLLocationCoordinate2D topRight;
|
||||
/** Coordinate at the top left corner. */
|
||||
CLLocationCoordinate2D topLeft;
|
||||
/** Coordinate at the bottom left corner. */
|
||||
CLLocationCoordinate2D bottomLeft;
|
||||
/** Coordinate at the bottom right corner. */
|
||||
CLLocationCoordinate2D bottomRight;
|
||||
/** Coordinate at the top right corner. */
|
||||
CLLocationCoordinate2D topRight;
|
||||
} MLNCoordinateQuad;
|
||||
|
||||
|
||||
/**
|
||||
Creates a new `MLNCoordinateBounds` structure from the given southwest and
|
||||
northeast coordinates.
|
||||
*/
|
||||
NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsMake(CLLocationCoordinate2D sw, CLLocationCoordinate2D ne) {
|
||||
MLNCoordinateBounds bounds;
|
||||
bounds.sw = sw;
|
||||
bounds.ne = ne;
|
||||
return bounds;
|
||||
NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsMake(CLLocationCoordinate2D sw,
|
||||
CLLocationCoordinate2D ne) {
|
||||
MLNCoordinateBounds bounds;
|
||||
bounds.sw = sw;
|
||||
bounds.ne = ne;
|
||||
return bounds;
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a new `MLNCoordinateQuad` structure from the given top left,
|
||||
bottom left, bottom right, and top right coordinates.
|
||||
*/
|
||||
NS_INLINE MLNCoordinateQuad MLNCoordinateQuadMake(CLLocationCoordinate2D topLeft, CLLocationCoordinate2D bottomLeft, CLLocationCoordinate2D bottomRight, CLLocationCoordinate2D topRight) {
|
||||
MLNCoordinateQuad quad;
|
||||
quad.topLeft = topLeft;
|
||||
quad.bottomLeft = bottomLeft;
|
||||
quad.bottomRight = bottomRight;
|
||||
quad.topRight = topRight;
|
||||
return quad;
|
||||
NS_INLINE MLNCoordinateQuad MLNCoordinateQuadMake(CLLocationCoordinate2D topLeft,
|
||||
CLLocationCoordinate2D bottomLeft,
|
||||
CLLocationCoordinate2D bottomRight,
|
||||
CLLocationCoordinate2D topRight) {
|
||||
MLNCoordinateQuad quad;
|
||||
quad.topLeft = topLeft;
|
||||
quad.bottomLeft = bottomLeft;
|
||||
quad.bottomRight = bottomRight;
|
||||
quad.topRight = topRight;
|
||||
return quad;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,28 +127,28 @@ NS_INLINE MLNCoordinateQuad MLNCoordinateQuadMake(CLLocationCoordinate2D topLeft
|
||||
southwest coordinate at the bottom left.
|
||||
*/
|
||||
NS_INLINE MLNCoordinateQuad MLNCoordinateQuadFromCoordinateBounds(MLNCoordinateBounds bounds) {
|
||||
MLNCoordinateQuad quad;
|
||||
quad.topLeft = CLLocationCoordinate2DMake(bounds.ne.latitude, bounds.sw.longitude);
|
||||
quad.bottomLeft = bounds.sw;
|
||||
quad.bottomRight = CLLocationCoordinate2DMake(bounds.sw.latitude, bounds.ne.longitude);
|
||||
quad.topRight = bounds.ne;
|
||||
return quad;
|
||||
MLNCoordinateQuad quad;
|
||||
quad.topLeft = CLLocationCoordinate2DMake(bounds.ne.latitude, bounds.sw.longitude);
|
||||
quad.bottomLeft = bounds.sw;
|
||||
quad.bottomRight = CLLocationCoordinate2DMake(bounds.sw.latitude, bounds.ne.longitude);
|
||||
quad.topRight = bounds.ne;
|
||||
return quad;
|
||||
}
|
||||
|
||||
/** Returns `YES` if the two coordinate bounds are equal to each other. */
|
||||
NS_INLINE BOOL MLNCoordinateBoundsEqualToCoordinateBounds(MLNCoordinateBounds bounds1, MLNCoordinateBounds bounds2) {
|
||||
return (bounds1.sw.latitude == bounds2.sw.latitude &&
|
||||
bounds1.sw.longitude == bounds2.sw.longitude &&
|
||||
bounds1.ne.latitude == bounds2.ne.latitude &&
|
||||
bounds1.ne.longitude == bounds2.ne.longitude);
|
||||
NS_INLINE BOOL MLNCoordinateBoundsEqualToCoordinateBounds(MLNCoordinateBounds bounds1,
|
||||
MLNCoordinateBounds bounds2) {
|
||||
return (
|
||||
bounds1.sw.latitude == bounds2.sw.latitude && bounds1.sw.longitude == bounds2.sw.longitude &&
|
||||
bounds1.ne.latitude == bounds2.ne.latitude && bounds1.ne.longitude == bounds2.ne.longitude);
|
||||
}
|
||||
|
||||
/** Returns `YES` if the two coordinate bounds intersect. */
|
||||
NS_INLINE BOOL MLNCoordinateBoundsIntersectsCoordinateBounds(MLNCoordinateBounds bounds1, MLNCoordinateBounds bounds2) {
|
||||
return (bounds1.ne.latitude > bounds2.sw.latitude &&
|
||||
bounds1.sw.latitude < bounds2.ne.latitude &&
|
||||
bounds1.ne.longitude > bounds2.sw.longitude &&
|
||||
bounds1.sw.longitude < bounds2.ne.longitude);
|
||||
NS_INLINE BOOL MLNCoordinateBoundsIntersectsCoordinateBounds(MLNCoordinateBounds bounds1,
|
||||
MLNCoordinateBounds bounds2) {
|
||||
return (bounds1.ne.latitude > bounds2.sw.latitude && bounds1.sw.latitude < bounds2.ne.latitude &&
|
||||
bounds1.ne.longitude > bounds2.sw.longitude &&
|
||||
bounds1.sw.longitude < bounds2.ne.longitude);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,30 +159,31 @@ NS_INLINE BOOL MLNCoordinateBoundsIntersectsCoordinateBounds(MLNCoordinateBounds
|
||||
`MLNCoordinateInCoordinateBounds` to determine if a point is within, or
|
||||
intersects, a given bounding box.
|
||||
*/
|
||||
NS_INLINE BOOL MLNCoordinateInCoordinateBounds(CLLocationCoordinate2D coordinate, MLNCoordinateBounds bounds) {
|
||||
return (coordinate.latitude >= bounds.sw.latitude &&
|
||||
coordinate.latitude <= bounds.ne.latitude &&
|
||||
coordinate.longitude >= bounds.sw.longitude &&
|
||||
coordinate.longitude <= bounds.ne.longitude);
|
||||
NS_INLINE BOOL MLNCoordinateInCoordinateBounds(CLLocationCoordinate2D coordinate,
|
||||
MLNCoordinateBounds bounds) {
|
||||
return (coordinate.latitude >= bounds.sw.latitude && coordinate.latitude <= bounds.ne.latitude &&
|
||||
coordinate.longitude >= bounds.sw.longitude &&
|
||||
coordinate.longitude <= bounds.ne.longitude);
|
||||
}
|
||||
|
||||
/** Returns the area spanned by the coordinate bounds. */
|
||||
NS_INLINE MLNCoordinateSpan MLNCoordinateBoundsGetCoordinateSpan(MLNCoordinateBounds bounds) {
|
||||
return MLNCoordinateSpanMake(bounds.ne.latitude - bounds.sw.latitude,
|
||||
bounds.ne.longitude - bounds.sw.longitude);
|
||||
return MLNCoordinateSpanMake(bounds.ne.latitude - bounds.sw.latitude,
|
||||
bounds.ne.longitude - bounds.sw.longitude);
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a coordinate bounds with southwest and northeast coordinates that are
|
||||
offset from those of the source bounds.
|
||||
*/
|
||||
NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsOffset(MLNCoordinateBounds bounds, MLNCoordinateSpan offset) {
|
||||
MLNCoordinateBounds offsetBounds = bounds;
|
||||
offsetBounds.sw.latitude += offset.latitudeDelta;
|
||||
offsetBounds.sw.longitude += offset.longitudeDelta;
|
||||
offsetBounds.ne.latitude += offset.latitudeDelta;
|
||||
offsetBounds.ne.longitude += offset.longitudeDelta;
|
||||
return offsetBounds;
|
||||
NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsOffset(MLNCoordinateBounds bounds,
|
||||
MLNCoordinateSpan offset) {
|
||||
MLNCoordinateBounds offsetBounds = bounds;
|
||||
offsetBounds.sw.latitude += offset.latitudeDelta;
|
||||
offsetBounds.sw.longitude += offset.longitudeDelta;
|
||||
offsetBounds.ne.latitude += offset.latitudeDelta;
|
||||
offsetBounds.ne.longitude += offset.longitudeDelta;
|
||||
return offsetBounds;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,39 +193,37 @@ NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsOffset(MLNCoordinateBounds boun
|
||||
northeast point lies due north of its southwest point).
|
||||
*/
|
||||
NS_INLINE BOOL MLNCoordinateBoundsIsEmpty(MLNCoordinateBounds bounds) {
|
||||
MLNCoordinateSpan span = MLNCoordinateBoundsGetCoordinateSpan(bounds);
|
||||
return span.latitudeDelta == 0 || span.longitudeDelta == 0;
|
||||
MLNCoordinateSpan span = MLNCoordinateBoundsGetCoordinateSpan(bounds);
|
||||
return span.latitudeDelta == 0 || span.longitudeDelta == 0;
|
||||
}
|
||||
|
||||
/** Returns a formatted string for the given coordinate bounds. */
|
||||
NS_INLINE NSString *MLNStringFromCoordinateBounds(MLNCoordinateBounds bounds) {
|
||||
return [NSString stringWithFormat:@"{ sw = {%.1f, %.1f}, ne = {%.1f, %.1f}}",
|
||||
bounds.sw.latitude, bounds.sw.longitude,
|
||||
bounds.ne.latitude, bounds.ne.longitude];
|
||||
return [NSString stringWithFormat:@"{ sw = {%.1f, %.1f}, ne = {%.1f, %.1f}}", bounds.sw.latitude,
|
||||
bounds.sw.longitude, bounds.ne.latitude, bounds.ne.longitude];
|
||||
}
|
||||
|
||||
/** Returns a formatted string for the given coordinate quad. */
|
||||
NS_INLINE NSString *MLNStringFromCoordinateQuad(MLNCoordinateQuad quad) {
|
||||
return [NSString stringWithFormat:@"{ topleft = {%.1f, %.1f}, bottomleft = {%.1f, %.1f}}, bottomright = {%.1f, %.1f}, topright = {%.1f, %.1f}",
|
||||
quad.topLeft.latitude, quad.topLeft.longitude,
|
||||
quad.bottomLeft.latitude, quad.bottomLeft.longitude,
|
||||
quad.bottomRight.latitude, quad.bottomRight.longitude,
|
||||
quad.topRight.latitude, quad.topRight.longitude];
|
||||
return [NSString stringWithFormat:@"{ topleft = {%.1f, %.1f}, bottomleft = {%.1f, %.1f}}, "
|
||||
@"bottomright = {%.1f, %.1f}, topright = {%.1f, %.1f}",
|
||||
quad.topLeft.latitude, quad.topLeft.longitude,
|
||||
quad.bottomLeft.latitude, quad.bottomLeft.longitude,
|
||||
quad.bottomRight.latitude, quad.bottomRight.longitude,
|
||||
quad.topRight.latitude, quad.topRight.longitude];
|
||||
}
|
||||
|
||||
/** Returns radians, converted from degrees. */
|
||||
NS_INLINE CGFloat MLNRadiansFromDegrees(CLLocationDegrees degrees) {
|
||||
return (CGFloat)(degrees * M_PI) / 180;
|
||||
return (CGFloat)(degrees * M_PI) / 180;
|
||||
}
|
||||
|
||||
/** Returns degrees, converted from radians. */
|
||||
NS_INLINE CLLocationDegrees MLNDegreesFromRadians(CGFloat radians) {
|
||||
return radians * 180 / M_PI;
|
||||
}
|
||||
NS_INLINE CLLocationDegrees MLNDegreesFromRadians(CGFloat radians) { return radians * 180 / M_PI; }
|
||||
|
||||
/** Returns Mercator projection of a WGS84 coordinate at the specified zoom level. */
|
||||
FOUNDATION_EXTERN MLN_EXPORT MLNMapPoint MLNMapPointForCoordinate(CLLocationCoordinate2D coordinate, double zoomLevel);
|
||||
|
||||
FOUNDATION_EXTERN MLN_EXPORT MLNMapPoint MLNMapPointForCoordinate(CLLocationCoordinate2D coordinate,
|
||||
double zoomLevel);
|
||||
|
||||
/** Converts a map zoom level to a camera altitude.
|
||||
|
||||
@@ -228,7 +232,10 @@ FOUNDATION_EXTERN MLN_EXPORT MLNMapPoint MLNMapPointForCoordinate(CLLocationCoor
|
||||
@param latitude The latitude of the point at the center of the viewport.
|
||||
@param size The size of the viewport.
|
||||
@return An altitude measured in meters. */
|
||||
FOUNDATION_EXTERN MLN_EXPORT CLLocationDistance MLNAltitudeForZoomLevel(double zoomLevel, CGFloat pitch, CLLocationDegrees latitude, CGSize size);
|
||||
FOUNDATION_EXTERN MLN_EXPORT CLLocationDistance MLNAltitudeForZoomLevel(double zoomLevel,
|
||||
CGFloat pitch,
|
||||
CLLocationDegrees latitude,
|
||||
CGSize size);
|
||||
|
||||
/** Converts a camera altitude to a map zoom level.
|
||||
|
||||
@@ -237,6 +244,9 @@ FOUNDATION_EXTERN MLN_EXPORT CLLocationDistance MLNAltitudeForZoomLevel(double z
|
||||
@param latitude The latitude of the point at the center of the viewport.
|
||||
@param size The size of the viewport.
|
||||
@return A zero-based zoom level. */
|
||||
FOUNDATION_EXTERN MLN_EXPORT double MLNZoomLevelForAltitude(CLLocationDistance altitude, CGFloat pitch, CLLocationDegrees latitude, CGSize size);
|
||||
FOUNDATION_EXTERN MLN_EXPORT double MLNZoomLevelForAltitude(CLLocationDistance altitude,
|
||||
CGFloat pitch,
|
||||
CLLocationDegrees latitude,
|
||||
CGSize size);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
|
||||
#import <mbgl/util/geo.hpp>
|
||||
@@ -15,18 +15,19 @@ typedef double MLNRadianDirection;
|
||||
|
||||
/** Defines the coordinate by a `MLNRadianCoordinate2D`. */
|
||||
typedef struct MLNRadianCoordinate2D {
|
||||
MLNLocationRadians latitude;
|
||||
MLNLocationRadians longitude;
|
||||
MLNLocationRadians latitude;
|
||||
MLNLocationRadians longitude;
|
||||
} MLNRadianCoordinate2D;
|
||||
|
||||
/**
|
||||
Creates a new `MLNRadianCoordinate2D` from the given latitudinal and longitudinal.
|
||||
*/
|
||||
NS_INLINE MLNRadianCoordinate2D MLNRadianCoordinate2DMake(MLNLocationRadians latitude, MLNLocationRadians longitude) {
|
||||
MLNRadianCoordinate2D radianCoordinate;
|
||||
radianCoordinate.latitude = latitude;
|
||||
radianCoordinate.longitude = longitude;
|
||||
return radianCoordinate;
|
||||
NS_INLINE MLNRadianCoordinate2D MLNRadianCoordinate2DMake(MLNLocationRadians latitude,
|
||||
MLNLocationRadians longitude) {
|
||||
MLNRadianCoordinate2D radianCoordinate;
|
||||
radianCoordinate.latitude = latitude;
|
||||
radianCoordinate.longitude = longitude;
|
||||
return radianCoordinate;
|
||||
}
|
||||
|
||||
/// Returns the smallest rectangle that contains both the given rectangle and
|
||||
@@ -34,55 +35,51 @@ NS_INLINE MLNRadianCoordinate2D MLNRadianCoordinate2DMake(MLNLocationRadians lat
|
||||
CGRect MLNExtendRect(CGRect rect, CGPoint point);
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
NS_INLINE NSString *MLNStringFromSize(CGSize size) {
|
||||
return NSStringFromCGSize(size);
|
||||
}
|
||||
NS_INLINE NSString *MLNStringFromSize(CGSize size) { return NSStringFromCGSize(size); }
|
||||
#else
|
||||
NS_INLINE NSString *MLNStringFromSize(NSSize size) {
|
||||
return NSStringFromSize(size);
|
||||
}
|
||||
NS_INLINE NSString *MLNStringFromSize(NSSize size) { return NSStringFromSize(size); }
|
||||
#endif
|
||||
|
||||
NS_INLINE NSString *MLNStringFromCLLocationCoordinate2D(CLLocationCoordinate2D coordinate) {
|
||||
return [NSString stringWithFormat:@"(lat: %f, lon: %f)", coordinate.latitude, coordinate.longitude];
|
||||
return
|
||||
[NSString stringWithFormat:@"(lat: %f, lon: %f)", coordinate.latitude, coordinate.longitude];
|
||||
}
|
||||
|
||||
mbgl::LatLng MLNLatLngFromLocationCoordinate2D(CLLocationCoordinate2D coordinate);
|
||||
|
||||
NS_INLINE mbgl::Point<double> MLNPointFromLocationCoordinate2D(CLLocationCoordinate2D coordinate) {
|
||||
return mbgl::Point<double>(coordinate.longitude, coordinate.latitude);
|
||||
return mbgl::Point<double>(coordinate.longitude, coordinate.latitude);
|
||||
}
|
||||
|
||||
NS_INLINE CLLocationCoordinate2D MLNLocationCoordinate2DFromPoint(mbgl::Point<double> point) {
|
||||
return CLLocationCoordinate2DMake(point.y, point.x);
|
||||
return CLLocationCoordinate2DMake(point.y, point.x);
|
||||
}
|
||||
|
||||
NS_INLINE CLLocationCoordinate2D MLNLocationCoordinate2DFromLatLng(mbgl::LatLng latLng) {
|
||||
return CLLocationCoordinate2DMake(latLng.latitude(), latLng.longitude());
|
||||
return CLLocationCoordinate2DMake(latLng.latitude(), latLng.longitude());
|
||||
}
|
||||
|
||||
NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsFromLatLngBounds(mbgl::LatLngBounds latLngBounds) {
|
||||
return MLNCoordinateBoundsMake(MLNLocationCoordinate2DFromLatLng(latLngBounds.southwest()),
|
||||
MLNLocationCoordinate2DFromLatLng(latLngBounds.northeast()));
|
||||
return MLNCoordinateBoundsMake(MLNLocationCoordinate2DFromLatLng(latLngBounds.southwest()),
|
||||
MLNLocationCoordinate2DFromLatLng(latLngBounds.northeast()));
|
||||
}
|
||||
|
||||
NS_INLINE mbgl::LatLngBounds MLNLatLngBoundsFromCoordinateBounds(MLNCoordinateBounds coordinateBounds) {
|
||||
return mbgl::LatLngBounds::hull(MLNLatLngFromLocationCoordinate2D(coordinateBounds.sw),
|
||||
MLNLatLngFromLocationCoordinate2D(coordinateBounds.ne));
|
||||
NS_INLINE mbgl::LatLngBounds MLNLatLngBoundsFromCoordinateBounds(
|
||||
MLNCoordinateBounds coordinateBounds) {
|
||||
return mbgl::LatLngBounds::hull(MLNLatLngFromLocationCoordinate2D(coordinateBounds.sw),
|
||||
MLNLatLngFromLocationCoordinate2D(coordinateBounds.ne));
|
||||
}
|
||||
|
||||
NS_INLINE std::array<mbgl::LatLng, 4> MLNLatLngArrayFromCoordinateQuad(MLNCoordinateQuad quad) {
|
||||
return { MLNLatLngFromLocationCoordinate2D(quad.topLeft),
|
||||
MLNLatLngFromLocationCoordinate2D(quad.topRight),
|
||||
MLNLatLngFromLocationCoordinate2D(quad.bottomRight),
|
||||
MLNLatLngFromLocationCoordinate2D(quad.bottomLeft) };
|
||||
return {MLNLatLngFromLocationCoordinate2D(quad.topLeft),
|
||||
MLNLatLngFromLocationCoordinate2D(quad.topRight),
|
||||
MLNLatLngFromLocationCoordinate2D(quad.bottomRight),
|
||||
MLNLatLngFromLocationCoordinate2D(quad.bottomLeft)};
|
||||
}
|
||||
|
||||
NS_INLINE MLNCoordinateQuad MLNCoordinateQuadFromLatLngArray(std::array<mbgl::LatLng, 4> quad) {
|
||||
return { MLNLocationCoordinate2DFromLatLng(quad[0]),
|
||||
MLNLocationCoordinate2DFromLatLng(quad[3]),
|
||||
MLNLocationCoordinate2DFromLatLng(quad[2]),
|
||||
MLNLocationCoordinate2DFromLatLng(quad[1]) };
|
||||
return {MLNLocationCoordinate2DFromLatLng(quad[0]), MLNLocationCoordinate2DFromLatLng(quad[3]),
|
||||
MLNLocationCoordinate2DFromLatLng(quad[2]), MLNLocationCoordinate2DFromLatLng(quad[1])};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,51 +87,50 @@ NS_INLINE MLNCoordinateQuad MLNCoordinateQuadFromLatLngArray(std::array<mbgl::La
|
||||
Considers extended coordinates.
|
||||
*/
|
||||
NS_INLINE BOOL MLNLocationCoordinate2DIsValid(CLLocationCoordinate2D coordinate) {
|
||||
return (coordinate.latitude <= 90.0 &&
|
||||
coordinate.latitude >= -90.0 &&
|
||||
coordinate.longitude <= 360.0 &&
|
||||
coordinate.longitude >= -360.0);
|
||||
return (coordinate.latitude <= 90.0 && coordinate.latitude >= -90.0 &&
|
||||
coordinate.longitude <= 360.0 && coordinate.longitude >= -360.0);
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#define MLNEdgeInsets UIEdgeInsets
|
||||
#define MLNEdgeInsetsMake UIEdgeInsetsMake
|
||||
#define MLNEdgeInsets UIEdgeInsets
|
||||
#define MLNEdgeInsetsMake UIEdgeInsetsMake
|
||||
#else
|
||||
#define MLNEdgeInsets NSEdgeInsets
|
||||
#define MLNEdgeInsetsMake NSEdgeInsetsMake
|
||||
#define MLNEdgeInsets NSEdgeInsets
|
||||
#define MLNEdgeInsetsMake NSEdgeInsetsMake
|
||||
#endif
|
||||
|
||||
NS_INLINE mbgl::EdgeInsets MLNEdgeInsetsFromNSEdgeInsets(MLNEdgeInsets insets) {
|
||||
return { insets.top, insets.left, insets.bottom, insets.right };
|
||||
return {insets.top, insets.left, insets.bottom, insets.right};
|
||||
}
|
||||
|
||||
NS_INLINE MLNEdgeInsets NSEdgeInsetsFromMLNEdgeInsets(const mbgl::EdgeInsets& insets) {
|
||||
return MLNEdgeInsetsMake(insets.top(), insets.left(), insets.bottom(), insets.right());
|
||||
NS_INLINE MLNEdgeInsets NSEdgeInsetsFromMLNEdgeInsets(const mbgl::EdgeInsets &insets) {
|
||||
return MLNEdgeInsetsMake(insets.top(), insets.left(), insets.bottom(), insets.right());
|
||||
}
|
||||
|
||||
/// Returns the combination of two edge insets.
|
||||
NS_INLINE MLNEdgeInsets MLNEdgeInsetsInsetEdgeInset(MLNEdgeInsets base, MLNEdgeInsets inset) {
|
||||
return MLNEdgeInsetsMake(base.top + inset.top,
|
||||
base.left + inset.left,
|
||||
base.bottom + inset.bottom,
|
||||
base.right + inset.right);
|
||||
return MLNEdgeInsetsMake(base.top + inset.top, base.left + inset.left, base.bottom + inset.bottom,
|
||||
base.right + inset.right);
|
||||
}
|
||||
|
||||
/** Returns MLNRadianCoordinate2D, converted from CLLocationCoordinate2D. */
|
||||
NS_INLINE MLNRadianCoordinate2D MLNRadianCoordinateFromLocationCoordinate(CLLocationCoordinate2D locationCoordinate) {
|
||||
return MLNRadianCoordinate2DMake(MLNRadiansFromDegrees(locationCoordinate.latitude),
|
||||
MLNRadiansFromDegrees(locationCoordinate.longitude));
|
||||
NS_INLINE MLNRadianCoordinate2D
|
||||
MLNRadianCoordinateFromLocationCoordinate(CLLocationCoordinate2D locationCoordinate) {
|
||||
return MLNRadianCoordinate2DMake(MLNRadiansFromDegrees(locationCoordinate.latitude),
|
||||
MLNRadiansFromDegrees(locationCoordinate.longitude));
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the distance in radians given two coordinates.
|
||||
*/
|
||||
MLNRadianDistance MLNDistanceBetweenRadianCoordinates(MLNRadianCoordinate2D from, MLNRadianCoordinate2D to);
|
||||
MLNRadianDistance MLNDistanceBetweenRadianCoordinates(MLNRadianCoordinate2D from,
|
||||
MLNRadianCoordinate2D to);
|
||||
|
||||
/**
|
||||
Returns direction in radians given two coordinates.
|
||||
*/
|
||||
MLNRadianDirection MLNRadianCoordinatesDirection(MLNRadianCoordinate2D from, MLNRadianCoordinate2D to);
|
||||
MLNRadianDirection MLNRadianCoordinatesDirection(MLNRadianCoordinate2D from,
|
||||
MLNRadianCoordinate2D to);
|
||||
|
||||
/**
|
||||
Returns a coordinate at a given distance and direction away from coordinate.
|
||||
@@ -146,7 +142,8 @@ MLNRadianCoordinate2D MLNRadianCoordinateAtDistanceFacingDirection(MLNRadianCoor
|
||||
/**
|
||||
Returns the direction from one coordinate to another.
|
||||
*/
|
||||
CLLocationDirection MLNDirectionBetweenCoordinates(CLLocationCoordinate2D firstCoordinate, CLLocationCoordinate2D secondCoordinate);
|
||||
CLLocationDirection MLNDirectionBetweenCoordinates(CLLocationCoordinate2D firstCoordinate,
|
||||
CLLocationCoordinate2D secondCoordinate);
|
||||
|
||||
/**
|
||||
Returns a point with coordinates rounded to the nearest logical pixel.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#import "MLNSource.h"
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNTypes.h"
|
||||
#import "MLNGeometry.h"
|
||||
#import "MLNTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -38,8 +38,8 @@ MLN_EXPORT
|
||||
bottomLeft: CLLocationCoordinate2D(latitude: 37.936, longitude: -80.425),
|
||||
bottomRight: CLLocationCoordinate2D(latitude: 37.936, longitude: -71.516),
|
||||
topRight: CLLocationCoordinate2D(latitude: 46.437, longitude: -71.516))
|
||||
let source = MLNImageSource(identifier: "radar", coordinateQuad: coordinates, url: URL(string: "https://maplibre.org/maplibre-gl-js-docs/assets/radar.gif")!)
|
||||
mapView.style?.addSource(source)
|
||||
let source = MLNImageSource(identifier: "radar", coordinateQuad: coordinates, url: URL(string:
|
||||
"https://maplibre.org/maplibre-gl-js-docs/assets/radar.gif")!) mapView.style?.addSource(source)
|
||||
```
|
||||
|
||||
#### Related examples
|
||||
@@ -54,22 +54,28 @@ MLN_EXPORT
|
||||
Returns a georeferenced image source with an identifier, coordinates and a URL.
|
||||
|
||||
@param identifier A string that uniquely identifies the source.
|
||||
@param coordinateQuad the top left, top right, bottom right, and bottom left coordinates for the image.
|
||||
@param coordinateQuad the top left, top right, bottom right, and bottom left coordinates for the
|
||||
image.
|
||||
@param url An HTTP(S) URL, absolute file URL, or local file URL relative to the
|
||||
current application’s resource bundle.
|
||||
@return An initialized shape source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier coordinateQuad:(MLNCoordinateQuad)coordinateQuad URL:(NSURL *)url;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
coordinateQuad:(MLNCoordinateQuad)coordinateQuad
|
||||
URL:(NSURL *)url;
|
||||
|
||||
/**
|
||||
Returns a georeferenced image source with an identifier, coordinates and an image.
|
||||
|
||||
@param identifier A string that uniquely identifies the source.
|
||||
@param coordinateQuad The top left, top right, bottom right, and bottom left coordinates for the image.
|
||||
@param coordinateQuad The top left, top right, bottom right, and bottom left coordinates for the
|
||||
image.
|
||||
@param image The image to display for the source.
|
||||
@return An initialized shape source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier coordinateQuad:(MLNCoordinateQuad)coordinateQuad image:(MLNImage *)image;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
coordinateQuad:(MLNCoordinateQuad)coordinateQuad
|
||||
image:(MLNImage *)image;
|
||||
|
||||
// MARK: Accessing a Source’s Content
|
||||
|
||||
@@ -79,7 +85,7 @@ MLN_EXPORT
|
||||
If the receiver was initialized using `-initWithIdentifier:coordinateQuad:image:` or
|
||||
the `image` property is set, this property is set to `nil`.
|
||||
*/
|
||||
@property (nonatomic, copy, nullable)NSURL *URL;
|
||||
@property (nonatomic, copy, nullable) NSURL *URL;
|
||||
|
||||
/**
|
||||
Sets the URL for the image source, performing necessary validations.
|
||||
@@ -91,9 +97,10 @@ MLN_EXPORT
|
||||
/**
|
||||
The source image.
|
||||
|
||||
If the receiver was initialized using `-initWithIdentifier:coordinateQuad:URL:` or if the `URL` property is set, this property is set to `nil`.
|
||||
If the receiver was initialized using `-initWithIdentifier:coordinateQuad:URL:` or if the `URL`
|
||||
property is set, this property is set to `nil`.
|
||||
*/
|
||||
@property (nonatomic, retain, nullable)MLNImage *image;
|
||||
@property (nonatomic, retain, nullable) MLNImage *image;
|
||||
|
||||
/**
|
||||
The coordinates at which the corners of the source image will be placed.
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
#import "MLNLight.h"
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
class Light;
|
||||
}
|
||||
namespace style {
|
||||
class Light;
|
||||
}
|
||||
} // namespace mbgl
|
||||
|
||||
@interface MLNLight (Private)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
Sets the minimum update distance in meters.
|
||||
@param distanceFilter The distance filter in meters.
|
||||
*/
|
||||
- (void)setDistanceFilter:(CLLocationDistance) distanceFilter;
|
||||
- (void)setDistanceFilter:(CLLocationDistance)distanceFilter;
|
||||
|
||||
/**
|
||||
Specifies the accuracy of the location data.
|
||||
@@ -63,9 +63,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
Specifies the level of location accuracy the Maps SDK has permission to use.
|
||||
|
||||
@note If the value of this property is `CLAccuracyAuthorizationFullAccuracy`, you can set the
|
||||
`MLNLocationManager.desiredAccuracy` property to any value. If the value is `CLAccuracyAuthorizationReducedAccuracy`,
|
||||
setting `MLNLocationManager.desiredAccuracy` to a value other than` kCLLocationAccuracyReduced` has no effect on
|
||||
the location information.
|
||||
`MLNLocationManager.desiredAccuracy` property to any value. If the value is
|
||||
`CLAccuracyAuthorizationReducedAccuracy`, setting `MLNLocationManager.desiredAccuracy` to a value
|
||||
other than` kCLLocationAccuracyReduced` has no effect on the location information.
|
||||
*/
|
||||
- (CLAccuracyAuthorization)accuracyAuthorization API_AVAILABLE(ios(14));
|
||||
#endif
|
||||
@@ -98,7 +98,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@note If the user turned off location accuracy you may use this method to
|
||||
request full accuracy for a session.
|
||||
*/
|
||||
- (void)requestTemporaryFullAccuracyAuthorizationWithPurposeKey:(NSString *)purposeKey API_AVAILABLE(ios(14));
|
||||
- (void)requestTemporaryFullAccuracyAuthorizationWithPurposeKey:(NSString *)purposeKey
|
||||
API_AVAILABLE(ios(14));
|
||||
#endif
|
||||
|
||||
@required
|
||||
@@ -198,8 +199,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@param manager The location manager reporting the update.
|
||||
@param newHeading The new heading update.
|
||||
*/
|
||||
- (void)locationManager:(id<MLNLocationManager>)manager
|
||||
didUpdateHeading:(CLHeading *)newHeading;
|
||||
- (void)locationManager:(id<MLNLocationManager>)manager didUpdateHeading:(CLHeading *)newHeading;
|
||||
|
||||
/**
|
||||
Asks the delegate if the calibration alert should be displayed.
|
||||
@@ -218,8 +218,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@param error An error object containing the error code that indicates
|
||||
why the location manager failed.
|
||||
*/
|
||||
- (void)locationManager:(id<MLNLocationManager>)manager
|
||||
didFailWithError:(nonnull NSError *)error;
|
||||
- (void)locationManager:(id<MLNLocationManager>)manager didFailWithError:(nonnull NSError *)error;
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
|
||||
/**
|
||||
Notifies the delegate that the location authorization status has changed.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import "MLNLocationManager.h"
|
||||
|
||||
@interface MLNCLLocationManager : NSObject<MLNLocationManager>
|
||||
@interface MLNCLLocationManager : NSObject <MLNLocationManager>
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
#ifndef MLN_LOGGING_DISABLED
|
||||
#ifndef MLN_LOGGING_ENABLE_DEBUG
|
||||
#ifndef NDEBUG
|
||||
#define MLN_LOGGING_ENABLE_DEBUG 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef MLN_LOGGING_ENABLE_DEBUG
|
||||
#ifndef NDEBUG
|
||||
#define MLN_LOGGING_ENABLE_DEBUG 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -15,39 +15,39 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
Constants indicating the message's logging level.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, MLNLoggingLevel) {
|
||||
/**
|
||||
None-level won't print any messages.
|
||||
*/
|
||||
MLNLoggingLevelNone = 0,
|
||||
/**
|
||||
Fault-level messages contain system-level error information.
|
||||
*/
|
||||
MLNLoggingLevelFault,
|
||||
/**
|
||||
Error-level messages contain information that is intended to aid in process-level
|
||||
errors.
|
||||
*/
|
||||
MLNLoggingLevelError,
|
||||
/**
|
||||
Warning-level messages contain warning information for potential risks.
|
||||
*/
|
||||
MLNLoggingLevelWarning,
|
||||
/**
|
||||
Info-level messages contain information that may be helpful for flow tracing
|
||||
but is not essential.
|
||||
*/
|
||||
MLNLoggingLevelInfo,
|
||||
/**
|
||||
Debug-level messages contain information that may be helpful for troubleshooting
|
||||
specific problems.
|
||||
*/
|
||||
/**
|
||||
None-level won't print any messages.
|
||||
*/
|
||||
MLNLoggingLevelNone = 0,
|
||||
/**
|
||||
Fault-level messages contain system-level error information.
|
||||
*/
|
||||
MLNLoggingLevelFault,
|
||||
/**
|
||||
Error-level messages contain information that is intended to aid in process-level
|
||||
errors.
|
||||
*/
|
||||
MLNLoggingLevelError,
|
||||
/**
|
||||
Warning-level messages contain warning information for potential risks.
|
||||
*/
|
||||
MLNLoggingLevelWarning,
|
||||
/**
|
||||
Info-level messages contain information that may be helpful for flow tracing
|
||||
but is not essential.
|
||||
*/
|
||||
MLNLoggingLevelInfo,
|
||||
/**
|
||||
Debug-level messages contain information that may be helpful for troubleshooting
|
||||
specific problems.
|
||||
*/
|
||||
#if MLN_LOGGING_ENABLE_DEBUG
|
||||
MLNLoggingLevelDebug,
|
||||
MLNLoggingLevelDebug,
|
||||
#endif
|
||||
/**
|
||||
Verbose-level will print all messages.
|
||||
*/
|
||||
MLNLoggingLevelVerbose,
|
||||
/**
|
||||
Verbose-level will print all messages.
|
||||
*/
|
||||
MLNLoggingLevelVerbose,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,8 @@ typedef NS_ENUM(NSInteger, MLNLoggingLevel) {
|
||||
@param line The line where the message is logged.
|
||||
@param message The logging message.
|
||||
*/
|
||||
typedef void (^MLNLoggingBlockHandler)(MLNLoggingLevel loggingLevel, NSString *filePath, NSUInteger line, NSString *message);
|
||||
typedef void (^MLNLoggingBlockHandler)(MLNLoggingLevel loggingLevel, NSString *filePath,
|
||||
NSUInteger line, NSString *message);
|
||||
|
||||
/**
|
||||
The `MLNLoggingConfiguration` object provides a global way to set this SDK logging levels
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#import "MLNLoggingConfiguration.h"
|
||||
|
||||
NS_INLINE NSString *MLNStringFromBOOL(BOOL value) {
|
||||
return value ? @"YES" : @"NO";
|
||||
}
|
||||
NS_INLINE NSString *MLNStringFromBOOL(BOOL value) { return value ? @"YES" : @"NO"; }
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
NS_INLINE NSString *MLNStringFromNSEdgeInsets(NSEdgeInsets insets) {
|
||||
return [NSString stringWithFormat:@"{ top: %f, left: %f, bottom: %f, right: %f", insets.top, insets.left, insets.bottom, insets.right];
|
||||
return [NSString stringWithFormat:@"{ top: %f, left: %f, bottom: %f, right: %f", insets.top,
|
||||
insets.left, insets.bottom, insets.right];
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -21,47 +20,57 @@ NS_INLINE NSString *MLNStringFromNSEdgeInsets(NSEdgeInsets insets) {
|
||||
#else
|
||||
|
||||
#if MLN_LOGGING_ENABLE_DEBUG
|
||||
#define MLNLogDebug(message, ...) MLNLogWithType(MLNLoggingLevelDebug, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||
#define MLNLogDebug(message, ...) \
|
||||
MLNLogWithType(MLNLoggingLevelDebug, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||
#else
|
||||
#define MLNLogDebug(...)
|
||||
#define MLNLogDebug(...)
|
||||
#endif
|
||||
|
||||
#define MLNLogInfo(message, ...) MLNLogWithType(MLNLoggingLevelInfo, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||
#define MLNLogWarning(message, ...) MLNLogWithType(MLNLoggingLevelWarning, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||
#define MLNLogError(message, ...) MLNLogWithType(MLNLoggingLevelError, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||
#define MLNLogFault(message, ...) MLNLogWithType(MLNLoggingLevelFault, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||
#define MLNLogInfo(message, ...) \
|
||||
MLNLogWithType(MLNLoggingLevelInfo, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||
#define MLNLogWarning(message, ...) \
|
||||
MLNLogWithType(MLNLoggingLevelWarning, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||
#define MLNLogError(message, ...) \
|
||||
MLNLogWithType(MLNLoggingLevelError, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||
#define MLNLogFault(message, ...) \
|
||||
MLNLogWithType(MLNLoggingLevelFault, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
||||
#define MLNAssert(expression, message, ...) \
|
||||
__extension__({ \
|
||||
if (__builtin_expect(!(expression), 0)) { \
|
||||
MLNLogFault(message, ##__VA_ARGS__); \
|
||||
} \
|
||||
NSAssert(expression, message, ##__VA_ARGS__); \
|
||||
})
|
||||
#define MLNCAssert(expression, message, ...) \
|
||||
__extension__({ \
|
||||
if (__builtin_expect(!(expression), 0)) { \
|
||||
MLNLogFault(message, ##__VA_ARGS__); \
|
||||
} \
|
||||
NSCAssert(expression, message, ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
#define MLNAssert(expression, message, ...) \
|
||||
__extension__({ \
|
||||
if (__builtin_expect(!(expression), 0)) { \
|
||||
MLNLogFault(message, ##__VA_ARGS__); \
|
||||
} \
|
||||
NSAssert(expression, message, ##__VA_ARGS__); \
|
||||
})
|
||||
#define MLNCAssert(expression, message, ...) \
|
||||
__extension__({ \
|
||||
if (__builtin_expect(!(expression), 0)) { \
|
||||
MLNLogFault(message, ##__VA_ARGS__); \
|
||||
} \
|
||||
NSCAssert(expression, message, ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
#ifndef MLN_LOGGING_DISABLED
|
||||
|
||||
#define MLNLogWithType(type, function, line, message, ...) \
|
||||
{ \
|
||||
if ([MLNLoggingConfiguration sharedConfiguration].loggingLevel != MLNLoggingLevelNone && type <= [MLNLoggingConfiguration sharedConfiguration].loggingLevel) \
|
||||
{ \
|
||||
[[MLNLoggingConfiguration sharedConfiguration] logCallingFunction:function functionLine:line messageType:type format:(message), ##__VA_ARGS__]; \
|
||||
} \
|
||||
}
|
||||
#define MLNLogWithType(type, function, line, message, ...) \
|
||||
{ \
|
||||
if ([MLNLoggingConfiguration sharedConfiguration].loggingLevel != MLNLoggingLevelNone && \
|
||||
type <= [MLNLoggingConfiguration sharedConfiguration].loggingLevel) { \
|
||||
[[MLNLoggingConfiguration sharedConfiguration] logCallingFunction:function \
|
||||
functionLine:line \
|
||||
messageType:type \
|
||||
format:(message), ##__VA_ARGS__]; \
|
||||
} \
|
||||
}
|
||||
|
||||
@interface MLNLoggingConfiguration (Private)
|
||||
|
||||
- (void)logCallingFunction:(const char *)callingFunction functionLine:(NSUInteger)functionLine messageType:(MLNLoggingLevel)type format:(id)messageFormat, ...;
|
||||
- (void)logCallingFunction:(const char *)callingFunction
|
||||
functionLine:(NSUInteger)functionLine
|
||||
messageType:(MLNLoggingLevel)type
|
||||
format:(id)messageFormat, ...;
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
@@ -128,8 +128,8 @@ MLN_EXPORT
|
||||
fromDistance:(CLLocationDistance)distance
|
||||
pitch:(CGFloat)pitch
|
||||
heading:(CLLocationDirection)heading
|
||||
__attribute__((deprecated("Use -cameraLookingAtCenterCoordinate:acrossDistance:pitch:heading: "
|
||||
"or -cameraLookingAtCenterCoordinate:altitude:pitch:heading:.")));
|
||||
__attribute__((deprecated("Use -cameraLookingAtCenterCoordinate:acrossDistance:pitch:heading: "
|
||||
"or -cameraLookingAtCenterCoordinate:altitude:pitch:heading:.")));
|
||||
|
||||
/**
|
||||
Returns a Boolean value indicating whether the given camera is functionally
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MLNTypes.h"
|
||||
#import "MLNGeometry.h"
|
||||
#import "MLNMapCamera.h"
|
||||
#import "MLNStyle.h"
|
||||
#import "MLNTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -55,7 +55,7 @@ draw custom overlays rendered with Core Graphics.
|
||||
|
||||
@param snapshotOverlay The `MLNMapSnapshotOverlay` provided during snapshot drawing.
|
||||
*/
|
||||
typedef void (^MLNMapSnapshotOverlayHandler)(MLNMapSnapshotOverlay * snapshotOverlay);
|
||||
typedef void (^MLNMapSnapshotOverlayHandler)(MLNMapSnapshotOverlay *snapshotOverlay);
|
||||
|
||||
/**
|
||||
The options to use when creating images with the `MLNMapSnapshotter`.
|
||||
@@ -71,7 +71,9 @@ MLN_EXPORT
|
||||
the application’s resource path. Specify `nil` for the default style.
|
||||
@param size The image size.
|
||||
*/
|
||||
- (instancetype)initWithStyleURL:(nullable NSURL *)styleURL camera:(MLNMapCamera *)camera size:(CGSize)size;
|
||||
- (instancetype)initWithStyleURL:(nullable NSURL *)styleURL
|
||||
camera:(MLNMapCamera *)camera
|
||||
size:(CGSize)size;
|
||||
|
||||
// MARK: - Configuring the Map
|
||||
|
||||
@@ -157,7 +159,6 @@ MLN_EXPORT
|
||||
*/
|
||||
- (CLLocationCoordinate2D)coordinateForPoint:(NSPoint)point;
|
||||
|
||||
|
||||
/**
|
||||
The image of the map’s content.
|
||||
*/
|
||||
@@ -173,7 +174,8 @@ MLN_EXPORT
|
||||
occurred.
|
||||
@param error The error that occured or `nil` when successful.
|
||||
*/
|
||||
typedef void (^MLNMapSnapshotCompletionHandler)(MLNMapSnapshot* _Nullable snapshot, NSError* _Nullable error);
|
||||
typedef void (^MLNMapSnapshotCompletionHandler)(MLNMapSnapshot *_Nullable snapshot,
|
||||
NSError *_Nullable error);
|
||||
|
||||
/**
|
||||
An `MLNMapSnapshotter` generates static raster images of the map. Each snapshot
|
||||
@@ -201,10 +203,11 @@ typedef void (^MLNMapSnapshotCompletionHandler)(MLNMapSnapshot* _Nullable snapsh
|
||||
### Example
|
||||
|
||||
```swift
|
||||
let camera = MLNMapCamera(lookingAtCenter: CLLocationCoordinate2D(latitude: 37.7184, longitude: -122.4365), altitude: 100, pitch: 20, heading: 0)
|
||||
let camera = MLNMapCamera(lookingAtCenter: CLLocationCoordinate2D(latitude: 37.7184, longitude:
|
||||
-122.4365), altitude: 100, pitch: 20, heading: 0)
|
||||
|
||||
let options = MLNMapSnapshotOptions(styleURL: MLNStyle.satelliteStreetsStyleURL, camera: camera, size: CGSize(width: 320, height: 480))
|
||||
options.zoomLevel = 10
|
||||
let options = MLNMapSnapshotOptions(styleURL: MLNStyle.satelliteStreetsStyleURL, camera: camera,
|
||||
size: CGSize(width: 320, height: 480)) options.zoomLevel = 10
|
||||
|
||||
let snapshotter = MLNMapSnapshotter(options: options)
|
||||
snapshotter.start { (snapshot, error) in
|
||||
@@ -252,7 +255,8 @@ MLN_EXPORT
|
||||
@param completionHandler The block to call with a finished snapshot. The block
|
||||
is executed on the queue specified in the `queue` parameter.
|
||||
*/
|
||||
- (void)startWithQueue:(dispatch_queue_t)queue completionHandler:(MLNMapSnapshotCompletionHandler)completionHandler;
|
||||
- (void)startWithQueue:(dispatch_queue_t)queue
|
||||
completionHandler:(MLNMapSnapshotCompletionHandler)completionHandler;
|
||||
|
||||
/**
|
||||
Starts the snapshot creation and executes the specified blocks with the result
|
||||
@@ -266,7 +270,8 @@ MLN_EXPORT
|
||||
@param completionHandler The block to call with a finished snapshot. The block
|
||||
is executed on the main queue.
|
||||
*/
|
||||
- (void)startWithOverlayHandler:(MLNMapSnapshotOverlayHandler)overlayHandler completionHandler:(MLNMapSnapshotCompletionHandler)completionHandler;
|
||||
- (void)startWithOverlayHandler:(MLNMapSnapshotOverlayHandler)overlayHandler
|
||||
completionHandler:(MLNMapSnapshotCompletionHandler)completionHandler;
|
||||
|
||||
/**
|
||||
Cancels the snapshot creation request, if any.
|
||||
@@ -298,7 +303,7 @@ MLN_EXPORT
|
||||
weak reference to its delegate, so you must keep a strong reference to it to
|
||||
ensure that your style customizations apply.
|
||||
*/
|
||||
@property (nonatomic, weak) id <MLNMapSnapshotterDelegate> delegate;
|
||||
@property (nonatomic, weak) id<MLNMapSnapshotterDelegate> delegate;
|
||||
|
||||
/**
|
||||
The style displayed in the resulting snapshot.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNShape.h"
|
||||
@@ -72,7 +72,9 @@ MLN_EXPORT
|
||||
@param index The zero-based index at which the first coordinate in `coords`
|
||||
will appear in the `coordinates` property.
|
||||
*/
|
||||
- (void)insertCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count atIndex:(NSUInteger)index;
|
||||
- (void)insertCoordinates:(const CLLocationCoordinate2D *)coords
|
||||
count:(NSUInteger)count
|
||||
atIndex:(NSUInteger)index;
|
||||
|
||||
/**
|
||||
Appends the given vertices to the shape.
|
||||
@@ -112,7 +114,8 @@ MLN_EXPORT
|
||||
@param coords The array of coordinates defining part of the shape. The data in
|
||||
this array is copied to the shape’s `coordinates` property.
|
||||
*/
|
||||
- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates:(const CLLocationCoordinate2D *)coords;
|
||||
- (void)replaceCoordinatesInRange:(NSRange)range
|
||||
withCoordinates:(const CLLocationCoordinate2D *)coords;
|
||||
|
||||
/**
|
||||
Replaces the vertices at the given range in the shape with the specified number
|
||||
@@ -142,7 +145,9 @@ MLN_EXPORT
|
||||
count must not exceed the number of items currently in the `coordinates`
|
||||
property.
|
||||
*/
|
||||
- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count;
|
||||
- (void)replaceCoordinatesInRange:(NSRange)range
|
||||
withCoordinates:(const CLLocationCoordinate2D *)coords
|
||||
count:(NSUInteger)count;
|
||||
|
||||
/**
|
||||
Removes the vertices at the given range from the shape.
|
||||
|
||||
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (BOOL)intersectsOverlayBounds:(MLNCoordinateBounds)overlayBounds;
|
||||
|
||||
/** Constructs a shape annotation object, asking the delegate for style values. */
|
||||
- (mbgl::Annotation)annotationObjectWithDelegate:(id <MLNMultiPointDelegate>)delegate;
|
||||
- (mbgl::Annotation)annotationObjectWithDelegate:(id<MLNMultiPointDelegate>)delegate;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (NSURLSession *)sessionForNetworkConfiguration:(MLNNetworkConfiguration *)configuration;
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
The `MLNNetworkConfiguration` object provides a global way to set a base
|
||||
`NSURLSessionConfiguration`, and other resources.
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
#import "MLNNetworkConfiguration.h"
|
||||
#include <mbgl/interface/native_apple_interface.h>
|
||||
#import "MLNNetworkConfiguration.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MLNNetworkConfiguration;
|
||||
@protocol MLNNetworkConfigurationMetricsDelegate <NSObject>
|
||||
|
||||
- (void)networkConfiguration:(MLNNetworkConfiguration *)networkConfiguration didGenerateMetricEvent:(NSDictionary *)metricEvent;
|
||||
- (void)networkConfiguration:(MLNNetworkConfiguration *)networkConfiguration
|
||||
didGenerateMetricEvent:(NSDictionary *)metricEvent;
|
||||
|
||||
@end
|
||||
|
||||
extern NSString * const kMLNDownloadPerformanceEvent;
|
||||
extern NSString *const kMLNDownloadPerformanceEvent;
|
||||
|
||||
@interface MLNNetworkConfiguration (Private)
|
||||
|
||||
@property (nonatomic, strong) NSMutableDictionary<NSString*, NSDictionary*> *events;
|
||||
@property (nonatomic, strong) NSMutableDictionary<NSString *, NSDictionary *> *events;
|
||||
@property (nonatomic, weak) id<MLNNetworkConfigurationMetricsDelegate> metricsDelegate;
|
||||
|
||||
- (void)resetNativeNetworkManagerDelegate;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNTypes.h"
|
||||
#import "MLNOfflineRegion.h"
|
||||
#import "MLNTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -11,46 +11,46 @@ FOUNDATION_EXTERN MLN_EXPORT MLNExceptionName const MLNInvalidOfflinePackExcepti
|
||||
/**
|
||||
The state an offline pack is currently in.
|
||||
*/
|
||||
typedef NS_ENUM (NSInteger, MLNOfflinePackState) {
|
||||
/**
|
||||
It is unknown whether the pack is inactive, active, or complete.
|
||||
typedef NS_ENUM(NSInteger, MLNOfflinePackState) {
|
||||
/**
|
||||
It is unknown whether the pack is inactive, active, or complete.
|
||||
|
||||
This is the initial state of a pack. The state of a pack becomes known by
|
||||
the time the shared `MLNOfflineStorage` object sends the first
|
||||
`MLNOfflinePackProgressChangedNotification` about the pack. For inactive
|
||||
packs, you must explicitly request a progress update using the
|
||||
`-[MLNOfflinePack requestProgress]` method.
|
||||
This is the initial state of a pack. The state of a pack becomes known by
|
||||
the time the shared `MLNOfflineStorage` object sends the first
|
||||
`MLNOfflinePackProgressChangedNotification` about the pack. For inactive
|
||||
packs, you must explicitly request a progress update using the
|
||||
`-[MLNOfflinePack requestProgress]` method.
|
||||
|
||||
An invalid pack always has a state of `MLNOfflinePackStateInvalid`, never
|
||||
`MLNOfflinePackStateUnknown`.
|
||||
*/
|
||||
MLNOfflinePackStateUnknown = 0,
|
||||
/**
|
||||
The pack is incomplete and is not currently downloading.
|
||||
An invalid pack always has a state of `MLNOfflinePackStateInvalid`, never
|
||||
`MLNOfflinePackStateUnknown`.
|
||||
*/
|
||||
MLNOfflinePackStateUnknown = 0,
|
||||
/**
|
||||
The pack is incomplete and is not currently downloading.
|
||||
|
||||
This is the initial state of a pack that is created using the
|
||||
`-[MLNOfflineStorage addPackForRegion:withContext:completionHandler:]`
|
||||
method, as well as after the `-[MLNOfflinePack suspend]` method is
|
||||
called.
|
||||
*/
|
||||
MLNOfflinePackStateInactive = 1,
|
||||
/**
|
||||
The pack is incomplete and is currently downloading.
|
||||
This is the initial state of a pack that is created using the
|
||||
`-[MLNOfflineStorage addPackForRegion:withContext:completionHandler:]`
|
||||
method, as well as after the `-[MLNOfflinePack suspend]` method is
|
||||
called.
|
||||
*/
|
||||
MLNOfflinePackStateInactive = 1,
|
||||
/**
|
||||
The pack is incomplete and is currently downloading.
|
||||
|
||||
This is the state of a pack after the `-[MLNOfflinePack resume]` method is
|
||||
called.
|
||||
*/
|
||||
MLNOfflinePackStateActive = 2,
|
||||
/**
|
||||
The pack has downloaded to completion.
|
||||
*/
|
||||
MLNOfflinePackStateComplete = 3,
|
||||
/**
|
||||
The pack has been removed using the
|
||||
`-[MLNOfflineStorage removePack:withCompletionHandler:]` method. Sending
|
||||
any message to the pack will raise an exception.
|
||||
*/
|
||||
MLNOfflinePackStateInvalid = 4,
|
||||
This is the state of a pack after the `-[MLNOfflinePack resume]` method is
|
||||
called.
|
||||
*/
|
||||
MLNOfflinePackStateActive = 2,
|
||||
/**
|
||||
The pack has downloaded to completion.
|
||||
*/
|
||||
MLNOfflinePackStateComplete = 3,
|
||||
/**
|
||||
The pack has been removed using the
|
||||
`-[MLNOfflineStorage removePack:withCompletionHandler:]` method. Sending
|
||||
any message to the pack will raise an exception.
|
||||
*/
|
||||
MLNOfflinePackStateInvalid = 4,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -58,42 +58,42 @@ typedef NS_ENUM (NSInteger, MLNOfflinePackState) {
|
||||
progress.
|
||||
*/
|
||||
typedef struct __attribute__((objc_boxable)) MLNOfflinePackProgress {
|
||||
/**
|
||||
The number of resources, including tiles, that have been completely
|
||||
downloaded and are ready to use offline.
|
||||
*/
|
||||
uint64_t countOfResourcesCompleted;
|
||||
/**
|
||||
The cumulative size of the downloaded resources on disk, including tiles,
|
||||
measured in bytes.
|
||||
*/
|
||||
uint64_t countOfBytesCompleted;
|
||||
/**
|
||||
The number of tiles that have been completely downloaded and are ready
|
||||
to use offline.
|
||||
*/
|
||||
uint64_t countOfTilesCompleted;
|
||||
/**
|
||||
The cumulative size of the downloaded tiles on disk, measured in bytes.
|
||||
*/
|
||||
uint64_t countOfTileBytesCompleted;
|
||||
/**
|
||||
The minimum number of resources that must be downloaded in order to view
|
||||
the pack’s full region without any omissions.
|
||||
/**
|
||||
The number of resources, including tiles, that have been completely
|
||||
downloaded and are ready to use offline.
|
||||
*/
|
||||
uint64_t countOfResourcesCompleted;
|
||||
/**
|
||||
The cumulative size of the downloaded resources on disk, including tiles,
|
||||
measured in bytes.
|
||||
*/
|
||||
uint64_t countOfBytesCompleted;
|
||||
/**
|
||||
The number of tiles that have been completely downloaded and are ready
|
||||
to use offline.
|
||||
*/
|
||||
uint64_t countOfTilesCompleted;
|
||||
/**
|
||||
The cumulative size of the downloaded tiles on disk, measured in bytes.
|
||||
*/
|
||||
uint64_t countOfTileBytesCompleted;
|
||||
/**
|
||||
The minimum number of resources that must be downloaded in order to view
|
||||
the pack’s full region without any omissions.
|
||||
|
||||
At the beginning of a download, this count is a lower bound; the number of
|
||||
expected resources may increase as the download progresses.
|
||||
*/
|
||||
uint64_t countOfResourcesExpected;
|
||||
/**
|
||||
The maximum number of resources that must be downloaded in order to view
|
||||
the pack’s full region without any omissions.
|
||||
At the beginning of a download, this count is a lower bound; the number of
|
||||
expected resources may increase as the download progresses.
|
||||
*/
|
||||
uint64_t countOfResourcesExpected;
|
||||
/**
|
||||
The maximum number of resources that must be downloaded in order to view
|
||||
the pack’s full region without any omissions.
|
||||
|
||||
At the beginning of a download, when the exact number of required resources
|
||||
is unknown, this field is set to `UINT64_MAX`. Thus this count is always an
|
||||
upper bound.
|
||||
*/
|
||||
uint64_t maximumResourcesExpected;
|
||||
At the beginning of a download, when the exact number of required resources
|
||||
is unknown, this field is set to `UINT64_MAX`. Thus this count is always an
|
||||
upper bound.
|
||||
*/
|
||||
uint64_t maximumResourcesExpected;
|
||||
} MLNOfflinePackProgress;
|
||||
|
||||
/**
|
||||
@@ -109,8 +109,8 @@ typedef struct __attribute__((objc_boxable)) MLNOfflinePackProgress {
|
||||
MLNOfflineStorage.shared.addPack(for: region, withContext: context) { (pack, error) in
|
||||
guard let pack = pack else {
|
||||
// If adding the pack fails, log an error to console.
|
||||
print("Error:", error?.localizedDescription ?? "unknown error adding pack at \(#file)(\(#line)) in \(#function)")
|
||||
return
|
||||
print("Error:", error?.localizedDescription ?? "unknown error adding pack at
|
||||
\(#file)(\(#line)) in \(#function)") return
|
||||
}
|
||||
|
||||
// Start an MLNOfflinePack download
|
||||
@@ -124,7 +124,7 @@ MLN_EXPORT
|
||||
/**
|
||||
The region for which the pack manages resources.
|
||||
*/
|
||||
@property (nonatomic, readonly) id <MLNOfflineRegion> region;
|
||||
@property (nonatomic, readonly) id<MLNOfflineRegion> region;
|
||||
|
||||
/**
|
||||
Arbitrary data stored alongside the downloaded resources.
|
||||
@@ -151,7 +151,8 @@ MLN_EXPORT
|
||||
updated. If there is an error setting the context, the error is passed into
|
||||
the completion handler.
|
||||
*/
|
||||
- (void)setContext:(NSData *)context completionHandler:(void (^_Nullable)(NSError * _Nullable error))completion;
|
||||
- (void)setContext:(NSData *)context
|
||||
completionHandler:(void (^_Nullable)(NSError *_Nullable error))completion;
|
||||
|
||||
/**
|
||||
The pack’s current state.
|
||||
|
||||
@@ -58,7 +58,8 @@ FOUNDATION_EXTERN MLN_EXPORT const NSNotificationName MLNOfflinePackErrorNotific
|
||||
additional tiles from Mapbox APIs until already downloaded tiles are removed by
|
||||
calling the `-[MLNOfflineStorage removePack:withCompletionHandler:]` method.
|
||||
*/
|
||||
FOUNDATION_EXTERN MLN_EXPORT const NSNotificationName MLNOfflinePackMaximumMapboxTilesReachedNotification;
|
||||
FOUNDATION_EXTERN MLN_EXPORT const NSNotificationName
|
||||
MLNOfflinePackMaximumMapboxTilesReachedNotification;
|
||||
|
||||
/**
|
||||
A key in the `userInfo` property of a notification posted by `MLNOfflinePack`.
|
||||
@@ -114,7 +115,8 @@ FOUNDATION_EXTERN MLN_EXPORT MLNExceptionName const MLNUnsupportedRegionTypeExce
|
||||
@param error Contains a pointer to an error object (if any) indicating why the
|
||||
pack could not be created or added.
|
||||
*/
|
||||
typedef void (^MLNOfflinePackAdditionCompletionHandler)(MLNOfflinePack * _Nullable pack, NSError * _Nullable error);
|
||||
typedef void (^MLNOfflinePackAdditionCompletionHandler)(MLNOfflinePack *_Nullable pack,
|
||||
NSError *_Nullable error);
|
||||
|
||||
/**
|
||||
A block to be called once an offline pack has been completely invalidated and
|
||||
@@ -127,7 +129,7 @@ typedef void (^MLNOfflinePackAdditionCompletionHandler)(MLNOfflinePack * _Nullab
|
||||
@param error Contains a pointer to an error object (if any) indicating why the
|
||||
pack could not be invalidated or removed.
|
||||
*/
|
||||
typedef void (^MLNOfflinePackRemovalCompletionHandler)(NSError * _Nullable error);
|
||||
typedef void (^MLNOfflinePackRemovalCompletionHandler)(NSError *_Nullable error);
|
||||
|
||||
/**
|
||||
A block to be called once the contents of a file are copied into the current packs.
|
||||
@@ -139,7 +141,8 @@ typedef void (^MLNOfflinePackRemovalCompletionHandler)(NSError * _Nullable error
|
||||
@param error A pointer to an error object (if any) indicating why the pack could
|
||||
not be created or added.
|
||||
*/
|
||||
typedef void (^MLNBatchedOfflinePackAdditionCompletionHandler)(NSURL *fileURL, NSArray<MLNOfflinePack *> * _Nullable packs, NSError * _Nullable error);
|
||||
typedef void (^MLNBatchedOfflinePackAdditionCompletionHandler)(
|
||||
NSURL *fileURL, NSArray<MLNOfflinePack *> *_Nullable packs, NSError *_Nullable error);
|
||||
|
||||
/**
|
||||
A block to be called once the data has been preloaded.
|
||||
@@ -148,32 +151,32 @@ A block to be called once the data has been preloaded.
|
||||
@param error Contains a pointer to an error object (if any) indicating why the
|
||||
data could not be pre-loaded.
|
||||
*/
|
||||
typedef void (^MLNOfflinePreloadDataCompletionHandler)(NSURL * url, NSError * _Nullable error);
|
||||
typedef void (^MLNOfflinePreloadDataCompletionHandler)(NSURL *url, NSError *_Nullable error);
|
||||
|
||||
/**
|
||||
The type of resource that is requested.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, MLNResourceKind) {
|
||||
/** Unknown type */
|
||||
MLNResourceKindUnknown,
|
||||
/** Style sheet JSON file */
|
||||
MLNResourceKindStyle,
|
||||
/** TileJSON file as specified in https://maplibre.org/maplibre-style-spec/root/#sources */
|
||||
MLNResourceKindSource,
|
||||
/** A vector or raster tile as described in the style sheet at
|
||||
https://maplibre.org/maplibre-style-spec/sources/ */
|
||||
MLNResourceKindTile,
|
||||
/** Signed distance field glyphs for text rendering. These are the URLs specified in the style
|
||||
in https://maplibre.org/maplibre-style-spec/root/#glyphs */
|
||||
MLNResourceKindGlyphs,
|
||||
/** Image part of a sprite sheet. It is constructed of the prefix in
|
||||
https://maplibre.org/maplibre-style-spec/root/#sprite and a PNG file extension. */
|
||||
MLNResourceKindSpriteImage,
|
||||
/** JSON part of a sprite sheet. It is constructed of the prefix in
|
||||
https://maplibre.org/maplibre-style-spec/root/#sprite and a JSON file extension. */
|
||||
MLNResourceKindSpriteJSON,
|
||||
/** Image data for a georeferenced image source. **/
|
||||
MLNResourceKindImage,
|
||||
/** Unknown type */
|
||||
MLNResourceKindUnknown,
|
||||
/** Style sheet JSON file */
|
||||
MLNResourceKindStyle,
|
||||
/** TileJSON file as specified in https://maplibre.org/maplibre-style-spec/root/#sources */
|
||||
MLNResourceKindSource,
|
||||
/** A vector or raster tile as described in the style sheet at
|
||||
https://maplibre.org/maplibre-style-spec/sources/ */
|
||||
MLNResourceKindTile,
|
||||
/** Signed distance field glyphs for text rendering. These are the URLs specified in the style
|
||||
in https://maplibre.org/maplibre-style-spec/root/#glyphs */
|
||||
MLNResourceKindGlyphs,
|
||||
/** Image part of a sprite sheet. It is constructed of the prefix in
|
||||
https://maplibre.org/maplibre-style-spec/root/#sprite and a PNG file extension. */
|
||||
MLNResourceKindSpriteImage,
|
||||
/** JSON part of a sprite sheet. It is constructed of the prefix in
|
||||
https://maplibre.org/maplibre-style-spec/root/#sprite and a JSON file extension. */
|
||||
MLNResourceKindSpriteJSON,
|
||||
/** Image data for a georeferenced image source. **/
|
||||
MLNResourceKindImage,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -209,7 +212,7 @@ MLN_EXPORT
|
||||
add or remove custom parameters, or reroute certain requests to other servers
|
||||
or endpoints.
|
||||
*/
|
||||
@property(nonatomic, weak, nullable) IBOutlet id<MLNOfflineStorageDelegate> delegate;
|
||||
@property (nonatomic, weak, nullable) IBOutlet id<MLNOfflineStorageDelegate> delegate;
|
||||
|
||||
// MARK: - Managing the Database of Offline Packs
|
||||
|
||||
@@ -246,7 +249,8 @@ MLN_EXPORT
|
||||
file has been added to offline storage. This handler is executed
|
||||
asynchronously on the main queue.
|
||||
*/
|
||||
- (void)addContentsOfFile:(NSString *)filePath withCompletionHandler:(nullable MLNBatchedOfflinePackAdditionCompletionHandler)completion;
|
||||
- (void)addContentsOfFile:(NSString *)filePath
|
||||
withCompletionHandler:(nullable MLNBatchedOfflinePackAdditionCompletionHandler)completion;
|
||||
|
||||
/**
|
||||
Adds the offline packs located at the given URL to offline storage.
|
||||
@@ -263,7 +267,8 @@ MLN_EXPORT
|
||||
file has been added to offline storage. This handler is executed
|
||||
asynchronously on the main queue.
|
||||
*/
|
||||
- (void)addContentsOfURL:(NSURL *)fileURL withCompletionHandler:(nullable MLNBatchedOfflinePackAdditionCompletionHandler)completion;
|
||||
- (void)addContentsOfURL:(NSURL *)fileURL
|
||||
withCompletionHandler:(nullable MLNBatchedOfflinePackAdditionCompletionHandler)completion;
|
||||
|
||||
// MARK: - Managing Offline Packs
|
||||
|
||||
@@ -303,7 +308,9 @@ MLN_EXPORT
|
||||
@param completion The completion handler to call once the pack has been added.
|
||||
This handler is executed asynchronously on the main queue.
|
||||
*/
|
||||
- (void)addPackForRegion:(id <MLNOfflineRegion>)region withContext:(NSData *)context completionHandler:(nullable MLNOfflinePackAdditionCompletionHandler)completion;
|
||||
- (void)addPackForRegion:(id<MLNOfflineRegion>)region
|
||||
withContext:(NSData *)context
|
||||
completionHandler:(nullable MLNOfflinePackAdditionCompletionHandler)completion;
|
||||
|
||||
/**
|
||||
Unregisters the given offline pack and allows resources that are no longer
|
||||
@@ -330,7 +337,8 @@ MLN_EXPORT
|
||||
@param completion The completion handler to call once the pack has been
|
||||
removed. This handler is executed asynchronously on the main queue.
|
||||
*/
|
||||
- (void)removePack:(MLNOfflinePack *)pack withCompletionHandler:(nullable MLNOfflinePackRemovalCompletionHandler)completion;
|
||||
- (void)removePack:(MLNOfflinePack *)pack
|
||||
withCompletionHandler:(nullable MLNOfflinePackRemovalCompletionHandler)completion;
|
||||
|
||||
/**
|
||||
Invalidates the specified offline pack. This method checks that the tiles
|
||||
@@ -346,7 +354,8 @@ MLN_EXPORT
|
||||
removed. This handler is executed asynchronously on the main queue.
|
||||
*/
|
||||
|
||||
- (void)invalidatePack:(MLNOfflinePack *)pack withCompletionHandler:(void (^)(NSError * _Nullable))completion;
|
||||
- (void)invalidatePack:(MLNOfflinePack *)pack
|
||||
withCompletionHandler:(void (^)(NSError *_Nullable))completion;
|
||||
/**
|
||||
Forcibly, asynchronously reloads the `packs` property. At some point after this
|
||||
method is called, the pointer values of the `MLNOfflinePack` objects in the
|
||||
@@ -406,7 +415,8 @@ MLN_EXPORT
|
||||
@param completion The completion handler to call once the maximum ambient cache
|
||||
size has been set. This handler is executed synchronously on the main queue.
|
||||
*/
|
||||
- (void)setMaximumAmbientCacheSize:(NSUInteger)cacheSize withCompletionHandler:(void (^)(NSError *_Nullable error))completion;
|
||||
- (void)setMaximumAmbientCacheSize:(NSUInteger)cacheSize
|
||||
withCompletionHandler:(void (^)(NSError *_Nullable error))completion;
|
||||
|
||||
/**
|
||||
Invalidates the ambient cache. This method checks that the tiles in the
|
||||
@@ -455,7 +465,8 @@ MLN_EXPORT
|
||||
in-progress requests, though subsequent requests should have access to the
|
||||
cached data.
|
||||
|
||||
To find out when the resource is ready to retrieve from the cache, use the `-preloadData:forURL:modificationDate:expirationDate:eTag:mustRevalidate:completionHandler:`
|
||||
To find out when the resource is ready to retrieve from the cache, use the
|
||||
`-preloadData:forURL:modificationDate:expirationDate:eTag:mustRevalidate:completionHandler:`
|
||||
method.
|
||||
|
||||
@param data Response data to store for this resource. The data is expected to
|
||||
@@ -467,9 +478,22 @@ MLN_EXPORT
|
||||
@param mustRevalidate A Boolean value indicating whether the data is still
|
||||
usable past the expiration date.
|
||||
*/
|
||||
- (void)preloadData:(NSData *)data forURL:(NSURL *)url modificationDate:(nullable NSDate *)modified expirationDate:(nullable NSDate *)expires eTag:(nullable NSString *)eTag mustRevalidate:(BOOL)mustRevalidate NS_SWIFT_NAME(preload(_:for:modifiedOn:expiresOn:eTag:mustRevalidate:));
|
||||
- (void)preloadData:(NSData *)data
|
||||
forURL:(NSURL *)url
|
||||
modificationDate:(nullable NSDate *)modified
|
||||
expirationDate:(nullable NSDate *)expires
|
||||
eTag:(nullable NSString *)eTag
|
||||
mustRevalidate:(BOOL)mustRevalidate
|
||||
NS_SWIFT_NAME(preload(_:for:modifiedOn:expiresOn:eTag:mustRevalidate:));
|
||||
|
||||
- (void)putResourceWithUrl:(NSURL *)url data:(NSData *)data modified:(nullable NSDate *)modified expires:(nullable NSDate *)expires etag:(nullable NSString *)etag mustRevalidate:(BOOL)mustRevalidate __attribute__((deprecated("", "-preloadData:forURL:modificationDate:expirationDate:eTag:mustRevalidate:")));
|
||||
- (void)putResourceWithUrl:(NSURL *)url
|
||||
data:(NSData *)data
|
||||
modified:(nullable NSDate *)modified
|
||||
expires:(nullable NSDate *)expires
|
||||
etag:(nullable NSString *)etag
|
||||
mustRevalidate:(BOOL)mustRevalidate
|
||||
__attribute__((deprecated(
|
||||
"", "-preloadData:forURL:modificationDate:expirationDate:eTag:mustRevalidate:")));
|
||||
|
||||
/**
|
||||
Inserts the provided resource into the ambient cache, calling a completion
|
||||
@@ -493,7 +517,12 @@ MLN_EXPORT
|
||||
@param completion The completion handler to call once the data has been
|
||||
preloaded. This handler is executed asynchronously on the main queue.
|
||||
*/
|
||||
- (void)preloadData:(NSData *)data forURL:(NSURL *)url modificationDate:(nullable NSDate *)modified expirationDate:(nullable NSDate *)expires eTag:(nullable NSString *)eTag mustRevalidate:(BOOL)mustRevalidate
|
||||
- (void)preloadData:(NSData *)data
|
||||
forURL:(NSURL *)url
|
||||
modificationDate:(nullable NSDate *)modified
|
||||
expirationDate:(nullable NSDate *)expires
|
||||
eTag:(nullable NSString *)eTag
|
||||
mustRevalidate:(BOOL)mustRevalidate
|
||||
completionHandler:(nullable MLNOfflinePreloadDataCompletionHandler)completion;
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#import "MLNOfflinePack.h"
|
||||
|
||||
#include <mbgl/storage/online_file_source.hpp>
|
||||
#include <mbgl/storage/database_file_source.hpp>
|
||||
#include <mbgl/storage/online_file_source.hpp>
|
||||
|
||||
#include "MLNSettings_Private.h"
|
||||
|
||||
@@ -28,7 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
@property (nonatomic) std::shared_ptr<mbgl::FileSource> mbglFileSource;
|
||||
|
||||
- (void)getPacksWithCompletionHandler:(void (^)(NSArray<MLNOfflinePack *> *packs, NSError * _Nullable error))completion;
|
||||
- (void)getPacksWithCompletionHandler:(void (^)(NSArray<MLNOfflinePack *> *packs,
|
||||
NSError *_Nullable error))completion;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNAnnotation.h"
|
||||
#import "MLNGeometry.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNShape.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNOverlay.h"
|
||||
@@ -40,7 +40,8 @@ MLN_EXPORT
|
||||
@param count The number of items in the `coords` array.
|
||||
@return A new point collection object.
|
||||
*/
|
||||
+ (instancetype)pointCollectionWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count;
|
||||
+ (instancetype)pointCollectionWithCoordinates:(const CLLocationCoordinate2D *)coords
|
||||
count:(NSUInteger)count;
|
||||
|
||||
/** The array of coordinates associated with the shape. */
|
||||
@property (nonatomic, readonly) CLLocationCoordinate2D *coordinates NS_RETURNS_INNER_POINTER;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNMultiPoint.h"
|
||||
@@ -72,7 +72,8 @@ MLN_EXPORT
|
||||
@param count The number of items in the `coords` array.
|
||||
@return A new polygon object.
|
||||
*/
|
||||
+ (instancetype)polygonWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count;
|
||||
+ (instancetype)polygonWithCoordinates:(const CLLocationCoordinate2D *)coords
|
||||
count:(NSUInteger)count;
|
||||
|
||||
/**
|
||||
Creates and returns an `MLNPolygon` object from the specified set of
|
||||
@@ -86,7 +87,9 @@ MLN_EXPORT
|
||||
is considered to have no interior polygons.
|
||||
@return A new polygon object.
|
||||
*/
|
||||
+ (instancetype)polygonWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(nullable NSArray<MLNPolygon *> *)interiorPolygons;
|
||||
+ (instancetype)polygonWithCoordinates:(const CLLocationCoordinate2D *)coords
|
||||
count:(NSUInteger)count
|
||||
interiorPolygons:(nullable NSArray<MLNPolygon *> *)interiorPolygons;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNMultiPoint.h"
|
||||
@@ -69,7 +69,8 @@ MLN_EXPORT
|
||||
@param count The number of items in the `coords` array.
|
||||
@return A new polyline object.
|
||||
*/
|
||||
+ (instancetype)polylineWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count;
|
||||
+ (instancetype)polylineWithCoordinates:(const CLLocationCoordinate2D *)coords
|
||||
count:(NSUInteger)count;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -9,4 +9,3 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
|
||||
@@ -34,7 +34,9 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNTileSourceOption MLNTileSourceOptionDEMEnc
|
||||
`-[MLNStyle addSource:]` and `-[MLNStyle sourceWithIdentifier:]`.
|
||||
|
||||
Currently, raster DEM sources only support the format used by
|
||||
<a href="https://docs.mapbox.com/help/troubleshooting/access-elevation-data/#mapbox-terrain-rgb">Mapbox Terrain-RGB</a>.
|
||||
<a
|
||||
href="https://docs.mapbox.com/help/troubleshooting/access-elevation-data/#mapbox-terrain-rgb">Mapbox
|
||||
Terrain-RGB</a>.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
@@ -42,12 +42,13 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNTileSourceOption MLNTileSourceOptionTileSi
|
||||
### Example
|
||||
|
||||
```swift
|
||||
let source = MLNRasterTileSource(identifier: "clouds", tileURLTemplates: ["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [
|
||||
.minimumZoomLevel: 9,
|
||||
let source = MLNRasterTileSource(identifier: "clouds", tileURLTemplates:
|
||||
["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [ .minimumZoomLevel: 9,
|
||||
.maximumZoomLevel: 16,
|
||||
.tileSize: 512,
|
||||
.attributionInfos: [
|
||||
MLNAttributionInfo(title: NSAttributedString(string: "© Mapbox"), url: URL(string: "https://mapbox.com"))
|
||||
MLNAttributionInfo(title: NSAttributedString(string: "© Mapbox"), url: URL(string:
|
||||
"https://mapbox.com"))
|
||||
]
|
||||
])
|
||||
mapView.style?.addSource(source)
|
||||
@@ -85,7 +86,8 @@ MLN_EXPORT
|
||||
source’s contents and other metadata.
|
||||
@return An initialized raster tile source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
configurationURL:(NSURL *)configurationURL;
|
||||
|
||||
/**
|
||||
Returns a raster tile source initialized with an identifier, configuration URL,
|
||||
@@ -107,7 +109,9 @@ MLN_EXPORT
|
||||
documentation for details.
|
||||
@return An initialized raster tile source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL tileSize:(CGFloat)tileSize NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
configurationURL:(NSURL *)configurationURL
|
||||
tileSize:(CGFloat)tileSize NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
Returns a raster tile source initialized an identifier, tile URL templates, and
|
||||
@@ -129,7 +133,10 @@ MLN_EXPORT
|
||||
the default values.
|
||||
@return An initialized tile source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NSArray<NSString *> *)tileURLTemplates options:(nullable NSDictionary<MLNTileSourceOption, id> *)options NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
tileURLTemplates:(NSArray<NSString *> *)tileURLTemplates
|
||||
options:(nullable NSDictionary<MLNTileSourceOption, id> *)options
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#import "MLNRasterTileSource.h"
|
||||
|
||||
#include <memory>
|
||||
#include <mbgl/util/variant.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace mbgl {
|
||||
class Tileset;
|
||||
namespace style {
|
||||
class RasterSource;
|
||||
}
|
||||
class Tileset;
|
||||
namespace style {
|
||||
class RasterSource;
|
||||
}
|
||||
} // namespace mbgl
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -16,7 +16,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@property (nonatomic, readonly, nullable) mbgl::style::RasterSource *rawSource;
|
||||
|
||||
- (std::unique_ptr<mbgl::style::RasterSource>)pendingSourceWithIdentifier:(NSString *)identifier urlOrTileset:(mbgl::variant<std::string, mbgl::Tileset>)urlOrTileset tileSize:(uint16_t)tileSize;
|
||||
- (std::unique_ptr<mbgl::style::RasterSource>)
|
||||
pendingSourceWithIdentifier:(NSString *)identifier
|
||||
urlOrTileset:(mbgl::variant<std::string, mbgl::Tileset>)urlOrTileset
|
||||
tileSize:(uint16_t)tileSize;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -28,66 +28,65 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <SystemConfiguration/SystemConfiguration.h>
|
||||
|
||||
|
||||
/**
|
||||
* Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
|
||||
*
|
||||
* @see http://nshipster.com/ns_enum-ns_options/
|
||||
**/
|
||||
#ifndef NS_ENUM
|
||||
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
|
||||
#define NS_ENUM(_type, _name) \
|
||||
enum _name : _type _name; \
|
||||
enum _name : _type
|
||||
#endif
|
||||
|
||||
extern NSString *const kMLNReachabilityChangedNotification;
|
||||
|
||||
typedef NS_ENUM(NSInteger, NetworkStatus) {
|
||||
// Apple NetworkStatus Compatible Names.
|
||||
NotReachable = 0,
|
||||
ReachableViaWiFi = 2,
|
||||
ReachableViaWWAN = 1
|
||||
// Apple NetworkStatus Compatible Names.
|
||||
NotReachable = 0,
|
||||
ReachableViaWiFi = 2,
|
||||
ReachableViaWWAN = 1
|
||||
};
|
||||
|
||||
@class MLNReachability;
|
||||
|
||||
typedef void (^NetworkReachable)(MLNReachability * reachability);
|
||||
typedef void (^NetworkUnreachable)(MLNReachability * reachability);
|
||||
|
||||
typedef void (^NetworkReachable)(MLNReachability *reachability);
|
||||
typedef void (^NetworkUnreachable)(MLNReachability *reachability);
|
||||
|
||||
@interface MLNReachability : NSObject
|
||||
|
||||
@property (nonatomic, copy) NetworkReachable reachableBlock;
|
||||
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
|
||||
@property (nonatomic, copy) NetworkReachable reachableBlock;
|
||||
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
|
||||
|
||||
@property (nonatomic, assign) BOOL reachableOnWWAN;
|
||||
|
||||
|
||||
+(instancetype)reachabilityWithHostname:(NSString*)hostname;
|
||||
+ (instancetype)reachabilityWithHostname:(NSString *)hostname;
|
||||
// This is identical to the function above, but is here to maintain
|
||||
// compatibility with Apples original code. (see .m)
|
||||
+(instancetype)reachabilityWithHostName:(NSString*)hostname;
|
||||
+(instancetype)reachabilityForInternetConnection;
|
||||
+(instancetype)reachabilityWithAddress:(void *)hostAddress;
|
||||
+(instancetype)reachabilityForLocalWiFi;
|
||||
+ (instancetype)reachabilityWithHostName:(NSString *)hostname;
|
||||
+ (instancetype)reachabilityForInternetConnection;
|
||||
+ (instancetype)reachabilityWithAddress:(void *)hostAddress;
|
||||
+ (instancetype)reachabilityForLocalWiFi;
|
||||
|
||||
-(BOOL)startNotifier;
|
||||
-(void)stopNotifier;
|
||||
- (BOOL)startNotifier;
|
||||
- (void)stopNotifier;
|
||||
|
||||
-(BOOL)isReachable;
|
||||
-(BOOL)isReachableViaWWAN;
|
||||
-(BOOL)isReachableViaWiFi;
|
||||
- (BOOL)isReachable;
|
||||
- (BOOL)isReachableViaWWAN;
|
||||
- (BOOL)isReachableViaWiFi;
|
||||
|
||||
// WWAN may be available, but not active until a connection has been established.
|
||||
// WiFi may require a connection for VPN on Demand.
|
||||
-(BOOL)isConnectionRequired; // Identical DDG variant.
|
||||
-(BOOL)connectionRequired; // Apple's routine.
|
||||
- (BOOL)isConnectionRequired; // Identical DDG variant.
|
||||
- (BOOL)connectionRequired; // Apple's routine.
|
||||
// Dynamic, on demand connection?
|
||||
-(BOOL)isConnectionOnDemand;
|
||||
- (BOOL)isConnectionOnDemand;
|
||||
// Is user intervention required?
|
||||
-(BOOL)isInterventionRequired;
|
||||
- (BOOL)isInterventionRequired;
|
||||
|
||||
-(NetworkStatus)currentReachabilityStatus;
|
||||
-(SCNetworkReachabilityFlags)reachabilityFlags;
|
||||
-(NSString*)currentReachabilityString;
|
||||
-(NSString*)currentReachabilityFlags;
|
||||
- (NetworkStatus)currentReachabilityStatus;
|
||||
- (SCNetworkReachabilityFlags)reachabilityFlags;
|
||||
- (NSString *)currentReachabilityString;
|
||||
- (NSString *)currentReachabilityFlags;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import "MLNFoundation.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -34,7 +34,8 @@ MLN_EXPORT
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *localFontFamilyName;
|
||||
|
||||
- (nullable NSString *)localFontFamilyNameWithInfoDictionaryObject:(nullable id)infoDictionaryObject;
|
||||
- (nullable NSString *)localFontFamilyNameWithInfoDictionaryObject:
|
||||
(nullable id)infoDictionaryObject;
|
||||
|
||||
/**
|
||||
A Boolean value indicating whether symbol layers may enable per-source symbol
|
||||
|
||||
@@ -1,73 +1,67 @@
|
||||
#include <mbgl/gfx/backend_scope.hpp>
|
||||
#include <mbgl/gfx/renderer_backend.hpp>
|
||||
#include <mbgl/renderer/renderer.hpp>
|
||||
#include <mbgl/renderer/renderer_frontend.hpp>
|
||||
#include <mbgl/gfx/renderer_backend.hpp>
|
||||
#include <mbgl/util/async_task.hpp>
|
||||
|
||||
/**
|
||||
The RenderFrontend is passed to the Map to facilitate rendering in a platform
|
||||
dependent way.
|
||||
*/
|
||||
class MLNRenderFrontend : public mbgl::RendererFrontend
|
||||
{
|
||||
public:
|
||||
MLNRenderFrontend(std::unique_ptr<mbgl::Renderer> renderer_, MLNMapView* nativeView_, mbgl::gfx::RendererBackend& mbglBackend_, bool async = false)
|
||||
: renderer(std::move(renderer_))
|
||||
, nativeView(nativeView_)
|
||||
, mbglBackend(mbglBackend_) {
|
||||
if (async) {
|
||||
asyncInvalidate.emplace([&]() {
|
||||
[nativeView setNeedsRerender];
|
||||
});
|
||||
}
|
||||
class MLNRenderFrontend : public mbgl::RendererFrontend {
|
||||
public:
|
||||
MLNRenderFrontend(std::unique_ptr<mbgl::Renderer> renderer_, MLNMapView* nativeView_,
|
||||
mbgl::gfx::RendererBackend& mbglBackend_, bool async = false)
|
||||
: renderer(std::move(renderer_)), nativeView(nativeView_), mbglBackend(mbglBackend_) {
|
||||
if (async) {
|
||||
asyncInvalidate.emplace([&]() { [nativeView setNeedsRerender]; });
|
||||
}
|
||||
}
|
||||
|
||||
void reset() override {
|
||||
if (renderer) {
|
||||
renderer.reset();
|
||||
}
|
||||
void reset() override {
|
||||
if (renderer) {
|
||||
renderer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void update(std::shared_ptr<mbgl::UpdateParameters> updateParameters_) override {
|
||||
updateParameters = std::move(updateParameters_);
|
||||
if (asyncInvalidate) {
|
||||
asyncInvalidate->send();
|
||||
} else {
|
||||
[nativeView setNeedsRerender];
|
||||
}
|
||||
void update(std::shared_ptr<mbgl::UpdateParameters> updateParameters_) override {
|
||||
updateParameters = std::move(updateParameters_);
|
||||
if (asyncInvalidate) {
|
||||
asyncInvalidate->send();
|
||||
} else {
|
||||
[nativeView setNeedsRerender];
|
||||
}
|
||||
}
|
||||
|
||||
void setObserver(mbgl::RendererObserver& observer) override {
|
||||
if (!renderer) return;
|
||||
renderer->setObserver(&observer);
|
||||
}
|
||||
void setObserver(mbgl::RendererObserver& observer) override {
|
||||
if (!renderer) return;
|
||||
renderer->setObserver(&observer);
|
||||
}
|
||||
|
||||
void render() {
|
||||
if (!renderer || !updateParameters) return;
|
||||
void render() {
|
||||
if (!renderer || !updateParameters) return;
|
||||
|
||||
mbgl::gfx::BackendScope guard { mbglBackend, mbgl::gfx::BackendScope::ScopeType::Implicit };
|
||||
mbgl::gfx::BackendScope guard{mbglBackend, mbgl::gfx::BackendScope::ScopeType::Implicit};
|
||||
|
||||
// onStyleImageMissing might be called during a render. The user implemented method
|
||||
// could trigger a call to MLNRenderFrontend#update which overwrites `updateParameters`.
|
||||
// Copy the shared pointer here so that the parameters aren't destroyed while `render(...)` is
|
||||
// still using them.
|
||||
auto updateParameters_ = updateParameters;
|
||||
renderer->render(updateParameters_);
|
||||
}
|
||||
// onStyleImageMissing might be called during a render. The user implemented method
|
||||
// could trigger a call to MLNRenderFrontend#update which overwrites `updateParameters`.
|
||||
// Copy the shared pointer here so that the parameters aren't destroyed while `render(...)` is
|
||||
// still using them.
|
||||
auto updateParameters_ = updateParameters;
|
||||
renderer->render(updateParameters_);
|
||||
}
|
||||
|
||||
mbgl::Renderer* getRenderer() {
|
||||
return renderer.get();
|
||||
}
|
||||
mbgl::Renderer* getRenderer() { return renderer.get(); }
|
||||
|
||||
void reduceMemoryUse() {
|
||||
if (!renderer) return;
|
||||
renderer->reduceMemoryUse();
|
||||
}
|
||||
void reduceMemoryUse() {
|
||||
if (!renderer) return;
|
||||
renderer->reduceMemoryUse();
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<mbgl::Renderer> renderer;
|
||||
__weak MLNMapView *nativeView = nullptr;
|
||||
mbgl::gfx::RendererBackend& mbglBackend;
|
||||
std::shared_ptr<mbgl::UpdateParameters> updateParameters;
|
||||
std::optional<mbgl::util::AsyncTask> asyncInvalidate;
|
||||
private:
|
||||
std::unique_ptr<mbgl::Renderer> renderer;
|
||||
__weak MLNMapView* nativeView = nullptr;
|
||||
mbgl::gfx::RendererBackend& mbglBackend;
|
||||
std::shared_ptr<mbgl::UpdateParameters> updateParameters;
|
||||
std::optional<mbgl::util::AsyncTask> asyncInvalidate;
|
||||
};
|
||||
|
||||
@@ -9,18 +9,18 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
Well-known tile servers
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, MLNWellKnownTileServer) {
|
||||
/**
|
||||
Maptiler
|
||||
*/
|
||||
MLNMapTiler,
|
||||
/**
|
||||
MapLibre
|
||||
*/
|
||||
MLNMapLibre,
|
||||
/**
|
||||
Mapbox
|
||||
*/
|
||||
MLNMapbox
|
||||
/**
|
||||
Maptiler
|
||||
*/
|
||||
MLNMapTiler,
|
||||
/**
|
||||
MapLibre
|
||||
*/
|
||||
MLNMapLibre,
|
||||
/**
|
||||
Mapbox
|
||||
*/
|
||||
MLNMapbox
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ MLN_EXPORT
|
||||
and the type `String`. Alternatively, you may call this method from your
|
||||
application delegate’s `-applicationDidFinishLaunching:` method.
|
||||
*/
|
||||
@property (class, copy, nullable) NSString *apiKey;
|
||||
@property (class, copy, nullable) NSString* apiKey;
|
||||
|
||||
/**
|
||||
Instructs the SDk to use the give tile server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#import "MLNSettings.h"
|
||||
#import <mbgl/util/tile_server_options.hpp>
|
||||
#import <mbgl/util/default_style.hpp>
|
||||
#import <mbgl/util/tile_server_options.hpp>
|
||||
#import "MLNSettings.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNAnnotation.h"
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -56,7 +56,8 @@ MLN_EXPORT
|
||||
```swift
|
||||
let url = mainBundle.url(forResource: "amsterdam", withExtension: "geojson")!
|
||||
let data = try! Data(contentsOf: url)
|
||||
let feature = try! MLNShape(data: data, encoding: String.Encoding.utf8.rawValue) as! MLNShapeCollectionFeature
|
||||
let feature = try! MLNShape(data: data, encoding: String.Encoding.utf8.rawValue) as!
|
||||
MLNShapeCollectionFeature
|
||||
```
|
||||
|
||||
@param data String data containing GeoJSON source code.
|
||||
@@ -67,7 +68,9 @@ MLN_EXPORT
|
||||
not be parsed as valid GeoJSON source code. If `nil`, `outError` contains an
|
||||
`NSError` object describing the problem.
|
||||
*/
|
||||
+ (nullable MLNShape *)shapeWithData:(NSData *)data encoding:(NSStringEncoding)encoding error:(NSError * _Nullable *)outError;
|
||||
+ (nullable MLNShape *)shapeWithData:(NSData *)data
|
||||
encoding:(NSStringEncoding)encoding
|
||||
error:(NSError *_Nullable *)outError;
|
||||
|
||||
// MARK: Accessing the Shape Attributes
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
]
|
||||
|
||||
let triangle = MLNPolygon(coordinates: &coordinates, count: UInt(coordinates.count))
|
||||
let region = MLNShapeOfflineRegion(styleURL: MLNStyle.lightStyleURL, shape: triangle, fromZoomLevel: 11, toZoomLevel: 14)
|
||||
let context = "Triangle Region".data(using: .utf8)
|
||||
let region = MLNShapeOfflineRegion(styleURL: MLNStyle.lightStyleURL, shape: triangle,
|
||||
fromZoomLevel: 11, toZoomLevel: 14) let context = "Triangle Region".data(using: .utf8)
|
||||
MLNOfflineStorage.shared.addPack(for: region, withContext: context!)
|
||||
```
|
||||
|
||||
@@ -79,7 +79,10 @@ MLN_EXPORT
|
||||
level, the download covers zoom levels up to the tile source’s maximum zoom
|
||||
level.
|
||||
*/
|
||||
- (instancetype)initWithStyleURL:(nullable NSURL *)styleURL shape:(MLNShape *)shape fromZoomLevel:(double)minimumZoomLevel toZoomLevel:(double)maximumZoomLevel NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithStyleURL:(nullable NSURL *)styleURL
|
||||
shape:(MLNShape *)shape
|
||||
fromZoomLevel:(double)minimumZoomLevel
|
||||
toZoomLevel:(double)maximumZoomLevel NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@param definition A reference to an offline region definition backing the
|
||||
offline region.
|
||||
*/
|
||||
- (instancetype)initWithOfflineRegionDefinition:(const mbgl::OfflineGeometryRegionDefinition &)definition;
|
||||
- (instancetype)initWithOfflineRegionDefinition:
|
||||
(const mbgl::OfflineGeometryRegionDefinition &)definition;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNTypes.h"
|
||||
#import "MLNSource.h"
|
||||
#import "MLNTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -20,7 +20,8 @@ typedef NSString *MLNShapeSourceOption NS_STRING_ENUM;
|
||||
`YES` clusters the points by radius into groups. The default value is `NO`.
|
||||
|
||||
This option corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson-cluster"><code>cluster</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/#sources-geojson-cluster"><code>cluster</code></a>
|
||||
source property in the MapLibre Style Spec.
|
||||
|
||||
This option only affects point features within an `MLNShapeSource` object; it
|
||||
@@ -68,7 +69,8 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionClus
|
||||
```
|
||||
|
||||
This option corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson-clusterProperties"><code>clusterProperties</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/#sources-geojson-clusterProperties"><code>clusterProperties</code></a>
|
||||
source property in the MapLibre Style Spec.
|
||||
|
||||
This option only affects point features within an `MLNShapeSource` object; it
|
||||
@@ -82,20 +84,23 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionClus
|
||||
maximum zoom level, the shapes are not clustered.
|
||||
|
||||
This option corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson-clusterMaxZoom"><code>clusterMaxZoom</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/#sources-geojson-clusterMaxZoom"><code>clusterMaxZoom</code></a>
|
||||
source property in the MapLibre Style Spec.
|
||||
|
||||
This option only affects point features within an `MLNShapeSource` object; it
|
||||
is ignored when creating an `MLNComputedShapeSource` object.
|
||||
*/
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionMaximumZoomLevelForClustering;
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption
|
||||
MLNShapeSourceOptionMaximumZoomLevelForClustering;
|
||||
|
||||
/**
|
||||
An `NSNumber` object containing an integer; specifies the minimum zoom level at
|
||||
which to create vector tiles. The default value is 0.
|
||||
|
||||
This option corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson-minzoom"><code>minzoom</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/#sources-geojson-minzoom"><code>minzoom</code></a>
|
||||
source property in the MapLibre Style Spec.
|
||||
*/
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionMinimumZoomLevel;
|
||||
@@ -106,7 +111,8 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionMini
|
||||
zoom levels. The default value is 18.
|
||||
|
||||
This option corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson-maxzoom"><code>maxzoom</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/#sources-geojson-maxzoom"><code>maxzoom</code></a>
|
||||
source property in the MapLibre Style Spec.
|
||||
*/
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionMaximumZoomLevel;
|
||||
@@ -129,7 +135,8 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionBuff
|
||||
improves performance. The default value is 0.375.
|
||||
|
||||
This option corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson-tolerance"><code>tolerance</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/#sources-geojson-tolerance"><code>tolerance</code></a>
|
||||
source property in the MapLibre Style Spec.
|
||||
*/
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionSimplificationTolerance;
|
||||
@@ -137,11 +144,12 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionSimp
|
||||
/**
|
||||
An `NSNumber` object containing a Boolean enabling or disabling calculating line distance metrics.
|
||||
|
||||
Set this property to `YES` in order for the `MLNLineStyleLayer.lineGradient` property to have its intended effect.
|
||||
The default value is `NO`.
|
||||
Set this property to `YES` in order for the `MLNLineStyleLayer.lineGradient` property to have its
|
||||
intended effect. The default value is `NO`.
|
||||
|
||||
This option corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/sources/#geojson-lineMetrics"><code>lineMetrics</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/sources/#geojson-lineMetrics"><code>lineMetrics</code></a>
|
||||
source property in the MapLibre Style Spec.
|
||||
*/
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionLineDistanceMetrics;
|
||||
@@ -215,7 +223,10 @@ MLN_EXPORT
|
||||
TODO: Add live data, learn how to add live data to your map by
|
||||
updating the an `MLNShapeSource` object's `URL` property.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
URL:(NSURL *)url
|
||||
options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
Returns a shape source with an identifier, a shape, and dictionary of options
|
||||
@@ -248,7 +259,10 @@ MLN_EXPORT
|
||||
TODO: Animate a line, learn how to animate line data by continously
|
||||
updating an `MLNShapeSource`'s `shape` attribute.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MLNShape *)shape options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
shape:(nullable MLNShape *)shape
|
||||
options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
Returns a shape source with an identifier, an array of features, and a dictionary
|
||||
@@ -275,7 +289,9 @@ MLN_EXPORT
|
||||
@param options An `NSDictionary` of options for this source.
|
||||
@return An initialized shape source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier features:(NSArray<MLNShape<MLNFeature> *> *)features options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
features:(NSArray<MLNShape<MLNFeature> *> *)features
|
||||
options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options;
|
||||
|
||||
/**
|
||||
Returns a shape source with an identifier, an array of shapes, and a dictionary of
|
||||
@@ -303,7 +319,9 @@ MLN_EXPORT
|
||||
@param options An `NSDictionary` of options for this source.
|
||||
@return An initialized shape source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier shapes:(NSArray<MLNShape *> *)shapes options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
shapes:(NSArray<MLNShape *> *)shapes
|
||||
options:(nullable NSDictionary<MLNShapeSourceOption, id> *)options;
|
||||
|
||||
// MARK: Accessing a Source’s Content
|
||||
|
||||
@@ -356,7 +374,7 @@ MLN_EXPORT
|
||||
@return An array of objects conforming to the `MLNFeature` protocol that
|
||||
represent features in the source that match the predicate.
|
||||
*/
|
||||
- (NSArray<id <MLNFeature>> *)featuresMatchingPredicate:(nullable NSPredicate *)predicate;
|
||||
- (NSArray<id<MLNFeature>> *)featuresMatchingPredicate:(nullable NSPredicate *)predicate;
|
||||
|
||||
/**
|
||||
Returns an array of map features that are the leaves of the specified cluster.
|
||||
@@ -365,20 +383,24 @@ MLN_EXPORT
|
||||
This method supports pagination; you supply an offset (number of features to skip)
|
||||
and a maximum number of features to return.
|
||||
|
||||
@param cluster An object of type `MLNPointFeatureCluster` (that conforms to the `MLNCluster` protocol).
|
||||
@param cluster An object of type `MLNPointFeatureCluster` (that conforms to the `MLNCluster`
|
||||
protocol).
|
||||
@param offset Number of features to skip.
|
||||
@param limit The maximum number of features to return
|
||||
|
||||
@return An array of objects that conform to the `MLNFeature` protocol.
|
||||
*/
|
||||
- (NSArray<id <MLNFeature>> *)leavesOfCluster:(MLNPointFeatureCluster *)cluster offset:(NSUInteger)offset limit:(NSUInteger)limit;
|
||||
- (NSArray<id<MLNFeature>> *)leavesOfCluster:(MLNPointFeatureCluster *)cluster
|
||||
offset:(NSUInteger)offset
|
||||
limit:(NSUInteger)limit;
|
||||
|
||||
/**
|
||||
Returns an array of map features that are the immediate children of the specified
|
||||
cluster *on the next zoom level*. The may include features that also conform to
|
||||
the `MLNCluster` protocol (currently only objects of type `MLNPointFeatureCluster`).
|
||||
|
||||
@param cluster An object of type `MLNPointFeatureCluster` (that conforms to the `MLNCluster` protocol).
|
||||
@param cluster An object of type `MLNPointFeatureCluster` (that conforms to the `MLNCluster`
|
||||
protocol).
|
||||
|
||||
@return An array of objects that conform to the `MLNFeature` protocol.
|
||||
|
||||
@@ -391,7 +413,8 @@ MLN_EXPORT
|
||||
/**
|
||||
Returns the zoom level at which the given cluster expands.
|
||||
|
||||
@param cluster An object of type `MLNPointFeatureCluster` (that conforms to the `MLNCluster` protocol).
|
||||
@param cluster An object of type `MLNPointFeatureCluster` (that conforms to the `MLNCluster`
|
||||
protocol).
|
||||
|
||||
@return Zoom level. This should be >= 0; any negative return value should be
|
||||
considered an error.
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
#include <mbgl/util/immutable.hpp>
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNShapeSource.h"
|
||||
#include <mbgl/util/immutable.hpp>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
struct GeoJSONOptions;
|
||||
}
|
||||
namespace style {
|
||||
struct GeoJSONOptions;
|
||||
}
|
||||
} // namespace mbgl
|
||||
|
||||
MLN_EXPORT
|
||||
mbgl::Immutable<mbgl::style::GeoJSONOptions> MLNGeoJSONOptionsFromDictionary(NSDictionary<MLNShapeSourceOption, id> *options);
|
||||
mbgl::Immutable<mbgl::style::GeoJSONOptions> MLNGeoJSONOptionsFromDictionary(
|
||||
NSDictionary<MLNShapeSourceOption, id> *options);
|
||||
|
||||
@interface MLNShapeSource (Private)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#import "MLNShape.h"
|
||||
|
||||
#import <mbgl/util/geo.hpp>
|
||||
#import <mbgl/util/geojson.hpp>
|
||||
#import <mbgl/util/geometry.hpp>
|
||||
#import <mbgl/util/geo.hpp>
|
||||
|
||||
bool operator==(const CLLocationCoordinate2D lhs, const CLLocationCoordinate2D rhs);
|
||||
|
||||
|
||||
@@ -2,23 +2,22 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MLNStylable;
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
class Source;
|
||||
}
|
||||
namespace style {
|
||||
class Source;
|
||||
}
|
||||
} // namespace mbgl
|
||||
|
||||
// A struct to be stored in the `peer` member of mbgl::style::Source, in order to implement
|
||||
// object identity. We don't store a MLNSource pointer directly because that doesn't
|
||||
// interoperate with ARC. The inner pointer is weak in order to avoid a reference cycle for
|
||||
// "pending" MLNSources, which have a strong owning pointer to the mbgl::style::Source.
|
||||
struct SourceWrapper {
|
||||
__weak MLNSource *source;
|
||||
__weak MLNSource *source;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -27,13 +26,13 @@ struct SourceWrapper {
|
||||
This macro should be used at the beginning of any public-facing instance method
|
||||
of `MLNSource` and its subclasses. For private methods, an assertion is more appropriate.
|
||||
*/
|
||||
#define MLNAssertStyleSourceIsValid() \
|
||||
do { \
|
||||
if (!self.rawSource) { \
|
||||
[NSException raise:MLNInvalidStyleSourceException \
|
||||
format:@"This source got invalidated after the style change"]; \
|
||||
} \
|
||||
} while (NO);
|
||||
#define MLNAssertStyleSourceIsValid() \
|
||||
do { \
|
||||
if (!self.rawSource) { \
|
||||
[NSException raise:MLNInvalidStyleSourceException \
|
||||
format:@"This source got invalidated after the style change"]; \
|
||||
} \
|
||||
} while (NO);
|
||||
|
||||
@class MLNMapView;
|
||||
|
||||
@@ -43,7 +42,8 @@ do { \
|
||||
Initializes and returns a source with a raw pointer to the backing store,
|
||||
associated with a style.
|
||||
*/
|
||||
- (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource stylable:(nullable id <MLNStylable>)stylable;
|
||||
- (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource
|
||||
stylable:(nullable id<MLNStylable>)stylable;
|
||||
|
||||
/**
|
||||
Initializes and returns a source with an owning pointer to the backing store,
|
||||
@@ -66,7 +66,7 @@ do { \
|
||||
If the source is not currently part of any stylable object’s style, this
|
||||
property is set to `nil`.
|
||||
*/
|
||||
@property (nonatomic, readonly, weak) id <MLNStylable> stylable;
|
||||
@property (nonatomic, readonly, weak) id<MLNStylable> stylable;
|
||||
|
||||
/**
|
||||
Adds the mbgl source that this object represents to the mbgl map.
|
||||
@@ -77,7 +77,7 @@ do { \
|
||||
is added back to the map via `-[MLNStyle addSource:]` and styled with a
|
||||
`MLNLayer`.
|
||||
*/
|
||||
- (void)addToStylable:(id <MLNStylable>)mapView;
|
||||
- (void)addToStylable:(id<MLNStylable>)mapView;
|
||||
|
||||
/**
|
||||
Removes the mbgl source that this object represents from the mbgl map.
|
||||
@@ -85,7 +85,7 @@ do { \
|
||||
to the `MLNSource` instance and the unique_ptr reference is valid again. It is
|
||||
safe to add the source back to the style after it is removed.
|
||||
*/
|
||||
- (BOOL)removeFromStylable:(id <MLNStylable>)mapView error:(NSError * __nullable * __nullable)outError;
|
||||
- (BOOL)removeFromStylable:(id<MLNStylable>)mapView error:(NSError *__nullable *__nullable)outError;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
#import "MLNTypes.h"
|
||||
|
||||
#import "MLNDefaultStyle.h"
|
||||
#import "MLNSettings.h"
|
||||
#import "MLNTileServerOptions.h"
|
||||
#import "MLNDefaultStyle.h"
|
||||
|
||||
@class MLNSource;
|
||||
@class MLNLight;
|
||||
@@ -43,23 +43,23 @@ MLN_EXPORT
|
||||
/**
|
||||
Returns list of predefined styles
|
||||
*/
|
||||
+ (NSArray<MLNDefaultStyle*>*) predefinedStyles;
|
||||
+ (NSArray<MLNDefaultStyle *> *)predefinedStyles;
|
||||
|
||||
/**
|
||||
Returns default style
|
||||
*/
|
||||
+ (MLNDefaultStyle*) defaultStyle;
|
||||
+ (MLNDefaultStyle *)defaultStyle;
|
||||
|
||||
/**
|
||||
Returns default style as NSURL
|
||||
*/
|
||||
+ (nullable NSURL*) defaultStyleURL;
|
||||
+ (nullable NSURL *)defaultStyleURL;
|
||||
|
||||
/** Get predefined style by name
|
||||
|
||||
@param withStyleName style name.
|
||||
*/
|
||||
+ (nullable MLNDefaultStyle*) predefinedStyle:(NSString*)withStyleName;
|
||||
+ (nullable MLNDefaultStyle *)predefinedStyle:(NSString *)withStyleName;
|
||||
|
||||
// MARK: Accessing Metadata About the Style
|
||||
|
||||
@@ -156,8 +156,7 @@ MLN_EXPORT
|
||||
@return `YES` if `source` was removed successfully. If `NO`, `outError` contains
|
||||
an `NSError` object describing the problem.
|
||||
*/
|
||||
- (BOOL)removeSource:(MLNSource *)source error:(NSError * __nullable * __nullable)outError;
|
||||
|
||||
- (BOOL)removeSource:(MLNSource *)source error:(NSError *__nullable *__nullable)outError;
|
||||
|
||||
// MARK: Managing Style Layers
|
||||
|
||||
@@ -335,7 +334,6 @@ MLN_EXPORT
|
||||
*/
|
||||
- (void)removeImageForName:(NSString *)name;
|
||||
|
||||
|
||||
// MARK: Managing the Style's Light
|
||||
|
||||
/**
|
||||
@@ -350,10 +348,10 @@ MLN_EXPORT
|
||||
|
||||
This method automatically modifies the text property of any symbol style layer
|
||||
in the style whose source is the
|
||||
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets-v8/#overview">Mapbox Streets source</a>.
|
||||
On iOS, the user can set the system’s preferred language in Settings, General
|
||||
Settings, Language & Region. On macOS, the user can set the system’s preferred
|
||||
language in the Language & Region pane of System Preferences.
|
||||
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets-v8/#overview">Mapbox Streets
|
||||
source</a>. On iOS, the user can set the system’s preferred language in Settings, General Settings,
|
||||
Language & Region. On macOS, the user can set the system’s preferred language in the Language &
|
||||
Region pane of System Preferences.
|
||||
|
||||
@param locale The locale into which labels should be localized. To use the
|
||||
system’s preferred language, if supported, specify `nil`. To use the local
|
||||
|
||||
@@ -29,7 +29,8 @@ MLN_EXPORT
|
||||
|
||||
// MARK: Initializing a Style Layer
|
||||
|
||||
- (instancetype)init __attribute__((unavailable("Use -init methods of concrete subclasses instead.")));
|
||||
- (instancetype)init
|
||||
__attribute__((unavailable("Use -init methods of concrete subclasses instead.")));
|
||||
|
||||
// MARK: Identifying a Style Layer
|
||||
|
||||
@@ -51,12 +52,14 @@ MLN_EXPORT
|
||||
@property (nonatomic, assign, getter=isVisible) BOOL visible;
|
||||
|
||||
/**
|
||||
The maximum zoom level at which the layer gets parsed and appears. This value is a floating-point number.
|
||||
The maximum zoom level at which the layer gets parsed and appears. This value is a floating-point
|
||||
number.
|
||||
*/
|
||||
@property (nonatomic, assign) float maximumZoomLevel;
|
||||
|
||||
/**
|
||||
The minimum zoom level at which the layer gets parsed and appears. This value is a floating-point number.
|
||||
The minimum zoom level at which the layer gets parsed and appears. This value is a floating-point
|
||||
number.
|
||||
*/
|
||||
@property (nonatomic, assign) float minimumZoomLevel;
|
||||
|
||||
|
||||
@@ -44,4 +44,4 @@ private:
|
||||
std::map<std::string, LayerFactory*> typeToFactory;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
// interoperate with ARC. The inner pointer is weak in order to avoid a reference cycle for
|
||||
// "pending" MLNStyleLayers, which have a strong owning pointer to the mbgl::style::Layer.
|
||||
struct LayerWrapper {
|
||||
__weak MLNStyleLayer *layer;
|
||||
__weak MLNStyleLayer *layer;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -22,19 +22,19 @@ struct LayerWrapper {
|
||||
This macro should be used at the beginning of any public-facing instance method
|
||||
of `MLNStyleLayer` and its subclasses. For private methods, an assertion is more appropriate.
|
||||
*/
|
||||
#define MLNAssertStyleLayerIsValid() \
|
||||
do { \
|
||||
if (!self.rawLayer) { \
|
||||
[NSException raise:MLNInvalidStyleLayerException \
|
||||
format: \
|
||||
@"Either this layer got invalidated after the style change or " \
|
||||
@"-[MLNStyle removeLayer:] has been called " \
|
||||
@"with this instance but another style layer instance was added with the same identifer. It is an " \
|
||||
@"error to send any message to this layer since it cannot be recovered after removal due to the " \
|
||||
@"identifier collision. Use unique identifiers for all layer instances including layers of " \
|
||||
@"different types."]; \
|
||||
} \
|
||||
} while (NO);
|
||||
#define MLNAssertStyleLayerIsValid() \
|
||||
do { \
|
||||
if (!self.rawLayer) { \
|
||||
[NSException raise:MLNInvalidStyleLayerException \
|
||||
format:@"Either this layer got invalidated after the style change or " \
|
||||
@"-[MLNStyle removeLayer:] has been called with this instance but " \
|
||||
@"another style layer instance was added with the same identifer. " \
|
||||
@"It is an error to send any message to this layer since it cannot " \
|
||||
@"be recovered after removal due to the identifier collision. " \
|
||||
@"Use unique identifiers for all layer instances including layers " \
|
||||
@"of different types."]; \
|
||||
} \
|
||||
} while (NO);
|
||||
|
||||
@class MLNStyle;
|
||||
|
||||
@@ -87,16 +87,16 @@ struct LayerWrapper {
|
||||
namespace mbgl {
|
||||
|
||||
class LayerPeerFactory {
|
||||
public:
|
||||
virtual ~LayerPeerFactory() = default;
|
||||
/**
|
||||
Get the corresponding core layer factory.
|
||||
*/
|
||||
virtual LayerFactory* getCoreLayerFactory() = 0;
|
||||
/**
|
||||
Creates an MLNStyleLayer instance with a raw pointer to the backing store.
|
||||
*/
|
||||
virtual MLNStyleLayer* createPeer(style::Layer*) = 0;
|
||||
public:
|
||||
virtual ~LayerPeerFactory() = default;
|
||||
/**
|
||||
Get the corresponding core layer factory.
|
||||
*/
|
||||
virtual LayerFactory *getCoreLayerFactory() = 0;
|
||||
/**
|
||||
Creates an MLNStyleLayer instance with a raw pointer to the backing store.
|
||||
*/
|
||||
virtual MLNStyleLayer *createPeer(style::Layer *) = 0;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNTypes.h"
|
||||
@@ -8,15 +8,24 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NSString *MLNStyleFunctionOption NS_STRING_ENUM NS_UNAVAILABLE;
|
||||
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNStyleFunctionOption MLNStyleFunctionOptionInterpolationBase __attribute__((unavailable("Use NSExpression instead, applying the mgl_interpolate:withCurveType:parameters:stops: function with a curve type of “exponential” and a non-nil parameter.")));
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNStyleFunctionOption MLNStyleFunctionOptionInterpolationBase
|
||||
__attribute__((unavailable(
|
||||
"Use NSExpression instead, applying the mgl_interpolate:withCurveType:parameters:stops: "
|
||||
"function with a curve type of “exponential” and a non-nil parameter.")));
|
||||
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNStyleFunctionOption MLNStyleFunctionOptionDefaultValue __attribute__((unavailable("Use +[NSExpression expressionForConditional:trueExpression:falseExpression:] instead.")));
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNStyleFunctionOption MLNStyleFunctionOptionDefaultValue
|
||||
__attribute__((unavailable(
|
||||
"Use +[NSExpression expressionForConditional:trueExpression:falseExpression:] instead.")));
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MLNInterpolationMode) {
|
||||
MLNInterpolationModeExponential __attribute__((unavailable("Use NSExpression instead, applying the mgl_interpolate:withCurveType:parameters:stops: function with a curve type of “exponential”."))) = 0,
|
||||
MLNInterpolationModeInterval __attribute__((unavailable("Use NSExpression instead, calling the mgl_step:from:stops: function."))),
|
||||
MLNInterpolationModeCategorical __attribute__((unavailable("Use NSExpression instead."))),
|
||||
MLNInterpolationModeIdentity __attribute__((unavailable("Use +[NSExpression expressionForKeyPath:] instead.")))
|
||||
MLNInterpolationModeExponential __attribute__((unavailable(
|
||||
"Use NSExpression instead, applying the mgl_interpolate:withCurveType:parameters:stops: "
|
||||
"function with a curve type of “exponential”."))) = 0,
|
||||
MLNInterpolationModeInterval __attribute__((
|
||||
unavailable("Use NSExpression instead, calling the mgl_step:from:stops: function."))),
|
||||
MLNInterpolationModeCategorical __attribute__((unavailable("Use NSExpression instead."))),
|
||||
MLNInterpolationModeIdentity
|
||||
__attribute__((unavailable("Use +[NSExpression expressionForKeyPath:] instead.")))
|
||||
} __attribute__((unavailable("Use NSExpression instead.")));
|
||||
|
||||
MLN_EXPORT __attribute__((unavailable("Use NSExpression instead.")))
|
||||
@@ -29,19 +38,27 @@ MLN_EXPORT __attribute__((unavailable("Use +[NSExpression expressionForConstantV
|
||||
|
||||
@compatibility_alias MLNStyleConstantValue MLNConstantStyleValue;
|
||||
|
||||
MLN_EXPORT __attribute__((unavailable("Use NSExpression instead, calling the mgl_step:from:stops: or mgl_interpolate:withCurveType:parameters:stops: function.")))
|
||||
MLN_EXPORT
|
||||
__attribute__((unavailable("Use NSExpression instead, calling the mgl_step:from:stops: or "
|
||||
"mgl_interpolate:withCurveType:parameters:stops: function.")))
|
||||
@interface MLNStyleFunction<T> : MLNStyleValue<T>
|
||||
@end
|
||||
|
||||
MLN_EXPORT __attribute__((unavailable("Use NSExpression instead, applying the mgl_step:from:stops: or mgl_interpolate:withCurveType:parameters:stops: function to the $zoomLevel variable.")))
|
||||
MLN_EXPORT __attribute__((unavailable(
|
||||
"Use NSExpression instead, applying the mgl_step:from:stops: or "
|
||||
"mgl_interpolate:withCurveType:parameters:stops: function to the $zoomLevel variable.")))
|
||||
@interface MLNCameraStyleFunction<T> : MLNStyleFunction<T>
|
||||
@end
|
||||
|
||||
MLN_EXPORT __attribute__((unavailable("Use NSExpression instead, applying the mgl_step:from:stops: or mgl_interpolate:withCurveType:parameters:stops: function to a key path expression.")))
|
||||
MLN_EXPORT __attribute__((unavailable(
|
||||
"Use NSExpression instead, applying the mgl_step:from:stops: or "
|
||||
"mgl_interpolate:withCurveType:parameters:stops: function to a key path expression.")))
|
||||
@interface MLNSourceStyleFunction<T> : MLNStyleFunction<T>
|
||||
@end
|
||||
|
||||
MLN_EXPORT __attribute__((unavailable("Use a NSExpression instead with nested mgl_step:from:stops: or mgl_interpolate:withCurveType:parameters:stops: function calls.")))
|
||||
MLN_EXPORT
|
||||
__attribute__((unavailable("Use a NSExpression instead with nested mgl_step:from:stops: or "
|
||||
"mgl_interpolate:withCurveType:parameters:stops: function calls.")))
|
||||
@interface MLNCompositeStyleFunction<T> : MLNStyleFunction<T>
|
||||
@end
|
||||
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
|
||||
#import "MLNStyleValue.h"
|
||||
|
||||
#import "NSValue+MLNStyleAttributeAdditions.h"
|
||||
#import "NSValue+MLNAdditions.h"
|
||||
#import "NSExpression+MLNPrivateAdditions.h"
|
||||
#import "NSDate+MLNAdditions.h"
|
||||
#import "MLNTypes.h"
|
||||
#import "NSDate+MLNAdditions.h"
|
||||
#import "NSExpression+MLNPrivateAdditions.h"
|
||||
#import "NSValue+MLNAdditions.h"
|
||||
#import "NSValue+MLNStyleAttributeAdditions.h"
|
||||
|
||||
#import "MLNConversion.h"
|
||||
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
|
||||
#include <mbgl/style/conversion/property_value.hpp>
|
||||
#include <mbgl/style/conversion/position.hpp>
|
||||
#include <mbgl/style/conversion/property_value.hpp>
|
||||
#include <mbgl/style/expression/dsl.hpp>
|
||||
#import <mbgl/style/transition_options.hpp>
|
||||
#import <mbgl/style/types.hpp>
|
||||
#import "MLNConversion.h"
|
||||
|
||||
#import <mbgl/util/enum.hpp>
|
||||
#include <mbgl/util/interpolate.hpp>
|
||||
@@ -22,329 +22,323 @@
|
||||
#include <memory>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#import "UIColor+MLNAdditions.h"
|
||||
#import "UIColor+MLNAdditions.h"
|
||||
#else
|
||||
#import "NSColor+MLNAdditions.h"
|
||||
#import "NSColor+MLNAdditions.h"
|
||||
#endif
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
namespace expression {
|
||||
class Expression;
|
||||
}
|
||||
}
|
||||
namespace style {
|
||||
namespace expression {
|
||||
class Expression;
|
||||
}
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
id MLNJSONObjectFromMBGLValue(const mbgl::Value &value);
|
||||
|
||||
NS_INLINE MLNTransition MLNTransitionFromOptions(const mbgl::style::TransitionOptions& options) {
|
||||
MLNTransition transition;
|
||||
transition.duration = MLNTimeIntervalFromDuration(options.duration.value_or(mbgl::Duration::zero()));
|
||||
transition.delay = MLNTimeIntervalFromDuration(options.delay.value_or(mbgl::Duration::zero()));
|
||||
NS_INLINE MLNTransition MLNTransitionFromOptions(const mbgl::style::TransitionOptions &options) {
|
||||
MLNTransition transition;
|
||||
transition.duration =
|
||||
MLNTimeIntervalFromDuration(options.duration.value_or(mbgl::Duration::zero()));
|
||||
transition.delay = MLNTimeIntervalFromDuration(options.delay.value_or(mbgl::Duration::zero()));
|
||||
|
||||
return transition;
|
||||
return transition;
|
||||
}
|
||||
|
||||
NS_INLINE mbgl::style::TransitionOptions MLNOptionsFromTransition(MLNTransition transition) {
|
||||
mbgl::style::TransitionOptions options { { MLNDurationFromTimeInterval(transition.duration) }, { MLNDurationFromTimeInterval(transition.delay) } };
|
||||
return options;
|
||||
mbgl::style::TransitionOptions options{{MLNDurationFromTimeInterval(transition.duration)},
|
||||
{MLNDurationFromTimeInterval(transition.delay)}};
|
||||
return options;
|
||||
}
|
||||
|
||||
std::unique_ptr<mbgl::style::expression::Expression> MLNClusterPropertyFromNSExpression(NSExpression *expression);
|
||||
std::unique_ptr<mbgl::style::expression::Expression> MLNClusterPropertyFromNSExpression(
|
||||
NSExpression *expression);
|
||||
|
||||
id MLNJSONObjectFromMBGLExpression(const mbgl::style::expression::Expression &mbglExpression);
|
||||
|
||||
template <typename MBGLType, typename ObjCType, typename MBGLElement = MBGLType, typename ObjCEnum = ObjCType>
|
||||
template <typename MBGLType, typename ObjCType, typename MBGLElement = MBGLType,
|
||||
typename ObjCEnum = ObjCType>
|
||||
class MLNStyleValueTransformer {
|
||||
public:
|
||||
public:
|
||||
/// Convert an mbgl property value into an mgl style value
|
||||
NSExpression *toExpression(const mbgl::style::PropertyValue<MBGLType> &mbglValue) {
|
||||
PropertyExpressionEvaluator evaluator;
|
||||
return mbglValue.evaluate(evaluator);
|
||||
}
|
||||
|
||||
/// Convert an mbgl property value into an mgl style value
|
||||
NSExpression *toExpression(const mbgl::style::PropertyValue<MBGLType> &mbglValue) {
|
||||
PropertyExpressionEvaluator evaluator;
|
||||
return mbglValue.evaluate(evaluator);
|
||||
// Convert an mbgl heatmap color property value into an mgl style value
|
||||
NSExpression *toExpression(const mbgl::style::ColorRampPropertyValue &mbglValue) {
|
||||
if (mbglValue.isUndefined()) {
|
||||
return nil;
|
||||
}
|
||||
return [NSExpression
|
||||
expressionWithMLNJSONObject:MLNJSONObjectFromMBGLExpression(mbglValue.getExpression())];
|
||||
}
|
||||
|
||||
/**
|
||||
Converts an NSExpression to an mbgl property value.
|
||||
*/
|
||||
template <typename MBGLValue>
|
||||
typename std::enable_if_t<!std::is_same<MBGLValue, mbgl::style::ColorRampPropertyValue>::value,
|
||||
MBGLValue>
|
||||
toPropertyValue(NSExpression *expression, bool allowDataExpressions) {
|
||||
if (!expression) {
|
||||
return {};
|
||||
}
|
||||
|
||||
// Convert an mbgl heatmap color property value into an mgl style value
|
||||
NSExpression *toExpression(const mbgl::style::ColorRampPropertyValue &mbglValue) {
|
||||
if (mbglValue.isUndefined()) {
|
||||
return nil;
|
||||
}
|
||||
return [NSExpression expressionWithMLNJSONObject:MLNJSONObjectFromMBGLExpression(mbglValue.getExpression())];
|
||||
if (expression.expressionType == NSConstantValueExpressionType) {
|
||||
MBGLType mbglValue;
|
||||
getMBGLValue(expression.constantValue, mbglValue);
|
||||
return mbglValue;
|
||||
}
|
||||
if (expression.expressionType == NSAggregateExpressionType) {
|
||||
MBGLType mbglValue;
|
||||
getMBGLValue(expression.collection, mbglValue);
|
||||
return mbglValue;
|
||||
}
|
||||
|
||||
/**
|
||||
Converts an NSExpression to an mbgl property value.
|
||||
*/
|
||||
template <typename MBGLValue>
|
||||
typename std::enable_if_t<!std::is_same<MBGLValue, mbgl::style::ColorRampPropertyValue>::value,
|
||||
MBGLValue> toPropertyValue(NSExpression *expression, bool allowDataExpressions) {
|
||||
if (!expression) {
|
||||
return {};
|
||||
}
|
||||
NSArray *jsonExpression = expression.mgl_jsonExpressionObject;
|
||||
|
||||
if (expression.expressionType == NSConstantValueExpressionType) {
|
||||
MBGLType mbglValue;
|
||||
getMBGLValue(expression.constantValue, mbglValue);
|
||||
return mbglValue;
|
||||
}
|
||||
if (expression.expressionType == NSAggregateExpressionType) {
|
||||
MBGLType mbglValue;
|
||||
getMBGLValue(expression.collection, mbglValue);
|
||||
return mbglValue;
|
||||
}
|
||||
|
||||
NSArray *jsonExpression = expression.mgl_jsonExpressionObject;
|
||||
|
||||
mbgl::style::conversion::Error valueError;
|
||||
auto value = mbgl::style::conversion::convert<MBGLValue>(
|
||||
mbgl::style::conversion::makeConvertible(jsonExpression), valueError, allowDataExpressions, false);
|
||||
if (!value) {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"Invalid property value: %@", @(valueError.message.c_str())];
|
||||
return {};
|
||||
}
|
||||
|
||||
return *value;
|
||||
mbgl::style::conversion::Error valueError;
|
||||
auto value = mbgl::style::conversion::convert<MBGLValue>(
|
||||
mbgl::style::conversion::makeConvertible(jsonExpression), valueError, allowDataExpressions,
|
||||
false);
|
||||
if (!value) {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"Invalid property value: %@", @(valueError.message.c_str())];
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
Converts an NSExpression to an mbgl property value.
|
||||
*/
|
||||
template <typename MBGLValue>
|
||||
typename std::enable_if_t<std::is_same<MBGLValue, mbgl::style::ColorRampPropertyValue>::value,
|
||||
MBGLValue> toPropertyValue(NSExpression *expression) {
|
||||
if (!expression) {
|
||||
return {};
|
||||
}
|
||||
return *value;
|
||||
}
|
||||
|
||||
NSArray *jsonExpression = expression.mgl_jsonExpressionObject;
|
||||
|
||||
mbgl::style::conversion::Error valueError;
|
||||
auto value = mbgl::style::conversion::convert<mbgl::style::ColorRampPropertyValue>(
|
||||
mbgl::style::conversion::makeConvertible(jsonExpression), valueError);
|
||||
if (!value) {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"Invalid property value: %@", @(valueError.message.c_str())];
|
||||
return {};
|
||||
}
|
||||
|
||||
return *value;
|
||||
/**
|
||||
Converts an NSExpression to an mbgl property value.
|
||||
*/
|
||||
template <typename MBGLValue>
|
||||
typename std::enable_if_t<std::is_same<MBGLValue, mbgl::style::ColorRampPropertyValue>::value,
|
||||
MBGLValue>
|
||||
toPropertyValue(NSExpression *expression) {
|
||||
if (!expression) {
|
||||
return {};
|
||||
}
|
||||
|
||||
private: // Private utilities for converting from mgl to mbgl values
|
||||
NSArray *jsonExpression = expression.mgl_jsonExpressionObject;
|
||||
|
||||
/**
|
||||
As hack to allow converting enum => string values, we accept a second, dummy parameter in
|
||||
the toRawStyleSpecValue() methods for converting 'atomic' (non-style-function) values.
|
||||
This allows us to use `std::enable_if` to test (at compile time) whether or not MBGLType is an Enum.
|
||||
*/
|
||||
template <typename MBGLEnum = MBGLType,
|
||||
class = typename std::enable_if<!std::is_enum<MBGLEnum>::value>::type,
|
||||
typename MLNEnum = ObjCEnum,
|
||||
class = typename std::enable_if<!std::is_enum<MLNEnum>::value>::type>
|
||||
NSObject* toRawStyleSpecValue(NSObject *rawMLNValue, MBGLEnum &) {
|
||||
if ([rawMLNValue isKindOfClass:[NSValue class]]) {
|
||||
const auto rawNSValue = (NSValue *)rawMLNValue;
|
||||
if (strcmp([rawNSValue objCType], @encode(CGVector)) == 0) {
|
||||
// offset [x, y]
|
||||
std::array<float, 2> mglValue = rawNSValue.mgl_offsetArrayValue;
|
||||
return [NSArray arrayWithObjects:@(mglValue[0]), @(mglValue[1]), nil];
|
||||
}
|
||||
}
|
||||
// noop pass-through plain NSObject-based items
|
||||
return rawMLNValue;
|
||||
mbgl::style::conversion::Error valueError;
|
||||
auto value = mbgl::style::conversion::convert<mbgl::style::ColorRampPropertyValue>(
|
||||
mbgl::style::conversion::makeConvertible(jsonExpression), valueError);
|
||||
if (!value) {
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"Invalid property value: %@", @(valueError.message.c_str())];
|
||||
return {};
|
||||
}
|
||||
|
||||
template <typename MBGLEnum = MBGLType,
|
||||
class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type,
|
||||
typename MLNEnum = ObjCEnum,
|
||||
class = typename std::enable_if<std::is_enum<MLNEnum>::value>::type>
|
||||
NSString* toRawStyleSpecValue(ObjCType rawValue, MBGLEnum &) {
|
||||
MLNEnum mglEnum;
|
||||
[rawValue getValue:&mglEnum];
|
||||
return @(mbgl::Enum<MLNEnum>::toString(mglEnum));
|
||||
return *value;
|
||||
}
|
||||
|
||||
private: // Private utilities for converting from mgl to mbgl values
|
||||
/**
|
||||
As hack to allow converting enum => string values, we accept a second, dummy parameter in
|
||||
the toRawStyleSpecValue() methods for converting 'atomic' (non-style-function) values.
|
||||
This allows us to use `std::enable_if` to test (at compile time) whether or not MBGLType is an
|
||||
Enum.
|
||||
*/
|
||||
template <typename MBGLEnum = MBGLType,
|
||||
class = typename std::enable_if<!std::is_enum<MBGLEnum>::value>::type,
|
||||
typename MLNEnum = ObjCEnum,
|
||||
class = typename std::enable_if<!std::is_enum<MLNEnum>::value>::type>
|
||||
NSObject *toRawStyleSpecValue(NSObject *rawMLNValue, MBGLEnum &) {
|
||||
if ([rawMLNValue isKindOfClass:[NSValue class]]) {
|
||||
const auto rawNSValue = (NSValue *)rawMLNValue;
|
||||
if (strcmp([rawNSValue objCType], @encode(CGVector)) == 0) {
|
||||
// offset [x, y]
|
||||
std::array<float, 2> mglValue = rawNSValue.mgl_offsetArrayValue;
|
||||
return [NSArray arrayWithObjects:@(mglValue[0]), @(mglValue[1]), nil];
|
||||
}
|
||||
}
|
||||
// noop pass-through plain NSObject-based items
|
||||
return rawMLNValue;
|
||||
}
|
||||
|
||||
template <typename MBGLEnum = MBGLType,
|
||||
class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type,
|
||||
typename MLNEnum = ObjCEnum,
|
||||
class = typename std::enable_if<std::is_enum<MLNEnum>::value>::type>
|
||||
NSString *toRawStyleSpecValue(ObjCType rawValue, MBGLEnum &) {
|
||||
MLNEnum mglEnum;
|
||||
[rawValue getValue:&mglEnum];
|
||||
return @(mbgl::Enum<MLNEnum>::toString(mglEnum));
|
||||
}
|
||||
|
||||
NSObject *toRawStyleSpecValue(MLNColor *color, MBGLType &) {
|
||||
return @(color.mgl_color.stringify().c_str());
|
||||
}
|
||||
|
||||
// Bool
|
||||
void getMBGLValue(NSNumber *rawValue, bool &mbglValue) { mbglValue = !!rawValue.boolValue; }
|
||||
|
||||
// Float
|
||||
void getMBGLValue(NSNumber *rawValue, float &mbglValue) { mbglValue = rawValue.floatValue; }
|
||||
|
||||
// String
|
||||
void getMBGLValue(NSString *rawValue, std::string &mbglValue) { mbglValue = rawValue.UTF8String; }
|
||||
|
||||
// Formatted
|
||||
void getMBGLValue(NSString *rawValue, mbgl::style::expression::Formatted &mbglValue) {
|
||||
mbglValue = mbgl::style::expression::Formatted(rawValue.UTF8String);
|
||||
}
|
||||
|
||||
// Offsets
|
||||
void getMBGLValue(id rawValue, std::array<float, 2> &mbglValue) {
|
||||
if ([rawValue isKindOfClass:[NSValue class]]) {
|
||||
mbglValue = [rawValue mgl_offsetArrayValue];
|
||||
} else if ([rawValue isKindOfClass:[NSArray class]]) {
|
||||
NSArray *array = (NSArray *)rawValue;
|
||||
getMBGLValue(array[0], mbglValue[0]);
|
||||
getMBGLValue(array[1], mbglValue[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Padding
|
||||
void getMBGLValue(id rawValue, std::array<float, 4> &mbglValue) {
|
||||
if ([rawValue isKindOfClass:[NSValue class]]) {
|
||||
mbglValue = [rawValue mgl_paddingArrayValue];
|
||||
} else if ([rawValue isKindOfClass:[NSArray class]]) {
|
||||
NSArray *array = (NSArray *)rawValue;
|
||||
getMBGLValue(array[0], mbglValue[0]);
|
||||
getMBGLValue(array[1], mbglValue[1]);
|
||||
getMBGLValue(array[2], mbglValue[2]);
|
||||
getMBGLValue(array[3], mbglValue[3]);
|
||||
getMBGLValue(array[4], mbglValue[4]);
|
||||
}
|
||||
}
|
||||
|
||||
// Color
|
||||
void getMBGLValue(MLNColor *rawValue, mbgl::Color &mbglValue) { mbglValue = rawValue.mgl_color; }
|
||||
|
||||
// Image
|
||||
void getMBGLValue(NSString *rawValue, mbgl::style::expression::Image &mbglValue) {
|
||||
mbglValue = mbgl::style::expression::Image(rawValue.UTF8String);
|
||||
}
|
||||
|
||||
// Array
|
||||
void getMBGLValue(ObjCType rawValue, std::vector<MBGLElement> &mbglValue) {
|
||||
mbglValue.reserve(rawValue.count);
|
||||
for (id obj in rawValue) {
|
||||
id constantObject = obj;
|
||||
if ([obj isKindOfClass:[NSExpression class]] &&
|
||||
[obj expressionType] == NSConstantValueExpressionType) {
|
||||
constantObject = [constantObject constantValue];
|
||||
}
|
||||
MBGLElement mbglElement;
|
||||
getMBGLValue(constantObject, mbglElement);
|
||||
mbglValue.push_back(mbglElement);
|
||||
}
|
||||
}
|
||||
|
||||
void getMBGLValue(NSValue *rawValue, mbgl::style::Position &mbglValue) {
|
||||
auto spherical = rawValue.mgl_lightPositionArrayValue;
|
||||
mbgl::style::Position position(spherical);
|
||||
mbglValue = position;
|
||||
}
|
||||
|
||||
// Enumerations
|
||||
template <typename MBGLEnum = MBGLType,
|
||||
class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type,
|
||||
typename MLNEnum = ObjCEnum,
|
||||
class = typename std::enable_if<std::is_enum<MLNEnum>::value>::type>
|
||||
void getMBGLValue(id rawValue, MBGLEnum &mbglValue) {
|
||||
if ([rawValue isKindOfClass:[NSString class]]) {
|
||||
mbglValue = *mbgl::Enum<MBGLEnum>::toEnum([(NSString *)rawValue UTF8String]);
|
||||
} else {
|
||||
MLNEnum mglEnum;
|
||||
[(NSValue *)rawValue getValue:&mglEnum];
|
||||
auto str = mbgl::Enum<MLNEnum>::toString(mglEnum);
|
||||
mbglValue = *mbgl::Enum<MBGLEnum>::toEnum(str);
|
||||
}
|
||||
}
|
||||
|
||||
private: // Private utilities for converting from mbgl to mgl values
|
||||
// Bool
|
||||
static NSNumber *toMLNRawStyleValue(const bool mbglStopValue) { return @(mbglStopValue); }
|
||||
|
||||
// Float
|
||||
static NSNumber *toMLNRawStyleValue(const float mbglStopValue) { return @(mbglStopValue); }
|
||||
|
||||
// Integer
|
||||
static NSNumber *toMLNRawStyleValue(const int64_t mbglStopValue) { return @(mbglStopValue); }
|
||||
|
||||
// String
|
||||
static NSString *toMLNRawStyleValue(const std::string &mbglStopValue) {
|
||||
return @(mbglStopValue.c_str());
|
||||
}
|
||||
|
||||
// Formatted
|
||||
static NSString *toMLNRawStyleValue(const mbgl::style::expression::Formatted &mbglStopValue) {
|
||||
return @(mbglStopValue.toString().c_str());
|
||||
}
|
||||
|
||||
// Offsets
|
||||
static NSValue *toMLNRawStyleValue(const std::array<float, 2> &mbglStopValue) {
|
||||
return [NSValue mgl_valueWithOffsetArray:mbglStopValue];
|
||||
}
|
||||
|
||||
// Padding
|
||||
static NSValue *toMLNRawStyleValue(const std::array<float, 4> &mbglStopValue) {
|
||||
return [NSValue mgl_valueWithPaddingArray:mbglStopValue];
|
||||
}
|
||||
|
||||
// Color
|
||||
static MLNColor *toMLNRawStyleValue(const mbgl::Color mbglStopValue) {
|
||||
return [MLNColor mgl_colorWithColor:mbglStopValue];
|
||||
}
|
||||
|
||||
// Image
|
||||
static NSString *toMLNRawStyleValue(const mbgl::style::expression::Image &mbglImageValue) {
|
||||
return @(mbglImageValue.id().c_str());
|
||||
}
|
||||
|
||||
// Array
|
||||
static NSArray<NSExpression *> *toMLNRawStyleValue(
|
||||
const std::vector<MBGLElement> &mbglStopValue) {
|
||||
NSMutableArray *array = [NSMutableArray arrayWithCapacity:mbglStopValue.size()];
|
||||
for (const auto &mbglElement : mbglStopValue) {
|
||||
[array addObject:[NSExpression expressionForConstantValue:toMLNRawStyleValue(mbglElement)]];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
static NSValue *toMLNRawStyleValue(const mbgl::style::Position &mbglStopValue) {
|
||||
std::array<float, 3> spherical = mbglStopValue.getSpherical();
|
||||
MLNSphericalPosition position =
|
||||
MLNSphericalPositionMake(spherical[0], spherical[1], spherical[2]);
|
||||
return [NSValue valueWithMLNSphericalPosition:position];
|
||||
}
|
||||
|
||||
// Enumerations
|
||||
template <typename MBGLEnum = MBGLType, typename MLNEnum = ObjCEnum>
|
||||
static NSString *toMLNRawStyleValue(const MBGLEnum &value) {
|
||||
return @(mbgl::Enum<MBGLEnum>::toString(value));
|
||||
}
|
||||
|
||||
/// Converts all types of mbgl property values into an equivalent NSExpression.
|
||||
class PropertyExpressionEvaluator {
|
||||
public:
|
||||
NSExpression *operator()(const mbgl::style::Undefined) const { return nil; }
|
||||
|
||||
NSExpression *operator()(const MBGLType &value) const {
|
||||
id constantValue = toMLNRawStyleValue(value);
|
||||
if ([constantValue isKindOfClass:[NSArray class]]) {
|
||||
return [NSExpression expressionForAggregate:constantValue];
|
||||
}
|
||||
return [NSExpression expressionForConstantValue:constantValue];
|
||||
}
|
||||
|
||||
NSObject* toRawStyleSpecValue(MLNColor *color, MBGLType &) {
|
||||
return @(color.mgl_color.stringify().c_str());
|
||||
NSExpression *operator()(const mbgl::style::PropertyExpression<MBGLType> &mbglValue) const {
|
||||
return [NSExpression
|
||||
expressionWithMLNJSONObject:MLNJSONObjectFromMBGLExpression(mbglValue.getExpression())];
|
||||
}
|
||||
|
||||
// Bool
|
||||
void getMBGLValue(NSNumber *rawValue, bool &mbglValue) {
|
||||
mbglValue = !!rawValue.boolValue;
|
||||
}
|
||||
|
||||
// Float
|
||||
void getMBGLValue(NSNumber *rawValue, float &mbglValue) {
|
||||
mbglValue = rawValue.floatValue;
|
||||
}
|
||||
|
||||
// String
|
||||
void getMBGLValue(NSString *rawValue, std::string &mbglValue) {
|
||||
mbglValue = rawValue.UTF8String;
|
||||
}
|
||||
|
||||
// Formatted
|
||||
void getMBGLValue(NSString *rawValue, mbgl::style::expression::Formatted &mbglValue) {
|
||||
mbglValue = mbgl::style::expression::Formatted(rawValue.UTF8String);
|
||||
}
|
||||
|
||||
// Offsets
|
||||
void getMBGLValue(id rawValue, std::array<float, 2> &mbglValue) {
|
||||
if ([rawValue isKindOfClass:[NSValue class]]) {
|
||||
mbglValue = [rawValue mgl_offsetArrayValue];
|
||||
} else if ([rawValue isKindOfClass:[NSArray class]]) {
|
||||
NSArray *array = (NSArray *)rawValue;
|
||||
getMBGLValue(array[0], mbglValue[0]);
|
||||
getMBGLValue(array[1], mbglValue[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Padding
|
||||
void getMBGLValue(id rawValue, std::array<float, 4> &mbglValue) {
|
||||
if ([rawValue isKindOfClass:[NSValue class]]) {
|
||||
mbglValue = [rawValue mgl_paddingArrayValue];
|
||||
} else if ([rawValue isKindOfClass:[NSArray class]]) {
|
||||
NSArray *array = (NSArray *)rawValue;
|
||||
getMBGLValue(array[0], mbglValue[0]);
|
||||
getMBGLValue(array[1], mbglValue[1]);
|
||||
getMBGLValue(array[2], mbglValue[2]);
|
||||
getMBGLValue(array[3], mbglValue[3]);
|
||||
getMBGLValue(array[4], mbglValue[4]);
|
||||
}
|
||||
}
|
||||
|
||||
// Color
|
||||
void getMBGLValue(MLNColor *rawValue, mbgl::Color &mbglValue) {
|
||||
mbglValue = rawValue.mgl_color;
|
||||
}
|
||||
|
||||
// Image
|
||||
void getMBGLValue(NSString *rawValue, mbgl::style::expression::Image &mbglValue) {
|
||||
mbglValue = mbgl::style::expression::Image(rawValue.UTF8String);
|
||||
}
|
||||
|
||||
// Array
|
||||
void getMBGLValue(ObjCType rawValue, std::vector<MBGLElement> &mbglValue) {
|
||||
mbglValue.reserve(rawValue.count);
|
||||
for (id obj in rawValue) {
|
||||
id constantObject = obj;
|
||||
if ([obj isKindOfClass:[NSExpression class]] && [obj expressionType] == NSConstantValueExpressionType) {
|
||||
constantObject = [constantObject constantValue];
|
||||
}
|
||||
MBGLElement mbglElement;
|
||||
getMBGLValue(constantObject, mbglElement);
|
||||
mbglValue.push_back(mbglElement);
|
||||
}
|
||||
}
|
||||
|
||||
void getMBGLValue(NSValue *rawValue, mbgl::style::Position &mbglValue) {
|
||||
auto spherical = rawValue.mgl_lightPositionArrayValue;
|
||||
mbgl::style::Position position(spherical);
|
||||
mbglValue = position;
|
||||
}
|
||||
|
||||
// Enumerations
|
||||
template <typename MBGLEnum = MBGLType,
|
||||
class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type,
|
||||
typename MLNEnum = ObjCEnum,
|
||||
class = typename std::enable_if<std::is_enum<MLNEnum>::value>::type>
|
||||
void getMBGLValue(id rawValue, MBGLEnum &mbglValue) {
|
||||
if ([rawValue isKindOfClass:[NSString class]]) {
|
||||
mbglValue = *mbgl::Enum<MBGLEnum>::toEnum([(NSString *)rawValue UTF8String]);
|
||||
} else {
|
||||
MLNEnum mglEnum;
|
||||
[(NSValue *)rawValue getValue:&mglEnum];
|
||||
auto str = mbgl::Enum<MLNEnum>::toString(mglEnum);
|
||||
mbglValue = *mbgl::Enum<MBGLEnum>::toEnum(str);
|
||||
}
|
||||
}
|
||||
|
||||
private: // Private utilities for converting from mbgl to mgl values
|
||||
|
||||
// Bool
|
||||
static NSNumber *toMLNRawStyleValue(const bool mbglStopValue) {
|
||||
return @(mbglStopValue);
|
||||
}
|
||||
|
||||
// Float
|
||||
static NSNumber *toMLNRawStyleValue(const float mbglStopValue) {
|
||||
return @(mbglStopValue);
|
||||
}
|
||||
|
||||
// Integer
|
||||
static NSNumber *toMLNRawStyleValue(const int64_t mbglStopValue) {
|
||||
return @(mbglStopValue);
|
||||
}
|
||||
|
||||
// String
|
||||
static NSString *toMLNRawStyleValue(const std::string &mbglStopValue) {
|
||||
return @(mbglStopValue.c_str());
|
||||
}
|
||||
|
||||
// Formatted
|
||||
static NSString *toMLNRawStyleValue(const mbgl::style::expression::Formatted &mbglStopValue) {
|
||||
return @(mbglStopValue.toString().c_str());
|
||||
}
|
||||
|
||||
// Offsets
|
||||
static NSValue *toMLNRawStyleValue(const std::array<float, 2> &mbglStopValue) {
|
||||
return [NSValue mgl_valueWithOffsetArray:mbglStopValue];
|
||||
}
|
||||
|
||||
// Padding
|
||||
static NSValue *toMLNRawStyleValue(const std::array<float, 4> &mbglStopValue) {
|
||||
return [NSValue mgl_valueWithPaddingArray:mbglStopValue];
|
||||
}
|
||||
|
||||
// Color
|
||||
static MLNColor *toMLNRawStyleValue(const mbgl::Color mbglStopValue) {
|
||||
return [MLNColor mgl_colorWithColor:mbglStopValue];
|
||||
}
|
||||
|
||||
// Image
|
||||
static NSString *toMLNRawStyleValue(const mbgl::style::expression::Image &mbglImageValue) {
|
||||
return @(mbglImageValue.id().c_str());
|
||||
}
|
||||
|
||||
// Array
|
||||
static NSArray<NSExpression*> *toMLNRawStyleValue(const std::vector<MBGLElement> &mbglStopValue) {
|
||||
NSMutableArray *array = [NSMutableArray arrayWithCapacity:mbglStopValue.size()];
|
||||
for (const auto &mbglElement: mbglStopValue) {
|
||||
[array addObject:[NSExpression expressionForConstantValue:toMLNRawStyleValue(mbglElement)]];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
static NSValue *toMLNRawStyleValue(const mbgl::style::Position &mbglStopValue) {
|
||||
std::array<float, 3> spherical = mbglStopValue.getSpherical();
|
||||
MLNSphericalPosition position = MLNSphericalPositionMake(spherical[0], spherical[1], spherical[2]);
|
||||
return [NSValue valueWithMLNSphericalPosition:position];
|
||||
}
|
||||
|
||||
// Enumerations
|
||||
template <typename MBGLEnum = MBGLType, typename MLNEnum = ObjCEnum>
|
||||
static NSString *toMLNRawStyleValue(const MBGLEnum &value) {
|
||||
return @(mbgl::Enum<MBGLEnum>::toString(value));
|
||||
}
|
||||
|
||||
/// Converts all types of mbgl property values into an equivalent NSExpression.
|
||||
class PropertyExpressionEvaluator {
|
||||
public:
|
||||
NSExpression *operator()(const mbgl::style::Undefined) const {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSExpression *operator()(const MBGLType &value) const {
|
||||
id constantValue = toMLNRawStyleValue(value);
|
||||
if ([constantValue isKindOfClass:[NSArray class]]) {
|
||||
return [NSExpression expressionForAggregate:constantValue];
|
||||
}
|
||||
return [NSExpression expressionForConstantValue:constantValue];
|
||||
}
|
||||
|
||||
NSExpression *operator()(const mbgl::style::PropertyExpression<MBGLType> &mbglValue) const {
|
||||
return [NSExpression expressionWithMLNJSONObject:MLNJSONObjectFromMBGLExpression(mbglValue.getExpression())];
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#import "MLNStyle.h"
|
||||
|
||||
#import "MLNStyleLayer.h"
|
||||
#import "MLNFillStyleLayer.h"
|
||||
#import "MLNStyleLayer.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
class Style;
|
||||
}
|
||||
namespace style {
|
||||
class Style;
|
||||
}
|
||||
} // namespace mbgl
|
||||
|
||||
@class MLNAttributionInfo;
|
||||
@class MLNMapView;
|
||||
@@ -19,14 +19,18 @@ namespace mbgl {
|
||||
|
||||
@interface MLNStyle (Private)
|
||||
|
||||
- (instancetype)initWithRawStyle:(mbgl::style::Style *)rawStyle stylable:(id <MLNStylable>)stylable;
|
||||
- (instancetype)initWithRawStyle:(mbgl::style::Style *)rawStyle stylable:(id<MLNStylable>)stylable;
|
||||
|
||||
@property (nonatomic, readonly, weak) id <MLNStylable> stylable;
|
||||
@property (nonatomic, readonly, weak) id<MLNStylable> stylable;
|
||||
@property (nonatomic, readonly) mbgl::style::Style *rawStyle;
|
||||
|
||||
- (nullable NSArray<MLNAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MLNColor *)linkColor;
|
||||
@property (nonatomic, readonly, strong) NSMutableDictionary<NSString *, MLNCustomStyleLayer *> *customLayers;
|
||||
- (void)setStyleClasses:(NSArray<NSString *> *)appliedClasses transitionDuration:(NSTimeInterval)transitionDuration;
|
||||
- (nullable NSArray<MLNAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize
|
||||
linkColor:
|
||||
(nullable MLNColor *)linkColor;
|
||||
@property (nonatomic, readonly, strong)
|
||||
NSMutableDictionary<NSString *, MLNCustomStyleLayer *> *customLayers;
|
||||
- (void)setStyleClasses:(NSArray<NSString *> *)appliedClasses
|
||||
transitionDuration:(NSTimeInterval)transitionDuration;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNOfflineRegion.h"
|
||||
#import "MLNGeometry.h"
|
||||
#import "MLNOfflineRegion.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -19,8 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
let southwest = CLLocationCoordinate2D(latitude: 36.986207, longitude: -109.049896)
|
||||
let bbox = MLNCoordinateBounds(sw: southwest, ne: northeast)
|
||||
|
||||
let region = MLNTilePyramidOfflineRegion(styleURL: MLNStyle.lightStyleURL, bounds: bbox, fromZoomLevel: 11, toZoomLevel: 14)
|
||||
let context = "Tile Pyramid Region".data(using: .utf8)
|
||||
let region = MLNTilePyramidOfflineRegion(styleURL: MLNStyle.lightStyleURL, bounds: bbox,
|
||||
fromZoomLevel: 11, toZoomLevel: 14) let context = "Tile Pyramid Region".data(using: .utf8)
|
||||
MLNOfflineStorage.shared.addPack(for: region, withContext: context!)
|
||||
```
|
||||
|
||||
@@ -80,7 +80,10 @@ MLN_EXPORT
|
||||
level, the download covers zoom levels up to the tile source’s maximum zoom
|
||||
level.
|
||||
*/
|
||||
- (instancetype)initWithStyleURL:(nullable NSURL *)styleURL bounds:(MLNCoordinateBounds)bounds fromZoomLevel:(double)minimumZoomLevel toZoomLevel:(double)maximumZoomLevel NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithStyleURL:(nullable NSURL *)styleURL
|
||||
bounds:(MLNCoordinateBounds)bounds
|
||||
fromZoomLevel:(double)minimumZoomLevel
|
||||
toZoomLevel:(double)maximumZoomLevel NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@param definition A reference to an offline region definition backing the
|
||||
offline region.
|
||||
*/
|
||||
- (instancetype)initWithOfflineRegionDefinition:(const mbgl::OfflineTilePyramidRegionDefinition &)definition;
|
||||
- (instancetype)initWithOfflineRegionDefinition:
|
||||
(const mbgl::OfflineTilePyramidRegionDefinition &)definition;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNDefaultStyle.h"
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -12,98 +12,98 @@ MLN_EXPORT
|
||||
@interface MLNTileServerOptions : NSObject
|
||||
|
||||
/**
|
||||
* API base URL.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* baseURL;
|
||||
* API base URL.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* baseURL;
|
||||
|
||||
/**
|
||||
* Tile server URI alias.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* uriSchemeAlias;
|
||||
* Tile server URI alias.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* uriSchemeAlias;
|
||||
|
||||
/**
|
||||
* URL template for sources.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* sourceTemplate;
|
||||
* URL template for sources.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* sourceTemplate;
|
||||
|
||||
/**
|
||||
* source domain name.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* sourceDomainName;
|
||||
* source domain name.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* sourceDomainName;
|
||||
|
||||
/**
|
||||
* source version prefix
|
||||
*/
|
||||
@property (nonatomic,retain,nullable) NSString* sourceVersionPrefix;
|
||||
* source version prefix
|
||||
*/
|
||||
@property (nonatomic, retain, nullable) NSString* sourceVersionPrefix;
|
||||
|
||||
/**
|
||||
* URL template for style.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* styleTemplate;
|
||||
* URL template for style.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* styleTemplate;
|
||||
|
||||
/**
|
||||
* style domain name.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* styleDomainName;
|
||||
* style domain name.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* styleDomainName;
|
||||
|
||||
/**
|
||||
* style version prefix
|
||||
*/
|
||||
@property (nonatomic,retain,nullable) NSString* styleVersionPrefix;
|
||||
* style version prefix
|
||||
*/
|
||||
@property (nonatomic, retain, nullable) NSString* styleVersionPrefix;
|
||||
|
||||
/**
|
||||
* URL template for sprites.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* spritesTemplate;
|
||||
* URL template for sprites.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* spritesTemplate;
|
||||
|
||||
/**
|
||||
* sprites domain name.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* spritesDomainName;
|
||||
* sprites domain name.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* spritesDomainName;
|
||||
|
||||
/**
|
||||
* version prefix
|
||||
*/
|
||||
@property (nonatomic,retain,nullable) NSString* spritesVersionPrefix;
|
||||
* version prefix
|
||||
*/
|
||||
@property (nonatomic, retain, nullable) NSString* spritesVersionPrefix;
|
||||
|
||||
/**
|
||||
* URL template for glyphs.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* glyphsTemplate;
|
||||
* URL template for glyphs.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* glyphsTemplate;
|
||||
|
||||
/**
|
||||
* glyphs domain name.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* glyphsDomainName;
|
||||
* glyphs domain name.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* glyphsDomainName;
|
||||
|
||||
/**
|
||||
* Glyphs version prefix
|
||||
*/
|
||||
@property (nonatomic,retain,nullable) NSString* glyphsVersionPrefix;
|
||||
* Glyphs version prefix
|
||||
*/
|
||||
@property (nonatomic, retain, nullable) NSString* glyphsVersionPrefix;
|
||||
|
||||
/**
|
||||
* URL template for tiles.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* tileTemplate;
|
||||
* URL template for tiles.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* tileTemplate;
|
||||
|
||||
/**
|
||||
* tile domain name.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* tileDomainName;
|
||||
* tile domain name.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* tileDomainName;
|
||||
|
||||
/**
|
||||
* tile version prefix
|
||||
*/
|
||||
@property (nonatomic,retain,nullable) NSString* tileVersionPrefix;
|
||||
* tile version prefix
|
||||
*/
|
||||
@property (nonatomic, retain, nullable) NSString* tileVersionPrefix;
|
||||
|
||||
/**
|
||||
* API key parameter name.
|
||||
*/
|
||||
@property (nonatomic,retain) NSString* apiKeyParameterName;
|
||||
* API key parameter name.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* apiKeyParameterName;
|
||||
|
||||
/**
|
||||
* Default styles.
|
||||
*/
|
||||
* Default styles.
|
||||
*/
|
||||
@property (nonatomic, retain) NSArray<MLNDefaultStyle*>* defaultStyles;
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,23 +122,24 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNTileSourceOption MLNTileSourceOptionTileCo
|
||||
interpreted.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, MLNTileCoordinateSystem) {
|
||||
/**
|
||||
The origin is at the top-left (northwest), and `y` values increase
|
||||
southwards.
|
||||
/**
|
||||
The origin is at the top-left (northwest), and `y` values increase
|
||||
southwards.
|
||||
|
||||
This tile coordinate system is used by Mapbox and OpenStreetMap tile
|
||||
servers.
|
||||
*/
|
||||
MLNTileCoordinateSystemXYZ = 0,
|
||||
This tile coordinate system is used by Mapbox and OpenStreetMap tile
|
||||
servers.
|
||||
*/
|
||||
MLNTileCoordinateSystemXYZ = 0,
|
||||
|
||||
/**
|
||||
The origin is at the bottom-left (southwest), and `y` values increase
|
||||
northwards.
|
||||
/**
|
||||
The origin is at the bottom-left (southwest), and `y` values increase
|
||||
northwards.
|
||||
|
||||
This tile coordinate system is used by tile servers that conform to the
|
||||
<a href="http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification">Tile Map Service Specification</a>.
|
||||
*/
|
||||
MLNTileCoordinateSystemTMS
|
||||
This tile coordinate system is used by tile servers that conform to the
|
||||
<a href="http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification">Tile Map Service
|
||||
Specification</a>.
|
||||
*/
|
||||
MLNTileCoordinateSystemTMS
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -147,15 +148,17 @@ typedef NS_ENUM(NSUInteger, MLNTileCoordinateSystem) {
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MLNDEMEncoding) {
|
||||
|
||||
/**
|
||||
Raster tiles generated with the [Mapbox encoding formula](https://docs.mapbox.com/help/troubleshooting/access-elevation-data/#mapbox-terrain-rgb).
|
||||
*/
|
||||
MLNDEMEncodingMapbox = 0,
|
||||
/**
|
||||
Raster tiles generated with the [Mapbox encoding
|
||||
formula](https://docs.mapbox.com/help/troubleshooting/access-elevation-data/#mapbox-terrain-rgb).
|
||||
*/
|
||||
MLNDEMEncodingMapbox = 0,
|
||||
|
||||
/**
|
||||
Raster tiles generated with the [Mapzen Terrarium encoding formula](https://aws.amazon.com/public-datasets/terrain/).
|
||||
*/
|
||||
MLNDEMEncodingTerrarium
|
||||
/**
|
||||
Raster tiles generated with the [Mapzen Terrarium encoding
|
||||
formula](https://aws.amazon.com/public-datasets/terrain/).
|
||||
*/
|
||||
MLNDEMEncodingTerrarium
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
namespace mbgl {
|
||||
class Tileset;
|
||||
class Tileset;
|
||||
}
|
||||
|
||||
@class MLNAttributionInfo;
|
||||
@@ -28,11 +28,14 @@ namespace mbgl {
|
||||
@param fontSize The default text size in points, or 0 to use the default.
|
||||
@param linkColor The default link color, or `nil` to use the default.
|
||||
*/
|
||||
- (NSArray<MLNAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MLNColor *)linkColor;
|
||||
- (NSArray<MLNAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize
|
||||
linkColor:(nullable MLNColor *)linkColor;
|
||||
|
||||
@end
|
||||
|
||||
MLN_EXPORT
|
||||
mbgl::Tileset MLNTileSetFromTileURLTemplates(NSArray<NSString *> *tileURLTemplates, NSDictionary<MLNTileSourceOption, id> * _Nullable options);
|
||||
mbgl::Tileset MLNTileSetFromTileURLTemplates(
|
||||
NSArray<NSString *> *tileURLTemplates,
|
||||
NSDictionary<MLNTileSourceOption, id> *_Nullable options);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
@@ -36,55 +36,55 @@ FOUNDATION_EXTERN MLN_EXPORT NSErrorDomain const MLNErrorDomain;
|
||||
|
||||
/** Error constants for the Mapbox SDK. */
|
||||
typedef NS_ENUM(NSInteger, MLNErrorCode) {
|
||||
/** An unknown error occurred. */
|
||||
MLNErrorCodeUnknown = -1,
|
||||
/** The resource could not be found. */
|
||||
MLNErrorCodeNotFound = 1,
|
||||
/** The connection received an invalid server response. */
|
||||
MLNErrorCodeBadServerResponse = 2,
|
||||
/** An attempt to establish a connection failed. */
|
||||
MLNErrorCodeConnectionFailed = 3,
|
||||
/** A style parse error occurred while attempting to load the map. */
|
||||
MLNErrorCodeParseStyleFailed = 4,
|
||||
/** An attempt to load the style failed. */
|
||||
MLNErrorCodeLoadStyleFailed = 5,
|
||||
/** An error occurred while snapshotting the map. */
|
||||
MLNErrorCodeSnapshotFailed = 6,
|
||||
/** Source is in use and cannot be removed */
|
||||
MLNErrorCodeSourceIsInUseCannotRemove = 7,
|
||||
/** Source is in use and cannot be removed */
|
||||
MLNErrorCodeSourceIdentifierMismatch = 8,
|
||||
/** An error occurred while modifying the offline storage database */
|
||||
MLNErrorCodeModifyingOfflineStorageFailed = 9,
|
||||
/** Source is invalid and cannot be removed from the style (e.g. after a style change) */
|
||||
MLNErrorCodeSourceCannotBeRemovedFromStyle = 10,
|
||||
/** An error occurred while rendering */
|
||||
MLNErrorCodeRenderingError = 11,
|
||||
/** An unknown error occurred. */
|
||||
MLNErrorCodeUnknown = -1,
|
||||
/** The resource could not be found. */
|
||||
MLNErrorCodeNotFound = 1,
|
||||
/** The connection received an invalid server response. */
|
||||
MLNErrorCodeBadServerResponse = 2,
|
||||
/** An attempt to establish a connection failed. */
|
||||
MLNErrorCodeConnectionFailed = 3,
|
||||
/** A style parse error occurred while attempting to load the map. */
|
||||
MLNErrorCodeParseStyleFailed = 4,
|
||||
/** An attempt to load the style failed. */
|
||||
MLNErrorCodeLoadStyleFailed = 5,
|
||||
/** An error occurred while snapshotting the map. */
|
||||
MLNErrorCodeSnapshotFailed = 6,
|
||||
/** Source is in use and cannot be removed */
|
||||
MLNErrorCodeSourceIsInUseCannotRemove = 7,
|
||||
/** Source is in use and cannot be removed */
|
||||
MLNErrorCodeSourceIdentifierMismatch = 8,
|
||||
/** An error occurred while modifying the offline storage database */
|
||||
MLNErrorCodeModifyingOfflineStorageFailed = 9,
|
||||
/** Source is invalid and cannot be removed from the style (e.g. after a style change) */
|
||||
MLNErrorCodeSourceCannotBeRemovedFromStyle = 10,
|
||||
/** An error occurred while rendering */
|
||||
MLNErrorCodeRenderingError = 11,
|
||||
};
|
||||
|
||||
/** Options for enabling debugging features in an `MLNMapView` instance. */
|
||||
typedef NS_OPTIONS(NSUInteger, MLNMapDebugMaskOptions) {
|
||||
/** Edges of tile boundaries are shown as thick, red lines to help diagnose
|
||||
tile clipping issues. */
|
||||
MLNMapDebugTileBoundariesMask = 1 << 1,
|
||||
/** Each tile shows its tile coordinate (x/y/z) in the upper-left corner. */
|
||||
MLNMapDebugTileInfoMask = 1 << 2,
|
||||
/** Each tile shows a timestamp indicating when it was loaded. */
|
||||
MLNMapDebugTimestampsMask = 1 << 3,
|
||||
/** Edges of glyphs and symbols are shown as faint, green lines to help
|
||||
diagnose collision and label placement issues. */
|
||||
MLNMapDebugCollisionBoxesMask = 1 << 4,
|
||||
/** Each drawing operation is replaced by a translucent fill. Overlapping
|
||||
drawing operations appear more prominent to help diagnose overdrawing.
|
||||
@note This option does nothing in Release builds of the SDK. */
|
||||
MLNMapDebugOverdrawVisualizationMask = 1 << 5,
|
||||
/** Edges of tile boundaries are shown as thick, red lines to help diagnose
|
||||
tile clipping issues. */
|
||||
MLNMapDebugTileBoundariesMask = 1 << 1,
|
||||
/** Each tile shows its tile coordinate (x/y/z) in the upper-left corner. */
|
||||
MLNMapDebugTileInfoMask = 1 << 2,
|
||||
/** Each tile shows a timestamp indicating when it was loaded. */
|
||||
MLNMapDebugTimestampsMask = 1 << 3,
|
||||
/** Edges of glyphs and symbols are shown as faint, green lines to help
|
||||
diagnose collision and label placement issues. */
|
||||
MLNMapDebugCollisionBoxesMask = 1 << 4,
|
||||
/** Each drawing operation is replaced by a translucent fill. Overlapping
|
||||
drawing operations appear more prominent to help diagnose overdrawing.
|
||||
@note This option does nothing in Release builds of the SDK. */
|
||||
MLNMapDebugOverdrawVisualizationMask = 1 << 5,
|
||||
#if !TARGET_OS_IPHONE
|
||||
/** The stencil buffer is shown instead of the color buffer.
|
||||
@note This option does nothing in Release builds of the SDK. */
|
||||
MLNMapDebugStencilBufferMask = 1 << 6,
|
||||
/** The depth buffer is shown instead of the color buffer.
|
||||
@note This option does nothing in Release builds of the SDK. */
|
||||
MLNMapDebugDepthBufferMask = 1 << 7,
|
||||
/** The stencil buffer is shown instead of the color buffer.
|
||||
@note This option does nothing in Release builds of the SDK. */
|
||||
MLNMapDebugStencilBufferMask = 1 << 6,
|
||||
/** The depth buffer is shown instead of the color buffer.
|
||||
@note This option does nothing in Release builds of the SDK. */
|
||||
MLNMapDebugDepthBufferMask = 1 << 7,
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -92,19 +92,20 @@ typedef NS_OPTIONS(NSUInteger, MLNMapDebugMaskOptions) {
|
||||
A structure containing information about a transition.
|
||||
*/
|
||||
typedef struct __attribute__((objc_boxable)) MLNTransition {
|
||||
/**
|
||||
The amount of time the animation should take, not including the delay.
|
||||
*/
|
||||
NSTimeInterval duration;
|
||||
/**
|
||||
The amount of time the animation should take, not including the delay.
|
||||
*/
|
||||
NSTimeInterval duration;
|
||||
|
||||
/**
|
||||
The amount of time in seconds to wait before beginning the animation.
|
||||
*/
|
||||
NSTimeInterval delay;
|
||||
/**
|
||||
The amount of time in seconds to wait before beginning the animation.
|
||||
*/
|
||||
NSTimeInterval delay;
|
||||
} MLNTransition;
|
||||
|
||||
NS_INLINE NSString *MLNStringFromMLNTransition(MLNTransition transition) {
|
||||
return [NSString stringWithFormat:@"transition { duration: %f, delay: %f }", transition.duration, transition.delay];
|
||||
return [NSString stringWithFormat:@"transition { duration: %f, delay: %f }", transition.duration,
|
||||
transition.delay];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,23 +119,23 @@ NS_INLINE NSString *MLNStringFromMLNTransition(MLNTransition transition) {
|
||||
@return Returns a `MLNTransition` struct containing the transition attributes.
|
||||
*/
|
||||
NS_INLINE MLNTransition MLNTransitionMake(NSTimeInterval duration, NSTimeInterval delay) {
|
||||
MLNTransition transition;
|
||||
transition.duration = duration;
|
||||
transition.delay = delay;
|
||||
MLNTransition transition;
|
||||
transition.duration = duration;
|
||||
transition.delay = delay;
|
||||
|
||||
return transition;
|
||||
return transition;
|
||||
}
|
||||
|
||||
/**
|
||||
Constants indicating the visibility of different map ornaments.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, MLNOrnamentVisibility) {
|
||||
/** A constant indicating that the ornament adapts to the current map state. */
|
||||
MLNOrnamentVisibilityAdaptive,
|
||||
/** A constant indicating that the ornament is always hidden. */
|
||||
MLNOrnamentVisibilityHidden,
|
||||
/** A constant indicating that the ornament is always visible. */
|
||||
MLNOrnamentVisibilityVisible
|
||||
/** A constant indicating that the ornament adapts to the current map state. */
|
||||
MLNOrnamentVisibilityAdaptive,
|
||||
/** A constant indicating that the ornament is always hidden. */
|
||||
MLNOrnamentVisibilityHidden,
|
||||
/** A constant indicating that the ornament is always visible. */
|
||||
MLNOrnamentVisibilityVisible
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -6,44 +6,32 @@
|
||||
Recursively transforms a C++ type into the corresponding Foundation type.
|
||||
*/
|
||||
class ValueEvaluator {
|
||||
public:
|
||||
id operator()(const mbgl::NullValue &) const {
|
||||
return [NSNull null];
|
||||
}
|
||||
public:
|
||||
id operator()(const mbgl::NullValue &) const { return [NSNull null]; }
|
||||
|
||||
id operator()(const bool &value) const {
|
||||
return value ? @YES : @NO;
|
||||
}
|
||||
id operator()(const bool &value) const { return value ? @YES : @NO; }
|
||||
|
||||
id operator()(const uint64_t &value) const {
|
||||
return @(value);
|
||||
}
|
||||
id operator()(const uint64_t &value) const { return @(value); }
|
||||
|
||||
id operator()(const int64_t &value) const {
|
||||
return @(value);
|
||||
}
|
||||
id operator()(const int64_t &value) const { return @(value); }
|
||||
|
||||
id operator()(const double &value) const {
|
||||
return @(value);
|
||||
}
|
||||
id operator()(const double &value) const { return @(value); }
|
||||
|
||||
id operator()(const std::string &value) const {
|
||||
return @(value.c_str());
|
||||
}
|
||||
id operator()(const std::string &value) const { return @(value.c_str()); }
|
||||
|
||||
id operator()(const std::vector<mbgl::Value> &values) const {
|
||||
NSMutableArray *objects = [NSMutableArray arrayWithCapacity:values.size()];
|
||||
for (const auto &v : values) {
|
||||
[objects addObject:mbgl::Value::visit(v, *this)];
|
||||
}
|
||||
return objects;
|
||||
id operator()(const std::vector<mbgl::Value> &values) const {
|
||||
NSMutableArray *objects = [NSMutableArray arrayWithCapacity:values.size()];
|
||||
for (const auto &v : values) {
|
||||
[objects addObject:mbgl::Value::visit(v, *this)];
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
id operator()(const std::unordered_map<std::string, mbgl::Value> &items) const {
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithCapacity:items.size()];
|
||||
for (auto &item : items) {
|
||||
attributes[@(item.first.c_str())] = mbgl::Value::visit(item.second, *this);
|
||||
}
|
||||
return attributes;
|
||||
id operator()(const std::unordered_map<std::string, mbgl::Value> &items) const {
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithCapacity:items.size()];
|
||||
for (auto &item : items) {
|
||||
attributes[@(item.first.c_str())] = mbgl::Value::visit(item.second, *this);
|
||||
}
|
||||
return attributes;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNForegroundStyleLayer.h"
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -47,8 +47,8 @@ MLN_EXPORT
|
||||
```swift
|
||||
let layer = MLNLineStyleLayer(identifier: "contour", source: terrain)
|
||||
layer.sourceLayerIdentifier = "contours"
|
||||
layer.predicate = NSPredicate(format: "(index == 5 || index == 10) && CAST(ele, 'NSNumber') >= 1500.0")
|
||||
mapView.style?.addLayer(layer)
|
||||
layer.predicate = NSPredicate(format: "(index == 5 || index == 10) && CAST(ele, 'NSNumber') >=
|
||||
1500.0") mapView.style?.addLayer(layer)
|
||||
```
|
||||
*/
|
||||
@property (nonatomic, nullable) NSPredicate *predicate;
|
||||
|
||||
@@ -44,11 +44,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
### Example
|
||||
|
||||
```swift
|
||||
let source = MLNVectorTileSource(identifier: "pois", tileURLTemplates: ["https://example.com/vector-tiles/{z}/{x}/{y}.mvt"], options: [
|
||||
.minimumZoomLevel: 9,
|
||||
let source = MLNVectorTileSource(identifier: "pois", tileURLTemplates:
|
||||
["https://example.com/vector-tiles/{z}/{x}/{y}.mvt"], options: [ .minimumZoomLevel: 9,
|
||||
.maximumZoomLevel: 16,
|
||||
.attributionInfos: [
|
||||
MLNAttributionInfo(title: NSAttributedString(string: "© Mapbox"), url: URL(string: "https://mapbox.com"))
|
||||
MLNAttributionInfo(title: NSAttributedString(string: "© Mapbox"), url: URL(string:
|
||||
"https://mapbox.com"))
|
||||
]
|
||||
])
|
||||
mapView.style?.addSource(source)
|
||||
@@ -80,7 +81,8 @@ MLN_EXPORT
|
||||
source’s contents and other metadata.
|
||||
@return An initialized vector tile source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
configurationURL:(NSURL *)configurationURL NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
Returns a vector tile source initialized an identifier, tile URL templates, and
|
||||
@@ -102,7 +104,10 @@ MLN_EXPORT
|
||||
the default values.
|
||||
@return An initialized tile source.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NSArray<NSString *> *)tileURLTemplates options:(nullable NSDictionary<MLNTileSourceOption, id> *)options NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
tileURLTemplates:(NSArray<NSString *> *)tileURLTemplates
|
||||
options:(nullable NSDictionary<MLNTileSourceOption, id> *)options
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
// MARK: Accessing a Source’s Content
|
||||
|
||||
@@ -141,7 +146,10 @@ MLN_EXPORT
|
||||
@return An array of objects conforming to the `MLNFeature` protocol that
|
||||
represent features loaded by the source that match the predicate.
|
||||
*/
|
||||
- (NSArray<id <MLNFeature>> *)featuresInSourceLayersWithIdentifiers:(NSSet<NSString *> *)sourceLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(features(sourceLayerIdentifiers:predicate:));
|
||||
- (NSArray<id<MLNFeature>> *)featuresInSourceLayersWithIdentifiers:
|
||||
(NSSet<NSString *> *)sourceLayerIdentifiers
|
||||
predicate:(nullable NSPredicate *)predicate
|
||||
NS_SWIFT_NAME(features(sourceLayerIdentifiers:predicate:));
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (NSSet<NSString *> *)mapboxStreetsLanguages;
|
||||
|
||||
+ (nullable NSString *)preferredMapboxStreetsLanguage;
|
||||
+ (nullable NSString *)preferredMapboxStreetsLanguageForPreferences:(NSArray<NSString *> *)preferencesArray;
|
||||
+ (nullable NSString *)preferredMapboxStreetsLanguageForPreferences:
|
||||
(NSArray<NSString *> *)preferencesArray;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <mbgl/util/feature.hpp>
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
- (std::vector<mbgl::Value>)mgl_vector;
|
||||
|
||||
/** Returns a string resulting from inserting a separator between each attributed string in the array */
|
||||
/** Returns a string resulting from inserting a separator between each attributed string in the
|
||||
* array */
|
||||
- (NSAttributedString *)mgl_attributedComponentsJoinedByString:(NSString *)separator;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,15 +17,15 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#undef NSLocalizedString
|
||||
#define NSLocalizedString(key, comment) \
|
||||
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:@"" table:nil]
|
||||
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:@"" table:nil]
|
||||
|
||||
#undef NSLocalizedStringFromTable
|
||||
#define NSLocalizedStringFromTable(key, tbl, comment) \
|
||||
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
|
||||
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
|
||||
|
||||
#undef NSLocalizedStringWithDefaultValue
|
||||
#define NSLocalizedStringWithDefaultValue(key, tbl, bundle, val, comment) \
|
||||
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:(val) table:(tbl)]
|
||||
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:(val)table:(tbl)]
|
||||
|
||||
FOUNDATION_EXTERN MLN_EXPORT MLNExceptionName const MLNBundleNotFoundException;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <mbgl/util/feature.hpp>
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
- (CLLocationCoordinate2D)decodeMLNCoordinateForKey:(NSString *)key;
|
||||
|
||||
- (void)mgl_encodeLocationCoordinates2D:(std::vector<CLLocationCoordinate2D>)coordinates forKey:(NSString *)key;
|
||||
- (void)mgl_encodeLocationCoordinates2D:(std::vector<CLLocationCoordinate2D>)coordinates
|
||||
forKey:(NSString *)key;
|
||||
|
||||
- (std::vector<CLLocationCoordinate2D>)mgl_decodeLocationCoordinates2DForKey:(NSString *)key;
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#include <mbgl/util/chrono.hpp>
|
||||
#import "MLNFoundation.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
/// Converts from a duration in seconds to a duration object usable in mbgl.
|
||||
MLN_EXPORT
|
||||
mbgl::Duration MLNDurationFromTimeInterval(NSTimeInterval duration);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MLNLoggingConfiguration_Private.h"
|
||||
|
||||
#define MLNAssertIsMainThread() MLNAssert([[NSThread currentThread] isMainThread], @"%s must be accessed on the main thread, not %@", __PRETTY_FUNCTION__, [NSThread currentThread])
|
||||
#define MLNAssertIsMainThread() \
|
||||
MLNAssert([[NSThread currentThread] isMainThread], \
|
||||
@"%s must be accessed on the main thread, not %@", __PRETTY_FUNCTION__, \
|
||||
[NSThread currentThread])
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
#import "MLNTypes.h"
|
||||
@@ -17,28 +17,34 @@ typedef NSString *MLNExpressionInterpolationMode NS_TYPED_ENUM;
|
||||
An `NSString` identifying the `linear` interpolation type in an `NSExpression`.
|
||||
|
||||
This attribute corresponds to the `linear` value in the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/expressions/#interpolate"><code>interpolate</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/expressions/#interpolate"><code>interpolate</code></a>
|
||||
expression operator in the MapLibre Style Spec.
|
||||
*/
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionInterpolationModeLinear;
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode
|
||||
MLNExpressionInterpolationModeLinear;
|
||||
|
||||
/**
|
||||
An `NSString` identifying the `expotential` interpolation type in an `NSExpression`.
|
||||
|
||||
This attribute corresponds to the `exponential` value in the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/expressions/#interpolate"><code>interpolate</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/expressions/#interpolate"><code>interpolate</code></a>
|
||||
expression operator in the MapLibre Style Spec.
|
||||
*/
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionInterpolationModeExponential;
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode
|
||||
MLNExpressionInterpolationModeExponential;
|
||||
|
||||
/**
|
||||
An `NSString` identifying the `cubic-bezier` interpolation type in an `NSExpression`.
|
||||
|
||||
This attribute corresponds to the `cubic-bezier` value in the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/expressions/#interpolate"><code>interpolate</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/expressions/#interpolate"><code>interpolate</code></a>
|
||||
expression operator in the MapLibre Style Spec.
|
||||
*/
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionInterpolationModeCubicBezier;
|
||||
FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode
|
||||
MLNExpressionInterpolationModeCubicBezier;
|
||||
|
||||
/**
|
||||
Methods for creating expressions that use Mapbox-specific functionality and for
|
||||
@@ -58,21 +64,24 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
||||
|
||||
/**
|
||||
`NSExpression` variable that corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/expressions/#heatmap-density"><code>heatmap-density</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/expressions/#heatmap-density"><code>heatmap-density</code></a>
|
||||
expression operator in the MapLibre Style Spec.
|
||||
*/
|
||||
@property (class, nonatomic, readonly) NSExpression *heatmapDensityVariableExpression;
|
||||
|
||||
/**
|
||||
`NSExpression` variable that corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/expressions/#line-progress"><code>line-progress</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/expressions/#line-progress"><code>line-progress</code></a>
|
||||
expression operator in the MapLibre Style Spec.
|
||||
*/
|
||||
@property (class, nonatomic, readonly) NSExpression *lineProgressVariableExpression;
|
||||
|
||||
/**
|
||||
`NSExpression` variable that corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/expressions/#geometry-type"><code>geometry-type</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/expressions/#geometry-type"><code>geometry-type</code></a>
|
||||
expression operator in the MapLibre Style Spec.
|
||||
*/
|
||||
@property (class, nonatomic, readonly) NSExpression *geometryTypeVariableExpression;
|
||||
@@ -93,12 +102,14 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
||||
|
||||
/**
|
||||
`NSExpression` variable that corresponds to the
|
||||
<a href="https://maplibre.org/maplibre-style-spec/expressions/#properties"><code>properties</code></a>
|
||||
<a
|
||||
href="https://maplibre.org/maplibre-style-spec/expressions/#properties"><code>properties</code></a>
|
||||
expression operator in the MapLibre Style Spec.
|
||||
*/
|
||||
@property (class, nonatomic, readonly) NSExpression *featureAttributesVariableExpression;
|
||||
|
||||
@property (class, nonatomic, readonly) NSExpression *featurePropertiesVariableExpression __attribute__((deprecated("", "featureAttributesVariableExpression")));
|
||||
@property (class, nonatomic, readonly) NSExpression *featurePropertiesVariableExpression
|
||||
__attribute__((deprecated("", "featureAttributesVariableExpression")));
|
||||
|
||||
// MARK: Creating Conditional Expressions
|
||||
|
||||
@@ -110,7 +121,10 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
||||
@param trueExpression The expression for conditions equal to true.
|
||||
@param falseExpression The expression for conditions equal to false.
|
||||
*/
|
||||
+ (instancetype)mgl_expressionForConditional:(nonnull NSPredicate *)conditionPredicate trueExpression:(nonnull NSExpression *)trueExpression falseExpresssion:(nonnull NSExpression *)falseExpression NS_SWIFT_NAME(init(forMLNConditional:trueExpression:falseExpression:));
|
||||
+ (instancetype)mgl_expressionForConditional:(nonnull NSPredicate *)conditionPredicate
|
||||
trueExpression:(nonnull NSExpression *)trueExpression
|
||||
falseExpresssion:(nonnull NSExpression *)falseExpression
|
||||
NS_SWIFT_NAME(init(forMLNConditional:trueExpression:falseExpression:));
|
||||
|
||||
// MARK: Creating Ramp, Scale, and Curve Expressions
|
||||
|
||||
@@ -128,7 +142,10 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
||||
TODO: Use images to cluster point data
|
||||
Learn how to use this expression to style a map layer based on an attribute value.
|
||||
*/
|
||||
+ (instancetype)mgl_expressionForSteppingExpression:(nonnull NSExpression*)steppingExpression fromExpression:(nonnull NSExpression *)minimumExpression stops:(nonnull NSExpression*)stops NS_SWIFT_NAME(init(forMLNStepping:from:stops:));
|
||||
+ (instancetype)mgl_expressionForSteppingExpression:(nonnull NSExpression *)steppingExpression
|
||||
fromExpression:(nonnull NSExpression *)minimumExpression
|
||||
stops:(nonnull NSExpression *)stops
|
||||
NS_SWIFT_NAME(init(forMLNStepping:from:stops:));
|
||||
|
||||
/**
|
||||
Returns an interpolated function expression specifying the function operator, curve type,
|
||||
@@ -145,7 +162,12 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
||||
TODO: Create a heatmap layer, learn how to style an `MLNHeatmapStyleLayer`
|
||||
based on zoom level and point density with this expression.
|
||||
*/
|
||||
+ (instancetype)mgl_expressionForInterpolatingExpression:(nonnull NSExpression*)inputExpression withCurveType:(nonnull MLNExpressionInterpolationMode)curveType parameters:(nullable NSExpression *)parameters stops:(nonnull NSExpression*)stops NS_SWIFT_NAME(init(forMLNInterpolating:curveType:parameters:stops:));
|
||||
+ (instancetype)mgl_expressionForInterpolatingExpression:(nonnull NSExpression *)inputExpression
|
||||
withCurveType:
|
||||
(nonnull MLNExpressionInterpolationMode)curveType
|
||||
parameters:(nullable NSExpression *)parameters
|
||||
stops:(nonnull NSExpression *)stops
|
||||
NS_SWIFT_NAME(init(forMLNInterpolating:curveType:parameters:stops:));
|
||||
|
||||
/**
|
||||
Returns a match function expression specifying the input, matching values,
|
||||
@@ -155,7 +177,12 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
||||
@param matchedExpressions The matched values expression dictionary must be condition : value.
|
||||
@param defaultExpression The defaultValue expression to be used in case there is no match.
|
||||
*/
|
||||
+ (instancetype)mgl_expressionForMatchingExpression:(nonnull NSExpression *)inputExpression inDictionary:(nonnull NSDictionary<NSExpression *, NSExpression *> *)matchedExpressions defaultExpression:(nonnull NSExpression *)defaultExpression NS_SWIFT_NAME(init(forMLNMatchingKey:in:default:));
|
||||
+ (instancetype)mgl_expressionForMatchingExpression:(nonnull NSExpression *)inputExpression
|
||||
inDictionary:
|
||||
(nonnull NSDictionary<NSExpression *, NSExpression *> *)
|
||||
matchedExpressions
|
||||
defaultExpression:(nonnull NSExpression *)defaultExpression
|
||||
NS_SWIFT_NAME(init(forMLNMatchingKey:in:default:));
|
||||
|
||||
/**
|
||||
Returns an attributed function expression specifying an `MLNAttributedExpression` constant
|
||||
@@ -163,7 +190,9 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
||||
|
||||
@param attributedExpressions The `MLNAttributedExpression` constant expression array.
|
||||
*/
|
||||
+ (instancetype)mgl_expressionForAttributedExpressions:(nonnull NSArray<NSExpression *> *)attributedExpressions NS_SWIFT_NAME(init(forAttributedExpressions:));
|
||||
+ (instancetype)mgl_expressionForAttributedExpressions:
|
||||
(nonnull NSArray<NSExpression *> *)attributedExpressions
|
||||
NS_SWIFT_NAME(init(forAttributedExpressions:));
|
||||
|
||||
// MARK: Concatenating String Expressions
|
||||
|
||||
@@ -175,7 +204,8 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
||||
|
||||
@param expression The expression to append to the receiver.
|
||||
*/
|
||||
- (instancetype)mgl_expressionByAppendingExpression:(nonnull NSExpression *)expression NS_SWIFT_NAME(mgl_appending(_:));
|
||||
- (instancetype)mgl_expressionByAppendingExpression:(nonnull NSExpression *)expression
|
||||
NS_SWIFT_NAME(mgl_appending(_:));
|
||||
|
||||
// MARK: Converting JSON Expressions
|
||||
|
||||
@@ -219,10 +249,10 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
||||
|
||||
This method assumes the receiver refers to the feature attributes that are
|
||||
available in vector tiles supplied by the
|
||||
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets-v8/#overview">Mapbox Streets source</a>.
|
||||
On iOS, the user can set the system’s preferred language in Settings, General
|
||||
Settings, Language & Region. On macOS, the user can set the system’s preferred
|
||||
language in the Language & Region pane of System Preferences.
|
||||
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets-v8/#overview">Mapbox Streets
|
||||
source</a>. On iOS, the user can set the system’s preferred language in Settings, General Settings,
|
||||
Language & Region. On macOS, the user can set the system’s preferred language in the Language &
|
||||
Region pane of System Preferences.
|
||||
|
||||
@param locale The locale into which labels should be localized. To use the
|
||||
system’s preferred language, if supported, specify `nil`. To use the local
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
#import "NSExpression+MLNAdditions.h"
|
||||
@@ -14,7 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface NSObject (MLNExpressionAdditions)
|
||||
|
||||
- (nullable NSNumber *)mgl_number;
|
||||
- (nullable NSNumber *)mgl_numberWithFallbackValues:(id)fallbackValue, ... NS_REQUIRES_NIL_TERMINATION;
|
||||
- (nullable NSNumber *)mgl_numberWithFallbackValues:(id)fallbackValue,
|
||||
... NS_REQUIRES_NIL_TERMINATION;
|
||||
|
||||
@end
|
||||
|
||||
@@ -43,7 +44,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSNumber (MLNExpressionAdditions)
|
||||
|
||||
- (id)mgl_interpolateWithCurveType:(NSString *)curveType parameters:(NSArray *)parameters stops:(NSDictionary<NSNumber *, id> *)stops;
|
||||
- (id)mgl_interpolateWithCurveType:(NSString *)curveType
|
||||
parameters:(NSArray *)parameters
|
||||
stops:(NSDictionary<NSNumber *, id> *)stops;
|
||||
- (id)mgl_stepWithMinimum:(id)minimum stops:(NSDictionary<NSNumber *, id> *)stops;
|
||||
|
||||
@property (nonatomic, readonly) id mgl_jsonExpressionObject;
|
||||
@@ -74,7 +77,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (NSExpression *)mgl_expressionWithContext:(NSDictionary<NSString *, NSExpression *> *)context;
|
||||
|
||||
|
||||
- (id)mgl_has:(id)element;
|
||||
|
||||
@end
|
||||
|
||||
@@ -13,17 +13,7 @@ public:
|
||||
: task(std::move(fn)),
|
||||
loop(CFRunLoopGetCurrent()) {
|
||||
CFRunLoopSourceContext context = {
|
||||
0,
|
||||
this,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
perform
|
||||
};
|
||||
0, this, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, perform};
|
||||
source = CFRunLoopSourceCreate(kCFAllocatorDefault, 0, &context);
|
||||
CFRunLoopAddSource(loop, source, kCFRunLoopCommonModes);
|
||||
}
|
||||
@@ -46,9 +36,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static void perform(void* info) {
|
||||
reinterpret_cast<Impl*>(info)->runTask();
|
||||
}
|
||||
static void perform(void* info) { reinterpret_cast<Impl*>(info)->runTask(); }
|
||||
|
||||
std::function<void()> task;
|
||||
std::atomic_flag queued = ATOMIC_FLAG_INIT;
|
||||
@@ -58,8 +46,7 @@ private:
|
||||
};
|
||||
|
||||
AsyncTask::AsyncTask(std::function<void()>&& fn)
|
||||
: impl(std::make_unique<Impl>(std::move(fn))) {
|
||||
}
|
||||
: impl(std::make_unique<Impl>(std::move(fn))) {}
|
||||
|
||||
AsyncTask::~AsyncTask() = default;
|
||||
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
#include "TargetConditionals.h"
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#include <OpenGLES/ES3/gl.h>
|
||||
#include <OpenGLES/ES3/glext.h>
|
||||
#include <OpenGLES/ES3/gl.h>
|
||||
#include <OpenGLES/ES3/glext.h>
|
||||
#elif TARGET_OS_SIMULATOR
|
||||
#include <OpenGLES/ES3/gl.h>
|
||||
#include <OpenGLES/ES3/glext.h>
|
||||
#include <OpenGLES/ES3/gl.h>
|
||||
#include <OpenGLES/ES3/glext.h>
|
||||
#elif TARGET_OS_MAC
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <OpenGL/gl3ext.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <OpenGL/gl3ext.h>
|
||||
#else
|
||||
#error Unsupported Apple platform
|
||||
#error Unsupported Apple platform
|
||||
#endif
|
||||
|
||||
namespace mbgl {
|
||||
@@ -21,258 +21,276 @@ namespace platform {
|
||||
|
||||
/* OpenGL ES 2.0 */
|
||||
|
||||
void (* const glActiveTexture)(GLenum) = ::glActiveTexture;
|
||||
void (* const glAttachShader)(GLuint, GLuint) = ::glAttachShader;
|
||||
void (* const glBindAttribLocation)(GLuint, GLuint, const GLchar *) = ::glBindAttribLocation;
|
||||
void (* const glBindBuffer)(GLenum, GLuint) = ::glBindBuffer;
|
||||
void (* const glBindFramebuffer)(GLenum, GLuint) = ::glBindFramebuffer;
|
||||
void (* const glBindRenderbuffer)(GLenum, GLuint) = ::glBindRenderbuffer;
|
||||
void (* const glBindTexture)(GLenum, GLuint) = ::glBindTexture;
|
||||
void (* const glBlendColor)(GLfloat, GLfloat, GLfloat, GLfloat) = ::glBlendColor;
|
||||
void (* const glBlendEquation)(GLenum) = ::glBlendEquation;
|
||||
void (* const glBlendEquationSeparate)(GLenum, GLenum) = ::glBlendEquationSeparate;
|
||||
void (* const glBlendFunc)(GLenum, GLenum) = ::glBlendFunc;
|
||||
void (* const glBlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum) = ::glBlendFuncSeparate;
|
||||
void (* const glBufferData)(GLenum, GLsizeiptr, const void *, GLenum) = ::glBufferData;
|
||||
void (* const glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const void *) = ::glBufferSubData;
|
||||
GLenum (* const glCheckFramebufferStatus)(GLenum) = ::glCheckFramebufferStatus;
|
||||
void (* const glClear)(GLbitfield) = ::glClear;
|
||||
void (* const glClearColor)(GLfloat, GLfloat, GLfloat, GLfloat) = ::glClearColor;
|
||||
void (* const glClearDepthf)(GLfloat) = ::glClearDepthf;
|
||||
void (* const glClearStencil)(GLint) = ::glClearStencil;
|
||||
void (* const glColorMask)(GLboolean, GLboolean, GLboolean, GLboolean) = ::glColorMask;
|
||||
void (* const glCompileShader)(GLuint) = ::glCompileShader;
|
||||
void (* const glCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *) = ::glCompressedTexImage2D;
|
||||
void (* const glCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *) = ::glCompressedTexSubImage2D;
|
||||
void (* const glCopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) = ::glCopyTexImage2D;
|
||||
void (* const glCopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) = ::glCopyTexSubImage2D;
|
||||
GLuint (* const glCreateProgram)() = ::glCreateProgram;
|
||||
GLuint (* const glCreateShader)(GLenum) = ::glCreateShader;
|
||||
void (* const glCullFace)(GLenum) = ::glCullFace;
|
||||
void (* const glDeleteBuffers)(GLsizei, const GLuint *) = ::glDeleteBuffers;
|
||||
void (* const glDeleteFramebuffers)(GLsizei, const GLuint *) = ::glDeleteFramebuffers;
|
||||
void (* const glDeleteProgram)(GLuint) = ::glDeleteProgram;
|
||||
void (* const glDeleteRenderbuffers)(GLsizei, const GLuint *) = ::glDeleteRenderbuffers;
|
||||
void (* const glDeleteShader)(GLuint) = ::glDeleteShader;
|
||||
void (* const glDeleteTextures)(GLsizei, const GLuint *) = ::glDeleteTextures;
|
||||
void (* const glDepthFunc)(GLenum) = ::glDepthFunc;
|
||||
void (* const glDepthMask)(GLboolean) = ::glDepthMask;
|
||||
void (* const glDepthRangef)(GLfloat, GLfloat) = ::glDepthRangef;
|
||||
void (* const glDetachShader)(GLuint, GLuint) = ::glDetachShader;
|
||||
void (* const glDisable)(GLenum) = ::glDisable;
|
||||
void (* const glDisableVertexAttribArray)(GLuint) = ::glDisableVertexAttribArray;
|
||||
void (* const glDrawArrays)(GLenum, GLint, GLsizei) = ::glDrawArrays;
|
||||
void (* const glDrawElements)(GLenum, GLsizei, GLenum, const void *) = ::glDrawElements;
|
||||
void (* const glEnable)(GLenum) = ::glEnable;
|
||||
void (* const glEnableVertexAttribArray)(GLuint) = ::glEnableVertexAttribArray;
|
||||
void (* const glFinish)() = ::glFinish;
|
||||
void (* const glFlush)() = ::glFlush;
|
||||
void (* const glFramebufferRenderbuffer)(GLenum, GLenum, GLenum, GLuint) = ::glFramebufferRenderbuffer;
|
||||
void (* const glFramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint) = ::glFramebufferTexture2D;
|
||||
void (* const glFrontFace)(GLenum) = ::glFrontFace;
|
||||
void (* const glGenBuffers)(GLsizei, GLuint *) = ::glGenBuffers;
|
||||
void (* const glGenerateMipmap)(GLenum) = ::glGenerateMipmap;
|
||||
void (* const glGenFramebuffers)(GLsizei, GLuint *) = ::glGenFramebuffers;
|
||||
void (* const glGenRenderbuffers)(GLsizei, GLuint *) = ::glGenRenderbuffers;
|
||||
void (* const glGenTextures)(GLsizei, GLuint *) = ::glGenTextures;
|
||||
void (* const glGetActiveAttrib)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *) = ::glGetActiveAttrib;
|
||||
void (* const glGetActiveUniform)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *) = ::glGetActiveUniform;
|
||||
void (* const glGetAttachedShaders)(GLuint, GLsizei, GLsizei *, GLuint *) = ::glGetAttachedShaders;
|
||||
GLint (* const glGetAttribLocation)(GLuint, const GLchar *) = ::glGetAttribLocation;
|
||||
void (* const glGetBooleanv)(GLenum, GLboolean *) = ::glGetBooleanv;
|
||||
void (* const glGetBufferParameteriv)(GLenum, GLenum, GLint *) = ::glGetBufferParameteriv;
|
||||
GLenum (* const glGetError)() = ::glGetError;
|
||||
void (* const glGetFloatv)(GLenum, GLfloat *) = ::glGetFloatv;
|
||||
void (* const glGetFramebufferAttachmentParameteriv)(GLenum, GLenum, GLenum, GLint *) = ::glGetFramebufferAttachmentParameteriv;
|
||||
void (* const glGetIntegerv)(GLenum, GLint *) = ::glGetIntegerv;
|
||||
void (* const glGetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *) = ::glGetProgramInfoLog;
|
||||
void (* const glGetProgramiv)(GLuint, GLenum, GLint *) = ::glGetProgramiv;
|
||||
void (* const glGetRenderbufferParameteriv)(GLenum, GLenum, GLint *) = ::glGetRenderbufferParameteriv;
|
||||
void (* const glGetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *) = ::glGetShaderInfoLog;
|
||||
void (* const glGetShaderiv)(GLuint, GLenum, GLint *) = ::glGetShaderiv;
|
||||
void (* const glGetShaderPrecisionFormat)(GLenum, GLenum, GLint *, GLint *) = ::glGetShaderPrecisionFormat;
|
||||
void (* const glGetShaderSource)(GLuint, GLsizei, GLsizei *, GLchar *) = ::glGetShaderSource;
|
||||
const GLubyte *(* const glGetString)(GLenum) = ::glGetString;
|
||||
void (* const glGetTexParameterfv)(GLenum, GLenum, GLfloat *) = ::glGetTexParameterfv;
|
||||
void (* const glGetTexParameteriv)(GLenum, GLenum, GLint *) = ::glGetTexParameteriv;
|
||||
void (* const glGetUniformfv)(GLuint, GLint, GLfloat *) = ::glGetUniformfv;
|
||||
void (* const glGetUniformiv)(GLuint, GLint, GLint *) = ::glGetUniformiv;
|
||||
GLint (* const glGetUniformLocation)(GLuint, const GLchar *) = ::glGetUniformLocation;
|
||||
void (* const glGetVertexAttribfv)(GLuint, GLenum, GLfloat *) = ::glGetVertexAttribfv;
|
||||
void (* const glGetVertexAttribiv)(GLuint, GLenum, GLint *) = ::glGetVertexAttribiv;
|
||||
void (* const glGetVertexAttribPointerv)(GLuint, GLenum, void **) = ::glGetVertexAttribPointerv;
|
||||
void (* const glHint)(GLenum, GLenum) = ::glHint;
|
||||
GLboolean (* const glIsBuffer)(GLuint) = ::glIsBuffer;
|
||||
GLboolean (* const glIsEnabled)(GLenum) = ::glIsEnabled;
|
||||
GLboolean (* const glIsFramebuffer)(GLuint) = ::glIsFramebuffer;
|
||||
GLboolean (* const glIsProgram)(GLuint) = ::glIsProgram;
|
||||
GLboolean (* const glIsRenderbuffer)(GLuint) = ::glIsRenderbuffer;
|
||||
GLboolean (* const glIsShader)(GLuint) = ::glIsShader;
|
||||
GLboolean (* const glIsTexture)(GLuint) = ::glIsTexture;
|
||||
void (* const glLineWidth)(GLfloat) = ::glLineWidth;
|
||||
void (* const glLinkProgram)(GLuint) = ::glLinkProgram;
|
||||
void (* const glPixelStorei)(GLenum, GLint) = ::glPixelStorei;
|
||||
void (* const glPolygonOffset)(GLfloat, GLfloat) = ::glPolygonOffset;
|
||||
void (* const glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void *) = ::glReadPixels;
|
||||
void (* const glReleaseShaderCompiler)() = ::glReleaseShaderCompiler;
|
||||
void (* const glRenderbufferStorage)(GLenum, GLenum, GLsizei, GLsizei) = ::glRenderbufferStorage;
|
||||
void (* const glSampleCoverage)(GLfloat, GLboolean) = ::glSampleCoverage;
|
||||
void (* const glScissor)(GLint, GLint, GLsizei, GLsizei) = ::glScissor;
|
||||
void (* const glShaderBinary)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei) = ::glShaderBinary;
|
||||
void (* const glShaderSource)(GLuint, GLsizei, const GLchar * const*, const GLint *) = ::glShaderSource;
|
||||
void (* const glStencilFunc)(GLenum, GLint, GLuint) = ::glStencilFunc;
|
||||
void (* const glStencilFuncSeparate)(GLenum, GLenum, GLint, GLuint) = ::glStencilFuncSeparate;
|
||||
void (* const glStencilMask)(GLuint) = ::glStencilMask;
|
||||
void (* const glStencilMaskSeparate)(GLenum, GLuint) = ::glStencilMaskSeparate;
|
||||
void (* const glStencilOp)(GLenum, GLenum, GLenum) = ::glStencilOp;
|
||||
void (* const glStencilOpSeparate)(GLenum, GLenum, GLenum, GLenum) = ::glStencilOpSeparate;
|
||||
void (* const glTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *) = ::glTexImage2D;
|
||||
void (* const glTexParameterf)(GLenum, GLenum, GLfloat) = ::glTexParameterf;
|
||||
void (* const glTexParameterfv)(GLenum, GLenum, const GLfloat *) = ::glTexParameterfv;
|
||||
void (* const glTexParameteri)(GLenum, GLenum, GLint) = ::glTexParameteri;
|
||||
void (* const glTexParameteriv)(GLenum, GLenum, const GLint *) = ::glTexParameteriv;
|
||||
void (* const glTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *) = ::glTexSubImage2D;
|
||||
void (* const glUniform1f)(GLint, GLfloat) = ::glUniform1f;
|
||||
void (* const glUniform1fv)(GLint, GLsizei, const GLfloat *) = ::glUniform1fv;
|
||||
void (* const glUniform1i)(GLint, GLint) = ::glUniform1i;
|
||||
void (* const glUniform1iv)(GLint, GLsizei, const GLint *) = ::glUniform1iv;
|
||||
void (* const glUniform2f)(GLint, GLfloat, GLfloat) = ::glUniform2f;
|
||||
void (* const glUniform2fv)(GLint, GLsizei, const GLfloat *) = ::glUniform2fv;
|
||||
void (* const glUniform2i)(GLint, GLint, GLint) = ::glUniform2i;
|
||||
void (* const glUniform2iv)(GLint, GLsizei, const GLint *) = ::glUniform2iv;
|
||||
void (* const glUniform3f)(GLint, GLfloat, GLfloat, GLfloat) = ::glUniform3f;
|
||||
void (* const glUniform3fv)(GLint, GLsizei, const GLfloat *) = ::glUniform3fv;
|
||||
void (* const glUniform3i)(GLint, GLint, GLint, GLint) = ::glUniform3i;
|
||||
void (* const glUniform3iv)(GLint, GLsizei, const GLint *) = ::glUniform3iv;
|
||||
void (* const glUniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat) = ::glUniform4f;
|
||||
void (* const glUniform4fv)(GLint, GLsizei, const GLfloat *) = ::glUniform4fv;
|
||||
void (* const glUniform4i)(GLint, GLint, GLint, GLint, GLint) = ::glUniform4i;
|
||||
void (* const glUniform4iv)(GLint, GLsizei, const GLint *) = ::glUniform4iv;
|
||||
void (* const glUniformMatrix2fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix2fv;
|
||||
void (* const glUniformMatrix3fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix3fv;
|
||||
void (* const glUniformMatrix4fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix4fv;
|
||||
void (* const glUseProgram)(GLuint) = ::glUseProgram;
|
||||
void (* const glValidateProgram)(GLuint) = ::glValidateProgram;
|
||||
void (* const glVertexAttrib1f)(GLuint, GLfloat) = ::glVertexAttrib1f;
|
||||
void (* const glVertexAttrib1fv)(GLuint, const GLfloat *) = ::glVertexAttrib1fv;
|
||||
void (* const glVertexAttrib2f)(GLuint, GLfloat, GLfloat) = ::glVertexAttrib2f;
|
||||
void (* const glVertexAttrib2fv)(GLuint, const GLfloat *) = ::glVertexAttrib2fv;
|
||||
void (* const glVertexAttrib3f)(GLuint, GLfloat, GLfloat, GLfloat) = ::glVertexAttrib3f;
|
||||
void (* const glVertexAttrib3fv)(GLuint, const GLfloat *) = ::glVertexAttrib3fv;
|
||||
void (* const glVertexAttrib4f)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat) = ::glVertexAttrib4f;
|
||||
void (* const glVertexAttrib4fv)(GLuint, const GLfloat *) = ::glVertexAttrib4fv;
|
||||
void (* const glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *) = ::glVertexAttribPointer;
|
||||
void (* const glViewport)(GLint, GLint, GLsizei, GLsizei) = ::glViewport;
|
||||
void (*const glActiveTexture)(GLenum) = ::glActiveTexture;
|
||||
void (*const glAttachShader)(GLuint, GLuint) = ::glAttachShader;
|
||||
void (*const glBindAttribLocation)(GLuint, GLuint, const GLchar*) = ::glBindAttribLocation;
|
||||
void (*const glBindBuffer)(GLenum, GLuint) = ::glBindBuffer;
|
||||
void (*const glBindFramebuffer)(GLenum, GLuint) = ::glBindFramebuffer;
|
||||
void (*const glBindRenderbuffer)(GLenum, GLuint) = ::glBindRenderbuffer;
|
||||
void (*const glBindTexture)(GLenum, GLuint) = ::glBindTexture;
|
||||
void (*const glBlendColor)(GLfloat, GLfloat, GLfloat, GLfloat) = ::glBlendColor;
|
||||
void (*const glBlendEquation)(GLenum) = ::glBlendEquation;
|
||||
void (*const glBlendEquationSeparate)(GLenum, GLenum) = ::glBlendEquationSeparate;
|
||||
void (*const glBlendFunc)(GLenum, GLenum) = ::glBlendFunc;
|
||||
void (*const glBlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum) = ::glBlendFuncSeparate;
|
||||
void (*const glBufferData)(GLenum, GLsizeiptr, const void*, GLenum) = ::glBufferData;
|
||||
void (*const glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const void*) = ::glBufferSubData;
|
||||
GLenum (*const glCheckFramebufferStatus)(GLenum) = ::glCheckFramebufferStatus;
|
||||
void (*const glClear)(GLbitfield) = ::glClear;
|
||||
void (*const glClearColor)(GLfloat, GLfloat, GLfloat, GLfloat) = ::glClearColor;
|
||||
void (*const glClearDepthf)(GLfloat) = ::glClearDepthf;
|
||||
void (*const glClearStencil)(GLint) = ::glClearStencil;
|
||||
void (*const glColorMask)(GLboolean, GLboolean, GLboolean, GLboolean) = ::glColorMask;
|
||||
void (*const glCompileShader)(GLuint) = ::glCompileShader;
|
||||
void (*const glCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*) =
|
||||
::glCompressedTexImage2D;
|
||||
void (*const glCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void*) =
|
||||
::glCompressedTexSubImage2D;
|
||||
void (*const glCopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) = ::glCopyTexImage2D;
|
||||
void (*const glCopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) = ::glCopyTexSubImage2D;
|
||||
GLuint (*const glCreateProgram)() = ::glCreateProgram;
|
||||
GLuint (*const glCreateShader)(GLenum) = ::glCreateShader;
|
||||
void (*const glCullFace)(GLenum) = ::glCullFace;
|
||||
void (*const glDeleteBuffers)(GLsizei, const GLuint*) = ::glDeleteBuffers;
|
||||
void (*const glDeleteFramebuffers)(GLsizei, const GLuint*) = ::glDeleteFramebuffers;
|
||||
void (*const glDeleteProgram)(GLuint) = ::glDeleteProgram;
|
||||
void (*const glDeleteRenderbuffers)(GLsizei, const GLuint*) = ::glDeleteRenderbuffers;
|
||||
void (*const glDeleteShader)(GLuint) = ::glDeleteShader;
|
||||
void (*const glDeleteTextures)(GLsizei, const GLuint*) = ::glDeleteTextures;
|
||||
void (*const glDepthFunc)(GLenum) = ::glDepthFunc;
|
||||
void (*const glDepthMask)(GLboolean) = ::glDepthMask;
|
||||
void (*const glDepthRangef)(GLfloat, GLfloat) = ::glDepthRangef;
|
||||
void (*const glDetachShader)(GLuint, GLuint) = ::glDetachShader;
|
||||
void (*const glDisable)(GLenum) = ::glDisable;
|
||||
void (*const glDisableVertexAttribArray)(GLuint) = ::glDisableVertexAttribArray;
|
||||
void (*const glDrawArrays)(GLenum, GLint, GLsizei) = ::glDrawArrays;
|
||||
void (*const glDrawElements)(GLenum, GLsizei, GLenum, const void*) = ::glDrawElements;
|
||||
void (*const glEnable)(GLenum) = ::glEnable;
|
||||
void (*const glEnableVertexAttribArray)(GLuint) = ::glEnableVertexAttribArray;
|
||||
void (*const glFinish)() = ::glFinish;
|
||||
void (*const glFlush)() = ::glFlush;
|
||||
void (*const glFramebufferRenderbuffer)(GLenum, GLenum, GLenum, GLuint) = ::glFramebufferRenderbuffer;
|
||||
void (*const glFramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint) = ::glFramebufferTexture2D;
|
||||
void (*const glFrontFace)(GLenum) = ::glFrontFace;
|
||||
void (*const glGenBuffers)(GLsizei, GLuint*) = ::glGenBuffers;
|
||||
void (*const glGenerateMipmap)(GLenum) = ::glGenerateMipmap;
|
||||
void (*const glGenFramebuffers)(GLsizei, GLuint*) = ::glGenFramebuffers;
|
||||
void (*const glGenRenderbuffers)(GLsizei, GLuint*) = ::glGenRenderbuffers;
|
||||
void (*const glGenTextures)(GLsizei, GLuint*) = ::glGenTextures;
|
||||
void (*const glGetActiveAttrib)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*) = ::glGetActiveAttrib;
|
||||
void (*const glGetActiveUniform)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*) = ::glGetActiveUniform;
|
||||
void (*const glGetAttachedShaders)(GLuint, GLsizei, GLsizei*, GLuint*) = ::glGetAttachedShaders;
|
||||
GLint (*const glGetAttribLocation)(GLuint, const GLchar*) = ::glGetAttribLocation;
|
||||
void (*const glGetBooleanv)(GLenum, GLboolean*) = ::glGetBooleanv;
|
||||
void (*const glGetBufferParameteriv)(GLenum, GLenum, GLint*) = ::glGetBufferParameteriv;
|
||||
GLenum (*const glGetError)() = ::glGetError;
|
||||
void (*const glGetFloatv)(GLenum, GLfloat*) = ::glGetFloatv;
|
||||
void (*const glGetFramebufferAttachmentParameteriv)(GLenum,
|
||||
GLenum,
|
||||
GLenum,
|
||||
GLint*) = ::glGetFramebufferAttachmentParameteriv;
|
||||
void (*const glGetIntegerv)(GLenum, GLint*) = ::glGetIntegerv;
|
||||
void (*const glGetProgramInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*) = ::glGetProgramInfoLog;
|
||||
void (*const glGetProgramiv)(GLuint, GLenum, GLint*) = ::glGetProgramiv;
|
||||
void (*const glGetRenderbufferParameteriv)(GLenum, GLenum, GLint*) = ::glGetRenderbufferParameteriv;
|
||||
void (*const glGetShaderInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*) = ::glGetShaderInfoLog;
|
||||
void (*const glGetShaderiv)(GLuint, GLenum, GLint*) = ::glGetShaderiv;
|
||||
void (*const glGetShaderPrecisionFormat)(GLenum, GLenum, GLint*, GLint*) = ::glGetShaderPrecisionFormat;
|
||||
void (*const glGetShaderSource)(GLuint, GLsizei, GLsizei*, GLchar*) = ::glGetShaderSource;
|
||||
const GLubyte* (*const glGetString)(GLenum) = ::glGetString;
|
||||
void (*const glGetTexParameterfv)(GLenum, GLenum, GLfloat*) = ::glGetTexParameterfv;
|
||||
void (*const glGetTexParameteriv)(GLenum, GLenum, GLint*) = ::glGetTexParameteriv;
|
||||
void (*const glGetUniformfv)(GLuint, GLint, GLfloat*) = ::glGetUniformfv;
|
||||
void (*const glGetUniformiv)(GLuint, GLint, GLint*) = ::glGetUniformiv;
|
||||
GLint (*const glGetUniformLocation)(GLuint, const GLchar*) = ::glGetUniformLocation;
|
||||
void (*const glGetVertexAttribfv)(GLuint, GLenum, GLfloat*) = ::glGetVertexAttribfv;
|
||||
void (*const glGetVertexAttribiv)(GLuint, GLenum, GLint*) = ::glGetVertexAttribiv;
|
||||
void (*const glGetVertexAttribPointerv)(GLuint, GLenum, void**) = ::glGetVertexAttribPointerv;
|
||||
void (*const glHint)(GLenum, GLenum) = ::glHint;
|
||||
GLboolean (*const glIsBuffer)(GLuint) = ::glIsBuffer;
|
||||
GLboolean (*const glIsEnabled)(GLenum) = ::glIsEnabled;
|
||||
GLboolean (*const glIsFramebuffer)(GLuint) = ::glIsFramebuffer;
|
||||
GLboolean (*const glIsProgram)(GLuint) = ::glIsProgram;
|
||||
GLboolean (*const glIsRenderbuffer)(GLuint) = ::glIsRenderbuffer;
|
||||
GLboolean (*const glIsShader)(GLuint) = ::glIsShader;
|
||||
GLboolean (*const glIsTexture)(GLuint) = ::glIsTexture;
|
||||
void (*const glLineWidth)(GLfloat) = ::glLineWidth;
|
||||
void (*const glLinkProgram)(GLuint) = ::glLinkProgram;
|
||||
void (*const glPixelStorei)(GLenum, GLint) = ::glPixelStorei;
|
||||
void (*const glPolygonOffset)(GLfloat, GLfloat) = ::glPolygonOffset;
|
||||
void (*const glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*) = ::glReadPixels;
|
||||
void (*const glReleaseShaderCompiler)() = ::glReleaseShaderCompiler;
|
||||
void (*const glRenderbufferStorage)(GLenum, GLenum, GLsizei, GLsizei) = ::glRenderbufferStorage;
|
||||
void (*const glSampleCoverage)(GLfloat, GLboolean) = ::glSampleCoverage;
|
||||
void (*const glScissor)(GLint, GLint, GLsizei, GLsizei) = ::glScissor;
|
||||
void (*const glShaderBinary)(GLsizei, const GLuint*, GLenum, const GLvoid*, GLsizei) = ::glShaderBinary;
|
||||
void (*const glShaderSource)(GLuint, GLsizei, const GLchar* const*, const GLint*) = ::glShaderSource;
|
||||
void (*const glStencilFunc)(GLenum, GLint, GLuint) = ::glStencilFunc;
|
||||
void (*const glStencilFuncSeparate)(GLenum, GLenum, GLint, GLuint) = ::glStencilFuncSeparate;
|
||||
void (*const glStencilMask)(GLuint) = ::glStencilMask;
|
||||
void (*const glStencilMaskSeparate)(GLenum, GLuint) = ::glStencilMaskSeparate;
|
||||
void (*const glStencilOp)(GLenum, GLenum, GLenum) = ::glStencilOp;
|
||||
void (*const glStencilOpSeparate)(GLenum, GLenum, GLenum, GLenum) = ::glStencilOpSeparate;
|
||||
void (*const glTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*) = ::glTexImage2D;
|
||||
void (*const glTexParameterf)(GLenum, GLenum, GLfloat) = ::glTexParameterf;
|
||||
void (*const glTexParameterfv)(GLenum, GLenum, const GLfloat*) = ::glTexParameterfv;
|
||||
void (*const glTexParameteri)(GLenum, GLenum, GLint) = ::glTexParameteri;
|
||||
void (*const glTexParameteriv)(GLenum, GLenum, const GLint*) = ::glTexParameteriv;
|
||||
void (*const glTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void*) =
|
||||
::glTexSubImage2D;
|
||||
void (*const glUniform1f)(GLint, GLfloat) = ::glUniform1f;
|
||||
void (*const glUniform1fv)(GLint, GLsizei, const GLfloat*) = ::glUniform1fv;
|
||||
void (*const glUniform1i)(GLint, GLint) = ::glUniform1i;
|
||||
void (*const glUniform1iv)(GLint, GLsizei, const GLint*) = ::glUniform1iv;
|
||||
void (*const glUniform2f)(GLint, GLfloat, GLfloat) = ::glUniform2f;
|
||||
void (*const glUniform2fv)(GLint, GLsizei, const GLfloat*) = ::glUniform2fv;
|
||||
void (*const glUniform2i)(GLint, GLint, GLint) = ::glUniform2i;
|
||||
void (*const glUniform2iv)(GLint, GLsizei, const GLint*) = ::glUniform2iv;
|
||||
void (*const glUniform3f)(GLint, GLfloat, GLfloat, GLfloat) = ::glUniform3f;
|
||||
void (*const glUniform3fv)(GLint, GLsizei, const GLfloat*) = ::glUniform3fv;
|
||||
void (*const glUniform3i)(GLint, GLint, GLint, GLint) = ::glUniform3i;
|
||||
void (*const glUniform3iv)(GLint, GLsizei, const GLint*) = ::glUniform3iv;
|
||||
void (*const glUniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat) = ::glUniform4f;
|
||||
void (*const glUniform4fv)(GLint, GLsizei, const GLfloat*) = ::glUniform4fv;
|
||||
void (*const glUniform4i)(GLint, GLint, GLint, GLint, GLint) = ::glUniform4i;
|
||||
void (*const glUniform4iv)(GLint, GLsizei, const GLint*) = ::glUniform4iv;
|
||||
void (*const glUniformMatrix2fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix2fv;
|
||||
void (*const glUniformMatrix3fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix3fv;
|
||||
void (*const glUniformMatrix4fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix4fv;
|
||||
void (*const glUseProgram)(GLuint) = ::glUseProgram;
|
||||
void (*const glValidateProgram)(GLuint) = ::glValidateProgram;
|
||||
void (*const glVertexAttrib1f)(GLuint, GLfloat) = ::glVertexAttrib1f;
|
||||
void (*const glVertexAttrib1fv)(GLuint, const GLfloat*) = ::glVertexAttrib1fv;
|
||||
void (*const glVertexAttrib2f)(GLuint, GLfloat, GLfloat) = ::glVertexAttrib2f;
|
||||
void (*const glVertexAttrib2fv)(GLuint, const GLfloat*) = ::glVertexAttrib2fv;
|
||||
void (*const glVertexAttrib3f)(GLuint, GLfloat, GLfloat, GLfloat) = ::glVertexAttrib3f;
|
||||
void (*const glVertexAttrib3fv)(GLuint, const GLfloat*) = ::glVertexAttrib3fv;
|
||||
void (*const glVertexAttrib4f)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat) = ::glVertexAttrib4f;
|
||||
void (*const glVertexAttrib4fv)(GLuint, const GLfloat*) = ::glVertexAttrib4fv;
|
||||
void (*const glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void*) = ::glVertexAttribPointer;
|
||||
void (*const glViewport)(GLint, GLint, GLsizei, GLsizei) = ::glViewport;
|
||||
|
||||
/* OpenGL ES 3.0 */
|
||||
|
||||
void (* const glReadBuffer)(GLenum) = ::glReadBuffer;
|
||||
void (* const glDrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *) = ::glDrawRangeElements;
|
||||
void (* const glTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = ::glTexImage3D;
|
||||
void (* const glTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = ::glTexSubImage3D;
|
||||
void (* const glCopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) = ::glCopyTexSubImage3D;
|
||||
void (* const glCompressedTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *) = ::glCompressedTexImage3D;
|
||||
void (* const glCompressedTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *) = ::glCompressedTexSubImage3D;
|
||||
void (* const glGenQueries)(GLsizei, GLuint *) = ::glGenQueries;
|
||||
void (* const glDeleteQueries)(GLsizei, const GLuint *) = ::glDeleteQueries;
|
||||
GLboolean (* const glIsQuery)(GLuint) = ::glIsQuery;
|
||||
void (* const glBeginQuery)(GLenum, GLuint) = ::glBeginQuery;
|
||||
void (* const glEndQuery)(GLenum) = ::glEndQuery;
|
||||
void (* const glGetQueryiv)(GLenum, GLenum, GLint *) = ::glGetQueryiv;
|
||||
void (* const glGetQueryObjectuiv)(GLuint, GLenum, GLuint *) = ::glGetQueryObjectuiv;
|
||||
GLboolean (* const glUnmapBuffer)(GLenum) = ::glUnmapBuffer;
|
||||
void (* const glGetBufferPointerv)(GLenum, GLenum, GLvoid **) = ::glGetBufferPointerv;
|
||||
void (* const glDrawBuffers)(GLsizei, const GLenum *) = ::glDrawBuffers;
|
||||
void (* const glUniformMatrix2x3fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix2x3fv;
|
||||
void (* const glUniformMatrix3x2fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix3x2fv;
|
||||
void (* const glUniformMatrix2x4fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix2x4fv;
|
||||
void (* const glUniformMatrix4x2fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix4x2fv;
|
||||
void (* const glUniformMatrix3x4fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix3x4fv;
|
||||
void (* const glUniformMatrix4x3fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix4x3fv;
|
||||
void (* const glBlitFramebuffer)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum) = ::glBlitFramebuffer;
|
||||
void (* const glRenderbufferStorageMultisample)(GLenum, GLsizei, GLenum, GLsizei, GLsizei) = ::glRenderbufferStorageMultisample;
|
||||
void (* const glFramebufferTextureLayer)(GLenum, GLenum, GLuint, GLint, GLint) = ::glFramebufferTextureLayer;
|
||||
GLvoid* (* const glMapBufferRange)(GLenum, GLintptr, GLsizeiptr, GLbitfield) = ::glMapBufferRange;
|
||||
void (* const glFlushMappedBufferRange)(GLenum, GLintptr, GLsizeiptr) = ::glFlushMappedBufferRange;
|
||||
void (* const glBindVertexArray)(GLuint) = ::glBindVertexArray;
|
||||
void (* const glDeleteVertexArrays)(GLsizei, const GLuint *) = ::glDeleteVertexArrays;
|
||||
void (* const glGenVertexArrays)(GLsizei, GLuint *) = ::glGenVertexArrays;
|
||||
GLboolean (* const glIsVertexArray)(GLuint) = ::glIsVertexArray;
|
||||
void (* const glGetIntegeri_v)(GLenum, GLuint, GLint *) = ::glGetIntegeri_v;
|
||||
void (* const glBeginTransformFeedback)(GLenum) = ::glBeginTransformFeedback;
|
||||
void (* const glEndTransformFeedback)() = ::glEndTransformFeedback;
|
||||
void (* const glBindBufferRange)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr) = ::glBindBufferRange;
|
||||
void (* const glBindBufferBase)(GLenum, GLuint, GLuint) = ::glBindBufferBase;
|
||||
void (* const glTransformFeedbackVaryings)(GLuint, GLsizei, const GLchar * const*, GLenum) = ::glTransformFeedbackVaryings;
|
||||
void (* const glGetTransformFeedbackVarying)(GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *) = ::glGetTransformFeedbackVarying;
|
||||
void (* const glVertexAttribIPointer)(GLuint, GLint, GLenum, GLsizei, const GLvoid *) = ::glVertexAttribIPointer;
|
||||
void (* const glGetVertexAttribIiv)(GLuint, GLenum, GLint *) = ::glGetVertexAttribIiv;
|
||||
void (* const glGetVertexAttribIuiv)(GLuint, GLenum, GLuint *) = ::glGetVertexAttribIuiv;
|
||||
void (* const glVertexAttribI4i)(GLuint, GLint, GLint, GLint, GLint) = ::glVertexAttribI4i;
|
||||
void (* const glVertexAttribI4ui)(GLuint, GLuint, GLuint, GLuint, GLuint) = ::glVertexAttribI4ui;
|
||||
void (* const glVertexAttribI4iv)(GLuint, const GLint *) = ::glVertexAttribI4iv;
|
||||
void (* const glVertexAttribI4uiv)(GLuint, const GLuint *) = ::glVertexAttribI4uiv;
|
||||
void (* const glGetUniformuiv)(GLuint, GLint, GLuint *) = ::glGetUniformuiv;
|
||||
GLint (* const glGetFragDataLocation)(GLuint, const GLchar *) = ::glGetFragDataLocation;
|
||||
void (* const glUniform1ui)(GLint, GLuint) = ::glUniform1ui;
|
||||
void (* const glUniform2ui)(GLint, GLuint, GLuint) = ::glUniform2ui;
|
||||
void (* const glUniform3ui)(GLint, GLuint, GLuint, GLuint) = ::glUniform3ui;
|
||||
void (* const glUniform4ui)(GLint, GLuint, GLuint, GLuint, GLuint) = ::glUniform4ui;
|
||||
void (* const glUniform1uiv)(GLint, GLsizei, const GLuint *) = ::glUniform1uiv;
|
||||
void (* const glUniform2uiv)(GLint, GLsizei, const GLuint *) = ::glUniform2uiv;
|
||||
void (* const glUniform3uiv)(GLint, GLsizei, const GLuint *) = ::glUniform3uiv;
|
||||
void (* const glUniform4uiv)(GLint, GLsizei, const GLuint *) = ::glUniform4uiv;
|
||||
void (* const glClearBufferiv)(GLenum, GLint, const GLint *) = ::glClearBufferiv;
|
||||
void (* const glClearBufferuiv)(GLenum, GLint, const GLuint *) = ::glClearBufferuiv;
|
||||
void (* const glClearBufferfv)(GLenum, GLint, const GLfloat *) = ::glClearBufferfv;
|
||||
void (* const glClearBufferfi)(GLenum, GLint, GLfloat, GLint) = ::glClearBufferfi;
|
||||
const GLubyte* (* const glGetStringi)(GLenum, GLuint) = ::glGetStringi;
|
||||
void (* const glCopyBufferSubData)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr) = ::glCopyBufferSubData;
|
||||
void (* const glGetUniformIndices)(GLuint, GLsizei, const GLchar * const*, GLuint *) = ::glGetUniformIndices;
|
||||
void (* const glGetActiveUniformsiv)(GLuint, GLsizei, const GLuint *, GLenum, GLint *) = ::glGetActiveUniformsiv;
|
||||
GLuint (* const glGetUniformBlockIndex)(GLuint, const GLchar *) = ::glGetUniformBlockIndex;
|
||||
void (* const glGetActiveUniformBlockiv)(GLuint, GLuint, GLenum, GLint *) = ::glGetActiveUniformBlockiv;
|
||||
void (* const glGetActiveUniformBlockName)(GLuint, GLuint, GLsizei, GLsizei *, GLchar *) = ::glGetActiveUniformBlockName;
|
||||
void (* const glUniformBlockBinding)(GLuint, GLuint, GLuint) = ::glUniformBlockBinding;
|
||||
void (* const glDrawArraysInstanced)(GLenum, GLint, GLsizei, GLsizei) = ::glDrawArraysInstanced;
|
||||
void (* const glDrawElementsInstanced)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei) = ::glDrawElementsInstanced;
|
||||
GLsync (* const glFenceSync)(GLenum, GLbitfield) = ::glFenceSync;
|
||||
GLboolean (* const glIsSync)(GLsync) = ::glIsSync;
|
||||
void (* const glDeleteSync)(GLsync) = ::glDeleteSync;
|
||||
GLenum (* const glClientWaitSync)(GLsync, GLbitfield, GLuint64) = ::glClientWaitSync;
|
||||
void (* const glWaitSync)(GLsync, GLbitfield, GLuint64) = ::glWaitSync;
|
||||
void (* const glGetInteger64v)(GLenum, GLint64 *) = ::glGetInteger64v;
|
||||
void (* const glGetSynciv)(GLsync, GLenum, GLsizei, GLsizei *, GLint *) = ::glGetSynciv;
|
||||
void (* const glGetInteger64i_v)(GLenum, GLuint, GLint64 *) = ::glGetInteger64i_v;
|
||||
void (* const glGetBufferParameteri64v)(GLenum, GLenum, GLint64 *) = ::glGetBufferParameteri64v;
|
||||
void (* const glGenSamplers)(GLsizei, GLuint *) = ::glGenSamplers;
|
||||
void (* const glDeleteSamplers)(GLsizei, const GLuint *) = ::glDeleteSamplers;
|
||||
GLboolean (* const glIsSampler)(GLuint) = ::glIsSampler;
|
||||
void (* const glBindSampler)(GLuint, GLuint) = ::glBindSampler;
|
||||
void (* const glSamplerParameteri)(GLuint, GLenum, GLint) = ::glSamplerParameteri;
|
||||
void (* const glSamplerParameteriv)(GLuint, GLenum, const GLint *) = ::glSamplerParameteriv;
|
||||
void (* const glSamplerParameterf)(GLuint, GLenum, GLfloat) = ::glSamplerParameterf;
|
||||
void (* const glSamplerParameterfv)(GLuint, GLenum, const GLfloat *) = ::glSamplerParameterfv;
|
||||
void (* const glGetSamplerParameteriv)(GLuint, GLenum, GLint *) = ::glGetSamplerParameteriv;
|
||||
void (* const glGetSamplerParameterfv)(GLuint, GLenum, GLfloat *) = ::glGetSamplerParameterfv;
|
||||
void (* const glVertexAttribDivisor)(GLuint, GLuint) = ::glVertexAttribDivisor;
|
||||
void (* const glBindTransformFeedback)(GLenum, GLuint) = ::glBindTransformFeedback;
|
||||
void (* const glDeleteTransformFeedbacks)(GLsizei, const GLuint *) = ::glDeleteTransformFeedbacks;
|
||||
void (* const glGenTransformFeedbacks)(GLsizei, GLuint *) = ::glGenTransformFeedbacks;
|
||||
GLboolean (* const glIsTransformFeedback)(GLuint) = ::glIsTransformFeedback;
|
||||
void (* const glPauseTransformFeedback)() = ::glPauseTransformFeedback;
|
||||
void (* const glResumeTransformFeedback)() = ::glResumeTransformFeedback;
|
||||
void (* const glGetProgramBinary)(GLuint, GLsizei, GLsizei *, GLenum *, GLvoid *) = ::glGetProgramBinary;
|
||||
void (* const glProgramBinary)(GLuint, GLenum, const GLvoid *, GLsizei) = ::glProgramBinary;
|
||||
void (* const glProgramParameteri)(GLuint, GLenum, GLint) = ::glProgramParameteri;
|
||||
void (*const glReadBuffer)(GLenum) = ::glReadBuffer;
|
||||
void (*const glDrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid*) = ::glDrawRangeElements;
|
||||
void (*const glTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*) =
|
||||
::glTexImage3D;
|
||||
void (*const glTexSubImage3D)(
|
||||
GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*) = ::glTexSubImage3D;
|
||||
void (*const glCopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) =
|
||||
::glCopyTexSubImage3D;
|
||||
void (*const glCompressedTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*) =
|
||||
::glCompressedTexImage3D;
|
||||
void (*const glCompressedTexSubImage3D)(
|
||||
GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*) =
|
||||
::glCompressedTexSubImage3D;
|
||||
void (*const glGenQueries)(GLsizei, GLuint*) = ::glGenQueries;
|
||||
void (*const glDeleteQueries)(GLsizei, const GLuint*) = ::glDeleteQueries;
|
||||
GLboolean (*const glIsQuery)(GLuint) = ::glIsQuery;
|
||||
void (*const glBeginQuery)(GLenum, GLuint) = ::glBeginQuery;
|
||||
void (*const glEndQuery)(GLenum) = ::glEndQuery;
|
||||
void (*const glGetQueryiv)(GLenum, GLenum, GLint*) = ::glGetQueryiv;
|
||||
void (*const glGetQueryObjectuiv)(GLuint, GLenum, GLuint*) = ::glGetQueryObjectuiv;
|
||||
GLboolean (*const glUnmapBuffer)(GLenum) = ::glUnmapBuffer;
|
||||
void (*const glGetBufferPointerv)(GLenum, GLenum, GLvoid**) = ::glGetBufferPointerv;
|
||||
void (*const glDrawBuffers)(GLsizei, const GLenum*) = ::glDrawBuffers;
|
||||
void (*const glUniformMatrix2x3fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix2x3fv;
|
||||
void (*const glUniformMatrix3x2fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix3x2fv;
|
||||
void (*const glUniformMatrix2x4fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix2x4fv;
|
||||
void (*const glUniformMatrix4x2fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix4x2fv;
|
||||
void (*const glUniformMatrix3x4fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix3x4fv;
|
||||
void (*const glUniformMatrix4x3fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix4x3fv;
|
||||
void (*const glBlitFramebuffer)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum) =
|
||||
::glBlitFramebuffer;
|
||||
void (*const glRenderbufferStorageMultisample)(GLenum, GLsizei, GLenum, GLsizei, GLsizei) =
|
||||
::glRenderbufferStorageMultisample;
|
||||
void (*const glFramebufferTextureLayer)(GLenum, GLenum, GLuint, GLint, GLint) = ::glFramebufferTextureLayer;
|
||||
GLvoid* (*const glMapBufferRange)(GLenum, GLintptr, GLsizeiptr, GLbitfield) = ::glMapBufferRange;
|
||||
void (*const glFlushMappedBufferRange)(GLenum, GLintptr, GLsizeiptr) = ::glFlushMappedBufferRange;
|
||||
void (*const glBindVertexArray)(GLuint) = ::glBindVertexArray;
|
||||
void (*const glDeleteVertexArrays)(GLsizei, const GLuint*) = ::glDeleteVertexArrays;
|
||||
void (*const glGenVertexArrays)(GLsizei, GLuint*) = ::glGenVertexArrays;
|
||||
GLboolean (*const glIsVertexArray)(GLuint) = ::glIsVertexArray;
|
||||
void (*const glGetIntegeri_v)(GLenum, GLuint, GLint*) = ::glGetIntegeri_v;
|
||||
void (*const glBeginTransformFeedback)(GLenum) = ::glBeginTransformFeedback;
|
||||
void (*const glEndTransformFeedback)() = ::glEndTransformFeedback;
|
||||
void (*const glBindBufferRange)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr) = ::glBindBufferRange;
|
||||
void (*const glBindBufferBase)(GLenum, GLuint, GLuint) = ::glBindBufferBase;
|
||||
void (*const glTransformFeedbackVaryings)(GLuint,
|
||||
GLsizei,
|
||||
const GLchar* const*,
|
||||
GLenum) = ::glTransformFeedbackVaryings;
|
||||
void (*const glGetTransformFeedbackVarying)(GLuint, GLuint, GLsizei, GLsizei*, GLsizei*, GLenum*, GLchar*) =
|
||||
::glGetTransformFeedbackVarying;
|
||||
void (*const glVertexAttribIPointer)(GLuint, GLint, GLenum, GLsizei, const GLvoid*) = ::glVertexAttribIPointer;
|
||||
void (*const glGetVertexAttribIiv)(GLuint, GLenum, GLint*) = ::glGetVertexAttribIiv;
|
||||
void (*const glGetVertexAttribIuiv)(GLuint, GLenum, GLuint*) = ::glGetVertexAttribIuiv;
|
||||
void (*const glVertexAttribI4i)(GLuint, GLint, GLint, GLint, GLint) = ::glVertexAttribI4i;
|
||||
void (*const glVertexAttribI4ui)(GLuint, GLuint, GLuint, GLuint, GLuint) = ::glVertexAttribI4ui;
|
||||
void (*const glVertexAttribI4iv)(GLuint, const GLint*) = ::glVertexAttribI4iv;
|
||||
void (*const glVertexAttribI4uiv)(GLuint, const GLuint*) = ::glVertexAttribI4uiv;
|
||||
void (*const glGetUniformuiv)(GLuint, GLint, GLuint*) = ::glGetUniformuiv;
|
||||
GLint (*const glGetFragDataLocation)(GLuint, const GLchar*) = ::glGetFragDataLocation;
|
||||
void (*const glUniform1ui)(GLint, GLuint) = ::glUniform1ui;
|
||||
void (*const glUniform2ui)(GLint, GLuint, GLuint) = ::glUniform2ui;
|
||||
void (*const glUniform3ui)(GLint, GLuint, GLuint, GLuint) = ::glUniform3ui;
|
||||
void (*const glUniform4ui)(GLint, GLuint, GLuint, GLuint, GLuint) = ::glUniform4ui;
|
||||
void (*const glUniform1uiv)(GLint, GLsizei, const GLuint*) = ::glUniform1uiv;
|
||||
void (*const glUniform2uiv)(GLint, GLsizei, const GLuint*) = ::glUniform2uiv;
|
||||
void (*const glUniform3uiv)(GLint, GLsizei, const GLuint*) = ::glUniform3uiv;
|
||||
void (*const glUniform4uiv)(GLint, GLsizei, const GLuint*) = ::glUniform4uiv;
|
||||
void (*const glClearBufferiv)(GLenum, GLint, const GLint*) = ::glClearBufferiv;
|
||||
void (*const glClearBufferuiv)(GLenum, GLint, const GLuint*) = ::glClearBufferuiv;
|
||||
void (*const glClearBufferfv)(GLenum, GLint, const GLfloat*) = ::glClearBufferfv;
|
||||
void (*const glClearBufferfi)(GLenum, GLint, GLfloat, GLint) = ::glClearBufferfi;
|
||||
const GLubyte* (*const glGetStringi)(GLenum, GLuint) = ::glGetStringi;
|
||||
void (*const glCopyBufferSubData)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr) = ::glCopyBufferSubData;
|
||||
void (*const glGetUniformIndices)(GLuint, GLsizei, const GLchar* const*, GLuint*) = ::glGetUniformIndices;
|
||||
void (*const glGetActiveUniformsiv)(GLuint, GLsizei, const GLuint*, GLenum, GLint*) = ::glGetActiveUniformsiv;
|
||||
GLuint (*const glGetUniformBlockIndex)(GLuint, const GLchar*) = ::glGetUniformBlockIndex;
|
||||
void (*const glGetActiveUniformBlockiv)(GLuint, GLuint, GLenum, GLint*) = ::glGetActiveUniformBlockiv;
|
||||
void (*const glGetActiveUniformBlockName)(GLuint, GLuint, GLsizei, GLsizei*, GLchar*) = ::glGetActiveUniformBlockName;
|
||||
void (*const glUniformBlockBinding)(GLuint, GLuint, GLuint) = ::glUniformBlockBinding;
|
||||
void (*const glDrawArraysInstanced)(GLenum, GLint, GLsizei, GLsizei) = ::glDrawArraysInstanced;
|
||||
void (*const glDrawElementsInstanced)(GLenum, GLsizei, GLenum, const GLvoid*, GLsizei) = ::glDrawElementsInstanced;
|
||||
GLsync (*const glFenceSync)(GLenum, GLbitfield) = ::glFenceSync;
|
||||
GLboolean (*const glIsSync)(GLsync) = ::glIsSync;
|
||||
void (*const glDeleteSync)(GLsync) = ::glDeleteSync;
|
||||
GLenum (*const glClientWaitSync)(GLsync, GLbitfield, GLuint64) = ::glClientWaitSync;
|
||||
void (*const glWaitSync)(GLsync, GLbitfield, GLuint64) = ::glWaitSync;
|
||||
void (*const glGetInteger64v)(GLenum, GLint64*) = ::glGetInteger64v;
|
||||
void (*const glGetSynciv)(GLsync, GLenum, GLsizei, GLsizei*, GLint*) = ::glGetSynciv;
|
||||
void (*const glGetInteger64i_v)(GLenum, GLuint, GLint64*) = ::glGetInteger64i_v;
|
||||
void (*const glGetBufferParameteri64v)(GLenum, GLenum, GLint64*) = ::glGetBufferParameteri64v;
|
||||
void (*const glGenSamplers)(GLsizei, GLuint*) = ::glGenSamplers;
|
||||
void (*const glDeleteSamplers)(GLsizei, const GLuint*) = ::glDeleteSamplers;
|
||||
GLboolean (*const glIsSampler)(GLuint) = ::glIsSampler;
|
||||
void (*const glBindSampler)(GLuint, GLuint) = ::glBindSampler;
|
||||
void (*const glSamplerParameteri)(GLuint, GLenum, GLint) = ::glSamplerParameteri;
|
||||
void (*const glSamplerParameteriv)(GLuint, GLenum, const GLint*) = ::glSamplerParameteriv;
|
||||
void (*const glSamplerParameterf)(GLuint, GLenum, GLfloat) = ::glSamplerParameterf;
|
||||
void (*const glSamplerParameterfv)(GLuint, GLenum, const GLfloat*) = ::glSamplerParameterfv;
|
||||
void (*const glGetSamplerParameteriv)(GLuint, GLenum, GLint*) = ::glGetSamplerParameteriv;
|
||||
void (*const glGetSamplerParameterfv)(GLuint, GLenum, GLfloat*) = ::glGetSamplerParameterfv;
|
||||
void (*const glVertexAttribDivisor)(GLuint, GLuint) = ::glVertexAttribDivisor;
|
||||
void (*const glBindTransformFeedback)(GLenum, GLuint) = ::glBindTransformFeedback;
|
||||
void (*const glDeleteTransformFeedbacks)(GLsizei, const GLuint*) = ::glDeleteTransformFeedbacks;
|
||||
void (*const glGenTransformFeedbacks)(GLsizei, GLuint*) = ::glGenTransformFeedbacks;
|
||||
GLboolean (*const glIsTransformFeedback)(GLuint) = ::glIsTransformFeedback;
|
||||
void (*const glPauseTransformFeedback)() = ::glPauseTransformFeedback;
|
||||
void (*const glResumeTransformFeedback)() = ::glResumeTransformFeedback;
|
||||
void (*const glGetProgramBinary)(GLuint, GLsizei, GLsizei*, GLenum*, GLvoid*) = ::glGetProgramBinary;
|
||||
void (*const glProgramBinary)(GLuint, GLenum, const GLvoid*, GLsizei) = ::glProgramBinary;
|
||||
void (*const glProgramParameteri)(GLuint, GLenum, GLint) = ::glProgramParameteri;
|
||||
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
|
||||
void (* const glInvalidateFramebuffer)(GLenum, GLsizei, const GLenum *) = ::glInvalidateFramebuffer;
|
||||
void (* const glInvalidateSubFramebuffer)(GLenum, GLsizei, const GLenum *, GLint, GLint, GLsizei, GLsizei) = ::glInvalidateSubFramebuffer;
|
||||
void (*const glInvalidateFramebuffer)(GLenum, GLsizei, const GLenum*) = ::glInvalidateFramebuffer;
|
||||
void (*const glInvalidateSubFramebuffer)(GLenum, GLsizei, const GLenum*, GLint, GLint, GLsizei, GLsizei) =
|
||||
::glInvalidateSubFramebuffer;
|
||||
#endif
|
||||
void (* const glTexStorage2D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei) = ::glTexStorage2D;
|
||||
void (* const glTexStorage3D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei) = ::glTexStorage3D;
|
||||
void (* const glGetInternalformativ)(GLenum, GLenum, GLenum, GLsizei, GLint *) = ::glGetInternalformativ;
|
||||
void (*const glTexStorage2D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei) = ::glTexStorage2D;
|
||||
void (*const glTexStorage3D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei) = ::glTexStorage3D;
|
||||
void (*const glGetInternalformativ)(GLenum, GLenum, GLenum, GLsizei, GLint*) = ::glGetInternalformativ;
|
||||
|
||||
|
||||
} // namespace platform
|
||||
} // namespace mbgl
|
||||
} // namespace platform
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -20,7 +20,7 @@ RunLoop* RunLoop::Get() {
|
||||
}
|
||||
|
||||
RunLoop::RunLoop(Type)
|
||||
: impl(std::make_unique<Impl>()) {
|
||||
: impl(std::make_unique<Impl>()) {
|
||||
assert(!Scheduler::GetCurrent());
|
||||
Scheduler::SetCurrent(this);
|
||||
impl->async = std::make_unique<AsyncTask>(std::bind(&RunLoop::process, this));
|
||||
|
||||
@@ -18,14 +18,9 @@ public:
|
||||
Impl(Duration timeout, Duration repeat, std::function<void()>&& fn)
|
||||
: task(std::move(fn)),
|
||||
loop(CFRunLoopGetCurrent()) {
|
||||
CFRunLoopTimerContext context = {
|
||||
0,
|
||||
this,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
timer = CFRunLoopTimerCreate(kCFAllocatorDefault, toCFAbsoluteTime(timeout), toCFTimeInterval(repeat), 0, 0, perform, &context);
|
||||
CFRunLoopTimerContext context = {0, this, nullptr, nullptr, nullptr};
|
||||
timer = CFRunLoopTimerCreate(
|
||||
kCFAllocatorDefault, toCFAbsoluteTime(timeout), toCFTimeInterval(repeat), 0, 0, perform, &context);
|
||||
CFRunLoopAddTimer(loop, timer, kCFRunLoopDefaultMode);
|
||||
}
|
||||
|
||||
@@ -35,9 +30,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static void perform(CFRunLoopTimerRef, void* info) {
|
||||
reinterpret_cast<Impl*>(info)->task();
|
||||
}
|
||||
static void perform(CFRunLoopTimerRef, void* info) { reinterpret_cast<Impl*>(info)->task(); }
|
||||
|
||||
std::function<void()> task;
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#import <Mapbox.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#define MLNConstantExpression(constant) \
|
||||
[NSExpression expressionForConstantValue:constant]
|
||||
#define MLNConstantExpression(constant) [NSExpression expressionForConstantValue:constant]
|
||||
|
||||
@interface MLNStyleLayerTests : XCTestCase <MLNMapViewDelegate>
|
||||
|
||||
|
||||
@@ -15,13 +15,14 @@
|
||||
will also be picked up by xcpretty. PENDING tests will be distinguished by a `⧖`
|
||||
and `[PENDING]`
|
||||
*/
|
||||
#define MLN_CHECK_IF_PENDING_TEST_SHOULD_RUN() \
|
||||
/* By default, skip pending tests. Otherwise check environment for MAPBOX_RUN_PENDING_TESTS */ \
|
||||
{ \
|
||||
NSString *runPendingTests = [[NSProcessInfo processInfo] environment][@"MAPBOX_RUN_PENDING_TESTS"]; \
|
||||
if (![runPendingTests boolValue]) { \
|
||||
/* The following warning will be picked up by xcpretty */ \
|
||||
printf("warning: '%s' is a pending test - skipping\n", __PRETTY_FUNCTION__); \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
#define MLN_CHECK_IF_PENDING_TEST_SHOULD_RUN() \
|
||||
/* By default, skip pending tests. Otherwise check environment for MAPBOX_RUN_PENDING_TESTS */ \
|
||||
{ \
|
||||
NSString *runPendingTests = \
|
||||
[[NSProcessInfo processInfo] environment][@"MAPBOX_RUN_PENDING_TESTS"]; \
|
||||
if (![runPendingTests boolValue]) { \
|
||||
/* The following warning will be picked up by xcpretty */ \
|
||||
printf("warning: '%s' is a pending test - skipping\n", __PRETTY_FUNCTION__); \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
|
||||
@@ -5,4 +5,3 @@
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
#import <XCTest/XCTest.h>
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "MLNTestUtility.h"
|
||||
|
||||
#define MLNTestFail(myself, ...) \
|
||||
_XCTPrimitiveFail(myself, __VA_ARGS__)
|
||||
#define MLNTestFail(myself, ...) _XCTPrimitiveFail(myself, __VA_ARGS__)
|
||||
|
||||
#define MLNTestAssert(myself, expression, ...) \
|
||||
_XCTPrimitiveAssertTrue(myself, expression, @#expression, __VA_ARGS__)
|
||||
_XCTPrimitiveAssertTrue(myself, expression, @ #expression, __VA_ARGS__)
|
||||
|
||||
#define MLNTestAssertEqualWithAccuracy(myself, expression1, expression2, accuracy, ...) \
|
||||
_XCTPrimitiveAssertEqualWithAccuracy(myself, expression1, @#expression1, expression2, @#expression2, accuracy, @#accuracy, __VA_ARGS__)
|
||||
#define MLNTestAssertEqualWithAccuracy(myself, expression1, expression2, accuracy, ...) \
|
||||
_XCTPrimitiveAssertEqualWithAccuracy(myself, expression1, @ #expression1, expression2, \
|
||||
@ #expression2, accuracy, @ #accuracy, __VA_ARGS__)
|
||||
#define MLNTestAssertNil(myself, expression, ...) \
|
||||
_XCTPrimitiveAssertNil(myself, expression, @#expression, __VA_ARGS__)
|
||||
_XCTPrimitiveAssertNil(myself, expression, @ #expression, __VA_ARGS__)
|
||||
|
||||
#define MLNTestAssertNotNil(myself, expression, ...) \
|
||||
_XCTPrimitiveAssertNotNil(myself, expression, @#expression, __VA_ARGS__)
|
||||
_XCTPrimitiveAssertNotNil(myself, expression, @ #expression, __VA_ARGS__)
|
||||
|
||||
#define MLNTestWarning(expression, format, ...) \
|
||||
({ \
|
||||
if (!(expression)) { \
|
||||
NSString *message = [NSString stringWithFormat:format, ##__VA_ARGS__]; \
|
||||
printf("warning: Test Case '%s' at line %d: '%s' %s\n", __PRETTY_FUNCTION__, __LINE__, #expression, message.UTF8String); \
|
||||
} \
|
||||
})
|
||||
#define MLNTestWarning(expression, format, ...) \
|
||||
({ \
|
||||
if (!(expression)) { \
|
||||
NSString *message = [NSString stringWithFormat:format, ##__VA_ARGS__]; \
|
||||
printf("warning: Test Case '%s' at line %d: '%s' %s\n", __PRETTY_FUNCTION__, __LINE__, \
|
||||
#expression, message.UTF8String); \
|
||||
} \
|
||||
})
|
||||
|
||||
@interface MLNIntegrationTestCase: XCTestCase
|
||||
@interface MLNIntegrationTestCase : XCTestCase
|
||||
@end
|
||||
|
||||
@@ -6,13 +6,17 @@
|
||||
@property (nonatomic) MLNStyle *style;
|
||||
@property (nonatomic) XCTestExpectation *styleLoadingExpectation;
|
||||
@property (nonatomic) XCTestExpectation *renderFinishedExpectation;
|
||||
@property (nonatomic) MLNAnnotationView * (^viewForAnnotation)(MLNMapView *mapView, id<MLNAnnotation> annotation);
|
||||
@property (nonatomic) MLNAnnotationView * (^viewForAnnotation)
|
||||
(MLNMapView *mapView, id<MLNAnnotation> annotation);
|
||||
@property (nonatomic) void (^regionWillChange)(MLNMapView *mapView, BOOL animated);
|
||||
@property (nonatomic) void (^regionIsChanging)(MLNMapView *mapView);
|
||||
@property (nonatomic) void (^regionDidChange)(MLNMapView *mapView, MLNCameraChangeReason reason, BOOL animated);
|
||||
@property (nonatomic) void (^regionDidChange)
|
||||
(MLNMapView *mapView, MLNCameraChangeReason reason, BOOL animated);
|
||||
@property (nonatomic) CGPoint (^mapViewUserLocationAnchorPoint)(MLNMapView *mapView);
|
||||
@property (nonatomic) BOOL (^mapViewAnnotationCanShowCalloutForAnnotation)(MLNMapView *mapView, id<MLNAnnotation> annotation);
|
||||
@property (nonatomic) id<MLNCalloutView> (^mapViewCalloutViewForAnnotation)(MLNMapView *mapView, id<MLNAnnotation> annotation);
|
||||
@property (nonatomic) BOOL (^mapViewAnnotationCanShowCalloutForAnnotation)
|
||||
(MLNMapView *mapView, id<MLNAnnotation> annotation);
|
||||
@property (nonatomic) id<MLNCalloutView> (^mapViewCalloutViewForAnnotation)
|
||||
(MLNMapView *mapView, id<MLNAnnotation> annotation);
|
||||
|
||||
// Utility methods
|
||||
- (void)waitForMapViewToFinishLoadingStyleWithTimeout:(NSTimeInterval)timeout;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#import <XCTest/XCTest.h>
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "MLNTestUtility.h"
|
||||
|
||||
@interface MLNTestLocationManager : NSObject<MLNLocationManager>
|
||||
@interface MLNTestLocationManager : NSObject <MLNLocationManager>
|
||||
@end
|
||||
|
||||
@interface MLNTestLocationManager()
|
||||
@interface MLNTestLocationManager ()
|
||||
|
||||
@end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user