@johnmorrisdotca/chikyu-earth 0.47.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +1 -1
- package/dist/realistic/earth.d.ts +3 -0
- package/dist/realistic/earth.js +4 -1
- package/dist/realistic/element-base.d.ts +91 -0
- package/dist/realistic/element-base.js +165 -4
- package/dist/satellites/source.js +1 -1
- package/dist/satellites/track.d.ts +5 -0
- package/dist/satellites/track.js +66 -5
- package/dist/satellites/types.d.ts +14 -0
- package/dist/sky/claim.d.ts +4 -0
- package/dist/sky/claim.js +8 -0
- package/dist/sky/host.js +5 -0
- package/dist/space/element-base.d.ts +91 -0
- package/dist/space/element-base.js +168 -5
- package/dist/space/path-controls.d.ts +56 -0
- package/dist/space/path-controls.js +121 -0
- package/dist/space/path-ribbons.d.ts +25 -0
- package/dist/space/path-ribbons.js +165 -0
- package/dist/space/paths.d.ts +119 -0
- package/dist/space/paths.js +163 -0
- package/dist/space/satellite-layer.d.ts +31 -2
- package/dist/space/satellite-layer.js +159 -32
- package/dist/space/scene.d.ts +3 -0
- package/dist/space/scene.js +5 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.49.0 - 2026-11-13
|
|
4
|
+
|
|
5
|
+
- **Satellites far from today, as an estimate** (MODULES-1296). `estimate-far` (the property `estimateFar`, or `createSatellites(sets, { estimateFar: true })`; off by default) keeps placing a satellite beyond 30 days from its elements: the same elements carried forward or back by the same SGP4 code, drawn lighter than a dimmed one, with `estimated: true` and `estimatedDays` (how far the moment is from the elements', in days) in `placeSatellite`, `satelliteInfo` and the details of `chikyu-satellite-click` and `chikyu-satellite-visibility`, and `stats.satellites.estimated`. The docs say what an estimate is (where it would be had its orbit not changed) and where it is worst (low orbits, months away). Never before an element set's `LAUNCH_DATE` (else the year of its `OBJECT_ID`) or after its `DECAY_DATE`, both new optional fields that `parseElements` keeps; a satellite SGP4 cannot carry that far, or brings below about 120 km, is left out and not counted as placed.
|
|
6
|
+
|
|
7
|
+
## 0.48.0 - 2026-11-13
|
|
8
|
+
|
|
9
|
+
- **Paths of a page's own, a quiet chosen orbit, and a hit test for a path line** (MODULES-1289). `selected-path="off"` (the property `selectedPath`) stops the package drawing the chosen satellite's own orbit; ring, name and ride stay. `setPaths(list)` (the property `paths`) draws up to 16 orbits at once, each `{ id, style }` (`id` a NORAD number or `group:index`, the last 16 kept), and `setPathStyles(table)` (the property `pathStyles`) changes the named looks `selected`, `hovered`, `favourite` and `path`, each a colour, a width of 0.5 to 8 px, an opacity and a dash: they differ by width and dash as well as colour. All the paths and the chosen orbit are one draw call, with a real width and dashes, and nothing is drawn at rest. `path-hit` (the property `pathHit`, 8 px, 0 to 40, off at 0; a touch has twice the reach, at least 16) makes `chikyu-path-hover` (a mouse) and `chikyu-path-click` (a press or a tap) say which path is under the pointer, `{ id, ref, style, x, y, distancePx, pointer }` with the same `ref` as `chikyu-satellite-click`; `pathAt(x, y, radiusPx?)` asks the same for any point. One press means one thing: a dot, then a path, then the sky. In a ride, the ridden satellite's own orbit is drawn in the `selected` look, and the hit test is off there unless `path-hit` is set. `stats.paths`. On both `<chikyu-space>` and `<chikyu-earth-realistic>`. The chosen satellite's orbit is now 2 px wide (the `selected` look; it was 1 px).
|
|
10
|
+
- **Three browser tests no longer fail on a saturated machine** (MODULES-1319). The full-screen at-rest and ride-look hidden-tab freeze tests wait for the page's own out-of-sight signal and count draws once they have held still; the ring test records the turn and its first draw in the page; the ride-size frame comparison holds everything that can arrive and leaves the stations' own orbit lines out. Tests only; the package is unchanged by them.
|
|
11
|
+
|
|
3
12
|
## 0.47.0 - 2026-11-13
|
|
4
13
|
|
|
5
14
|
- **The demo's Find box keeps a Japanese query.** A name in kana or kanji used to be dropped before the catalogue was asked, so `ハッブル` found nothing. It now asks the catalogue, and a satellite the package knows by a short name is listed by that name (Hubble, not only HST).
|
package/README.md
CHANGED
|
@@ -612,7 +612,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
|
|
|
612
612
|
|
|
613
613
|
## How to cite
|
|
614
614
|
|
|
615
|
-
> Morris, J. (2026). *Chikyu Earth* (version 0.
|
|
615
|
+
> Morris, J. (2026). *Chikyu Earth* (version 0.49.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
|
|
616
616
|
|
|
617
617
|
GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA. Cite the version you used (`npm ls @johnmorrisdotca/chikyu-earth`), and credit the sources behind the numbers and pictures: [NOTICE.md](NOTICE.md) says who made each one and under what terms.
|
|
618
618
|
|
|
@@ -3,6 +3,7 @@ import type { AssetCache, Item3D } from "@johnmorrisdotca/kazoku-ui/renderer";
|
|
|
3
3
|
import type { GeoPoint, GlobeView } from "../types.ts";
|
|
4
4
|
import type { SatelliteRef } from "../satellites/types.ts";
|
|
5
5
|
import { lookAt } from "../view.ts";
|
|
6
|
+
import type { PathHit } from "../space/paths.ts";
|
|
6
7
|
import { type SatelliteScreen, type SatelliteState } from "../space/satellite-layer.ts";
|
|
7
8
|
import type { Layer } from "./tiers.ts";
|
|
8
9
|
import { type ThreeParts } from "./textures.ts";
|
|
@@ -85,6 +86,8 @@ export interface EarthModel {
|
|
|
85
86
|
} | null;
|
|
86
87
|
/** The map tiles laid over the pictures while the scene is built: what they are doing, for a page or a test. */
|
|
87
88
|
tiles: TileSet | null;
|
|
89
|
+
/** The page's path under a point of the view (CSS pixels), within a radius, once a draw has been made and one is there. */
|
|
90
|
+
pathAt: ((x: number, y: number, radius: number) => Omit<PathHit, "pointer"> | null) | null;
|
|
88
91
|
/** The satellite at a point of the view (CSS pixels), within a radius, once a draw has been made and one is there. */
|
|
89
92
|
pick: ((x: number, y: number, radius: number) => SatelliteRef | null) | null;
|
|
90
93
|
/** Where a satellite of a shown group is on the screen as of the last draw, or `null`. */
|
package/dist/realistic/earth.js
CHANGED
|
@@ -44,6 +44,7 @@ export const newModel = () => ({
|
|
|
44
44
|
drawn: null,
|
|
45
45
|
tiles: null,
|
|
46
46
|
pick: null,
|
|
47
|
+
pathAt: null,
|
|
47
48
|
placeSatellite: null,
|
|
48
49
|
ratio: () => Math.min(globalThis.devicePixelRatio || 1, 2),
|
|
49
50
|
meteors: newMeteorState(),
|
|
@@ -242,8 +243,9 @@ export function createEarthItem(model, deps) {
|
|
|
242
243
|
deps.onSatellitesError?.(error);
|
|
243
244
|
}
|
|
244
245
|
}
|
|
245
|
-
layer?.update(model.time, model.speed, radius);
|
|
246
|
+
layer?.update(model.time, model.speed, radius, size);
|
|
246
247
|
model.pick = layer ? (x, y, radius) => layer.pick(x, y, camera, size, radius) : null;
|
|
248
|
+
model.pathAt = layer ? (x, y, radius) => layer.pathAt(x, y, camera, size, radius) : null;
|
|
247
249
|
model.placeSatellite = layer ? (ref) => layer.placeOf(ref, camera, size) : null;
|
|
248
250
|
if (layer && deps.onHover) {
|
|
249
251
|
const hover = model.satellites.hover;
|
|
@@ -356,6 +358,7 @@ export function createEarthItem(model, deps) {
|
|
|
356
358
|
dispose() {
|
|
357
359
|
layer?.dispose();
|
|
358
360
|
model.pick = null;
|
|
361
|
+
model.pathAt = null;
|
|
359
362
|
model.placeSatellite = null;
|
|
360
363
|
clearTimeout(meteorTimer);
|
|
361
364
|
meteors?.dispose();
|
|
@@ -5,6 +5,8 @@ import { type PaintSpec } from "../paint/buffer.ts";
|
|
|
5
5
|
import type { SatelliteInfo, SatelliteRef, Satellites } from "../satellites/types.ts";
|
|
6
6
|
import { type SatelliteStyle } from "../space/satellite-layer.ts";
|
|
7
7
|
import { type SatelliteOthers } from "../space/satellite-focus.ts";
|
|
8
|
+
import { type PathStats } from "../space/path-controls.ts";
|
|
9
|
+
import { type PathHit, type PathRequest, type PathStyle } from "../space/paths.ts";
|
|
8
10
|
import type { Credit, DataSource } from "../data-door.ts";
|
|
9
11
|
import { type BodyLabelSettings } from "./body-label.ts";
|
|
10
12
|
import type { SkyKeepClear } from "../sky/keep-clear.ts";
|
|
@@ -59,6 +61,7 @@ type SatelliteStats = {
|
|
|
59
61
|
hoverPath: boolean;
|
|
60
62
|
hoverOpacity: number;
|
|
61
63
|
selectedOpacity: number;
|
|
64
|
+
estimated: number;
|
|
62
65
|
};
|
|
63
66
|
/**
|
|
64
67
|
* A `speed` attribute: how many seconds pass for each real second.
|
|
@@ -373,6 +376,8 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
373
376
|
tiers: Record<EarthLayer, number>;
|
|
374
377
|
tiles: TileStats;
|
|
375
378
|
satellites: SatelliteStats;
|
|
379
|
+
/** The page's paths: asked for, drawn (with the chosen satellite's own), left out over the cap of 16, unmatched, whether the chosen satellite's own orbit is drawn, draw calls they took at the last draw (0 or 1), the path under the mouse and the `chikyu-path-click` events sent. */
|
|
380
|
+
paths: PathStats;
|
|
376
381
|
draws: number;
|
|
377
382
|
contexts: number;
|
|
378
383
|
canvas: {
|
|
@@ -560,8 +565,94 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
560
565
|
visible: boolean;
|
|
561
566
|
heightKm: number;
|
|
562
567
|
} | null;
|
|
568
|
+
/**
|
|
569
|
+
* Keep placing satellites that are far from their element sets, as an estimate (the attribute `estimate-far`, off unless set; `estimate-far="off"` is off). A satellite is left out when the moment shown is more than `maxAgeDays` (30) from its elements; on, it is carried forward or back by the same SGP4 code
|
|
570
|
+
* instead, and drawn lighter than a dimmed one. **An estimate is where the satellite would be if its orbit had not changed since the elements were taken.** It is worst for low orbits (drag changes them within days, and a manoeuvre moves the satellite along its path, so after weeks the estimate can be far along the orbit from the truth, and a satellite that has re-entered is not there at all) and for a long time away; a high orbit changes slowly and is close for months. Never before a satellite's launch or after its decay when its elements carry `LAUNCH_DATE` and `DECAY_DATE` (else the year of its `OBJECT_ID` is the earliest);
|
|
571
|
+
* one SGP4 cannot carry that far, or brings down below about 120 km, is left out and is not counted as placed. Each estimated satellite is `estimated: true`, with `estimatedDays`, in `placeSatellite`, `satelliteInfo`, `chikyu-satellite-visibility` and `chikyu-satellite-click`, and `stats.satellites.estimated` counts them.
|
|
572
|
+
* It applies to every group, those the page made with `createSatellites(sets, { estimateFar: true })` too.
|
|
573
|
+
*
|
|
574
|
+
* @example
|
|
575
|
+
* ```ts
|
|
576
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
577
|
+
*
|
|
578
|
+
* const farFromToday = (space: ChikyuSpace): void => {
|
|
579
|
+
* space.estimateFar = true;
|
|
580
|
+
* space.addEventListener("chikyu-satellite-click", (event) => console.log((event as CustomEvent).detail.estimated, (event as CustomEvent).detail.estimatedDays));
|
|
581
|
+
* };
|
|
582
|
+
* console.log(typeof farFromToday);
|
|
583
|
+
* ```
|
|
584
|
+
*/
|
|
585
|
+
get estimateFar(): boolean;
|
|
586
|
+
set estimateFar(value: boolean);
|
|
563
587
|
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
564
588
|
get selectedSatellite(): SatelliteRef | null;
|
|
589
|
+
/**
|
|
590
|
+
* Draw these satellites' orbits at once, each in a look from the table (`pathStyles`), without a satellite being chosen. One draw call for all of them and the chosen satellite's own orbit, and nothing is drawn at rest. At most 16 are kept, the last of the list.
|
|
591
|
+
* `id` is a NORAD catalogue number or `group:index` (`stations:0`); an id that matches no satellite is skipped (`stats.paths.unresolved`). A satellite asked for twice is drawn once, in the later look. `style` is the name of a look (`selected`, `hovered`, `favourite`, `path`, or one of the page's own)
|
|
592
|
+
* or a partial look over `path`. `[]` takes them all away. Where the pointer is on one, `chikyu-path-hover` and `chikyu-path-click` say which (`path-hit`).
|
|
593
|
+
*
|
|
594
|
+
* @param list - The paths, oldest first.
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* ```ts
|
|
598
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
599
|
+
*
|
|
600
|
+
* const show = (space: ChikyuSpace): void => space.setPaths([{ id: 25544, style: "favourite" }, { id: "stations:1", style: { color: "#7fdbff", dash: [8, 4] } }]);
|
|
601
|
+
* console.log(typeof show);
|
|
602
|
+
* ```
|
|
603
|
+
*/
|
|
604
|
+
setPaths(list: readonly PathRequest[]): void;
|
|
605
|
+
/** The paths in use, as set (the last 16). Setting it is `setPaths`. */
|
|
606
|
+
get paths(): PathRequest[];
|
|
607
|
+
set paths(list: readonly PathRequest[]);
|
|
608
|
+
/**
|
|
609
|
+
* Change the looks the paths are drawn in, by name. Each entry is a partial look over the built-in one of that name (or over `path`, for a name of the page's own); `null` takes the page's entry away. Without `replace` the entries are added to those already set.
|
|
610
|
+
* The built-in looks differ by width and dash as well as colour: `selected` (white, 2 px, solid, also the look of the chosen satellite's own orbit), `hovered` (white, 1.5 px, dashed), `favourite` (amber, 1.75 px, dotted) and `path` (white, 1.5 px, solid).
|
|
611
|
+
* A look is `{ color, width (0.5 to 8 CSS pixels), opacity (0 to 1), dash ([dash, gap] in CSS pixels, or null) }`.
|
|
612
|
+
*
|
|
613
|
+
* @param table - The entries by name.
|
|
614
|
+
* @param replace - `true` to drop the entries set before.
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```ts
|
|
618
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
619
|
+
*
|
|
620
|
+
* const quiet = (space: ChikyuSpace): void => space.setPathStyles({ selected: { color: "#ffd166", width: 3, dash: null } });
|
|
621
|
+
* console.log(typeof quiet);
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
setPathStyles(table: Readonly<Record<string, Partial<PathStyle> | null>>, replace?: boolean): void;
|
|
625
|
+
/** The table of looks in use, whole: the built-in ones with the page's own over them. A copy. */
|
|
626
|
+
get pathStyles(): Record<string, PathStyle>;
|
|
627
|
+
set pathStyles(table: Readonly<Record<string, Partial<PathStyle> | null>>);
|
|
628
|
+
/**
|
|
629
|
+
* Draw the chosen satellite's own orbit (the attribute `selected-path`; on unless `off`). Off, `selectSatellite` still rings and names the satellite and a ride still follows it, but no line is drawn: the page draws it, with `setPaths` and the `selected` look, or its own. The look of the line when it is on is the `selected` entry of `pathStyles`.
|
|
630
|
+
*/
|
|
631
|
+
get selectedPath(): boolean;
|
|
632
|
+
set selectedPath(value: boolean);
|
|
633
|
+
/**
|
|
634
|
+
* How near, in CSS pixels, the pointer has to be to a path for the pick and hover events to report it (the attribute `path-hit`; 8 when left out, 0 to 40; `0` or `off` turns the test off). A touch is given twice that, and at least 16.
|
|
635
|
+
* The test covers the page's paths and the chosen satellite's own orbit, not the part of an orbit the Earth hides, and a satellite's dot under the pointer comes first. In a ride from a satellite the test is off unless the attribute is set.
|
|
636
|
+
*/
|
|
637
|
+
get pathHit(): number;
|
|
638
|
+
set pathHit(value: number);
|
|
639
|
+
/**
|
|
640
|
+
* The path under a point of the element, from the last draw: its id as given, the satellite (`ref`, the same shape as in `chikyu-satellite-click`), the name of its look, the nearest point on it and the distance to it, or `null`.
|
|
641
|
+
*
|
|
642
|
+
* @param x - CSS pixels from the element's left.
|
|
643
|
+
* @param y - CSS pixels from its top.
|
|
644
|
+
* @param radiusPx - How near the point must be, 0 to 200; `path-hit` when left out.
|
|
645
|
+
* @returns The path, or `null` when none is within reach.
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* ```ts
|
|
649
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
650
|
+
*
|
|
651
|
+
* const name = (space: ChikyuSpace, x: number, y: number): string => space.pathAt(x, y, 10)?.style ?? "none";
|
|
652
|
+
* console.log(typeof name);
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
655
|
+
pathAt(x: number, y: number, radiusPx?: number): PathHit | null;
|
|
565
656
|
/** Facts about one satellite at the moment shown (name, number, element age, height, speed, period, and `ownerCountry` when the owner is one country); undefined if it cannot be placed then. */
|
|
566
657
|
satelliteInfo(ref: SatelliteRef): SatelliteInfo | undefined;
|
|
567
658
|
/** The view as it is (for a page that wants to read it back). */
|
|
@@ -10,6 +10,9 @@ import { cameraCentre, createEarthItem, discRadius, lookAt, newModel } from "./e
|
|
|
10
10
|
import { createPaintState, paintedGround, paintedPeriod } from "../paint/buffer.js";
|
|
11
11
|
import { MAX_ORBIT_GROUP, readStreakMax } from "../space/satellite-layer.js";
|
|
12
12
|
import { applySatelliteFocus, satelliteEmphasis, satelliteGroupRows, shellRadiusOf, zoomForOrthographicShell } from "../space/satellite-focus.js";
|
|
13
|
+
import { claimPress } from "../sky/claim.js";
|
|
14
|
+
import { bindPaths, emptyPathStats, pointerOf } from "../space/path-controls.js";
|
|
15
|
+
import { styleTable } from "../space/paths.js";
|
|
13
16
|
import { bindSatelliteHover, hoverPathOn, hoverStyleOf, namesOnHover as namesHoverOn } from "../space/satellite-hover.js";
|
|
14
17
|
import { readMeteorStrength } from "../meteors/strength.js";
|
|
15
18
|
import { METEOR_NOTE_STYLE, prefersLessMotion, setMeteorNote } from "../meteors/note.js";
|
|
@@ -162,7 +165,7 @@ export const readTime = (value) => {
|
|
|
162
165
|
* ```
|
|
163
166
|
*/
|
|
164
167
|
export class ChikyuEarthRealistic extends HTMLElement {
|
|
165
|
-
static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint", "satellite-streak-max", "hover-path", "names-on-hover"];
|
|
168
|
+
static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint", "satellite-streak-max", "hover-path", "names-on-hover", "selected-path", "path-hit", "estimate-far"];
|
|
166
169
|
#model = newModel();
|
|
167
170
|
#paint = createPaintState();
|
|
168
171
|
#mode = "now";
|
|
@@ -211,6 +214,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
211
214
|
#focusView = null;
|
|
212
215
|
/** The name and the faint orbit while the pointer rests on a satellite. */
|
|
213
216
|
#hover;
|
|
217
|
+
#pathControls;
|
|
214
218
|
#reach = null;
|
|
215
219
|
/** The page has set a `speed` since the element came into the page: for a reader who prefers reduced motion, that is the Play that lets meteors start. */
|
|
216
220
|
#played = false;
|
|
@@ -407,12 +411,23 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
407
411
|
style: () => hoverStyleOf(this),
|
|
408
412
|
});
|
|
409
413
|
this.#hover.sync();
|
|
414
|
+
this.#pathControls = bindPaths({
|
|
415
|
+
element: this,
|
|
416
|
+
state: this.#model.satellites,
|
|
417
|
+
request: () => this.#gate?.soon(),
|
|
418
|
+
pathAt: (x, y, radius) => this.#model.pathAt?.(x, y, radius) ?? null,
|
|
419
|
+
pick: (x, y) => this.#model.pick?.(x, y, 12) ?? null,
|
|
420
|
+
riding: () => false,
|
|
421
|
+
});
|
|
422
|
+
this.#pathControls.sync();
|
|
410
423
|
this.#startTick();
|
|
411
424
|
document.addEventListener("visibilitychange", this.#onVisible);
|
|
412
425
|
}
|
|
413
426
|
disconnectedCallback() {
|
|
414
427
|
this.#hover?.stop();
|
|
415
428
|
this.#hover = undefined;
|
|
429
|
+
this.#pathControls?.stop();
|
|
430
|
+
this.#pathControls = undefined;
|
|
416
431
|
this.removeEventListener("pointerdown", this.#take);
|
|
417
432
|
this.removeEventListener("pointerdown", this.#down);
|
|
418
433
|
this.removeEventListener("wheel", this.#wheel, { capture: true });
|
|
@@ -541,6 +556,11 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
541
556
|
}
|
|
542
557
|
else if (name === "hover-path" || name === "names-on-hover")
|
|
543
558
|
this.#hover?.sync();
|
|
559
|
+
else if (name === "selected-path")
|
|
560
|
+
this.#pathControls?.sync();
|
|
561
|
+
else if (name === "estimate-far")
|
|
562
|
+
this.#applyEstimate();
|
|
563
|
+
else if (name === "path-hit") { /* read at each press and move */ }
|
|
544
564
|
else if (name === "satellite-streak-max") {
|
|
545
565
|
this.#model.satellites.streakMax = readStreakMax(value);
|
|
546
566
|
this.#gate?.soon();
|
|
@@ -1199,6 +1219,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1199
1219
|
state: this.#state,
|
|
1200
1220
|
tiers: { ...this.#tiers },
|
|
1201
1221
|
satellites: this.#satelliteStats(),
|
|
1222
|
+
paths: this.#pathControls?.stats() ?? emptyPathStats(),
|
|
1202
1223
|
tiles: this.#model.tiles?.stats ?? { ready: false, level: null, held: 0, shown: 0, loading: 0, failed: 0, requested: 0, heldBytes: 0, refused: 0, used: {}, finer: null, fading: false },
|
|
1203
1224
|
draws: stats?.draws ?? 0,
|
|
1204
1225
|
contexts: stats?.contexts ?? 0,
|
|
@@ -1322,6 +1343,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1322
1343
|
orbits: (style.orbits ?? was?.orbits ?? false) && satellites.count <= MAX_ORBIT_GROUP,
|
|
1323
1344
|
visible: was?.visible ?? true,
|
|
1324
1345
|
});
|
|
1346
|
+
if (typeof this.hasAttribute === "function" && this.hasAttribute("estimate-far"))
|
|
1347
|
+
satellites.estimateFar = this.estimateFar;
|
|
1325
1348
|
}
|
|
1326
1349
|
this.#last = performance.now();
|
|
1327
1350
|
this.#startTick();
|
|
@@ -1432,11 +1455,144 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1432
1455
|
placeSatellite(ref) {
|
|
1433
1456
|
return this.#model.placeSatellite?.(ref) ?? null;
|
|
1434
1457
|
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Keep placing satellites that are far from their element sets, as an estimate (the attribute `estimate-far`, off unless set; `estimate-far="off"` is off). A satellite is left out when the moment shown is more than `maxAgeDays` (30) from its elements; on, it is carried forward or back by the same SGP4 code
|
|
1460
|
+
* instead, and drawn lighter than a dimmed one. **An estimate is where the satellite would be if its orbit had not changed since the elements were taken.** It is worst for low orbits (drag changes them within days, and a manoeuvre moves the satellite along its path, so after weeks the estimate can be far along the orbit from the truth, and a satellite that has re-entered is not there at all) and for a long time away; a high orbit changes slowly and is close for months. Never before a satellite's launch or after its decay when its elements carry `LAUNCH_DATE` and `DECAY_DATE` (else the year of its `OBJECT_ID` is the earliest);
|
|
1461
|
+
* one SGP4 cannot carry that far, or brings down below about 120 km, is left out and is not counted as placed. Each estimated satellite is `estimated: true`, with `estimatedDays`, in `placeSatellite`, `satelliteInfo`, `chikyu-satellite-visibility` and `chikyu-satellite-click`, and `stats.satellites.estimated` counts them.
|
|
1462
|
+
* It applies to every group, those the page made with `createSatellites(sets, { estimateFar: true })` too.
|
|
1463
|
+
*
|
|
1464
|
+
* @example
|
|
1465
|
+
* ```ts
|
|
1466
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
1467
|
+
*
|
|
1468
|
+
* const farFromToday = (space: ChikyuSpace): void => {
|
|
1469
|
+
* space.estimateFar = true;
|
|
1470
|
+
* space.addEventListener("chikyu-satellite-click", (event) => console.log((event as CustomEvent).detail.estimated, (event as CustomEvent).detail.estimatedDays));
|
|
1471
|
+
* };
|
|
1472
|
+
* console.log(typeof farFromToday);
|
|
1473
|
+
* ```
|
|
1474
|
+
*/
|
|
1475
|
+
get estimateFar() {
|
|
1476
|
+
return this.hasAttribute("estimate-far") && this.getAttribute("estimate-far") !== "off";
|
|
1477
|
+
}
|
|
1478
|
+
set estimateFar(value) {
|
|
1479
|
+
if (value)
|
|
1480
|
+
this.setAttribute("estimate-far", "");
|
|
1481
|
+
else
|
|
1482
|
+
this.removeAttribute("estimate-far");
|
|
1483
|
+
}
|
|
1484
|
+
/** What an event says of a satellite's place: whether it is an estimate, and how far the moment shown is from its elements' own, in days. */
|
|
1485
|
+
#estimateOf(ref) {
|
|
1486
|
+
const info = this.#model.satellites.groups.get(ref.group)?.satellites.info(ref.index, this.#model.time);
|
|
1487
|
+
return { estimated: info?.estimated ?? false, estimatedDays: info?.estimatedDays ?? 0 };
|
|
1488
|
+
}
|
|
1489
|
+
#applyEstimate() {
|
|
1490
|
+
const on = this.estimateFar;
|
|
1491
|
+
for (const group of this.#model.satellites.groups.values())
|
|
1492
|
+
group.satellites.estimateFar = on;
|
|
1493
|
+
this.#gate?.soon();
|
|
1494
|
+
}
|
|
1435
1495
|
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
1436
1496
|
get selectedSatellite() {
|
|
1437
1497
|
const chosen = this.#model.satellites.selected;
|
|
1438
1498
|
return chosen ? { ...chosen } : null;
|
|
1439
1499
|
}
|
|
1500
|
+
// --- paths -------------------------------------------------------------------------------------------------------------------------------------
|
|
1501
|
+
/**
|
|
1502
|
+
* Draw these satellites' orbits at once, each in a look from the table (`pathStyles`), without a satellite being chosen. One draw call for all of them and the chosen satellite's own orbit, and nothing is drawn at rest. At most 16 are kept, the last of the list.
|
|
1503
|
+
* `id` is a NORAD catalogue number or `group:index` (`stations:0`); an id that matches no satellite is skipped (`stats.paths.unresolved`). A satellite asked for twice is drawn once, in the later look. `style` is the name of a look (`selected`, `hovered`, `favourite`, `path`, or one of the page's own)
|
|
1504
|
+
* or a partial look over `path`. `[]` takes them all away. Where the pointer is on one, `chikyu-path-hover` and `chikyu-path-click` say which (`path-hit`).
|
|
1505
|
+
*
|
|
1506
|
+
* @param list - The paths, oldest first.
|
|
1507
|
+
*
|
|
1508
|
+
* @example
|
|
1509
|
+
* ```ts
|
|
1510
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
1511
|
+
*
|
|
1512
|
+
* const show = (space: ChikyuSpace): void => space.setPaths([{ id: 25544, style: "favourite" }, { id: "stations:1", style: { color: "#7fdbff", dash: [8, 4] } }]);
|
|
1513
|
+
* console.log(typeof show);
|
|
1514
|
+
* ```
|
|
1515
|
+
*/
|
|
1516
|
+
setPaths(list) {
|
|
1517
|
+
this.#pathControls?.setPaths(list);
|
|
1518
|
+
}
|
|
1519
|
+
/** The paths in use, as set (the last 16). Setting it is `setPaths`. */
|
|
1520
|
+
get paths() {
|
|
1521
|
+
return this.#pathControls?.paths ?? [];
|
|
1522
|
+
}
|
|
1523
|
+
set paths(list) {
|
|
1524
|
+
this.setPaths(list);
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Change the looks the paths are drawn in, by name. Each entry is a partial look over the built-in one of that name (or over `path`, for a name of the page's own); `null` takes the page's entry away. Without `replace` the entries are added to those already set.
|
|
1528
|
+
* The built-in looks differ by width and dash as well as colour: `selected` (white, 2 px, solid, also the look of the chosen satellite's own orbit), `hovered` (white, 1.5 px, dashed), `favourite` (amber, 1.75 px, dotted) and `path` (white, 1.5 px, solid).
|
|
1529
|
+
* A look is `{ color, width (0.5 to 8 CSS pixels), opacity (0 to 1), dash ([dash, gap] in CSS pixels, or null) }`.
|
|
1530
|
+
*
|
|
1531
|
+
* @param table - The entries by name.
|
|
1532
|
+
* @param replace - `true` to drop the entries set before.
|
|
1533
|
+
*
|
|
1534
|
+
* @example
|
|
1535
|
+
* ```ts
|
|
1536
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
1537
|
+
*
|
|
1538
|
+
* const quiet = (space: ChikyuSpace): void => space.setPathStyles({ selected: { color: "#ffd166", width: 3, dash: null } });
|
|
1539
|
+
* console.log(typeof quiet);
|
|
1540
|
+
* ```
|
|
1541
|
+
*/
|
|
1542
|
+
setPathStyles(table, replace = false) {
|
|
1543
|
+
this.#pathControls?.setStyles(table, replace);
|
|
1544
|
+
}
|
|
1545
|
+
/** The table of looks in use, whole: the built-in ones with the page's own over them. A copy. */
|
|
1546
|
+
get pathStyles() {
|
|
1547
|
+
return this.#pathControls?.styles ?? styleTable({});
|
|
1548
|
+
}
|
|
1549
|
+
set pathStyles(table) {
|
|
1550
|
+
this.setPathStyles(table, true);
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Draw the chosen satellite's own orbit (the attribute `selected-path`; on unless `off`). Off, `selectSatellite` still rings and names the satellite and a ride still follows it, but no line is drawn: the page draws it, with `setPaths` and the `selected` look, or its own. The look of the line when it is on is the `selected` entry of `pathStyles`.
|
|
1554
|
+
*/
|
|
1555
|
+
get selectedPath() {
|
|
1556
|
+
return this.getAttribute("selected-path") !== "off";
|
|
1557
|
+
}
|
|
1558
|
+
set selectedPath(value) {
|
|
1559
|
+
if (value)
|
|
1560
|
+
this.removeAttribute("selected-path");
|
|
1561
|
+
else
|
|
1562
|
+
this.setAttribute("selected-path", "off");
|
|
1563
|
+
}
|
|
1564
|
+
/**
|
|
1565
|
+
* How near, in CSS pixels, the pointer has to be to a path for the pick and hover events to report it (the attribute `path-hit`; 8 when left out, 0 to 40; `0` or `off` turns the test off). A touch is given twice that, and at least 16.
|
|
1566
|
+
* The test covers the page's paths and the chosen satellite's own orbit, not the part of an orbit the Earth hides, and a satellite's dot under the pointer comes first. In a ride from a satellite the test is off unless the attribute is set.
|
|
1567
|
+
*/
|
|
1568
|
+
get pathHit() {
|
|
1569
|
+
return this.#pathControls?.hit ?? 8;
|
|
1570
|
+
}
|
|
1571
|
+
set pathHit(value) {
|
|
1572
|
+
if (Number.isFinite(value) && value >= 0)
|
|
1573
|
+
this.setAttribute("path-hit", String(value));
|
|
1574
|
+
else
|
|
1575
|
+
this.removeAttribute("path-hit");
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* The path under a point of the element, from the last draw: its id as given, the satellite (`ref`, the same shape as in `chikyu-satellite-click`), the name of its look, the nearest point on it and the distance to it, or `null`.
|
|
1579
|
+
*
|
|
1580
|
+
* @param x - CSS pixels from the element's left.
|
|
1581
|
+
* @param y - CSS pixels from its top.
|
|
1582
|
+
* @param radiusPx - How near the point must be, 0 to 200; `path-hit` when left out.
|
|
1583
|
+
* @returns The path, or `null` when none is within reach.
|
|
1584
|
+
*
|
|
1585
|
+
* @example
|
|
1586
|
+
* ```ts
|
|
1587
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
1588
|
+
*
|
|
1589
|
+
* const name = (space: ChikyuSpace, x: number, y: number): string => space.pathAt(x, y, 10)?.style ?? "none";
|
|
1590
|
+
* console.log(typeof name);
|
|
1591
|
+
* ```
|
|
1592
|
+
*/
|
|
1593
|
+
pathAt(x, y, radiusPx) {
|
|
1594
|
+
return this.#pathControls?.at(x, y, radiusPx) ?? null;
|
|
1595
|
+
}
|
|
1440
1596
|
/** Facts about one satellite at the moment shown (name, number, element age, height, speed, period, and `ownerCountry` when the owner is one country); undefined if it cannot be placed then. */
|
|
1441
1597
|
satelliteInfo(ref) {
|
|
1442
1598
|
return this.#model.satellites.groups.get(ref.group)?.satellites.info(ref.index, this.#model.time);
|
|
@@ -1454,7 +1610,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1454
1610
|
let epochMs = 0;
|
|
1455
1611
|
for (const group of this.#model.satellites.groups.values())
|
|
1456
1612
|
epochMs = Math.max(epochMs, group.satellites.newestEpochMs);
|
|
1457
|
-
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity };
|
|
1613
|
+
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity, estimated: drawn.estimated };
|
|
1458
1614
|
}
|
|
1459
1615
|
// A press that does not turn the view (under 6 pixels) on a satellite tells the page, which chooses it with `selectSatellite` if it likes.
|
|
1460
1616
|
#downX = 0;
|
|
@@ -1471,8 +1627,13 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1471
1627
|
return;
|
|
1472
1628
|
const rect = this.getBoundingClientRect();
|
|
1473
1629
|
const satellite = this.#model.pick?.(event.clientX - rect.left, event.clientY - rect.top, 12);
|
|
1474
|
-
if (satellite)
|
|
1475
|
-
|
|
1630
|
+
if (satellite) {
|
|
1631
|
+
claimPress(event);
|
|
1632
|
+
this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite), ...this.#estimateOf(satellite) }, bubbles: true, composed: true }));
|
|
1633
|
+
return;
|
|
1634
|
+
}
|
|
1635
|
+
if (this.#pathControls?.press(event.clientX - rect.left, event.clientY - rect.top, pointerOf(event)))
|
|
1636
|
+
claimPress(event);
|
|
1476
1637
|
};
|
|
1477
1638
|
#wheel = (event) => immersiveWheel(this, event);
|
|
1478
1639
|
/** The view as it is (for a page that wants to read it back). */
|
|
@@ -9,7 +9,7 @@ export function toElementSet(record) {
|
|
|
9
9
|
out["OBJECT_ID"] = record["OBJECT_ID"];
|
|
10
10
|
if (typeof record["CLASSIFICATION_TYPE"] === "string" && record["CLASSIFICATION_TYPE"])
|
|
11
11
|
out["CLASSIFICATION_TYPE"] = record["CLASSIFICATION_TYPE"];
|
|
12
|
-
for (const key of ["COUNTRY_CODE", "OWNER"])
|
|
12
|
+
for (const key of ["COUNTRY_CODE", "OWNER", "LAUNCH_DATE", "DECAY_DATE"])
|
|
13
13
|
if (typeof record[key] === "string" && record[key].trim())
|
|
14
14
|
out[key] = record[key].trim();
|
|
15
15
|
const epoch = record["EPOCH"];
|
|
@@ -20,6 +20,11 @@ export interface SatellitesOptions {
|
|
|
20
20
|
maxAgeDays?: number;
|
|
21
21
|
/** The age, in days, past which a satellite is drawn dimmer because its place is less exact (14 by default). */
|
|
22
22
|
dimAfterDays?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Keep placing a satellite beyond `maxAgeDays` from its element set, as an estimate (off by default): the same elements carried forward or back by the same SGP4 code, where the satellite would be had its orbit not changed.
|
|
25
|
+
* Never before its launch date or after its decay date when the elements carry them (`LAUNCH_DATE`, `DECAY_DATE`; else the launch year in `OBJECT_ID` marks the earliest), and a satellite that SGP4 cannot carry that far, or brings down below about 120 km, is left out.
|
|
26
|
+
*/
|
|
27
|
+
estimateFar?: boolean;
|
|
23
28
|
}
|
|
24
29
|
/**
|
|
25
30
|
* Make a group of satellites from their element sets. Each starts SGP4 once here; one that does not (bad numbers, decayed at its own epoch) is listed in `refused` and left out.
|
package/dist/satellites/track.js
CHANGED
|
@@ -15,6 +15,18 @@ const MAX_STEP_MS = 60_000;
|
|
|
15
15
|
* (a Molniya orbit is 10 times quicker at its lowest point than its mean): its place and its streak are SGP4 itself, two calls a frame, for the few that are this eccentric.
|
|
16
16
|
*/
|
|
17
17
|
export const ECCENTRIC_FROM = 0.02;
|
|
18
|
+
/** A date from the catalogue (`2026-11-02`, or with a time), in milliseconds, or NaN. A bare date is taken as the start of that day UTC. */
|
|
19
|
+
const dateOf = (text) => {
|
|
20
|
+
const t = typeof text === "string" ? text.trim() : "";
|
|
21
|
+
if (t === "")
|
|
22
|
+
return Number.NaN;
|
|
23
|
+
if (t.length <= 10)
|
|
24
|
+
return Date.parse(`${t}T00:00:00Z`);
|
|
25
|
+
const iso = t.replace(" ", "T");
|
|
26
|
+
return Date.parse(/[zZ]|[+-]\d\d:?\d\d$/.test(iso) ? iso : `${iso}Z`);
|
|
27
|
+
};
|
|
28
|
+
/** The height, in kilometres above the mean Earth radius, below which a satellite carried far from its elements is taken to have come down: SGP4 has nothing true to say there, and it is never drawn inside the Earth. */
|
|
29
|
+
const LOWEST_ESTIMATE_KM = 120;
|
|
18
30
|
const epochOf = (text) => Date.parse(/[zZ]|[+-]\d\d:?\d\d$/.test(text) ? text : `${text}Z`);
|
|
19
31
|
/**
|
|
20
32
|
* Make a group of satellites from their element sets. Each starts SGP4 once here; one that does not (bad numbers, decayed at its own epoch) is listed in `refused` and left out.
|
|
@@ -57,6 +69,8 @@ export function createSatellites(sets, options = {}) {
|
|
|
57
69
|
const recs = [];
|
|
58
70
|
const usable = [];
|
|
59
71
|
const epochs = [];
|
|
72
|
+
const launchOf = [];
|
|
73
|
+
const decayOf = [];
|
|
60
74
|
const refused = [];
|
|
61
75
|
for (const set of sets) {
|
|
62
76
|
const epoch = epochOf(set.EPOCH);
|
|
@@ -75,6 +89,12 @@ export function createSatellites(sets, options = {}) {
|
|
|
75
89
|
recs.push(rec);
|
|
76
90
|
usable.push(set);
|
|
77
91
|
epochs.push(epoch);
|
|
92
|
+
// the earliest moment it can have been in orbit: its launch date, else the start of the year in its international designator; the latest: the end of its decay day
|
|
93
|
+
const launch = dateOf(set.LAUNCH_DATE);
|
|
94
|
+
const year = /^(\d{4})-\d{3}/.exec(set.OBJECT_ID ?? "");
|
|
95
|
+
launchOf.push(Number.isFinite(launch) ? launch : year ? Date.UTC(Number(year[1]), 0, 1) : Number.NEGATIVE_INFINITY);
|
|
96
|
+
const decay = dateOf(set.DECAY_DATE);
|
|
97
|
+
decayOf.push(Number.isFinite(decay) ? decay + ((set.DECAY_DATE ?? "").trim().length <= 10 ? DAY_MS - 1 : 0) : Number.POSITIVE_INFINITY);
|
|
78
98
|
}
|
|
79
99
|
catch (error) {
|
|
80
100
|
refuse(error instanceof Error ? error.message : "SGP4 could not start from these elements");
|
|
@@ -121,6 +141,17 @@ export function createSatellites(sets, options = {}) {
|
|
|
121
141
|
let propagations = 0;
|
|
122
142
|
let placed = 0;
|
|
123
143
|
const timing = { lastBatchMs: 0, maxBatchMs: 0 };
|
|
144
|
+
let estimate = options.estimateFar === true;
|
|
145
|
+
let estimatedCount = 0;
|
|
146
|
+
/** Whether a satellite is placed at a moment: within `maxAgeDays` of its elements, or, when far moments are estimated, inside the time it was in orbit. */
|
|
147
|
+
const usableAt = (i, ms) => {
|
|
148
|
+
if (estimate)
|
|
149
|
+
return ms >= launchOf[i] && ms <= decayOf[i];
|
|
150
|
+
return Math.abs(ms - epochs[i]) <= maxAgeMs;
|
|
151
|
+
};
|
|
152
|
+
const isFar = (i, ms) => estimate && Math.abs(ms - epochs[i]) > maxAgeMs;
|
|
153
|
+
/** A carried-far position that is down in the air or inside the Earth is no estimate (Earth radii). */
|
|
154
|
+
const tooLow = (x, y, z) => Math.hypot(x, y, z) < 1 + LOWEST_ESTIMATE_KM / EARTH_RADIUS_KM;
|
|
124
155
|
const pinned = new Float32Array(n * 3);
|
|
125
156
|
const pinOk = new Uint8Array(n);
|
|
126
157
|
// when each satellite was last pinned (NaN: never), so a group can be pinned a slice at a time and `arc` turns each from its own pin
|
|
@@ -148,14 +179,14 @@ export function createSatellites(sets, options = {}) {
|
|
|
148
179
|
if (skipEccentric && isEccentric[i] === 1)
|
|
149
180
|
continue;
|
|
150
181
|
const epoch = epochs[i];
|
|
151
|
-
if (
|
|
182
|
+
if (!usableAt(i, ms)) {
|
|
152
183
|
ok[i] = 0;
|
|
153
184
|
continue;
|
|
154
185
|
}
|
|
155
186
|
propagations += 1;
|
|
156
187
|
const result = sgp4(recs[i], (ms - epoch) / 60_000);
|
|
157
188
|
const p = result && result.position;
|
|
158
|
-
if (!p || !Number.isFinite(p.x)) {
|
|
189
|
+
if (!p || !Number.isFinite(p.x) || (isFar(i, ms) && tooLow(p.x / EARTH_RADIUS_KM, p.y / EARTH_RADIUS_KM, p.z / EARTH_RADIUS_KM))) {
|
|
159
190
|
ok[i] = 0;
|
|
160
191
|
continue;
|
|
161
192
|
}
|
|
@@ -170,12 +201,14 @@ export function createSatellites(sets, options = {}) {
|
|
|
170
201
|
};
|
|
171
202
|
const exactAt = (index, ms, out) => {
|
|
172
203
|
const epoch = epochs[index];
|
|
173
|
-
if (epoch === undefined ||
|
|
204
|
+
if (epoch === undefined || !usableAt(index, ms))
|
|
174
205
|
return false;
|
|
175
206
|
propagations += 1;
|
|
176
207
|
const result = sgp4(recs[index], (ms - epoch) / 60_000);
|
|
177
208
|
if (!result || !result.position || !result.velocity || !Number.isFinite(result.position.x))
|
|
178
209
|
return false;
|
|
210
|
+
if (isFar(index, ms) && tooLow(result.position.x / EARTH_RADIUS_KM, result.position.y / EARTH_RADIUS_KM, result.position.z / EARTH_RADIUS_KM))
|
|
211
|
+
return false;
|
|
179
212
|
out[0] = result.position.x / EARTH_RADIUS_KM;
|
|
180
213
|
out[1] = result.position.z / EARTH_RADIUS_KM;
|
|
181
214
|
out[2] = -result.position.y / EARTH_RADIUS_KM;
|
|
@@ -203,6 +236,24 @@ export function createSatellites(sets, options = {}) {
|
|
|
203
236
|
get placed() {
|
|
204
237
|
return placed;
|
|
205
238
|
},
|
|
239
|
+
get estimateFar() {
|
|
240
|
+
return estimate;
|
|
241
|
+
},
|
|
242
|
+
set estimateFar(value) {
|
|
243
|
+
if (value === estimate)
|
|
244
|
+
return;
|
|
245
|
+
estimate = value;
|
|
246
|
+
// what was placed was placed under the other rule: place everything again, and draw each satellite's look again
|
|
247
|
+
ready = false;
|
|
248
|
+
pinnedCount = 0;
|
|
249
|
+
pinMsOf.fill(Number.NaN);
|
|
250
|
+
dimmed.fill(0);
|
|
251
|
+
dimVersion += 1;
|
|
252
|
+
},
|
|
253
|
+
get estimatedCount() {
|
|
254
|
+
return estimatedCount;
|
|
255
|
+
},
|
|
256
|
+
estimated: (index) => dimmed[index] === 2 && shown[index] === 1,
|
|
206
257
|
pin(ms, first = 0, count = n) {
|
|
207
258
|
if (n === 0)
|
|
208
259
|
return;
|
|
@@ -232,7 +283,7 @@ export function createSatellites(sets, options = {}) {
|
|
|
232
283
|
let count = 0;
|
|
233
284
|
for (let i = 0; i < n; i += 1) {
|
|
234
285
|
const k = i * 3;
|
|
235
|
-
const dim = Math.abs(ms - epochs[i]) > dimAfterMs ? 1 : 0;
|
|
286
|
+
const dim = isFar(i, ms) ? 2 : Math.abs(ms - epochs[i]) > dimAfterMs ? 1 : 0;
|
|
236
287
|
if (dim !== dimmed[i]) {
|
|
237
288
|
dimmed[i] = dim;
|
|
238
289
|
dimVersion += 1;
|
|
@@ -298,6 +349,10 @@ export function createSatellites(sets, options = {}) {
|
|
|
298
349
|
count += 1;
|
|
299
350
|
}
|
|
300
351
|
placed = count;
|
|
352
|
+
estimatedCount = 0;
|
|
353
|
+
for (let i = 0; i < n; i += 1)
|
|
354
|
+
if (dimmed[i] === 2 && shown[i] === 1)
|
|
355
|
+
estimatedCount += 1;
|
|
301
356
|
return count;
|
|
302
357
|
},
|
|
303
358
|
setStep(ms) {
|
|
@@ -337,7 +392,7 @@ export function createSatellites(sets, options = {}) {
|
|
|
337
392
|
let count = 0;
|
|
338
393
|
for (let i = 0; i < n; i += 1) {
|
|
339
394
|
const k = i * 3;
|
|
340
|
-
const dim = Math.abs(ms - epochs[i]) > dimAfterMs ? 1 : 0;
|
|
395
|
+
const dim = isFar(i, ms) ? 2 : Math.abs(ms - epochs[i]) > dimAfterMs ? 1 : 0;
|
|
341
396
|
if (dim !== dimmed[i]) {
|
|
342
397
|
dimmed[i] = dim;
|
|
343
398
|
dimVersion += 1;
|
|
@@ -357,6 +412,10 @@ export function createSatellites(sets, options = {}) {
|
|
|
357
412
|
}
|
|
358
413
|
}
|
|
359
414
|
placed = count;
|
|
415
|
+
estimatedCount = 0;
|
|
416
|
+
for (let i = 0; i < n; i += 1)
|
|
417
|
+
if (dimmed[i] === 2 && shown[i] === 1)
|
|
418
|
+
estimatedCount += 1;
|
|
360
419
|
},
|
|
361
420
|
visible: (index) => shown[index] === 1,
|
|
362
421
|
exact: exactAt,
|
|
@@ -385,6 +444,8 @@ export function createSatellites(sets, options = {}) {
|
|
|
385
444
|
objectId: set.OBJECT_ID,
|
|
386
445
|
epochMs: epochs[index],
|
|
387
446
|
ageDays: (ms - epochs[index]) / DAY_MS,
|
|
447
|
+
estimated: isFar(index, ms),
|
|
448
|
+
estimatedDays: Math.abs(ms - epochs[index]) / DAY_MS,
|
|
388
449
|
altitudeKm: Math.hypot(one[0], one[1], one[2]) * EARTH_RADIUS_KM - EARTH_RADIUS_KM,
|
|
389
450
|
speedKmS: Math.hypot(one[3], one[4], one[5]),
|
|
390
451
|
periodMinutes: 1440 / set.MEAN_MOTION,
|