@honua/app-platform 0.1.2-beta.0 → 0.1.4-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/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 +87 -18
- package/contract/types.d.ts.map +1 -1
- 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 +45 -21
- package/core/client.d.ts.map +1 -1
- package/core/client.js +224 -46
- package/core/error-classifications.d.ts +6 -0
- package/core/error-classifications.d.ts.map +1 -1
- package/core/error-classifications.js +6 -0
- package/core/error-code-registry.d.ts +6 -0
- package/core/error-code-registry.d.ts.map +1 -1
- package/core/error-code-registry.js +6 -0
- package/core/error-envelope.js +2 -0
- package/core/errors.d.ts +1 -1
- package/core/errors.js +1 -1
- package/core/geoparquet-sql.d.ts +68 -4
- package/core/geoparquet-sql.d.ts.map +1 -1
- package/core/geoparquet-sql.js +325 -8
- 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 +31 -0
- package/core/stac.d.ts.map +1 -1
- package/core/stac.js +136 -19
- package/core/surfaces.d.ts.map +1 -1
- package/core/surfaces.js +273 -68
- package/core/types.d.ts +123 -9
- 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/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/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/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/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
|
@@ -16,30 +16,16 @@
|
|
|
16
16
|
* PMTiles source to a live map through `runtime.addSource` is synchronous — call
|
|
17
17
|
* {@link ensurePmtilesProtocol} yourself beforehand in that case.
|
|
18
18
|
*
|
|
19
|
-
* The
|
|
20
|
-
*
|
|
19
|
+
* The registration bookkeeping itself lives in `protocol-registry.ts`, shared
|
|
20
|
+
* with every other scheme the runtime registers; this module owns only the
|
|
21
|
+
* PMTiles policy. The `maplibre-gl` / `pmtiles` slices are injectable so the
|
|
22
|
+
* wiring is unit-testable without either real package.
|
|
21
23
|
*
|
|
22
24
|
* @module
|
|
23
25
|
*/
|
|
26
|
+
import { ensureMaplibreProtocol, isMaplibreProtocolRegistered, resetMaplibreProtocol, styleUsesProtocolScheme, } from "./protocol-registry.js";
|
|
24
27
|
/** The default MapLibre protocol scheme PMTiles archives are addressed under. */
|
|
25
28
|
export const PMTILES_PROTOCOL_SCHEME = "pmtiles";
|
|
26
|
-
let registration;
|
|
27
|
-
let inFlight;
|
|
28
|
-
/**
|
|
29
|
-
* Resolve the MapLibre `addProtocol` registrar from the lazily-imported module.
|
|
30
|
-
* MapLibre exposes it both as a named ESM export and off the default namespace;
|
|
31
|
-
* accept either so this works against any v5 packaging.
|
|
32
|
-
*/
|
|
33
|
-
async function loadMaplibreRegistrar() {
|
|
34
|
-
const mod = (await import("maplibre-gl"));
|
|
35
|
-
if (typeof mod.addProtocol === "function") {
|
|
36
|
-
return { addProtocol: mod.addProtocol, removeProtocol: mod.removeProtocol };
|
|
37
|
-
}
|
|
38
|
-
if (mod.default && typeof mod.default.addProtocol === "function") {
|
|
39
|
-
return mod.default;
|
|
40
|
-
}
|
|
41
|
-
throw new Error("maplibre-gl does not expose addProtocol(); ensure maplibre-gl >= 2 is installed.");
|
|
42
|
-
}
|
|
43
29
|
async function loadPmtilesModule() {
|
|
44
30
|
return (await import("pmtiles"));
|
|
45
31
|
}
|
|
@@ -53,29 +39,20 @@ async function loadPmtilesModule() {
|
|
|
53
39
|
*/
|
|
54
40
|
export async function ensurePmtilesProtocol(deps = {}) {
|
|
55
41
|
const scheme = deps.scheme ?? PMTILES_PROTOCOL_SCHEME;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
registrar.addProtocol(scheme, protocol.tile);
|
|
67
|
-
registration = { scheme, registrar, protocol };
|
|
68
|
-
})();
|
|
69
|
-
try {
|
|
70
|
-
await inFlight;
|
|
71
|
-
}
|
|
72
|
-
finally {
|
|
73
|
-
inFlight = undefined;
|
|
74
|
-
}
|
|
42
|
+
await ensureMaplibreProtocol({
|
|
43
|
+
scheme,
|
|
44
|
+
...(deps.maplibre ? { maplibre: deps.maplibre } : {}),
|
|
45
|
+
createHandler: async () => {
|
|
46
|
+
const pmtilesModule = deps.pmtilesModule ?? (await loadPmtilesModule());
|
|
47
|
+
// `metadata: true` lets MapLibre auto-populate source attribution and the
|
|
48
|
+
// inspect surface from the archive header without a second wiring step.
|
|
49
|
+
return new pmtilesModule.Protocol({ metadata: true }).tile;
|
|
50
|
+
},
|
|
51
|
+
});
|
|
75
52
|
}
|
|
76
53
|
/** Whether the `pmtiles://` protocol (or `scheme`) is currently registered. */
|
|
77
54
|
export function isPmtilesProtocolRegistered(scheme = PMTILES_PROTOCOL_SCHEME) {
|
|
78
|
-
return
|
|
55
|
+
return isMaplibreProtocolRegistered(scheme);
|
|
79
56
|
}
|
|
80
57
|
/**
|
|
81
58
|
* Tear down a prior {@link ensurePmtilesProtocol} registration. Primarily a test
|
|
@@ -83,25 +60,8 @@ export function isPmtilesProtocolRegistered(scheme = PMTILES_PROTOCOL_SCHEME) {
|
|
|
83
60
|
* useful if a host wants to fully release the protocol. Best-effort — a
|
|
84
61
|
* registrar without `removeProtocol` just clears the local record.
|
|
85
62
|
*/
|
|
86
|
-
export function resetPmtilesProtocol() {
|
|
87
|
-
|
|
88
|
-
registration.registrar.removeProtocol?.(registration.scheme);
|
|
89
|
-
registration = undefined;
|
|
90
|
-
}
|
|
91
|
-
inFlight = undefined;
|
|
92
|
-
}
|
|
93
|
-
function sourceReferencesPmtiles(source, scheme) {
|
|
94
|
-
if (!source || typeof source !== "object")
|
|
95
|
-
return false;
|
|
96
|
-
const prefix = `${scheme}://`;
|
|
97
|
-
const url = source.url;
|
|
98
|
-
if (typeof url === "string" && url.startsWith(prefix))
|
|
99
|
-
return true;
|
|
100
|
-
const tiles = source.tiles;
|
|
101
|
-
if (Array.isArray(tiles) && tiles.some((tile) => typeof tile === "string" && tile.startsWith(prefix))) {
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
return false;
|
|
63
|
+
export function resetPmtilesProtocol(scheme = PMTILES_PROTOCOL_SCHEME) {
|
|
64
|
+
resetMaplibreProtocol(scheme);
|
|
105
65
|
}
|
|
106
66
|
/**
|
|
107
67
|
* Whether a composed MapLibre style references at least one `pmtiles://` source.
|
|
@@ -109,12 +69,5 @@ function sourceReferencesPmtiles(source, scheme) {
|
|
|
109
69
|
* before `map.setStyle`.
|
|
110
70
|
*/
|
|
111
71
|
export function styleUsesPmtiles(style, scheme = PMTILES_PROTOCOL_SCHEME) {
|
|
112
|
-
|
|
113
|
-
if (!sources)
|
|
114
|
-
return false;
|
|
115
|
-
for (const source of Object.values(sources)) {
|
|
116
|
-
if (sourceReferencesPmtiles(source, scheme))
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
return false;
|
|
72
|
+
return styleUsesProtocolScheme(style, scheme);
|
|
120
73
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One idempotent MapLibre protocol registry, shared by every scheme the runtime
|
|
3
|
+
* auto-registers.
|
|
4
|
+
*
|
|
5
|
+
* MapLibre's protocol table is process-global, so registration has to be
|
|
6
|
+
* idempotent, deduplicated across concurrently loading maps, and keyed by scheme
|
|
7
|
+
* rather than by whichever protocol happened to register last. This module owns
|
|
8
|
+
* that bookkeeping once; `pmtiles-protocol.ts` and `offline-region-protocol.ts`
|
|
9
|
+
* are thin policies over it that decide *what* handler a scheme gets and *when* a
|
|
10
|
+
* style needs it.
|
|
11
|
+
*
|
|
12
|
+
* The `maplibre-gl` slice stays injectable so every wiring path is unit-testable
|
|
13
|
+
* without the real peer.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
/** The MapLibre `addProtocol` / `removeProtocol` surface this module drives. */
|
|
18
|
+
export interface MaplibreProtocolRegistrar {
|
|
19
|
+
addProtocol(scheme: string, handler: unknown): void;
|
|
20
|
+
removeProtocol?(scheme: string): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the MapLibre `addProtocol` registrar from the lazily-imported module.
|
|
24
|
+
* MapLibre 6 is ESM-only and exposes it as a named export; MapLibre 5 may also
|
|
25
|
+
* surface it off the default namespace depending on how the host bundles the
|
|
26
|
+
* UMD build. Accept either so this works across the `^5 || ^6` peer range.
|
|
27
|
+
*/
|
|
28
|
+
export declare function loadMaplibreRegistrar(): Promise<MaplibreProtocolRegistrar>;
|
|
29
|
+
/**
|
|
30
|
+
* Register `scheme` once, building its handler only when it is actually needed.
|
|
31
|
+
*
|
|
32
|
+
* Repeated calls — including from several maps loading at the same time — share
|
|
33
|
+
* one registration and one in-flight build per scheme. A failed build is not
|
|
34
|
+
* remembered, so a later call can retry.
|
|
35
|
+
*/
|
|
36
|
+
export declare function ensureMaplibreProtocol(options: {
|
|
37
|
+
readonly scheme: string;
|
|
38
|
+
/** Built at most once per scheme, and only when the scheme is not registered. */
|
|
39
|
+
readonly createHandler: () => unknown | Promise<unknown>;
|
|
40
|
+
readonly maplibre?: MaplibreProtocolRegistrar;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
/** Whether `scheme` is currently registered through this registry. */
|
|
43
|
+
export declare function isMaplibreProtocolRegistered(scheme: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Tear down a prior registration. Primarily a test seam so a module-global
|
|
46
|
+
* registration does not leak between cases; also useful if a host wants to fully
|
|
47
|
+
* release a protocol. Best-effort — a registrar without `removeProtocol` just
|
|
48
|
+
* clears the local record.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resetMaplibreProtocol(scheme: string): void;
|
|
51
|
+
/** Whether a composed MapLibre style references at least one `<scheme>://` source. */
|
|
52
|
+
export declare function styleUsesProtocolScheme(style: {
|
|
53
|
+
sources?: Record<string, unknown>;
|
|
54
|
+
} | null | undefined, scheme: string): boolean;
|
|
55
|
+
//# sourceMappingURL=protocol-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-registry.d.ts","sourceRoot":"","sources":["../../../src/runtime/protocol-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,gFAAgF;AAChF,MAAM,WAAW,yBAAyB;IACxC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACpD,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAUD;;;;;GAKG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,yBAAyB,CAAC,CAehF;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iFAAiF;IACjF,QAAQ,CAAC,aAAa,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,yBAAyB,CAAC;CAC/C,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBhB;AAED,sEAAsE;AACtE,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAO1D;AAED,sFAAsF;AACtF,wBAAgB,uBAAuB,CACrC,KAAK,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,EAC/D,MAAM,EAAE,MAAM,GACb,OAAO,CAQT"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One idempotent MapLibre protocol registry, shared by every scheme the runtime
|
|
3
|
+
* auto-registers.
|
|
4
|
+
*
|
|
5
|
+
* MapLibre's protocol table is process-global, so registration has to be
|
|
6
|
+
* idempotent, deduplicated across concurrently loading maps, and keyed by scheme
|
|
7
|
+
* rather than by whichever protocol happened to register last. This module owns
|
|
8
|
+
* that bookkeeping once; `pmtiles-protocol.ts` and `offline-region-protocol.ts`
|
|
9
|
+
* are thin policies over it that decide *what* handler a scheme gets and *when* a
|
|
10
|
+
* style needs it.
|
|
11
|
+
*
|
|
12
|
+
* The `maplibre-gl` slice stays injectable so every wiring path is unit-testable
|
|
13
|
+
* without the real peer.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
const registrations = new Map();
|
|
18
|
+
const inFlight = new Map();
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the MapLibre `addProtocol` registrar from the lazily-imported module.
|
|
21
|
+
* MapLibre 6 is ESM-only and exposes it as a named export; MapLibre 5 may also
|
|
22
|
+
* surface it off the default namespace depending on how the host bundles the
|
|
23
|
+
* UMD build. Accept either so this works across the `^5 || ^6` peer range.
|
|
24
|
+
*/
|
|
25
|
+
export async function loadMaplibreRegistrar() {
|
|
26
|
+
const mod = (await import("maplibre-gl"));
|
|
27
|
+
if (typeof mod.addProtocol === "function") {
|
|
28
|
+
return { addProtocol: mod.addProtocol, removeProtocol: mod.removeProtocol };
|
|
29
|
+
}
|
|
30
|
+
if (mod.default && typeof mod.default.addProtocol === "function") {
|
|
31
|
+
return mod.default;
|
|
32
|
+
}
|
|
33
|
+
throw new Error("maplibre-gl does not expose addProtocol(); install maplibre-gl 5.x or 6.x (the SDK peer range is ^5.0.0 || ^6.0.0).");
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Register `scheme` once, building its handler only when it is actually needed.
|
|
37
|
+
*
|
|
38
|
+
* Repeated calls — including from several maps loading at the same time — share
|
|
39
|
+
* one registration and one in-flight build per scheme. A failed build is not
|
|
40
|
+
* remembered, so a later call can retry.
|
|
41
|
+
*/
|
|
42
|
+
export async function ensureMaplibreProtocol(options) {
|
|
43
|
+
const scheme = options.scheme;
|
|
44
|
+
if (typeof scheme !== "string" || scheme.length === 0)
|
|
45
|
+
throw new TypeError("A protocol scheme is required.");
|
|
46
|
+
if (registrations.has(scheme))
|
|
47
|
+
return;
|
|
48
|
+
const pending = inFlight.get(scheme);
|
|
49
|
+
if (pending)
|
|
50
|
+
return pending;
|
|
51
|
+
const run = (async () => {
|
|
52
|
+
const registrar = options.maplibre ?? (await loadMaplibreRegistrar());
|
|
53
|
+
const handler = await options.createHandler();
|
|
54
|
+
registrar.addProtocol(scheme, handler);
|
|
55
|
+
registrations.set(scheme, { registrar, handler });
|
|
56
|
+
})();
|
|
57
|
+
inFlight.set(scheme, run);
|
|
58
|
+
try {
|
|
59
|
+
await run;
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
inFlight.delete(scheme);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Whether `scheme` is currently registered through this registry. */
|
|
66
|
+
export function isMaplibreProtocolRegistered(scheme) {
|
|
67
|
+
return registrations.has(scheme);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Tear down a prior registration. Primarily a test seam so a module-global
|
|
71
|
+
* registration does not leak between cases; also useful if a host wants to fully
|
|
72
|
+
* release a protocol. Best-effort — a registrar without `removeProtocol` just
|
|
73
|
+
* clears the local record.
|
|
74
|
+
*/
|
|
75
|
+
export function resetMaplibreProtocol(scheme) {
|
|
76
|
+
const registration = registrations.get(scheme);
|
|
77
|
+
if (registration) {
|
|
78
|
+
registration.registrar.removeProtocol?.(scheme);
|
|
79
|
+
registrations.delete(scheme);
|
|
80
|
+
}
|
|
81
|
+
inFlight.delete(scheme);
|
|
82
|
+
}
|
|
83
|
+
/** Whether a composed MapLibre style references at least one `<scheme>://` source. */
|
|
84
|
+
export function styleUsesProtocolScheme(style, scheme) {
|
|
85
|
+
const sources = style?.sources;
|
|
86
|
+
if (!sources)
|
|
87
|
+
return false;
|
|
88
|
+
const prefix = `${scheme}://`;
|
|
89
|
+
for (const source of Object.values(sources)) {
|
|
90
|
+
if (sourceReferencesScheme(source, prefix))
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
function sourceReferencesScheme(source, prefix) {
|
|
96
|
+
if (!source || typeof source !== "object")
|
|
97
|
+
return false;
|
|
98
|
+
const url = source.url;
|
|
99
|
+
if (typeof url === "string" && url.startsWith(prefix))
|
|
100
|
+
return true;
|
|
101
|
+
const tiles = source.tiles;
|
|
102
|
+
return Array.isArray(tiles) && tiles.some((tile) => typeof tile === "string" && tile.startsWith(prefix));
|
|
103
|
+
}
|
package/runtime/runtime.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export interface MaplibreMap extends FeatureStateMap, MapEventTarget {
|
|
|
48
48
|
lat: number;
|
|
49
49
|
} | readonly [number, number];
|
|
50
50
|
fitBounds?(bounds: [[number, number], [number, number]] | [number, number, number, number], options?: Record<string, unknown>): void;
|
|
51
|
+
getContainer?(): HTMLElement;
|
|
51
52
|
jumpTo?(options: {
|
|
52
53
|
center?: [number, number];
|
|
53
54
|
zoom?: number;
|
|
@@ -209,6 +210,7 @@ export declare class HonuaMapRuntime {
|
|
|
209
210
|
remove(): void;
|
|
210
211
|
};
|
|
211
212
|
setViewState(view: SetViewStateInput): void;
|
|
213
|
+
private prefersReducedMotion;
|
|
212
214
|
/**
|
|
213
215
|
* Diff the current package against `next`. Applies the change
|
|
214
216
|
* incrementally when safe; falls back to `map.setStyle` for structural
|
package/runtime/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,OAAO,EAA8B,MAAM,sBAAsB,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;AAGhH,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEtH,OAAO,KAAK,EAEV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,E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Ae;IAc9F,0BAA0B,CAC/B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,yBAAyB,EAC/B,OAAO,GAAE,kCAAuC,GAC/C,eAAe;IAeX,4BAA4B,CACjC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,yBAAyB,EAC/B,OAAO,GAAE,IAAI,CAAC,kCAAkC,EAAE,aAAa,GAAG,UAAU,GAAG,0BAA0B,CAAM,GAC9G;QAAE,MAAM,IAAI,IAAI,CAAA;KAAE;IAUd,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,2BAA2B,GAAG;QAAE,MAAM,IAAI,IAAI,CAAA;KAAE;IAqCrF,YAAY,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAuClD,OAAO,CAAC,oBAAoB;IAK5B;;;;OAIG;IACU,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAqEzD,EAAE,CAAC,QAAQ,EAAE,yBAAyB,GAAG;QAAE,MAAM,IAAI,IAAI,CAAA;KAAE;IASlE,6DAA6D;IACtD,KAAK,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAI5C;;;;;;;;;;;;;OAaG;IACI,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAiBzD,OAAO,IAAI,IAAI;CAwRvB;AAiMD,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnF,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
package/runtime/runtime.js
CHANGED
|
@@ -613,6 +613,7 @@ export class HonuaMapRuntime {
|
|
|
613
613
|
}
|
|
614
614
|
setViewState(view) {
|
|
615
615
|
this.#assertLive();
|
|
616
|
+
const reducedMotion = this.prefersReducedMotion();
|
|
616
617
|
const bbox = view.bbox ?? this.#packageRef.current.initialView?.bbox;
|
|
617
618
|
if (view.bbox && this.map.fitBounds) {
|
|
618
619
|
const [west, south, east, north] = view.bbox;
|
|
@@ -620,7 +621,7 @@ export class HonuaMapRuntime {
|
|
|
620
621
|
[west, south],
|
|
621
622
|
[east, north],
|
|
622
623
|
], {
|
|
623
|
-
animate: view.animate ?? false,
|
|
624
|
+
animate: reducedMotion ? false : (view.animate ?? false),
|
|
624
625
|
...(view.padding !== undefined ? { padding: view.padding } : {}),
|
|
625
626
|
});
|
|
626
627
|
return;
|
|
@@ -642,6 +643,10 @@ export class HonuaMapRuntime {
|
|
|
642
643
|
], { animate: false });
|
|
643
644
|
}
|
|
644
645
|
}
|
|
646
|
+
prefersReducedMotion() {
|
|
647
|
+
const view = this.map.getContainer?.().ownerDocument.defaultView;
|
|
648
|
+
return view?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
649
|
+
}
|
|
645
650
|
/**
|
|
646
651
|
* Diff the current package against `next`. Applies the change
|
|
647
652
|
* incrementally when safe; falls back to `map.setStyle` for structural
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
* `HonuaClient` — so the widgets reuse the SDK's auth / retry / timeout /
|
|
18
18
|
* interceptor pipeline instead of issuing ad-hoc `fetch` calls.
|
|
19
19
|
*
|
|
20
|
-
* @experimental
|
|
21
|
-
*
|
|
20
|
+
* @experimental Held back from the beta `@honua/app-platform/scene-workspace`
|
|
21
|
+
* tier: line-of-sight, viewshed, and elevation profile execute against Honua
|
|
22
|
+
* Server analysis endpoints, so they sit outside the open-endpoint evidence
|
|
23
|
+
* behind that promotion and may change in any minor release prior to `1.0.0`.
|
|
22
24
|
* @module
|
|
23
25
|
*/
|
|
24
26
|
import type { QueryMethod } from "../core/types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis-widgets.d.ts","sourceRoot":"","sources":["../../../src/scene-workspace/analysis-widgets.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file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/B;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,0BAA0B,EACpC,WAAW,EAAE,gBAAgB,EAC7B,MAAM,CAAC,EAAE,yBAAyB,GACjC,OAAO,CAAC,oBAAoB,CAAC,CA0B/B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,gBAAgB,GAAG,MAAM,CAO5E"}
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
* `HonuaClient` — so the widgets reuse the SDK's auth / retry / timeout /
|
|
18
18
|
* interceptor pipeline instead of issuing ad-hoc `fetch` calls.
|
|
19
19
|
*
|
|
20
|
-
* @experimental
|
|
21
|
-
*
|
|
20
|
+
* @experimental Held back from the beta `@honua/app-platform/scene-workspace`
|
|
21
|
+
* tier: line-of-sight, viewshed, and elevation profile execute against Honua
|
|
22
|
+
* Server analysis endpoints, so they sit outside the open-endpoint evidence
|
|
23
|
+
* behind that promotion and may change in any minor release prior to `1.0.0`.
|
|
22
24
|
* @module
|
|
23
25
|
*/
|
|
24
26
|
const JSON_HEADERS = { "Content-Type": "application/json", Accept: "application/json" };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 2D/3D camera correspondence.
|
|
3
|
+
*
|
|
4
|
+
* The renderer-neutral {@link SceneCameraState} is a globe pose: geodetic
|
|
5
|
+
* longitude/latitude, an ellipsoidal camera height in metres, and a
|
|
6
|
+
* heading/pitch/roll triple in degrees using Cesium's sign convention
|
|
7
|
+
* (`pitch = -90` looks straight down, `pitch = 0` looks at the horizon).
|
|
8
|
+
*
|
|
9
|
+
* A 2D web map does not carry a camera height at all — it carries a *zoom*,
|
|
10
|
+
* which is a statement about ground resolution. This module is the documented,
|
|
11
|
+
* unit-tested bridge between the two, so no consumer has to re-derive it. The
|
|
12
|
+
* Cesium half of the same correspondence lives in `cesium-adapter.ts`
|
|
13
|
+
* (`cameraStateToCesiumView` / `cesiumCameraToSceneState`), which needs no
|
|
14
|
+
* conversion because the workspace camera *is* a globe pose.
|
|
15
|
+
*
|
|
16
|
+
* ## The zoom/height relationship
|
|
17
|
+
*
|
|
18
|
+
* Zoom fixes the ground resolution of the projected plane:
|
|
19
|
+
*
|
|
20
|
+
* ```text
|
|
21
|
+
* groundResolution(zoom, lat) = C · cos(lat) / (tileSize · 2^zoom) [m/px]
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* where `C` is the WGS84 equatorial circumference. The 2D renderer places its
|
|
25
|
+
* perspective camera so the map centre fills the viewport at that resolution:
|
|
26
|
+
*
|
|
27
|
+
* ```text
|
|
28
|
+
* centreDistance(px) = 0.5 · viewportHeight / tan(fov / 2)
|
|
29
|
+
* centreDistance(m) = groundResolution · centreDistance(px)
|
|
30
|
+
* cameraHeight(m) = centreDistance(m) · cos(pitch2D)
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* The relationship is therefore **not** latitude-independent and **not**
|
|
34
|
+
* viewport-independent: the same zoom on a taller viewport puts the camera
|
|
35
|
+
* further away in metres, because more ground is on screen at the same
|
|
36
|
+
* resolution. Both halves are captured in {@link MapLibreCameraGeometry}, which
|
|
37
|
+
* a live port reads from the map it is bound to rather than assuming.
|
|
38
|
+
*
|
|
39
|
+
* ## What cannot round-trip
|
|
40
|
+
*
|
|
41
|
+
* A globe camera can hold poses a Web Mercator plane cannot express. Those are
|
|
42
|
+
* clamped and reported as {@link SceneCameraDegradation} entries rather than
|
|
43
|
+
* silently applied: latitudes beyond the Mercator limit, zooms outside the
|
|
44
|
+
* map's own range, pitches beyond the map's maximum, and a non-zero roll on a
|
|
45
|
+
* renderer that does not support roll. A projection that needed no clamping
|
|
46
|
+
* reports `exact` fidelity and round-trips to floating-point precision.
|
|
47
|
+
*
|
|
48
|
+
* @beta Part of the beta `@honua/app-platform/scene-workspace` surface.
|
|
49
|
+
* @module
|
|
50
|
+
*/
|
|
51
|
+
import type { SceneStateSyncFidelity } from "./state-sync.js";
|
|
52
|
+
import type { SceneCameraState } from "./types.js";
|
|
53
|
+
/** WGS84 equatorial circumference in metres (`2π · 6378137`). */
|
|
54
|
+
export declare const EARTH_CIRCUMFERENCE_METERS = 40075016.68557849;
|
|
55
|
+
/**
|
|
56
|
+
* The Web Mercator latitude limit in degrees. Beyond it the projection is
|
|
57
|
+
* undefined, so a globe camera over the poles has no 2D equivalent.
|
|
58
|
+
*/
|
|
59
|
+
export declare const WEB_MERCATOR_MAX_LATITUDE = 85.05112877980659;
|
|
60
|
+
/**
|
|
61
|
+
* The viewport and lens properties a 2D zoom is defined against.
|
|
62
|
+
*
|
|
63
|
+
* A live port reads these from the map it is bound to; the defaults describe a
|
|
64
|
+
* 600 CSS-pixel-tall viewport with the standard 512-pixel tile scheme and the
|
|
65
|
+
* renderer's default vertical field of view.
|
|
66
|
+
*/
|
|
67
|
+
export interface MapLibreCameraGeometry {
|
|
68
|
+
/** Viewport height in CSS pixels. */
|
|
69
|
+
readonly viewportHeightPixels: number;
|
|
70
|
+
/** Vertical field of view in radians. */
|
|
71
|
+
readonly fovRadians: number;
|
|
72
|
+
/** Tile edge length in pixels the zoom scale is defined against. */
|
|
73
|
+
readonly tileSizePixels: number;
|
|
74
|
+
}
|
|
75
|
+
/** Documented defaults for {@link MapLibreCameraGeometry}. */
|
|
76
|
+
export declare const DEFAULT_MAPLIBRE_CAMERA_GEOMETRY: MapLibreCameraGeometry;
|
|
77
|
+
/** What a 2D map will actually accept; anything outside it is clamped. */
|
|
78
|
+
export interface MapLibreCameraLimits {
|
|
79
|
+
readonly minZoom: number;
|
|
80
|
+
readonly maxZoom: number;
|
|
81
|
+
readonly maxPitch: number;
|
|
82
|
+
/** Whether the renderer can express a non-zero roll. */
|
|
83
|
+
readonly rollSupported: boolean;
|
|
84
|
+
}
|
|
85
|
+
/** Documented defaults for {@link MapLibreCameraLimits}. */
|
|
86
|
+
export declare const DEFAULT_MAPLIBRE_CAMERA_LIMITS: MapLibreCameraLimits;
|
|
87
|
+
/** A 2D map camera: centre, zoom, and screen orientation, all in degrees. */
|
|
88
|
+
export interface MapLibreCameraView {
|
|
89
|
+
readonly center: readonly [number, number];
|
|
90
|
+
readonly zoom: number;
|
|
91
|
+
/** Compass direction that is "up", clockwise from north — the same convention as a globe heading. */
|
|
92
|
+
readonly bearing: number;
|
|
93
|
+
/** Tilt in degrees where `0` looks straight down. */
|
|
94
|
+
readonly pitch: number;
|
|
95
|
+
readonly roll: number;
|
|
96
|
+
}
|
|
97
|
+
export type SceneCameraDegradationCode = "camera-latitude-clamped" | "camera-zoom-clamped" | "camera-pitch-clamped" | "camera-roll-dropped";
|
|
98
|
+
/** One named way a globe pose failed to survive projection onto a 2D map. */
|
|
99
|
+
export interface SceneCameraDegradation {
|
|
100
|
+
readonly code: SceneCameraDegradationCode;
|
|
101
|
+
readonly message: string;
|
|
102
|
+
readonly requested: number;
|
|
103
|
+
readonly applied: number;
|
|
104
|
+
}
|
|
105
|
+
/** A projected 2D view plus the honest account of what projecting it cost. */
|
|
106
|
+
export interface MapLibreCameraProjection {
|
|
107
|
+
readonly view: MapLibreCameraView;
|
|
108
|
+
/** `exact` when nothing was clamped or dropped, `equivalent` otherwise. */
|
|
109
|
+
readonly fidelity: SceneStateSyncFidelity;
|
|
110
|
+
readonly degradations: readonly SceneCameraDegradation[];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Ground resolution in metres per CSS pixel at a zoom and latitude.
|
|
114
|
+
*
|
|
115
|
+
* This is the definition of zoom, and the only part of the correspondence that
|
|
116
|
+
* is independent of the viewport and the lens.
|
|
117
|
+
*/
|
|
118
|
+
export declare function mapLibreGroundResolutionMeters(zoom: number, latitude: number, geometry?: MapLibreCameraGeometry): number;
|
|
119
|
+
/**
|
|
120
|
+
* Camera height in metres above the map centre for a 2D zoom.
|
|
121
|
+
*
|
|
122
|
+
* `pitchDegrees` is the 2D tilt (`0` = straight down), not the globe pitch.
|
|
123
|
+
*/
|
|
124
|
+
export declare function mapLibreZoomToCameraHeight(zoom: number, latitude: number, pitchDegrees?: number, geometry?: MapLibreCameraGeometry): number;
|
|
125
|
+
/**
|
|
126
|
+
* The inverse of {@link mapLibreZoomToCameraHeight}: the zoom whose camera sits
|
|
127
|
+
* `height` metres above the map centre. Unclamped — callers decide what their
|
|
128
|
+
* map will accept.
|
|
129
|
+
*/
|
|
130
|
+
export declare function mapLibreCameraHeightToZoom(height: number, latitude: number, pitchDegrees?: number, geometry?: MapLibreCameraGeometry): number;
|
|
131
|
+
/**
|
|
132
|
+
* Read a 2D map view as a renderer-neutral globe pose.
|
|
133
|
+
*
|
|
134
|
+
* Always lossless in this direction: every 2D view is a valid globe pose. The
|
|
135
|
+
* pitch convention flips (`pitch2D = 0` looks down, which is `pitch = -90` on
|
|
136
|
+
* the globe) and the bearing is the heading unchanged.
|
|
137
|
+
*/
|
|
138
|
+
export declare function mapLibreViewToSceneCamera(view: MapLibreCameraView, geometry?: MapLibreCameraGeometry): SceneCameraState;
|
|
139
|
+
/**
|
|
140
|
+
* Project a globe pose onto a 2D map view, clamping what the plane cannot hold
|
|
141
|
+
* and naming every clamp.
|
|
142
|
+
*
|
|
143
|
+
* The caller is expected to apply `view` and surface `degradations`; the shared
|
|
144
|
+
* state is deliberately left alone, because writing the clamped pose back would
|
|
145
|
+
* drag the 3D view down to the 2D renderer's limits.
|
|
146
|
+
*/
|
|
147
|
+
export declare function sceneCameraToMapLibreView(camera: SceneCameraState, options?: {
|
|
148
|
+
readonly geometry?: MapLibreCameraGeometry;
|
|
149
|
+
readonly limits?: MapLibreCameraLimits;
|
|
150
|
+
}): MapLibreCameraProjection;
|
|
151
|
+
//# sourceMappingURL=camera-correspondence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera-correspondence.d.ts","sourceRoot":"","sources":["../../../src/scene-workspace/camera-correspondence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAA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