@johnmorrisdotca/chikyu-earth 0.42.0 → 0.45.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 +17 -0
- package/NOTICE.md +15 -5
- package/README.md +4 -4
- package/dist/door/map.js +5 -1
- package/dist/element.d.ts +30 -0
- package/dist/element.js +82 -2
- package/dist/markers/here-city-host.d.ts +3 -1
- package/dist/markers/here-city-host.js +67 -5
- package/dist/markers/here-city.d.ts +94 -1
- package/dist/markers/here-city.js +69 -1
- package/dist/markers/index.d.ts +1 -1
- package/dist/markers/index.js +1 -1
- package/dist/realistic/element-base.d.ts +44 -1
- package/dist/realistic/element-base.js +128 -16
- package/dist/realistic/index.d.ts +1 -0
- package/dist/realistic/index.js +1 -0
- package/dist/realistic/zoom-reach.d.ts +29 -0
- package/dist/realistic/zoom-reach.js +30 -0
- package/dist/satellites/catalogue.d.ts +52 -1
- package/dist/satellites/catalogue.js +96 -5
- package/dist/satellites/index.d.ts +1 -1
- package/dist/satellites/index.js +1 -1
- package/dist/sea-names/features.d.ts +12 -0
- package/dist/sea-names/features.js +46 -0
- package/dist/sea-names/geometry.d.ts +121 -0
- package/dist/sea-names/geometry.js +135 -0
- package/dist/sea-names/host.d.ts +46 -0
- package/dist/sea-names/host.js +111 -0
- package/dist/space/element-base.d.ts +58 -11
- package/dist/space/element-base.js +153 -13
- package/dist/space/generic-satellite.d.ts +46 -0
- package/dist/space/generic-satellite.js +96 -0
- package/dist/space/index.d.ts +2 -1
- package/dist/space/index.js +2 -1
- package/dist/space/ride.d.ts +45 -0
- package/dist/space/ride.js +38 -0
- package/dist/space/satellite-focus.d.ts +90 -0
- package/dist/space/satellite-focus.js +109 -0
- package/dist/space/satellite-layer.d.ts +32 -3
- package/dist/space/satellite-layer.js +95 -29
- package/dist/space/scene.d.ts +3 -1
- package/dist/space/scene.js +54 -25
- package/package.json +3 -3
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// The nearest city's name on a "you are here" marker. Pure: kuni does the lookup (`CitySet.nearest`); this only decides which places are named, in which language, and how far is too far.
|
|
2
|
+
import { greatCircleKm } from "../route.js";
|
|
1
3
|
/**
|
|
2
4
|
* How far, in kilometres, a `here` marker looks for a city when `here-city` is set with no number.
|
|
3
5
|
*
|
|
@@ -21,7 +23,7 @@ export const HERE_CITY_KM = 100;
|
|
|
21
23
|
*/
|
|
22
24
|
export const HERE_CITY_MAX_KM = 20_000;
|
|
23
25
|
/**
|
|
24
|
-
* The kuni tiers a `here` marker
|
|
26
|
+
* The kuni tiers a `here` marker looks through first. A smaller town is read afterwards from that city's country, one country file at a time.
|
|
25
27
|
*
|
|
26
28
|
* @example
|
|
27
29
|
* ```ts
|
|
@@ -105,3 +107,69 @@ export function hereCityLabels(places, source, options) {
|
|
|
105
107
|
}
|
|
106
108
|
return out;
|
|
107
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* At most two countries to read for a place. The first is the country of the nearest city in the three tiers, however far.
|
|
112
|
+
* The second is added only when a city of another country is also inside the limit: a place near a border. `src/countries.ts` has no point-in-country test, so the country comes from those cities.
|
|
113
|
+
*
|
|
114
|
+
* @param point - The place.
|
|
115
|
+
* @param source - The three tiers.
|
|
116
|
+
* @param maxKm - The limit, in kilometres.
|
|
117
|
+
* @returns ISO codes, upper case, at most two.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* import { hereCountries } from "@johnmorrisdotca/chikyu-earth/markers";
|
|
122
|
+
*
|
|
123
|
+
* const source = {
|
|
124
|
+
* nearest: () => ({ city: { id: "a", name: { en: "A" }, country: "fr" }, km: 30 }),
|
|
125
|
+
* within: () => [{ city: { country: "fr" }, km: 30 }, { city: { country: "de" }, km: 40 }],
|
|
126
|
+
* };
|
|
127
|
+
* console.log(hereCountries({ lat: 49, lon: 8 }, source, 100).join(" "));
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export function hereCountries(point, source, maxKm) {
|
|
131
|
+
const nearest = source.nearest(point);
|
|
132
|
+
const first = nearest?.city.country?.trim().toUpperCase();
|
|
133
|
+
if (!first)
|
|
134
|
+
return [];
|
|
135
|
+
const out = [first];
|
|
136
|
+
for (const hit of source.within?.(point, maxKm) ?? []) {
|
|
137
|
+
const code = hit.city.country?.trim().toUpperCase();
|
|
138
|
+
if (code && code !== first) {
|
|
139
|
+
out.push(code);
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return out;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The city to draw: the nearest of the coarse hit and the towns, and only when it is within `maxKm`. A town closer than the big city wins.
|
|
147
|
+
*
|
|
148
|
+
* @param point - The place.
|
|
149
|
+
* @param coarse - The nearest city of the three tiers inside the limit, or null.
|
|
150
|
+
* @param towns - The cities of the one or two countries read for this place.
|
|
151
|
+
* @param maxKm - The limit, in kilometres.
|
|
152
|
+
* @returns The city and its distance, or null when none is close enough.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* import { chooseHereCity } from "@johnmorrisdotca/chikyu-earth/markers";
|
|
157
|
+
*
|
|
158
|
+
* const town = { id: "v", name: { en: "Village" }, lat: 0.05, lon: 0 };
|
|
159
|
+
* const chosen = chooseHereCity({ lat: 0, lon: 0 }, { city: { id: "c", name: { en: "City" } }, km: 40 }, [town], 100);
|
|
160
|
+
* console.log(chosen?.id);
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export function chooseHereCity(point, coarse, towns, maxKm) {
|
|
164
|
+
if (!(maxKm > 0))
|
|
165
|
+
return null;
|
|
166
|
+
let best = coarse && coarse.km <= maxKm ? { id: coarse.city.id, name: coarse.city.name, km: coarse.km } : null;
|
|
167
|
+
for (const town of towns) {
|
|
168
|
+
const km = greatCircleKm({ lon: point.lon, lat: point.lat }, { lon: town.lon, lat: town.lat });
|
|
169
|
+
if (km === null || km > maxKm)
|
|
170
|
+
continue;
|
|
171
|
+
if (!best || km < best.km - 1e-6)
|
|
172
|
+
best = { id: town.id, name: town.name, km };
|
|
173
|
+
}
|
|
174
|
+
return best;
|
|
175
|
+
}
|
package/dist/markers/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export { clusterPoints, type Cluster } from "./cluster.ts";
|
|
|
4
4
|
export { placeLabels, type LabelItem, type Placement } from "./labels.ts";
|
|
5
5
|
export type { GroupInfo, MarkerEventDetail, MarkerIcon, MarkerInput } from "./types.ts";
|
|
6
6
|
export { cleanPlaces, groupCell, groupPlaces, layoutPlaces, MAX_PLACES, nearby, orthoView, PLACE_GROUP_PX, PLACE_LOOKS, readPlaceGroups, readPlaces, type Place, type PlaceGroup, type PlaceKind, type PlaceLabelSpot, type PlaceLayout, type PlaceLayoutOptions, type PlaceLook, type PlaceShape, type PlaceView, type SurfacePoint } from "./places.ts";
|
|
7
|
-
export { HERE_CITY_KM, HERE_CITY_MAX_KM, HERE_CITY_TIERS, hereCityLabels, readHereCity, type HereCityHit, type HereCitySource } from "./here-city.ts";
|
|
7
|
+
export { HERE_CITY_KM, HERE_CITY_MAX_KM, HERE_CITY_TIERS, chooseHereCity, hereCityLabels, hereCountries, readHereCity, type HereCityHit, type HereCitySource, type HereTown } from "./here-city.ts";
|
|
8
8
|
export { PLACE_DOTS, PLACE_MARKS } from "./place-layer.ts";
|
package/dist/markers/index.js
CHANGED
|
@@ -5,5 +5,5 @@ export { project, projectAll, canvasRatio } from "./project.js";
|
|
|
5
5
|
export { clusterPoints } from "./cluster.js";
|
|
6
6
|
export { placeLabels } from "./labels.js";
|
|
7
7
|
export { cleanPlaces, groupCell, groupPlaces, layoutPlaces, MAX_PLACES, nearby, orthoView, PLACE_GROUP_PX, PLACE_LOOKS, readPlaceGroups, readPlaces } from "./places.js";
|
|
8
|
-
export { HERE_CITY_KM, HERE_CITY_MAX_KM, HERE_CITY_TIERS, hereCityLabels, readHereCity } from "./here-city.js";
|
|
8
|
+
export { HERE_CITY_KM, HERE_CITY_MAX_KM, HERE_CITY_TIERS, chooseHereCity, hereCityLabels, hereCountries, readHereCity } from "./here-city.js";
|
|
9
9
|
export { PLACE_DOTS, PLACE_MARKS } from "./place-layer.js";
|
|
@@ -4,6 +4,7 @@ import { type CameraMode, type LightMode } from "./earth.ts";
|
|
|
4
4
|
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
|
+
import { type SatelliteOthers } from "../space/satellite-focus.ts";
|
|
7
8
|
import type { Credit, DataSource } from "../data-door.ts";
|
|
8
9
|
import { type BodyLabelSettings } from "./body-label.ts";
|
|
9
10
|
import type { SkyKeepClear } from "../sky/keep-clear.ts";
|
|
@@ -15,6 +16,7 @@ import type { BorderData, BorderStats } from "../borders/layer.ts";
|
|
|
15
16
|
import { type RouteLeg } from "../route.ts";
|
|
16
17
|
import type { GridStats } from "../grid/layer.ts";
|
|
17
18
|
import { type CountryNamesStats, type CountryNamesStyle } from "../country-names/host.ts";
|
|
19
|
+
import { type SeaNamesStats } from "../sea-names/host.ts";
|
|
18
20
|
import { setSharedRenderer, setThreeLoader } from "./shared.ts";
|
|
19
21
|
export { setSharedRenderer, setThreeLoader };
|
|
20
22
|
export type { CameraMode };
|
|
@@ -270,6 +272,21 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
270
272
|
*/
|
|
271
273
|
get countryNamesStyle(): CountryNamesStyle;
|
|
272
274
|
set countryNamesStyle(value: CountryNamesStyle);
|
|
275
|
+
/**
|
|
276
|
+
* Names of oceans, seas and continents (the attribute `sea-names`). Off unless set: a bare attribute is on. Oceans and continents from far out, seas once the Earth is large on the screen. A city name keeps the space where both fit only one. Nothing is drawn again at rest.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts no-run
|
|
280
|
+
* import type { ChikyuEarthRealistic } from "@johnmorrisdotca/chikyu-earth/realistic/element";
|
|
281
|
+
*
|
|
282
|
+
* const earth = document.querySelector("chikyu-earth-realistic") as ChikyuEarthRealistic;
|
|
283
|
+
* earth.seaNames = true;
|
|
284
|
+
* console.log(earth.seaNames);
|
|
285
|
+
* earth.seaNames = false;
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
get seaNames(): boolean;
|
|
289
|
+
set seaNames(value: boolean);
|
|
273
290
|
/**
|
|
274
291
|
* Which borders are drawn (the attribute `borders`): the countries' at any size, and the regions' (provinces, states, prefectures) once the Earth is large enough on the screen to tell them apart.
|
|
275
292
|
* Setting it writes the attribute: both sets as `borders="countries regions"`, one as its own word, none takes the attribute away.
|
|
@@ -430,6 +447,8 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
430
447
|
};
|
|
431
448
|
/** The names of countries: whether `country-names` is set and the most it asks for, the countries loaded, the names shown at the last draw, how many times they were laid out, and whether the outlines could not be loaded. */
|
|
432
449
|
countryNames: CountryNamesStats;
|
|
450
|
+
/** The names of oceans, seas and continents: whether `sea-names` is on, the Earth's radius on the screen, the names shown at the last draw, and how many times the layer was laid out. */
|
|
451
|
+
seaNames: SeaNamesStats;
|
|
433
452
|
};
|
|
434
453
|
/**
|
|
435
454
|
* Apply a shared view controller's camera (yaw, tilt, zoom, pan). A change under half a pixel is not drawn, a settled change always is,
|
|
@@ -462,12 +481,36 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
462
481
|
setSatellites(group: string, satellites: Satellites | null, style?: Partial<SatelliteStyle>): void;
|
|
463
482
|
/** Show or hide a group without losing it. */
|
|
464
483
|
showSatellites(group: string, on: boolean): void;
|
|
465
|
-
/**
|
|
484
|
+
/**
|
|
485
|
+
* The groups now set. `count` is how many satellites the group holds, `visible` is the shown state from `showSatellites` (a focus does not change it), `placed` is how many the last draw placed (0 when the group is not drawn) and `emphasis` is how a focus treats it: `focus`, `dim`, `hidden` or `plain` (no focus).
|
|
486
|
+
*/
|
|
466
487
|
get satelliteGroups(): {
|
|
467
488
|
name: string;
|
|
468
489
|
count: number;
|
|
469
490
|
visible: boolean;
|
|
491
|
+
placed: number;
|
|
492
|
+
emphasis: "focus" | "dim" | "hidden" | "plain";
|
|
470
493
|
}[];
|
|
494
|
+
/** The group `focusSatelliteGroup` is showing on its own, or `null`. */
|
|
495
|
+
get focusedSatelliteGroup(): string | null;
|
|
496
|
+
/**
|
|
497
|
+
* Show one group on its own. The others are drawn dimmer (`others: "dim"`, the default, through the same dimming an old element set uses) or not drawn (`"hide"`). `frame` (true by default) pulls the camera back, by this view's own zoom, until the group's orbits fit: the distance is the greatest apogee of the group, from each satellite's mean motion and eccentricity, and it stops at 8 Earth radii. `null` puts every group back to the shown state it had, and puts the camera back when it was moved. A name that `setSatellites` has not set returns `{ ok: false, reason: "not-set" }` and changes nothing. It does not throw. When the choice changes, `chikyu-satellite-focus` is sent with `{ group, count }`.
|
|
498
|
+
*
|
|
499
|
+
* @param name - The group's name, or `null` to clear the focus.
|
|
500
|
+
* @param options - `others` and `frame`.
|
|
501
|
+
* @returns `{ ok: true, group, count }` when the group is set (`group` is `null` and `count` is 0 when cleared). `{ ok: false, reason: "not-set" }` when it is not.
|
|
502
|
+
*/
|
|
503
|
+
focusSatelliteGroup(name: string | null, options?: {
|
|
504
|
+
others?: SatelliteOthers;
|
|
505
|
+
frame?: boolean;
|
|
506
|
+
}): {
|
|
507
|
+
ok: true;
|
|
508
|
+
group: string | null;
|
|
509
|
+
count: number;
|
|
510
|
+
} | {
|
|
511
|
+
ok: false;
|
|
512
|
+
reason: "not-set";
|
|
513
|
+
};
|
|
471
514
|
/** Mark one satellite: a larger ring round it and its orbit drawn. `null` lets it go. */
|
|
472
515
|
selectSatellite(ref: SatelliteRef | null): void;
|
|
473
516
|
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
@@ -9,6 +9,7 @@ import { NOTES_STYLE, setAirNote } from "./air-note.js";
|
|
|
9
9
|
import { cameraCentre, createEarthItem, discRadius, lookAt, newModel } from "./earth.js";
|
|
10
10
|
import { createPaintState, paintedGround, paintedPeriod } from "../paint/buffer.js";
|
|
11
11
|
import { MAX_ORBIT_GROUP } from "../space/satellite-layer.js";
|
|
12
|
+
import { applySatelliteFocus, satelliteEmphasis, satelliteGroupRows, shellRadiusOf, zoomForOrthographicShell } from "../space/satellite-focus.js";
|
|
12
13
|
import { readMeteorStrength } from "../meteors/strength.js";
|
|
13
14
|
import { METEOR_NOTE_STYLE, prefersLessMotion, setMeteorNote } from "../meteors/note.js";
|
|
14
15
|
import { createDoorHost } from "../door/host.js";
|
|
@@ -30,11 +31,14 @@ import { readRoute, routeLeg, routeText } from "../route.js";
|
|
|
30
31
|
import { applyRoute } from "../route/layer.js";
|
|
31
32
|
import { COUNTRY_NAMES_ATTRIBUTES } from "../country-names/geometry.js";
|
|
32
33
|
import { COUNTRY_NAMES_STYLE, createCountryHost } from "../country-names/host.js";
|
|
34
|
+
import { SEA_NAMES_ATTRIBUTES, readSeaNames } from "../sea-names/geometry.js";
|
|
35
|
+
import { SEA_NAMES_STYLE, createSeaHost } from "../sea-names/host.js";
|
|
33
36
|
import { createGate, frameCap } from "./gate.js";
|
|
34
37
|
import { setSharedRenderer, setThreeLoader, takeRenderer } from "./shared.js";
|
|
35
38
|
export { setSharedRenderer, setThreeLoader };
|
|
36
39
|
import { MAX_TEXTURE, TIERS } from "./tiers.js";
|
|
37
|
-
|
|
40
|
+
import { mayWriteZoomMax, raisedZoomMax } from "./zoom-reach.js";
|
|
41
|
+
const STYLE = ":host{display:block;aspect-ratio:1/1;position:relative;isolation:isolate}" + IMMERSIVE_STYLE + "#stage,#overlay{position:absolute;inset:0}#overlay{pointer-events:none}" + PLACE_STYLE + SKY_STYLE + COUNTRY_NAMES_STYLE + SEA_NAMES_STYLE + CITY_NAMES_STYLE + METEOR_NOTE_STYLE + NOTES_STYLE;
|
|
38
42
|
const RAD = Math.PI / 180;
|
|
39
43
|
/** The Sun and the clouds are re-placed this often at real time: 15 degrees an hour is 0.25 degree a minute. */
|
|
40
44
|
const LIVE_TICK_MS = 60_000;
|
|
@@ -45,8 +49,6 @@ const TIME_EVENT_MS = 250;
|
|
|
45
49
|
const SUN_RATE = 360 / 86_400;
|
|
46
50
|
/** Tilt to the poles; zoom from a tenth of Fit, which leaves the whole Earth small in the view, to 5 times: the package's own pictures are sharp to about 5 times. */
|
|
47
51
|
const LIMITS = { tiltMax: 90, zoomMin: 0.1, zoomMax: 5 };
|
|
48
|
-
/** With the finer tiles the detail runs 4 times further: the finest level is 4 times wider than the widest picture. */
|
|
49
|
-
const TILES_ZOOM_MAX = "20";
|
|
50
52
|
const readCentre = (value) => {
|
|
51
53
|
if (!value)
|
|
52
54
|
return null;
|
|
@@ -158,7 +160,7 @@ export const readTime = (value) => {
|
|
|
158
160
|
* ```
|
|
159
161
|
*/
|
|
160
162
|
export class ChikyuEarthRealistic extends HTMLElement {
|
|
161
|
-
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, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint"];
|
|
163
|
+
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, ...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"];
|
|
162
164
|
#model = newModel();
|
|
163
165
|
#paint = createPaintState();
|
|
164
166
|
#mode = "now";
|
|
@@ -188,6 +190,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
188
190
|
#citiesStyle = {};
|
|
189
191
|
/** The names of the countries on the Earth (`country-names`), and the look of the names. */
|
|
190
192
|
#countries;
|
|
193
|
+
#seas;
|
|
191
194
|
#countriesStyle = {};
|
|
192
195
|
#listeners = new Set();
|
|
193
196
|
#placeLayer;
|
|
@@ -199,6 +202,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
199
202
|
/** Counts the turns to a place, so a new one stops the one before. */
|
|
200
203
|
#placeGlide = 0;
|
|
201
204
|
#hands;
|
|
205
|
+
/** The view from before a satellite group was framed, put back when the focus is cleared. */
|
|
206
|
+
#focusView = null;
|
|
202
207
|
#reach = null;
|
|
203
208
|
/** 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. */
|
|
204
209
|
#played = false;
|
|
@@ -276,6 +281,11 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
276
281
|
onError: (error) => this.dispatchEvent(new CustomEvent("chikyu-country-names-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
|
|
277
282
|
});
|
|
278
283
|
this.#countries.setStyle(this.#countriesStyle);
|
|
284
|
+
this.#seas = createSeaHost({
|
|
285
|
+
root,
|
|
286
|
+
attribute: (name) => this.getAttribute(name),
|
|
287
|
+
language: () => ((this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en"),
|
|
288
|
+
});
|
|
279
289
|
this.#played = false;
|
|
280
290
|
this.#model.meteors.on = this.#meteorsAsked();
|
|
281
291
|
this.#model.meteors.strength = readMeteorStrength(this.getAttribute("meteors-strength"));
|
|
@@ -303,11 +313,12 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
303
313
|
cap: () => this.#textureCap(),
|
|
304
314
|
sources: () => this.#tileSources(),
|
|
305
315
|
onTiles: (layers) => {
|
|
306
|
-
if (
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
316
|
+
if (mayWriteZoomMax(this.getAttribute("zoom-max"), this.#reach)) {
|
|
317
|
+
// only ever raised, and lowered when the tiles are taken away (below), not before
|
|
318
|
+
const reach = raisedZoomMax(this.#reach, layers);
|
|
319
|
+
this.#reach = reach;
|
|
320
|
+
if (this.getAttribute("zoom-max") !== reach)
|
|
321
|
+
this.setAttribute("zoom-max", reach);
|
|
311
322
|
}
|
|
312
323
|
this.dispatchEvent(new CustomEvent("chikyu-tiles", { detail: { layers } }));
|
|
313
324
|
},
|
|
@@ -403,6 +414,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
403
414
|
this.#cities = undefined;
|
|
404
415
|
this.#countries?.dispose();
|
|
405
416
|
this.#countries = undefined;
|
|
417
|
+
this.#seas?.dispose();
|
|
418
|
+
this.#seas = undefined;
|
|
406
419
|
}
|
|
407
420
|
attributeChangedCallback(name, _old, value) {
|
|
408
421
|
if (name === "center")
|
|
@@ -445,6 +458,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
445
458
|
this.#applyBodyLabel();
|
|
446
459
|
this.#sky?.refresh();
|
|
447
460
|
this.#cities?.refresh();
|
|
461
|
+
this.#seas?.refresh();
|
|
448
462
|
this.#countries?.refresh();
|
|
449
463
|
this.#here?.refresh();
|
|
450
464
|
}
|
|
@@ -475,6 +489,11 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
475
489
|
}
|
|
476
490
|
else if (CITY_NAMES_ATTRIBUTES.includes(name))
|
|
477
491
|
this.#cities?.refresh();
|
|
492
|
+
else if (SEA_NAMES_ATTRIBUTES.includes(name)) {
|
|
493
|
+
this.#seas?.refresh();
|
|
494
|
+
this.#seaFrame();
|
|
495
|
+
this.#countryFrame();
|
|
496
|
+
}
|
|
478
497
|
else if (name === "borders") {
|
|
479
498
|
Object.assign(this.#model.borders, readBorders(value));
|
|
480
499
|
this.#gate?.soon();
|
|
@@ -795,6 +814,28 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
795
814
|
this.#countriesStyle = { ...value };
|
|
796
815
|
this.#countries?.setStyle(this.#countriesStyle);
|
|
797
816
|
}
|
|
817
|
+
/**
|
|
818
|
+
* Names of oceans, seas and continents (the attribute `sea-names`). Off unless set: a bare attribute is on. Oceans and continents from far out, seas once the Earth is large on the screen. A city name keeps the space where both fit only one. Nothing is drawn again at rest.
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* ```ts no-run
|
|
822
|
+
* import type { ChikyuEarthRealistic } from "@johnmorrisdotca/chikyu-earth/realistic/element";
|
|
823
|
+
*
|
|
824
|
+
* const earth = document.querySelector("chikyu-earth-realistic") as ChikyuEarthRealistic;
|
|
825
|
+
* earth.seaNames = true;
|
|
826
|
+
* console.log(earth.seaNames);
|
|
827
|
+
* earth.seaNames = false;
|
|
828
|
+
* ```
|
|
829
|
+
*/
|
|
830
|
+
get seaNames() {
|
|
831
|
+
return readSeaNames(this.getAttribute("sea-names"));
|
|
832
|
+
}
|
|
833
|
+
set seaNames(value) {
|
|
834
|
+
if (value)
|
|
835
|
+
this.setAttribute("sea-names", "");
|
|
836
|
+
else
|
|
837
|
+
this.removeAttribute("sea-names");
|
|
838
|
+
}
|
|
798
839
|
/**
|
|
799
840
|
* Which borders are drawn (the attribute `borders`): the countries' at any size, and the regions' (provinces, states, prefectures) once the Earth is large enough on the screen to tell them apart.
|
|
800
841
|
* Setting it writes the attribute: both sets as `borders="countries regions"`, one as its own word, none takes the attribute away.
|
|
@@ -847,6 +888,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
847
888
|
#relayNames(cities, sky) {
|
|
848
889
|
if (cities && this.#nameFrame)
|
|
849
890
|
this.#cities?.frame(this.#nameFrame, this.#boxesBeforeCities());
|
|
891
|
+
this.#seaFrame();
|
|
850
892
|
this.#countryFrame();
|
|
851
893
|
if (sky)
|
|
852
894
|
this.#sky?.relayout();
|
|
@@ -869,17 +911,24 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
869
911
|
out.push(...(this.#placeLayer?.boxes ?? []));
|
|
870
912
|
for (const boxes of this.#claims.values())
|
|
871
913
|
out.push(...boxes);
|
|
872
|
-
out.push(...(this.#cities?.boxes ?? []));
|
|
914
|
+
out.push(...(this.#cities?.boxes ?? []), ...(this.#seas?.boxes ?? []));
|
|
873
915
|
return out;
|
|
874
916
|
}
|
|
875
917
|
/** The frame the names were last laid out on. */
|
|
876
918
|
#nameFrame = null;
|
|
877
|
-
/** Lays the
|
|
919
|
+
/** Lays the ocean, sea and continent names out on the last frame, clear of the places' and the cities' names. A city that was placed first keeps the space. */
|
|
920
|
+
#seaFrame() {
|
|
921
|
+
const seas = this.#seas;
|
|
922
|
+
if (!seas || !this.#nameFrame)
|
|
923
|
+
return;
|
|
924
|
+
seas.frame(this.#nameFrame, seas.stats.on ? [...(this.#placeLayer?.boxes ?? []), ...(this.#cities?.boxes ?? []), ...[...this.#claims.values()].flat()] : []);
|
|
925
|
+
}
|
|
926
|
+
/** Lays the countries' names out on the last frame, clear of the places', the cities' and the sea names as they are now. */
|
|
878
927
|
#countryFrame() {
|
|
879
928
|
const countries = this.#countries;
|
|
880
929
|
if (!countries || !this.#nameFrame)
|
|
881
930
|
return;
|
|
882
|
-
countries.frame(this.#nameFrame, countries.stats.on ? [...(this.#placeLayer?.boxes ?? []), ...(this.#cities?.boxes ?? []), ...[...this.#claims.values()].flat()] : []);
|
|
931
|
+
countries.frame(this.#nameFrame, countries.stats.on ? [...(this.#placeLayer?.boxes ?? []), ...(this.#cities?.boxes ?? []), ...(this.#seas?.boxes ?? []), ...[...this.#claims.values()].flat()] : []);
|
|
883
932
|
}
|
|
884
933
|
/** Puts the name's settings and text right from the attributes (`body-label` and its family, `lang`). */
|
|
885
934
|
#applyBodyLabel() {
|
|
@@ -1094,6 +1143,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1094
1143
|
grid: { ...this.#model.grid.stats },
|
|
1095
1144
|
route: { ...this.#model.route.stats },
|
|
1096
1145
|
countryNames: this.#countries?.stats ?? { on: false, max: 0, countries: 0, names: 0, renders: 0, failed: false },
|
|
1146
|
+
seaNames: this.#seas?.stats ?? { on: false, radius: 0, names: 0, renders: 0 },
|
|
1097
1147
|
};
|
|
1098
1148
|
}
|
|
1099
1149
|
/**
|
|
@@ -1161,6 +1211,11 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1161
1211
|
groups.delete(group);
|
|
1162
1212
|
if (this.#model.satellites.selected?.group === group)
|
|
1163
1213
|
this.#model.satellites.selected = null;
|
|
1214
|
+
if (this.#model.satellites.focus?.name === group) {
|
|
1215
|
+
this.#model.satellites.focus = null;
|
|
1216
|
+
this.#restoreFocusView();
|
|
1217
|
+
this.dispatchEvent(new CustomEvent("chikyu-satellite-focus", { detail: { group: null, count: 0 }, bubbles: true, composed: true }));
|
|
1218
|
+
}
|
|
1164
1219
|
}
|
|
1165
1220
|
else {
|
|
1166
1221
|
const was = groups.get(group);
|
|
@@ -1185,9 +1240,66 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1185
1240
|
this.#startTick();
|
|
1186
1241
|
this.#gate?.soon();
|
|
1187
1242
|
}
|
|
1188
|
-
/**
|
|
1243
|
+
/**
|
|
1244
|
+
* The groups now set. `count` is how many satellites the group holds, `visible` is the shown state from `showSatellites` (a focus does not change it), `placed` is how many the last draw placed (0 when the group is not drawn) and `emphasis` is how a focus treats it: `focus`, `dim`, `hidden` or `plain` (no focus).
|
|
1245
|
+
*/
|
|
1189
1246
|
get satelliteGroups() {
|
|
1190
|
-
return
|
|
1247
|
+
return satelliteGroupRows(this.#model.satellites);
|
|
1248
|
+
}
|
|
1249
|
+
/** The group `focusSatelliteGroup` is showing on its own, or `null`. */
|
|
1250
|
+
get focusedSatelliteGroup() {
|
|
1251
|
+
return this.#model.satellites.focus?.name ?? null;
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Show one group on its own. The others are drawn dimmer (`others: "dim"`, the default, through the same dimming an old element set uses) or not drawn (`"hide"`). `frame` (true by default) pulls the camera back, by this view's own zoom, until the group's orbits fit: the distance is the greatest apogee of the group, from each satellite's mean motion and eccentricity, and it stops at 8 Earth radii. `null` puts every group back to the shown state it had, and puts the camera back when it was moved. A name that `setSatellites` has not set returns `{ ok: false, reason: "not-set" }` and changes nothing. It does not throw. When the choice changes, `chikyu-satellite-focus` is sent with `{ group, count }`.
|
|
1255
|
+
*
|
|
1256
|
+
* @param name - The group's name, or `null` to clear the focus.
|
|
1257
|
+
* @param options - `others` and `frame`.
|
|
1258
|
+
* @returns `{ ok: true, group, count }` when the group is set (`group` is `null` and `count` is 0 when cleared). `{ ok: false, reason: "not-set" }` when it is not.
|
|
1259
|
+
*/
|
|
1260
|
+
focusSatelliteGroup(name, options = {}) {
|
|
1261
|
+
const answer = applySatelliteFocus(this.#model.satellites, name, options);
|
|
1262
|
+
if (!answer.ok || answer.group === undefined || answer.count === undefined)
|
|
1263
|
+
return { ok: false, reason: "not-set" };
|
|
1264
|
+
if (answer.group === null)
|
|
1265
|
+
this.#restoreFocusView();
|
|
1266
|
+
else if (options.frame !== false)
|
|
1267
|
+
this.#frameSatelliteShell(answer.group);
|
|
1268
|
+
if (answer.changed)
|
|
1269
|
+
this.dispatchEvent(new CustomEvent("chikyu-satellite-focus", { detail: { group: answer.group, count: answer.count }, bubbles: true, composed: true }));
|
|
1270
|
+
// which groups are drawn decides how often time is drawn, so the next step is worked out again, as for `showSatellites`
|
|
1271
|
+
this.#startTick();
|
|
1272
|
+
this.#gate?.soon();
|
|
1273
|
+
return { ok: true, group: answer.group, count: answer.count };
|
|
1274
|
+
}
|
|
1275
|
+
/** The view's own zoom, far enough that the group's shell fills the picture, with the Earth back in the middle. */
|
|
1276
|
+
#frameSatelliteShell(name) {
|
|
1277
|
+
const group = this.#model.satellites.groups.get(name);
|
|
1278
|
+
if (!group)
|
|
1279
|
+
return;
|
|
1280
|
+
const box = this.getBoundingClientRect();
|
|
1281
|
+
if (box.width < 2 || box.height < 2)
|
|
1282
|
+
return;
|
|
1283
|
+
if (!this.#focusView)
|
|
1284
|
+
this.#focusView = { ...this.#model.view };
|
|
1285
|
+
const zoom = zoomForOrthographicShell(shellRadiusOf(group.satellites.sets), box.width, box.height, LIMITS.zoomMin, LIMITS.zoomMax);
|
|
1286
|
+
this.#applyCamera({ ...this.#model.view, zoom, panX: 0, panY: 0 });
|
|
1287
|
+
}
|
|
1288
|
+
/** Put back the view from before the shell was framed. */
|
|
1289
|
+
#restoreFocusView() {
|
|
1290
|
+
const saved = this.#focusView;
|
|
1291
|
+
this.#focusView = null;
|
|
1292
|
+
if (saved)
|
|
1293
|
+
this.#applyCamera(saved);
|
|
1294
|
+
}
|
|
1295
|
+
/** Hand a camera to the controls that are driving the view, or to the view itself when those are not there yet. */
|
|
1296
|
+
#applyCamera(view) {
|
|
1297
|
+
const bar = this.hasAttribute("data-kazoku-bar") && this.id ? this.getRootNode().querySelector?.(`kazoku-view-controls[for="${CSS.escape(this.id)}"]`) : null;
|
|
1298
|
+
const controls = (bar ? Reflect.get(bar, "controller") : undefined) ?? this.#hands?.controller;
|
|
1299
|
+
if (controls)
|
|
1300
|
+
controls.set(view, true, "satellites");
|
|
1301
|
+
else
|
|
1302
|
+
this.setView(view, true);
|
|
1191
1303
|
}
|
|
1192
1304
|
/** Mark one satellite: a larger ring round it and its orbit drawn. `null` lets it go. */
|
|
1193
1305
|
selectSatellite(ref) {
|
|
@@ -1266,8 +1378,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1266
1378
|
}
|
|
1267
1379
|
/** Is anything on show that moves faster than the Earth turns: a group of satellites, including above the interpolation limit where they are drawn as streaks? */
|
|
1268
1380
|
#satellitesMoving() {
|
|
1269
|
-
for (const group of this.#model.satellites.groups
|
|
1270
|
-
if (group.visible && group.satellites.count > 0)
|
|
1381
|
+
for (const [name, group] of this.#model.satellites.groups)
|
|
1382
|
+
if (satelliteEmphasis(name, group.visible, this.#model.satellites.focus).drawn && group.satellites.count > 0)
|
|
1271
1383
|
return true;
|
|
1272
1384
|
return false;
|
|
1273
1385
|
}
|
|
@@ -17,4 +17,5 @@ export type { BorderData, BorderStats } from "../borders/layer.ts";
|
|
|
17
17
|
export { EARTH_TILT, GRID_ATTRIBUTES, GRID_FINE_RADIUS, gridLines, readGrid, type GridLines } from "../grid/lines.ts";
|
|
18
18
|
export type { GridStats } from "../grid/layer.ts";
|
|
19
19
|
export { COUNTRY_LETTER_SPACING, COUNTRY_NAMES_ATTRIBUTES, COUNTRY_NAMES_DEFAULT, COUNTRY_NAMES_MAX, countryNameBox, countryNameText, countrySpots, layoutCountryNames, readCountryNames, type CountryFrame, type CountryLayoutOptions, type CountryName, type CountrySpots, type NamedShape } from "../country-names/geometry.ts";
|
|
20
|
+
export { SEA_FEATURES, SEA_RADIUS, layoutSeaNames, readSeaNames, seaNamesFor, type SeaFeature, type SeaName } from "../sea-names/geometry.ts";
|
|
20
21
|
export type { CountryNamesStats, CountryNamesStyle } from "../country-names/host.ts";
|
package/dist/realistic/index.js
CHANGED
|
@@ -14,3 +14,4 @@ export { CITY_NAMES_ATTRIBUTES } from "../cities/host.js";
|
|
|
14
14
|
export { BORDER_ATTRIBUTES, BORDER_REGIONS_RADIUS, codesNear, readBorders, shapeBoxes, sharedEdges } from "../borders/lines.js";
|
|
15
15
|
export { EARTH_TILT, GRID_ATTRIBUTES, GRID_FINE_RADIUS, gridLines, readGrid } from "../grid/lines.js";
|
|
16
16
|
export { COUNTRY_LETTER_SPACING, COUNTRY_NAMES_ATTRIBUTES, COUNTRY_NAMES_DEFAULT, COUNTRY_NAMES_MAX, countryNameBox, countryNameText, countrySpots, layoutCountryNames, readCountryNames } from "../country-names/geometry.js";
|
|
17
|
+
export { SEA_FEATURES, SEA_RADIUS, layoutSeaNames, readSeaNames, seaNamesFor } from "../sea-names/geometry.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** The zoom limit of the package's own pictures (the element's `LIMITS.zoomMax`), sharp to about this many times. */
|
|
2
|
+
export declare const PICTURE_ZOOM = 5;
|
|
3
|
+
/** The width of the widest picture the tiles are laid over, which that limit is sharp to. */
|
|
4
|
+
export declare const PICTURE_WIDTH = 4096;
|
|
5
|
+
/**
|
|
6
|
+
* The zoom limit a tile set gives: as many times `PICTURE_ZOOM` as the finest day level is wider than the widest picture (16384 across, 4 times: 20; 32768, 8 times: 40), never below the pictures' own
|
|
7
|
+
* limit, and the pictures' own limit when the set has no day layer.
|
|
8
|
+
*
|
|
9
|
+
* @param layers - The width in pixels of the finest level of each layer of the set.
|
|
10
|
+
* @returns The limit, as the attribute's text.
|
|
11
|
+
*/
|
|
12
|
+
export declare const tilesZoomMax: (layers: Record<string, number>) => string;
|
|
13
|
+
/**
|
|
14
|
+
* The limit to write when a set has been read: the larger of the one written before and the set's own, so a source with fewer levels added later does not lower it (the view controls take a written
|
|
15
|
+
* attribute as a new limit and bring the view back to fit).
|
|
16
|
+
*
|
|
17
|
+
* @param written - What this element wrote before, or null.
|
|
18
|
+
* @param layers - The width of the finest level of each layer of the set read now.
|
|
19
|
+
* @returns The limit, as the attribute's text.
|
|
20
|
+
*/
|
|
21
|
+
export declare const raisedZoomMax: (written: string | null, layers: Record<string, number>) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the element may write the limit: when the page has set none, or the one there is the one the element wrote. A `zoom-max` a page sets itself is never overwritten.
|
|
24
|
+
*
|
|
25
|
+
* @param attribute - The `zoom-max` attribute now, or null.
|
|
26
|
+
* @param written - What this element wrote before, or null.
|
|
27
|
+
* @returns True when the element may write.
|
|
28
|
+
*/
|
|
29
|
+
export declare const mayWriteZoomMax: (attribute: string | null, written: string | null) => boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// How far the realistic Earth may be zoomed once its tiles are found. Pure: the element reads and writes the `zoom-max` attribute, this says what to write.
|
|
2
|
+
/** The zoom limit of the package's own pictures (the element's `LIMITS.zoomMax`), sharp to about this many times. */
|
|
3
|
+
export const PICTURE_ZOOM = 5;
|
|
4
|
+
/** The width of the widest picture the tiles are laid over, which that limit is sharp to. */
|
|
5
|
+
export const PICTURE_WIDTH = 4096;
|
|
6
|
+
/**
|
|
7
|
+
* The zoom limit a tile set gives: as many times `PICTURE_ZOOM` as the finest day level is wider than the widest picture (16384 across, 4 times: 20; 32768, 8 times: 40), never below the pictures' own
|
|
8
|
+
* limit, and the pictures' own limit when the set has no day layer.
|
|
9
|
+
*
|
|
10
|
+
* @param layers - The width in pixels of the finest level of each layer of the set.
|
|
11
|
+
* @returns The limit, as the attribute's text.
|
|
12
|
+
*/
|
|
13
|
+
export const tilesZoomMax = (layers) => String(Math.max(PICTURE_ZOOM, Math.round((PICTURE_ZOOM * (layers["day"] ?? 0)) / PICTURE_WIDTH)));
|
|
14
|
+
/**
|
|
15
|
+
* The limit to write when a set has been read: the larger of the one written before and the set's own, so a source with fewer levels added later does not lower it (the view controls take a written
|
|
16
|
+
* attribute as a new limit and bring the view back to fit).
|
|
17
|
+
*
|
|
18
|
+
* @param written - What this element wrote before, or null.
|
|
19
|
+
* @param layers - The width of the finest level of each layer of the set read now.
|
|
20
|
+
* @returns The limit, as the attribute's text.
|
|
21
|
+
*/
|
|
22
|
+
export const raisedZoomMax = (written, layers) => String(Math.max(Number(written ?? 0), Number(tilesZoomMax(layers))));
|
|
23
|
+
/**
|
|
24
|
+
* Whether the element may write the limit: when the page has set none, or the one there is the one the element wrote. A `zoom-max` a page sets itself is never overwritten.
|
|
25
|
+
*
|
|
26
|
+
* @param attribute - The `zoom-max` attribute now, or null.
|
|
27
|
+
* @param written - What this element wrote before, or null.
|
|
28
|
+
* @returns True when the element may write.
|
|
29
|
+
*/
|
|
30
|
+
export const mayWriteZoomMax = (attribute, written) => attribute === null || attribute === written;
|
|
@@ -81,7 +81,57 @@ export declare const SATELLITE_GROUPS: readonly SatelliteGroupInfo[];
|
|
|
81
81
|
*/
|
|
82
82
|
export declare const CATALOGUE: readonly CatalogueEntry[];
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* One plain row a page can index, for its own search box. No DOM: a group or a satellite, with both languages on every row.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import type { CatalogueRow } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
89
|
+
*
|
|
90
|
+
* const row: CatalogueRow = { kind: "group", id: "weather", names: { en: "Weather", ja: "気象衛星" }, orbit: "mixed" };
|
|
91
|
+
* console.log(row.names.ja);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export interface CatalogueRow {
|
|
95
|
+
/** `group` for a button's group, `satellite` for one named satellite. */
|
|
96
|
+
kind: "satellite" | "group";
|
|
97
|
+
/** The group's id, or the satellite's NORAD number as a string. */
|
|
98
|
+
id: string;
|
|
99
|
+
/** The NORAD catalogue number. Only a satellite has one. */
|
|
100
|
+
noradId?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Names in both languages. `ja` is the short Japanese name where {@link SHORT_NAMES} has one, and otherwise the English name:
|
|
103
|
+
* a name such as Sentinel-2A is written the same way in Japanese. `reading` is hiragana for a Japanese name that is not already kana.
|
|
104
|
+
*/
|
|
105
|
+
names: {
|
|
106
|
+
en: string;
|
|
107
|
+
ja: string;
|
|
108
|
+
reading?: string;
|
|
109
|
+
};
|
|
110
|
+
/** The group's id. Only a satellite has one. */
|
|
111
|
+
group?: string;
|
|
112
|
+
orbit: OrbitKind;
|
|
113
|
+
/** Other names already written in the catalogue, such as HST for Hubble. Absent when there are none. */
|
|
114
|
+
aka?: readonly string[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Plain rows for every group and every catalogue satellite, for a page to index. Both languages are on every row: `lang` says which language the page is showing and does not drop the other, so one index serves either.
|
|
118
|
+
* A satellite's Japanese name comes from {@link SHORT_NAMES} where that has one, and is otherwise the English name.
|
|
119
|
+
*
|
|
120
|
+
* @param lang - `en` or `ja`, the language the page is showing. Omit it for the same rows.
|
|
121
|
+
* @returns The groups in their own order, then the satellites in catalogue order.
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* import { catalogueRows } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
125
|
+
*
|
|
126
|
+
* const hubble = catalogueRows("ja").find((row) => row.noradId === 20580);
|
|
127
|
+
* console.log(hubble?.names.ja, hubble?.aka?.join(", "));
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare function catalogueRows(lang?: "en" | "ja"): CatalogueRow[];
|
|
131
|
+
/**
|
|
132
|
+
* Find catalogue entries by name, group name, NORAD number, Japanese name or a group's Japanese label: "hubble", "hst", "25544", "weather" or "ハッブル".
|
|
133
|
+
* An English or numeric query ignores case, spaces and punctuation, as before. Kana and kanji are matched as typed: only letter case and character width are folded (NFKC), and that same width fold is applied before the English comparison.
|
|
134
|
+
* A name that starts with the text comes before one that only has it inside.
|
|
85
135
|
*
|
|
86
136
|
* @param text - What the reader typed.
|
|
87
137
|
* @param limit - The most entries to give back (8 by default).
|
|
@@ -91,6 +141,7 @@ export declare const CATALOGUE: readonly CatalogueEntry[];
|
|
|
91
141
|
* import { findInCatalogue } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
92
142
|
*
|
|
93
143
|
* console.log(findInCatalogue("sentinel 2").map((entry) => entry.name));
|
|
144
|
+
* console.log(findInCatalogue("ハッブル").map((entry) => entry.name));
|
|
94
145
|
* ```
|
|
95
146
|
*/
|
|
96
147
|
export declare function findInCatalogue(text: string, limit?: number): CatalogueEntry[];
|