@vizhub/quadstream 0.2.0 → 1.0.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 (49) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +49 -323
  3. package/bin/quadstream.mjs +8 -6
  4. package/dist/blg.d.ts +3 -0
  5. package/dist/blg.js +14 -1
  6. package/dist/cooperative.d.ts +21 -0
  7. package/dist/cooperative.js +33 -0
  8. package/dist/dataset.d.ts +8 -4
  9. package/dist/dataset.js +51 -14
  10. package/dist/geometry-wire.d.ts +8 -0
  11. package/dist/geometry-wire.js +76 -0
  12. package/dist/geometry.d.ts +3 -1
  13. package/dist/geometry.js +115 -5
  14. package/dist/index.d.ts +20 -2
  15. package/dist/index.js +9 -1
  16. package/dist/loader.d.ts +1 -1
  17. package/dist/loader.js +1 -1
  18. package/dist/lod-scheduler.d.ts +15 -0
  19. package/dist/lod-scheduler.js +85 -0
  20. package/dist/progressive-map.d.ts +1 -1
  21. package/dist/progressive-map.js +12 -8
  22. package/dist/quadtree.d.ts +2 -0
  23. package/dist/quadtree.js +12 -0
  24. package/dist/reconstruct.d.ts +18 -1
  25. package/dist/reconstruct.js +94 -32
  26. package/dist/session.d.ts +12 -9
  27. package/dist/session.js +24 -7
  28. package/dist/spherical-clip.d.ts +95 -0
  29. package/dist/spherical-clip.js +557 -0
  30. package/dist/spherical-cull.d.ts +25 -0
  31. package/dist/spherical-cull.js +102 -0
  32. package/dist/spherical-dataset.d.ts +41 -9
  33. package/dist/spherical-dataset.js +221 -122
  34. package/dist/spherical-geometry.d.ts +2 -0
  35. package/dist/spherical-geometry.js +87 -44
  36. package/dist/spherical-line.d.ts +29 -0
  37. package/dist/spherical-line.js +221 -0
  38. package/dist/spherical-preprocess.d.ts +23 -0
  39. package/dist/spherical-preprocess.js +160 -0
  40. package/dist/spherical-repair.d.ts +17 -0
  41. package/dist/spherical-repair.js +100 -0
  42. package/dist/spherical-robust-dataset.d.ts +27 -0
  43. package/dist/spherical-robust-dataset.js +89 -0
  44. package/dist/spherical-view-clipper.d.ts +22 -0
  45. package/dist/spherical-view-clipper.js +85 -0
  46. package/dist/topology.d.ts +3 -0
  47. package/dist/topology.js +40 -9
  48. package/dist/types.d.ts +5 -1
  49. package/package.json +12 -7
@@ -0,0 +1,100 @@
1
+ import { canonicalLonLat, projectSpherical, sphericalChart, } from "./spherical-geometry.js";
2
+ import { simpleClosedRing } from "./geometry.js";
3
+ const DEG = 180 / Math.PI, MAX_RING = 5000, MAX_PASSES = 16;
4
+ const orient = (a, b, c) => (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
5
+ // First pair of non-adjacent edges that properly cross (O(n^2), only run on
6
+ // rings the validator already rejected).
7
+ function firstCrossing(xy) {
8
+ const n = xy.length - 1;
9
+ for (let i = 0; i < n; i++)
10
+ for (let j = i + 2; j < n; j++) {
11
+ if (i === 0 && j === n - 1)
12
+ continue;
13
+ const a = xy[i], b = xy[i + 1], c = xy[j], d = xy[j + 1], d1 = orient(a, b, c), d2 = orient(a, b, d), d3 = orient(c, d, a), d4 = orient(c, d, b);
14
+ if (d1 * d2 < 0 && d3 * d4 < 0) {
15
+ const t = d3 / (d3 - d4);
16
+ return {
17
+ i,
18
+ j,
19
+ x: [a[0] + t * (b[0] - a[0]), a[1] + t * (b[1] - a[1])],
20
+ };
21
+ }
22
+ }
23
+ return null;
24
+ }
25
+ function unproject([x, y], chart) {
26
+ const v = [0, 1, 2].map((k) => chart.center[k] + x * chart.east[k] + y * chart.north[k]);
27
+ const len = Math.hypot(...v);
28
+ return canonicalLonLat([
29
+ Math.atan2(v[1], v[0]) * DEG,
30
+ Math.asin(Math.max(-1, Math.min(1, v[2] / len))) * DEG,
31
+ ]);
32
+ }
33
+ /**
34
+ * Removes self-intersection loops from a closed lon/lat ring by cutting at
35
+ * each crossing and discarding the loop with fewer vertices. Returns the
36
+ * repaired ring, or null when the ring is not repairable this way.
37
+ */
38
+ export function repairRing(ring, chart = null, { maxRing = MAX_RING, maxPasses = MAX_PASSES } = {}) {
39
+ if (ring.length < 4 || ring.length > maxRing)
40
+ return null;
41
+ let pts = ring.slice(0, -1);
42
+ try {
43
+ const activeChart = chart ?? sphericalChart(ring);
44
+ for (let pass = 0; pass < maxPasses; pass++) {
45
+ const closed = [...pts, pts[0]], xy = closed.map((p) => projectSpherical(p, activeChart));
46
+ if (simpleClosedRing(xy))
47
+ return closed;
48
+ const hit = firstCrossing(xy);
49
+ if (!hit)
50
+ return null;
51
+ const x = unproject(hit.x, activeChart), inner = pts.slice(hit.i + 1, hit.j + 1);
52
+ pts =
53
+ inner.length <= pts.length - inner.length
54
+ ? [...pts.slice(0, hit.i + 1), x, ...pts.slice(hit.j + 1)]
55
+ : [x, ...inner];
56
+ if (pts.length < 3)
57
+ return null;
58
+ }
59
+ }
60
+ catch {
61
+ return null;
62
+ }
63
+ return null;
64
+ }
65
+ /** Repairs every ring of a Polygon/MultiPolygon; reports whether it changed. */
66
+ export function repairGeometry(geometry, options = {}) {
67
+ let changed = false;
68
+ const fix = (poly) => {
69
+ let chart = null;
70
+ try {
71
+ chart = sphericalChart(poly[0]);
72
+ }
73
+ catch {
74
+ return poly;
75
+ }
76
+ return poly.map((ring) => {
77
+ const xy = (() => {
78
+ try {
79
+ return ring.map((p) => projectSpherical(p, chart));
80
+ }
81
+ catch {
82
+ return null;
83
+ }
84
+ })();
85
+ if (!xy || simpleClosedRing(xy))
86
+ return ring;
87
+ const fixed = repairRing(ring, chart, options);
88
+ if (!fixed)
89
+ return ring;
90
+ changed = true;
91
+ return fixed;
92
+ });
93
+ };
94
+ const next = geometry.type === "Polygon"
95
+ ? { ...geometry, coordinates: fix(geometry.coordinates) }
96
+ : geometry.type === "MultiPolygon"
97
+ ? { ...geometry, coordinates: geometry.coordinates.map(fix) }
98
+ : geometry;
99
+ return { geometry: next, changed };
100
+ }
@@ -0,0 +1,27 @@
1
+ import type { Feature, Geometry, FeatureCollection } from "./types.js";
2
+ /** Group exact-coordinate-connected features, including shared line vertices. */
3
+ export declare function sphericalConnectedComponents(features: readonly Feature[]): number[][];
4
+ export type SphericalBuildGroup<T> = {
5
+ indices: number[];
6
+ engine: T;
7
+ error?: never;
8
+ } | {
9
+ indices: number[];
10
+ engine?: never;
11
+ error: string;
12
+ };
13
+ export interface RobustSphericalOptions<T> {
14
+ build: (indices: number[], working: readonly Feature[]) => SphericalBuildGroup<T>;
15
+ repair?: (geometry: Geometry) => {
16
+ geometry: Geometry;
17
+ changed: boolean;
18
+ };
19
+ }
20
+ /** Recover independently connected components after a failed global build.
21
+ * Failed groups retain their source geometry at the caller; no implicit repair. */
22
+ export declare function buildRobustSphericalGroups<T>(source: FeatureCollection, options: RobustSphericalOptions<T>): {
23
+ groups: SphericalBuildGroup<T>[];
24
+ working: Feature[];
25
+ unavailable: number;
26
+ reasons: string[];
27
+ };
@@ -0,0 +1,89 @@
1
+ import { canonicalLonLat } from "./spherical-geometry.js";
2
+ const paths = (g) => g.type === "Polygon"
3
+ ? g.coordinates
4
+ : g.type === "MultiPolygon"
5
+ ? g.coordinates.flat()
6
+ : g.type === "LineString"
7
+ ? [g.coordinates]
8
+ : g.coordinates;
9
+ /** Group exact-coordinate-connected features, including shared line vertices. */
10
+ export function sphericalConnectedComponents(features) {
11
+ const parent = features.map((_, i) => i), owner = new Map();
12
+ const root = (index) => {
13
+ let i = index;
14
+ while (parent[i] !== i) {
15
+ parent[i] = parent[parent[i]];
16
+ i = parent[i];
17
+ }
18
+ return i;
19
+ };
20
+ for (const [i, feature] of features.entries()) {
21
+ for (const ring of paths(feature.geometry))
22
+ for (const vertex of ring) {
23
+ const key = JSON.stringify(canonicalLonLat(vertex));
24
+ const previous = owner.get(key);
25
+ if (previous === undefined)
26
+ owner.set(key, i);
27
+ else {
28
+ const a = root(i), b = root(previous);
29
+ if (a !== b)
30
+ parent[a] = b;
31
+ }
32
+ }
33
+ }
34
+ const groups = new Map();
35
+ for (const i of features.keys()) {
36
+ const k = root(i);
37
+ if (!groups.has(k))
38
+ groups.set(k, []);
39
+ groups.get(k).push(i);
40
+ }
41
+ return [...groups.values()];
42
+ }
43
+ /** Recover independently connected components after a failed global build.
44
+ * Failed groups retain their source geometry at the caller; no implicit repair. */
45
+ export function buildRobustSphericalGroups(source, options) {
46
+ const features = source.features, work = [...features], all = features.map((_, i) => i);
47
+ const build = (indices) => options.build(indices, work);
48
+ let groups = [build(all)];
49
+ if (groups[0]?.error && features.length > 1) {
50
+ try {
51
+ const singletonGroups = all.map((i) => {
52
+ let g = build([i]);
53
+ if (g.error && options.repair) {
54
+ const original = features[i], fixed = options.repair(original.geometry);
55
+ if (fixed.changed) {
56
+ work[i] = { ...original, geometry: fixed.geometry };
57
+ const retry = build([i]);
58
+ if (retry.error)
59
+ work[i] = original;
60
+ else
61
+ g = retry;
62
+ }
63
+ }
64
+ return g;
65
+ });
66
+ const invalid = singletonGroups.filter((g) => g.error);
67
+ const valid = all.filter((i) => !singletonGroups[i].error);
68
+ groups = [...(valid.length ? [build(valid)] : []), ...invalid];
69
+ // Regroup when a rejected singleton shares a vertex with a valid group.
70
+ const connected = sphericalConnectedComponents(features);
71
+ const failed = new Set(invalid.flatMap((g) => g.indices));
72
+ if (groups.some((g) => g.error && g.indices.length > 1) ||
73
+ connected.some((c) => c.some((i) => failed.has(i)) && c.some((i) => !failed.has(i)))) {
74
+ groups = connected.map(build);
75
+ }
76
+ }
77
+ catch {
78
+ /* Keep the last complete grouping if recovery fails. */
79
+ }
80
+ }
81
+ return {
82
+ groups,
83
+ working: work,
84
+ unavailable: groups
85
+ .filter((g) => g.error)
86
+ .reduce((n, g) => n + g.indices.length, 0),
87
+ reasons: [...new Set(groups.flatMap((g) => (g.error ? [g.error] : [])))],
88
+ };
89
+ }
@@ -0,0 +1,22 @@
1
+ import type { SphericalClipStats } from "./spherical-clip.js";
2
+ import type { SphericalViewCone, SphericalCap } from "./spherical-cull.js";
3
+ import type { FeatureCollection } from "./types.js";
4
+ export interface SphericalViewClipperOptions {
5
+ margin?: number;
6
+ radiusScale?: number;
7
+ maxRadius?: number;
8
+ }
9
+ export interface CachedSphericalClipResult {
10
+ geojson: FeatureCollection;
11
+ stats: SphericalClipStats & {
12
+ mode: "clip" | "cull";
13
+ rebuilt: boolean;
14
+ sourceVertices: number;
15
+ sourceFeatures: number;
16
+ };
17
+ }
18
+ /** Inputs are immutable by convention. Change identity or call invalidate after edits.
19
+ * Supplied caps must conservatively enclose their corresponding frame features. */
20
+ export declare function createSphericalViewClipper({ margin, radiusScale, maxRadius, }?: SphericalViewClipperOptions): ((geojson: FeatureCollection, cone: SphericalViewCone, suppliedCaps?: readonly SphericalCap[]) => CachedSphericalClipResult) & {
21
+ invalidate: () => void;
22
+ };
@@ -0,0 +1,85 @@
1
+ import { clipWindow, clipFeatureCollection, buildFeatureInfo, countVertices, } from "./spherical-clip.js";
2
+ import { computeFeatureCaps, filterSphericalFeatures, } from "./spherical-cull.js";
3
+ /** Inputs are immutable by convention. Change identity or call invalidate after edits.
4
+ * Supplied caps must conservatively enclose their corresponding frame features. */
5
+ export function createSphericalViewClipper({ margin = 0, radiusScale = 1.2, maxRadius = Math.PI / 2 - 0.12, } = {}) {
6
+ if (!Number.isFinite(margin) ||
7
+ margin < 0 ||
8
+ !Number.isFinite(radiusScale) ||
9
+ radiusScale < 1 ||
10
+ !Number.isFinite(maxRadius) ||
11
+ maxRadius <= 0 ||
12
+ maxRadius >= Math.PI / 2)
13
+ throw new Error("Invalid spherical clip options");
14
+ let frame, capIdentity, caps, infos = [], sourceVertices = 0;
15
+ let cached;
16
+ const invalidate = () => {
17
+ frame = undefined;
18
+ capIdentity = undefined;
19
+ caps = undefined;
20
+ infos = [];
21
+ cached = undefined;
22
+ sourceVertices = 0;
23
+ };
24
+ function clip(geojson, cone, suppliedCaps) {
25
+ if (!Number.isFinite(cone.viewRadius) ||
26
+ cone.viewRadius < 0 ||
27
+ cone.viewRadius > Math.PI ||
28
+ Math.abs(Math.hypot(cone.vx, cone.vy, cone.vz) - 1) > 1e-9 ||
29
+ ![cone.vx, cone.vy, cone.vz].every(Number.isFinite))
30
+ throw new Error("Invalid spherical view cone");
31
+ if (suppliedCaps && suppliedCaps.length !== geojson.features.length)
32
+ throw new Error("Spherical caps must match feature count");
33
+ if (frame !== geojson || capIdentity !== suppliedCaps) {
34
+ invalidate();
35
+ frame = geojson;
36
+ capIdentity = suppliedCaps;
37
+ caps = suppliedCaps ?? computeFeatureCaps(geojson);
38
+ sourceVertices = countVertices(geojson);
39
+ }
40
+ const sourceFeatures = geojson.features.length;
41
+ if (!sourceFeatures ||
42
+ cone.viewRadius + margin > maxRadius ||
43
+ cone.viewRadius + margin === 0) {
44
+ cached = undefined;
45
+ const visible = filterSphericalFeatures(geojson, cone, caps);
46
+ return {
47
+ geojson: visible,
48
+ stats: {
49
+ mode: "cull",
50
+ rebuilt: true,
51
+ sourceFeatures,
52
+ sourceVertices,
53
+ features: visible.features.length,
54
+ vertices: countVertices(visible),
55
+ rings: { kept: 0, clipped: 0, wrapped: 0, dropped: 0 },
56
+ stream: { classified: 0, inside: 0, outside: 0 },
57
+ },
58
+ };
59
+ }
60
+ if (cached) {
61
+ const w = cached.window;
62
+ const angle = Math.acos(Math.max(-1, Math.min(1, w.cx * cone.vx + w.cy * cone.vy + w.cz * cone.vz)));
63
+ if (angle + cone.viewRadius + margin <= w.radius)
64
+ return {
65
+ geojson: cached.result.geojson,
66
+ stats: { ...cached.result.stats, rebuilt: false },
67
+ };
68
+ }
69
+ const window = clipWindow(cone.vx, cone.vy, cone.vz, Math.min(maxRadius, cone.viewRadius * radiusScale + margin));
70
+ const { geojson: out, stats } = clipFeatureCollection(geojson, window, (i, f) => (infos[i] ??= buildFeatureInfo(f, caps[i])));
71
+ const result = {
72
+ geojson: out,
73
+ stats: {
74
+ ...stats,
75
+ mode: "clip",
76
+ rebuilt: true,
77
+ sourceFeatures,
78
+ sourceVertices,
79
+ },
80
+ };
81
+ cached = { window, result };
82
+ return result;
83
+ }
84
+ return Object.assign(clip, { invalidate });
85
+ }
@@ -1,6 +1,8 @@
1
+ import { type Work } from "./cooperative.js";
1
2
  import type { FeatureCollection, Position, Topology } from "./types.js";
2
3
  /** Exact coordinate topology: no implicit snapping, deduping almost-equal points, or antimeridian wrapping. */
3
4
  export declare function buildTopology(input: FeatureCollection): Topology;
5
+ export declare function buildPlanarTopologySteps(input: FeatureCollection): Work<Topology>;
4
6
  export interface TopologyPolicy {
5
7
  position(value: unknown): Position;
6
8
  ring(ring: readonly Position[]): boolean;
@@ -9,3 +11,4 @@ export interface TopologyPolicy {
9
11
  }
10
12
  /** Internal shared graph construction; coordinate semantics are provided by the caller. */
11
13
  export declare function buildTopologyWithPolicy(input: FeatureCollection, policy: TopologyPolicy): Topology;
14
+ export declare function buildTopologySteps(input: FeatureCollection, policy: TopologyPolicy): Work<Topology>;
package/dist/topology.js CHANGED
@@ -1,7 +1,11 @@
1
+ import { runSync } from "./cooperative.js";
1
2
  import { assertPosition, boundsOf, simpleClosedRing, validPolygon, unionBounds, } from "./geometry.js";
2
3
  /** Exact coordinate topology: no implicit snapping, deduping almost-equal points, or antimeridian wrapping. */
3
4
  export function buildTopology(input) {
4
- return buildTopologyWithPolicy(input, {
5
+ return runSync(buildPlanarTopologySteps(input));
6
+ }
7
+ export function* buildPlanarTopologySteps(input) {
8
+ return yield* buildTopologySteps(input, {
5
9
  position: assertPosition,
6
10
  ring: simpleClosedRing,
7
11
  polygon: validPolygon,
@@ -9,6 +13,9 @@ export function buildTopology(input) {
9
13
  }
10
14
  /** Internal shared graph construction; coordinate semantics are provided by the caller. */
11
15
  export function buildTopologyWithPolicy(input, policy) {
16
+ return runSync(buildTopologySteps(input, policy));
17
+ }
18
+ export function* buildTopologySteps(input, policy) {
12
19
  if (!input ||
13
20
  input.type !== "FeatureCollection" ||
14
21
  !Array.isArray(input.features))
@@ -29,6 +36,12 @@ export function buildTopologyWithPolicy(input, policy) {
29
36
  return id;
30
37
  }
31
38
  for (let f = 0; f < input.features.length; f++) {
39
+ if (f % 32 === 0)
40
+ yield {
41
+ stage: "Topology features",
42
+ completed: f,
43
+ total: input.features.length,
44
+ };
32
45
  const feature = input.features[f];
33
46
  if (!feature ||
34
47
  feature.type !== "Feature" ||
@@ -43,10 +56,15 @@ export function buildTopologyWithPolicy(input, policy) {
43
56
  if (!["Polygon", "MultiPolygon", "LineString", "MultiLineString"].includes(type))
44
57
  throw new Error(`Unsupported geometry: ${type}`);
45
58
  const paths = [], groups = [];
46
- function append(coords, closed) {
59
+ function* append(coords, closed) {
47
60
  if (!Array.isArray(coords))
48
61
  throw new Error("Invalid coordinate path");
49
- const pts = coords.map(policy.position);
62
+ const pts = [];
63
+ for (let i = 0; i < coords.length; i++) {
64
+ if (i % 512 === 0)
65
+ yield undefined;
66
+ pts.push(policy.position(coords[i]));
67
+ }
50
68
  if (closed) {
51
69
  if (pts.length >= 2 &&
52
70
  pts[0][0] === pts.at(-1)[0] &&
@@ -60,8 +78,12 @@ export function buildTopologyWithPolicy(input, policy) {
60
78
  new Set(pts.map((p) => JSON.stringify(p))).size < 2 ||
61
79
  (policy.line && !policy.line(pts)))
62
80
  throw new Error(`Line requires >=2 distinct coordinates in feature ${featureId}`);
63
- const ids = pts.map(vertexId);
64
- for (const id of ids) {
81
+ const ids = [];
82
+ for (let i = 0; i < pts.length; i++) {
83
+ if (i % 512 === 0)
84
+ yield undefined;
85
+ const id = vertexId(pts[i]);
86
+ ids.push(id);
65
87
  if (!featureIdsByVertex.has(id))
66
88
  featureIdsByVertex.set(id, new Set());
67
89
  featureIdsByVertex.get(id).add(featureId);
@@ -72,7 +94,7 @@ export function buildTopologyWithPolicy(input, policy) {
72
94
  const group = [];
73
95
  for (const ring of coordinates) {
74
96
  group.push(paths.length);
75
- append(ring, true);
97
+ yield* append(ring, true);
76
98
  }
77
99
  if (!group.length ||
78
100
  !policy.polygon(coordinates.map((r) => {
@@ -90,7 +112,7 @@ export function buildTopologyWithPolicy(input, policy) {
90
112
  const group = [];
91
113
  for (const ring of polygon) {
92
114
  group.push(paths.length);
93
- append(ring, true);
115
+ yield* append(ring, true);
94
116
  }
95
117
  groups.push(group);
96
118
  if (!policy.polygon(polygon.map((r) => {
@@ -106,13 +128,13 @@ export function buildTopologyWithPolicy(input, policy) {
106
128
  throw new Error(`Empty multipolygon: ${featureId}`);
107
129
  }
108
130
  else if (type === "LineString") {
109
- append(coordinates, false);
131
+ yield* append(coordinates, false);
110
132
  groups.push([0]);
111
133
  }
112
134
  else {
113
135
  for (const line of coordinates) {
114
136
  const i = paths.length;
115
- append(line, false);
137
+ yield* append(line, false);
116
138
  groups.push([i]);
117
139
  }
118
140
  if (!groups.length)
@@ -146,6 +168,8 @@ export function buildTopologyWithPolicy(input, policy) {
146
168
  vertices[path.ids[i]].critical = true;
147
169
  }
148
170
  for (let i = 0; i < limit; i++) {
171
+ if (i % 512 === 0)
172
+ yield undefined;
149
173
  const a = path.ids[i], b = path.ids[(i + 1) % n];
150
174
  if (a === b)
151
175
  continue;
@@ -163,7 +187,10 @@ export function buildTopologyWithPolicy(input, policy) {
163
187
  pathNumber++;
164
188
  }
165
189
  const incident = new Map();
190
+ let edgeCount = 0;
166
191
  for (const [edge, owners] of edgeOwners) {
192
+ if (edgeCount++ % 512 === 0)
193
+ yield undefined;
167
194
  const signature = [...owners].sort((a, b) => a - b).join(",");
168
195
  const [a, b] = edge.split(":").map(Number);
169
196
  for (const id of [a, b]) {
@@ -173,6 +200,8 @@ export function buildTopologyWithPolicy(input, policy) {
173
200
  }
174
201
  }
175
202
  for (const v of vertices) {
203
+ if (v.id % 512 === 0)
204
+ yield undefined;
176
205
  const shapeCount = featureIdsByVertex.get(v.id)?.size ?? 0;
177
206
  if (shapeCount >= 3 ||
178
207
  neighbors.get(v.id)?.size !== 2 ||
@@ -214,6 +243,8 @@ export function buildTopologyWithPolicy(input, policy) {
214
243
  const refs = [], n = ids.length, total = raw.closed ? n : n - 1;
215
244
  let current = [ids[0]];
216
245
  for (let i = 1; i <= total; i++) {
246
+ if (i % 512 === 0)
247
+ yield undefined;
217
248
  const next = ids[i % n];
218
249
  current.push(next);
219
250
  if (vertices[next].critical || i === total) {
package/dist/types.d.ts CHANGED
@@ -79,8 +79,12 @@ export interface QueryResult {
79
79
  /** Whether the requested reconstruction passed the dataset's validity checks. */
80
80
  valid: boolean;
81
81
  usedFallback: boolean;
82
- /** Spherical queries: arcs promoted to a finer level to keep features valid. */
82
+ /** Deprecated spherical diagnostic: always zero for preprocessed hierarchies. */
83
83
  promotedArcs?: number;
84
+ /** Spherical queries with the "drop" policy: polygons hidden by the tree. */
85
+ hiddenPolygons?: number;
86
+ /** Spherical queries with the "drop" policy: closed rings (shells and holes) omitted. */
87
+ hiddenRings?: number;
84
88
  selectedFeatures: number;
85
89
  selectedVertices: number;
86
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizhub/quadstream",
3
- "version": "0.2.0",
3
+ "version": "1.0.0",
4
4
  "description": "Deterministic, topology-aware progressive geographic geometry engine",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -21,6 +21,9 @@
21
21
  "bin"
22
22
  ],
23
23
  "scripts": {
24
+ "dev": "npm run build && npm --prefix quadstream-globe run dev",
25
+ "dev:legacy": "npm run build && node examples/progressive/server.mjs --globe",
26
+ "dev:restart": "node scripts/dev-restart.mjs",
24
27
  "build": "tsc -p tsconfig.json",
25
28
  "typecheck": "tsc -p tsconfig.json --noEmit",
26
29
  "prettier": "prettier --write .",
@@ -35,16 +38,18 @@
35
38
  "test:package": "node scripts/test-package.mjs"
36
39
  },
37
40
  "devDependencies": {
38
- "typescript": "^6.0.3",
39
- "prettier": "3.10.1",
40
- "eslint": "10.15.0",
41
41
  "@eslint/js": "10.0.1",
42
- "typescript-eslint": "8.74.0",
43
- "globals": "17.14.0",
44
- "maplibre-gl": "6.19.0",
45
42
  "@playwright/test": "1.65.1",
46
43
  "d3": "7.9.2",
44
+ "eslint": "10.16.0",
45
+ "globals": "17.14.0",
46
+ "maplibre-gl": "6.20.0",
47
+ "prettier": "3.10.1",
47
48
  "topojson-client": "3.1.0",
49
+ "typescript": "^6.0.3",
50
+ "typescript-eslint": "8.74.0",
51
+ "us-atlas": "3.0.1",
52
+ "visionscarto-world-atlas": "1.0.0",
48
53
  "world-atlas": "2.0.2"
49
54
  },
50
55
  "bin": {