Fix Custom Drawable Layer usage of private headers (#2039)

This commit is contained in:
Stefan Karschti
2024-01-19 18:00:38 +02:00
committed by GitHub
parent 802c47dd3b
commit cd3de6d3ad
4 changed files with 18 additions and 24 deletions

View File

@@ -1,11 +1,6 @@
#import "Mapbox.h"
#import "MLNFoundation.h"
#import "MLNStyleValue.h"
#import "MLNStyleLayer.h"
#import "MLNGeometry.h"
@interface ExampleCustomDrawableStyleLayer : MLNStyleLayer
@interface ExampleCustomDrawableStyleLayer : MLNCustomDrawableStyleLayer
- (instancetype)initWithIdentifier:(NSString *)identifier;

View File

@@ -1,10 +1,6 @@
#import "ExampleCustomDrawableStyleLayer.h"
#import "MLNStyleLayer.h"
#import "MLNCustomDrawableStyleLayer_Private.h"
#import "MLNStyle_Private.h"
#import "MLNStyleLayer_Private.h"
#import "MLNGeometry_Private.h"
#import "MLNCustomDrawableStyleLayer.h"
#include <mbgl/layermanager/layer_factory.hpp>
#include <mbgl/style/layer.hpp>

View File

@@ -1,10 +1,19 @@
#import <Foundation/Foundation.h>
#import "MLNFoundation.h"
#import "MLNFoundation.h"
#import "MLNStyleValue.h"
#import "MLNStyleLayer.h"
#import "MLNGeometry.h"
#ifdef __cplusplus
#include <mbgl/style/layer.hpp>
#endif
@interface MLNCustomDrawableStyleLayer : MLNStyleLayer
- (instancetype)initWithIdentifier:(NSString *)identifier;
#ifdef __cplusplus
- (instancetype)initWithPendingLayer:(std::unique_ptr<mbgl::style::Layer>)pendingLayer;
#endif
@end

View File

@@ -14,18 +14,12 @@
@implementation MLNCustomDrawableStyleLayer
/// @note
/// Inherit MLNCustomDrawableStyleLayer class and override initWithIdentifier method to create and attach a valid CustomDrawableLayerHost instance
/// Example:
/// - (instancetype)initWithIdentifier:(NSString *)identifier {
/// auto layer = std::make_unique<mbgl::style::CustomDrawableLayer>(identifier.UTF8String,
/// std::make_unique<ExampleCustomDrawableStyleLayerHost>(self));
/// return self = [super initWithPendingLayer:std::move(layer)];
/// }
///
- (instancetype)initWithIdentifier:(NSString *)identifier {
auto layer = std::make_unique<mbgl::style::CustomDrawableLayer>(identifier.UTF8String, nullptr);
return self = [super initWithPendingLayer:std::move(layer)];
- (instancetype)initWithRawLayer:(mbgl::style::Layer *)rawLayer {
return [super initWithRawLayer:rawLayer];
}
- (instancetype)initWithPendingLayer:(std::unique_ptr<mbgl::style::Layer>)pendingLayer {
return [super initWithPendingLayer:std::move(pendingLayer)];
}
@end