@mailwoman/map-tui 9.4.0 → 10.1.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/README.md +5 -6
- package/{lib/cli-args.ts → cli/args.ts} +49 -28
- package/{lib/cli.ts → cli/main.ts} +13 -24
- package/lib/browser.ts +33 -76
- package/lib/frame.ts +50 -28
- package/lib/input.ts +46 -69
- package/lib/mercator.ts +13 -12
- package/lib/mvt.ts +2 -2
- package/lib/raster.ts +53 -27
- package/lib/renderer.ts +19 -38
- package/lib/style.ts +21 -15
- package/lib/tile-source.ts +30 -19
- package/out/browser.d.ts +24 -33
- package/out/browser.d.ts.map +1 -1
- package/out/browser.js +27 -72
- package/out/browser.js.map +1 -1
- package/out/{cli-args.d.ts → cli/args.d.ts} +19 -9
- package/out/cli/args.d.ts.map +1 -0
- package/out/{cli-args.js → cli/args.js} +42 -26
- package/out/cli/args.js.map +1 -0
- package/out/{cli.d.ts → cli/main.d.ts} +1 -1
- package/out/cli/main.d.ts.map +1 -0
- package/out/{cli.js → cli/main.js} +14 -25
- package/out/cli/main.js.map +1 -0
- package/out/cli/tsconfig.tsbuildinfo +1 -0
- package/out/frame.d.ts +40 -23
- package/out/frame.d.ts.map +1 -1
- package/out/frame.js +48 -26
- package/out/frame.js.map +1 -1
- package/out/input.d.ts +18 -36
- package/out/input.d.ts.map +1 -1
- package/out/input.js +37 -63
- package/out/input.js.map +1 -1
- package/out/mercator.d.ts +12 -11
- package/out/mercator.d.ts.map +1 -1
- package/out/mercator.js +4 -10
- package/out/mercator.js.map +1 -1
- package/out/mvt.js +2 -2
- package/out/raster.d.ts +45 -23
- package/out/raster.d.ts.map +1 -1
- package/out/raster.js +44 -22
- package/out/raster.js.map +1 -1
- package/out/renderer.d.ts +6 -7
- package/out/renderer.d.ts.map +1 -1
- package/out/renderer.js +13 -22
- package/out/renderer.js.map +1 -1
- package/out/style.d.ts +17 -11
- package/out/style.d.ts.map +1 -1
- package/out/style.js +11 -9
- package/out/style.js.map +1 -1
- package/out/tile-source.d.ts +12 -8
- package/out/tile-source.d.ts.map +1 -1
- package/out/tile-source.js +21 -14
- package/out/tile-source.js.map +1 -1
- package/out/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +35 -83
- package/out/cli-args.d.ts.map +0 -1
- package/out/cli-args.js.map +0 -1
- package/out/cli.d.ts.map +0 -1
- package/out/cli.js.map +0 -1
package/out/raster.d.ts
CHANGED
|
@@ -4,58 +4,80 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Rgba pixel rasterizer for map-tui's debug view.
|
|
8
8
|
*
|
|
9
|
-
* Rasterizes vector geometry (polylines, filled polygons, circles) onto a plain
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Rasterizes vector geometry (polylines, filled polygons, circles) onto a plain rgba
|
|
10
|
+
* byte grid — the shape asciify's rasterize step consumes.
|
|
11
|
+
* Every draw call clips through {@link RGBAGrid.setPixel}, so callers never
|
|
12
|
+
* need to bounds-check geometry themselves.
|
|
13
|
+
*
|
|
14
|
+
* The polyline and circle primitives floor their coordinates to integers on entry;
|
|
15
|
+
* {@link fillPolygon} does not.
|
|
16
|
+
* Its scanline edge math keeps ring vertices as given, see its own docstring.
|
|
13
17
|
*/
|
|
14
18
|
import type { RGB } from "#style";
|
|
15
19
|
/**
|
|
16
|
-
* A row-major
|
|
17
|
-
*
|
|
20
|
+
* A row-major rgba pixel buffer.
|
|
21
|
+
*
|
|
22
|
+
* Alpha starts at 0 (unlit/transparent) everywhere.
|
|
23
|
+
* A drawn pixel has value 255.
|
|
24
|
+
*
|
|
25
|
+
* Callers, including this module's own tests, distinguish "lit" from "background".
|
|
18
26
|
*/
|
|
19
27
|
export declare class RGBAGrid {
|
|
20
28
|
readonly width: number;
|
|
21
29
|
readonly height: number;
|
|
22
30
|
/**
|
|
23
|
-
*
|
|
31
|
+
* Rgba, row-major, width * height * 4 bytes — the shape asciify's rasterize consumes.
|
|
24
32
|
*/
|
|
25
33
|
readonly data: Uint8ClampedArray;
|
|
26
34
|
constructor(width: number, height: number);
|
|
27
35
|
/**
|
|
28
|
-
* Writes a pixel's RGB channels and sets alpha to fully opaque (255).
|
|
29
|
-
*
|
|
30
|
-
*
|
|
36
|
+
* Writes a pixel's RGB channels and sets alpha to fully opaque (255).
|
|
37
|
+
*
|
|
38
|
+
* Coordinates outside the grid are silently ignored.
|
|
39
|
+
* This is the one clipping boundary every drawing primitive in this module routes through,
|
|
40
|
+
* so geometry that runs off the grid (or arrives with negative/oversized coordinates)
|
|
41
|
+
* never needs special-casing upstream.
|
|
31
42
|
*/
|
|
32
43
|
setPixel(x: number, y: number, color: RGB): void;
|
|
33
44
|
}
|
|
34
45
|
/**
|
|
35
|
-
* Draws a connected polyline through `points`, one Bresenham segment per consecutive pair.
|
|
36
|
-
*
|
|
37
|
-
*
|
|
46
|
+
* Draws a connected polyline through `points`, one Bresenham segment per consecutive pair.
|
|
47
|
+
*
|
|
48
|
+
* `width > 1` stamps a `width`-sized square at every plotted step instead of
|
|
49
|
+
* a single pixel, thickening the line.
|
|
50
|
+
* Segments that run outside the grid clip through `setPixel` rather than throwing.
|
|
38
51
|
*/
|
|
39
52
|
export declare function drawPolyline(grid: RGBAGrid, points: ReadonlyArray<{
|
|
40
53
|
x: number;
|
|
41
54
|
y: number;
|
|
42
55
|
}>, color: RGB, width: number): void;
|
|
43
56
|
/**
|
|
44
|
-
* Fills one or more polygon rings with the even-odd rule: a pixel is interior
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
57
|
+
* Fills one or more polygon rings with the even-odd rule: a pixel is interior
|
|
58
|
+
* when a ray from it crosses an odd number of ring edges.
|
|
59
|
+
*
|
|
60
|
+
* Rings after the first behave as holes wherever they overlap the first ring.
|
|
61
|
+
* Holes nested inside holes fill again as a consequence of the parity count.
|
|
62
|
+
* No explicit hole/outer distinction is tracked.
|
|
63
|
+
*
|
|
64
|
+
* Scanlines sample row centers (`y + 0.5`) rather than integer row coordinates.
|
|
65
|
+
* This keeps horizontal edges and grid-aligned polygon boundaries from producing
|
|
66
|
+
* degenerate (zero-width or doubled) intersections.
|
|
67
|
+
*
|
|
68
|
+
* Coordinates are floored to the grid via `setPixel`; edge math itself uses the ring vertices as given.
|
|
50
69
|
*/
|
|
51
70
|
export declare function fillPolygon(grid: RGBAGrid, rings: ReadonlyArray<ReadonlyArray<{
|
|
52
71
|
x: number;
|
|
53
72
|
y: number;
|
|
54
73
|
}>>, color: RGB): void;
|
|
55
74
|
/**
|
|
56
|
-
* Draws a circle's outline (ring
|
|
57
|
-
* octant points per step.
|
|
58
|
-
*
|
|
75
|
+
* Draws a circle's outline (ring rather than a filled disc) with the midpoint circle
|
|
76
|
+
* algorithm, plotting all eight symmetric octant points per step.
|
|
77
|
+
*
|
|
78
|
+
* `centerX`/`centerY`/`radius` are floored on entry.
|
|
79
|
+
* Every plotted point routes through `setPixel`, so a circle that runs off
|
|
80
|
+
* the grid clips rather than throwing.
|
|
59
81
|
*/
|
|
60
82
|
export declare function drawCircle(grid: RGBAGrid, centerX: number, centerY: number, radius: number, color: RGB): void;
|
|
61
83
|
//# sourceMappingURL=raster.d.ts.map
|
package/out/raster.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raster.d.ts","sourceRoot":"","sources":["../lib/raster.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"raster.d.ts","sourceRoot":"","sources":["../lib/raster.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEjC;;;;;;;GAOG;AACH,qBAAa,QAAQ;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;IAEhC,YAAY,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAIxC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAY/C;CACD;AA2DD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,aAAa,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EAC/C,KAAK,EAAE,GAAG,EACV,KAAK,EAAE,MAAM,GACX,IAAI,CAON;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,aAAa,CAAC,aAAa,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,EAC7D,KAAK,EAAE,GAAG,GACR,IAAI,CAkCN;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAgC7G"}
|
package/out/raster.js
CHANGED
|
@@ -4,14 +4,18 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* A row-major
|
|
8
|
-
*
|
|
7
|
+
* A row-major rgba pixel buffer.
|
|
8
|
+
*
|
|
9
|
+
* Alpha starts at 0 (unlit/transparent) everywhere.
|
|
10
|
+
* A drawn pixel has value 255.
|
|
11
|
+
*
|
|
12
|
+
* Callers, including this module's own tests, distinguish "lit" from "background".
|
|
9
13
|
*/
|
|
10
14
|
export class RGBAGrid {
|
|
11
15
|
width;
|
|
12
16
|
height;
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
18
|
+
* Rgba, row-major, width * height * 4 bytes — the shape asciify's rasterize consumes.
|
|
15
19
|
*/
|
|
16
20
|
data;
|
|
17
21
|
constructor(width, height) {
|
|
@@ -20,9 +24,12 @@ export class RGBAGrid {
|
|
|
20
24
|
this.data = new Uint8ClampedArray(width * height * 4);
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
23
|
-
* Writes a pixel's RGB channels and sets alpha to fully opaque (255).
|
|
24
|
-
*
|
|
25
|
-
*
|
|
27
|
+
* Writes a pixel's RGB channels and sets alpha to fully opaque (255).
|
|
28
|
+
*
|
|
29
|
+
* Coordinates outside the grid are silently ignored.
|
|
30
|
+
* This is the one clipping boundary every drawing primitive in this module routes through,
|
|
31
|
+
* so geometry that runs off the grid (or arrives with negative/oversized coordinates)
|
|
32
|
+
* never needs special-casing upstream.
|
|
26
33
|
*/
|
|
27
34
|
setPixel(x, y, color) {
|
|
28
35
|
const px = Math.floor(x);
|
|
@@ -37,8 +44,9 @@ export class RGBAGrid {
|
|
|
37
44
|
}
|
|
38
45
|
}
|
|
39
46
|
/**
|
|
40
|
-
* Stamps a `width`-sized square centered on (x, y) — used by {@link drawPolyline} for `width > 1`.
|
|
41
|
-
*
|
|
47
|
+
* Stamps a `width`-sized square centered on (x, y) — used by {@link drawPolyline} for `width > 1`.
|
|
48
|
+
*
|
|
49
|
+
* `width === 1` callers should use `grid.setPixel` directly rather than pay the square-stamp loop.
|
|
42
50
|
*/
|
|
43
51
|
function stampSquare(grid, x, y, color, width) {
|
|
44
52
|
const half = Math.floor(width / 2);
|
|
@@ -49,8 +57,11 @@ function stampSquare(grid, x, y, color, width) {
|
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
59
|
/**
|
|
52
|
-
* Draws a single line segment with the integer Bresenham algorithm.
|
|
53
|
-
*
|
|
60
|
+
* Draws a single line segment with the integer Bresenham algorithm.
|
|
61
|
+
*
|
|
62
|
+
* Coordinates are floored on entry.
|
|
63
|
+
* Every plotted point routes through `grid.setPixel`, so segments that run partly
|
|
64
|
+
* or fully off-grid clip for free.
|
|
54
65
|
*/
|
|
55
66
|
function drawSegment(grid, x0, y0, x1, y1, color, width) {
|
|
56
67
|
let x = Math.floor(x0);
|
|
@@ -83,9 +94,11 @@ function drawSegment(grid, x0, y0, x1, y1, color, width) {
|
|
|
83
94
|
}
|
|
84
95
|
}
|
|
85
96
|
/**
|
|
86
|
-
* Draws a connected polyline through `points`, one Bresenham segment per consecutive pair.
|
|
87
|
-
*
|
|
88
|
-
*
|
|
97
|
+
* Draws a connected polyline through `points`, one Bresenham segment per consecutive pair.
|
|
98
|
+
*
|
|
99
|
+
* `width > 1` stamps a `width`-sized square at every plotted step instead of
|
|
100
|
+
* a single pixel, thickening the line.
|
|
101
|
+
* Segments that run outside the grid clip through `setPixel` rather than throwing.
|
|
89
102
|
*/
|
|
90
103
|
export function drawPolyline(grid, points, color, width) {
|
|
91
104
|
for (let index = 0; index < points.length - 1; index++) {
|
|
@@ -95,12 +108,18 @@ export function drawPolyline(grid, points, color, width) {
|
|
|
95
108
|
}
|
|
96
109
|
}
|
|
97
110
|
/**
|
|
98
|
-
* Fills one or more polygon rings with the even-odd rule: a pixel is interior
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
111
|
+
* Fills one or more polygon rings with the even-odd rule: a pixel is interior
|
|
112
|
+
* when a ray from it crosses an odd number of ring edges.
|
|
113
|
+
*
|
|
114
|
+
* Rings after the first behave as holes wherever they overlap the first ring.
|
|
115
|
+
* Holes nested inside holes fill again as a consequence of the parity count.
|
|
116
|
+
* No explicit hole/outer distinction is tracked.
|
|
117
|
+
*
|
|
118
|
+
* Scanlines sample row centers (`y + 0.5`) rather than integer row coordinates.
|
|
119
|
+
* This keeps horizontal edges and grid-aligned polygon boundaries from producing
|
|
120
|
+
* degenerate (zero-width or doubled) intersections.
|
|
121
|
+
*
|
|
122
|
+
* Coordinates are floored to the grid via `setPixel`; edge math itself uses the ring vertices as given.
|
|
104
123
|
*/
|
|
105
124
|
export function fillPolygon(grid, rings, color) {
|
|
106
125
|
for (let y = 0; y < grid.height; y++) {
|
|
@@ -132,9 +151,12 @@ export function fillPolygon(grid, rings, color) {
|
|
|
132
151
|
}
|
|
133
152
|
}
|
|
134
153
|
/**
|
|
135
|
-
* Draws a circle's outline (ring
|
|
136
|
-
* octant points per step.
|
|
137
|
-
*
|
|
154
|
+
* Draws a circle's outline (ring rather than a filled disc) with the midpoint circle
|
|
155
|
+
* algorithm, plotting all eight symmetric octant points per step.
|
|
156
|
+
*
|
|
157
|
+
* `centerX`/`centerY`/`radius` are floored on entry.
|
|
158
|
+
* Every plotted point routes through `setPixel`, so a circle that runs off
|
|
159
|
+
* the grid clips rather than throwing.
|
|
138
160
|
*/
|
|
139
161
|
export function drawCircle(grid, centerX, centerY, radius, color) {
|
|
140
162
|
const cx = Math.floor(centerX);
|
package/out/raster.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raster.js","sourceRoot":"","sources":["../lib/raster.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"raster.js","sourceRoot":"","sources":["../lib/raster.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH;;;;;;;GAOG;AACH,MAAM,OAAO,QAAQ;IACX,KAAK,CAAQ;IACb,MAAM,CAAQ;IACvB;;OAEG;IACM,IAAI,CAAmB;IAEhC,YAAY,KAAa,EAAE,MAAc;QACxC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAiB,CAAC,KAAK,GAAG,MAAM,GAAG,CAAC,CAAC,CAAA;IACtD,CAAC;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A;QACtC,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,KAAK,CAAC,CAAA;QACtC,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,KAAK,CAAC,CAAA;IACvC,CAAC,CAAA;IAED,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACf,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAEjB,CAAC,EAAE,CAAA;QAEH,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACf,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACnB,CAAC;aAAM,CAAC;YACP,CAAC,EAAE,CAAA;YACH,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;QACzB,CAAC;IACF,CAAC;AACF,CAAC"}
|
package/out/renderer.d.ts
CHANGED
|
@@ -25,18 +25,17 @@ export interface RingSpec {
|
|
|
25
25
|
radiusMeters: number;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Walks a viewport's rendering pipeline
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* Walks a viewport's rendering pipeline (tile fetch, style-ordered rasterization,
|
|
29
|
+
* braille conversion, then ring/label/marker overlays) and holds no per-frame state,
|
|
30
|
+
* so one instance can render any number of viewports against the same `TileSource`.
|
|
31
31
|
*/
|
|
32
32
|
export declare class MapRenderer {
|
|
33
33
|
private readonly source;
|
|
34
34
|
constructor(source: TileProvider);
|
|
35
35
|
/**
|
|
36
|
-
* Resolves each viewport slot to its native tile or
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* cover a cell.
|
|
36
|
+
* Resolves each viewport slot to its native tile or the nearest existing ancestor,
|
|
37
|
+
* deduplicated so shared ancestors rasterize once and sorted coarse-first
|
|
38
|
+
* so native detail paints over the fallback.
|
|
40
39
|
*/
|
|
41
40
|
private resolveTiles;
|
|
42
41
|
renderFrame(viewport: Viewport, overlays?: {
|
package/out/renderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../lib/renderer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../lib/renderer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,KAAK,QAAQ,EAA8C,MAAM,QAAQ,CAAA;AAUlF,OAAO,EAAmB,KAAK,GAAG,EAAkC,MAAM,QAAQ,CAAA;AAClF,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,cAAc,CAAA;AAE7D,MAAM,WAAW,QAAQ;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,UAAU;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,GAAG,CAAA;CACX;AAED,MAAM,WAAW,QAAQ;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,CAAA;CACpB;AAgKD;;;;GAIG;AACH,qBAAa,WAAW;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IAErC,YAAY,MAAM,EAAE,YAAY,EAE/B;IAED;;;;OAIG;YACW,YAAY;IA8BpB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CA0E/G;CACD"}
|
package/out/renderer.js
CHANGED
|
@@ -4,14 +4,8 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `MapRenderer.renderFrame` is the package's single public entry point: given a `Viewport` (center lon/lat, zoom, cell
|
|
10
|
-
* columns/rows), it fetches the covering tiles from a `TileSource`, rasterizes styled geometry (./style.ts,
|
|
11
|
-
* ./raster.ts) into a subpixel RGBA grid, converts that grid to braille cells (./frame.ts), then overlays collected
|
|
12
|
-
* labels and marker/ring annotations on top. Draw order is fill → line → label per the layer style table, with overlays
|
|
13
|
-
* (ring, labels, markers) layered afterward in that order — markers deliberately skip the label collision bitmap so a
|
|
14
|
-
* requested marker always wins the cell.
|
|
7
|
+
* Draw order is fill → line → label per the layer style table, then overlays (ring, labels, markers),
|
|
8
|
+
* and markers deliberately skip the label collision bitmap so a requested marker always wins the cell.
|
|
15
9
|
*/
|
|
16
10
|
import { clamp } from "@mailwoman/core/numeric";
|
|
17
11
|
import { overlayText, rasterizeToFrame, rgbToPacked } from "#frame";
|
|
@@ -21,8 +15,7 @@ import { styleForFeatureKind, stylesFor } from "#style";
|
|
|
21
15
|
const DEFAULT_MARKER_CHAR = "●";
|
|
22
16
|
const DEFAULT_MARKER_COLOR = [255, 80, 80];
|
|
23
17
|
/**
|
|
24
|
-
*
|
|
25
|
-
* to a single point or nothing useful.
|
|
18
|
+
* A ring radius below this many device pixels degenerates the midpoint circle algorithm to a single point.
|
|
26
19
|
*/
|
|
27
20
|
const MIN_RING_RADIUS_PX = 2;
|
|
28
21
|
function projectPoint(projection, gx, gy) {
|
|
@@ -59,9 +52,8 @@ function collectLabels(feature, property, color, projection, pendingLabels) {
|
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
54
|
/**
|
|
62
|
-
* Rasterizes (or, for labels, collects) one feature under one style
|
|
63
|
-
*
|
|
64
|
-
* stays a flat one-level `if`/`else` regardless of how deeply its caller is already nested.
|
|
55
|
+
* Rasterizes (or, for labels, collects) one feature under one style, keeping the `style.kind`
|
|
56
|
+
* dispatch as the only branching so this stays a flat one-level `if`/`else`.
|
|
65
57
|
*/
|
|
66
58
|
function rasterizeFeature(grid, feature, style, renderZoom, projection, pendingLabels) {
|
|
67
59
|
if (style.kind === "fill") {
|
|
@@ -75,8 +67,8 @@ function rasterizeFeature(grid, feature, style, renderZoom, projection, pendingL
|
|
|
75
67
|
}
|
|
76
68
|
}
|
|
77
69
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
70
|
+
* Pulled out of {@link MapRenderer.renderFrame} so its tile loop does not accumulate
|
|
71
|
+
* this function's three nested loops on top of its own.
|
|
80
72
|
*/
|
|
81
73
|
function rasterizeTileForKind(grid, resolved, kind, renderZoom, origin, pendingLabels) {
|
|
82
74
|
for (const layer of resolved.tile.layers) {
|
|
@@ -98,9 +90,9 @@ function rasterizeTileForKind(grid, resolved, kind, renderZoom, origin, pendingL
|
|
|
98
90
|
}
|
|
99
91
|
}
|
|
100
92
|
/**
|
|
101
|
-
* Walks a viewport's rendering pipeline
|
|
102
|
-
*
|
|
103
|
-
*
|
|
93
|
+
* Walks a viewport's rendering pipeline (tile fetch, style-ordered rasterization,
|
|
94
|
+
* braille conversion, then ring/label/marker overlays) and holds no per-frame state,
|
|
95
|
+
* so one instance can render any number of viewports against the same `TileSource`.
|
|
104
96
|
*/
|
|
105
97
|
export class MapRenderer {
|
|
106
98
|
source;
|
|
@@ -108,10 +100,9 @@ export class MapRenderer {
|
|
|
108
100
|
this.source = source;
|
|
109
101
|
}
|
|
110
102
|
/**
|
|
111
|
-
* Resolves each viewport slot to its native tile or
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* cover a cell.
|
|
103
|
+
* Resolves each viewport slot to its native tile or the nearest existing ancestor,
|
|
104
|
+
* deduplicated so shared ancestors rasterize once and sorted coarse-first
|
|
105
|
+
* so native detail paints over the fallback.
|
|
115
106
|
*/
|
|
116
107
|
async resolveTiles(tileCoords, renderZoom) {
|
|
117
108
|
const resolved = new Map();
|
package/out/renderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../lib/renderer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../lib/renderer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,OAAO,EAAiB,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAClF,OAAO,EACN,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,SAAS,GACT,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO,EAA6B,mBAAmB,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAwBlF,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAC/B,MAAM,oBAAoB,GAAQ,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AAE/C;;GAEG;AACH,MAAM,kBAAkB,GAAG,CAAC,CAAA;AA2C5B,SAAS,YAAY,CAAC,UAA0B,EAAE,EAAU,EAAE,EAAU;IACvE,OAAO;QACN,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,EAAE,GAAG,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;QAClE,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,EAAE,GAAG,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;KAClE,CAAA;AACF,CAAC;AAED,SAAS,aAAa,CAAC,IAAc,EAAE,OAAuB,EAAE,UA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AAG,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAC/E,CAAC;QAED,IAAI,QAAQ,EAAE,OAAO,EAAE,CAAC;YACvB,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACvC,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;gBACvE,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAA;gBACnC,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAA;gBACnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,yBAAyB,CAAC,CAAA;gBACzD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,sBAAsB,CAAC,CAAA;gBAEnD,WAAW,CACV,KAAK,EACL,MAAM,EACN,GAAG,EACH,MAAM,CAAC,IAAI,IAAI,mBAAmB,EAClC,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,oBAAoB,CAAC,CACjD,CAAA;YACF,CAAC;QACF,CAAC;QAED,OAAO,KAAK,CAAA;IACb,CAAC;CACD"}
|
package/out/style.d.ts
CHANGED
|
@@ -6,15 +6,19 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Protomaps-basemap style table for the map-tui debug view.
|
|
8
8
|
*
|
|
9
|
-
* Defines fill, line
|
|
10
|
-
* palette calibrated for dark-terminal rendering: dim fills
|
|
11
|
-
* labels.
|
|
9
|
+
* Defines fill, line and label styles for the nine Protomaps basemap layers, restricted by zoom level.
|
|
10
|
+
* Color palette calibrated for dark-terminal rendering: dim fills
|
|
11
|
+
* (read as stipple density via dithering), bright lines and labels.
|
|
12
12
|
*/
|
|
13
13
|
export type RGB = readonly [red: number, green: number, blue: number];
|
|
14
14
|
/**
|
|
15
|
-
* Fields shared by every style entry.
|
|
16
|
-
*
|
|
17
|
-
* kind
|
|
15
|
+
* Fields shared by every style entry.
|
|
16
|
+
*
|
|
17
|
+
* `featureKinds` scopes an entry to features whose `kind` tile attribute is in the list.
|
|
18
|
+
* An entry without it is the layer's catch-all.
|
|
19
|
+
*
|
|
20
|
+
* Entries are consulted in table order and the first match wins, so kind-scoped
|
|
21
|
+
* entries precede the catch-all.
|
|
18
22
|
*/
|
|
19
23
|
interface StyleBase {
|
|
20
24
|
color: RGB;
|
|
@@ -34,14 +38,16 @@ export interface LabelStyle extends StyleBase {
|
|
|
34
38
|
}
|
|
35
39
|
export type LayerStyle = FillStyle | LineStyle | LabelStyle;
|
|
36
40
|
/**
|
|
37
|
-
* Styles applying to a protomaps-basemap layer at a zoom, draw-ordered (fills < lines < labels).
|
|
38
|
-
*
|
|
41
|
+
* Styles applying to a protomaps-basemap layer at a zoom, draw-ordered (fills < lines < labels).
|
|
42
|
+
*
|
|
43
|
+
* Empty for unstyled or zoom-restricted layers.
|
|
39
44
|
*/
|
|
40
45
|
export declare function stylesFor(layerName: string, zoom: number): LayerStyle[];
|
|
41
46
|
/**
|
|
42
|
-
* The one style painting a feature: the first entry whose `featureKinds` contains
|
|
43
|
-
* the
|
|
44
|
-
*
|
|
47
|
+
* The one style painting a feature: the first entry whose `featureKinds` contains
|
|
48
|
+
* the feature's `kind` attribute, or the first catch-all.
|
|
49
|
+
*
|
|
50
|
+
* A feature is painted at most once per draw pass — kind-scoped entries recolor, they never double-paint.
|
|
45
51
|
*/
|
|
46
52
|
export declare function styleForFeatureKind(styles: readonly LayerStyle[], featureKind: unknown): LayerStyle | null;
|
|
47
53
|
export {};
|
package/out/style.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../lib/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AAEH,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AAErE
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../lib/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AAEH,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AAErE;;;;;;;;GAQG;AACH,UAAU,SAAS;IAClB,KAAK,EAAE,GAAG,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC;AAED,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC3C,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CAC/B;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC5C,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAA;AAoD3D;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,EAAE,WAAW,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAQ1G"}
|
package/out/style.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
// Zoom level at which roads render with 2px width instead of 1px.
|
|
7
7
|
const ROAD_WIDTH_THRESHOLD = 14;
|
|
8
8
|
const roadWidth = (zoom) => (zoom >= ROAD_WIDTH_THRESHOLD ? 2 : 1);
|
|
9
|
-
// At braille scale
|
|
10
|
-
//
|
|
11
|
-
// brighter than vegetation so
|
|
12
|
-
// turns it into stipple density.
|
|
9
|
+
// At braille scale, each road is one dot wide and each fill is stippled.
|
|
10
|
+
// Color encodes class information: arteries brighten toward amber and paths dim toward vegetation green.
|
|
11
|
+
// Urban land use is warmer and brighter than vegetation, so cities read as denser texture.
|
|
12
|
+
// Luminance is required — asciify's ordered dither turns it into stipple density.
|
|
13
13
|
const VEGETATION_KINDS = [
|
|
14
14
|
"allotments",
|
|
15
15
|
"cemetery",
|
|
@@ -50,16 +50,18 @@ const STYLE_TABLE = {
|
|
|
50
50
|
pois: [{ kind: "label", color: [180, 200, 160], minZoom: 14, property: "name" }],
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
|
-
* Styles applying to a protomaps-basemap layer at a zoom, draw-ordered (fills < lines < labels).
|
|
54
|
-
*
|
|
53
|
+
* Styles applying to a protomaps-basemap layer at a zoom, draw-ordered (fills < lines < labels).
|
|
54
|
+
*
|
|
55
|
+
* Empty for unstyled or zoom-restricted layers.
|
|
55
56
|
*/
|
|
56
57
|
export function stylesFor(layerName, zoom) {
|
|
57
58
|
return (STYLE_TABLE[layerName] ?? []).filter((style) => zoom >= style.minZoom);
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
|
-
* The one style painting a feature: the first entry whose `featureKinds` contains
|
|
61
|
-
* the
|
|
62
|
-
*
|
|
61
|
+
* The one style painting a feature: the first entry whose `featureKinds` contains
|
|
62
|
+
* the feature's `kind` attribute, or the first catch-all.
|
|
63
|
+
*
|
|
64
|
+
* A feature is painted at most once per draw pass — kind-scoped entries recolor, they never double-paint.
|
|
63
65
|
*/
|
|
64
66
|
export function styleForFeatureKind(styles, featureKind) {
|
|
65
67
|
for (const style of styles) {
|
package/out/style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sourceR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AAE,QAAQ,EAAE,MAAM,EAAE,CAAC;CAChF,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,SAAiB,EAAE,IAAY;IACxD,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;AAC/E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA6B,EAAE,WAAoB;IACtF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,YAAY,IAAI,IAAI;YAAE,OAAO,KAAK,CAAA;QAE5C,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,OAAO,KAAK,CAAA;IAC9F,CAAC;IAED,OAAO,IAAI,CAAA;AACZ,CAAC"}
|
package/out/tile-source.d.ts
CHANGED
|
@@ -8,8 +8,10 @@ export interface DecodedTile {
|
|
|
8
8
|
layers: DecodedLayer[];
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* What a renderer needs from a tile archive
|
|
12
|
-
*
|
|
11
|
+
* What a renderer needs from a tile archive.
|
|
12
|
+
*
|
|
13
|
+
* The read surface of {@link TileSource}, separated so a renderer can be driven by any
|
|
14
|
+
* provider: a single archive, a stub in tests, or a composite over several archives.
|
|
13
15
|
*/
|
|
14
16
|
export interface TileProvider {
|
|
15
17
|
readonly minZoom: number;
|
|
@@ -18,30 +20,32 @@ export interface TileProvider {
|
|
|
18
20
|
getTile(z: number, x: number, y: number): Promise<DecodedTile | null>;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
|
-
* Plain-text attribution out of archive metadata (
|
|
23
|
+
* Plain-text attribution out of archive metadata (html tags stripped, entities decoded);
|
|
24
|
+
* empty string when absent.
|
|
22
25
|
*/
|
|
23
26
|
export declare function readAttribution(metadata: unknown): string;
|
|
24
27
|
export declare class TileSource implements TileProvider, AsyncDisposable {
|
|
25
28
|
readonly minZoom: number;
|
|
26
29
|
readonly maxZoom: number;
|
|
27
30
|
/**
|
|
28
|
-
* Plain-text attribution from archive metadata (
|
|
31
|
+
* Plain-text attribution from archive metadata (html tags stripped); empty string when absent.
|
|
29
32
|
*/
|
|
30
33
|
readonly attribution: string;
|
|
31
34
|
/**
|
|
32
|
-
* Null for
|
|
35
|
+
* Null for http sources — fetch connections have no handle to hold or close.
|
|
33
36
|
*/
|
|
34
37
|
private readonly handle;
|
|
35
38
|
private readonly pmtiles;
|
|
36
39
|
private readonly cache;
|
|
37
40
|
private constructor();
|
|
38
41
|
/**
|
|
39
|
-
* Opens a local `.pmtiles` path, or an `http(s)://` URL read via range requests — a hosted archive
|
|
40
|
-
* server, only a host honoring `Range` (any static file server or object store does).
|
|
42
|
+
* Opens a local `.pmtiles` path, or an `http(s)://` URL read via range requests — a hosted archive
|
|
43
|
+
* needs no tile server, only a host honoring `Range` (any static file server or object store does).
|
|
41
44
|
*/
|
|
42
45
|
static open(pathOrURL: string): Promise<TileSource>;
|
|
43
46
|
/**
|
|
44
|
-
* Decoded tile, LRU-cached (64 entries).
|
|
47
|
+
* Decoded tile, LRU-cached (64 entries).
|
|
48
|
+
* Null = tile absent from the archive.
|
|
45
49
|
*/
|
|
46
50
|
getTile(z: number, x: number, y: number): Promise<DecodedTile | null>;
|
|
47
51
|
[Symbol.asyncDispose](): Promise<void>;
|
package/out/tile-source.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-source.d.ts","sourceRoot":"","sources":["../lib/tile-source.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"tile-source.d.ts","sourceRoot":"","sources":["../lib/tile-source.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,OAAO,EAAE,KAAK,YAAY,EAAa,MAA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