isard 1.6.0 → 1.7.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/basemap/furniture.d.ts +20 -2
  3. package/dist/basemap/furniture.js +72 -3
  4. package/dist/basemap/furniture.js.map +1 -1
  5. package/dist/basemap/meshes.d.ts +21 -0
  6. package/dist/basemap/meshes.js +159 -0
  7. package/dist/basemap/meshes.js.map +1 -0
  8. package/dist/basemap/placed.d.ts +13 -0
  9. package/dist/basemap/placed.js +14 -0
  10. package/dist/basemap/placed.js.map +1 -0
  11. package/dist/basemap/trees.d.ts +4 -14
  12. package/dist/basemap/trees.js +12 -93
  13. package/dist/basemap/trees.js.map +1 -1
  14. package/dist/basemap/vectortiles/context.d.ts +4 -2
  15. package/dist/basemap/vectortiles/context.js.map +1 -1
  16. package/dist/basemap/vectortiles/extrusions.d.ts +1 -1
  17. package/dist/basemap/vectortiles/extrusions.js +7 -16
  18. package/dist/basemap/vectortiles/extrusions.js.map +1 -1
  19. package/dist/basemap/vectortiles/furniture.d.ts +19 -0
  20. package/dist/basemap/vectortiles/furniture.js +29 -0
  21. package/dist/basemap/vectortiles/furniture.js.map +1 -0
  22. package/dist/basemap/vectortiles/labels.js +8 -1
  23. package/dist/basemap/vectortiles/labels.js.map +1 -1
  24. package/dist/basemap/vectortiles/lamps.js +11 -76
  25. package/dist/basemap/vectortiles/lamps.js.map +1 -1
  26. package/dist/basemap/vectortiles/placed.d.ts +38 -0
  27. package/dist/basemap/vectortiles/placed.js +143 -0
  28. package/dist/basemap/vectortiles/placed.js.map +1 -0
  29. package/dist/basemap/vectortiles/street-wind.js +4 -6
  30. package/dist/basemap/vectortiles/street-wind.js.map +1 -1
  31. package/dist/basemap/vectortiles/trees.d.ts +2 -9
  32. package/dist/basemap/vectortiles/trees.js +34 -165
  33. package/dist/basemap/vectortiles/trees.js.map +1 -1
  34. package/dist/basemap/vectortiles/vectors.d.ts +4 -5
  35. package/dist/basemap/vectortiles/vectors.js +17 -16
  36. package/dist/basemap/vectortiles/vectors.js.map +1 -1
  37. package/dist/basemap/vectortiles.d.ts +14 -4
  38. package/dist/basemap/vectortiles.js +40 -12
  39. package/dist/basemap/vectortiles.js.map +1 -1
  40. package/dist/basemap/wmts.js +2 -2
  41. package/dist/basemap/wmts.js.map +1 -1
  42. package/dist/basemap.worker.js +2 -2
  43. package/dist/basemap.worker.js.map +18 -14
  44. package/dist/data/collada.js +3 -17
  45. package/dist/data/collada.js.map +1 -1
  46. package/dist/data/crs.js +1 -1
  47. package/dist/data/crs.js.map +1 -1
  48. package/dist/data/ifc.js +21 -22
  49. package/dist/data/ifc.js.map +1 -1
  50. package/dist/geoplateforme.d.ts +14 -2
  51. package/dist/geoplateforme.js +24 -2
  52. package/dist/geoplateforme.js.map +1 -1
  53. package/dist/index.d.ts +5 -4
  54. package/dist/index.js +3 -3
  55. package/dist/index.js.map +1 -1
  56. package/dist/isard_bg.wasm +0 -0
  57. package/dist/isard_core_bg.wasm +0 -0
  58. package/dist/isard_grid_bg.wasm +0 -0
  59. package/dist/isard_tess_bg.wasm +0 -0
  60. package/dist/layers/extrusions.js +5 -4
  61. package/dist/layers/extrusions.js.map +1 -1
  62. package/dist/layers/features.d.ts +0 -2
  63. package/dist/layers/features.js +5 -6
  64. package/dist/layers/features.js.map +1 -1
  65. package/dist/layers/layers.d.ts +2 -0
  66. package/dist/layers/layers.js +11 -0
  67. package/dist/layers/layers.js.map +1 -1
  68. package/dist/layers/panoramas.d.ts +32 -10
  69. package/dist/layers/panoramas.js +55 -28
  70. package/dist/layers/panoramas.js.map +1 -1
  71. package/dist/layers/photos.js +5 -6
  72. package/dist/layers/photos.js.map +1 -1
  73. package/dist/layers/trees.js +7 -7
  74. package/dist/layers/trees.js.map +1 -1
  75. package/dist/layers/vectors.d.ts +1 -0
  76. package/dist/layers/vectors.js +23 -8
  77. package/dist/layers/vectors.js.map +1 -1
  78. package/dist/map/frame-loop.d.ts +2 -0
  79. package/dist/map/frame-loop.js +3 -3
  80. package/dist/map/frame-loop.js.map +1 -1
  81. package/dist/map.js +17 -0
  82. package/dist/map.js.map +1 -1
  83. package/dist/panoramax.d.ts +6 -0
  84. package/dist/panoramax.js +29 -3
  85. package/dist/panoramax.js.map +1 -1
  86. package/dist/react/VectorGeometry.d.ts +18 -9
  87. package/dist/react/VectorGeometry.js +27 -13
  88. package/dist/react/VectorGeometry.js.map +1 -1
  89. package/dist/react/VectorTiles.d.ts +65 -0
  90. package/dist/react/VectorTiles.js +112 -0
  91. package/dist/react/VectorTiles.js.map +1 -0
  92. package/dist/react/context.d.ts +9 -0
  93. package/dist/react/context.js +32 -0
  94. package/dist/react/context.js.map +1 -1
  95. package/dist/react/index.d.ts +7 -1
  96. package/dist/react/index.js +7 -1
  97. package/dist/react/index.js.map +1 -1
  98. package/dist/types.d.ts +2 -0
  99. package/dist/types.js.map +1 -1
  100. package/dist/util/geo.d.ts +8 -0
  101. package/dist/util/geo.js +8 -0
  102. package/dist/util/geo.js.map +1 -1
  103. package/dist/util/gltf.d.ts +18 -1
  104. package/dist/util/gltf.js +26 -1
  105. package/dist/util/gltf.js.map +1 -1
  106. package/dist/util/roofs.d.ts +8 -0
  107. package/dist/util/roofs.js +16 -2
  108. package/dist/util/roofs.js.map +1 -1
  109. package/dist/util/style-floats.d.ts +33 -0
  110. package/dist/util/style-floats.js +34 -0
  111. package/dist/util/style-floats.js.map +1 -0
  112. package/dist/util/sun.js +1 -1
  113. package/dist/util/sun.js.map +1 -1
  114. package/dist/workers/basemap/furniture.d.ts +13 -0
  115. package/dist/workers/basemap/geometry.d.ts +2 -5
  116. package/dist/workers/basemap/labels.d.ts +5 -2
  117. package/dist/workers/basemap/lamps.d.ts +3 -3
  118. package/dist/workers/basemap/tiles.d.ts +2 -0
  119. package/dist/workers/basemap/trees.d.ts +3 -0
  120. package/dist/workers/basemap.worker.d.ts +17 -1
  121. package/dist/workers/basemap.worker.js +12 -1
  122. package/dist/workers/basemap.worker.js.map +1 -1
  123. package/package.json +1 -1
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0CAA0C","sourcesContent":["/** Public types of the `isard` package */\n\nimport type { TileGrid } from './basemap/grid.ts';\nimport type { DecoderUrls } from './engine/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard.js';\n\nexport type LonLat = [lon: number, lat: number];\nexport type Point = [x: number, y: number];\n\n/**\n * The named basemaps. OpenFreeMap's vector styles, OpenStreetMap data worldwide, their labels above the other layers:\n * `osm-positron` (light grey, quiet: data over it reads first), `osm-liberty` and `osm-bright` (in colour), `osm-dark`\n * (near black: bright data over it, a wind's particles, lights). The\n * Géoplateforme's (IGN, France): rasters (`ign-plan`, `ign-plan-grey`, `ign-ortho`, the aerial photographs) or vector\n * tiles with their labels (`ign-plan-vector`, `ign-plan-grey-vector`, the PLAN.IGN styles).\n */\nexport type BasemapName =\n | 'osm-positron'\n | 'osm-liberty'\n | 'osm-bright'\n | 'osm-dark'\n | 'ign-plan'\n | 'ign-plan-grey'\n | 'ign-ortho'\n | 'ign-plan-vector'\n | 'ign-plan-grey-vector'\n | 'none';\n\n/** A basemap by name (see `BasemapName`) */\nexport type Basemap = BasemapName;\n\n/**\n * The Earth's named terrain models. `'terrain-tiles'`: worldwide, the Terrain Tiles of AWS's open data registry\n * (SRTM, EU-DEM, GMTED… merged by Mapzen, 30 m in most places), the sea floor flattened at sea level. `'ign'`: France,\n * the IGN's RGE ALTI from the Géoplateforme (1 to 5 m), raised by the RAF20 geoid to heights above the ellipsoid.\n */\nexport type TerrainModel = 'terrain-tiles' | 'ign';\n\n/** How tiles encode their altitudes: `'float32'`, raw little-endian floats (`image/x-bil;bits=32`, an ArcGIS raw\n * grid); `'terrarium'`, the colors of a PNG, `R × 256 + G + B / 256 - 32768`; `'mapbox'`, those of Terrain-RGB,\n * `(R × 65536 + G × 256 + B) / 10 - 10000` */\nexport type TerrainEncoding = 'float32' | 'terrarium' | 'mapbox';\n\n/**\n * How tiles load and show. 'immediate' (default): everything visible loads, tiles show as soon as they arrive.\n * 'smooth': during flights the levels flown through are skipped, off-center tiles wait while the camera moves, tiles\n * fade in; fewer downloads, for slow networks or GPUs.\n */\nexport type LoadingMode = 'immediate' | 'smooth';\n\n/** 'globe': a sphere at low zoom, blending into Web Mercator between zooms 5 and 7, up to three levels later under a\n * tilted camera (it sees much farther than its center: the horizon stays curved) */\nexport type Projection = 'globe' | 'mercator';\n\n/** A body to draw the map on, other than the named ones (`CelestialBody`) */\nexport interface BodyOptions {\n /** Equatorial radius, metres */\n radius: number;\n /** Flattening of its ellipsoid, 0 for a sphere (default 0) */\n flattening?: number;\n /** An atmosphere: its halo around the globe, true for the Earth's light blue, or a CSS color (its alpha the\n * halo's strength) (default false) */\n atmosphere?: boolean | string;\n /** Color of the globe where no tile covers it (past the Web Mercator latitudes, 85°), a CSS color (default\n * `#808080`) */\n color?: string;\n /** Lowest and highest altitudes of its ground, metres around the ellipsoid: what its relief may raise into view\n * (default ±1 % of the radius) */\n relief?: [lowest: number, highest: number];\n}\n\n/**\n * The body the map is drawn on: 'earth' (WGS 84, the default), 'moon' (a sphere of 1 737 400 m, no atmosphere),\n * 'mars' (a sphere of 3 396 190 m, its equatorial radius, a thin dusty halo; planetocentric latitudes) or another\n * one. Zoom levels keep their meaning on screen (the Web Mercator tile pyramid), their metres follow the body:\n * altitudes, relief, buildings, 3D Tiles. Off the Earth, the map has none of the Earth's defaults: no basemap, no\n * credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.\n */\nexport type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;\n\nexport interface GeoMapOptions extends Partial<Camera> {\n /** The body the map is drawn on (default 'earth'); set at creation */\n body?: CelestialBody;\n /** Default 'globe' */\n projection?: Projection;\n /** Default 'immediate' */\n loading?: LoadingMode;\n /** The basemap (default 'osm-positron'; 'none' off the Earth) */\n basemap?: Basemap;\n /** Opacity of the IGN hillshade over the basemap (France, Géoplateforme), 0 for none (default 0) */\n hillshade?: number;\n /** Color behind the map (sky of tilted flat views), a CSS color (default `#f2f2f0`; black off the Earth) */\n background?: string;\n /** Space behind the globe: stars and atmosphere halo, fading out as the globe turns flat (default true) */\n sky?: boolean;\n /** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */\n sun?: SunOptions;\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on\n * the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options\n * (default false; on another body, its `url` is required). Network layers are draped on it */\n terrain?: boolean | TerrainModel | TerrainOptions;\n minZoom?: number;\n maxZoom?: number;\n /** Highest pitch, degrees, up to 85 (default 70) */\n maxPitch?: number;\n /** Sky over the plane, seen when the camera is tilted towards the horizon, and the fog the ground fades into\n * (MapLibre's `setSky`); default none: the background color */\n atmosphere?: AtmosphereOptions;\n /** Mouse, touch and keyboard controls (default true) */\n interactive?: boolean;\n /** Keyboard controls once the map has the focus (it is reached with Tab): arrows pan, Shift + arrows rotate and\n * tilt, + and - zoom (Shift: two levels), 0 faces north and levels the view (default true; none when not\n * `interactive`) */\n keyboard?: boolean;\n /** Accessible name of the map, read by screen readers (default 'Map') */\n ariaLabel?: string;\n /** A preset of map options (`IGN_PRESETS`: `'ign'`, `'ign-3d'`, `'ign-ortho-3d'`), the other options over it */\n preset?: 'ign' | 'ign-3d' | 'ign-ortho-3d';\n /** The folder isard's files are served from (its engines, `isard_bg.wasm`, `isard_core_bg.wasm`,\n * `isard_points_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that\n * moves them, the `…Url` options below for each one. `isard/vite` sets it for the whole page; default next to the\n * module */\n assetsUrl?: string | URL;\n /** Where to load the engine with 3D Tiles from (`isard_bg.wasm`), when a bundler does not resolve the default URL.\n * Given without `coreWasmUrl`, maps load this engine from the start */\n wasmUrl?: string | URL;\n /** Where to load the engine without 3D Tiles from (`isard_core_bg.wasm`, a third smaller), when a bundler does not\n * resolve the default URL. Maps load it first, and the engine with 3D Tiles (`wasmUrl`) for their first 3D Tiles\n * layer only */\n coreWasmUrl?: string | URL;\n /** Where the decoding workers load the point cloud module from (`isard_points_bg.wasm`, the LAZ decoder of COPC),\n * when a bundler does not resolve the default URL. Loaded with the first point cloud only */\n pointsWasmUrl?: string | URL;\n /** Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`: the vector tiles drawn as\n * geometry, `vectorTiles().vectors()`, made ready for the GPU off the main thread), when a bundler does not resolve\n * the default URL. Loaded with the first tile of geometry; without it, the main thread does that work */\n tessWasmUrl?: string | URL;\n /** Where the workers load the grid module from (`isard_grid_bg.wasm`: GRIB2 and NetCDF files read by\n * `map.readGrids`), when a bundler does not resolve the default URL. Loaded with the first file */\n gridWasmUrl?: string | URL;\n /** Load the engine with 3D Tiles from the start (default false: it is loaded when the first 3D Tiles layer or glTF\n * model is added, the map then moving its camera and layers onto it, a stall of about a frame or two). For a map that shows 3D Tiles\n * at once: one engine downloaded instead of two. `'preload'`: the map starts on the engine without 3D Tiles and\n * downloads and compiles the other once idle, without running it: its first 3D Tiles layer does not wait for the\n * download (for a map that will show 3D Tiles later, on demand) */\n tiles3d?: boolean | 'preload';\n /** Where to load the vector basemap worker from, when a bundler does not resolve the default URL */\n basemapWorkerUrl?: string | URL;\n /** Texture size of the vector basemap's tiles, pixels (default 512: lines and edges sharp at every zoom on a screen\n * of pixel ratio 1). 256: a quarter of the drawing in the workers, of the uploads and of the GPU memory, for lines\n * and edges a little softer between two zoom levels (the tiles are shown 181 to 362 CSS pixels wide) */\n basemapTileSize?: number;\n /** Glyphs of the symbol layers: a URL with `{fontstack}` and `{range}` (MapLibre's glyph format; default\n * OpenFreeMap's fonts, Noto Sans). A vector basemap's labels take the glyphs of its style */\n glyphs?: string;\n /** Workers decoding 3D Tiles off the main thread: a count, or false to decode on the main thread (default: cores - 1,\n * 1 to 4). False (or 0) also decodes the PNG relief and reprojects the equirectangular rasters on the main thread,\n * else done by the vector basemap's workers */\n workers?: number | false;\n /** Where to load the decoding worker from, when a bundler does not resolve the default URL */\n workerUrl?: string | URL;\n /** Folders of the Draco and Basis Universal decoders, loaded by the workers on first use (default: the official\n * builds on gstatic.com and jsDelivr; self-host them for offline or locked-down networks). They run through\n * `new Function`: a Content Security Policy needs `'unsafe-eval'` (see `DecoderUrls`) */\n decoders?: Partial<DecoderUrls>;\n /** Credits at the bottom right: false for none, or its options (default true: the credits of the basemap,\n * hillshade and relief in use, compact on maps narrower than 640 px) */\n attributionControl?: boolean | AttributionOptions;\n}\n\nexport interface TerrainOptions {\n /** One of the Earth's named models (default `'terrain-tiles'` on the Earth); unused with a `url` */\n model?: TerrainModel;\n /** Altitudes of 256 × 256 tiles in `encoding`: a WMS GetMap URL with {bbox} (EPSG:3857 on the Earth, the body's\n * Mercator metres elsewhere: the sphere of its radius), a tile URL with {z}, {x} and {y}, or an ArcGIS image service\n * (a URL ending in `/ImageServer`), asked for raw altitudes in the body's Mercator (default: the `model`'s; on the\n * Moon and Mars, NASA's Trek LOLA and MOLA models) */\n url?: string;\n /** How the tiles of `url` encode their altitudes (default `'float32'`); `'terrarium'` and `'mapbox'` take a URL with\n * {z}, {x} and {y} */\n encoding?: TerrainEncoding;\n /** Vertical exaggeration, 1 for the true relief (default 1) */\n exaggeration?: number;\n /** Finest level of the relief, up to 15 (default 15; 14 for the Terrain Tiles, 8 for the Moon's and Mars's models). It\n * starts at level 6 on the Earth, coarser on bodies of a larger relief for their size (3 on the Moon and Mars) */\n maxZoom?: number;\n /** Altitudes over mainland France raised by the height of the RAF20 geoid (the French one, 0 away from France), to\n * heights above the ellipsoid (those of 3D Tiles); false keeps the altitudes as served (NGF-IGN69 for the IGN's)\n * (default true for the `'ign'` model, false otherwise) */\n geoid?: boolean;\n}\n\n/** Sky, horizon and fog over the plane, with the names and meanings of MapLibre's `setSky` */\nexport interface AtmosphereOptions {\n /** A CSS color (default `#9cc7ec`) */\n skyColor?: string;\n /** (default `#e8f1f8`) */\n horizonColor?: string;\n /** (default `#f2f5f8`) */\n fogColor?: string;\n /** Blend from the horizon to the sky color, share of the field of view above the horizon, 0-1 (default 0.6) */\n skyHorizonBlend?: number;\n /** Blend from the horizon to the fog color below the horizon, 0-1 (default 0.7) */\n horizonFogBlend?: number;\n /** Share of the distance to the far plane over which the ground fades into the fog, 0-1 (default 0.4) */\n fogGroundBlend?: number;\n}\n\n/** The sun casting shadows (`GeoMap.setSun`): where it stands, by date or by hand, and how dark its shadows are */\nexport interface SunOptions {\n /** The time: the sun where it stands then over the map's center (default now, unless `azimuth` and `altitude`) */\n date?: Date;\n /** Degrees clockwise from north, with `altitude`: the sun placed by hand */\n azimuth?: number;\n /** Degrees above the horizon; at or under it, no shadows */\n altitude?: number;\n /** How dark the shadows are, 0 to 1 (default 0.35) */\n opacity?: number;\n /** How dark the night is, 0 to 1: the scene tinted in its blue, the windows of the buildings and the streets of\n * `vectors()` lit, the labels light on dark. By default from the sun's altitude: falling from 6° above the horizon\n * to 6° under it */\n night?: number;\n}\n\n/** What can be seen from a point (`GeoMap.setViewshed`); with several observers, the colors, the opacity and the\n * cone's color are the first one's */\nexport interface ViewshedOptions {\n /** The observer */\n position: LonLat;\n /** Metres above the ground (default 1.7, eye level) */\n height?: number;\n /** Metres around the observer that are tinted (default 1000) */\n range?: number;\n /** A CSS color for what is seen (default `#2f9e44`) */\n visibleColor?: string;\n /** A CSS color for what is hidden (default `#e03131`) */\n hiddenColor?: string;\n /** How strongly the colors tint the scene, multiplied into it so that its textures and shading stay, 0-1 (default\n * 0.7) */\n opacity?: number;\n /** A CSS color for the cone drawn in 3D (one way only): its fan through the axis, at the eye's height and tilted\n * with it, from the eye to the range; solid where nothing hides it, faint behind the scene; none by default */\n coneColor?: string;\n /** To look one way only (a camera, a lookout), degrees clockwise from north; all around without it */\n direction?: number;\n /** Degrees above the horizon the cone looks, negative below (default 0) */\n tilt?: number;\n /** Angle of view across, degrees (default 60) */\n fov?: number;\n /** Angle of view up and down, degrees (default 40) */\n verticalFov?: number;\n}\n\n/** An eye at street level (`GeoMap.setFirstPerson`) */\nexport interface FirstPersonView {\n /** Where it stands */\n lonLat: LonLat;\n /** Metres above the ground (default 1.7) */\n height?: number;\n /** Degrees clockwise from north it looks to */\n bearing: number;\n /** Degrees from straight down: 90 level (the default), 180 straight up */\n pitch?: number;\n /** Vertical field of view, degrees (default 75) */\n fov?: number;\n}\n\n/** Layers shown on one side of a vertical line only (`GeoMap.setSwipe`) */\nexport interface SwipeOptions {\n /** CSS pixels from the left of the map */\n position: number;\n layers: readonly Layer[];\n /** The side they show on (default 'left') */\n side?: 'left' | 'right';\n /** Layers shown on the other side only: two meshes of the same place, each on its side, never drawn over each other */\n other?: readonly Layer[];\n}\n\n/** Animation of a camera move */\nexport interface AnimationOptions {\n /** Milliseconds */\n duration?: number;\n /** Progress over time, both 0 to 1 */\n easing?: (t: number) => number;\n}\n\nexport interface FlyToOptions extends AnimationOptions {\n /** How far the flight zooms out on its way, as MapLibre's `curve` (default 1.42) */\n curve?: number;\n /** Average speed in screens per second when `duration` is not given (default 1.2) */\n speed?: number;\n}\n\n/**\n * Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':\n * longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the\n * north (NASA's Trek WMTS, WorldCRS84Quad). A `TileGrid`: the tile matrices of a WMTS in any CRS (Lambert-93…), or a\n * WMS asked for each tile's box in its CRS. The last two are reprojected into Web Mercator tiles by the map's workers\n * (in the page with `workers: false`).\n */\nexport type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;\n\n/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\nexport interface RasterOptions {\n /** Tile URL with {z}, {x} and {y} (256 px tiles); unused with a `loader` */\n url: string;\n /** Tile grid of `url` (default 'mercator'); with 'equirectangular', `minZoom` and `maxZoom` are levels of that\n * grid; with a `TileGrid`, they are map zooms, by default those its matrices span */\n grid?: RasterGrid;\n minZoom?: number;\n maxZoom?: number;\n opacity?: number;\n /** 0 = greyscale, 1 = original colors */\n saturation?: number;\n /** Side of the tiles' textures, pixels (default 256): more for sharper tiles drawn by a `loader` */\n size?: number;\n /** Draws each tile instead of fetching `url`: an image of `size` × `size`, null for nothing there; a rejection is\n * retried like a network error */\n loader?: (z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>;\n /** Credits of the tiles, HTML: shown by the attribution control while the layer is on the map */\n attribution?: string;\n}\n\nexport interface NetworkStyle {\n /** Line width, CSS pixels, or zoom stops `[[zoom, width], …]` (default 2) */\n width: Size;\n /** Values above are drawn as unreached (default 1800) */\n max: number;\n /** Darker line every `contour` value units, 0 for none (default 0) */\n contour: number;\n opacity: number;\n /** Width of the halo drawn under the lines, CSS pixels or zoom stops, 0 for none (default 0): wide and faint, the\n * reached streets add up into a heat map that fills the blocks */\n halo: Size;\n /** Opacity of the halo at the middle of a line, fading quadratically to its sides (default 0.11) */\n haloOpacity: number;\n /** Colors from 0 to `max`: `[[fraction of max, color], …]` (default green to red) */\n ramp: Ramp | undefined;\n /** Color of the parts beyond `max` or unreached (default `rgba(140, 140, 140, 0.25)`) */\n unreachedColor: string;\n /** Share of `max` over which the colors fade out before it, 0 to 1 (default 0) */\n fade: number;\n}\n\nexport interface NetworkOptions extends Partial<NetworkStyle> {\n /** Node coordinates in degrees: lon0, lat0, lon1, lat1… */\n nodes: Float64Array;\n /** Edges as node index pairs: a0, b0, a1, b1… */\n edges: Uint32Array;\n /** Line of each edge, from A to B: the points of edge e are `points[start[e] .. start[e + 1]]` (lon, lat pairs,\n * counted in points); with fewer than two points an edge is straight. Default: all straight. */\n lines?: { start: Uint32Array; points: Float64Array };\n /** Per edge, the cost of travelling it from A to B then from B to A, in value units (Infinity: closed that way;\n * closed both ways: not drawn). A point along an edge then takes the quickest way there, min(value(A) + cost from\n * A, value(B) + cost from B), as a travel time does. Without costs, values are interpolated along the edges. */\n costs?: Float32Array;\n /** Width factor of each edge (default 1): rail lines wider than streets */\n edgeWidths?: Float32Array;\n}\n\nexport interface Tiles3dStyle {\n /** Screen-space error (CSS pixels) above which a tile is refined: 16 by default, lower is finer and heavier */\n maxScreenSpaceError: number;\n opacity: number;\n /** Size of the points of point cloud tiles (`.pnts`, glTF points), CSS pixels: 2 by default */\n pointSize?: number;\n /** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without\n * textures are light grey without it); none by default */\n color?: string;\n}\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle> {\n /** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */\n url: string;\n /** Its heights are altitudes above the geoid (NGF-IGN69), as the IGN's Bâtiments 3D, rather than above the\n * ellipsoid (3D Tiles as specified): each tile raised by the RAF20 geoid, onto the IGN relief (default false) */\n geoid?: boolean;\n}\n\nexport interface MapPointerEvent {\n point: Point;\n /** Undefined above the horizon */\n lonLat: LonLat | undefined;\n}\n\n/** What 'hoverfeature' found under the pointer */\nexport interface MapHoverFeatureEvent extends MapPointerEvent {\n /** The feature under the pointer (see `GeoMap.pickFeature`), undefined if none */\n hit: FeatureHit | undefined;\n}\n\n/** A picked feature: its layer handle, its index there and, for line, circle, fill, extrusion, point cloud and 3D\n * Tiles layers, the feature itself (a building of 3D Tiles with its properties) */\nexport interface FeatureHit {\n layer: Layer;\n index: number;\n feature: Feature | undefined;\n}\n\nexport interface MapEvents {\n /** The camera started moving (a gesture, an animation or `setCamera`) */\n movestart: Camera;\n /** The camera moved */\n move: Camera;\n /** The camera stopped: no gesture held, no animation running */\n moveend: Camera;\n /** The map changed size (CSS pixels) */\n resize: { width: number; height: number };\n /** The pointer moved over the map (at most once per frame, not while dragging) */\n hover: MapPointerEvent;\n /** What is under the pointer, picked without stalling the GPU: a frame or two after 'hover', only while listened to\n * (radius and layers in `GeoMap.hoverPicking`) */\n hoverfeature: MapHoverFeatureEvent;\n /** Click without drag */\n click: MapPointerEvent;\n /** A frame was drawn; duration of the engine call in milliseconds */\n render: { ms: number };\n /** Everything in view is loaded and drawn, nothing moves: the end of a load, once after each change (as MapLibre's\n * `idle`). Tiles requested by the first frame count, so it never fires before they arrive. */\n idle: Record<string, never>;\n /** The pointer left the canvas (a mouse going out of the map, or onto a control or marker) */\n leave: Record<string, never>;\n}\n\n/** What a layer handle needs from its map */\nexport interface LayerHost {\n readonly engine: Engine;\n requestRender(): void;\n /** Forgets a removed layer */\n detach(layer: Layer): void;\n /** Moves a layer under `before`, or on top */\n moveLayer(layer: Layer, before: Layer | undefined): void;\n /** A layer created again in the engine (new id): put at the place of its old id, which is removed */\n replaceLayer(layer: Layer, old: number): void;\n /** Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,0CAA0C","sourcesContent":["/** Public types of the `isard` package */\n\nimport type { TileGrid } from './basemap/grid.ts';\nimport type { DecoderUrls } from './engine/decoders.ts';\nimport type { Feature, Ramp, Size } from './layers/features.ts';\nimport type { Layer } from './layers/layers.ts';\nimport type { AttributionOptions } from './ui/controls.ts';\nimport type { Camera, Engine } from './wasm/isard.js';\n\nexport type LonLat = [lon: number, lat: number];\nexport type Point = [x: number, y: number];\n\n/**\n * The named basemaps. OpenFreeMap's vector styles, OpenStreetMap data worldwide, their labels above the other layers:\n * `osm-positron` (light grey, quiet: data over it reads first), `osm-liberty` and `osm-bright` (in colour), `osm-dark`\n * (near black: bright data over it, a wind's particles, lights). The\n * Géoplateforme's (IGN, France): rasters (`ign-plan`, `ign-plan-grey`, `ign-ortho`, the aerial photographs) or vector\n * tiles with their labels (`ign-plan-vector`, `ign-plan-grey-vector`, the PLAN.IGN styles).\n */\nexport type BasemapName =\n | 'osm-positron'\n | 'osm-liberty'\n | 'osm-bright'\n | 'osm-dark'\n | 'ign-plan'\n | 'ign-plan-grey'\n | 'ign-ortho'\n | 'ign-plan-vector'\n | 'ign-plan-grey-vector'\n | 'none';\n\n/** A basemap by name (see `BasemapName`) */\nexport type Basemap = BasemapName;\n\n/**\n * The Earth's named terrain models. `'terrain-tiles'`: worldwide, the Terrain Tiles of AWS's open data registry\n * (SRTM, EU-DEM, GMTED… merged by Mapzen, 30 m in most places), the sea floor flattened at sea level. `'ign'`: France,\n * the IGN's RGE ALTI from the Géoplateforme (1 to 5 m), raised by the RAF20 geoid to heights above the ellipsoid.\n */\nexport type TerrainModel = 'terrain-tiles' | 'ign';\n\n/** How tiles encode their altitudes: `'float32'`, raw little-endian floats (`image/x-bil;bits=32`, an ArcGIS raw\n * grid); `'terrarium'`, the colors of a PNG, `R × 256 + G + B / 256 - 32768`; `'mapbox'`, those of Terrain-RGB,\n * `(R × 65536 + G × 256 + B) / 10 - 10000` */\nexport type TerrainEncoding = 'float32' | 'terrarium' | 'mapbox';\n\n/**\n * How tiles load and show. 'immediate' (default): everything visible loads, tiles show as soon as they arrive.\n * 'smooth': during flights the levels flown through are skipped, off-center tiles wait while the camera moves, tiles\n * fade in; fewer downloads, for slow networks or GPUs.\n */\nexport type LoadingMode = 'immediate' | 'smooth';\n\n/** 'globe': a sphere at low zoom, blending into Web Mercator between zooms 5 and 7, up to three levels later under a\n * tilted camera (it sees much farther than its center: the horizon stays curved) */\nexport type Projection = 'globe' | 'mercator';\n\n/** A body to draw the map on, other than the named ones (`CelestialBody`) */\nexport interface BodyOptions {\n /** Equatorial radius, metres */\n radius: number;\n /** Flattening of its ellipsoid, 0 for a sphere (default 0) */\n flattening?: number;\n /** An atmosphere: its halo around the globe, true for the Earth's light blue, or a CSS color (its alpha the\n * halo's strength) (default false) */\n atmosphere?: boolean | string;\n /** Color of the globe where no tile covers it (past the Web Mercator latitudes, 85°), a CSS color (default\n * `#808080`) */\n color?: string;\n /** Lowest and highest altitudes of its ground, metres around the ellipsoid: what its relief may raise into view\n * (default ±1 % of the radius) */\n relief?: [lowest: number, highest: number];\n}\n\n/**\n * The body the map is drawn on: 'earth' (WGS 84, the default), 'moon' (a sphere of 1 737 400 m, no atmosphere),\n * 'mars' (a sphere of 3 396 190 m, its equatorial radius, a thin dusty halo; planetocentric latitudes) or another\n * one. Zoom levels keep their meaning on screen (the Web Mercator tile pyramid), their metres follow the body:\n * altitudes, relief, buildings, 3D Tiles. Off the Earth, the map has none of the Earth's defaults: no basemap, no\n * credits, and space for its background; the Moon and Mars have NASA's relief for `terrain: true`.\n */\nexport type CelestialBody = 'earth' | 'moon' | 'mars' | BodyOptions;\n\nexport interface GeoMapOptions extends Partial<Camera> {\n /** The body the map is drawn on (default 'earth'); set at creation */\n body?: CelestialBody;\n /** Default 'globe' */\n projection?: Projection;\n /** Default 'immediate' */\n loading?: LoadingMode;\n /** The basemap (default 'osm-positron'; 'none' off the Earth) */\n basemap?: Basemap;\n /** Opacity of the IGN hillshade over the basemap (France, Géoplateforme), 0 for none (default 0) */\n hillshade?: number;\n /** Color behind the map (sky of tilted flat views), a CSS color (default `#f2f2f0`; black off the Earth) */\n background?: string;\n /** Space behind the globe: stars and atmosphere halo, fading out as the globe turns flat (default true) */\n sky?: boolean;\n /** The sun casting the shadows of buildings, trees, models and the relief (`setSun`); none by default */\n sun?: SunOptions;\n /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles; NASA's on\n * the Moon and Mars: LOLA, MOLA), one of the Earth's models by name (`'ign'`: France, RGE ALTI), or its options\n * (default false; on another body, its `url` is required). Network layers are draped on it */\n terrain?: boolean | TerrainModel | TerrainOptions;\n minZoom?: number;\n maxZoom?: number;\n /** Highest pitch, degrees, up to 85 (default 70) */\n maxPitch?: number;\n /** Sky over the plane, seen when the camera is tilted towards the horizon, and the fog the ground fades into\n * (MapLibre's `setSky`); default none: the background color */\n atmosphere?: AtmosphereOptions;\n /** Mouse, touch and keyboard controls (default true) */\n interactive?: boolean;\n /** Keyboard controls once the map has the focus (it is reached with Tab): arrows pan, Shift + arrows rotate and\n * tilt, + and - zoom (Shift: two levels), 0 faces north and levels the view (default true; none when not\n * `interactive`) */\n keyboard?: boolean;\n /** Accessible name of the map, read by screen readers (default 'Map') */\n ariaLabel?: string;\n /** A preset of map options (`IGN_PRESETS`: `'ign'`, `'ign-3d'`, `'ign-ortho-3d'`), the other options over it */\n preset?: 'ign' | 'ign-3d' | 'ign-ortho-3d';\n /** The folder isard's files are served from (its engines, `isard_bg.wasm`, `isard_core_bg.wasm`,\n * `isard_points_bg.wasm`, `isard_tess_bg.wasm`, `isard_grid_bg.wasm`, and its workers, `decoder.worker.js`, `basemap.worker.js`): one option for a bundler that\n * moves them, the `…Url` options below for each one. `isard/vite` sets it for the whole page; default next to the\n * module */\n assetsUrl?: string | URL;\n /** Where to load the engine with 3D Tiles from (`isard_bg.wasm`), when a bundler does not resolve the default URL.\n * Given without `coreWasmUrl`, maps load this engine from the start */\n wasmUrl?: string | URL;\n /** Where to load the engine without 3D Tiles from (`isard_core_bg.wasm`, a third smaller), when a bundler does not\n * resolve the default URL. Maps load it first, and the engine with 3D Tiles (`wasmUrl`) for their first 3D Tiles\n * layer only */\n coreWasmUrl?: string | URL;\n /** Where the decoding workers load the point cloud module from (`isard_points_bg.wasm`, the LAZ decoder of COPC),\n * when a bundler does not resolve the default URL. Loaded with the first point cloud only */\n pointsWasmUrl?: string | URL;\n /** Where the basemap workers load the tessellation module from (`isard_tess_bg.wasm`: the vector tiles drawn as\n * geometry, `vectorTiles().vectors()`, made ready for the GPU off the main thread), when a bundler does not resolve\n * the default URL. Loaded with the first tile of geometry; without it, the main thread does that work */\n tessWasmUrl?: string | URL;\n /** Where the workers load the grid module from (`isard_grid_bg.wasm`: GRIB2 and NetCDF files read by\n * `map.readGrids`), when a bundler does not resolve the default URL. Loaded with the first file */\n gridWasmUrl?: string | URL;\n /** Load the engine with 3D Tiles from the start (default false: it is loaded when the first 3D Tiles layer or glTF\n * model is added, the map then moving its camera and layers onto it, a stall of about a frame or two). For a map that shows 3D Tiles\n * at once: one engine downloaded instead of two. `'preload'`: the map starts on the engine without 3D Tiles and\n * downloads and compiles the other once idle, without running it: its first 3D Tiles layer does not wait for the\n * download (for a map that will show 3D Tiles later, on demand) */\n tiles3d?: boolean | 'preload';\n /** Where to load the vector basemap worker from, when a bundler does not resolve the default URL */\n basemapWorkerUrl?: string | URL;\n /** Texture size of the vector basemap's tiles, pixels (default 512: lines and edges sharp at every zoom on a screen\n * of pixel ratio 1). 256: a quarter of the drawing in the workers, of the uploads and of the GPU memory, for lines\n * and edges a little softer between two zoom levels (the tiles are shown 181 to 362 CSS pixels wide) */\n basemapTileSize?: number;\n /** Glyphs of the symbol layers: a URL with `{fontstack}` and `{range}` (MapLibre's glyph format; default\n * OpenFreeMap's fonts, Noto Sans). A vector basemap's labels take the glyphs of its style */\n glyphs?: string;\n /** Workers decoding 3D Tiles off the main thread: a count, or false to decode on the main thread (default: cores - 1,\n * 1 to 4). False (or 0) also decodes the PNG relief and reprojects the equirectangular rasters on the main thread,\n * else done by the vector basemap's workers */\n workers?: number | false;\n /** Where to load the decoding worker from, when a bundler does not resolve the default URL */\n workerUrl?: string | URL;\n /** Folders of the Draco and Basis Universal decoders, loaded by the workers on first use (default: the official\n * builds on gstatic.com and jsDelivr; self-host them for offline or locked-down networks). They run through\n * `new Function`: a Content Security Policy needs `'unsafe-eval'` (see `DecoderUrls`) */\n decoders?: Partial<DecoderUrls>;\n /** Credits at the bottom right: false for none, or its options (default true: the credits of the basemap,\n * hillshade and relief in use, compact on maps narrower than 640 px) */\n attributionControl?: boolean | AttributionOptions;\n}\n\nexport interface TerrainOptions {\n /** One of the Earth's named models (default `'terrain-tiles'` on the Earth); unused with a `url` */\n model?: TerrainModel;\n /** Altitudes of 256 × 256 tiles in `encoding`: a WMS GetMap URL with {bbox} (EPSG:3857 on the Earth, the body's\n * Mercator metres elsewhere: the sphere of its radius), a tile URL with {z}, {x} and {y}, or an ArcGIS image service\n * (a URL ending in `/ImageServer`), asked for raw altitudes in the body's Mercator (default: the `model`'s; on the\n * Moon and Mars, NASA's Trek LOLA and MOLA models) */\n url?: string;\n /** How the tiles of `url` encode their altitudes (default `'float32'`); `'terrarium'` and `'mapbox'` take a URL with\n * {z}, {x} and {y} */\n encoding?: TerrainEncoding;\n /** Vertical exaggeration, 1 for the true relief (default 1) */\n exaggeration?: number;\n /** Finest level of the relief, up to 15 (default 15; 14 for the Terrain Tiles, 8 for the Moon's and Mars's models). It\n * starts at level 6 on the Earth, coarser on bodies of a larger relief for their size (3 on the Moon and Mars) */\n maxZoom?: number;\n /** Altitudes over mainland France raised by the height of the RAF20 geoid (the French one, 0 away from France), to\n * heights above the ellipsoid (those of 3D Tiles); false keeps the altitudes as served (NGF-IGN69 for the IGN's)\n * (default true for the `'ign'` model, false otherwise) */\n geoid?: boolean;\n}\n\n/** Sky, horizon and fog over the plane, with the names and meanings of MapLibre's `setSky` */\nexport interface AtmosphereOptions {\n /** A CSS color (default `#9cc7ec`) */\n skyColor?: string;\n /** (default `#e8f1f8`) */\n horizonColor?: string;\n /** (default `#f2f5f8`) */\n fogColor?: string;\n /** Blend from the horizon to the sky color, share of the field of view above the horizon, 0-1 (default 0.6) */\n skyHorizonBlend?: number;\n /** Blend from the horizon to the fog color below the horizon, 0-1 (default 0.7) */\n horizonFogBlend?: number;\n /** Share of the distance to the far plane over which the ground fades into the fog, 0-1 (default 0.4) */\n fogGroundBlend?: number;\n}\n\n/** The sun casting shadows (`GeoMap.setSun`): where it stands, by date or by hand, and how dark its shadows are */\nexport interface SunOptions {\n /** The time: the sun where it stands then over the map's center (default now, unless `azimuth` and `altitude`) */\n date?: Date;\n /** Degrees clockwise from north, with `altitude`: the sun placed by hand */\n azimuth?: number;\n /** Degrees above the horizon; at or under it, no shadows */\n altitude?: number;\n /** How dark the shadows are, 0 to 1 (default 0.35) */\n opacity?: number;\n /** How dark the night is, 0 to 1: the scene tinted in its blue, the windows of the buildings and the streets of\n * `vectors()` lit, the labels light on dark. By default from the sun's altitude: falling from 6° above the horizon\n * to 6° under it */\n night?: number;\n}\n\n/** What can be seen from a point (`GeoMap.setViewshed`); with several observers, the colors, the opacity and the\n * cone's color are the first one's */\nexport interface ViewshedOptions {\n /** The observer */\n position: LonLat;\n /** Metres above the ground (default 1.7, eye level) */\n height?: number;\n /** Metres around the observer that are tinted (default 1000) */\n range?: number;\n /** A CSS color for what is seen (default `#2f9e44`) */\n visibleColor?: string;\n /** A CSS color for what is hidden (default `#e03131`) */\n hiddenColor?: string;\n /** How strongly the colors tint the scene, multiplied into it so that its textures and shading stay, 0-1 (default\n * 0.7) */\n opacity?: number;\n /** A CSS color for the cone drawn in 3D (one way only): its fan through the axis, at the eye's height and tilted\n * with it, from the eye to the range; solid where nothing hides it, faint behind the scene; none by default */\n coneColor?: string;\n /** To look one way only (a camera, a lookout), degrees clockwise from north; all around without it */\n direction?: number;\n /** Degrees above the horizon the cone looks, negative below (default 0) */\n tilt?: number;\n /** Angle of view across, degrees (default 60) */\n fov?: number;\n /** Angle of view up and down, degrees (default 40) */\n verticalFov?: number;\n}\n\n/** An eye at street level (`GeoMap.setFirstPerson`) */\nexport interface FirstPersonView {\n /** Where it stands */\n lonLat: LonLat;\n /** Metres above the ground (default 1.7) */\n height?: number;\n /** Degrees clockwise from north it looks to */\n bearing: number;\n /** Degrees from straight down: 90 level (the default), 180 straight up */\n pitch?: number;\n /** Vertical field of view, degrees (default 75) */\n fov?: number;\n}\n\n/** Layers shown on one side of a vertical line only (`GeoMap.setSwipe`) */\nexport interface SwipeOptions {\n /** CSS pixels from the left of the map */\n position: number;\n layers: readonly Layer[];\n /** The side they show on (default 'left') */\n side?: 'left' | 'right';\n /** Layers shown on the other side only: two meshes of the same place, each on its side, never drawn over each other */\n other?: readonly Layer[];\n}\n\n/** Animation of a camera move */\nexport interface AnimationOptions {\n /** Milliseconds */\n duration?: number;\n /** Progress over time, both 0 to 1 */\n easing?: (t: number) => number;\n}\n\nexport interface FlyToOptions extends AnimationOptions {\n /** How far the flight zooms out on its way, as MapLibre's `curve` (default 1.42) */\n curve?: number;\n /** Average speed in screens per second when `duration` is not given (default 1.2) */\n speed?: number;\n}\n\n/**\n * Tile grid of a raster's URL. 'mercator': Web Mercator (XYZ, WMTS PM), the engine's own. 'equirectangular':\n * longitudes and latitudes (Plate Carrée, EPSG:4326-like), two 256 px tiles side by side at level 0, rows from the\n * north (NASA's Trek WMTS, WorldCRS84Quad). A `TileGrid`: the tile matrices of a WMTS in any CRS (Lambert-93…), or a\n * WMS asked for each tile's box in its CRS. The last two are reprojected into Web Mercator tiles by the map's workers\n * (in the page with `workers: false`).\n */\nexport type RasterGrid = 'mercator' | 'equirectangular' | TileGrid;\n\n/** What `RasterLayer.setStyle` changes */\nexport interface RasterStyle {\n opacity: number;\n /** 0 = greyscale, 1 = original colors */\n saturation: number;\n}\n\nexport interface RasterOptions {\n /** Tile URL with {z}, {x} and {y} (256 px tiles); unused with a `loader` */\n url: string;\n /** Tile grid of `url` (default 'mercator'); with 'equirectangular', `minZoom` and `maxZoom` are levels of that\n * grid; with a `TileGrid`, they are map zooms, by default those its matrices span */\n grid?: RasterGrid;\n minZoom?: number;\n maxZoom?: number;\n opacity?: number;\n /** 0 = greyscale, 1 = original colors */\n saturation?: number;\n /** Side of the tiles' textures, pixels (default 256): more for sharper tiles drawn by a `loader` */\n size?: number;\n /** Draws each tile instead of fetching `url`: an image of `size` × `size`, null for nothing there; a rejection is\n * retried like a network error */\n loader?: (z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>;\n /** Credits of the tiles, HTML: shown by the attribution control while the layer is on the map */\n attribution?: string;\n}\n\nexport interface NetworkStyle {\n /** Line width, CSS pixels, or zoom stops `[[zoom, width], …]` (default 2) */\n width: Size;\n /** Values above are drawn as unreached (default 1800) */\n max: number;\n /** Darker line every `contour` value units, 0 for none (default 0) */\n contour: number;\n opacity: number;\n /** Width of the halo drawn under the lines, CSS pixels or zoom stops, 0 for none (default 0): wide and faint, the\n * reached streets add up into a heat map that fills the blocks */\n halo: Size;\n /** Opacity of the halo at the middle of a line, fading quadratically to its sides (default 0.11) */\n haloOpacity: number;\n /** Colors from 0 to `max`: `[[fraction of max, color], …]` (default green to red) */\n ramp: Ramp | undefined;\n /** Color of the parts beyond `max` or unreached (default `rgba(140, 140, 140, 0.25)`) */\n unreachedColor: string;\n /** Share of `max` over which the colors fade out before it, 0 to 1 (default 0) */\n fade: number;\n}\n\nexport interface NetworkOptions extends Partial<NetworkStyle> {\n /** Node coordinates in degrees: lon0, lat0, lon1, lat1… */\n nodes: Float64Array;\n /** Edges as node index pairs: a0, b0, a1, b1… */\n edges: Uint32Array;\n /** Line of each edge, from A to B: the points of edge e are `points[start[e] .. start[e + 1]]` (lon, lat pairs,\n * counted in points); with fewer than two points an edge is straight. Default: all straight. */\n lines?: { start: Uint32Array; points: Float64Array };\n /** Per edge, the cost of travelling it from A to B then from B to A, in value units (Infinity: closed that way;\n * closed both ways: not drawn). A point along an edge then takes the quickest way there, min(value(A) + cost from\n * A, value(B) + cost from B), as a travel time does. Without costs, values are interpolated along the edges. */\n costs?: Float32Array;\n /** Width factor of each edge (default 1): rail lines wider than streets */\n edgeWidths?: Float32Array;\n}\n\nexport interface Tiles3dStyle {\n /** Screen-space error (CSS pixels) above which a tile is refined: 16 by default, lower is finer and heavier */\n maxScreenSpaceError: number;\n opacity: number;\n /** Size of the points of point cloud tiles (`.pnts`, glTF points), CSS pixels: 2 by default */\n pointSize?: number;\n /** A CSS color multiplying the textures of the meshes, the color of the untextured ones (buildings without\n * textures are light grey without it); none by default */\n color?: string;\n}\n\nexport interface Tiles3dOptions extends Partial<Tiles3dStyle> {\n /** URL of a `tileset.json` (3D Tiles 1.0 b3dm and pnts, 1.1 glb meshes and points, external tilesets) */\n url: string;\n /** Its heights are altitudes above the geoid (NGF-IGN69), as the IGN's Bâtiments 3D, rather than above the\n * ellipsoid (3D Tiles as specified): each tile raised by the RAF20 geoid, onto the IGN relief (default false) */\n geoid?: boolean;\n}\n\nexport interface MapPointerEvent {\n point: Point;\n /** Undefined above the horizon */\n lonLat: LonLat | undefined;\n}\n\n/** What 'hoverfeature' found under the pointer */\nexport interface MapHoverFeatureEvent extends MapPointerEvent {\n /** The feature under the pointer (see `GeoMap.pickFeature`), undefined if none */\n hit: FeatureHit | undefined;\n}\n\n/** A picked feature: its layer handle, its index there and, for line, circle, fill, extrusion, point cloud and 3D\n * Tiles layers, the feature itself (a building of 3D Tiles with its properties) */\nexport interface FeatureHit {\n layer: Layer;\n index: number;\n feature: Feature | undefined;\n}\n\nexport interface MapEvents {\n /** The camera started moving (a gesture, an animation or `setCamera`) */\n movestart: Camera;\n /** The camera moved */\n move: Camera;\n /** The camera stopped: no gesture held, no animation running */\n moveend: Camera;\n /** The map changed size (CSS pixels) */\n resize: { width: number; height: number };\n /** The pointer moved over the map (at most once per frame, not while dragging) */\n hover: MapPointerEvent;\n /** What is under the pointer, picked without stalling the GPU: a frame or two after 'hover', only while listened to\n * (radius and layers in `GeoMap.hoverPicking`) */\n hoverfeature: MapHoverFeatureEvent;\n /** Click without drag */\n click: MapPointerEvent;\n /** A frame was drawn; duration of the engine call in milliseconds */\n render: { ms: number };\n /** Everything in view is loaded and drawn, nothing moves: the end of a load, once after each change (as MapLibre's\n * `idle`). Tiles requested by the first frame count, so it never fires before they arrive. */\n idle: Record<string, never>;\n /** The pointer left the canvas (a mouse going out of the map, or onto a control or marker) */\n leave: Record<string, never>;\n}\n\n/** What a layer handle needs from its map */\nexport interface LayerHost {\n readonly engine: Engine;\n requestRender(): void;\n /** Forgets a removed layer */\n detach(layer: Layer): void;\n /** Moves a layer under `before`, or on top */\n moveLayer(layer: Layer, before: Layer | undefined): void;\n /** A layer created again in the engine (new id): put at the place of its old id, which is removed */\n replaceLayer(layer: Layer, old: number): void;\n /** Resolves once the map is idle (everything in view loaded and drawn) */\n whenIdle(): Promise<void>;\n /** Work the map waits on before it is idle (`GeoMap.track`) */\n track<T>(work: Promise<T>): Promise<T>;\n}\n"]}
@@ -2,6 +2,12 @@
2
2
  * Web Mercator in [0, 1] across the world (y towards the south), for the page and the workers alike: the positions
3
3
  * sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.
4
4
  */
5
+ /** Radians in a degree */
6
+ export declare const RAD: number;
7
+ /** The Earth's circumference at the equator, metres (Web Mercator's sphere: WGS 84's major axis) */
8
+ export declare const EARTH_METRES = 40075016.686;
9
+ /** Metres in a degree of latitude (and of longitude at the equator), on that sphere */
10
+ export declare const METRES_PER_DEGREE: number;
5
11
  /** Mercator x of a longitude (degrees) */
6
12
  export declare const mercatorX: (lon: number) => number;
7
13
  /** Mercator y of a latitude (degrees), clamped to the edges of the map */
@@ -14,3 +20,5 @@ export declare const latitude: (y: number) => number;
14
20
  export declare const toMercator: ([lon, lat]: readonly [number, number, ...unknown[]]) => [x: number, y: number];
15
21
  /** Longitude and latitude of a Mercator x, y */
16
22
  export declare const fromMercator: ([x, y]: readonly [number, number]) => [lon: number, lat: number];
23
+ /** Metres across a tile of level `z` and row `y` at its middle */
24
+ export declare const tileMetres: (z: number, y: number) => number;
package/dist/util/geo.js CHANGED
@@ -2,6 +2,12 @@
2
2
  * Web Mercator in [0, 1] across the world (y towards the south), for the page and the workers alike: the positions
3
3
  * sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.
4
4
  */
5
+ /** Radians in a degree */
6
+ export const RAD = Math.PI / 180;
7
+ /** The Earth's circumference at the equator, metres (Web Mercator's sphere: WGS 84's major axis) */
8
+ export const EARTH_METRES = 40_075_016.686;
9
+ /** Metres in a degree of latitude (and of longitude at the equator), on that sphere */
10
+ export const METRES_PER_DEGREE = EARTH_METRES / 360;
5
11
  /** The latitude where Web Mercator is square: the edges of the map */
6
12
  const MAX_LAT = 85.051128779806589;
7
13
  /** Mercator x of a longitude (degrees) */
@@ -29,4 +35,6 @@ export const toMercator = ([lon, lat]) => {
29
35
  export const fromMercator = ([x, y]) => {
30
36
  return [longitude(x), latitude(y)];
31
37
  };
38
+ /** Metres across a tile of level `z` and row `y` at its middle */
39
+ export const tileMetres = (z, y) => (EARTH_METRES * Math.cos((latitude((y + 0.5) / 2 ** z) * Math.PI) / 180)) / 2 ** z;
32
40
  //# sourceMappingURL=geo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"geo.js","sourceRoot":"","sources":["../../src/util/geo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3B,CAAC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IAEzE,OAAO,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAS,EAAU,EAAE;IAC7C,OAAO,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AACvB,CAAC,CAAC;AAEF,yCAAyC;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE;IAC5C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AACvE,CAAC,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAA0C,EAA0B,EAAE;IACxG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAA4B,EAA8B,EAAE;IAC5F,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["/**\n * Web Mercator in [0, 1] across the world (y towards the south), for the page and the workers alike: the positions\n * sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.\n */\n\n/** The latitude where Web Mercator is square: the edges of the map */\nconst MAX_LAT = 85.051128779806589;\n\n/** Mercator x of a longitude (degrees) */\nexport const mercatorX = (lon: number): number => {\n return (lon + 180) / 360;\n};\n\n/** Mercator y of a latitude (degrees), clamped to the edges of the map */\nexport const mercatorY = (lat: number): number => {\n const phi = (Math.max(-MAX_LAT, Math.min(MAX_LAT, lat)) * Math.PI) / 180;\n\n return 0.5 - Math.log(Math.tan(Math.PI / 4 + phi / 2)) / (2 * Math.PI);\n};\n\n/** Longitude (degrees) of a Mercator x */\nexport const longitude = (x: number): number => {\n return x * 360 - 180;\n};\n\n/** Latitude (degrees) of a Mercator y */\nexport const latitude = (y: number): number => {\n return (Math.atan(Math.sinh(Math.PI * (1 - 2 * y))) * 180) / Math.PI;\n};\n\n/** Mercator x, y of a longitude and latitude */\nexport const toMercator = ([lon, lat]: readonly [number, number, ...unknown[]]): [x: number, y: number] => {\n return [mercatorX(lon), mercatorY(lat)];\n};\n\n/** Longitude and latitude of a Mercator x, y */\nexport const fromMercator = ([x, y]: readonly [number, number]): [lon: number, lat: number] => {\n return [longitude(x), latitude(y)];\n};\n"]}
1
+ {"version":3,"file":"geo.js","sourceRoot":"","sources":["../../src/util/geo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0BAA0B;AAC1B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAEjC,oGAAoG;AACpG,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAE3C,uFAAuF;AACvF,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,GAAG,GAAG,CAAC;AAEpD,sEAAsE;AACtE,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3B,CAAC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IAEzE,OAAO,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAA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: the positions\n * sent to the engine, the tiles of a view, the flights, the label candidates of the vector tiles.\n */\n\n/** Radians in a degree */\nexport const RAD = Math.PI / 180;\n\n/** The Earth's circumference at the equator, metres (Web Mercator's sphere: WGS 84's major axis) */\nexport const EARTH_METRES = 40_075_016.686;\n\n/** Metres in a degree of latitude (and of longitude at the equator), on that sphere */\nexport const METRES_PER_DEGREE = EARTH_METRES / 360;\n\n/** The latitude where Web Mercator is square: the edges of the map */\nconst MAX_LAT = 85.051128779806589;\n\n/** Mercator x of a longitude (degrees) */\nexport const mercatorX = (lon: number): number => {\n return (lon + 180) / 360;\n};\n\n/** Mercator y of a latitude (degrees), clamped to the edges of the map */\nexport const mercatorY = (lat: number): number => {\n const phi = (Math.max(-MAX_LAT, Math.min(MAX_LAT, lat)) * Math.PI) / 180;\n\n return 0.5 - Math.log(Math.tan(Math.PI / 4 + phi / 2)) / (2 * Math.PI);\n};\n\n/** Longitude (degrees) of a Mercator x */\nexport const longitude = (x: number): number => {\n return x * 360 - 180;\n};\n\n/** Latitude (degrees) of a Mercator y */\nexport const latitude = (y: number): number => {\n return (Math.atan(Math.sinh(Math.PI * (1 - 2 * y))) * 180) / Math.PI;\n};\n\n/** Mercator x, y of a longitude and latitude */\nexport const toMercator = ([lon, lat]: readonly [number, number, ...unknown[]]): [x: number, y: number] => {\n return [mercatorX(lon), mercatorY(lat)];\n};\n\n/** Longitude and latitude of a Mercator x, y */\nexport const fromMercator = ([x, y]: readonly [number, number]): [lon: number, lat: number] => {\n return [longitude(x), latitude(y)];\n};\n\n/** Metres across a tile of level `z` and row `y` at its middle */\nexport const tileMetres = (z: number, y: number): number =>\n (EARTH_METRES * Math.cos((latitude((y + 0.5) / 2 ** z) * Math.PI) / 180)) / 2 ** z;\n"]}
@@ -1,4 +1,5 @@
1
- /** glTF binaries made by the page (the basemap's trees and lamps, the photos): their bounds, their chunks */
1
+ /** glTF binaries made by the page (the basemap's trees and furniture, the photos, COLLADA and IFC models): their
2
+ * bounds, their buffers, their chunks */
2
3
  /** Lowest and highest of interleaved x, y, z (glTF needs them on positions) */
3
4
  export declare const bounds: (xyz: readonly number[]) => {
4
5
  min: number[];
@@ -7,3 +8,19 @@ export declare const bounds: (xyz: readonly number[]) => {
7
8
  /** A glTF binary of its JSON and its buffer, the chunks padded to 4 bytes (the JSON with spaces, the buffer with
8
9
  * zeros) */
9
10
  export declare const glbOf: (gltf: unknown, bin: Uint8Array) => Uint8Array<ArrayBuffer>;
11
+ /** A glTF buffer view (`target`: 34962 vertices, 34963 indices, none for an image) */
12
+ interface BufferView {
13
+ buffer: 0;
14
+ byteOffset: number;
15
+ byteLength: number;
16
+ target?: number;
17
+ }
18
+ /** A glTF buffer made part by part, each 4-byte aligned in a view of its own */
19
+ export declare const bufferBuilder: () => {
20
+ views: BufferView[];
21
+ /** A part appended; its view's index */
22
+ append(bytes: Uint8Array, target?: number): number;
23
+ /** The buffer: the parts at their views' offsets */
24
+ bin(): Uint8Array<ArrayBuffer>;
25
+ };
26
+ export {};
package/dist/util/gltf.js CHANGED
@@ -1,4 +1,5 @@
1
- /** glTF binaries made by the page (the basemap's trees and lamps, the photos): their bounds, their chunks */
1
+ /** glTF binaries made by the page (the basemap's trees and furniture, the photos, COLLADA and IFC models): their
2
+ * bounds, their buffers, their chunks */
2
3
  /** Lowest and highest of interleaved x, y, z (glTF needs them on positions) */
3
4
  export const bounds = (xyz) => {
4
5
  const axes = [0, 1, 2].map((a) => xyz.filter((_, i) => i % 3 === a));
@@ -24,4 +25,28 @@ export const glbOf = (gltf, bin) => {
24
25
  out.set(bin, 28 + jsonLength);
25
26
  return out;
26
27
  };
28
+ /** A glTF buffer made part by part, each 4-byte aligned in a view of its own */
29
+ export const bufferBuilder = () => {
30
+ const parts = [];
31
+ const views = [];
32
+ let offset = 0;
33
+ return {
34
+ views,
35
+ /** A part appended; its view's index */
36
+ append(bytes, target) {
37
+ views.push({ buffer: 0, byteOffset: offset, byteLength: bytes.byteLength, ...(target && { target }) });
38
+ parts.push(bytes);
39
+ offset += Math.ceil(bytes.byteLength / 4) * 4;
40
+ return views.length - 1;
41
+ },
42
+ /** The buffer: the parts at their views' offsets */
43
+ bin() {
44
+ const bin = new Uint8Array(offset);
45
+ parts.forEach((p, i) => {
46
+ bin.set(p, views[i]?.byteOffset ?? 0);
47
+ });
48
+ return bin;
49
+ },
50
+ };
51
+ };
27
52
  //# sourceMappingURL=gltf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gltf.js","sourceRoot":"","sources":["../../src/util/gltf.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAE7G,+EAA+E;AAC/E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAsB,EAAoC,EAAE;IACjF,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAErE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AACxF,CAAC,CAAC;AAEF;YACY;AACZ,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,GAAe,EAA2B,EAAE;IAC/E,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACpD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,GAAG,CAAC,GAAG,UAAU,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAEtC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAC3B,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IACrC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,UAAU,CAAC,CAAC;IACpC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAClB,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACjD,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,UAAU,CAAC,CAAC;IAE9B,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","sourcesContent":["/** glTF binaries made by the page (the basemap's trees and lamps, the photos): their bounds, their chunks */\n\n/** Lowest and highest of interleaved x, y, z (glTF needs them on positions) */\nexport const bounds = (xyz: readonly number[]): { min: number[]; max: number[] } => {\n const axes = [0, 1, 2].map((a) => xyz.filter((_, i) => i % 3 === a));\n\n return { min: axes.map((v) => Math.min(...v)), max: axes.map((v) => Math.max(...v)) };\n};\n\n/** A glTF binary of its JSON and its buffer, the chunks padded to 4 bytes (the JSON with spaces, the buffer with\n * zeros) */\nexport const glbOf = (gltf: unknown, bin: Uint8Array): Uint8Array<ArrayBuffer> => {\n const json = new TextEncoder().encode(JSON.stringify(gltf));\n const jsonLength = Math.ceil(json.length / 4) * 4;\n const binLength = Math.ceil(bin.byteLength / 4) * 4;\n const out = new Uint8Array(12 + 8 + jsonLength + 8 + binLength);\n const view = new DataView(out.buffer);\n\n view.setUint32(0, 0x46546c67, true);\n view.setUint32(4, 2, true);\n view.setUint32(8, out.length, true);\n view.setUint32(12, jsonLength, true);\n view.setUint32(16, 0x4e4f534a, true);\n out.fill(0x20, 20, 20 + jsonLength);\n out.set(json, 20);\n view.setUint32(20 + jsonLength, binLength, true);\n view.setUint32(24 + jsonLength, 0x004e4942, true);\n out.set(bin, 28 + jsonLength);\n\n return out;\n};\n"]}
1
+ {"version":3,"file":"gltf.js","sourceRoot":"","sources":["../../src/util/gltf.ts"],"names":[],"mappings":"AAAA;yCACyC;AAEzC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAsB,EAAoC,EAAE;IACjF,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAErE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,C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CAAC","sourcesContent":["/** glTF binaries made by the page (the basemap's trees and furniture, the photos, COLLADA and IFC models): their\n * bounds, their buffers, their chunks */\n\n/** Lowest and highest of interleaved x, y, z (glTF needs them on positions) */\nexport const bounds = (xyz: readonly number[]): { min: number[]; max: number[] } => {\n const axes = [0, 1, 2].map((a) => xyz.filter((_, i) => i % 3 === a));\n\n return { min: axes.map((v) => Math.min(...v)), max: axes.map((v) => Math.max(...v)) };\n};\n\n/** A glTF binary of its JSON and its buffer, the chunks padded to 4 bytes (the JSON with spaces, the buffer with\n * zeros) */\nexport const glbOf = (gltf: unknown, bin: Uint8Array): Uint8Array<ArrayBuffer> => {\n const json = new TextEncoder().encode(JSON.stringify(gltf));\n const jsonLength = Math.ceil(json.length / 4) * 4;\n const binLength = Math.ceil(bin.byteLength / 4) * 4;\n const out = new Uint8Array(12 + 8 + jsonLength + 8 + binLength);\n const view = new DataView(out.buffer);\n\n view.setUint32(0, 0x46546c67, true);\n view.setUint32(4, 2, true);\n view.setUint32(8, out.length, true);\n view.setUint32(12, jsonLength, true);\n view.setUint32(16, 0x4e4f534a, true);\n out.fill(0x20, 20, 20 + jsonLength);\n out.set(json, 20);\n view.setUint32(20 + jsonLength, binLength, true);\n view.setUint32(24 + jsonLength, 0x004e4942, true);\n out.set(bin, 28 + jsonLength);\n\n return out;\n};\n\n/** A glTF buffer view (`target`: 34962 vertices, 34963 indices, none for an image) */\ninterface BufferView {\n buffer: 0;\n byteOffset: number;\n byteLength: number;\n target?: number;\n}\n\n/** A glTF buffer made part by part, each 4-byte aligned in a view of its own */\nexport const bufferBuilder = () => {\n const parts: Uint8Array[] = [];\n const views: BufferView[] = [];\n let offset = 0;\n\n return {\n views,\n /** A part appended; its view's index */\n append(bytes: Uint8Array, target?: number): number {\n views.push({ buffer: 0, byteOffset: offset, byteLength: bytes.byteLength, ...(target && { target }) });\n parts.push(bytes);\n offset += Math.ceil(bytes.byteLength / 4) * 4;\n\n return views.length - 1;\n },\n /** The buffer: the parts at their views' offsets */\n bin(): Uint8Array<ArrayBuffer> {\n const bin = new Uint8Array(offset);\n\n parts.forEach((p, i) => {\n bin.set(p, views[i]?.byteOffset ?? 0);\n });\n\n return bin;\n },\n };\n};\n"]}
@@ -6,5 +6,13 @@
6
6
  export declare const GENERATED_ROOF = 255;
7
7
  /** The engine's number of a roof shape (`roof:shape`, or `generated`); undefined for a shape it does not know */
8
8
  export declare const roofNumber: (shape: string) => number | undefined;
9
+ /** How the buildings' roofs are made: from their data (`roof:shape`, `roof:height`; flat without), generated where
10
+ * they have none, or all flat */
11
+ export type RoofMode = 'data' | 'generated' | 'flat';
12
+ /** A building's roof shape by the `mode`, from its properties (`roof:shape` or `roof_shape`): one the engine knows,
13
+ * else generated in `generated`; undefined for none (flat) */
14
+ export declare const roofShapeOf: (properties: unknown, mode: RoofMode) => string | undefined;
15
+ /** A building's roof height from its properties (`roof:height` or `roof_height`; not a number: as its slopes make it) */
16
+ export declare const roofHeightOf: (properties: unknown) => number;
9
17
  /** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): a roof's slopes run in metres */
10
18
  export declare const metresAt: (y: number) => number;
@@ -2,6 +2,8 @@
2
2
  * The roofs of the buildings as the engine builds them (`RoofShape::number`): the shapes of OpenStreetMap's
3
3
  * `roof:shape`, those it does not draw as the nearest of them, or generated from a building's outline
4
4
  */
5
+ import { EARTH_METRES } from "./geo.js";
6
+ import { isRecord } from "./guards.js";
5
7
  /** OpenStreetMap's `roof:shape` as the engine's roofs (1 flat, 2 hipped, 3 gabled, 4 pyramidal, 5 mansard) */
6
8
  const ROOF_SHAPES = {
7
9
  flat: 1,
@@ -21,10 +23,22 @@ const ROOF_SHAPES = {
21
23
  };
22
24
  /** A roof generated from its building's outline (`shapes::GENERATED_ROOF`) */
23
25
  export const GENERATED_ROOF = 255;
24
- /** The Earth's circumference (metres) */
25
- const EARTH_METRES = 40_075_016.686;
26
26
  /** The engine's number of a roof shape (`roof:shape`, or `generated`); undefined for a shape it does not know */
27
27
  export const roofNumber = (shape) => shape === 'generated' ? GENERATED_ROOF : ROOF_SHAPES[shape];
28
+ /** The first of a feature's properties `names` it has */
29
+ const property = (p, names) => isRecord(p) ? names.map((n) => p[n]).find((v) => v !== undefined) : undefined;
30
+ /** A building's roof shape by the `mode`, from its properties (`roof:shape` or `roof_shape`): one the engine knows,
31
+ * else generated in `generated`; undefined for none (flat) */
32
+ export const roofShapeOf = (properties, mode) => {
33
+ const shape = property(properties, ['roof:shape', 'roof_shape']);
34
+ if (mode === 'flat')
35
+ return undefined;
36
+ if (typeof shape === 'string' && ROOF_SHAPES[shape] !== undefined)
37
+ return shape;
38
+ return mode === 'generated' ? 'generated' : undefined;
39
+ };
40
+ /** A building's roof height from its properties (`roof:height` or `roof_height`; not a number: as its slopes make it) */
41
+ export const roofHeightOf = (properties) => Number(property(properties, ['roof:height', 'roof_height']) ?? Number.NaN);
28
42
  /** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): a roof's slopes run in metres */
29
43
  export const metresAt = (y) => EARTH_METRES * Math.cos(Math.atan(Math.sinh(Math.PI * (1 - 2 * y))));
30
44
  //# sourceMappingURL=roofs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"roofs.js","sourceRoot":"","sources":["../../src/util/roofs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,8GAA8G;AAC9G,MAAM,WAAW,GAAqC;IACpD,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,CAAC;IACT,aAAa,EAAE,CAAC;IAChB,WAAW,EAAE,CAAC;IACd,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;CACX,CAAC;AAEF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC,yCAAyC;AACzC,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC,iHAAiH;AACjH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAsB,EAAE,CAC9D,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAE9D,0GAA0G;AAC1G,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/**\n * The roofs of the buildings as the engine builds them (`RoofShape::number`): the shapes of OpenStreetMap's\n * `roof:shape`, those it does not draw as the nearest of them, or generated from a building's outline\n */\n\n/** OpenStreetMap's `roof:shape` as the engine's roofs (1 flat, 2 hipped, 3 gabled, 4 pyramidal, 5 mansard) */\nconst ROOF_SHAPES: Readonly<Record<string, number>> = {\n flat: 1,\n skillion: 1,\n hipped: 2,\n 'half-hipped': 2,\n side_hipped: 2,\n dome: 2,\n onion: 2,\n round: 2,\n gabled: 3,\n saltbox: 3,\n pyramidal: 4,\n cone: 4,\n mansard: 5,\n gambrel: 5,\n};\n\n/** A roof generated from its building's outline (`shapes::GENERATED_ROOF`) */\nexport const GENERATED_ROOF = 255;\n\n/** The Earth's circumference (metres) */\nconst EARTH_METRES = 40_075_016.686;\n\n/** The engine's number of a roof shape (`roof:shape`, or `generated`); undefined for a shape it does not know */\nexport const roofNumber = (shape: string): number | undefined =>\n shape === 'generated' ? GENERATED_ROOF : ROOF_SHAPES[shape];\n\n/** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): a roof's slopes run in metres */\nexport const metresAt = (y: number): number => EARTH_METRES * Math.cos(Math.atan(Math.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E;IACrF,MAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC;IAEjE,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,WAAW,CAAC,KAAK,CAAC,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAEhF,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC,CAAC;AAEF,yHAAyH;AACzH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAmB,EAAU,EAAE,CAC1D,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;AAE7E,0GAA0G;AAC1G,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/**\n * The roofs of the buildings as the engine builds them (`RoofShape::number`): the shapes of OpenStreetMap's\n * `roof:shape`, those it does not draw as the nearest of them, or generated from a building's outline\n */\n\nimport { EARTH_METRES } from './geo.ts';\nimport { isRecord } from './guards.ts';\n\n/** OpenStreetMap's `roof:shape` as the engine's roofs (1 flat, 2 hipped, 3 gabled, 4 pyramidal, 5 mansard) */\nconst ROOF_SHAPES: Readonly<Record<string, number>> = {\n flat: 1,\n skillion: 1,\n hipped: 2,\n 'half-hipped': 2,\n side_hipped: 2,\n dome: 2,\n onion: 2,\n round: 2,\n gabled: 3,\n saltbox: 3,\n pyramidal: 4,\n cone: 4,\n mansard: 5,\n gambrel: 5,\n};\n\n/** A roof generated from its building's outline (`shapes::GENERATED_ROOF`) */\nexport const GENERATED_ROOF = 255;\n\n/** The engine's number of a roof shape (`roof:shape`, or `generated`); undefined for a shape it does not know */\nexport const roofNumber = (shape: string): number | undefined =>\n shape === 'generated' ? GENERATED_ROOF : ROOF_SHAPES[shape];\n\n/** How the buildings' roofs are made: from their data (`roof:shape`, `roof:height`; flat without), generated where\n * they have none, or all flat */\nexport type RoofMode = 'data' | 'generated' | 'flat';\n\n/** The first of a feature's properties `names` it has */\nconst property = (p: unknown, names: readonly string[]): unknown =>\n isRecord(p) ? names.map((n) => p[n]).find((v) => v !== undefined) : undefined;\n\n/** A building's roof shape by the `mode`, from its properties (`roof:shape` or `roof_shape`): one the engine knows,\n * else generated in `generated`; undefined for none (flat) */\nexport const roofShapeOf = (properties: unknown, mode: RoofMode): string | undefined => {\n const shape = property(properties, ['roof:shape', 'roof_shape']);\n\n if (mode === 'flat') return undefined;\n if (typeof shape === 'string' && ROOF_SHAPES[shape] !== undefined) return shape;\n\n return mode === 'generated' ? 'generated' : undefined;\n};\n\n/** A building's roof height from its properties (`roof:height` or `roof_height`; not a number: as its slopes make it) */\nexport const roofHeightOf = (properties: unknown): number =>\n Number(property(properties, ['roof:height', 'roof_height']) ?? Number.NaN);\n\n/** Metres per Mercator unit at a Mercator y (towards the south, [0, 1]): a roof's slopes run in metres */\nexport const metresAt = (y: number): number => EARTH_METRES * Math.cos(Math.atan(Math.sinh(Math.PI * (1 - 2 * y))));\n"]}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The floats of a feature's style in the engine (`setFeatureStyle`, `render::features::TEXELS`), for the page's
3
+ * layers and the vector tiles' workers alike: what each holds.
4
+ */
5
+ /** Floats per feature */
6
+ export declare const FLOATS = 32;
7
+ /** Where a feature's style holds what */
8
+ export declare const STYLE: {
9
+ /** Its color (RGBA) at the first zoom of its range */
10
+ readonly color: 0;
11
+ /** Its second color (RGBA): at the last zoom of its range, a circle's stroke's; a line's or a building's pattern
12
+ * there instead (its place in the icon atlas, texels) */
13
+ readonly second: 4;
14
+ /** Its size: four zooms, then its value at each (a line's width, a building's height, a circle's radius); a fill's
15
+ * pattern's place in the icon atlas at its values */
16
+ readonly size: 8;
17
+ /** Its second size, the same way (a line's offset, a building's base, a circle's stroke's width); a fill's pattern's
18
+ * pixel ratio at its first zoom */
19
+ readonly size2: 16;
20
+ /** The zooms it is drawn from and to */
21
+ readonly range: 24;
22
+ /** A line's blur (CSS pixels) */
23
+ readonly blur: 26;
24
+ /** A building's landmark flag, in a line's blur's place (1: drawn as a monument, no office windows, floodlit at
25
+ * night) */
26
+ readonly landmark: 26;
27
+ /** A line's or a building's pattern's pixel ratio */
28
+ readonly patternRatio: 27;
29
+ /** A fill's pattern by its name's index past one, the page putting its place instead (not kept by the engine) */
30
+ readonly fillPattern: 28;
31
+ /** A line's or a building's, the same way */
32
+ readonly linePattern: 29;
33
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The floats of a feature's style in the engine (`setFeatureStyle`, `render::features::TEXELS`), for the page's
3
+ * layers and the vector tiles' workers alike: what each holds.
4
+ */
5
+ /** Floats per feature */
6
+ export const FLOATS = 32;
7
+ /** Where a feature's style holds what */
8
+ export const STYLE = {
9
+ /** Its color (RGBA) at the first zoom of its range */
10
+ color: 0,
11
+ /** Its second color (RGBA): at the last zoom of its range, a circle's stroke's; a line's or a building's pattern
12
+ * there instead (its place in the icon atlas, texels) */
13
+ second: 4,
14
+ /** Its size: four zooms, then its value at each (a line's width, a building's height, a circle's radius); a fill's
15
+ * pattern's place in the icon atlas at its values */
16
+ size: 8,
17
+ /** Its second size, the same way (a line's offset, a building's base, a circle's stroke's width); a fill's pattern's
18
+ * pixel ratio at its first zoom */
19
+ size2: 16,
20
+ /** The zooms it is drawn from and to */
21
+ range: 24,
22
+ /** A line's blur (CSS pixels) */
23
+ blur: 26,
24
+ /** A building's landmark flag, in a line's blur's place (1: drawn as a monument, no office windows, floodlit at
25
+ * night) */
26
+ landmark: 26,
27
+ /** A line's or a building's pattern's pixel ratio */
28
+ patternRatio: 27,
29
+ /** A fill's pattern by its name's index past one, the page putting its place instead (not kept by the engine) */
30
+ fillPattern: 28,
31
+ /** A line's or a building's, the same way */
32
+ linePattern: 29,
33
+ };
34
+ //# sourceMappingURL=style-floats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-floats.js","sourceRoot":"","sources":["../../src/util/style-floats.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,yBAAyB;AACzB,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,CAAC;AAEzB,yCAAyC;AACzC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,sDAAsD;IACtD,KAAK,EAAE,CAAC;IACR;6DACyD;IACzD,MAAM,EAAE,CAAC;IACT;yDACqD;IACrD,IAAI,EAAE,CAAC;IACP;uCACmC;IACnC,KAAK,EAAE,EAAE;IACT,wCAAwC;IACxC,KAAK,EAAE,EAAE;IACT,iCAAiC;IACjC,IAAI,EAAE,EAAE;IACR;gBACY;IACZ,QAAQ,EAAE,EAAE;IACZ,qDAAqD;IACrD,YAAY,EAAE,EAAE;IAChB,iHAAiH;IACjH,WAAW,EAAE,EAAE;IACf,6CAA6C;IAC7C,WAAW,EAAE,EAAE;CACP,CAAC","sourcesContent":["/**\n * The floats of a feature's style in the engine (`setFeatureStyle`, `render::features::TEXELS`), for the page's\n * layers and the vector tiles' workers alike: what each holds.\n */\n\n/** Floats per feature */\nexport const FLOATS = 32;\n\n/** Where a feature's style holds what */\nexport const STYLE = {\n /** Its color (RGBA) at the first zoom of its range */\n color: 0,\n /** Its second color (RGBA): at the last zoom of its range, a circle's stroke's; a line's or a building's pattern\n * there instead (its place in the icon atlas, texels) */\n second: 4,\n /** Its size: four zooms, then its value at each (a line's width, a building's height, a circle's radius); a fill's\n * pattern's place in the icon atlas at its values */\n size: 8,\n /** Its second size, the same way (a line's offset, a building's base, a circle's stroke's width); a fill's pattern's\n * pixel ratio at its first zoom */\n size2: 16,\n /** The zooms it is drawn from and to */\n range: 24,\n /** A line's blur (CSS pixels) */\n blur: 26,\n /** A building's landmark flag, in a line's blur's place (1: drawn as a monument, no office windows, floodlit at\n * night) */\n landmark: 26,\n /** A line's or a building's pattern's pixel ratio */\n patternRatio: 27,\n /** A fill's pattern by its name's index past one, the page putting its place instead (not kept by the engine) */\n fillPattern: 28,\n /** A line's or a building's, the same way */\n linePattern: 29,\n} as const;\n"]}
package/dist/util/sun.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * low-precision formulas of the Astronomical Almanac: within a few hundredths of a degree from 1950 to 2050, far
4
4
  * finer than a shadow needs)
5
5
  */
6
- const RAD = Math.PI / 180;
6
+ import { RAD } from "./geo.js";
7
7
  /** The sun's azimuth (degrees clockwise from north) and altitude (degrees above the horizon) at `lonLat` at `date` */
8
8
  export const sunPosition = (date, [lon, lat]) => {
9
9
  // Days since J2000.0 (noon on the 1st of January 2000, UTC)
@@ -1 +1 @@
1
- {"version":3,"file":"sun.js","sourceRoot":"","sources":["../../src/util/sun.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAE1B,sHAAsH;AACtH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAU,EAAE,CAAC,GAAG,EAAE,GAAG,CAAS,EAAyC,EAAE;IACnG,4DAA4D;IAC5D,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,UAAU,GAAG,QAAQ,CAAC;IACjD,MAAM,CAAC,GAAG,CAAC,OAAO,GAAG,YAAY,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAC7C,MAAM,CAAC,GAAG,OAAO,GAAG,YAAY,GAAG,CAAC,CAAC;IACrC,kGAAkG;IAClG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,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AAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,GAAG,EAAE,CAAC;AACtF,CAAC,CAAC","sourcesContent":["/**\n * Where the sun stands in the sky: its azimuth and altitude at a place and time, from its ecliptic position (the\n * low-precision formulas of the Astronomical Almanac: within a few hundredths of a degree from 1950 to 2050, far\n * finer than a shadow needs)\n */\n\nimport type { LonLat } from '../types.ts';\n\nconst RAD = Math.PI / 180;\n\n/** The sun's azimuth (degrees clockwise from north) and altitude (degrees above the horizon) at `lonLat` at `date` */\nexport const sunPosition = (date: Date, [lon, lat]: LonLat): { azimuth: number; altitude: number } => {\n // Days since J2000.0 (noon on the 1st of January 2000, UTC)\n const d = date.getTime() / 86_400_000 - 10_957.5;\n const g = (357.529 + 0.985_600_28 * d) * RAD;\n const q = 280.459 + 0.985_647_36 * d;\n // Its ecliptic longitude, the obliquity of the ecliptic, then its right ascension and declination\n const l = (q + 1.915 * Math.sin(g) + 0.02 * Math.sin(2 * g)) * RAD;\n const e = (23.439 - 0.000_000_36 * d) * RAD;\n const ra = Math.atan2(Math.cos(e) * Math.sin(l), Math.cos(l));\n const dec = Math.asin(Math.sin(e) * Math.sin(l));\n // Its hour angle at the place, from the sidereal time at Greenwich\n const gmst = 280.460_618_37 + 360.985_647_366_29 * d;\n const h = (gmst + lon) * RAD - ra;\n const phi = lat * RAD;\n const altitude = Math.asin(Math.sin(phi) * Math.sin(dec) + Math.cos(phi) * Math.cos(dec) * Math.cos(h));\n const azimuth = Math.atan2(-Math.sin(h), Math.tan(dec) * Math.cos(phi) - Math.sin(phi) * Math.cos(h));\n\n return { azimuth: (((azimuth / RAD) % 360) + 360) % 360, altitude: altitude / RAD };\n};\n"]}
1
+ {"version":3,"file":"sun.js","sourceRoot":"","sources":["../../src/util/sun.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAA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,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACxG,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtG,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,GAAG,EAAE,CAAC;AACtF,CAAC,CAAC","sourcesContent":["/**\n * Where the sun stands in the sky: its azimuth and altitude at a place and time, from its ecliptic position (the\n * low-precision formulas of the Astronomical Almanac: within a few hundredths of a degree from 1950 to 2050, far\n * finer than a shadow needs)\n */\n\nimport type { LonLat } from '../types.ts';\nimport { RAD } from './geo.ts';\n\n/** The sun's azimuth (degrees clockwise from north) and altitude (degrees above the horizon) at `lonLat` at `date` */\nexport const sunPosition = (date: Date, [lon, lat]: LonLat): { azimuth: number; altitude: number } => {\n // Days since J2000.0 (noon on the 1st of January 2000, UTC)\n const d = date.getTime() / 86_400_000 - 10_957.5;\n const g = (357.529 + 0.985_600_28 * d) * RAD;\n const q = 280.459 + 0.985_647_36 * d;\n // Its ecliptic longitude, the obliquity of the ecliptic, then its right ascension and declination\n const l = (q + 1.915 * Math.sin(g) + 0.02 * Math.sin(2 * g)) * RAD;\n const e = (23.439 - 0.000_000_36 * d) * RAD;\n const ra = Math.atan2(Math.cos(e) * Math.sin(l), Math.cos(l));\n const dec = Math.asin(Math.sin(e) * Math.sin(l));\n // Its hour angle at the place, from the sidereal time at Greenwich\n const gmst = 280.460_618_37 + 360.985_647_366_29 * d;\n const h = (gmst + lon) * RAD - ra;\n const phi = lat * RAD;\n const altitude = Math.asin(Math.sin(phi) * Math.sin(dec) + Math.cos(phi) * Math.cos(dec) * Math.cos(h));\n const azimuth = Math.atan2(-Math.sin(h), Math.tan(dec) * Math.cos(phi) - Math.sin(phi) * Math.cos(h));\n\n return { azimuth: (((azimuth / RAD) % 360) + 360) % 360, altitude: altitude / RAD };\n};\n"]}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The street furniture of a tile, from OpenMapTiles' layers: its points of interest of the street where they stand
3
+ * (bus stops' shelters, waste baskets, post boxes, drinking fountains, bicycle racks), each facing the nearest street;
4
+ * benches along the pedestrian streets and the paths of the parks and gardens. The same each time the tile is cut
5
+ */
6
+ import type { Priority } from '../basemap.worker.ts';
7
+ import { type Renderer } from './tiles.ts';
8
+ /**
9
+ * The street furniture of a tile: longitude, latitude, scale, heading (degrees, facing its street or path), rank (in
10
+ * [0, 1): the page keeps the lowest far from the view) and kind (`FURNITURE`' index) of each, as things placed
11
+ * (`PLACED_NUMBERS`); past `maxObjects`, thinned evenly
12
+ */
13
+ export declare const furniture: (r: Renderer, z: number, x: number, y: number, id: number, maxObjects: number, priority?: Priority) => Promise<Float64Array<ArrayBufferLike> | undefined>;
@@ -2,6 +2,7 @@
2
2
  * `vectors()` with their style per feature, made ready for the GPU by the tessellation module */
3
3
  import type { TileFeature, Value } from '../../basemap/mvt.ts';
4
4
  import { type StyleLayer } from '../../basemap/vectorstyle.ts';
5
+ import { type RoofMode } from '../../util/roofs.ts';
5
6
  import type { Priority, TileMesh, TileStyles, TileVectors } from '../basemap.worker.ts';
6
7
  import { type Renderer } from './tiles.ts';
7
8
  /**
@@ -31,11 +32,7 @@ export declare const holdsLandmark: (rings: readonly (readonly number[])[], poin
31
32
  * landmark's wall, its middle outside, is none
32
33
  */
33
34
  export declare const landmarkBuildings: (features: readonly TileFeature[], points: readonly number[]) => Set<TileFeature>;
34
- /** How the buildings' roofs are made: from their data (`roof:shape`, `roof:height`; flat without), generated where
35
- * they have none, or all flat */
36
- export type RoofMode = 'data' | 'generated' | 'flat';
37
- /** A building's roof for the engine: its shape's number (0 flat) and height (metres; not a number: as its slopes make
38
- * it), from its properties (`roof:shape` or `roof_shape`, `roof:height` or `roof_height`) and the `mode` */
35
+ /** A building's roof for the engine: its shape's number (`roofShapeOf`; 0 none) and height (`roofHeightOf`) */
39
36
  export declare const roofOf: (properties: Record<string, Value>, mode: RoofMode) => [number, number];
40
37
  /**
41
38
  * The zooms a feature shows over by its layer's filter, as MapLibre evaluates a filter (at the whole zoom under the
@@ -5,8 +5,11 @@ import type { Priority } from '../basemap.worker.ts';
5
5
  import { type Renderer } from './tiles.ts';
6
6
  /** Points every `spacing` along a line (tile units, x and y interleaved), the first half a spacing in (the middle of a
7
7
  * shorter line): each point, the segment it lies on and how far along the line it is (x, y, x0, y0, x1, y1, the
8
- * segment's index, the distance) */
8
+ * distance) */
9
9
  export declare const lineAnchors: (line: readonly number[], spacing: number) => number[][];
10
+ /** The point `offset` (tile units) beside a line's anchor (`lineAnchors`), the `k`th anchor's on one side of the line,
11
+ * the next one's on the other: x, y and its heading facing the line (degrees; y towards the south in the tile) */
12
+ export declare const besideLine: (anchor: readonly number[], k: number, offset: number) => [x: number, y: number, heading: number];
10
13
  /** The part of a line (tile units, interleaved) from `from` to `to` along it (distances from its start) */
11
14
  export declare const lineBetween: (line: readonly number[], from: number, to: number) => number[];
12
15
  /**
@@ -18,4 +21,4 @@ export declare const roofsOf: (r: Renderer, layers: Map<string, {
18
21
  extent: number;
19
22
  features: TileFeature[];
20
23
  }>, zoom: number) => ((px: number, py: number) => number | undefined);
21
- export declare const labels: (r: Renderer, z: number, x: number, y: number, id: number, priority?: Priority, zoom?: number) => Promise<LabelCandidate[]>;
24
+ export declare const labels: (r: Renderer, z: number, x: number, y: number, id: number, priority?: Priority, zoom?: number, roofs?: boolean) => Promise<LabelCandidate[]>;
@@ -4,7 +4,7 @@ import { type Renderer } from './tiles.ts';
4
4
  /**
5
5
  * Lamps along the lines of the renderer's layers in a tile, `spacing` metres apart along each street, every other
6
6
  * one on its other side, as far from its middle as its class says (`SIDE_METRES`): longitude, latitude, scale, heading
7
- * (degrees, facing the street) and rank (in [0, 1): the page keeps the lowest far from the view) of each, as the trees'
8
- * numbers (`TREE_NUMBERS`, the kind 0); past `maxLamps`, thinned evenly. A street in several layers has its lamps once
7
+ * (degrees, facing the street) and rank (in [0, 1): the page keeps the lowest far from the view) of each, as things
8
+ * placed (`PLACED_NUMBERS`, the kind 0); past `maxLamps`, thinned evenly. A street in several layers has its lamps once
9
9
  */
10
- export declare const lamps: (r: Renderer, z: number, x: number, y: number, id: number, spacing: number, maxLamps: number, priority?: Priority) => Promise<Float64Array<ArrayBuffer> | undefined>;
10
+ export declare const lamps: (r: Renderer, z: number, x: number, y: number, id: number, spacing: number, maxLamps: number, priority?: Priority) => Promise<Float64Array<ArrayBufferLike> | undefined>;
@@ -47,6 +47,8 @@ export declare const aborted: Set<number>;
47
47
  export declare const image: (url: string, priority?: Priority) => Promise<ImageBitmap | undefined>;
48
48
  /** A vector tile, decoded (shared by every renderer of its URL); the first request's priority fetches it */
49
49
  export declare const tile: (url: string, priority?: Priority) => Promise<Map<string, TileLayer> | undefined>;
50
+ /** A tile's URL from its source's template */
51
+ export declare const tileUrl: (template: string, z: number, x: number, y: number) => string;
50
52
  /** The vector tile to draw a raster tile from, and where the raster tile lies in it (tile units) */
51
53
  export declare const source: (r: Renderer, z: number, x: number, y: number) => {
52
54
  url: string;
@@ -1,6 +1,9 @@
1
1
  /** The trees of a tile: points scattered over the woods of its polygons, the same each time the tile is cut */
2
2
  import type { Priority } from '../basemap.worker.ts';
3
3
  import { type Renderer } from './tiles.ts';
4
+ /** Things placed (`PLACED_NUMBERS` each), past `max` thinned evenly by their rank: one in so many kept, the
5
+ * same ones each time */
6
+ export declare const thinned: (found: readonly number[], max: number) => Float64Array;
4
7
  /** A number in [0, 1) from four integers, the same for the same ones: where a tree stands in its cell, its size */
5
8
  export declare const treeHash: (a: number, b: number, c: number, d: number) => number;
6
9
  /** Whether a point lies in rings (interleaved points, unclosed or closed), even-odd: the holes cut out */
@@ -20,7 +20,7 @@ import { type PngEncoding } from '../basemap/terrain.ts';
20
20
  import { type LabelCandidate, type RasterSource, type StyleLayer } from '../basemap/vectorstyle.ts';
21
21
  import { type HeaderRules } from '../engine/requests.ts';
22
22
  import { type GridDescription, type StreetFlows } from '../grid-module.ts';
23
- import { type RoofMode } from './basemap/geometry.ts';
23
+ import type { RoofMode } from '../util/roofs.ts';
24
24
  import { type StreetWork } from './basemap/street.ts';
25
25
  import { type Sprite } from './basemap/tiles.ts';
26
26
  export type { LabelCandidate, RasterSource, Sprite };
@@ -45,6 +45,8 @@ export type BasemapWork = {
45
45
  x: number;
46
46
  y: number;
47
47
  zoom?: number;
48
+ /** The labels in a building given its height (they stand on its roof) */
49
+ roofs?: boolean;
48
50
  priority?: Priority;
49
51
  }
50
52
  /** The polygons of the renderer's layers (buildings), for extrusions */
@@ -68,6 +70,17 @@ export type BasemapWork = {
68
70
  maxTrees: number;
69
71
  priority?: Priority;
70
72
  }
73
+ /** The street furniture of the tile (OpenMapTiles' points of interest of the street, benches along the pedestrian
74
+ * streets and the parks' paths), at most `maxObjects` */
75
+ | {
76
+ type: 'furniture';
77
+ key: string;
78
+ z: number;
79
+ x: number;
80
+ y: number;
81
+ maxObjects: number;
82
+ priority?: Priority;
83
+ }
71
84
  /** Street lamps along the lines of the renderer's layers, `spacing` metres apart along each street, at most
72
85
  * `maxLamps` */
73
86
  | {
@@ -174,6 +187,9 @@ export type BasemapResponse = {
174
187
  } | {
175
188
  id: number;
176
189
  lamps: Float64Array;
190
+ } | {
191
+ id: number;
192
+ furniture: Float64Array;
177
193
  } | {
178
194
  id: number;
179
195
  vectors: TileVectors;