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

[android] Add jni binding for line-sort-key and fill-sort-key #16256

Merged
merged 1 commit into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

But `within` expression need to accept an Object and then convert to GeoJSON object, now `toGeoJSON` method can convert both string and Object to GeoJSON.

### ✨ New features

- [android] Add jni binding for line-sort-key and fill-sort-key ([#16256](https://github.com/mapbox/mapbox-gl-native/pull/16256))

With this change, android sdk will be able to get sort key for LineLayer and FillLayer.

## maps-v1.3.0 (2020.02-relvanillashake)

### 🐞 Bug fixes
Expand Down
10 changes: 9 additions & 1 deletion platform/android/src/style/layers/fill_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ namespace android {

// Property getters

jni::Local<jni::Object<>> FillLayer::getFillSortKey(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillLayer(layer).getFillSortKey()));
}

jni::Local<jni::Object<>> FillLayer::getFillAntialias(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillLayer(layer).getFillAntialias()));
Expand Down Expand Up @@ -172,10 +177,13 @@ namespace android {

// Register the peer
jni::RegisterNativePeer<FillLayer>(
env, javaClass, "nativePtr",
env,
javaClass,
"nativePtr",
jni::MakePeer<FillLayer, jni::String&, jni::String&>,
"initialize",
"finalize",
METHOD(&FillLayer::getFillSortKey, "nativeGetFillSortKey"),
METHOD(&FillLayer::getFillAntialias, "nativeGetFillAntialias"),
METHOD(&FillLayer::getFillOpacityTransition, "nativeGetFillOpacityTransition"),
METHOD(&FillLayer::setFillOpacityTransition, "nativeSetFillOpacityTransition"),
Expand Down
2 changes: 2 additions & 0 deletions platform/android/src/style/layers/fill_layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class FillLayer : public Layer {

// Properties

jni::Local<jni::Object<jni::ObjectTag>> getFillSortKey(jni::JNIEnv&);

jni::Local<jni::Object<jni::ObjectTag>> getFillAntialias(jni::JNIEnv&);

jni::Local<jni::Object<jni::ObjectTag>> getFillOpacity(jni::JNIEnv&);
Expand Down
4 changes: 3 additions & 1 deletion platform/android/src/style/layers/layer.cpp.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ namespace android {

// Register the peer
jni::RegisterNativePeer<<%- camelize(type) %>Layer>(
env, javaClass, "nativePtr",
env,
javaClass,
"nativePtr",
<% if (type === 'background') { -%>
jni::MakePeer<<%- camelize(type) %>Layer, jni::String&>,
<% } else { -%>
Expand Down
10 changes: 9 additions & 1 deletion platform/android/src/style/layers/line_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ namespace android {
return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineRoundLimit()));
}

jni::Local<jni::Object<>> LineLayer::getLineSortKey(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineSortKey()));
}

jni::Local<jni::Object<>> LineLayer::getLineOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineOpacity()));
Expand Down Expand Up @@ -264,14 +269,17 @@ namespace android {

// Register the peer
jni::RegisterNativePeer<LineLayer>(
env, javaClass, "nativePtr",
env,
javaClass,
"nativePtr",
jni::MakePeer<LineLayer, jni::String&, jni::String&>,
"initialize",
"finalize",
METHOD(&LineLayer::getLineCap, "nativeGetLineCap"),
METHOD(&LineLayer::getLineJoin, "nativeGetLineJoin"),
METHOD(&LineLayer::getLineMiterLimit, "nativeGetLineMiterLimit"),
METHOD(&LineLayer::getLineRoundLimit, "nativeGetLineRoundLimit"),
METHOD(&LineLayer::getLineSortKey, "nativeGetLineSortKey"),
METHOD(&LineLayer::getLineOpacityTransition, "nativeGetLineOpacityTransition"),
METHOD(&LineLayer::setLineOpacityTransition, "nativeSetLineOpacityTransition"),
METHOD(&LineLayer::getLineOpacity, "nativeGetLineOpacity"),
Expand Down
2 changes: 2 additions & 0 deletions platform/android/src/style/layers/line_layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class LineLayer : public Layer {

jni::Local<jni::Object<jni::ObjectTag>> getLineRoundLimit(jni::JNIEnv&);

jni::Local<jni::Object<jni::ObjectTag>> getLineSortKey(jni::JNIEnv&);

jni::Local<jni::Object<jni::ObjectTag>> getLineOpacity(jni::JNIEnv&);
void setLineOpacityTransition(jni::JNIEnv&, jlong duration, jlong delay);
jni::Local<jni::Object<TransitionOptions>> getLineOpacityTransition(jni::JNIEnv&);
Expand Down