[ios, macos] Renamed files to match renamed classes
This commit is contained in:
committed by
Minh Nguyễn
parent
50d2c01d7d
commit
0acf1ed596
@@ -2,7 +2,7 @@
|
||||
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
|
||||
|
||||
#import "MGLStyleAttributeValue.h"
|
||||
#import "MGLBaseStyleLayer.h"
|
||||
#import "MGLStyleLayer.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MGLTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`MGLStyleLayer` is an abstract base class for style layers. A style layer
|
||||
manages the layout and appearance of content at a specific z-index in a style.
|
||||
An `MGLStyle` object consists of one or more `MGLStyleLayer` objects.
|
||||
|
||||
Each style layer defined by the style JSON file is represented at runtime by an
|
||||
`MGLStyleLayer` object, which you can use to refine the map’s appearance. You
|
||||
can also add and remove style layers dynamically.
|
||||
|
||||
Do not create instances of this class directly, and do not create your own
|
||||
subclasses of this class. Instead, create instances of
|
||||
`MGLBackgroundStyleLayer` and the concrete subclasses of
|
||||
`MGLForegroundStyleLayer`.
|
||||
*/
|
||||
@interface MGLStyleLayer : NSObject
|
||||
|
||||
#pragma mark Initializing a Style Layer
|
||||
|
||||
/**
|
||||
Returns a style layer object initialized with the given identifier.
|
||||
|
||||
After initializing and configuring the style layer, add it to a map view’s
|
||||
style using the `-[MGLStyle addLayer:]` or
|
||||
`-[MGLStyle insertLayer:belowLayer:]` method.
|
||||
|
||||
@param identifier A string that uniquely identifies the layer in the style to
|
||||
which it is added.
|
||||
@return An initialized style layer.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier;
|
||||
|
||||
#pragma mark Identifying a Style Layer
|
||||
|
||||
/**
|
||||
A string that uniquely identifies the style layer in the style to which it is
|
||||
added.
|
||||
*/
|
||||
@property (nonatomic, copy, readonly) NSString *identifier;
|
||||
|
||||
#pragma mark Configuring a Style Layer’s Visibility
|
||||
|
||||
/**
|
||||
Whether this layer is displayed. A value of `NO` hides the layer.
|
||||
*/
|
||||
@property (nonatomic, assign, getter=isVisible) BOOL visible;
|
||||
|
||||
/**
|
||||
The maximum zoom level at which the layer gets parsed and appears.
|
||||
*/
|
||||
@property (nonatomic, assign) float maximumZoomLevel;
|
||||
|
||||
/**
|
||||
The minimum zoom level at which the layer gets parsed and appears.
|
||||
*/
|
||||
@property (nonatomic, assign) float minimumZoomLevel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,52 +0,0 @@
|
||||
#import "MGLBaseStyleLayer.h"
|
||||
|
||||
#import "MGLStyleLayer_Private.h"
|
||||
#import "MGLMapView_Private.h"
|
||||
|
||||
#include <mbgl/style/layer.hpp>
|
||||
|
||||
@implementation MGLStyleLayer
|
||||
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_identifier = identifier;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setVisible:(BOOL)visible
|
||||
{
|
||||
mbgl::style::VisibilityType v = visible
|
||||
? mbgl::style::VisibilityType::Visible
|
||||
: mbgl::style::VisibilityType::None;
|
||||
self.layer->setVisibility(v);
|
||||
}
|
||||
|
||||
- (BOOL)isVisible
|
||||
{
|
||||
mbgl::style::VisibilityType v = self.layer->getVisibility();
|
||||
return (v == mbgl::style::VisibilityType::Visible);
|
||||
}
|
||||
|
||||
- (void)setMaximumZoomLevel:(float)maximumZoomLevel
|
||||
{
|
||||
self.layer->setMaxZoom(maximumZoomLevel);
|
||||
}
|
||||
|
||||
- (float)maximumZoomLevel
|
||||
{
|
||||
return self.layer->getMaxZoom();
|
||||
}
|
||||
|
||||
- (void)setMinimumZoomLevel:(float)minimumZoomLevel
|
||||
{
|
||||
self.layer->setMinZoom(minimumZoomLevel);
|
||||
}
|
||||
|
||||
- (float)minimumZoomLevel
|
||||
{
|
||||
return self.layer->getMinZoom();
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -2,7 +2,7 @@
|
||||
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
|
||||
|
||||
#import "MGLStyleAttributeValue.h"
|
||||
#import "MGLBaseStyleLayer.h"
|
||||
#import "MGLVectorStyleLayer.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
|
||||
|
||||
#import "MGLStyleAttributeValue.h"
|
||||
#import "MGLBaseStyleLayer.h"
|
||||
#import "MGLVectorStyleLayer.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
45
platform/darwin/src/MGLForegroundStyleLayer.h
Normal file
45
platform/darwin/src/MGLForegroundStyleLayer.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MGLStyleLayer.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MGLSource;
|
||||
|
||||
/**
|
||||
`MGLForegroundStyleLayer` is an abstract superclass for style layers whose
|
||||
content is defined by an `MGLSource` object.
|
||||
|
||||
Do not create instances of this class directly, and do not create your own
|
||||
subclasses of this class. Instead, create instances of `MGLRasterStyleLayer`
|
||||
and the concrete subclasses of `MGLVectorStyleLayer`.
|
||||
*/
|
||||
@interface MGLForegroundStyleLayer : MGLStyleLayer
|
||||
|
||||
#pragma mark Initializing a Style Layer
|
||||
|
||||
/**
|
||||
Returns a foreground style layer initialized with an identifier and source.
|
||||
|
||||
After initializing and configuring the style layer, add it to a map view’s
|
||||
style using the `-[MGLStyle addLayer:]` or
|
||||
`-[MGLStyle insertLayer:belowLayer:]` method.
|
||||
|
||||
@param identifier A string that uniquely identifies the source in the style to
|
||||
which it is added.
|
||||
@param source The source from which to obtain the data to style. If the source
|
||||
has not yet been added to the current style, the behavior is undefined.
|
||||
@return An initialized foreground style layer.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
#pragma mark Specifying a Style Layer’s Content
|
||||
|
||||
/**
|
||||
Identifier of the source from which the receiver obtains the data to style.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *sourceIdentifier;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
13
platform/darwin/src/MGLForegroundStyleLayer.m
Normal file
13
platform/darwin/src/MGLForegroundStyleLayer.m
Normal file
@@ -0,0 +1,13 @@
|
||||
#import "MGLForegroundStyleLayer.h"
|
||||
#import "MGLSource.h"
|
||||
|
||||
@implementation MGLForegroundStyleLayer
|
||||
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source {
|
||||
if (self = [super initWithIdentifier:identifier]) {
|
||||
_sourceIdentifier = source.identifier;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -2,7 +2,7 @@
|
||||
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
|
||||
|
||||
#import "MGLStyleAttributeValue.h"
|
||||
#import "MGLBaseStyleLayer.h"
|
||||
#import "MGLVectorStyleLayer.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
|
||||
|
||||
#import "MGLStyleAttributeValue.h"
|
||||
#import "MGLBaseStyleLayer.h"
|
||||
#import "MGLForegroundStyleLayer.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
/**
|
||||
A source supplies data to be shown on the map. Sources don't contain styling
|
||||
details like color or width. Use subclasses of `MGLBaseStyleLayer` to give
|
||||
visual representation to sources.
|
||||
details like color or width. Use subclasses of `MGLStyleLayer` to give visual
|
||||
representation to sources.
|
||||
|
||||
You should use the concrete subclasses of `MGLSource` to create vector,
|
||||
raster, GeoJSON, and other source types.
|
||||
|
||||
@@ -1,73 +1,64 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MGLBaseStyleLayer.h"
|
||||
#import "MGLTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MGLSource;
|
||||
|
||||
/**
|
||||
`MGLForegroundStyleLayer` is an abstract superclass for style layers whose
|
||||
content is defined by an `MGLSource` object.
|
||||
`MGLStyleLayer` is an abstract base class for style layers. A style layer
|
||||
manages the layout and appearance of content at a specific z-index in a style.
|
||||
An `MGLStyle` object consists of one or more `MGLStyleLayer` objects.
|
||||
|
||||
Each style layer defined by the style JSON file is represented at runtime by an
|
||||
`MGLStyleLayer` object, which you can use to refine the map’s appearance. You
|
||||
can also add and remove style layers dynamically.
|
||||
|
||||
Do not create instances of this class directly, and do not create your own
|
||||
subclasses of this class. Instead, create instances of `MGLRasterStyleLayer`
|
||||
and the concrete subclasses of `MGLVectorStyleLayer`.
|
||||
subclasses of this class. Instead, create instances of
|
||||
`MGLBackgroundStyleLayer` and the concrete subclasses of
|
||||
`MGLForegroundStyleLayer`.
|
||||
*/
|
||||
@interface MGLForegroundStyleLayer : MGLStyleLayer
|
||||
@interface MGLStyleLayer : NSObject
|
||||
|
||||
#pragma mark Initializing a Style Layer
|
||||
|
||||
/**
|
||||
Returns a foreground style layer initialized with an identifier and source.
|
||||
Returns a style layer object initialized with the given identifier.
|
||||
|
||||
After initializing and configuring the style layer, add it to a map view’s
|
||||
style using the `-[MGLStyle addLayer:]` or
|
||||
`-[MGLStyle insertLayer:belowLayer:]` method.
|
||||
|
||||
@param identifier A string that uniquely identifies the source in the style to
|
||||
@param identifier A string that uniquely identifies the layer in the style to
|
||||
which it is added.
|
||||
@param source The source from which to obtain the data to style. If the source
|
||||
has not yet been added to the current style, the behavior is undefined.
|
||||
@return An initialized foreground style layer.
|
||||
@return An initialized style layer.
|
||||
*/
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier;
|
||||
|
||||
#pragma mark Specifying a Style Layer’s Content
|
||||
#pragma mark Identifying a Style Layer
|
||||
|
||||
/**
|
||||
Identifier of the source from which the receiver obtains the data to style.
|
||||
A string that uniquely identifies the style layer in the style to which it is
|
||||
added.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *sourceIdentifier;
|
||||
@property (nonatomic, copy, readonly) NSString *identifier;
|
||||
|
||||
@end
|
||||
#pragma mark Configuring a Style Layer’s Visibility
|
||||
|
||||
/**
|
||||
`MGLVectorStyleLayer` is an abstract superclass for style layers whose content
|
||||
is defined by an `MGLGeoJSONSource` or `MGLVectorSource` object.
|
||||
|
||||
Do not create instances of this class directly, and do not create your own
|
||||
subclasses of this class. Instead, create instances of the following concrete
|
||||
subclasses: `MGLCircleStyleLayer`, `MGLFillStyleLayer`, `MGLLineStyleLayer`,
|
||||
and `MGLSymbolStyleLayer`.
|
||||
Whether this layer is displayed. A value of `NO` hides the layer.
|
||||
*/
|
||||
@interface MGLVectorStyleLayer : MGLForegroundStyleLayer
|
||||
|
||||
#pragma mark Refining a Style Layer’s Content
|
||||
@property (nonatomic, assign, getter=isVisible) BOOL visible;
|
||||
|
||||
/**
|
||||
Identifier of the layer within the source identified by the `sourceIdentifier`
|
||||
property from which the receiver obtains the data to style.
|
||||
The maximum zoom level at which the layer gets parsed and appears.
|
||||
*/
|
||||
@property (nonatomic, nullable) NSString *sourceLayerIdentifier;
|
||||
@property (nonatomic, assign) float maximumZoomLevel;
|
||||
|
||||
/**
|
||||
A predicate that corresponds to the layer's <a href='https://www.mapbox.com/mapbox-gl-style-spec/#types-filter'>filter</a>.
|
||||
|
||||
The predicate's left expression must be a string that identifies a feature
|
||||
property, or one of the special keys.
|
||||
The minimum zoom level at which the layer gets parsed and appears.
|
||||
*/
|
||||
@property (nonatomic, nullable) NSPredicate *predicate;
|
||||
@property (nonatomic, assign) float minimumZoomLevel;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
|
||||
|
||||
#import "MGLStyleAttributeValue.h"
|
||||
#import "MGLBaseStyleLayer.h"
|
||||
#import "MGL<%-
|
||||
(type === 'background' ? '' :
|
||||
(type === 'raster' ? 'Foreground' :
|
||||
'Vector'))
|
||||
%>StyleLayer.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -60,11 +64,11 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(type) %>StyleLayer<%- camelize(prope
|
||||
`-[MGLStyle layerWithIdentifier:]` method.
|
||||
*/
|
||||
<% } -%>
|
||||
@interface MGL<%- camelize(type) %>StyleLayer : <%-
|
||||
(type === 'background' ? 'MGLStyleLayer' :
|
||||
(type === 'raster' ? 'MGLForegroundStyleLayer' :
|
||||
'MGLVectorStyleLayer'))
|
||||
%>
|
||||
@interface MGL<%- camelize(type) %>StyleLayer : MGL<%-
|
||||
(type === 'background' ? '' :
|
||||
(type === 'raster' ? 'Foreground' :
|
||||
'Vector'))
|
||||
%>StyleLayer
|
||||
<% if (type === 'background') { -%>
|
||||
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@@ -1,28 +1,50 @@
|
||||
#import "MGLStyleLayer_Private.h"
|
||||
#import "MGLSource.h"
|
||||
#import "MGLMapView_Private.h"
|
||||
|
||||
@implementation MGLForegroundStyleLayer
|
||||
#include <mbgl/style/layer.hpp>
|
||||
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)source {
|
||||
if (self = [super initWithIdentifier:identifier]) {
|
||||
_sourceIdentifier = source.identifier;
|
||||
@implementation MGLStyleLayer
|
||||
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_identifier = identifier;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MGLVectorStyleLayer
|
||||
|
||||
- (void)setPredicate:(NSPredicate *)predicate {
|
||||
[NSException raise:@"MGLAbstractClassException"
|
||||
format:@"MGLVectorLayer is an abstract class"];
|
||||
- (void)setVisible:(BOOL)visible
|
||||
{
|
||||
mbgl::style::VisibilityType v = visible
|
||||
? mbgl::style::VisibilityType::Visible
|
||||
: mbgl::style::VisibilityType::None;
|
||||
self.layer->setVisibility(v);
|
||||
}
|
||||
|
||||
- (NSPredicate *)predicate {
|
||||
[NSException raise:@"MGLAbstractClassException"
|
||||
format:@"MGLVectorLayer is an abstract class"];
|
||||
return nil;
|
||||
- (BOOL)isVisible
|
||||
{
|
||||
mbgl::style::VisibilityType v = self.layer->getVisibility();
|
||||
return (v == mbgl::style::VisibilityType::Visible);
|
||||
}
|
||||
|
||||
- (void)setMaximumZoomLevel:(float)maximumZoomLevel
|
||||
{
|
||||
self.layer->setMaxZoom(maximumZoomLevel);
|
||||
}
|
||||
|
||||
- (float)maximumZoomLevel
|
||||
{
|
||||
return self.layer->getMaxZoom();
|
||||
}
|
||||
|
||||
- (void)setMinimumZoomLevel:(float)minimumZoomLevel
|
||||
{
|
||||
self.layer->setMinZoom(minimumZoomLevel);
|
||||
}
|
||||
|
||||
- (float)minimumZoomLevel
|
||||
{
|
||||
return self.layer->getMinZoom();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
|
||||
|
||||
#import "MGLStyleAttributeValue.h"
|
||||
#import "MGLBaseStyleLayer.h"
|
||||
#import "MGLVectorStyleLayer.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
36
platform/darwin/src/MGLVectorStyleLayer.h
Normal file
36
platform/darwin/src/MGLVectorStyleLayer.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MGLForegroundStyleLayer.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
`MGLVectorStyleLayer` is an abstract superclass for style layers whose content
|
||||
is defined by an `MGLGeoJSONSource` or `MGLVectorSource` object.
|
||||
|
||||
Do not create instances of this class directly, and do not create your own
|
||||
subclasses of this class. Instead, create instances of the following concrete
|
||||
subclasses: `MGLCircleStyleLayer`, `MGLFillStyleLayer`, `MGLLineStyleLayer`,
|
||||
and `MGLSymbolStyleLayer`.
|
||||
*/
|
||||
@interface MGLVectorStyleLayer : MGLForegroundStyleLayer
|
||||
|
||||
#pragma mark Refining a Style Layer’s Content
|
||||
|
||||
/**
|
||||
Identifier of the layer within the source identified by the `sourceIdentifier`
|
||||
property from which the receiver obtains the data to style.
|
||||
*/
|
||||
@property (nonatomic, nullable) NSString *sourceLayerIdentifier;
|
||||
|
||||
/**
|
||||
A predicate that corresponds to the layer's <a href='https://www.mapbox.com/mapbox-gl-style-spec/#types-filter'>filter</a>.
|
||||
|
||||
The predicate's left expression must be a string that identifies a feature
|
||||
property, or one of the special keys.
|
||||
*/
|
||||
@property (nonatomic, nullable) NSPredicate *predicate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
16
platform/darwin/src/MGLVectorStyleLayer.m
Normal file
16
platform/darwin/src/MGLVectorStyleLayer.m
Normal file
@@ -0,0 +1,16 @@
|
||||
#import "MGLVectorStyleLayer.h"
|
||||
|
||||
@implementation MGLVectorStyleLayer
|
||||
|
||||
- (void)setPredicate:(NSPredicate *)predicate {
|
||||
[NSException raise:@"MGLAbstractClassException"
|
||||
format:@"MGLVectorLayer is an abstract class"];
|
||||
}
|
||||
|
||||
- (NSPredicate *)predicate {
|
||||
[NSException raise:@"MGLAbstractClassException"
|
||||
format:@"MGLVectorLayer is an abstract class"];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user