Add bindings for circle-sort-key (#322)

* Update generate-style-code.js

* add jni bindings for circle-sort-key

* update mapbox-gl-native to latest

* Revert "add jni bindings for circle-sort-key"

This reverts commit cdd6049d

Co-authored-by: kevin <kevin.li@mapbox.com>
This commit is contained in:
Chloe Krawczyk
2020-04-15 02:56:54 -07:00
committed by GitHub
parent d32133790c
commit 77d0d5e5cf
7 changed files with 78 additions and 8 deletions

View File

@@ -37,6 +37,11 @@ namespace android {
// Property getters
jni::Local<jni::Object<>> CircleLayer::getCircleSortKey(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleSortKey()));
}
jni::Local<jni::Object<>> CircleLayer::getCircleRadius(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleRadius()));
@@ -237,6 +242,7 @@ namespace android {
jni::MakePeer<CircleLayer, jni::String&, jni::String&>,
"initialize",
"finalize",
METHOD(&CircleLayer::getCircleSortKey, "nativeGetCircleSortKey"),
METHOD(&CircleLayer::getCircleRadiusTransition, "nativeGetCircleRadiusTransition"),
METHOD(&CircleLayer::setCircleRadiusTransition, "nativeSetCircleRadiusTransition"),
METHOD(&CircleLayer::getCircleRadius, "nativeGetCircleRadius"),

View File

@@ -26,6 +26,8 @@ public:
// Properties
jni::Local<jni::Object<jni::ObjectTag>> getCircleSortKey(jni::JNIEnv&);
jni::Local<jni::Object<jni::ObjectTag>> getCircleRadius(jni::JNIEnv&);
void setCircleRadiusTransition(jni::JNIEnv&, jlong duration, jlong delay);
jni::Local<jni::Object<TransitionOptions>> getCircleRadiusTransition(jni::JNIEnv&);

View File

@@ -143,6 +143,18 @@ public class CircleLayer extends Layer {
// Property getters
/**
* Get the CircleSortKey property
*
* @return property wrapper value around Float
*/
@NonNull
@SuppressWarnings("unchecked")
public PropertyValue<Float> getCircleSortKey() {
checkThread();
return (PropertyValue<Float>) new PropertyValue("circle-sort-key", nativeGetCircleSortKey());
}
/**
* Get the CircleRadius property
*
@@ -477,6 +489,10 @@ public class CircleLayer extends Layer {
nativeSetCircleStrokeOpacityTransition(options.getDuration(), options.getDelay());
}
@NonNull
@Keep
private native Object nativeGetCircleSortKey();
@NonNull
@Keep
private native Object nativeGetCircleRadius();

View File

@@ -1826,7 +1826,7 @@ public class PropertyFactory {
}
/**
* Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key when they overlap. Features with a lower sort key will have priority over other features when doing placement.
* Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When {@link PropertyFactory#iconAllowOverlap} or {@link PropertyFactory#textAllowOverlap} is `false`, features with a lower sort key will have priority during placement. When {@link PropertyFactory#iconAllowOverlap} or {@link PropertyFactory#textAllowOverlap} is set to `true`, features with a higher sort key will overlap over features with a lower sort key.
*
* @param value a Float value
* @return property wrapper around Float
@@ -1836,7 +1836,7 @@ public class PropertyFactory {
}
/**
* Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key when they overlap. Features with a lower sort key will have priority over other features when doing placement.
* Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When {@link PropertyFactory#iconAllowOverlap} or {@link PropertyFactory#textAllowOverlap} is `false`, features with a lower sort key will have priority during placement. When {@link PropertyFactory#iconAllowOverlap} or {@link PropertyFactory#textAllowOverlap} is set to `true`, features with a higher sort key will overlap over features with a lower sort key.
*
* @param value a Float value
* @return property wrapper around Float
@@ -2595,4 +2595,24 @@ public class PropertyFactory {
return new LayoutPropertyValue<>("text-optional", value);
}
/**
* Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.
*
* @param value a Float value
* @return property wrapper around Float
*/
public static PropertyValue<Float> circleSortKey(Float value) {
return new LayoutPropertyValue<>("circle-sort-key", value);
}
/**
* Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.
*
* @param value a Float value
* @return property wrapper around Float
*/
public static PropertyValue<Expression> circleSortKey(Expression value) {
return new LayoutPropertyValue<>("circle-sort-key", value);
}
}