isard 2.4.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +2 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/isard_tess_bg.wasm +0 -0
- package/dist/isard_webgl2_bg.wasm +0 -0
- package/dist/isard_webgpu_bg.wasm +0 -0
- package/dist/layers/tiles3d.d.ts +19 -1
- package/dist/layers/tiles3d.js +44 -0
- package/dist/layers/tiles3d.js.map +1 -1
- package/dist/map.d.ts +11 -1
- package/dist/map.js +29 -0
- package/dist/map.js.map +1 -1
- package/dist/react/IsardMap.d.ts +1 -0
- package/dist/react/IsardMap.js +1 -0
- package/dist/react/IsardMap.js.map +1 -1
- package/dist/types.d.ts +24 -0
- package/dist/types.js.map +1 -1
- package/dist/wasm/isard_webgl2.d.ts +27 -2
- package/dist/wasm/isard_webgl2.js +89 -11
- package/dist/wasm/isard_webgpu.d.ts +27 -2
- package/dist/wasm/isard_webgpu.js +89 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ versions [Semantic Versioning](https://semver.org) (before 1.0.0, a minor versio
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [2.5.0] - 2026-11-02
|
|
9
|
+
|
|
10
|
+
With `isard-react-native` and `isard-map` (Python) 2.5.0.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Finding a feature and framing it (#176): `map.fitBounds(box, options)` frames a box on the ground or in space (its
|
|
15
|
+
bottom and top altitudes: a building, a pipe underground), all of it within the canvas less the padding, at the pitch
|
|
16
|
+
and bearing given; `tiles3d.refine(box)` loads the tiles meeting a box to their finest level, first, in view or not,
|
|
17
|
+
resolved once they are there; `tiles3d.find(matches)` gives the first feature of the tiles drawn whose properties
|
|
18
|
+
match; `map.geoidHeight([lon, lat])`. The example Find a building, in its four versions.
|
|
19
|
+
- `onGpuLost` on `<IsardMap>` (the `'gpulost'` event).
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- The API page listed `map.camera`, `map.query` and `map.effects`, gone since the public API was made consistent.
|
|
24
|
+
|
|
8
25
|
## [2.4.2] - 2026-11-02
|
|
9
26
|
|
|
10
27
|
With `isard-react-native` and `isard-map` (Python) 2.4.2.
|
package/README.md
CHANGED
|
@@ -187,9 +187,8 @@ More in [Develop and release](https://ideal-adventure-zqn6y6p.pages.github.io/gu
|
|
|
187
187
|
By priority:
|
|
188
188
|
|
|
189
189
|
- **P1**, next: the memory budget measured on a phone (a phone closes a page past about a gigabyte).
|
|
190
|
-
- **P2**, then:
|
|
191
|
-
|
|
192
|
-
within an area; a performance report.
|
|
190
|
+
- **P2**, then: OGC API - Features and Tiles (#177); virtual point clouds (#183); Cloud-Optimized GeoTIFF (#184);
|
|
191
|
+
measured against iTowns on 3D data (#178); rasters draped within an area; a performance report.
|
|
193
192
|
- **P3**, later: several elevation sources (#179); a time for layers (#180); objects moving along paths (#181); photos
|
|
194
193
|
projected onto the meshes (#187) and video in the scene; composable effects over the frame (#182).
|
|
195
194
|
- **P4**, when time allows: Gaussian splats (#186), WebXR (#185), the whole MapLibre style drawn as vectors, a 3D
|
package/dist/index.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export { type VectorFeature, VectorLayer, type VectorSublayer } from './layers/v
|
|
|
67
67
|
export type { HoverPicking } from './map/hover-pick.ts';
|
|
68
68
|
export { GeoMap, type LayerSpec } from './map.ts';
|
|
69
69
|
export { PANORAMAX_API, type PanoramaxPicture, type PanoramaxSequenceOptions, panoramaxPanoramas, panoramaxPhoto, panoramaxPicture, panoramaxSequence, panoramaxStyle, } from './panoramax.ts';
|
|
70
|
-
export type { AnimationOptions, AtmosphereOptions, Basemap, BasemapName, BodyOptions, CelestialBody, ClipBox, ClipCylinder, ClipPolygon, ClipVolume, Drape, FeatureColor, FeatureHit, FirstPersonView, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, MapGpuTimings, MapHoverFeatureEvent, MapMemory, MapPointerEvent, NetworkOptions, NetworkStyle, PickOptions, Placement, Point, Projection, Quality, RasterGrid, RasterOptions, RasterStyle, SunOptions, SwipeOptions, TerrainEncoding, TerrainModel, TerrainOptions, Tiles3dOptions, Tiles3dStyle, ViewshedOptions, } from './types.ts';
|
|
70
|
+
export type { AnimationOptions, AtmosphereOptions, Basemap, BasemapName, BodyOptions, CelestialBody, ClipBox, ClipCylinder, ClipPolygon, ClipVolume, Drape, FeatureColor, FeatureHit, FirstPersonView, FitBoundsOptions, FitBox, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, MapGpuTimings, MapHoverFeatureEvent, MapMemory, MapPointerEvent, NetworkOptions, NetworkStyle, PickOptions, Placement, Point, Projection, Quality, RasterGrid, RasterOptions, RasterStyle, SunOptions, SwipeOptions, TerrainEncoding, TerrainModel, TerrainOptions, Tiles3dOptions, Tiles3dStyle, ViewshedOptions, } from './types.ts';
|
|
71
71
|
export { AttributionControl, type AttributionOptions, type Control, type ControlPosition, NavigationControl, type NavigationOptions, } from './ui/controls.ts';
|
|
72
72
|
export { MinimapControl, type MinimapOptions } from './ui/minimap.ts';
|
|
73
73
|
export { type Anchor, Marker, type MarkerEvent, type MarkerEvents, type MarkerOptions, Panel, type PanelOptions, Popup, type PopupEvents, type PopupOptions, } from './ui/overlay.ts';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAE3F,OAAO,EAAE,YAAY,EAAmB,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EACL,OAAO,EAIP,WAAW,EACX,WAAW,GACZ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AAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAKL,SAAS,GAEV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAqB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAmC,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAsB,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AAE3F,OAAO,EAAE,MAAM,EAAkB,MAAM,UAAU,CAAC;AAClD,OAAO,EACL,aAAa,EAGb,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,gBAAgB,CAAC;AA8CxB,OAAO,EACL,kBAAkB,EAIlB,iBAAiB,GAElB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAEL,MAAM,EAIN,KAAK,EAEL,KAAK,GAGN,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAqB,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAsB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/**\n * isard: a WebGL2 map engine for large, interactive data layers, labels and 3D Tiles.\n *\n * ```ts\n * import { GeoMap } from 'isard';\n * const map = await GeoMap.create(container, { center: [2.4246, 48.8457], zoom: 13 });\n * const network = map.addNetwork({ nodes, edges, max: 1800, contour: 300 });\n * map.on('hover', ({ lonLat }) => lonLat && network.setValues(travelTimes(lonLat)));\n * map.addTiles3d({ url: 'https://…/tileset.json' });\n * map.addControl(new NavigationControl());\n * new Marker().setLonLat([2.4246, 48.8457]).setPopup(new Popup({ offset: [0, -34] }).setText('Here')).addTo(map);\n * ```\n */\nexport { OPENFREEMAP_ATTRIBUTION, TERRAIN_TILES_ATTRIBUTION } from './basemap/basemaps.ts';\nexport type { TileGrid, TileMatrix } from './basemap/grid.ts';\nexport { coniferModel, type TreeColors, treeModel } from './basemap/models/trees.ts';\nexport {\n PMTiles,\n type PmtilesEntry,\n type PmtilesHeader,\n type PmtilesTileType,\n tileIdToZxy,\n zxyToTileId,\n} from './basemap/pmtiles.ts';\nexport { basicStyle, type PmtilesOptions } from './basemap/pmtileslayer.ts';\nexport type {\n CandidateIcon,\n CandidateOverlap,\n Json,\n LabelCandidate,\n RasterSource,\n Style,\n StyleLayer,\n} from './basemap/vectorstyle.ts';\nexport type { VectorExtrusionOptions } from './basemap/vectortiles/extrusions.ts';\nexport type { FurnitureOptions } from './basemap/vectortiles/furniture.ts';\nexport type { LabelsOptions } from './basemap/vectortiles/labels.ts';\nexport type { LampsOptions } from './basemap/vectortiles/lamps.ts';\nexport type { StreetWindLayer, StreetWindOptions } from './basemap/vectortiles/street-wind.ts';\nexport type { LoadedStyle } from './basemap/vectortiles/style.ts';\nexport type { TreesOptions } from './basemap/vectortiles/trees.ts';\nexport { isStreet, type VectorsOptions } from './basemap/vectortiles/vectors.ts';\nexport type { VectorRasterOptions, VectorTilesOptions } from './basemap/vectortiles.ts';\nexport { OPENFREEMAP_STYLES, PLAN_STYLES, VectorTiles } from './basemap/vectortiles.ts';\nexport { parseWmtsGrid, wmtsGrid } from './basemap/wmts.ts';\nexport { type ColladaImages, colladaImages, loadCollada, parseCollada } from './data/collada.ts';\nexport {\n type Crs,\n type CrsLike,\n getCrs,\n lambertConformalConic,\n registerCrs,\n reproject,\n transverseMercator,\n} from './data/crs.ts';\nexport { parseGpx } from './data/gpx.ts';\nexport {\n type IfcElement,\n type IfcModel,\n type IfcOptions,\n type IfcPlace,\n type IfcProperties,\n type IfcStorey,\n loadIfc,\n WEB_IFC,\n} from './data/ifc.ts';\nexport { parseKml } from './data/kml.ts';\nexport { parseTopoJson, type TopoGeometry, type Topology } from './data/topojson.ts';\nexport type { DecoderUrls } from './decoding/decoders.ts';\nexport {\n BATIMENTS_3D_URL,\n type BdTopoBuilding,\n batiments3d,\n bdtopoBuildings,\n bdtopoRoofs,\n type GeocodedPlace,\n geoplateformeGeocode,\n geoplateformeWfs,\n geoplateformeWms,\n geoplateformeWmts,\n IGN_ATTRIBUTION,\n IGN_PRESETS,\n type IgnPreset,\n lambert93Grid,\n} from './geoplateforme.ts';\nexport { type Grid, windAt, windFields } from './grids.ts';\nexport type { CustomFrame, CustomLayerInterface } from './layers/custom.ts';\nexport { CustomLayer } from './layers/custom.ts';\nexport type { ExtrusionOptions, ExtrusionStyle, PolygonArrays, TileKey } from './layers/extrusions.ts';\nexport { ExtrusionLayer } from './layers/extrusions.ts';\nexport type {\n CircleOptions,\n CircleStyle,\n Feature,\n FeatureCollection,\n FeatureData,\n FeatureLayerStyle,\n FillOptions,\n FillStyle,\n Geometry,\n LineOptions,\n LineStyle,\n Position,\n Properties,\n Ramp,\n Size,\n Stops,\n Styled,\n} from './layers/features.ts';\nexport { CircleLayer, FeatureLayer, FillLayer, interpolate, LineLayer, parseColor } from './layers/features.ts';\nexport type { FlowField, FlowOptions, FlowStyle, TimedField } from './layers/flow.ts';\nexport { FlowLayer, flowFieldFromImage, flowFieldsFromImage } from './layers/flow.ts';\nexport type { TextPart } from './layers/glyphs.ts';\nexport { DEFAULT_FONT, GLYPHS_URL } from './layers/glyphs.ts';\nexport type { GroundOptions, GroundTexture, GroundUniform } from './layers/ground.ts';\nexport { GroundLayer } from './layers/ground.ts';\nexport type { ImageOptions, Pixels, SpriteIcon } from './layers/icons.ts';\nexport { Layer } from './layers/layers.ts';\nexport type { ModelInstance, ModelOptions } from './layers/models.ts';\nexport { ModelLayer } from './layers/models.ts';\nexport { NetworkLayer } from './layers/network.ts';\nexport {\n type CalibratedPanoramaOptions,\n type Panorama,\n type PanoramaOptions,\n type PanoramaPhoto,\n Panoramas,\n type PhotoPanoramaOptions,\n} from './layers/panoramas.ts';\nexport { type PhotoOptions, photoModel } from './layers/photos.ts';\nexport type { ClassStyle, PointCloudOptions, PointCloudStyle, PointColor } from './layers/pointclouds.ts';\nexport { CLASSIFICATIONS, ELEVATION_RAMP, PointCloudLayer } from './layers/pointclouds.ts';\nexport { RasterLayer } from './layers/raster.ts';\nexport type { Overlap, SymbolOptions, SymbolStyle } from './layers/symbols.ts';\nexport { SymbolLayer } from './layers/symbols.ts';\nexport { Tiles3dLayer } from './layers/tiles3d.ts';\nexport { type TreeKind, type TreeOptions, treeKind } from './layers/trees.ts';\nexport { type VectorFeature, VectorLayer, type VectorSublayer } from './layers/vectors.ts';\nexport type { HoverPicking } from './map/hover-pick.ts';\nexport { GeoMap, type LayerSpec } from './map.ts';\nexport {\n PANORAMAX_API,\n type PanoramaxPicture,\n type PanoramaxSequenceOptions,\n panoramaxPanoramas,\n panoramaxPhoto,\n panoramaxPicture,\n panoramaxSequence,\n panoramaxStyle,\n} from './panoramax.ts';\nexport type {\n AnimationOptions,\n AtmosphereOptions,\n Basemap,\n BasemapName,\n BodyOptions,\n CelestialBody,\n ClipBox,\n ClipCylinder,\n ClipPolygon,\n ClipVolume,\n Drape,\n FeatureColor,\n FeatureHit,\n FirstPersonView,\n FitBoundsOptions,\n FitBox,\n FlyToOptions,\n GeoMapOptions,\n LoadingMode,\n LonLat,\n MapEvents,\n MapGpuTimings,\n MapHoverFeatureEvent,\n MapMemory,\n MapPointerEvent,\n NetworkOptions,\n NetworkStyle,\n PickOptions,\n Placement,\n Point,\n Projection,\n Quality,\n RasterGrid,\n RasterOptions,\n RasterStyle,\n SunOptions,\n SwipeOptions,\n TerrainEncoding,\n TerrainModel,\n TerrainOptions,\n Tiles3dOptions,\n Tiles3dStyle,\n ViewshedOptions,\n} from './types.ts';\nexport {\n AttributionControl,\n type AttributionOptions,\n type Control,\n type ControlPosition,\n NavigationControl,\n type NavigationOptions,\n} from './ui/controls.ts';\nexport { MinimapControl, type MinimapOptions } from './ui/minimap.ts';\nexport {\n type Anchor,\n Marker,\n type MarkerEvent,\n type MarkerEvents,\n type MarkerOptions,\n Panel,\n type PanelOptions,\n Popup,\n type PopupEvents,\n type PopupOptions,\n} from './ui/overlay.ts';\nexport { lengthLabel, roundLength, ScaleControl, type ScaleOptions } from './ui/scale.ts';\nexport { SearchControl, type SearchOptions } from './ui/search.ts';\nexport { setRequestHeaders } from './util/requests.ts';\nexport type { RoofMode } from './util/roofs.ts';\nexport { sunPosition } from './util/sun.ts';\nexport type {\n Camera,\n NetworkStats,\n PickHit,\n PickResult,\n PointCloudInfo,\n PointCloudPoint,\n PointCloudStats,\n RasterLayerStats,\n Tiles3dStats,\n} from './wasm/isard_webgpu.js';\n"]}
|
package/dist/isard_tess_bg.wasm
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/layers/tiles3d.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** A 3D Tiles tileset as a layer: its style, its features picked */
|
|
2
|
-
import type { Drape, Tiles3dStyle } from '../types.ts';
|
|
2
|
+
import type { Drape, FitBox, Tiles3dStyle } from '../types.ts';
|
|
3
3
|
import type { Tiles3dStats } from '../wasm/isard_webgpu.js';
|
|
4
|
+
import type { Feature } from './features.ts';
|
|
4
5
|
import { Layer } from './layers.ts';
|
|
5
6
|
/** Textured meshes in 3D Tiles */
|
|
6
7
|
export declare class Tiles3dLayer extends Layer {
|
|
@@ -9,6 +10,17 @@ export declare class Tiles3dLayer extends Layer {
|
|
|
9
10
|
private style;
|
|
10
11
|
private facades;
|
|
11
12
|
private drape;
|
|
13
|
+
/** The box loaded to its finest tiles (`refine`): west, south, east, north, bottom, top */
|
|
14
|
+
private focus;
|
|
15
|
+
/**
|
|
16
|
+
* Loads the tiles meeting a box to their finest level, before the others and whether the box is in view or not (a
|
|
17
|
+
* feature framed to be found in them: its finest geometry, its ID); resolved once they are all there. The box stays
|
|
18
|
+
* so until another one, or `refine(undefined)`. `box`: as `fitBounds` takes it, altitudes in metres above the
|
|
19
|
+
* ellipsoid; `timeout` (ms, default 30 s): rejected past it
|
|
20
|
+
*/
|
|
21
|
+
refine(box: FitBox | FitBox['bounds'] | undefined, { timeout }?: {
|
|
22
|
+
timeout?: number | undefined;
|
|
23
|
+
}): Promise<void>;
|
|
12
24
|
/** Whether the walls of its untextured meshes (buildings without their photos, as the IGN's Bâtiments 3D) show
|
|
13
25
|
* windows, as the vector tiles' buildings do: glass by day, some lit at night. Their faces near vertical are walls,
|
|
14
26
|
* bays of 3 metres along them and floors of 3.2 metres from the ellipsoid (a mesh tells neither foot nor top) */
|
|
@@ -16,6 +28,12 @@ export declare class Tiles3dLayer extends Layer {
|
|
|
16
28
|
/** A raster layer draped on its meshes, its roofs by default (see `Drape`); undefined: none */
|
|
17
29
|
setDrape(drape: Drape | undefined): void;
|
|
18
30
|
setStyle(style: Partial<Tiles3dStyle>): void;
|
|
31
|
+
/**
|
|
32
|
+
* The first feature of the tiles drawn whose properties `matches` takes (its ID, its attributes), the finest tiles
|
|
33
|
+
* first: a feature framed and loaded (`fitBounds`, `refine`) found in them, to show or color (`featureColor`);
|
|
34
|
+
* undefined if none drawn has it
|
|
35
|
+
*/
|
|
36
|
+
find(matches: (properties: Record<string, unknown>) => boolean): Feature<Record<string, unknown>> | undefined;
|
|
19
37
|
/** Loading counters; undefined once the layer is removed, and while the map waits for a new engine (the GPU lost) */
|
|
20
38
|
stats(): Tiles3dStats | undefined;
|
|
21
39
|
private applyStyle;
|
package/dist/layers/tiles3d.js
CHANGED
|
@@ -43,6 +43,35 @@ export class Tiles3dLayer extends Layer {
|
|
|
43
43
|
this.facades = facades;
|
|
44
44
|
this.drape = drape;
|
|
45
45
|
}
|
|
46
|
+
/** The box loaded to its finest tiles (`refine`): west, south, east, north, bottom, top */
|
|
47
|
+
focus = [];
|
|
48
|
+
/**
|
|
49
|
+
* Loads the tiles meeting a box to their finest level, before the others and whether the box is in view or not (a
|
|
50
|
+
* feature framed to be found in them: its finest geometry, its ID); resolved once they are all there. The box stays
|
|
51
|
+
* so until another one, or `refine(undefined)`. `box`: as `fitBounds` takes it, altitudes in metres above the
|
|
52
|
+
* ellipsoid; `timeout` (ms, default 30 s): rejected past it
|
|
53
|
+
*/
|
|
54
|
+
async refine(box, { timeout = 30_000 } = {}) {
|
|
55
|
+
const { bounds, bottom = -1e4, top = 1e4 } = !box || Array.isArray(box) ? { bounds: box } : box;
|
|
56
|
+
this.focus = bounds ? [...bounds, Math.min(bottom, top), Math.max(bottom, top)] : [];
|
|
57
|
+
if (this.id >= 0)
|
|
58
|
+
this.map.engine.setTiles3dFocus(this.id, Float64Array.from(this.focus));
|
|
59
|
+
this.map.requestRender();
|
|
60
|
+
if (!bounds)
|
|
61
|
+
return;
|
|
62
|
+
const focus = this.focus;
|
|
63
|
+
const until = performance.now() + timeout;
|
|
64
|
+
// Its tiles counted by the frames drawn with the box (undefined before), the box still this one
|
|
65
|
+
while (this.focus === focus) {
|
|
66
|
+
const pending = this.id < 0 ? undefined : this.map.engine.tiles3dFocusPending(this.id);
|
|
67
|
+
if (pending === 0)
|
|
68
|
+
return;
|
|
69
|
+
if (performance.now() >= until)
|
|
70
|
+
throw new Error("isard: the box's tiles were not loaded in time");
|
|
71
|
+
this.map.requestRender();
|
|
72
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
46
75
|
/** Whether the walls of its untextured meshes (buildings without their photos, as the IGN's Bâtiments 3D) show
|
|
47
76
|
* windows, as the vector tiles' buildings do: glass by day, some lit at night. Their faces near vertical are walls,
|
|
48
77
|
* bays of 3 metres along them and floors of 3.2 metres from the ellipsoid (a mesh tells neither foot nor top) */
|
|
@@ -85,6 +114,20 @@ export class Tiles3dLayer extends Layer {
|
|
|
85
114
|
const [properties, feature] = hit;
|
|
86
115
|
return { type: 'Feature', id: feature, properties: properties ?? {}, geometry: null };
|
|
87
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* The first feature of the tiles drawn whose properties `matches` takes (its ID, its attributes), the finest tiles
|
|
119
|
+
* first: a feature framed and loaded (`fitBounds`, `refine`) found in them, to show or color (`featureColor`);
|
|
120
|
+
* undefined if none drawn has it
|
|
121
|
+
*/
|
|
122
|
+
find(matches) {
|
|
123
|
+
if (this.id < 0)
|
|
124
|
+
return undefined;
|
|
125
|
+
const hit = this.map.engine.tiles3dFind(this.id, matches);
|
|
126
|
+
if (!hit)
|
|
127
|
+
return undefined;
|
|
128
|
+
const [properties, feature] = hit;
|
|
129
|
+
return { type: 'Feature', id: feature, properties, geometry: null };
|
|
130
|
+
}
|
|
88
131
|
/** Loading counters; undefined once the layer is removed, and while the map waits for a new engine (the GPU lost) */
|
|
89
132
|
stats() {
|
|
90
133
|
return this.id < 0 ? undefined : this.map.engine.tiles3dStats(this.id);
|
|
@@ -95,6 +138,7 @@ export class Tiles3dLayer extends Layer {
|
|
|
95
138
|
this.applyStyle(engine, id);
|
|
96
139
|
this.applyFeatureColor(engine, id);
|
|
97
140
|
engine.setTiles3dFacades(id, this.facades);
|
|
141
|
+
engine.setTiles3dFocus(id, Float64Array.from(this.focus));
|
|
98
142
|
// A raster created before (on a new engine, the map relinks once every layer is there)
|
|
99
143
|
sendDrape(engine, id, this.drape);
|
|
100
144
|
return id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiles3d.js","sourceRoot":"","sources":["../../src/layers/tiles3d.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,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AAM,CAAC,uBAAuB,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxF,CAAC;CACF","sourcesContent":["/** A 3D Tiles tileset as a layer: its style, its features picked */\n\nimport { rgb } from '../settings.ts';\nimport type { Drape, FeatureColor, LayerHost, Tiles3dStyle } from '../types.ts';\nimport { parseColor } from '../util/color.ts';\nimport type { Engine, Tiles3dStats } from '../wasm/isard_webgpu.js';\nimport type { Feature } from './features.ts';\nimport { Layer } from './layers.ts';\nimport { sendDrape } from './raster.ts';\n\n/**\n * The engine's colors of a tile's features from a `featureColor`: RGBA bytes for each (alpha 0: the layer's color),\n * the CSS colors parsed once each\n */\nconst featureColors = (color: FeatureColor) => {\n const parsed = new Map<string, number[]>();\n const bytesOf = (css: string) => {\n const known = parsed.get(css);\n\n if (known) return known;\n\n const [r, g, b] = parseColor(css);\n const made = [r, g, b].map((c) => Math.round(c * 255)).concat(255);\n\n parsed.set(css, made);\n\n return made;\n };\n\n return (properties: Record<string, unknown>[] | undefined, count: number): Uint8Array => {\n const rgba = new Uint8Array(count * 4);\n\n Array.from({ length: count }, (_, i) => color(properties?.[i] ?? {}, i)).forEach((css, i) => {\n if (css) rgba.set(bytesOf(css), i * 4);\n });\n\n return rgba;\n };\n};\n\n/** Textured meshes in 3D Tiles */\nexport class Tiles3dLayer extends Layer {\n /** @internal */\n constructor(\n map: LayerHost,\n private readonly url: string,\n private readonly geoid: boolean,\n private style: Tiles3dStyle,\n private facades = false,\n private drape: Drape | undefined = undefined,\n ) {\n super(map);\n }\n\n /** Whether the walls of its untextured meshes (buildings without their photos, as the IGN's Bâtiments 3D) show\n * windows, as the vector tiles' buildings do: glass by day, some lit at night. Their faces near vertical are walls,\n * bays of 3 metres along them and floors of 3.2 metres from the ellipsoid (a mesh tells neither foot nor top) */\n setFacades(facades: boolean): void {\n this.facades = facades;\n // Kept for its creation in a new engine (the GPU lost and given back), none while it has no id\n if (this.id < 0) return;\n this.map.engine.setTiles3dFacades(this.id, facades);\n this.map.requestRender();\n }\n\n /** A raster layer draped on its meshes, its roofs by default (see `Drape`); undefined: none */\n setDrape(drape: Drape | undefined): void {\n this.drape = drape;\n // Kept for its creation in a new engine (the GPU lost and given back), none while it has no id\n if (this.id < 0) return;\n sendDrape(this.map.engine, this.id, drape);\n this.map.requestRender();\n }\n\n setStyle(style: Partial<Tiles3dStyle>): void {\n this.style = { ...this.style, ...style };\n // Kept for its creation in a new engine (the GPU lost and given back), none while it has no id\n if (this.id < 0) return;\n this.applyStyle(this.map.engine, this.id);\n // The features colored again only when their function changed: every tile asks for its colors then\n if ('featureColor' in style) this.applyFeatureColor(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n /** @internal The feature picked (`pickFeature`, 'hoverfeature'): the properties of its feature in the tile\n * (`EXT_structural_metadata`, a b3dm batch table), none for a mesh without features; its index in the tile as id */\n featureAt(index: number): Feature<Record<string, unknown>> | undefined {\n if (this.id < 0) return undefined;\n\n const hit = this.map.engine.tiles3dFeature(this.id, index);\n\n if (!hit) return undefined;\n\n const [properties, feature] = hit;\n\n return { type: 'Feature', id: feature, properties: properties ?? {}, geometry: null };\n }\n\n /** Loading counters; undefined once the layer is removed, and while the map waits for a new engine (the GPU lost) */\n stats(): Tiles3dStats | undefined {\n return this.id < 0 ? undefined : this.map.engine.tiles3dStats(this.id);\n }\n\n /** @internal */\n protected create(engine: Engine): number {\n const id = engine.addTiles3d(this.url, this.style.maxScreenSpaceError * this.map.quality.errorScale, this.geoid);\n\n this.applyStyle(engine, id);\n this.applyFeatureColor(engine, id);\n engine.setTiles3dFacades(id, this.facades);\n // A raster created before (on a new engine, the map relinks once every layer is there)\n sendDrape(engine, id, this.drape);\n\n return id;\n }\n\n /** @internal On a new engine, the raster may come after the tiles: draped once both are there */\n override relink(engine: Engine): void {\n sendDrape(engine, this.id, this.drape);\n }\n\n /** @internal */\n override qualityChanged(): void {\n if (this.id >= 0) this.applyStyle(this.map.engine, this.id);\n }\n\n private applyStyle(engine: Engine, id: number): void {\n const { maxScreenSpaceError, opacity, pointSize, color } = this.style;\n // Coarser far away at a lower quality\n const error = maxScreenSpaceError * this.map.quality.errorScale;\n\n engine.setTiles3dStyle(id, error, opacity, pointSize, new Float32Array(color ? rgb(color) : []));\n }\n\n private applyFeatureColor(engine: Engine, id: number): void {\n const { featureColor } = this.style;\n\n engine.setTiles3dFeatureColors(id, featureColor ? featureColors(featureColor) : null);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tiles3d.js","sourceRoot":"","sources":["../../src/layers/tiles3d.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;GAGG;AACH,MAAM,aAAa,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC5C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC3C,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE;QAC9B,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE9B,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;QAExB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAEnE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAA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;IACnG,CAAC;IAEO,iBAAiB,CAAC,MAAc,EAAE,EAAU;QAClD,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAEpC,MAAM,CAAC,uBAAuB,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxF,CAAC;CACF","sourcesContent":["/** A 3D Tiles tileset as a layer: its style, its features picked */\n\nimport { rgb } from '../settings.ts';\nimport type { Drape, FeatureColor, FitBox, LayerHost, Tiles3dStyle } from '../types.ts';\nimport { parseColor } from '../util/color.ts';\nimport type { Engine, Tiles3dStats } from '../wasm/isard_webgpu.js';\nimport type { Feature } from './features.ts';\nimport { Layer } from './layers.ts';\nimport { sendDrape } from './raster.ts';\n\n/**\n * The engine's colors of a tile's features from a `featureColor`: RGBA bytes for each (alpha 0: the layer's color),\n * the CSS colors parsed once each\n */\nconst featureColors = (color: FeatureColor) => {\n const parsed = new Map<string, number[]>();\n const bytesOf = (css: string) => {\n const known = parsed.get(css);\n\n if (known) return known;\n\n const [r, g, b] = parseColor(css);\n const made = [r, g, b].map((c) => Math.round(c * 255)).concat(255);\n\n parsed.set(css, made);\n\n return made;\n };\n\n return (properties: Record<string, unknown>[] | undefined, count: number): Uint8Array => {\n const rgba = new Uint8Array(count * 4);\n\n Array.from({ length: count }, (_, i) => color(properties?.[i] ?? {}, i)).forEach((css, i) => {\n if (css) rgba.set(bytesOf(css), i * 4);\n });\n\n return rgba;\n };\n};\n\n/** Textured meshes in 3D Tiles */\nexport class Tiles3dLayer extends Layer {\n /** @internal */\n constructor(\n map: LayerHost,\n private readonly url: string,\n private readonly geoid: boolean,\n private style: Tiles3dStyle,\n private facades = false,\n private drape: Drape | undefined = undefined,\n ) {\n super(map);\n }\n\n /** The box loaded to its finest tiles (`refine`): west, south, east, north, bottom, top */\n private focus: number[] = [];\n\n /**\n * Loads the tiles meeting a box to their finest level, before the others and whether the box is in view or not (a\n * feature framed to be found in them: its finest geometry, its ID); resolved once they are all there. The box stays\n * so until another one, or `refine(undefined)`. `box`: as `fitBounds` takes it, altitudes in metres above the\n * ellipsoid; `timeout` (ms, default 30 s): rejected past it\n */\n async refine(box: FitBox | FitBox['bounds'] | undefined, { timeout = 30_000 } = {}): Promise<void> {\n const { bounds, bottom = -1e4, top = 1e4 } = !box || Array.isArray(box) ? { bounds: box } : box;\n\n this.focus = bounds ? [...bounds, Math.min(bottom, top), Math.max(bottom, top)] : [];\n if (this.id >= 0) this.map.engine.setTiles3dFocus(this.id, Float64Array.from(this.focus));\n this.map.requestRender();\n if (!bounds) return;\n\n const focus = this.focus;\n const until = performance.now() + timeout;\n\n // Its tiles counted by the frames drawn with the box (undefined before), the box still this one\n while (this.focus === focus) {\n const pending = this.id < 0 ? undefined : this.map.engine.tiles3dFocusPending(this.id);\n\n if (pending === 0) return;\n if (performance.now() >= until) throw new Error(\"isard: the box's tiles were not loaded in time\");\n this.map.requestRender();\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n }\n\n /** Whether the walls of its untextured meshes (buildings without their photos, as the IGN's Bâtiments 3D) show\n * windows, as the vector tiles' buildings do: glass by day, some lit at night. Their faces near vertical are walls,\n * bays of 3 metres along them and floors of 3.2 metres from the ellipsoid (a mesh tells neither foot nor top) */\n setFacades(facades: boolean): void {\n this.facades = facades;\n // Kept for its creation in a new engine (the GPU lost and given back), none while it has no id\n if (this.id < 0) return;\n this.map.engine.setTiles3dFacades(this.id, facades);\n this.map.requestRender();\n }\n\n /** A raster layer draped on its meshes, its roofs by default (see `Drape`); undefined: none */\n setDrape(drape: Drape | undefined): void {\n this.drape = drape;\n // Kept for its creation in a new engine (the GPU lost and given back), none while it has no id\n if (this.id < 0) return;\n sendDrape(this.map.engine, this.id, drape);\n this.map.requestRender();\n }\n\n setStyle(style: Partial<Tiles3dStyle>): void {\n this.style = { ...this.style, ...style };\n // Kept for its creation in a new engine (the GPU lost and given back), none while it has no id\n if (this.id < 0) return;\n this.applyStyle(this.map.engine, this.id);\n // The features colored again only when their function changed: every tile asks for its colors then\n if ('featureColor' in style) this.applyFeatureColor(this.map.engine, this.id);\n this.map.requestRender();\n }\n\n /** @internal The feature picked (`pickFeature`, 'hoverfeature'): the properties of its feature in the tile\n * (`EXT_structural_metadata`, a b3dm batch table), none for a mesh without features; its index in the tile as id */\n featureAt(index: number): Feature<Record<string, unknown>> | undefined {\n if (this.id < 0) return undefined;\n\n const hit = this.map.engine.tiles3dFeature(this.id, index);\n\n if (!hit) return undefined;\n\n const [properties, feature] = hit;\n\n return { type: 'Feature', id: feature, properties: properties ?? {}, geometry: null };\n }\n\n /**\n * The first feature of the tiles drawn whose properties `matches` takes (its ID, its attributes), the finest tiles\n * first: a feature framed and loaded (`fitBounds`, `refine`) found in them, to show or color (`featureColor`);\n * undefined if none drawn has it\n */\n find(matches: (properties: Record<string, unknown>) => boolean): Feature<Record<string, unknown>> | undefined {\n if (this.id < 0) return undefined;\n\n const hit = this.map.engine.tiles3dFind(this.id, matches);\n\n if (!hit) return undefined;\n\n const [properties, feature] = hit;\n\n return { type: 'Feature', id: feature, properties, geometry: null };\n }\n\n /** Loading counters; undefined once the layer is removed, and while the map waits for a new engine (the GPU lost) */\n stats(): Tiles3dStats | undefined {\n return this.id < 0 ? undefined : this.map.engine.tiles3dStats(this.id);\n }\n\n /** @internal */\n protected create(engine: Engine): number {\n const id = engine.addTiles3d(this.url, this.style.maxScreenSpaceError * this.map.quality.errorScale, this.geoid);\n\n this.applyStyle(engine, id);\n this.applyFeatureColor(engine, id);\n engine.setTiles3dFacades(id, this.facades);\n engine.setTiles3dFocus(id, Float64Array.from(this.focus));\n // A raster created before (on a new engine, the map relinks once every layer is there)\n sendDrape(engine, id, this.drape);\n\n return id;\n }\n\n /** @internal On a new engine, the raster may come after the tiles: draped once both are there */\n override relink(engine: Engine): void {\n sendDrape(engine, this.id, this.drape);\n }\n\n /** @internal */\n override qualityChanged(): void {\n if (this.id >= 0) this.applyStyle(this.map.engine, this.id);\n }\n\n private applyStyle(engine: Engine, id: number): void {\n const { maxScreenSpaceError, opacity, pointSize, color } = this.style;\n // Coarser far away at a lower quality\n const error = maxScreenSpaceError * this.map.quality.errorScale;\n\n engine.setTiles3dStyle(id, error, opacity, pointSize, new Float32Array(color ? rgb(color) : []));\n }\n\n private applyFeatureColor(engine: Engine, id: number): void {\n const { featureColor } = this.style;\n\n engine.setTiles3dFeatureColors(id, featureColor ? featureColors(featureColor) : null);\n }\n}\n"]}
|
package/dist/map.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ import { Tiles3dLayer } from './layers/tiles3d.ts';
|
|
|
26
26
|
import { type TreeOptions } from './layers/trees.ts';
|
|
27
27
|
import { type HoverPicking } from './map/hover-pick.ts';
|
|
28
28
|
import { type LayerSpec } from './map/layer-spec.ts';
|
|
29
|
-
import type { AnimationOptions, AtmosphereOptions, Basemap, ClipVolume, FeatureHit, FirstPersonView, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, MapGpuTimings, MapMemory, NetworkOptions, PickOptions, Point, Projection, Quality, RasterOptions, SunOptions, SwipeOptions, TerrainModel, TerrainOptions, Tiles3dOptions, ViewshedOptions } from './types.ts';
|
|
29
|
+
import type { AnimationOptions, AtmosphereOptions, Basemap, ClipVolume, FeatureHit, FirstPersonView, FitBoundsOptions, FitBox, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, MapGpuTimings, MapMemory, NetworkOptions, PickOptions, Point, Projection, Quality, RasterOptions, SunOptions, SwipeOptions, TerrainModel, TerrainOptions, Tiles3dOptions, ViewshedOptions } from './types.ts';
|
|
30
30
|
import { type Control, type ControlPosition } from './ui/controls.ts';
|
|
31
31
|
import type { Camera, PickHit, RasterLayerStats } from './wasm/isard_webgpu.js';
|
|
32
32
|
export type { LayerSpec } from './map/layer-spec.ts';
|
|
@@ -158,6 +158,16 @@ export declare class GeoMap {
|
|
|
158
158
|
* `flyTo`): long moves stay readable. Pitch and bearing follow the progress.
|
|
159
159
|
*/
|
|
160
160
|
flyTo(camera: Partial<Camera>, options?: FlyToOptions): void;
|
|
161
|
+
/**
|
|
162
|
+
* Moves the camera to frame a box: a ground box (`[west, south, east, north]`), or a box in space (a building, a
|
|
163
|
+
* pipe underground: `{ bounds, bottom, top }`, altitudes in metres), all its corners within the canvas less the
|
|
164
|
+
* padding, at the pitch and bearing given (default the current ones); an ease, a flight with `fly`, a jump with
|
|
165
|
+
* `duration: 0`
|
|
166
|
+
*/
|
|
167
|
+
fitBounds(box: FitBox | FitBox['bounds'], options?: FitBoundsOptions): void;
|
|
168
|
+
/** Height of the RAF20 geoid above the ellipsoid at a position (metres; 0 away from mainland France): what turns an
|
|
169
|
+
* altitude (NGF-IGN69: the BD TOPO's, the RGE ALTI's) into a height above the ellipsoid (`fitBounds`, `refine`) */
|
|
170
|
+
geoidHeight([lon, lat]: LonLat): number;
|
|
161
171
|
/** Longitudes and latitudes the view covers on the ground: `[west, south, east, north]` */
|
|
162
172
|
getBounds(): [west: number, south: number, east: number, north: number];
|
|
163
173
|
/** Lowest zoom the camera accepts (the widest view) */
|
package/dist/map.js
CHANGED
|
@@ -521,6 +521,35 @@ export class GeoMap {
|
|
|
521
521
|
this.animate(flyTo(() => this.engine, from, to, viewport, options));
|
|
522
522
|
this.engine.preload(to.center[0], to.center[1], to.zoom, to.pitch, to.bearing);
|
|
523
523
|
}
|
|
524
|
+
/**
|
|
525
|
+
* Moves the camera to frame a box: a ground box (`[west, south, east, north]`), or a box in space (a building, a
|
|
526
|
+
* pipe underground: `{ bounds, bottom, top }`, altitudes in metres), all its corners within the canvas less the
|
|
527
|
+
* padding, at the pitch and bearing given (default the current ones); an ease, a flight with `fly`, a jump with
|
|
528
|
+
* `duration: 0`
|
|
529
|
+
*/
|
|
530
|
+
fitBounds(box, options = {}) {
|
|
531
|
+
const { bounds, bottom = 0, top = bottom } = Array.isArray(box) ? { bounds: box } : box;
|
|
532
|
+
const current = this.getCamera();
|
|
533
|
+
const room = options.padding ?? 40;
|
|
534
|
+
const padding = typeof room === 'number'
|
|
535
|
+
? [room, room, room, room]
|
|
536
|
+
: [room.top ?? 0, room.right ?? 0, room.bottom ?? 0, room.left ?? 0];
|
|
537
|
+
const camera = this.engine.fitCamera(Float64Array.from(bounds), bottom, top, Float64Array.from(padding), options.pitch ?? current.pitch, options.bearing ?? current.bearing);
|
|
538
|
+
if (!camera)
|
|
539
|
+
throw new Error('isard: fitBounds needs a box, west not past east nor south past north');
|
|
540
|
+
const to = { ...camera, zoom: Math.min(camera.zoom, options.maxZoom ?? Number.POSITIVE_INFINITY) };
|
|
541
|
+
if (options.duration === 0)
|
|
542
|
+
this.setCamera(to);
|
|
543
|
+
else if (options.fly)
|
|
544
|
+
this.flyTo(to, options);
|
|
545
|
+
else
|
|
546
|
+
this.easeTo(to, { duration: 600, ...options });
|
|
547
|
+
}
|
|
548
|
+
/** Height of the RAF20 geoid above the ellipsoid at a position (metres; 0 away from mainland France): what turns an
|
|
549
|
+
* altitude (NGF-IGN69: the BD TOPO's, the RGE ALTI's) into a height above the ellipsoid (`fitBounds`, `refine`) */
|
|
550
|
+
geoidHeight([lon, lat]) {
|
|
551
|
+
return this.engines.geoidHeight(lon, lat);
|
|
552
|
+
}
|
|
524
553
|
/** Longitudes and latitudes the view covers on the ground: `[west, south, east, north]` */
|
|
525
554
|
getBounds() {
|
|
526
555
|
const [west = -180, south = -85, east = 180, north = 85] = this.engine.bounds();
|