-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
|
||
// Private implementation | ||
|
||
std::unique_ptr<Layer> clone() const final; |
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.
Any way we can move this to Impl
?
Looks good! As for the generated files, it's probably useful to have them pre-generated to be able to look at them. We could still add the generation script to the build system, and check whether files were modified and fail if that is the case. |
976397a
to
67ce67c
Compare
How about running the generation script as part of the build, but having the script output to the checkout, as it does now? |
For now I'm going to go with running the generator manually when you make a change. I looked at including it as part of the build step but outputting to the src directory (which I want to do) didn't fit in cleanly with our use of gyp. |
d298ab0
to
00c9500
Compare
The last commit here involves a lot of renaming and re-namespacing. Would be great to get a second opinion on my approach:
|
4ac3b87
to
0d8fb9a
Compare
PropertyValue<T> represents the three possible types of style property value: undefined, constant, or function.
This PR implements the first bit of the core runtime styling API: the ability to dynamically add and remove layers.
As appropriate for a C++ API, the layers API is strongly typed: there are subclasses for each layer type, with correctly-typed accessors for each style property. This results in a large API surface area. Fortunately, this is automated, by generating the API – and the regular portion of the implementation – from the style specification.
The layers API makes a distinction between public API and internal implementation using the
Impl
idiom seen elsewhere in the codebase. Here, it takes the form of two parallel class hierarchies:Layer
and its subclasses form the public API.Layer::Impl
and its subclasses form the internal API.As well as forming the boundary between public and internal, these two class hierarchies form the boundary between generated code and handwritten code. Except for
CustomLayer
andCustomLayer::Impl
:Layer
subclasses are entirely generated. (Layer
itself is handwritten.)Layer::Impl
and its subclasses are entirely handwritten.There is still work to be done before this is ready to be exposed via SDK bindings:
mbgl::style
namespace andmbgl/style
directory. (Beneath that directory there can be alayer
directory for organization.)map.getStyle().getLayer()
as the API.Map::{add,remove}Layer
would also move toStyle
.