feat: add generic render segment model
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
tei
2026-09-25 13:55:19 +09:00
parent 8fbb892a12
commit 016fd1fff6
29 changed files with 1409 additions and 162 deletions

View File

@@ -36,6 +36,7 @@
#include <mbgl/style/image.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/renderer/query.hpp>
#include <mbgl/renderer/render_segment_json.hpp>
#include <mbgl/particle/field/field_profile_contract_json.hpp>
#include <mbgl/particle/ingress/encoded_field_transport.hpp>
@@ -727,6 +728,19 @@ jni::jboolean NativeMapView::setContinuousLayerRange(JNIEnv& env,
jni::Make<std::string>(env, endLayerId));
}
jni::jboolean NativeMapView::setRenderSegmentPlan(JNIEnv& env, const jni::String& planJson) {
const auto plan = parseRenderSegmentPlanJSON(jni::Make<std::string>(env, planJson));
if (plan) return map->setRenderSegmentPlan(*plan);
RenderSegmentPlan invalid;
invalid.schemaVersion = 0;
map->setRenderSegmentPlan(std::move(invalid));
return false;
}
jni::Local<jni::String> NativeMapView::getRenderSegmentDiagnostics(JNIEnv& env) {
return jni::Make<jni::String>(env, renderSegmentDiagnosticsToJSON(map->getRenderSegmentDiagnostics()));
}
jni::Local<jni::Array<jni::String>> NativeMapView::getRetainedUnderlayDiagnostics(JNIEnv& env) {
const auto snapshot = map->getRetainedUnderlayDiagnostics();
const std::array<std::string, 39> values = {
@@ -1858,6 +1872,8 @@ void NativeMapView::registerNative(jni::JNIEnv& env) {
METHOD(&NativeMapView::getDebug, "nativeGetDebug"),
METHOD(&NativeMapView::setRetainedUnderlayEnabled, "nativeSetRetainedUnderlayEnabled"),
METHOD(&NativeMapView::setContinuousLayerRange, "nativeSetContinuousLayerRange"),
METHOD(&NativeMapView::setRenderSegmentPlan, "nativeSetRenderSegmentPlan"),
METHOD(&NativeMapView::getRenderSegmentDiagnostics, "nativeGetRenderSegmentDiagnostics"),
METHOD(&NativeMapView::getRetainedUnderlayDiagnostics, "nativeGetRetainedUnderlayDiagnostics"),
METHOD(&NativeMapView::getActionJournalLogFiles, "nativeGetActionJournalLogFiles"),
METHOD(&NativeMapView::getActionJournalLog, "nativeGetActionJournalLog"),