@johnmorrisdotca/chikyu-earth 0.33.2 → 0.34.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 +23 -5
- package/dist/cities/geometry.d.ts +233 -0
- package/dist/cities/geometry.js +174 -0
- package/dist/cities/host.d.ts +73 -0
- package/dist/cities/host.js +240 -0
- package/dist/element.d.ts +1 -1
- package/dist/element.js +2 -13
- package/dist/markers/index.d.ts +1 -0
- package/dist/markers/index.js +1 -0
- package/dist/markers/labels.d.ts +7 -1
- package/dist/markers/labels.js +12 -1
- package/dist/markers/place-layer.d.ts +43 -0
- package/dist/markers/place-layer.js +238 -0
- package/dist/markers/places.d.ts +279 -0
- package/dist/markers/places.js +213 -0
- package/dist/passes/element.js +2 -5
- package/dist/realistic/body-label.js +19 -11
- package/dist/realistic/element.d.ts +35 -0
- package/dist/realistic/element.js +94 -11
- package/dist/realistic/index.d.ts +2 -0
- package/dist/realistic/index.js +2 -0
- package/dist/satellites/index.d.ts +1 -0
- package/dist/satellites/index.js +1 -0
- package/dist/satellites/names.d.ts +14 -0
- package/dist/satellites/names.js +16 -0
- package/dist/space/element.d.ts +103 -1
- package/dist/space/element.js +219 -3
- package/dist/space/index.d.ts +3 -1
- package/dist/space/index.js +1 -0
- package/dist/space/satellite-layer.d.ts +26 -0
- package/dist/space/satellite-layer.js +37 -1
- package/dist/space/satellite-model.d.ts +72 -0
- package/dist/space/satellite-model.js +82 -0
- package/dist/space/scene.d.ts +42 -1
- package/dist/space/scene.js +152 -0
- package/package.json +7 -3
|
@@ -15,11 +15,15 @@ import { folderSource } from "../door/map.js";
|
|
|
15
15
|
import { ownCredit } from "../door/own.js";
|
|
16
16
|
import { BODY_LABEL_ATTRIBUTES, bodyLabelText, loadMichroma, readBodyLabel } from "./body-label.js";
|
|
17
17
|
import { createSkyHost, SKY_ATTRIBUTES, SKY_STYLE } from "../sky/host.js";
|
|
18
|
+
import { cleanPlaces, orthoView, readPlaces } from "../markers/places.js";
|
|
19
|
+
import { createPlaceLayer, PLACE_STYLE, readPlaceLook } from "../markers/place-layer.js";
|
|
20
|
+
import { CITY_NAMES_ATTRIBUTES, CITY_NAMES_STYLE, createCityHost } from "../cities/host.js";
|
|
21
|
+
import { project } from "../markers/project.js";
|
|
18
22
|
import { createGate, frameCap } from "./gate.js";
|
|
19
23
|
import { setSharedRenderer, setThreeLoader, takeRenderer } from "./shared.js";
|
|
20
24
|
export { setSharedRenderer, setThreeLoader };
|
|
21
25
|
import { MAX_TEXTURE, TIERS } from "./tiers.js";
|
|
22
|
-
const STYLE = ":host{display:block;aspect-ratio:1/1;position:relative}:host([immersive]){aspect-ratio:auto;width:100%;height:100%;touch-action:none!important;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}#stage,#overlay{position:absolute;inset:0}#overlay{pointer-events:none}" + SKY_STYLE + METEOR_NOTE_STYLE + NOTES_STYLE;
|
|
26
|
+
const STYLE = ":host{display:block;aspect-ratio:1/1;position:relative}:host([immersive]){aspect-ratio:auto;width:100%;height:100%;touch-action:none!important;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}#stage,#overlay{position:absolute;inset:0}#overlay{pointer-events:none}" + PLACE_STYLE + SKY_STYLE + CITY_NAMES_STYLE + METEOR_NOTE_STYLE + NOTES_STYLE;
|
|
23
27
|
const RAD = Math.PI / 180;
|
|
24
28
|
/** The Sun and the clouds are re-placed this often at real time: 15 degrees an hour is 0.25 degree a minute. */
|
|
25
29
|
const LIVE_TICK_MS = 60_000;
|
|
@@ -130,7 +134,7 @@ export const readTime = (value) => {
|
|
|
130
134
|
* ```
|
|
131
135
|
*/
|
|
132
136
|
export class ChikyuEarthRealistic extends HTMLElement {
|
|
133
|
-
static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, "air-thickness", "air-label", "lang"];
|
|
137
|
+
static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look"];
|
|
134
138
|
#model = newModel();
|
|
135
139
|
#mode = "now";
|
|
136
140
|
#view;
|
|
@@ -154,7 +158,12 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
154
158
|
#stage;
|
|
155
159
|
#overlay;
|
|
156
160
|
#pose = null;
|
|
161
|
+
/** The names of cities on the Earth (`city-names`), and the look of the names. */
|
|
162
|
+
#cities;
|
|
163
|
+
#citiesStyle = {};
|
|
157
164
|
#listeners = new Set();
|
|
165
|
+
#placeLayer;
|
|
166
|
+
#placeList = [];
|
|
158
167
|
#hands;
|
|
159
168
|
#reach = null;
|
|
160
169
|
/** 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. */
|
|
@@ -191,7 +200,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
191
200
|
if (!this.hasAttribute("aria-label"))
|
|
192
201
|
this.setAttribute("aria-label", "The Earth from space, with its sunlit and dark sides");
|
|
193
202
|
const root = this.shadowRoot ?? this.attachShadow({ mode: "open" });
|
|
194
|
-
root.innerHTML = `<div id="stage"></div><div id="overlay"></div><div id="notes"><p id="air-note" hidden></p><p id="meteor-note" hidden></p></div>`;
|
|
203
|
+
root.innerHTML = `<div id="stage"></div><div id="places"></div><div id="overlay"></div><div id="notes"><p id="air-note" hidden></p><p id="meteor-note" hidden></p></div>`;
|
|
195
204
|
adoptStyles(root, STYLE, this.nonce);
|
|
196
205
|
this.#stage = root.getElementById("stage");
|
|
197
206
|
this.#overlay = root.getElementById("overlay");
|
|
@@ -205,6 +214,17 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
205
214
|
loadFont: loadMichroma,
|
|
206
215
|
});
|
|
207
216
|
this.#sky.setStyle(this.#skyStyle);
|
|
217
|
+
this.#placeLayer = createPlaceLayer(root.getElementById("places"));
|
|
218
|
+
this.#placeList = readPlaces(this.getAttribute("places"));
|
|
219
|
+
this.#placeLayer.set(this.#placeList);
|
|
220
|
+
this.#placeLayer.look = readPlaceLook(this.getAttribute("places-look"));
|
|
221
|
+
this.#cities = createCityHost({
|
|
222
|
+
root,
|
|
223
|
+
attribute: (name) => this.getAttribute(name),
|
|
224
|
+
language: () => ((this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en"),
|
|
225
|
+
onError: (error) => this.dispatchEvent(new CustomEvent("chikyu-city-names-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
|
|
226
|
+
});
|
|
227
|
+
this.#cities.setStyle(this.#citiesStyle);
|
|
208
228
|
this.#played = false;
|
|
209
229
|
this.#model.meteors.on = this.#meteorsAsked();
|
|
210
230
|
this.#model.meteors.strength = readMeteorStrength(this.getAttribute("meteors-strength"));
|
|
@@ -252,6 +272,9 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
252
272
|
this.#pose = { ...pose, transform: "" };
|
|
253
273
|
for (const listener of this.#listeners)
|
|
254
274
|
listener(this.#pose);
|
|
275
|
+
if (this.#placeLayer && (this.#placeList.length > 0 || this.#placeLayer.stats.shown > 0))
|
|
276
|
+
this.#placeLayer.frame(orthoView(pose));
|
|
277
|
+
this.#cityFrame();
|
|
255
278
|
},
|
|
256
279
|
onSatellitesError: (error) => this.dispatchEvent(new CustomEvent("chikyu-satellites-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
|
|
257
280
|
onError: (error) => this.#fail(error instanceof Error ? error.message : String(error)),
|
|
@@ -279,7 +302,6 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
279
302
|
this.#hands = carryControls(this, { initial: this.#model.view, limits: LIMITS, onChange: (state, info) => this.setView(state, info.final) });
|
|
280
303
|
this.#startTick();
|
|
281
304
|
document.addEventListener("visibilitychange", this.#onVisible);
|
|
282
|
-
this.#locate();
|
|
283
305
|
}
|
|
284
306
|
disconnectedCallback() {
|
|
285
307
|
this.removeEventListener("pointerdown", this.#take);
|
|
@@ -303,6 +325,10 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
303
325
|
this.#taken = undefined;
|
|
304
326
|
this.#sky?.dispose();
|
|
305
327
|
this.#sky = undefined;
|
|
328
|
+
this.#placeLayer?.dispose();
|
|
329
|
+
this.#placeLayer = undefined;
|
|
330
|
+
this.#cities?.dispose();
|
|
331
|
+
this.#cities = undefined;
|
|
306
332
|
}
|
|
307
333
|
attributeChangedCallback(name, _old, value) {
|
|
308
334
|
if (name === "center")
|
|
@@ -344,12 +370,24 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
344
370
|
if (name === "lang") {
|
|
345
371
|
this.#applyBodyLabel();
|
|
346
372
|
this.#sky?.refresh();
|
|
373
|
+
this.#cities?.refresh();
|
|
347
374
|
}
|
|
348
375
|
}
|
|
349
376
|
else if (BODY_LABEL_ATTRIBUTES.includes(name))
|
|
350
377
|
this.#applyBodyLabel();
|
|
351
378
|
else if (SKY_ATTRIBUTES.includes(name))
|
|
352
379
|
this.#sky?.refresh();
|
|
380
|
+
else if (name === "places") {
|
|
381
|
+
this.#placeList = readPlaces(value);
|
|
382
|
+
this.#placeLayer?.set(this.#placeList);
|
|
383
|
+
this.#gate?.soon();
|
|
384
|
+
}
|
|
385
|
+
else if (name === "places-look" && this.#placeLayer) {
|
|
386
|
+
this.#placeLayer.look = readPlaceLook(value);
|
|
387
|
+
this.#gate?.soon();
|
|
388
|
+
}
|
|
389
|
+
else if (CITY_NAMES_ATTRIBUTES.includes(name))
|
|
390
|
+
this.#cities?.refresh();
|
|
353
391
|
if (name === "air-thickness" || name === "air-label" || name === "lang")
|
|
354
392
|
setAirNote(this.#airNote, this, this.#model.airThickness);
|
|
355
393
|
}
|
|
@@ -440,6 +478,56 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
440
478
|
this.#skyStyle = { ...value };
|
|
441
479
|
this.#sky?.setStyle(this.#skyStyle);
|
|
442
480
|
}
|
|
481
|
+
/**
|
|
482
|
+
* Places marked on the Earth (the attribute `places`, a JSON array): each `{ id, lon, lat, label, kind }`, `kind` being `here` (where the reader is: drawn bright and taller, with a quiet pulse) or `favourite`
|
|
483
|
+
* (the default: quieter). Each stands up out of the ground, turns with the Earth, is hidden on its far side and keeps its size in pixels at any zoom. Names go at the top, `here` first, and never overlap
|
|
484
|
+
* one another; one with no room is left out. The element stores nothing and sends nothing: the page hands the places over and keeps them where it likes. Setting the property writes the attribute; at most
|
|
485
|
+
* `MAX_PLACES` are drawn. Nothing is drawn again at rest: the pulse is the page's own animation, stopped out of sight and for a reader who asked for less motion.
|
|
486
|
+
*/
|
|
487
|
+
get places() {
|
|
488
|
+
return this.#placeList.map((place) => ({ ...place }));
|
|
489
|
+
}
|
|
490
|
+
set places(value) {
|
|
491
|
+
const clean = cleanPlaces(value);
|
|
492
|
+
if (clean.length === 0)
|
|
493
|
+
this.removeAttribute("places");
|
|
494
|
+
else
|
|
495
|
+
this.setAttribute("places", JSON.stringify(clean));
|
|
496
|
+
}
|
|
497
|
+
/** How the places are drawn (the attribute `places-look`): `beam` (a light rising out of the ground with a ring at its foot, the default), `pin` (a thin stick with a round head) or `ring` (only the ring on the ground). */
|
|
498
|
+
get placesLook() {
|
|
499
|
+
return this.#placeLayer?.look ?? readPlaceLook(this.getAttribute("places-look"));
|
|
500
|
+
}
|
|
501
|
+
set placesLook(value) {
|
|
502
|
+
this.setAttribute("places-look", value);
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* The look of the names of cities (`city-names`): font, size, weight, colour, the outline round the text, and the dot's colour and size. Any of them may be left out; the Earth's size, the language and the data are not set here.
|
|
506
|
+
*/
|
|
507
|
+
get cityNamesStyle() {
|
|
508
|
+
return { ...this.#citiesStyle };
|
|
509
|
+
}
|
|
510
|
+
set cityNamesStyle(value) {
|
|
511
|
+
this.#citiesStyle = { ...value };
|
|
512
|
+
this.#cities?.setStyle(this.#citiesStyle);
|
|
513
|
+
}
|
|
514
|
+
/** Tells the names of cities where the Earth is in the picture just drawn: the orthographic view the markers share. */
|
|
515
|
+
#cityFrame() {
|
|
516
|
+
const pose = this.#pose;
|
|
517
|
+
if (!this.#cities || !pose)
|
|
518
|
+
return;
|
|
519
|
+
this.#cities.frame({
|
|
520
|
+
width: pose.width,
|
|
521
|
+
height: pose.height,
|
|
522
|
+
radius: pose.radius,
|
|
523
|
+
project: (lon, lat, out) => {
|
|
524
|
+
const at = project(lon, lat, pose);
|
|
525
|
+
out.x = at.x;
|
|
526
|
+
out.y = at.y;
|
|
527
|
+
return at.z;
|
|
528
|
+
},
|
|
529
|
+
});
|
|
530
|
+
}
|
|
443
531
|
/** Puts the name's settings and text right from the attributes (`body-label` and its family, `lang`). */
|
|
444
532
|
#applyBodyLabel() {
|
|
445
533
|
this.#model.bodyLabel.settings = readBodyLabel((name) => this.getAttribute(name));
|
|
@@ -626,6 +714,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
626
714
|
meteors: { on: this.#model.meteors.on, strength: this.#model.meteors.strength, ...this.#model.meteors.drawn },
|
|
627
715
|
bodyLabel: { on: this.#model.bodyLabel.settings !== null, text: this.#model.bodyLabel.text, ...this.#model.bodyLabel.drawn },
|
|
628
716
|
sky: this.#sky?.stats ?? { on: false, loaded: false, names: 0, figures: 0, picked: null, renders: 0, lang: "", stars: [] },
|
|
717
|
+
places: { ...(this.#placeLayer?.stats ?? { places: 0, shown: 0, labels: 0, renders: 0 }) },
|
|
718
|
+
cityNames: this.#cities?.stats ?? { on: false, max: 0, radius: 0, tiers: [], cities: 0, names: 0, renders: 0 },
|
|
629
719
|
};
|
|
630
720
|
}
|
|
631
721
|
/**
|
|
@@ -842,13 +932,6 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
842
932
|
this.#set("unavailable");
|
|
843
933
|
this.dispatchEvent(new CustomEvent("chikyu-unavailable", { detail: { reason } }));
|
|
844
934
|
}
|
|
845
|
-
#locate() {
|
|
846
|
-
if (readCentre(this.getAttribute("center")) || typeof navigator === "undefined" || !navigator.geolocation)
|
|
847
|
-
return;
|
|
848
|
-
navigator.geolocation.getCurrentPosition((position) => {
|
|
849
|
-
this.centre = { lon: position.coords.longitude, lat: position.coords.latitude };
|
|
850
|
-
}, () => undefined, { timeout: 8000, maximumAge: 600000 });
|
|
851
|
-
}
|
|
852
935
|
}
|
|
853
936
|
if (typeof customElements !== "undefined" && !customElements.get("chikyu-earth-realistic")) {
|
|
854
937
|
customElements.define("chikyu-earth-realistic", ChikyuEarthRealistic);
|
|
@@ -9,3 +9,5 @@ export { BODY_LABEL_ATTRIBUTES, bodyLabelText, readBodyLabel, loadMichroma, setB
|
|
|
9
9
|
export { AIR_QUALITY, AIR_THICKNESS_DEFAULT, AIR_THICKNESS_MAX, AIR_TOP, AIR_VERT, airFor, airFrag, airTop, readAirThickness, type AirSamples } from "./air.ts";
|
|
10
10
|
export { AIR_NOTE } from "./air-note.ts";
|
|
11
11
|
export type { SkyLabelStyle } from "../sky/style.ts";
|
|
12
|
+
export { CITY_NAMES_DEFAULT, CITY_NAMES_MAX, TIER_RADIUS, cityNameText, cityRank, cityTiersFor, layoutCities, nameWidth, readCityNames, type CityFrame, type CityLayoutOptions, type CityName, type CityNameTier, type NamedCity } from "../cities/geometry.ts";
|
|
13
|
+
export { CITY_NAMES_ATTRIBUTES, type CityNamesStyle } from "../cities/host.ts";
|
package/dist/realistic/index.js
CHANGED
|
@@ -9,3 +9,5 @@ export { TILE_KEEP_MS, TILE_LIMIT } from "./tile-set.js";
|
|
|
9
9
|
export { BODY_LABEL_ATTRIBUTES, bodyLabelText, readBodyLabel, loadMichroma, setBodyLabelFontUrl } from "./body-label.js";
|
|
10
10
|
export { AIR_QUALITY, AIR_THICKNESS_DEFAULT, AIR_THICKNESS_MAX, AIR_TOP, AIR_VERT, airFor, airFrag, airTop, readAirThickness } from "./air.js";
|
|
11
11
|
export { AIR_NOTE } from "./air-note.js";
|
|
12
|
+
export { CITY_NAMES_DEFAULT, CITY_NAMES_MAX, TIER_RADIUS, cityNameText, cityRank, cityTiersFor, layoutCities, nameWidth, readCityNames } from "../cities/geometry.js";
|
|
13
|
+
export { CITY_NAMES_ATTRIBUTES } from "../cities/host.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { createSatellites, type SatellitesOptions } from "./track.ts";
|
|
2
2
|
export { DEFAULT_DIM_AFTER_DAYS, DEFAULT_MAX_AGE_DAYS, MAX_SATELLITE_SPEED } from "./limits.ts";
|
|
3
3
|
export type { ElementSet, RefusedElementSet, SatelliteInfo, SatelliteRef, Satellites } from "./types.ts";
|
|
4
|
+
export { SHORT_NAMES } from "./names.ts";
|
|
4
5
|
export { CATALOGUE, SATELLITE_GROUPS, catalogueEntry, findInCatalogue, type CatalogueEntry, type OrbitKind, type SatelliteGroupInfo } from "./catalogue.ts";
|
|
5
6
|
export { ElementSourceError, fetchElements, forgetElements, parseElements, type ElementFormat, type ElementSource, type FetchElementsOptions, type ParsedElements } from "./source.ts";
|
|
6
7
|
export { missionElements, missionOf, missionPosition, missions, type HubbleVisit, type Mission, type MissionFile, type MissionPosition, type Orbiter } from "./missions.ts";
|
package/dist/satellites/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// The satellites' pure parts: orbital elements in, positions out (SGP4 by satellite.js, an optional peer). They import on a server. The space view takes a group with `setSatellites`.
|
|
2
2
|
export { createSatellites } from "./track.js";
|
|
3
3
|
export { DEFAULT_DIM_AFTER_DAYS, DEFAULT_MAX_AGE_DAYS, MAX_SATELLITE_SPEED } from "./limits.js";
|
|
4
|
+
export { SHORT_NAMES } from "./names.js";
|
|
4
5
|
export { CATALOGUE, SATELLITE_GROUPS, catalogueEntry, findInCatalogue } from "./catalogue.js";
|
|
5
6
|
export { ElementSourceError, fetchElements, forgetElements, parseElements } from "./source.js";
|
|
6
7
|
export { missionElements, missionOf, missionPosition, missions } from "./missions.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The short names of the satellites the package knows by name, by NORAD number, in English and in Japanese: the ISS, Tiangong and Hubble.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { SHORT_NAMES } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
7
|
+
*
|
|
8
|
+
* console.log(SHORT_NAMES[48274]?.ja);
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare const SHORT_NAMES: Readonly<Record<number, {
|
|
12
|
+
en: string;
|
|
13
|
+
ja: string;
|
|
14
|
+
}>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The short names of the large satellites the package knows, in each language, for a label or a list: any other satellite is shown under the name in its elements. Pure.
|
|
2
|
+
/**
|
|
3
|
+
* The short names of the satellites the package knows by name, by NORAD number, in English and in Japanese: the ISS, Tiangong and Hubble.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { SHORT_NAMES } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
8
|
+
*
|
|
9
|
+
* console.log(SHORT_NAMES[48274]?.ja);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export const SHORT_NAMES = {
|
|
13
|
+
25544: { en: "ISS", ja: "ISS" },
|
|
14
|
+
48274: { en: "Tiangong", ja: "天宮" },
|
|
15
|
+
20580: { en: "Hubble", ja: "ハッブル" },
|
|
16
|
+
};
|
package/dist/space/element.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type ViewController } from "@johnmorrisdotca/kazoku-ui/view-controls";
|
|
|
2
2
|
import type { GeoPoint } from "../types.ts";
|
|
3
3
|
import { type BodyLabelSettings } from "../realistic/body-label.ts";
|
|
4
4
|
import type { SkyLabelStyle } from "../sky/style.ts";
|
|
5
|
+
import { type Place, type PlaceLook } from "../markers/places.ts";
|
|
6
|
+
import { type CityNamesStyle } from "../cities/host.ts";
|
|
5
7
|
import { setThreeLoader } from "../realistic/shared.ts";
|
|
6
8
|
import type { LightMode } from "../realistic/earth.ts";
|
|
7
9
|
import type { SatelliteInfo, SatelliteRef, Satellites } from "../satellites/types.ts";
|
|
@@ -9,7 +11,7 @@ import { type PlanetName } from "./ephemeris.ts";
|
|
|
9
11
|
import { type SatelliteStyle } from "./satellite-layer.ts";
|
|
10
12
|
import { type RideLook } from "./ride.ts";
|
|
11
13
|
import { type ScaleMode } from "./scale.ts";
|
|
12
|
-
import { BODY_NAMES, type CameraMode, type BodyName, type BodyPainter, type RideTarget } from "./scene.ts";
|
|
14
|
+
import { BODY_NAMES, type CameraMode, type BodyName, type BodyPainter, type RideTarget, type SatellitePainter } from "./scene.ts";
|
|
13
15
|
export { BODY_NAMES, type BodyName, type CameraMode, type RideTarget };
|
|
14
16
|
/**
|
|
15
17
|
* Change how the Sun and the planets are drawn (before the first element connects): the space view keeps their places, sizes, light, names and orbits and asks
|
|
@@ -26,6 +28,20 @@ export { BODY_NAMES, type BodyName, type CameraMode, type RideTarget };
|
|
|
26
28
|
* ```
|
|
27
29
|
*/
|
|
28
30
|
export declare function setBodyPainter(next: BodyPainter | undefined): void;
|
|
31
|
+
/**
|
|
32
|
+
* Where the 3D models of large satellites come from if the page has any: the package ships none. With a painter set, a satellite followed (`ride(ref, { view: "follow" })`) that the painter has a model for is drawn as that model, in the middle
|
|
33
|
+
* of the picture at a size that reads, pointed the way it flies, lit by the Sun; a satellite it has none for stays a dot. See `SatellitePainter`.
|
|
34
|
+
*
|
|
35
|
+
* @param next - The painter, or `undefined` for none.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts no-run
|
|
39
|
+
* import { setSatellitePainter } from "@johnmorrisdotca/chikyu-earth/space/element";
|
|
40
|
+
*
|
|
41
|
+
* setSatellitePainter({ has: (norad) => norad === 25544, make: async () => null });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function setSatellitePainter(next: SatellitePainter | undefined): void;
|
|
29
45
|
/**
|
|
30
46
|
* What a page can tell a reader about a body now.
|
|
31
47
|
*
|
|
@@ -180,6 +196,22 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
180
196
|
*/
|
|
181
197
|
get skyStyle(): Partial<SkyLabelStyle>;
|
|
182
198
|
set skyStyle(value: Partial<SkyLabelStyle>);
|
|
199
|
+
/**
|
|
200
|
+
* Places marked on the Earth (the attribute `places`, a JSON array): each `{ id, lon, lat, label, kind }`, `kind` being `here` (where the reader is: drawn bright and taller, with a quiet pulse) or `favourite`
|
|
201
|
+
* (the default: quieter). Each stands up out of the ground, turns with the Earth, is hidden on its far side and keeps its size in pixels at any zoom. Names go at the top, `here` first, and never overlap
|
|
202
|
+
* one another or the bodies' names; one with no room is left out. The element stores nothing and sends nothing: the page hands the places over and keeps them where it likes. Setting the property writes
|
|
203
|
+
* the attribute; at most `MAX_PLACES` are drawn. Nothing is drawn again at rest: the pulse is the page's own animation, stopped out of sight and for a reader who asked for less motion.
|
|
204
|
+
*/
|
|
205
|
+
get places(): Place[];
|
|
206
|
+
set places(value: readonly Place[]);
|
|
207
|
+
/** How the places are drawn (the attribute `places-look`): `beam` (a light rising out of the ground with a ring at its foot, the default), `pin` (a thin stick with a round head) or `ring` (only the ring on the ground). */
|
|
208
|
+
get placesLook(): PlaceLook;
|
|
209
|
+
set placesLook(value: PlaceLook);
|
|
210
|
+
/**
|
|
211
|
+
* The look of the names of cities (`city-names`): font, size, weight, colour, the outline round the text, and the dot's colour and size. Any of them may be left out; the Earth's size, the language and the data are not set here.
|
|
212
|
+
*/
|
|
213
|
+
get cityNamesStyle(): CityNamesStyle;
|
|
214
|
+
set cityNamesStyle(value: CityNamesStyle);
|
|
183
215
|
/**
|
|
184
216
|
* How many times its real thickness the air is drawn, from 1 (the true thickness) to 5 (the attribute `air-thickness`; 3 when the page says nothing): see `<chikyu-earth-realistic>`. While it is above 1 the element says so in a line
|
|
185
217
|
* under the picture (`air-label="off"` takes the line away, for a page that says it itself).
|
|
@@ -252,6 +284,25 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
252
284
|
* @param options - `view`, `look`, `distanceKm`, `smooth` (see `RideOptions`).
|
|
253
285
|
*/
|
|
254
286
|
ride(target: RideTarget | null, options?: RideOptions): void;
|
|
287
|
+
/**
|
|
288
|
+
* The satellites the page has a model for (`setSatellitePainter`) in the groups now set, each with its name in the page's language: the large satellites that can be followed as a model. Empty with no painter.
|
|
289
|
+
*/
|
|
290
|
+
largeSatellites(): {
|
|
291
|
+
ref: SatelliteRef;
|
|
292
|
+
noradId: number;
|
|
293
|
+
name: string;
|
|
294
|
+
}[];
|
|
295
|
+
/**
|
|
296
|
+
* Follow the next (or, with a negative `step`, the previous) of the large satellites in `largeSatellites()`, going round: the first when none is followed yet. The followed satellite stays in the middle of the picture, as a model where the page has one,
|
|
297
|
+
* with the Earth turning and sliding beneath. Returns the satellite now followed, or `null` when there is none to follow.
|
|
298
|
+
*
|
|
299
|
+
* @param step - How many places to hop: 1 (the default) is the next.
|
|
300
|
+
*/
|
|
301
|
+
followNext(step?: number): {
|
|
302
|
+
ref: SatelliteRef;
|
|
303
|
+
noradId: number;
|
|
304
|
+
name: string;
|
|
305
|
+
} | null;
|
|
255
306
|
/** What the camera is riding along with now, or null. */
|
|
256
307
|
get riding(): Riding | null;
|
|
257
308
|
/**
|
|
@@ -276,6 +327,32 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
276
327
|
selectSatellite(ref: SatelliteRef | null): void;
|
|
277
328
|
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
278
329
|
get selectedSatellite(): SatelliteRef | null;
|
|
330
|
+
/**
|
|
331
|
+
* Ring and name every satellite of a group (or stop): a ring round each and its name beside it, in the page's language (the ISS, Tiangong and Hubble by their short names, the rest as their elements name them, or as `satelliteNames` says), never over another name, a place's or a ring's.
|
|
332
|
+
* Names and rings are drawn with the places, only for satellites that are in the picture and not behind the Earth, and nothing is drawn at rest. `chikyu-satellite-visibility` is sent with `detail: { ref, visible }` when a labelled satellite comes into view or goes out of it (not at every frame).
|
|
333
|
+
* At most 80 satellites are ringed, over all the groups. A group that is not set, or is not shown, has none.
|
|
334
|
+
*
|
|
335
|
+
* @param group - The group's name, as given to `setSatellites`.
|
|
336
|
+
* @param on - `true` to ring and name its members (the default), `false` to stop.
|
|
337
|
+
*/
|
|
338
|
+
labelSatellites(group: string, on?: boolean): void;
|
|
339
|
+
/** The groups whose satellites are ringed and named now (`labelSatellites`). */
|
|
340
|
+
get labelledSatellites(): string[];
|
|
341
|
+
/**
|
|
342
|
+
* The names written beside the ringed satellites, by NORAD number, for a page in another language or with names of its own (`{ 25544: "Space Station" }`). One left out keeps its short name (the ISS, Tiangong and Hubble) or the name in its elements.
|
|
343
|
+
*/
|
|
344
|
+
get satelliteNames(): Record<number, string>;
|
|
345
|
+
set satelliteNames(value: Record<number, string>);
|
|
346
|
+
/**
|
|
347
|
+
* Where a satellite is on the screen as of the last draw: `{ x, y, visible, heightKm }` in CSS pixels from the view's top left, `visible` meaning it is inside the box and not behind the Earth. `null` when its group is not set or not shown, it cannot be
|
|
348
|
+
* placed (its elements are too old), or it is behind the camera. It is the picture's own camera maths and its own test for the Earth in the way, so a page that draws its own rings need not repeat either.
|
|
349
|
+
*/
|
|
350
|
+
placeSatellite(ref: SatelliteRef): {
|
|
351
|
+
x: number;
|
|
352
|
+
y: number;
|
|
353
|
+
visible: boolean;
|
|
354
|
+
heightKm: number;
|
|
355
|
+
} | null;
|
|
279
356
|
/** Facts about one satellite at the moment shown (name, number, element age, height, speed, period); undefined if it cannot be placed then. */
|
|
280
357
|
satelliteInfo(ref: SatelliteRef): SatelliteInfo | undefined;
|
|
281
358
|
/** The words shown beside each body, for a page in another language (`{ Mars: "火星" }`). A body left out keeps its English name. */
|
|
@@ -356,6 +433,31 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
356
433
|
y: number;
|
|
357
434
|
}[];
|
|
358
435
|
};
|
|
436
|
+
/** The followed satellite's model (`setSatellitePainter`), when one is drawn: where its middle is on the screen, in CSS pixels, as of the last draw; `null` otherwise. */
|
|
437
|
+
followModel: {
|
|
438
|
+
x: number;
|
|
439
|
+
y: number;
|
|
440
|
+
shown: boolean;
|
|
441
|
+
} | null;
|
|
442
|
+
/** The places: how many were handed over, how many are drawn and named at the last draw, and how many times they were laid out. */
|
|
443
|
+
places: {
|
|
444
|
+
places: number;
|
|
445
|
+
shown: number;
|
|
446
|
+
labels: number;
|
|
447
|
+
renders: number;
|
|
448
|
+
rings: number;
|
|
449
|
+
satelliteNames: number;
|
|
450
|
+
};
|
|
451
|
+
/** The names of cities: whether `city-names` is set and the most it asks for, the Earth's radius on the screen, the tiers of kuni's cities that have arrived and how many cities, the names shown at the last draw and how many times the layer was drawn. */
|
|
452
|
+
cityNames: {
|
|
453
|
+
on: boolean;
|
|
454
|
+
max: number;
|
|
455
|
+
radius: number;
|
|
456
|
+
tiers: string[];
|
|
457
|
+
cities: number;
|
|
458
|
+
names: number;
|
|
459
|
+
renders: number;
|
|
460
|
+
};
|
|
359
461
|
};
|
|
360
462
|
}
|
|
361
463
|
declare global {
|