Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

1.1 KB
Raw Blame
import { createAnnotationEngine } from './annotationEngine.js';
import { createHybridAnnotationRenderer } from './hybridAnnotationRenderer.js';

/**
 * Initialize the map-annotation engine and expose it for the voice agent and
 * for manual/dev use via `window.__gevAnnotations`.
 *
 * This module is the single swap point between annotation rendering strategies.
 * This branch (Direction C) uses the HYBRID renderer: world-space draping for
 * footprints + screen-space SVG for callouts/rings/arrows. The engine, resolver,
 * and voice tool wiring are identical to the other two branches.
 */
export function initAnnotations({
  viewer,
  tileset = null,
  placeSearch,
  resolver,
}) {
  // World-space footprint draping; clamped marks can use the photoreal tiles.
  if (tileset) {
    try {
      tileset.enableCollision = true;
    } catch {
      /* older tileset */
    }
  }
  const renderer = createHybridAnnotationRenderer(viewer);
  const engine = createAnnotationEngine({
    viewer,
    renderer,
    placeSearch,
    resolveTarget: resolver?.resolveAnnotationTarget,
  });
  window.__gevAnnotations = engine;
  return engine;
}