summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLLight.h.ejs
blob: 30efef79370d31e1ebe24160d869453226b14d24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<%
  const properties = locals.properties;
  const type = locals.type;
  const doc = locals.doc;
-%>
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.

#import <CoreLocation/CoreLocation.h>

#import "MGLFoundation.h"
#import "MGLStyleValue.h"

NS_ASSUME_NONNULL_BEGIN

<% for (const property of properties) { -%>
<% if (property.type == "enum") { -%>
/**
<%- propertyDoc(property.name, property, type, 'enum').wrap(80, 1) %>
 */
typedef NS_ENUM(NSUInteger, MGLLight<%- camelize(property.name) %>) {
<% for (const value in property.values) { -%>
    /**
<%- propertyDoc(property.name, property.values[value], type, 'enum').wrap(80, 4+1) %>
     */
    MGLLightAnchor<%- camelize(value) %>,
<% } -%>
};
<% } -%>
<% } -%>

/**
 A structure containing information about the position of the light source
 relative to lit geometries.
 */
typedef struct __attribute__((objc_boxable)) MGLSphericalPosition {
    /** Distance from the center of the base of an object to its light. */
    CGFloat radial;
    /** Position of the light relative to 0° (0° when `MGLLight.anchor` is set to viewport corresponds
     to the top of the viewport, or 0° when `MGLLight.anchor` is set to map corresponds to due north,
     and degrees proceed clockwise). */
    CLLocationDirection azimuthal;
    /** Indicates the height of the light (from 0°, directly above, to 180°, directly below). */
    CLLocationDirection polar;
} MGLSphericalPosition;

/**
 Creates a new `MGLSphericalPosition` from the given radial, azimuthal, polar.

 @param radial The radial coordinate.
 @param azimuthal The azimuthal angle.
 @param polar The polar angle.

 @return Returns a `MGLSphericalPosition` struct containing the position attributes.
 */
NS_INLINE MGLSphericalPosition MGLSphericalPositionMake(CGFloat radial, CLLocationDirection azimuthal, CLLocationDirection polar) {
    MGLSphericalPosition position;
    position.radial = radial;
    position.azimuthal = azimuthal;
    position.polar = polar;

    return position;
}

/**
 <%- doc.wrap(80, 1) %>
 */
MGL_EXPORT
@interface MGLLight : NSObject
<% if (properties.length) { -%>

<% for (const property of properties) { -%>
/**
<%- propertyDoc(property.name, property, type, 'light').wrap(80, 1) %>

 This property corresponds to the <a
 href="https://www.mapbox.com/mapbox-gl-js/style-spec/#light-<%- originalPropertyName(property) %>"><code><%- originalPropertyName(property) %></code></a>
 light property in the Mapbox Style Specification.
<% if (property.examples) { -%>

 #### Related examples
<%- propertyExample(property).wrap(80, 1) %>
<% } -%>
 */
@property (nonatomic<% 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) MGLTransition <%- 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

NS_ASSUME_NONNULL_END