isard 1.10.0 → 1.11.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 +36 -0
- package/README.md +1 -1
- package/dist/basemap/vectortiles.d.ts +13 -8
- package/dist/basemap/vectortiles.js.map +1 -1
- package/dist/bind/layers.js +7 -2
- package/dist/bind/layers.js.map +1 -1
- package/dist/decoder.worker.js +3 -3
- package/dist/decoder.worker.js.map +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -0
- 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_tess_bg.wasm +0 -0
- package/dist/layers/features.d.ts +7 -0
- package/dist/layers/features.js +21 -5
- package/dist/layers/features.js.map +1 -1
- package/dist/layers/layers.js +2 -0
- package/dist/layers/layers.js.map +1 -1
- package/dist/layers/tiles3d.d.ts +1 -0
- package/dist/layers/tiles3d.js +42 -2
- package/dist/layers/tiles3d.js.map +1 -1
- package/dist/map/events.js +1 -0
- package/dist/map/events.js.map +1 -1
- package/dist/map/quality.d.ts +33 -0
- package/dist/map/quality.js +61 -0
- package/dist/map/quality.js.map +1 -0
- package/dist/map.d.ts +12 -1
- package/dist/map.js +64 -6
- package/dist/map.js.map +1 -1
- package/dist/react/IsardMap.d.ts +1 -0
- package/dist/react/IsardMap.js +2 -0
- package/dist/react/IsardMap.js.map +1 -1
- package/dist/react/VectorTiles.d.ts +5 -1
- package/dist/react/VectorTiles.js +8 -0
- package/dist/react/VectorTiles.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/types.d.ts +20 -0
- package/dist/types.js.map +1 -1
- package/dist/wasm/isard.d.ts +12 -5
- package/dist/wasm/isard.js +33 -5
- package/dist/wasm/isard_core.d.ts +7 -5
- package/dist/wasm/isard_core.js +21 -5
- package/package.json +1 -1
|
@@ -1 +1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,CAAC,CAAC;IAEnC,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF,MAAM,eAAe,GAAG,UAAU,CAGhC,SAAS,MAAM,CAAC,KAAK,EAAE,GAAG;IAC1B,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IAEhC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,UAAU,CAGpC,SAAS,UAAU,CAAC,KAAK,EAAE,GAAG;IAC9B,OAAO,CAAC,cAAc,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IAEpC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAEH;uBACuB;AACvB,MAAM,CAAC,MAAM,KAAK,GAAG,cAA2E,CAAC;AAEjG,oGAAoG;AACpG,MAAM,CAAC,MAAM,KAAK,GAAG,cAA2E,CAAC;AAEjG;uCACuC;AACvC,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAmF,CAAC;AAE7G;UACU;AACV,MAAM,CAAC,MAAM,MAAM,GAAG,eAA8F,CAAC;AAErH;;sDAEsD;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,mBAEZ,CAAC","sourcesContent":["/** `<VectorTiles>`: the vector tiles of a MapLibre style, the parts drawn from them as its children (`<Geometry>`,\n * `<Trees>`, `<Lamps>`, `<Furniture>`, `<Labels>`) sharing its tiles and its workers */\n\nimport {\n type ForwardedRef,\n forwardRef,\n type ReactNode,\n type Ref,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport type { VectorExtrusionOptions } from '../basemap/vectortiles/extrusions.ts';\nimport type { FurnitureOptions } from '../basemap/vectortiles/furniture.ts';\nimport type { LabelsOptions } from '../basemap/vectortiles/labels.ts';\nimport type { LampsOptions } from '../basemap/vectortiles/lamps.ts';\nimport type { TreesOptions } from '../basemap/vectortiles/trees.ts';\nimport type { VectorTiles as VectorTilesHandle, VectorTilesOptions } from '../basemap/vectortiles.ts';\nimport type { ExtrusionLayer } from '../layers/extrusions.ts';\nimport type { Layer as LayerHandle } from '../layers/layers.ts';\nimport type { ModelLayer } from '../layers/models.ts';\nimport type { SymbolLayer } from '../layers/symbols.ts';\nimport type { LabelCandidate } from '../workers/basemap/protocol.ts';\nimport { MapContext, useStableOptions, VectorTilesContext } from './context.ts';\n\nexport interface VectorTilesProps extends VectorTilesOptions {\n /** The vector tiles, once made and each time they are made anew (another style, other workers) */\n onTiles?: (tiles: VectorTilesHandle) => void;\n ref?: Ref<VectorTilesHandle | undefined>;\n /** The parts drawn from its tiles: `<Geometry>`, `<Trees>`, `<Lamps>`, `<Furniture>`, `<Labels>`, or a component of\n * your own using `useVectorTiles` */\n children?: ReactNode;\n}\n\nconst VectorTilesComponent = forwardRef<VectorTilesHandle | undefined, Omit<VectorTilesProps, 'ref'>>(\n function VectorTiles({ children, onTiles, ...options }, ref) {\n const binding = useContext(MapContext);\n const stable = useStableOptions(options);\n const latest = useRef(onTiles);\n const [tiles, setTiles] = useState<VectorTilesHandle>();\n\n latest.current = onTiles;\n useImperativeHandle(ref, () => tiles, [tiles]);\n\n // Made once the map is there, anew when its options change; destroyed with its parts when unmounted\n useEffect(() => {\n if (!binding) return;\n\n const made = binding.map.vectorTiles(stable);\n\n setTiles(made);\n latest.current?.(made);\n\n return () => {\n made.remove();\n setTiles(undefined);\n };\n }, [binding, stable]);\n\n return <VectorTilesContext.Provider value={tiles}>{children}</VectorTilesContext.Provider>;\n },\n);\n\n/**\n * The vector tiles of a MapLibre style (`map.vectorTiles`), its children drawing from them: the style's fills, lines\n * and buildings as geometry (`<Geometry>`), its trees, street lamps, street furniture, labels. One set of tiles and\n * workers for all of them: the tiles fetched and decoded once. Its options (`style`, `workers`…) compared by value: an\n * inline object keeps the tiles, another style makes them anew. The ref and `onTiles` give its handle\n * (`VectorTiles`).\n *\n * ```tsx\n * <VectorTiles style={OPENFREEMAP_STYLES.liberty}>\n * <Geometry roofs=\"generated\" />\n * <Trees />\n * <Labels />\n * </VectorTiles>\n * ```\n */\nexport const VectorTiles = VectorTilesComponent as (props: VectorTilesProps) => ReactNode;\n\n/** The vector tiles of the `<VectorTiles>` around, once made (undefined before): a part of your own drawn from them\n * (`streetWind`, `raster`…) */\nexport const useVectorTiles = (): VectorTilesHandle | undefined => useContext(VectorTilesContext);\n\n/** What a part drawn from the vector tiles around takes besides its options */\ninterface PartHandle<L> {\n /** The layer, once made and each time it is made anew */\n onLayer?: (layer: L) => void;\n}\n\n/** The props of a part: its options (those of its `VectorTiles` method), its handle */\ntype PartProps<O, L> = O & PartHandle<L> & { ref?: Ref<L | undefined> };\n\n/** A part drawn from the vector tiles around: made by `make` once they are there, anew when its options change\n * (compared by value, `useStableOptions`), removed when unmounted */\nconst usePart = <O extends object, L extends LayerHandle>(\n make: (tiles: VectorTilesHandle, options: O) => L,\n props: O & PartHandle<L>,\n ref: ForwardedRef<L | undefined>,\n): void => {\n const binding = useContext(MapContext);\n const tiles = useContext(VectorTilesContext);\n // Its options: its props but `onLayer` (a function written inline would make it anew at each render)\n const stable = useStableOptions({ ...props, onLayer: undefined });\n const latest = useRef(props.onLayer);\n const [layer, setLayer] = useState<L>();\n\n latest.current = props.onLayer;\n useImperativeHandle(ref, () => layer, [layer]);\n useEffect(() => {\n if (!binding || !tiles) return;\n\n const made = make(tiles, stable);\n\n setLayer(made);\n latest.current?.(made);\n\n return () => {\n // Gone already with its tiles, or with the map\n if (binding.map.hasLayer(made)) made.remove();\n setLayer(undefined);\n };\n }, [binding, tiles, stable, make]);\n};\n\n/** The parts' layers made from the vector tiles (at the module's level: the same functions from render to render) */\nconst makeTrees = (tiles: VectorTilesHandle, options: TreesOptions) => tiles.trees(options);\nconst makeLamps = (tiles: VectorTilesHandle, options: LampsOptions) => tiles.lamps(options);\nconst makeFurniture = (tiles: VectorTilesHandle, options: FurnitureOptions) => tiles.furniture(options);\nconst makeLabels = (tiles: VectorTilesHandle, options: LabelsOptions) => tiles.labels(options);\nconst makeExtrusions = (tiles: VectorTilesHandle, options: VectorExtrusionOptions<Record<string, unknown>>) =>\n tiles.extrusions(options);\n\nconst TreesComponent = forwardRef<ModelLayer | undefined, TreesOptions & PartHandle<ModelLayer>>(\n function Trees(props, ref) {\n usePart(makeTrees, props, ref);\n\n return null;\n },\n);\n\nconst LampsComponent = forwardRef<ModelLayer | undefined, LampsOptions & PartHandle<ModelLayer>>(\n function Lamps(props, ref) {\n usePart(makeLamps, props, ref);\n\n return null;\n },\n);\n\nconst FurnitureComponent = forwardRef<ModelLayer | undefined, FurnitureOptions & PartHandle<ModelLayer>>(\n function Furniture(props, ref) {\n usePart(makeFurniture, props, ref);\n\n return null;\n },\n);\n\nconst LabelsComponent = forwardRef<\n SymbolLayer<LabelCandidate> | undefined,\n LabelsOptions & PartHandle<SymbolLayer<LabelCandidate>>\n>(function Labels(props, ref) {\n usePart(makeLabels, props, ref);\n\n return null;\n});\n\nconst ExtrusionsComponent = forwardRef<\n ExtrusionLayer<Record<string, unknown>> | undefined,\n VectorExtrusionOptions<Record<string, unknown>> & PartHandle<ExtrusionLayer<Record<string, unknown>>>\n>(function Extrusions(props, ref) {\n usePart(makeExtrusions, props, ref);\n\n return null;\n});\n\n/** The trees of the vector tiles around on their woods, forests and grass, as 3D models (`VectorTiles.trees`: its\n * options as props) */\nexport const Trees = TreesComponent as (props: PartProps<TreesOptions, ModelLayer>) => ReactNode;\n\n/** Street lamps along the streets of the vector tiles around, lit at night (`VectorTiles.lamps`) */\nexport const Lamps = LampsComponent as (props: PartProps<LampsOptions, ModelLayer>) => ReactNode;\n\n/** The street furniture of the vector tiles around: bus shelters, waste baskets, post boxes, fountains, bicycle racks,\n * benches (`VectorTiles.furniture`) */\nexport const Furniture = FurnitureComponent as (props: PartProps<FurnitureOptions, ModelLayer>) => ReactNode;\n\n/** The labels of the vector tiles around (`VectorTiles.labels`): hidden by the buildings of a `<Geometry>` beside\n * them */\nexport const Labels = LabelsComponent as (props: PartProps<LabelsOptions, SymbolLayer<LabelCandidate>>) => ReactNode;\n\n/** The buildings of the vector tiles around as an extrusion layer, its style per feature (`VectorTiles.extrusions`:\n * its options as props; functions compared by identity, so at the module's level or in a memo). The properties of\n * its features named by `<Extrusions<Building> …>` */\nexport const Extrusions = ExtrusionsComponent as <P = Record<string, unknown>>(\n props: PartProps<VectorExtrusionOptions<P>, ExtrusionLayer<P>>,\n) => ReactNode;\n"]}
|
|
1
|
+
{"version":3,"file":"VectorTiles.js","sourceRoot":"","sources":["../../src/react/VectorTiles.tsx"],"names":[],"mappings":";AAAA;wFACwF;AAExF,OAAO,EAEL,UAAU,EAGV,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAiBf,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAWhF,MAAM,oBAAoB,GAAG,UAAU,CACrC,SAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE,GAAG;IACzD,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAqB,CAAC;IAExD,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAE/C,oGAAoG;IACpG,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAE7C,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,MAAM,C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tD,MAAM,CAAC,MAAM,UAAU,GAAG,mBAEZ,CAAC;AAEf;4GAC4G;AAC5G,MAAM,CAAC,MAAM,MAAM,GAAG,eAAoF,CAAC","sourcesContent":["/** `<VectorTiles>`: the vector tiles of a MapLibre style, the parts drawn from them as its children (`<Geometry>`,\n * `<Trees>`, `<Lamps>`, `<Furniture>`, `<Labels>`) sharing its tiles and its workers */\n\nimport {\n type ForwardedRef,\n forwardRef,\n type ReactNode,\n type Ref,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport type { VectorExtrusionOptions } from '../basemap/vectortiles/extrusions.ts';\nimport type { FurnitureOptions } from '../basemap/vectortiles/furniture.ts';\nimport type { LabelsOptions } from '../basemap/vectortiles/labels.ts';\nimport type { LampsOptions } from '../basemap/vectortiles/lamps.ts';\nimport type { TreesOptions } from '../basemap/vectortiles/trees.ts';\nimport type {\n VectorRasterOptions,\n VectorTiles as VectorTilesHandle,\n VectorTilesOptions,\n} from '../basemap/vectortiles.ts';\nimport type { ExtrusionLayer } from '../layers/extrusions.ts';\nimport type { Layer as LayerHandle } from '../layers/layers.ts';\nimport type { ModelLayer } from '../layers/models.ts';\nimport type { RasterLayer } from '../layers/raster.ts';\nimport type { SymbolLayer } from '../layers/symbols.ts';\nimport type { LabelCandidate } from '../workers/basemap/protocol.ts';\nimport { MapContext, useStableOptions, VectorTilesContext } from './context.ts';\n\nexport interface VectorTilesProps extends VectorTilesOptions {\n /** The vector tiles, once made and each time they are made anew (another style, other workers) */\n onTiles?: (tiles: VectorTilesHandle) => void;\n ref?: Ref<VectorTilesHandle | undefined>;\n /** The parts drawn from its tiles: `<Geometry>`, `<Trees>`, `<Lamps>`, `<Furniture>`, `<Labels>`, or a component of\n * your own using `useVectorTiles` */\n children?: ReactNode;\n}\n\nconst VectorTilesComponent = forwardRef<VectorTilesHandle | undefined, Omit<VectorTilesProps, 'ref'>>(\n function VectorTiles({ children, onTiles, ...options }, ref) {\n const binding = useContext(MapContext);\n const stable = useStableOptions(options);\n const latest = useRef(onTiles);\n const [tiles, setTiles] = useState<VectorTilesHandle>();\n\n latest.current = onTiles;\n useImperativeHandle(ref, () => tiles, [tiles]);\n\n // Made once the map is there, anew when its options change; destroyed with its parts when unmounted\n useEffect(() => {\n if (!binding) return;\n\n const made = binding.map.vectorTiles(stable);\n\n setTiles(made);\n latest.current?.(made);\n\n return () => {\n made.remove();\n setTiles(undefined);\n };\n }, [binding, stable]);\n\n return <VectorTilesContext.Provider value={tiles}>{children}</VectorTilesContext.Provider>;\n },\n);\n\n/**\n * The vector tiles of a MapLibre style (`map.vectorTiles`), its children drawing from them: the style's fills, lines\n * and buildings as geometry (`<Geometry>`), its trees, street lamps, street furniture, labels. One set of tiles and\n * workers for all of them: the tiles fetched and decoded once. Its options (`style`, `workers`…) compared by value: an\n * inline object keeps the tiles, another style makes them anew. The ref and `onTiles` give its handle\n * (`VectorTiles`).\n *\n * ```tsx\n * <VectorTiles style={OPENFREEMAP_STYLES.liberty}>\n * <Geometry roofs=\"generated\" />\n * <Trees />\n * <Labels />\n * </VectorTiles>\n * ```\n */\nexport const VectorTiles = VectorTilesComponent as (props: VectorTilesProps) => ReactNode;\n\n/** The vector tiles of the `<VectorTiles>` around, once made (undefined before): a part of your own drawn from them\n * (`streetWind`, `raster`…) */\nexport const useVectorTiles = (): VectorTilesHandle | undefined => useContext(VectorTilesContext);\n\n/** What a part drawn from the vector tiles around takes besides its options */\ninterface PartHandle<L> {\n /** The layer, once made and each time it is made anew */\n onLayer?: (layer: L) => void;\n}\n\n/** The props of a part: its options (those of its `VectorTiles` method), its handle */\ntype PartProps<O, L> = O & PartHandle<L> & { ref?: Ref<L | undefined> };\n\n/** A part drawn from the vector tiles around: made by `make` once they are there, anew when its options change\n * (compared by value, `useStableOptions`), removed when unmounted */\nconst usePart = <O extends object, L extends LayerHandle>(\n make: (tiles: VectorTilesHandle, options: O) => L,\n props: O & PartHandle<L>,\n ref: ForwardedRef<L | undefined>,\n): void => {\n const binding = useContext(MapContext);\n const tiles = useContext(VectorTilesContext);\n // Its options: its props but `onLayer` (a function written inline would make it anew at each render)\n const stable = useStableOptions({ ...props, onLayer: undefined });\n const latest = useRef(props.onLayer);\n const [layer, setLayer] = useState<L>();\n\n latest.current = props.onLayer;\n useImperativeHandle(ref, () => layer, [layer]);\n useEffect(() => {\n if (!binding || !tiles) return;\n\n const made = make(tiles, stable);\n\n setLayer(made);\n latest.current?.(made);\n\n return () => {\n // Gone already with its tiles, or with the map\n if (binding.map.hasLayer(made)) made.remove();\n setLayer(undefined);\n };\n }, [binding, tiles, stable, make]);\n};\n\n/** The parts' layers made from the vector tiles (at the module's level: the same functions from render to render) */\nconst makeTrees = (tiles: VectorTilesHandle, options: TreesOptions) => tiles.trees(options);\nconst makeLamps = (tiles: VectorTilesHandle, options: LampsOptions) => tiles.lamps(options);\nconst makeFurniture = (tiles: VectorTilesHandle, options: FurnitureOptions) => tiles.furniture(options);\nconst makeLabels = (tiles: VectorTilesHandle, options: LabelsOptions) => tiles.labels(options);\nconst makeRaster = (tiles: VectorTilesHandle, options: VectorRasterOptions) => tiles.raster(options);\nconst makeExtrusions = (tiles: VectorTilesHandle, options: VectorExtrusionOptions<Record<string, unknown>>) =>\n tiles.extrusions(options);\n\nconst TreesComponent = forwardRef<ModelLayer | undefined, TreesOptions & PartHandle<ModelLayer>>(\n function Trees(props, ref) {\n usePart(makeTrees, props, ref);\n\n return null;\n },\n);\n\nconst LampsComponent = forwardRef<ModelLayer | undefined, LampsOptions & PartHandle<ModelLayer>>(\n function Lamps(props, ref) {\n usePart(makeLamps, props, ref);\n\n return null;\n },\n);\n\nconst FurnitureComponent = forwardRef<ModelLayer | undefined, FurnitureOptions & PartHandle<ModelLayer>>(\n function Furniture(props, ref) {\n usePart(makeFurniture, props, ref);\n\n return null;\n },\n);\n\nconst LabelsComponent = forwardRef<\n SymbolLayer<LabelCandidate> | undefined,\n LabelsOptions & PartHandle<SymbolLayer<LabelCandidate>>\n>(function Labels(props, ref) {\n usePart(makeLabels, props, ref);\n\n return null;\n});\n\nconst ExtrusionsComponent = forwardRef<\n ExtrusionLayer<Record<string, unknown>> | undefined,\n VectorExtrusionOptions<Record<string, unknown>> & PartHandle<ExtrusionLayer<Record<string, unknown>>>\n>(function Extrusions(props, ref) {\n usePart(makeExtrusions, props, ref);\n\n return null;\n});\n\nconst RasterComponent = forwardRef<RasterLayer | undefined, VectorRasterOptions & PartHandle<RasterLayer>>(\n function Raster(props, ref) {\n usePart(makeRaster, props, ref);\n\n return null;\n },\n);\n\n/** The trees of the vector tiles around on their woods, forests and grass, as 3D models (`VectorTiles.trees`: its\n * options as props) */\nexport const Trees = TreesComponent as (props: PartProps<TreesOptions, ModelLayer>) => ReactNode;\n\n/** Street lamps along the streets of the vector tiles around, lit at night (`VectorTiles.lamps`) */\nexport const Lamps = LampsComponent as (props: PartProps<LampsOptions, ModelLayer>) => ReactNode;\n\n/** The street furniture of the vector tiles around: bus shelters, waste baskets, post boxes, fountains, bicycle racks,\n * benches (`VectorTiles.furniture`) */\nexport const Furniture = FurnitureComponent as (props: PartProps<FurnitureOptions, ModelLayer>) => ReactNode;\n\n/** The labels of the vector tiles around (`VectorTiles.labels`): hidden by the buildings of a `<Geometry>` beside\n * them */\nexport const Labels = LabelsComponent as (props: PartProps<LabelsOptions, SymbolLayer<LabelCandidate>>) => ReactNode;\n\n/** The buildings of the vector tiles around as an extrusion layer, its style per feature (`VectorTiles.extrusions`:\n * its options as props; functions compared by identity, so at the module's level or in a memo). The properties of\n * its features named by `<Extrusions<Building> …>` */\nexport const Extrusions = ExtrusionsComponent as <P = Record<string, unknown>>(\n props: PartProps<VectorExtrusionOptions<P>, ExtrusionLayer<P>>,\n) => ReactNode;\n\n/** The fills, lines and circles of the vector tiles around drawn into images over the ground (`VectorTiles.raster`): the\n * light way over the relief, under 3D buildings (their own drawn as geometry by a `<Geometry>`, or none) */\nexport const Raster = RasterComponent as (props: PartProps<VectorRasterOptions, RasterLayer>) => ReactNode;\n"]}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -29,5 +29,5 @@ export { Panel, type PanelProps } from './Panel.tsx';
|
|
|
29
29
|
export { Popup, type PopupProps } from './Popup.tsx';
|
|
30
30
|
export { Swipe, SwipeOther, type SwipeProps } from './Swipe.tsx';
|
|
31
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';
|
|
32
|
+
export { Extrusions, Furniture, Labels, Lamps, Raster, Trees, useVectorTiles, VectorTiles, type VectorTilesProps, } from './VectorTiles.tsx';
|
|
33
33
|
export { Viewshed } from './Viewshed.tsx';
|
package/dist/react/index.js
CHANGED
|
@@ -24,6 +24,6 @@ export { Panel } from "./Panel.js";
|
|
|
24
24
|
export { Popup } from "./Popup.js";
|
|
25
25
|
export { Swipe, SwipeOther } from "./Swipe.js";
|
|
26
26
|
export { Geometry, VectorGeometry } from "./VectorGeometry.js";
|
|
27
|
-
export { Extrusions, Furniture, Labels, Lamps, Trees, useVectorTiles, VectorTiles, } from "./VectorTiles.js";
|
|
27
|
+
export { Extrusions, Furniture, Labels, Lamps, Raster, Trees, useVectorTiles, VectorTiles, } from "./VectorTiles.js";
|
|
28
28
|
export { Viewshed } from "./Viewshed.js";
|
|
29
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;;;;;;;;;;;;;;;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"]}
|
|
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,MAAM,EACN,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 Raster,\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
|
@@ -3,6 +3,7 @@ import type { TileGrid } from './basemap/grid.ts';
|
|
|
3
3
|
import type { DecoderUrls } from './decoding/decoders.ts';
|
|
4
4
|
import type { Feature, Ramp, Size } from './layers/features.ts';
|
|
5
5
|
import type { Layer } from './layers/layers.ts';
|
|
6
|
+
import type { QualitySettings } from './map/quality.ts';
|
|
6
7
|
import type { AttributionOptions } from './ui/controls.ts';
|
|
7
8
|
import type { Camera, Engine } from './wasm/isard.js';
|
|
8
9
|
export type LonLat = [lon: number, lat: number];
|
|
@@ -60,6 +61,8 @@ export interface BodyOptions {
|
|
|
60
61
|
* credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.
|
|
61
62
|
*/
|
|
62
63
|
export type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;
|
|
64
|
+
/** A level of the map's quality (`GeoMapOptions.quality`) */
|
|
65
|
+
export type Quality = 'high' | 'medium' | 'low';
|
|
63
66
|
export interface GeoMapOptions extends Partial<Camera> {
|
|
64
67
|
/** The body the map is drawn on (default 'earth'); set at creation */
|
|
65
68
|
body?: CelestialBody;
|
|
@@ -77,6 +80,11 @@ export interface GeoMapOptions extends Partial<Camera> {
|
|
|
77
80
|
sky?: boolean;
|
|
78
81
|
/** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */
|
|
79
82
|
sun?: SunOptions;
|
|
83
|
+
/** What the map draws less of on a device that cannot keep up (`setQuality`): `'high'` (the default) all of it;
|
|
84
|
+
* `'medium'` at most 1.5 device pixels a CSS pixel, the 3D Tiles coarser far away; `'low'` one device pixel a CSS
|
|
85
|
+
* pixel, no sun's shadows, the 3D Tiles coarser still; `'auto'` high, a level lower each time the frames stay slow
|
|
86
|
+
* while the map moves (`'quality'` event) */
|
|
87
|
+
quality?: Quality | 'auto';
|
|
80
88
|
/** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on
|
|
81
89
|
* the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options
|
|
82
90
|
* (default false; on another body, its `url` is required). Network layers are draped on it */
|
|
@@ -348,7 +356,13 @@ export interface Tiles3dStyle {
|
|
|
348
356
|
/** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without
|
|
349
357
|
* textures are light grey without it); none by default */
|
|
350
358
|
color?: string;
|
|
359
|
+
/** Each feature's color from its properties (a building's height, its use: a thematic map), in place of `color`: a
|
|
360
|
+
* CSS color, or undefined for the layer's. Asked once for each feature of a tile, when the tile is first drawn, and
|
|
361
|
+
* again for every tile when it changes (in React, keep the same function from one render to the next) */
|
|
362
|
+
featureColor?: FeatureColor | undefined;
|
|
351
363
|
}
|
|
364
|
+
/** A feature's color from its properties and its index in its tile (`Tiles3dStyle.featureColor`) */
|
|
365
|
+
export type FeatureColor = (properties: Record<string, unknown>, feature: number) => string | undefined;
|
|
352
366
|
export interface Tiles3dOptions extends Partial<Tiles3dStyle>, Placement {
|
|
353
367
|
/** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */
|
|
354
368
|
url: string;
|
|
@@ -404,6 +418,10 @@ export interface MapEvents {
|
|
|
404
418
|
render: {
|
|
405
419
|
ms: number;
|
|
406
420
|
};
|
|
421
|
+
/** The map's quality changed, by `setQuality` or stepped down by `'auto'` */
|
|
422
|
+
quality: {
|
|
423
|
+
quality: Quality;
|
|
424
|
+
};
|
|
407
425
|
/** Everything in view is loaded and drawn, nothing moves: the end of a load, once after each change (as MapLibre's
|
|
408
426
|
* `idle`). Tiles requested by the first frame count, so it never fires before they arrive. */
|
|
409
427
|
idle: Record<string, never>;
|
|
@@ -424,4 +442,6 @@ export interface LayerHost {
|
|
|
424
442
|
whenIdle(): Promise<void>;
|
|
425
443
|
/** Work the map waits on before it is idle (`GeoMap.track`) */
|
|
426
444
|
track<T>(work: Promise<T>): Promise<T>;
|
|
445
|
+
/** What its quality draws (`GeoMap.setQuality`) */
|
|
446
|
+
readonly quality: QualitySettings;
|
|
427
447
|
}
|
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 './decoding/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\n/** Where a new layer goes: under `before`, or on top of the others (under the labels kept on top) */\nexport interface Placement {\n before?: Layer;\n}\n\nexport interface RasterOptions extends Placement {\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>, Placement {\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>, Placement {\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 /** The walls of its untextured meshes show windows: glass by day, some lit at night (`setFacades`; default false) */\n facades?: 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/** What a pick looks at: within `radius` CSS pixels of the point (default 0), among `layers` (default every layer;\n * the others hide nothing) */\nexport interface PickOptions {\n radius?: number;\n layers?: readonly Layer[];\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"]}
|
|
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 './decoding/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { QualitySettings } from './map/quality.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\n/** A level of the map's quality (`GeoMapOptions.quality`) */\nexport type Quality = 'high' | 'medium' | 'low';\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 /** What the map draws less of on a device that cannot keep up (`setQuality`): `'high'` (the default) all of it;\n * `'medium'` at most 1.5 device pixels a CSS pixel, the 3D Tiles coarser far away; `'low'` one device pixel a CSS\n * pixel, no sun's shadows, the 3D Tiles coarser still; `'auto'` high, a level lower each time the frames stay slow\n * while the map moves (`'quality'` event) */\n quality?: Quality | 'auto';\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\n/** Where a new layer goes: under `before`, or on top of the others (under the labels kept on top) */\nexport interface Placement {\n before?: Layer;\n}\n\nexport interface RasterOptions extends Placement {\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>, Placement {\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 /** Each feature's color from its properties (a building's height, its use: a thematic map), in place of `color`: a\n * CSS color, or undefined for the layer's. Asked once for each feature of a tile, when the tile is first drawn, and\n * again for every tile when it changes (in React, keep the same function from one render to the next) */\n featureColor?: FeatureColor | undefined;\n}\n\n/** A feature's color from its properties and its index in its tile (`Tiles3dStyle.featureColor`) */\nexport type FeatureColor = (properties: Record<string, unknown>, feature: number) => string | undefined;\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle>, Placement {\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 /** The walls of its untextured meshes show windows: glass by day, some lit at night (`setFacades`; default false) */\n facades?: 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/** What a pick looks at: within `radius` CSS pixels of the point (default 0), among `layers` (default every layer;\n * the others hide nothing) */\nexport interface PickOptions {\n radius?: number;\n layers?: readonly Layer[];\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 /** The map's quality changed, by `setQuality` or stepped down by `'auto'` */\n quality: { quality: Quality };\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 /** What its quality draws (`GeoMap.setQuality`) */\n readonly quality: QualitySettings;\n}\n"]}
|
package/dist/wasm/isard.d.ts
CHANGED
|
@@ -336,7 +336,7 @@ export class Engine {
|
|
|
336
336
|
* Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
|
|
337
337
|
* info log), or when the features or the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
338
338
|
*/
|
|
339
|
-
addLines(points: Float64Array, start: Uint32Array, feature: Uint32Array, feature_count: number): number;
|
|
339
|
+
addLines(points: Float64Array, start: Uint32Array, feature: Uint32Array, feature_count: number, heights?: Float64Array | null, sea?: boolean | null): number;
|
|
340
340
|
/**
|
|
341
341
|
* A glTF / GLB model (its URL, a `blob:` one for data of the page) drawn at each instance of `instances`
|
|
342
342
|
* (`INSTANCE_NUMBERS` numbers each: longitude, latitude, altitude, heading, pitch, roll in degrees, scale);
|
|
@@ -454,7 +454,9 @@ export class Engine {
|
|
|
454
454
|
*/
|
|
455
455
|
static geoidHeight(lon: number, lat: number): number;
|
|
456
456
|
/**
|
|
457
|
-
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself
|
|
457
|
+
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself: from the copy of
|
|
458
|
+
* its tiles kept on the CPU, the drawn ground read back from the GPU only where none is there (a read back waits
|
|
459
|
+
* for the frame: called during a move, it stalls it)
|
|
458
460
|
*/
|
|
459
461
|
ground(x: number, y: number): [lon: number, lat: number] | undefined;
|
|
460
462
|
/**
|
|
@@ -758,7 +760,7 @@ export class Engine {
|
|
|
758
760
|
* Throws (to JavaScript) when the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
|
|
759
761
|
* when it cannot be created; the layer then keeps its lines
|
|
760
762
|
*/
|
|
761
|
-
setLines(id: number, points: Float64Array, start: Uint32Array, feature: Uint32Array): void;
|
|
763
|
+
setLines(id: number, points: Float64Array, start: Uint32Array, feature: Uint32Array, heights?: Float64Array | null, sea?: boolean | null): void;
|
|
762
764
|
/**
|
|
763
765
|
* Highest pitch the camera accepts, degrees (up to 85)
|
|
764
766
|
*/
|
|
@@ -902,6 +904,10 @@ export class Engine {
|
|
|
902
904
|
* Whether the walls of a 3D Tiles layer's untextured meshes show their windows: glass by day, some lit at night
|
|
903
905
|
*/
|
|
904
906
|
setTiles3dFacades(id: number, facades: boolean): void;
|
|
907
|
+
/**
|
|
908
|
+
* Each feature of a 3D Tiles layer its color (null: the layer's)
|
|
909
|
+
*/
|
|
910
|
+
setTiles3dFeatureColors(id: number, colors: ((properties: Record<string, unknown>[] | undefined, count: number) => Uint8Array) | null): void;
|
|
905
911
|
/**
|
|
906
912
|
* Screen-space error threshold, opacity, size of the points (CSS pixels, 2 if not given) and color (RGB 0-1, empty
|
|
907
913
|
* for none: it tints the textures and colors the untextured meshes) of a 3D Tiles layer
|
|
@@ -1081,7 +1087,7 @@ export interface InitOutput {
|
|
|
1081
1087
|
readonly engine_addFills: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
|
|
1082
1088
|
readonly engine_addFlow: (a: number, b: number, c: number) => [number, number, number];
|
|
1083
1089
|
readonly engine_addGround: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
1084
|
-
readonly engine_addLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
1090
|
+
readonly engine_addLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number];
|
|
1085
1091
|
readonly engine_addModels: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
1086
1092
|
readonly engine_addNetwork: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => [number, number, number];
|
|
1087
1093
|
readonly engine_addPointCloud: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
@@ -1152,7 +1158,7 @@ export interface InitOutput {
|
|
|
1152
1158
|
readonly engine_setIconAtlas: (a: number, b: number, c: number) => [number, number];
|
|
1153
1159
|
readonly engine_setImmediateLoading: (a: number, b: number) => void;
|
|
1154
1160
|
readonly engine_setLineDash: (a: number, b: number, c: number, d: number) => void;
|
|
1155
|
-
readonly engine_setLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
1161
|
+
readonly engine_setLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number];
|
|
1156
1162
|
readonly engine_setMaxPitch: (a: number, b: number) => void;
|
|
1157
1163
|
readonly engine_setModelGlow: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1158
1164
|
readonly engine_setModelHighlight: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
@@ -1176,6 +1182,7 @@ export interface InitOutput {
|
|
|
1176
1182
|
readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
1177
1183
|
readonly engine_setTileLoader: (a: number, b: any) => void;
|
|
1178
1184
|
readonly engine_setTiles3dFacades: (a: number, b: number, c: number) => void;
|
|
1185
|
+
readonly engine_setTiles3dFeatureColors: (a: number, b: number, c: any) => void;
|
|
1179
1186
|
readonly engine_setTiles3dStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
1180
1187
|
readonly engine_setVectorSublayers: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number) => void;
|
|
1181
1188
|
readonly engine_setVectorTile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number) => [number, number];
|
package/dist/wasm/isard.js
CHANGED
|
@@ -154,16 +154,20 @@ export class Engine {
|
|
|
154
154
|
* @param {Uint32Array} start
|
|
155
155
|
* @param {Uint32Array} feature
|
|
156
156
|
* @param {number} feature_count
|
|
157
|
+
* @param {Float64Array | null} [heights]
|
|
158
|
+
* @param {boolean | null} [sea]
|
|
157
159
|
* @returns {number}
|
|
158
160
|
*/
|
|
159
|
-
addLines(points, start, feature, feature_count) {
|
|
161
|
+
addLines(points, start, feature, feature_count, heights, sea) {
|
|
160
162
|
const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
161
163
|
const len0 = WASM_VECTOR_LEN;
|
|
162
164
|
const ptr1 = passArray32ToWasm0(start, wasm.__wbindgen_malloc);
|
|
163
165
|
const len1 = WASM_VECTOR_LEN;
|
|
164
166
|
const ptr2 = passArray32ToWasm0(feature, wasm.__wbindgen_malloc);
|
|
165
167
|
const len2 = WASM_VECTOR_LEN;
|
|
166
|
-
|
|
168
|
+
var ptr3 = isLikeNone(heights) ? 0 : passArrayF64ToWasm0(heights, wasm.__wbindgen_malloc);
|
|
169
|
+
var len3 = WASM_VECTOR_LEN;
|
|
170
|
+
const ret = wasm.engine_addLines(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, feature_count, ptr3, len3, isLikeNone(sea) ? 0xFFFFFF : sea ? 1 : 0);
|
|
167
171
|
if (ret[2]) {
|
|
168
172
|
throw takeFromExternrefTable0(ret[1]);
|
|
169
173
|
}
|
|
@@ -420,7 +424,9 @@ export class Engine {
|
|
|
420
424
|
return ret;
|
|
421
425
|
}
|
|
422
426
|
/**
|
|
423
|
-
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself
|
|
427
|
+
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself: from the copy of
|
|
428
|
+
* its tiles kept on the CPU, the drawn ground read back from the GPU only where none is there (a read back waits
|
|
429
|
+
* for the frame: called during a move, it stalls it)
|
|
424
430
|
* @param {number} x
|
|
425
431
|
* @param {number} y
|
|
426
432
|
* @returns {[lon: number, lat: number] | undefined}
|
|
@@ -1123,15 +1129,19 @@ export class Engine {
|
|
|
1123
1129
|
* @param {Float64Array} points
|
|
1124
1130
|
* @param {Uint32Array} start
|
|
1125
1131
|
* @param {Uint32Array} feature
|
|
1132
|
+
* @param {Float64Array | null} [heights]
|
|
1133
|
+
* @param {boolean | null} [sea]
|
|
1126
1134
|
*/
|
|
1127
|
-
setLines(id, points, start, feature) {
|
|
1135
|
+
setLines(id, points, start, feature, heights, sea) {
|
|
1128
1136
|
const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
1129
1137
|
const len0 = WASM_VECTOR_LEN;
|
|
1130
1138
|
const ptr1 = passArray32ToWasm0(start, wasm.__wbindgen_malloc);
|
|
1131
1139
|
const len1 = WASM_VECTOR_LEN;
|
|
1132
1140
|
const ptr2 = passArray32ToWasm0(feature, wasm.__wbindgen_malloc);
|
|
1133
1141
|
const len2 = WASM_VECTOR_LEN;
|
|
1134
|
-
|
|
1142
|
+
var ptr3 = isLikeNone(heights) ? 0 : passArrayF64ToWasm0(heights, wasm.__wbindgen_malloc);
|
|
1143
|
+
var len3 = WASM_VECTOR_LEN;
|
|
1144
|
+
const ret = wasm.engine_setLines(this.__wbg_ptr, id, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, isLikeNone(sea) ? 0xFFFFFF : sea ? 1 : 0);
|
|
1135
1145
|
if (ret[1]) {
|
|
1136
1146
|
throw takeFromExternrefTable0(ret[0]);
|
|
1137
1147
|
}
|
|
@@ -1465,6 +1475,14 @@ export class Engine {
|
|
|
1465
1475
|
setTiles3dFacades(id, facades) {
|
|
1466
1476
|
wasm.engine_setTiles3dFacades(this.__wbg_ptr, id, facades);
|
|
1467
1477
|
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Each feature of a 3D Tiles layer its color (null: the layer's)
|
|
1480
|
+
* @param {number} id
|
|
1481
|
+
* @param {((properties: Record<string, unknown>[] | undefined, count: number) => Uint8Array) | null} colors
|
|
1482
|
+
*/
|
|
1483
|
+
setTiles3dFeatureColors(id, colors) {
|
|
1484
|
+
wasm.engine_setTiles3dFeatureColors(this.__wbg_ptr, id, colors);
|
|
1485
|
+
}
|
|
1468
1486
|
/**
|
|
1469
1487
|
* Screen-space error threshold, opacity, size of the points (CSS pixels, 2 if not given) and color (RGB 0-1, empty
|
|
1470
1488
|
* for none: it tints the textures and colors the untextured meshes) of a 3D Tiles layer
|
|
@@ -2119,6 +2137,10 @@ function __wbg_get_imports() {
|
|
|
2119
2137
|
const ret = arg0.call(arg1, arg2, arg3, arg4, arg5);
|
|
2120
2138
|
return ret;
|
|
2121
2139
|
}, arguments); },
|
|
2140
|
+
__wbg_call_1875a20c43a36133: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
2141
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
2142
|
+
return ret;
|
|
2143
|
+
}, arguments); },
|
|
2122
2144
|
__wbg_call_187d372bd5fdd4aa: function() { return handleError(function (arg0, arg1, arg2) {
|
|
2123
2145
|
const ret = arg0.call(arg1, arg2);
|
|
2124
2146
|
return ret;
|
|
@@ -2308,6 +2330,12 @@ function __wbg_get_imports() {
|
|
|
2308
2330
|
__wbg_detachShader_67dabaaad80a795e: function(arg0, arg1, arg2) {
|
|
2309
2331
|
arg0.detachShader(arg1, arg2);
|
|
2310
2332
|
},
|
|
2333
|
+
__wbg_disableVertexAttribArray_11c9f11bee30c9d8: function(arg0, arg1) {
|
|
2334
|
+
arg0.disableVertexAttribArray(arg1 >>> 0);
|
|
2335
|
+
},
|
|
2336
|
+
__wbg_disableVertexAttribArray_c4c8af1f9e4120d4: function(arg0, arg1) {
|
|
2337
|
+
arg0.disableVertexAttribArray(arg1 >>> 0);
|
|
2338
|
+
},
|
|
2311
2339
|
__wbg_disable_19fe787eccdf0272: function(arg0, arg1) {
|
|
2312
2340
|
arg0.disable(arg1 >>> 0);
|
|
2313
2341
|
},
|
|
@@ -132,7 +132,7 @@ export class Engine {
|
|
|
132
132
|
* Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
|
|
133
133
|
* info log), or when the features or the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
|
|
134
134
|
*/
|
|
135
|
-
addLines(points: Float64Array, start: Uint32Array, feature: Uint32Array, feature_count: number): number;
|
|
135
|
+
addLines(points: Float64Array, start: Uint32Array, feature: Uint32Array, feature_count: number, heights?: Float64Array | null, sea?: boolean | null): number;
|
|
136
136
|
/**
|
|
137
137
|
* Network of `mercator.length / 2` nodes (Mercator [0, 1], y towards the south, interleaved: converted by the
|
|
138
138
|
* JavaScript side, where `Math.tan` and `Math.log` are much faster than in WebAssembly) and `edges.length / 2`
|
|
@@ -213,7 +213,9 @@ export class Engine {
|
|
|
213
213
|
*/
|
|
214
214
|
static geoidHeight(lon: number, lat: number): number;
|
|
215
215
|
/**
|
|
216
|
-
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself
|
|
216
|
+
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself: from the copy of
|
|
217
|
+
* its tiles kept on the CPU, the drawn ground read back from the GPU only where none is there (a read back waits
|
|
218
|
+
* for the frame: called during a move, it stalls it)
|
|
217
219
|
*/
|
|
218
220
|
ground(x: number, y: number): [lon: number, lat: number] | undefined;
|
|
219
221
|
/**
|
|
@@ -504,7 +506,7 @@ export class Engine {
|
|
|
504
506
|
* Throws (to JavaScript) when the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
|
|
505
507
|
* when it cannot be created; the layer then keeps its lines
|
|
506
508
|
*/
|
|
507
|
-
setLines(id: number, points: Float64Array, start: Uint32Array, feature: Uint32Array): void;
|
|
509
|
+
setLines(id: number, points: Float64Array, start: Uint32Array, feature: Uint32Array, heights?: Float64Array | null, sea?: boolean | null): void;
|
|
508
510
|
/**
|
|
509
511
|
* Highest pitch the camera accepts, degrees (up to 85)
|
|
510
512
|
*/
|
|
@@ -742,7 +744,7 @@ export interface InitOutput {
|
|
|
742
744
|
readonly engine_addFills: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
|
|
743
745
|
readonly engine_addFlow: (a: number, b: number, c: number) => [number, number, number];
|
|
744
746
|
readonly engine_addGround: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
745
|
-
readonly engine_addLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
747
|
+
readonly engine_addLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number];
|
|
746
748
|
readonly engine_addNetwork: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => [number, number, number];
|
|
747
749
|
readonly engine_addRaster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
748
750
|
readonly engine_addSymbols: (a: number) => [number, number, number];
|
|
@@ -806,7 +808,7 @@ export interface InitOutput {
|
|
|
806
808
|
readonly engine_setIconAtlas: (a: number, b: number, c: number) => [number, number];
|
|
807
809
|
readonly engine_setImmediateLoading: (a: number, b: number) => void;
|
|
808
810
|
readonly engine_setLineDash: (a: number, b: number, c: number, d: number) => void;
|
|
809
|
-
readonly engine_setLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
811
|
+
readonly engine_setLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number];
|
|
810
812
|
readonly engine_setMaxPitch: (a: number, b: number) => void;
|
|
811
813
|
readonly engine_setNetworkCosts: (a: number, b: number, c: number, d: number) => void;
|
|
812
814
|
readonly engine_setNetworkRamp: (a: number, b: number, c: number, d: number) => void;
|
package/dist/wasm/isard_core.js
CHANGED
|
@@ -154,16 +154,20 @@ export class Engine {
|
|
|
154
154
|
* @param {Uint32Array} start
|
|
155
155
|
* @param {Uint32Array} feature
|
|
156
156
|
* @param {number} feature_count
|
|
157
|
+
* @param {Float64Array | null} [heights]
|
|
158
|
+
* @param {boolean | null} [sea]
|
|
157
159
|
* @returns {number}
|
|
158
160
|
*/
|
|
159
|
-
addLines(points, start, feature, feature_count) {
|
|
161
|
+
addLines(points, start, feature, feature_count, heights, sea) {
|
|
160
162
|
const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
161
163
|
const len0 = WASM_VECTOR_LEN;
|
|
162
164
|
const ptr1 = passArray32ToWasm0(start, wasm.__wbindgen_malloc);
|
|
163
165
|
const len1 = WASM_VECTOR_LEN;
|
|
164
166
|
const ptr2 = passArray32ToWasm0(feature, wasm.__wbindgen_malloc);
|
|
165
167
|
const len2 = WASM_VECTOR_LEN;
|
|
166
|
-
|
|
168
|
+
var ptr3 = isLikeNone(heights) ? 0 : passArrayF64ToWasm0(heights, wasm.__wbindgen_malloc);
|
|
169
|
+
var len3 = WASM_VECTOR_LEN;
|
|
170
|
+
const ret = wasm.engine_addLines(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, feature_count, ptr3, len3, isLikeNone(sea) ? 0xFFFFFF : sea ? 1 : 0);
|
|
167
171
|
if (ret[2]) {
|
|
168
172
|
throw takeFromExternrefTable0(ret[1]);
|
|
169
173
|
}
|
|
@@ -344,7 +348,9 @@ export class Engine {
|
|
|
344
348
|
return ret;
|
|
345
349
|
}
|
|
346
350
|
/**
|
|
347
|
-
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself
|
|
351
|
+
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself: from the copy of
|
|
352
|
+
* its tiles kept on the CPU, the drawn ground read back from the GPU only where none is there (a read back waits
|
|
353
|
+
* for the frame: called during a move, it stalls it)
|
|
348
354
|
* @param {number} x
|
|
349
355
|
* @param {number} y
|
|
350
356
|
* @returns {[lon: number, lat: number] | undefined}
|
|
@@ -1018,15 +1024,19 @@ export class Engine {
|
|
|
1018
1024
|
* @param {Float64Array} points
|
|
1019
1025
|
* @param {Uint32Array} start
|
|
1020
1026
|
* @param {Uint32Array} feature
|
|
1027
|
+
* @param {Float64Array | null} [heights]
|
|
1028
|
+
* @param {boolean | null} [sea]
|
|
1021
1029
|
*/
|
|
1022
|
-
setLines(id, points, start, feature) {
|
|
1030
|
+
setLines(id, points, start, feature, heights, sea) {
|
|
1023
1031
|
const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
1024
1032
|
const len0 = WASM_VECTOR_LEN;
|
|
1025
1033
|
const ptr1 = passArray32ToWasm0(start, wasm.__wbindgen_malloc);
|
|
1026
1034
|
const len1 = WASM_VECTOR_LEN;
|
|
1027
1035
|
const ptr2 = passArray32ToWasm0(feature, wasm.__wbindgen_malloc);
|
|
1028
1036
|
const len2 = WASM_VECTOR_LEN;
|
|
1029
|
-
|
|
1037
|
+
var ptr3 = isLikeNone(heights) ? 0 : passArrayF64ToWasm0(heights, wasm.__wbindgen_malloc);
|
|
1038
|
+
var len3 = WASM_VECTOR_LEN;
|
|
1039
|
+
const ret = wasm.engine_setLines(this.__wbg_ptr, id, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, isLikeNone(sea) ? 0xFFFFFF : sea ? 1 : 0);
|
|
1030
1040
|
if (ret[1]) {
|
|
1031
1041
|
throw takeFromExternrefTable0(ret[0]);
|
|
1032
1042
|
}
|
|
@@ -1970,6 +1980,12 @@ function __wbg_get_imports() {
|
|
|
1970
1980
|
__wbg_detachShader_67dabaaad80a795e: function(arg0, arg1, arg2) {
|
|
1971
1981
|
arg0.detachShader(arg1, arg2);
|
|
1972
1982
|
},
|
|
1983
|
+
__wbg_disableVertexAttribArray_11c9f11bee30c9d8: function(arg0, arg1) {
|
|
1984
|
+
arg0.disableVertexAttribArray(arg1 >>> 0);
|
|
1985
|
+
},
|
|
1986
|
+
__wbg_disableVertexAttribArray_c4c8af1f9e4120d4: function(arg0, arg1) {
|
|
1987
|
+
arg0.disableVertexAttribArray(arg1 >>> 0);
|
|
1988
|
+
},
|
|
1973
1989
|
__wbg_disable_19fe787eccdf0272: function(arg0, arg1) {
|
|
1974
1990
|
arg0.disable(arg1 >>> 0);
|
|
1975
1991
|
},
|
package/package.json
CHANGED