fix: bridge Android particle mix property
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
OpenAI Codex
2026-09-03 10:35:17 +08:00
parent 0ab94c4eab
commit 5782574c8c
11 changed files with 68 additions and 6 deletions

View File

@@ -1106,6 +1106,23 @@ jni::Local<jni::Object<Layer>> NativeMapView::getLayer(JNIEnv& env, const jni::S
return LayerManagerAndroid::get()->createJavaLayerPeer(env, *coreLayer);
}
jni::jboolean NativeMapView::setStyleLayerFloatProperty(JNIEnv& env,
const jni::String& layerId,
const jni::String& propertyName,
const jni::jfloat value) {
auto* layer = map->getStyle().getLayer(jni::Make<std::string>(env, layerId));
if (!layer) return false;
if (const auto error = layer->setProperty(jni::Make<std::string>(env, propertyName), static_cast<double>(value))) {
mbgl::Log::Error(mbgl::Event::JNI, "ParticleGPU: event=STYLE_PROPERTY_SET result=FAILURE " + error->message);
return false;
}
mbgl::Log::Info(mbgl::Event::JNI,
"ParticleGPU: event=STYLE_PROPERTY_SET layerId=" + jni::Make<std::string>(env, layerId) +
" property=" + jni::Make<std::string>(env, propertyName) + " value=" + std::to_string(value) +
" result=SUCCESS");
return true;
}
void NativeMapView::addLayer(JNIEnv& env, jlong nativeLayerPtr, const jni::String& before) {
assert(nativeLayerPtr != 0);
@@ -1489,6 +1506,7 @@ void NativeMapView::registerNative(jni::JNIEnv& env) {
METHOD(&NativeMapView::getLight, "nativeGetLight"),
METHOD(&NativeMapView::getLayers, "nativeGetLayers"),
METHOD(&NativeMapView::getLayer, "nativeGetLayer"),
METHOD(&NativeMapView::setStyleLayerFloatProperty, "nativeSetStyleLayerFloatProperty"),
METHOD(&NativeMapView::addLayer, "nativeAddLayer"),
METHOD(&NativeMapView::addLayerAbove, "nativeAddLayerAbove"),
METHOD(&NativeMapView::addLayerAt, "nativeAddLayerAt"),