Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] - add default heatmap color to getter
Browse files Browse the repository at this point in the history
  • Loading branch information
tobrun committed Feb 19, 2018
1 parent 366051e commit e5ce57b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion platform/android/src/style/layers/heatmap_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ namespace android {

jni::Object<jni::ObjectTag> HeatmapLayer::getHeatmapColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
Result<jni::jobject*> converted = convert<jni::jobject*>(env, layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapColor());
auto propertyValue = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapColor();
if (propertyValue.isUndefined()) {
propertyValue = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getDefaultHeatmapColor();
}
Result<jni::jobject*> converted = convert<jni::jobject*>(env, propertyValue);
return jni::Object<jni::ObjectTag>(*converted);
}

Expand Down
13 changes: 13 additions & 0 deletions platform/android/src/style/layers/layer.cpp.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,25 @@ namespace android {
// Property getters
<% for (const property of properties) { -%>
<% if (property.name != 'heatmap-color') { -%>
jni::Object<jni::ObjectTag> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
Result<jni::jobject*> converted = convert<jni::jobject*>(env, layer.as<mbgl::style::<%- camelize(type) %>Layer>()-><%- camelize(type) %>Layer::get<%- camelize(property.name) %>());
return jni::Object<jni::ObjectTag>(*converted);
}
<% } else { -%>
jni::Object<jni::ObjectTag> HeatmapLayer::getHeatmapColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
auto propertyValue = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapColor();
if (propertyValue.isUndefined()) {
propertyValue = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getDefaultHeatmapColor();
}
Result<jni::jobject*> converted = convert<jni::jobject*>(env, propertyValue);
return jni::Object<jni::ObjectTag>(*converted);
}
<% } -%>
<% if (property.transition) { -%>
jni::Object<TransitionOptions> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>Transition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
Expand Down

0 comments on commit e5ce57b

Please sign in to comment.