@nebula-spatial/cad-loader 0.2.4 → 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.
@@ -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;
@@ -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;
@@ -469,7 +469,8 @@ function Pe(t) {
469
469
  dotCount: Number(t.dot_count || 0),
470
470
  textCount: r.length,
471
471
  layers: Sn(t.layers ?? []),
472
- texts: r
472
+ texts: r,
473
+ units: t.units
473
474
  };
474
475
  }
475
476
  function Tn(t) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebula-spatial/cad-loader",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "description": "Browser-side DXB3/DXBS CAD pack loader runtime",
5
5
  "license": "ISC",
6
6
  "engines": {