spacemap 0.1.0 → 0.1.1
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/README.md +23 -3
- package/index.d.ts +2171 -0
- package/index.js +30403 -0
- package/package.json +2 -8
package/README.md
CHANGED
|
@@ -13,17 +13,22 @@ are licensed for non-commercial use only.
|
|
|
13
13
|
|
|
14
14
|
## Getting it
|
|
15
15
|
|
|
16
|
-
As one script that carries everything it needs
|
|
17
|
-
|
|
16
|
+
As one script that carries everything it needs, from the CDN or copied next to
|
|
17
|
+
your page:
|
|
18
18
|
|
|
19
19
|
```html
|
|
20
20
|
<div id="map" style="height: 500px"></div>
|
|
21
21
|
<script type="module">
|
|
22
|
-
import { createMap } from '
|
|
22
|
+
import { createMap } from 'https://cdn.spacemap.co/0.1.1/spacemap.js';
|
|
23
23
|
const map = await createMap({ container: '#map' });
|
|
24
24
|
</script>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
`spacemap.iife.js` at the same path defines a `spacemap` global instead, for
|
|
28
|
+
pages without modules. Every version stays where it was published, so pin the
|
|
29
|
+
one you tested; the build's `sha384` digest in an `integrity` attribute keeps
|
|
30
|
+
the page from running anything else.
|
|
31
|
+
|
|
27
32
|
Or from npm, where three.js is yours to provide:
|
|
28
33
|
|
|
29
34
|
```sh
|
|
@@ -167,6 +172,8 @@ map.addSurfaceCircle({ body: 'naif-499', center: { lon: 77.5, lat: 18.4 }, radiu
|
|
|
167
172
|
|
|
168
173
|
`boxRing`, `smallCircle` and `graticule`, the flat map's helpers, make point
|
|
169
174
|
lists these take; `circlePoints` does the same for a circle in space.
|
|
175
|
+
`groundDistanceM` and `bearingDeg` measure between any two places on a body,
|
|
176
|
+
given its radius.
|
|
170
177
|
|
|
171
178
|
Every drawing answers `remove()` and `setVisible()`, a shape answers
|
|
172
179
|
`setAnchor()` and `setPoints()`, and `map.clearDrawings()` takes them all away
|
|
@@ -435,6 +442,19 @@ A rover's panorama from the inside, with arrows along its traverse. The
|
|
|
435
442
|
three-dimensional part is all the SDK draws; the date, the place, a list to
|
|
436
443
|
pick from or a map of the traverse are the page's to build.
|
|
437
444
|
|
|
445
|
+
Which bodies have panoramas, and where each one stands, can be read before a
|
|
446
|
+
view exists — what a page picking one for the reader needs, since `createPanorama`
|
|
447
|
+
opens the body's first unless told which:
|
|
448
|
+
|
|
449
|
+
```js
|
|
450
|
+
import { fetchPanoramaIndex, fetchPanoramas } from 'spacemap';
|
|
451
|
+
|
|
452
|
+
await fetchPanoramaIndex(); // every body with coverage, and the missions on it
|
|
453
|
+
const entries = await fetchPanoramas('naif-499'); // every panorama on Mars
|
|
454
|
+
const pick = entries[(Math.random() * entries.length) | 0];
|
|
455
|
+
const view = await createPanorama({ container: '#panorama', body: 'naif-499', at: pick.id });
|
|
456
|
+
```
|
|
457
|
+
|
|
438
458
|
```js
|
|
439
459
|
const view = await createPanorama({
|
|
440
460
|
container: '#panorama',
|