feat: add generic render segment model
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
FieldRuntime,
|
||||
RendererRuntime,
|
||||
type RetainedUnderlayDiagnostics,
|
||||
type RenderSegmentDiagnostics,
|
||||
type RuntimeSnapshot,
|
||||
} from "@navsea/maplibre-particle-rn";
|
||||
import {
|
||||
@@ -67,6 +68,8 @@ export default function App() {
|
||||
const [snapshot, setSnapshot] = useState<RuntimeSnapshot>(initialSnapshot);
|
||||
const [retainedSnapshot, setRetainedSnapshot] =
|
||||
useState<RetainedUnderlayDiagnostics | null>(null);
|
||||
const [segmentSnapshot, setSegmentSnapshot] =
|
||||
useState<RenderSegmentDiagnostics | null>(null);
|
||||
const [mapStatus, setMapStatus] = useState("LOADING");
|
||||
const [weatherStatus, setWeatherStatus] = useState("WAITING");
|
||||
const [result, setResult] = useState("Waiting for map/style");
|
||||
@@ -91,6 +94,11 @@ export default function App() {
|
||||
const refreshRetained = useCallback(async (tag: number) => {
|
||||
setRetainedSnapshot(await RendererRuntime.getRetainedUnderlayDiagnostics(tag));
|
||||
}, []);
|
||||
const refreshSegments = useCallback(async (tag: number) => {
|
||||
const value = await RendererRuntime.getRenderSegmentDiagnostics(tag);
|
||||
setSegmentSnapshot(value);
|
||||
setResult(JSON.stringify(value, null, 2));
|
||||
}, []);
|
||||
const applyVisualToTag = useCallback(async (tag: number) => {
|
||||
const results = await Promise.all([
|
||||
FieldRuntime.setParticleCount(tag, Number(visual.count)),
|
||||
@@ -384,6 +392,28 @@ export default function App() {
|
||||
onPress={() => reactTag != null && void refreshRetained(reactTag)}
|
||||
/>
|
||||
</View>
|
||||
<Text selectable>
|
||||
Segments: {segmentSnapshot == null ? "not read" :
|
||||
`${segmentSnapshot.valid ? "VALID" : "INVALID"} source=${segmentSnapshot.configSource} count=${segmentSnapshot.segmentCount} topology=${segmentSnapshot.topologyRevision}`}
|
||||
</Text>
|
||||
<View style={styles.row}>
|
||||
<Button
|
||||
title="Apply C-R plan"
|
||||
disabled={reactTag == null}
|
||||
onPress={() => reactTag != null && void RendererRuntime.setRenderSegmentPlan(reactTag, {
|
||||
schemaVersion: 1,
|
||||
segments: [
|
||||
{ strategy: "CONTINUOUS" },
|
||||
{ strategy: "RETAINED", startLayerId: "darkmap-basemap" },
|
||||
],
|
||||
}).then(() => refreshSegments(reactTag))}
|
||||
/>
|
||||
<Button
|
||||
title="Fetch Segment Diagnostics"
|
||||
disabled={reactTag == null}
|
||||
onPress={() => reactTag != null && void refreshSegments(reactTag)}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<Text>QBIN Format</Text>
|
||||
<View style={styles.row}>
|
||||
|
||||
Reference in New Issue
Block a user