summaryrefslogtreecommitdiff
path: root/platform/darwin/src
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-10-05 00:50:48 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-10-06 15:19:38 -0700
commit0acf1ed5969cdf8ff428beea1b5cdc8d64bfc10f (patch)
tree0610d378b7fb7a5fbd2715775f0696304f74e187 /platform/darwin/src
parent50d2c01d7d0bad1aa1dee1a028e06f49f33c9b4c (diff)
downloadqtlocation-mapboxgl-0acf1ed5969cdf8ff428beea1b5cdc8d64bfc10f.tar.gz
[ios, macos] Renamed files to match renamed classes
Diffstat (limited to 'platform/darwin/src')
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLBaseStyleLayer.h65
-rw-r--r--platform/darwin/src/MGLBaseStyleLayer.mm52
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLForegroundStyleLayer.h45
-rw-r--r--platform/darwin/src/MGLForegroundStyleLayer.m13
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLSource.h4
-rw-r--r--platform/darwin/src/MGLStyleLayer.h63
-rw-r--r--platform/darwin/src/MGLStyleLayer.h.ejs16
-rw-r--r--platform/darwin/src/MGLStyleLayer.mm50
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLVectorStyleLayer.h36
-rw-r--r--platform/darwin/src/MGLVectorStyleLayer.m16
16 files changed, 191 insertions, 181 deletions
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h
index d464eb49f2..1a4c64dedf 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.h
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.h
@@ -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
diff --git a/platform/darwin/src/MGLBaseStyleLayer.h b/platform/darwin/src/MGLBaseStyleLayer.h
deleted file mode 100644
index cfdc03962f..0000000000
--- a/platform/darwin/src/MGLBaseStyleLayer.h
+++ /dev/null
@@ -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
diff --git a/platform/darwin/src/MGLBaseStyleLayer.mm b/platform/darwin/src/MGLBaseStyleLayer.mm
deleted file mode 100644
index 8a599e67c7..0000000000
--- a/platform/darwin/src/MGLBaseStyleLayer.mm
+++ /dev/null
@@ -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
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h
index bddc6bf525..d056815b9d 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.h
+++ b/platform/darwin/src/MGLCircleStyleLayer.h
@@ -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
diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h
index ff1edddd5a..8776c1755f 100644
--- a/platform/darwin/src/MGLFillStyleLayer.h
+++ b/platform/darwin/src/MGLFillStyleLayer.h
@@ -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
diff --git a/platform/darwin/src/MGLForegroundStyleLayer.h b/platform/darwin/src/MGLForegroundStyleLayer.h
new file mode 100644
index 0000000000..cb98876810
--- /dev/null
+++ b/platform/darwin/src/MGLForegroundStyleLayer.h
@@ -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
diff --git a/platform/darwin/src/MGLForegroundStyleLayer.m b/platform/darwin/src/MGLForegroundStyleLayer.m
new file mode 100644
index 0000000000..e3af963313
--- /dev/null
+++ b/platform/darwin/src/MGLForegroundStyleLayer.m
@@ -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
diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h
index f8a9970f31..d3969ddd34 100644
--- a/platform/darwin/src/MGLLineStyleLayer.h
+++ b/platform/darwin/src/MGLLineStyleLayer.h
@@ -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
diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h
index d0a08c8223..90af43c7a1 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.h
+++ b/platform/darwin/src/MGLRasterStyleLayer.h
@@ -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
diff --git a/platform/darwin/src/MGLSource.h b/platform/darwin/src/MGLSource.h
index 79f6ce491f..ec3733bf08 100644
--- a/platform/darwin/src/MGLSource.h
+++ b/platform/darwin/src/MGLSource.h
@@ -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.
diff --git a/platform/darwin/src/MGLStyleLayer.h b/platform/darwin/src/MGLStyleLayer.h
index 763854f44c..cfdc03962f 100644
--- a/platform/darwin/src/MGLStyleLayer.h
+++ b/platform/darwin/src/MGLStyleLayer.h
@@ -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
diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs
index e27808bfc7..c688f1db5f 100644
--- a/platform/darwin/src/MGLStyleLayer.h.ejs
+++ b/platform/darwin/src/MGLStyleLayer.h.ejs
@@ -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;
diff --git a/platform/darwin/src/MGLStyleLayer.mm b/platform/darwin/src/MGLStyleLayer.mm
index b0fbb38dc9..a2bb1fc2cf 100644
--- a/platform/darwin/src/MGLStyleLayer.mm
+++ b/platform/darwin/src/MGLStyleLayer.mm
@@ -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
+- (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);
+}
-@implementation MGLVectorStyleLayer
+- (float)maximumZoomLevel
+{
+ return self.layer->getMaxZoom();
+}
-- (void)setPredicate:(NSPredicate *)predicate {
- [NSException raise:@"MGLAbstractClassException"
- format:@"MGLVectorLayer is an abstract class"];
+- (void)setMinimumZoomLevel:(float)minimumZoomLevel
+{
+ self.layer->setMinZoom(minimumZoomLevel);
}
-- (NSPredicate *)predicate {
- [NSException raise:@"MGLAbstractClassException"
- format:@"MGLVectorLayer is an abstract class"];
- return nil;
+- (float)minimumZoomLevel
+{
+ return self.layer->getMinZoom();
}
@end
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
index 45387bdf87..c12471a0d3 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.h
+++ b/platform/darwin/src/MGLSymbolStyleLayer.h
@@ -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
diff --git a/platform/darwin/src/MGLVectorStyleLayer.h b/platform/darwin/src/MGLVectorStyleLayer.h
new file mode 100644
index 0000000000..c9272ac89b
--- /dev/null
+++ b/platform/darwin/src/MGLVectorStyleLayer.h
@@ -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
diff --git a/platform/darwin/src/MGLVectorStyleLayer.m b/platform/darwin/src/MGLVectorStyleLayer.m
new file mode 100644
index 0000000000..174256cbdd
--- /dev/null
+++ b/platform/darwin/src/MGLVectorStyleLayer.m
@@ -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