@honua/app-platform 0.1.2-beta.0 → 0.1.7-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/index.d.ts.map +1 -1
- package/app/index.js +4 -0
- package/collaboration/client.d.ts.map +1 -1
- package/connect-url-safety.d.ts +53 -0
- package/connect-url-safety.js +189 -0
- package/contract/discovery.d.ts +34 -0
- package/contract/discovery.d.ts.map +1 -1
- package/contract/index.d.ts +7 -5
- package/contract/index.d.ts.map +1 -1
- package/contract/index.js +3 -2
- package/contract/pmtiles.d.ts +10 -1
- package/contract/pmtiles.d.ts.map +1 -1
- package/contract/pmtiles.js +10 -2
- package/contract/protocol-module.d.ts +84 -9
- package/contract/protocol-module.d.ts.map +1 -1
- package/contract/query-filter-fes.d.ts +18 -0
- package/contract/query-filter-fes.d.ts.map +1 -0
- package/contract/query-filter-fes.js +122 -0
- package/contract/query-filter.d.ts +300 -0
- package/contract/query-filter.d.ts.map +1 -0
- package/contract/query-filter.js +883 -0
- package/contract/schema.d.ts +12 -0
- package/contract/schema.d.ts.map +1 -1
- package/contract/schema.js +34 -0
- package/contract/source-capability-support.d.ts.map +1 -1
- package/contract/source-capability-support.js +15 -3
- package/contract/source.d.ts +45 -25
- package/contract/source.d.ts.map +1 -1
- package/contract/source.js +719 -479
- package/contract/types.d.ts +88 -19
- package/contract/types.d.ts.map +1 -1
- package/contract/types.js +4 -0
- package/contract/widget-source.d.ts.map +1 -1
- package/controls/basemap-switcher.d.ts +19 -11
- package/controls/basemap-switcher.d.ts.map +1 -1
- package/controls/basemap-switcher.js +58 -25
- package/controls/catalog.d.ts +105 -0
- package/controls/catalog.d.ts.map +1 -0
- package/controls/catalog.js +341 -0
- package/controls/element-utils.d.ts +9 -0
- package/controls/element-utils.d.ts.map +1 -1
- package/controls/element-utils.js +17 -0
- package/controls/index.d.ts +29 -8
- package/controls/index.d.ts.map +1 -1
- package/controls/index.js +26 -8
- package/controls/layer-list.d.ts +13 -5
- package/controls/layer-list.d.ts.map +1 -1
- package/controls/layer-list.js +72 -15
- package/controls/legend.d.ts +32 -5
- package/controls/legend.d.ts.map +1 -1
- package/controls/legend.js +95 -25
- package/controls/qualification.d.ts +152 -0
- package/controls/qualification.d.ts.map +1 -0
- package/controls/qualification.js +1265 -0
- package/controls/registry.d.ts +104 -0
- package/controls/registry.d.ts.map +1 -0
- package/controls/registry.js +150 -0
- package/controls/swipe-control.d.ts +6 -1
- package/controls/swipe-control.d.ts.map +1 -1
- package/controls/swipe-control.js +82 -20
- package/core/client.d.ts +51 -21
- package/core/client.d.ts.map +1 -1
- package/core/client.js +234 -54
- package/core/error-classifications.d.ts +23 -0
- package/core/error-classifications.d.ts.map +1 -1
- package/core/error-classifications.js +23 -0
- package/core/error-code-registry.d.ts +24 -1
- package/core/error-code-registry.d.ts.map +1 -1
- package/core/error-code-registry.js +23 -0
- package/core/error-envelope.js +2 -0
- package/core/errors.d.ts +2 -2
- package/core/errors.d.ts.map +1 -1
- package/core/errors.js +1 -1
- package/core/geoparquet-sql.d.ts +69 -5
- package/core/geoparquet-sql.d.ts.map +1 -1
- package/core/geoparquet-sql.js +327 -10
- package/core/odata-write-codec.d.ts.map +1 -1
- package/core/odata-write-codec.js +0 -1
- package/core/odata.d.ts +6 -0
- package/core/odata.d.ts.map +1 -1
- package/core/odata.js +6 -1
- package/core/ogc-processes.d.ts +182 -25
- package/core/ogc-processes.d.ts.map +1 -1
- package/core/ogc-processes.js +602 -30
- package/core/process-runner.d.ts +8 -1
- package/core/process-runner.d.ts.map +1 -1
- package/core/process-runner.js +1 -0
- package/core/protocol-transport.d.ts +2 -0
- package/core/protocol-transport.d.ts.map +1 -1
- package/core/stac.d.ts +32 -0
- package/core/stac.d.ts.map +1 -1
- package/core/stac.js +158 -23
- package/core/surfaces.d.ts.map +1 -1
- package/core/surfaces.js +273 -68
- package/core/types.d.ts +138 -11
- package/core/types.d.ts.map +1 -1
- package/core/wfs-axis-order.d.ts +18 -0
- package/core/wfs-axis-order.d.ts.map +1 -0
- package/core/wfs-axis-order.js +108 -0
- package/core/wfs-capabilities.d.ts +65 -24
- package/core/wfs-capabilities.d.ts.map +1 -1
- package/core/wfs-capabilities.js +237 -27
- package/core/wfs-filter.d.ts +26 -3
- package/core/wfs-filter.d.ts.map +1 -1
- package/core/wfs-filter.js +48 -53
- package/core/wfs-protocol-error.d.ts +12 -0
- package/core/wfs-protocol-error.d.ts.map +1 -0
- package/core/wfs-protocol-error.js +13 -0
- package/core/wfs.d.ts +53 -1
- package/core/wfs.d.ts.map +1 -1
- package/core/wfs.js +251 -29
- package/core/wms-feature-info.d.ts +92 -0
- package/core/wms-feature-info.d.ts.map +1 -0
- package/core/wms-feature-info.js +285 -0
- package/core/wms.d.ts +9 -0
- package/core/wms.d.ts.map +1 -1
- package/core/wms.js +17 -5
- package/esri-compat/event-bus.d.ts +20 -0
- package/esri-compat/event-bus.d.ts.map +1 -1
- package/esri-compat/feature-filter.d.ts +46 -1
- package/esri-compat/feature-filter.d.ts.map +1 -1
- package/esri-compat/feature-filter.js +49 -0
- package/esri-compat/geojson-layer.d.ts +4 -2
- package/esri-compat/geojson-layer.d.ts.map +1 -1
- package/esri-compat/geojson-layer.js +4 -2
- package/esri-compat/identity-manager.js +2 -2
- package/esri-compat/imagery-layer.d.ts +2 -1
- package/esri-compat/imagery-layer.d.ts.map +1 -1
- package/esri-compat/imagery-layer.js +2 -1
- package/esri-compat/layer-list.d.ts +8 -1
- package/esri-compat/layer-list.d.ts.map +1 -1
- package/esri-compat/layer-list.js +11 -4
- package/esri-compat/legend.d.ts.map +1 -1
- package/esri-compat/legend.js +1 -1
- package/esri-compat/locator.d.ts +297 -0
- package/esri-compat/locator.d.ts.map +1 -0
- package/esri-compat/locator.js +579 -0
- package/esri-compat/map-image-layer.d.ts.map +1 -1
- package/esri-compat/map-view.d.ts.map +1 -1
- package/esri-compat/map-view.js +1 -1
- package/esri-compat/scene-view.d.ts.map +1 -1
- package/esri-compat/time-slider.d.ts +29 -0
- package/esri-compat/time-slider.d.ts.map +1 -1
- package/esri-compat/time-slider.js +117 -0
- package/esri-compat/wfs-layer.d.ts +2 -1
- package/esri-compat/wfs-layer.d.ts.map +1 -1
- package/esri-compat/wfs-layer.js +2 -1
- package/esri-compat/widget-host.d.ts +42 -6
- package/esri-compat/widget-host.d.ts.map +1 -1
- package/esri-compat/widget-host.js +99 -10
- package/generated-app/projection.d.ts.map +1 -1
- package/generated-app/runtime.d.ts.map +1 -1
- package/interactions/declarative-contract.d.ts +149 -0
- package/interactions/declarative-contract.d.ts.map +1 -0
- package/interactions/declarative-contract.js +293 -0
- package/interactions/declarative.d.ts +198 -0
- package/interactions/declarative.d.ts.map +1 -0
- package/interactions/declarative.js +470 -0
- package/interactions/feature-state.d.ts +7 -0
- package/interactions/feature-state.d.ts.map +1 -1
- package/interactions/feature-state.js +10 -2
- package/map/data-to-map-bridge.d.ts +1 -1
- package/map/data-to-map-bridge.d.ts.map +1 -1
- package/map/data-to-map-bridge.js +1 -2
- package/map/honua-map.d.ts.map +1 -1
- package/map/honua-map.js +1 -1
- package/map/index.d.ts +2 -0
- package/map/index.d.ts.map +1 -1
- package/map/index.js +2 -0
- package/map/maplibre-target.js +1 -1
- package/map/realtime-reconciliation-adapter.d.ts +98 -0
- package/map/realtime-reconciliation-adapter.d.ts.map +1 -0
- package/map/realtime-reconciliation-adapter.js +84 -0
- package/map/temporal-playback.d.ts +25 -0
- package/map/temporal-playback.d.ts.map +1 -1
- package/map/temporal-playback.js +29 -1
- package/operator/workspace/workspace.d.ts.map +1 -1
- package/operator/workspace/workspace.js +0 -2
- package/package.json +4 -3
- package/query-planner/canonical-filter.d.ts +30 -0
- package/query-planner/canonical-filter.d.ts.map +1 -0
- package/query-planner/canonical-filter.js +30 -0
- package/query-planner/columnar-plan.d.ts +63 -0
- package/query-planner/columnar-plan.d.ts.map +1 -0
- package/query-planner/columnar-plan.js +94 -0
- package/query-planner/diagnostics.d.ts +3 -3
- package/query-planner/diagnostics.d.ts.map +1 -1
- package/query-planner/diagnostics.js +17 -4
- package/query-planner/duckdb.d.ts.map +1 -1
- package/query-planner/duckdb.js +16 -2
- package/query-planner/execution-context.d.ts.map +1 -1
- package/query-planner/execution-context.js +3 -1
- package/query-planner/executor.d.ts.map +1 -1
- package/query-planner/executor.js +7 -1
- package/query-planner/geoservices.d.ts.map +1 -1
- package/query-planner/geoservices.js +24 -5
- package/query-planner/grpc.d.ts.map +1 -1
- package/query-planner/grpc.js +29 -5
- package/query-planner/index.d.ts +20 -5
- package/query-planner/index.d.ts.map +1 -1
- package/query-planner/index.js +16 -3
- package/query-planner/ir.d.ts +6 -1
- package/query-planner/ir.d.ts.map +1 -1
- package/query-planner/ir.js +63 -1
- package/query-planner/odata-protocol-module.d.ts +54 -0
- package/query-planner/odata-protocol-module.d.ts.map +1 -0
- package/query-planner/odata-protocol-module.js +199 -0
- package/query-planner/odata-v1.d.ts +23 -0
- package/query-planner/odata-v1.d.ts.map +1 -0
- package/query-planner/odata-v1.js +202 -0
- package/query-planner/odata.d.ts +0 -3
- package/query-planner/odata.d.ts.map +1 -1
- package/query-planner/odata.js +0 -143
- package/query-planner/ogc-features.d.ts.map +1 -1
- package/query-planner/ogc-features.js +23 -1
- package/query-planner/planner.d.ts +2 -2
- package/query-planner/planner.d.ts.map +1 -1
- package/query-planner/planner.js +146 -27
- package/query-planner/representation.d.ts +59 -0
- package/query-planner/representation.d.ts.map +1 -0
- package/query-planner/representation.js +140 -0
- package/query-planner/types.d.ts +153 -3
- package/query-planner/types.d.ts.map +1 -1
- package/query-planner/wfs-protocol-module.d.ts +57 -0
- package/query-planner/wfs-protocol-module.d.ts.map +1 -0
- package/query-planner/wfs-protocol-module.js +731 -0
- package/query-planner/wfs-v1.d.ts +41 -0
- package/query-planner/wfs-v1.d.ts.map +1 -0
- package/query-planner/wfs-v1.js +366 -0
- package/query-planner/wfs.d.ts +1 -3
- package/query-planner/wfs.d.ts.map +1 -1
- package/query-planner/wfs.js +1 -70
- package/realtime/checkpoint-store.d.ts +206 -0
- package/realtime/checkpoint-store.d.ts.map +1 -0
- package/realtime/checkpoint-store.js +504 -0
- package/realtime/honua-server.d.ts +8 -0
- package/realtime/honua-server.d.ts.map +1 -1
- package/realtime/honua-server.js +123 -14
- package/realtime/index.d.ts +4 -0
- package/realtime/index.d.ts.map +1 -1
- package/realtime/index.js +2 -0
- package/realtime/reconciliation.d.ts +245 -0
- package/realtime/reconciliation.d.ts.map +1 -0
- package/realtime/reconciliation.js +377 -0
- package/realtime/resumable-transport.d.ts.map +1 -1
- package/realtime/sse.d.ts.map +1 -1
- package/realtime/sse.js +7 -1
- package/realtime/websocket.d.ts.map +1 -1
- package/realtime/wire.d.ts +2 -1
- package/realtime/wire.d.ts.map +1 -1
- package/realtime/wire.js +24 -8
- package/replica-sync/errors.d.ts +19 -1
- package/replica-sync/errors.d.ts.map +1 -1
- package/replica-sync/errors.js +16 -0
- package/replica-sync/geoservices.d.ts +260 -0
- package/replica-sync/geoservices.d.ts.map +1 -0
- package/replica-sync/geoservices.js +1093 -0
- package/replica-sync/index.d.ts +5 -1
- package/replica-sync/index.d.ts.map +1 -1
- package/replica-sync/index.js +3 -1
- package/replica-sync/transport-conformance.d.ts +58 -0
- package/replica-sync/transport-conformance.d.ts.map +1 -0
- package/replica-sync/transport-conformance.js +265 -0
- package/replica-sync/types.d.ts +22 -0
- package/replica-sync/types.d.ts.map +1 -1
- package/runtime/index.d.ts +6 -2
- package/runtime/index.d.ts.map +1 -1
- package/runtime/index.js +3 -1
- package/runtime/load-package.d.ts +24 -0
- package/runtime/load-package.d.ts.map +1 -1
- package/runtime/load-package.js +45 -1
- package/runtime/maplibre-renderer.d.ts +11 -0
- package/runtime/maplibre-renderer.d.ts.map +1 -1
- package/runtime/maplibre-renderer.js +32 -7
- package/runtime/offline-region-protocol.d.ts +73 -0
- package/runtime/offline-region-protocol.d.ts.map +1 -0
- package/runtime/offline-region-protocol.js +63 -0
- package/runtime/offline-region-style.d.ts +78 -0
- package/runtime/offline-region-style.d.ts.map +1 -0
- package/runtime/offline-region-style.js +147 -0
- package/runtime/pmtiles-protocol.d.ts +7 -8
- package/runtime/pmtiles-protocol.d.ts.map +1 -1
- package/runtime/pmtiles-protocol.js +19 -66
- package/runtime/protocol-registry.d.ts +55 -0
- package/runtime/protocol-registry.d.ts.map +1 -0
- package/runtime/protocol-registry.js +103 -0
- package/runtime/runtime.d.ts +2 -0
- package/runtime/runtime.d.ts.map +1 -1
- package/runtime/runtime.js +6 -1
- package/runtime/style-compose.d.ts.map +1 -1
- package/runtime/style-compose.js +78 -9
- package/scene-workspace/analysis-widgets.d.ts +4 -2
- package/scene-workspace/analysis-widgets.d.ts.map +1 -1
- package/scene-workspace/analysis-widgets.js +4 -2
- package/scene-workspace/camera-correspondence.d.ts +151 -0
- package/scene-workspace/camera-correspondence.d.ts.map +1 -0
- package/scene-workspace/camera-correspondence.js +220 -0
- package/scene-workspace/cesium-adapter.d.ts +230 -29
- package/scene-workspace/cesium-adapter.d.ts.map +1 -1
- package/scene-workspace/cesium-adapter.js +741 -56
- package/scene-workspace/cesium-mount.d.ts +205 -0
- package/scene-workspace/cesium-mount.d.ts.map +1 -0
- package/scene-workspace/cesium-mount.js +392 -0
- package/scene-workspace/cesium-scene-owner.d.ts +160 -0
- package/scene-workspace/cesium-scene-owner.d.ts.map +1 -0
- package/scene-workspace/cesium-scene-owner.js +205 -0
- package/scene-workspace/cesium-state-sync.d.ts +101 -0
- package/scene-workspace/cesium-state-sync.d.ts.map +1 -0
- package/scene-workspace/cesium-state-sync.js +432 -0
- package/scene-workspace/cesium-time.d.ts +346 -0
- package/scene-workspace/cesium-time.d.ts.map +1 -0
- package/scene-workspace/cesium-time.js +403 -0
- package/scene-workspace/index.d.ts +42 -10
- package/scene-workspace/index.d.ts.map +1 -1
- package/scene-workspace/index.js +32 -7
- package/scene-workspace/maplibre-state-sync.d.ts +112 -0
- package/scene-workspace/maplibre-state-sync.d.ts.map +1 -0
- package/scene-workspace/maplibre-state-sync.js +400 -0
- package/scene-workspace/primitives.d.ts +237 -3
- package/scene-workspace/primitives.d.ts.map +1 -1
- package/scene-workspace/primitives.js +1087 -17
- package/scene-workspace/scene-discovery.d.ts +5 -2
- package/scene-workspace/scene-discovery.d.ts.map +1 -1
- package/scene-workspace/scene-discovery.js +5 -2
- package/scene-workspace/scene-view.d.ts +5 -2
- package/scene-workspace/scene-view.d.ts.map +1 -1
- package/scene-workspace/scene-view.js +5 -2
- package/scene-workspace/source-to-cesium.d.ts +141 -8
- package/scene-workspace/source-to-cesium.d.ts.map +1 -1
- package/scene-workspace/source-to-cesium.js +497 -72
- package/scene-workspace/state-sync-port-kit.d.ts +156 -0
- package/scene-workspace/state-sync-port-kit.d.ts.map +1 -0
- package/scene-workspace/state-sync-port-kit.js +319 -0
- package/scene-workspace/state-sync.d.ts +34 -1
- package/scene-workspace/state-sync.d.ts.map +1 -1
- package/scene-workspace/state-sync.js +48 -0
- package/scene-workspace/types.d.ts +8 -0
- package/scene-workspace/types.d.ts.map +1 -1
- package/scene-workspace/types.js +2 -0
- package/scene-workspace/workspace.d.ts +12 -1
- package/scene-workspace/workspace.d.ts.map +1 -1
- package/scene-workspace/workspace.js +13 -0
- package/studio/index.d.ts +24 -7
- package/studio/index.d.ts.map +1 -1
- package/studio/index.js +21 -7
- package/studio/lifecycle-client.d.ts +164 -0
- package/studio/lifecycle-client.d.ts.map +1 -0
- package/studio/lifecycle-client.js +299 -0
- package/studio/lifecycle-errors.d.ts +91 -0
- package/studio/lifecycle-errors.d.ts.map +1 -0
- package/studio/lifecycle-errors.js +77 -0
- package/studio/lifecycle-types.d.ts +321 -0
- package/studio/lifecycle-types.d.ts.map +1 -0
- package/studio/lifecycle-types.js +22 -0
- package/web-components/controller.d.ts.map +1 -1
- package/web-components/csp-styles.d.ts +6 -0
- package/web-components/csp-styles.d.ts.map +1 -0
- package/web-components/csp-styles.js +53 -0
- package/web-components/elements.d.ts +158 -2
- package/web-components/elements.d.ts.map +1 -1
- package/web-components/elements.js +1302 -215
- package/web-components/export-redaction.d.ts +252 -0
- package/web-components/export-redaction.d.ts.map +1 -0
- package/web-components/export-redaction.js +588 -0
- package/web-components/export.d.ts +417 -0
- package/web-components/export.d.ts.map +1 -0
- package/web-components/export.js +719 -0
- package/web-components/feature-editor-model.d.ts +265 -0
- package/web-components/feature-editor-model.d.ts.map +1 -0
- package/web-components/feature-editor-model.js +438 -0
- package/web-components/feature-editor-sketch.d.ts +125 -0
- package/web-components/feature-editor-sketch.d.ts.map +1 -0
- package/web-components/feature-editor-sketch.js +194 -0
- package/web-components/feature-editor-workflow.d.ts +286 -0
- package/web-components/feature-editor-workflow.d.ts.map +1 -0
- package/web-components/feature-editor-workflow.js +889 -0
- package/web-components/feature-editor.d.ts +83 -0
- package/web-components/feature-editor.d.ts.map +1 -0
- package/web-components/feature-editor.js +829 -0
- package/web-components/feature-table-engine.d.ts +465 -0
- package/web-components/feature-table-engine.d.ts.map +1 -0
- package/web-components/feature-table-engine.js +1360 -0
- package/web-components/feature-table-view.d.ts +95 -0
- package/web-components/feature-table-view.d.ts.map +1 -0
- package/web-components/feature-table-view.js +343 -0
- package/web-components/index.d.ts +34 -3
- package/web-components/index.d.ts.map +1 -1
- package/web-components/index.js +35 -2
- package/web-components/maplibre-renderer.d.ts.map +1 -1
- package/web-components/maplibre-renderer.js +13 -4
- package/web-components/measurement.d.ts +3 -1
- package/web-components/measurement.d.ts.map +1 -1
- package/web-components/measurement.js +62 -18
- package/web-components/time-slider.d.ts +122 -0
- package/web-components/time-slider.d.ts.map +1 -0
- package/web-components/time-slider.js +740 -0
- package/web-components/types.d.ts +310 -0
- package/web-components/types.d.ts.map +1 -1
- package/webmap/convert-label.js +0 -1
- package/webmap/convert-symbol.d.ts.map +1 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One owner for both halves of a Cesium scene.
|
|
3
|
+
*
|
|
4
|
+
* A Cesium application that draws a published scene *and* an accepted-plan
|
|
5
|
+
* feature query had two lifecycle owners and nothing above them:
|
|
6
|
+
* {@link mountScenePrimitivesToCesium} owns terrain, imagery, tilesets, and
|
|
7
|
+
* models on `viewer.scene`, and {@link mountSourceToCesium} owns entities on
|
|
8
|
+
* `viewer.entities`. Composing them worked — that is proven against a real
|
|
9
|
+
* `Viewer` — but the application had to hold two handles, dispose them in the
|
|
10
|
+
* right order, and get that right on every error path. This module is the
|
|
11
|
+
* missing owner (epic #395 REQ-003, issue #1050).
|
|
12
|
+
*
|
|
13
|
+
* {@link mountCesiumScene} is deliberately a **delegating** owner rather than a
|
|
14
|
+
* new adapter:
|
|
15
|
+
*
|
|
16
|
+
* - It does not reimplement either mount. The primitive mount keeps its own
|
|
17
|
+
* diff, layer ceiling, transactional apply, and rebuild boundaries; each
|
|
18
|
+
* entity mount keeps its own refresh diff, entity ceiling, and rollback. The
|
|
19
|
+
* owner adds ordering, admission, and a single `dispose()`.
|
|
20
|
+
* - It does not change the beta mount's shape. `mountScenePrimitivesToCesium`
|
|
21
|
+
* and its handle are untouched and remain the supported way to own primitives
|
|
22
|
+
* alone; `mountCesiumScene` is additive, and a host that already holds a
|
|
23
|
+
* primitive mount keeps working exactly as before.
|
|
24
|
+
* - One target. A live `Viewer` structurally satisfies
|
|
25
|
+
* {@link CesiumSceneOwnerTarget} — `camera`, `scene`, `clock`, `entities` —
|
|
26
|
+
* so the owner is handed the viewer, not a pair of collections the caller has
|
|
27
|
+
* to keep consistent.
|
|
28
|
+
*
|
|
29
|
+
* Disposal releases entity mounts first, in reverse acquisition order, and the
|
|
30
|
+
* primitive mount last. That is the order the browser lane measures: entity
|
|
31
|
+
* visualizers attach their own primitives to `scene.primitives`, and releasing
|
|
32
|
+
* an elevation-source handle resets the globe's terrain provider, so tearing the
|
|
33
|
+
* scene down underneath live entities is the arrangement worth avoiding. A
|
|
34
|
+
* refusing mount leaves the owner in `disposing`, still owning exactly what did
|
|
35
|
+
* not release, so `dispose()` can be called again.
|
|
36
|
+
*
|
|
37
|
+
* @experimental Held back from the beta `@honua/app-platform/scene-workspace`
|
|
38
|
+
* tier with the accepted-plan entity slice it composes: the entity half has no
|
|
39
|
+
* symbology surface yet, and adding one changes shapes this owner forwards.
|
|
40
|
+
* See `docs/cesium-entity-adapter.md`.
|
|
41
|
+
* @module
|
|
42
|
+
*/
|
|
43
|
+
import type { Source } from "../contract/types.js";
|
|
44
|
+
import type { QueryExecutionPlanV1 } from "../query-planner/types.js";
|
|
45
|
+
import type { CesiumSceneRuntimeTarget } from "./cesium-adapter.js";
|
|
46
|
+
import { type ApplyMountedScenePrimitivesOptions, type MountScenePrimitivesToCesiumOptions, type MountedCesiumScenePrimitives, type MountedScenePrimitiveApplyResult } from "./cesium-mount.js";
|
|
47
|
+
import type { SceneRuntimePrimitive } from "./primitives.js";
|
|
48
|
+
import { type CesiumEntityCollectionTarget, type MountSourceToCesiumOptions, type MountedCesiumEntitySource } from "./source-to-cesium.js";
|
|
49
|
+
/**
|
|
50
|
+
* Default ceiling on the number of live entity mounts one owner may hold.
|
|
51
|
+
*
|
|
52
|
+
* Each mount materializes up to `DEFAULT_CESIUM_ENTITY_LIMIT` entities, so an
|
|
53
|
+
* unbounded set of mounts is an unbounded scene. Eight is generous for an
|
|
54
|
+
* operational view — a handful of feature layers over a published scene — and
|
|
55
|
+
* small enough that a runaway generated application fails closed. Raise it
|
|
56
|
+
* deliberately with {@link MountCesiumSceneOptions.maxSources}.
|
|
57
|
+
*/
|
|
58
|
+
export declare const DEFAULT_CESIUM_SCENE_SOURCE_LIMIT = 8;
|
|
59
|
+
/** Failure codes raised by the scene owner's own contract. */
|
|
60
|
+
export type CesiumSceneOwnerErrorCode = "disposed" | "entities-unavailable" | "invalid-option" | "source-conflict" | "source-limit-exceeded";
|
|
61
|
+
/**
|
|
62
|
+
* A lifecycle refusal from {@link mountCesiumScene} or the handle it returns.
|
|
63
|
+
* Failures raised by the mounts it delegates to keep their own error types —
|
|
64
|
+
* `HonuaCesiumSceneMountError` and `HonuaCesiumEntityAdapterError` — so a caller
|
|
65
|
+
* can still tell a layer-ceiling refusal from an entity-ceiling refusal.
|
|
66
|
+
*/
|
|
67
|
+
export declare class HonuaCesiumSceneOwnerError extends Error {
|
|
68
|
+
readonly code: CesiumSceneOwnerErrorCode;
|
|
69
|
+
readonly detail?: Readonly<Record<string, unknown>> | undefined;
|
|
70
|
+
constructor(code: CesiumSceneOwnerErrorCode, message: string, detail?: Readonly<Record<string, unknown>> | undefined, options?: ErrorOptions);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The live Cesium surface both halves of the scene attach to. A `Viewer`
|
|
74
|
+
* satisfies it structurally; `entities` is optional so a scene that never mounts
|
|
75
|
+
* a source can hand over the same target the primitive adapter already accepts.
|
|
76
|
+
*/
|
|
77
|
+
export interface CesiumSceneOwnerTarget extends CesiumSceneRuntimeTarget {
|
|
78
|
+
/** Live `viewer.entities`. Required before {@link MountedCesiumScene.mountSource} can run. */
|
|
79
|
+
readonly entities?: CesiumEntityCollectionTarget;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Lifecycle state of a scene owner.
|
|
83
|
+
*
|
|
84
|
+
* `disposing` is durable when a mount refused to release: the owner permanently
|
|
85
|
+
* refuses new work while remaining retryable, exactly like the primitive mount.
|
|
86
|
+
*/
|
|
87
|
+
export type CesiumSceneOwnerState = "ready" | "disposing" | "disposed";
|
|
88
|
+
/** Options for {@link mountCesiumScene}. */
|
|
89
|
+
export interface MountCesiumSceneOptions extends MountScenePrimitivesToCesiumOptions {
|
|
90
|
+
/**
|
|
91
|
+
* Ceiling on the live entity mounts this owner may hold. Defaults to
|
|
92
|
+
* {@link DEFAULT_CESIUM_SCENE_SOURCE_LIMIT}. Must be a positive integer.
|
|
93
|
+
*/
|
|
94
|
+
readonly maxSources?: number;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* One owner of a whole Cesium scene: the primitive plan and every accepted-plan
|
|
98
|
+
* source mounted over it.
|
|
99
|
+
*
|
|
100
|
+
* Callers hold the owner, not the mounts. The mounts are still reachable —
|
|
101
|
+
* {@link primitives} and {@link sources} expose them so their diagnostics,
|
|
102
|
+
* revisions, and rebuild boundaries stay readable — but ownership is the owner's,
|
|
103
|
+
* and {@link dispose} is the only teardown a host has to sequence.
|
|
104
|
+
*/
|
|
105
|
+
export interface MountedCesiumScene {
|
|
106
|
+
readonly renderer: "cesium";
|
|
107
|
+
/** Lifecycle state. See {@link CesiumSceneOwnerState}. */
|
|
108
|
+
readonly state: CesiumSceneOwnerState;
|
|
109
|
+
/** The primitive mount this owner created. Its own lifecycle is owned here. */
|
|
110
|
+
readonly primitives: MountedCesiumScenePrimitives;
|
|
111
|
+
/** Live entity mounts keyed by their `sourceId`, in acquisition order. */
|
|
112
|
+
readonly sources: ReadonlyMap<string, MountedCesiumEntitySource>;
|
|
113
|
+
/** The entity-mount ceiling this owner was created with. */
|
|
114
|
+
readonly sourceLimit: number;
|
|
115
|
+
/**
|
|
116
|
+
* Apply a revised primitive plan. Delegates to the primitive mount's diff, so
|
|
117
|
+
* unchanged primitives are reused and the owner's entity mounts are untouched.
|
|
118
|
+
*/
|
|
119
|
+
applyPrimitives(primitives: readonly SceneRuntimePrimitive[], options?: ApplyMountedScenePrimitivesOptions): Promise<MountedScenePrimitiveApplyResult>;
|
|
120
|
+
/**
|
|
121
|
+
* Mount an accepted plan against a source and take ownership of the result.
|
|
122
|
+
*
|
|
123
|
+
* The mount runs under the owner's lifecycle: disposing the owner mid-mount
|
|
124
|
+
* aborts it and leaves nothing attached. A source whose `sourceId` is already
|
|
125
|
+
* mounted is refused with `source-conflict` and the redundant mount is
|
|
126
|
+
* released, so the owner can never hold two mounts fighting over one set of
|
|
127
|
+
* entity ids.
|
|
128
|
+
*/
|
|
129
|
+
mountSource<T>(source: Source<T>, plan: QueryExecutionPlanV1, options?: MountSourceToCesiumOptions): Promise<MountedCesiumEntitySource>;
|
|
130
|
+
/**
|
|
131
|
+
* Release one entity mount by `sourceId`, leaving the rest of the scene alone.
|
|
132
|
+
* Returns `false` when the owner does not hold that source. A mount that
|
|
133
|
+
* refuses to release stays owned so a later {@link dispose} retries it.
|
|
134
|
+
*/
|
|
135
|
+
releaseSource(sourceId: string): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Release every mount this owner holds — entity mounts first, in reverse
|
|
138
|
+
* acquisition order, then the primitive mount. Idempotent.
|
|
139
|
+
*
|
|
140
|
+
* A mount that refuses to release does not stop the teardown: everything that
|
|
141
|
+
* can be released is, the failures are aggregated and thrown, the owner stays
|
|
142
|
+
* in `disposing` still owning exactly what refused, and a later `dispose()`
|
|
143
|
+
* retries only that. One stuck entity therefore never pins the scene's GPU
|
|
144
|
+
* resources indefinitely.
|
|
145
|
+
*/
|
|
146
|
+
dispose(): void;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Mount a whole Cesium scene — primitives now, sources later — behind one owner.
|
|
150
|
+
*
|
|
151
|
+
* The initial primitive plan is applied before the promise resolves, so a
|
|
152
|
+
* resolved owner is a mounted scene. A rejection means nothing was left
|
|
153
|
+
* attached: the primitive mount's transactional rollback has already run and no
|
|
154
|
+
* source has been mounted yet. Pass an empty plan to own entity mounts alone.
|
|
155
|
+
*
|
|
156
|
+
* @param target Live Cesium `Viewer`/`Scene` surface, optionally carrying `entities`.
|
|
157
|
+
* @param primitives The accepted scene plan.
|
|
158
|
+
*/
|
|
159
|
+
export declare function mountCesiumScene(target: CesiumSceneOwnerTarget, primitives: readonly SceneRuntimePrimitive[], options?: MountCesiumSceneOptions): Promise<MountedCesiumScene>;
|
|
160
|
+
//# sourceMappingURL=cesium-scene-owner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cesium-scene-owner.d.ts","sourceRoot":"","sources":["../../../src/scene-workspace/cesium-scene-owner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAA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GG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,4BAA4B,CAAC;IAClD,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IACjE,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,eAAe,CACb,UAAU,EAAE,SAAS,qBAAqB,EAAE,EAC5C,OAAO,CAAC,EAAE,kCAAkC,GAC3C,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAC7C;;;;;;;;OAQG;IACH,WAAW,CAAC,CAAC,EACX,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EACjB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtC;;;;OAIG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACzC;;;;;;;;;OASG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,sBAAsB,EAC9B,UAAU,EAAE,SAAS,qBAAqB,EAAE,EAC5C,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,kBAAkB,CAAC,CAuH7B"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One owner for both halves of a Cesium scene.
|
|
3
|
+
*
|
|
4
|
+
* A Cesium application that draws a published scene *and* an accepted-plan
|
|
5
|
+
* feature query had two lifecycle owners and nothing above them:
|
|
6
|
+
* {@link mountScenePrimitivesToCesium} owns terrain, imagery, tilesets, and
|
|
7
|
+
* models on `viewer.scene`, and {@link mountSourceToCesium} owns entities on
|
|
8
|
+
* `viewer.entities`. Composing them worked — that is proven against a real
|
|
9
|
+
* `Viewer` — but the application had to hold two handles, dispose them in the
|
|
10
|
+
* right order, and get that right on every error path. This module is the
|
|
11
|
+
* missing owner (epic #395 REQ-003, issue #1050).
|
|
12
|
+
*
|
|
13
|
+
* {@link mountCesiumScene} is deliberately a **delegating** owner rather than a
|
|
14
|
+
* new adapter:
|
|
15
|
+
*
|
|
16
|
+
* - It does not reimplement either mount. The primitive mount keeps its own
|
|
17
|
+
* diff, layer ceiling, transactional apply, and rebuild boundaries; each
|
|
18
|
+
* entity mount keeps its own refresh diff, entity ceiling, and rollback. The
|
|
19
|
+
* owner adds ordering, admission, and a single `dispose()`.
|
|
20
|
+
* - It does not change the beta mount's shape. `mountScenePrimitivesToCesium`
|
|
21
|
+
* and its handle are untouched and remain the supported way to own primitives
|
|
22
|
+
* alone; `mountCesiumScene` is additive, and a host that already holds a
|
|
23
|
+
* primitive mount keeps working exactly as before.
|
|
24
|
+
* - One target. A live `Viewer` structurally satisfies
|
|
25
|
+
* {@link CesiumSceneOwnerTarget} — `camera`, `scene`, `clock`, `entities` —
|
|
26
|
+
* so the owner is handed the viewer, not a pair of collections the caller has
|
|
27
|
+
* to keep consistent.
|
|
28
|
+
*
|
|
29
|
+
* Disposal releases entity mounts first, in reverse acquisition order, and the
|
|
30
|
+
* primitive mount last. That is the order the browser lane measures: entity
|
|
31
|
+
* visualizers attach their own primitives to `scene.primitives`, and releasing
|
|
32
|
+
* an elevation-source handle resets the globe's terrain provider, so tearing the
|
|
33
|
+
* scene down underneath live entities is the arrangement worth avoiding. A
|
|
34
|
+
* refusing mount leaves the owner in `disposing`, still owning exactly what did
|
|
35
|
+
* not release, so `dispose()` can be called again.
|
|
36
|
+
*
|
|
37
|
+
* @experimental Held back from the beta `@honua/app-platform/scene-workspace`
|
|
38
|
+
* tier with the accepted-plan entity slice it composes: the entity half has no
|
|
39
|
+
* symbology surface yet, and adding one changes shapes this owner forwards.
|
|
40
|
+
* See `docs/cesium-entity-adapter.md`.
|
|
41
|
+
* @module
|
|
42
|
+
*/
|
|
43
|
+
import { mountScenePrimitivesToCesium, } from "./cesium-mount.js";
|
|
44
|
+
import { mountSourceToCesium, } from "./source-to-cesium.js";
|
|
45
|
+
/**
|
|
46
|
+
* Default ceiling on the number of live entity mounts one owner may hold.
|
|
47
|
+
*
|
|
48
|
+
* Each mount materializes up to `DEFAULT_CESIUM_ENTITY_LIMIT` entities, so an
|
|
49
|
+
* unbounded set of mounts is an unbounded scene. Eight is generous for an
|
|
50
|
+
* operational view — a handful of feature layers over a published scene — and
|
|
51
|
+
* small enough that a runaway generated application fails closed. Raise it
|
|
52
|
+
* deliberately with {@link MountCesiumSceneOptions.maxSources}.
|
|
53
|
+
*/
|
|
54
|
+
export const DEFAULT_CESIUM_SCENE_SOURCE_LIMIT = 8;
|
|
55
|
+
/**
|
|
56
|
+
* A lifecycle refusal from {@link mountCesiumScene} or the handle it returns.
|
|
57
|
+
* Failures raised by the mounts it delegates to keep their own error types —
|
|
58
|
+
* `HonuaCesiumSceneMountError` and `HonuaCesiumEntityAdapterError` — so a caller
|
|
59
|
+
* can still tell a layer-ceiling refusal from an entity-ceiling refusal.
|
|
60
|
+
*/
|
|
61
|
+
export class HonuaCesiumSceneOwnerError extends Error {
|
|
62
|
+
code;
|
|
63
|
+
detail;
|
|
64
|
+
constructor(code, message, detail, options) {
|
|
65
|
+
super(message, options);
|
|
66
|
+
this.code = code;
|
|
67
|
+
this.detail = detail;
|
|
68
|
+
this.name = "HonuaCesiumSceneOwnerError";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Mount a whole Cesium scene — primitives now, sources later — behind one owner.
|
|
73
|
+
*
|
|
74
|
+
* The initial primitive plan is applied before the promise resolves, so a
|
|
75
|
+
* resolved owner is a mounted scene. A rejection means nothing was left
|
|
76
|
+
* attached: the primitive mount's transactional rollback has already run and no
|
|
77
|
+
* source has been mounted yet. Pass an empty plan to own entity mounts alone.
|
|
78
|
+
*
|
|
79
|
+
* @param target Live Cesium `Viewer`/`Scene` surface, optionally carrying `entities`.
|
|
80
|
+
* @param primitives The accepted scene plan.
|
|
81
|
+
*/
|
|
82
|
+
export async function mountCesiumScene(target, primitives, options = {}) {
|
|
83
|
+
const sourceLimit = resolveSourceLimit(options.maxSources);
|
|
84
|
+
const lifecycle = new AbortController();
|
|
85
|
+
const sources = new Map();
|
|
86
|
+
let state = "ready";
|
|
87
|
+
let disposeActive = false;
|
|
88
|
+
const primitiveMount = await mountScenePrimitivesToCesium(target, primitives, {
|
|
89
|
+
...(options.signal ? { signal: combineSignals([lifecycle.signal, options.signal]) } : { signal: lifecycle.signal }),
|
|
90
|
+
...(options.maxLayers === undefined ? {} : { maxLayers: options.maxLayers }),
|
|
91
|
+
...(options.state ? { state: options.state } : {}),
|
|
92
|
+
});
|
|
93
|
+
const assertReady = () => {
|
|
94
|
+
if (state !== "ready") {
|
|
95
|
+
throw new HonuaCesiumSceneOwnerError("disposed", "Cannot use a disposed Cesium scene owner.", { state });
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
renderer: "cesium",
|
|
100
|
+
get state() {
|
|
101
|
+
return state;
|
|
102
|
+
},
|
|
103
|
+
get primitives() {
|
|
104
|
+
return primitiveMount;
|
|
105
|
+
},
|
|
106
|
+
get sources() {
|
|
107
|
+
return new Map(sources);
|
|
108
|
+
},
|
|
109
|
+
sourceLimit,
|
|
110
|
+
applyPrimitives(plan, applyOptions = {}) {
|
|
111
|
+
try {
|
|
112
|
+
assertReady();
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
return Promise.reject(error);
|
|
116
|
+
}
|
|
117
|
+
return primitiveMount.apply(plan, {
|
|
118
|
+
...applyOptions,
|
|
119
|
+
signal: combineSignals([lifecycle.signal, applyOptions.signal]),
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
async mountSource(source, plan, sourceOptions = {}) {
|
|
123
|
+
assertReady();
|
|
124
|
+
const entities = target.entities;
|
|
125
|
+
if (!entities) {
|
|
126
|
+
throw new HonuaCesiumSceneOwnerError("entities-unavailable", "The Cesium scene target carries no entity collection; pass `viewer.entities` to mount a source.");
|
|
127
|
+
}
|
|
128
|
+
if (sources.size >= sourceLimit) {
|
|
129
|
+
throw new HonuaCesiumSceneOwnerError("source-limit-exceeded", `The Cesium scene owner already holds ${sources.size} source mounts, its ceiling.`, { sourceCount: sources.size, sourceLimit });
|
|
130
|
+
}
|
|
131
|
+
const signal = combineSignals([lifecycle.signal, sourceOptions.signal]);
|
|
132
|
+
signal.throwIfAborted();
|
|
133
|
+
const mounted = await mountSourceToCesium(entities, source, plan, { ...sourceOptions, signal });
|
|
134
|
+
// Disposal may have won the race with a mount that had no checkpoint left
|
|
135
|
+
// to hit. Release what it built rather than committing it into an owner the
|
|
136
|
+
// host has already torn down.
|
|
137
|
+
if (state !== "ready") {
|
|
138
|
+
mounted.dispose();
|
|
139
|
+
throw lifecycle.signal.reason;
|
|
140
|
+
}
|
|
141
|
+
if (sources.has(mounted.sourceId)) {
|
|
142
|
+
mounted.dispose();
|
|
143
|
+
throw new HonuaCesiumSceneOwnerError("source-conflict", `The Cesium scene owner already holds a mount for source "${mounted.sourceId}".`, { sourceId: mounted.sourceId });
|
|
144
|
+
}
|
|
145
|
+
sources.set(mounted.sourceId, mounted);
|
|
146
|
+
return mounted;
|
|
147
|
+
},
|
|
148
|
+
releaseSource(sourceId) {
|
|
149
|
+
const mounted = sources.get(sourceId);
|
|
150
|
+
if (!mounted)
|
|
151
|
+
return false;
|
|
152
|
+
// Delete only once the mount says it released: a refusing mount stays owned
|
|
153
|
+
// so `dispose()` retries exactly what is still attached.
|
|
154
|
+
mounted.dispose();
|
|
155
|
+
sources.delete(sourceId);
|
|
156
|
+
return true;
|
|
157
|
+
},
|
|
158
|
+
dispose() {
|
|
159
|
+
if (state === "disposed" || disposeActive)
|
|
160
|
+
return;
|
|
161
|
+
disposeActive = true;
|
|
162
|
+
if (!lifecycle.signal.aborted) {
|
|
163
|
+
lifecycle.abort(new DOMException("Cesium scene owner disposed", "AbortError"));
|
|
164
|
+
}
|
|
165
|
+
state = "disposing";
|
|
166
|
+
try {
|
|
167
|
+
const failures = [];
|
|
168
|
+
for (const [sourceId, mounted] of [...sources.entries()].reverse()) {
|
|
169
|
+
try {
|
|
170
|
+
mounted.dispose();
|
|
171
|
+
sources.delete(sourceId);
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
failures.push(error);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
primitiveMount.dispose();
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
failures.push(error);
|
|
182
|
+
}
|
|
183
|
+
if (failures.length > 0) {
|
|
184
|
+
throw new AggregateError(failures, "Cesium scene owner disposal is incomplete and may be retried.");
|
|
185
|
+
}
|
|
186
|
+
state = "disposed";
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
disposeActive = false;
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function resolveSourceLimit(maxSources) {
|
|
195
|
+
if (maxSources === undefined)
|
|
196
|
+
return DEFAULT_CESIUM_SCENE_SOURCE_LIMIT;
|
|
197
|
+
if (!Number.isSafeInteger(maxSources) || maxSources <= 0) {
|
|
198
|
+
throw new HonuaCesiumSceneOwnerError("invalid-option", "maxSources must be a positive integer.", { maxSources });
|
|
199
|
+
}
|
|
200
|
+
return maxSources;
|
|
201
|
+
}
|
|
202
|
+
function combineSignals(signals) {
|
|
203
|
+
const available = signals.filter((signal) => signal !== undefined);
|
|
204
|
+
return available.length === 1 ? available[0] : AbortSignal.any(available);
|
|
205
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shipped 3D {@link SceneStateSyncPort}: a live Cesium `Viewer` bound to the
|
|
3
|
+
* shared scene state.
|
|
4
|
+
*
|
|
5
|
+
* The camera half reuses the adapter's existing conversion
|
|
6
|
+
* (`cameraStateToCesiumView` / `cesiumCameraToSceneState` /
|
|
7
|
+
* `applyCameraStateToCesiumCamera`) rather than re-deriving it, because the
|
|
8
|
+
* renderer-neutral camera *is* a globe pose — there is nothing to project. The
|
|
9
|
+
* slices that a globe expresses differently from a 2D map are declared
|
|
10
|
+
* differently by this port's own `mappings`, so a fidelity claim is always
|
|
11
|
+
* backed by the code that makes it.
|
|
12
|
+
*
|
|
13
|
+
* CesiumJS stays an optional peer: the viewer is duck-typed, and the only
|
|
14
|
+
* reference to the package is a lazy `import("cesium")` performed on the first
|
|
15
|
+
* apply that actually needs a Cesium constructor.
|
|
16
|
+
*
|
|
17
|
+
* @beta Part of the beta `@honua/app-platform/scene-workspace` surface.
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import type { FeatureSelectionTarget } from "../exploration/index.js";
|
|
21
|
+
import { type CesiumCameraLike } from "./cesium-adapter.js";
|
|
22
|
+
import { type CesiumClockTarget } from "./cesium-time.js";
|
|
23
|
+
import { type SceneStateSyncPortDegradation, type SceneStateSyncRendererPort } from "./state-sync-port-kit.js";
|
|
24
|
+
import { type SceneStateSyncIdentity } from "./state-sync.js";
|
|
25
|
+
/** A Cesium `Event`: `addEventListener` returns its own remover. */
|
|
26
|
+
export interface CesiumStateSyncEvent {
|
|
27
|
+
addEventListener(listener: (...args: never[]) => void): unknown;
|
|
28
|
+
removeEventListener?(listener: (...args: never[]) => void): unknown;
|
|
29
|
+
}
|
|
30
|
+
/** The bits of a Cesium `Entity` this port reads and writes. */
|
|
31
|
+
export interface CesiumStateSyncEntity {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
show?: boolean;
|
|
34
|
+
readonly properties?: unknown;
|
|
35
|
+
}
|
|
36
|
+
/** The bits of a Cesium `EntityCollection` this port reads. */
|
|
37
|
+
export interface CesiumStateSyncEntityCollection {
|
|
38
|
+
readonly values: readonly CesiumStateSyncEntity[];
|
|
39
|
+
getById?(id: string): CesiumStateSyncEntity | undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The subset of a live Cesium `Viewer` this port drives.
|
|
43
|
+
*
|
|
44
|
+
* The clock half is {@link CesiumClockTarget}, so the shared `time` slice writes
|
|
45
|
+
* a globe through exactly the binding the scene adapter uses — including its
|
|
46
|
+
* `clockOwnership` declaration, which this port honours by standing down rather
|
|
47
|
+
* than fighting a host-owned transport.
|
|
48
|
+
*/
|
|
49
|
+
export interface CesiumStateSyncTarget extends CesiumClockTarget {
|
|
50
|
+
readonly camera: CesiumCameraLike & {
|
|
51
|
+
readonly changed?: CesiumStateSyncEvent;
|
|
52
|
+
readonly moveEnd?: CesiumStateSyncEvent;
|
|
53
|
+
};
|
|
54
|
+
readonly entities?: CesiumStateSyncEntityCollection;
|
|
55
|
+
selectedEntity?: unknown;
|
|
56
|
+
readonly selectedEntityChanged?: CesiumStateSyncEvent;
|
|
57
|
+
readonly scene?: {
|
|
58
|
+
requestRender?(): void;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The Cesium symbols this port needs, modelled as the minimal slice of
|
|
63
|
+
* `typeof import("cesium")` so a mocked module satisfies it.
|
|
64
|
+
*/
|
|
65
|
+
export interface CesiumStateSyncModule {
|
|
66
|
+
readonly Cartesian3: {
|
|
67
|
+
fromDegrees(longitude: number, latitude: number, height?: number): unknown;
|
|
68
|
+
};
|
|
69
|
+
readonly JulianDate: {
|
|
70
|
+
fromIso8601(iso: string): unknown;
|
|
71
|
+
toIso8601(date: unknown, precision?: number): string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export interface CreateCesiumStateSyncPortOptions {
|
|
75
|
+
readonly id?: string;
|
|
76
|
+
/** Shared-plan identity stamped onto everything this port publishes. */
|
|
77
|
+
readonly identity: SceneStateSyncIdentity;
|
|
78
|
+
readonly now?: () => string;
|
|
79
|
+
/** Inject the Cesium module. Defaults to a lazy `import("cesium")`. */
|
|
80
|
+
readonly cesium?: CesiumStateSyncModule | (() => Promise<CesiumStateSyncModule>);
|
|
81
|
+
/** Map a shared selection target onto an entity id. Defaults to the target's id. */
|
|
82
|
+
readonly entityIdForTarget?: (target: FeatureSelectionTarget) => string | undefined;
|
|
83
|
+
/** The inverse; defaults to `{ sourceId: identity.sourceId, id: entityId }`. */
|
|
84
|
+
readonly targetForEntityId?: (entityId: string) => FeatureSelectionTarget | undefined;
|
|
85
|
+
/** Read a filterable property off an entity. Defaults to its `properties` bag. */
|
|
86
|
+
readonly entityProperty?: (entity: CesiumStateSyncEntity, field: string) => unknown;
|
|
87
|
+
/** Source id the entity collection stands for, for `appliesTo` scoping. Defaults to `identity.sourceId`. */
|
|
88
|
+
readonly sourceId?: string;
|
|
89
|
+
readonly onDegraded?: (degradation: SceneStateSyncPortDegradation) => void;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Bind a live Cesium viewer to the shared scene state.
|
|
93
|
+
*
|
|
94
|
+
* Camera and selection changes are published automatically where the viewer
|
|
95
|
+
* raises an event for them (`camera.changed`, `camera.moveEnd`,
|
|
96
|
+
* `selectedEntityChanged`); everything else is published by the host. Because a
|
|
97
|
+
* globe's camera event is frame-driven, {@link SceneStateSyncRendererPort.readFromRenderer}
|
|
98
|
+
* is the deterministic pull complement.
|
|
99
|
+
*/
|
|
100
|
+
export declare function createCesiumStateSyncPort(viewer: CesiumStateSyncTarget, options: CreateCesiumStateSyncPortOptions): SceneStateSyncRendererPort;
|
|
101
|
+
//# sourceMappingURL=cesium-state-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cesium-state-sync.d.ts","sourceRoot":"","sources":["../../../src/scene-workspace/cesium-state-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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