mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 18:22:25 +00:00
feat(satellites): ISS as a 3D model up close, NASA live video when selected
Within 1,500 km of the camera the ISS (NORAD 25544) is drawn as NASA 3D Resources' station model, at its real 109 m span with a 72 px floor, in its usual +XVV attitude from a per-frame SGP4 sample (the follow camera's sample while tracked). Farther out the dot stays; model and dots split the distance range. Selecting the ISS opens a panel beside the existing tracked card with NASA's official ISS live stream, embedded through youtube-nocookie with a fixed video id (no page scraping). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
10a788db78
commit
9aeabbacfb
32 files changed
+841
-17
No files matched your search
@@ -33,6 +33,8 @@ How to read this:
|
||||
| **Planespotters.net** (`api.planespotters.net/pub/photos/hex/{hex}`) | One thumbnail photo of the tracked aircraft, by ICAO hex, in the CONTEXT panel's CONTACTS view under the tracked flight's name | [Planespotters photo API terms](https://www.planespotters.net/photo/api); each photo remains the copyright of its photographer. Thumbnails may be hotlinked on the condition that the photographer is named next to the photo and the photo links to its Planespotters page with a followable link | "Photo © {photographer}" beside every photo that names one, linked to its Planespotters page; "Planespotters.net" in Data attribution |
|
||||
| **AISStream.io** | Live vessels (AIS) | Free, beta, no formal ToS; AIS is a public broadcast | "AISStream.io" (courtesy) |
|
||||
| **CelesTrak** | Satellite TLEs (SGP4) and SATCAT records (object type, operational status, owner) that file each satellite under a class | US-government-origin data, no license; citation requested | "CelesTrak (celestrak.org), Dr. T.S. Kelso" |
|
||||
| **NASA 3D Resources** (`public/models/iss.glb`) | The ISS drawn as a 3D model when the camera is near it (satellites layer) | NASA media, not subject to copyright in the United States; NASA's Images and Media Usage Guidelines (https://www.nasa.gov/nasa-brand-center/images-and-media) ask that use not imply endorsement and that the insignia not be used | "ISS model: NASA 3D Resources" |
|
||||
| **NASA ISS live stream on YouTube** (`youtube-nocookie.com/embed/ROboUHfPUrU`) | NASA's official live video from the ISS ("Live High-Definition Views from the International Space Station"), embedded with YouTube's player while the ISS is selected; the app stores nothing from it | NASA video, not subject to copyright in the United States (same guidelines); played through YouTube's embedded player under YouTube's Terms of Service | "ISS live video: NASA, via YouTube" |
|
||||
| **The Space Devs — Launch Library 2 v2.3** | Recent launch, payload, stage, and recovery metadata for Space Missions (30d) | [The Space Devs terms of use](https://github.com/TheSpaceDevs/Tutorials/blob/main/faqs/faq_TSD.md#terms-of-use): data may be used and shared in any form; avoid forwarding it without added value; attribution is encouraged (not mandatory). [Official API limits](https://ll.thespacedevs.com/docs/): 15 unauthenticated calls/hour; optional token | "Launch Library 2 — The Space Devs" (courtesy attribution) |
|
||||
| **Esri World Imagery** (ArcGIS Online tile service) | The keyless satellite basemap — the default landing when no Google/ion credential is configured, and the "Esri Satellite" map stack | [Esri Master Agreement](https://www.esri.com/en-us/legal/terms/full-master-agreement): the public World Imagery service is usable in public-facing apps with attribution; no key is required for this classic endpoint, but Esri governs and can change access — an app at scale should review current ArcGIS Location Platform terms | "Powered by Esri — Source: Esri, Maxar, Earthstar Geographics, and the GIS User Community" (provider carries the service's own credit line) |
|
||||
| **USGS** | Earthquakes | U.S. public domain | "Data courtesy of the U.S. Geological Survey" |
|
||||
|
||||
@@ -1378,6 +1378,17 @@ a fresh winning record. Dense removal clears only its own provenance, and a
|
||||
fresh core rebuild or lifecycle reset replaces the corresponding ownership.
|
||||
Source adapters retain the existing CelesTrak and Launch Library
|
||||
endpoints; standalone entries provide scene services and the satellite dependency.
|
||||
The ISS (NORAD 25544, by number, not name) is drawn as NASA's 3D model within
|
||||
1,500 km of the camera and as its dot beyond; the two split the distance range,
|
||||
so exactly one draws (the tracked dot too). The model is at its real 109 m span
|
||||
with a 72 px floor, flies the station's usual attitude (modules along the
|
||||
velocity, the same side to the Earth) from its own per-frame SGP4 sample, sits
|
||||
on the follow camera's sample while tracked, loads only once the ISS is shown,
|
||||
and hides with the dot's own rules and under the Cockpit hold. A click on it
|
||||
tracks the ISS. While the ISS is selected, a panel beside the tracked card plays
|
||||
NASA's official ISS live stream (YouTube, muted to start); closing it holds
|
||||
until the next selection, and untracking, the Cockpit or turning the layer off
|
||||
removes the player.
|
||||
The mission factory separates paths, replay, camera, panel, overlays and placement.
|
||||
Launch Library pad coordinates retain unknown values: missing fields use the
|
||||
reported location coordinates when available, and launches without a known pad
|
||||
|
||||
@@ -14,6 +14,7 @@ under the license listed below.
|
||||
| `mq9.glb` | “MQ-9” by [IProZenoN](https://sketchfab.com/IProZenoN) | [Sketchfab model](https://sketchfab.com/3d-models/mq-9-fabe963feb354c5584b51f9c470c3f7e) | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) | Optimized for God's Eye View: geometry/material simplification, textures resized to 256 px WebP, orientation/scale vertex-baked to real-world meters (Y-up, nose −X), origin centered. |
|
||||
| `b789.glb` | “Boeing 787-9” by [Nobilis 2](https://sketchfab.com/nobilishornet2) | [Sketchfab model](https://sketchfab.com/3d-models/boeing-787-9-b6711e2e698e4e469675c1154a50b7a3) | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) | Optimized for God's Eye View: geometry/material simplification, textures resized to 256 px WebP, orientation/scale vertex-baked to real-world meters (Y-up, nose −X), origin centered. |
|
||||
| `atr72.glb` | “ATR 72 - 600” by [Oyan3D](https://sketchfab.com/oyan3D) | [Sketchfab model](https://sketchfab.com/3d-models/atr-72-600-1e1a7186f7444d288675262fcee44744) | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) | Optimized for God's Eye View: geometry/material simplification, textures removed with dominant material colors baked into PBR factors (flat “abstracted” style), orientation/scale vertex-baked to real-world meters (Y-up, nose −X), origin centered. |
|
||||
| `iss.glb` | “International Space Station (ISS) (A)”, NASA | [NASA 3D Resources](https://github.com/nasa/NASA-3D-Resources/tree/master/3D%20Models/International%20Space%20Station%20(ISS)%20(A)) | NASA media: not subject to copyright in the United States ([NASA Images and Media Usage Guidelines](https://www.nasa.gov/nasa-brand-center/images-and-media)) | None: shipped as published (Draco-compressed, 40 KB). The app scales it to the real 109 m truss at runtime. Its use does not imply endorsement by NASA. |
|
||||
|
||||
CC BY 4.0 permits sharing and adaptation, including commercial use, provided
|
||||
appropriate credit is retained, the license is linked, and modifications are
|
||||
|
||||
Binary file not shown.
@@ -1790,6 +1790,8 @@
|
||||
"src/layers/satellites/index.js",
|
||||
"src/layers/satellites/ingestion.js",
|
||||
"src/layers/satellites/interaction.js",
|
||||
"src/layers/satellites/issModel.js",
|
||||
"src/layers/satellites/issLive.js",
|
||||
"src/layers/satellites/labels.js",
|
||||
"src/layers/satellites/lifecycle.js",
|
||||
"src/layers/satellites/orbits.js",
|
||||
@@ -2904,6 +2906,8 @@
|
||||
"src/layers/satellites/index.js",
|
||||
"src/layers/satellites/ingestion.js",
|
||||
"src/layers/satellites/interaction.js",
|
||||
"src/layers/satellites/issModel.js",
|
||||
"src/layers/satellites/issLive.js",
|
||||
"src/layers/satellites/labels.js",
|
||||
"src/layers/satellites/lifecycle.js",
|
||||
"src/layers/satellites/orbits.js",
|
||||
@@ -3941,6 +3945,8 @@
|
||||
"src/layers/satellites/index.js",
|
||||
"src/layers/satellites/ingestion.js",
|
||||
"src/layers/satellites/interaction.js",
|
||||
"src/layers/satellites/issModel.js",
|
||||
"src/layers/satellites/issLive.js",
|
||||
"src/layers/satellites/labels.js",
|
||||
"src/layers/satellites/lifecycle.js",
|
||||
"src/layers/satellites/orbits.js",
|
||||
|
||||
@@ -116,6 +116,7 @@ export function createApplicationCatalog({
|
||||
});
|
||||
const satellites = createApplicationSatellites({
|
||||
source: sources.satellites,
|
||||
...(resolveAsset ? { resolveAsset } : {}),
|
||||
});
|
||||
const catalog = createLayerCatalog(
|
||||
[
|
||||
|
||||
@@ -8,9 +8,14 @@ import * as render from '../../renderGovernor.js';
|
||||
import * as layerState from '../../data/layerState.js';
|
||||
|
||||
/** Construct one layer using the application scene owners and a supplied source. */
|
||||
export function createApplicationSatellites({ source }) {
|
||||
export function createApplicationSatellites({
|
||||
source,
|
||||
resolveAsset = (url) =>
|
||||
`${import.meta.env?.BASE_URL || '/'}${url.replace(/^\//, '')}`,
|
||||
}) {
|
||||
return createSatellitesLayer({
|
||||
source,
|
||||
resolveAsset,
|
||||
services: {
|
||||
picking,
|
||||
focus,
|
||||
|
||||
@@ -154,6 +154,18 @@ export const DATA_CREDITS = [
|
||||
'(<a href="https://celestrak.org" target="_blank" rel="noopener">celestrak.org</a>), ' +
|
||||
'Dr. T.S. Kelso',
|
||||
},
|
||||
{
|
||||
key: 'nasa-iss-model',
|
||||
html:
|
||||
'ISS model: ' +
|
||||
'<a href="https://github.com/nasa/NASA-3D-Resources" target="_blank" rel="noopener">NASA 3D Resources</a>',
|
||||
},
|
||||
{
|
||||
key: 'nasa-iss-live',
|
||||
html:
|
||||
'ISS live video: NASA, via ' +
|
||||
'<a href="https://www.youtube.com/watch?v=ROboUHfPUrU" target="_blank" rel="noopener">YouTube</a>',
|
||||
},
|
||||
{
|
||||
key: 'ucs-satellite-database',
|
||||
html:
|
||||
|
||||
@@ -3830,5 +3830,10 @@
|
||||
"{source} imagery could not be opened": "تعذّر فتح صور {source}",
|
||||
"{place} has no position to look for imagery at": "لا يوجد لـ{place} موضع للبحث عن الصور فيه",
|
||||
"No {source} imagery near {place}": "لا توجد صور {source} قرب {place}",
|
||||
"{reason} (filters on: {filters})": "{reason} (المرشحات المفعّلة: {filters})"
|
||||
"{reason} (filters on: {filters})": "{reason} (المرشحات المفعّلة: {filters})",
|
||||
"ISS live video": "بث مباشر من محطة الفضاء الدولية",
|
||||
"ISS LIVE · NASA": "محطة الفضاء الدولية مباشر · NASA",
|
||||
"Open on YouTube": "فتح على YouTube",
|
||||
"Close ISS live video": "إغلاق البث المباشر لمحطة الفضاء الدولية",
|
||||
"Live views from the International Space Station (NASA)": "مشاهد مباشرة من محطة الفضاء الدولية (NASA)"
|
||||
}
|
||||
@@ -3506,5 +3506,10 @@
|
||||
"{source} imagery could not be opened": "Bilder von {source} konnten nicht geöffnet werden",
|
||||
"{place} has no position to look for imagery at": "{place} hat keine Position, an der nach Bildern gesucht werden kann",
|
||||
"No {source} imagery near {place}": "Keine Bilder von {source} in der Nähe von {place}",
|
||||
"{reason} (filters on: {filters})": "{reason} (aktive Filter: {filters})"
|
||||
"{reason} (filters on: {filters})": "{reason} (aktive Filter: {filters})",
|
||||
"ISS live video": "ISS-Livevideo",
|
||||
"ISS LIVE · NASA": "ISS LIVE · NASA",
|
||||
"Open on YouTube": "Auf YouTube öffnen",
|
||||
"Close ISS live video": "ISS-Livevideo schließen",
|
||||
"Live views from the International Space Station (NASA)": "Livebilder von der Internationalen Raumstation (NASA)"
|
||||
}
|
||||
@@ -3587,5 +3587,10 @@
|
||||
"{source} imagery could not be opened": "No se pudieron abrir las imágenes de {source}",
|
||||
"{place} has no position to look for imagery at": "{place} no tiene una posición donde buscar imágenes",
|
||||
"No {source} imagery near {place}": "No hay imágenes de {source} cerca de {place}",
|
||||
"{reason} (filters on: {filters})": "{reason} (filtros activos: {filters})"
|
||||
"{reason} (filters on: {filters})": "{reason} (filtros activos: {filters})",
|
||||
"ISS live video": "Vídeo en directo de la ISS",
|
||||
"ISS LIVE · NASA": "ISS EN DIRECTO · NASA",
|
||||
"Open on YouTube": "Abrir en YouTube",
|
||||
"Close ISS live video": "Cerrar vídeo en directo de la ISS",
|
||||
"Live views from the International Space Station (NASA)": "Imágenes en directo de la Estación Espacial Internacional (NASA)"
|
||||
}
|
||||
@@ -3587,5 +3587,10 @@
|
||||
"{source} imagery could not be opened": "Impossible d'ouvrir les images de {source}",
|
||||
"{place} has no position to look for imagery at": "{place} n'a pas de position où chercher des images",
|
||||
"No {source} imagery near {place}": "Aucune image {source} près de {place}",
|
||||
"{reason} (filters on: {filters})": "{reason} (filtres actifs : {filters})"
|
||||
"{reason} (filters on: {filters})": "{reason} (filtres actifs : {filters})",
|
||||
"ISS live video": "Vidéo en direct de l’ISS",
|
||||
"ISS LIVE · NASA": "ISS EN DIRECT · NASA",
|
||||
"Open on YouTube": "Ouvrir sur YouTube",
|
||||
"Close ISS live video": "Fermer la vidéo en direct de l’ISS",
|
||||
"Live views from the International Space Station (NASA)": "Images en direct de la Station spatiale internationale (NASA)"
|
||||
}
|
||||
@@ -3587,5 +3587,10 @@
|
||||
"{source} imagery could not be opened": "לא ניתן היה לפתוח את הצילומים של {source}",
|
||||
"{place} has no position to look for imagery at": "ל-{place} אין מיקום לחיפוש צילומים",
|
||||
"No {source} imagery near {place}": "אין צילומים של {source} ליד {place}",
|
||||
"{reason} (filters on: {filters})": "{reason} (מסננים פעילים: {filters})"
|
||||
"{reason} (filters on: {filters})": "{reason} (מסננים פעילים: {filters})",
|
||||
"ISS live video": "שידור חי מתחנת החלל",
|
||||
"ISS LIVE · NASA": "ISS בשידור חי · NASA",
|
||||
"Open on YouTube": "פתיחה ב-YouTube",
|
||||
"Close ISS live video": "סגירת השידור החי מתחנת החלל",
|
||||
"Live views from the International Space Station (NASA)": "צילומים חיים מתחנת החלל הבינלאומית (NASA)"
|
||||
}
|
||||
@@ -3587,5 +3587,10 @@
|
||||
"{source} imagery could not be opened": "Impossibile aprire le immagini di {source}",
|
||||
"{place} has no position to look for imagery at": "{place} non ha una posizione in cui cercare immagini",
|
||||
"No {source} imagery near {place}": "Nessuna immagine di {source} vicino a {place}",
|
||||
"{reason} (filters on: {filters})": "{reason} (filtri attivi: {filters})"
|
||||
"{reason} (filters on: {filters})": "{reason} (filtri attivi: {filters})",
|
||||
"ISS live video": "Video in diretta dalla ISS",
|
||||
"ISS LIVE · NASA": "ISS IN DIRETTA · NASA",
|
||||
"Open on YouTube": "Apri su YouTube",
|
||||
"Close ISS live video": "Chiudi il video in diretta della ISS",
|
||||
"Live views from the International Space Station (NASA)": "Immagini in diretta dalla Stazione Spaziale Internazionale (NASA)"
|
||||
}
|
||||
@@ -3425,5 +3425,10 @@
|
||||
"{source} imagery could not be opened": "{source}の画像を開けませんでした",
|
||||
"{place} has no position to look for imagery at": "{place}には画像を探す位置がありません",
|
||||
"No {source} imagery near {place}": "{place}の近くに{source}の画像はありません",
|
||||
"{reason} (filters on: {filters})": "{reason}(有効なフィルター: {filters})"
|
||||
"{reason} (filters on: {filters})": "{reason}(有効なフィルター: {filters})",
|
||||
"ISS live video": "ISSのライブ映像",
|
||||
"ISS LIVE · NASA": "ISS ライブ · NASA",
|
||||
"Open on YouTube": "YouTubeで開く",
|
||||
"Close ISS live video": "ISSのライブ映像を閉じる",
|
||||
"Live views from the International Space Station (NASA)": "国際宇宙ステーションからのライブ映像(NASA)"
|
||||
}
|
||||
@@ -3587,5 +3587,10 @@
|
||||
"{source} imagery could not be opened": "Não foi possível abrir as imagens de {source}",
|
||||
"{place} has no position to look for imagery at": "{place} não tem uma posição para buscar imagens",
|
||||
"No {source} imagery near {place}": "Nenhuma imagem de {source} perto de {place}",
|
||||
"{reason} (filters on: {filters})": "{reason} (filtros ativos: {filters})"
|
||||
"{reason} (filters on: {filters})": "{reason} (filtros ativos: {filters})",
|
||||
"ISS live video": "Vídeo ao vivo da ISS",
|
||||
"ISS LIVE · NASA": "ISS AO VIVO · NASA",
|
||||
"Open on YouTube": "Abrir no YouTube",
|
||||
"Close ISS live video": "Fechar vídeo ao vivo da ISS",
|
||||
"Live views from the International Space Station (NASA)": "Imagens ao vivo da Estação Espacial Internacional (NASA)"
|
||||
}
|
||||
@@ -3668,5 +3668,10 @@
|
||||
"{source} imagery could not be opened": "Не удалось открыть снимки {source}",
|
||||
"{place} has no position to look for imagery at": "У места «{place}» нет координат для поиска снимков",
|
||||
"No {source} imagery near {place}": "Нет снимков {source} рядом с {place}",
|
||||
"{reason} (filters on: {filters})": "{reason} (включены фильтры: {filters})"
|
||||
"{reason} (filters on: {filters})": "{reason} (включены фильтры: {filters})",
|
||||
"ISS live video": "Прямая трансляция с МКС",
|
||||
"ISS LIVE · NASA": "МКС В ЭФИРЕ · NASA",
|
||||
"Open on YouTube": "Открыть на YouTube",
|
||||
"Close ISS live video": "Закрыть трансляцию с МКС",
|
||||
"Live views from the International Space Station (NASA)": "Прямая трансляция с Международной космической станции (NASA)"
|
||||
}
|
||||
@@ -3506,5 +3506,10 @@
|
||||
"Play speed": "Uppspelningshastighet",
|
||||
"Scroll or pinch to zoom, drag to move along · double-click to see it all": "Scrolla eller nyp för att zooma, dra för att flytta · dubbelklicka för att se allt",
|
||||
"Live": "Live",
|
||||
"Back to live": "Tillbaka till live"
|
||||
"Back to live": "Tillbaka till live",
|
||||
"ISS live video": "Livevideo från ISS",
|
||||
"ISS LIVE · NASA": "ISS LIVE · NASA",
|
||||
"Open on YouTube": "Öppna på YouTube",
|
||||
"Close ISS live video": "Stäng livevideon från ISS",
|
||||
"Live views from the International Space Station (NASA)": "Livebilder från Internationella rymdstationen (NASA)"
|
||||
}
|
||||
@@ -3668,5 +3668,10 @@
|
||||
"{source} imagery could not be opened": "Не вдалося відкрити знімки {source}",
|
||||
"{place} has no position to look for imagery at": "Для місця «{place}» немає координат для пошуку знімків",
|
||||
"No {source} imagery near {place}": "Немає знімків {source} поблизу {place}",
|
||||
"{reason} (filters on: {filters})": "{reason} (увімкнено фільтри: {filters})"
|
||||
"{reason} (filters on: {filters})": "{reason} (увімкнено фільтри: {filters})",
|
||||
"ISS live video": "Пряма трансляція з МКС",
|
||||
"ISS LIVE · NASA": "МКС НАЖИВО · NASA",
|
||||
"Open on YouTube": "Відкрити на YouTube",
|
||||
"Close ISS live video": "Закрити трансляцію з МКС",
|
||||
"Live views from the International Space Station (NASA)": "Пряма трансляція з Міжнародної космічної станції (NASA)"
|
||||
}
|
||||
@@ -3425,5 +3425,10 @@
|
||||
"{source} imagery could not be opened": "无法打开 {source} 影像",
|
||||
"{place} has no position to look for imagery at": "{place} 没有可查找影像的位置",
|
||||
"No {source} imagery near {place}": "{place} 附近没有 {source} 影像",
|
||||
"{reason} (filters on: {filters})": "{reason}(已开启筛选:{filters})"
|
||||
"{reason} (filters on: {filters})": "{reason}(已开启筛选:{filters})",
|
||||
"ISS live video": "国际空间站直播视频",
|
||||
"ISS LIVE · NASA": "国际空间站直播 · NASA",
|
||||
"Open on YouTube": "在 YouTube 上打开",
|
||||
"Close ISS live video": "关闭国际空间站直播视频",
|
||||
"Live views from the International Space Station (NASA)": "国际空间站实时画面(NASA)"
|
||||
}
|
||||
@@ -3425,5 +3425,10 @@
|
||||
"{source} imagery could not be opened": "無法打開 {source} 影像",
|
||||
"{place} has no position to look for imagery at": "{place} 沒有可查找影像的位置",
|
||||
"No {source} imagery near {place}": "{place} 附近沒有 {source} 影像",
|
||||
"{reason} (filters on: {filters})": "{reason}(已開啟篩選:{filters})"
|
||||
"{reason} (filters on: {filters})": "{reason}(已開啟篩選:{filters})",
|
||||
"ISS live video": "國際太空站直播影片",
|
||||
"ISS LIVE · NASA": "國際太空站直播 · NASA",
|
||||
"Open on YouTube": "在 YouTube 上開啟",
|
||||
"Close ISS live video": "關閉國際太空站直播影片",
|
||||
"Live views from the International Space Station (NASA)": "國際太空站即時畫面(NASA)"
|
||||
}
|
||||
@@ -244,7 +244,8 @@
|
||||
"▲ {frp} MW",
|
||||
"ICAO: {id}",
|
||||
"MMSI: {id}",
|
||||
"NORAD: {id}"
|
||||
"NORAD: {id}",
|
||||
"ISS LIVE · NASA"
|
||||
],
|
||||
"es": [
|
||||
"1 min/s",
|
||||
@@ -1245,7 +1246,8 @@
|
||||
"Period",
|
||||
"ICAO: {id}",
|
||||
"NORAD: {id}",
|
||||
"MMSI: {id}"
|
||||
"MMSI: {id}",
|
||||
"ISS LIVE · NASA"
|
||||
],
|
||||
"uk": [
|
||||
"1900–1945",
|
||||
|
||||
@@ -7,13 +7,19 @@ import { createRendering } from './rendering.js';
|
||||
import { createTracking } from './tracking.js';
|
||||
import { createTesting } from './testing.js';
|
||||
import { createInteraction } from './interaction.js';
|
||||
import { createIssLive } from './issLive.js';
|
||||
import { createIssModel } from './issModel.js';
|
||||
import { createLifecycle } from './lifecycle.js';
|
||||
import { createIngestion } from './ingestion.js';
|
||||
import { createRecords } from './records.js';
|
||||
import { createState } from './state.js';
|
||||
|
||||
/** Construct one layer with its own scene state and supplied application services. */
|
||||
export function createSatellitesLayer({ services, source }) {
|
||||
export function createSatellitesLayer({
|
||||
services,
|
||||
source,
|
||||
resolveAsset = (url) => url,
|
||||
}) {
|
||||
if (typeof source?.readGroup !== 'function')
|
||||
throw new TypeError('A satellites source is required');
|
||||
const state = createState({ services });
|
||||
@@ -25,6 +31,8 @@ export function createSatellitesLayer({ services, source }) {
|
||||
parts.orbits = createOrbits(context);
|
||||
parts.records = createRecords(context);
|
||||
parts.rendering = createRendering(context);
|
||||
parts.issModel = createIssModel({ ...context, resolveAsset });
|
||||
parts.issLive = createIssLive(context);
|
||||
parts.tracking = createTracking(context);
|
||||
parts.testing = createTesting(context);
|
||||
parts.interaction = createInteraction(context);
|
||||
|
||||
@@ -65,6 +65,8 @@ export function createInteraction({
|
||||
const prim = picked.primitive;
|
||||
if (prim && prim.id != null) {
|
||||
const noradId = Number(prim.id);
|
||||
// A click on the tracked ISS's own model: it is already tracked.
|
||||
if (noradId === layerState._trackedNorad) return;
|
||||
if (!isNaN(noradId) && layerState._catalog.has(noradId)) {
|
||||
parts.tracking._cancelPendingTrackingRestore();
|
||||
parts.tracking._trackSatellite(noradId, { origin: 'user' });
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { ISS_LIVE_VIDEO_ID, ISS_NORAD } from './policy.js';
|
||||
|
||||
/**
|
||||
* The player address for a YouTube video: the privacy-enhanced host the
|
||||
* page's frame-src allows, muted so the browser lets it start on its own.
|
||||
* @param {string} videoId
|
||||
* @returns {string}
|
||||
*/
|
||||
export function issLiveEmbedUrl(videoId) {
|
||||
const params = new URLSearchParams({
|
||||
autoplay: '1',
|
||||
mute: '1',
|
||||
playsinline: '1',
|
||||
rel: '0',
|
||||
});
|
||||
return `https://www.youtube-nocookie.com/embed/${encodeURIComponent(videoId)}?${params}`;
|
||||
}
|
||||
|
||||
/** The video's own page, for the "Open on YouTube" link. */
|
||||
export function issLiveWatchUrl(videoId) {
|
||||
return `https://www.youtube.com/watch?v=${encodeURIComponent(videoId)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the live panel shows: the ISS selected (tracked), the layer on, the
|
||||
* Cockpit not riding it, and the viewer not having closed it for this pick.
|
||||
* @param {{enabled: boolean, trackedNorad: number|null, cockpitHeld: boolean,
|
||||
* dismissed: boolean}} input
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function issLiveShouldShow({
|
||||
enabled,
|
||||
trackedNorad,
|
||||
cockpitHeld,
|
||||
dismissed,
|
||||
}) {
|
||||
return (
|
||||
Boolean(enabled) && trackedNorad === ISS_NORAD && !cockpitHeld && !dismissed
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* NASA's live view from the ISS, in a panel beside the existing tracked card
|
||||
* while the ISS is selected. The player is created on show and removed on
|
||||
* hide, so nothing streams while the panel is closed.
|
||||
*/
|
||||
export function createIssLive({ state: layerState, parts }) {
|
||||
let panel = null;
|
||||
let dismissed = false;
|
||||
let lastTracked = null;
|
||||
|
||||
function _build(documentRef) {
|
||||
const root = documentRef.createElement('section');
|
||||
root.className = 'iss-live-panel';
|
||||
root.setAttribute('role', 'region');
|
||||
root.setAttribute('aria-label', t('ISS live video'));
|
||||
|
||||
const header = documentRef.createElement('header');
|
||||
header.className = 'iss-live-header';
|
||||
const title = documentRef.createElement('span');
|
||||
title.className = 'iss-live-title';
|
||||
const dotMark = documentRef.createElement('span');
|
||||
dotMark.className = 'iss-live-dot';
|
||||
dotMark.setAttribute('aria-hidden', 'true');
|
||||
title.append(dotMark, documentRef.createTextNode(t('ISS LIVE · NASA')));
|
||||
const link = documentRef.createElement('a');
|
||||
link.className = 'iss-live-link';
|
||||
link.href = issLiveWatchUrl(ISS_LIVE_VIDEO_ID);
|
||||
link.target = '_blank';
|
||||
link.rel = 'noopener noreferrer';
|
||||
link.textContent = t('Open on YouTube');
|
||||
const close = documentRef.createElement('button');
|
||||
close.type = 'button';
|
||||
close.className = 'iss-live-close';
|
||||
close.textContent = '×';
|
||||
close.title = t('Close ISS live video');
|
||||
close.setAttribute('aria-label', t('Close ISS live video'));
|
||||
close.addEventListener('click', () => {
|
||||
dismissed = true;
|
||||
_syncIssLive();
|
||||
});
|
||||
header.append(title, link, close);
|
||||
|
||||
const frame = documentRef.createElement('div');
|
||||
frame.className = 'iss-live-frame';
|
||||
const iframe = documentRef.createElement('iframe');
|
||||
iframe.src = issLiveEmbedUrl(ISS_LIVE_VIDEO_ID);
|
||||
iframe.title = t('Live views from the International Space Station (NASA)');
|
||||
iframe.allow = 'autoplay; encrypted-media; picture-in-picture; fullscreen';
|
||||
iframe.allowFullscreen = true;
|
||||
iframe.referrerPolicy = 'strict-origin-when-cross-origin';
|
||||
iframe.loading = 'eager';
|
||||
frame.append(iframe);
|
||||
|
||||
root.append(header, frame);
|
||||
return root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show or hide the panel for the current selection. Cheap when nothing
|
||||
* changed, so the tracking and Cockpit paths can call it freely.
|
||||
* @returns {void}
|
||||
*/
|
||||
function _syncIssLive() {
|
||||
const tracked = layerState._trackedNorad;
|
||||
// A new pick of the ISS brings back a panel closed on an earlier one.
|
||||
if (tracked !== lastTracked) {
|
||||
dismissed = false;
|
||||
lastTracked = tracked;
|
||||
}
|
||||
const show = issLiveShouldShow({
|
||||
enabled: layerState._enabled,
|
||||
trackedNorad: tracked,
|
||||
cockpitHeld: Boolean(parts.cockpit?._cockpitHeld()),
|
||||
dismissed,
|
||||
});
|
||||
if (!show) {
|
||||
_removePanel();
|
||||
return;
|
||||
}
|
||||
if (panel) return;
|
||||
const documentRef = globalThis.document;
|
||||
if (!documentRef?.body) return;
|
||||
panel = _build(documentRef);
|
||||
documentRef.body.append(panel);
|
||||
}
|
||||
|
||||
function _removePanel() {
|
||||
if (!panel) return;
|
||||
panel.remove(); // the player goes with it, so the stream stops
|
||||
panel = null;
|
||||
}
|
||||
|
||||
/** Drop the panel and forget the selection (layer destroy). */
|
||||
function _destroyIssLive() {
|
||||
_removePanel();
|
||||
dismissed = false;
|
||||
lastTracked = null;
|
||||
}
|
||||
|
||||
return { _syncIssLive, _destroyIssLive };
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { eciToGeodetic, gstime, propagate } from 'satellite.js';
|
||||
import {
|
||||
ISS_MODEL_MAX_DISTANCE_M,
|
||||
ISS_MODEL_MIN_PX,
|
||||
ISS_MODEL_NATIVE_SPAN,
|
||||
ISS_MODEL_URL,
|
||||
ISS_NORAD,
|
||||
ISS_SPAN_M,
|
||||
} from './policy.js';
|
||||
|
||||
/** The model's scale for the real 109 m truss. */
|
||||
export const ISS_MODEL_SCALE = ISS_SPAN_M / ISS_MODEL_NATIVE_SPAN;
|
||||
|
||||
/**
|
||||
* Whether the ISS model may be drawn: the dot's own rules (layer on, points
|
||||
* on, the ISS loaded and its class shown or the ISS tracked), and not while
|
||||
* the Cockpit rides the ISS or hides it as a docked companion.
|
||||
* @param {{enabled: boolean, showPoints: boolean, hasIss: boolean,
|
||||
* classVisible: boolean, tracked: boolean, cockpitHidden: boolean}} input
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function issModelShouldShow({
|
||||
enabled,
|
||||
showPoints,
|
||||
hasIss,
|
||||
classVisible,
|
||||
tracked,
|
||||
cockpitHidden,
|
||||
}) {
|
||||
return (
|
||||
Boolean(enabled) &&
|
||||
Boolean(showPoints) &&
|
||||
Boolean(hasIss) &&
|
||||
(Boolean(classVisible) || Boolean(tracked)) &&
|
||||
!cockpitHidden
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The station's flight axes in the Earth-fixed frame, from one SGP4 state:
|
||||
* the ISS normally flies "+XVV", its modules along the velocity, the truss
|
||||
* across the orbit plane, the same side always to the Earth. Returned as the
|
||||
* model's local axes: x along-track, y the orbit normal (along the truss), z
|
||||
* zenith (away from the Earth's centre).
|
||||
* @param {{x:number,y:number,z:number}} positionEcef Earth-fixed position.
|
||||
* @param {{x:number,y:number,z:number}} velocityEcefAxes Inertial velocity,
|
||||
* turned onto the Earth-fixed axes (direction only matters).
|
||||
* @returns {{x:number[], y:number[], z:number[]}|null} Unit vectors, or null
|
||||
* for a degenerate state (zero position or velocity along it).
|
||||
*/
|
||||
export function issFlightAxes(positionEcef, velocityEcefAxes) {
|
||||
const r = [positionEcef.x, positionEcef.y, positionEcef.z];
|
||||
const v = [velocityEcefAxes.x, velocityEcefAxes.y, velocityEcefAxes.z];
|
||||
const z = unit(r);
|
||||
const y = unit(cross(r, v));
|
||||
if (!z || !y) return null;
|
||||
const x = cross(y, z);
|
||||
return { x, y, z };
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn an inertial (TEME) vector onto the Earth-fixed axes at `gmst`: the same
|
||||
* rotation `eciToGeodetic` applies to the position.
|
||||
* @param {{x:number,y:number,z:number}} v
|
||||
* @param {number} gmst Radians.
|
||||
* @returns {{x:number,y:number,z:number}}
|
||||
*/
|
||||
export function temeToEcefAxes(v, gmst) {
|
||||
const c = Math.cos(gmst);
|
||||
const s = Math.sin(gmst);
|
||||
return { x: c * v.x + s * v.y, y: -s * v.x + c * v.y, z: v.z };
|
||||
}
|
||||
|
||||
function cross(a, b) {
|
||||
return [
|
||||
a[1] * b[2] - a[2] * b[1],
|
||||
a[2] * b[0] - a[0] * b[2],
|
||||
a[0] * b[1] - a[1] * b[0],
|
||||
];
|
||||
}
|
||||
|
||||
function unit(a) {
|
||||
const n = Math.hypot(a[0], a[1], a[2]);
|
||||
if (!(n > 0)) return null;
|
||||
return [a[0] / n, a[1] / n, a[2] / n];
|
||||
}
|
||||
|
||||
/**
|
||||
* The ISS as a 3D model when the camera is close. Far out the dot stays: the
|
||||
* model and the dot (ambient and tracked) split the distance range, so exactly
|
||||
* one of them draws. The model loads on first need and only if the ISS is
|
||||
* shown, and positions itself every frame from its own SGP4 sample (the dot
|
||||
* moves once a second, which at model range would show as a jump).
|
||||
*/
|
||||
export function createIssModel({ state: layerState, parts, resolveAsset }) {
|
||||
let model = null;
|
||||
let loading = false;
|
||||
let failed = false;
|
||||
let generation = 0;
|
||||
const nearCondition = new Cesium.DistanceDisplayCondition(
|
||||
0,
|
||||
ISS_MODEL_MAX_DISTANCE_M,
|
||||
);
|
||||
const farCondition = new Cesium.DistanceDisplayCondition(
|
||||
ISS_MODEL_MAX_DISTANCE_M,
|
||||
Number.MAX_VALUE,
|
||||
);
|
||||
const scratchPosition = new Cesium.Cartesian3();
|
||||
const scratchRotation = new Cesium.Matrix3();
|
||||
const scratchColumn = new Cesium.Cartesian3();
|
||||
|
||||
function _shouldShow() {
|
||||
const tracked = layerState._trackedNorad === ISS_NORAD;
|
||||
return issModelShouldShow({
|
||||
enabled: layerState._enabled,
|
||||
showPoints: layerState._params.showPoints,
|
||||
hasIss: layerState._catalog.has(ISS_NORAD),
|
||||
classVisible: parts.controls._classVisible(ISS_NORAD),
|
||||
tracked,
|
||||
cockpitHidden:
|
||||
(tracked && parts.cockpit?._cockpitHeld()) ||
|
||||
layerState._cockpitHiddenPoints?.has(ISS_NORAD),
|
||||
});
|
||||
}
|
||||
|
||||
async function _load() {
|
||||
loading = true;
|
||||
const loadGeneration = generation;
|
||||
try {
|
||||
const loaded = await Cesium.Model.fromGltfAsync({
|
||||
url: resolveAsset(ISS_MODEL_URL),
|
||||
scale: ISS_MODEL_SCALE,
|
||||
minimumPixelSize: ISS_MODEL_MIN_PX,
|
||||
distanceDisplayCondition: nearCondition,
|
||||
// So a click on the model tracks the ISS, as a click on its dot does.
|
||||
id: ISS_NORAD,
|
||||
show: false,
|
||||
});
|
||||
const viewer = layerState._viewer;
|
||||
if (loadGeneration !== generation || !viewer) {
|
||||
loaded.destroy();
|
||||
return;
|
||||
}
|
||||
viewer.scene.primitives.add(loaded);
|
||||
model = loaded;
|
||||
} catch (error) {
|
||||
// The dot keeps drawing at every distance; nothing else depends on this.
|
||||
failed = true;
|
||||
console.warn('[Data:Satellites] ISS model failed to load:', error);
|
||||
} finally {
|
||||
if (loadGeneration === generation) loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Leave the near range to the model: the dots draw only beyond it. */
|
||||
function _handOverDots() {
|
||||
const point = layerState._points.get(ISS_NORAD);
|
||||
if (point && point.distanceDisplayCondition !== farCondition)
|
||||
point.distanceDisplayCondition = farCondition;
|
||||
const dot =
|
||||
layerState._trackedNorad === ISS_NORAD
|
||||
? layerState._trackedEntity?.point
|
||||
: null;
|
||||
if (dot && !dot.distanceDisplayCondition)
|
||||
dot.distanceDisplayCondition = farCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-frame update from the layer's preRender tick.
|
||||
* @returns {void}
|
||||
*/
|
||||
function _updateIssModel() {
|
||||
const show = _shouldShow();
|
||||
if (!show) {
|
||||
if (model) model.show = false;
|
||||
return;
|
||||
}
|
||||
if (!model) {
|
||||
if (!loading && !failed && resolveAsset) _load();
|
||||
return;
|
||||
}
|
||||
_handOverDots();
|
||||
|
||||
const point = layerState._points.get(ISS_NORAD);
|
||||
const camera = layerState._viewer?.camera;
|
||||
// Out of range the model would not draw anyway: skip the SGP4 sample.
|
||||
if (
|
||||
point?.position &&
|
||||
camera &&
|
||||
Cesium.Cartesian3.distance(camera.positionWC, point.position) >
|
||||
ISS_MODEL_MAX_DISTANCE_M * 1.5
|
||||
) {
|
||||
model.show = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const sat = layerState._catalog.get(ISS_NORAD);
|
||||
const trackedSample =
|
||||
layerState._trackedNorad === ISS_NORAD &&
|
||||
Number.isFinite(layerState._trackedFrameGeo?.atMs)
|
||||
? layerState._trackedFrameGeo
|
||||
: null;
|
||||
const date = new Date(
|
||||
trackedSample ? trackedSample.atMs : layerState.now(),
|
||||
);
|
||||
let posVel;
|
||||
try {
|
||||
posVel = propagate(sat.satrec, date);
|
||||
} catch {
|
||||
posVel = null;
|
||||
}
|
||||
if (
|
||||
!posVel?.position ||
|
||||
typeof posVel.position === 'boolean' ||
|
||||
!posVel.velocity ||
|
||||
typeof posVel.velocity === 'boolean'
|
||||
) {
|
||||
model.show = false;
|
||||
return;
|
||||
}
|
||||
const gmst = gstime(date);
|
||||
if (trackedSample) {
|
||||
// The sample the follow camera and the tracked dot were placed from.
|
||||
Cesium.Cartesian3.clone(
|
||||
layerState._trackedFrameCartesian,
|
||||
scratchPosition,
|
||||
);
|
||||
} else {
|
||||
const geo = eciToGeodetic(posVel.position, gmst);
|
||||
Cesium.Cartesian3.fromRadians(
|
||||
geo.longitude,
|
||||
geo.latitude,
|
||||
geo.height * 1000,
|
||||
undefined,
|
||||
scratchPosition,
|
||||
);
|
||||
}
|
||||
const axes = issFlightAxes(
|
||||
scratchPosition,
|
||||
temeToEcefAxes(posVel.velocity, gmst),
|
||||
);
|
||||
if (!axes) {
|
||||
model.show = false;
|
||||
return;
|
||||
}
|
||||
['x', 'y', 'z'].forEach((key, column) => {
|
||||
scratchColumn.x = axes[key][0];
|
||||
scratchColumn.y = axes[key][1];
|
||||
scratchColumn.z = axes[key][2];
|
||||
Cesium.Matrix3.setColumn(
|
||||
scratchRotation,
|
||||
column,
|
||||
scratchColumn,
|
||||
scratchRotation,
|
||||
);
|
||||
});
|
||||
Cesium.Matrix4.fromRotationTranslation(
|
||||
scratchRotation,
|
||||
scratchPosition,
|
||||
model.modelMatrix,
|
||||
);
|
||||
model.show = true;
|
||||
}
|
||||
|
||||
/** Drop the model (destroy or a fresh init); the next need reloads it. */
|
||||
function _destroyIssModel() {
|
||||
generation += 1;
|
||||
loading = false;
|
||||
failed = false;
|
||||
if (model) {
|
||||
const scene = layerState._viewer?.scene;
|
||||
if (scene && scene.primitives.contains(model))
|
||||
scene.primitives.remove(model); // remove() destroys
|
||||
else if (!model.isDestroyed()) model.destroy();
|
||||
model = null;
|
||||
}
|
||||
}
|
||||
|
||||
return { _updateIssModel, _destroyIssModel };
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { gstime, propagate, twoline2satrec } from 'satellite.js';
|
||||
import {
|
||||
ISS_MODEL_SCALE,
|
||||
issFlightAxes,
|
||||
issModelShouldShow,
|
||||
temeToEcefAxes,
|
||||
} from './issModel.js';
|
||||
import {
|
||||
ISS_MODEL_NATIVE_SPAN,
|
||||
ISS_MODEL_URL,
|
||||
ISS_NORAD,
|
||||
ISS_SPAN_M,
|
||||
} from './policy.js';
|
||||
|
||||
const ISS_TLE = [
|
||||
'1 25544U 98067A 24001.50000000 .00016717 00000-0 10270-3 0 9002',
|
||||
'2 25544 51.6416 247.4627 0006703 130.5360 325.0288 15.50377579 1234',
|
||||
];
|
||||
|
||||
const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
||||
const norm = (a) => Math.hypot(a[0], a[1], a[2]);
|
||||
|
||||
const shown = {
|
||||
enabled: true,
|
||||
showPoints: true,
|
||||
hasIss: true,
|
||||
classVisible: true,
|
||||
tracked: false,
|
||||
cockpitHidden: false,
|
||||
};
|
||||
|
||||
test('the ISS model shows on the same terms as its dot', () => {
|
||||
assert.equal(issModelShouldShow(shown), true);
|
||||
assert.equal(issModelShouldShow({ ...shown, enabled: false }), false);
|
||||
assert.equal(issModelShouldShow({ ...shown, showPoints: false }), false);
|
||||
assert.equal(issModelShouldShow({ ...shown, hasIss: false }), false);
|
||||
assert.equal(issModelShouldShow({ ...shown, classVisible: false }), false);
|
||||
});
|
||||
|
||||
test('a tracked ISS keeps its model with its class hidden', () => {
|
||||
assert.equal(
|
||||
issModelShouldShow({ ...shown, classVisible: false, tracked: true }),
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test('the Cockpit hold hides the model', () => {
|
||||
assert.equal(
|
||||
issModelShouldShow({ ...shown, tracked: true, cockpitHidden: true }),
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
test('the model is the ISS by NORAD number, at its real 109 m span', () => {
|
||||
assert.equal(ISS_NORAD, 25544);
|
||||
assert.ok(
|
||||
Math.abs(ISS_MODEL_SCALE * ISS_MODEL_NATIVE_SPAN - ISS_SPAN_M) < 1e-9,
|
||||
);
|
||||
});
|
||||
|
||||
test('the native span matches the shipped asset', () => {
|
||||
const glb = readFileSync(
|
||||
new URL(`../../../public${ISS_MODEL_URL}`, import.meta.url),
|
||||
);
|
||||
const jsonLength = glb.readUInt32LE(12);
|
||||
const gltf = JSON.parse(glb.subarray(20, 20 + jsonLength).toString('utf8'));
|
||||
let minX = Infinity;
|
||||
let maxX = -Infinity;
|
||||
for (const node of gltf.nodes.filter((n) => n.mesh !== undefined)) {
|
||||
for (const primitive of gltf.meshes[node.mesh].primitives) {
|
||||
const accessor = gltf.accessors[primitive.attributes.POSITION];
|
||||
minX = Math.min(minX, accessor.min[0] * (node.scale?.[0] ?? 1));
|
||||
maxX = Math.max(maxX, accessor.max[0] * (node.scale?.[0] ?? 1));
|
||||
}
|
||||
}
|
||||
assert.ok(Math.abs(maxX - minX - ISS_MODEL_NATIVE_SPAN) < 0.01);
|
||||
});
|
||||
|
||||
test('flight axes: orthonormal, z away from the Earth, x along the motion', () => {
|
||||
const satrec = twoline2satrec(ISS_TLE[0], ISS_TLE[1]);
|
||||
for (const minutes of [0, 17, 46, 80]) {
|
||||
const date = new Date(Date.UTC(2024, 0, 1, 12, minutes));
|
||||
const { position, velocity } = propagate(satrec, date);
|
||||
const gmst = gstime(date);
|
||||
const r = temeToEcefAxes(position, gmst);
|
||||
const v = temeToEcefAxes(velocity, gmst);
|
||||
const axes = issFlightAxes(r, v);
|
||||
for (const key of ['x', 'y', 'z'])
|
||||
assert.ok(Math.abs(norm(axes[key]) - 1) < 1e-9);
|
||||
assert.ok(Math.abs(dot(axes.x, axes.y)) < 1e-9);
|
||||
assert.ok(Math.abs(dot(axes.y, axes.z)) < 1e-9);
|
||||
assert.ok(Math.abs(dot(axes.x, axes.z)) < 1e-9);
|
||||
const rUnit = [r.x, r.y, r.z].map((c) => c / norm([r.x, r.y, r.z]));
|
||||
assert.ok(dot(axes.z, rUnit) > 0.999999);
|
||||
// A near-circular orbit: the along-track axis is almost the velocity.
|
||||
const vUnit = [v.x, v.y, v.z].map((c) => c / norm([v.x, v.y, v.z]));
|
||||
assert.ok(dot(axes.x, vUnit) > 0.999);
|
||||
// Right-handed: x × y = z.
|
||||
const cross = [
|
||||
axes.x[1] * axes.y[2] - axes.x[2] * axes.y[1],
|
||||
axes.x[2] * axes.y[0] - axes.x[0] * axes.y[2],
|
||||
axes.x[0] * axes.y[1] - axes.x[1] * axes.y[0],
|
||||
];
|
||||
assert.ok(dot(cross, axes.z) > 0.999999);
|
||||
}
|
||||
});
|
||||
|
||||
test('flight axes refuse a degenerate state', () => {
|
||||
assert.equal(issFlightAxes({ x: 0, y: 0, z: 0 }, { x: 1, y: 0, z: 0 }), null);
|
||||
assert.equal(issFlightAxes({ x: 1, y: 0, z: 0 }, { x: 2, y: 0, z: 0 }), null);
|
||||
});
|
||||
|
||||
test('TEME to Earth-fixed axes keeps the position eciToGeodetic uses', () => {
|
||||
const v = temeToEcefAxes({ x: 1, y: 0, z: 0 }, Math.PI / 2);
|
||||
assert.ok(Math.abs(v.x) < 1e-12);
|
||||
assert.ok(Math.abs(v.y + 1) < 1e-12);
|
||||
});
|
||||
|
||||
test('the ISS live panel follows the ISS selection', async () => {
|
||||
const { issLiveShouldShow } = await import('./issLive.js');
|
||||
const base = {
|
||||
enabled: true,
|
||||
trackedNorad: ISS_NORAD,
|
||||
cockpitHeld: false,
|
||||
dismissed: false,
|
||||
};
|
||||
assert.equal(issLiveShouldShow(base), true);
|
||||
assert.equal(issLiveShouldShow({ ...base, trackedNorad: 48274 }), false);
|
||||
assert.equal(issLiveShouldShow({ ...base, trackedNorad: null }), false);
|
||||
assert.equal(issLiveShouldShow({ ...base, enabled: false }), false);
|
||||
assert.equal(issLiveShouldShow({ ...base, cockpitHeld: true }), false);
|
||||
assert.equal(issLiveShouldShow({ ...base, dismissed: true }), false);
|
||||
});
|
||||
|
||||
test("the ISS live player is NASA's stream on the privacy-enhanced host", async () => {
|
||||
const { issLiveEmbedUrl, issLiveWatchUrl } = await import('./issLive.js');
|
||||
const { ISS_LIVE_VIDEO_ID } = await import('./policy.js');
|
||||
const embed = new URL(issLiveEmbedUrl(ISS_LIVE_VIDEO_ID));
|
||||
assert.equal(embed.origin, 'https://www.youtube-nocookie.com');
|
||||
assert.equal(embed.pathname, `/embed/${ISS_LIVE_VIDEO_ID}`);
|
||||
// Muted, or the browser will not start it on its own.
|
||||
assert.equal(embed.searchParams.get('mute'), '1');
|
||||
assert.equal(embed.searchParams.get('autoplay'), '1');
|
||||
assert.equal(
|
||||
issLiveWatchUrl(ISS_LIVE_VIDEO_ID),
|
||||
`https://www.youtube.com/watch?v=${ISS_LIVE_VIDEO_ID}`,
|
||||
);
|
||||
});
|
||||
@@ -36,6 +36,7 @@ export function createLifecycle({
|
||||
async init(viewer) {
|
||||
parts.catalog._abortActiveUpdates();
|
||||
clearFocusTarget('satellites');
|
||||
parts.issModel?._destroyIssModel();
|
||||
layerState._viewer = viewer;
|
||||
layerState._catalog = new Map();
|
||||
layerState._points = new Map();
|
||||
@@ -130,7 +131,9 @@ export function createLifecycle({
|
||||
if (layerState._pointCollection) layerState._pointCollection.show = false;
|
||||
for (const path of layerState._orbitPaths.values())
|
||||
path.primitive.show = false;
|
||||
parts.issModel?._updateIssModel(); // off: hides the model
|
||||
parts.tracking._clearTracking();
|
||||
parts.issLive?._syncIssLive(); // off: closes the live video
|
||||
parts.labels._syncIssOverlay();
|
||||
// Remove click handler + keydown listener + preRender propagation while disabled
|
||||
if (layerState._clickHandler) {
|
||||
@@ -172,6 +175,8 @@ export function createLifecycle({
|
||||
}
|
||||
layerState._overlayHost.clearSource(ISS_OVERLAY_SOURCE_ID);
|
||||
layerState._overlayHost.setVisible(ISS_OVERLAY_SOURCE_ID, false);
|
||||
parts.issModel?._destroyIssModel();
|
||||
parts.issLive?._destroyIssLive();
|
||||
if (layerState._pointCollection) {
|
||||
viewer.scene.primitives.remove(layerState._pointCollection);
|
||||
layerState._pointCollection = null;
|
||||
|
||||
@@ -19,6 +19,42 @@ import { SATELLITE_CLASS_DISPLAY, SATELLITE_CLASS_IDS } from './classes.js';
|
||||
|
||||
export const ISS_NORAD = 25544;
|
||||
|
||||
/**
|
||||
* The ISS drawn as a 3D model up close (issModel.js): NASA's "International
|
||||
* Space Station (ISS) (A)" from NASA 3D Resources, shipped unmodified.
|
||||
*/
|
||||
export const ISS_MODEL_URL = '/models/iss.glb';
|
||||
|
||||
/** The real station across its main truss, end to end, in meters. */
|
||||
export const ISS_SPAN_M = 109;
|
||||
|
||||
/**
|
||||
* The asset's truss length in its own units: the mesh's X extent (37.772)
|
||||
* times the root node's scale (0.678121), read from the file's accessors.
|
||||
*/
|
||||
export const ISS_MODEL_NATIVE_SPAN = 25.614;
|
||||
|
||||
/**
|
||||
* Within this camera distance the model replaces the dot; farther out the dot
|
||||
* stays. Covers the tracked view (~726 km back for LEO) with room to spare.
|
||||
*/
|
||||
export const ISS_MODEL_MAX_DISTANCE_M = 1_500_000;
|
||||
|
||||
/**
|
||||
* The model is never drawn smaller than this, in pixels. At true size the
|
||||
* station is under a pixel from the tracked view, so the floor is what makes
|
||||
* it readable there; within a few kilometres the true size takes over.
|
||||
*/
|
||||
export const ISS_MODEL_MIN_PX = 72;
|
||||
|
||||
/**
|
||||
* NASA's official live stream from the ISS on YouTube ("Live High-Definition
|
||||
* Views from the International Space Station", channel @NASA), shown in a
|
||||
* panel while the ISS is selected (issLive.js). A YouTube live keeps its id
|
||||
* while the broadcast runs; if NASA restarts it under a new id, change it here.
|
||||
*/
|
||||
export const ISS_LIVE_VIDEO_ID = 'ROboUHfPUrU';
|
||||
|
||||
export const ISS_OVERLAY_SOURCE_ID = 'satellites-iss';
|
||||
|
||||
export const ISS_OVERLAY_SOURCE_OPTIONS = Object.freeze({
|
||||
|
||||
@@ -200,6 +200,11 @@ export function createRendering({
|
||||
if (!layerState._enabled) return;
|
||||
const now = focusNowMs(Date.now());
|
||||
|
||||
// The ISS as a 3D model up close. First, before the tracked sample below
|
||||
// is refreshed: the follow camera and the tracked dot were placed this
|
||||
// frame from the sample still cached, and the model must sit on it too.
|
||||
parts.issModel?._updateIssModel();
|
||||
|
||||
const interval = layerState._trackedNorad ? 200 : POSITION_UPDATE_MS;
|
||||
// Space Missions keeps this layer enabled for TLE lookup while deliberately
|
||||
// hiding its standalone fleet. Do not rebuild hidden point buffers on the
|
||||
@@ -229,6 +234,9 @@ export function createRendering({
|
||||
if (layerState._cockpitSubjectNorad !== null)
|
||||
parts.cockpit?._syncCockpitSubjectVisuals();
|
||||
|
||||
// NASA's live video beside the card while the ISS is selected.
|
||||
parts.issLive?._syncIssLive();
|
||||
|
||||
_updatePointFocus(now);
|
||||
|
||||
// Hidden standalone orbit primitives do not need GMST matrix writes while
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/* NASA's ISS live video while the ISS is selected (src/layers/satellites/issLive.js).
|
||||
Bottom right, above the timeline and under the right rail: 300 px wide keeps
|
||||
it clear of the rail's last item at 720 px tall, and the rail (z-index 110)
|
||||
stays on top where a shorter window makes them meet. */
|
||||
.iss-live-panel {
|
||||
position: fixed;
|
||||
right: 16px;
|
||||
bottom: 96px;
|
||||
z-index: 40;
|
||||
width: min(300px, calc(100vw - 32px));
|
||||
background: rgba(6, 14, 22, 0.92);
|
||||
border: 1px solid rgba(0, 220, 255, 0.35);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
|
||||
color: #d8f6ff;
|
||||
font-family: var(--font-mono);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.iss-live-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 6px 8px 6px 10px;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
.iss-live-title {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: #ffd84d;
|
||||
}
|
||||
|
||||
.iss-live-dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: #ff4444;
|
||||
box-shadow: 0 0 6px #ff4444;
|
||||
}
|
||||
|
||||
.iss-live-link {
|
||||
color: #7fe3ff;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.iss-live-link:hover,
|
||||
.iss-live-link:focus-visible {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.iss-live-close {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #d8f6ff;
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
padding: 2px 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.iss-live-close:hover,
|
||||
.iss-live-close:focus-visible {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.iss-live-frame {
|
||||
position: relative;
|
||||
aspect-ratio: 16 / 9;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.iss-live-frame iframe {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
@import './src/ui/styles/layers.css';
|
||||
@import './src/ui/styles/radio.css';
|
||||
@import './src/ui/styles/cctv.css';
|
||||
@import './src/ui/styles/iss-live.css';
|
||||
@import './src/ui/styles/quebecCctvOverlay.css';
|
||||
@import './src/ui/styles/street-level.css';
|
||||
@import './src/ui/styles/scenes.css';
|
||||
|
||||
Reference in new issue
Block a user