Formatting Objective-C and Objective-C++ (#2492)
This commit is contained in:
@@ -19,4 +19,5 @@ Language: Cpp
|
|||||||
---
|
---
|
||||||
Language: ObjC
|
Language: ObjC
|
||||||
BasedOnStyle: Google
|
BasedOnStyle: Google
|
||||||
|
ObjCSpaceAfterProperty: true
|
||||||
...
|
...
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: clang-format
|
- id: clang-format
|
||||||
files: '.*\.(hpp|cpp|h)'
|
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
|
- repo: https://github.com/keith/pre-commit-buildifier
|
||||||
rev: 6.4.0
|
rev: 6.4.0
|
||||||
hooks:
|
hooks:
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
NSString *dataDir = @"benchmark-data";
|
NSString *dataDir = @"benchmark-data";
|
||||||
NSString *resultFilePath = @"benchmark/results.json";
|
NSString *resultFilePath = @"benchmark/results.json";
|
||||||
|
|
||||||
__attribute__((visibility ("default")))
|
__attribute__((visibility("default")))
|
||||||
@interface IosTestRunner : NSObject
|
@interface IosTestRunner : NSObject
|
||||||
|
|
||||||
- (NSString*) getResultPath;
|
- (NSString *)getResultPath;
|
||||||
- (BOOL) getTestStatus;
|
- (BOOL)getTestStatus;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#define MLN_APPLE_EXPORT __attribute__((visibility ("default")))
|
#define MLN_APPLE_EXPORT __attribute__((visibility("default")))
|
||||||
|
|
||||||
@interface MLNNativeNetworkManager: NSObject
|
@interface MLNNativeNetworkManager : NSObject
|
||||||
|
|
||||||
+ (MLNNativeNetworkManager *)sharedManager;
|
+ (MLNNativeNetworkManager *)sharedManager;
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
or just use unique_ptr with a custom deleter.
|
or just use unique_ptr with a custom deleter.
|
||||||
CFHandle has no special treatment for null handles -- be careful not to let it hold a null
|
CFHandle has no special treatment for null handles -- be careful not to let it hold a null
|
||||||
handle if the behavior of the Releaser isn't defined for null.
|
handle if the behavior of the Releaser isn't defined for null.
|
||||||
|
|
||||||
ex:
|
ex:
|
||||||
using CFDataHandle = CFHandle<CFDataRef, CFTypeRef, CFRelease>;
|
using CFDataHandle = CFHandle<CFDataRef, CFTypeRef, CFRelease>;
|
||||||
|
|
||||||
CFDataHandle data(CFDataCreateWithBytesNoCopy(
|
CFDataHandle data(CFDataCreateWithBytesNoCopy(
|
||||||
kCFAllocatorDefault, reinterpret_cast<const unsigned char*>(source.data()), source.size(),
|
kCFAllocatorDefault, reinterpret_cast<const unsigned char*>(source.data()), source.size(),
|
||||||
kCFAllocatorNull));
|
kCFAllocatorNull));
|
||||||
@@ -19,13 +19,14 @@ namespace {
|
|||||||
|
|
||||||
template <typename HandleType, typename ReleaserArgumentType, void (*Releaser)(ReleaserArgumentType)>
|
template <typename HandleType, typename ReleaserArgumentType, void (*Releaser)(ReleaserArgumentType)>
|
||||||
struct CFHandle {
|
struct CFHandle {
|
||||||
CFHandle(HandleType handle_): handle(handle_) {}
|
CFHandle(HandleType handle_)
|
||||||
|
: handle(handle_) {}
|
||||||
~CFHandle() { Releaser(handle); }
|
~CFHandle() { Releaser(handle); }
|
||||||
HandleType operator*() { return handle; }
|
HandleType operator*() { return handle; }
|
||||||
operator bool() { return handle; }
|
operator bool() { return handle; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HandleType handle;
|
HandleType handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
#import <TargetConditionals.h>
|
#import <TargetConditionals.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
An object that adopts this protocol must implement the `coordinate` property.
|
An object that adopts this protocol must implement the `coordinate` property.
|
||||||
The other methods of this protocol are optional.
|
The other methods of this protocol are optional.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Annotation models
|
TODO: Annotation models
|
||||||
TODO: Annotation views, learn how to add objects that follow the
|
TODO: Annotation views, learn how to add objects that follow the
|
||||||
|
|||||||
@@ -3,12 +3,13 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/** Options for `MLNAttributedExpression.attributes`. */
|
/** 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. */
|
/** The font name string array expression used to format the text. */
|
||||||
FOUNDATION_EXTERN MLN_EXPORT MLNAttributedExpressionKey const MLNFontNamesAttribute;
|
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;
|
FOUNDATION_EXTERN MLN_EXPORT MLNAttributedExpressionKey const MLNFontScaleAttribute;
|
||||||
|
|
||||||
/** The font color expression used to format the text. */
|
/** The font color expression used to format the text. */
|
||||||
@@ -17,18 +18,18 @@ FOUNDATION_EXTERN MLN_EXPORT MLNAttributedExpressionKey const MLNFontColorAttrib
|
|||||||
/**
|
/**
|
||||||
An `MLNAttributedExpression` object associates text formatting attibutes (such as font size or
|
An `MLNAttributedExpression` object associates text formatting attibutes (such as font size or
|
||||||
font names) to an `NSExpression`.
|
font names) to an `NSExpression`.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```swift
|
```swift
|
||||||
let redColor = UIColor.red
|
let redColor = UIColor.red
|
||||||
let expression = NSExpression(forConstantValue: "Foo")
|
let expression = NSExpression(forConstantValue: "Foo")
|
||||||
let attributes: [MLNAttributedExpressionKey: NSExpression] = [.fontNamesAttribute : NSExpression(forConstantValue: ["DIN Offc Pro Italic",
|
let attributes: [MLNAttributedExpressionKey: NSExpression] = [.fontNamesAttribute :
|
||||||
"Arial Unicode MS Regular"]),
|
NSExpression(forConstantValue: ["DIN Offc Pro Italic", "Arial Unicode MS Regular"]),
|
||||||
.fontScaleAttribute: NSExpression(forConstantValue: 1.2),
|
.fontScaleAttribute:
|
||||||
.fontColorAttribute: NSExpression(forConstantValue: redColor)]
|
NSExpression(forConstantValue: 1.2), .fontColorAttribute: NSExpression(forConstantValue: redColor)]
|
||||||
let attributedExpression = MLNAttributedExpression(expression, attributes:attributes)
|
let attributedExpression = MLNAttributedExpression(expression, attributes:attributes)
|
||||||
```
|
```
|
||||||
|
|
||||||
*/
|
*/
|
||||||
MLN_EXPORT
|
MLN_EXPORT
|
||||||
@interface MLNAttributedExpression : NSObject
|
@interface MLNAttributedExpression : NSObject
|
||||||
@@ -48,7 +49,8 @@ MLN_EXPORT
|
|||||||
`MLNFontColorAttribute` | An `NSExpression` evaluating to an `UIColor`.
|
`MLNFontColorAttribute` | An `NSExpression` evaluating to an `UIColor`.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@property (strong, nonatomic, readonly) NSDictionary<MLNAttributedExpressionKey, NSExpression *> *attributes;
|
@property (strong, nonatomic, readonly)
|
||||||
|
NSDictionary<MLNAttributedExpressionKey, NSExpression *> *attributes;
|
||||||
#else
|
#else
|
||||||
/**
|
/**
|
||||||
The formatting attributes dictionary.
|
The formatting attributes dictionary.
|
||||||
@@ -58,29 +60,39 @@ MLN_EXPORT
|
|||||||
`MLNFontScaleAttribute` | An `NSExpression` evaluating to an `NSNumber` value.
|
`MLNFontScaleAttribute` | An `NSExpression` evaluating to an `NSNumber` value.
|
||||||
`MLNFontColorAttribute` | An `NSExpression` evaluating to an `NSColor` on macos.
|
`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
|
#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;
|
- (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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreGraphics/CoreGraphics.h>
|
#import <CoreGraphics/CoreGraphics.h>
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNTypes.h"
|
#import "MLNTypes.h"
|
||||||
@@ -11,18 +11,18 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
The attribution info is represented in the longest format available.
|
The attribution info is represented in the longest format available.
|
||||||
*/
|
*/
|
||||||
typedef NS_ENUM(NSUInteger, MLNAttributionInfoStyle) {
|
typedef NS_ENUM(NSUInteger, MLNAttributionInfoStyle) {
|
||||||
/**
|
/**
|
||||||
Specifies a short attribution info style.
|
Specifies a short attribution info style.
|
||||||
*/
|
*/
|
||||||
MLNAttributionInfoStyleShort = 1,
|
MLNAttributionInfoStyleShort = 1,
|
||||||
/**
|
/**
|
||||||
Specifies a medium attribution info style.
|
Specifies a medium attribution info style.
|
||||||
*/
|
*/
|
||||||
MLNAttributionInfoStyleMedium,
|
MLNAttributionInfoStyleMedium,
|
||||||
/**
|
/**
|
||||||
Specifies a long attribution info style.
|
Specifies a long attribution info style.
|
||||||
*/
|
*/
|
||||||
MLNAttributionInfoStyleLong
|
MLNAttributionInfoStyleLong
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,12 +66,12 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a copy of the current `title` formatted accordingly to `style`.
|
Returns a copy of the current `title` formatted accordingly to `style`.
|
||||||
|
|
||||||
Example: If the `style` property is set to `MLNAttributionInfoStyleShort` and the
|
Example: If the `style` property is set to `MLNAttributionInfoStyleShort` and the
|
||||||
`title` property is set to `OpenStreetMap`, then this method returns `OSM`.
|
`title` property is set to `OpenStreetMap`, then this method returns `OSM`.
|
||||||
|
|
||||||
@param style The attribution info style.
|
@param style The attribution info style.
|
||||||
|
|
||||||
@return The `NSAttributedString` styled title.
|
@return The `NSAttributedString` styled title.
|
||||||
*/
|
*/
|
||||||
- (NSAttributedString *)titleWithStyle:(MLNAttributionInfoStyle)style;
|
- (NSAttributedString *)titleWithStyle:(MLNAttributionInfoStyle)style;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreGraphics/CoreGraphics.h>
|
#import <CoreGraphics/CoreGraphics.h>
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNAttributionInfo.h"
|
#import "MLNAttributionInfo.h"
|
||||||
|
|
||||||
@@ -16,9 +16,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@param fontSize The default text size in points.
|
@param fontSize The default text size in points.
|
||||||
@param linkColor The default link color.
|
@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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,16 @@
|
|||||||
|
|
||||||
#import <MetalKit/MetalKit.h>
|
#import <MetalKit/MetalKit.h>
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
MTKView *mtkView;
|
MTKView *mtkView;
|
||||||
id <MTLDevice> device;
|
id<MTLDevice> device;
|
||||||
MTLRenderPassDescriptor *renderPassDescriptor;
|
MTLRenderPassDescriptor *renderPassDescriptor;
|
||||||
id <MTLCommandBuffer> commandBuffer;
|
id<MTLCommandBuffer> commandBuffer;
|
||||||
} MLNBackendResource;
|
} MLNBackendResource;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
} MLNBackendResource;
|
} MLNBackendResource;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
@@ -39,7 +39,9 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
This method is not supported for the `MLNDirectionFormatter` class.
|
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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -13,25 +13,25 @@ FOUNDATION_EXTERN MLN_EXPORT const NSUInteger MLNClusterIdentifierInvalid;
|
|||||||
/**
|
/**
|
||||||
A protocol that feature subclasses (i.e. those already conforming to
|
A protocol that feature subclasses (i.e. those already conforming to
|
||||||
the `MLNFeature` protocol) conform to if they represent clusters.
|
the `MLNFeature` protocol) conform to if they represent clusters.
|
||||||
|
|
||||||
Currently the only class that conforms to `MLNCluster` is
|
Currently the only class that conforms to `MLNCluster` is
|
||||||
`MLNPointFeatureCluster` (a subclass of `MLNPointFeature`).
|
`MLNPointFeatureCluster` (a subclass of `MLNPointFeature`).
|
||||||
|
|
||||||
To check if a feature is a cluster, check conformity to `MLNCluster`, for
|
To check if a feature is a cluster, check conformity to `MLNCluster`, for
|
||||||
example:
|
example:
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
let shape = try! MLNShape(data: clusterShapeData, encoding: String.Encoding.utf8.rawValue)
|
let shape = try! MLNShape(data: clusterShapeData, encoding: String.Encoding.utf8.rawValue)
|
||||||
|
|
||||||
guard let pointFeature = shape as? MLNPointFeature else {
|
guard let pointFeature = shape as? MLNPointFeature else {
|
||||||
throw ExampleError.unexpectedFeatureType
|
throw ExampleError.unexpectedFeatureType
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for cluster conformance
|
// Check for cluster conformance
|
||||||
guard let cluster = pointFeature as? MLNCluster else {
|
guard let cluster = pointFeature as? MLNCluster else {
|
||||||
throw ExampleError.featureIsNotACluster
|
throw ExampleError.featureIsNotACluster
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently the only supported class that conforms to `MLNCluster` is
|
// Currently the only supported class that conforms to `MLNCluster` is
|
||||||
// `MLNPointFeatureCluster`
|
// `MLNPointFeatureCluster`
|
||||||
guard cluster is MLNPointFeatureCluster else {
|
guard cluster is MLNPointFeatureCluster else {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
@@ -36,7 +36,9 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
This method is not supported for the `MLNDirectionFormatter` class.
|
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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNGeometry.h"
|
#import "MLNGeometry.h"
|
||||||
#import "MLNTypes.h"
|
|
||||||
#import "MLNShapeSource.h"
|
#import "MLNShapeSource.h"
|
||||||
|
#import "MLNTypes.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -11,9 +11,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
An `NSNumber` object containing a Boolean value; specifies whether the shape of
|
An `NSNumber` object containing a Boolean value; specifies whether the shape of
|
||||||
an `MLNComputedShapeSource` should be wrapped to accomodate coordinates with
|
an `MLNComputedShapeSource` should be wrapped to accomodate coordinates with
|
||||||
longitudes beyond −180 and 180. The default value is `NO`.
|
longitudes beyond −180 and 180. The default value is `NO`.
|
||||||
|
|
||||||
Setting this option to `YES` affects rendering performance.
|
Setting this option to `YES` affects rendering performance.
|
||||||
|
|
||||||
This option is used with the `MLNComputedShapeSource` class; it is ignored when
|
This option is used with the `MLNComputedShapeSource` class; it is ignored when
|
||||||
creating an `MLNShapeSource` object.
|
creating an `MLNShapeSource` object.
|
||||||
*/
|
*/
|
||||||
@@ -23,10 +23,10 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionWrap
|
|||||||
An `NSNumber` object containing a Boolean value; specifies whether the shape of
|
An `NSNumber` object containing a Boolean value; specifies whether the shape of
|
||||||
an `MLNComputedShapeSource` should be clipped at the edge of each tile. The
|
an `MLNComputedShapeSource` should be clipped at the edge of each tile. The
|
||||||
default value is `NO`.
|
default value is `NO`.
|
||||||
|
|
||||||
Setting this option to `YES` affects rendering performance. Use this option to
|
Setting this option to `YES` affects rendering performance. Use this option to
|
||||||
clip `MLNPolyline`s and `MLNPolygon`s at tile boundaries without artifacts.
|
clip `MLNPolyline`s and `MLNPolygon`s at tile boundaries without artifacts.
|
||||||
|
|
||||||
This option is used with the `MLNComputedShapeSource` class; it is ignored when
|
This option is used with the `MLNComputedShapeSource` class; it is ignored when
|
||||||
creating an `MLNShapeSource` object.
|
creating an `MLNShapeSource` object.
|
||||||
*/
|
*/
|
||||||
@@ -50,7 +50,9 @@ FOUNDATION_EXTERN MLN_EXPORT MLNExceptionName const MLNInvalidDatasourceExceptio
|
|||||||
@param y Tile Y coordinate.
|
@param y Tile Y coordinate.
|
||||||
@param zoomLevel Tile zoom level.
|
@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
|
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 bounds The bounds to fetch data for.
|
||||||
@param zoomLevel Tile zoom level.
|
@param zoomLevel Tile zoom level.
|
||||||
*/
|
*/
|
||||||
- (NSArray<MLNShape <MLNFeature> *>*)featuresInCoordinateBounds:(MLNCoordinateBounds)bounds zoomLevel:(NSUInteger)zoomLevel;
|
- (NSArray<MLNShape<MLNFeature> *> *)featuresInCoordinateBounds:(MLNCoordinateBounds)bounds
|
||||||
|
zoomLevel:(NSUInteger)zoomLevel;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -70,14 +73,14 @@ FOUNDATION_EXTERN MLN_EXPORT MLNExceptionName const MLNInvalidDatasourceExceptio
|
|||||||
`MLNStyle` object along with an `MLNVectorStyleLayer` object. The vector style
|
`MLNStyle` object along with an `MLNVectorStyleLayer` object. The vector style
|
||||||
layer defines the appearance of any content supplied by the computed shape
|
layer defines the appearance of any content supplied by the computed shape
|
||||||
source.
|
source.
|
||||||
|
|
||||||
`MLNComputedShapeSource` is similar to `MLNShapeSource` but is optimized for
|
`MLNComputedShapeSource` is similar to `MLNShapeSource` but is optimized for
|
||||||
data sets that change dynamically or are too large to fit completely in memory.
|
data sets that change dynamically or are too large to fit completely in memory.
|
||||||
It is also useful for data that is divided into tiles in a format other than
|
It is also useful for data that is divided into tiles in a format other than
|
||||||
<a href="https://www.mapbox.com/vector-tiles/">Mapbox Vector Tiles</a>. For
|
<a href="https://www.mapbox.com/vector-tiles/">Mapbox Vector Tiles</a>. For
|
||||||
<a href="http://geojson.org/">GeoJSON</a> data, use the `MLNShapeSource` class.
|
<a href="http://geojson.org/">GeoJSON</a> data, use the `MLNShapeSource` class.
|
||||||
For static tiles or Mapbox Vector Tiles, use the `MLNVectorTileSource` class.
|
For static tiles or Mapbox Vector Tiles, use the `MLNVectorTileSource` class.
|
||||||
|
|
||||||
You can add and remove sources dynamically using methods such as
|
You can add and remove sources dynamically using methods such as
|
||||||
`-[MLNStyle addSource:]` and `-[MLNStyle sourceWithIdentifier:]`. This class
|
`-[MLNStyle addSource:]` and `-[MLNStyle sourceWithIdentifier:]`. This class
|
||||||
cannot be represented in a style JSON file; you must add it ot the style at
|
cannot be represented in a style JSON file; you must add it ot the style at
|
||||||
@@ -91,7 +94,7 @@ MLN_EXPORT
|
|||||||
dictionary of options for the source according to the
|
dictionary of options for the source according to the
|
||||||
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson">style
|
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson">style
|
||||||
specification</a>.
|
specification</a>.
|
||||||
|
|
||||||
This class supports the following options:
|
This class supports the following options:
|
||||||
`MLNShapeSourceOptionMinimumZoomLevel`, `MLNShapeSourceOptionMaximumZoomLevel`,
|
`MLNShapeSourceOptionMinimumZoomLevel`, `MLNShapeSourceOptionMaximumZoomLevel`,
|
||||||
`MLNShapeSourceOptionBuffer`,
|
`MLNShapeSourceOptionBuffer`,
|
||||||
@@ -103,14 +106,16 @@ MLN_EXPORT
|
|||||||
@param identifier A string that uniquely identifies the source.
|
@param identifier A string that uniquely identifies the source.
|
||||||
@param options An `NSDictionary` of options for this 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
|
Returns a custom shape data source initialized with an identifier, data source, and a
|
||||||
dictionary of options for the source according to the
|
dictionary of options for the source according to the
|
||||||
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson">style
|
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson">style
|
||||||
specification</a>.
|
specification</a>.
|
||||||
|
|
||||||
This class supports the following options:
|
This class supports the following options:
|
||||||
`MLNShapeSourceOptionMinimumZoomLevel`, `MLNShapeSourceOptionMaximumZoomLevel`,
|
`MLNShapeSourceOptionMinimumZoomLevel`, `MLNShapeSourceOptionMaximumZoomLevel`,
|
||||||
`MLNShapeSourceOptionBuffer`,
|
`MLNShapeSourceOptionBuffer`,
|
||||||
@@ -122,7 +127,9 @@ MLN_EXPORT
|
|||||||
@param identifier A string that uniquely identifies the source.
|
@param identifier A string that uniquely identifies the source.
|
||||||
@param options An `NSDictionary` of options for this 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
|
Invalidates all the features and properties intersecting with or contained in
|
||||||
@@ -130,7 +137,7 @@ MLN_EXPORT
|
|||||||
`MLNComputedShapeSourceDataSource`.
|
`MLNComputedShapeSourceDataSource`.
|
||||||
@param bounds Coordinate bounds to invalidate.
|
@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
|
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 y Tile Y coordinate.
|
||||||
@param zoomLevel Tile zoom level.
|
@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.
|
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 y Tile Y coordinate.
|
||||||
@param zoomLevel Tile zoom level.
|
@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;
|
@property (nonatomic, weak, nullable) id<MLNComputedShapeSourceDataSource> dataSource;
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
|
#import "MLNComputedShapeSource.h"
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNTypes.h"
|
#import "MLNTypes.h"
|
||||||
#import "MLNComputedShapeSource.h"
|
|
||||||
|
|
||||||
#include <mbgl/style/sources/custom_geometry_source.hpp>
|
#include <mbgl/style/sources/custom_geometry_source.hpp>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
MLN_EXPORT
|
MLN_EXPORT
|
||||||
mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDictionary(NSDictionary<MLNShapeSourceOption, id> *options);
|
mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDictionary(
|
||||||
|
NSDictionary<MLNShapeSourceOption, id> *options);
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -8,164 +8,165 @@ namespace conversion {
|
|||||||
|
|
||||||
// A wrapper class for `id`, so as not to confuse ARC.
|
// A wrapper class for `id`, so as not to confuse ARC.
|
||||||
class Holder {
|
class Holder {
|
||||||
public:
|
public:
|
||||||
Holder(const id v) : value(v) {}
|
Holder(const id v) : value(v) {}
|
||||||
const id value;
|
const id value;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class ConversionTraits<Holder> {
|
class ConversionTraits<Holder> {
|
||||||
public:
|
public:
|
||||||
static bool isUndefined(const Holder& holder) {
|
static bool isUndefined(const Holder& holder) {
|
||||||
const id value = holder.value;
|
const id value = holder.value;
|
||||||
return !value || value == [NSNull null];
|
return !value || value == [NSNull null];
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isArray(const Holder& holder) {
|
static bool isArray(const Holder& holder) {
|
||||||
const id value = holder.value;
|
const id value = holder.value;
|
||||||
return [value isKindOfClass:[NSArray class]];
|
return [value isKindOfClass:[NSArray class]];
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isObject(const Holder& holder) {
|
static bool isObject(const Holder& holder) {
|
||||||
const id value = holder.value;
|
const id value = holder.value;
|
||||||
return [value isKindOfClass:[NSDictionary class]];
|
return [value isKindOfClass:[NSDictionary class]];
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::size_t arrayLength(const Holder& holder) {
|
static std::size_t arrayLength(const Holder& holder) {
|
||||||
const id value = holder.value;
|
const id value = holder.value;
|
||||||
NSCAssert([value isKindOfClass:[NSArray class]], @"Value must be an NSArray for getLength().");
|
NSCAssert([value isKindOfClass:[NSArray class]], @"Value must be an NSArray for getLength().");
|
||||||
NSArray *array = value;
|
NSArray* array = value;
|
||||||
auto length = [array count];
|
auto length = [array count];
|
||||||
NSCAssert(length <= std::numeric_limits<size_t>::max(), @"Array length out of bounds.");
|
NSCAssert(length <= std::numeric_limits<size_t>::max(), @"Array length out of bounds.");
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Holder arrayMember(const Holder& holder, std::size_t i) {
|
static Holder arrayMember(const Holder& holder, std::size_t i) {
|
||||||
const id value = holder.value;
|
const id value = holder.value;
|
||||||
NSCAssert([value isKindOfClass:[NSArray class]], @"Value must be an NSArray for get(int).");
|
NSCAssert([value isKindOfClass:[NSArray class]], @"Value must be an NSArray for get(int).");
|
||||||
NSCAssert(i < NSUIntegerMax, @"Index must be less than NSUIntegerMax");
|
NSCAssert(i < NSUIntegerMax, @"Index must be less than NSUIntegerMax");
|
||||||
return {[value objectAtIndex: i]};
|
return {[value objectAtIndex:i]};
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::optional<Holder> objectMember(const Holder& holder, const char *key) {
|
static std::optional<Holder> objectMember(const Holder& holder, const char* key) {
|
||||||
const id value = holder.value;
|
const id value = holder.value;
|
||||||
NSCAssert([value isKindOfClass:[NSDictionary class]], @"Value must be an NSDictionary for get(string).");
|
NSCAssert([value isKindOfClass:[NSDictionary class]],
|
||||||
NSObject *member = [value objectForKey: @(key)];
|
@"Value must be an NSDictionary for get(string).");
|
||||||
if (member && member != [NSNull null]) {
|
NSObject* member = [value objectForKey:@(key)];
|
||||||
return {member};
|
if (member && member != [NSNull null]) {
|
||||||
} else {
|
return {member};
|
||||||
return {};
|
} else {
|
||||||
}
|
return {};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Compiler is wrong about `Fn` parameter missing a nullability specifier.
|
// Compiler is wrong about `Fn` parameter missing a nullability specifier.
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wnullability-completeness"
|
#pragma clang diagnostic ignored "-Wnullability-completeness"
|
||||||
template <class Fn>
|
template <class Fn>
|
||||||
static std::optional<Error> eachMember(const Holder& holder, Fn&& visit) {
|
static std::optional<Error> eachMember(const Holder& holder, Fn&& visit) {
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
[holder.value enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
|
[holder.value
|
||||||
auto result = visit(std::string(static_cast<const char *>([key UTF8String])), obj);
|
enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL* _Nonnull stop) {
|
||||||
if (result) {
|
auto result = visit(std::string(static_cast<const char*>([key UTF8String])), obj);
|
||||||
*stop = YES;
|
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 {};
|
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) {
|
private:
|
||||||
const id value = holder.value;
|
static bool _isBool(const id value) {
|
||||||
if (_isBool(value)) {
|
if (![value isKindOfClass:[NSNumber class]]) return false;
|
||||||
return ((NSNumber *)value).boolValue;
|
// char: 32-bit boolean
|
||||||
} else {
|
// BOOL: 64-bit boolean
|
||||||
return {};
|
NSNumber* number = value;
|
||||||
}
|
return ((strcmp([number objCType], @encode(char)) == 0) ||
|
||||||
}
|
(strcmp([number objCType], @encode(BOOL)) == 0));
|
||||||
|
}
|
||||||
|
|
||||||
static std::optional<float> toNumber(const Holder& holder) {
|
static bool _isNumber(const id value) {
|
||||||
const id value = holder.value;
|
return [value isKindOfClass:[NSNumber class]] && !_isBool(value);
|
||||||
if (_isNumber(value)) {
|
}
|
||||||
return ((NSNumber *)value).floatValue;
|
|
||||||
} else {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::optional<double> toDouble(const Holder& holder) {
|
static bool _isString(const id value) { return [value isKindOfClass:[NSString class]]; }
|
||||||
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]];
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Convertible makeConvertible(const id value) {
|
inline Convertible makeConvertible(const id value) { return Convertible(Holder(value)); }
|
||||||
return Convertible(Holder(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace conversion
|
} // namespace conversion
|
||||||
} // namespace style
|
} // namespace style
|
||||||
} // namespace mbgl
|
} // namespace mbgl
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
@@ -49,7 +49,9 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
This method is not supported for the `MLNCoordinateFormatter` class.
|
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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNFoundation.h"
|
|
||||||
#import "MLNStyleValue.h"
|
|
||||||
#import "MLNStyleLayer.h"
|
|
||||||
#import "MLNGeometry.h"
|
#import "MLNGeometry.h"
|
||||||
|
#import "MLNStyleLayer.h"
|
||||||
|
#import "MLNStyleValue.h"
|
||||||
|
|
||||||
MLN_EXPORT
|
MLN_EXPORT
|
||||||
@interface MLNCustomDrawableStyleLayer : MLNStyleLayer
|
@interface MLNCustomDrawableStyleLayer : MLNStyleLayer
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
#include <mbgl/layermanager/custom_drawable_layer_factory.hpp>
|
#include <mbgl/layermanager/custom_drawable_layer_factory.hpp>
|
||||||
|
|
||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
|
|
||||||
class CustomDrawableStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::CustomDrawableLayerFactory {
|
class CustomDrawableStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::CustomDrawableLayerFactory {
|
||||||
// LayerPeerFactory overrides.
|
// LayerPeerFactory overrides.
|
||||||
LayerFactory* getCoreLayerFactory() final { return this; }
|
LayerFactory* getCoreLayerFactory() final { return this; }
|
||||||
virtual MLNStyleLayer* createPeer(style::Layer*) final;
|
virtual MLNStyleLayer* createPeer(style::Layer*) final;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbgl
|
} // namespace mbgl
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
#import <QuartzCore/QuartzCore.h>
|
#import <QuartzCore/QuartzCore.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNStyleValue.h"
|
|
||||||
#import "MLNStyleLayer.h"
|
|
||||||
#import "MLNGeometry.h"
|
#import "MLNGeometry.h"
|
||||||
|
#import "MLNStyleLayer.h"
|
||||||
|
#import "MLNStyleValue.h"
|
||||||
|
|
||||||
#if MLN_RENDER_BACKEND_METAL
|
#if MLN_RENDER_BACKEND_METAL
|
||||||
#import <MetalKit/MetalKit.h>
|
#import <MetalKit/MetalKit.h>
|
||||||
@@ -17,13 +17,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@class MLNStyle;
|
@class MLNStyle;
|
||||||
|
|
||||||
typedef struct MLNStyleLayerDrawingContext {
|
typedef struct MLNStyleLayerDrawingContext {
|
||||||
CGSize size;
|
CGSize size;
|
||||||
CLLocationCoordinate2D centerCoordinate;
|
CLLocationCoordinate2D centerCoordinate;
|
||||||
double zoomLevel;
|
double zoomLevel;
|
||||||
CLLocationDirection direction;
|
CLLocationDirection direction;
|
||||||
CGFloat pitch;
|
CGFloat pitch;
|
||||||
CGFloat fieldOfView;
|
CGFloat fieldOfView;
|
||||||
MLNMatrix4 projectionMatrix;
|
MLNMatrix4 projectionMatrix;
|
||||||
} MLNStyleLayerDrawingContext;
|
} MLNStyleLayerDrawingContext;
|
||||||
|
|
||||||
MLN_EXPORT
|
MLN_EXPORT
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
#include <mbgl/layermanager/custom_layer_factory.hpp>
|
#include <mbgl/layermanager/custom_layer_factory.hpp>
|
||||||
|
|
||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
|
|
||||||
class CustomStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::CustomLayerFactory {
|
class CustomStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::CustomLayerFactory {
|
||||||
// LayerPeerFactory overrides.
|
// LayerPeerFactory overrides.
|
||||||
LayerFactory* getCoreLayerFactory() final { return this; }
|
LayerFactory* getCoreLayerFactory() final { return this; }
|
||||||
virtual MLNStyleLayer* createPeer(style::Layer*) final;
|
virtual MLNStyleLayer* createPeer(style::Layer*) final;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbgl
|
} // namespace mbgl
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
The style URL
|
The style URL
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSURL* url;
|
@property (nonatomic, retain) NSURL* url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The style name
|
The style name
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSString* name;
|
@property (nonatomic, retain) NSString* name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The style version
|
The style version
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a localized formatted string for the provided distance.
|
Returns a localized formatted string for the provided distance.
|
||||||
|
|
||||||
@param distance The distance, measured in meters.
|
@param distance The distance, measured in meters.
|
||||||
@return A localized formatted distance string including units.
|
@return A localized formatted distance string including units.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
#import "MLNCluster.h"
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNPolyline.h"
|
|
||||||
#import "MLNPolygon.h"
|
|
||||||
#import "MLNPointAnnotation.h"
|
#import "MLNPointAnnotation.h"
|
||||||
#import "MLNPointCollection.h"
|
#import "MLNPointCollection.h"
|
||||||
|
#import "MLNPolygon.h"
|
||||||
|
#import "MLNPolyline.h"
|
||||||
#import "MLNShapeCollection.h"
|
#import "MLNShapeCollection.h"
|
||||||
#import "MLNCluster.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -50,7 +50,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
In vector tiles loaded by `MLNVectorTileSource` objects, the identifier
|
In vector tiles loaded by `MLNVectorTileSource` objects, the identifier
|
||||||
corresponds to the
|
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
|
(`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,
|
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
|
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>
|
<tr><th>In the tile source</th><th>This property</th></tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><td>Integer</td> <td><code>NSNumber</code> (use the <code>unsignedLongLongValue</code> or <code>longLongValue</code> property)</td></tr>
|
<tr><td>Integer</td> <td><code>NSNumber</code> (use the
|
||||||
<tr><td>Floating-point number</td> <td><code>NSNumber</code> (use the <code>doubleValue</code> property)</td></tr>
|
<code>unsignedLongLongValue</code> or <code>longLongValue</code> property)</td></tr>
|
||||||
<tr><td>String</td> <td><code>NSString</code></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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@@ -98,7 +100,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
`MLNShapeSource` using an `MLNCircleStyleLayer`, you can assign a `halfway`
|
`MLNShapeSource` using an `MLNCircleStyleLayer`, you can assign a `halfway`
|
||||||
attribute to each of the source’s features, then set
|
attribute to each of the source’s features, then set
|
||||||
`MLNCircleStyleLayer.circleRadius` to an expression for the key path `halfway`.
|
`MLNCircleStyleLayer.circleRadius` to an expression for the key path `halfway`.
|
||||||
|
|
||||||
The `MLNSymbolStyleLayer.text` and `MLNSymbolStyleLayer.iconImageName`
|
The `MLNSymbolStyleLayer.text` and `MLNSymbolStyleLayer.iconImageName`
|
||||||
properties allow you to use attributes yet another way. For example, to label
|
properties allow you to use attributes yet another way. For example, to label
|
||||||
features in an `MLNShapeSource` object by their names, you can assign a `name`
|
features in an `MLNShapeSource` object by their names, you can assign a `name`
|
||||||
@@ -120,10 +122,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><td>Null</td> <td><code>NSNull</code></td></tr>
|
<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>Boolean</td> <td><code>NSNumber</code> (use the <code>boolValue</code>
|
||||||
<tr><td>Integer</td> <td><code>NSNumber</code> (use the <code>unsignedLongLongValue</code> or <code>longLongValue</code> property)</td></tr>
|
property)</td></tr> <tr><td>Integer</td> <td><code>NSNumber</code> (use the
|
||||||
<tr><td>Floating-point number</td> <td><code>NSNumber</code> (use the <code>doubleValue</code> property)</td></tr>
|
<code>unsignedLongLongValue</code> or <code>longLongValue</code> property)</td></tr>
|
||||||
<tr><td>String</td> <td><code>NSString</code></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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@@ -133,7 +136,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
and
|
and
|
||||||
<a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a>
|
<a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a>
|
||||||
layer references.
|
layer references.
|
||||||
|
|
||||||
When adding a feature to an `MLNShapeSource`, use the same Foundation types
|
When adding a feature to an `MLNShapeSource`, use the same Foundation types
|
||||||
listed above for each attribute value. In addition to the Foundation types, you
|
listed above for each attribute value. In addition to the Foundation types, you
|
||||||
may also set an attribute to an `NSColor` (macOS) or `UIColor` (iOS), which
|
may also set an attribute to an `NSColor` (macOS) or `UIColor` (iOS), which
|
||||||
@@ -183,7 +186,7 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
An `MLNPointFeature` object associates a point shape with an optional
|
An `MLNPointFeature` object associates a point shape with an optional
|
||||||
identifier and attributes.
|
identifier and attributes.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Dynamically style interactive points, learn how to initialize
|
TODO: Dynamically style interactive points, learn how to initialize
|
||||||
`MLNPointFeature` objects and add them to your map.
|
`MLNPointFeature` objects and add them to your map.
|
||||||
@@ -195,9 +198,9 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
An `MLNPointFeatureCluster` object associates a point shape (with an optional
|
An `MLNPointFeatureCluster` object associates a point shape (with an optional
|
||||||
identifier and attributes) and represents a point cluster.
|
identifier and attributes) and represents a point cluster.
|
||||||
|
|
||||||
@see `MLNCluster`
|
@see `MLNCluster`
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Clustering point data, learn how to initialize
|
TODO: Clustering point data, learn how to initialize
|
||||||
clusters and add them to your map.
|
clusters and add them to your map.
|
||||||
@@ -213,7 +216,7 @@ MLN_EXPORT
|
|||||||
A polyline feature is known as a
|
A polyline feature is known as a
|
||||||
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
|
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
|
||||||
feature in GeoJSON.
|
feature in GeoJSON.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Add a line annotation from GeoJSON, learn how to initialize an
|
TODO: Add a line annotation from GeoJSON, learn how to initialize an
|
||||||
`MLNPolylineFeature` and add it to an `MLNMapView` object.
|
`MLNPolylineFeature` and add it to an `MLNMapView` object.
|
||||||
@@ -268,7 +271,7 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
An `MLNShapeCollectionFeature` object associates a shape collection with an
|
An `MLNShapeCollectionFeature` object associates a shape collection with an
|
||||||
optional identifier and attributes.
|
optional identifier and attributes.
|
||||||
|
|
||||||
`MLNShapeCollectionFeature` is most commonly used to add multiple shapes to a
|
`MLNShapeCollectionFeature` is most commonly used to add multiple shapes to a
|
||||||
single `MLNShapeSource`. Configure the appearance of an `MLNSource`’s shape
|
single `MLNShapeSource`. Configure the appearance of an `MLNSource`’s shape
|
||||||
collection collectively using an `MLNSymbolStyleLayer` object, or use multiple
|
collection collectively using an `MLNSymbolStyleLayer` object, or use multiple
|
||||||
@@ -279,7 +282,7 @@ MLN_EXPORT
|
|||||||
A shape collection feature is known as a
|
A shape collection feature is known as a
|
||||||
<a href="https://tools.ietf.org/html/rfc7946#section-3.3">feature collection</a>
|
<a href="https://tools.ietf.org/html/rfc7946#section-3.3">feature collection</a>
|
||||||
in GeoJSON.
|
in GeoJSON.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Add multiple shapes from a single shape source, learn how to
|
TODO: Add multiple shapes from a single shape source, learn how to
|
||||||
add shape data to your map using an `MLNShapeCollectionFeature` object.
|
add shape data to your map using an `MLNShapeCollectionFeature` object.
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#import "MLNFoundation.h"
|
|
||||||
#import "MLNFeature.h"
|
#import "MLNFeature.h"
|
||||||
|
#import "MLNFoundation.h"
|
||||||
#import "MLNShape.h"
|
#import "MLNShape.h"
|
||||||
|
|
||||||
#import <mbgl/util/geo.hpp>
|
|
||||||
#import <mbgl/util/feature.hpp>
|
|
||||||
#import <mbgl/style/conversion/geojson.hpp>
|
#import <mbgl/style/conversion/geojson.hpp>
|
||||||
|
#import <mbgl/util/feature.hpp>
|
||||||
|
#import <mbgl/util/geo.hpp>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -13,73 +13,79 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
vector tile features.
|
vector tile features.
|
||||||
*/
|
*/
|
||||||
MLN_EXPORT
|
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
|
Returns an array of `MLNFeature` objects converted from the given vector of
|
||||||
vector tile features.
|
vector tile features.
|
||||||
*/
|
*/
|
||||||
MLN_EXPORT
|
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
|
Returns an `MLNFeature` object converted from the given mbgl::GeoJSONFeature
|
||||||
*/
|
*/
|
||||||
MLN_EXPORT
|
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
|
Returns an `MLNShape` representing the given geojson. The shape can be
|
||||||
a feature, a collection of features, or a geometry.
|
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
|
Takes an `mbgl::GeoJSONFeature` object, an identifer, and attributes dictionary and
|
||||||
returns the feature object with converted `mbgl::FeatureIdentifier` and
|
returns the feature object with converted `mbgl::FeatureIdentifier` and
|
||||||
`mbgl::PropertyMap` properties.
|
`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`.
|
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
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
||||||
#define MLN_DEFINE_FEATURE_INIT_WITH_CODER() \
|
#define MLN_DEFINE_FEATURE_INIT_WITH_CODER() \
|
||||||
- (instancetype)initWithCoder:(NSCoder *)decoder { \
|
-(instancetype)initWithCoder : (NSCoder *)decoder { \
|
||||||
if (self = [super initWithCoder:decoder]) { \
|
if (self = [super initWithCoder:decoder]) { \
|
||||||
NSSet<Class> *identifierClasses = [NSSet setWithArray:@[[NSString class], [NSNumber class]]]; \
|
NSSet<Class> *identifierClasses = \
|
||||||
identifier = [decoder decodeObjectOfClasses:identifierClasses forKey:@"identifier"]; \
|
[NSSet setWithArray:@[ [NSString class], [NSNumber class] ]]; \
|
||||||
_attributes = [decoder decodeObjectOfClass:[NSDictionary class] forKey:@"attributes"]; \
|
identifier = [decoder decodeObjectOfClasses:identifierClasses forKey:@"identifier"]; \
|
||||||
} \
|
_attributes = [decoder decodeObjectOfClass:[NSDictionary class] forKey:@"attributes"]; \
|
||||||
return self; \
|
} \
|
||||||
}
|
return self; \
|
||||||
|
}
|
||||||
|
|
||||||
#define MLN_DEFINE_FEATURE_ENCODE() \
|
#define MLN_DEFINE_FEATURE_ENCODE() \
|
||||||
- (void)encodeWithCoder:(NSCoder *)coder { \
|
-(void)encodeWithCoder : (NSCoder *)coder { \
|
||||||
[super encodeWithCoder:coder]; \
|
[super encodeWithCoder:coder]; \
|
||||||
[coder encodeObject:identifier forKey:@"identifier"]; \
|
[coder encodeObject:identifier forKey:@"identifier"]; \
|
||||||
[coder encodeObject:_attributes forKey:@"attributes"]; \
|
[coder encodeObject:_attributes forKey:@"attributes"]; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MLN_DEFINE_FEATURE_IS_EQUAL() \
|
#define MLN_DEFINE_FEATURE_IS_EQUAL() \
|
||||||
- (BOOL)isEqual:(id)other { \
|
-(BOOL)isEqual : (id)other { \
|
||||||
if (other == self) return YES; \
|
if (other == self) return YES; \
|
||||||
if (![other isKindOfClass:[self class]]) return NO; \
|
if (![other isKindOfClass:[self class]]) return NO; \
|
||||||
__typeof(self) otherFeature = other; \
|
__typeof(self) otherFeature = other; \
|
||||||
return [super isEqual:other] && [self geoJSONObject] == [otherFeature geoJSONObject]; \
|
return [super isEqual:other] && [self geoJSONObject] == [otherFeature geoJSONObject]; \
|
||||||
} \
|
} \
|
||||||
- (NSUInteger)hash { \
|
-(NSUInteger)hash { \
|
||||||
return [super hash] + [[self geoJSONDictionary] hash]; \
|
return [super hash] + [[self geoJSONDictionary] hash]; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MLN_DEFINE_FEATURE_ATTRIBUTES_GETTER() \
|
#define MLN_DEFINE_FEATURE_ATTRIBUTES_GETTER() \
|
||||||
- (NSDictionary *) attributes { \
|
-(NSDictionary *)attributes { \
|
||||||
if (!_attributes) { \
|
if (!_attributes) { \
|
||||||
return @{}; \
|
return @{}; \
|
||||||
} \
|
} \
|
||||||
return _attributes; \
|
return _attributes; \
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ MLN_EXPORT
|
|||||||
|
|
||||||
// MARK: Initializing a Style Layer
|
// 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
|
// MARK: Specifying a Style Layer’s Content
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#define MLN_EXPORT __attribute__((visibility ("default")))
|
#define MLN_EXPORT __attribute__((visibility("default")))
|
||||||
|
|||||||
@@ -5,15 +5,14 @@
|
|||||||
void MLNInitializeRunLoop();
|
void MLNInitializeRunLoop();
|
||||||
|
|
||||||
/* Using a compound statement (GNU Extension, supported by clang) */
|
/* Using a compound statement (GNU Extension, supported by clang) */
|
||||||
#define MLN_OBJC_DYNAMIC_CAST(object, type) \
|
#define MLN_OBJC_DYNAMIC_CAST(object, type) \
|
||||||
({ \
|
({ \
|
||||||
__typeof__( object ) temp##__LINE__ = (object); \
|
__typeof__(object) temp##__LINE__ = (object); \
|
||||||
(type *)([temp##__LINE__ isKindOfClass:[type class]] ? temp##__LINE__ : nil); \
|
(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_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 <CoreGraphics/CoreGraphics.h>
|
||||||
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
@@ -8,59 +8,61 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
/** Defines the area spanned by an `MLNCoordinateBounds`. */
|
/** Defines the area spanned by an `MLNCoordinateBounds`. */
|
||||||
typedef struct __attribute__((objc_boxable)) MLNCoordinateSpan {
|
typedef struct __attribute__((objc_boxable)) MLNCoordinateSpan {
|
||||||
/** Latitudes spanned by an `MLNCoordinateBounds`. */
|
/** Latitudes spanned by an `MLNCoordinateBounds`. */
|
||||||
CLLocationDegrees latitudeDelta;
|
CLLocationDegrees latitudeDelta;
|
||||||
/** Longitudes spanned by an `MLNCoordinateBounds`. */
|
/** Longitudes spanned by an `MLNCoordinateBounds`. */
|
||||||
CLLocationDegrees longitudeDelta;
|
CLLocationDegrees longitudeDelta;
|
||||||
} MLNCoordinateSpan;
|
} MLNCoordinateSpan;
|
||||||
|
|
||||||
/* Defines a point on the map in Mercator projection for a specific zoom level. */
|
/* Defines a point on the map in Mercator projection for a specific zoom level. */
|
||||||
typedef struct __attribute__((objc_boxable)) MLNMapPoint {
|
typedef struct __attribute__((objc_boxable)) MLNMapPoint {
|
||||||
/** X coordinate representing a longitude in Mercator projection. */
|
/** X coordinate representing a longitude in Mercator projection. */
|
||||||
CGFloat x;
|
CGFloat x;
|
||||||
/** Y coordinate representing a latitide in Mercator projection. */
|
/** Y coordinate representing a latitide in Mercator projection. */
|
||||||
CGFloat y;
|
CGFloat y;
|
||||||
/** Zoom level at which the X and Y coordinates are valid. */
|
/** Zoom level at which the X and Y coordinates are valid. */
|
||||||
CGFloat zoomLevel;
|
CGFloat zoomLevel;
|
||||||
} MLNMapPoint;
|
} MLNMapPoint;
|
||||||
|
|
||||||
/* Defines a 4x4 matrix. */
|
/* Defines a 4x4 matrix. */
|
||||||
typedef struct MLNMatrix4 {
|
typedef struct MLNMatrix4 {
|
||||||
double m00, m01, m02, m03;
|
double m00, m01, m02, m03;
|
||||||
double m10, m11, m12, m13;
|
double m10, m11, m12, m13;
|
||||||
double m20, m21, m22, m23;
|
double m20, m21, m22, m23;
|
||||||
double m30, m31, m32, m33;
|
double m30, m31, m32, m33;
|
||||||
} MLNMatrix4;
|
} MLNMatrix4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a new `MLNCoordinateSpan` from the given latitudinal and longitudinal
|
Creates a new `MLNCoordinateSpan` from the given latitudinal and longitudinal
|
||||||
deltas.
|
deltas.
|
||||||
*/
|
*/
|
||||||
NS_INLINE MLNCoordinateSpan MLNCoordinateSpanMake(CLLocationDegrees latitudeDelta, CLLocationDegrees longitudeDelta) {
|
NS_INLINE MLNCoordinateSpan MLNCoordinateSpanMake(CLLocationDegrees latitudeDelta,
|
||||||
MLNCoordinateSpan span;
|
CLLocationDegrees longitudeDelta) {
|
||||||
span.latitudeDelta = latitudeDelta;
|
MLNCoordinateSpan span;
|
||||||
span.longitudeDelta = longitudeDelta;
|
span.latitudeDelta = latitudeDelta;
|
||||||
return span;
|
span.longitudeDelta = longitudeDelta;
|
||||||
|
return span;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a new `MLNMapPoint` from the given X and Y coordinates, and zoom level.
|
Creates a new `MLNMapPoint` from the given X and Y coordinates, and zoom level.
|
||||||
*/
|
*/
|
||||||
NS_INLINE MLNMapPoint MLNMapPointMake(CGFloat x, CGFloat y, CGFloat zoomLevel) {
|
NS_INLINE MLNMapPoint MLNMapPointMake(CGFloat x, CGFloat y, CGFloat zoomLevel) {
|
||||||
MLNMapPoint point;
|
MLNMapPoint point;
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
point.zoomLevel = zoomLevel;
|
point.zoomLevel = zoomLevel;
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns `YES` if the two coordinate spans represent the same latitudinal change
|
Returns `YES` if the two coordinate spans represent the same latitudinal change
|
||||||
and the same longitudinal change.
|
and the same longitudinal change.
|
||||||
*/
|
*/
|
||||||
NS_INLINE BOOL MLNCoordinateSpanEqualToCoordinateSpan(MLNCoordinateSpan span1, MLNCoordinateSpan span2) {
|
NS_INLINE BOOL MLNCoordinateSpanEqualToCoordinateSpan(MLNCoordinateSpan span1,
|
||||||
return (span1.latitudeDelta == span2.latitudeDelta &&
|
MLNCoordinateSpan span2) {
|
||||||
span1.longitudeDelta == span2.longitudeDelta);
|
return (span1.latitudeDelta == span2.latitudeDelta &&
|
||||||
|
span1.longitudeDelta == span2.longitudeDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** An area of zero width and zero height. */
|
/** An area of zero width and zero height. */
|
||||||
@@ -68,52 +70,55 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNCoordinateSpan MLNCoordinateSpanZero;
|
|||||||
|
|
||||||
/** A rectangular area as measured on a two-dimensional map projection. */
|
/** A rectangular area as measured on a two-dimensional map projection. */
|
||||||
typedef struct __attribute__((objc_boxable)) MLNCoordinateBounds {
|
typedef struct __attribute__((objc_boxable)) MLNCoordinateBounds {
|
||||||
/** Coordinate at the southwest corner. */
|
/** Coordinate at the southwest corner. */
|
||||||
CLLocationCoordinate2D sw;
|
CLLocationCoordinate2D sw;
|
||||||
/** Coordinate at the northeast corner. */
|
/** Coordinate at the northeast corner. */
|
||||||
CLLocationCoordinate2D ne;
|
CLLocationCoordinate2D ne;
|
||||||
} MLNCoordinateBounds;
|
} MLNCoordinateBounds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A quadrilateral area as measured on a two-dimensional map projection.
|
A quadrilateral area as measured on a two-dimensional map projection.
|
||||||
`MLNCoordinateQuad` differs from `MLNCoordinateBounds` in that it allows
|
`MLNCoordinateQuad` differs from `MLNCoordinateBounds` in that it allows
|
||||||
representation of non-axis aligned bounds and non-rectangular quadrilaterals.
|
representation of non-axis aligned bounds and non-rectangular quadrilaterals.
|
||||||
The coordinates are described in counter clockwise order from top left.
|
The coordinates are described in counter clockwise order from top left.
|
||||||
*/
|
*/
|
||||||
typedef struct MLNCoordinateQuad {
|
typedef struct MLNCoordinateQuad {
|
||||||
/** Coordinate at the top left corner. */
|
/** Coordinate at the top left corner. */
|
||||||
CLLocationCoordinate2D topLeft;
|
CLLocationCoordinate2D topLeft;
|
||||||
/** Coordinate at the bottom left corner. */
|
/** Coordinate at the bottom left corner. */
|
||||||
CLLocationCoordinate2D bottomLeft;
|
CLLocationCoordinate2D bottomLeft;
|
||||||
/** Coordinate at the bottom right corner. */
|
/** Coordinate at the bottom right corner. */
|
||||||
CLLocationCoordinate2D bottomRight;
|
CLLocationCoordinate2D bottomRight;
|
||||||
/** Coordinate at the top right corner. */
|
/** Coordinate at the top right corner. */
|
||||||
CLLocationCoordinate2D topRight;
|
CLLocationCoordinate2D topRight;
|
||||||
} MLNCoordinateQuad;
|
} MLNCoordinateQuad;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a new `MLNCoordinateBounds` structure from the given southwest and
|
Creates a new `MLNCoordinateBounds` structure from the given southwest and
|
||||||
northeast coordinates.
|
northeast coordinates.
|
||||||
*/
|
*/
|
||||||
NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsMake(CLLocationCoordinate2D sw, CLLocationCoordinate2D ne) {
|
NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsMake(CLLocationCoordinate2D sw,
|
||||||
MLNCoordinateBounds bounds;
|
CLLocationCoordinate2D ne) {
|
||||||
bounds.sw = sw;
|
MLNCoordinateBounds bounds;
|
||||||
bounds.ne = ne;
|
bounds.sw = sw;
|
||||||
return bounds;
|
bounds.ne = ne;
|
||||||
|
return bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a new `MLNCoordinateQuad` structure from the given top left,
|
Creates a new `MLNCoordinateQuad` structure from the given top left,
|
||||||
bottom left, bottom right, and top right coordinates.
|
bottom left, bottom right, and top right coordinates.
|
||||||
*/
|
*/
|
||||||
NS_INLINE MLNCoordinateQuad MLNCoordinateQuadMake(CLLocationCoordinate2D topLeft, CLLocationCoordinate2D bottomLeft, CLLocationCoordinate2D bottomRight, CLLocationCoordinate2D topRight) {
|
NS_INLINE MLNCoordinateQuad MLNCoordinateQuadMake(CLLocationCoordinate2D topLeft,
|
||||||
MLNCoordinateQuad quad;
|
CLLocationCoordinate2D bottomLeft,
|
||||||
quad.topLeft = topLeft;
|
CLLocationCoordinate2D bottomRight,
|
||||||
quad.bottomLeft = bottomLeft;
|
CLLocationCoordinate2D topRight) {
|
||||||
quad.bottomRight = bottomRight;
|
MLNCoordinateQuad quad;
|
||||||
quad.topRight = topRight;
|
quad.topLeft = topLeft;
|
||||||
return quad;
|
quad.bottomLeft = bottomLeft;
|
||||||
|
quad.bottomRight = bottomRight;
|
||||||
|
quad.topRight = topRight;
|
||||||
|
return quad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,62 +127,63 @@ NS_INLINE MLNCoordinateQuad MLNCoordinateQuadMake(CLLocationCoordinate2D topLeft
|
|||||||
southwest coordinate at the bottom left.
|
southwest coordinate at the bottom left.
|
||||||
*/
|
*/
|
||||||
NS_INLINE MLNCoordinateQuad MLNCoordinateQuadFromCoordinateBounds(MLNCoordinateBounds bounds) {
|
NS_INLINE MLNCoordinateQuad MLNCoordinateQuadFromCoordinateBounds(MLNCoordinateBounds bounds) {
|
||||||
MLNCoordinateQuad quad;
|
MLNCoordinateQuad quad;
|
||||||
quad.topLeft = CLLocationCoordinate2DMake(bounds.ne.latitude, bounds.sw.longitude);
|
quad.topLeft = CLLocationCoordinate2DMake(bounds.ne.latitude, bounds.sw.longitude);
|
||||||
quad.bottomLeft = bounds.sw;
|
quad.bottomLeft = bounds.sw;
|
||||||
quad.bottomRight = CLLocationCoordinate2DMake(bounds.sw.latitude, bounds.ne.longitude);
|
quad.bottomRight = CLLocationCoordinate2DMake(bounds.sw.latitude, bounds.ne.longitude);
|
||||||
quad.topRight = bounds.ne;
|
quad.topRight = bounds.ne;
|
||||||
return quad;
|
return quad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns `YES` if the two coordinate bounds are equal to each other. */
|
/** Returns `YES` if the two coordinate bounds are equal to each other. */
|
||||||
NS_INLINE BOOL MLNCoordinateBoundsEqualToCoordinateBounds(MLNCoordinateBounds bounds1, MLNCoordinateBounds bounds2) {
|
NS_INLINE BOOL MLNCoordinateBoundsEqualToCoordinateBounds(MLNCoordinateBounds bounds1,
|
||||||
return (bounds1.sw.latitude == bounds2.sw.latitude &&
|
MLNCoordinateBounds bounds2) {
|
||||||
bounds1.sw.longitude == bounds2.sw.longitude &&
|
return (
|
||||||
bounds1.ne.latitude == bounds2.ne.latitude &&
|
bounds1.sw.latitude == bounds2.sw.latitude && bounds1.sw.longitude == bounds2.sw.longitude &&
|
||||||
bounds1.ne.longitude == bounds2.ne.longitude);
|
bounds1.ne.latitude == bounds2.ne.latitude && bounds1.ne.longitude == bounds2.ne.longitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns `YES` if the two coordinate bounds intersect. */
|
/** Returns `YES` if the two coordinate bounds intersect. */
|
||||||
NS_INLINE BOOL MLNCoordinateBoundsIntersectsCoordinateBounds(MLNCoordinateBounds bounds1, MLNCoordinateBounds bounds2) {
|
NS_INLINE BOOL MLNCoordinateBoundsIntersectsCoordinateBounds(MLNCoordinateBounds bounds1,
|
||||||
return (bounds1.ne.latitude > bounds2.sw.latitude &&
|
MLNCoordinateBounds bounds2) {
|
||||||
bounds1.sw.latitude < bounds2.ne.latitude &&
|
return (bounds1.ne.latitude > bounds2.sw.latitude && bounds1.sw.latitude < bounds2.ne.latitude &&
|
||||||
bounds1.ne.longitude > bounds2.sw.longitude &&
|
bounds1.ne.longitude > bounds2.sw.longitude &&
|
||||||
bounds1.sw.longitude < bounds2.ne.longitude);
|
bounds1.sw.longitude < bounds2.ne.longitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns `YES` if the coordinate is within the coordinate bounds.
|
Returns `YES` if the coordinate is within the coordinate bounds.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Restrict map panning to an area, learn how to use
|
TODO: Restrict map panning to an area, learn how to use
|
||||||
`MLNCoordinateInCoordinateBounds` to determine if a point is within, or
|
`MLNCoordinateInCoordinateBounds` to determine if a point is within, or
|
||||||
intersects, a given bounding box.
|
intersects, a given bounding box.
|
||||||
*/
|
*/
|
||||||
NS_INLINE BOOL MLNCoordinateInCoordinateBounds(CLLocationCoordinate2D coordinate, MLNCoordinateBounds bounds) {
|
NS_INLINE BOOL MLNCoordinateInCoordinateBounds(CLLocationCoordinate2D coordinate,
|
||||||
return (coordinate.latitude >= bounds.sw.latitude &&
|
MLNCoordinateBounds bounds) {
|
||||||
coordinate.latitude <= bounds.ne.latitude &&
|
return (coordinate.latitude >= bounds.sw.latitude && coordinate.latitude <= bounds.ne.latitude &&
|
||||||
coordinate.longitude >= bounds.sw.longitude &&
|
coordinate.longitude >= bounds.sw.longitude &&
|
||||||
coordinate.longitude <= bounds.ne.longitude);
|
coordinate.longitude <= bounds.ne.longitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the area spanned by the coordinate bounds. */
|
/** Returns the area spanned by the coordinate bounds. */
|
||||||
NS_INLINE MLNCoordinateSpan MLNCoordinateBoundsGetCoordinateSpan(MLNCoordinateBounds bounds) {
|
NS_INLINE MLNCoordinateSpan MLNCoordinateBoundsGetCoordinateSpan(MLNCoordinateBounds bounds) {
|
||||||
return MLNCoordinateSpanMake(bounds.ne.latitude - bounds.sw.latitude,
|
return MLNCoordinateSpanMake(bounds.ne.latitude - bounds.sw.latitude,
|
||||||
bounds.ne.longitude - bounds.sw.longitude);
|
bounds.ne.longitude - bounds.sw.longitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a coordinate bounds with southwest and northeast coordinates that are
|
Returns a coordinate bounds with southwest and northeast coordinates that are
|
||||||
offset from those of the source bounds.
|
offset from those of the source bounds.
|
||||||
*/
|
*/
|
||||||
NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsOffset(MLNCoordinateBounds bounds, MLNCoordinateSpan offset) {
|
NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsOffset(MLNCoordinateBounds bounds,
|
||||||
MLNCoordinateBounds offsetBounds = bounds;
|
MLNCoordinateSpan offset) {
|
||||||
offsetBounds.sw.latitude += offset.latitudeDelta;
|
MLNCoordinateBounds offsetBounds = bounds;
|
||||||
offsetBounds.sw.longitude += offset.longitudeDelta;
|
offsetBounds.sw.latitude += offset.latitudeDelta;
|
||||||
offsetBounds.ne.latitude += offset.latitudeDelta;
|
offsetBounds.sw.longitude += offset.longitudeDelta;
|
||||||
offsetBounds.ne.longitude += offset.longitudeDelta;
|
offsetBounds.ne.latitude += offset.latitudeDelta;
|
||||||
return offsetBounds;
|
offsetBounds.ne.longitude += offset.longitudeDelta;
|
||||||
|
return offsetBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,56 +193,60 @@ NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsOffset(MLNCoordinateBounds boun
|
|||||||
northeast point lies due north of its southwest point).
|
northeast point lies due north of its southwest point).
|
||||||
*/
|
*/
|
||||||
NS_INLINE BOOL MLNCoordinateBoundsIsEmpty(MLNCoordinateBounds bounds) {
|
NS_INLINE BOOL MLNCoordinateBoundsIsEmpty(MLNCoordinateBounds bounds) {
|
||||||
MLNCoordinateSpan span = MLNCoordinateBoundsGetCoordinateSpan(bounds);
|
MLNCoordinateSpan span = MLNCoordinateBoundsGetCoordinateSpan(bounds);
|
||||||
return span.latitudeDelta == 0 || span.longitudeDelta == 0;
|
return span.latitudeDelta == 0 || span.longitudeDelta == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a formatted string for the given coordinate bounds. */
|
/** Returns a formatted string for the given coordinate bounds. */
|
||||||
NS_INLINE NSString *MLNStringFromCoordinateBounds(MLNCoordinateBounds bounds) {
|
NS_INLINE NSString *MLNStringFromCoordinateBounds(MLNCoordinateBounds bounds) {
|
||||||
return [NSString stringWithFormat:@"{ sw = {%.1f, %.1f}, ne = {%.1f, %.1f}}",
|
return [NSString stringWithFormat:@"{ sw = {%.1f, %.1f}, ne = {%.1f, %.1f}}", bounds.sw.latitude,
|
||||||
bounds.sw.latitude, bounds.sw.longitude,
|
bounds.sw.longitude, bounds.ne.latitude, bounds.ne.longitude];
|
||||||
bounds.ne.latitude, bounds.ne.longitude];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a formatted string for the given coordinate quad. */
|
/** Returns a formatted string for the given coordinate quad. */
|
||||||
NS_INLINE NSString *MLNStringFromCoordinateQuad(MLNCoordinateQuad quad) {
|
NS_INLINE NSString *MLNStringFromCoordinateQuad(MLNCoordinateQuad quad) {
|
||||||
return [NSString stringWithFormat:@"{ topleft = {%.1f, %.1f}, bottomleft = {%.1f, %.1f}}, bottomright = {%.1f, %.1f}, topright = {%.1f, %.1f}",
|
return [NSString stringWithFormat:@"{ topleft = {%.1f, %.1f}, bottomleft = {%.1f, %.1f}}, "
|
||||||
quad.topLeft.latitude, quad.topLeft.longitude,
|
@"bottomright = {%.1f, %.1f}, topright = {%.1f, %.1f}",
|
||||||
quad.bottomLeft.latitude, quad.bottomLeft.longitude,
|
quad.topLeft.latitude, quad.topLeft.longitude,
|
||||||
quad.bottomRight.latitude, quad.bottomRight.longitude,
|
quad.bottomLeft.latitude, quad.bottomLeft.longitude,
|
||||||
quad.topRight.latitude, quad.topRight.longitude];
|
quad.bottomRight.latitude, quad.bottomRight.longitude,
|
||||||
|
quad.topRight.latitude, quad.topRight.longitude];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns radians, converted from degrees. */
|
/** Returns radians, converted from degrees. */
|
||||||
NS_INLINE CGFloat MLNRadiansFromDegrees(CLLocationDegrees degrees) {
|
NS_INLINE CGFloat MLNRadiansFromDegrees(CLLocationDegrees degrees) {
|
||||||
return (CGFloat)(degrees * M_PI) / 180;
|
return (CGFloat)(degrees * M_PI) / 180;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns degrees, converted from radians. */
|
/** Returns degrees, converted from radians. */
|
||||||
NS_INLINE CLLocationDegrees MLNDegreesFromRadians(CGFloat radians) {
|
NS_INLINE CLLocationDegrees MLNDegreesFromRadians(CGFloat radians) { return radians * 180 / M_PI; }
|
||||||
return radians * 180 / M_PI;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns Mercator projection of a WGS84 coordinate at the specified zoom level. */
|
/** 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.
|
/** Converts a map zoom level to a camera altitude.
|
||||||
|
|
||||||
@param zoomLevel The zoom level to convert.
|
@param zoomLevel The zoom level to convert.
|
||||||
@param pitch The camera pitch, measured in degrees.
|
@param pitch The camera pitch, measured in degrees.
|
||||||
@param latitude The latitude of the point at the center of the viewport.
|
@param latitude The latitude of the point at the center of the viewport.
|
||||||
@param size The size of the viewport.
|
@param size The size of the viewport.
|
||||||
@return An altitude measured in meters. */
|
@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.
|
/** Converts a camera altitude to a map zoom level.
|
||||||
|
|
||||||
@param altitude The altitude to convert, measured in meters.
|
@param altitude The altitude to convert, measured in meters.
|
||||||
@param pitch The camera pitch, measured in degrees.
|
@param pitch The camera pitch, measured in degrees.
|
||||||
@param latitude The latitude of the point at the center of the viewport.
|
@param latitude The latitude of the point at the center of the viewport.
|
||||||
@param size The size of the viewport.
|
@param size The size of the viewport.
|
||||||
@return A zero-based zoom level. */
|
@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
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#import <TargetConditionals.h>
|
#import <TargetConditionals.h>
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#import <mbgl/util/geo.hpp>
|
#import <mbgl/util/geo.hpp>
|
||||||
@@ -15,18 +15,19 @@ typedef double MLNRadianDirection;
|
|||||||
|
|
||||||
/** Defines the coordinate by a `MLNRadianCoordinate2D`. */
|
/** Defines the coordinate by a `MLNRadianCoordinate2D`. */
|
||||||
typedef struct MLNRadianCoordinate2D {
|
typedef struct MLNRadianCoordinate2D {
|
||||||
MLNLocationRadians latitude;
|
MLNLocationRadians latitude;
|
||||||
MLNLocationRadians longitude;
|
MLNLocationRadians longitude;
|
||||||
} MLNRadianCoordinate2D;
|
} MLNRadianCoordinate2D;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a new `MLNRadianCoordinate2D` from the given latitudinal and longitudinal.
|
Creates a new `MLNRadianCoordinate2D` from the given latitudinal and longitudinal.
|
||||||
*/
|
*/
|
||||||
NS_INLINE MLNRadianCoordinate2D MLNRadianCoordinate2DMake(MLNLocationRadians latitude, MLNLocationRadians longitude) {
|
NS_INLINE MLNRadianCoordinate2D MLNRadianCoordinate2DMake(MLNLocationRadians latitude,
|
||||||
MLNRadianCoordinate2D radianCoordinate;
|
MLNLocationRadians longitude) {
|
||||||
radianCoordinate.latitude = latitude;
|
MLNRadianCoordinate2D radianCoordinate;
|
||||||
radianCoordinate.longitude = longitude;
|
radianCoordinate.latitude = latitude;
|
||||||
return radianCoordinate;
|
radianCoordinate.longitude = longitude;
|
||||||
|
return radianCoordinate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the smallest rectangle that contains both the given rectangle and
|
/// 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);
|
CGRect MLNExtendRect(CGRect rect, CGPoint point);
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
NS_INLINE NSString *MLNStringFromSize(CGSize size) {
|
NS_INLINE NSString *MLNStringFromSize(CGSize size) { return NSStringFromCGSize(size); }
|
||||||
return NSStringFromCGSize(size);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
NS_INLINE NSString *MLNStringFromSize(NSSize size) {
|
NS_INLINE NSString *MLNStringFromSize(NSSize size) { return NSStringFromSize(size); }
|
||||||
return NSStringFromSize(size);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_INLINE NSString *MLNStringFromCLLocationCoordinate2D(CLLocationCoordinate2D coordinate) {
|
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);
|
mbgl::LatLng MLNLatLngFromLocationCoordinate2D(CLLocationCoordinate2D coordinate);
|
||||||
|
|
||||||
NS_INLINE mbgl::Point<double> MLNPointFromLocationCoordinate2D(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) {
|
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) {
|
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) {
|
NS_INLINE MLNCoordinateBounds MLNCoordinateBoundsFromLatLngBounds(mbgl::LatLngBounds latLngBounds) {
|
||||||
return MLNCoordinateBoundsMake(MLNLocationCoordinate2DFromLatLng(latLngBounds.southwest()),
|
return MLNCoordinateBoundsMake(MLNLocationCoordinate2DFromLatLng(latLngBounds.southwest()),
|
||||||
MLNLocationCoordinate2DFromLatLng(latLngBounds.northeast()));
|
MLNLocationCoordinate2DFromLatLng(latLngBounds.northeast()));
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_INLINE mbgl::LatLngBounds MLNLatLngBoundsFromCoordinateBounds(MLNCoordinateBounds coordinateBounds) {
|
NS_INLINE mbgl::LatLngBounds MLNLatLngBoundsFromCoordinateBounds(
|
||||||
return mbgl::LatLngBounds::hull(MLNLatLngFromLocationCoordinate2D(coordinateBounds.sw),
|
MLNCoordinateBounds coordinateBounds) {
|
||||||
MLNLatLngFromLocationCoordinate2D(coordinateBounds.ne));
|
return mbgl::LatLngBounds::hull(MLNLatLngFromLocationCoordinate2D(coordinateBounds.sw),
|
||||||
|
MLNLatLngFromLocationCoordinate2D(coordinateBounds.ne));
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_INLINE std::array<mbgl::LatLng, 4> MLNLatLngArrayFromCoordinateQuad(MLNCoordinateQuad quad) {
|
NS_INLINE std::array<mbgl::LatLng, 4> MLNLatLngArrayFromCoordinateQuad(MLNCoordinateQuad quad) {
|
||||||
return { MLNLatLngFromLocationCoordinate2D(quad.topLeft),
|
return {MLNLatLngFromLocationCoordinate2D(quad.topLeft),
|
||||||
MLNLatLngFromLocationCoordinate2D(quad.topRight),
|
MLNLatLngFromLocationCoordinate2D(quad.topRight),
|
||||||
MLNLatLngFromLocationCoordinate2D(quad.bottomRight),
|
MLNLatLngFromLocationCoordinate2D(quad.bottomRight),
|
||||||
MLNLatLngFromLocationCoordinate2D(quad.bottomLeft) };
|
MLNLatLngFromLocationCoordinate2D(quad.bottomLeft)};
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_INLINE MLNCoordinateQuad MLNCoordinateQuadFromLatLngArray(std::array<mbgl::LatLng, 4> quad) {
|
NS_INLINE MLNCoordinateQuad MLNCoordinateQuadFromLatLngArray(std::array<mbgl::LatLng, 4> quad) {
|
||||||
return { MLNLocationCoordinate2DFromLatLng(quad[0]),
|
return {MLNLocationCoordinate2DFromLatLng(quad[0]), MLNLocationCoordinate2DFromLatLng(quad[3]),
|
||||||
MLNLocationCoordinate2DFromLatLng(quad[3]),
|
MLNLocationCoordinate2DFromLatLng(quad[2]), MLNLocationCoordinate2DFromLatLng(quad[1])};
|
||||||
MLNLocationCoordinate2DFromLatLng(quad[2]),
|
|
||||||
MLNLocationCoordinate2DFromLatLng(quad[1]) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,51 +87,50 @@ NS_INLINE MLNCoordinateQuad MLNCoordinateQuadFromLatLngArray(std::array<mbgl::La
|
|||||||
Considers extended coordinates.
|
Considers extended coordinates.
|
||||||
*/
|
*/
|
||||||
NS_INLINE BOOL MLNLocationCoordinate2DIsValid(CLLocationCoordinate2D coordinate) {
|
NS_INLINE BOOL MLNLocationCoordinate2DIsValid(CLLocationCoordinate2D coordinate) {
|
||||||
return (coordinate.latitude <= 90.0 &&
|
return (coordinate.latitude <= 90.0 && coordinate.latitude >= -90.0 &&
|
||||||
coordinate.latitude >= -90.0 &&
|
coordinate.longitude <= 360.0 && coordinate.longitude >= -360.0);
|
||||||
coordinate.longitude <= 360.0 &&
|
|
||||||
coordinate.longitude >= -360.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
#define MLNEdgeInsets UIEdgeInsets
|
#define MLNEdgeInsets UIEdgeInsets
|
||||||
#define MLNEdgeInsetsMake UIEdgeInsetsMake
|
#define MLNEdgeInsetsMake UIEdgeInsetsMake
|
||||||
#else
|
#else
|
||||||
#define MLNEdgeInsets NSEdgeInsets
|
#define MLNEdgeInsets NSEdgeInsets
|
||||||
#define MLNEdgeInsetsMake NSEdgeInsetsMake
|
#define MLNEdgeInsetsMake NSEdgeInsetsMake
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_INLINE mbgl::EdgeInsets MLNEdgeInsetsFromNSEdgeInsets(MLNEdgeInsets insets) {
|
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) {
|
NS_INLINE MLNEdgeInsets NSEdgeInsetsFromMLNEdgeInsets(const mbgl::EdgeInsets &insets) {
|
||||||
return MLNEdgeInsetsMake(insets.top(), insets.left(), insets.bottom(), insets.right());
|
return MLNEdgeInsetsMake(insets.top(), insets.left(), insets.bottom(), insets.right());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the combination of two edge insets.
|
/// Returns the combination of two edge insets.
|
||||||
NS_INLINE MLNEdgeInsets MLNEdgeInsetsInsetEdgeInset(MLNEdgeInsets base, MLNEdgeInsets inset) {
|
NS_INLINE MLNEdgeInsets MLNEdgeInsetsInsetEdgeInset(MLNEdgeInsets base, MLNEdgeInsets inset) {
|
||||||
return MLNEdgeInsetsMake(base.top + inset.top,
|
return MLNEdgeInsetsMake(base.top + inset.top, base.left + inset.left, base.bottom + inset.bottom,
|
||||||
base.left + inset.left,
|
base.right + inset.right);
|
||||||
base.bottom + inset.bottom,
|
|
||||||
base.right + inset.right);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns MLNRadianCoordinate2D, converted from CLLocationCoordinate2D. */
|
/** Returns MLNRadianCoordinate2D, converted from CLLocationCoordinate2D. */
|
||||||
NS_INLINE MLNRadianCoordinate2D MLNRadianCoordinateFromLocationCoordinate(CLLocationCoordinate2D locationCoordinate) {
|
NS_INLINE MLNRadianCoordinate2D
|
||||||
return MLNRadianCoordinate2DMake(MLNRadiansFromDegrees(locationCoordinate.latitude),
|
MLNRadianCoordinateFromLocationCoordinate(CLLocationCoordinate2D locationCoordinate) {
|
||||||
MLNRadiansFromDegrees(locationCoordinate.longitude));
|
return MLNRadianCoordinate2DMake(MLNRadiansFromDegrees(locationCoordinate.latitude),
|
||||||
|
MLNRadiansFromDegrees(locationCoordinate.longitude));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the distance in radians given two coordinates.
|
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.
|
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.
|
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.
|
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.
|
Returns a point with coordinates rounded to the nearest logical pixel.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "MLNSource.h"
|
#import "MLNSource.h"
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNTypes.h"
|
|
||||||
#import "MLNGeometry.h"
|
#import "MLNGeometry.h"
|
||||||
|
#import "MLNTypes.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -10,19 +10,19 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
`MLNImageSource` is a content source that is used for a georeferenced raster
|
`MLNImageSource` is a content source that is used for a georeferenced raster
|
||||||
image to be shown on the map. The georeferenced image scales and rotates as the
|
image to be shown on the map. The georeferenced image scales and rotates as the
|
||||||
user zooms and rotates the map. Images may also be used as icons or patterns
|
user zooms and rotates the map. Images may also be used as icons or patterns
|
||||||
in a style layer. To register an image for use as an icon or pattern,
|
in a style layer. To register an image for use as an icon or pattern,
|
||||||
use the `-[MLNStyle setImage:forName:]` method. To configure a point
|
use the `-[MLNStyle setImage:forName:]` method. To configure a point
|
||||||
annotation’s image, use the `MLNAnnotationImage` class.
|
annotation’s image, use the `MLNAnnotationImage` class.
|
||||||
|
|
||||||
The geographic location of the raster image content, supplied with
|
The geographic location of the raster image content, supplied with
|
||||||
`MLNCoordinateQuad`, can be non-axis aligned.
|
`MLNCoordinateQuad`, can be non-axis aligned.
|
||||||
`MLNImageSource` supports raster content from `NSURL`, `NSImage` (macOS), or
|
`MLNImageSource` supports raster content from `NSURL`, `NSImage` (macOS), or
|
||||||
`UIImage` (iOS).
|
`UIImage` (iOS).
|
||||||
An image source is added to an `MLNStyle` object along with one or more
|
An image source is added to an `MLNStyle` object along with one or more
|
||||||
`MLNRasterStyleLayer` objects. Use a raster style layer to control the
|
`MLNRasterStyleLayer` objects. Use a raster style layer to control the
|
||||||
appearance of content supplied by the image source.
|
appearance of content supplied by the image source.
|
||||||
|
|
||||||
Each
|
Each
|
||||||
<a href="https://maplibre.org/maplibre-style-spec/#sources-image"><code>image</code></a>
|
<a href="https://maplibre.org/maplibre-style-spec/#sources-image"><code>image</code></a>
|
||||||
source defined by the style JSON file is represented at runtime by an
|
source defined by the style JSON file is represented at runtime by an
|
||||||
@@ -38,10 +38,10 @@ MLN_EXPORT
|
|||||||
bottomLeft: CLLocationCoordinate2D(latitude: 37.936, longitude: -80.425),
|
bottomLeft: CLLocationCoordinate2D(latitude: 37.936, longitude: -80.425),
|
||||||
bottomRight: CLLocationCoordinate2D(latitude: 37.936, longitude: -71.516),
|
bottomRight: CLLocationCoordinate2D(latitude: 37.936, longitude: -71.516),
|
||||||
topRight: CLLocationCoordinate2D(latitude: 46.437, 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")!)
|
let source = MLNImageSource(identifier: "radar", coordinateQuad: coordinates, url: URL(string:
|
||||||
mapView.style?.addSource(source)
|
"https://maplibre.org/maplibre-gl-js-docs/assets/radar.gif")!) mapView.style?.addSource(source)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Add an image, learn how to add an image to your map using `MLNImageSource`.
|
TODO: Add an image, learn how to add an image to your map using `MLNImageSource`.
|
||||||
*/
|
*/
|
||||||
@@ -54,22 +54,28 @@ MLN_EXPORT
|
|||||||
Returns a georeferenced image source with an identifier, coordinates and a URL.
|
Returns a georeferenced image source with an identifier, coordinates and a URL.
|
||||||
|
|
||||||
@param identifier A string that uniquely identifies the source.
|
@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
|
@param url An HTTP(S) URL, absolute file URL, or local file URL relative to the
|
||||||
current application’s resource bundle.
|
current application’s resource bundle.
|
||||||
@return An initialized shape source.
|
@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.
|
Returns a georeferenced image source with an identifier, coordinates and an image.
|
||||||
|
|
||||||
@param identifier A string that uniquely identifies the source.
|
@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.
|
@param image The image to display for the source.
|
||||||
@return An initialized shape 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
|
// MARK: Accessing a Source’s Content
|
||||||
|
|
||||||
@@ -79,7 +85,7 @@ MLN_EXPORT
|
|||||||
If the receiver was initialized using `-initWithIdentifier:coordinateQuad:image:` or
|
If the receiver was initialized using `-initWithIdentifier:coordinateQuad:image:` or
|
||||||
the `image` property is set, this property is set to `nil`.
|
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.
|
Sets the URL for the image source, performing necessary validations.
|
||||||
@@ -91,9 +97,10 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
The source image.
|
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.
|
The coordinates at which the corners of the source image will be placed.
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
#import "MLNLight.h"
|
#import "MLNLight.h"
|
||||||
|
|
||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
namespace style {
|
namespace style {
|
||||||
class Light;
|
class Light;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace mbgl
|
||||||
|
|
||||||
@interface MLNLight (Private)
|
@interface MLNLight (Private)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
such as a change in the user’s location. This protocol is similar to the
|
such as a change in the user’s location. This protocol is similar to the
|
||||||
Core Location framework’s `CLLocationManager` class, but your implementation
|
Core Location framework’s `CLLocationManager` class, but your implementation
|
||||||
does not need to be based on `CLLocationManager`.
|
does not need to be based on `CLLocationManager`.
|
||||||
|
|
||||||
To receive location updates from an object that conforms to the `MLNLocationManager`
|
To receive location updates from an object that conforms to the `MLNLocationManager`
|
||||||
protocol, use the optional methods available in the `MLNLocationManagerDelegate` protocol.
|
protocol, use the optional methods available in the `MLNLocationManagerDelegate` protocol.
|
||||||
*/
|
*/
|
||||||
@@ -25,10 +25,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
Specifies the minimum distance (measured in meters) a device must move horizontally
|
Specifies the minimum distance (measured in meters) a device must move horizontally
|
||||||
before a location update is generated.
|
before a location update is generated.
|
||||||
|
|
||||||
The default value of this property is `kCLDistanceFilterNone` when `MLNMapView` uses its
|
The default value of this property is `kCLDistanceFilterNone` when `MLNMapView` uses its
|
||||||
default location manager.
|
default location manager.
|
||||||
|
|
||||||
@see `CLLocationManager.distanceFilter`
|
@see `CLLocationManager.distanceFilter`
|
||||||
*/
|
*/
|
||||||
- (CLLocationDistance)distanceFilter;
|
- (CLLocationDistance)distanceFilter;
|
||||||
@@ -37,23 +37,23 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
Sets the minimum update distance in meters.
|
Sets the minimum update distance in meters.
|
||||||
@param distanceFilter The distance filter in meters.
|
@param distanceFilter The distance filter in meters.
|
||||||
*/
|
*/
|
||||||
- (void)setDistanceFilter:(CLLocationDistance) distanceFilter;
|
- (void)setDistanceFilter:(CLLocationDistance)distanceFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Specifies the accuracy of the location data.
|
Specifies the accuracy of the location data.
|
||||||
|
|
||||||
The default value is `kCLLocationAccuracyBest` when `MLNMapView` uses its
|
The default value is `kCLLocationAccuracyBest` when `MLNMapView` uses its
|
||||||
default location manager.
|
default location manager.
|
||||||
|
|
||||||
@note Determining a location with greater accuracy requires more time and more power.
|
@note Determining a location with greater accuracy requires more time and more power.
|
||||||
|
|
||||||
@see `CLLocationManager.desiredAccuracy`
|
@see `CLLocationManager.desiredAccuracy`
|
||||||
*/
|
*/
|
||||||
- (CLLocationAccuracy)desiredAccuracy;
|
- (CLLocationAccuracy)desiredAccuracy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the desired location accuracy.
|
Sets the desired location accuracy.
|
||||||
|
|
||||||
@param desiredAccuracy The desired location accuracy.
|
@param desiredAccuracy The desired location accuracy.
|
||||||
*/
|
*/
|
||||||
- (void)setDesiredAccuracy:(CLLocationAccuracy)desiredAccuracy;
|
- (void)setDesiredAccuracy:(CLLocationAccuracy)desiredAccuracy;
|
||||||
@@ -61,31 +61,31 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
|
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
|
||||||
/**
|
/**
|
||||||
Specifies the level of location accuracy the Maps SDK has permission to use.
|
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
|
@note If the value of this property is `CLAccuracyAuthorizationFullAccuracy`, you can set the
|
||||||
`MLNLocationManager.desiredAccuracy` property to any value. If the value is `CLAccuracyAuthorizationReducedAccuracy`,
|
`MLNLocationManager.desiredAccuracy` property to any value. If the value is
|
||||||
setting `MLNLocationManager.desiredAccuracy` to a value other than` kCLLocationAccuracyReduced` has no effect on
|
`CLAccuracyAuthorizationReducedAccuracy`, setting `MLNLocationManager.desiredAccuracy` to a value
|
||||||
the location information.
|
other than` kCLLocationAccuracyReduced` has no effect on the location information.
|
||||||
*/
|
*/
|
||||||
- (CLAccuracyAuthorization)accuracyAuthorization API_AVAILABLE(ios(14));
|
- (CLAccuracyAuthorization)accuracyAuthorization API_AVAILABLE(ios(14));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Specifies the type of user activity associated with the location updates.
|
Specifies the type of user activity associated with the location updates.
|
||||||
|
|
||||||
The location manager uses this property as a cue to determine when location updates
|
The location manager uses this property as a cue to determine when location updates
|
||||||
may be automatically paused.
|
may be automatically paused.
|
||||||
|
|
||||||
The default value is `CLActivityTypeOther` when `MLNMapView` uses its
|
The default value is `CLActivityTypeOther` when `MLNMapView` uses its
|
||||||
default location manager.
|
default location manager.
|
||||||
|
|
||||||
@see `CLLocationManager.activityType`
|
@see `CLLocationManager.activityType`
|
||||||
*/
|
*/
|
||||||
- (CLActivityType)activityType;
|
- (CLActivityType)activityType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the type of user activity associated with the location updates.
|
Sets the type of user activity associated with the location updates.
|
||||||
|
|
||||||
@param activityType The location's manager activity type.
|
@param activityType The location's manager activity type.
|
||||||
*/
|
*/
|
||||||
- (void)setActivityType:(CLActivityType)activityType;
|
- (void)setActivityType:(CLActivityType)activityType;
|
||||||
@@ -94,18 +94,19 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
Requests the user's permission to temporarily use location update services
|
Requests the user's permission to temporarily use location update services
|
||||||
with full accuracy.
|
with full accuracy.
|
||||||
|
|
||||||
@note If the user turned off location accuracy you may use this method to
|
@note If the user turned off location accuracy you may use this method to
|
||||||
request full accuracy for a session.
|
request full accuracy for a session.
|
||||||
*/
|
*/
|
||||||
- (void)requestTemporaryFullAccuracyAuthorizationWithPurposeKey:(NSString *)purposeKey API_AVAILABLE(ios(14));
|
- (void)requestTemporaryFullAccuracyAuthorizationWithPurposeKey:(NSString *)purposeKey
|
||||||
|
API_AVAILABLE(ios(14));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@required
|
@required
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The delegate to receive location updates.
|
The delegate to receive location updates.
|
||||||
|
|
||||||
Do not set the location manager’s delegate yourself. `MLNMapView` sets this property
|
Do not set the location manager’s delegate yourself. `MLNMapView` sets this property
|
||||||
after the location manager becomes `MLNMapView`’s location manager.
|
after the location manager becomes `MLNMapView`’s location manager.
|
||||||
*/
|
*/
|
||||||
@@ -115,7 +116,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the current localization authorization status.
|
Returns the current localization authorization status.
|
||||||
|
|
||||||
@see `+[CLLocationManger authorizationStatus]`
|
@see `+[CLLocationManger authorizationStatus]`
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly) CLAuthorizationStatus authorizationStatus;
|
@property (nonatomic, readonly) CLAuthorizationStatus authorizationStatus;
|
||||||
@@ -180,7 +181,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Notifies the delegate with the new location data.
|
Notifies the delegate with the new location data.
|
||||||
|
|
||||||
@param manager The location manager reporting the update.
|
@param manager The location manager reporting the update.
|
||||||
@param locations An array of `CLLocation` objects in chronological order,
|
@param locations An array of `CLLocation` objects in chronological order,
|
||||||
with the last object representing the most recent location. This array
|
with the last object representing the most recent location. This array
|
||||||
@@ -194,16 +195,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Notifies the delegate with the new heading data.
|
Notifies the delegate with the new heading data.
|
||||||
|
|
||||||
@param manager The location manager reporting the update.
|
@param manager The location manager reporting the update.
|
||||||
@param newHeading The new heading update.
|
@param newHeading The new heading update.
|
||||||
*/
|
*/
|
||||||
- (void)locationManager:(id<MLNLocationManager>)manager
|
- (void)locationManager:(id<MLNLocationManager>)manager didUpdateHeading:(CLHeading *)newHeading;
|
||||||
didUpdateHeading:(CLHeading *)newHeading;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Asks the delegate if the calibration alert should be displayed.
|
Asks the delegate if the calibration alert should be displayed.
|
||||||
|
|
||||||
@param manager The location manager reporting the calibration.
|
@param manager The location manager reporting the calibration.
|
||||||
*/
|
*/
|
||||||
- (BOOL)locationManagerShouldDisplayHeadingCalibration:(id<MLNLocationManager>)manager;
|
- (BOOL)locationManagerShouldDisplayHeadingCalibration:(id<MLNLocationManager>)manager;
|
||||||
@@ -213,21 +213,20 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
Notifies the delegate that the location manager was unable to retrieve
|
Notifies the delegate that the location manager was unable to retrieve
|
||||||
location updates.
|
location updates.
|
||||||
|
|
||||||
@param manager The location manager reporting the error.
|
@param manager The location manager reporting the error.
|
||||||
@param error An error object containing the error code that indicates
|
@param error An error object containing the error code that indicates
|
||||||
why the location manager failed.
|
why the location manager failed.
|
||||||
*/
|
*/
|
||||||
- (void)locationManager:(id<MLNLocationManager>)manager
|
- (void)locationManager:(id<MLNLocationManager>)manager didFailWithError:(nonnull NSError *)error;
|
||||||
didFailWithError:(nonnull NSError *)error;
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
|
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
|
||||||
/**
|
/**
|
||||||
Notifies the delegate that the location authorization status has changed.
|
Notifies the delegate that the location authorization status has changed.
|
||||||
|
|
||||||
@param manager The location manager reporting the change.
|
@param manager The location manager reporting the change.
|
||||||
*/
|
*/
|
||||||
- (void)locationManagerDidChangeAuthorization:(id<MLNLocationManager>)manager;
|
- (void)locationManagerDidChangeAuthorization:(id<MLNLocationManager>)manager;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@optional
|
@optional
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import "MLNLocationManager.h"
|
#import "MLNLocationManager.h"
|
||||||
|
|
||||||
@interface MLNCLLocationManager : NSObject<MLNLocationManager>
|
@interface MLNCLLocationManager : NSObject <MLNLocationManager>
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
#ifndef MLN_LOGGING_DISABLED
|
#ifndef MLN_LOGGING_DISABLED
|
||||||
#ifndef MLN_LOGGING_ENABLE_DEBUG
|
#ifndef MLN_LOGGING_ENABLE_DEBUG
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
#define MLN_LOGGING_ENABLE_DEBUG 1
|
#define MLN_LOGGING_ENABLE_DEBUG 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -15,50 +15,51 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
Constants indicating the message's logging level.
|
Constants indicating the message's logging level.
|
||||||
*/
|
*/
|
||||||
typedef NS_ENUM(NSInteger, MLNLoggingLevel) {
|
typedef NS_ENUM(NSInteger, MLNLoggingLevel) {
|
||||||
/**
|
/**
|
||||||
None-level won't print any messages.
|
None-level won't print any messages.
|
||||||
*/
|
*/
|
||||||
MLNLoggingLevelNone = 0,
|
MLNLoggingLevelNone = 0,
|
||||||
/**
|
/**
|
||||||
Fault-level messages contain system-level error information.
|
Fault-level messages contain system-level error information.
|
||||||
*/
|
*/
|
||||||
MLNLoggingLevelFault,
|
MLNLoggingLevelFault,
|
||||||
/**
|
/**
|
||||||
Error-level messages contain information that is intended to aid in process-level
|
Error-level messages contain information that is intended to aid in process-level
|
||||||
errors.
|
errors.
|
||||||
*/
|
*/
|
||||||
MLNLoggingLevelError,
|
MLNLoggingLevelError,
|
||||||
/**
|
/**
|
||||||
Warning-level messages contain warning information for potential risks.
|
Warning-level messages contain warning information for potential risks.
|
||||||
*/
|
*/
|
||||||
MLNLoggingLevelWarning,
|
MLNLoggingLevelWarning,
|
||||||
/**
|
/**
|
||||||
Info-level messages contain information that may be helpful for flow tracing
|
Info-level messages contain information that may be helpful for flow tracing
|
||||||
but is not essential.
|
but is not essential.
|
||||||
*/
|
*/
|
||||||
MLNLoggingLevelInfo,
|
MLNLoggingLevelInfo,
|
||||||
/**
|
/**
|
||||||
Debug-level messages contain information that may be helpful for troubleshooting
|
Debug-level messages contain information that may be helpful for troubleshooting
|
||||||
specific problems.
|
specific problems.
|
||||||
*/
|
*/
|
||||||
#if MLN_LOGGING_ENABLE_DEBUG
|
#if MLN_LOGGING_ENABLE_DEBUG
|
||||||
MLNLoggingLevelDebug,
|
MLNLoggingLevelDebug,
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
Verbose-level will print all messages.
|
Verbose-level will print all messages.
|
||||||
*/
|
*/
|
||||||
MLNLoggingLevelVerbose,
|
MLNLoggingLevelVerbose,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A block to be called once `loggingLevel` is set to a higher value than `MLNLoggingLevelNone`.
|
A block to be called once `loggingLevel` is set to a higher value than `MLNLoggingLevelNone`.
|
||||||
|
|
||||||
@param loggingLevel The message logging level.
|
@param loggingLevel The message logging level.
|
||||||
@param filePath The description of the file and method for the calling message.
|
@param filePath The description of the file and method for the calling message.
|
||||||
@param line The line where the message is logged.
|
@param line The line where the message is logged.
|
||||||
@param message The logging message.
|
@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
|
The `MLNLoggingConfiguration` object provides a global way to set this SDK logging levels
|
||||||
@@ -69,19 +70,19 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The handler this SDK uses to log messages.
|
The handler this SDK uses to log messages.
|
||||||
|
|
||||||
If this property is set to nil or if no custom handler is provided this property
|
If this property is set to nil or if no custom handler is provided this property
|
||||||
is set to the default handler.
|
is set to the default handler.
|
||||||
|
|
||||||
The default handler uses `os_log` and `NSLog` for iOS 10+ and iOS < 10 respectively.
|
The default handler uses `os_log` and `NSLog` for iOS 10+ and iOS < 10 respectively.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, copy, null_resettable) MLNLoggingBlockHandler handler;
|
@property (nonatomic, copy, null_resettable) MLNLoggingBlockHandler handler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The logging level.
|
The logging level.
|
||||||
|
|
||||||
The default value is `MLNLoggingLevelNone`.
|
The default value is `MLNLoggingLevelNone`.
|
||||||
|
|
||||||
Setting this property includes logging levels less than or equal to the setted value.
|
Setting this property includes logging levels less than or equal to the setted value.
|
||||||
*/
|
*/
|
||||||
@property (assign, nonatomic) MLNLoggingLevel loggingLevel;
|
@property (assign, nonatomic) MLNLoggingLevel loggingLevel;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
#import "MLNLoggingConfiguration.h"
|
#import "MLNLoggingConfiguration.h"
|
||||||
|
|
||||||
NS_INLINE NSString *MLNStringFromBOOL(BOOL value) {
|
NS_INLINE NSString *MLNStringFromBOOL(BOOL value) { return value ? @"YES" : @"NO"; }
|
||||||
return value ? @"YES" : @"NO";
|
|
||||||
}
|
|
||||||
|
|
||||||
#if TARGET_OS_OSX
|
#if TARGET_OS_OSX
|
||||||
NS_INLINE NSString *MLNStringFromNSEdgeInsets(NSEdgeInsets insets) {
|
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
|
#endif
|
||||||
|
|
||||||
@@ -21,47 +20,57 @@ NS_INLINE NSString *MLNStringFromNSEdgeInsets(NSEdgeInsets insets) {
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#if MLN_LOGGING_ENABLE_DEBUG
|
#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
|
#else
|
||||||
#define MLNLogDebug(...)
|
#define MLNLogDebug(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MLNLogInfo(message, ...) MLNLogWithType(MLNLoggingLevelInfo, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
#define MLNLogInfo(message, ...) \
|
||||||
#define MLNLogWarning(message, ...) MLNLogWithType(MLNLoggingLevelWarning, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
MLNLogWithType(MLNLoggingLevelInfo, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
||||||
#define MLNLogError(message, ...) MLNLogWithType(MLNLoggingLevelError, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
#define MLNLogWarning(message, ...) \
|
||||||
#define MLNLogFault(message, ...) MLNLogWithType(MLNLoggingLevelFault, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__)
|
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
|
#endif
|
||||||
|
|
||||||
#define MLNAssert(expression, message, ...) \
|
#define MLNAssert(expression, message, ...) \
|
||||||
__extension__({ \
|
__extension__({ \
|
||||||
if (__builtin_expect(!(expression), 0)) { \
|
if (__builtin_expect(!(expression), 0)) { \
|
||||||
MLNLogFault(message, ##__VA_ARGS__); \
|
MLNLogFault(message, ##__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
NSAssert(expression, message, ##__VA_ARGS__); \
|
NSAssert(expression, message, ##__VA_ARGS__); \
|
||||||
})
|
})
|
||||||
#define MLNCAssert(expression, message, ...) \
|
#define MLNCAssert(expression, message, ...) \
|
||||||
__extension__({ \
|
__extension__({ \
|
||||||
if (__builtin_expect(!(expression), 0)) { \
|
if (__builtin_expect(!(expression), 0)) { \
|
||||||
MLNLogFault(message, ##__VA_ARGS__); \
|
MLNLogFault(message, ##__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
NSCAssert(expression, message, ##__VA_ARGS__); \
|
NSCAssert(expression, message, ##__VA_ARGS__); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
#ifndef MLN_LOGGING_DISABLED
|
#ifndef MLN_LOGGING_DISABLED
|
||||||
|
|
||||||
#define MLNLogWithType(type, function, line, message, ...) \
|
#define MLNLogWithType(type, function, line, message, ...) \
|
||||||
{ \
|
{ \
|
||||||
if ([MLNLoggingConfiguration sharedConfiguration].loggingLevel != MLNLoggingLevelNone && type <= [MLNLoggingConfiguration sharedConfiguration].loggingLevel) \
|
if ([MLNLoggingConfiguration sharedConfiguration].loggingLevel != MLNLoggingLevelNone && \
|
||||||
{ \
|
type <= [MLNLoggingConfiguration sharedConfiguration].loggingLevel) { \
|
||||||
[[MLNLoggingConfiguration sharedConfiguration] logCallingFunction:function functionLine:line messageType:type format:(message), ##__VA_ARGS__]; \
|
[[MLNLoggingConfiguration sharedConfiguration] logCallingFunction:function \
|
||||||
} \
|
functionLine:line \
|
||||||
}
|
messageType:type \
|
||||||
|
format:(message), ##__VA_ARGS__]; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
@interface MLNLoggingConfiguration (Private)
|
@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
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreGraphics/CoreGraphics.h>
|
#import <CoreGraphics/CoreGraphics.h>
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
An `MLNMapCamera` object represents a viewpoint from which the user observes
|
An `MLNMapCamera` object represents a viewpoint from which the user observes
|
||||||
some point on an `MLNMapView`.
|
some point on an `MLNMapView`.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Camera animation, learn how to create a camera that rotates
|
TODO: Camera animation, learn how to create a camera that rotates
|
||||||
around a central point.
|
around a central point.
|
||||||
@@ -34,10 +34,10 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
The altitude (measured in meters) above the map at which the camera is
|
The altitude (measured in meters) above the map at which the camera is
|
||||||
situated.
|
situated.
|
||||||
|
|
||||||
The altitude is the distance from the viewpoint to the map, perpendicular to
|
The altitude is the distance from the viewpoint to the map, perpendicular to
|
||||||
the map plane. This property does not account for physical elevation.
|
the map plane. This property does not account for physical elevation.
|
||||||
|
|
||||||
This property’s value may be less than that of the `viewingDistance` property.
|
This property’s value may be less than that of the `viewingDistance` property.
|
||||||
Setting this property automatically updates the `viewingDistance` property
|
Setting this property automatically updates the `viewingDistance` property
|
||||||
based on the `pitch` property’s current value.
|
based on the `pitch` property’s current value.
|
||||||
@@ -46,7 +46,7 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The straight-line distance from the viewpoint to the `centerCoordinate`.
|
The straight-line distance from the viewpoint to the `centerCoordinate`.
|
||||||
|
|
||||||
Setting this property automatically updates the `altitude` property based on
|
Setting this property automatically updates the `altitude` property based on
|
||||||
the `pitch` property’s current value.
|
the `pitch` property’s current value.
|
||||||
*/
|
*/
|
||||||
@@ -73,11 +73,11 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a new camera with the given distance, pitch, and heading.
|
Returns a new camera with the given distance, pitch, and heading.
|
||||||
|
|
||||||
This method interprets the distance as a straight-line distance from the
|
This method interprets the distance as a straight-line distance from the
|
||||||
viewpoint to the center coordinate. To specify the altitude of the viewpoint,
|
viewpoint to the center coordinate. To specify the altitude of the viewpoint,
|
||||||
use the `-cameraLookingAtCenterCoordinate:altitude:pitch:heading:` method.
|
use the `-cameraLookingAtCenterCoordinate:altitude:pitch:heading:` method.
|
||||||
|
|
||||||
@param centerCoordinate The geographic coordinate on which the map should be
|
@param centerCoordinate The geographic coordinate on which the map should be
|
||||||
centered.
|
centered.
|
||||||
@param distance The straight-line distance from the viewpoint to the
|
@param distance The straight-line distance from the viewpoint to the
|
||||||
@@ -128,17 +128,17 @@ MLN_EXPORT
|
|||||||
fromDistance:(CLLocationDistance)distance
|
fromDistance:(CLLocationDistance)distance
|
||||||
pitch:(CGFloat)pitch
|
pitch:(CGFloat)pitch
|
||||||
heading:(CLLocationDirection)heading
|
heading:(CLLocationDirection)heading
|
||||||
__attribute__((deprecated("Use -cameraLookingAtCenterCoordinate:acrossDistance:pitch:heading: "
|
__attribute__((deprecated("Use -cameraLookingAtCenterCoordinate:acrossDistance:pitch:heading: "
|
||||||
"or -cameraLookingAtCenterCoordinate:altitude:pitch:heading:.")));
|
"or -cameraLookingAtCenterCoordinate:altitude:pitch:heading:.")));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a Boolean value indicating whether the given camera is functionally
|
Returns a Boolean value indicating whether the given camera is functionally
|
||||||
equivalent to the receiver.
|
equivalent to the receiver.
|
||||||
|
|
||||||
Unlike `-isEqual:`, this method returns `YES` if the difference between the
|
Unlike `-isEqual:`, this method returns `YES` if the difference between the
|
||||||
coordinates, altitudes, pitches, or headings of the two camera objects is
|
coordinates, altitudes, pitches, or headings of the two camera objects is
|
||||||
negligible.
|
negligible.
|
||||||
|
|
||||||
@param otherCamera The camera with which to compare the receiver.
|
@param otherCamera The camera with which to compare the receiver.
|
||||||
@return A Boolean value indicating whether the two cameras are functionally
|
@return A Boolean value indicating whether the two cameras are functionally
|
||||||
equivalent.
|
equivalent.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "MLNTypes.h"
|
|
||||||
#import "MLNGeometry.h"
|
#import "MLNGeometry.h"
|
||||||
#import "MLNMapCamera.h"
|
#import "MLNMapCamera.h"
|
||||||
#import "MLNStyle.h"
|
#import "MLNStyle.h"
|
||||||
|
#import "MLNTypes.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ draw custom overlays rendered with Core Graphics.
|
|||||||
|
|
||||||
@param snapshotOverlay The `MLNMapSnapshotOverlay` provided during snapshot drawing.
|
@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`.
|
The options to use when creating images with the `MLNMapSnapshotter`.
|
||||||
@@ -65,13 +65,15 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a set of options with the minimum required information.
|
Creates a set of options with the minimum required information.
|
||||||
|
|
||||||
@param styleURL URL of the map style to snapshot. The URL may be a full HTTP,
|
@param styleURL URL of the map style to snapshot. The URL may be a full HTTP,
|
||||||
HTTPS URL, canonical URL or a path to a local file relative to
|
HTTPS URL, canonical URL or a path to a local file relative to
|
||||||
the application’s resource path. Specify `nil` for the default style.
|
the application’s resource path. Specify `nil` for the default style.
|
||||||
@param size The image size.
|
@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
|
// MARK: - Configuring the Map
|
||||||
|
|
||||||
@@ -82,7 +84,7 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The zoom level.
|
The zoom level.
|
||||||
|
|
||||||
The default zoom level is 0. If this property is non-zero and the camera
|
The default zoom level is 0. If this property is non-zero and the camera
|
||||||
property is non-nil, the camera’s altitude is ignored in favor of this
|
property is non-nil, the camera’s altitude is ignored in favor of this
|
||||||
property’s value.
|
property’s value.
|
||||||
@@ -91,7 +93,7 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
A camera representing the viewport visible in the snapshot.
|
A camera representing the viewport visible in the snapshot.
|
||||||
|
|
||||||
If this property is non-nil and the `coordinateBounds` property is set to a
|
If this property is non-nil and the `coordinateBounds` property is set to a
|
||||||
non-empty coordinate bounds, the camera’s center coordinate and altitude are
|
non-empty coordinate bounds, the camera’s center coordinate and altitude are
|
||||||
ignored in favor of the `coordinateBounds` property.
|
ignored in favor of the `coordinateBounds` property.
|
||||||
@@ -100,7 +102,7 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The coordinate rectangle that encompasses the bounds to capture.
|
The coordinate rectangle that encompasses the bounds to capture.
|
||||||
|
|
||||||
If this property is non-empty and the camera property is non-nil, the camera’s
|
If this property is non-empty and the camera property is non-nil, the camera’s
|
||||||
center coordinate and altitude are ignored in favor of this property’s value.
|
center coordinate and altitude are ignored in favor of this property’s value.
|
||||||
*/
|
*/
|
||||||
@@ -110,13 +112,13 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The size of the output image, measured in points.
|
The size of the output image, measured in points.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly) CGSize size;
|
@property (nonatomic, readonly) CGSize size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The scale of the output image. Defaults to the main screen scale.
|
The scale of the output image. Defaults to the main screen scale.
|
||||||
|
|
||||||
The minimum scale is 1.
|
The minimum scale is 1.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic) CGFloat scale;
|
@property (nonatomic) CGFloat scale;
|
||||||
@@ -157,7 +159,6 @@ MLN_EXPORT
|
|||||||
*/
|
*/
|
||||||
- (CLLocationCoordinate2D)coordinateForPoint:(NSPoint)point;
|
- (CLLocationCoordinate2D)coordinateForPoint:(NSPoint)point;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The image of the map’s content.
|
The image of the map’s content.
|
||||||
*/
|
*/
|
||||||
@@ -168,12 +169,13 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
A block to processes the result or error of a snapshot request.
|
A block to processes the result or error of a snapshot request.
|
||||||
|
|
||||||
@param snapshot The `MLNMapSnapshot` that was generated or `nil` if an error
|
@param snapshot The `MLNMapSnapshot` that was generated or `nil` if an error
|
||||||
occurred.
|
occurred.
|
||||||
@param error The error that occured or `nil` when successful.
|
@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
|
An `MLNMapSnapshotter` generates static raster images of the map. Each snapshot
|
||||||
@@ -182,40 +184,41 @@ typedef void (^MLNMapSnapshotCompletionHandler)(MLNMapSnapshot* _Nullable snapsh
|
|||||||
asynchronously, calling `MLNMapSnapshotterDelegate` methods if defined, then
|
asynchronously, calling `MLNMapSnapshotterDelegate` methods if defined, then
|
||||||
passing it into a completion handler once tiles and other resources needed for
|
passing it into a completion handler once tiles and other resources needed for
|
||||||
the snapshot are finished loading.
|
the snapshot are finished loading.
|
||||||
|
|
||||||
You can change the snapshotter’s options at any time and reuse the snapshotter
|
You can change the snapshotter’s options at any time and reuse the snapshotter
|
||||||
for multiple distinct snapshots; however, the snapshotter can only generate one
|
for multiple distinct snapshots; however, the snapshotter can only generate one
|
||||||
snapshot at a time. If you need to generate multiple snapshots concurrently,
|
snapshot at a time. If you need to generate multiple snapshots concurrently,
|
||||||
create multiple snapshotter objects.
|
create multiple snapshotter objects.
|
||||||
|
|
||||||
For an interactive map, use the `MLNMapView` class. Both `MLNMapSnapshotter`
|
For an interactive map, use the `MLNMapView` class. Both `MLNMapSnapshotter`
|
||||||
and `MLNMapView` are compatible with offline packs managed by the
|
and `MLNMapView` are compatible with offline packs managed by the
|
||||||
`MLNOfflineStorage` class.
|
`MLNOfflineStorage` class.
|
||||||
|
|
||||||
From a snapshot, you can obtain an image and convert geographic coordinates to
|
From a snapshot, you can obtain an image and convert geographic coordinates to
|
||||||
the image’s coordinate space in order to superimpose markers and overlays. If
|
the image’s coordinate space in order to superimpose markers and overlays. If
|
||||||
you do not need offline map functionality, you can use the `Snapshot` class in
|
you do not need offline map functionality, you can use the `Snapshot` class in
|
||||||
[MapboxStatic.swift](https://github.com/mapbox/MapboxStatic.swift/) to generate
|
[MapboxStatic.swift](https://github.com/mapbox/MapboxStatic.swift/) to generate
|
||||||
static map images with overlays.
|
static map images with overlays.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
```swift
|
```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)
|
let snapshotter = MLNMapSnapshotter(options: options)
|
||||||
snapshotter.start { (snapshot, error) in
|
snapshotter.start { (snapshot, error) in
|
||||||
if let error = error {
|
if let error = error {
|
||||||
fatalError(error.localizedDescription)
|
fatalError(error.localizedDescription)
|
||||||
}
|
}
|
||||||
|
|
||||||
image = snapshot?.image
|
image = snapshot?.image
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Create a static map snapshot, learn how to use the
|
TODO: Create a static map snapshot, learn how to use the
|
||||||
`MLNMapSnapshotter` to generate a static image based on an `MLNMapView`
|
`MLNMapSnapshotter` to generate a static image based on an `MLNMapView`
|
||||||
@@ -229,7 +232,7 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
Initializes and returns a map snapshotter object that produces snapshots
|
Initializes and returns a map snapshotter object that produces snapshots
|
||||||
according to the given options.
|
according to the given options.
|
||||||
|
|
||||||
@param options The options to use when generating a map snapshot.
|
@param options The options to use when generating a map snapshot.
|
||||||
@return An initialized map snapshotter.
|
@return An initialized map snapshotter.
|
||||||
*/
|
*/
|
||||||
@@ -237,7 +240,7 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Starts the snapshot creation and executes the specified block with the result.
|
Starts the snapshot creation and executes the specified block with the result.
|
||||||
|
|
||||||
@param completionHandler The block to call with a finished snapshot. The block
|
@param completionHandler The block to call with a finished snapshot. The block
|
||||||
is executed on the main queue.
|
is executed on the main queue.
|
||||||
*/
|
*/
|
||||||
@@ -246,19 +249,20 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
Starts the snapshot creation and executes the specified block with the result
|
Starts the snapshot creation and executes the specified block with the result
|
||||||
on the specified queue.
|
on the specified queue.
|
||||||
|
|
||||||
@param queue The queue on which to call the block specified in the
|
@param queue The queue on which to call the block specified in the
|
||||||
`completionHandler` parameter.
|
`completionHandler` parameter.
|
||||||
@param completionHandler The block to call with a finished snapshot. The block
|
@param completionHandler The block to call with a finished snapshot. The block
|
||||||
is executed on the queue specified in the `queue` parameter.
|
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
|
Starts the snapshot creation and executes the specified blocks with the result
|
||||||
on the specified queue. Use this option if you want to add custom drawing on
|
on the specified queue. Use this option if you want to add custom drawing on
|
||||||
top of the resulting `MLNMapSnapshot`.
|
top of the resulting `MLNMapSnapshot`.
|
||||||
|
|
||||||
@param overlayHandler The block to call after the base map finishes drawing but
|
@param overlayHandler The block to call after the base map finishes drawing but
|
||||||
before certain built-in overlays draw. The block can use Core Graphics to
|
before certain built-in overlays draw. The block can use Core Graphics to
|
||||||
draw custom content directly over the base map. The block is executed on a
|
draw custom content directly over the base map. The block is executed on a
|
||||||
@@ -266,11 +270,12 @@ MLN_EXPORT
|
|||||||
@param completionHandler The block to call with a finished snapshot. The block
|
@param completionHandler The block to call with a finished snapshot. The block
|
||||||
is executed on the main queue.
|
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.
|
Cancels the snapshot creation request, if any.
|
||||||
|
|
||||||
Once you call this method, you cannot resume the snapshot. In order to obtain
|
Once you call this method, you cannot resume the snapshot. In order to obtain
|
||||||
the snapshot, create a new `MLNMapSnapshotter` object.
|
the snapshot, create a new `MLNMapSnapshotter` object.
|
||||||
*/
|
*/
|
||||||
@@ -288,24 +293,24 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The snapshotter’s delegate.
|
The snapshotter’s delegate.
|
||||||
|
|
||||||
The delegate is responsible for responding to significant changes during the
|
The delegate is responsible for responding to significant changes during the
|
||||||
snapshotting process, such as the style loading. Implement a delegate to
|
snapshotting process, such as the style loading. Implement a delegate to
|
||||||
customize the style that is depicted by the snapshot.
|
customize the style that is depicted by the snapshot.
|
||||||
|
|
||||||
You set the delegate after initializing the snapshotter but before receiving
|
You set the delegate after initializing the snapshotter but before receiving
|
||||||
the snapshot, typically before starting the snapshot. The snapshotter keeps a
|
the snapshot, typically before starting the snapshot. The snapshotter keeps a
|
||||||
weak reference to its delegate, so you must keep a strong reference to it to
|
weak reference to its delegate, so you must keep a strong reference to it to
|
||||||
ensure that your style customizations apply.
|
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.
|
The style displayed in the resulting snapshot.
|
||||||
|
|
||||||
Unlike the `MLNMapSnapshotOptions.styleURL` property, this property is set to
|
Unlike the `MLNMapSnapshotOptions.styleURL` property, this property is set to
|
||||||
an object that allows you to manipulate every aspect of the style locally.
|
an object that allows you to manipulate every aspect of the style locally.
|
||||||
|
|
||||||
This property is set to `nil` until the style finishes loading. If the style
|
This property is set to `nil` until the style finishes loading. If the style
|
||||||
has failed to load, this property is set to `nil`. Because the style loads
|
has failed to load, this property is set to `nil`. Because the style loads
|
||||||
asynchronously, you should manipulate it in the
|
asynchronously, you should manipulate it in the
|
||||||
@@ -333,11 +338,11 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
Tells the delegate that the snapshotter was unable to load data needed for
|
Tells the delegate that the snapshotter was unable to load data needed for
|
||||||
snapshotting the map.
|
snapshotting the map.
|
||||||
|
|
||||||
This method may be called for a variety of reasons, including a network
|
This method may be called for a variety of reasons, including a network
|
||||||
connection failure or a failure to fetch the style from the server. You can use
|
connection failure or a failure to fetch the style from the server. You can use
|
||||||
the given error message to notify the user that map data is unavailable.
|
the given error message to notify the user that map data is unavailable.
|
||||||
|
|
||||||
@param snapshotter The snapshotter that is unable to load the data.
|
@param snapshotter The snapshotter that is unable to load the data.
|
||||||
@param error The reason the data could not be loaded.
|
@param error The reason the data could not be loaded.
|
||||||
*/
|
*/
|
||||||
@@ -345,12 +350,12 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Tells the delegate that the snapshotter has just finished loading a style.
|
Tells the delegate that the snapshotter has just finished loading a style.
|
||||||
|
|
||||||
This method is called in response to
|
This method is called in response to
|
||||||
`-[MLNMapSnapshotter startWithQueue:completionHandler:]` as long as the
|
`-[MLNMapSnapshotter startWithQueue:completionHandler:]` as long as the
|
||||||
`MLNMapSnapshotter.delegate` property is set. Changes to sources or layers of
|
`MLNMapSnapshotter.delegate` property is set. Changes to sources or layers of
|
||||||
the style being snapshotted do not cause this method to be called.
|
the style being snapshotted do not cause this method to be called.
|
||||||
|
|
||||||
@param snapshotter The snapshotter that has just loaded a style.
|
@param snapshotter The snapshotter that has just loaded a style.
|
||||||
@param style The style that was loaded.
|
@param style The style that was loaded.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNShape.h"
|
#import "MLNShape.h"
|
||||||
@@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
The `MLNMultiPoint` class is an abstract superclass used to define shapes
|
The `MLNMultiPoint` class is an abstract superclass used to define shapes
|
||||||
composed of multiple vertices.
|
composed of multiple vertices.
|
||||||
|
|
||||||
Create instances of `MLNPolyline` or `MLNPolygon` in order to use
|
Create instances of `MLNPolyline` or `MLNPolygon` in order to use
|
||||||
properties of `MLNMultiPoint`. Do not create instances of `MLNMultiPoint`
|
properties of `MLNMultiPoint`. Do not create instances of `MLNMultiPoint`
|
||||||
directly and do not create your own subclasses of this class. You can use
|
directly and do not create your own subclasses of this class. You can use
|
||||||
the method and properties of this class to access information about the
|
the method and properties of this class to access information about the
|
||||||
@@ -60,7 +60,7 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Inserts the given vertices into the shape.
|
Inserts the given vertices into the shape.
|
||||||
|
|
||||||
If the shape is currently visible on the map as an annotation, it is redrawn
|
If the shape is currently visible on the map as an annotation, it is redrawn
|
||||||
immediately. If the shape is part of an `MLNShapeSource` object, you must
|
immediately. If the shape is part of an `MLNShapeSource` object, you must
|
||||||
explicitly set the `MLNShapeSource.shape` property in order for any style
|
explicitly set the `MLNShapeSource.shape` property in order for any style
|
||||||
@@ -72,11 +72,13 @@ MLN_EXPORT
|
|||||||
@param index The zero-based index at which the first coordinate in `coords`
|
@param index The zero-based index at which the first coordinate in `coords`
|
||||||
will appear in the `coordinates` property.
|
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.
|
Appends the given vertices to the shape.
|
||||||
|
|
||||||
If the shape is currently visible on the map as an annotation, it is redrawn
|
If the shape is currently visible on the map as an annotation, it is redrawn
|
||||||
immediately. If the shape is part of an `MLNShapeSource` object, you must
|
immediately. If the shape is part of an `MLNShapeSource` object, you must
|
||||||
explicitly set the `MLNShapeSource.shape` property in order for any style
|
explicitly set the `MLNShapeSource.shape` property in order for any style
|
||||||
@@ -91,7 +93,7 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
Replaces the vertices at the given range in the shape with the same number of
|
Replaces the vertices at the given range in the shape with the same number of
|
||||||
vertices from a given C array.
|
vertices from a given C array.
|
||||||
|
|
||||||
If the shape is currently visible on the map as an annotation, it is redrawn
|
If the shape is currently visible on the map as an annotation, it is redrawn
|
||||||
immediately. If the shape is part of an `MLNShapeSource` object, you must
|
immediately. If the shape is part of an `MLNShapeSource` object, you must
|
||||||
explicitly set the `MLNShapeSource.shape` property in order for any style
|
explicitly set the `MLNShapeSource.shape` property in order for any style
|
||||||
@@ -112,12 +114,13 @@ MLN_EXPORT
|
|||||||
@param coords The array of coordinates defining part of the shape. The data in
|
@param coords The array of coordinates defining part of the shape. The data in
|
||||||
this array is copied to the shape’s `coordinates` property.
|
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
|
Replaces the vertices at the given range in the shape with the specified number
|
||||||
of vertices from a given C array.
|
of vertices from a given C array.
|
||||||
|
|
||||||
If the shape is currently visible on the map as an annotation, it is redrawn
|
If the shape is currently visible on the map as an annotation, it is redrawn
|
||||||
immediately. If the shape is part of an `MLNShapeSource` object, you must
|
immediately. If the shape is part of an `MLNShapeSource` object, you must
|
||||||
explicitly set the `MLNShapeSource.shape` property in order for any style
|
explicitly set the `MLNShapeSource.shape` property in order for any style
|
||||||
@@ -142,11 +145,13 @@ MLN_EXPORT
|
|||||||
count must not exceed the number of items currently in the `coordinates`
|
count must not exceed the number of items currently in the `coordinates`
|
||||||
property.
|
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.
|
Removes the vertices at the given range from the shape.
|
||||||
|
|
||||||
If the shape is currently visible on the map as an annotation, it is redrawn
|
If the shape is currently visible on the map as an annotation, it is redrawn
|
||||||
immediately. If the shape is part of an `MLNShapeSource` object, you must
|
immediately. If the shape is part of an `MLNShapeSource` object, you must
|
||||||
explicitly set the `MLNShapeSource.shape` property in order for any style
|
explicitly set the `MLNShapeSource.shape` property in order for any style
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (BOOL)intersectsOverlayBounds:(MLNCoordinateBounds)overlayBounds;
|
- (BOOL)intersectsOverlayBounds:(MLNCoordinateBounds)overlayBounds;
|
||||||
|
|
||||||
/** Constructs a shape annotation object, asking the delegate for style values. */
|
/** Constructs a shape annotation object, asking the delegate for style values. */
|
||||||
- (mbgl::Annotation)annotationObjectWithDelegate:(id <MLNMultiPointDelegate>)delegate;
|
- (mbgl::Annotation)annotationObjectWithDelegate:(id<MLNMultiPointDelegate>)delegate;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (NSURLSession *)sessionForNetworkConfiguration:(MLNNetworkConfiguration *)configuration;
|
- (NSURLSession *)sessionForNetworkConfiguration:(MLNNetworkConfiguration *)configuration;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The `MLNNetworkConfiguration` object provides a global way to set a base
|
The `MLNNetworkConfiguration` object provides a global way to set a base
|
||||||
`NSURLSessionConfiguration`, and other resources.
|
`NSURLSessionConfiguration`, and other resources.
|
||||||
@@ -48,13 +47,13 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
The session configuration object that is used by the `NSURLSession` objects
|
The session configuration object that is used by the `NSURLSession` objects
|
||||||
in this SDK.
|
in this SDK.
|
||||||
|
|
||||||
If this property is set to nil or if no session configuration is provided this property
|
If this property is set to nil or if no session configuration is provided this property
|
||||||
is set to the default session configuration.
|
is set to the default session configuration.
|
||||||
|
|
||||||
Assign this object before instantiating any `MLNMapView` object, or using
|
Assign this object before instantiating any `MLNMapView` object, or using
|
||||||
`MLNOfflineStorage`
|
`MLNOfflineStorage`
|
||||||
|
|
||||||
@note `NSURLSession` objects store a copy of this configuration. Any further changes
|
@note `NSURLSession` objects store a copy of this configuration. Any further changes
|
||||||
to mutable properties on this configuration object passed to a session’s initializer
|
to mutable properties on this configuration object passed to a session’s initializer
|
||||||
will not affect the behavior of that session.
|
will not affect the behavior of that session.
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
#import "MLNNetworkConfiguration.h"
|
|
||||||
#include <mbgl/interface/native_apple_interface.h>
|
#include <mbgl/interface/native_apple_interface.h>
|
||||||
|
#import "MLNNetworkConfiguration.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@class MLNNetworkConfiguration;
|
@class MLNNetworkConfiguration;
|
||||||
@protocol MLNNetworkConfigurationMetricsDelegate <NSObject>
|
@protocol MLNNetworkConfigurationMetricsDelegate <NSObject>
|
||||||
|
|
||||||
- (void)networkConfiguration:(MLNNetworkConfiguration *)networkConfiguration didGenerateMetricEvent:(NSDictionary *)metricEvent;
|
- (void)networkConfiguration:(MLNNetworkConfiguration *)networkConfiguration
|
||||||
|
didGenerateMetricEvent:(NSDictionary *)metricEvent;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
extern NSString * const kMLNDownloadPerformanceEvent;
|
extern NSString *const kMLNDownloadPerformanceEvent;
|
||||||
|
|
||||||
@interface MLNNetworkConfiguration (Private)
|
@interface MLNNetworkConfiguration (Private)
|
||||||
|
|
||||||
@property (nonatomic, strong) NSMutableDictionary<NSString*, NSDictionary*> *events;
|
@property (nonatomic, strong) NSMutableDictionary<NSString *, NSDictionary *> *events;
|
||||||
@property (nonatomic, weak) id<MLNNetworkConfigurationMetricsDelegate> metricsDelegate;
|
@property (nonatomic, weak) id<MLNNetworkConfigurationMetricsDelegate> metricsDelegate;
|
||||||
|
|
||||||
- (void)resetNativeNetworkManagerDelegate;
|
- (void)resetNativeNetworkManagerDelegate;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNTypes.h"
|
|
||||||
#import "MLNOfflineRegion.h"
|
#import "MLNOfflineRegion.h"
|
||||||
|
#import "MLNTypes.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -11,46 +11,46 @@ FOUNDATION_EXTERN MLN_EXPORT MLNExceptionName const MLNInvalidOfflinePackExcepti
|
|||||||
/**
|
/**
|
||||||
The state an offline pack is currently in.
|
The state an offline pack is currently in.
|
||||||
*/
|
*/
|
||||||
typedef NS_ENUM (NSInteger, MLNOfflinePackState) {
|
typedef NS_ENUM(NSInteger, MLNOfflinePackState) {
|
||||||
/**
|
/**
|
||||||
It is unknown whether the pack is inactive, active, or complete.
|
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
|
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
|
the time the shared `MLNOfflineStorage` object sends the first
|
||||||
`MLNOfflinePackProgressChangedNotification` about the pack. For inactive
|
`MLNOfflinePackProgressChangedNotification` about the pack. For inactive
|
||||||
packs, you must explicitly request a progress update using the
|
packs, you must explicitly request a progress update using the
|
||||||
`-[MLNOfflinePack requestProgress]` method.
|
`-[MLNOfflinePack requestProgress]` method.
|
||||||
|
|
||||||
An invalid pack always has a state of `MLNOfflinePackStateInvalid`, never
|
An invalid pack always has a state of `MLNOfflinePackStateInvalid`, never
|
||||||
`MLNOfflinePackStateUnknown`.
|
`MLNOfflinePackStateUnknown`.
|
||||||
*/
|
*/
|
||||||
MLNOfflinePackStateUnknown = 0,
|
MLNOfflinePackStateUnknown = 0,
|
||||||
/**
|
/**
|
||||||
The pack is incomplete and is not currently downloading.
|
The pack is incomplete and is not currently downloading.
|
||||||
|
|
||||||
This is the initial state of a pack that is created using the
|
This is the initial state of a pack that is created using the
|
||||||
`-[MLNOfflineStorage addPackForRegion:withContext:completionHandler:]`
|
`-[MLNOfflineStorage addPackForRegion:withContext:completionHandler:]`
|
||||||
method, as well as after the `-[MLNOfflinePack suspend]` method is
|
method, as well as after the `-[MLNOfflinePack suspend]` method is
|
||||||
called.
|
called.
|
||||||
*/
|
*/
|
||||||
MLNOfflinePackStateInactive = 1,
|
MLNOfflinePackStateInactive = 1,
|
||||||
/**
|
/**
|
||||||
The pack is incomplete and is currently downloading.
|
The pack is incomplete and is currently downloading.
|
||||||
|
|
||||||
This is the state of a pack after the `-[MLNOfflinePack resume]` method is
|
This is the state of a pack after the `-[MLNOfflinePack resume]` method is
|
||||||
called.
|
called.
|
||||||
*/
|
*/
|
||||||
MLNOfflinePackStateActive = 2,
|
MLNOfflinePackStateActive = 2,
|
||||||
/**
|
/**
|
||||||
The pack has downloaded to completion.
|
The pack has downloaded to completion.
|
||||||
*/
|
*/
|
||||||
MLNOfflinePackStateComplete = 3,
|
MLNOfflinePackStateComplete = 3,
|
||||||
/**
|
/**
|
||||||
The pack has been removed using the
|
The pack has been removed using the
|
||||||
`-[MLNOfflineStorage removePack:withCompletionHandler:]` method. Sending
|
`-[MLNOfflineStorage removePack:withCompletionHandler:]` method. Sending
|
||||||
any message to the pack will raise an exception.
|
any message to the pack will raise an exception.
|
||||||
*/
|
*/
|
||||||
MLNOfflinePackStateInvalid = 4,
|
MLNOfflinePackStateInvalid = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,42 +58,42 @@ typedef NS_ENUM (NSInteger, MLNOfflinePackState) {
|
|||||||
progress.
|
progress.
|
||||||
*/
|
*/
|
||||||
typedef struct __attribute__((objc_boxable)) MLNOfflinePackProgress {
|
typedef struct __attribute__((objc_boxable)) MLNOfflinePackProgress {
|
||||||
/**
|
/**
|
||||||
The number of resources, including tiles, that have been completely
|
The number of resources, including tiles, that have been completely
|
||||||
downloaded and are ready to use offline.
|
downloaded and are ready to use offline.
|
||||||
*/
|
*/
|
||||||
uint64_t countOfResourcesCompleted;
|
uint64_t countOfResourcesCompleted;
|
||||||
/**
|
/**
|
||||||
The cumulative size of the downloaded resources on disk, including tiles,
|
The cumulative size of the downloaded resources on disk, including tiles,
|
||||||
measured in bytes.
|
measured in bytes.
|
||||||
*/
|
*/
|
||||||
uint64_t countOfBytesCompleted;
|
uint64_t countOfBytesCompleted;
|
||||||
/**
|
/**
|
||||||
The number of tiles that have been completely downloaded and are ready
|
The number of tiles that have been completely downloaded and are ready
|
||||||
to use offline.
|
to use offline.
|
||||||
*/
|
*/
|
||||||
uint64_t countOfTilesCompleted;
|
uint64_t countOfTilesCompleted;
|
||||||
/**
|
/**
|
||||||
The cumulative size of the downloaded tiles on disk, measured in bytes.
|
The cumulative size of the downloaded tiles on disk, measured in bytes.
|
||||||
*/
|
*/
|
||||||
uint64_t countOfTileBytesCompleted;
|
uint64_t countOfTileBytesCompleted;
|
||||||
/**
|
/**
|
||||||
The minimum number of resources that must be downloaded in order to view
|
The minimum number of resources that must be downloaded in order to view
|
||||||
the pack’s full region without any omissions.
|
the pack’s full region without any omissions.
|
||||||
|
|
||||||
At the beginning of a download, this count is a lower bound; the number of
|
At the beginning of a download, this count is a lower bound; the number of
|
||||||
expected resources may increase as the download progresses.
|
expected resources may increase as the download progresses.
|
||||||
*/
|
*/
|
||||||
uint64_t countOfResourcesExpected;
|
uint64_t countOfResourcesExpected;
|
||||||
/**
|
/**
|
||||||
The maximum number of resources that must be downloaded in order to view
|
The maximum number of resources that must be downloaded in order to view
|
||||||
the pack’s full region without any omissions.
|
the pack’s full region without any omissions.
|
||||||
|
|
||||||
At the beginning of a download, when the exact number of required resources
|
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
|
is unknown, this field is set to `UINT64_MAX`. Thus this count is always an
|
||||||
upper bound.
|
upper bound.
|
||||||
*/
|
*/
|
||||||
uint64_t maximumResourcesExpected;
|
uint64_t maximumResourcesExpected;
|
||||||
} MLNOfflinePackProgress;
|
} MLNOfflinePackProgress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,16 +103,16 @@ typedef struct __attribute__((objc_boxable)) MLNOfflinePackProgress {
|
|||||||
To create an instance of `MLNOfflinePack`, use the
|
To create an instance of `MLNOfflinePack`, use the
|
||||||
`+[MLNOfflineStorage addPackForRegion:withContext:completionHandler:]` method.
|
`+[MLNOfflineStorage addPackForRegion:withContext:completionHandler:]` method.
|
||||||
A pack created using `-[MLNOfflinePack init]` is immediately invalid.
|
A pack created using `-[MLNOfflinePack init]` is immediately invalid.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```swift
|
```swift
|
||||||
MLNOfflineStorage.shared.addPack(for: region, withContext: context) { (pack, error) in
|
MLNOfflineStorage.shared.addPack(for: region, withContext: context) { (pack, error) in
|
||||||
guard let pack = pack else {
|
guard let pack = pack else {
|
||||||
// If adding the pack fails, log an error to console.
|
// If adding the pack fails, log an error to console.
|
||||||
print("Error:", error?.localizedDescription ?? "unknown error adding pack at \(#file)(\(#line)) in \(#function)")
|
print("Error:", error?.localizedDescription ?? "unknown error adding pack at
|
||||||
return
|
\(#file)(\(#line)) in \(#function)") return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start an MLNOfflinePack download
|
// Start an MLNOfflinePack download
|
||||||
pack.resume()
|
pack.resume()
|
||||||
}
|
}
|
||||||
@@ -124,14 +124,14 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
The region for which the pack manages resources.
|
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.
|
Arbitrary data stored alongside the downloaded resources.
|
||||||
|
|
||||||
The context typically holds application-specific information for identifying
|
The context typically holds application-specific information for identifying
|
||||||
the pack, such as a user-selected name.
|
the pack, such as a user-selected name.
|
||||||
|
|
||||||
To change the value of this property, use the `-setContext:completionHandler:`
|
To change the value of this property, use the `-setContext:completionHandler:`
|
||||||
method. If you access this property after calling that method but before its
|
method. If you access this property after calling that method but before its
|
||||||
completion handler is called, this property’s value may not reflect the new
|
completion handler is called, this property’s value may not reflect the new
|
||||||
@@ -142,16 +142,17 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
Associates arbitrary contextual data with the offline pack, replacing any
|
Associates arbitrary contextual data with the offline pack, replacing any
|
||||||
context that was previously associated with the offline pack.
|
context that was previously associated with the offline pack.
|
||||||
|
|
||||||
Setting the context is asynchronous. The `context` property may not be updated
|
Setting the context is asynchronous. The `context` property may not be updated
|
||||||
until the completion handler is called.
|
until the completion handler is called.
|
||||||
|
|
||||||
@param context The new context to associate with the offline pack.
|
@param context The new context to associate with the offline pack.
|
||||||
@param completion The completion handler to call when the context has been
|
@param completion The completion handler to call when the context has been
|
||||||
updated. If there is an error setting the context, the error is passed into
|
updated. If there is an error setting the context, the error is passed into
|
||||||
the completion handler.
|
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.
|
The pack’s current state.
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
URL of the style whose resources are required for offline viewing.
|
URL of the style whose resources are required for offline viewing.
|
||||||
|
|
||||||
In addition to the JSON stylesheet, different styles may require different font
|
In addition to the JSON stylesheet, different styles may require different font
|
||||||
glyphs, sprite sheets, and other resources.
|
glyphs, sprite sheets, and other resources.
|
||||||
|
|
||||||
The URL may be a full HTTP or HTTPS URL or a canonical URL
|
The URL may be a full HTTP or HTTPS URL or a canonical URL
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly) NSURL *styleURL;
|
@property (nonatomic, readonly) NSURL *styleURL;
|
||||||
@@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
instead of relying on fonts downloaded as part of the offline pack.
|
instead of relying on fonts downloaded as part of the offline pack.
|
||||||
See `MLNIdeographicFontFamilyName` setting. Also, for regions outside of
|
See `MLNIdeographicFontFamilyName` setting. Also, for regions outside of
|
||||||
China, Japan, and Korea, these glyphs will rarely appear for non-CJK users.
|
China, Japan, and Korea, these glyphs will rarely appear for non-CJK users.
|
||||||
|
|
||||||
By default, this property is set to `NO`, so that the offline pack will
|
By default, this property is set to `NO`, so that the offline pack will
|
||||||
include ideographic glyphs.
|
include ideographic glyphs.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
If you only need to observe changes in a particular pack’s progress, you can
|
If you only need to observe changes in a particular pack’s progress, you can
|
||||||
alternatively observe KVO change notifications to the pack’s `progress` key
|
alternatively observe KVO change notifications to the pack’s `progress` key
|
||||||
path.
|
path.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Download an offline map, learn how to calculate the progress
|
TODO: Download an offline map, learn how to calculate the progress
|
||||||
of an offline download.
|
of an offline download.
|
||||||
@@ -58,7 +58,8 @@ FOUNDATION_EXTERN MLN_EXPORT const NSNotificationName MLNOfflinePackErrorNotific
|
|||||||
additional tiles from Mapbox APIs until already downloaded tiles are removed by
|
additional tiles from Mapbox APIs until already downloaded tiles are removed by
|
||||||
calling the `-[MLNOfflineStorage removePack:withCompletionHandler:]` method.
|
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`.
|
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
|
@param error Contains a pointer to an error object (if any) indicating why the
|
||||||
pack could not be created or added.
|
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
|
A block to be called once an offline pack has been completely invalidated and
|
||||||
@@ -127,11 +129,11 @@ typedef void (^MLNOfflinePackAdditionCompletionHandler)(MLNOfflinePack * _Nullab
|
|||||||
@param error Contains a pointer to an error object (if any) indicating why the
|
@param error Contains a pointer to an error object (if any) indicating why the
|
||||||
pack could not be invalidated or removed.
|
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.
|
A block to be called once the contents of a file are copied into the current packs.
|
||||||
|
|
||||||
@param fileURL The file URL of the offline database containing the offline packs
|
@param fileURL The file URL of the offline database containing the offline packs
|
||||||
that were copied.
|
that were copied.
|
||||||
@param packs An array of all known offline packs, or `nil` if there was an error
|
@param packs An array of all known offline packs, or `nil` if there was an error
|
||||||
@@ -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
|
@param error A pointer to an error object (if any) indicating why the pack could
|
||||||
not be created or added.
|
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.
|
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
|
@param error Contains a pointer to an error object (if any) indicating why the
|
||||||
data could not be pre-loaded.
|
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.
|
The type of resource that is requested.
|
||||||
*/
|
*/
|
||||||
typedef NS_ENUM(NSUInteger, MLNResourceKind) {
|
typedef NS_ENUM(NSUInteger, MLNResourceKind) {
|
||||||
/** Unknown type */
|
/** Unknown type */
|
||||||
MLNResourceKindUnknown,
|
MLNResourceKindUnknown,
|
||||||
/** Style sheet JSON file */
|
/** Style sheet JSON file */
|
||||||
MLNResourceKindStyle,
|
MLNResourceKindStyle,
|
||||||
/** TileJSON file as specified in https://maplibre.org/maplibre-style-spec/root/#sources */
|
/** TileJSON file as specified in https://maplibre.org/maplibre-style-spec/root/#sources */
|
||||||
MLNResourceKindSource,
|
MLNResourceKindSource,
|
||||||
/** A vector or raster tile as described in the style sheet at
|
/** A vector or raster tile as described in the style sheet at
|
||||||
https://maplibre.org/maplibre-style-spec/sources/ */
|
https://maplibre.org/maplibre-style-spec/sources/ */
|
||||||
MLNResourceKindTile,
|
MLNResourceKindTile,
|
||||||
/** Signed distance field glyphs for text rendering. These are the URLs specified in the style
|
/** Signed distance field glyphs for text rendering. These are the URLs specified in the style
|
||||||
in https://maplibre.org/maplibre-style-spec/root/#glyphs */
|
in https://maplibre.org/maplibre-style-spec/root/#glyphs */
|
||||||
MLNResourceKindGlyphs,
|
MLNResourceKindGlyphs,
|
||||||
/** Image part of a sprite sheet. It is constructed of the prefix in
|
/** 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. */
|
https://maplibre.org/maplibre-style-spec/root/#sprite and a PNG file extension. */
|
||||||
MLNResourceKindSpriteImage,
|
MLNResourceKindSpriteImage,
|
||||||
/** JSON part of a sprite sheet. It is constructed of the prefix in
|
/** 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. */
|
https://maplibre.org/maplibre-style-spec/root/#sprite and a JSON file extension. */
|
||||||
MLNResourceKindSpriteJSON,
|
MLNResourceKindSpriteJSON,
|
||||||
/** Image data for a georeferenced image source. **/
|
/** Image data for a georeferenced image source. **/
|
||||||
MLNResourceKindImage,
|
MLNResourceKindImage,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +189,7 @@ typedef NS_ENUM(NSUInteger, MLNResourceKind) {
|
|||||||
Raster Tile API pricing and are not included in the Maps SDK’s “unlimited” requests.
|
Raster Tile API pricing and are not included in the Maps SDK’s “unlimited” requests.
|
||||||
See <a href="https://www.mapbox.com/pricing/">our pricing page</a> for more
|
See <a href="https://www.mapbox.com/pricing/">our pricing page</a> for more
|
||||||
information.
|
information.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Download an offline map, learn how to create and register an
|
TODO: Download an offline map, learn how to create and register an
|
||||||
offline pack for a defined region.
|
offline pack for a defined region.
|
||||||
@@ -209,13 +212,13 @@ MLN_EXPORT
|
|||||||
add or remove custom parameters, or reroute certain requests to other servers
|
add or remove custom parameters, or reroute certain requests to other servers
|
||||||
or endpoints.
|
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
|
// MARK: - Managing the Database of Offline Packs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The file path at which offline packs and the ambient cache are stored.
|
The file path at which offline packs and the ambient cache are stored.
|
||||||
|
|
||||||
To customize this path, specify the
|
To customize this path, specify the
|
||||||
[`MLNOfflineStorageDatabasePath`](../infoplist-keys.html#mglofflinestoragedatabasepath)
|
[`MLNOfflineStorageDatabasePath`](../infoplist-keys.html#mglofflinestoragedatabasepath)
|
||||||
key in Info.plist.
|
key in Info.plist.
|
||||||
@@ -224,7 +227,7 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The file URL at which offline packs and the ambient cache are stored.
|
The file URL at which offline packs and the ambient cache are stored.
|
||||||
|
|
||||||
To customize this path, specify the
|
To customize this path, specify the
|
||||||
[`MLNOfflineStorageDatabasePath`](../infoplist-keys.html#mglofflinestoragedatabasepath)
|
[`MLNOfflineStorageDatabasePath`](../infoplist-keys.html#mglofflinestoragedatabasepath)
|
||||||
key in Info.plist.
|
key in Info.plist.
|
||||||
@@ -233,37 +236,39 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Adds the offline packs located at the given file path to offline storage.
|
Adds the offline packs located at the given file path to offline storage.
|
||||||
|
|
||||||
The file must be a valid offline pack database bundled with the application or
|
The file must be a valid offline pack database bundled with the application or
|
||||||
downloaded separately.
|
downloaded separately.
|
||||||
|
|
||||||
The resulting packs are added or updated to the shared offline storage object’s
|
The resulting packs are added or updated to the shared offline storage object’s
|
||||||
`packs` property, then the `completion` block is executed.
|
`packs` property, then the `completion` block is executed.
|
||||||
|
|
||||||
@param filePath A string representation of the file path. The file path must be
|
@param filePath A string representation of the file path. The file path must be
|
||||||
writable as schema updates may be perfomed.
|
writable as schema updates may be perfomed.
|
||||||
@param completion The completion handler to call once the contents of the given
|
@param completion The completion handler to call once the contents of the given
|
||||||
file has been added to offline storage. This handler is executed
|
file has been added to offline storage. This handler is executed
|
||||||
asynchronously on the main queue.
|
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.
|
Adds the offline packs located at the given URL to offline storage.
|
||||||
|
|
||||||
The file must be a valid offline pack database bundled with the application or
|
The file must be a valid offline pack database bundled with the application or
|
||||||
downloaded separately.
|
downloaded separately.
|
||||||
|
|
||||||
The resulting packs are added or updated to the shared offline storage object’s
|
The resulting packs are added or updated to the shared offline storage object’s
|
||||||
`packs` property, then the `completion` block is executed.
|
`packs` property, then the `completion` block is executed.
|
||||||
|
|
||||||
@param fileURL A file URL specifying the file to add. The URL should be a valid
|
@param fileURL A file URL specifying the file to add. The URL should be a valid
|
||||||
system path. The URL must be writable as schema updates may be performed.
|
system path. The URL must be writable as schema updates may be performed.
|
||||||
@param completion The completion handler to call once the contents of the given
|
@param completion The completion handler to call once the contents of the given
|
||||||
file has been added to offline storage. This handler is executed
|
file has been added to offline storage. This handler is executed
|
||||||
asynchronously on the main queue.
|
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
|
// MARK: - Managing Offline Packs
|
||||||
|
|
||||||
@@ -303,7 +308,9 @@ MLN_EXPORT
|
|||||||
@param completion The completion handler to call once the pack has been added.
|
@param completion The completion handler to call once the pack has been added.
|
||||||
This handler is executed asynchronously on the main queue.
|
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
|
Unregisters the given offline pack and allows resources that are no longer
|
||||||
@@ -330,23 +337,25 @@ MLN_EXPORT
|
|||||||
@param completion The completion handler to call once the pack has been
|
@param completion The completion handler to call once the pack has been
|
||||||
removed. This handler is executed asynchronously on the main queue.
|
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
|
Invalidates the specified offline pack. This method checks that the tiles
|
||||||
in the specified offline pack match those from the server. Local tiles that
|
in the specified offline pack match those from the server. Local tiles that
|
||||||
do not match the latest version on the server are updated.
|
do not match the latest version on the server are updated.
|
||||||
|
|
||||||
This is more efficient than deleting the offline pack and downloading it
|
This is more efficient than deleting the offline pack and downloading it
|
||||||
again. If the data stored locally matches that on the server, new data will
|
again. If the data stored locally matches that on the server, new data will
|
||||||
not be downloaded.
|
not be downloaded.
|
||||||
|
|
||||||
@param pack The offline pack to be invalidated.
|
@param pack The offline pack to be invalidated.
|
||||||
@param completion The completion handler to call once the pack has been
|
@param completion The completion handler to call once the pack has been
|
||||||
removed. This handler is executed asynchronously on the main queue.
|
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
|
Forcibly, asynchronously reloads the `packs` property. At some point after this
|
||||||
method is called, the pointer values of the `MLNOfflinePack` objects in the
|
method is called, the pointer values of the `MLNOfflinePack` objects in the
|
||||||
@@ -390,34 +399,35 @@ MLN_EXPORT
|
|||||||
size is 50 MB. To disable ambient caching, set the maximum ambient cache size
|
size is 50 MB. To disable ambient caching, set the maximum ambient cache size
|
||||||
to `0`. Setting the maximum ambient cache size does not impact the maximum size
|
to `0`. Setting the maximum ambient cache size does not impact the maximum size
|
||||||
of offline packs.
|
of offline packs.
|
||||||
|
|
||||||
This method does not limit the space available to offline packs, and data in
|
This method does not limit the space available to offline packs, and data in
|
||||||
offline packs does not count towards this limit. If you set the maximum ambient
|
offline packs does not count towards this limit. If you set the maximum ambient
|
||||||
cache size to 30 MB then download 20 MB of offline packs, 30 MB will remain
|
cache size to 30 MB then download 20 MB of offline packs, 30 MB will remain
|
||||||
available for the ambient cache.
|
available for the ambient cache.
|
||||||
|
|
||||||
This method should be called before the map and map style have been loaded.
|
This method should be called before the map and map style have been loaded.
|
||||||
|
|
||||||
This method is potentially expensive, as the database will trim cached data
|
This method is potentially expensive, as the database will trim cached data
|
||||||
in order to prevent the ambient cache from being larger than the
|
in order to prevent the ambient cache from being larger than the
|
||||||
specified amount.
|
specified amount.
|
||||||
|
|
||||||
@param cacheSize The maximum size in bytes for the ambient cache.
|
@param cacheSize The maximum size in bytes for the ambient cache.
|
||||||
@param completion The completion handler to call once the maximum ambient cache
|
@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.
|
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
|
Invalidates the ambient cache. This method checks that the tiles in the
|
||||||
ambient cache match those from the server. If the local tiles do not match
|
ambient cache match those from the server. If the local tiles do not match
|
||||||
those on the server, they are re-downloaded.
|
those on the server, they are re-downloaded.
|
||||||
|
|
||||||
This is recommended over clearing the cache or resetting the database
|
This is recommended over clearing the cache or resetting the database
|
||||||
because valid local tiles will not be downloaded again.
|
because valid local tiles will not be downloaded again.
|
||||||
|
|
||||||
Resources shared with offline packs will not be affected by this method.
|
Resources shared with offline packs will not be affected by this method.
|
||||||
|
|
||||||
@param completion The completion handler to call once the ambient cache has
|
@param completion The completion handler to call once the ambient cache has
|
||||||
been revalidated. This handler is executed asynchronously on the main queue.
|
been revalidated. This handler is executed asynchronously on the main queue.
|
||||||
*/
|
*/
|
||||||
@@ -426,7 +436,7 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
Clears the ambient cache by deleting resources. This method does not affect
|
Clears the ambient cache by deleting resources. This method does not affect
|
||||||
resources shared with offline regions.
|
resources shared with offline regions.
|
||||||
|
|
||||||
@param completion The completion handler to call once resources from the
|
@param completion The completion handler to call once resources from the
|
||||||
ambient cache have been cleared. This handler is executed asynchronously on
|
ambient cache have been cleared. This handler is executed asynchronously on
|
||||||
the main queue.
|
the main queue.
|
||||||
@@ -436,9 +446,9 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
Deletes the existing database, which includes both the ambient cache and
|
Deletes the existing database, which includes both the ambient cache and
|
||||||
offline packs, then reinitializes it.
|
offline packs, then reinitializes it.
|
||||||
|
|
||||||
You typically do not need to call this method.
|
You typically do not need to call this method.
|
||||||
|
|
||||||
@param completion The completion handler to call once the pack has database has
|
@param completion The completion handler to call once the pack has database has
|
||||||
been reset. This handler is executed asynchronously on the main queue.
|
been reset. This handler is executed asynchronously on the main queue.
|
||||||
*/
|
*/
|
||||||
@@ -446,16 +456,17 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Inserts the provided resource into the ambient cache.
|
Inserts the provided resource into the ambient cache.
|
||||||
|
|
||||||
This method mimics the caching that would take place if the equivalent resource
|
This method mimics the caching that would take place if the equivalent resource
|
||||||
were requested in the process of map rendering. Use this method to pre-warm the
|
were requested in the process of map rendering. Use this method to pre-warm the
|
||||||
cache with resources you know will be requested.
|
cache with resources you know will be requested.
|
||||||
|
|
||||||
This method is asynchronous; the data may not be immediately available for
|
This method is asynchronous; the data may not be immediately available for
|
||||||
in-progress requests, though subsequent requests should have access to the
|
in-progress requests, though subsequent requests should have access to the
|
||||||
cached data.
|
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.
|
method.
|
||||||
|
|
||||||
@param data Response data to store for this resource. The data is expected to
|
@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
|
@param mustRevalidate A Boolean value indicating whether the data is still
|
||||||
usable past the expiration date.
|
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
|
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
|
@param completion The completion handler to call once the data has been
|
||||||
preloaded. This handler is executed asynchronously on the main queue.
|
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;
|
completionHandler:(nullable MLNOfflinePreloadDataCompletionHandler)completion;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#import "MLNOfflinePack.h"
|
#import "MLNOfflinePack.h"
|
||||||
|
|
||||||
#include <mbgl/storage/online_file_source.hpp>
|
|
||||||
#include <mbgl/storage/database_file_source.hpp>
|
#include <mbgl/storage/database_file_source.hpp>
|
||||||
|
#include <mbgl/storage/online_file_source.hpp>
|
||||||
|
|
||||||
#include "MLNSettings_Private.h"
|
#include "MLNSettings_Private.h"
|
||||||
|
|
||||||
@@ -28,7 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
*/
|
*/
|
||||||
@property (nonatomic) std::shared_ptr<mbgl::FileSource> mbglFileSource;
|
@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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNAnnotation.h"
|
#import "MLNAnnotation.h"
|
||||||
#import "MLNGeometry.h"
|
#import "MLNGeometry.h"
|
||||||
@@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
This property contains the smallest rectangle that completely encompasses the
|
This property contains the smallest rectangle that completely encompasses the
|
||||||
overlay. Implementers of this protocol must set this area when implementing
|
overlay. Implementers of this protocol must set this area when implementing
|
||||||
their overlay class, and after setting it, you must not change it.
|
their overlay class, and after setting it, you must not change it.
|
||||||
|
|
||||||
If this overlay spans the antimeridian, its bounds may extend west of −180 degrees
|
If this overlay spans the antimeridian, its bounds may extend west of −180 degrees
|
||||||
longitude or east of 180 degrees longitude. For example, an overlay covering the
|
longitude or east of 180 degrees longitude. For example, an overlay covering the
|
||||||
Pacific Ocean from Tokyo to San Francisco might have a bounds extending
|
Pacific Ocean from Tokyo to San Francisco might have a bounds extending
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNShape.h"
|
#import "MLNShape.h"
|
||||||
@@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
A point shape is known as a
|
A point shape is known as a
|
||||||
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.2">Point</a> geometry
|
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.2">Point</a> geometry
|
||||||
in GeoJSON.
|
in GeoJSON.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Mark a place on the map with an annotation
|
TODO: Mark a place on the map with an annotation
|
||||||
TODO: Mark a place on the map with an image
|
TODO: Mark a place on the map with an image
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNOverlay.h"
|
#import "MLNOverlay.h"
|
||||||
@@ -40,7 +40,8 @@ MLN_EXPORT
|
|||||||
@param count The number of items in the `coords` array.
|
@param count The number of items in the `coords` array.
|
||||||
@return A new point collection object.
|
@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. */
|
/** The array of coordinates associated with the shape. */
|
||||||
@property (nonatomic, readonly) CLLocationCoordinate2D *coordinates NS_RETURNS_INNER_POINTER;
|
@property (nonatomic, readonly) CLLocationCoordinate2D *coordinates NS_RETURNS_INNER_POINTER;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNMultiPoint.h"
|
#import "MLNMultiPoint.h"
|
||||||
@@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
To make the polygon straddle the antimeridian, specify some longitudes less
|
To make the polygon straddle the antimeridian, specify some longitudes less
|
||||||
than −180 degrees or greater than 180 degrees.
|
than −180 degrees or greater than 180 degrees.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Add a polygon annotation, learn how to initialize an
|
TODO: Add a polygon annotation, learn how to initialize an
|
||||||
`MLNPolygon` object from an array of coordinates.
|
`MLNPolygon` object from an array of coordinates.
|
||||||
@@ -72,7 +72,8 @@ MLN_EXPORT
|
|||||||
@param count The number of items in the `coords` array.
|
@param count The number of items in the `coords` array.
|
||||||
@return A new polygon object.
|
@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
|
Creates and returns an `MLNPolygon` object from the specified set of
|
||||||
@@ -86,7 +87,9 @@ MLN_EXPORT
|
|||||||
is considered to have no interior polygons.
|
is considered to have no interior polygons.
|
||||||
@return A new polygon object.
|
@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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNMultiPoint.h"
|
#import "MLNMultiPoint.h"
|
||||||
@@ -34,11 +34,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
`MLNPolygon` object. To group multiple polylines together in one shape, use an
|
`MLNPolygon` object. To group multiple polylines together in one shape, use an
|
||||||
`MLNMultiPolyline` or `MLNShapeCollection` object.
|
`MLNMultiPolyline` or `MLNShapeCollection` object.
|
||||||
|
|
||||||
To make the polyline go across the antimeridian or international date line,
|
To make the polyline go across the antimeridian or international date line,
|
||||||
specify some longitudes less than −180 degrees or greater than 180 degrees.
|
specify some longitudes less than −180 degrees or greater than 180 degrees.
|
||||||
For example, a polyline that stretches from Tokyo to San Francisco would have
|
For example, a polyline that stretches from Tokyo to San Francisco would have
|
||||||
coordinates of (35.68476, -220.24257) and (37.78428, -122.41310).
|
coordinates of (35.68476, -220.24257) and (37.78428, -122.41310).
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
let coordinates = [
|
let coordinates = [
|
||||||
CLLocationCoordinate2D(latitude: 35.68476, longitude: -220.24257),
|
CLLocationCoordinate2D(latitude: 35.68476, longitude: -220.24257),
|
||||||
@@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
A polyline is known as a
|
A polyline is known as a
|
||||||
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
|
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
|
||||||
geometry in GeoJSON.
|
geometry in GeoJSON.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
|
|
||||||
- <doc:LineOnUserTap>
|
- <doc:LineOnUserTap>
|
||||||
@@ -69,7 +69,8 @@ MLN_EXPORT
|
|||||||
@param count The number of items in the `coords` array.
|
@param count The number of items in the `coords` array.
|
||||||
@return A new polyline object.
|
@return A new polyline object.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)polylineWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count;
|
+ (instancetype)polylineWithCoordinates:(const CLLocationCoordinate2D *)coords
|
||||||
|
count:(NSUInteger)count;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -9,4 +9,3 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
An `NSNumber` object containing an unsigned integer that specifies the encoding
|
An `NSNumber` object containing an unsigned integer that specifies the encoding
|
||||||
formula for raster-dem tilesets. The integer corresponds to one of
|
formula for raster-dem tilesets. The integer corresponds to one of
|
||||||
the constants described in `MLNDEMEncoding`.
|
the constants described in `MLNDEMEncoding`.
|
||||||
|
|
||||||
The default value for this option is `MLNDEMEncodingMapbox`.
|
The default value for this option is `MLNDEMEncodingMapbox`.
|
||||||
|
|
||||||
This option cannot be represented in a TileJSON or style JSON file. It is used
|
This option cannot be represented in a TileJSON or style JSON file. It is used
|
||||||
with the `MLNRasterDEMSource` class and is ignored when creating an
|
with the `MLNRasterDEMSource` class and is ignored when creating an
|
||||||
`MLNRasterTileSource` or `MLNVectorTileSource` object.
|
`MLNRasterTileSource` or `MLNVectorTileSource` object.
|
||||||
@@ -32,9 +32,11 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNTileSourceOption MLNTileSourceOptionDEMEnc
|
|||||||
`MLNRasterDEMSource` object that you can use to initialize new style layers.
|
`MLNRasterDEMSource` object that you can use to initialize new style layers.
|
||||||
You can also add and remove sources dynamically using methods such as
|
You can also add and remove sources dynamically using methods such as
|
||||||
`-[MLNStyle addSource:]` and `-[MLNStyle sourceWithIdentifier:]`.
|
`-[MLNStyle addSource:]` and `-[MLNStyle sourceWithIdentifier:]`.
|
||||||
|
|
||||||
Currently, raster DEM sources only support the format used by
|
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
|
### Example
|
||||||
|
|
||||||
|
|||||||
@@ -42,12 +42,13 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNTileSourceOption MLNTileSourceOptionTileSi
|
|||||||
### Example
|
### Example
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
let source = MLNRasterTileSource(identifier: "clouds", tileURLTemplates: ["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [
|
let source = MLNRasterTileSource(identifier: "clouds", tileURLTemplates:
|
||||||
.minimumZoomLevel: 9,
|
["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [ .minimumZoomLevel: 9,
|
||||||
.maximumZoomLevel: 16,
|
.maximumZoomLevel: 16,
|
||||||
.tileSize: 512,
|
.tileSize: 512,
|
||||||
.attributionInfos: [
|
.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)
|
mapView.style?.addSource(source)
|
||||||
@@ -85,7 +86,8 @@ MLN_EXPORT
|
|||||||
source’s contents and other metadata.
|
source’s contents and other metadata.
|
||||||
@return An initialized raster tile source.
|
@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,
|
Returns a raster tile source initialized with an identifier, configuration URL,
|
||||||
@@ -107,7 +109,9 @@ MLN_EXPORT
|
|||||||
documentation for details.
|
documentation for details.
|
||||||
@return An initialized raster tile source.
|
@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
|
Returns a raster tile source initialized an identifier, tile URL templates, and
|
||||||
@@ -129,7 +133,10 @@ MLN_EXPORT
|
|||||||
the default values.
|
the default values.
|
||||||
@return An initialized tile source.
|
@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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#import "MLNRasterTileSource.h"
|
#import "MLNRasterTileSource.h"
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <mbgl/util/variant.hpp>
|
#include <mbgl/util/variant.hpp>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
class Tileset;
|
class Tileset;
|
||||||
namespace style {
|
namespace style {
|
||||||
class RasterSource;
|
class RasterSource;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace mbgl
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -16,7 +16,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@property (nonatomic, readonly, nullable) mbgl::style::RasterSource *rawSource;
|
@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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -28,66 +28,65 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <SystemConfiguration/SystemConfiguration.h>
|
#import <SystemConfiguration/SystemConfiguration.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
|
* 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/
|
* @see http://nshipster.com/ns_enum-ns_options/
|
||||||
**/
|
**/
|
||||||
#ifndef NS_ENUM
|
#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
|
#endif
|
||||||
|
|
||||||
extern NSString *const kMLNReachabilityChangedNotification;
|
extern NSString *const kMLNReachabilityChangedNotification;
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, NetworkStatus) {
|
typedef NS_ENUM(NSInteger, NetworkStatus) {
|
||||||
// Apple NetworkStatus Compatible Names.
|
// Apple NetworkStatus Compatible Names.
|
||||||
NotReachable = 0,
|
NotReachable = 0,
|
||||||
ReachableViaWiFi = 2,
|
ReachableViaWiFi = 2,
|
||||||
ReachableViaWWAN = 1
|
ReachableViaWWAN = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
@class MLNReachability;
|
@class MLNReachability;
|
||||||
|
|
||||||
typedef void (^NetworkReachable)(MLNReachability * reachability);
|
typedef void (^NetworkReachable)(MLNReachability *reachability);
|
||||||
typedef void (^NetworkUnreachable)(MLNReachability * reachability);
|
typedef void (^NetworkUnreachable)(MLNReachability *reachability);
|
||||||
|
|
||||||
|
|
||||||
@interface MLNReachability : NSObject
|
@interface MLNReachability : NSObject
|
||||||
|
|
||||||
@property (nonatomic, copy) NetworkReachable reachableBlock;
|
@property (nonatomic, copy) NetworkReachable reachableBlock;
|
||||||
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
|
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
|
||||||
|
|
||||||
@property (nonatomic, assign) BOOL reachableOnWWAN;
|
@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
|
// This is identical to the function above, but is here to maintain
|
||||||
// compatibility with Apples original code. (see .m)
|
// compatibility with Apples original code. (see .m)
|
||||||
+(instancetype)reachabilityWithHostName:(NSString*)hostname;
|
+ (instancetype)reachabilityWithHostName:(NSString *)hostname;
|
||||||
+(instancetype)reachabilityForInternetConnection;
|
+ (instancetype)reachabilityForInternetConnection;
|
||||||
+(instancetype)reachabilityWithAddress:(void *)hostAddress;
|
+ (instancetype)reachabilityWithAddress:(void *)hostAddress;
|
||||||
+(instancetype)reachabilityForLocalWiFi;
|
+ (instancetype)reachabilityForLocalWiFi;
|
||||||
|
|
||||||
-(BOOL)startNotifier;
|
- (BOOL)startNotifier;
|
||||||
-(void)stopNotifier;
|
- (void)stopNotifier;
|
||||||
|
|
||||||
-(BOOL)isReachable;
|
- (BOOL)isReachable;
|
||||||
-(BOOL)isReachableViaWWAN;
|
- (BOOL)isReachableViaWWAN;
|
||||||
-(BOOL)isReachableViaWiFi;
|
- (BOOL)isReachableViaWiFi;
|
||||||
|
|
||||||
// WWAN may be available, but not active until a connection has been established.
|
// WWAN may be available, but not active until a connection has been established.
|
||||||
// WiFi may require a connection for VPN on Demand.
|
// WiFi may require a connection for VPN on Demand.
|
||||||
-(BOOL)isConnectionRequired; // Identical DDG variant.
|
- (BOOL)isConnectionRequired; // Identical DDG variant.
|
||||||
-(BOOL)connectionRequired; // Apple's routine.
|
- (BOOL)connectionRequired; // Apple's routine.
|
||||||
// Dynamic, on demand connection?
|
// Dynamic, on demand connection?
|
||||||
-(BOOL)isConnectionOnDemand;
|
- (BOOL)isConnectionOnDemand;
|
||||||
// Is user intervention required?
|
// Is user intervention required?
|
||||||
-(BOOL)isInterventionRequired;
|
- (BOOL)isInterventionRequired;
|
||||||
|
|
||||||
-(NetworkStatus)currentReachabilityStatus;
|
- (NetworkStatus)currentReachabilityStatus;
|
||||||
-(SCNetworkReachabilityFlags)reachabilityFlags;
|
- (SCNetworkReachabilityFlags)reachabilityFlags;
|
||||||
-(NSString*)currentReachabilityString;
|
- (NSString *)currentReachabilityString;
|
||||||
-(NSString*)currentReachabilityFlags;
|
- (NSString *)currentReachabilityFlags;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import "MLNFoundation.h"
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -19,31 +19,32 @@ MLN_EXPORT
|
|||||||
@property (nonatomic, readonly) const float scaleFactor;
|
@property (nonatomic, readonly) const float scaleFactor;
|
||||||
|
|
||||||
/** The name of the font family to use for client-side text rendering of CJK ideographs.
|
/** The name of the font family to use for client-side text rendering of CJK ideographs.
|
||||||
|
|
||||||
Set MLNIdeographicFontFamilyName in your containing application's Info.plist to
|
Set MLNIdeographicFontFamilyName in your containing application's Info.plist to
|
||||||
font family name(s) that will be available at run time, such as “PingFang TC”
|
font family name(s) that will be available at run time, such as “PingFang TC”
|
||||||
or “Marker Felt”. This plist key accepts:
|
or “Marker Felt”. This plist key accepts:
|
||||||
|
|
||||||
- A string value of a single font family name.
|
- A string value of a single font family name.
|
||||||
|
|
||||||
- An array of font family names. Fonts will be used in the defined order,
|
- An array of font family names. Fonts will be used in the defined order,
|
||||||
eventually falling back to default system font if none are available.
|
eventually falling back to default system font if none are available.
|
||||||
|
|
||||||
- A boolean value NO to disable client-side rendering of CJK glyphs —
|
- A boolean value NO to disable client-side rendering of CJK glyphs —
|
||||||
remote fonts specified in your style will be used instead.
|
remote fonts specified in your style will be used instead.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly, nullable) NSString *localFontFamilyName;
|
@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
|
A Boolean value indicating whether symbol layers may enable per-source symbol
|
||||||
collision detection.
|
collision detection.
|
||||||
|
|
||||||
Set `MLNCollisionBehaviorPre4_0` in your containing app's Info.plist or by using
|
Set `MLNCollisionBehaviorPre4_0` in your containing app's Info.plist or by using
|
||||||
`[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:@"MLNCollisionBehaviorPre4_0"]`.
|
`[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:@"MLNCollisionBehaviorPre4_0"]`.
|
||||||
If both are set, the value from `NSUserDefaults` takes priority.
|
If both are set, the value from `NSUserDefaults` takes priority.
|
||||||
|
|
||||||
Setting this property to `YES` in the plist results in symbol layers only running
|
Setting this property to `YES` in the plist results in symbol layers only running
|
||||||
collision detection against other symbol layers that are part of the same source.
|
collision detection against other symbol layers that are part of the same source.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,73 +1,67 @@
|
|||||||
#include <mbgl/gfx/backend_scope.hpp>
|
#include <mbgl/gfx/backend_scope.hpp>
|
||||||
|
#include <mbgl/gfx/renderer_backend.hpp>
|
||||||
#include <mbgl/renderer/renderer.hpp>
|
#include <mbgl/renderer/renderer.hpp>
|
||||||
#include <mbgl/renderer/renderer_frontend.hpp>
|
#include <mbgl/renderer/renderer_frontend.hpp>
|
||||||
#include <mbgl/gfx/renderer_backend.hpp>
|
|
||||||
#include <mbgl/util/async_task.hpp>
|
#include <mbgl/util/async_task.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The RenderFrontend is passed to the Map to facilitate rendering in a platform
|
The RenderFrontend is passed to the Map to facilitate rendering in a platform
|
||||||
dependent way.
|
dependent way.
|
||||||
*/
|
*/
|
||||||
class MLNRenderFrontend : public mbgl::RendererFrontend
|
class MLNRenderFrontend : public mbgl::RendererFrontend {
|
||||||
{
|
public:
|
||||||
public:
|
MLNRenderFrontend(std::unique_ptr<mbgl::Renderer> renderer_, MLNMapView* nativeView_,
|
||||||
MLNRenderFrontend(std::unique_ptr<mbgl::Renderer> renderer_, MLNMapView* nativeView_, mbgl::gfx::RendererBackend& mbglBackend_, bool async = false)
|
mbgl::gfx::RendererBackend& mbglBackend_, bool async = false)
|
||||||
: renderer(std::move(renderer_))
|
: renderer(std::move(renderer_)), nativeView(nativeView_), mbglBackend(mbglBackend_) {
|
||||||
, nativeView(nativeView_)
|
if (async) {
|
||||||
, mbglBackend(mbglBackend_) {
|
asyncInvalidate.emplace([&]() { [nativeView setNeedsRerender]; });
|
||||||
if (async) {
|
|
||||||
asyncInvalidate.emplace([&]() {
|
|
||||||
[nativeView setNeedsRerender];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void reset() override {
|
|
||||||
if (renderer) {
|
void reset() override {
|
||||||
renderer.reset();
|
if (renderer) {
|
||||||
}
|
renderer.reset();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void update(std::shared_ptr<mbgl::UpdateParameters> updateParameters_) override {
|
|
||||||
updateParameters = std::move(updateParameters_);
|
void update(std::shared_ptr<mbgl::UpdateParameters> updateParameters_) override {
|
||||||
if (asyncInvalidate) {
|
updateParameters = std::move(updateParameters_);
|
||||||
asyncInvalidate->send();
|
if (asyncInvalidate) {
|
||||||
} else {
|
asyncInvalidate->send();
|
||||||
[nativeView setNeedsRerender];
|
} else {
|
||||||
}
|
[nativeView setNeedsRerender];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void setObserver(mbgl::RendererObserver& observer) override {
|
|
||||||
if (!renderer) return;
|
void setObserver(mbgl::RendererObserver& observer) override {
|
||||||
renderer->setObserver(&observer);
|
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`.
|
// onStyleImageMissing might be called during a render. The user implemented method
|
||||||
// Copy the shared pointer here so that the parameters aren't destroyed while `render(...)` is
|
// could trigger a call to MLNRenderFrontend#update which overwrites `updateParameters`.
|
||||||
// still using them.
|
// Copy the shared pointer here so that the parameters aren't destroyed while `render(...)` is
|
||||||
auto updateParameters_ = updateParameters;
|
// still using them.
|
||||||
renderer->render(updateParameters_);
|
auto updateParameters_ = updateParameters;
|
||||||
}
|
renderer->render(updateParameters_);
|
||||||
|
}
|
||||||
mbgl::Renderer* getRenderer() {
|
|
||||||
return renderer.get();
|
mbgl::Renderer* getRenderer() { return renderer.get(); }
|
||||||
}
|
|
||||||
|
void reduceMemoryUse() {
|
||||||
void reduceMemoryUse() {
|
if (!renderer) return;
|
||||||
if (!renderer) return;
|
renderer->reduceMemoryUse();
|
||||||
renderer->reduceMemoryUse();
|
}
|
||||||
}
|
|
||||||
|
private:
|
||||||
private:
|
std::unique_ptr<mbgl::Renderer> renderer;
|
||||||
std::unique_ptr<mbgl::Renderer> renderer;
|
__weak MLNMapView* nativeView = nullptr;
|
||||||
__weak MLNMapView *nativeView = nullptr;
|
mbgl::gfx::RendererBackend& mbglBackend;
|
||||||
mbgl::gfx::RendererBackend& mbglBackend;
|
std::shared_ptr<mbgl::UpdateParameters> updateParameters;
|
||||||
std::shared_ptr<mbgl::UpdateParameters> updateParameters;
|
std::optional<mbgl::util::AsyncTask> asyncInvalidate;
|
||||||
std::optional<mbgl::util::AsyncTask> asyncInvalidate;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,18 +9,18 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
Well-known tile servers
|
Well-known tile servers
|
||||||
*/
|
*/
|
||||||
typedef NS_ENUM(NSUInteger, MLNWellKnownTileServer) {
|
typedef NS_ENUM(NSUInteger, MLNWellKnownTileServer) {
|
||||||
/**
|
/**
|
||||||
Maptiler
|
Maptiler
|
||||||
*/
|
*/
|
||||||
MLNMapTiler,
|
MLNMapTiler,
|
||||||
/**
|
/**
|
||||||
MapLibre
|
MapLibre
|
||||||
*/
|
*/
|
||||||
MLNMapLibre,
|
MLNMapLibre,
|
||||||
/**
|
/**
|
||||||
Mapbox
|
Mapbox
|
||||||
*/
|
*/
|
||||||
MLNMapbox
|
MLNMapbox
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,7 +50,7 @@ MLN_EXPORT
|
|||||||
and the type `String`. Alternatively, you may call this method from your
|
and the type `String`. Alternatively, you may call this method from your
|
||||||
application delegate’s `-applicationDidFinishLaunching:` method.
|
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
|
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/default_style.hpp>
|
||||||
|
#import <mbgl/util/tile_server_options.hpp>
|
||||||
|
#import "MLNSettings.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
|
||||||
#import "MLNAnnotation.h"
|
#import "MLNAnnotation.h"
|
||||||
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
shapes collectively using a concrete instance of `MLNVectorStyleLayer`.
|
shapes collectively using a concrete instance of `MLNVectorStyleLayer`.
|
||||||
Alternatively, you can add some kinds of shapes directly to a map view as
|
Alternatively, you can add some kinds of shapes directly to a map view as
|
||||||
annotations or overlays.
|
annotations or overlays.
|
||||||
|
|
||||||
You can filter the features in a `MLNVectorStyleLayer` or vary their layout or
|
You can filter the features in a `MLNVectorStyleLayer` or vary their layout or
|
||||||
paint attributes based on the features’ geographies. Pass an `MLNShape` into an
|
paint attributes based on the features’ geographies. Pass an `MLNShape` into an
|
||||||
`NSPredicate` with the format `SELF IN %@` or `%@ CONTAINS SELF` and set the
|
`NSPredicate` with the format `SELF IN %@` or `%@ CONTAINS SELF` and set the
|
||||||
@@ -56,7 +56,8 @@ MLN_EXPORT
|
|||||||
```swift
|
```swift
|
||||||
let url = mainBundle.url(forResource: "amsterdam", withExtension: "geojson")!
|
let url = mainBundle.url(forResource: "amsterdam", withExtension: "geojson")!
|
||||||
let data = try! Data(contentsOf: url)
|
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.
|
@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
|
not be parsed as valid GeoJSON source code. If `nil`, `outError` contains an
|
||||||
`NSError` object describing the problem.
|
`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
|
// MARK: Accessing the Shape Attributes
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
An offline region defined by a style URL, geographic shape, and
|
An offline region defined by a style URL, geographic shape, and
|
||||||
range of zoom levels.
|
range of zoom levels.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```swift
|
```swift
|
||||||
var coordinates = [
|
var coordinates = [
|
||||||
@@ -17,13 +17,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
CLLocationCoordinate2D(latitude: 45.534611, longitude: -122.708873),
|
CLLocationCoordinate2D(latitude: 45.534611, longitude: -122.708873),
|
||||||
CLLocationCoordinate2D(latitude: 45.530883, longitude: -122.678833)
|
CLLocationCoordinate2D(latitude: 45.530883, longitude: -122.678833)
|
||||||
]
|
]
|
||||||
|
|
||||||
let triangle = MLNPolygon(coordinates: &coordinates, count: UInt(coordinates.count))
|
let triangle = MLNPolygon(coordinates: &coordinates, count: UInt(coordinates.count))
|
||||||
let region = MLNShapeOfflineRegion(styleURL: MLNStyle.lightStyleURL, shape: triangle, fromZoomLevel: 11, toZoomLevel: 14)
|
let region = MLNShapeOfflineRegion(styleURL: MLNStyle.lightStyleURL, shape: triangle,
|
||||||
let context = "Triangle Region".data(using: .utf8)
|
fromZoomLevel: 11, toZoomLevel: 14) let context = "Triangle Region".data(using: .utf8)
|
||||||
MLNOfflineStorage.shared.addPack(for: region, withContext: context!)
|
MLNOfflineStorage.shared.addPack(for: region, withContext: context!)
|
||||||
```
|
```
|
||||||
|
|
||||||
This class requires fewer resources than MLNTilePyramidOfflineRegion
|
This class requires fewer resources than MLNTilePyramidOfflineRegion
|
||||||
for irregularly shaped regions.
|
for irregularly shaped regions.
|
||||||
*/
|
*/
|
||||||
@@ -79,7 +79,10 @@ MLN_EXPORT
|
|||||||
level, the download covers zoom levels up to the tile source’s maximum zoom
|
level, the download covers zoom levels up to the tile source’s maximum zoom
|
||||||
level.
|
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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@param definition A reference to an offline region definition backing the
|
@param definition A reference to an offline region definition backing the
|
||||||
offline region.
|
offline region.
|
||||||
*/
|
*/
|
||||||
- (instancetype)initWithOfflineRegionDefinition:(const mbgl::OfflineGeometryRegionDefinition &)definition;
|
- (instancetype)initWithOfflineRegionDefinition:
|
||||||
|
(const mbgl::OfflineGeometryRegionDefinition &)definition;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNTypes.h"
|
|
||||||
#import "MLNSource.h"
|
#import "MLNSource.h"
|
||||||
|
#import "MLNTypes.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -18,11 +18,12 @@ typedef NSString *MLNShapeSourceOption NS_STRING_ENUM;
|
|||||||
An `NSNumber` object containing a Boolean enabling or disabling clustering.
|
An `NSNumber` object containing a Boolean enabling or disabling clustering.
|
||||||
If the `shape` property contains point shapes, setting this option to
|
If the `shape` property contains point shapes, setting this option to
|
||||||
`YES` clusters the points by radius into groups. The default value is `NO`.
|
`YES` clusters the points by radius into groups. The default value is `NO`.
|
||||||
|
|
||||||
This option corresponds to the
|
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.
|
source property in the MapLibre Style Spec.
|
||||||
|
|
||||||
This option only affects point features within an `MLNShapeSource` object; it
|
This option only affects point features within an `MLNShapeSource` object; it
|
||||||
is ignored when creating an `MLNComputedShapeSource` object.
|
is ignored when creating an `MLNComputedShapeSource` object.
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionClus
|
|||||||
An `NSNumber` object containing an integer; specifies the radius of each
|
An `NSNumber` object containing an integer; specifies the radius of each
|
||||||
cluster if clustering is enabled. A value of 512 produces a radius equal to
|
cluster if clustering is enabled. A value of 512 produces a radius equal to
|
||||||
the width of a tile. The default value is 50.
|
the width of a tile. The default value is 50.
|
||||||
|
|
||||||
This option only affects point features within an `MLNShapeSource` object; it
|
This option only affects point features within an `MLNShapeSource` object; it
|
||||||
is ignored when creating an `MLNComputedShapeSource` object.
|
is ignored when creating an `MLNComputedShapeSource` object.
|
||||||
*/
|
*/
|
||||||
@@ -62,13 +63,14 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionClus
|
|||||||
let firstExpression = NSExpression(format: "sum:({$featureAccumulated, sumValue})")
|
let firstExpression = NSExpression(format: "sum:({$featureAccumulated, sumValue})")
|
||||||
let secondExpression = NSExpression(forKeyPath: "magnitude")
|
let secondExpression = NSExpression(forKeyPath: "magnitude")
|
||||||
let clusterPropertiesDictionary = ["sumValue" : [firstExpression, secondExpression]]
|
let clusterPropertiesDictionary = ["sumValue" : [firstExpression, secondExpression]]
|
||||||
|
|
||||||
let options : [MLNShapeSourceOption : Any] = [.clustered : true,
|
let options : [MLNShapeSourceOption : Any] = [.clustered : true,
|
||||||
.clusterProperties: clusterPropertiesDictionary]
|
.clusterProperties: clusterPropertiesDictionary]
|
||||||
```
|
```
|
||||||
|
|
||||||
This option corresponds to the
|
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.
|
source property in the MapLibre Style Spec.
|
||||||
|
|
||||||
This option only affects point features within an `MLNShapeSource` object; it
|
This option only affects point features within an `MLNShapeSource` object; it
|
||||||
@@ -80,22 +82,25 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionClus
|
|||||||
which to cluster points if clustering is enabled. Defaults to one zoom level
|
which to cluster points if clustering is enabled. Defaults to one zoom level
|
||||||
less than the value of `MLNShapeSourceOptionMaximumZoomLevel` so that, at the
|
less than the value of `MLNShapeSourceOptionMaximumZoomLevel` so that, at the
|
||||||
maximum zoom level, the shapes are not clustered.
|
maximum zoom level, the shapes are not clustered.
|
||||||
|
|
||||||
This option corresponds to the
|
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.
|
source property in the MapLibre Style Spec.
|
||||||
|
|
||||||
This option only affects point features within an `MLNShapeSource` object; it
|
This option only affects point features within an `MLNShapeSource` object; it
|
||||||
is ignored when creating an `MLNComputedShapeSource` object.
|
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
|
An `NSNumber` object containing an integer; specifies the minimum zoom level at
|
||||||
which to create vector tiles. The default value is 0.
|
which to create vector tiles. The default value is 0.
|
||||||
|
|
||||||
This option corresponds to the
|
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.
|
source property in the MapLibre Style Spec.
|
||||||
*/
|
*/
|
||||||
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionMinimumZoomLevel;
|
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionMinimumZoomLevel;
|
||||||
@@ -104,9 +109,10 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionMini
|
|||||||
An `NSNumber` object containing an integer; specifies the maximum zoom level at
|
An `NSNumber` object containing an integer; specifies the maximum zoom level at
|
||||||
which to create vector tiles. A greater value produces greater detail at high
|
which to create vector tiles. A greater value produces greater detail at high
|
||||||
zoom levels. The default value is 18.
|
zoom levels. The default value is 18.
|
||||||
|
|
||||||
This option corresponds to the
|
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.
|
source property in the MapLibre Style Spec.
|
||||||
*/
|
*/
|
||||||
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionMaximumZoomLevel;
|
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionMaximumZoomLevel;
|
||||||
@@ -116,7 +122,7 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionMaxi
|
|||||||
buffer on each side. A value of 0 produces no buffer. A value of 512 produces a
|
buffer on each side. A value of 0 produces no buffer. A value of 512 produces a
|
||||||
buffer as wide as the tile itself. Larger values produce fewer rendering
|
buffer as wide as the tile itself. Larger values produce fewer rendering
|
||||||
artifacts near tile edges and slower performance. The default value is 128.
|
artifacts near tile edges and slower performance. The default value is 128.
|
||||||
|
|
||||||
This option corresponds to the
|
This option corresponds to the
|
||||||
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson-buffer"><code>buffer</code></a>
|
<a href="https://maplibre.org/maplibre-style-spec/#sources-geojson-buffer"><code>buffer</code></a>
|
||||||
source property in the MapLibre Style Spec.
|
source property in the MapLibre Style Spec.
|
||||||
@@ -127,21 +133,23 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionBuff
|
|||||||
An `NSNumber` object containing a double; specifies the Douglas-Peucker
|
An `NSNumber` object containing a double; specifies the Douglas-Peucker
|
||||||
simplification tolerance. A greater value produces simpler geometries and
|
simplification tolerance. A greater value produces simpler geometries and
|
||||||
improves performance. The default value is 0.375.
|
improves performance. The default value is 0.375.
|
||||||
|
|
||||||
This option corresponds to the
|
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.
|
source property in the MapLibre Style Spec.
|
||||||
*/
|
*/
|
||||||
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionSimplificationTolerance;
|
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionSimplificationTolerance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
An `NSNumber` object containing a Boolean enabling or disabling calculating line distance metrics.
|
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.
|
Set this property to `YES` in order for the `MLNLineStyleLayer.lineGradient` property to have its
|
||||||
The default value is `NO`.
|
intended effect. The default value is `NO`.
|
||||||
|
|
||||||
This option corresponds to the
|
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.
|
source property in the MapLibre Style Spec.
|
||||||
*/
|
*/
|
||||||
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionLineDistanceMetrics;
|
FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionLineDistanceMetrics;
|
||||||
@@ -154,7 +162,7 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionLine
|
|||||||
`MLNStyle` object along with an `MLNVectorStyleLayer` object. The vector style
|
`MLNStyle` object along with an `MLNVectorStyleLayer` object. The vector style
|
||||||
layer defines the appearance of any content supplied by the shape source. You
|
layer defines the appearance of any content supplied by the shape source. You
|
||||||
can update a shape source by setting its `shape` or `URL` property.
|
can update a shape source by setting its `shape` or `URL` property.
|
||||||
|
|
||||||
`MLNShapeSource` is optimized for data sets that change dynamically and fit
|
`MLNShapeSource` is optimized for data sets that change dynamically and fit
|
||||||
completely in memory. For large data sets that do not fit completely in memory,
|
completely in memory. For large data sets that do not fit completely in memory,
|
||||||
use the `MLNComputedShapeSource` or `MLNVectorTileSource` class.
|
use the `MLNComputedShapeSource` or `MLNVectorTileSource` class.
|
||||||
@@ -181,7 +189,7 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNShapeSourceOption MLNShapeSourceOptionLine
|
|||||||
let source = MLNShapeSource(identifier: "lines", features: [polyline], options: nil)
|
let source = MLNShapeSource(identifier: "lines", features: [polyline], options: nil)
|
||||||
mapView.style?.addSource(source)
|
mapView.style?.addSource(source)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Cluster point data
|
TODO: Cluster point data
|
||||||
TODO: Use images to cluster point data
|
TODO: Use images to cluster point data
|
||||||
@@ -196,7 +204,7 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
Returns a shape source with an identifier, URL, and dictionary of options for
|
Returns a shape source with an identifier, URL, and dictionary of options for
|
||||||
the source.
|
the source.
|
||||||
|
|
||||||
This class supports the following options: `MLNShapeSourceOptionClustered`,
|
This class supports the following options: `MLNShapeSourceOptionClustered`,
|
||||||
`MLNShapeSourceOptionClusterRadius`,
|
`MLNShapeSourceOptionClusterRadius`,
|
||||||
`MLNShapeSourceOptionMaximumZoomLevelForClustering`,
|
`MLNShapeSourceOptionMaximumZoomLevelForClustering`,
|
||||||
@@ -210,17 +218,20 @@ MLN_EXPORT
|
|||||||
current application’s resource bundle.
|
current application’s resource bundle.
|
||||||
@param options An `NSDictionary` of options for this source.
|
@param options An `NSDictionary` of options for this source.
|
||||||
@return An initialized shape source.
|
@return An initialized shape source.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Add live data, learn how to add live data to your map by
|
TODO: Add live data, learn how to add live data to your map by
|
||||||
updating the an `MLNShapeSource` object's `URL` property.
|
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
|
Returns a shape source with an identifier, a shape, and dictionary of options
|
||||||
for the source.
|
for the source.
|
||||||
|
|
||||||
This class supports the following options: `MLNShapeSourceOptionClustered`,
|
This class supports the following options: `MLNShapeSourceOptionClustered`,
|
||||||
`MLNShapeSourceOptionClusterRadius`,
|
`MLNShapeSourceOptionClusterRadius`,
|
||||||
`MLNShapeSourceOptionMaximumZoomLevelForClustering`,
|
`MLNShapeSourceOptionMaximumZoomLevelForClustering`,
|
||||||
@@ -243,17 +254,20 @@ MLN_EXPORT
|
|||||||
@param shape A concrete subclass of `MLNShape`
|
@param shape A concrete subclass of `MLNShape`
|
||||||
@param options An `NSDictionary` of options for this source.
|
@param options An `NSDictionary` of options for this source.
|
||||||
@return An initialized shape source.
|
@return An initialized shape source.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Animate a line, learn how to animate line data by continously
|
TODO: Animate a line, learn how to animate line data by continously
|
||||||
updating an `MLNShapeSource`'s `shape` attribute.
|
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
|
Returns a shape source with an identifier, an array of features, and a dictionary
|
||||||
of options for the source.
|
of options for the source.
|
||||||
|
|
||||||
This class supports the following options: `MLNShapeSourceOptionClustered`,
|
This class supports the following options: `MLNShapeSourceOptionClustered`,
|
||||||
`MLNShapeSourceOptionClusterRadius`,
|
`MLNShapeSourceOptionClusterRadius`,
|
||||||
`MLNShapeSourceOptionMaximumZoomLevelForClustering`,
|
`MLNShapeSourceOptionMaximumZoomLevelForClustering`,
|
||||||
@@ -275,12 +289,14 @@ MLN_EXPORT
|
|||||||
@param options An `NSDictionary` of options for this source.
|
@param options An `NSDictionary` of options for this source.
|
||||||
@return An initialized shape 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
|
Returns a shape source with an identifier, an array of shapes, and a dictionary of
|
||||||
options for the source.
|
options for the source.
|
||||||
|
|
||||||
This class supports the following options: `MLNShapeSourceOptionClustered`,
|
This class supports the following options: `MLNShapeSourceOptionClustered`,
|
||||||
`MLNShapeSourceOptionClusterRadius`,
|
`MLNShapeSourceOptionClusterRadius`,
|
||||||
`MLNShapeSourceOptionMaximumZoomLevelForClustering`,
|
`MLNShapeSourceOptionMaximumZoomLevelForClustering`,
|
||||||
@@ -303,7 +319,9 @@ MLN_EXPORT
|
|||||||
@param options An `NSDictionary` of options for this source.
|
@param options An `NSDictionary` of options for this source.
|
||||||
@return An initialized shape 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
|
// MARK: Accessing a Source’s Content
|
||||||
|
|
||||||
@@ -342,7 +360,7 @@ MLN_EXPORT
|
|||||||
the road that lie within the map tiles that the source has loaded, even if the
|
the road that lie within the map tiles that the source has loaded, even if the
|
||||||
road extends into other tiles. The portion of the road within each map tile is
|
road extends into other tiles. The portion of the road within each map tile is
|
||||||
included individually.
|
included individually.
|
||||||
|
|
||||||
Returned features may not necessarily be visible to the user at the time they
|
Returned features may not necessarily be visible to the user at the time they
|
||||||
are loaded: the style may lack a layer that draws the features in question. To
|
are loaded: the style may lack a layer that draws the features in question. To
|
||||||
obtain only _visible_ features, use the
|
obtain only _visible_ features, use the
|
||||||
@@ -356,32 +374,36 @@ MLN_EXPORT
|
|||||||
@return An array of objects conforming to the `MLNFeature` protocol that
|
@return An array of objects conforming to the `MLNFeature` protocol that
|
||||||
represent features in the source that match the predicate.
|
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.
|
Returns an array of map features that are the leaves of the specified cluster.
|
||||||
("Leaves" are the original points that belong to the cluster.)
|
("Leaves" are the original points that belong to the cluster.)
|
||||||
|
|
||||||
This method supports pagination; you supply an offset (number of features to skip)
|
This method supports pagination; you supply an offset (number of features to skip)
|
||||||
and a maximum number of features to return.
|
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 offset Number of features to skip.
|
||||||
@param limit The maximum number of features to return
|
@param limit The maximum number of features to return
|
||||||
|
|
||||||
@return An array of objects that conform to the `MLNFeature` protocol.
|
@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
|
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
|
cluster *on the next zoom level*. The may include features that also conform to
|
||||||
the `MLNCluster` protocol (currently only objects of type `MLNPointFeatureCluster`).
|
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.
|
@return An array of objects that conform to the `MLNFeature` protocol.
|
||||||
|
|
||||||
@note The returned array may contain the `cluster` that was passed in, if the next
|
@note The returned array may contain the `cluster` that was passed in, if the next
|
||||||
zoom level doesn't match the zoom level for expanding that cluster. See
|
zoom level doesn't match the zoom level for expanding that cluster. See
|
||||||
`-[MLNShapeSource zoomLevelForExpandingCluster:]`.
|
`-[MLNShapeSource zoomLevelForExpandingCluster:]`.
|
||||||
@@ -390,9 +412,10 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the zoom level at which the given cluster expands.
|
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
|
@return Zoom level. This should be >= 0; any negative return value should be
|
||||||
considered an error.
|
considered an error.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
|
#include <mbgl/util/immutable.hpp>
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNShapeSource.h"
|
#import "MLNShapeSource.h"
|
||||||
#include <mbgl/util/immutable.hpp>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
namespace style {
|
namespace style {
|
||||||
struct GeoJSONOptions;
|
struct GeoJSONOptions;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace mbgl
|
||||||
|
|
||||||
MLN_EXPORT
|
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)
|
@interface MLNShapeSource (Private)
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ mbgl::Immutable<mbgl::style::GeoJSONOptions> MLNGeoJSONOptionsFromDictionary(NSD
|
|||||||
that the feature conforms to `MLNCluster`. This method is used for testing and
|
that the feature conforms to `MLNCluster`. This method is used for testing and
|
||||||
should be considered experimental, likely to be removed or changed in future
|
should be considered experimental, likely to be removed or changed in future
|
||||||
releases.
|
releases.
|
||||||
|
|
||||||
@param feature An object that conforms to the `MLNFeature` protocol.
|
@param feature An object that conforms to the `MLNFeature` protocol.
|
||||||
@param indent Used during recursion. Specify 0.
|
@param indent Used during recursion. Specify 0.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "MLNShape.h"
|
#import "MLNShape.h"
|
||||||
|
|
||||||
|
#import <mbgl/util/geo.hpp>
|
||||||
#import <mbgl/util/geojson.hpp>
|
#import <mbgl/util/geojson.hpp>
|
||||||
#import <mbgl/util/geometry.hpp>
|
#import <mbgl/util/geometry.hpp>
|
||||||
#import <mbgl/util/geo.hpp>
|
|
||||||
|
|
||||||
bool operator==(const CLLocationCoordinate2D lhs, const CLLocationCoordinate2D rhs);
|
bool operator==(const CLLocationCoordinate2D lhs, const CLLocationCoordinate2D rhs);
|
||||||
|
|
||||||
|
|||||||
@@ -2,38 +2,37 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@protocol MLNStylable;
|
@protocol MLNStylable;
|
||||||
|
|
||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
namespace style {
|
namespace style {
|
||||||
class Source;
|
class Source;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace mbgl
|
||||||
|
|
||||||
// A struct to be stored in the `peer` member of mbgl::style::Source, in order to implement
|
// 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
|
// 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
|
// 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.
|
// "pending" MLNSources, which have a strong owning pointer to the mbgl::style::Source.
|
||||||
struct SourceWrapper {
|
struct SourceWrapper {
|
||||||
__weak MLNSource *source;
|
__weak MLNSource *source;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Assert that the style source is valid.
|
Assert that the style source is valid.
|
||||||
|
|
||||||
This macro should be used at the beginning of any public-facing instance method
|
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.
|
of `MLNSource` and its subclasses. For private methods, an assertion is more appropriate.
|
||||||
*/
|
*/
|
||||||
#define MLNAssertStyleSourceIsValid() \
|
#define MLNAssertStyleSourceIsValid() \
|
||||||
do { \
|
do { \
|
||||||
if (!self.rawSource) { \
|
if (!self.rawSource) { \
|
||||||
[NSException raise:MLNInvalidStyleSourceException \
|
[NSException raise:MLNInvalidStyleSourceException \
|
||||||
format:@"This source got invalidated after the style change"]; \
|
format:@"This source got invalidated after the style change"]; \
|
||||||
} \
|
} \
|
||||||
} while (NO);
|
} while (NO);
|
||||||
|
|
||||||
@class MLNMapView;
|
@class MLNMapView;
|
||||||
|
|
||||||
@@ -43,7 +42,8 @@ do { \
|
|||||||
Initializes and returns a source with a raw pointer to the backing store,
|
Initializes and returns a source with a raw pointer to the backing store,
|
||||||
associated with a style.
|
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,
|
Initializes and returns a source with an owning pointer to the backing store,
|
||||||
@@ -62,11 +62,11 @@ do { \
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The stylable object whose style currently contains the source.
|
The stylable object whose style currently contains the source.
|
||||||
|
|
||||||
If the source is not currently part of any stylable object’s style, this
|
If the source is not currently part of any stylable object’s style, this
|
||||||
property is set to `nil`.
|
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.
|
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
|
is added back to the map via `-[MLNStyle addSource:]` and styled with a
|
||||||
`MLNLayer`.
|
`MLNLayer`.
|
||||||
*/
|
*/
|
||||||
- (void)addToStylable:(id <MLNStylable>)mapView;
|
- (void)addToStylable:(id<MLNStylable>)mapView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Removes the mbgl source that this object represents from the mbgl map.
|
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
|
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.
|
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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
#import "MLNTypes.h"
|
#import "MLNTypes.h"
|
||||||
|
|
||||||
|
#import "MLNDefaultStyle.h"
|
||||||
#import "MLNSettings.h"
|
#import "MLNSettings.h"
|
||||||
#import "MLNTileServerOptions.h"
|
#import "MLNTileServerOptions.h"
|
||||||
#import "MLNDefaultStyle.h"
|
|
||||||
|
|
||||||
@class MLNSource;
|
@class MLNSource;
|
||||||
@class MLNLight;
|
@class MLNLight;
|
||||||
@@ -43,23 +43,23 @@ MLN_EXPORT
|
|||||||
/**
|
/**
|
||||||
Returns list of predefined styles
|
Returns list of predefined styles
|
||||||
*/
|
*/
|
||||||
+ (NSArray<MLNDefaultStyle*>*) predefinedStyles;
|
+ (NSArray<MLNDefaultStyle *> *)predefinedStyles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns default style
|
Returns default style
|
||||||
*/
|
*/
|
||||||
+ (MLNDefaultStyle*) defaultStyle;
|
+ (MLNDefaultStyle *)defaultStyle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns default style as NSURL
|
Returns default style as NSURL
|
||||||
*/
|
*/
|
||||||
+ (nullable NSURL*) defaultStyleURL;
|
+ (nullable NSURL *)defaultStyleURL;
|
||||||
|
|
||||||
/** Get predefined style by name
|
/** Get predefined style by name
|
||||||
|
|
||||||
@param withStyleName style name.
|
@param withStyleName style name.
|
||||||
*/
|
*/
|
||||||
+ (nullable MLNDefaultStyle*) predefinedStyle:(NSString*)withStyleName;
|
+ (nullable MLNDefaultStyle *)predefinedStyle:(NSString *)withStyleName;
|
||||||
|
|
||||||
// MARK: Accessing Metadata About the Style
|
// MARK: Accessing Metadata About the Style
|
||||||
|
|
||||||
@@ -156,8 +156,7 @@ MLN_EXPORT
|
|||||||
@return `YES` if `source` was removed successfully. If `NO`, `outError` contains
|
@return `YES` if `source` was removed successfully. If `NO`, `outError` contains
|
||||||
an `NSError` object describing the problem.
|
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
|
// MARK: Managing Style Layers
|
||||||
|
|
||||||
@@ -335,7 +334,6 @@ MLN_EXPORT
|
|||||||
*/
|
*/
|
||||||
- (void)removeImageForName:(NSString *)name;
|
- (void)removeImageForName:(NSString *)name;
|
||||||
|
|
||||||
|
|
||||||
// MARK: Managing the Style's Light
|
// MARK: Managing the Style's Light
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -350,10 +348,10 @@ MLN_EXPORT
|
|||||||
|
|
||||||
This method automatically modifies the text property of any symbol style layer
|
This method automatically modifies the text property of any symbol style layer
|
||||||
in the style whose source is the
|
in the style whose source is the
|
||||||
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets-v8/#overview">Mapbox Streets source</a>.
|
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets-v8/#overview">Mapbox Streets
|
||||||
On iOS, the user can set the system’s preferred language in Settings, General
|
source</a>. On iOS, the user can set the system’s preferred language in Settings, General Settings,
|
||||||
Settings, Language & Region. On macOS, the user can set the system’s preferred
|
Language & Region. On macOS, the user can set the system’s preferred language in the Language &
|
||||||
language in the Language & Region pane of System Preferences.
|
Region pane of System Preferences.
|
||||||
|
|
||||||
@param locale The locale into which labels should be localized. To use the
|
@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
|
system’s preferred language, if supported, specify `nil`. To use the local
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ FOUNDATION_EXTERN MLN_EXPORT MLNExceptionName const MLNInvalidStyleLayerExceptio
|
|||||||
`MLNForegroundStyleLayer` in order to use `MLNStyleLayer`'s properties and methods.
|
`MLNForegroundStyleLayer` in order to use `MLNStyleLayer`'s properties and methods.
|
||||||
You do not create instances of `MLNStyleLayer` directly, and do not
|
You do not create instances of `MLNStyleLayer` directly, and do not
|
||||||
create your own subclasses of this class.
|
create your own subclasses of this class.
|
||||||
|
|
||||||
Do not add `MLNStyleLayer` objects to the `style` property of a `MLNMapView` before
|
Do not add `MLNStyleLayer` objects to the `style` property of a `MLNMapView` before
|
||||||
`-mapView:didFinishLoadingStyle:` is called.
|
`-mapView:didFinishLoadingStyle:` is called.
|
||||||
*/
|
*/
|
||||||
@@ -29,7 +29,8 @@ MLN_EXPORT
|
|||||||
|
|
||||||
// MARK: Initializing a Style Layer
|
// 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
|
// MARK: Identifying a Style Layer
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ MLN_EXPORT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Whether this layer is displayed. A value of `NO` hides the layer.
|
Whether this layer is displayed. A value of `NO` hides the layer.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Show and hide a layer, learn how to toggle an `MLNStyleLayer`
|
TODO: Show and hide a layer, learn how to toggle an `MLNStyleLayer`
|
||||||
object's visibility.
|
object's visibility.
|
||||||
@@ -51,12 +52,14 @@ MLN_EXPORT
|
|||||||
@property (nonatomic, assign, getter=isVisible) BOOL visible;
|
@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;
|
@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;
|
@property (nonatomic, assign) float minimumZoomLevel;
|
||||||
|
|
||||||
|
|||||||
@@ -43,5 +43,5 @@ private:
|
|||||||
std::vector<std::unique_ptr<LayerFactory>> coreFactories;
|
std::vector<std::unique_ptr<LayerFactory>> coreFactories;
|
||||||
std::map<std::string, LayerFactory*> typeToFactory;
|
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
|
// 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.
|
// "pending" MLNStyleLayers, which have a strong owning pointer to the mbgl::style::Layer.
|
||||||
struct LayerWrapper {
|
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
|
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.
|
of `MLNStyleLayer` and its subclasses. For private methods, an assertion is more appropriate.
|
||||||
*/
|
*/
|
||||||
#define MLNAssertStyleLayerIsValid() \
|
#define MLNAssertStyleLayerIsValid() \
|
||||||
do { \
|
do { \
|
||||||
if (!self.rawLayer) { \
|
if (!self.rawLayer) { \
|
||||||
[NSException raise:MLNInvalidStyleLayerException \
|
[NSException raise:MLNInvalidStyleLayerException \
|
||||||
format: \
|
format:@"Either this layer got invalidated after the style change or " \
|
||||||
@"Either this layer got invalidated after the style change or " \
|
@"-[MLNStyle removeLayer:] has been called with this instance but " \
|
||||||
@"-[MLNStyle removeLayer:] has been called " \
|
@"another style layer instance was added with the same identifer. " \
|
||||||
@"with this instance but another style layer instance was added with the same identifer. It is an " \
|
@"It is an error to send any message to this layer since it cannot " \
|
||||||
@"error to send any message to this layer since it cannot be recovered after removal due to the " \
|
@"be recovered after removal due to the identifier collision. " \
|
||||||
@"identifier collision. Use unique identifiers for all layer instances including layers of " \
|
@"Use unique identifiers for all layer instances including layers " \
|
||||||
@"different types."]; \
|
@"of different types."]; \
|
||||||
} \
|
} \
|
||||||
} while (NO);
|
} while (NO);
|
||||||
|
|
||||||
@class MLNStyle;
|
@class MLNStyle;
|
||||||
|
|
||||||
@@ -87,16 +87,16 @@ struct LayerWrapper {
|
|||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
|
|
||||||
class LayerPeerFactory {
|
class LayerPeerFactory {
|
||||||
public:
|
public:
|
||||||
virtual ~LayerPeerFactory() = default;
|
virtual ~LayerPeerFactory() = default;
|
||||||
/**
|
/**
|
||||||
Get the corresponding core layer factory.
|
Get the corresponding core layer factory.
|
||||||
*/
|
*/
|
||||||
virtual LayerFactory* getCoreLayerFactory() = 0;
|
virtual LayerFactory *getCoreLayerFactory() = 0;
|
||||||
/**
|
/**
|
||||||
Creates an MLNStyleLayer instance with a raw pointer to the backing store.
|
Creates an MLNStyleLayer instance with a raw pointer to the backing store.
|
||||||
*/
|
*/
|
||||||
virtual MLNStyleLayer* createPeer(style::Layer*) = 0;
|
virtual MLNStyleLayer *createPeer(style::Layer *) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbgl
|
} // namespace mbgl
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreGraphics/CoreGraphics.h>
|
#import <CoreGraphics/CoreGraphics.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNTypes.h"
|
#import "MLNTypes.h"
|
||||||
@@ -8,15 +8,24 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
typedef NSString *MLNStyleFunctionOption NS_STRING_ENUM NS_UNAVAILABLE;
|
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) {
|
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,
|
MLNInterpolationModeExponential __attribute__((unavailable(
|
||||||
MLNInterpolationModeInterval __attribute__((unavailable("Use NSExpression instead, calling the mgl_step:from:stops: function."))),
|
"Use NSExpression instead, applying the mgl_interpolate:withCurveType:parameters:stops: "
|
||||||
MLNInterpolationModeCategorical __attribute__((unavailable("Use NSExpression instead."))),
|
"function with a curve type of “exponential”."))) = 0,
|
||||||
MLNInterpolationModeIdentity __attribute__((unavailable("Use +[NSExpression expressionForKeyPath:] instead.")))
|
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.")));
|
} __attribute__((unavailable("Use NSExpression instead.")));
|
||||||
|
|
||||||
MLN_EXPORT __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;
|
@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>
|
@interface MLNStyleFunction<T> : MLNStyleValue<T>
|
||||||
@end
|
@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>
|
@interface MLNCameraStyleFunction<T> : MLNStyleFunction<T>
|
||||||
@end
|
@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>
|
@interface MLNSourceStyleFunction<T> : MLNStyleFunction<T>
|
||||||
@end
|
@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>
|
@interface MLNCompositeStyleFunction<T> : MLNStyleFunction<T>
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
#import "MLNStyleValue.h"
|
#import "MLNStyleValue.h"
|
||||||
|
|
||||||
#import "NSValue+MLNStyleAttributeAdditions.h"
|
|
||||||
#import "NSValue+MLNAdditions.h"
|
|
||||||
#import "NSExpression+MLNPrivateAdditions.h"
|
|
||||||
#import "NSDate+MLNAdditions.h"
|
|
||||||
#import "MLNTypes.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/color_ramp_property_value.hpp>
|
||||||
#include <mbgl/style/conversion/property_value.hpp>
|
|
||||||
#include <mbgl/style/conversion/position.hpp>
|
#include <mbgl/style/conversion/position.hpp>
|
||||||
|
#include <mbgl/style/conversion/property_value.hpp>
|
||||||
#include <mbgl/style/expression/dsl.hpp>
|
#include <mbgl/style/expression/dsl.hpp>
|
||||||
#import <mbgl/style/transition_options.hpp>
|
#import <mbgl/style/transition_options.hpp>
|
||||||
#import <mbgl/style/types.hpp>
|
#import <mbgl/style/types.hpp>
|
||||||
|
#import "MLNConversion.h"
|
||||||
|
|
||||||
#import <mbgl/util/enum.hpp>
|
#import <mbgl/util/enum.hpp>
|
||||||
#include <mbgl/util/interpolate.hpp>
|
#include <mbgl/util/interpolate.hpp>
|
||||||
@@ -22,329 +22,323 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
#import "UIColor+MLNAdditions.h"
|
#import "UIColor+MLNAdditions.h"
|
||||||
#else
|
#else
|
||||||
#import "NSColor+MLNAdditions.h"
|
#import "NSColor+MLNAdditions.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
namespace style {
|
namespace style {
|
||||||
namespace expression {
|
namespace expression {
|
||||||
class Expression;
|
class Expression;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace style
|
||||||
|
} // namespace mbgl
|
||||||
|
|
||||||
id MLNJSONObjectFromMBGLValue(const mbgl::Value &value);
|
id MLNJSONObjectFromMBGLValue(const mbgl::Value &value);
|
||||||
|
|
||||||
NS_INLINE MLNTransition MLNTransitionFromOptions(const mbgl::style::TransitionOptions& options) {
|
NS_INLINE MLNTransition MLNTransitionFromOptions(const mbgl::style::TransitionOptions &options) {
|
||||||
MLNTransition transition;
|
MLNTransition transition;
|
||||||
transition.duration = MLNTimeIntervalFromDuration(options.duration.value_or(mbgl::Duration::zero()));
|
transition.duration =
|
||||||
transition.delay = MLNTimeIntervalFromDuration(options.delay.value_or(mbgl::Duration::zero()));
|
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) {
|
NS_INLINE mbgl::style::TransitionOptions MLNOptionsFromTransition(MLNTransition transition) {
|
||||||
mbgl::style::TransitionOptions options { { MLNDurationFromTimeInterval(transition.duration) }, { MLNDurationFromTimeInterval(transition.delay) } };
|
mbgl::style::TransitionOptions options{{MLNDurationFromTimeInterval(transition.duration)},
|
||||||
return options;
|
{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);
|
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 {
|
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
|
// Convert an mbgl heatmap color property value into an mgl style value
|
||||||
NSExpression *toExpression(const mbgl::style::PropertyValue<MBGLType> &mbglValue) {
|
NSExpression *toExpression(const mbgl::style::ColorRampPropertyValue &mbglValue) {
|
||||||
PropertyExpressionEvaluator evaluator;
|
if (mbglValue.isUndefined()) {
|
||||||
return mbglValue.evaluate(evaluator);
|
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
|
if (expression.expressionType == NSConstantValueExpressionType) {
|
||||||
NSExpression *toExpression(const mbgl::style::ColorRampPropertyValue &mbglValue) {
|
MBGLType mbglValue;
|
||||||
if (mbglValue.isUndefined()) {
|
getMBGLValue(expression.constantValue, mbglValue);
|
||||||
return nil;
|
return mbglValue;
|
||||||
}
|
}
|
||||||
return [NSExpression expressionWithMLNJSONObject:MLNJSONObjectFromMBGLExpression(mbglValue.getExpression())];
|
if (expression.expressionType == NSAggregateExpressionType) {
|
||||||
|
MBGLType mbglValue;
|
||||||
|
getMBGLValue(expression.collection, mbglValue);
|
||||||
|
return mbglValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
NSArray *jsonExpression = expression.mgl_jsonExpressionObject;
|
||||||
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 {};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (expression.expressionType == NSConstantValueExpressionType) {
|
mbgl::style::conversion::Error valueError;
|
||||||
MBGLType mbglValue;
|
auto value = mbgl::style::conversion::convert<MBGLValue>(
|
||||||
getMBGLValue(expression.constantValue, mbglValue);
|
mbgl::style::conversion::makeConvertible(jsonExpression), valueError, allowDataExpressions,
|
||||||
return mbglValue;
|
false);
|
||||||
}
|
if (!value) {
|
||||||
if (expression.expressionType == NSAggregateExpressionType) {
|
[NSException raise:NSInvalidArgumentException
|
||||||
MBGLType mbglValue;
|
format:@"Invalid property value: %@", @(valueError.message.c_str())];
|
||||||
getMBGLValue(expression.collection, mbglValue);
|
return {};
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
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 {};
|
|
||||||
}
|
|
||||||
|
|
||||||
NSArray *jsonExpression = expression.mgl_jsonExpressionObject;
|
/**
|
||||||
|
Converts an NSExpression to an mbgl property value.
|
||||||
mbgl::style::conversion::Error valueError;
|
*/
|
||||||
auto value = mbgl::style::conversion::convert<mbgl::style::ColorRampPropertyValue>(
|
template <typename MBGLValue>
|
||||||
mbgl::style::conversion::makeConvertible(jsonExpression), valueError);
|
typename std::enable_if_t<std::is_same<MBGLValue, mbgl::style::ColorRampPropertyValue>::value,
|
||||||
if (!value) {
|
MBGLValue>
|
||||||
[NSException raise:NSInvalidArgumentException
|
toPropertyValue(NSExpression *expression) {
|
||||||
format:@"Invalid property value: %@", @(valueError.message.c_str())];
|
if (!expression) {
|
||||||
return {};
|
return {};
|
||||||
}
|
|
||||||
|
|
||||||
return *value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private: // Private utilities for converting from mgl to mbgl values
|
NSArray *jsonExpression = expression.mgl_jsonExpressionObject;
|
||||||
|
|
||||||
/**
|
mbgl::style::conversion::Error valueError;
|
||||||
As hack to allow converting enum => string values, we accept a second, dummy parameter in
|
auto value = mbgl::style::conversion::convert<mbgl::style::ColorRampPropertyValue>(
|
||||||
the toRawStyleSpecValue() methods for converting 'atomic' (non-style-function) values.
|
mbgl::style::conversion::makeConvertible(jsonExpression), valueError);
|
||||||
This allows us to use `std::enable_if` to test (at compile time) whether or not MBGLType is an Enum.
|
if (!value) {
|
||||||
*/
|
[NSException raise:NSInvalidArgumentException
|
||||||
template <typename MBGLEnum = MBGLType,
|
format:@"Invalid property value: %@", @(valueError.message.c_str())];
|
||||||
class = typename std::enable_if<!std::is_enum<MBGLEnum>::value>::type,
|
return {};
|
||||||
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,
|
return *value;
|
||||||
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>
|
private: // Private utilities for converting from mgl to mbgl values
|
||||||
NSString* toRawStyleSpecValue(ObjCType rawValue, MBGLEnum &) {
|
/**
|
||||||
MLNEnum mglEnum;
|
As hack to allow converting enum => string values, we accept a second, dummy parameter in
|
||||||
[rawValue getValue:&mglEnum];
|
the toRawStyleSpecValue() methods for converting 'atomic' (non-style-function) values.
|
||||||
return @(mbgl::Enum<MLNEnum>::toString(mglEnum));
|
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 &) {
|
NSExpression *operator()(const mbgl::style::PropertyExpression<MBGLType> &mbglValue) const {
|
||||||
return @(color.mgl_color.stringify().c_str());
|
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 "MLNStyle.h"
|
||||||
|
|
||||||
#import "MLNStyleLayer.h"
|
|
||||||
#import "MLNFillStyleLayer.h"
|
#import "MLNFillStyleLayer.h"
|
||||||
|
#import "MLNStyleLayer.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
namespace style {
|
namespace style {
|
||||||
class Style;
|
class Style;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace mbgl
|
||||||
|
|
||||||
@class MLNAttributionInfo;
|
@class MLNAttributionInfo;
|
||||||
@class MLNMapView;
|
@class MLNMapView;
|
||||||
@@ -19,14 +19,18 @@ namespace mbgl {
|
|||||||
|
|
||||||
@interface MLNStyle (Private)
|
@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;
|
@property (nonatomic, readonly) mbgl::style::Style *rawStyle;
|
||||||
|
|
||||||
- (nullable NSArray<MLNAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MLNColor *)linkColor;
|
- (nullable NSArray<MLNAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize
|
||||||
@property (nonatomic, readonly, strong) NSMutableDictionary<NSString *, MLNCustomStyleLayer *> *customLayers;
|
linkColor:
|
||||||
- (void)setStyleClasses:(NSArray<NSString *> *)appliedClasses transitionDuration:(NSTimeInterval)transitionDuration;
|
(nullable MLNColor *)linkColor;
|
||||||
|
@property (nonatomic, readonly, strong)
|
||||||
|
NSMutableDictionary<NSString *, MLNCustomStyleLayer *> *customLayers;
|
||||||
|
- (void)setStyleClasses:(NSArray<NSString *> *)appliedClasses
|
||||||
|
transitionDuration:(NSTimeInterval)transitionDuration;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
#import "MLNOfflineRegion.h"
|
|
||||||
#import "MLNGeometry.h"
|
#import "MLNGeometry.h"
|
||||||
|
#import "MLNOfflineRegion.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
An offline region defined by a style URL, geographic coordinate bounds, and
|
An offline region defined by a style URL, geographic coordinate bounds, and
|
||||||
range of zoom levels.
|
range of zoom levels.
|
||||||
|
|
||||||
To minimize the resources required by an irregularly shaped offline region,
|
To minimize the resources required by an irregularly shaped offline region,
|
||||||
use the MLNShapeOfflineRegion class instead.
|
use the MLNShapeOfflineRegion class instead.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```swift
|
```swift
|
||||||
let northeast = CLLocationCoordinate2D(latitude: 40.989329, longitude: -102.062592)
|
let northeast = CLLocationCoordinate2D(latitude: 40.989329, longitude: -102.062592)
|
||||||
let southwest = CLLocationCoordinate2D(latitude: 36.986207, longitude: -109.049896)
|
let southwest = CLLocationCoordinate2D(latitude: 36.986207, longitude: -109.049896)
|
||||||
let bbox = MLNCoordinateBounds(sw: southwest, ne: northeast)
|
let bbox = MLNCoordinateBounds(sw: southwest, ne: northeast)
|
||||||
|
|
||||||
let region = MLNTilePyramidOfflineRegion(styleURL: MLNStyle.lightStyleURL, bounds: bbox, fromZoomLevel: 11, toZoomLevel: 14)
|
let region = MLNTilePyramidOfflineRegion(styleURL: MLNStyle.lightStyleURL, bounds: bbox,
|
||||||
let context = "Tile Pyramid Region".data(using: .utf8)
|
fromZoomLevel: 11, toZoomLevel: 14) let context = "Tile Pyramid Region".data(using: .utf8)
|
||||||
MLNOfflineStorage.shared.addPack(for: region, withContext: context!)
|
MLNOfflineStorage.shared.addPack(for: region, withContext: context!)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Download an offline map, learn how to define an offline region
|
TODO: Download an offline map, learn how to define an offline region
|
||||||
to be downloaded to a user's device.
|
to be downloaded to a user's device.
|
||||||
@@ -80,7 +80,10 @@ MLN_EXPORT
|
|||||||
level, the download covers zoom levels up to the tile source’s maximum zoom
|
level, the download covers zoom levels up to the tile source’s maximum zoom
|
||||||
level.
|
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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@param definition A reference to an offline region definition backing the
|
@param definition A reference to an offline region definition backing the
|
||||||
offline region.
|
offline region.
|
||||||
*/
|
*/
|
||||||
- (instancetype)initWithOfflineRegionDefinition:(const mbgl::OfflineTilePyramidRegionDefinition &)definition;
|
- (instancetype)initWithOfflineRegionDefinition:
|
||||||
|
(const mbgl::OfflineTilePyramidRegionDefinition &)definition;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
|
||||||
#import "MLNDefaultStyle.h"
|
#import "MLNDefaultStyle.h"
|
||||||
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -12,98 +12,98 @@ MLN_EXPORT
|
|||||||
@interface MLNTileServerOptions : NSObject
|
@interface MLNTileServerOptions : NSObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API base URL.
|
* API base URL.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSString* baseURL;
|
@property (nonatomic, retain) NSString* baseURL;
|
||||||
|
|
||||||
/**
|
|
||||||
* Tile server URI alias.
|
|
||||||
*/
|
|
||||||
@property (nonatomic,retain) NSString* uriSchemeAlias;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL template for sources.
|
* Tile server URI alias.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSString* sourceTemplate;
|
@property (nonatomic, retain) NSString* uriSchemeAlias;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* source domain name.
|
* URL template for sources.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSString* sourceDomainName;
|
@property (nonatomic, retain) NSString* sourceTemplate;
|
||||||
|
|
||||||
/**
|
|
||||||
* source version prefix
|
|
||||||
*/
|
|
||||||
@property (nonatomic,retain,nullable) NSString* sourceVersionPrefix;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL template for style.
|
* source domain name.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSString* styleTemplate;
|
@property (nonatomic, retain) NSString* sourceDomainName;
|
||||||
|
|
||||||
/**
|
|
||||||
* style domain name.
|
|
||||||
*/
|
|
||||||
@property (nonatomic,retain) NSString* styleDomainName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* style version prefix
|
|
||||||
*/
|
|
||||||
@property (nonatomic,retain,nullable) NSString* styleVersionPrefix;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL template for sprites.
|
* source version prefix
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSString* spritesTemplate;
|
@property (nonatomic, retain, nullable) NSString* sourceVersionPrefix;
|
||||||
|
|
||||||
/**
|
|
||||||
* sprites domain name.
|
|
||||||
*/
|
|
||||||
@property (nonatomic,retain) NSString* spritesDomainName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* version prefix
|
* URL template for style.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain,nullable) NSString* spritesVersionPrefix;
|
@property (nonatomic, retain) NSString* styleTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL template for glyphs.
|
* style domain name.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSString* glyphsTemplate;
|
@property (nonatomic, retain) NSString* styleDomainName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* glyphs domain name.
|
* style version prefix
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSString* glyphsDomainName;
|
@property (nonatomic, retain, nullable) NSString* styleVersionPrefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Glyphs version prefix
|
* URL template for sprites.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain,nullable) NSString* glyphsVersionPrefix;
|
@property (nonatomic, retain) NSString* spritesTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL template for tiles.
|
* sprites domain name.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSString* tileTemplate;
|
@property (nonatomic, retain) NSString* spritesDomainName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tile domain name.
|
* version prefix
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain) NSString* tileDomainName;
|
@property (nonatomic, retain, nullable) NSString* spritesVersionPrefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tile version prefix
|
* URL template for glyphs.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic,retain,nullable) NSString* tileVersionPrefix;
|
@property (nonatomic, retain) NSString* glyphsTemplate;
|
||||||
|
|
||||||
/**
|
|
||||||
* API key parameter name.
|
|
||||||
*/
|
|
||||||
@property (nonatomic,retain) NSString* apiKeyParameterName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default styles.
|
* glyphs domain name.
|
||||||
*/
|
*/
|
||||||
|
@property (nonatomic, retain) NSString* glyphsDomainName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Glyphs version prefix
|
||||||
|
*/
|
||||||
|
@property (nonatomic, retain, nullable) NSString* glyphsVersionPrefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL template for tiles.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, retain) NSString* tileTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tile domain name.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, retain) NSString* tileDomainName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tile version prefix
|
||||||
|
*/
|
||||||
|
@property (nonatomic, retain, nullable) NSString* tileVersionPrefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API key parameter name.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, retain) NSString* apiKeyParameterName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default styles.
|
||||||
|
*/
|
||||||
@property (nonatomic, retain) NSArray<MLNDefaultStyle*>* defaultStyles;
|
@property (nonatomic, retain) NSArray<MLNDefaultStyle*>* defaultStyles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNTileSourceOption MLNTileSourceOptionMaximu
|
|||||||
/**
|
/**
|
||||||
An `NSValue` object containing an `MLNCoordinateBounds` struct that specifies
|
An `NSValue` object containing an `MLNCoordinateBounds` struct that specifies
|
||||||
the geographic extent of the source.
|
the geographic extent of the source.
|
||||||
|
|
||||||
If this option is specified, the SDK avoids requesting any tile that falls
|
If this option is specified, the SDK avoids requesting any tile that falls
|
||||||
outside of the coordinate bounds. Otherwise, the SDK requests any tile needed
|
outside of the coordinate bounds. Otherwise, the SDK requests any tile needed
|
||||||
to cover the viewport, as it does by default.
|
to cover the viewport, as it does by default.
|
||||||
@@ -122,23 +122,24 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNTileSourceOption MLNTileSourceOptionTileCo
|
|||||||
interpreted.
|
interpreted.
|
||||||
*/
|
*/
|
||||||
typedef NS_ENUM(NSUInteger, MLNTileCoordinateSystem) {
|
typedef NS_ENUM(NSUInteger, MLNTileCoordinateSystem) {
|
||||||
/**
|
/**
|
||||||
The origin is at the top-left (northwest), and `y` values increase
|
The origin is at the top-left (northwest), and `y` values increase
|
||||||
southwards.
|
southwards.
|
||||||
|
|
||||||
This tile coordinate system is used by Mapbox and OpenStreetMap tile
|
This tile coordinate system is used by Mapbox and OpenStreetMap tile
|
||||||
servers.
|
servers.
|
||||||
*/
|
*/
|
||||||
MLNTileCoordinateSystemXYZ = 0,
|
MLNTileCoordinateSystemXYZ = 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The origin is at the bottom-left (southwest), and `y` values increase
|
The origin is at the bottom-left (southwest), and `y` values increase
|
||||||
northwards.
|
northwards.
|
||||||
|
|
||||||
This tile coordinate system is used by tile servers that conform to the
|
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>.
|
<a href="http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification">Tile Map Service
|
||||||
*/
|
Specification</a>.
|
||||||
MLNTileCoordinateSystemTMS
|
*/
|
||||||
|
MLNTileCoordinateSystemTMS
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,15 +148,17 @@ typedef NS_ENUM(NSUInteger, MLNTileCoordinateSystem) {
|
|||||||
|
|
||||||
typedef NS_ENUM(NSUInteger, MLNDEMEncoding) {
|
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).
|
Raster tiles generated with the [Mapbox encoding
|
||||||
*/
|
formula](https://docs.mapbox.com/help/troubleshooting/access-elevation-data/#mapbox-terrain-rgb).
|
||||||
MLNDEMEncodingMapbox = 0,
|
*/
|
||||||
|
MLNDEMEncodingMapbox = 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Raster tiles generated with the [Mapzen Terrarium encoding formula](https://aws.amazon.com/public-datasets/terrain/).
|
Raster tiles generated with the [Mapzen Terrarium encoding
|
||||||
*/
|
formula](https://aws.amazon.com/public-datasets/terrain/).
|
||||||
MLNDEMEncodingTerrarium
|
*/
|
||||||
|
MLNDEMEncodingTerrarium
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,7 +169,7 @@ typedef NS_ENUM(NSUInteger, MLNDEMEncoding) {
|
|||||||
A tile source is added to an `MLNStyle` object along with one or more
|
A tile source is added to an `MLNStyle` object along with one or more
|
||||||
`MLNRasterStyleLayer` or `MLNVectorStyleLayer` objects. Use a style layer to
|
`MLNRasterStyleLayer` or `MLNVectorStyleLayer` objects. Use a style layer to
|
||||||
control the appearance of content supplied by the tile source.
|
control the appearance of content supplied by the tile source.
|
||||||
|
|
||||||
A tile source is also known as a tile set. To learn about the structure of a
|
A tile source is also known as a tile set. To learn about the structure of a
|
||||||
Mapbox-hosted tile set, view it in
|
Mapbox-hosted tile set, view it in
|
||||||
<a href="https://www.mapbox.com/studio/tilesets/">Mapbox Studio’s Tilesets editor</a>.
|
<a href="https://www.mapbox.com/studio/tilesets/">Mapbox Studio’s Tilesets editor</a>.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
class Tileset;
|
class Tileset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@class MLNAttributionInfo;
|
@class MLNAttributionInfo;
|
||||||
@@ -28,11 +28,14 @@ namespace mbgl {
|
|||||||
@param fontSize The default text size in points, or 0 to use the default.
|
@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.
|
@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
|
@end
|
||||||
|
|
||||||
MLN_EXPORT
|
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
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreGraphics/CoreGraphics.h>
|
#import <CoreGraphics/CoreGraphics.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
@@ -36,55 +36,55 @@ FOUNDATION_EXTERN MLN_EXPORT NSErrorDomain const MLNErrorDomain;
|
|||||||
|
|
||||||
/** Error constants for the Mapbox SDK. */
|
/** Error constants for the Mapbox SDK. */
|
||||||
typedef NS_ENUM(NSInteger, MLNErrorCode) {
|
typedef NS_ENUM(NSInteger, MLNErrorCode) {
|
||||||
/** An unknown error occurred. */
|
/** An unknown error occurred. */
|
||||||
MLNErrorCodeUnknown = -1,
|
MLNErrorCodeUnknown = -1,
|
||||||
/** The resource could not be found. */
|
/** The resource could not be found. */
|
||||||
MLNErrorCodeNotFound = 1,
|
MLNErrorCodeNotFound = 1,
|
||||||
/** The connection received an invalid server response. */
|
/** The connection received an invalid server response. */
|
||||||
MLNErrorCodeBadServerResponse = 2,
|
MLNErrorCodeBadServerResponse = 2,
|
||||||
/** An attempt to establish a connection failed. */
|
/** An attempt to establish a connection failed. */
|
||||||
MLNErrorCodeConnectionFailed = 3,
|
MLNErrorCodeConnectionFailed = 3,
|
||||||
/** A style parse error occurred while attempting to load the map. */
|
/** A style parse error occurred while attempting to load the map. */
|
||||||
MLNErrorCodeParseStyleFailed = 4,
|
MLNErrorCodeParseStyleFailed = 4,
|
||||||
/** An attempt to load the style failed. */
|
/** An attempt to load the style failed. */
|
||||||
MLNErrorCodeLoadStyleFailed = 5,
|
MLNErrorCodeLoadStyleFailed = 5,
|
||||||
/** An error occurred while snapshotting the map. */
|
/** An error occurred while snapshotting the map. */
|
||||||
MLNErrorCodeSnapshotFailed = 6,
|
MLNErrorCodeSnapshotFailed = 6,
|
||||||
/** Source is in use and cannot be removed */
|
/** Source is in use and cannot be removed */
|
||||||
MLNErrorCodeSourceIsInUseCannotRemove = 7,
|
MLNErrorCodeSourceIsInUseCannotRemove = 7,
|
||||||
/** Source is in use and cannot be removed */
|
/** Source is in use and cannot be removed */
|
||||||
MLNErrorCodeSourceIdentifierMismatch = 8,
|
MLNErrorCodeSourceIdentifierMismatch = 8,
|
||||||
/** An error occurred while modifying the offline storage database */
|
/** An error occurred while modifying the offline storage database */
|
||||||
MLNErrorCodeModifyingOfflineStorageFailed = 9,
|
MLNErrorCodeModifyingOfflineStorageFailed = 9,
|
||||||
/** Source is invalid and cannot be removed from the style (e.g. after a style change) */
|
/** Source is invalid and cannot be removed from the style (e.g. after a style change) */
|
||||||
MLNErrorCodeSourceCannotBeRemovedFromStyle = 10,
|
MLNErrorCodeSourceCannotBeRemovedFromStyle = 10,
|
||||||
/** An error occurred while rendering */
|
/** An error occurred while rendering */
|
||||||
MLNErrorCodeRenderingError = 11,
|
MLNErrorCodeRenderingError = 11,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Options for enabling debugging features in an `MLNMapView` instance. */
|
/** Options for enabling debugging features in an `MLNMapView` instance. */
|
||||||
typedef NS_OPTIONS(NSUInteger, MLNMapDebugMaskOptions) {
|
typedef NS_OPTIONS(NSUInteger, MLNMapDebugMaskOptions) {
|
||||||
/** Edges of tile boundaries are shown as thick, red lines to help diagnose
|
/** Edges of tile boundaries are shown as thick, red lines to help diagnose
|
||||||
tile clipping issues. */
|
tile clipping issues. */
|
||||||
MLNMapDebugTileBoundariesMask = 1 << 1,
|
MLNMapDebugTileBoundariesMask = 1 << 1,
|
||||||
/** Each tile shows its tile coordinate (x/y/z) in the upper-left corner. */
|
/** Each tile shows its tile coordinate (x/y/z) in the upper-left corner. */
|
||||||
MLNMapDebugTileInfoMask = 1 << 2,
|
MLNMapDebugTileInfoMask = 1 << 2,
|
||||||
/** Each tile shows a timestamp indicating when it was loaded. */
|
/** Each tile shows a timestamp indicating when it was loaded. */
|
||||||
MLNMapDebugTimestampsMask = 1 << 3,
|
MLNMapDebugTimestampsMask = 1 << 3,
|
||||||
/** Edges of glyphs and symbols are shown as faint, green lines to help
|
/** Edges of glyphs and symbols are shown as faint, green lines to help
|
||||||
diagnose collision and label placement issues. */
|
diagnose collision and label placement issues. */
|
||||||
MLNMapDebugCollisionBoxesMask = 1 << 4,
|
MLNMapDebugCollisionBoxesMask = 1 << 4,
|
||||||
/** Each drawing operation is replaced by a translucent fill. Overlapping
|
/** Each drawing operation is replaced by a translucent fill. Overlapping
|
||||||
drawing operations appear more prominent to help diagnose overdrawing.
|
drawing operations appear more prominent to help diagnose overdrawing.
|
||||||
@note This option does nothing in Release builds of the SDK. */
|
@note This option does nothing in Release builds of the SDK. */
|
||||||
MLNMapDebugOverdrawVisualizationMask = 1 << 5,
|
MLNMapDebugOverdrawVisualizationMask = 1 << 5,
|
||||||
#if !TARGET_OS_IPHONE
|
#if !TARGET_OS_IPHONE
|
||||||
/** The stencil buffer is shown instead of the color buffer.
|
/** The stencil buffer is shown instead of the color buffer.
|
||||||
@note This option does nothing in Release builds of the SDK. */
|
@note This option does nothing in Release builds of the SDK. */
|
||||||
MLNMapDebugStencilBufferMask = 1 << 6,
|
MLNMapDebugStencilBufferMask = 1 << 6,
|
||||||
/** The depth buffer is shown instead of the color buffer.
|
/** The depth buffer is shown instead of the color buffer.
|
||||||
@note This option does nothing in Release builds of the SDK. */
|
@note This option does nothing in Release builds of the SDK. */
|
||||||
MLNMapDebugDepthBufferMask = 1 << 7,
|
MLNMapDebugDepthBufferMask = 1 << 7,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -92,49 +92,50 @@ typedef NS_OPTIONS(NSUInteger, MLNMapDebugMaskOptions) {
|
|||||||
A structure containing information about a transition.
|
A structure containing information about a transition.
|
||||||
*/
|
*/
|
||||||
typedef struct __attribute__((objc_boxable)) MLNTransition {
|
typedef struct __attribute__((objc_boxable)) MLNTransition {
|
||||||
/**
|
/**
|
||||||
The amount of time the animation should take, not including the delay.
|
The amount of time the animation should take, not including the delay.
|
||||||
*/
|
*/
|
||||||
NSTimeInterval duration;
|
NSTimeInterval duration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The amount of time in seconds to wait before beginning the animation.
|
The amount of time in seconds to wait before beginning the animation.
|
||||||
*/
|
*/
|
||||||
NSTimeInterval delay;
|
NSTimeInterval delay;
|
||||||
} MLNTransition;
|
} MLNTransition;
|
||||||
|
|
||||||
NS_INLINE NSString *MLNStringFromMLNTransition(MLNTransition transition) {
|
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];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a new `MLNTransition` from the given duration and delay.
|
Creates a new `MLNTransition` from the given duration and delay.
|
||||||
|
|
||||||
@param duration The amount of time the animation should take, not including
|
@param duration The amount of time the animation should take, not including
|
||||||
the delay.
|
the delay.
|
||||||
@param delay The amount of time in seconds to wait before beginning the
|
@param delay The amount of time in seconds to wait before beginning the
|
||||||
animation.
|
animation.
|
||||||
|
|
||||||
@return Returns a `MLNTransition` struct containing the transition attributes.
|
@return Returns a `MLNTransition` struct containing the transition attributes.
|
||||||
*/
|
*/
|
||||||
NS_INLINE MLNTransition MLNTransitionMake(NSTimeInterval duration, NSTimeInterval delay) {
|
NS_INLINE MLNTransition MLNTransitionMake(NSTimeInterval duration, NSTimeInterval delay) {
|
||||||
MLNTransition transition;
|
MLNTransition transition;
|
||||||
transition.duration = duration;
|
transition.duration = duration;
|
||||||
transition.delay = delay;
|
transition.delay = delay;
|
||||||
|
|
||||||
return transition;
|
return transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constants indicating the visibility of different map ornaments.
|
Constants indicating the visibility of different map ornaments.
|
||||||
*/
|
*/
|
||||||
typedef NS_ENUM(NSInteger, MLNOrnamentVisibility) {
|
typedef NS_ENUM(NSInteger, MLNOrnamentVisibility) {
|
||||||
/** A constant indicating that the ornament adapts to the current map state. */
|
/** A constant indicating that the ornament adapts to the current map state. */
|
||||||
MLNOrnamentVisibilityAdaptive,
|
MLNOrnamentVisibilityAdaptive,
|
||||||
/** A constant indicating that the ornament is always hidden. */
|
/** A constant indicating that the ornament is always hidden. */
|
||||||
MLNOrnamentVisibilityHidden,
|
MLNOrnamentVisibilityHidden,
|
||||||
/** A constant indicating that the ornament is always visible. */
|
/** A constant indicating that the ornament is always visible. */
|
||||||
MLNOrnamentVisibilityVisible
|
MLNOrnamentVisibilityVisible
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -6,44 +6,32 @@
|
|||||||
Recursively transforms a C++ type into the corresponding Foundation type.
|
Recursively transforms a C++ type into the corresponding Foundation type.
|
||||||
*/
|
*/
|
||||||
class ValueEvaluator {
|
class ValueEvaluator {
|
||||||
public:
|
public:
|
||||||
id operator()(const mbgl::NullValue &) const {
|
id operator()(const mbgl::NullValue &) const { return [NSNull null]; }
|
||||||
return [NSNull null];
|
|
||||||
}
|
|
||||||
|
|
||||||
id operator()(const bool &value) const {
|
id operator()(const bool &value) const { return value ? @YES : @NO; }
|
||||||
return value ? @YES : @NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
id operator()(const uint64_t &value) const {
|
id operator()(const uint64_t &value) const { return @(value); }
|
||||||
return @(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
id operator()(const int64_t &value) const {
|
id operator()(const int64_t &value) const { return @(value); }
|
||||||
return @(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
id operator()(const double &value) const {
|
id operator()(const double &value) const { return @(value); }
|
||||||
return @(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
id operator()(const std::string &value) const {
|
id operator()(const std::string &value) const { return @(value.c_str()); }
|
||||||
return @(value.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
id operator()(const std::vector<mbgl::Value> &values) const {
|
id operator()(const std::vector<mbgl::Value> &values) const {
|
||||||
NSMutableArray *objects = [NSMutableArray arrayWithCapacity:values.size()];
|
NSMutableArray *objects = [NSMutableArray arrayWithCapacity:values.size()];
|
||||||
for (const auto &v : values) {
|
for (const auto &v : values) {
|
||||||
[objects addObject:mbgl::Value::visit(v, *this)];
|
[objects addObject:mbgl::Value::visit(v, *this)];
|
||||||
}
|
|
||||||
return objects;
|
|
||||||
}
|
}
|
||||||
|
return objects;
|
||||||
|
}
|
||||||
|
|
||||||
id operator()(const std::unordered_map<std::string, mbgl::Value> &items) const {
|
id operator()(const std::unordered_map<std::string, mbgl::Value> &items) const {
|
||||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithCapacity:items.size()];
|
NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithCapacity:items.size()];
|
||||||
for (auto &item : items) {
|
for (auto &item : items) {
|
||||||
attributes[@(item.first.c_str())] = mbgl::Value::visit(item.second, *this);
|
attributes[@(item.first.c_str())] = mbgl::Value::visit(item.second, *this);
|
||||||
}
|
|
||||||
return attributes;
|
|
||||||
}
|
}
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
|
||||||
#import "MLNForegroundStyleLayer.h"
|
#import "MLNForegroundStyleLayer.h"
|
||||||
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ MLN_EXPORT
|
|||||||
comes from the style, its predicate corresponds to the
|
comes from the style, its predicate corresponds to the
|
||||||
<a href="https://maplibre.org/maplibre-style-spec/#layer-filter">`filter`</a>
|
<a href="https://maplibre.org/maplibre-style-spec/#layer-filter">`filter`</a>
|
||||||
property in the style JSON.
|
property in the style JSON.
|
||||||
|
|
||||||
See the “<a href="../predicates-and-expressions.html">Predicates and Expressions</a>”
|
See the “<a href="../predicates-and-expressions.html">Predicates and Expressions</a>”
|
||||||
guide for details about the predicate syntax supported by this class.
|
guide for details about the predicate syntax supported by this class.
|
||||||
|
|
||||||
@@ -47,8 +47,8 @@ MLN_EXPORT
|
|||||||
```swift
|
```swift
|
||||||
let layer = MLNLineStyleLayer(identifier: "contour", source: terrain)
|
let layer = MLNLineStyleLayer(identifier: "contour", source: terrain)
|
||||||
layer.sourceLayerIdentifier = "contours"
|
layer.sourceLayerIdentifier = "contours"
|
||||||
layer.predicate = NSPredicate(format: "(index == 5 || index == 10) && CAST(ele, 'NSNumber') >= 1500.0")
|
layer.predicate = NSPredicate(format: "(index == 5 || index == 10) && CAST(ele, 'NSNumber') >=
|
||||||
mapView.style?.addLayer(layer)
|
1500.0") mapView.style?.addLayer(layer)
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, nullable) NSPredicate *predicate;
|
@property (nonatomic, nullable) NSPredicate *predicate;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
A vector tile source is added to an `MLNStyle` object along with one or more
|
A vector tile source is added to an `MLNStyle` object along with one or more
|
||||||
`MLNVectorStyleLayer` objects. A vector style layer defines the appearance of
|
`MLNVectorStyleLayer` objects. A vector style layer defines the appearance of
|
||||||
any content supplied by the vector tile source.
|
any content supplied by the vector tile source.
|
||||||
|
|
||||||
`MLNVectorTileSource` is optimized for data sets that are too large to fit
|
`MLNVectorTileSource` is optimized for data sets that are too large to fit
|
||||||
completely in memory, such as vector tile sets or data sets managed in
|
completely in memory, such as vector tile sets or data sets managed in
|
||||||
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a>. For
|
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a>. For
|
||||||
@@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
(<var>extent</var> × 2) − 1, inclusive. Any vector style
|
(<var>extent</var> × 2) − 1, inclusive. Any vector style
|
||||||
layer initialized with a vector tile source must have a non-`nil` value in its
|
layer initialized with a vector tile source must have a non-`nil` value in its
|
||||||
`sourceLayerIdentifier` property.
|
`sourceLayerIdentifier` property.
|
||||||
|
|
||||||
Commonly used vector tile sources include
|
Commonly used vector tile sources include
|
||||||
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets</a>,
|
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets</a>,
|
||||||
<a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a>,
|
<a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a>,
|
||||||
@@ -44,16 +44,17 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
### Example
|
### Example
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
let source = MLNVectorTileSource(identifier: "pois", tileURLTemplates: ["https://example.com/vector-tiles/{z}/{x}/{y}.mvt"], options: [
|
let source = MLNVectorTileSource(identifier: "pois", tileURLTemplates:
|
||||||
.minimumZoomLevel: 9,
|
["https://example.com/vector-tiles/{z}/{x}/{y}.mvt"], options: [ .minimumZoomLevel: 9,
|
||||||
.maximumZoomLevel: 16,
|
.maximumZoomLevel: 16,
|
||||||
.attributionInfos: [
|
.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)
|
mapView.style?.addSource(source)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Data-driven circles, learn how to add data to your map using
|
TODO: Data-driven circles, learn how to add data to your map using
|
||||||
an `MLNVectorTileSource` object.
|
an `MLNVectorTileSource` object.
|
||||||
@@ -80,7 +81,8 @@ MLN_EXPORT
|
|||||||
source’s contents and other metadata.
|
source’s contents and other metadata.
|
||||||
@return An initialized vector tile source.
|
@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
|
Returns a vector tile source initialized an identifier, tile URL templates, and
|
||||||
@@ -102,7 +104,10 @@ MLN_EXPORT
|
|||||||
the default values.
|
the default values.
|
||||||
@return An initialized tile source.
|
@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
|
// MARK: Accessing a Source’s Content
|
||||||
|
|
||||||
@@ -123,7 +128,7 @@ MLN_EXPORT
|
|||||||
includes those parts of the road that lie within the map tiles that the source
|
includes those parts of the road that lie within the map tiles that the source
|
||||||
has loaded, even if the road extends into other tiles. The portion of the road
|
has loaded, even if the road extends into other tiles. The portion of the road
|
||||||
within each map tile is included individually.
|
within each map tile is included individually.
|
||||||
|
|
||||||
Returned features may not necessarily be visible to the user at the time they
|
Returned features may not necessarily be visible to the user at the time they
|
||||||
are loaded: the style may contain a layer that forces the source’s tiles to
|
are loaded: the style may contain a layer that forces the source’s tiles to
|
||||||
load but filters out the features in question, preventing them from being
|
load but filters out the features in question, preventing them from being
|
||||||
@@ -141,7 +146,10 @@ MLN_EXPORT
|
|||||||
@return An array of objects conforming to the `MLNFeature` protocol that
|
@return An array of objects conforming to the `MLNFeature` protocol that
|
||||||
represent features loaded by the source that match the predicate.
|
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
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
+ (NSSet<NSString *> *)mapboxStreetsLanguages;
|
+ (NSSet<NSString *> *)mapboxStreetsLanguages;
|
||||||
|
|
||||||
+ (nullable NSString *)preferredMapboxStreetsLanguage;
|
+ (nullable NSString *)preferredMapboxStreetsLanguage;
|
||||||
+ (nullable NSString *)preferredMapboxStreetsLanguageForPreferences:(NSArray<NSString *> *)preferencesArray;
|
+ (nullable NSString *)preferredMapboxStreetsLanguageForPreferences:
|
||||||
|
(NSArray<NSString *> *)preferencesArray;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import <mbgl/util/feature.hpp>
|
#import <mbgl/util/feature.hpp>
|
||||||
|
|
||||||
@@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
- (std::vector<mbgl::Value>)mgl_vector;
|
- (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;
|
- (NSAttributedString *)mgl_attributedComponentsJoinedByString:(NSString *)separator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,15 +17,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
#undef NSLocalizedString
|
#undef NSLocalizedString
|
||||||
#define NSLocalizedString(key, comment) \
|
#define NSLocalizedString(key, comment) \
|
||||||
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:@"" table:nil]
|
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:@"" table:nil]
|
||||||
|
|
||||||
#undef NSLocalizedStringFromTable
|
#undef NSLocalizedStringFromTable
|
||||||
#define NSLocalizedStringFromTable(key, tbl, comment) \
|
#define NSLocalizedStringFromTable(key, tbl, comment) \
|
||||||
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
|
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
|
||||||
|
|
||||||
#undef NSLocalizedStringWithDefaultValue
|
#undef NSLocalizedStringWithDefaultValue
|
||||||
#define NSLocalizedStringWithDefaultValue(key, tbl, bundle, val, comment) \
|
#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;
|
FOUNDATION_EXTERN MLN_EXPORT MLNExceptionName const MLNBundleNotFoundException;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreLocation/CoreLocation.h>
|
#import <CoreLocation/CoreLocation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import <mbgl/util/feature.hpp>
|
#import <mbgl/util/feature.hpp>
|
||||||
|
|
||||||
@@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
- (CLLocationCoordinate2D)decodeMLNCoordinateForKey:(NSString *)key;
|
- (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;
|
- (std::vector<CLLocationCoordinate2D>)mgl_decodeLocationCoordinates2DForKey:(NSString *)key;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "MLNFoundation.h"
|
|
||||||
#include <mbgl/util/chrono.hpp>
|
#include <mbgl/util/chrono.hpp>
|
||||||
|
#import "MLNFoundation.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
|
||||||
/// Converts from a duration in seconds to a duration object usable in mbgl.
|
/// Converts from a duration in seconds to a duration object usable in mbgl.
|
||||||
MLN_EXPORT
|
MLN_EXPORT
|
||||||
mbgl::Duration MLNDurationFromTimeInterval(NSTimeInterval duration);
|
mbgl::Duration MLNDurationFromTimeInterval(NSTimeInterval duration);
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "MLNLoggingConfiguration_Private.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>
|
#import <Foundation/Foundation.h>
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#else
|
#else
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#import "MLNTypes.h"
|
#import "MLNTypes.h"
|
||||||
@@ -15,30 +15,36 @@ typedef NSString *MLNExpressionInterpolationMode NS_TYPED_ENUM;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
An `NSString` identifying the `linear` interpolation type in an `NSExpression`.
|
An `NSString` identifying the `linear` interpolation type in an `NSExpression`.
|
||||||
|
|
||||||
This attribute corresponds to the `linear` value in the
|
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.
|
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`.
|
An `NSString` identifying the `expotential` interpolation type in an `NSExpression`.
|
||||||
|
|
||||||
This attribute corresponds to the `exponential` value in the
|
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.
|
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`.
|
An `NSString` identifying the `cubic-bezier` interpolation type in an `NSExpression`.
|
||||||
|
|
||||||
This attribute corresponds to the `cubic-bezier` value in the
|
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.
|
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
|
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
|
`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.
|
expression operator in the MapLibre Style Spec.
|
||||||
*/
|
*/
|
||||||
@property (class, nonatomic, readonly) NSExpression *heatmapDensityVariableExpression;
|
@property (class, nonatomic, readonly) NSExpression *heatmapDensityVariableExpression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
`NSExpression` variable that corresponds to the
|
`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.
|
expression operator in the MapLibre Style Spec.
|
||||||
*/
|
*/
|
||||||
@property (class, nonatomic, readonly) NSExpression *lineProgressVariableExpression;
|
@property (class, nonatomic, readonly) NSExpression *lineProgressVariableExpression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
`NSExpression` variable that corresponds to the
|
`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.
|
expression operator in the MapLibre Style Spec.
|
||||||
*/
|
*/
|
||||||
@property (class, nonatomic, readonly) NSExpression *geometryTypeVariableExpression;
|
@property (class, nonatomic, readonly) NSExpression *geometryTypeVariableExpression;
|
||||||
@@ -93,103 +102,124 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
`NSExpression` variable that corresponds to the
|
`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.
|
expression operator in the MapLibre Style Spec.
|
||||||
*/
|
*/
|
||||||
@property (class, nonatomic, readonly) NSExpression *featureAttributesVariableExpression;
|
@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
|
// MARK: Creating Conditional Expressions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a conditional function expression specifying the string predicate, and
|
Returns a conditional function expression specifying the string predicate, and
|
||||||
expressions for each condition.
|
expressions for each condition.
|
||||||
|
|
||||||
@param conditionPredicate The predicate to get evaluated.
|
@param conditionPredicate The predicate to get evaluated.
|
||||||
@param trueExpression The expression for conditions equal to true.
|
@param trueExpression The expression for conditions equal to true.
|
||||||
@param falseExpression The expression for conditions equal to false.
|
@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
|
// MARK: Creating Ramp, Scale, and Curve Expressions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a step function expression specifying the stepping, from expression
|
Returns a step function expression specifying the stepping, from expression
|
||||||
and stops.
|
and stops.
|
||||||
|
|
||||||
@param steppingExpression The stepping expression.
|
@param steppingExpression The stepping expression.
|
||||||
@param minimumExpression The expression which could be a constant or function expression.
|
@param minimumExpression The expression which could be a constant or function expression.
|
||||||
@param stops The stops must be an `NSDictionary` constant `NSExpression`.
|
@param stops The stops must be an `NSDictionary` constant `NSExpression`.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Data-driven circles
|
TODO: Data-driven circles
|
||||||
TODO: Cluster point data
|
TODO: Cluster point data
|
||||||
TODO: Use images to cluster point data
|
TODO: Use images to cluster point data
|
||||||
Learn how to use this expression to style a map layer based on an attribute value.
|
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,
|
Returns an interpolated function expression specifying the function operator, curve type,
|
||||||
parameters and steps.
|
parameters and steps.
|
||||||
|
|
||||||
@param inputExpression The interpolating expression input.
|
@param inputExpression The interpolating expression input.
|
||||||
@param curveType The curve type could be `MLNExpressionInterpolationModeLinear`,
|
@param curveType The curve type could be `MLNExpressionInterpolationModeLinear`,
|
||||||
`MLNExpressionInterpolationModeExponential` and
|
`MLNExpressionInterpolationModeExponential` and
|
||||||
`MLNExpressionInterpolationModeCubicBezier`.
|
`MLNExpressionInterpolationModeCubicBezier`.
|
||||||
@param parameters The parameters expression.
|
@param parameters The parameters expression.
|
||||||
@param stops The stops expression.
|
@param stops The stops expression.
|
||||||
|
|
||||||
#### Related examples
|
#### Related examples
|
||||||
TODO: Create a heatmap layer, learn how to style an `MLNHeatmapStyleLayer`
|
TODO: Create a heatmap layer, learn how to style an `MLNHeatmapStyleLayer`
|
||||||
based on zoom level and point density with this expression.
|
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,
|
Returns a match function expression specifying the input, matching values,
|
||||||
and default value.
|
and default value.
|
||||||
|
|
||||||
@param inputExpression The matching expression.
|
@param inputExpression The matching expression.
|
||||||
@param matchedExpressions The matched values expression dictionary must be condition : value.
|
@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.
|
@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
|
Returns an attributed function expression specifying an `MLNAttributedExpression` constant
|
||||||
expression array.
|
expression array.
|
||||||
|
|
||||||
@param attributedExpressions The `MLNAttributedExpression` constant expression array.
|
@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
|
// MARK: Concatenating String Expressions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a constant expression appending the passed expression.
|
Returns a constant expression appending the passed expression.
|
||||||
|
|
||||||
@note Both the receiver and the given expression must be an `NSString` constant
|
@note Both the receiver and the given expression must be an `NSString` constant
|
||||||
expression type; otherwise, an exception is rised.
|
expression type; otherwise, an exception is rised.
|
||||||
|
|
||||||
@param expression The expression to append to the receiver.
|
@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
|
// MARK: Converting JSON Expressions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns an expression equivalent to the given Foundation object deserialized
|
Returns an expression equivalent to the given Foundation object deserialized
|
||||||
from JSON data.
|
from JSON data.
|
||||||
|
|
||||||
The Foundation object is interpreted according to the
|
The Foundation object is interpreted according to the
|
||||||
[MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/expressions/).
|
[MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/expressions/).
|
||||||
See the
|
See the
|
||||||
“[Information for Style Authors](../for-style-authors.html#setting-attribute-values)”
|
“[Information for Style Authors](../for-style-authors.html#setting-attribute-values)”
|
||||||
guide for a correspondence of operators and types between the style
|
guide for a correspondence of operators and types between the style
|
||||||
specification and the `NSExpression` representation used by this SDK.
|
specification and the `NSExpression` representation used by this SDK.
|
||||||
|
|
||||||
@param object A Foundation object deserialized from JSON data, for example
|
@param object A Foundation object deserialized from JSON data, for example
|
||||||
using `NSJSONSerialization`.
|
using `NSJSONSerialization`.
|
||||||
@return An initialized expression equivalent to `object`, suitable for use as
|
@return An initialized expression equivalent to `object`, suitable for use as
|
||||||
@@ -199,14 +229,14 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
An equivalent Foundation object that can be serialized as JSON.
|
An equivalent Foundation object that can be serialized as JSON.
|
||||||
|
|
||||||
The Foundation object conforms to the
|
The Foundation object conforms to the
|
||||||
[MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/expressions/).
|
[MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/expressions/).
|
||||||
See the
|
See the
|
||||||
“[Information for Style Authors](../for-style-authors.html#setting-attribute-values)”
|
“[Information for Style Authors](../for-style-authors.html#setting-attribute-values)”
|
||||||
guide for a correspondence of operators and types between the style
|
guide for a correspondence of operators and types between the style
|
||||||
specification and the `NSExpression` representation used by this SDK.
|
specification and the `NSExpression` representation used by this SDK.
|
||||||
|
|
||||||
You can use `NSJSONSerialization` to serialize the Foundation object as data to
|
You can use `NSJSONSerialization` to serialize the Foundation object as data to
|
||||||
write to a file.
|
write to a file.
|
||||||
*/
|
*/
|
||||||
@@ -216,14 +246,14 @@ FOUNDATION_EXTERN MLN_EXPORT const MLNExpressionInterpolationMode MLNExpressionI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a copy of the receiver localized into the given locale.
|
Returns a copy of the receiver localized into the given locale.
|
||||||
|
|
||||||
This method assumes the receiver refers to the feature attributes that are
|
This method assumes the receiver refers to the feature attributes that are
|
||||||
available in vector tiles supplied by the
|
available in vector tiles supplied by the
|
||||||
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets-v8/#overview">Mapbox Streets source</a>.
|
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets-v8/#overview">Mapbox Streets
|
||||||
On iOS, the user can set the system’s preferred language in Settings, General
|
source</a>. On iOS, the user can set the system’s preferred language in Settings, General Settings,
|
||||||
Settings, Language & Region. On macOS, the user can set the system’s preferred
|
Language & Region. On macOS, the user can set the system’s preferred language in the Language &
|
||||||
language in the Language & Region pane of System Preferences.
|
Region pane of System Preferences.
|
||||||
|
|
||||||
@param locale The locale into which labels should be localized. To use the
|
@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
|
system’s preferred language, if supported, specify `nil`. To use the local
|
||||||
language, specify a locale with the identifier `mul`.
|
language, specify a locale with the identifier `mul`.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#else
|
#else
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#import "NSExpression+MLNAdditions.h"
|
#import "NSExpression+MLNAdditions.h"
|
||||||
@@ -14,7 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@interface NSObject (MLNExpressionAdditions)
|
@interface NSObject (MLNExpressionAdditions)
|
||||||
|
|
||||||
- (nullable NSNumber *)mgl_number;
|
- (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
|
@end
|
||||||
|
|
||||||
@@ -43,7 +44,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface NSNumber (MLNExpressionAdditions)
|
@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;
|
- (id)mgl_stepWithMinimum:(id)minimum stops:(NSDictionary<NSNumber *, id> *)stops;
|
||||||
|
|
||||||
@property (nonatomic, readonly) id mgl_jsonExpressionObject;
|
@property (nonatomic, readonly) id mgl_jsonExpressionObject;
|
||||||
@@ -74,7 +77,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
- (NSExpression *)mgl_expressionWithContext:(NSDictionary<NSString *, NSExpression *> *)context;
|
- (NSExpression *)mgl_expressionWithContext:(NSDictionary<NSString *, NSExpression *> *)context;
|
||||||
|
|
||||||
|
|
||||||
- (id)mgl_has:(id)element;
|
- (id)mgl_has:(id)element;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
Returns a predicate equivalent to the given Foundation object deserialized
|
Returns a predicate equivalent to the given Foundation object deserialized
|
||||||
from JSON data.
|
from JSON data.
|
||||||
|
|
||||||
The Foundation object is interpreted according to the
|
The Foundation object is interpreted according to the
|
||||||
[MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/expressions/).
|
[MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/expressions/).
|
||||||
See the
|
See the
|
||||||
“[Predicates and Expressions](../predicates-and-expressions.html)”
|
“[Predicates and Expressions](../predicates-and-expressions.html)”
|
||||||
guide for a correspondence of operators and types between the style
|
guide for a correspondence of operators and types between the style
|
||||||
specification and the `NSPredicate` representation used by this SDK.
|
specification and the `NSPredicate` representation used by this SDK.
|
||||||
|
|
||||||
@param object A Foundation object deserialized from JSON data, for example
|
@param object A Foundation object deserialized from JSON data, for example
|
||||||
using `NSJSONSerialization`.
|
using `NSJSONSerialization`.
|
||||||
@return An initialized predicate equivalent to `object`, suitable for use
|
@return An initialized predicate equivalent to `object`, suitable for use
|
||||||
@@ -26,14 +26,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
An equivalent Foundation object that can be serialized as JSON.
|
An equivalent Foundation object that can be serialized as JSON.
|
||||||
|
|
||||||
The Foundation object conforms to the
|
The Foundation object conforms to the
|
||||||
[MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/expressions/).
|
[MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/expressions/).
|
||||||
See the
|
See the
|
||||||
“[Predicates and Expressions](../predicates-and-expressions.html)”
|
“[Predicates and Expressions](../predicates-and-expressions.html)”
|
||||||
guide for a correspondence of operators and types between the style
|
guide for a correspondence of operators and types between the style
|
||||||
specification and the `NSPredicate` representation used by this SDK.
|
specification and the `NSPredicate` representation used by this SDK.
|
||||||
|
|
||||||
You can use `NSJSONSerialization` to serialize the Foundation object as data to
|
You can use `NSJSONSerialization` to serialize the Foundation object as data to
|
||||||
write to a file.
|
write to a file.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (readonly) MLNCoordinateBounds MLNCoordinateBoundsValue;
|
@property (readonly) MLNCoordinateBounds MLNCoordinateBoundsValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a new value object containing the specified Mapbox coordinate
|
Creates a new value object containing the specified Mapbox coordinate
|
||||||
quad structure.
|
quad structure.
|
||||||
|
|
||||||
@param quad The value for the new object.
|
@param quad The value for the new object.
|
||||||
@@ -104,7 +104,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
Creates a new value object containing the given `MLNTransition`
|
Creates a new value object containing the given `MLNTransition`
|
||||||
structure.
|
structure.
|
||||||
|
|
||||||
@param transition The value for the new object.
|
@param transition The value for the new object.
|
||||||
@return A new value object that contains the transition information.
|
@return A new value object that contains the transition information.
|
||||||
*/
|
*/
|
||||||
@@ -118,7 +118,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
Creates a new value object containing the given `MLNSphericalPosition`
|
Creates a new value object containing the given `MLNSphericalPosition`
|
||||||
structure.
|
structure.
|
||||||
|
|
||||||
@param lightPosition The value for the new object.
|
@param lightPosition The value for the new object.
|
||||||
@return A new value object that contains the light position information.
|
@return A new value object that contains the light position information.
|
||||||
*/
|
*/
|
||||||
@@ -132,7 +132,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
Creates a new value object containing the given `MLNLightAnchor`
|
Creates a new value object containing the given `MLNLightAnchor`
|
||||||
enum.
|
enum.
|
||||||
|
|
||||||
@param lightAnchor The value for the new object.
|
@param lightAnchor The value for the new object.
|
||||||
@return A new value object that contains the light anchor information.
|
@return A new value object that contains the light anchor information.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,17 +13,7 @@ public:
|
|||||||
: task(std::move(fn)),
|
: task(std::move(fn)),
|
||||||
loop(CFRunLoopGetCurrent()) {
|
loop(CFRunLoopGetCurrent()) {
|
||||||
CFRunLoopSourceContext context = {
|
CFRunLoopSourceContext context = {
|
||||||
0,
|
0, this, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, perform};
|
||||||
this,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
perform
|
|
||||||
};
|
|
||||||
source = CFRunLoopSourceCreate(kCFAllocatorDefault, 0, &context);
|
source = CFRunLoopSourceCreate(kCFAllocatorDefault, 0, &context);
|
||||||
CFRunLoopAddSource(loop, source, kCFRunLoopCommonModes);
|
CFRunLoopAddSource(loop, source, kCFRunLoopCommonModes);
|
||||||
}
|
}
|
||||||
@@ -46,9 +36,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void perform(void* info) {
|
static void perform(void* info) { reinterpret_cast<Impl*>(info)->runTask(); }
|
||||||
reinterpret_cast<Impl*>(info)->runTask();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::function<void()> task;
|
std::function<void()> task;
|
||||||
std::atomic_flag queued = ATOMIC_FLAG_INIT;
|
std::atomic_flag queued = ATOMIC_FLAG_INIT;
|
||||||
@@ -58,8 +46,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
AsyncTask::AsyncTask(std::function<void()>&& fn)
|
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;
|
AsyncTask::~AsyncTask() = default;
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,17 @@
|
|||||||
#include "TargetConditionals.h"
|
#include "TargetConditionals.h"
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
#include <OpenGLES/ES3/gl.h>
|
#include <OpenGLES/ES3/gl.h>
|
||||||
#include <OpenGLES/ES3/glext.h>
|
#include <OpenGLES/ES3/glext.h>
|
||||||
#elif TARGET_OS_SIMULATOR
|
#elif TARGET_OS_SIMULATOR
|
||||||
#include <OpenGLES/ES3/gl.h>
|
#include <OpenGLES/ES3/gl.h>
|
||||||
#include <OpenGLES/ES3/glext.h>
|
#include <OpenGLES/ES3/glext.h>
|
||||||
#elif TARGET_OS_MAC
|
#elif TARGET_OS_MAC
|
||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
#include <OpenGL/gl3.h>
|
#include <OpenGL/gl3.h>
|
||||||
#include <OpenGL/gl3ext.h>
|
#include <OpenGL/gl3ext.h>
|
||||||
#else
|
#else
|
||||||
#error Unsupported Apple platform
|
#error Unsupported Apple platform
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
@@ -21,258 +21,276 @@ namespace platform {
|
|||||||
|
|
||||||
/* OpenGL ES 2.0 */
|
/* OpenGL ES 2.0 */
|
||||||
|
|
||||||
void (* const glActiveTexture)(GLenum) = ::glActiveTexture;
|
void (*const glActiveTexture)(GLenum) = ::glActiveTexture;
|
||||||
void (* const glAttachShader)(GLuint, GLuint) = ::glAttachShader;
|
void (*const glAttachShader)(GLuint, GLuint) = ::glAttachShader;
|
||||||
void (* const glBindAttribLocation)(GLuint, GLuint, const GLchar *) = ::glBindAttribLocation;
|
void (*const glBindAttribLocation)(GLuint, GLuint, const GLchar*) = ::glBindAttribLocation;
|
||||||
void (* const glBindBuffer)(GLenum, GLuint) = ::glBindBuffer;
|
void (*const glBindBuffer)(GLenum, GLuint) = ::glBindBuffer;
|
||||||
void (* const glBindFramebuffer)(GLenum, GLuint) = ::glBindFramebuffer;
|
void (*const glBindFramebuffer)(GLenum, GLuint) = ::glBindFramebuffer;
|
||||||
void (* const glBindRenderbuffer)(GLenum, GLuint) = ::glBindRenderbuffer;
|
void (*const glBindRenderbuffer)(GLenum, GLuint) = ::glBindRenderbuffer;
|
||||||
void (* const glBindTexture)(GLenum, GLuint) = ::glBindTexture;
|
void (*const glBindTexture)(GLenum, GLuint) = ::glBindTexture;
|
||||||
void (* const glBlendColor)(GLfloat, GLfloat, GLfloat, GLfloat) = ::glBlendColor;
|
void (*const glBlendColor)(GLfloat, GLfloat, GLfloat, GLfloat) = ::glBlendColor;
|
||||||
void (* const glBlendEquation)(GLenum) = ::glBlendEquation;
|
void (*const glBlendEquation)(GLenum) = ::glBlendEquation;
|
||||||
void (* const glBlendEquationSeparate)(GLenum, GLenum) = ::glBlendEquationSeparate;
|
void (*const glBlendEquationSeparate)(GLenum, GLenum) = ::glBlendEquationSeparate;
|
||||||
void (* const glBlendFunc)(GLenum, GLenum) = ::glBlendFunc;
|
void (*const glBlendFunc)(GLenum, GLenum) = ::glBlendFunc;
|
||||||
void (* const glBlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum) = ::glBlendFuncSeparate;
|
void (*const glBlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum) = ::glBlendFuncSeparate;
|
||||||
void (* const glBufferData)(GLenum, GLsizeiptr, const void *, GLenum) = ::glBufferData;
|
void (*const glBufferData)(GLenum, GLsizeiptr, const void*, GLenum) = ::glBufferData;
|
||||||
void (* const glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const void *) = ::glBufferSubData;
|
void (*const glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const void*) = ::glBufferSubData;
|
||||||
GLenum (* const glCheckFramebufferStatus)(GLenum) = ::glCheckFramebufferStatus;
|
GLenum (*const glCheckFramebufferStatus)(GLenum) = ::glCheckFramebufferStatus;
|
||||||
void (* const glClear)(GLbitfield) = ::glClear;
|
void (*const glClear)(GLbitfield) = ::glClear;
|
||||||
void (* const glClearColor)(GLfloat, GLfloat, GLfloat, GLfloat) = ::glClearColor;
|
void (*const glClearColor)(GLfloat, GLfloat, GLfloat, GLfloat) = ::glClearColor;
|
||||||
void (* const glClearDepthf)(GLfloat) = ::glClearDepthf;
|
void (*const glClearDepthf)(GLfloat) = ::glClearDepthf;
|
||||||
void (* const glClearStencil)(GLint) = ::glClearStencil;
|
void (*const glClearStencil)(GLint) = ::glClearStencil;
|
||||||
void (* const glColorMask)(GLboolean, GLboolean, GLboolean, GLboolean) = ::glColorMask;
|
void (*const glColorMask)(GLboolean, GLboolean, GLboolean, GLboolean) = ::glColorMask;
|
||||||
void (* const glCompileShader)(GLuint) = ::glCompileShader;
|
void (*const glCompileShader)(GLuint) = ::glCompileShader;
|
||||||
void (* const glCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *) = ::glCompressedTexImage2D;
|
void (*const glCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*) =
|
||||||
void (* const glCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *) = ::glCompressedTexSubImage2D;
|
::glCompressedTexImage2D;
|
||||||
void (* const glCopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) = ::glCopyTexImage2D;
|
void (*const glCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void*) =
|
||||||
void (* const glCopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) = ::glCopyTexSubImage2D;
|
::glCompressedTexSubImage2D;
|
||||||
GLuint (* const glCreateProgram)() = ::glCreateProgram;
|
void (*const glCopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) = ::glCopyTexImage2D;
|
||||||
GLuint (* const glCreateShader)(GLenum) = ::glCreateShader;
|
void (*const glCopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) = ::glCopyTexSubImage2D;
|
||||||
void (* const glCullFace)(GLenum) = ::glCullFace;
|
GLuint (*const glCreateProgram)() = ::glCreateProgram;
|
||||||
void (* const glDeleteBuffers)(GLsizei, const GLuint *) = ::glDeleteBuffers;
|
GLuint (*const glCreateShader)(GLenum) = ::glCreateShader;
|
||||||
void (* const glDeleteFramebuffers)(GLsizei, const GLuint *) = ::glDeleteFramebuffers;
|
void (*const glCullFace)(GLenum) = ::glCullFace;
|
||||||
void (* const glDeleteProgram)(GLuint) = ::glDeleteProgram;
|
void (*const glDeleteBuffers)(GLsizei, const GLuint*) = ::glDeleteBuffers;
|
||||||
void (* const glDeleteRenderbuffers)(GLsizei, const GLuint *) = ::glDeleteRenderbuffers;
|
void (*const glDeleteFramebuffers)(GLsizei, const GLuint*) = ::glDeleteFramebuffers;
|
||||||
void (* const glDeleteShader)(GLuint) = ::glDeleteShader;
|
void (*const glDeleteProgram)(GLuint) = ::glDeleteProgram;
|
||||||
void (* const glDeleteTextures)(GLsizei, const GLuint *) = ::glDeleteTextures;
|
void (*const glDeleteRenderbuffers)(GLsizei, const GLuint*) = ::glDeleteRenderbuffers;
|
||||||
void (* const glDepthFunc)(GLenum) = ::glDepthFunc;
|
void (*const glDeleteShader)(GLuint) = ::glDeleteShader;
|
||||||
void (* const glDepthMask)(GLboolean) = ::glDepthMask;
|
void (*const glDeleteTextures)(GLsizei, const GLuint*) = ::glDeleteTextures;
|
||||||
void (* const glDepthRangef)(GLfloat, GLfloat) = ::glDepthRangef;
|
void (*const glDepthFunc)(GLenum) = ::glDepthFunc;
|
||||||
void (* const glDetachShader)(GLuint, GLuint) = ::glDetachShader;
|
void (*const glDepthMask)(GLboolean) = ::glDepthMask;
|
||||||
void (* const glDisable)(GLenum) = ::glDisable;
|
void (*const glDepthRangef)(GLfloat, GLfloat) = ::glDepthRangef;
|
||||||
void (* const glDisableVertexAttribArray)(GLuint) = ::glDisableVertexAttribArray;
|
void (*const glDetachShader)(GLuint, GLuint) = ::glDetachShader;
|
||||||
void (* const glDrawArrays)(GLenum, GLint, GLsizei) = ::glDrawArrays;
|
void (*const glDisable)(GLenum) = ::glDisable;
|
||||||
void (* const glDrawElements)(GLenum, GLsizei, GLenum, const void *) = ::glDrawElements;
|
void (*const glDisableVertexAttribArray)(GLuint) = ::glDisableVertexAttribArray;
|
||||||
void (* const glEnable)(GLenum) = ::glEnable;
|
void (*const glDrawArrays)(GLenum, GLint, GLsizei) = ::glDrawArrays;
|
||||||
void (* const glEnableVertexAttribArray)(GLuint) = ::glEnableVertexAttribArray;
|
void (*const glDrawElements)(GLenum, GLsizei, GLenum, const void*) = ::glDrawElements;
|
||||||
void (* const glFinish)() = ::glFinish;
|
void (*const glEnable)(GLenum) = ::glEnable;
|
||||||
void (* const glFlush)() = ::glFlush;
|
void (*const glEnableVertexAttribArray)(GLuint) = ::glEnableVertexAttribArray;
|
||||||
void (* const glFramebufferRenderbuffer)(GLenum, GLenum, GLenum, GLuint) = ::glFramebufferRenderbuffer;
|
void (*const glFinish)() = ::glFinish;
|
||||||
void (* const glFramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint) = ::glFramebufferTexture2D;
|
void (*const glFlush)() = ::glFlush;
|
||||||
void (* const glFrontFace)(GLenum) = ::glFrontFace;
|
void (*const glFramebufferRenderbuffer)(GLenum, GLenum, GLenum, GLuint) = ::glFramebufferRenderbuffer;
|
||||||
void (* const glGenBuffers)(GLsizei, GLuint *) = ::glGenBuffers;
|
void (*const glFramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint) = ::glFramebufferTexture2D;
|
||||||
void (* const glGenerateMipmap)(GLenum) = ::glGenerateMipmap;
|
void (*const glFrontFace)(GLenum) = ::glFrontFace;
|
||||||
void (* const glGenFramebuffers)(GLsizei, GLuint *) = ::glGenFramebuffers;
|
void (*const glGenBuffers)(GLsizei, GLuint*) = ::glGenBuffers;
|
||||||
void (* const glGenRenderbuffers)(GLsizei, GLuint *) = ::glGenRenderbuffers;
|
void (*const glGenerateMipmap)(GLenum) = ::glGenerateMipmap;
|
||||||
void (* const glGenTextures)(GLsizei, GLuint *) = ::glGenTextures;
|
void (*const glGenFramebuffers)(GLsizei, GLuint*) = ::glGenFramebuffers;
|
||||||
void (* const glGetActiveAttrib)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *) = ::glGetActiveAttrib;
|
void (*const glGenRenderbuffers)(GLsizei, GLuint*) = ::glGenRenderbuffers;
|
||||||
void (* const glGetActiveUniform)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *) = ::glGetActiveUniform;
|
void (*const glGenTextures)(GLsizei, GLuint*) = ::glGenTextures;
|
||||||
void (* const glGetAttachedShaders)(GLuint, GLsizei, GLsizei *, GLuint *) = ::glGetAttachedShaders;
|
void (*const glGetActiveAttrib)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*) = ::glGetActiveAttrib;
|
||||||
GLint (* const glGetAttribLocation)(GLuint, const GLchar *) = ::glGetAttribLocation;
|
void (*const glGetActiveUniform)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*) = ::glGetActiveUniform;
|
||||||
void (* const glGetBooleanv)(GLenum, GLboolean *) = ::glGetBooleanv;
|
void (*const glGetAttachedShaders)(GLuint, GLsizei, GLsizei*, GLuint*) = ::glGetAttachedShaders;
|
||||||
void (* const glGetBufferParameteriv)(GLenum, GLenum, GLint *) = ::glGetBufferParameteriv;
|
GLint (*const glGetAttribLocation)(GLuint, const GLchar*) = ::glGetAttribLocation;
|
||||||
GLenum (* const glGetError)() = ::glGetError;
|
void (*const glGetBooleanv)(GLenum, GLboolean*) = ::glGetBooleanv;
|
||||||
void (* const glGetFloatv)(GLenum, GLfloat *) = ::glGetFloatv;
|
void (*const glGetBufferParameteriv)(GLenum, GLenum, GLint*) = ::glGetBufferParameteriv;
|
||||||
void (* const glGetFramebufferAttachmentParameteriv)(GLenum, GLenum, GLenum, GLint *) = ::glGetFramebufferAttachmentParameteriv;
|
GLenum (*const glGetError)() = ::glGetError;
|
||||||
void (* const glGetIntegerv)(GLenum, GLint *) = ::glGetIntegerv;
|
void (*const glGetFloatv)(GLenum, GLfloat*) = ::glGetFloatv;
|
||||||
void (* const glGetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *) = ::glGetProgramInfoLog;
|
void (*const glGetFramebufferAttachmentParameteriv)(GLenum,
|
||||||
void (* const glGetProgramiv)(GLuint, GLenum, GLint *) = ::glGetProgramiv;
|
GLenum,
|
||||||
void (* const glGetRenderbufferParameteriv)(GLenum, GLenum, GLint *) = ::glGetRenderbufferParameteriv;
|
GLenum,
|
||||||
void (* const glGetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *) = ::glGetShaderInfoLog;
|
GLint*) = ::glGetFramebufferAttachmentParameteriv;
|
||||||
void (* const glGetShaderiv)(GLuint, GLenum, GLint *) = ::glGetShaderiv;
|
void (*const glGetIntegerv)(GLenum, GLint*) = ::glGetIntegerv;
|
||||||
void (* const glGetShaderPrecisionFormat)(GLenum, GLenum, GLint *, GLint *) = ::glGetShaderPrecisionFormat;
|
void (*const glGetProgramInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*) = ::glGetProgramInfoLog;
|
||||||
void (* const glGetShaderSource)(GLuint, GLsizei, GLsizei *, GLchar *) = ::glGetShaderSource;
|
void (*const glGetProgramiv)(GLuint, GLenum, GLint*) = ::glGetProgramiv;
|
||||||
const GLubyte *(* const glGetString)(GLenum) = ::glGetString;
|
void (*const glGetRenderbufferParameteriv)(GLenum, GLenum, GLint*) = ::glGetRenderbufferParameteriv;
|
||||||
void (* const glGetTexParameterfv)(GLenum, GLenum, GLfloat *) = ::glGetTexParameterfv;
|
void (*const glGetShaderInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*) = ::glGetShaderInfoLog;
|
||||||
void (* const glGetTexParameteriv)(GLenum, GLenum, GLint *) = ::glGetTexParameteriv;
|
void (*const glGetShaderiv)(GLuint, GLenum, GLint*) = ::glGetShaderiv;
|
||||||
void (* const glGetUniformfv)(GLuint, GLint, GLfloat *) = ::glGetUniformfv;
|
void (*const glGetShaderPrecisionFormat)(GLenum, GLenum, GLint*, GLint*) = ::glGetShaderPrecisionFormat;
|
||||||
void (* const glGetUniformiv)(GLuint, GLint, GLint *) = ::glGetUniformiv;
|
void (*const glGetShaderSource)(GLuint, GLsizei, GLsizei*, GLchar*) = ::glGetShaderSource;
|
||||||
GLint (* const glGetUniformLocation)(GLuint, const GLchar *) = ::glGetUniformLocation;
|
const GLubyte* (*const glGetString)(GLenum) = ::glGetString;
|
||||||
void (* const glGetVertexAttribfv)(GLuint, GLenum, GLfloat *) = ::glGetVertexAttribfv;
|
void (*const glGetTexParameterfv)(GLenum, GLenum, GLfloat*) = ::glGetTexParameterfv;
|
||||||
void (* const glGetVertexAttribiv)(GLuint, GLenum, GLint *) = ::glGetVertexAttribiv;
|
void (*const glGetTexParameteriv)(GLenum, GLenum, GLint*) = ::glGetTexParameteriv;
|
||||||
void (* const glGetVertexAttribPointerv)(GLuint, GLenum, void **) = ::glGetVertexAttribPointerv;
|
void (*const glGetUniformfv)(GLuint, GLint, GLfloat*) = ::glGetUniformfv;
|
||||||
void (* const glHint)(GLenum, GLenum) = ::glHint;
|
void (*const glGetUniformiv)(GLuint, GLint, GLint*) = ::glGetUniformiv;
|
||||||
GLboolean (* const glIsBuffer)(GLuint) = ::glIsBuffer;
|
GLint (*const glGetUniformLocation)(GLuint, const GLchar*) = ::glGetUniformLocation;
|
||||||
GLboolean (* const glIsEnabled)(GLenum) = ::glIsEnabled;
|
void (*const glGetVertexAttribfv)(GLuint, GLenum, GLfloat*) = ::glGetVertexAttribfv;
|
||||||
GLboolean (* const glIsFramebuffer)(GLuint) = ::glIsFramebuffer;
|
void (*const glGetVertexAttribiv)(GLuint, GLenum, GLint*) = ::glGetVertexAttribiv;
|
||||||
GLboolean (* const glIsProgram)(GLuint) = ::glIsProgram;
|
void (*const glGetVertexAttribPointerv)(GLuint, GLenum, void**) = ::glGetVertexAttribPointerv;
|
||||||
GLboolean (* const glIsRenderbuffer)(GLuint) = ::glIsRenderbuffer;
|
void (*const glHint)(GLenum, GLenum) = ::glHint;
|
||||||
GLboolean (* const glIsShader)(GLuint) = ::glIsShader;
|
GLboolean (*const glIsBuffer)(GLuint) = ::glIsBuffer;
|
||||||
GLboolean (* const glIsTexture)(GLuint) = ::glIsTexture;
|
GLboolean (*const glIsEnabled)(GLenum) = ::glIsEnabled;
|
||||||
void (* const glLineWidth)(GLfloat) = ::glLineWidth;
|
GLboolean (*const glIsFramebuffer)(GLuint) = ::glIsFramebuffer;
|
||||||
void (* const glLinkProgram)(GLuint) = ::glLinkProgram;
|
GLboolean (*const glIsProgram)(GLuint) = ::glIsProgram;
|
||||||
void (* const glPixelStorei)(GLenum, GLint) = ::glPixelStorei;
|
GLboolean (*const glIsRenderbuffer)(GLuint) = ::glIsRenderbuffer;
|
||||||
void (* const glPolygonOffset)(GLfloat, GLfloat) = ::glPolygonOffset;
|
GLboolean (*const glIsShader)(GLuint) = ::glIsShader;
|
||||||
void (* const glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void *) = ::glReadPixels;
|
GLboolean (*const glIsTexture)(GLuint) = ::glIsTexture;
|
||||||
void (* const glReleaseShaderCompiler)() = ::glReleaseShaderCompiler;
|
void (*const glLineWidth)(GLfloat) = ::glLineWidth;
|
||||||
void (* const glRenderbufferStorage)(GLenum, GLenum, GLsizei, GLsizei) = ::glRenderbufferStorage;
|
void (*const glLinkProgram)(GLuint) = ::glLinkProgram;
|
||||||
void (* const glSampleCoverage)(GLfloat, GLboolean) = ::glSampleCoverage;
|
void (*const glPixelStorei)(GLenum, GLint) = ::glPixelStorei;
|
||||||
void (* const glScissor)(GLint, GLint, GLsizei, GLsizei) = ::glScissor;
|
void (*const glPolygonOffset)(GLfloat, GLfloat) = ::glPolygonOffset;
|
||||||
void (* const glShaderBinary)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei) = ::glShaderBinary;
|
void (*const glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*) = ::glReadPixels;
|
||||||
void (* const glShaderSource)(GLuint, GLsizei, const GLchar * const*, const GLint *) = ::glShaderSource;
|
void (*const glReleaseShaderCompiler)() = ::glReleaseShaderCompiler;
|
||||||
void (* const glStencilFunc)(GLenum, GLint, GLuint) = ::glStencilFunc;
|
void (*const glRenderbufferStorage)(GLenum, GLenum, GLsizei, GLsizei) = ::glRenderbufferStorage;
|
||||||
void (* const glStencilFuncSeparate)(GLenum, GLenum, GLint, GLuint) = ::glStencilFuncSeparate;
|
void (*const glSampleCoverage)(GLfloat, GLboolean) = ::glSampleCoverage;
|
||||||
void (* const glStencilMask)(GLuint) = ::glStencilMask;
|
void (*const glScissor)(GLint, GLint, GLsizei, GLsizei) = ::glScissor;
|
||||||
void (* const glStencilMaskSeparate)(GLenum, GLuint) = ::glStencilMaskSeparate;
|
void (*const glShaderBinary)(GLsizei, const GLuint*, GLenum, const GLvoid*, GLsizei) = ::glShaderBinary;
|
||||||
void (* const glStencilOp)(GLenum, GLenum, GLenum) = ::glStencilOp;
|
void (*const glShaderSource)(GLuint, GLsizei, const GLchar* const*, const GLint*) = ::glShaderSource;
|
||||||
void (* const glStencilOpSeparate)(GLenum, GLenum, GLenum, GLenum) = ::glStencilOpSeparate;
|
void (*const glStencilFunc)(GLenum, GLint, GLuint) = ::glStencilFunc;
|
||||||
void (* const glTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *) = ::glTexImage2D;
|
void (*const glStencilFuncSeparate)(GLenum, GLenum, GLint, GLuint) = ::glStencilFuncSeparate;
|
||||||
void (* const glTexParameterf)(GLenum, GLenum, GLfloat) = ::glTexParameterf;
|
void (*const glStencilMask)(GLuint) = ::glStencilMask;
|
||||||
void (* const glTexParameterfv)(GLenum, GLenum, const GLfloat *) = ::glTexParameterfv;
|
void (*const glStencilMaskSeparate)(GLenum, GLuint) = ::glStencilMaskSeparate;
|
||||||
void (* const glTexParameteri)(GLenum, GLenum, GLint) = ::glTexParameteri;
|
void (*const glStencilOp)(GLenum, GLenum, GLenum) = ::glStencilOp;
|
||||||
void (* const glTexParameteriv)(GLenum, GLenum, const GLint *) = ::glTexParameteriv;
|
void (*const glStencilOpSeparate)(GLenum, GLenum, GLenum, GLenum) = ::glStencilOpSeparate;
|
||||||
void (* const glTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *) = ::glTexSubImage2D;
|
void (*const glTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*) = ::glTexImage2D;
|
||||||
void (* const glUniform1f)(GLint, GLfloat) = ::glUniform1f;
|
void (*const glTexParameterf)(GLenum, GLenum, GLfloat) = ::glTexParameterf;
|
||||||
void (* const glUniform1fv)(GLint, GLsizei, const GLfloat *) = ::glUniform1fv;
|
void (*const glTexParameterfv)(GLenum, GLenum, const GLfloat*) = ::glTexParameterfv;
|
||||||
void (* const glUniform1i)(GLint, GLint) = ::glUniform1i;
|
void (*const glTexParameteri)(GLenum, GLenum, GLint) = ::glTexParameteri;
|
||||||
void (* const glUniform1iv)(GLint, GLsizei, const GLint *) = ::glUniform1iv;
|
void (*const glTexParameteriv)(GLenum, GLenum, const GLint*) = ::glTexParameteriv;
|
||||||
void (* const glUniform2f)(GLint, GLfloat, GLfloat) = ::glUniform2f;
|
void (*const glTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void*) =
|
||||||
void (* const glUniform2fv)(GLint, GLsizei, const GLfloat *) = ::glUniform2fv;
|
::glTexSubImage2D;
|
||||||
void (* const glUniform2i)(GLint, GLint, GLint) = ::glUniform2i;
|
void (*const glUniform1f)(GLint, GLfloat) = ::glUniform1f;
|
||||||
void (* const glUniform2iv)(GLint, GLsizei, const GLint *) = ::glUniform2iv;
|
void (*const glUniform1fv)(GLint, GLsizei, const GLfloat*) = ::glUniform1fv;
|
||||||
void (* const glUniform3f)(GLint, GLfloat, GLfloat, GLfloat) = ::glUniform3f;
|
void (*const glUniform1i)(GLint, GLint) = ::glUniform1i;
|
||||||
void (* const glUniform3fv)(GLint, GLsizei, const GLfloat *) = ::glUniform3fv;
|
void (*const glUniform1iv)(GLint, GLsizei, const GLint*) = ::glUniform1iv;
|
||||||
void (* const glUniform3i)(GLint, GLint, GLint, GLint) = ::glUniform3i;
|
void (*const glUniform2f)(GLint, GLfloat, GLfloat) = ::glUniform2f;
|
||||||
void (* const glUniform3iv)(GLint, GLsizei, const GLint *) = ::glUniform3iv;
|
void (*const glUniform2fv)(GLint, GLsizei, const GLfloat*) = ::glUniform2fv;
|
||||||
void (* const glUniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat) = ::glUniform4f;
|
void (*const glUniform2i)(GLint, GLint, GLint) = ::glUniform2i;
|
||||||
void (* const glUniform4fv)(GLint, GLsizei, const GLfloat *) = ::glUniform4fv;
|
void (*const glUniform2iv)(GLint, GLsizei, const GLint*) = ::glUniform2iv;
|
||||||
void (* const glUniform4i)(GLint, GLint, GLint, GLint, GLint) = ::glUniform4i;
|
void (*const glUniform3f)(GLint, GLfloat, GLfloat, GLfloat) = ::glUniform3f;
|
||||||
void (* const glUniform4iv)(GLint, GLsizei, const GLint *) = ::glUniform4iv;
|
void (*const glUniform3fv)(GLint, GLsizei, const GLfloat*) = ::glUniform3fv;
|
||||||
void (* const glUniformMatrix2fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix2fv;
|
void (*const glUniform3i)(GLint, GLint, GLint, GLint) = ::glUniform3i;
|
||||||
void (* const glUniformMatrix3fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix3fv;
|
void (*const glUniform3iv)(GLint, GLsizei, const GLint*) = ::glUniform3iv;
|
||||||
void (* const glUniformMatrix4fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix4fv;
|
void (*const glUniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat) = ::glUniform4f;
|
||||||
void (* const glUseProgram)(GLuint) = ::glUseProgram;
|
void (*const glUniform4fv)(GLint, GLsizei, const GLfloat*) = ::glUniform4fv;
|
||||||
void (* const glValidateProgram)(GLuint) = ::glValidateProgram;
|
void (*const glUniform4i)(GLint, GLint, GLint, GLint, GLint) = ::glUniform4i;
|
||||||
void (* const glVertexAttrib1f)(GLuint, GLfloat) = ::glVertexAttrib1f;
|
void (*const glUniform4iv)(GLint, GLsizei, const GLint*) = ::glUniform4iv;
|
||||||
void (* const glVertexAttrib1fv)(GLuint, const GLfloat *) = ::glVertexAttrib1fv;
|
void (*const glUniformMatrix2fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix2fv;
|
||||||
void (* const glVertexAttrib2f)(GLuint, GLfloat, GLfloat) = ::glVertexAttrib2f;
|
void (*const glUniformMatrix3fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix3fv;
|
||||||
void (* const glVertexAttrib2fv)(GLuint, const GLfloat *) = ::glVertexAttrib2fv;
|
void (*const glUniformMatrix4fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix4fv;
|
||||||
void (* const glVertexAttrib3f)(GLuint, GLfloat, GLfloat, GLfloat) = ::glVertexAttrib3f;
|
void (*const glUseProgram)(GLuint) = ::glUseProgram;
|
||||||
void (* const glVertexAttrib3fv)(GLuint, const GLfloat *) = ::glVertexAttrib3fv;
|
void (*const glValidateProgram)(GLuint) = ::glValidateProgram;
|
||||||
void (* const glVertexAttrib4f)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat) = ::glVertexAttrib4f;
|
void (*const glVertexAttrib1f)(GLuint, GLfloat) = ::glVertexAttrib1f;
|
||||||
void (* const glVertexAttrib4fv)(GLuint, const GLfloat *) = ::glVertexAttrib4fv;
|
void (*const glVertexAttrib1fv)(GLuint, const GLfloat*) = ::glVertexAttrib1fv;
|
||||||
void (* const glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *) = ::glVertexAttribPointer;
|
void (*const glVertexAttrib2f)(GLuint, GLfloat, GLfloat) = ::glVertexAttrib2f;
|
||||||
void (* const glViewport)(GLint, GLint, GLsizei, GLsizei) = ::glViewport;
|
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 */
|
/* OpenGL ES 3.0 */
|
||||||
|
|
||||||
void (* const glReadBuffer)(GLenum) = ::glReadBuffer;
|
void (*const glReadBuffer)(GLenum) = ::glReadBuffer;
|
||||||
void (* const glDrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *) = ::glDrawRangeElements;
|
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 glTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*) =
|
||||||
void (* const glTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = ::glTexSubImage3D;
|
::glTexImage3D;
|
||||||
void (* const glCopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) = ::glCopyTexSubImage3D;
|
void (*const glTexSubImage3D)(
|
||||||
void (* const glCompressedTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *) = ::glCompressedTexImage3D;
|
GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*) = ::glTexSubImage3D;
|
||||||
void (* const glCompressedTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *) = ::glCompressedTexSubImage3D;
|
void (*const glCopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) =
|
||||||
void (* const glGenQueries)(GLsizei, GLuint *) = ::glGenQueries;
|
::glCopyTexSubImage3D;
|
||||||
void (* const glDeleteQueries)(GLsizei, const GLuint *) = ::glDeleteQueries;
|
void (*const glCompressedTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*) =
|
||||||
GLboolean (* const glIsQuery)(GLuint) = ::glIsQuery;
|
::glCompressedTexImage3D;
|
||||||
void (* const glBeginQuery)(GLenum, GLuint) = ::glBeginQuery;
|
void (*const glCompressedTexSubImage3D)(
|
||||||
void (* const glEndQuery)(GLenum) = ::glEndQuery;
|
GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*) =
|
||||||
void (* const glGetQueryiv)(GLenum, GLenum, GLint *) = ::glGetQueryiv;
|
::glCompressedTexSubImage3D;
|
||||||
void (* const glGetQueryObjectuiv)(GLuint, GLenum, GLuint *) = ::glGetQueryObjectuiv;
|
void (*const glGenQueries)(GLsizei, GLuint*) = ::glGenQueries;
|
||||||
GLboolean (* const glUnmapBuffer)(GLenum) = ::glUnmapBuffer;
|
void (*const glDeleteQueries)(GLsizei, const GLuint*) = ::glDeleteQueries;
|
||||||
void (* const glGetBufferPointerv)(GLenum, GLenum, GLvoid **) = ::glGetBufferPointerv;
|
GLboolean (*const glIsQuery)(GLuint) = ::glIsQuery;
|
||||||
void (* const glDrawBuffers)(GLsizei, const GLenum *) = ::glDrawBuffers;
|
void (*const glBeginQuery)(GLenum, GLuint) = ::glBeginQuery;
|
||||||
void (* const glUniformMatrix2x3fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix2x3fv;
|
void (*const glEndQuery)(GLenum) = ::glEndQuery;
|
||||||
void (* const glUniformMatrix3x2fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix3x2fv;
|
void (*const glGetQueryiv)(GLenum, GLenum, GLint*) = ::glGetQueryiv;
|
||||||
void (* const glUniformMatrix2x4fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix2x4fv;
|
void (*const glGetQueryObjectuiv)(GLuint, GLenum, GLuint*) = ::glGetQueryObjectuiv;
|
||||||
void (* const glUniformMatrix4x2fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix4x2fv;
|
GLboolean (*const glUnmapBuffer)(GLenum) = ::glUnmapBuffer;
|
||||||
void (* const glUniformMatrix3x4fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix3x4fv;
|
void (*const glGetBufferPointerv)(GLenum, GLenum, GLvoid**) = ::glGetBufferPointerv;
|
||||||
void (* const glUniformMatrix4x3fv)(GLint, GLsizei, GLboolean, const GLfloat *) = ::glUniformMatrix4x3fv;
|
void (*const glDrawBuffers)(GLsizei, const GLenum*) = ::glDrawBuffers;
|
||||||
void (* const glBlitFramebuffer)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum) = ::glBlitFramebuffer;
|
void (*const glUniformMatrix2x3fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix2x3fv;
|
||||||
void (* const glRenderbufferStorageMultisample)(GLenum, GLsizei, GLenum, GLsizei, GLsizei) = ::glRenderbufferStorageMultisample;
|
void (*const glUniformMatrix3x2fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix3x2fv;
|
||||||
void (* const glFramebufferTextureLayer)(GLenum, GLenum, GLuint, GLint, GLint) = ::glFramebufferTextureLayer;
|
void (*const glUniformMatrix2x4fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix2x4fv;
|
||||||
GLvoid* (* const glMapBufferRange)(GLenum, GLintptr, GLsizeiptr, GLbitfield) = ::glMapBufferRange;
|
void (*const glUniformMatrix4x2fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix4x2fv;
|
||||||
void (* const glFlushMappedBufferRange)(GLenum, GLintptr, GLsizeiptr) = ::glFlushMappedBufferRange;
|
void (*const glUniformMatrix3x4fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix3x4fv;
|
||||||
void (* const glBindVertexArray)(GLuint) = ::glBindVertexArray;
|
void (*const glUniformMatrix4x3fv)(GLint, GLsizei, GLboolean, const GLfloat*) = ::glUniformMatrix4x3fv;
|
||||||
void (* const glDeleteVertexArrays)(GLsizei, const GLuint *) = ::glDeleteVertexArrays;
|
void (*const glBlitFramebuffer)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum) =
|
||||||
void (* const glGenVertexArrays)(GLsizei, GLuint *) = ::glGenVertexArrays;
|
::glBlitFramebuffer;
|
||||||
GLboolean (* const glIsVertexArray)(GLuint) = ::glIsVertexArray;
|
void (*const glRenderbufferStorageMultisample)(GLenum, GLsizei, GLenum, GLsizei, GLsizei) =
|
||||||
void (* const glGetIntegeri_v)(GLenum, GLuint, GLint *) = ::glGetIntegeri_v;
|
::glRenderbufferStorageMultisample;
|
||||||
void (* const glBeginTransformFeedback)(GLenum) = ::glBeginTransformFeedback;
|
void (*const glFramebufferTextureLayer)(GLenum, GLenum, GLuint, GLint, GLint) = ::glFramebufferTextureLayer;
|
||||||
void (* const glEndTransformFeedback)() = ::glEndTransformFeedback;
|
GLvoid* (*const glMapBufferRange)(GLenum, GLintptr, GLsizeiptr, GLbitfield) = ::glMapBufferRange;
|
||||||
void (* const glBindBufferRange)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr) = ::glBindBufferRange;
|
void (*const glFlushMappedBufferRange)(GLenum, GLintptr, GLsizeiptr) = ::glFlushMappedBufferRange;
|
||||||
void (* const glBindBufferBase)(GLenum, GLuint, GLuint) = ::glBindBufferBase;
|
void (*const glBindVertexArray)(GLuint) = ::glBindVertexArray;
|
||||||
void (* const glTransformFeedbackVaryings)(GLuint, GLsizei, const GLchar * const*, GLenum) = ::glTransformFeedbackVaryings;
|
void (*const glDeleteVertexArrays)(GLsizei, const GLuint*) = ::glDeleteVertexArrays;
|
||||||
void (* const glGetTransformFeedbackVarying)(GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *) = ::glGetTransformFeedbackVarying;
|
void (*const glGenVertexArrays)(GLsizei, GLuint*) = ::glGenVertexArrays;
|
||||||
void (* const glVertexAttribIPointer)(GLuint, GLint, GLenum, GLsizei, const GLvoid *) = ::glVertexAttribIPointer;
|
GLboolean (*const glIsVertexArray)(GLuint) = ::glIsVertexArray;
|
||||||
void (* const glGetVertexAttribIiv)(GLuint, GLenum, GLint *) = ::glGetVertexAttribIiv;
|
void (*const glGetIntegeri_v)(GLenum, GLuint, GLint*) = ::glGetIntegeri_v;
|
||||||
void (* const glGetVertexAttribIuiv)(GLuint, GLenum, GLuint *) = ::glGetVertexAttribIuiv;
|
void (*const glBeginTransformFeedback)(GLenum) = ::glBeginTransformFeedback;
|
||||||
void (* const glVertexAttribI4i)(GLuint, GLint, GLint, GLint, GLint) = ::glVertexAttribI4i;
|
void (*const glEndTransformFeedback)() = ::glEndTransformFeedback;
|
||||||
void (* const glVertexAttribI4ui)(GLuint, GLuint, GLuint, GLuint, GLuint) = ::glVertexAttribI4ui;
|
void (*const glBindBufferRange)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr) = ::glBindBufferRange;
|
||||||
void (* const glVertexAttribI4iv)(GLuint, const GLint *) = ::glVertexAttribI4iv;
|
void (*const glBindBufferBase)(GLenum, GLuint, GLuint) = ::glBindBufferBase;
|
||||||
void (* const glVertexAttribI4uiv)(GLuint, const GLuint *) = ::glVertexAttribI4uiv;
|
void (*const glTransformFeedbackVaryings)(GLuint,
|
||||||
void (* const glGetUniformuiv)(GLuint, GLint, GLuint *) = ::glGetUniformuiv;
|
GLsizei,
|
||||||
GLint (* const glGetFragDataLocation)(GLuint, const GLchar *) = ::glGetFragDataLocation;
|
const GLchar* const*,
|
||||||
void (* const glUniform1ui)(GLint, GLuint) = ::glUniform1ui;
|
GLenum) = ::glTransformFeedbackVaryings;
|
||||||
void (* const glUniform2ui)(GLint, GLuint, GLuint) = ::glUniform2ui;
|
void (*const glGetTransformFeedbackVarying)(GLuint, GLuint, GLsizei, GLsizei*, GLsizei*, GLenum*, GLchar*) =
|
||||||
void (* const glUniform3ui)(GLint, GLuint, GLuint, GLuint) = ::glUniform3ui;
|
::glGetTransformFeedbackVarying;
|
||||||
void (* const glUniform4ui)(GLint, GLuint, GLuint, GLuint, GLuint) = ::glUniform4ui;
|
void (*const glVertexAttribIPointer)(GLuint, GLint, GLenum, GLsizei, const GLvoid*) = ::glVertexAttribIPointer;
|
||||||
void (* const glUniform1uiv)(GLint, GLsizei, const GLuint *) = ::glUniform1uiv;
|
void (*const glGetVertexAttribIiv)(GLuint, GLenum, GLint*) = ::glGetVertexAttribIiv;
|
||||||
void (* const glUniform2uiv)(GLint, GLsizei, const GLuint *) = ::glUniform2uiv;
|
void (*const glGetVertexAttribIuiv)(GLuint, GLenum, GLuint*) = ::glGetVertexAttribIuiv;
|
||||||
void (* const glUniform3uiv)(GLint, GLsizei, const GLuint *) = ::glUniform3uiv;
|
void (*const glVertexAttribI4i)(GLuint, GLint, GLint, GLint, GLint) = ::glVertexAttribI4i;
|
||||||
void (* const glUniform4uiv)(GLint, GLsizei, const GLuint *) = ::glUniform4uiv;
|
void (*const glVertexAttribI4ui)(GLuint, GLuint, GLuint, GLuint, GLuint) = ::glVertexAttribI4ui;
|
||||||
void (* const glClearBufferiv)(GLenum, GLint, const GLint *) = ::glClearBufferiv;
|
void (*const glVertexAttribI4iv)(GLuint, const GLint*) = ::glVertexAttribI4iv;
|
||||||
void (* const glClearBufferuiv)(GLenum, GLint, const GLuint *) = ::glClearBufferuiv;
|
void (*const glVertexAttribI4uiv)(GLuint, const GLuint*) = ::glVertexAttribI4uiv;
|
||||||
void (* const glClearBufferfv)(GLenum, GLint, const GLfloat *) = ::glClearBufferfv;
|
void (*const glGetUniformuiv)(GLuint, GLint, GLuint*) = ::glGetUniformuiv;
|
||||||
void (* const glClearBufferfi)(GLenum, GLint, GLfloat, GLint) = ::glClearBufferfi;
|
GLint (*const glGetFragDataLocation)(GLuint, const GLchar*) = ::glGetFragDataLocation;
|
||||||
const GLubyte* (* const glGetStringi)(GLenum, GLuint) = ::glGetStringi;
|
void (*const glUniform1ui)(GLint, GLuint) = ::glUniform1ui;
|
||||||
void (* const glCopyBufferSubData)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr) = ::glCopyBufferSubData;
|
void (*const glUniform2ui)(GLint, GLuint, GLuint) = ::glUniform2ui;
|
||||||
void (* const glGetUniformIndices)(GLuint, GLsizei, const GLchar * const*, GLuint *) = ::glGetUniformIndices;
|
void (*const glUniform3ui)(GLint, GLuint, GLuint, GLuint) = ::glUniform3ui;
|
||||||
void (* const glGetActiveUniformsiv)(GLuint, GLsizei, const GLuint *, GLenum, GLint *) = ::glGetActiveUniformsiv;
|
void (*const glUniform4ui)(GLint, GLuint, GLuint, GLuint, GLuint) = ::glUniform4ui;
|
||||||
GLuint (* const glGetUniformBlockIndex)(GLuint, const GLchar *) = ::glGetUniformBlockIndex;
|
void (*const glUniform1uiv)(GLint, GLsizei, const GLuint*) = ::glUniform1uiv;
|
||||||
void (* const glGetActiveUniformBlockiv)(GLuint, GLuint, GLenum, GLint *) = ::glGetActiveUniformBlockiv;
|
void (*const glUniform2uiv)(GLint, GLsizei, const GLuint*) = ::glUniform2uiv;
|
||||||
void (* const glGetActiveUniformBlockName)(GLuint, GLuint, GLsizei, GLsizei *, GLchar *) = ::glGetActiveUniformBlockName;
|
void (*const glUniform3uiv)(GLint, GLsizei, const GLuint*) = ::glUniform3uiv;
|
||||||
void (* const glUniformBlockBinding)(GLuint, GLuint, GLuint) = ::glUniformBlockBinding;
|
void (*const glUniform4uiv)(GLint, GLsizei, const GLuint*) = ::glUniform4uiv;
|
||||||
void (* const glDrawArraysInstanced)(GLenum, GLint, GLsizei, GLsizei) = ::glDrawArraysInstanced;
|
void (*const glClearBufferiv)(GLenum, GLint, const GLint*) = ::glClearBufferiv;
|
||||||
void (* const glDrawElementsInstanced)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei) = ::glDrawElementsInstanced;
|
void (*const glClearBufferuiv)(GLenum, GLint, const GLuint*) = ::glClearBufferuiv;
|
||||||
GLsync (* const glFenceSync)(GLenum, GLbitfield) = ::glFenceSync;
|
void (*const glClearBufferfv)(GLenum, GLint, const GLfloat*) = ::glClearBufferfv;
|
||||||
GLboolean (* const glIsSync)(GLsync) = ::glIsSync;
|
void (*const glClearBufferfi)(GLenum, GLint, GLfloat, GLint) = ::glClearBufferfi;
|
||||||
void (* const glDeleteSync)(GLsync) = ::glDeleteSync;
|
const GLubyte* (*const glGetStringi)(GLenum, GLuint) = ::glGetStringi;
|
||||||
GLenum (* const glClientWaitSync)(GLsync, GLbitfield, GLuint64) = ::glClientWaitSync;
|
void (*const glCopyBufferSubData)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr) = ::glCopyBufferSubData;
|
||||||
void (* const glWaitSync)(GLsync, GLbitfield, GLuint64) = ::glWaitSync;
|
void (*const glGetUniformIndices)(GLuint, GLsizei, const GLchar* const*, GLuint*) = ::glGetUniformIndices;
|
||||||
void (* const glGetInteger64v)(GLenum, GLint64 *) = ::glGetInteger64v;
|
void (*const glGetActiveUniformsiv)(GLuint, GLsizei, const GLuint*, GLenum, GLint*) = ::glGetActiveUniformsiv;
|
||||||
void (* const glGetSynciv)(GLsync, GLenum, GLsizei, GLsizei *, GLint *) = ::glGetSynciv;
|
GLuint (*const glGetUniformBlockIndex)(GLuint, const GLchar*) = ::glGetUniformBlockIndex;
|
||||||
void (* const glGetInteger64i_v)(GLenum, GLuint, GLint64 *) = ::glGetInteger64i_v;
|
void (*const glGetActiveUniformBlockiv)(GLuint, GLuint, GLenum, GLint*) = ::glGetActiveUniformBlockiv;
|
||||||
void (* const glGetBufferParameteri64v)(GLenum, GLenum, GLint64 *) = ::glGetBufferParameteri64v;
|
void (*const glGetActiveUniformBlockName)(GLuint, GLuint, GLsizei, GLsizei*, GLchar*) = ::glGetActiveUniformBlockName;
|
||||||
void (* const glGenSamplers)(GLsizei, GLuint *) = ::glGenSamplers;
|
void (*const glUniformBlockBinding)(GLuint, GLuint, GLuint) = ::glUniformBlockBinding;
|
||||||
void (* const glDeleteSamplers)(GLsizei, const GLuint *) = ::glDeleteSamplers;
|
void (*const glDrawArraysInstanced)(GLenum, GLint, GLsizei, GLsizei) = ::glDrawArraysInstanced;
|
||||||
GLboolean (* const glIsSampler)(GLuint) = ::glIsSampler;
|
void (*const glDrawElementsInstanced)(GLenum, GLsizei, GLenum, const GLvoid*, GLsizei) = ::glDrawElementsInstanced;
|
||||||
void (* const glBindSampler)(GLuint, GLuint) = ::glBindSampler;
|
GLsync (*const glFenceSync)(GLenum, GLbitfield) = ::glFenceSync;
|
||||||
void (* const glSamplerParameteri)(GLuint, GLenum, GLint) = ::glSamplerParameteri;
|
GLboolean (*const glIsSync)(GLsync) = ::glIsSync;
|
||||||
void (* const glSamplerParameteriv)(GLuint, GLenum, const GLint *) = ::glSamplerParameteriv;
|
void (*const glDeleteSync)(GLsync) = ::glDeleteSync;
|
||||||
void (* const glSamplerParameterf)(GLuint, GLenum, GLfloat) = ::glSamplerParameterf;
|
GLenum (*const glClientWaitSync)(GLsync, GLbitfield, GLuint64) = ::glClientWaitSync;
|
||||||
void (* const glSamplerParameterfv)(GLuint, GLenum, const GLfloat *) = ::glSamplerParameterfv;
|
void (*const glWaitSync)(GLsync, GLbitfield, GLuint64) = ::glWaitSync;
|
||||||
void (* const glGetSamplerParameteriv)(GLuint, GLenum, GLint *) = ::glGetSamplerParameteriv;
|
void (*const glGetInteger64v)(GLenum, GLint64*) = ::glGetInteger64v;
|
||||||
void (* const glGetSamplerParameterfv)(GLuint, GLenum, GLfloat *) = ::glGetSamplerParameterfv;
|
void (*const glGetSynciv)(GLsync, GLenum, GLsizei, GLsizei*, GLint*) = ::glGetSynciv;
|
||||||
void (* const glVertexAttribDivisor)(GLuint, GLuint) = ::glVertexAttribDivisor;
|
void (*const glGetInteger64i_v)(GLenum, GLuint, GLint64*) = ::glGetInteger64i_v;
|
||||||
void (* const glBindTransformFeedback)(GLenum, GLuint) = ::glBindTransformFeedback;
|
void (*const glGetBufferParameteri64v)(GLenum, GLenum, GLint64*) = ::glGetBufferParameteri64v;
|
||||||
void (* const glDeleteTransformFeedbacks)(GLsizei, const GLuint *) = ::glDeleteTransformFeedbacks;
|
void (*const glGenSamplers)(GLsizei, GLuint*) = ::glGenSamplers;
|
||||||
void (* const glGenTransformFeedbacks)(GLsizei, GLuint *) = ::glGenTransformFeedbacks;
|
void (*const glDeleteSamplers)(GLsizei, const GLuint*) = ::glDeleteSamplers;
|
||||||
GLboolean (* const glIsTransformFeedback)(GLuint) = ::glIsTransformFeedback;
|
GLboolean (*const glIsSampler)(GLuint) = ::glIsSampler;
|
||||||
void (* const glPauseTransformFeedback)() = ::glPauseTransformFeedback;
|
void (*const glBindSampler)(GLuint, GLuint) = ::glBindSampler;
|
||||||
void (* const glResumeTransformFeedback)() = ::glResumeTransformFeedback;
|
void (*const glSamplerParameteri)(GLuint, GLenum, GLint) = ::glSamplerParameteri;
|
||||||
void (* const glGetProgramBinary)(GLuint, GLsizei, GLsizei *, GLenum *, GLvoid *) = ::glGetProgramBinary;
|
void (*const glSamplerParameteriv)(GLuint, GLenum, const GLint*) = ::glSamplerParameteriv;
|
||||||
void (* const glProgramBinary)(GLuint, GLenum, const GLvoid *, GLsizei) = ::glProgramBinary;
|
void (*const glSamplerParameterf)(GLuint, GLenum, GLfloat) = ::glSamplerParameterf;
|
||||||
void (* const glProgramParameteri)(GLuint, GLenum, GLint) = ::glProgramParameteri;
|
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
|
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
|
||||||
void (* const glInvalidateFramebuffer)(GLenum, GLsizei, const GLenum *) = ::glInvalidateFramebuffer;
|
void (*const glInvalidateFramebuffer)(GLenum, GLsizei, const GLenum*) = ::glInvalidateFramebuffer;
|
||||||
void (* const glInvalidateSubFramebuffer)(GLenum, GLsizei, const GLenum *, GLint, GLint, GLsizei, GLsizei) = ::glInvalidateSubFramebuffer;
|
void (*const glInvalidateSubFramebuffer)(GLenum, GLsizei, const GLenum*, GLint, GLint, GLsizei, GLsizei) =
|
||||||
|
::glInvalidateSubFramebuffer;
|
||||||
#endif
|
#endif
|
||||||
void (* const glTexStorage2D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei) = ::glTexStorage2D;
|
void (*const glTexStorage2D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei) = ::glTexStorage2D;
|
||||||
void (* const glTexStorage3D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei) = ::glTexStorage3D;
|
void (*const glTexStorage3D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei) = ::glTexStorage3D;
|
||||||
void (* const glGetInternalformativ)(GLenum, GLenum, GLenum, GLsizei, GLint *) = ::glGetInternalformativ;
|
void (*const glGetInternalformativ)(GLenum, GLenum, GLenum, GLsizei, GLint*) = ::glGetInternalformativ;
|
||||||
|
|
||||||
|
} // namespace platform
|
||||||
} // namespace platform
|
} // namespace mbgl
|
||||||
} // namespace mbgl
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ RunLoop* RunLoop::Get() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RunLoop::RunLoop(Type)
|
RunLoop::RunLoop(Type)
|
||||||
: impl(std::make_unique<Impl>()) {
|
: impl(std::make_unique<Impl>()) {
|
||||||
assert(!Scheduler::GetCurrent());
|
assert(!Scheduler::GetCurrent());
|
||||||
Scheduler::SetCurrent(this);
|
Scheduler::SetCurrent(this);
|
||||||
impl->async = std::make_unique<AsyncTask>(std::bind(&RunLoop::process, 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)
|
Impl(Duration timeout, Duration repeat, std::function<void()>&& fn)
|
||||||
: task(std::move(fn)),
|
: task(std::move(fn)),
|
||||||
loop(CFRunLoopGetCurrent()) {
|
loop(CFRunLoopGetCurrent()) {
|
||||||
CFRunLoopTimerContext context = {
|
CFRunLoopTimerContext context = {0, this, nullptr, nullptr, nullptr};
|
||||||
0,
|
timer = CFRunLoopTimerCreate(
|
||||||
this,
|
kCFAllocatorDefault, toCFAbsoluteTime(timeout), toCFTimeInterval(repeat), 0, 0, perform, &context);
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr
|
|
||||||
};
|
|
||||||
timer = CFRunLoopTimerCreate(kCFAllocatorDefault, toCFAbsoluteTime(timeout), toCFTimeInterval(repeat), 0, 0, perform, &context);
|
|
||||||
CFRunLoopAddTimer(loop, timer, kCFRunLoopDefaultMode);
|
CFRunLoopAddTimer(loop, timer, kCFRunLoopDefaultMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,9 +30,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void perform(CFRunLoopTimerRef, void* info) {
|
static void perform(CFRunLoopTimerRef, void* info) { reinterpret_cast<Impl*>(info)->task(); }
|
||||||
reinterpret_cast<Impl*>(info)->task();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::function<void()> task;
|
std::function<void()> task;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#import <Mapbox.h>
|
#import <Mapbox.h>
|
||||||
#import <XCTest/XCTest.h>
|
#import <XCTest/XCTest.h>
|
||||||
|
|
||||||
#define MLNConstantExpression(constant) \
|
#define MLNConstantExpression(constant) [NSExpression expressionForConstantValue:constant]
|
||||||
[NSExpression expressionForConstantValue:constant]
|
|
||||||
|
|
||||||
@interface MLNStyleLayerTests : XCTestCase <MLNMapViewDelegate>
|
@interface MLNStyleLayerTests : XCTestCase <MLNMapViewDelegate>
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,14 @@
|
|||||||
will also be picked up by xcpretty. PENDING tests will be distinguished by a `⧖`
|
will also be picked up by xcpretty. PENDING tests will be distinguished by a `⧖`
|
||||||
and `[PENDING]`
|
and `[PENDING]`
|
||||||
*/
|
*/
|
||||||
#define MLN_CHECK_IF_PENDING_TEST_SHOULD_RUN() \
|
#define MLN_CHECK_IF_PENDING_TEST_SHOULD_RUN() \
|
||||||
/* By default, skip pending tests. Otherwise check environment for MAPBOX_RUN_PENDING_TESTS */ \
|
/* By default, skip pending tests. Otherwise check environment for MAPBOX_RUN_PENDING_TESTS */ \
|
||||||
{ \
|
{ \
|
||||||
NSString *runPendingTests = [[NSProcessInfo processInfo] environment][@"MAPBOX_RUN_PENDING_TESTS"]; \
|
NSString *runPendingTests = \
|
||||||
if (![runPendingTests boolValue]) { \
|
[[NSProcessInfo processInfo] environment][@"MAPBOX_RUN_PENDING_TESTS"]; \
|
||||||
/* The following warning will be picked up by xcpretty */ \
|
if (![runPendingTests boolValue]) { \
|
||||||
printf("warning: '%s' is a pending test - skipping\n", __PRETTY_FUNCTION__); \
|
/* The following warning will be picked up by xcpretty */ \
|
||||||
return; \
|
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.
|
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user