Expose scoped domain geometry in the existing Cesium renderer
This commit is contained in:
@@ -319,3 +319,20 @@ Data Plane, а не Map Template.
|
||||
факте для quality/diagnostics, но не образуют дополнительные UI-фильтры. Цвет,
|
||||
геометрия таргета, label и порядок фильтров остаются в Foundry presentation
|
||||
profile.
|
||||
|
||||
## Domain geometry in the existing renderer
|
||||
|
||||
`@nodedc/map-cesium-react` 0.1.1 adds optional `onSceneReady(context)`;
|
||||
CesiumJS remains pinned to **1.143.0**. Existing consumers need no changes.
|
||||
`context` contains the existing `Cesium` namespace, renderer-owned `viewer`,
|
||||
and an abort `signal`. A consumer can attach ready domain geometry, pick
|
||||
objects and move the camera, returning synchronous cleanup for its own
|
||||
entities, primitives and listeners. Cleanup runs after abort and before
|
||||
viewer destruction, including provider toggles and renderer recovery.
|
||||
Asynchronous work must check the signal before attaching anything.
|
||||
|
||||
The callback must not create another Viewer, replace providers, introduce
|
||||
upstream credentials, or bypass the same-origin runtime/Map Gateway. Prepared
|
||||
BIM mesh residency, product leases, geometry budgets and project placement
|
||||
belong to the portable BIM consumer. The shared adapter retains sole ownership
|
||||
of imagery, terrain, buildings, network/cache intent and render recovery.
|
||||
|
||||
Generated
+1
-1
@@ -2462,7 +2462,7 @@
|
||||
},
|
||||
"packages/map-cesium-react": {
|
||||
"name": "@nodedc/map-cesium-react",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"dependencies": {
|
||||
"cesium": "1.143.0"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nodedc/map-cesium-react",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "Shared credential-free Cesium adapter for NODE.DC Map Page consumers.",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -60,10 +60,13 @@ export const CesiumMapRenderer = forwardRef<
|
||||
className,
|
||||
onRuntimeStateChange,
|
||||
onCameraChange,
|
||||
onSceneReady,
|
||||
}, forwardedRef) {
|
||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||
const stateCallbackRef = useRef(onRuntimeStateChange);
|
||||
const cameraCallbackRef = useRef(onCameraChange);
|
||||
const sceneCallbackRef = useRef(onSceneReady);
|
||||
sceneCallbackRef.current = onSceneReady;
|
||||
const runtimeRef = useRef<RendererRuntime | null>(null);
|
||||
const settingsRef = useRef(settings);
|
||||
const layersRef = useRef(layers);
|
||||
@@ -116,6 +119,7 @@ export const CesiumMapRenderer = forwardRef<
|
||||
const abortController = new AbortController();
|
||||
let disposed = false;
|
||||
let viewer: CesiumModule.Viewer | null = null;
|
||||
let disposeConsumer: (() => void) | void;
|
||||
let removeCameraListener: (() => void) | undefined;
|
||||
let removeRenderListener: (() => void) | undefined;
|
||||
let runtimeState = initialMapRuntimeState();
|
||||
@@ -191,6 +195,8 @@ export const CesiumMapRenderer = forwardRef<
|
||||
);
|
||||
removeRenderListener = bindRenderRecovery(viewer, publish);
|
||||
|
||||
disposeConsumer = sceneCallbackRef.current?.({Cesium, viewer, signal: abortController.signal});
|
||||
|
||||
const providerJobs = (["imagery", "terrain", "buildings"] as const).map(
|
||||
async (providerId) => {
|
||||
const visible = layers[providerId];
|
||||
@@ -265,6 +271,7 @@ export const CesiumMapRenderer = forwardRef<
|
||||
return () => {
|
||||
disposed = true;
|
||||
abortController.abort();
|
||||
try { disposeConsumer?.(); } finally {
|
||||
removeCameraListener?.();
|
||||
removeRenderListener?.();
|
||||
runtimeRef.current?.stopGhostPinAnimation?.();
|
||||
@@ -272,6 +279,7 @@ export const CesiumMapRenderer = forwardRef<
|
||||
viewer?.destroy();
|
||||
viewer = null;
|
||||
container.replaceChildren();
|
||||
}
|
||||
};
|
||||
}, [
|
||||
runtimeConfigUrl,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type * as Cesium from "cesium";
|
||||
export const MAP_RUNTIME_SCHEMA_VERSION = "missioncore.map-runtime/v1" as const;
|
||||
export const MAP_PAGE_VERSION = "0.1.0" as const;
|
||||
export const CESIUM_RENDERER_VERSION = "1.143.0" as const;
|
||||
@@ -159,7 +160,16 @@ export type MapCacheIntent = {
|
||||
no_overwrite: boolean;
|
||||
};
|
||||
|
||||
/** A consumer may attach domain objects to this renderer-owned scene. It must
|
||||
* remove its objects/listeners in the returned synchronous cleanup. Pending
|
||||
* work must observe signal; it may never destroy the viewer or change providers. */
|
||||
export type MapSceneContext = {
|
||||
Cesium: typeof Cesium;
|
||||
viewer: Cesium.Viewer;
|
||||
signal: AbortSignal;
|
||||
};
|
||||
export type CesiumMapRendererProps = {
|
||||
onSceneReady?: (context: MapSceneContext) => (() => void) | void;
|
||||
runtimeConfigUrl: string;
|
||||
camera: MapCamera | null;
|
||||
layers: MapLayerVisibility;
|
||||
|
||||
@@ -7,6 +7,7 @@ export {
|
||||
export type {
|
||||
CesiumMapRendererHandle,
|
||||
CesiumMapRendererProps,
|
||||
MapSceneContext,
|
||||
MapCacheIntent,
|
||||
MapCamera,
|
||||
MapGeoPoint,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
{
|
||||
"name": "@nodedc/map-cesium-react",
|
||||
"path": "packages/map-cesium-react",
|
||||
"role": "credential-free Cesium renderer adapter for the canonical Map Page and same-origin Platform Map Gateway BFFs"
|
||||
"role": "credential-free Cesium 1.143.0 renderer adapter for canonical Map Page and same-origin Map Gateway BFFs; optional lifetime-scoped ready-domain geometry hook"
|
||||
}
|
||||
],
|
||||
"sourceRegistry": "sources.json",
|
||||
|
||||
Reference in New Issue
Block a user