isard 1.6.0 → 1.8.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 +70 -0
- package/dist/basemap/furniture.d.ts +20 -2
- package/dist/basemap/furniture.js +72 -3
- package/dist/basemap/furniture.js.map +1 -1
- package/dist/basemap/meshes.d.ts +21 -0
- package/dist/basemap/meshes.js +159 -0
- package/dist/basemap/meshes.js.map +1 -0
- package/dist/basemap/placed.d.ts +13 -0
- package/dist/basemap/placed.js +14 -0
- package/dist/basemap/placed.js.map +1 -0
- package/dist/basemap/trees.d.ts +4 -14
- package/dist/basemap/trees.js +12 -93
- package/dist/basemap/trees.js.map +1 -1
- package/dist/basemap/vectortiles/context.d.ts +4 -2
- package/dist/basemap/vectortiles/context.js.map +1 -1
- package/dist/basemap/vectortiles/extrusions.d.ts +1 -1
- package/dist/basemap/vectortiles/extrusions.js +7 -16
- package/dist/basemap/vectortiles/extrusions.js.map +1 -1
- package/dist/basemap/vectortiles/furniture.d.ts +19 -0
- package/dist/basemap/vectortiles/furniture.js +29 -0
- package/dist/basemap/vectortiles/furniture.js.map +1 -0
- package/dist/basemap/vectortiles/labels.js +8 -1
- package/dist/basemap/vectortiles/labels.js.map +1 -1
- package/dist/basemap/vectortiles/lamps.js +11 -76
- package/dist/basemap/vectortiles/lamps.js.map +1 -1
- package/dist/basemap/vectortiles/placed.d.ts +38 -0
- package/dist/basemap/vectortiles/placed.js +143 -0
- package/dist/basemap/vectortiles/placed.js.map +1 -0
- package/dist/basemap/vectortiles/street-wind.js +4 -6
- package/dist/basemap/vectortiles/street-wind.js.map +1 -1
- package/dist/basemap/vectortiles/trees.d.ts +2 -9
- package/dist/basemap/vectortiles/trees.js +34 -165
- package/dist/basemap/vectortiles/trees.js.map +1 -1
- package/dist/basemap/vectortiles/vectors.d.ts +4 -5
- package/dist/basemap/vectortiles/vectors.js +17 -16
- package/dist/basemap/vectortiles/vectors.js.map +1 -1
- package/dist/basemap/vectortiles.d.ts +14 -4
- package/dist/basemap/vectortiles.js +40 -12
- package/dist/basemap/vectortiles.js.map +1 -1
- package/dist/basemap/wmts.js +2 -2
- package/dist/basemap/wmts.js.map +1 -1
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +18 -14
- package/dist/bind/layers.d.ts +10 -3
- package/dist/bind/layers.js +11 -4
- package/dist/bind/layers.js.map +1 -1
- package/dist/data/collada.js +3 -17
- package/dist/data/collada.js.map +1 -1
- package/dist/data/crs.js +1 -1
- package/dist/data/crs.js.map +1 -1
- package/dist/data/ifc.js +21 -22
- package/dist/data/ifc.js.map +1 -1
- package/dist/geoplateforme.d.ts +16 -4
- package/dist/geoplateforme.js +26 -4
- package/dist/geoplateforme.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/isard_grid_bg.wasm +0 -0
- package/dist/isard_tess_bg.wasm +0 -0
- package/dist/layers/extrusions.js +5 -4
- package/dist/layers/extrusions.js.map +1 -1
- package/dist/layers/features.d.ts +0 -2
- package/dist/layers/features.js +5 -6
- package/dist/layers/features.js.map +1 -1
- package/dist/layers/layers.d.ts +2 -0
- package/dist/layers/layers.js +11 -0
- package/dist/layers/layers.js.map +1 -1
- package/dist/layers/panoramas.d.ts +32 -10
- package/dist/layers/panoramas.js +55 -28
- package/dist/layers/panoramas.js.map +1 -1
- package/dist/layers/photos.js +5 -6
- package/dist/layers/photos.js.map +1 -1
- package/dist/layers/trees.js +7 -7
- package/dist/layers/trees.js.map +1 -1
- package/dist/layers/vectors.d.ts +1 -0
- package/dist/layers/vectors.js +23 -8
- package/dist/layers/vectors.js.map +1 -1
- package/dist/map/frame-loop.d.ts +2 -0
- package/dist/map/frame-loop.js +3 -3
- package/dist/map/frame-loop.js.map +1 -1
- package/dist/map.js +17 -0
- package/dist/map.js.map +1 -1
- package/dist/panoramax.d.ts +19 -0
- package/dist/panoramax.js +48 -3
- package/dist/panoramax.js.map +1 -1
- package/dist/react/CustomLayer.js +5 -4
- package/dist/react/CustomLayer.js.map +1 -1
- package/dist/react/Layer.d.ts +1 -1
- package/dist/react/Layer.js +6 -5
- package/dist/react/Layer.js.map +1 -1
- package/dist/react/VectorGeometry.d.ts +18 -9
- package/dist/react/VectorGeometry.js +30 -15
- package/dist/react/VectorGeometry.js.map +1 -1
- package/dist/react/VectorTiles.d.ts +65 -0
- package/dist/react/VectorTiles.js +112 -0
- package/dist/react/VectorTiles.js.map +1 -0
- package/dist/react/context.d.ts +12 -0
- package/dist/react/context.js +40 -1
- package/dist/react/context.js.map +1 -1
- package/dist/react/index.d.ts +7 -1
- package/dist/react/index.js +7 -1
- package/dist/react/index.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.js.map +1 -1
- package/dist/util/geo.d.ts +8 -0
- package/dist/util/geo.js +8 -0
- package/dist/util/geo.js.map +1 -1
- package/dist/util/gltf.d.ts +18 -1
- package/dist/util/gltf.js +26 -1
- package/dist/util/gltf.js.map +1 -1
- package/dist/util/roofs.d.ts +8 -0
- package/dist/util/roofs.js +16 -2
- package/dist/util/roofs.js.map +1 -1
- package/dist/util/style-floats.d.ts +33 -0
- package/dist/util/style-floats.js +34 -0
- package/dist/util/style-floats.js.map +1 -0
- package/dist/util/sun.js +1 -1
- package/dist/util/sun.js.map +1 -1
- package/dist/workers/basemap/furniture.d.ts +13 -0
- package/dist/workers/basemap/geometry.d.ts +2 -5
- package/dist/workers/basemap/labels.d.ts +5 -2
- package/dist/workers/basemap/lamps.d.ts +3 -3
- package/dist/workers/basemap/tiles.d.ts +2 -0
- package/dist/workers/basemap/trees.d.ts +3 -0
- package/dist/workers/basemap.worker.d.ts +17 -1
- package/dist/workers/basemap.worker.js +12 -1
- package/dist/workers/basemap.worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/react/context.ts"],"names":[],"mappings":"AAAA;uBACuB;AAEvB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/react/context.ts"],"names":[],"mappings":"AAAA;uBACuB;AAEvB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAgB/E,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAsB,SAAS,CAAC,CAAC;AASxE,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAyB,SAAS,CAAC,CAAC;AAE7E,kHAAkH;AAClH,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAuD,SAAS,CAAC,CAAC;AAE5G,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAA0B,SAAS,CAAC,CAAC;AAEpF;gCACgC;AAChC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAuB,EAAE;IAC9C,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACvC,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAErD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,MAAM,GAAG,GAAuB,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC;AAE5E,mHAAmH;AACnH,MAAM,CAAC,MAAM,WAAW,GAAG,CAA4B,IAAO,EAAE,QAAuC,EAAQ,EAAE;IAC/G,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEhC,MAAM,CAA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c,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS;QACjD,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;AAE3C;mEACmE;AACnE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAU,EAAE,CAClD,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,KAAc,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAEtG;iCACiC;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAmB,OAAU,EAAK,EAAE;IAClE,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACzD,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAE9B,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,GAAG;QAAE,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;IAE9D,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["/** What the components of a map share: the map, the order of their layers, the viewsheds, the swipe and the marker\n * around; the hooks */\n\nimport { createContext, useContext, useEffect, useRef, useState } from 'react';\nimport type { VectorTiles } from '../basemap/vectortiles.ts';\nimport type { LayerOrder } from '../bind/layers.ts';\nimport type { Layer as LayerHandle } from '../layers/layers.ts';\nimport type { GeoMap } from '../map.ts';\nimport type { LonLat, MapEvents, ViewshedOptions } from '../types.ts';\nimport type { Marker as MarkerHandle } from '../ui/overlay.ts';\n\nexport interface Binding {\n map: GeoMap;\n order: LayerOrder;\n /** The observers of the `<Viewshed>` components, set on the map together */\n viewsheds: Map<object, ViewshedOptions>;\n applyViewsheds(): void;\n}\n\nexport const MapContext = createContext<Binding | undefined>(undefined);\n\n/** The layers of a `<Swipe>` around, its `<Layer>` children joining it; `other`: the group of its `<SwipeOther>` */\nexport interface SwipeGroup {\n set(layer: LayerHandle): void;\n unset(layer: LayerHandle): void;\n other?: SwipeGroup;\n}\n\nexport const SwipeContext = createContext<SwipeGroup | undefined>(undefined);\n\n/** The marker of a `<Marker>` around and its position (a `<Popup>` in it opens on its click, at that position) */\nexport const MarkerContext = createContext<{ marker: MarkerHandle; lonLat: LonLat } | undefined>(undefined);\n\n/** The vector tiles of the `<VectorTiles>` around, once the map is there */\nexport const VectorTilesContext = createContext<VectorTiles | undefined>(undefined);\n\n/** A component's rank among the layers of the components (`LayerOrder.rank`): taken at its first render, in the\n * declared order, kept after */\nexport const useRank = (): number | undefined => {\n const binding = useContext(MapContext);\n const [rank] = useState(() => binding?.order.rank());\n\n return rank;\n};\n\n/** The map of the `<IsardMap>` around, once created (undefined before) */\nexport const useMap = (): GeoMap | undefined => useContext(MapContext)?.map;\n\n/** Listens to an event of the map around while the component is mounted; the listener may change at each render */\nexport const useMapEvent = <K extends keyof MapEvents>(type: K, listener: (event: MapEvents[K]) => void): void => {\n const map = useMap();\n const latest = useRef(listener);\n\n latest.current = listener;\n // Listening while mounted, to the listener of the last render; stops when unmounted or the map changes\n useEffect(() => map?.on(type, (event) => latest.current(event)), [map, type]);\n};\n\n/** The entries of an object whose value is defined (`exactOptionalPropertyTypes`) */\nexport const defined = <T extends object>(object: T): { [K in keyof T]?: Exclude<T[K], undefined> } =>\n Object.fromEntries(Object.entries(object).filter(([, value]) => value !== undefined)) as {\n [K in keyof T]?: Exclude<T[K], undefined>;\n };\n\n/** Numbers standing for the values compared by identity in `propsKey`, the next one */\nconst identities = { of: new WeakMap<object, number>(), next: 1 };\n\n/** The number of a value compared by identity */\nconst identity = (value: object): number => {\n const known = identities.of.get(value);\n\n if (known !== undefined) return known;\n identities.of.set(value, identities.next);\n identities.next += 1;\n\n return identities.next - 1;\n};\n\n/** A value compared by identity: a function, a class's instance (a layer), binary data */\nconst byIdentity = (value: unknown): value is object =>\n typeof value === 'function' ||\n (typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null);\n\n/** A key of options that changes when they do: plain data compared by value (an object written inline in the JSX\n * keeps its key), functions, layers and binary data by identity */\nexport const propsKey = (options: object): string =>\n JSON.stringify(options, (_, value: unknown) => (byIdentity(value) ? `#${identity(value)}` : value));\n\n/** The same options while their `propsKey` stays: an object written inline in the JSX, the same from render to render\n * until a value in it changes */\nexport const useStableOptions = <T extends object>(options: T): T => {\n const kept = useRef({ key: propsKey(options), options });\n const key = propsKey(options);\n\n if (kept.current.key !== key) kept.current = { key, options };\n\n return kept.current.options;\n};\n"]}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
*
|
|
5
5
|
* ```tsx
|
|
6
6
|
* <IsardMap preset="ign-3d" center={[2.35, 48.85]} zoom={15} style={{ height: 400 }}>
|
|
7
|
+
* <VectorTiles style={OPENFREEMAP_STYLES.liberty}>
|
|
8
|
+
* <Geometry roofs="generated" />
|
|
9
|
+
* <Trees />
|
|
10
|
+
* <Labels />
|
|
11
|
+
* </VectorTiles>
|
|
7
12
|
* <Layer type="lines" data={routes} color="#0057b8" width={3} />
|
|
8
13
|
* <Marker lonLat={[2.35, 48.85]}><Popup>Here</Popup></Marker>
|
|
9
14
|
* </IsardMap>
|
|
@@ -23,5 +28,6 @@ export { Marker, type MarkerProps } from './Marker.tsx';
|
|
|
23
28
|
export { Panel, type PanelProps } from './Panel.tsx';
|
|
24
29
|
export { Popup, type PopupProps } from './Popup.tsx';
|
|
25
30
|
export { Swipe, SwipeOther, type SwipeProps } from './Swipe.tsx';
|
|
26
|
-
export { VectorGeometry, type VectorGeometryProps } from './VectorGeometry.tsx';
|
|
31
|
+
export { Geometry, type GeometryProps, VectorGeometry, type VectorGeometryProps } from './VectorGeometry.tsx';
|
|
32
|
+
export { Extrusions, Furniture, Labels, Lamps, Trees, useVectorTiles, VectorTiles, type VectorTilesProps, } from './VectorTiles.tsx';
|
|
27
33
|
export { Viewshed } from './Viewshed.tsx';
|
package/dist/react/index.js
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
*
|
|
5
5
|
* ```tsx
|
|
6
6
|
* <IsardMap preset="ign-3d" center={[2.35, 48.85]} zoom={15} style={{ height: 400 }}>
|
|
7
|
+
* <VectorTiles style={OPENFREEMAP_STYLES.liberty}>
|
|
8
|
+
* <Geometry roofs="generated" />
|
|
9
|
+
* <Trees />
|
|
10
|
+
* <Labels />
|
|
11
|
+
* </VectorTiles>
|
|
7
12
|
* <Layer type="lines" data={routes} color="#0057b8" width={3} />
|
|
8
13
|
* <Marker lonLat={[2.35, 48.85]}><Popup>Here</Popup></Marker>
|
|
9
14
|
* </IsardMap>
|
|
@@ -18,6 +23,7 @@ export { Marker } from "./Marker.js";
|
|
|
18
23
|
export { Panel } from "./Panel.js";
|
|
19
24
|
export { Popup } from "./Popup.js";
|
|
20
25
|
export { Swipe, SwipeOther } from "./Swipe.js";
|
|
21
|
-
export { VectorGeometry } from "./VectorGeometry.js";
|
|
26
|
+
export { Geometry, VectorGeometry } from "./VectorGeometry.js";
|
|
27
|
+
export { Extrusions, Furniture, Labels, Lamps, Trees, useVectorTiles, VectorTiles, } from "./VectorTiles.js";
|
|
22
28
|
export { Viewshed } from "./Viewshed.js";
|
|
23
29
|
//# sourceMappingURL=index.js.map
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAe,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAmB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,QAAQ,EAA0C,MAAM,eAAgB,CAAC;AAClF,OAAO,EAAE,KAAK,EAAsD,MAAM,YAAa,CAAC;AACxF,OAAO,EAAE,MAAM,EAAoB,MAAM,aAAc,CAAC;AACxD,OAAO,EAAE,KAAK,EAAmB,MAAM,YAAa,CAAC;AACrD,OAAO,EAAE,KAAK,EAAmB,MAAM,YAAa,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAmB,MAAM,YAAa,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAsB,cAAc,EAA4B,MAAM,qBAAsB,CAAC;AAC9G,OAAO,EACL,UAAU,EACV,SAAS,EACT,MAAM,EACN,KAAK,EACL,KAAK,EACL,cAAc,EACd,WAAW,GAEZ,MAAM,kBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAgB,CAAC","sourcesContent":["/**\n * Isard in React: the map, its layers, markers, popups, panels and effects as components, created when they mount,\n * updated by the least their props need and removed when they unmount.\n *\n * ```tsx\n * <IsardMap preset=\"ign-3d\" center={[2.35, 48.85]} zoom={15} style={{ height: 400 }}>\n * <VectorTiles style={OPENFREEMAP_STYLES.liberty}>\n * <Geometry roofs=\"generated\" />\n * <Trees />\n * <Labels />\n * </VectorTiles>\n * <Layer type=\"lines\" data={routes} color=\"#0057b8\" width={3} />\n * <Marker lonLat={[2.35, 48.85]}><Popup>Here</Popup></Marker>\n * </IsardMap>\n * ```\n */\n\nexport type { Layer as LayerHandle } from '../layers/layers.ts';\nexport type { GeoMap, LayerSpec } from '../map.ts';\nexport type { LonLat } from '../types.ts';\nexport type { Marker as MarkerHandle, Panel as PanelHandle, Popup as PopupHandle } from '../ui/overlay.ts';\nexport type { Camera } from '../wasm/isard.js';\nexport { Control, type ControlProps } from './Control.tsx';\nexport { CustomLayer, type CustomLayerProps } from './CustomLayer.tsx';\nexport { useMap, useMapEvent } from './context.ts';\nexport { IsardMap, type IsardMapProps, type MapEventProps } from './IsardMap.tsx';\nexport { Layer, type LayerHandles, type LayerProps, type LayerType } from './Layer.tsx';\nexport { Marker, type MarkerProps } from './Marker.tsx';\nexport { Panel, type PanelProps } from './Panel.tsx';\nexport { Popup, type PopupProps } from './Popup.tsx';\nexport { Swipe, SwipeOther, type SwipeProps } from './Swipe.tsx';\nexport { Geometry, type GeometryProps, VectorGeometry, type VectorGeometryProps } from './VectorGeometry.tsx';\nexport {\n Extrusions,\n Furniture,\n Labels,\n Lamps,\n Trees,\n useVectorTiles,\n VectorTiles,\n type VectorTilesProps,\n} from './VectorTiles.tsx';\nexport { Viewshed } from './Viewshed.tsx';\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -410,4 +410,6 @@ export interface LayerHost {
|
|
|
410
410
|
replaceLayer(layer: Layer, old: number): void;
|
|
411
411
|
/** Resolves once the map is idle (everything in view loaded and drawn) */
|
|
412
412
|
whenIdle(): Promise<void>;
|
|
413
|
+
/** Work the map waits on before it is idle (`GeoMap.track`) */
|
|
414
|
+
track<T>(work: Promise<T>): Promise<T>;
|
|
413
415
|
}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0CAA0C","sourcesContent":["/** Public types of the `isard` package */\n\nimport type { TileGrid } from './basemap/grid.ts';\nimport type { DecoderUrls } from './engine/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard.js';\n\nexport type LonLat = [lon: number, lat: number];\nexport type Point = [x: number, y: number];\n\n/**\n * The named basemaps. OpenFreeMap's vector styles, OpenStreetMap data worldwide, their labels above the other layers:\n * `osm-positron` (light grey, quiet: data over it reads first), `osm-liberty` and `osm-bright` (in colour), `osm-dark`\n * (near black: bright data over it, a wind's particles, lights). The\n * Géoplateforme's (IGN, France): rasters (`ign-plan`, `ign-plan-grey`, `ign-ortho`, the aerial photographs) or vector\n * tiles with their labels (`ign-plan-vector`, `ign-plan-grey-vector`, the PLAN.IGN styles).\n */\nexport type BasemapName =\n | 'osm-positron'\n | 'osm-liberty'\n | 'osm-bright'\n | 'osm-dark'\n | 'ign-plan'\n | 'ign-plan-grey'\n | 'ign-ortho'\n | 'ign-plan-vector'\n | 'ign-plan-grey-vector'\n | 'none';\n\n/** A basemap by name (see `BasemapName`) */\nexport type Basemap = BasemapName;\n\n/**\n * The Earth's named terrain models. `'terrain-tiles'`: worldwide, the Terrain Tiles of AWS's open data registry\n * (SRTM, EU-DEM, GMTED… merged by Mapzen, 30 m in most places), the sea floor flattened at sea level. `'ign'`: France,\n * the IGN's RGE ALTI from the Géoplateforme (1 to 5 m), raised by the RAF20 geoid to heights above the ellipsoid.\n */\nexport type TerrainModel = 'terrain-tiles' | 'ign';\n\n/** How tiles encode their altitudes: `'float32'`, raw little-endian floats (`image/x-bil;bits=32`, an ArcGIS raw\n * grid); `'terrarium'`, the colors of a PNG, `R × 256 + G + B / 256 - 32768`; `'mapbox'`, those of Terrain-RGB,\n * `(R × 65536 + G × 256 + B) / 10 - 10000` */\nexport type TerrainEncoding = 'float32' | 'terrarium' | 'mapbox';\n\n/**\n * How tiles load and show. 'immediate' (default): everything visible loads, tiles show as soon as they arrive.\n * 'smooth': during flights the levels flown through are skipped, off-center tiles wait while the camera moves, tiles\n * fade in; fewer downloads, for slow networks or GPUs.\n */\nexport type LoadingMode = 'immediate' | 'smooth';\n\n/** 'globe': a sphere at low zoom, blending into Web Mercator between zooms 5 and 7, up to three levels later under a\n * tilted camera (it sees much farther than its center: the horizon stays curved) */\nexport type Projection = 'globe' | 'mercator';\n\n/** A body to draw the map on, other than the named ones (`CelestialBody`) */\nexport interface BodyOptions {\n /** Equatorial radius, metres */\n radius: number;\n /** Flattening of its ellipsoid, 0 for a sphere (default 0) */\n flattening?: number;\n /** An atmosphere: its halo around the globe, true for the Earth's light blue, or a CSS color (its alpha the\n * halo's strength) (default false) */\n atmosphere?: boolean | string;\n /** Color of the globe where no tile covers it (past the Web Mercator latitudes, 85°), a CSS color (default\n * `#808080`) */\n color?: string;\n /** Lowest and highest altitudes of its ground, metres around the ellipsoid: what its relief may raise into view\n * (default ±1 % of the radius) */\n relief?: [lowest: number, highest: number];\n}\n\n/**\n * The body the map is drawn on: 'earth' (WGS 84, the default), 'moon' (a sphere of 1 737 400 m, no atmosphere),\n * 'mars' (a sphere of 3 396 190 m, its equatorial radius, a thin dusty halo; planetocentric latitudes) or another\n * one. Zoom levels keep their meaning on screen (the Web Mercator tile pyramid), their metres follow the body:\n * altitudes, relief, buildings, 3D Tiles. Off the Earth, the map has none of the Earth's defaults: no basemap, no\n * credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.\n */\nexport type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;\n\nexport interface GeoMapOptions extends Partial<Camera> {\n /** The body the map is drawn on (default 'earth'); set at creation */\n body?: CelestialBody;\n /** Default 'globe' */\n projection?: Projection;\n /** Default 'immediate' */\n loading?: LoadingMode;\n /** The basemap (default 'osm-positron'; 'none' off the Earth) */\n basemap?: Basemap;\n /** Opacity of the IGN hillshade over the basemap (France, Géoplateforme), 0 for none (default 0) */\n hillshade?: number;\n /** Color behind the map (sky of tilted flat views), a CSS color (default `#f2f2f0`; black off the Earth) */\n background?: string;\n /** Space behind the globe: stars and atmosphere halo, fading out as the globe turns flat (default true) */\n sky?: boolean;\n /** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */\n sun?: SunOptions;\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on\n * the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options\n * (default false; on another body, its `url` is required). Network layers are draped on it */\n terrain?: boolean | TerrainModel | TerrainOptions;\n minZoom?: number;\n maxZoom?: number;\n /** Highest pitch, degrees, up to 85 (default 70) */\n maxPitch?: number;\n /** Sky over the plane, seen when the camera is tilted towards the horizon, and the fog the ground fades into\n * (MapLibre's `setSky`); default none: the background color */\n atmosphere?: AtmosphereOptions;\n /** Mouse, touch and keyboard controls (default true) */\n interactive?: boolean;\n /** Keyboard controls once the map has the focus (it is reached with Tab): arrows pan, Shift + arrows rotate and\n * tilt, + and - zoom (Shift: two levels), 0 faces north and levels the view (default true; none when not\n * `interactive`) */\n keyboard?: boolean;\n /** Accessible name of the map, read by screen readers (default 'Map') */\n ariaLabel?: string;\n /** A preset of map options (`IGN_PRESETS`: `'ign'`, `'ign-3d'`, `'ign-ortho-3d'`), the other options over it */\n preset?: 'ign' | 'ign-3d' | 'ign-ortho-3d';\n /** The folder isard's files are served from (its engines, `isard_bg.wasm`, `isard_core_bg.wasm`,\n * `isard_points_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that\n * moves them, the `…Url` options below for each one. `isard/vite` sets it for the whole page; default next to the\n * module */\n assetsUrl?: string | URL;\n /** Where to load the engine with 3D Tiles from (`isard_bg.wasm`), when a bundler does not resolve the default URL.\n * Given without `coreWasmUrl`, maps load this engine from the start */\n wasmUrl?: string | URL;\n /** Where to load the engine without 3D Tiles from (`isard_core_bg.wasm`, a third smaller), when a bundler does not\n * resolve the default URL. Maps load it first, and the engine with 3D Tiles (`wasmUrl`) for their first 3D Tiles\n * layer only */\n coreWasmUrl?: string | URL;\n /** Where the decoding workers load the point cloud module from (`isard_points_bg.wasm`, the LAZ decoder of COPC),\n * when a bundler does not resolve the default URL. Loaded with the first point cloud only */\n pointsWasmUrl?: string | URL;\n /** Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`: the vector tiles drawn as\n * geometry, `vectorTiles().vectors()`, made ready for the GPU off the main thread), when a bundler does not resolve\n * the default URL. Loaded with the first tile of geometry; without it, the main thread does that work */\n tessWasmUrl?: string | URL;\n /** Where the workers load the grid module from (`isard_grid_bg.wasm`: GRIB2 and NetCDF files read by\n * `map.readGrids`), when a bundler does not resolve the default URL. Loaded with the first file */\n gridWasmUrl?: string | URL;\n /** Load the engine with 3D Tiles from the start (default false: it is loaded when the first 3D Tiles layer or glTF\n * model is added, the map then moving its camera and layers onto it, a stall of about a frame or two). For a map that shows 3D Tiles\n * at once: one engine downloaded instead of two. `'preload'`: the map starts on the engine without 3D Tiles and\n * downloads and compiles the other once idle, without running it: its first 3D Tiles layer does not wait for the\n * download (for a map that will show 3D Tiles later, on demand) */\n tiles3d?: boolean | 'preload';\n /** Where to load the vector basemap worker from, when a bundler does not resolve the default URL */\n basemapWorkerUrl?: string | URL;\n /** Texture size of the vector basemap's tiles, pixels (default 512: lines and edges sharp at every zoom on a screen\n * of pixel ratio 1). 256: a quarter of the drawing in the workers, of the uploads and of the GPU memory, for lines\n * and edges a little softer between two zoom levels (the tiles are shown 181 to 362 CSS pixels wide) */\n basemapTileSize?: number;\n /** Glyphs of the symbol layers: a URL with `{fontstack}` and `{range}` (MapLibre's glyph format; default\n * OpenFreeMap's fonts, Noto Sans). A vector basemap's labels take the glyphs of its style */\n glyphs?: string;\n /** Workers decoding 3D Tiles off the main thread: a count, or false to decode on the main thread (default: cores - 1,\n * 1 to 4). False (or 0) also decodes the PNG relief and reprojects the equirectangular rasters on the main thread,\n * else done by the vector basemap's workers */\n workers?: number | false;\n /** Where to load the decoding worker from, when a bundler does not resolve the default URL */\n workerUrl?: string | URL;\n /** Folders of the Draco and Basis Universal decoders, loaded by the workers on first use (default: the official\n * builds on gstatic.com and jsDelivr; self-host them for offline or locked-down networks). They run through\n * `new Function`: a Content Security Policy needs `'unsafe-eval'` (see `DecoderUrls`) */\n decoders?: Partial<DecoderUrls>;\n /** Credits at the bottom right: false for none, or its options (default true: the credits of the basemap,\n * hillshade and relief in use, compact on maps narrower than 640 px) */\n attributionControl?: boolean | AttributionOptions;\n}\n\nexport interface TerrainOptions {\n /** One of the Earth's named models (default `'terrain-tiles'` on the Earth); unused with a `url` */\n model?: TerrainModel;\n /** Altitudes of 256 × 256 tiles in `encoding`: a WMS GetMap URL with {bbox} (EPSG:3857 on the Earth, the body's\n * Mercator metres elsewhere: the sphere of its radius), a tile URL with {z}, {x} and {y}, or an ArcGIS image service\n * (a URL ending in `/ImageServer`), asked for raw altitudes in the body's Mercator (default: the `model`'s; on the\n * Moon and Mars, NASA's Trek LOLA and MOLA models) */\n url?: string;\n /** How the tiles of `url` encode their altitudes (default `'float32'`); `'terrarium'` and `'mapbox'` take a URL with\n * {z}, {x} and {y} */\n encoding?: TerrainEncoding;\n /** Vertical exaggeration, 1 for the true relief (default 1) */\n exaggeration?: number;\n /** Finest level of the relief, up to 15 (default 15; 14 for the Terrain Tiles, 8 for the Moon's and Mars's models). It\n * starts at level 6 on the Earth, coarser on bodies of a larger relief for their size (3 on the Moon and Mars) */\n maxZoom?: number;\n /** Altitudes over mainland France raised by the height of the RAF20 geoid (the French one, 0 away from France), to\n * heights above the ellipsoid (those of 3D Tiles); false keeps the altitudes as served (NGF-IGN69 for the IGN's)\n * (default true for the `'ign'` model, false otherwise) */\n geoid?: boolean;\n}\n\n/** Sky, horizon and fog over the plane, with the names and meanings of MapLibre's `setSky` */\nexport interface AtmosphereOptions {\n /** A CSS color (default `#9cc7ec`) */\n skyColor?: string;\n /** (default `#e8f1f8`) */\n horizonColor?: string;\n /** (default `#f2f5f8`) */\n fogColor?: string;\n /** Blend from the horizon to the sky color, share of the field of view above the horizon, 0-1 (default 0.6) */\n skyHorizonBlend?: number;\n /** Blend from the horizon to the fog color below the horizon, 0-1 (default 0.7) */\n horizonFogBlend?: number;\n /** Share of the distance to the far plane over which the ground fades into the fog, 0-1 (default 0.4) */\n fogGroundBlend?: number;\n}\n\n/** The sun casting shadows (`GeoMap.setSun`): where it stands, by date or by hand, and how dark its shadows are */\nexport interface SunOptions {\n /** The time: the sun where it stands then over the map's center (default now, unless `azimuth` and `altitude`) */\n date?: Date;\n /** Degrees clockwise from north, with `altitude`: the sun placed by hand */\n azimuth?: number;\n /** Degrees above the horizon; at or under it, no shadows */\n altitude?: number;\n /** How dark the shadows are, 0 to 1 (default 0.35) */\n opacity?: number;\n /** How dark the night is, 0 to 1: the scene tinted in its blue, the windows of the buildings and the streets of\n * `vectors()` lit, the labels light on dark. By default from the sun's altitude: falling from 6° above the horizon\n * to 6° under it */\n night?: number;\n}\n\n/** What can be seen from a point (`GeoMap.setViewshed`); with several observers, the colors, the opacity and the\n * cone's color are the first one's */\nexport interface ViewshedOptions {\n /** The observer */\n position: LonLat;\n /** Metres above the ground (default 1.7, eye level) */\n height?: number;\n /** Metres around the observer that are tinted (default 1000) */\n range?: number;\n /** A CSS color for what is seen (default `#2f9e44`) */\n visibleColor?: string;\n /** A CSS color for what is hidden (default `#e03131`) */\n hiddenColor?: string;\n /** How strongly the colors tint the scene, multiplied into it so that its textures and shading stay, 0-1 (default\n * 0.7) */\n opacity?: number;\n /** A CSS color for the cone drawn in 3D (one way only): its fan through the axis, at the eye's height and tilted\n * with it, from the eye to the range; solid where nothing hides it, faint behind the scene; none by default */\n coneColor?: string;\n /** To look one way only (a camera, a lookout), degrees clockwise from north; all around without it */\n direction?: number;\n /** Degrees above the horizon the cone looks, negative below (default 0) */\n tilt?: number;\n /** Angle of view across, degrees (default 60) */\n fov?: number;\n /** Angle of view up and down, degrees (default 40) */\n verticalFov?: number;\n}\n\n/** An eye at street level (`GeoMap.setFirstPerson`) */\nexport interface FirstPersonView {\n /** Where it stands */\n lonLat: LonLat;\n /** Metres above the ground (default 1.7) */\n height?: number;\n /** Degrees clockwise from north it looks to */\n bearing: number;\n /** Degrees from straight down: 90 level (the default), 180 straight up */\n pitch?: number;\n /** Vertical field of view, degrees (default 75) */\n fov?: number;\n}\n\n/** Layers shown on one side of a vertical line only (`GeoMap.setSwipe`) */\nexport interface SwipeOptions {\n /** CSS pixels from the left of the map */\n position: number;\n layers: readonly Layer[];\n /** The side they show on (default 'left') */\n side?: 'left' | 'right';\n /** Layers shown on the other side only: two meshes of the same place, each on its side, never drawn over each other */\n other?: readonly Layer[];\n}\n\n/** Animation of a camera move */\nexport interface AnimationOptions {\n /** Milliseconds */\n duration?: number;\n /** Progress over time, both 0 to 1 */\n easing?: (t: number) => number;\n}\n\nexport interface FlyToOptions extends AnimationOptions {\n /** How far the flight zooms out on its way, as MapLibre's `curve` (default 1.42) */\n curve?: number;\n /** Average speed in screens per second when `duration` is not given (default 1.2) */\n speed?: number;\n}\n\n/**\n * Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':\n * longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the\n * north (NASA's Trek WMTS, WorldCRS84Quad). A `TileGrid`: the tile matrices of a WMTS in any CRS (Lambert-93…), or a\n * WMS asked for each tile's box in its CRS. The last two are reprojected into Web Mercator tiles by the map's workers\n * (in the page with `workers: false`).\n */\nexport type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;\n\n/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\nexport interface RasterOptions {\n /** Tile URL with {z}, {x} and {y} (256 px tiles); unused with a `loader` */\n url: string;\n /** Tile grid of `url` (default 'mercator'); with 'equirectangular', `minZoom` and `maxZoom` are levels of that\n * grid; with a `TileGrid`, they are map zooms, by default those its matrices span */\n grid?: RasterGrid;\n minZoom?: number;\n maxZoom?: number;\n opacity?: number;\n /** 0 = greyscale, 1 = original colors */\n saturation?: number;\n /** Side of the tiles' textures, pixels (default 256): more for sharper tiles drawn by a `loader` */\n size?: number;\n /** Draws each tile instead of fetching `url`: an image of `size` × `size`, null for nothing there; a rejection is\n * retried like a network error */\n loader?: (z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>;\n /** Credits of the tiles, HTML: shown by the attribution control while the layer is on the map */\n attribution?: string;\n}\n\nexport interface NetworkStyle {\n /** Line width, CSS pixels, or zoom stops `[[zoom, width], …]` (default 2) */\n width: Size;\n /** Values above are drawn as unreached (default 1800) */\n max: number;\n /** Darker line every `contour` value units, 0 for none (default 0) */\n contour: number;\n opacity: number;\n /** Width of the halo drawn under the lines, CSS pixels or zoom stops, 0 for none (default 0): wide and faint, the\n * reached streets add up into a heat map that fills the blocks */\n halo: Size;\n /** Opacity of the halo at the middle of a line, fading quadratically to its sides (default 0.11) */\n haloOpacity: number;\n /** Colors from 0 to `max`: `[[fraction of max, color], …]` (default green to red) */\n ramp: Ramp | undefined;\n /** Color of the parts beyond `max` or unreached (default `rgba(140, 140, 140, 0.25)`) */\n unreachedColor: string;\n /** Share of `max` over which the colors fade out before it, 0 to 1 (default 0) */\n fade: number;\n}\n\nexport interface NetworkOptions extends Partial<NetworkStyle> {\n /** Node coordinates in degrees: lon0, lat0, lon1, lat1… */\n nodes: Float64Array;\n /** Edges as node index pairs: a0, b0, a1, b1… */\n edges: Uint32Array;\n /** Line of each edge, from A to B: the points of edge e are `points[start[e] .. start[e + 1]]` (lon, lat pairs,\n * counted in points); with fewer than two points an edge is straight. Default: all straight. */\n lines?: { start: Uint32Array; points: Float64Array };\n /** Per edge, the cost of travelling it from A to B then from B to A, in value units (Infinity: closed that way;\n * closed both ways: not drawn). A point along an edge then takes the quickest way there, min(value(A) + cost from\n * A, value(B) + cost from B), as a travel time does. Without costs, values are interpolated along the edges. */\n costs?: Float32Array;\n /** Width factor of each edge (default 1): rail lines wider than streets */\n edgeWidths?: Float32Array;\n}\n\nexport interface Tiles3dStyle {\n /** Screen-space error (CSS pixels) above which a tile is refined: 16 by default, lower is finer and heavier */\n maxScreenSpaceError: number;\n opacity: number;\n /** Size of the points of point cloud tiles (`.pnts`, glTF points), CSS pixels: 2 by default */\n pointSize?: number;\n /** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without\n * textures are light grey without it); none by default */\n color?: string;\n}\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle> {\n /** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */\n url: string;\n /** Its heights are altitudes above the geoid (NGF-IGN69), as the IGN's Bâtiments 3D, rather than above the\n * ellipsoid (3D Tiles as specified): each tile raised by the RAF20 geoid, onto the IGN relief (default false) */\n geoid?: boolean;\n}\n\nexport interface MapPointerEvent {\n point: Point;\n /** Undefined above the horizon */\n lonLat: LonLat | undefined;\n}\n\n/** What 'hoverfeature' found under the pointer */\nexport interface MapHoverFeatureEvent extends MapPointerEvent {\n /** The feature under the pointer (see `GeoMap.pickFeature`), undefined if none */\n hit: FeatureHit | undefined;\n}\n\n/** A picked feature: its layer handle, its index there and, for line, circle, fill, extrusion, point cloud and 3D\n * Tiles layers, the feature itself (a building of 3D Tiles with its properties) */\nexport interface FeatureHit {\n layer: Layer;\n index: number;\n feature: Feature | undefined;\n}\n\nexport interface MapEvents {\n /** The camera started moving (a gesture, an animation or `setCamera`) */\n movestart: Camera;\n /** The camera moved */\n move: Camera;\n /** The camera stopped: no gesture held, no animation running */\n moveend: Camera;\n /** The map changed size (CSS pixels) */\n resize: { width: number; height: number };\n /** The pointer moved over the map (at most once per frame, not while dragging) */\n hover: MapPointerEvent;\n /** What is under the pointer, picked without stalling the GPU: a frame or two after 'hover', only while listened to\n * (radius and layers in `GeoMap.hoverPicking`) */\n hoverfeature: MapHoverFeatureEvent;\n /** Click without drag */\n click: MapPointerEvent;\n /** A frame was drawn; duration of the engine call in milliseconds */\n render: { ms: number };\n /** Everything in view is loaded and drawn, nothing moves: the end of a load, once after each change (as MapLibre's\n * `idle`). Tiles requested by the first frame count, so it never fires before they arrive. */\n idle: Record<string, never>;\n /** The pointer left the canvas (a mouse going out of the map, or onto a control or marker) */\n leave: Record<string, never>;\n}\n\n/** What a layer handle needs from its map */\nexport interface LayerHost {\n readonly engine: Engine;\n requestRender(): void;\n /** Forgets a removed layer */\n detach(layer: Layer): void;\n /** Moves a layer under `before`, or on top */\n moveLayer(layer: Layer, before: Layer | undefined): void;\n /** A layer created again in the engine (new id): put at the place of its old id, which is removed */\n replaceLayer(layer: Layer, old: number): void;\n /** Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0CAA0C","sourcesContent":["/** Public types of the `isard` package */\n\nimport type { TileGrid } from './basemap/grid.ts';\nimport type { DecoderUrls } from './engine/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard.js';\n\nexport type LonLat = [lon: number, lat: number];\nexport type Point = [x: number, y: number];\n\n/**\n * The named basemaps. OpenFreeMap's vector styles, OpenStreetMap data worldwide, their labels above the other layers:\n * `osm-positron` (light grey, quiet: data over it reads first), `osm-liberty` and `osm-bright` (in colour), `osm-dark`\n * (near black: bright data over it, a wind's particles, lights). The\n * Géoplateforme's (IGN, France): rasters (`ign-plan`, `ign-plan-grey`, `ign-ortho`, the aerial photographs) or vector\n * tiles with their labels (`ign-plan-vector`, `ign-plan-grey-vector`, the PLAN.IGN styles).\n */\nexport type BasemapName =\n | 'osm-positron'\n | 'osm-liberty'\n | 'osm-bright'\n | 'osm-dark'\n | 'ign-plan'\n | 'ign-plan-grey'\n | 'ign-ortho'\n | 'ign-plan-vector'\n | 'ign-plan-grey-vector'\n | 'none';\n\n/** A basemap by name (see `BasemapName`) */\nexport type Basemap = BasemapName;\n\n/**\n * The Earth's named terrain models. `'terrain-tiles'`: worldwide, the Terrain Tiles of AWS's open data registry\n * (SRTM, EU-DEM, GMTED… merged by Mapzen, 30 m in most places), the sea floor flattened at sea level. `'ign'`: France,\n * the IGN's RGE ALTI from the Géoplateforme (1 to 5 m), raised by the RAF20 geoid to heights above the ellipsoid.\n */\nexport type TerrainModel = 'terrain-tiles' | 'ign';\n\n/** How tiles encode their altitudes: `'float32'`, raw little-endian floats (`image/x-bil;bits=32`, an ArcGIS raw\n * grid); `'terrarium'`, the colors of a PNG, `R × 256 + G + B / 256 - 32768`; `'mapbox'`, those of Terrain-RGB,\n * `(R × 65536 + G × 256 + B) / 10 - 10000` */\nexport type TerrainEncoding = 'float32' | 'terrarium' | 'mapbox';\n\n/**\n * How tiles load and show. 'immediate' (default): everything visible loads, tiles show as soon as they arrive.\n * 'smooth': during flights the levels flown through are skipped, off-center tiles wait while the camera moves, tiles\n * fade in; fewer downloads, for slow networks or GPUs.\n */\nexport type LoadingMode = 'immediate' | 'smooth';\n\n/** 'globe': a sphere at low zoom, blending into Web Mercator between zooms 5 and 7, up to three levels later under a\n * tilted camera (it sees much farther than its center: the horizon stays curved) */\nexport type Projection = 'globe' | 'mercator';\n\n/** A body to draw the map on, other than the named ones (`CelestialBody`) */\nexport interface BodyOptions {\n /** Equatorial radius, metres */\n radius: number;\n /** Flattening of its ellipsoid, 0 for a sphere (default 0) */\n flattening?: number;\n /** An atmosphere: its halo around the globe, true for the Earth's light blue, or a CSS color (its alpha the\n * halo's strength) (default false) */\n atmosphere?: boolean | string;\n /** Color of the globe where no tile covers it (past the Web Mercator latitudes, 85°), a CSS color (default\n * `#808080`) */\n color?: string;\n /** Lowest and highest altitudes of its ground, metres around the ellipsoid: what its relief may raise into view\n * (default ±1 % of the radius) */\n relief?: [lowest: number, highest: number];\n}\n\n/**\n * The body the map is drawn on: 'earth' (WGS 84, the default), 'moon' (a sphere of 1 737 400 m, no atmosphere),\n * 'mars' (a sphere of 3 396 190 m, its equatorial radius, a thin dusty halo; planetocentric latitudes) or another\n * one. Zoom levels keep their meaning on screen (the Web Mercator tile pyramid), their metres follow the body:\n * altitudes, relief, buildings, 3D Tiles. Off the Earth, the map has none of the Earth's defaults: no basemap, no\n * credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.\n */\nexport type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;\n\nexport interface GeoMapOptions extends Partial<Camera> {\n /** The body the map is drawn on (default 'earth'); set at creation */\n body?: CelestialBody;\n /** Default 'globe' */\n projection?: Projection;\n /** Default 'immediate' */\n loading?: LoadingMode;\n /** The basemap (default 'osm-positron'; 'none' off the Earth) */\n basemap?: Basemap;\n /** Opacity of the IGN hillshade over the basemap (France, Géoplateforme), 0 for none (default 0) */\n hillshade?: number;\n /** Color behind the map (sky of tilted flat views), a CSS color (default `#f2f2f0`; black off the Earth) */\n background?: string;\n /** Space behind the globe: stars and atmosphere halo, fading out as the globe turns flat (default true) */\n sky?: boolean;\n /** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */\n sun?: SunOptions;\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on\n * the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options\n * (default false; on another body, its `url` is required). Network layers are draped on it */\n terrain?: boolean | TerrainModel | TerrainOptions;\n minZoom?: number;\n maxZoom?: number;\n /** Highest pitch, degrees, up to 85 (default 70) */\n maxPitch?: number;\n /** Sky over the plane, seen when the camera is tilted towards the horizon, and the fog the ground fades into\n * (MapLibre's `setSky`); default none: the background color */\n atmosphere?: AtmosphereOptions;\n /** Mouse, touch and keyboard controls (default true) */\n interactive?: boolean;\n /** Keyboard controls once the map has the focus (it is reached with Tab): arrows pan, Shift + arrows rotate and\n * tilt, + and - zoom (Shift: two levels), 0 faces north and levels the view (default true; none when not\n * `interactive`) */\n keyboard?: boolean;\n /** Accessible name of the map, read by screen readers (default 'Map') */\n ariaLabel?: string;\n /** A preset of map options (`IGN_PRESETS`: `'ign'`, `'ign-3d'`, `'ign-ortho-3d'`), the other options over it */\n preset?: 'ign' | 'ign-3d' | 'ign-ortho-3d';\n /** The folder isard's files are served from (its engines, `isard_bg.wasm`, `isard_core_bg.wasm`,\n * `isard_points_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that\n * moves them, the `…Url` options below for each one. `isard/vite` sets it for the whole page; default next to the\n * module */\n assetsUrl?: string | URL;\n /** Where to load the engine with 3D Tiles from (`isard_bg.wasm`), when a bundler does not resolve the default URL.\n * Given without `coreWasmUrl`, maps load this engine from the start */\n wasmUrl?: string | URL;\n /** Where to load the engine without 3D Tiles from (`isard_core_bg.wasm`, a third smaller), when a bundler does not\n * resolve the default URL. Maps load it first, and the engine with 3D Tiles (`wasmUrl`) for their first 3D Tiles\n * layer only */\n coreWasmUrl?: string | URL;\n /** Where the decoding workers load the point cloud module from (`isard_points_bg.wasm`, the LAZ decoder of COPC),\n * when a bundler does not resolve the default URL. Loaded with the first point cloud only */\n pointsWasmUrl?: string | URL;\n /** Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`: the vector tiles drawn as\n * geometry, `vectorTiles().vectors()`, made ready for the GPU off the main thread), when a bundler does not resolve\n * the default URL. Loaded with the first tile of geometry; without it, the main thread does that work */\n tessWasmUrl?: string | URL;\n /** Where the workers load the grid module from (`isard_grid_bg.wasm`: GRIB2 and NetCDF files read by\n * `map.readGrids`), when a bundler does not resolve the default URL. Loaded with the first file */\n gridWasmUrl?: string | URL;\n /** Load the engine with 3D Tiles from the start (default false: it is loaded when the first 3D Tiles layer or glTF\n * model is added, the map then moving its camera and layers onto it, a stall of about a frame or two). For a map that shows 3D Tiles\n * at once: one engine downloaded instead of two. `'preload'`: the map starts on the engine without 3D Tiles and\n * downloads and compiles the other once idle, without running it: its first 3D Tiles layer does not wait for the\n * download (for a map that will show 3D Tiles later, on demand) */\n tiles3d?: boolean | 'preload';\n /** Where to load the vector basemap worker from, when a bundler does not resolve the default URL */\n basemapWorkerUrl?: string | URL;\n /** Texture size of the vector basemap's tiles, pixels (default 512: lines and edges sharp at every zoom on a screen\n * of pixel ratio 1). 256: a quarter of the drawing in the workers, of the uploads and of the GPU memory, for lines\n * and edges a little softer between two zoom levels (the tiles are shown 181 to 362 CSS pixels wide) */\n basemapTileSize?: number;\n /** Glyphs of the symbol layers: a URL with `{fontstack}` and `{range}` (MapLibre's glyph format; default\n * OpenFreeMap's fonts, Noto Sans). A vector basemap's labels take the glyphs of its style */\n glyphs?: string;\n /** Workers decoding 3D Tiles off the main thread: a count, or false to decode on the main thread (default: cores - 1,\n * 1 to 4). False (or 0) also decodes the PNG relief and reprojects the equirectangular rasters on the main thread,\n * else done by the vector basemap's workers */\n workers?: number | false;\n /** Where to load the decoding worker from, when a bundler does not resolve the default URL */\n workerUrl?: string | URL;\n /** Folders of the Draco and Basis Universal decoders, loaded by the workers on first use (default: the official\n * builds on gstatic.com and jsDelivr; self-host them for offline or locked-down networks). They run through\n * `new Function`: a Content Security Policy needs `'unsafe-eval'` (see `DecoderUrls`) */\n decoders?: Partial<DecoderUrls>;\n /** Credits at the bottom right: false for none, or its options (default true: the credits of the basemap,\n * hillshade and relief in use, compact on maps narrower than 640 px) */\n attributionControl?: boolean | AttributionOptions;\n}\n\nexport interface TerrainOptions {\n /** One of the Earth's named models (default `'terrain-tiles'` on the Earth); unused with a `url` */\n model?: TerrainModel;\n /** Altitudes of 256 × 256 tiles in `encoding`: a WMS GetMap URL with {bbox} (EPSG:3857 on the Earth, the body's\n * Mercator metres elsewhere: the sphere of its radius), a tile URL with {z}, {x} and {y}, or an ArcGIS image service\n * (a URL ending in `/ImageServer`), asked for raw altitudes in the body's Mercator (default: the `model`'s; on the\n * Moon and Mars, NASA's Trek LOLA and MOLA models) */\n url?: string;\n /** How the tiles of `url` encode their altitudes (default `'float32'`); `'terrarium'` and `'mapbox'` take a URL with\n * {z}, {x} and {y} */\n encoding?: TerrainEncoding;\n /** Vertical exaggeration, 1 for the true relief (default 1) */\n exaggeration?: number;\n /** Finest level of the relief, up to 15 (default 15; 14 for the Terrain Tiles, 8 for the Moon's and Mars's models). It\n * starts at level 6 on the Earth, coarser on bodies of a larger relief for their size (3 on the Moon and Mars) */\n maxZoom?: number;\n /** Altitudes over mainland France raised by the height of the RAF20 geoid (the French one, 0 away from France), to\n * heights above the ellipsoid (those of 3D Tiles); false keeps the altitudes as served (NGF-IGN69 for the IGN's)\n * (default true for the `'ign'` model, false otherwise) */\n geoid?: boolean;\n}\n\n/** Sky, horizon and fog over the plane, with the names and meanings of MapLibre's `setSky` */\nexport interface AtmosphereOptions {\n /** A CSS color (default `#9cc7ec`) */\n skyColor?: string;\n /** (default `#e8f1f8`) */\n horizonColor?: string;\n /** (default `#f2f5f8`) */\n fogColor?: string;\n /** Blend from the horizon to the sky color, share of the field of view above the horizon, 0-1 (default 0.6) */\n skyHorizonBlend?: number;\n /** Blend from the horizon to the fog color below the horizon, 0-1 (default 0.7) */\n horizonFogBlend?: number;\n /** Share of the distance to the far plane over which the ground fades into the fog, 0-1 (default 0.4) */\n fogGroundBlend?: number;\n}\n\n/** The sun casting shadows (`GeoMap.setSun`): where it stands, by date or by hand, and how dark its shadows are */\nexport interface SunOptions {\n /** The time: the sun where it stands then over the map's center (default now, unless `azimuth` and `altitude`) */\n date?: Date;\n /** Degrees clockwise from north, with `altitude`: the sun placed by hand */\n azimuth?: number;\n /** Degrees above the horizon; at or under it, no shadows */\n altitude?: number;\n /** How dark the shadows are, 0 to 1 (default 0.35) */\n opacity?: number;\n /** How dark the night is, 0 to 1: the scene tinted in its blue, the windows of the buildings and the streets of\n * `vectors()` lit, the labels light on dark. By default from the sun's altitude: falling from 6° above the horizon\n * to 6° under it */\n night?: number;\n}\n\n/** What can be seen from a point (`GeoMap.setViewshed`); with several observers, the colors, the opacity and the\n * cone's color are the first one's */\nexport interface ViewshedOptions {\n /** The observer */\n position: LonLat;\n /** Metres above the ground (default 1.7, eye level) */\n height?: number;\n /** Metres around the observer that are tinted (default 1000) */\n range?: number;\n /** A CSS color for what is seen (default `#2f9e44`) */\n visibleColor?: string;\n /** A CSS color for what is hidden (default `#e03131`) */\n hiddenColor?: string;\n /** How strongly the colors tint the scene, multiplied into it so that its textures and shading stay, 0-1 (default\n * 0.7) */\n opacity?: number;\n /** A CSS color for the cone drawn in 3D (one way only): its fan through the axis, at the eye's height and tilted\n * with it, from the eye to the range; solid where nothing hides it, faint behind the scene; none by default */\n coneColor?: string;\n /** To look one way only (a camera, a lookout), degrees clockwise from north; all around without it */\n direction?: number;\n /** Degrees above the horizon the cone looks, negative below (default 0) */\n tilt?: number;\n /** Angle of view across, degrees (default 60) */\n fov?: number;\n /** Angle of view up and down, degrees (default 40) */\n verticalFov?: number;\n}\n\n/** An eye at street level (`GeoMap.setFirstPerson`) */\nexport interface FirstPersonView {\n /** Where it stands */\n lonLat: LonLat;\n /** Metres above the ground (default 1.7) */\n height?: number;\n /** Degrees clockwise from north it looks to */\n bearing: number;\n /** Degrees from straight down: 90 level (the default), 180 straight up */\n pitch?: number;\n /** Vertical field of view, degrees (default 75) */\n fov?: number;\n}\n\n/** Layers shown on one side of a vertical line only (`GeoMap.setSwipe`) */\nexport interface SwipeOptions {\n /** CSS pixels from the left of the map */\n position: number;\n layers: readonly Layer[];\n /** The side they show on (default 'left') */\n side?: 'left' | 'right';\n /** Layers shown on the other side only: two meshes of the same place, each on its side, never drawn over each other */\n other?: readonly Layer[];\n}\n\n/** Animation of a camera move */\nexport interface AnimationOptions {\n /** Milliseconds */\n duration?: number;\n /** Progress over time, both 0 to 1 */\n easing?: (t: number) => number;\n}\n\nexport interface FlyToOptions extends AnimationOptions {\n /** How far the flight zooms out on its way, as MapLibre's `curve` (default 1.42) */\n curve?: number;\n /** Average speed in screens per second when `duration` is not given (default 1.2) */\n speed?: number;\n}\n\n/**\n * Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':\n * longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the\n * north (NASA's Trek WMTS, WorldCRS84Quad). A `TileGrid`: the tile matrices of a WMTS in any CRS (Lambert-93…), or a\n * WMS asked for each tile's box in its CRS. The last two are reprojected into Web Mercator tiles by the map's workers\n * (in the page with `workers: false`).\n */\nexport type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;\n\n/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\nexport interface RasterOptions {\n /** Tile URL with {z}, {x} and {y} (256 px tiles); unused with a `loader` */\n url: string;\n /** Tile grid of `url` (default 'mercator'); with 'equirectangular', `minZoom` and `maxZoom` are levels of that\n * grid; with a `TileGrid`, they are map zooms, by default those its matrices span */\n grid?: RasterGrid;\n minZoom?: number;\n maxZoom?: number;\n opacity?: number;\n /** 0 = greyscale, 1 = original colors */\n saturation?: number;\n /** Side of the tiles' textures, pixels (default 256): more for sharper tiles drawn by a `loader` */\n size?: number;\n /** Draws each tile instead of fetching `url`: an image of `size` × `size`, null for nothing there; a rejection is\n * retried like a network error */\n loader?: (z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>;\n /** Credits of the tiles, HTML: shown by the attribution control while the layer is on the map */\n attribution?: string;\n}\n\nexport interface NetworkStyle {\n /** Line width, CSS pixels, or zoom stops `[[zoom, width], …]` (default 2) */\n width: Size;\n /** Values above are drawn as unreached (default 1800) */\n max: number;\n /** Darker line every `contour` value units, 0 for none (default 0) */\n contour: number;\n opacity: number;\n /** Width of the halo drawn under the lines, CSS pixels or zoom stops, 0 for none (default 0): wide and faint, the\n * reached streets add up into a heat map that fills the blocks */\n halo: Size;\n /** Opacity of the halo at the middle of a line, fading quadratically to its sides (default 0.11) */\n haloOpacity: number;\n /** Colors from 0 to `max`: `[[fraction of max, color], …]` (default green to red) */\n ramp: Ramp | undefined;\n /** Color of the parts beyond `max` or unreached (default `rgba(140, 140, 140, 0.25)`) */\n unreachedColor: string;\n /** Share of `max` over which the colors fade out before it, 0 to 1 (default 0) */\n fade: number;\n}\n\nexport interface NetworkOptions extends Partial<NetworkStyle> {\n /** Node coordinates in degrees: lon0, lat0, lon1, lat1… */\n nodes: Float64Array;\n /** Edges as node index pairs: a0, b0, a1, b1… */\n edges: Uint32Array;\n /** Line of each edge, from A to B: the points of edge e are `points[start[e] .. start[e + 1]]` (lon, lat pairs,\n * counted in points); with fewer than two points an edge is straight. Default: all straight. */\n lines?: { start: Uint32Array; points: Float64Array };\n /** Per edge, the cost of travelling it from A to B then from B to A, in value units (Infinity: closed that way;\n * closed both ways: not drawn). A point along an edge then takes the quickest way there, min(value(A) + cost from\n * A, value(B) + cost from B), as a travel time does. Without costs, values are interpolated along the edges. */\n costs?: Float32Array;\n /** Width factor of each edge (default 1): rail lines wider than streets */\n edgeWidths?: Float32Array;\n}\n\nexport interface Tiles3dStyle {\n /** Screen-space error (CSS pixels) above which a tile is refined: 16 by default, lower is finer and heavier */\n maxScreenSpaceError: number;\n opacity: number;\n /** Size of the points of point cloud tiles (`.pnts`, glTF points), CSS pixels: 2 by default */\n pointSize?: number;\n /** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without\n * textures are light grey without it); none by default */\n color?: string;\n}\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle> {\n /** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */\n url: string;\n /** Its heights are altitudes above the geoid (NGF-IGN69), as the IGN's Bâtiments 3D, rather than above the\n * ellipsoid (3D Tiles as specified): each tile raised by the RAF20 geoid, onto the IGN relief (default false) */\n geoid?: boolean;\n}\n\nexport interface MapPointerEvent {\n point: Point;\n /** Undefined above the horizon */\n lonLat: LonLat | undefined;\n}\n\n/** What 'hoverfeature' found under the pointer */\nexport interface MapHoverFeatureEvent extends MapPointerEvent {\n /** The feature under the pointer (see `GeoMap.pickFeature`), undefined if none */\n hit: FeatureHit | undefined;\n}\n\n/** A picked feature: its layer handle, its index there and, for line, circle, fill, extrusion, point cloud and 3D\n * Tiles layers, the feature itself (a building of 3D Tiles with its properties) */\nexport interface FeatureHit {\n layer: Layer;\n index: number;\n feature: Feature | undefined;\n}\n\nexport interface MapEvents {\n /** The camera started moving (a gesture, an animation or `setCamera`) */\n movestart: Camera;\n /** The camera moved */\n move: Camera;\n /** The camera stopped: no gesture held, no animation running */\n moveend: Camera;\n /** The map changed size (CSS pixels) */\n resize: { width: number; height: number };\n /** The pointer moved over the map (at most once per frame, not while dragging) */\n hover: MapPointerEvent;\n /** What is under the pointer, picked without stalling the GPU: a frame or two after 'hover', only while listened to\n * (radius and layers in `GeoMap.hoverPicking`) */\n hoverfeature: MapHoverFeatureEvent;\n /** Click without drag */\n click: MapPointerEvent;\n /** A frame was drawn; duration of the engine call in milliseconds */\n render: { ms: number };\n /** Everything in view is loaded and drawn, nothing moves: the end of a load, once after each change (as MapLibre's\n * `idle`). Tiles requested by the first frame count, so it never fires before they arrive. */\n idle: Record<string, never>;\n /** The pointer left the canvas (a mouse going out of the map, or onto a control or marker) */\n leave: Record<string, never>;\n}\n\n/** What a layer handle needs from its map */\nexport interface LayerHost {\n readonly engine: Engine;\n requestRender(): void;\n /** Forgets a removed layer */\n detach(layer: Layer): void;\n /** Moves a layer under `before`, or on top */\n moveLayer(layer: Layer, before: Layer | undefined): void;\n /** A layer created again in the engine (new id): put at the place of its old id, which is removed */\n replaceLayer(layer: Layer, old: number): void;\n /** Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void>;\n /** Work the map waits on before it is idle (`GeoMap.track`) */\n track<T>(work: Promise<T>): Promise<T>;\n}\n"]}
|
package/dist/util/geo.d.ts
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
* Web Mercator in [0, 1] across the world (y towards the south), for the page and the workers alike: the positions
|
|
3
3
|
* sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.
|
|
4
4
|
*/
|
|
5
|
+
/** Radians in a degree */
|
|
6
|
+
export declare const RAD: number;
|
|
7
|
+
/** The Earth's circumference at the equator, metres (Web Mercator's sphere: WGS 84's major axis) */
|
|
8
|
+
export declare const EARTH_METRES = 40075016.686;
|
|
9
|
+
/** Metres in a degree of latitude (and of longitude at the equator), on that sphere */
|
|
10
|
+
export declare const METRES_PER_DEGREE: number;
|
|
5
11
|
/** Mercator x of a longitude (degrees) */
|
|
6
12
|
export declare const mercatorX: (lon: number) => number;
|
|
7
13
|
/** Mercator y of a latitude (degrees), clamped to the edges of the map */
|
|
@@ -14,3 +20,5 @@ export declare const latitude: (y: number) => number;
|
|
|
14
20
|
export declare const toMercator: ([lon, lat]: readonly [number, number, ...unknown[]]) => [x: number, y: number];
|
|
15
21
|
/** Longitude and latitude of a Mercator x, y */
|
|
16
22
|
export declare const fromMercator: ([x, y]: readonly [number, number]) => [lon: number, lat: number];
|
|
23
|
+
/** Metres across a tile of level `z` and row `y` at its middle */
|
|
24
|
+
export declare const tileMetres: (z: number, y: number) => number;
|
package/dist/util/geo.js
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
* Web Mercator in [0, 1] across the world (y towards the south), for the page and the workers alike: the positions
|
|
3
3
|
* sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.
|
|
4
4
|
*/
|
|
5
|
+
/** Radians in a degree */
|
|
6
|
+
export const RAD = Math.PI / 180;
|
|
7
|
+
/** The Earth's circumference at the equator, metres (Web Mercator's sphere: WGS 84's major axis) */
|
|
8
|
+
export const EARTH_METRES = 40_075_016.686;
|
|
9
|
+
/** Metres in a degree of latitude (and of longitude at the equator), on that sphere */
|
|
10
|
+
export const METRES_PER_DEGREE = EARTH_METRES / 360;
|
|
5
11
|
/** The latitude where Web Mercator is square: the edges of the map */
|
|
6
12
|
const MAX_LAT = 85.051128779806589;
|
|
7
13
|
/** Mercator x of a longitude (degrees) */
|
|
@@ -29,4 +35,6 @@ export const toMercator = ([lon, lat]) => {
|
|
|
29
35
|
export const fromMercator = ([x, y]) => {
|
|
30
36
|
return [longitude(x), latitude(y)];
|
|
31
37
|
};
|
|
38
|
+
/** Metres across a tile of level `z` and row `y` at its middle */
|
|
39
|
+
export const tileMetres = (z, y) => (EARTH_METRES * Math.cos((latitude((y + 0.5) / 2 ** z) * Math.PI) / 180)) / 2 ** z;
|
|
32
40
|
//# sourceMappingURL=geo.js.map
|
package/dist/util/geo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo.js","sourceRoot":"","sources":["../../src/util/geo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3B,CAAC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IAEzE,OAAO,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAS,EAAU,EAAE;IAC7C,OAAO,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AACvB,CAAC,CAAC;AAEF,yCAAyC;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE;IAC5C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AACvE,CAAC,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAA0C,EAA0B,EAAE;IACxG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAA4B,EAA8B,EAAE;IAC5F,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["/**\n * Web Mercator in [0, 1] across the world (y towards the south), for the page and the workers alike: the positions\n * sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.\n */\n\n/** The latitude where Web Mercator is square: the edges of the map */\nconst MAX_LAT = 85.051128779806589;\n\n/** Mercator x of a longitude (degrees) */\nexport const mercatorX = (lon: number): number => {\n return (lon + 180) / 360;\n};\n\n/** Mercator y of a latitude (degrees), clamped to the edges of the map */\nexport const mercatorY = (lat: number): number => {\n const phi = (Math.max(-MAX_LAT, Math.min(MAX_LAT, lat)) * Math.PI) / 180;\n\n return 0.5 - Math.log(Math.tan(Math.PI / 4 + phi / 2)) / (2 * Math.PI);\n};\n\n/** Longitude (degrees) of a Mercator x */\nexport const longitude = (x: number): number => {\n return x * 360 - 180;\n};\n\n/** Latitude (degrees) of a Mercator y */\nexport const latitude = (y: number): number => {\n return (Math.atan(Math.sinh(Math.PI * (1 - 2 * y))) * 180) / Math.PI;\n};\n\n/** Mercator x, y of a longitude and latitude */\nexport const toMercator = ([lon, lat]: readonly [number, number, ...unknown[]]): [x: number, y: number] => {\n return [mercatorX(lon), mercatorY(lat)];\n};\n\n/** Longitude and latitude of a Mercator x, y */\nexport const fromMercator = ([x, y]: readonly [number, number]): [lon: number, lat: number] => {\n return [longitude(x), latitude(y)];\n};\n"]}
|
|
1
|
+
{"version":3,"file":"geo.js","sourceRoot":"","sources":["../../src/util/geo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0BAA0B;AAC1B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAEjC,oGAAoG;AACpG,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAE3C,uFAAuF;AACvF,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,GAAG,GAAG,CAAC;AAEpD,sEAAsE;AACtE,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3B,CAAC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IAEzE,OAAO,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAS,EAAU,EAAE;IAC7C,OAAO,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AACvB,CAAC,CAAC;AAEF,yCAAyC;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE;IAC5C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AACvE,CAAC,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAA0C,EAA0B,EAAE;IACxG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAA4B,EAA8B,EAAE;IAC5F,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF,kEAAkE;AAClE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CACzD,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/**\n * Web Mercator in [0, 1] across the world (y towards the south), for the page and the workers alike: the positions\n * sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.\n */\n\n/** Radians in a degree */\nexport const RAD = Math.PI / 180;\n\n/** The Earth's circumference at the equator, metres (Web Mercator's sphere: WGS 84's major axis) */\nexport const EARTH_METRES = 40_075_016.686;\n\n/** Metres in a degree of latitude (and of longitude at the equator), on that sphere */\nexport const METRES_PER_DEGREE = EARTH_METRES / 360;\n\n/** The latitude where Web Mercator is square: the edges of the map */\nconst MAX_LAT = 85.051128779806589;\n\n/** Mercator x of a longitude (degrees) */\nexport const mercatorX = (lon: number): number => {\n return (lon + 180) / 360;\n};\n\n/** Mercator y of a latitude (degrees), clamped to the edges of the map */\nexport const mercatorY = (lat: number): number => {\n const phi = (Math.max(-MAX_LAT, Math.min(MAX_LAT, lat)) * Math.PI) / 180;\n\n return 0.5 - Math.log(Math.tan(Math.PI / 4 + phi / 2)) / (2 * Math.PI);\n};\n\n/** Longitude (degrees) of a Mercator x */\nexport const longitude = (x: number): number => {\n return x * 360 - 180;\n};\n\n/** Latitude (degrees) of a Mercator y */\nexport const latitude = (y: number): number => {\n return (Math.atan(Math.sinh(Math.PI * (1 - 2 * y))) * 180) / Math.PI;\n};\n\n/** Mercator x, y of a longitude and latitude */\nexport const toMercator = ([lon, lat]: readonly [number, number, ...unknown[]]): [x: number, y: number] => {\n return [mercatorX(lon), mercatorY(lat)];\n};\n\n/** Longitude and latitude of a Mercator x, y */\nexport const fromMercator = ([x, y]: readonly [number, number]): [lon: number, lat: number] => {\n return [longitude(x), latitude(y)];\n};\n\n/** Metres across a tile of level `z` and row `y` at its middle */\nexport const tileMetres = (z: number, y: number): number =>\n (EARTH_METRES * Math.cos((latitude((y + 0.5) / 2 ** z) * Math.PI) / 180)) / 2 ** z;\n"]}
|
package/dist/util/gltf.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/** glTF binaries made by the page (the basemap's trees and
|
|
1
|
+
/** glTF binaries made by the page (the basemap's trees and furniture, the photos, COLLADA and IFC models): their
|
|
2
|
+
* bounds, their buffers, their chunks */
|
|
2
3
|
/** Lowest and highest of interleaved x, y, z (glTF needs them on positions) */
|
|
3
4
|
export declare const bounds: (xyz: readonly number[]) => {
|
|
4
5
|
min: number[];
|
|
@@ -7,3 +8,19 @@ export declare const bounds: (xyz: readonly number[]) => {
|
|
|
7
8
|
/** A glTF binary of its JSON and its buffer, the chunks padded to 4 bytes (the JSON with spaces, the buffer with
|
|
8
9
|
* zeros) */
|
|
9
10
|
export declare const glbOf: (gltf: unknown, bin: Uint8Array) => Uint8Array<ArrayBuffer>;
|
|
11
|
+
/** A glTF buffer view (`target`: 34962 vertices, 34963 indices, none for an image) */
|
|
12
|
+
interface BufferView {
|
|
13
|
+
buffer: 0;
|
|
14
|
+
byteOffset: number;
|
|
15
|
+
byteLength: number;
|
|
16
|
+
target?: number;
|
|
17
|
+
}
|
|
18
|
+
/** A glTF buffer made part by part, each 4-byte aligned in a view of its own */
|
|
19
|
+
export declare const bufferBuilder: () => {
|
|
20
|
+
views: BufferView[];
|
|
21
|
+
/** A part appended; its view's index */
|
|
22
|
+
append(bytes: Uint8Array, target?: number): number;
|
|
23
|
+
/** The buffer: the parts at their views' offsets */
|
|
24
|
+
bin(): Uint8Array<ArrayBuffer>;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
package/dist/util/gltf.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/** glTF binaries made by the page (the basemap's trees and
|
|
1
|
+
/** glTF binaries made by the page (the basemap's trees and furniture, the photos, COLLADA and IFC models): their
|
|
2
|
+
* bounds, their buffers, their chunks */
|
|
2
3
|
/** Lowest and highest of interleaved x, y, z (glTF needs them on positions) */
|
|
3
4
|
export const bounds = (xyz) => {
|
|
4
5
|
const axes = [0, 1, 2].map((a) => xyz.filter((_, i) => i % 3 === a));
|
|
@@ -24,4 +25,28 @@ export const glbOf = (gltf, bin) => {
|
|
|
24
25
|
out.set(bin, 28 + jsonLength);
|
|
25
26
|
return out;
|
|
26
27
|
};
|
|
28
|
+
/** A glTF buffer made part by part, each 4-byte aligned in a view of its own */
|
|
29
|
+
export const bufferBuilder = () => {
|
|
30
|
+
const parts = [];
|
|
31
|
+
const views = [];
|
|
32
|
+
let offset = 0;
|
|
33
|
+
return {
|
|
34
|
+
views,
|
|
35
|
+
/** A part appended; its view's index */
|
|
36
|
+
append(bytes, target) {
|
|
37
|
+
views.push({ buffer: 0, byteOffset: offset, byteLength: bytes.byteLength, ...(target && { target }) });
|
|
38
|
+
parts.push(bytes);
|
|
39
|
+
offset += Math.ceil(bytes.byteLength / 4) * 4;
|
|
40
|
+
return views.length - 1;
|
|
41
|
+
},
|
|
42
|
+
/** The buffer: the parts at their views' offsets */
|
|
43
|
+
bin() {
|
|
44
|
+
const bin = new Uint8Array(offset);
|
|
45
|
+
parts.forEach((p, i) => {
|
|
46
|
+
bin.set(p, views[i]?.byteOffset ?? 0);
|
|
47
|
+
});
|
|
48
|
+
return bin;
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
};
|
|
27
52
|
//# sourceMappingURL=gltf.js.map
|
package/dist/util/gltf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf.js","sourceRoot":"","sources":["../../src/util/gltf.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gltf.js","sourceRoot":"","sources":["../../src/util/gltf.ts"],"names":[],"mappings":"AAAA;yCACyC;AAEzC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAsB,EAAoC,EAAE;IACjF,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAErE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,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;AACJ,CAAC,CAAC","sourcesContent":["/** glTF binaries made by the page (the basemap's trees and furniture, the photos, COLLADA and IFC models): their\n * bounds, their buffers, their chunks */\n\n/** Lowest and highest of interleaved x, y, z (glTF needs them on positions) */\nexport const bounds = (xyz: readonly number[]): { min: number[]; max: number[] } => {\n const axes = [0, 1, 2].map((a) => xyz.filter((_, i) => i % 3 === a));\n\n return { min: axes.map((v) => Math.min(...v)), max: axes.map((v) => Math.max(...v)) };\n};\n\n/** A glTF binary of its JSON and its buffer, the chunks padded to 4 bytes (the JSON with spaces, the buffer with\n * zeros) */\nexport const glbOf = (gltf: unknown, bin: Uint8Array): Uint8Array<ArrayBuffer> => {\n const json = new TextEncoder().encode(JSON.stringify(gltf));\n const jsonLength = Math.ceil(json.length / 4) * 4;\n const binLength = Math.ceil(bin.byteLength / 4) * 4;\n const out = new Uint8Array(12 + 8 + jsonLength + 8 + binLength);\n const view = new DataView(out.buffer);\n\n view.setUint32(0, 0x46546c67, true);\n view.setUint32(4, 2, true);\n view.setUint32(8, out.length, true);\n view.setUint32(12, jsonLength, true);\n view.setUint32(16, 0x4e4f534a, true);\n out.fill(0x20, 20, 20 + jsonLength);\n out.set(json, 20);\n view.setUint32(20 + jsonLength, binLength, true);\n view.setUint32(24 + jsonLength, 0x004e4942, true);\n out.set(bin, 28 + jsonLength);\n\n return out;\n};\n\n/** A glTF buffer view (`target`: 34962 vertices, 34963 indices, none for an image) */\ninterface BufferView {\n buffer: 0;\n byteOffset: number;\n byteLength: number;\n target?: number;\n}\n\n/** A glTF buffer made part by part, each 4-byte aligned in a view of its own */\nexport const bufferBuilder = () => {\n const parts: Uint8Array[] = [];\n const views: BufferView[] = [];\n let offset = 0;\n\n return {\n views,\n /** A part appended; its view's index */\n append(bytes: Uint8Array, target?: number): number {\n views.push({ buffer: 0, byteOffset: offset, byteLength: bytes.byteLength, ...(target && { target }) });\n parts.push(bytes);\n offset += Math.ceil(bytes.byteLength / 4) * 4;\n\n return views.length - 1;\n },\n /** The buffer: the parts at their views' offsets */\n bin(): Uint8Array<ArrayBuffer> {\n const bin = new Uint8Array(offset);\n\n parts.forEach((p, i) => {\n bin.set(p, views[i]?.byteOffset ?? 0);\n });\n\n return bin;\n },\n };\n};\n"]}
|
package/dist/util/roofs.d.ts
CHANGED
|
@@ -6,5 +6,13 @@
|
|
|
6
6
|
export declare const GENERATED_ROOF = 255;
|
|
7
7
|
/** The engine's number of a roof shape (`roof:shape`, or `generated`); undefined for a shape it does not know */
|
|
8
8
|
export declare const roofNumber: (shape: string) => number | undefined;
|
|
9
|
+
/** How the buildings' roofs are made: from their data (`roof:shape`, `roof:height`; flat without), generated where
|
|
10
|
+
* they have none, or all flat */
|
|
11
|
+
export type RoofMode = 'data' | 'generated' | 'flat';
|
|
12
|
+
/** A building's roof shape by the `mode`, from its properties (`roof:shape` or `roof_shape`): one the engine knows,
|
|
13
|
+
* else generated in `generated`; undefined for none (flat) */
|
|
14
|
+
export declare const roofShapeOf: (properties: unknown, mode: RoofMode) => string | undefined;
|
|
15
|
+
/** A building's roof height from its properties (`roof:height` or `roof_height`; not a number: as its slopes make it) */
|
|
16
|
+
export declare const roofHeightOf: (properties: unknown) => number;
|
|
9
17
|
/** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): a roof's slopes run in metres */
|
|
10
18
|
export declare const metresAt: (y: number) => number;
|
package/dist/util/roofs.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* The roofs of the buildings as the engine builds them (`RoofShape::number`): the shapes of OpenStreetMap's
|
|
3
3
|
* `roof:shape`, those it does not draw as the nearest of them, or generated from a building's outline
|
|
4
4
|
*/
|
|
5
|
+
import { EARTH_METRES } from "./geo.js";
|
|
6
|
+
import { isRecord } from "./guards.js";
|
|
5
7
|
/** OpenStreetMap's `roof:shape` as the engine's roofs (1 flat, 2 hipped, 3 gabled, 4 pyramidal, 5 mansard) */
|
|
6
8
|
const ROOF_SHAPES = {
|
|
7
9
|
flat: 1,
|
|
@@ -21,10 +23,22 @@ const ROOF_SHAPES = {
|
|
|
21
23
|
};
|
|
22
24
|
/** A roof generated from its building's outline (`shapes::GENERATED_ROOF`) */
|
|
23
25
|
export const GENERATED_ROOF = 255;
|
|
24
|
-
/** The Earth's circumference (metres) */
|
|
25
|
-
const EARTH_METRES = 40_075_016.686;
|
|
26
26
|
/** The engine's number of a roof shape (`roof:shape`, or `generated`); undefined for a shape it does not know */
|
|
27
27
|
export const roofNumber = (shape) => shape === 'generated' ? GENERATED_ROOF : ROOF_SHAPES[shape];
|
|
28
|
+
/** The first of a feature's properties `names` it has */
|
|
29
|
+
const property = (p, names) => isRecord(p) ? names.map((n) => p[n]).find((v) => v !== undefined) : undefined;
|
|
30
|
+
/** A building's roof shape by the `mode`, from its properties (`roof:shape` or `roof_shape`): one the engine knows,
|
|
31
|
+
* else generated in `generated`; undefined for none (flat) */
|
|
32
|
+
export const roofShapeOf = (properties, mode) => {
|
|
33
|
+
const shape = property(properties, ['roof:shape', 'roof_shape']);
|
|
34
|
+
if (mode === 'flat')
|
|
35
|
+
return undefined;
|
|
36
|
+
if (typeof shape === 'string' && ROOF_SHAPES[shape] !== undefined)
|
|
37
|
+
return shape;
|
|
38
|
+
return mode === 'generated' ? 'generated' : undefined;
|
|
39
|
+
};
|
|
40
|
+
/** A building's roof height from its properties (`roof:height` or `roof_height`; not a number: as its slopes make it) */
|
|
41
|
+
export const roofHeightOf = (properties) => Number(property(properties, ['roof:height', 'roof_height']) ?? Number.NaN);
|
|
28
42
|
/** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): a roof's slopes run in metres */
|
|
29
43
|
export const metresAt = (y) => EARTH_METRES * Math.cos(Math.atan(Math.sinh(Math.PI * (1 - 2 * y))));
|
|
30
44
|
//# sourceMappingURL=roofs.js.map
|
package/dist/util/roofs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roofs.js","sourceRoot":"","sources":["../../src/util/roofs.ts"],"names":[],"mappings":"AAAA;;;GA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","sourcesContent":["/**\n * The roofs of the buildings as the engine builds them (`RoofShape::number`): the shapes of OpenStreetMap's\n * `roof:shape`, those it does not draw as the nearest of them, or generated from a building's outline\n */\n\nimport { EARTH_METRES } from './geo.ts';\nimport { isRecord } from './guards.ts';\n\n/** OpenStreetMap's `roof:shape` as the engine's roofs (1 flat, 2 hipped, 3 gabled, 4 pyramidal, 5 mansard) */\nconst ROOF_SHAPES: Readonly<Record<string, number>> = {\n flat: 1,\n skillion: 1,\n hipped: 2,\n 'half-hipped': 2,\n side_hipped: 2,\n dome: 2,\n onion: 2,\n round: 2,\n gabled: 3,\n saltbox: 3,\n pyramidal: 4,\n cone: 4,\n mansard: 5,\n gambrel: 5,\n};\n\n/** A roof generated from its building's outline (`shapes::GENERATED_ROOF`) */\nexport const GENERATED_ROOF = 255;\n\n/** The engine's number of a roof shape (`roof:shape`, or `generated`); undefined for a shape it does not know */\nexport const roofNumber = (shape: string): number | undefined =>\n shape === 'generated' ? GENERATED_ROOF : ROOF_SHAPES[shape];\n\n/** How the buildings' roofs are made: from their data (`roof:shape`, `roof:height`; flat without), generated where\n * they have none, or all flat */\nexport type RoofMode = 'data' | 'generated' | 'flat';\n\n/** The first of a feature's properties `names` it has */\nconst property = (p: unknown, names: readonly string[]): unknown =>\n isRecord(p) ? names.map((n) => p[n]).find((v) => v !== undefined) : undefined;\n\n/** A building's roof shape by the `mode`, from its properties (`roof:shape` or `roof_shape`): one the engine knows,\n * else generated in `generated`; undefined for none (flat) */\nexport const roofShapeOf = (properties: unknown, mode: RoofMode): string | undefined => {\n const shape = property(properties, ['roof:shape', 'roof_shape']);\n\n if (mode === 'flat') return undefined;\n if (typeof shape === 'string' && ROOF_SHAPES[shape] !== undefined) return shape;\n\n return mode === 'generated' ? 'generated' : undefined;\n};\n\n/** A building's roof height from its properties (`roof:height` or `roof_height`; not a number: as its slopes make it) */\nexport const roofHeightOf = (properties: unknown): number =>\n Number(property(properties, ['roof:height', 'roof_height']) ?? Number.NaN);\n\n/** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): a roof's slopes run in metres */\nexport const metresAt = (y: number): number => EARTH_METRES * Math.cos(Math.atan(Math.sinh(Math.PI * (1 - 2 * y))));\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The floats of a feature's style in the engine (`setFeatureStyle`, `render::features::TEXELS`), for the page's
|
|
3
|
+
* layers and the vector tiles' workers alike: what each holds.
|
|
4
|
+
*/
|
|
5
|
+
/** Floats per feature */
|
|
6
|
+
export declare const FLOATS = 32;
|
|
7
|
+
/** Where a feature's style holds what */
|
|
8
|
+
export declare const STYLE: {
|
|
9
|
+
/** Its color (RGBA) at the first zoom of its range */
|
|
10
|
+
readonly color: 0;
|
|
11
|
+
/** Its second color (RGBA): at the last zoom of its range, a circle's stroke's; a line's or a building's pattern
|
|
12
|
+
* there instead (its place in the icon atlas, texels) */
|
|
13
|
+
readonly second: 4;
|
|
14
|
+
/** Its size: four zooms, then its value at each (a line's width, a building's height, a circle's radius); a fill's
|
|
15
|
+
* pattern's place in the icon atlas at its values */
|
|
16
|
+
readonly size: 8;
|
|
17
|
+
/** Its second size, the same way (a line's offset, a building's base, a circle's stroke's width); a fill's pattern's
|
|
18
|
+
* pixel ratio at its first zoom */
|
|
19
|
+
readonly size2: 16;
|
|
20
|
+
/** The zooms it is drawn from and to */
|
|
21
|
+
readonly range: 24;
|
|
22
|
+
/** A line's blur (CSS pixels) */
|
|
23
|
+
readonly blur: 26;
|
|
24
|
+
/** A building's landmark flag, in a line's blur's place (1: drawn as a monument, no office windows, floodlit at
|
|
25
|
+
* night) */
|
|
26
|
+
readonly landmark: 26;
|
|
27
|
+
/** A line's or a building's pattern's pixel ratio */
|
|
28
|
+
readonly patternRatio: 27;
|
|
29
|
+
/** A fill's pattern by its name's index past one, the page putting its place instead (not kept by the engine) */
|
|
30
|
+
readonly fillPattern: 28;
|
|
31
|
+
/** A line's or a building's, the same way */
|
|
32
|
+
readonly linePattern: 29;
|
|
33
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The floats of a feature's style in the engine (`setFeatureStyle`, `render::features::TEXELS`), for the page's
|
|
3
|
+
* layers and the vector tiles' workers alike: what each holds.
|
|
4
|
+
*/
|
|
5
|
+
/** Floats per feature */
|
|
6
|
+
export const FLOATS = 32;
|
|
7
|
+
/** Where a feature's style holds what */
|
|
8
|
+
export const STYLE = {
|
|
9
|
+
/** Its color (RGBA) at the first zoom of its range */
|
|
10
|
+
color: 0,
|
|
11
|
+
/** Its second color (RGBA): at the last zoom of its range, a circle's stroke's; a line's or a building's pattern
|
|
12
|
+
* there instead (its place in the icon atlas, texels) */
|
|
13
|
+
second: 4,
|
|
14
|
+
/** Its size: four zooms, then its value at each (a line's width, a building's height, a circle's radius); a fill's
|
|
15
|
+
* pattern's place in the icon atlas at its values */
|
|
16
|
+
size: 8,
|
|
17
|
+
/** Its second size, the same way (a line's offset, a building's base, a circle's stroke's width); a fill's pattern's
|
|
18
|
+
* pixel ratio at its first zoom */
|
|
19
|
+
size2: 16,
|
|
20
|
+
/** The zooms it is drawn from and to */
|
|
21
|
+
range: 24,
|
|
22
|
+
/** A line's blur (CSS pixels) */
|
|
23
|
+
blur: 26,
|
|
24
|
+
/** A building's landmark flag, in a line's blur's place (1: drawn as a monument, no office windows, floodlit at
|
|
25
|
+
* night) */
|
|
26
|
+
landmark: 26,
|
|
27
|
+
/** A line's or a building's pattern's pixel ratio */
|
|
28
|
+
patternRatio: 27,
|
|
29
|
+
/** A fill's pattern by its name's index past one, the page putting its place instead (not kept by the engine) */
|
|
30
|
+
fillPattern: 28,
|
|
31
|
+
/** A line's or a building's, the same way */
|
|
32
|
+
linePattern: 29,
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=style-floats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-floats.js","sourceRoot":"","sources":["../../src/util/style-floats.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,yBAAyB;AACzB,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,CAAC;AAEzB,yCAAyC;AACzC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,sDAAsD;IACtD,KAAK,EAAE,CAAC;IACR;6DACyD;IACzD,MAAM,EAAE,CAAC;IACT;yDACqD;IACrD,IAAI,EAAE,CAAC;IACP;uCACmC;IACnC,KAAK,EAAE,EAAE;IACT,wCAAwC;IACxC,KAAK,EAAE,EAAE;IACT,iCAAiC;IACjC,IAAI,EAAE,EAAE;IACR;gBACY;IACZ,QAAQ,EAAE,EAAE;IACZ,qDAAqD;IACrD,YAAY,EAAE,EAAE;IAChB,iHAAiH;IACjH,WAAW,EAAE,EAAE;IACf,6CAA6C;IAC7C,WAAW,EAAE,EAAE;CACP,CAAC","sourcesContent":["/**\n * The floats of a feature's style in the engine (`setFeatureStyle`, `render::features::TEXELS`), for the page's\n * layers and the vector tiles' workers alike: what each holds.\n */\n\n/** Floats per feature */\nexport const FLOATS = 32;\n\n/** Where a feature's style holds what */\nexport const STYLE = {\n /** Its color (RGBA) at the first zoom of its range */\n color: 0,\n /** Its second color (RGBA): at the last zoom of its range, a circle's stroke's; a line's or a building's pattern\n * there instead (its place in the icon atlas, texels) */\n second: 4,\n /** Its size: four zooms, then its value at each (a line's width, a building's height, a circle's radius); a fill's\n * pattern's place in the icon atlas at its values */\n size: 8,\n /** Its second size, the same way (a line's offset, a building's base, a circle's stroke's width); a fill's pattern's\n * pixel ratio at its first zoom */\n size2: 16,\n /** The zooms it is drawn from and to */\n range: 24,\n /** A line's blur (CSS pixels) */\n blur: 26,\n /** A building's landmark flag, in a line's blur's place (1: drawn as a monument, no office windows, floodlit at\n * night) */\n landmark: 26,\n /** A line's or a building's pattern's pixel ratio */\n patternRatio: 27,\n /** A fill's pattern by its name's index past one, the page putting its place instead (not kept by the engine) */\n fillPattern: 28,\n /** A line's or a building's, the same way */\n linePattern: 29,\n} as const;\n"]}
|
package/dist/util/sun.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* low-precision formulas of the Astronomical Almanac: within a few hundredths of a degree from 1950 to 2050, far
|
|
4
4
|
* finer than a shadow needs)
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
import { RAD } from "./geo.js";
|
|
7
7
|
/** The sun's azimuth (degrees clockwise from north) and altitude (degrees above the horizon) at `lonLat` at `date` */
|
|
8
8
|
export const sunPosition = (date, [lon, lat]) => {
|
|
9
9
|
// Days since J2000.0 (noon on the 1st of January 2000, UTC)
|
package/dist/util/sun.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sun.js","sourceRoot":"","sources":["../../src/util/sun.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"sun.js","sourceRoot":"","sources":["../../src/util/sun.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,sHAAsH;AACtH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAU,EAAE,CAAC,GAAG,EAAE,GAAG,CAAS,EAAyC,EAAE;IACnG,4DAA4D;IAC5D,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,UAAU,GAAG,QAAQ,CAAC;IACjD,MAAM,CAAC,GAAG,CAAC,OAAO,GAAG,YAAY,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAC7C,MAAM,CAAC,GAAG,OAAO,GAAG,YAAY,GAAG,CAAC,CAAC;IACrC,kGAAkG;IAClG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACnE,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,YAAY,GAAG,CAAC,CA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AQ,GAAG,GAAG,EAAE,CAAC;AACtF,CAAC,CAAC","sourcesContent":["/**\n * Where the sun stands in the sky: its azimuth and altitude at a place and time, from its ecliptic position (the\n * low-precision formulas of the Astronomical Almanac: within a few hundredths of a degree from 1950 to 2050, far\n * finer than a shadow needs)\n */\n\nimport type { LonLat } from '../types.ts';\nimport { RAD } from './geo.ts';\n\n/** The sun's azimuth (degrees clockwise from north) and altitude (degrees above the horizon) at `lonLat` at `date` */\nexport const sunPosition = (date: Date, [lon, lat]: LonLat): { azimuth: number; altitude: number } => {\n // Days since J2000.0 (noon on the 1st of January 2000, UTC)\n const d = date.getTime() / 86_400_000 - 10_957.5;\n const g = (357.529 + 0.985_600_28 * d) * RAD;\n const q = 280.459 + 0.985_647_36 * d;\n // Its ecliptic longitude, the obliquity of the ecliptic, then its right ascension and declination\n const l = (q + 1.915 * Math.sin(g) + 0.02 * Math.sin(2 * g)) * RAD;\n const e = (23.439 - 0.000_000_36 * d) * RAD;\n const ra = Math.atan2(Math.cos(e) * Math.sin(l), Math.cos(l));\n const dec = Math.asin(Math.sin(e) * Math.sin(l));\n // Its hour angle at the place, from the sidereal time at Greenwich\n const gmst = 280.460_618_37 + 360.985_647_366_29 * d;\n const h = (gmst + lon) * RAD - ra;\n const phi = lat * RAD;\n const altitude = Math.asin(Math.sin(phi) * Math.sin(dec) + Math.cos(phi) * Math.cos(dec) * Math.cos(h));\n const azimuth = Math.atan2(-Math.sin(h), Math.tan(dec) * Math.cos(phi) - Math.sin(phi) * Math.cos(h));\n\n return { azimuth: (((azimuth / RAD) % 360) + 360) % 360, altitude: altitude / RAD };\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The street furniture of a tile, from OpenMapTiles' layers: its points of interest of the street where they stand
|
|
3
|
+
* (bus stops' shelters, waste baskets, post boxes, drinking fountains, bicycle racks), each facing the nearest street;
|
|
4
|
+
* benches along the pedestrian streets and the paths of the parks and gardens. The same each time the tile is cut
|
|
5
|
+
*/
|
|
6
|
+
import type { Priority } from '../basemap.worker.ts';
|
|
7
|
+
import { type Renderer } from './tiles.ts';
|
|
8
|
+
/**
|
|
9
|
+
* The street furniture of a tile: longitude, latitude, scale, heading (degrees, facing its street or path), rank (in
|
|
10
|
+
* [0, 1): the page keeps the lowest far from the view) and kind (`FURNITURE`' index) of each, as things placed
|
|
11
|
+
* (`PLACED_NUMBERS`); past `maxObjects`, thinned evenly
|
|
12
|
+
*/
|
|
13
|
+
export declare const furniture: (r: Renderer, z: number, x: number, y: number, id: number, maxObjects: number, priority?: Priority) => Promise<Float64Array<ArrayBufferLike> | undefined>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* `vectors()` with their style per feature, made ready for the GPU by the tessellation module */
|
|
3
3
|
import type { TileFeature, Value } from '../../basemap/mvt.ts';
|
|
4
4
|
import { type StyleLayer } from '../../basemap/vectorstyle.ts';
|
|
5
|
+
import { type RoofMode } from '../../util/roofs.ts';
|
|
5
6
|
import type { Priority, TileMesh, TileStyles, TileVectors } from '../basemap.worker.ts';
|
|
6
7
|
import { type Renderer } from './tiles.ts';
|
|
7
8
|
/**
|
|
@@ -31,11 +32,7 @@ export declare const holdsLandmark: (rings: readonly (readonly number[])[], poin
|
|
|
31
32
|
* landmark's wall, its middle outside, is none
|
|
32
33
|
*/
|
|
33
34
|
export declare const landmarkBuildings: (features: readonly TileFeature[], points: readonly number[]) => Set<TileFeature>;
|
|
34
|
-
/**
|
|
35
|
-
* they have none, or all flat */
|
|
36
|
-
export type RoofMode = 'data' | 'generated' | 'flat';
|
|
37
|
-
/** A building's roof for the engine: its shape's number (0 flat) and height (metres; not a number: as its slopes make
|
|
38
|
-
* it), from its properties (`roof:shape` or `roof_shape`, `roof:height` or `roof_height`) and the `mode` */
|
|
35
|
+
/** A building's roof for the engine: its shape's number (`roofShapeOf`; 0 none) and height (`roofHeightOf`) */
|
|
39
36
|
export declare const roofOf: (properties: Record<string, Value>, mode: RoofMode) => [number, number];
|
|
40
37
|
/**
|
|
41
38
|
* The zooms a feature shows over by its layer's filter, as MapLibre evaluates a filter (at the whole zoom under the
|
|
@@ -5,8 +5,11 @@ import type { Priority } from '../basemap.worker.ts';
|
|
|
5
5
|
import { type Renderer } from './tiles.ts';
|
|
6
6
|
/** Points every `spacing` along a line (tile units, x and y interleaved), the first half a spacing in (the middle of a
|
|
7
7
|
* shorter line): each point, the segment it lies on and how far along the line it is (x, y, x0, y0, x1, y1, the
|
|
8
|
-
*
|
|
8
|
+
* distance) */
|
|
9
9
|
export declare const lineAnchors: (line: readonly number[], spacing: number) => number[][];
|
|
10
|
+
/** The point `offset` (tile units) beside a line's anchor (`lineAnchors`), the `k`th anchor's on one side of the line,
|
|
11
|
+
* the next one's on the other: x, y and its heading facing the line (degrees; y towards the south in the tile) */
|
|
12
|
+
export declare const besideLine: (anchor: readonly number[], k: number, offset: number) => [x: number, y: number, heading: number];
|
|
10
13
|
/** The part of a line (tile units, interleaved) from `from` to `to` along it (distances from its start) */
|
|
11
14
|
export declare const lineBetween: (line: readonly number[], from: number, to: number) => number[];
|
|
12
15
|
/**
|
|
@@ -18,4 +21,4 @@ export declare const roofsOf: (r: Renderer, layers: Map<string, {
|
|
|
18
21
|
extent: number;
|
|
19
22
|
features: TileFeature[];
|
|
20
23
|
}>, zoom: number) => ((px: number, py: number) => number | undefined);
|
|
21
|
-
export declare const labels: (r: Renderer, z: number, x: number, y: number, id: number, priority?: Priority, zoom?: number) => Promise<LabelCandidate[]>;
|
|
24
|
+
export declare const labels: (r: Renderer, z: number, x: number, y: number, id: number, priority?: Priority, zoom?: number, roofs?: boolean) => Promise<LabelCandidate[]>;
|