@nebula-spatial/cad-loader 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +22 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1398 -1322
- package/dist/core/parser/bin-parser.d.ts +17 -4
- package/dist/core/parser/types.d.ts +2 -1
- package/dist/core/types.d.ts +6 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1096 -1053
- package/dist/loader/internal/external-variant-sidecar-fetch.d.ts +0 -1
- package/dist/loader/internal/geo-loader-pipeline.d.ts +2 -0
- package/dist/loader/internal/geo-node-builder.d.ts +1 -0
- package/dist/loader/internal/geo-node.d.ts +4 -0
- package/dist/loader/internal/geo-prepare-worker-types.d.ts +1 -0
- package/dist/render-resource/cad-render-node.d.ts +9 -0
- package/dist/session/cad-document-session.d.ts +8 -1
- package/dist/shared/text-builder.d.ts +25 -0
- package/dist/workers/geo-prepare.worker.js +1048 -974
- package/package.json +1 -1
|
@@ -5,7 +5,6 @@ export type FetchExternalVariantSidecarsOptions = {
|
|
|
5
5
|
readonly requiredVariantIds: readonly number[];
|
|
6
6
|
readonly fetchImpl?: typeof fetch;
|
|
7
7
|
readonly signal?: AbortSignal;
|
|
8
|
-
readonly concurrency?: number;
|
|
9
8
|
readonly onBuffer?: (variantId: number, buffer: ArrayBuffer) => void | Promise<void>;
|
|
10
9
|
};
|
|
11
10
|
export declare function fetchExternalVariantSidecars(options: FetchExternalVariantSidecarsOptions): Promise<{
|
|
@@ -45,6 +45,7 @@ export interface GeoLoaderPipelineAdapterInput {
|
|
|
45
45
|
externalVariantGeometryFetchIds?: ReadonlySet<number>;
|
|
46
46
|
deferExternalVariantGeometry?: boolean;
|
|
47
47
|
externalVariantDeltaOnly?: boolean;
|
|
48
|
+
cacheDocument?: boolean;
|
|
48
49
|
}
|
|
49
50
|
export interface GeoLoaderPipelineSession {
|
|
50
51
|
completion: Promise<void>;
|
|
@@ -81,6 +82,7 @@ export interface RunGeoLoaderPipelineOptions {
|
|
|
81
82
|
externalVariantGeometryFetchIds?: ReadonlySet<number>;
|
|
82
83
|
deferExternalVariantGeometry?: boolean;
|
|
83
84
|
externalVariantDeltaOnly?: boolean;
|
|
85
|
+
cacheDocument?: boolean;
|
|
84
86
|
appendExternalVariantDelta?: boolean;
|
|
85
87
|
onYield?: YieldCallback;
|
|
86
88
|
scheduler?: Partial<FrameBudgetSchedulerOptions>;
|
|
@@ -26,6 +26,7 @@ export interface BuildGeoNodeOptions {
|
|
|
26
26
|
externalVariantGeometryFetchIds?: ReadonlySet<number> | readonly number[];
|
|
27
27
|
deferExternalVariantGeometry?: boolean;
|
|
28
28
|
externalVariantDeltaOnly?: boolean;
|
|
29
|
+
cacheDocument?: boolean;
|
|
29
30
|
onFirstRenderableAppend?: () => void;
|
|
30
31
|
}
|
|
31
32
|
export declare function buildGeoNodeFromBuffer(node: GeoNode, buf: ArrayBuffer, onYield?: YieldCallback, options?: BuildGeoNodeOptions): Promise<void>;
|
|
@@ -115,6 +115,10 @@ export declare class GeoNode extends Group {
|
|
|
115
115
|
onChange(listener: GeoNodeChangeListener): () => void;
|
|
116
116
|
_notifyStructureChange(): void;
|
|
117
117
|
setLayerVisible(layerIndex: number, visible: boolean): void;
|
|
118
|
+
setLayerVisibleBatch(changes: ReadonlyArray<{
|
|
119
|
+
layerIndex: number;
|
|
120
|
+
visible: boolean;
|
|
121
|
+
}>): number;
|
|
118
122
|
setAnnotationOverlayVisible(visible: boolean): void;
|
|
119
123
|
setDisplayTheme(themeName: ViewerThemeName, options?: {
|
|
120
124
|
enhanceContrast?: boolean;
|
|
@@ -26,6 +26,7 @@ export interface GeoPrepareParseRequest {
|
|
|
26
26
|
requiredExternalVariantIds?: number[];
|
|
27
27
|
externalVariantGeometryFetchIds?: number[];
|
|
28
28
|
externalVariantDeltaOnly?: boolean;
|
|
29
|
+
cacheDocument?: boolean;
|
|
29
30
|
}
|
|
30
31
|
export interface GeoPrepareGrantMessage {
|
|
31
32
|
type: 'grant';
|
|
@@ -41,6 +41,10 @@ export interface CadInsertVisibilityChange {
|
|
|
41
41
|
readonly insertId: string;
|
|
42
42
|
readonly visible: boolean;
|
|
43
43
|
}
|
|
44
|
+
export interface CadLayerVisibilityChange {
|
|
45
|
+
readonly layerIndex: number;
|
|
46
|
+
readonly visible: boolean;
|
|
47
|
+
}
|
|
44
48
|
/**
|
|
45
49
|
* Read-only CAD render resource. Editing methods belong to legacy GeoNode and
|
|
46
50
|
* must not appear on this type.
|
|
@@ -54,6 +58,11 @@ export interface CadRenderNode {
|
|
|
54
58
|
appendContent(chunk: CadRenderContentChunk): boolean;
|
|
55
59
|
setDisplayContext(context: CadDisplayContext): void;
|
|
56
60
|
setLayerVisible(layerIndex: number, visible: boolean): void;
|
|
61
|
+
/**
|
|
62
|
+
* Applies layer visibility changes as one render-resource transaction. This
|
|
63
|
+
* avoids rebuilding the viewport INSERT presenter once per changed layer.
|
|
64
|
+
*/
|
|
65
|
+
setLayerVisibleBatch(changes: ReadonlyArray<CadLayerVisibilityChange>): void;
|
|
57
66
|
setLayerColorOverride(layerIndex: number, color: number | null): void;
|
|
58
67
|
setInsertVisible(insertId: string, visible: boolean): void;
|
|
59
68
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CadInsertDetails, CadInsertSelectionId } from '../selection/cad-insert-selection';
|
|
2
|
-
import type { CadTextSelection } from '../selection/cad-text-selection';
|
|
2
|
+
import type { CadTextDetails, CadTextSelection, CadTextSelectionId } from '../selection/cad-text-selection';
|
|
3
3
|
import type { ResolveTextFont } from '../shared/text-font';
|
|
4
4
|
import type { CadTextWarmupOptions } from './cad-text-warmup';
|
|
5
5
|
import type { ViewportRect } from '../core';
|
|
@@ -31,6 +31,11 @@ export interface CadLayerMeta {
|
|
|
31
31
|
readonly color: readonly [number, number, number];
|
|
32
32
|
readonly visible: boolean;
|
|
33
33
|
}
|
|
34
|
+
/** Source units carried by a generated CAD pack when available. */
|
|
35
|
+
export interface CadDocumentUnits {
|
|
36
|
+
readonly source: string;
|
|
37
|
+
readonly scaleToMeters?: number;
|
|
38
|
+
}
|
|
34
39
|
export interface CadVisibilityFilter {
|
|
35
40
|
readonly layerVisible?: ReadonlyMap<number, boolean> | ((layerIndex: number) => boolean);
|
|
36
41
|
readonly insertVisible?: ReadonlySet<string> | ((insertId: string) => boolean);
|
|
@@ -61,6 +66,7 @@ export interface CadDocumentHeader {
|
|
|
61
66
|
readonly sourceFingerprint: string;
|
|
62
67
|
readonly format: string;
|
|
63
68
|
readonly filename: string | null;
|
|
69
|
+
readonly units?: CadDocumentUnits;
|
|
64
70
|
}
|
|
65
71
|
export interface CadInsertSelection {
|
|
66
72
|
readonly documentKey: string | null;
|
|
@@ -154,6 +160,7 @@ export interface CadDocumentSession {
|
|
|
154
160
|
getLayers(): readonly CadLayerMeta[];
|
|
155
161
|
listInsertUsages(): readonly CadInsertUsageSummary[];
|
|
156
162
|
getBlockDetails(id: string): CadInsertDetails | null;
|
|
163
|
+
getTextDetails?(id: CadTextSelectionId): CadTextDetails | null;
|
|
157
164
|
pickInsertAtPoint(point: CadWorldPoint, viewport: ViewportRect): CadInsertSelection | null;
|
|
158
165
|
/** Optional for compatibility with pre-text-picking session adapters. */
|
|
159
166
|
pickTextAtPoint?(point: CadWorldPoint): CadTextSelection | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options accepted by Troika's global text builder configuration.
|
|
3
|
+
*
|
|
4
|
+
* This is intentionally a thin public surface over Troika. The configuration
|
|
5
|
+
* remains global to the module instance and must be supplied before the first
|
|
6
|
+
* font request. No defaults are applied here so an omitted configuration keeps
|
|
7
|
+
* Troika's original built-in behavior unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export interface CadTextBuilderOptions {
|
|
10
|
+
readonly defaultFontURL?: string;
|
|
11
|
+
readonly unicodeFontsURL?: string;
|
|
12
|
+
readonly sdfGlyphSize?: number;
|
|
13
|
+
readonly sdfMargin?: number;
|
|
14
|
+
readonly sdfExponent?: number;
|
|
15
|
+
readonly textureWidth?: number;
|
|
16
|
+
readonly useWorker?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Configures the Troika text builder used by cad-loader.
|
|
20
|
+
*
|
|
21
|
+
* This function deliberately does not add its own lifecycle, retry, fallback,
|
|
22
|
+
* or per-viewer state. Troika remains responsible for its existing
|
|
23
|
+
* module-level, one-time configuration semantics.
|
|
24
|
+
*/
|
|
25
|
+
export declare function configureCadTextBuilder(options: CadTextBuilderOptions): void;
|