Files
MapLibreParticleLab/platform/darwin/src/MLNStyleLayer.h.ejs
mwilsnd 20d9e1028c Platform flattening overhaul (#1393)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bart Louwers <bart@emeel.net>
2023-07-26 17:50:34 +02:00

200 lines
6.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<%
const doc = locals.doc;
const type = locals.type;
const examples = locals.examples;
const layoutProperties = locals.layoutProperties;
const paintProperties = locals.paintProperties;
const enumProperties = locals.enumProperties;
-%>
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MLNFoundation.h"
#import "MLN<%-
(type === 'background' ? '' :
(type === 'raster' || type === 'hillshade' ? 'Foreground' :
'Vector'))
%>StyleLayer.h"
NS_ASSUME_NONNULL_BEGIN
<% for (const property of layoutProperties) { -%>
<% if (definesEnum(property, layoutProperties)) { -%>
/**
<%- propertyDoc(enumName(property), property, type, 'enum').wrap(80, 1) %>
Values of this type are used in the `MLN<%- camelize(type) %>StyleLayer.<%- camelizeWithLeadingLowercase(property.name) %>`
property.
*/
typedef NS_ENUM(NSUInteger, MLN<%- camelize(enumName(property)) %>) {
<% for (const value in property.values) { -%>
/**
<%- propertyDoc(enumName(property), property.values[value], type, 'enum').wrap(80, 4+1) %>
*/
MLN<%- camelize(enumName(property)) %><%- camelize(value) %>,
<% } -%>
};
<% } -%>
<% } -%>
<% for (const property of paintProperties) { -%>
<% if (definesEnum(property, paintProperties)) { -%>
/**
<%- propertyDoc(enumName(property), property, type, 'enum').wrap(80, 1) %>
Values of this type are used in the `MLN<%- camelize(type) %>StyleLayer.<%- camelizeWithLeadingLowercase(enumName(property)) %>`
property.
*/
typedef NS_ENUM(NSUInteger, MLN<%- camelize(enumName(property)) %>) {
<% for (const value in property.values) { -%>
/**
<%- propertyDoc(enumName(property), property.values[value], type, 'enum').wrap(80, 4+1) %>
*/
MLN<%- camelize(enumName(property)) %><%- camelize(value) %>,
<% } -%>
};
<% } -%>
<% } -%>
<% if (type == 'background') { -%>
/**
<%- doc.wrap(80, 1) %>
*/
<% } else { -%>
/**
<%- doc.wrap(80, 1) %>
You can access an existing <%- type %> style layer using the
`-[MLNStyle layerWithIdentifier:]` method if you know its identifier;
otherwise, find it using the `MLNStyle.layers` property. You can also create a
new <%- type %> style layer and add it to the style using a method such as
`-[MLNStyle addLayer:]`.
<% if (examples) { -%>
#### Related examples
<%- examples.wrap(80, 1) %>
<% } -%>
### Example
```swift
```
*/
<% } -%>
MLN_EXPORT
@interface MLN<%- camelize(type) %>StyleLayer : MLN<%-
(type === 'background' ? '' :
(type === 'raster' || type === 'hillshade' ? 'Foreground' :
'Vector'))
%>StyleLayer
<% if (type === 'background') { -%>
/**
Returns a <%- type %> style layer initialized with an identifier.
After initializing and configuring the style layer, add it to a map view’s
style using the `-[MLNStyle addLayer:]` or
`-[MLNStyle insertLayer:belowLayer:]` method.
@param identifier A string that uniquely identifies the source in the style to
which it is added.
*/
- (instancetype)initWithIdentifier:(NSString *)identifier;
<% } else { -%>
/**
Returns a <%- type %> 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 `-[MLNStyle addLayer:]` or
`-[MLNStyle 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:(MLNSource *)source;
<% } -%>
<% if (layoutProperties.length) { -%>
// MARK: - Accessing the Layout Attributes
<% for (const property of layoutProperties) { -%>
/**
<%- propertyDoc(property.name, property, type, 'layout').wrap(80, 1) %>
<% if (property.examples) { -%>
#### Related examples
<%- propertyExample(property).wrap(80, 1) %>
<% } -%>
*/
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) NSExpression *<%- camelizeWithLeadingLowercase(property.name) %>;
<% if (property.original) { %>
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) NSExpression *<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> __attribute__((unavailable("Use <%- camelizeWithLeadingLowercase(property.name) %> instead.")));
<% } -%>
<% } -%>
<% } -%>
<% if (paintProperties.length) { -%>
// MARK: - Accessing the Paint Attributes
<% for (const property of paintProperties) { -%>
/**
<%- propertyDoc(property.name, property, type, 'paint').wrap(80, 1) %>
<% if (property.examples) { -%>
#### Related examples
<%- propertyExample(property).wrap(80, 1) %>
<% } -%>
*/
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) NSExpression *<%- camelizeWithLeadingLowercase(property.name) %>;
<% if (property["transition"]) { -%>
/**
The transition affecting any changes to this layer’s `<%- camelizeWithLeadingLowercase(property.name) %>` property.
This property corresponds to the `<%- originalPropertyName(property) %>-transition` property in the style JSON file format.
*/
@property (nonatomic) MLNTransition <%- camelizeWithLeadingLowercase(property.name) %>Transition;
<% } -%>
<% if (property.original) { -%>
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) NSExpression *<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> __attribute__((unavailable("Use <%- camelizeWithLeadingLowercase(property.name) %> instead.")));
<% } -%>
<% } -%>
<% } -%>
@end
<% if (enumProperties) { -%>
/**
Methods for wrapping an enumeration value for a style layer attribute in an
`MLN<%- camelize(type) %>StyleLayer` object and unwrapping its raw value.
*/
@interface NSValue (MLN<%- camelize(type) %>StyleLayerAdditions)
// MARK: Working with <%- camelize(unhyphenate(type)) %> Style Layer Attribute Values
<% for (let property of enumProperties) { -%>
/**
Creates a new value object containing the given `MLN<%- camelize(enumName(property)) %>` enumeration.
@param <%- objCName(property) %> The value for the new object.
@return A new value object that contains the enumeration value.
*/
+ (instancetype)valueWithMLN<%- camelize(enumName(property)) %>:(MLN<%- camelize(enumName(property)) %>)<%- objCName(property) %>;
/**
The `MLN<%- camelize(enumName(property)) %>` enumeration representation of the value.
*/
@property (readonly) MLN<%- camelize(enumName(property)) %> MLN<%- camelize(enumName(property)) %>Value;
<% } -%>
@end
<% } -%>
NS_ASSUME_NONNULL_END