mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Let an application leave the Data Library out (#1815)
* Let an application leave the Data Library out * Changelog fragment for #1815
This commit is contained in:
1 parent
4f1a4a3f2a
commit
2bbcc73f03
2 files changed
+59
-52
No files matched your search
+56
-52
@@ -53,7 +53,8 @@ import { overlayHost } from './layers/overlayHost.js';
|
||||
* `library.fetchImpl` asks the library server (its catalog) in place of the
|
||||
* page's fetch, for a server that wants the application's own credentials.
|
||||
* `library.requireCatalog` offers only what the server's library catalog
|
||||
* names, and nothing while it does not answer.
|
||||
* names, and nothing while it does not answer. `library: false` leaves the
|
||||
* Data Library out: no catalog is asked, and no Browse button is drawn.
|
||||
*/
|
||||
export function createApplicationTools({
|
||||
scene,
|
||||
@@ -155,57 +156,60 @@ export function createApplicationTools({
|
||||
connect: connectDisplay,
|
||||
});
|
||||
defer(() => geoFileImport?.destroy());
|
||||
// DATA ▸ Library: entries register their layers only when a viewer adds
|
||||
// them, after the core catalog is sealed. The browser dialog and the
|
||||
// controller share the application lifetime.
|
||||
const dataLibrary = createDataLibrary({
|
||||
dataManager,
|
||||
services: localGeoJsonServices,
|
||||
getTileset: () => tileset,
|
||||
mapStackController,
|
||||
shareLink: styleManager.shareLinkManager,
|
||||
requestRender: governorRequestRender,
|
||||
// An application's own tile and dataset fetches, when it keeps them in
|
||||
// its own cache.
|
||||
fetchImpl: library.fetchImpl ?? undefined,
|
||||
fetchTile: library.fetchTile ?? null,
|
||||
fetchData: library.fetchData ?? null,
|
||||
requireCatalog: library.requireCatalog === true,
|
||||
// Zoom to layer: an immediate navigation, so Cockpit can refuse it and
|
||||
// the current follow owner is released first (as for imported files).
|
||||
zoomTo: (extent) =>
|
||||
styleManager.runImmediateNavigation('layer', () =>
|
||||
flyToLibraryExtent(viewer, extent),
|
||||
) !== false,
|
||||
});
|
||||
defer(() => dataLibrary.destroy());
|
||||
// Browse: the owner presents the dialog through the store; LayerPanelsView
|
||||
// draws the Browse button and the dialog from it.
|
||||
const libraryStore = useDataLibraryStore(applicationPinia());
|
||||
const libraryBrowser = createLibraryBrowser({
|
||||
library: dataLibrary,
|
||||
publish: (view) => libraryStore.publish(view),
|
||||
});
|
||||
libraryStore.connect(libraryBrowser.controls);
|
||||
defer(() => {
|
||||
libraryBrowser.destroy();
|
||||
libraryStore.connect(null);
|
||||
});
|
||||
dataLibrary.start({ signal }).catch((error) => {
|
||||
if (!signal?.aborted) console.warn('[Library] start failed:', error);
|
||||
});
|
||||
// The live gate's handle (scripts/qa-data-library.mjs).
|
||||
const libraryHandle = {
|
||||
library: dataLibrary,
|
||||
browser: libraryBrowser,
|
||||
// What Copy Link would copy.
|
||||
buildShareLink: () => styleManager.shareLinkManager?.buildLink?.() ?? null,
|
||||
};
|
||||
window.__gevDataLibrary = libraryHandle;
|
||||
defer(() => {
|
||||
if (window.__gevDataLibrary === libraryHandle)
|
||||
delete window.__gevDataLibrary;
|
||||
});
|
||||
if (library !== false) {
|
||||
// DATA ▸ Library: entries register their layers only when a viewer adds
|
||||
// them, after the core catalog is sealed. The browser dialog and the
|
||||
// controller share the application lifetime.
|
||||
const dataLibrary = createDataLibrary({
|
||||
dataManager,
|
||||
services: localGeoJsonServices,
|
||||
getTileset: () => tileset,
|
||||
mapStackController,
|
||||
shareLink: styleManager.shareLinkManager,
|
||||
requestRender: governorRequestRender,
|
||||
// An application's own tile and dataset fetches, when it keeps them in
|
||||
// its own cache.
|
||||
fetchImpl: library.fetchImpl ?? undefined,
|
||||
fetchTile: library.fetchTile ?? null,
|
||||
fetchData: library.fetchData ?? null,
|
||||
requireCatalog: library.requireCatalog === true,
|
||||
// Zoom to layer: an immediate navigation, so Cockpit can refuse it and
|
||||
// the current follow owner is released first (as for imported files).
|
||||
zoomTo: (extent) =>
|
||||
styleManager.runImmediateNavigation('layer', () =>
|
||||
flyToLibraryExtent(viewer, extent),
|
||||
) !== false,
|
||||
});
|
||||
defer(() => dataLibrary.destroy());
|
||||
// Browse: the owner presents the dialog through the store; LayerPanelsView
|
||||
// draws the Browse button and the dialog from it.
|
||||
const libraryStore = useDataLibraryStore(applicationPinia());
|
||||
const libraryBrowser = createLibraryBrowser({
|
||||
library: dataLibrary,
|
||||
publish: (view) => libraryStore.publish(view),
|
||||
});
|
||||
libraryStore.connect(libraryBrowser.controls);
|
||||
defer(() => {
|
||||
libraryBrowser.destroy();
|
||||
libraryStore.connect(null);
|
||||
});
|
||||
dataLibrary.start({ signal }).catch((error) => {
|
||||
if (!signal?.aborted) console.warn('[Library] start failed:', error);
|
||||
});
|
||||
// The live gate's handle (scripts/qa-data-library.mjs).
|
||||
const libraryHandle = {
|
||||
library: dataLibrary,
|
||||
browser: libraryBrowser,
|
||||
// What Copy Link would copy.
|
||||
buildShareLink: () =>
|
||||
styleManager.shareLinkManager?.buildLink?.() ?? null,
|
||||
};
|
||||
window.__gevDataLibrary = libraryHandle;
|
||||
defer(() => {
|
||||
if (window.__gevDataLibrary === libraryHandle)
|
||||
delete window.__gevDataLibrary;
|
||||
});
|
||||
}
|
||||
// DATA ▸ Recent Imagery: the box tool claims the pointer like Draw and the
|
||||
// panel lives on the right rail, so both belong to the application
|
||||
// lifetime. The tileset lets the layer drape while the globe is hidden.
|
||||
|
||||
Reference in new issue
Block a user