@ac-kit/math-grid 0.3.0 → 0.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +117 -10
  3. package/dist/_brand.d.ts +14 -0
  4. package/dist/_brand.d.ts.map +1 -0
  5. package/dist/_brand.js +2 -0
  6. package/dist/_brand.js.map +1 -0
  7. package/dist/_coverage-contour2.d.ts +55 -0
  8. package/dist/_coverage-contour2.d.ts.map +1 -0
  9. package/dist/_coverage-contour2.js +2068 -0
  10. package/dist/_coverage-contour2.js.map +1 -0
  11. package/dist/_grid-offsets2.d.ts +15 -0
  12. package/dist/_grid-offsets2.d.ts.map +1 -0
  13. package/dist/_grid-offsets2.js +53 -0
  14. package/dist/_grid-offsets2.js.map +1 -0
  15. package/dist/_nearest-site-propagation2.d.ts +80 -0
  16. package/dist/_nearest-site-propagation2.d.ts.map +1 -0
  17. package/dist/_nearest-site-propagation2.js +707 -0
  18. package/dist/_nearest-site-propagation2.js.map +1 -0
  19. package/dist/breadth-first-grid2.d.ts +65 -0
  20. package/dist/breadth-first-grid2.d.ts.map +1 -0
  21. package/dist/breadth-first-grid2.js +116 -0
  22. package/dist/breadth-first-grid2.js.map +1 -0
  23. package/dist/flood-fill2.d.ts +39 -0
  24. package/dist/flood-fill2.d.ts.map +1 -0
  25. package/dist/flood-fill2.js +76 -0
  26. package/dist/flood-fill2.js.map +1 -0
  27. package/dist/grid-neighbors2.d.ts +45 -0
  28. package/dist/grid-neighbors2.d.ts.map +1 -0
  29. package/dist/grid-neighbors2.js +45 -0
  30. package/dist/grid-neighbors2.js.map +1 -0
  31. package/dist/grid-pack-dfs.d.ts.map +1 -1
  32. package/dist/grid-pack-dfs.js +4 -2
  33. package/dist/grid-pack-dfs.js.map +1 -1
  34. package/dist/index.d.ts +6 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +6 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/infinite-grid2.js.map +1 -1
  39. package/dist/max-rects-pack.d.ts +90 -0
  40. package/dist/max-rects-pack.d.ts.map +1 -0
  41. package/dist/max-rects-pack.js +310 -0
  42. package/dist/max-rects-pack.js.map +1 -0
  43. package/dist/rasterize-line2.d.ts +33 -0
  44. package/dist/rasterize-line2.d.ts.map +1 -0
  45. package/dist/rasterize-line2.js +103 -0
  46. package/dist/rasterize-line2.js.map +1 -0
  47. package/dist/shelf-allocator.d.ts +7 -1
  48. package/dist/shelf-allocator.d.ts.map +1 -1
  49. package/dist/shelf-allocator.js +32 -32
  50. package/dist/shelf-allocator.js.map +1 -1
  51. package/dist/signed-distance-from-coverage2.d.ts +63 -21
  52. package/dist/signed-distance-from-coverage2.d.ts.map +1 -1
  53. package/dist/signed-distance-from-coverage2.js +327 -99
  54. package/dist/signed-distance-from-coverage2.js.map +1 -1
  55. package/dist/squared-distance-transform2.d.ts +9 -4
  56. package/dist/squared-distance-transform2.d.ts.map +1 -1
  57. package/dist/squared-distance-transform2.js +9 -4
  58. package/dist/squared-distance-transform2.js.map +1 -1
  59. package/dist/tile/_tile-matrix.d.ts +33 -0
  60. package/dist/tile/_tile-matrix.d.ts.map +1 -0
  61. package/dist/tile/_tile-matrix.js +186 -0
  62. package/dist/tile/_tile-matrix.js.map +1 -0
  63. package/dist/tile/index.d.ts +8 -0
  64. package/dist/tile/index.d.ts.map +1 -0
  65. package/dist/tile/index.js +8 -0
  66. package/dist/tile/index.js.map +1 -0
  67. package/dist/tile/quadkey.d.ts +30 -0
  68. package/dist/tile/quadkey.d.ts.map +1 -0
  69. package/dist/tile/quadkey.js +91 -0
  70. package/dist/tile/quadkey.js.map +1 -0
  71. package/dist/tile/tile-address.d.ts +91 -0
  72. package/dist/tile/tile-address.d.ts.map +1 -0
  73. package/dist/tile/tile-address.js +228 -0
  74. package/dist/tile/tile-address.js.map +1 -0
  75. package/dist/tile/tile-index.d.ts +26 -0
  76. package/dist/tile/tile-index.d.ts.map +1 -0
  77. package/dist/tile/tile-index.js +2 -0
  78. package/dist/tile/tile-index.js.map +1 -0
  79. package/dist/tile/tile-level.d.ts +24 -0
  80. package/dist/tile/tile-level.d.ts.map +1 -0
  81. package/dist/tile/tile-level.js +53 -0
  82. package/dist/tile/tile-level.js.map +1 -0
  83. package/dist/tile/tile-matrix-set-json.d.ts +67 -0
  84. package/dist/tile/tile-matrix-set-json.d.ts.map +1 -0
  85. package/dist/tile/tile-matrix-set-json.js +247 -0
  86. package/dist/tile/tile-matrix-set-json.js.map +1 -0
  87. package/dist/tile/tile-matrix-set.d.ts +174 -0
  88. package/dist/tile/tile-matrix-set.d.ts.map +1 -0
  89. package/dist/tile/tile-matrix-set.js +244 -0
  90. package/dist/tile/tile-matrix-set.js.map +1 -0
  91. package/dist/tile/tile-range.d.ts +57 -0
  92. package/dist/tile/tile-range.d.ts.map +1 -0
  93. package/dist/tile/tile-range.js +140 -0
  94. package/dist/tile/tile-range.js.map +1 -0
  95. package/package.json +10 -8
@@ -0,0 +1,228 @@
1
+ import { coalescenceAt_, columnAt_, levelMatrix_, rangeEmpty_, rangeForBox_, rowAt_, tileMatrixOf_, } from "./_tile-matrix.js";
2
+ /**
3
+ * The tolerance of OGC 17-083r4 Annex I, in tile units: a box edge closer than
4
+ * this to a tile edge is taken to lie on it.
5
+ */
6
+ export const TILE_EPSILON = 1e-6;
7
+ /** Writes the tile of `matrix` (level `level`) holding `point` into `out`. */
8
+ function tileAtPoint_(out, matrix, level, point) {
9
+ const row = rowAt_(matrix, point);
10
+ const col = columnAt_(matrix, point);
11
+ out.level = level;
12
+ if (row < 0 || col < 0) {
13
+ out.col = Number.NaN;
14
+ out.row = Number.NaN;
15
+ }
16
+ else {
17
+ out.col = col - (col % coalescenceAt_(matrix, row));
18
+ out.row = row;
19
+ }
20
+ return out;
21
+ }
22
+ /**
23
+ * Writes the tile of level `level` of `set` that holds the plane point `point`
24
+ * (`[x, y]`, the column axis first whatever the CRS axis order) into `out`.
25
+ * Tiles are half-open towards their far side in index space — a point on the
26
+ * edge between two tiles belongs to the one of higher index — except at the far
27
+ * edges of the matrix, which belong to its last column and row; a point on an
28
+ * edge {@link tileBounds} gives lands exactly as that tile's numbering says. In
29
+ * a coalesced row the column is the coalesced tile's first. `col` and `row` are
30
+ * `NaN` outside the matrix and for a `NaN` coordinate or level. O(coalesced row
31
+ * ranges), no allocation.
32
+ *
33
+ * @returns `out`.
34
+ * @throws {RangeError} When `level` is not an integer level of `set`.
35
+ */
36
+ export function tileAt(out, set, level, point) {
37
+ if (level !== level) {
38
+ out.level = Number.NaN;
39
+ out.col = Number.NaN;
40
+ out.row = Number.NaN;
41
+ return out;
42
+ }
43
+ return tileAtPoint_(out, levelMatrix_("tileAt", set, level), level, point);
44
+ }
45
+ /** Writes the plane extent of the valid tile `(col, row)` of `matrix`. */
46
+ function boundsOf_(out, matrix, col, row) {
47
+ const coalesce = coalescenceAt_(matrix, row);
48
+ const first = col - (col % coalesce);
49
+ const end = Math.min(first + coalesce, matrix.matrixWidth);
50
+ const x0 = matrix.pointOfOrigin[0];
51
+ const y0 = matrix.pointOfOrigin[1];
52
+ const spanX = matrix.tileWidth * matrix.cellSize;
53
+ const spanY = matrix.tileHeight * matrix.cellSize;
54
+ out[0] = x0 + first * spanX;
55
+ out[2] = x0 + end * spanX;
56
+ if (matrix.cornerOfOrigin === "topLeft") {
57
+ out[1] = y0 - (row + 1) * spanY;
58
+ out[3] = y0 - row * spanY;
59
+ }
60
+ else {
61
+ out[1] = y0 + row * spanY;
62
+ out[3] = y0 + (row + 1) * spanY;
63
+ }
64
+ }
65
+ /**
66
+ * Writes the plane extent `[minX, minY, maxX, maxY]` of `tile` into `out`, by
67
+ * the formulas of OGC 17-083r4 Annex I.2; a coalesced tile spans its whole
68
+ * group of columns (cut at the matrix's edge), whichever of its columns `tile`
69
+ * names. `NaN` components for a `NaN` index. O(coalesced row ranges), no
70
+ * allocation.
71
+ *
72
+ * @returns `out`.
73
+ * @throws {RangeError} When the level, column or row of `tile` is not an
74
+ * integer of `set`.
75
+ */
76
+ export function tileBounds(out, set, tile) {
77
+ const matrix = tileMatrixOf_("tileBounds", set, tile);
78
+ if (matrix === undefined) {
79
+ out[0] = Number.NaN;
80
+ out[1] = Number.NaN;
81
+ out[2] = Number.NaN;
82
+ out[3] = Number.NaN;
83
+ return out;
84
+ }
85
+ boundsOf_(out, matrix, tile.col, tile.row);
86
+ return out;
87
+ }
88
+ const QUERY_ = new Float64Array(5);
89
+ /**
90
+ * Writes the parent of `tile` into `out`: the tile of the next coarser level
91
+ * (`level − 1`) holding the centre of `tile`. In a quadtree set it is the tile
92
+ * of halved indices; between levels that do not nest it is the coarser tile the
93
+ * centre of `tile` falls in, `NaN` when that centre is outside the coarser
94
+ * matrix. `NaN` for a `NaN` index. O(coalesced row ranges), no allocation.
95
+ *
96
+ * @returns `out`.
97
+ * @throws {RangeError} When `tile` is not a tile of `set`, or is at level 0.
98
+ */
99
+ export function tileParent(out, set, tile) {
100
+ const matrix = tileMatrixOf_("tileParent", set, tile);
101
+ const level = tile.level - 1;
102
+ if (matrix === undefined) {
103
+ out.level = level;
104
+ out.col = Number.NaN;
105
+ out.row = Number.NaN;
106
+ return out;
107
+ }
108
+ const parent = levelMatrix_("tileParent", set, level);
109
+ boundsOf_(QUERY_, matrix, tile.col, tile.row);
110
+ QUERY_[0] = (QUERY_[0] + QUERY_[2]) / 2;
111
+ QUERY_[1] = (QUERY_[1] + QUERY_[3]) / 2;
112
+ return tileAtPoint_(out, parent, level, QUERY_);
113
+ }
114
+ /**
115
+ * Writes the range of the children of `tile` into `out`: the tiles of the next
116
+ * finer level (`level + 1`) that overlap the inside of `tile`, edges within
117
+ * {@link TILE_EPSILON} of a tile edge snapped to it (published cell sizes are
118
+ * rounded). Four tiles in a quadtree set; enumerate them with
119
+ * `tileRangeForEach`, which also handles coalesced rows. Empty for a `NaN`
120
+ * index or when the finer matrix does not reach `tile`. O(coalesced row
121
+ * ranges), no allocation.
122
+ *
123
+ * @returns `out`.
124
+ * @throws {RangeError} When `tile` is not a tile of `set`, or is at the finest
125
+ * level.
126
+ */
127
+ export function tileChildren(out, set, tile) {
128
+ const matrix = tileMatrixOf_("tileChildren", set, tile);
129
+ const level = tile.level + 1;
130
+ if (matrix === undefined) {
131
+ return rangeEmpty_(out, level);
132
+ }
133
+ const child = levelMatrix_("tileChildren", set, level);
134
+ boundsOf_(QUERY_, matrix, tile.col, tile.row);
135
+ QUERY_[4] = TILE_EPSILON;
136
+ return rangeForBox_(out, child, level, QUERY_);
137
+ }
138
+ /**
139
+ * Visits the tiles `firstGroup` to `lastGroup` of `row` (group `g` starts at
140
+ * column `g · coalesce`), skipping the one starting at `skip`; returns how many
141
+ * it visited.
142
+ */
143
+ function visitGroups_(row, coalesce, firstGroup, lastGroup, skip, visit) {
144
+ let count = 0;
145
+ for (let group = firstGroup; group <= lastGroup; group++) {
146
+ const col = group * coalesce;
147
+ if (col !== skip) {
148
+ visit(col, row);
149
+ count++;
150
+ }
151
+ }
152
+ return count;
153
+ }
154
+ /**
155
+ * Visits each tile of `row` that has a grid column in `from` to `to` (which may
156
+ * run one column past either side of the matrix) once, in column order from the
157
+ * seam's far side when the span wraps, skipping the tile starting at `skip`;
158
+ * returns how many it visited.
159
+ */
160
+ function visitRowSpan_(matrix, row, from, to, wrap, skip, visit) {
161
+ const width = matrix.matrixWidth;
162
+ const coalesce = coalescenceAt_(matrix, row);
163
+ const groups = Math.ceil(width / coalesce);
164
+ if (!wrap || (from >= 0 && to < width)) {
165
+ const first = Math.max(from, 0);
166
+ const last = Math.min(to, width - 1);
167
+ return first <= last
168
+ ? visitGroups_(row, coalesce, Math.floor(first / coalesce), Math.floor(last / coalesce), skip, visit)
169
+ : 0;
170
+ }
171
+ // The span crosses the seam: one piece ends at the last column, the other
172
+ // starts at column 0.
173
+ const tailGroup = Math.floor((from < 0 ? from + width : from) / coalesce);
174
+ const headGroup = Math.floor((to >= width ? to - width : to) / coalesce);
175
+ if (to - from + 1 >= width || headGroup >= tailGroup) {
176
+ return visitGroups_(row, coalesce, 0, groups - 1, skip, visit);
177
+ }
178
+ return (visitGroups_(row, coalesce, tailGroup, groups - 1, skip, visit) +
179
+ visitGroups_(row, coalesce, 0, headGroup, skip, visit));
180
+ }
181
+ /**
182
+ * Calls `visit(col, row)` once for every tile of the level of `tile` that
183
+ * touches it, along an edge or at a corner: up to 8 in a uniform matrix, more
184
+ * where a neighbouring row is less coalesced. Rows never wrap; columns wrap
185
+ * around when `options.wrap` is set (a whole-world set). Visits the row before
186
+ * `tile`, its own row, then the row after, each in column order. Nothing for a
187
+ * `NaN` index. O(neighbours + coalesced row ranges), no allocation.
188
+ *
189
+ * @returns The number of neighbours visited.
190
+ * @throws {RangeError} When `tile` is not a tile of `set`.
191
+ */
192
+ export function tileNeighbours(set, tile, visit, options) {
193
+ const matrix = tileMatrixOf_("tileNeighbours", set, tile);
194
+ if (matrix === undefined) {
195
+ return 0;
196
+ }
197
+ const wrap = options?.wrap ?? false;
198
+ const row = tile.row;
199
+ const first = tile.col - (tile.col % coalescenceAt_(matrix, row));
200
+ const end = Math.min(first + coalescenceAt_(matrix, row), matrix.matrixWidth);
201
+ let count = 0;
202
+ if (row > 0) {
203
+ count += visitRowSpan_(matrix, row - 1, first - 1, end, wrap, -1, visit);
204
+ }
205
+ count += visitRowSpan_(matrix, row, first - 1, end, wrap, first, visit);
206
+ if (row < matrix.matrixHeight - 1) {
207
+ count += visitRowSpan_(matrix, row + 1, first - 1, end, wrap, -1, visit);
208
+ }
209
+ return count;
210
+ }
211
+ /**
212
+ * The row of the same tile counted from the opposite corner, `matrixHeight − 1
213
+ * − row`: the "XYZ" ↔ "TMS" flip at one level. `NaN` for a `NaN` level or row.
214
+ *
215
+ * @throws {RangeError} When `level` is not a level of `set`, or `row` is not
216
+ * one of its rows.
217
+ */
218
+ export function tileRowFlip(set, level, row) {
219
+ if (level !== level || row !== row) {
220
+ return Number.NaN;
221
+ }
222
+ const matrix = levelMatrix_("tileRowFlip", set, level);
223
+ if (!Number.isInteger(row) || row < 0 || row >= matrix.matrixHeight) {
224
+ throw new RangeError(`tileRowFlip: ${row} is not a row of tile matrix "${matrix.id}" (0 to ${matrix.matrixHeight - 1}).`);
225
+ }
226
+ return matrix.matrixHeight - 1 - row;
227
+ }
228
+ //# sourceMappingURL=tile-address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile-address.js","sourceRoot":"","sources":["../../src/tile/tile-address.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,cAAc,EACd,SAAS,EACT,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,EACN,aAAa,GACb,MAAM,mBAAmB,CAAC;AAI3B;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AAEjC,8EAA8E;AAC9E,SAAS,YAAY,CACpB,GAAc,EACd,MAAkB,EAClB,KAAa,EACb,KAAwB;IAExB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACrC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QACxB,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACrB,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;IACtB,CAAC;SAAM,CAAC;QACP,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QACpD,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,MAAM,CACrB,GAAc,EACd,GAAkB,EAClB,KAAa,EACb,KAAmB;IAEnB,IAA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D,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACvD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACrE,MAAM,IAAI,UAAU,CACnB,gBAAgB,GAAG,iCAAiC,MAAM,CAAC,EAAE,WAAW,MAAM,CAAC,YAAY,GAAG,CAAC,IAAI,CACnG,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,YAAY,GAAG,CAAC,GAAG,GAAG,CAAC;AACtC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The address of one tile of a `TileMatrixSet`: its `level` (the index of its
3
+ * tile matrix in the set, coarsest first), its column `col` and its row `row`,
4
+ * counted from the matrix's corner of origin (OGC `tileMatrix`, `tileCol`,
5
+ * `tileRow`). A coalesced tile is addressed by its first column.
6
+ */
7
+ export type TileIndex = {
8
+ level: number;
9
+ col: number;
10
+ row: number;
11
+ };
12
+ /**
13
+ * The rectangle of tiles of one level from `minCol`, `minRow` to `maxCol`,
14
+ * `maxRow` inclusive (an OGC `TileMatrixLimits`, with the level for the
15
+ * matrix). Columns are grid columns: in a coalesced row the range holds every
16
+ * tile that has a column in it. Empty when `minCol > maxCol` or `minRow >
17
+ * maxRow`.
18
+ */
19
+ export type TileRange = {
20
+ level: number;
21
+ minCol: number;
22
+ minRow: number;
23
+ maxCol: number;
24
+ maxRow: number;
25
+ };
26
+ //# sourceMappingURL=tile-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile-index.d.ts","sourceRoot":"","sources":["../../src/tile/tile-index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tile-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile-index.js","sourceRoot":"","sources":["../../src/tile/tile-index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import type { TileMatrixSet } from "./tile-matrix-set.js";
2
+ /**
3
+ * How {@link tileLevelForResolution} picks a level: `"nearest"` the closest cell
4
+ * size by ratio (a tie goes to the finer level), `"finer"` the coarsest level
5
+ * at least as detailed, `"coarser"` the finest level at most as detailed.
6
+ */
7
+ export type TileLevelRounding = "nearest" | "finer" | "coarser";
8
+ /** The options of {@link tileLevelForResolution}. */
9
+ export type TileLevelForResolutionOptions = {
10
+ /** `"nearest"` by default. */
11
+ readonly rounding?: TileLevelRounding | undefined;
12
+ };
13
+ /**
14
+ * The level of `set` whose cell size best matches `cellSize` (CRS units per
15
+ * cell, the resolution a view needs), by `options.rounding`. Cell sizes within
16
+ * a relative `1e-9` count as equal, so a published, rounded cell size finds its
17
+ * level whichever rounding is asked for. Past the set's range the result is
18
+ * clamped to its coarsest or finest level (`+∞` gives level 0, `0` the finest).
19
+ * `NaN` for a `NaN` or negative `cellSize`. O(log levels).
20
+ *
21
+ * @throws {RangeError} When `options.rounding` is not a known rounding.
22
+ */
23
+ export declare function tileLevelForResolution(set: TileMatrixSet, cellSize: number, options?: TileLevelForResolutionOptions): number;
24
+ //# sourceMappingURL=tile-level.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile-level.d.ts","sourceRoot":"","sources":["../../src/tile/tile-level.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhE,qDAAqD;AACrD,MAAM,MAAM,6BAA6B,GAAG;IAC3C,8BAA8B;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAClD,CAAC;AAQF;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,6BAA6B,GACrC,MAAM,CA6CR"}
@@ -0,0 +1,53 @@
1
+ import { binarySearch } from "@ac-kit/algo";
2
+ /**
3
+ * Cell sizes within this relative distance are equal: published sets round them
4
+ * to about 15 digits.
5
+ */
6
+ const RELATIVE_TOLERANCE_ = 1e-9;
7
+ /**
8
+ * The level of `set` whose cell size best matches `cellSize` (CRS units per
9
+ * cell, the resolution a view needs), by `options.rounding`. Cell sizes within
10
+ * a relative `1e-9` count as equal, so a published, rounded cell size finds its
11
+ * level whichever rounding is asked for. Past the set's range the result is
12
+ * clamped to its coarsest or finest level (`+∞` gives level 0, `0` the finest).
13
+ * `NaN` for a `NaN` or negative `cellSize`. O(log levels).
14
+ *
15
+ * @throws {RangeError} When `options.rounding` is not a known rounding.
16
+ */
17
+ export function tileLevelForResolution(set, cellSize, options) {
18
+ const rounding = options?.rounding ?? "nearest";
19
+ if (rounding !== "nearest" &&
20
+ rounding !== "finer" &&
21
+ rounding !== "coarser") {
22
+ throw new RangeError(`tileLevelForResolution: unknown rounding "${String(rounding)}".`);
23
+ }
24
+ if (!(cellSize >= 0)) {
25
+ return Number.NaN;
26
+ }
27
+ const matrices = set.tileMatrices;
28
+ const last = matrices.length - 1;
29
+ const upper = cellSize * (1 + RELATIVE_TOLERANCE_);
30
+ // The first level at least as detailed as `cellSize`, up to the tolerance.
31
+ const finer = binarySearch(0, matrices.length, (level) => matrices[level].cellSize > upper);
32
+ if (rounding === "finer") {
33
+ return Math.min(finer, last);
34
+ }
35
+ if (rounding === "coarser") {
36
+ if (finer <= last &&
37
+ matrices[finer].cellSize >= cellSize * (1 - RELATIVE_TOLERANCE_)) {
38
+ return finer;
39
+ }
40
+ return Math.max(finer - 1, 0);
41
+ }
42
+ if (finer === 0) {
43
+ return 0;
44
+ }
45
+ if (finer > last) {
46
+ return last;
47
+ }
48
+ const coarse = matrices[finer - 1].cellSize;
49
+ const fine = matrices[finer].cellSize;
50
+ // Compare the ratios coarse / cellSize and cellSize / fine.
51
+ return coarse / cellSize < cellSize / fine ? finer - 1 : finer;
52
+ }
53
+ //# sourceMappingURL=tile-level.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile-level.js","sourceRoot":"","sources":["../../src/tile/tile-level.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAiB5C;;;GAGG;AACH,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CACrC,GAAkB,EAClB,QAAgB,EAChB,OAAuC;IAEvC,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,SAAS,CAAC;IAChD,IACC,QAAQ,KAAK,SAAS;QACtB,QAAQ,KAAK,OAAO;QACpB,QAAQ,KAAK,SAAS,EACrB,CAAC;QACF,MAAM,IAAI,UAAU,CACnB,6CAA6C,MAAM,CAAC,QAAQ,CAAC,IAAI,CACjE,CAAC;IACH,CAAC;IACD,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC,GAAG,CAAC;IACnB,CAAC;IACD,MAAM,QAAQ,GAAG,GAAG,CAAC,YAAY,CAAC;IAClC,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,QAAQ,GAAG,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC;IACnD,2EAA2E;IAC3E,MAAM,KAAK,GAAG,YAAY,CACzB,CAAC,EACD,QAAQ,CAAC,MAAM,EACf,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAE,CAAC,QAAQ,GAAG,KAAK,CAC5C,CAAC;IACF,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,IACC,KAAK,IAAI,IAAI;YACb,QAAQ,CAAC,KAAK,CAAE,CAAC,QAAQ,IAAI,QAAQ,GAAG,CAAC,CAAC,GAAG,mBAAmB,CAAC,EAChE,CAAC;YACF,OAAO,KAAK,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC;IACV,CAAC;IACD,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC,QAAQ,CAAC;IAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAE,CAAC,QAAQ,CAAC;IACvC,4DAA4D;IAC5D,OAAO,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAChE,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { type TileAxisOrder, type TileCornerOfOrigin, type TileMatrixCoalescence, type TileMatrixSet, type TileMatrixSetCrs } from "./tile-matrix-set.js";
2
+ /** A tile matrix in the JSON encoding of OGC 17-083r4 §7.1, in CRS order. */
3
+ export type TileMatrixJson = {
4
+ id: string;
5
+ title?: string;
6
+ description?: string;
7
+ keywords?: string[];
8
+ scaleDenominator: number;
9
+ cellSize: number;
10
+ cornerOfOrigin?: TileCornerOfOrigin;
11
+ pointOfOrigin: [number, number];
12
+ tileWidth: number;
13
+ tileHeight: number;
14
+ matrixWidth: number;
15
+ matrixHeight: number;
16
+ variableMatrixWidths?: TileMatrixCoalescence[];
17
+ };
18
+ /** A tile matrix set in the JSON encoding of OGC 17-083r4 §7.1. */
19
+ export type TileMatrixSetJson = {
20
+ id?: string;
21
+ title?: string;
22
+ description?: string;
23
+ keywords?: string[];
24
+ uri?: string;
25
+ crs: TileMatrixSetCrs;
26
+ orderedAxes?: [string, string];
27
+ wellKnownScaleSet?: string;
28
+ boundingBox?: {
29
+ lowerLeft: [number, number];
30
+ upperRight: [number, number];
31
+ crs?: TileMatrixSetCrs;
32
+ orderedAxes?: [string, string];
33
+ };
34
+ tileMatrices: TileMatrixJson[];
35
+ };
36
+ /** The options of {@link tileMatrixSetFromJson}. */
37
+ export type TileMatrixSetFromJsonOptions = {
38
+ /**
39
+ * The axis order of the set's CRS. When omitted it is read from `orderedAxes`
40
+ * (a first axis named like a latitude or northing — `Lat`, `Latitude`, `N`,
41
+ * `Northing`, `Y` — makes it `"yx"`), then from the CRS when it is CRS84,
42
+ * CRS84h or EPSG:3857 (`"xy"`) or EPSG:4326 (`"yx"`).
43
+ */
44
+ readonly axisOrder?: TileAxisOrder | undefined;
45
+ };
46
+ /**
47
+ * Creates the tile matrix set a JSON TileMatrixSet document describes (OGC
48
+ * 17-083r4 §7.1, parsed already): its `pointOfOrigin` and `boundingBox` come in
49
+ * CRS axis order and are turned to plane order by the axis order of `options`,
50
+ * of `orderedAxes`, or of a well-known CRS, in that order. A bounding box with
51
+ * a CRS of its own keeps only its corners. Allocates.
52
+ *
53
+ * @throws {TypeError} When `json` or a member has the wrong JSON type.
54
+ * @throws {RangeError} When the axis order cannot be known, or the values do
55
+ * not make a set (as {@link tileMatrixSetCreate} throws).
56
+ */
57
+ export declare function tileMatrixSetFromJson(json: unknown, options?: TileMatrixSetFromJsonOptions): TileMatrixSet;
58
+ /**
59
+ * The JSON TileMatrixSet document of `set` (OGC 17-083r4 §7.1), ready for
60
+ * `JSON.stringify`: coordinates back in CRS axis order, `cornerOfOrigin` always
61
+ * written, empty and absent members left out, the matrices coarsest first.
62
+ * {@link tileMatrixSetFromJson} reads it back to an equal set when the set's
63
+ * axis order is the one its `orderedAxes` or CRS implies, or is passed to it
64
+ * again. Allocates.
65
+ */
66
+ export declare function tileMatrixSetToJson(set: TileMatrixSet): TileMatrixSetJson;
67
+ //# sourceMappingURL=tile-matrix-set-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile-matrix-set-json.d.ts","sourceRoot":"","sources":["../../src/tile/tile-matrix-set-json.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAGrB,MAAM,sBAAsB,CAAC;AAE9B,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,qBAAqB,EAAE,CAAC;CAC/C,CAAC;AAEF,mEA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