-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
@jfirebaugh, thanks for your PR! By analyzing the history of the files in this pull request, we identified @yhahn, @brunoabinader and @kkaefer to be potential reviewers. |
3f44890
to
a4142e8
Compare
}; | ||
|
||
struct SymbolSpacing : LayoutProperty<float> { | ||
static float defaultValue() { return 250; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using static functions instead of a constexpr
member var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some property types are not constexpr
(std::string
, std:array<float, 2>
). It's possible we could use constexpr
type variants (const char *
, float[2]
) for defaultValue
but for now I just went with this simple solution. It'll probably be inlined anyway.
74b724e
to
0782253
Compare
a4142e8
to
86120b8
Compare
0782253
to
8cdf2ec
Compare
86120b8
to
f1975f0
Compare
8cdf2ec
to
8d201ab
Compare
f1975f0
to
5ac1e32
Compare
b7f71e7
to
f41e21d
Compare
5ac1e32
to
c87d461
Compare
aa791f9
to
020260d
Compare
c87d461
to
45ae594
Compare
020260d
to
3b38cf4
Compare
45ae594
to
b265221
Compare
709232d
to
1a79317
Compare
This is ready for review. Like #6856, it takes a fair amount of work to keep up to date against |
8cee799
to
0e30f2d
Compare
duration ? duration : defaults.duration, | ||
delay ? delay : defaults.delay | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function produces a weird call pattern: the method is called defaults
which makes me think it returns defaults, but actually, it returns the values of the current objects if they are set, otherwise the defaults that are passed into this method. Can we come up with a clearer way of using the default values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was modeling on _.defaults
but would be fine with renaming it to reverseMerge
or something like that.
}; | ||
|
||
} // namespace style | ||
} // namespace mbgl | ||
} // namespace mgbl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.
}; | ||
|
||
} // namespace style | ||
} // namespace mbgl | ||
} // namespace mgbl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.
0e30f2d
to
829852e
Compare
This converts the style property classes (CirclePaintProperties and so on) to the same tuple-based approach as gl::Attribute and gl::Uniform. The approach is outlined in https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md. The main advantage of this approach is it allows writing algorithms that work on sets of style properties, without resorting to code generation or manually repetitive code. This lets us iterate on approaches to data-driven properties more easily. Another advantage is that the cascading, unevaluated, and evaluated states of a set of properties exist as independent structures, instead of individual properties holding their own state. This is a more functional approach that makes data flow clearer and reduces state.
829852e
to
38fcbe2
Compare
First item from #4860.
The strategy here is outlined in https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md.
The interesting parts to look at are
paint_property.hpp
andlayout_property.hpp
and one of the generated layer properties, likecircle_layer_properties.hpp
.