* feat(map): enhance globe projection handling and improve altitude color representation - Implemented elevation-aware pixel projection for globe mode in `projectLngLatElevationPixelDelta`. - Refactored north-up animation in `CameraController` to use `setBearing` for smoother transitions. - Added native GeoJSON support for globe zoom in `FlightLayers`, including dynamic opacity adjustments based on zoom levels. - Introduced globe-specific pitch and projection settings in `Map` component, ensuring consistent rendering. - Enhanced UI control panel with a visual separator for better organization. - Minor formatting adjustments in `altitudeToColor` function for improved readability. * feat(map): refactor elevation-aware projection handling for improved accuracy * feat(map): add dark terrain profile support and enhance map styling * feat: implement trail stitching for merging historical and live flight data - Added a new module `trail-stitching.ts` to handle the merging of sparse historical track data with high-frequency live trail data. - Introduced constants for thresholds and parameters to improve code readability and maintainability. - Implemented a main function `stitchHistoricalTrail` that processes flight tracks, applies smoothing, and merges live tail data. - Included utility functions for spherical interpolation and cubic easing for altitude transitions. - Ensured the final path is cleaned of spikes and sharp corners for a smoother representation. * feat: add centripetal Catmull-Rom spline interpolation for 3D flight trails - Implemented `catmullRomSpline3D` function to interpolate waypoints into a smooth 3D path. - Added helper functions for segment density calculation, safe linear interpolation, and endpoint reflection. - Included support for variable tension based on heading changes to enhance smoothness. - Introduced utility functions for linear interpolation between elevated points. * feat(map): enhance layer visibility handling for flight and selection layers * feat: enhance control panel with new tabs and settings - Added "Changelog" and "About" tabs to the control panel. - Introduced new icons for the added tabs using lucide-react. - Updated the styling of the control panel buttons and dialog. - Improved accessibility with aria-labels for buttons. feat: integrate hero banner in flight card - Added a HeroBanner component to display aircraft photos in the FlightCard. - Implemented loading and error states for the photo display. - Enhanced the layout and styling of the FlightCard for better user experience. fix: update keyboard shortcuts for search functionality - Added shortcut "⌘K" to open search from anywhere in the application. - Adjusted keyboard shortcut handling to prevent conflicts with input fields. fix: optimize flight tracking cache management - Introduced a maximum cache size for flight tracking to prevent memory growth. - Implemented a cache eviction strategy for stale entries. feat: add great-circle utilities for geographical calculations - Implemented functions for calculating haversine distance, great-circle interpolation, and densifying paths. - Added functionality to handle antimeridian crossings in geographical paths. refactor: streamline map styles and terrain handling - Consolidated terrain DEM source for both terrain mesh and hillshade. - Adjusted hillshade layer properties for better performance and visual fidelity. fix: improve bounding box calculations for flight queries - Enhanced longitude calculations to account for converging meridians at higher latitudes. - Ensured bounding box calculations are accurate across different latitudes. * feat(map): refine globe mode functionality and update trail settings
74 lines
2.5 KiB
TypeScript
74 lines
2.5 KiB
TypeScript
import { type MapboxOverlay } from "@deck.gl/mapbox";
|
|
import { type PickingInfo } from "@deck.gl/core";
|
|
import type { FlightState } from "@/lib/opensky";
|
|
import type { TrailEntry } from "@/hooks/use-trail-history";
|
|
import type { MutableRefObject } from "react";
|
|
|
|
// ── Overlay type augmentation ──────────────────────────────────────────
|
|
|
|
export type DeckGLOverlay = MapboxOverlay & {
|
|
pickObject?(opts: {
|
|
x: number;
|
|
y: number;
|
|
radius: number;
|
|
}): PickingInfo | null;
|
|
};
|
|
|
|
// ── Animation & rendering constants ────────────────────────────────────
|
|
|
|
export const DEFAULT_ANIM_DURATION_MS = 30_000;
|
|
export const MIN_ANIM_DURATION_MS = 8_000;
|
|
export const MAX_ANIM_DURATION_MS = 45_000;
|
|
export const TELEPORT_THRESHOLD = 0.3;
|
|
export const TRAIL_BELOW_AIRCRAFT_METERS = 40;
|
|
export const STARTUP_TRAIL_POLLS = 3;
|
|
export const STARTUP_TRAIL_STEP_SEC = 12;
|
|
export const TRACK_DAMPING = 0.18;
|
|
export const TRAIL_SMOOTHING_ITERATIONS = 3;
|
|
export const AIRCRAFT_SCENEGRAPH_URL = "/models/airplane.glb";
|
|
export const AIRCRAFT_PX_PER_UNIT = 0.3;
|
|
export const BASE_AIRCRAFT_SIZE = 25;
|
|
export const AIRCRAFT_PICK_RADIUS_PX = 14;
|
|
export const SELECTION_FADE_MS = 600;
|
|
|
|
// Globe/Mercator hard-switch: dots below this zoom, flights above.
|
|
export const GLOBE_SWITCH_ZOOM = 5.8;
|
|
export const GLOBE_FADE_ZOOM_FLOOR = GLOBE_SWITCH_ZOOM - 0.05;
|
|
export const GLOBE_FADE_ZOOM_CEIL = GLOBE_SWITCH_ZOOM + 0.05;
|
|
export const GLOBE_NATIVE_ZOOM_CEIL = GLOBE_SWITCH_ZOOM;
|
|
|
|
// GeoJSON globe dot layer timing
|
|
export const GEOJSON_THROTTLE_MS = 1500;
|
|
export const GEOJSON_DEBOUNCE_MS = 200;
|
|
|
|
// ── Shared types ───────────────────────────────────────────────────────
|
|
|
|
export type Snapshot = {
|
|
lng: number;
|
|
lat: number;
|
|
alt: number;
|
|
track: number;
|
|
};
|
|
|
|
export type ElevatedPoint = [number, number, number];
|
|
|
|
export type FlightLayerProps = {
|
|
flights: FlightState[];
|
|
trails: TrailEntry[];
|
|
onClick: (info: PickingInfo<FlightState> | null) => void;
|
|
selectedIcao24: string | null;
|
|
showTrails: boolean;
|
|
trailThickness: number;
|
|
trailDistance: number;
|
|
showShadows: boolean;
|
|
showAltitudeColors: boolean;
|
|
globeMode?: boolean;
|
|
fpvIcao24?: string | null;
|
|
fpvPositionRef?: MutableRefObject<{
|
|
lng: number;
|
|
lat: number;
|
|
alt: number;
|
|
track: number;
|
|
} | null>;
|
|
};
|