Import GeoJSON, KML, KMZ and GPX files on Navara: shapes as clamped vector layers, pins as sprites, and the graphics it cannot draw counted and reported

This commit is contained in:
German Khokhlov committed 2026-11-03 21:19:55 +04:00
1 parent eee4f48745
commit d8c63c69d8
22 files changed
+1368 -68

No files matched your search

+22 -3
View File
@@ -28,6 +28,19 @@ import { createRecentImageryPanel } from '../ui/recentImagery.js';
// Native mesh capability stays at the composition boundary.
const navaraViews = new WeakMap();
/**
* An imported file's data source drawn on `engine` (UTILITIES ▸ Import); the
* drawing loads on first use, like the layers' Navara renderers.
*/
async function drawImported(engine, dataSource) {
const { drawImportedSource, measureImportImages } =
await import('../layers/shared/render/navaraStory.js');
const sizes = await measureImportImages(dataSource);
return drawImportedSource(engine, navaraViews.get(engine), dataSource, {
sizes,
});
}
/** The Navara globe module, loaded on demand. */
const loadNavaraGlobeModule = async () =>
(await import('../globe/navara/index.js')).createNavaraGlobe;
@@ -400,7 +413,7 @@ export async function createNavaraScene({
* voice.
*/
export function attachViewerlessTools(
{ engine },
{ engine, mapStackController = null },
{
data,
operations,
@@ -468,8 +481,14 @@ export function attachViewerlessTools(
defer(() => styleManager._clearPersistentStatusNotice?.());
// The page session's annotation board, Draw and Import on this engine
// (src/app/navaraTools.js).
const tools = { engine, views: navaraViews.get(engine) };
const context = { operations, placeSearch, layerSession, styleManager };
const tools = { engine, views: navaraViews.get(engine), mapStackController };
const context = {
operations,
placeSearch,
layerSession,
styleManager,
drawImported,
};
const annotations = attachNavaraAnnotations(tools, context, {
signal,
defer,
+28 -4
View File
@@ -3,7 +3,7 @@
// with src/app/navaraMode.js, so the Cesium-mode bundle carries none of it.
import { createNavaraAnnotationRenderer } from '../annotations/navaraAnnotationRenderer.js';
import { sessionAnnotations } from './sessionTools.js';
import { sessionAnnotations, sessionGeoImport } from './sessionTools.js';
/**
* The annotation board drawn on this Navara scene: draped areas and routes
@@ -38,7 +38,31 @@ export function attachNavaraDraw() {
return null;
}
/** UTILITIES ▸ Import on this Navara scene; null while it has none. */
export function attachNavaraGeoImport() {
return null;
/**
* UTILITIES ▸ Import on this Navara scene: the session's files drawn by
* `drawImported(engine, dataSource)` (src/layers/shared/render/navaraStory.js,
* loaded by src/app/navaraMode.js), what Navara leaves out of them reported
* in the control's hint; drops and camera gestures on this engine's canvas.
* Returns the control (null on a page without it or without the view).
*/
export function attachNavaraGeoImport(
{ engine, views, mapStackController },
{ layerSession, styleManager, operations, drawImported },
{ defer },
) {
if (!views?.view || typeof drawImported !== 'function') return null;
const geoFileImport = sessionGeoImport({
layerSession,
styleManager,
operations,
defer,
});
geoFileImport?.attachScene({
engine,
draw: (dataSource) => drawImported(engine, dataSource),
navigation: styleManager,
subscribeMapSource: (listener) => mapStackController?.subscribe?.(listener),
});
defer(() => geoFileImport?.detachScene());
return geoFileImport;
}