@nika-js/onlymap 0.12.1 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +1 -1
- package/dist/{basemap-BK25o5OE.js → basemap-zG1-omic.js} +473 -443
- package/dist/basemap.d.ts +16 -3
- package/dist/build-Bbi4SleC.js +208 -0
- package/dist/cartograph.js +43 -41
- package/dist/cartograph.standalone.js +3 -1
- package/dist/client-CIH6ToMI.js +6878 -0
- package/dist/{geoparquet-CLydPm2f.js → geoparquet-CyWsYt9S.js} +1 -1
- package/dist/{globe-view-ChuX60M5.js → globe-view-Xelgj_KW.js} +6 -6
- package/dist/{hillshade-DD8WFrvf.js → hillshade-Zbg50lm6.js} +79 -67
- package/dist/hillshade.d.ts +7 -0
- package/dist/html-data.d.ts +1 -1
- package/dist/{index-CgVFHEdM.js → index-6eeSlSqN.js} +3 -3
- package/dist/{index-CMKrghNb.js → index-BL_YCKiW.js} +54 -54
- package/dist/{index-C2CKUsom.js → index-BbVnkgld.js} +38 -38
- package/dist/{index-CvrH6mbS.js → index-BtRsa5oc.js} +3 -3
- package/dist/{index-DIzzRLKr.js → index-BwtXeP_F.js} +1 -1
- package/dist/{index-Dvwr1Y3o.js → index-ClAPAqcm.js} +49 -49
- package/dist/{index-Bs69fn8a.js → index-CpFNIkOO.js} +33429 -30673
- package/dist/{index-CdAf0bLj.js → index-DnCmvLuC.js} +42 -42
- package/dist/index-JFuN4DCn.js +4449 -0
- package/dist/layer-registry.d.ts +1 -0
- package/dist/{lerc-mAijS40k.js → lerc-C3SKC6CU.js} +1 -1
- package/dist/onlymap.standalone.js +60762 -51701
- package/dist/onlymapjs.js +47 -47
- package/dist/plane-gpu/gpu-layer-types.d.ts +35 -0
- package/dist/plane-gpu/plane-basemap.d.ts +10461 -0
- package/dist/plane-gpu/plane-gpu-view.d.ts +90 -0
- package/dist/plane-gpu/projection-params.d.ts +47 -0
- package/dist/plane-layers.d.ts +2 -0
- package/dist/plane-seam.d.ts +48 -0
- package/dist/plane-tileset.d.ts +23 -2
- package/dist/plane-vector/build.d.ts +107 -0
- package/dist/plane-vector/client.d.ts +18 -0
- package/dist/plane-vector/cut-ends-extension.d.ts +30 -0
- package/dist/plane-vector/plane-mvt-layer.d.ts +10412 -0
- package/dist/plane-vector/tile-cut.d.ts +45 -0
- package/dist/plane-vector/worker.d.ts +15 -0
- package/dist/plane-warp.d.ts +12 -1
- package/dist/{post-process-effect-rwFDi8di.js → post-process-effect-C3P9VwC9.js} +11 -11
- package/dist/programmatic.d.ts +6 -0
- package/dist/projection.d.ts +51 -0
- package/dist/{raster-CXIqf83L.js → raster-BgCnz9-Z.js} +3 -3
- package/dist/{raster-pipeline-CfSg2Re7.js → raster-pipeline-CKdpKgFo.js} +1 -1
- package/dist/react/om-map.d.ts +4 -0
- package/dist/react.js +259 -252
- package/dist/runtime-core.d.ts +84 -2
- package/dist/{text-on-path-B08PekFz.js → text-on-path-BpVLX8Yt.js} +74 -66
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-CUn2udOc.js → zarr-Cur_pzNa.js} +2 -2
- package/docs/cartograph.md +2 -2
- package/docs/cartography.md +59 -3
- package/docs/testing.md +2 -1
- package/llms.txt +2 -2
- package/onlymapjs.attributes.json +1 -0
- package/onlymapjs.html-data.json +15 -1
- package/package.json +3 -2
- package/skills/onlymapjs/SKILL.md +2 -2
- package/skills/onlymapjs/references/syntax.md +7 -6
- package/dist/index-BHRpKnGi.js +0 -4883
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU-projection study (docs/design/gpu-projection.md, deliverables 2–3): the
|
|
3
|
+
* deck View/Viewport pair that asks the patched `project` module for its
|
|
4
|
+
* PLANE mode. An orthographic view over plane metres, as the CPU path uses,
|
|
5
|
+
* whose viewport reports projection mode 5 and carries the projection's
|
|
6
|
+
* uniforms (`planeGpu`) for `viewport-uniforms.js` to upload.
|
|
7
|
+
*
|
|
8
|
+
* Deliverable 3 adds the HANDOVER: the shader evaluates the full projection
|
|
9
|
+
* series while an output pixel is coarse, and a second-order expansion about
|
|
10
|
+
* the view centre once the series' float32 error would show. The expansion is
|
|
11
|
+
* computed here, in double, per view and per output resolution.
|
|
12
|
+
*/
|
|
13
|
+
import { OrthographicView, OrthographicViewport } from "@deck.gl/core";
|
|
14
|
+
import type { PlaneGpuUniforms } from "./projection-params";
|
|
15
|
+
import type { PlaneFrame } from "../projection";
|
|
16
|
+
/** `PROJECTION_MODE.PLANE` in the patched constants — deck's own enum stops at 4. */
|
|
17
|
+
export declare const PLANE_PROJECTION_MODE = 5;
|
|
18
|
+
/**
|
|
19
|
+
* Below this many ground metres per OUTPUT pixel the shader switches from the
|
|
20
|
+
* series to the second-order expansion. Deliverable 2 measured the series'
|
|
21
|
+
* float32 error on a real GPU at 1–2.3 m whatever the zoom, for which 8 m
|
|
22
|
+
* would do. Phase 4 measured more for the conics and LAEA on SwiftShader —
|
|
23
|
+
* a few metres, in float32-coordinate steps — which reached the half-pixel
|
|
24
|
+
* tolerance (0.52 px, Albers at Seattle) just above an 8 m handover; 16 m
|
|
25
|
+
* halves that in pixels. Deliverable 1 puts the expansion's own error under a
|
|
26
|
+
* thousandth of a pixel for views up to ~100 km across, which 16 m per output
|
|
27
|
+
* pixel stays inside even for a 600 dpi capture. Output pixels, not CSS
|
|
28
|
+
* pixels: a 600 dpi capture hands over earlier than the screen does.
|
|
29
|
+
*/
|
|
30
|
+
export declare const QUAD_BELOW_METRES_PER_PIXEL = 16;
|
|
31
|
+
type V4 = [number, number, number, number];
|
|
32
|
+
export interface PlaneQuadUniforms {
|
|
33
|
+
planeQuad0: V4;
|
|
34
|
+
planeQuad1: V4;
|
|
35
|
+
planeJ: V4;
|
|
36
|
+
planeHx: V4;
|
|
37
|
+
planeHy: V4;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The second-order expansion of `frame.toPlane` about `centre` (lng/lat,
|
|
41
|
+
* degrees): plane metres ≈ P0 + J·d + ½ dᵀH d, d in degrees. Central
|
|
42
|
+
* differences in double; the steps are chosen so their truncation error is
|
|
43
|
+
* far below the float32 noise the shader adds.
|
|
44
|
+
*/
|
|
45
|
+
export declare function quadraticAbout(frame: PlaneFrame, centre: [number, number]): {
|
|
46
|
+
p0: [number, number];
|
|
47
|
+
J: [[number, number], [number, number]];
|
|
48
|
+
Hx: [number, number, number];
|
|
49
|
+
Hy: [number, number, number];
|
|
50
|
+
};
|
|
51
|
+
export declare class PlaneGpuViewport extends OrthographicViewport {
|
|
52
|
+
planeGpu?: PlaneGpuUniforms;
|
|
53
|
+
planeFrame?: PlaneFrame;
|
|
54
|
+
/** The expansion about this view's centre — a viewport is immutable, so once per viewport. */
|
|
55
|
+
private quadratic?;
|
|
56
|
+
constructor(props: ConstructorParameters<typeof OrthographicViewport>[0] & {
|
|
57
|
+
planeGpu?: PlaneGpuUniforms;
|
|
58
|
+
planeFrame?: PlaneFrame;
|
|
59
|
+
});
|
|
60
|
+
get projectionMode(): number;
|
|
61
|
+
/**
|
|
62
|
+
* lng/lat → the plane, for deck's polygon tessellation (the patched
|
|
63
|
+
* solid-polygon-layer asks the viewport): earcut then sees the shape the
|
|
64
|
+
* shader will draw, and its triangles tile it. Triangulated in lng/lat, a
|
|
65
|
+
* polygon far from the meridian fanned into overlapping and missing
|
|
66
|
+
* triangles. A point the plane cannot place stays NaN: the shader puts its
|
|
67
|
+
* vertex nowhere and the GPU drops the triangles it is in. z rides along.
|
|
68
|
+
*/
|
|
69
|
+
planePreproject(p: number[]): number[];
|
|
70
|
+
/**
|
|
71
|
+
* A plane's coordinates are relative to its origin, the map's centre when it
|
|
72
|
+
* was adopted — so the same camera in two planes is the same orthographic
|
|
73
|
+
* viewport, and deck, seeing no viewport change on a live `crs` switch, never
|
|
74
|
+
* re-selected a tiled layer's tiles (the old plane's set stayed up). Two
|
|
75
|
+
* planes are two viewports.
|
|
76
|
+
*/
|
|
77
|
+
equals(viewport: Parameters<OrthographicViewport["equals"]>[0]): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Called by the patched `viewport-uniforms.js` for every draw. `origin32` is
|
|
80
|
+
* the float32 coordinate origin the shader subtracts; the expansion's
|
|
81
|
+
* constant term is expressed relative to it, in double, so the shader adds
|
|
82
|
+
* small numbers only.
|
|
83
|
+
*/
|
|
84
|
+
planeQuadUniforms(origin32: number[], devicePixelRatio: number): PlaneQuadUniforms;
|
|
85
|
+
}
|
|
86
|
+
export declare class PlaneGpuView extends OrthographicView {
|
|
87
|
+
static displayName: string;
|
|
88
|
+
getViewportType(): typeof OrthographicViewport;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU projection (docs/design/gpu-projection.md): the uniforms a CRS hands the
|
|
3
|
+
* patched `project` shader — its projection's constants and the
|
|
4
|
+
* seven-parameter datum step, computed once in double from the CRS's
|
|
5
|
+
* `+proj=` definition, mirroring proj4js's own init code.
|
|
6
|
+
*
|
|
7
|
+
* Four families, each a transcription of proj4js in the shader: Transverse
|
|
8
|
+
* Mercator (`tmerc`, and `utm` as the Transverse Mercator its zone fixes),
|
|
9
|
+
* Albers (`aea`), Lambert Conformal Conic (`lcc`) and Lambert Azimuthal
|
|
10
|
+
* Equal Area (`laea`, ellipsoidal). On the Airy, Bessel, International, GRS80
|
|
11
|
+
* or WGS84 ellipsoid, or `+datum=WGS84`/`NAD83`, with no datum step or a
|
|
12
|
+
* seven-parameter `+towgs84`. Anything else returns null and the map keeps
|
|
13
|
+
* its CPU path.
|
|
14
|
+
*/
|
|
15
|
+
type V4 = [number, number, number, number];
|
|
16
|
+
/** What each slot carries per family is written out where the shader reads it (gen-deck-patch.mjs, PROJECTION). */
|
|
17
|
+
export interface PlaneGpuUniforms {
|
|
18
|
+
planeP0: V4;
|
|
19
|
+
planeP1: V4;
|
|
20
|
+
planeP2: V4;
|
|
21
|
+
planeP3: V4;
|
|
22
|
+
planeP4: V4;
|
|
23
|
+
planeP5: V4;
|
|
24
|
+
planeHelmert0: V4;
|
|
25
|
+
planeHelmert1: V4;
|
|
26
|
+
planeOrigin: V4;
|
|
27
|
+
}
|
|
28
|
+
/** The etmerc constants a `+proj=` definition gives the shader, or null when it gives none. */
|
|
29
|
+
export declare function definitionConstants(def: string): ReturnType<typeof tmercConstants> | null;
|
|
30
|
+
/** proj4js etmerc constants for a definition, in double. */
|
|
31
|
+
declare function tmercConstants(p: Record<string, string>, a: number, es: number): {
|
|
32
|
+
a: number;
|
|
33
|
+
es: number;
|
|
34
|
+
cbg: number[];
|
|
35
|
+
gtu: number[];
|
|
36
|
+
Qn: number;
|
|
37
|
+
Zb: number;
|
|
38
|
+
long0: number;
|
|
39
|
+
x0: number;
|
|
40
|
+
y0: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The shader uniforms for a CRS definition and the plane's absolute origin,
|
|
44
|
+
* or null when the definition is outside what the shader implements.
|
|
45
|
+
*/
|
|
46
|
+
export declare function planeGpuUniforms(def: string, origin: [number, number]): PlaneGpuUniforms | null;
|
|
47
|
+
export {};
|
package/dist/plane-layers.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export declare const SPATIAL_INDEX_NAME_PATTERN: RegExp;
|
|
|
52
52
|
export declare function projectData(data: unknown, plane: PlaneFrame): unknown;
|
|
53
53
|
/** Positional accessor props on a resolved prop bag, wrapped for the plane. */
|
|
54
54
|
export declare function projectProps(props: Record<string, unknown>, plane: PlaneFrame): Record<string, unknown>;
|
|
55
|
+
/** What makes one plane different from another, for a trigger: its projection and its origin. */
|
|
56
|
+
export declare function planeKey(plane: PlaneFrame): string;
|
|
55
57
|
/** Which spatial-index accessors a resolved prop bag uses — empty for every layer that can draw in a plane. */
|
|
56
58
|
export declare function spatialIndexPropsUsed(props: Record<string, unknown>): string[];
|
|
57
59
|
/**
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cutting GeoJSON at a projection's SEAM, before it is drawn on a plane.
|
|
3
|
+
*
|
|
4
|
+
* A conic (Albers, Lambert Conformal Conic) is a cone cut open along the
|
|
5
|
+
* meridian opposite its central one; a Transverse Mercator wraps there too.
|
|
6
|
+
* Every point still has a place, but a segment that crosses that meridian is
|
|
7
|
+
* drawn as a straight chord across the whole sheet — on an Albers CONUS map,
|
|
8
|
+
* Russia came out as a wedge over Hudson Bay and the Arctic (the countries
|
|
9
|
+
* layer), by the shader and by the CPU path alike, since each draws straight
|
|
10
|
+
* lines between consecutive vertices. So a polygon or line that crosses the
|
|
11
|
+
* seam is cut there first, the way an antimeridian cut works, with the seam
|
|
12
|
+
* standing in for ±180°: each piece then lies on one side of the cone.
|
|
13
|
+
*
|
|
14
|
+
* The seam is a function of the plane's definition alone (its `lon_0`), so
|
|
15
|
+
* this is memoised per data object and seam: two planes with the same central
|
|
16
|
+
* meridian share one result, and a feature that does not reach the seam —
|
|
17
|
+
* nearly every feature of a regional map — is never touched. The cut feature
|
|
18
|
+
* keeps its place in the array and its properties (a Polygon becomes a
|
|
19
|
+
* MultiPolygon of its pieces), so picking and accessors see the same row.
|
|
20
|
+
*
|
|
21
|
+
* Data deck walks itself (GeoJSON features) is cut in place. Geometry reached
|
|
22
|
+
* through a positional accessor over flat rows (`get-polygon="$polygon"` on a
|
|
23
|
+
* CSV) is cut too: deck takes ONE polygon or path per row, so a row that
|
|
24
|
+
* crosses becomes one row per piece — a copy of the row carrying its piece
|
|
25
|
+
* under a hidden key, every field intact for colours, popups and picks — and
|
|
26
|
+
* the accessor is wrapped once to read the piece first. Rows that do not
|
|
27
|
+
* cross are the same objects, in the same array when none does.
|
|
28
|
+
*/
|
|
29
|
+
import type { PlaneFrame } from "./projection";
|
|
30
|
+
/** The longitude of a plane's seam, or null where the projection has no meridian seam this cut knows (LAEA, a registered function, WKT). */
|
|
31
|
+
export declare function seamOf(plane: PlaneFrame): number | null;
|
|
32
|
+
/** `data` with every polygon and line that crosses the plane's seam cut there; `data` itself when nothing does. */
|
|
33
|
+
export declare function cutAtSeam(data: unknown, plane: PlaneFrame): unknown;
|
|
34
|
+
/**
|
|
35
|
+
* `data` (an array of rows) and `props` with every row whose polygon or path
|
|
36
|
+
* crosses the seam expanded into one row per piece, the accessor reading the
|
|
37
|
+
* piece. Memoised per data, accessor and seam; `data` itself when no row
|
|
38
|
+
* crosses.
|
|
39
|
+
*/
|
|
40
|
+
export declare function cutRowsAtSeam(data: unknown, props: Record<string, unknown>, plane: PlaneFrame): {
|
|
41
|
+
data: unknown;
|
|
42
|
+
props: Record<string, unknown>;
|
|
43
|
+
};
|
|
44
|
+
/** Whichever a layer has: GeoJSON features deck walks, or rows read through a positional accessor. */
|
|
45
|
+
export declare function cutLayerAtSeam(data: unknown, props: Record<string, unknown>, plane: PlaneFrame): {
|
|
46
|
+
data: unknown;
|
|
47
|
+
props: Record<string, unknown>;
|
|
48
|
+
};
|
package/dist/plane-tileset.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* parent-tile fallback while children load — is inherited untouched.
|
|
14
14
|
*/
|
|
15
15
|
import { _Tileset2D as Tileset2D } from "@deck.gl/geo-layers";
|
|
16
|
-
import type
|
|
16
|
+
import { type PlaneFrame } from "./projection";
|
|
17
17
|
interface OrthographicLike {
|
|
18
18
|
/** The plane zoom deck was given — `scale` is 2^zoom, so this is the same fact said once. */
|
|
19
19
|
zoom: number;
|
|
@@ -27,5 +27,26 @@ interface OrthographicLike {
|
|
|
27
27
|
* question about metres per pixel, and the plane's own zoom is in plane units.
|
|
28
28
|
*/
|
|
29
29
|
export declare function tileZoomForPlane(viewport: OrthographicLike, frame: PlaneFrame, latitude: number, tileSize?: number): number;
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* The plane a tiled layer's tileset selects for, re-pointable under a live
|
|
32
|
+
* tileset. deck builds a TileLayer's tileset ONCE and keeps it for the
|
|
33
|
+
* layer's life — a different `TilesetClass` on a later render is ignored
|
|
34
|
+
* (deck 9.3.5 `TileLayer.updateState` only calls `setOptions`) — so a live
|
|
35
|
+
* `crs` switch cannot hand deck a new class. It re-points the binding: the
|
|
36
|
+
* tileset selects in the new plane, and culls every tile, cached ones
|
|
37
|
+
* included, by its extent in it. Tile content — Mercator images, lng/lat
|
|
38
|
+
* vectors — does not depend on the plane, so nothing is refetched.
|
|
39
|
+
*
|
|
40
|
+
* Bound by closure rather than by option because deck constructs the class
|
|
41
|
+
* itself (`new this.props.TilesetClass(...)`) and passes only its own options.
|
|
42
|
+
* One binding per layer, so the class keeps one identity for the layer's life.
|
|
43
|
+
*/
|
|
44
|
+
export declare class PlaneTilesetBinding {
|
|
45
|
+
frame: PlaneFrame;
|
|
46
|
+
readonly TilesetClass: typeof Tileset2D;
|
|
47
|
+
constructor(frame: PlaneFrame);
|
|
48
|
+
setFrame(frame: PlaneFrame): void;
|
|
49
|
+
/** A layer's binding re-pointed at `frame`, made on its first render: what each tiled layer keeps for its life. */
|
|
50
|
+
static bind(binding: PlaneTilesetBinding | undefined, frame: PlaneFrame): PlaneTilesetBinding;
|
|
51
|
+
}
|
|
31
52
|
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export interface TileIndex {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
z: number;
|
|
5
|
+
}
|
|
6
|
+
/** lng/lat → origin-relative plane coordinates; non-finite where the projection cannot place the point. */
|
|
7
|
+
export type Project = (lng: number, lat: number) => [number, number];
|
|
8
|
+
/** Origin-relative plane coordinates → lng/lat: the projection's inverse, which says where `project` is faithful. */
|
|
9
|
+
export type Unproject = (x: number, y: number) => ArrayLike<number>;
|
|
10
|
+
/** The tile's projection, made safe to draw from — see `tileProjection`. */
|
|
11
|
+
export interface TileProjection {
|
|
12
|
+
project: Project;
|
|
13
|
+
/** Whether the projection's image TEARS between two points of the tile — null where the tile shows no tear at all. */
|
|
14
|
+
tears: ((a: P, b: P, pa: number[], pb: number[]) => boolean) | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The plane projection for one tile, with the two ways a projection's image
|
|
18
|
+
* goes wrong past its domain made visible:
|
|
19
|
+
*
|
|
20
|
+
* - UNFAITHFUL points (NaN): a point that does not come back where it started
|
|
21
|
+
* (projection.ts, `placesFaithfully`) — where the far side of the world
|
|
22
|
+
* would land, finite, on the near one.
|
|
23
|
+
* - TEARS: the image jumps between two neighbouring points. Past 90° from its
|
|
24
|
+
* meridian a Transverse Mercator splits along the equator and runs to
|
|
25
|
+
* infinity near ±90°; a polygon with vertices on both sides of the split
|
|
26
|
+
* drew triangles thousands of kilometres across — a Pacific tile's ocean
|
|
27
|
+
* covered Canada on a BNG map at zoom 2.5.
|
|
28
|
+
*
|
|
29
|
+
* Both cost something only near a domain edge: a tile whose 9×9 sample grid
|
|
30
|
+
* comes back faithfully, with no grid step out of all proportion to the rest,
|
|
31
|
+
* keeps the plain projection and no tear test.
|
|
32
|
+
*/
|
|
33
|
+
export declare function tileProjection(project: Project, unproject: Unproject | undefined, index: TileIndex): TileProjection;
|
|
34
|
+
/** One line style class, as data, so the worker can sort and group without a function crossing to it. */
|
|
35
|
+
export interface LineRule {
|
|
36
|
+
layer: string;
|
|
37
|
+
classes?: string[];
|
|
38
|
+
/** Skip maritime boundaries. */
|
|
39
|
+
notMaritime?: boolean;
|
|
40
|
+
/** Keep only `admin_level` at or below this. */
|
|
41
|
+
adminLevelMax?: number;
|
|
42
|
+
rank: number;
|
|
43
|
+
/** Also drawn in the casings collection, under every line. */
|
|
44
|
+
casing?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** A basemap's selection and draw order: fills by layer, lines by rule. Without it, every feature draws in source order. */
|
|
47
|
+
export interface Classify {
|
|
48
|
+
fillRank: Record<string, number>;
|
|
49
|
+
lineRules: LineRule[];
|
|
50
|
+
}
|
|
51
|
+
export interface BuildOptions {
|
|
52
|
+
/** MVT layers to decode; all when absent. */
|
|
53
|
+
layers?: string[];
|
|
54
|
+
/** Build polygon outlines (a layer that is not stroked does not need them). */
|
|
55
|
+
outlines?: boolean;
|
|
56
|
+
classify?: Classify;
|
|
57
|
+
/** Test seam: draw the tile's buffer uncut, to prove a seam measurement can see it. */
|
|
58
|
+
cut?: boolean;
|
|
59
|
+
}
|
|
60
|
+
interface Column<T extends ArrayLike<number>> {
|
|
61
|
+
value: T;
|
|
62
|
+
size: number;
|
|
63
|
+
}
|
|
64
|
+
interface BinaryGeometry {
|
|
65
|
+
positions: Column<Float64Array>;
|
|
66
|
+
globalFeatureIds: Column<Uint32Array>;
|
|
67
|
+
featureIds: Column<Uint32Array>;
|
|
68
|
+
numericProps: Record<string, Column<Float32Array>>;
|
|
69
|
+
properties: Record<string, unknown>[];
|
|
70
|
+
fields: unknown[];
|
|
71
|
+
attributes?: Record<string, Column<Float32Array>>;
|
|
72
|
+
}
|
|
73
|
+
/** loaders.gl's BinaryFeatureCollection, as deck's GeoJsonLayer reads it. */
|
|
74
|
+
export interface BinaryCollection {
|
|
75
|
+
shape: "binary-feature-collection";
|
|
76
|
+
points: BinaryGeometry & {
|
|
77
|
+
type: "Point";
|
|
78
|
+
};
|
|
79
|
+
lines: BinaryGeometry & {
|
|
80
|
+
type: "LineString";
|
|
81
|
+
pathIndices: Column<Uint32Array>;
|
|
82
|
+
};
|
|
83
|
+
polygons: BinaryGeometry & {
|
|
84
|
+
type: "Polygon";
|
|
85
|
+
polygonIndices: Column<Uint32Array>;
|
|
86
|
+
primitivePolygonIndices: Column<Uint32Array>;
|
|
87
|
+
triangles: Column<Uint32Array>;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export interface PlaneTileGeometry {
|
|
91
|
+
/** Polygon fills, cut and triangulated. */
|
|
92
|
+
fills: BinaryCollection;
|
|
93
|
+
/** Lines and points. */
|
|
94
|
+
lines: BinaryCollection;
|
|
95
|
+
/** Polygon outlines, cut as lines. */
|
|
96
|
+
outlines: BinaryCollection;
|
|
97
|
+
/** Lines whose rule asks for a casing, in draw order (classify only). */
|
|
98
|
+
casings: BinaryCollection;
|
|
99
|
+
/** Every source feature's properties, by the id its pieces carry — for highlight lookup. */
|
|
100
|
+
properties: Record<string, unknown>[];
|
|
101
|
+
}
|
|
102
|
+
type P = number[];
|
|
103
|
+
/** Decode, cut, project and triangulate one tile. */
|
|
104
|
+
export declare function buildPlaneTile(buffer: ArrayBuffer, index: TileIndex, options: BuildOptions, planeProject: Project, unproject?: Unproject): PlaneTileGeometry;
|
|
105
|
+
/** The buffers a built tile can hand across a worker boundary without copying. */
|
|
106
|
+
export declare function transferablesOf(g: PlaneTileGeometry): ArrayBuffer[];
|
|
107
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds plane vector tiles (build.ts) off the main thread: a small pool of
|
|
3
|
+
* inline workers (worker.ts), each tile one request. Where a worker cannot
|
|
4
|
+
* build — no Worker global, or a plane registered as functions, which cannot
|
|
5
|
+
* cross to one — the same build runs here, on the main thread: slower, never
|
|
6
|
+
* blank.
|
|
7
|
+
*/
|
|
8
|
+
import type { PlaneFrame } from "../projection";
|
|
9
|
+
import type { BuildOptions, PlaneTileGeometry, TileIndex } from "./build";
|
|
10
|
+
import type { PlaneSpec } from "./worker";
|
|
11
|
+
/** The plane as data a worker can rebuild it from, or null when it cannot. */
|
|
12
|
+
export declare function planeSpecOf(frame: PlaneFrame): PlaneSpec | null;
|
|
13
|
+
/**
|
|
14
|
+
* One tile, built for one plane. The bytes are COPIED to the worker, not
|
|
15
|
+
* transferred: the caller keeps them, because a live `crs` switch rebuilds
|
|
16
|
+
* every cached tile for the new plane without fetching it again.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildTile(buffer: ArrayBuffer, index: TileIndex, options: BuildOptions, frame: PlaneFrame): Promise<PlaneTileGeometry>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flat ends where a line was CUT at a tile edge (plane-vector/build.ts).
|
|
3
|
+
*
|
|
4
|
+
* deck's PathLayer ends a path flat, or — with `capRounded` — with a round
|
|
5
|
+
* cap that reaches half a width PAST the end. At a tile edge the neighbour's
|
|
6
|
+
* piece of the same line begins at that very point, so two round caps
|
|
7
|
+
* overlap: a blob of double colour on a translucent line. Dropping a round
|
|
8
|
+
* cap at a cut end leaves each piece ending flat across the line at the shared
|
|
9
|
+
* point, so the halves meet with no overlap and no gap. A path's real ends
|
|
10
|
+
* keep their caps; a flat end needs nothing.
|
|
11
|
+
*
|
|
12
|
+
* The flags ride a per-vertex attribute the build supplies (`getCutEnds`:
|
|
13
|
+
* bit 0 the path's start is a cut, bit 1 its end). On any sublayer that is
|
|
14
|
+
* not a path — the points and fills of the same GeoJsonLayer — the extension
|
|
15
|
+
* does nothing.
|
|
16
|
+
*/
|
|
17
|
+
import { LayerExtension, type Layer } from "@deck.gl/core";
|
|
18
|
+
export declare class CutEndsExtension extends LayerExtension {
|
|
19
|
+
static extensionName: string;
|
|
20
|
+
static defaultProps: {
|
|
21
|
+
getCutEnds: {
|
|
22
|
+
type: string;
|
|
23
|
+
value: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
getShaders(this: Layer): {
|
|
27
|
+
inject?: Record<string, string>;
|
|
28
|
+
};
|
|
29
|
+
initializeState(this: Layer): void;
|
|
30
|
+
}
|