-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[android] - expose source layer identifier #8709
Conversation
0b1bc30
to
da28a2f
Compare
Whitespacing has been adressed + fixed a couple of nit's in the existing code. |
@@ -99,7 +108,7 @@ public class <%- camelize(type) %>Layer extends Layer { | |||
return this; | |||
} | |||
|
|||
<% } -%> | |||
<% } -%> |
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.
nit: probably accidental?
@@ -144,6 +144,25 @@ namespace android { | |||
} | |||
} | |||
|
|||
jni::String Layer::getSourceLayer(jni::JNIEnv& env) { |
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 set a bad example here (my apologies), but a more extensible way of doing this would be something like:
struct Evaluator {
std::string operator()(mbgl::style::BackgroundLayer&) { return {}; }
std::string operator()(mbgl::style::RasterLayer&) { return {}; }
std::string operator()(mbgl::style::CustomLayer&) { return {}; }
template <class VectorLayer>
std::string operator()(VectorLayer& layer) {
return layer.getSourceLayer();
}
};
...
std::string sourceLayerId = layer.accept(Evaluator());
maybe it's better though to clean this up separately in a pr and do the others in this class at the same time (might be quite some overlap).
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.
Follow up ticket in #8758
da28a2f
to
e8b17b1
Compare
Once CI approves, going to merge |
Closes #8663, need to fixup some whitespacing in the
.ejs
template file before reviewing.This PR add a getter for source layer identifier on the layer classes that support it. Exposing this allows to iterate all layers and check for a specfic source layer identifiers, eg.
road
.