@thatopen/components 3.3.2 → 3.4.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 +81 -81
- package/dist/index.cjs +77961 -13236
- package/dist/index.d.ts +2465 -18
- package/dist/index.min.cjs +17 -9
- package/dist/index.min.mjs +17 -8
- package/dist/index.mjs +77405 -12680
- package/package.json +60 -59
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,241 @@ declare class AmbientLightConfig {
|
|
|
33
33
|
set intensity(value: number);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export declare interface AngleAnnotation {
|
|
37
|
+
/** Unique identifier. */
|
|
38
|
+
uuid: string;
|
|
39
|
+
/** Snapped point on the first line — defines the first ray direction from the vertex. */
|
|
40
|
+
pointA: THREE.Vector3;
|
|
41
|
+
/** Computed intersection of the two measured lines. */
|
|
42
|
+
vertex: THREE.Vector3;
|
|
43
|
+
/** Snapped point on the second line — defines the second ray direction from the vertex. */
|
|
44
|
+
pointB: THREE.Vector3;
|
|
45
|
+
/** Radius of the arc at commit time, in drawing local units. */
|
|
46
|
+
arcRadius: number;
|
|
47
|
+
/**
|
|
48
|
+
* When `true`, the arc measures the reflex angle (360° − interior).
|
|
49
|
+
* The arc is drawn going the long way around and the bisector flips 180°.
|
|
50
|
+
*/
|
|
51
|
+
flipped?: boolean;
|
|
52
|
+
/** Name of the {@link AngleAnnotationStyle} to use when rendering. */
|
|
53
|
+
style: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Editable fields of {@link AngleAnnotation} — everything except the `uuid`. */
|
|
57
|
+
export declare type AngleAnnotationData = Omit<AngleAnnotation, "uuid">;
|
|
58
|
+
|
|
59
|
+
export declare type AngleAnnotationEvent =
|
|
60
|
+
/**
|
|
61
|
+
* A point was clicked. Carries `drawing` so the machine caches it on the first
|
|
62
|
+
* click — subsequent events reuse that context.
|
|
63
|
+
* `line` is required in `awaitingFirstLine` and `awaitingSecondLine`;
|
|
64
|
+
* free-space clicks are accepted in `positioningArc`.
|
|
65
|
+
*/
|
|
66
|
+
{
|
|
67
|
+
type: "CLICK";
|
|
68
|
+
point: THREE.Vector3;
|
|
69
|
+
line?: THREE.Line3;
|
|
70
|
+
drawing?: TechnicalDrawing;
|
|
71
|
+
}
|
|
72
|
+
/** Cursor moved — drawing context already cached from the initial CLICK. */
|
|
73
|
+
| {
|
|
74
|
+
type: "MOUSE_MOVE";
|
|
75
|
+
point: THREE.Vector3;
|
|
76
|
+
line?: THREE.Line3;
|
|
77
|
+
}
|
|
78
|
+
/** Cancel and return to the initial state. */
|
|
79
|
+
| {
|
|
80
|
+
type: "ESCAPE";
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Global drawing system that manages angle dimension annotations across all
|
|
85
|
+
* {@link TechnicalDrawing} instances.
|
|
86
|
+
*/
|
|
87
|
+
export declare class AngleAnnotations extends AnnotationSystem<AngleAnnotationSystem> implements Transitionable<AngleAnnotationState, AngleAnnotationEvent>, Disposable_2 {
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
readonly _item: AngleAnnotation;
|
|
90
|
+
machineState: AngleAnnotationState;
|
|
91
|
+
readonly onMachineStateChanged: Event_2<AngleAnnotationState>;
|
|
92
|
+
private _secondLinePreviewObject;
|
|
93
|
+
constructor(components: Components);
|
|
94
|
+
pickHandle(_drawing: TechnicalDrawing, _ray: THREE.Ray, _threshold?: number): {
|
|
95
|
+
uuid: string;
|
|
96
|
+
handle: "pointA" | "vertex" | "pointB";
|
|
97
|
+
} | null;
|
|
98
|
+
sendMachineEvent(event: AngleAnnotationEvent): void;
|
|
99
|
+
protected _buildGroup(dim: AngleAnnotation, style: AngleAnnotationStyle): THREE.Group;
|
|
100
|
+
protected _updatePreview(): void;
|
|
101
|
+
protected _onDispose(): void;
|
|
102
|
+
private _resetMachine;
|
|
103
|
+
private _clearSecondLinePreview;
|
|
104
|
+
private _updateSecondLinePreview;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export declare type AngleAnnotationState =
|
|
108
|
+
/** Waiting for the user to click the first measured line. */
|
|
109
|
+
{
|
|
110
|
+
kind: "awaitingFirstLine";
|
|
111
|
+
}
|
|
112
|
+
/** First line picked. Waiting for the second line. */
|
|
113
|
+
| {
|
|
114
|
+
kind: "awaitingSecondLine";
|
|
115
|
+
line1: THREE.Line3;
|
|
116
|
+
pointA: THREE.Vector3;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Both lines picked, vertex computed. User moves the cursor to set the
|
|
120
|
+
* arc radius, then clicks to commit.
|
|
121
|
+
*/
|
|
122
|
+
| {
|
|
123
|
+
kind: "positioningArc";
|
|
124
|
+
pointA: THREE.Vector3;
|
|
125
|
+
vertex: THREE.Vector3;
|
|
126
|
+
pointB: THREE.Vector3;
|
|
127
|
+
cursor: THREE.Vector3 | null;
|
|
128
|
+
flipped: boolean;
|
|
129
|
+
}
|
|
130
|
+
/** Annotation just committed. */
|
|
131
|
+
| {
|
|
132
|
+
kind: "committed";
|
|
133
|
+
dimension: AngleAnnotation;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export declare interface AngleAnnotationStyle extends BaseAnnotationStyle {
|
|
137
|
+
/** Tick mark builder at each end of the arc. */
|
|
138
|
+
lineTick: LineTickBuilder;
|
|
139
|
+
/**
|
|
140
|
+
* Optional filled tick mark builder. When provided, a `THREE.Mesh` triangle
|
|
141
|
+
* is rendered at each arc endpoint. Set `tick` to {@link NoTick} when you
|
|
142
|
+
* only want the filled shape.
|
|
143
|
+
*/
|
|
144
|
+
meshTick?: MeshTickBuilder;
|
|
145
|
+
/** Tick size in drawing local units. */
|
|
146
|
+
tickSize: number;
|
|
147
|
+
/** Gap between the vertex and the start of each extension line. */
|
|
148
|
+
extensionGap: number;
|
|
149
|
+
/** Distance from the arc to the text label, along the bisector ray. */
|
|
150
|
+
textOffset: number;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare interface AngleAnnotationSystem {
|
|
154
|
+
item: AngleAnnotation;
|
|
155
|
+
data: AngleAnnotationData;
|
|
156
|
+
style: AngleAnnotationStyle;
|
|
157
|
+
handle: "pointA" | "vertex" | "pointB";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Pure state transition function for the angle dimension tool.
|
|
162
|
+
* Returns the **same state reference** when no transition applies.
|
|
163
|
+
*/
|
|
164
|
+
export declare function angleDimensionMachine(state: AngleAnnotationState, event: AngleAnnotationEvent): AngleAnnotationState;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* A single annotation entry stored in {@link DrawingAnnotations}.
|
|
168
|
+
* Bundles the owning system, the annotation data, and its Three.js group
|
|
169
|
+
* so that any lookup by UUID gives full access to all three.
|
|
170
|
+
*/
|
|
171
|
+
export declare interface AnnotationEntry {
|
|
172
|
+
/** The system that created and owns this annotation. */
|
|
173
|
+
system: AnnotationSystem<any>;
|
|
174
|
+
/** The persisted annotation data (e.g. {@link LinearAnnotation}). */
|
|
175
|
+
data: unknown;
|
|
176
|
+
/** The Three.js group added to {@link TechnicalDrawing.three}. */
|
|
177
|
+
three: THREE.Group;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Abstract base for all annotation sub-systems operating on a
|
|
182
|
+
* {@link TechnicalDrawing}. Provides the full CRUD lifecycle, material caches,
|
|
183
|
+
* preview geometry, and automatic style-reactivity so subclasses only need to
|
|
184
|
+
* implement geometry construction and handle-picking.
|
|
185
|
+
*
|
|
186
|
+
* @typeParam TSystem - A {@link DrawingSystemDescriptor} that declares the item,
|
|
187
|
+
* data, style, and handle types for this specific system.
|
|
188
|
+
*/
|
|
189
|
+
declare abstract class AnnotationSystem<TSystem extends DrawingSystemDescriptor> {
|
|
190
|
+
protected readonly _components: Components;
|
|
191
|
+
/* Excluded from this release type: _item */
|
|
192
|
+
constructor(_components: Components);
|
|
193
|
+
abstract enabled: boolean;
|
|
194
|
+
readonly styles: FRAGS.DataMap<string, TSystem["style"]>;
|
|
195
|
+
activeStyle: string;
|
|
196
|
+
readonly onCommit: Event_2<{
|
|
197
|
+
drawing: TechnicalDrawing;
|
|
198
|
+
item: TSystem["item"];
|
|
199
|
+
group: THREE.Group;
|
|
200
|
+
}[]>;
|
|
201
|
+
readonly onUpdate: Event_2<{
|
|
202
|
+
item: TSystem["item"];
|
|
203
|
+
group: THREE.Group;
|
|
204
|
+
}>;
|
|
205
|
+
readonly onDelete: Event_2<string[]>;
|
|
206
|
+
readonly onDisposed: Event_2<void>;
|
|
207
|
+
protected readonly _knownDrawings: Set<TechnicalDrawing>;
|
|
208
|
+
protected readonly _previewMaterial: THREE.LineBasicMaterial;
|
|
209
|
+
protected _previewObject: THREE.LineSegments | null;
|
|
210
|
+
protected _previewDrawing: TechnicalDrawing | null;
|
|
211
|
+
protected readonly _materialCache: FRAGS.DataMap<string, THREE.LineBasicMaterial>;
|
|
212
|
+
protected readonly _meshMaterialCache: FRAGS.DataMap<string, THREE.MeshBasicMaterial>;
|
|
213
|
+
/**
|
|
214
|
+
* When `true` (default), {@link _disposeGroup} and {@link _redraw} will call
|
|
215
|
+
* `.dispose()` on each child's `BufferGeometry`. Set to `false` in systems
|
|
216
|
+
* where geometry is shared across multiple groups (e.g. {@link BlockAnnotations}).
|
|
217
|
+
*/
|
|
218
|
+
protected _ownsChildGeometry: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Build and return a `THREE.Group` containing all geometry for `item`.
|
|
221
|
+
* The group's own `userData` is set by the base class after this call.
|
|
222
|
+
* Set `userData` on *children* (e.g. `ls.userData.isDimension = true`) here.
|
|
223
|
+
*/
|
|
224
|
+
protected abstract _buildGroup(item: TSystem["item"], style: TSystem["style"]): THREE.Group;
|
|
225
|
+
/**
|
|
226
|
+
* Return the closest pickable handle on `drawing` for the given world-space
|
|
227
|
+
* `ray`, or `null` if nothing is within `threshold` units.
|
|
228
|
+
*/
|
|
229
|
+
abstract pickHandle(drawing: TechnicalDrawing, ray: THREE.Ray, threshold?: number): {
|
|
230
|
+
uuid: string;
|
|
231
|
+
handle: TSystem["handle"];
|
|
232
|
+
} | null;
|
|
233
|
+
/** Called synchronously after a group is first persisted or redrawn. */
|
|
234
|
+
protected _onAfterPersist(_item: TSystem["item"], _group: THREE.Group): void;
|
|
235
|
+
/** Called at the start of {@link dispose} before materials and events are torn down. */
|
|
236
|
+
protected _onDispose(): void;
|
|
237
|
+
/** Override to rebuild preview geometry after a state transition. */
|
|
238
|
+
protected _updatePreview(): void;
|
|
239
|
+
get(drawings: TechnicalDrawing[]): FRAGS.DataMap<string, {
|
|
240
|
+
drawingUuid: string;
|
|
241
|
+
item: TSystem["item"];
|
|
242
|
+
}>;
|
|
243
|
+
add(drawing: TechnicalDrawing, data: TSystem["data"]): TSystem["item"];
|
|
244
|
+
update(drawing: TechnicalDrawing, uuids: string[], changes: Partial<TSystem["data"]>): void;
|
|
245
|
+
pick(ray: THREE.Ray, threshold?: number): string | null;
|
|
246
|
+
delete(drawing: TechnicalDrawing, uuids: string[]): void;
|
|
247
|
+
clear(drawings?: TechnicalDrawing[]): void;
|
|
248
|
+
dispose(): void;
|
|
249
|
+
protected _trackDrawing(drawing: TechnicalDrawing): void;
|
|
250
|
+
protected _resolveStyle(styleName: string): TSystem["style"];
|
|
251
|
+
protected _getMaterial(styleName: string): THREE.LineBasicMaterial;
|
|
252
|
+
protected _getMeshMaterial(styleName: string): THREE.MeshBasicMaterial;
|
|
253
|
+
protected _disposeGroup(group: THREE.Group): void;
|
|
254
|
+
protected _clearPreview(): void;
|
|
255
|
+
protected _persist(drawing: TechnicalDrawing, item: TSystem["item"]): {
|
|
256
|
+
drawing: TechnicalDrawing;
|
|
257
|
+
item: TSystem["item"];
|
|
258
|
+
group: THREE.Group;
|
|
259
|
+
};
|
|
260
|
+
protected _redraw(item: TSystem["item"], group: THREE.Group): void;
|
|
261
|
+
}
|
|
262
|
+
export { AnnotationSystem }
|
|
263
|
+
export { AnnotationSystem as DrawingSystem }
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Closed arrowhead tick — two wing lines plus a base line connecting them,
|
|
267
|
+
* forming a triangle outline (tip → wing1, tip → wing2, wing1 → wing2).
|
|
268
|
+
*/
|
|
269
|
+
export declare const ArrowTick: LineTickBuilder;
|
|
270
|
+
|
|
36
271
|
/**
|
|
37
272
|
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to `this`, you will need to declare the callback as an arrow function.
|
|
38
273
|
*/
|
|
@@ -66,6 +301,23 @@ export declare class AsyncEvent<T> {
|
|
|
66
301
|
private handlers;
|
|
67
302
|
}
|
|
68
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Minimal interface for a translate-only gizmo that can be configured and
|
|
306
|
+
* attached to one of the helper's control handles.
|
|
307
|
+
*
|
|
308
|
+
* Satisfied by `THREE.TransformControls` without a direct import, keeping
|
|
309
|
+
* this class free of DOM dependencies.
|
|
310
|
+
*/
|
|
311
|
+
export declare interface AxisGizmoLike {
|
|
312
|
+
attach(object: THREE.Object3D): void;
|
|
313
|
+
setSpace(space: "world" | "local"): void;
|
|
314
|
+
getHelper(): THREE.Object3D;
|
|
315
|
+
showX: boolean;
|
|
316
|
+
showY: boolean;
|
|
317
|
+
showZ: boolean;
|
|
318
|
+
addEventListener(type: string, listener: () => void): void;
|
|
319
|
+
}
|
|
320
|
+
|
|
69
321
|
/**
|
|
70
322
|
* Base class of the library. Useful for finding out the interfaces something implements.
|
|
71
323
|
*/
|
|
@@ -86,6 +338,24 @@ export declare abstract class Base {
|
|
|
86
338
|
isSerializable: () => this is Serializable<any, Record<string, any>>;
|
|
87
339
|
}
|
|
88
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Minimum style contract shared by every annotation system.
|
|
343
|
+
* All per-system style interfaces must extend this.
|
|
344
|
+
*/
|
|
345
|
+
export declare interface BaseAnnotationStyle {
|
|
346
|
+
/** Line and text color as a hex number (e.g. `0xff0000`). */
|
|
347
|
+
color: number;
|
|
348
|
+
/** Distance from the annotation geometry to the text label in drawing local units. */
|
|
349
|
+
textOffset: number;
|
|
350
|
+
/** Font size of the text label in drawing local units. */
|
|
351
|
+
fontSize: number;
|
|
352
|
+
/**
|
|
353
|
+
* Unit used to format measured values in text labels.
|
|
354
|
+
* Defaults to {@link Units.m} (metres) when not set.
|
|
355
|
+
*/
|
|
356
|
+
unit?: DimensionUnit;
|
|
357
|
+
}
|
|
358
|
+
|
|
89
359
|
/**
|
|
90
360
|
* Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
|
|
91
361
|
*/
|
|
@@ -567,6 +837,116 @@ export declare interface BCFViewpoint {
|
|
|
567
837
|
bitmaps?: ViewpointBitmap[];
|
|
568
838
|
}
|
|
569
839
|
|
|
840
|
+
/**
|
|
841
|
+
* Global drawing system that manages block insertions across all
|
|
842
|
+
* {@link TechnicalDrawing} instances.
|
|
843
|
+
*
|
|
844
|
+
* A **block** is a named, reusable geometry definition (e.g. a furniture symbol
|
|
845
|
+
* or a detail imported from a DXF). Multiple insertions of the same block share
|
|
846
|
+
* the same `THREE.BufferGeometry`, so only the transform (position, rotation,
|
|
847
|
+
* scale) differs per instance.
|
|
848
|
+
*
|
|
849
|
+
* Register via {@link TechnicalDrawings.use}:
|
|
850
|
+
* ```ts
|
|
851
|
+
* const blocks = techDrawings.use(BlockAnnotations);
|
|
852
|
+
* ```
|
|
853
|
+
*
|
|
854
|
+
* Typical workflow:
|
|
855
|
+
* ```ts
|
|
856
|
+
* // 1. Project external geometry to drawing space
|
|
857
|
+
* const projected = TechnicalDrawing.toDrawingSpace(ifcLines, drawing);
|
|
858
|
+
*
|
|
859
|
+
* // 2. Register the block definition (global — do this once)
|
|
860
|
+
* blocks.define("CHAIR", { lines: projected.geometry });
|
|
861
|
+
*
|
|
862
|
+
* // 3. Insert on any drawing
|
|
863
|
+
* blocks.add(drawing, { blockName: "CHAIR", position, rotation: 0, scale: 1, style: "default" });
|
|
864
|
+
* ```
|
|
865
|
+
*/
|
|
866
|
+
export declare class BlockAnnotations extends AnnotationSystem<BlockAnnotationsSystem> implements Disposable_2 {
|
|
867
|
+
enabled: boolean;
|
|
868
|
+
readonly _item: BlockInsertion;
|
|
869
|
+
protected _ownsChildGeometry: boolean;
|
|
870
|
+
/**
|
|
871
|
+
* Named block definitions in block-local XZ space.
|
|
872
|
+
* Register via {@link define}. Geometry is shared across all drawings and insertions.
|
|
873
|
+
*/
|
|
874
|
+
readonly definitions: FRAGS.DataMap<string, BlockDefinition>;
|
|
875
|
+
constructor(components: Components);
|
|
876
|
+
pickHandle(_drawing: TechnicalDrawing, _ray: THREE.Ray, _threshold?: number): {
|
|
877
|
+
uuid: string;
|
|
878
|
+
handle: "position" | "rotation" | "scale";
|
|
879
|
+
} | null;
|
|
880
|
+
/**
|
|
881
|
+
* Overrides the base `pick` to use the correct `LineSegments.raycast` (pair-based)
|
|
882
|
+
* rather than `THREE.Line.prototype.raycast` (continuous-line).
|
|
883
|
+
*/
|
|
884
|
+
pick(ray: THREE.Ray, threshold?: number): string | null;
|
|
885
|
+
/**
|
|
886
|
+
* Registers a block definition by name (global — not tied to any drawing).
|
|
887
|
+
* All geometry must be in block-local XZ space (Y = 0).
|
|
888
|
+
* Use {@link TechnicalDrawing.toDrawingSpace} to project external geometry first.
|
|
889
|
+
*
|
|
890
|
+
* Replaces any existing definition with the same name without disposing the old geometry.
|
|
891
|
+
*/
|
|
892
|
+
define(name: string, definition: BlockDefinition): void;
|
|
893
|
+
protected _buildGroup(ins: BlockInsertion, _style: BlockStyle): THREE.Group;
|
|
894
|
+
protected _onAfterPersist(ins: BlockInsertion, group: THREE.Group): void;
|
|
895
|
+
protected _onDispose(): void;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
declare interface BlockAnnotationsSystem {
|
|
899
|
+
item: BlockInsertion;
|
|
900
|
+
data: BlockInsertionData;
|
|
901
|
+
style: BlockStyle;
|
|
902
|
+
handle: "position" | "rotation" | "scale";
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* The geometry content of a named block.
|
|
907
|
+
* At least one of `lines` or `mesh` must be provided.
|
|
908
|
+
*
|
|
909
|
+
* - `lines` — `BufferGeometry` rendered as `LineSegments` (wire outlines).
|
|
910
|
+
* - `mesh` — `BufferGeometry` rendered as a filled `THREE.Mesh` (e.g. hatches
|
|
911
|
+
* or solid fills imported from DXF `SOLID`/`HATCH` entities).
|
|
912
|
+
*/
|
|
913
|
+
export declare interface BlockDefinition {
|
|
914
|
+
/** Line geometry for `LineSegments`. */
|
|
915
|
+
lines?: THREE.BufferGeometry;
|
|
916
|
+
/** Triangle geometry for a filled `THREE.Mesh`. */
|
|
917
|
+
mesh?: THREE.BufferGeometry;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* A single placed instance of a named block definition.
|
|
922
|
+
* All coordinates are in drawing local space (XZ plane, Y = 0).
|
|
923
|
+
*/
|
|
924
|
+
export declare interface BlockInsertion {
|
|
925
|
+
/** Unique identifier for this insertion. */
|
|
926
|
+
uuid: string;
|
|
927
|
+
/** Name of the block definition to draw. Must be registered via {@link BlockAnnotations.define}. */
|
|
928
|
+
blockName: string;
|
|
929
|
+
/** Insertion point in drawing local space (Y is ignored — always 0). */
|
|
930
|
+
position: THREE.Vector3;
|
|
931
|
+
/** Rotation around the Y axis in radians. */
|
|
932
|
+
rotation: number;
|
|
933
|
+
/** Uniform scale applied to the block geometry. */
|
|
934
|
+
scale: number;
|
|
935
|
+
/** Style name — references a {@link BlockStyle} registered on the system. */
|
|
936
|
+
style: string;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
/** Editable fields of {@link BlockInsertion} — everything except the `uuid`. */
|
|
940
|
+
export declare type BlockInsertionData = Omit<BlockInsertion, "uuid">;
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Style for a {@link BlockAnnotations} system.
|
|
944
|
+
* `textOffset` and `fontSize` are unused for blocks but required by
|
|
945
|
+
* {@link BaseAnnotationStyle} — set them to `0` in the default style.
|
|
946
|
+
*/
|
|
947
|
+
export declare interface BlockStyle extends BaseAnnotationStyle {
|
|
948
|
+
}
|
|
949
|
+
|
|
570
950
|
export declare interface BooleanSettingsControl {
|
|
571
951
|
type: "Boolean";
|
|
572
952
|
value: boolean;
|
|
@@ -634,6 +1014,233 @@ export declare class BoundingBoxer extends Component implements Disposable_2 {
|
|
|
634
1014
|
}>;
|
|
635
1015
|
}
|
|
636
1016
|
|
|
1017
|
+
/**
|
|
1018
|
+
* Builds the flat vertex positions for a single committed angle dimension.
|
|
1019
|
+
*/
|
|
1020
|
+
export declare function buildAnglePositions(dim: AngleAnnotation, style: AngleAnnotationStyle): number[];
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Builds vertex positions for the live preview during `positioningArc`.
|
|
1024
|
+
* Uses the cursor distance from the vertex as the arc radius.
|
|
1025
|
+
*/
|
|
1026
|
+
export declare function buildAnglePreviewPositions(pointA: THREE.Vector3, vertex: THREE.Vector3, pointB: THREE.Vector3, cursor: THREE.Vector3 | null, style: AngleAnnotationStyle, flipped?: boolean): number[];
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Builds the flat vertex positions for a committed callout annotation:
|
|
1030
|
+
* enclosure outline + attachment-to-elbow line + elbow-to-extensionEnd line
|
|
1031
|
+
* + optional tick at `extensionEnd`.
|
|
1032
|
+
*/
|
|
1033
|
+
export declare function buildCalloutPositions(ann: CalloutAnnotation, style: CalloutAnnotationStyle): number[];
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Builds vertex positions for the live preview during interactive placement.
|
|
1037
|
+
* During `awaitingRadius`, `cursor` is treated as the SE corner of the enclosure
|
|
1038
|
+
* so halfW/halfH are derived live from the delta to `center`.
|
|
1039
|
+
*/
|
|
1040
|
+
export declare function buildCalloutPreviewPositions(kind: "awaitingRadius" | "awaitingElbow" | "awaitingExtension", center: THREE.Vector3, halfW: number, halfH: number, elbow: THREE.Vector3 | null, cursor: THREE.Vector3 | null, style: CalloutAnnotationStyle): number[];
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Builds the flat vertex positions (x,y,z triplets) for a single committed
|
|
1044
|
+
* linear dimension. The result can be passed directly to a
|
|
1045
|
+
* `THREE.BufferAttribute`.
|
|
1046
|
+
*
|
|
1047
|
+
* The geometry lives in drawing local space (XZ plane, Y = 0) and consists of:
|
|
1048
|
+
* - Extension line from pointA
|
|
1049
|
+
* - Extension line from pointB
|
|
1050
|
+
* - Dimension line connecting both extension line ends
|
|
1051
|
+
* - Tick geometry at each end of the dimension line (from `style.tick`)
|
|
1052
|
+
*/
|
|
1053
|
+
export declare function buildDimensionPositions(dim: LinearAnnotation, style: LinearAnnotationStyle): number[];
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* Builds an array of {@link LinearAnnotation}s from consecutive point pairs,
|
|
1057
|
+
* all sharing the same perpendicular offset.
|
|
1058
|
+
*/
|
|
1059
|
+
export declare function buildDimensions(points: THREE.Vector3[], offset: number): LinearAnnotation[];
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Builds the flat vertex positions for a committed leader annotation.
|
|
1063
|
+
*/
|
|
1064
|
+
export declare function buildLeaderPositions(ann: LeaderAnnotation, style: LeaderAnnotationStyle): number[];
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* Builds vertex positions for the live preview.
|
|
1068
|
+
*/
|
|
1069
|
+
export declare function buildLeaderPreviewPositions(kind: "placingElbow" | "placingExtension", arrowTip: THREE.Vector3, elbow: THREE.Vector3 | null, cursor: THREE.Vector3 | null, style: LeaderAnnotationStyle): number[];
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Builds the flat vertex positions for a live dimension preview.
|
|
1073
|
+
*
|
|
1074
|
+
* During `placingPoints`: lines connecting all placed points plus a line
|
|
1075
|
+
* to the cursor.
|
|
1076
|
+
* During `positioningOffset`: a full dimension preview using the cursor as
|
|
1077
|
+
* the offset reference, rendered with the active style's tick.
|
|
1078
|
+
*/
|
|
1079
|
+
export declare function buildPreviewPositions(kind: "placingPoints" | "positioningOffset", points: THREE.Vector3[], cursor: THREE.Vector3 | null, style: LinearAnnotationStyle): number[];
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Builds the `LineSegments` position array for a committed slope annotation.
|
|
1083
|
+
*
|
|
1084
|
+
* The geometry consists of:
|
|
1085
|
+
* - **Shaft**: tail → tip
|
|
1086
|
+
* - **Tick**: geometry produced by `style.tick` at the downhill tip
|
|
1087
|
+
*
|
|
1088
|
+
* @returns A flat `Float32Array` of XYZ triplets (vertex pairs for `LineSegments`).
|
|
1089
|
+
*/
|
|
1090
|
+
export declare function buildSlopePositions(ann: SlopeAnnotation, style: SlopeAnnotationStyle): Float32Array;
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* The committed data for a single callout annotation.
|
|
1094
|
+
* All coordinates are in drawing local space (XZ plane, Y = 0).
|
|
1095
|
+
*/
|
|
1096
|
+
export declare interface CalloutAnnotation {
|
|
1097
|
+
/** Unique identifier. */
|
|
1098
|
+
uuid: string;
|
|
1099
|
+
/** Centre of the enclosure shape. */
|
|
1100
|
+
center: THREE.Vector3;
|
|
1101
|
+
/** Half-width of the enclosure along the X axis. */
|
|
1102
|
+
halfW: number;
|
|
1103
|
+
/** Half-height of the enclosure along the Z axis. */
|
|
1104
|
+
halfH: number;
|
|
1105
|
+
/** Elbow — the bend between the extension line and its horizontal run. */
|
|
1106
|
+
elbow: THREE.Vector3;
|
|
1107
|
+
/** End of the horizontal extension line — anchor for the text label. */
|
|
1108
|
+
extensionEnd: THREE.Vector3;
|
|
1109
|
+
/** The annotation text. */
|
|
1110
|
+
text: string;
|
|
1111
|
+
/** Name of the {@link CalloutAnnotationStyle} to use when rendering. */
|
|
1112
|
+
style: string;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/** Editable fields of {@link CalloutAnnotation} — everything except `uuid`. */
|
|
1116
|
+
export declare type CalloutAnnotationData = Omit<CalloutAnnotation, "uuid">;
|
|
1117
|
+
|
|
1118
|
+
export declare type CalloutAnnotationEvent =
|
|
1119
|
+
/** A point in drawing local space was clicked. */
|
|
1120
|
+
{
|
|
1121
|
+
type: "CLICK";
|
|
1122
|
+
point: THREE.Vector3;
|
|
1123
|
+
drawing?: TechnicalDrawing;
|
|
1124
|
+
}
|
|
1125
|
+
/** The cursor moved to a new position in drawing local space. */
|
|
1126
|
+
| {
|
|
1127
|
+
type: "MOUSE_MOVE";
|
|
1128
|
+
point: THREE.Vector3;
|
|
1129
|
+
drawing?: TechnicalDrawing;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Consumer supplies the annotation text after the machine enters
|
|
1133
|
+
* `enteringText`. Ignored in all other states.
|
|
1134
|
+
*/
|
|
1135
|
+
| {
|
|
1136
|
+
type: "SUBMIT_TEXT";
|
|
1137
|
+
text: string;
|
|
1138
|
+
}
|
|
1139
|
+
/** Cancel the current operation and return to the initial state. */
|
|
1140
|
+
| {
|
|
1141
|
+
type: "ESCAPE";
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Pure state transition function for the callout annotation tool.
|
|
1146
|
+
* Returns the **same state reference** when no transition applies.
|
|
1147
|
+
*/
|
|
1148
|
+
export declare function calloutAnnotationMachine(state: CalloutAnnotationState, event: CalloutAnnotationEvent): CalloutAnnotationState;
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Global drawing system that manages callout annotations across all
|
|
1152
|
+
* {@link TechnicalDrawing} instances.
|
|
1153
|
+
*/
|
|
1154
|
+
export declare class CalloutAnnotations extends AnnotationSystem<CalloutAnnotationSystem> implements Transitionable<CalloutAnnotationState, CalloutAnnotationEvent>, Disposable_2 {
|
|
1155
|
+
enabled: boolean;
|
|
1156
|
+
readonly _item: CalloutAnnotation;
|
|
1157
|
+
machineState: CalloutAnnotationState;
|
|
1158
|
+
readonly onMachineStateChanged: Event_2<CalloutAnnotationState>;
|
|
1159
|
+
constructor(components: Components);
|
|
1160
|
+
pickHandle(_drawing: TechnicalDrawing, _ray: THREE.Ray, _threshold?: number): {
|
|
1161
|
+
uuid: string;
|
|
1162
|
+
handle: string;
|
|
1163
|
+
} | null;
|
|
1164
|
+
sendMachineEvent(event: CalloutAnnotationEvent): void;
|
|
1165
|
+
protected _buildGroup(ann: CalloutAnnotation, style: CalloutAnnotationStyle): THREE.Group;
|
|
1166
|
+
protected _updatePreview(): void;
|
|
1167
|
+
private _resetMachine;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
export declare type CalloutAnnotationState =
|
|
1171
|
+
/** Waiting for the user to click the enclosure centre. */
|
|
1172
|
+
{
|
|
1173
|
+
kind: "awaitingCenter";
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Centre placed. User moves the cursor to the SE corner of the enclosure
|
|
1177
|
+
* to define its half-width (X) and half-height (Z) simultaneously.
|
|
1178
|
+
*/
|
|
1179
|
+
| {
|
|
1180
|
+
kind: "awaitingRadius";
|
|
1181
|
+
center: THREE.Vector3;
|
|
1182
|
+
cursor: THREE.Vector3 | null;
|
|
1183
|
+
}
|
|
1184
|
+
/** Size set. User clicks to place the line elbow. */
|
|
1185
|
+
| {
|
|
1186
|
+
kind: "awaitingElbow";
|
|
1187
|
+
center: THREE.Vector3;
|
|
1188
|
+
halfW: number;
|
|
1189
|
+
halfH: number;
|
|
1190
|
+
cursor: THREE.Vector3 | null;
|
|
1191
|
+
}
|
|
1192
|
+
/** Elbow set. User clicks the extension endpoint. */
|
|
1193
|
+
| {
|
|
1194
|
+
kind: "awaitingExtension";
|
|
1195
|
+
center: THREE.Vector3;
|
|
1196
|
+
halfW: number;
|
|
1197
|
+
halfH: number;
|
|
1198
|
+
elbow: THREE.Vector3;
|
|
1199
|
+
cursor: THREE.Vector3 | null;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* All geometry is set. Paused waiting for the consumer to supply the text
|
|
1203
|
+
* via a `SUBMIT_TEXT` event.
|
|
1204
|
+
*/
|
|
1205
|
+
| {
|
|
1206
|
+
kind: "enteringText";
|
|
1207
|
+
center: THREE.Vector3;
|
|
1208
|
+
halfW: number;
|
|
1209
|
+
halfH: number;
|
|
1210
|
+
elbow: THREE.Vector3;
|
|
1211
|
+
extensionEnd: THREE.Vector3;
|
|
1212
|
+
}
|
|
1213
|
+
/** Annotation just committed. */
|
|
1214
|
+
| {
|
|
1215
|
+
kind: "committed";
|
|
1216
|
+
annotation: CalloutAnnotation;
|
|
1217
|
+
};
|
|
1218
|
+
|
|
1219
|
+
/** Visual appearance of a callout annotation. */
|
|
1220
|
+
export declare interface CalloutAnnotationStyle extends BaseAnnotationStyle {
|
|
1221
|
+
/** The enclosure shape builder (cloud, rectangle, circle). */
|
|
1222
|
+
enclosure: EnclosureBuilder;
|
|
1223
|
+
/** Size of the optional tick at the extension end in drawing local units. */
|
|
1224
|
+
tickSize: number;
|
|
1225
|
+
/**
|
|
1226
|
+
* Line-segment tick at the extension end — included in the same `LineSegments`
|
|
1227
|
+
* as the extension line. Omit to suppress.
|
|
1228
|
+
*/
|
|
1229
|
+
lineTick?: LineTickBuilder;
|
|
1230
|
+
/**
|
|
1231
|
+
* Filled (mesh) tick at the extension end — rendered as a separate `THREE.Mesh`.
|
|
1232
|
+
* Can be combined with `tick`.
|
|
1233
|
+
*/
|
|
1234
|
+
meshTick?: MeshTickBuilder;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
declare interface CalloutAnnotationSystem {
|
|
1238
|
+
item: CalloutAnnotation;
|
|
1239
|
+
data: CalloutAnnotationData;
|
|
1240
|
+
style: CalloutAnnotationStyle;
|
|
1241
|
+
handle: string;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
637
1244
|
/**
|
|
638
1245
|
* Whether a camera uses the Camera Controls library.
|
|
639
1246
|
*/
|
|
@@ -650,6 +1257,13 @@ export declare interface CameraControllable {
|
|
|
650
1257
|
*/
|
|
651
1258
|
export declare type CameraProjection = "Perspective" | "Orthographic";
|
|
652
1259
|
|
|
1260
|
+
/**
|
|
1261
|
+
* Elliptical enclosure — an ellipse approximated with line segments centred on
|
|
1262
|
+
* `center`, with semi-axis `halfW` on X and `halfH` on Z.
|
|
1263
|
+
* When `halfW === halfH` the result is a circle.
|
|
1264
|
+
*/
|
|
1265
|
+
export declare const CircleEnclosure: EnclosureBuilder;
|
|
1266
|
+
|
|
653
1267
|
/**
|
|
654
1268
|
* Represents the data structure for a classification group.
|
|
655
1269
|
*/
|
|
@@ -843,9 +1457,9 @@ export declare class Clipper extends Component implements Createable, Disposable
|
|
|
843
1457
|
/** {@link Configurable.onSetup} */
|
|
844
1458
|
readonly onSetup: Event_2<unknown>;
|
|
845
1459
|
/** Event that fires when the user starts dragging a clipping plane. */
|
|
846
|
-
readonly onBeforeDrag: Event_2<
|
|
1460
|
+
readonly onBeforeDrag: Event_2<SimplePlane>;
|
|
847
1461
|
/** Event that fires when the user stops dragging a clipping plane. */
|
|
848
|
-
readonly onAfterDrag: Event_2<
|
|
1462
|
+
readonly onAfterDrag: Event_2<SimplePlane>;
|
|
849
1463
|
/**
|
|
850
1464
|
* Event that fires when the user starts creating a clipping plane.
|
|
851
1465
|
*/
|
|
@@ -889,6 +1503,12 @@ export declare class Clipper extends Component implements Createable, Disposable
|
|
|
889
1503
|
* has to be `true` for this to apply.
|
|
890
1504
|
*/
|
|
891
1505
|
toleranceOrthogonalY: number;
|
|
1506
|
+
/**
|
|
1507
|
+
* Whether clipping planes should automatically scale based on
|
|
1508
|
+
* camera distance. When true, the plane surface stays proportional
|
|
1509
|
+
* to the arrow gizmo as you zoom in/out. Default is true.
|
|
1510
|
+
*/
|
|
1511
|
+
autoScalePlanes: boolean;
|
|
892
1512
|
/**
|
|
893
1513
|
* The type of clipping plane to be created.
|
|
894
1514
|
* Default is {@link SimplePlane}.
|
|
@@ -962,8 +1582,6 @@ export declare class Clipper extends Component implements Createable, Disposable
|
|
|
962
1582
|
private normalizePlaneDirectionY;
|
|
963
1583
|
private newPlane;
|
|
964
1584
|
private updateMaterialsAndPlanes;
|
|
965
|
-
private _onStartDragging;
|
|
966
|
-
private _onEndDragging;
|
|
967
1585
|
}
|
|
968
1586
|
|
|
969
1587
|
/**
|
|
@@ -997,6 +1615,12 @@ declare type ClipperConfigType = {
|
|
|
997
1615
|
size: NumberSettingControl;
|
|
998
1616
|
};
|
|
999
1617
|
|
|
1618
|
+
/**
|
|
1619
|
+
* Revision-cloud enclosure — a bumpy rectangle centred on `center`.
|
|
1620
|
+
* Width = 2 × halfW, height = 2 × halfH.
|
|
1621
|
+
*/
|
|
1622
|
+
export declare const CloudEnclosure: EnclosureBuilder;
|
|
1623
|
+
|
|
1000
1624
|
export declare interface ColorSettingsControl {
|
|
1001
1625
|
type: "Color";
|
|
1002
1626
|
value: THREE.Color;
|
|
@@ -1138,6 +1762,48 @@ export declare class Components implements Disposable_2 {
|
|
|
1138
1762
|
private static setupBVH;
|
|
1139
1763
|
}
|
|
1140
1764
|
|
|
1765
|
+
/**
|
|
1766
|
+
* Computes a local-to-world transformation matrix that maps a technical
|
|
1767
|
+
* drawing's local coordinate system onto a target plane in 3D world space.
|
|
1768
|
+
*
|
|
1769
|
+
* Given three point pairs — each pair being a point on the drawing (local
|
|
1770
|
+
* space) and its corresponding point in the 3D world — the function returns
|
|
1771
|
+
* the `THREE.Matrix4` that, when applied to the drawing's container, will
|
|
1772
|
+
* align the drawing to the target plane.
|
|
1773
|
+
*
|
|
1774
|
+
* The transformation encodes **translation**, **rotation**, and **uniform
|
|
1775
|
+
* scale** (derived from the ratio of world vs drawing distances between the
|
|
1776
|
+
* first pair of points, which handles unit mismatches such as mm vs m).
|
|
1777
|
+
*
|
|
1778
|
+
* @throws If either set of points is collinear (cannot define a plane).
|
|
1779
|
+
* @throws If either set contains a degenerate first pair (zero distance).
|
|
1780
|
+
*
|
|
1781
|
+
* @param drawingPoints - Three non-collinear points in drawing local space.
|
|
1782
|
+
* @param worldPoints - Three corresponding non-collinear points in world space.
|
|
1783
|
+
*/
|
|
1784
|
+
export declare function computeAlignmentMatrix(drawingPoints: THREE.Vector3[], worldPoints: THREE.Vector3[]): THREE.Matrix4;
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* Returns the angle in radians between the two rays defined by the dimension.
|
|
1788
|
+
* Result is in [0, π].
|
|
1789
|
+
*/
|
|
1790
|
+
export declare function computeAngle(dim: AngleAnnotation): number;
|
|
1791
|
+
|
|
1792
|
+
/**
|
|
1793
|
+
* Returns the angle (in radians, in the XZ plane) of the bisector ray between
|
|
1794
|
+
* the two measured rays. Useful for positioning the text label.
|
|
1795
|
+
*/
|
|
1796
|
+
export declare function computeBisectorAngle(dim: AngleAnnotation): number;
|
|
1797
|
+
|
|
1798
|
+
/**
|
|
1799
|
+
* Computes the signed offset from a cursor position to the measurement axis
|
|
1800
|
+
* defined by the first and last points.
|
|
1801
|
+
*
|
|
1802
|
+
* The offset is measured perpendicular to the `(points[0] → points[last])`
|
|
1803
|
+
* direction, which is the direction along the measured lines (lineDir).
|
|
1804
|
+
*/
|
|
1805
|
+
export declare function computeOffset(points: THREE.Vector3[], cursor: THREE.Vector3): number;
|
|
1806
|
+
|
|
1141
1807
|
/**
|
|
1142
1808
|
* A tool to manage all the configuration from the app centrally. 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/ConfigManager).
|
|
1143
1809
|
*/
|
|
@@ -1417,6 +2083,28 @@ export declare class DataSet<T> extends Set<T> {
|
|
|
1417
2083
|
dispose(): void;
|
|
1418
2084
|
}
|
|
1419
2085
|
|
|
2086
|
+
/**
|
|
2087
|
+
* Diagonal slash tick (architectural style).
|
|
2088
|
+
* A single line crossing the dimension endpoint at 45° relative to the
|
|
2089
|
+
* dimension line direction.
|
|
2090
|
+
*/
|
|
2091
|
+
export declare const DiagonalTick: LineTickBuilder;
|
|
2092
|
+
|
|
2093
|
+
/**
|
|
2094
|
+
* Defines how a measured value (in drawing-space metres) is converted to a
|
|
2095
|
+
* display string. Pass one of the {@link Units} presets or build your own.
|
|
2096
|
+
*
|
|
2097
|
+
* ```ts
|
|
2098
|
+
* dims.styles.get("default")!.unit = OBC.Units.cm;
|
|
2099
|
+
* ```
|
|
2100
|
+
*/
|
|
2101
|
+
export declare interface DimensionUnit {
|
|
2102
|
+
/** Multiplier applied to the raw metre value before display. */
|
|
2103
|
+
factor: number;
|
|
2104
|
+
/** Label appended to the formatted number (e.g. `"cm"`, `"mm"`, `"ft"`). */
|
|
2105
|
+
suffix: string;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
1420
2108
|
declare class DirectionalLightConfig {
|
|
1421
2109
|
private _list;
|
|
1422
2110
|
private _scene;
|
|
@@ -1554,6 +2242,724 @@ export declare interface DocumentReference {
|
|
|
1554
2242
|
description?: string;
|
|
1555
2243
|
}
|
|
1556
2244
|
|
|
2245
|
+
/**
|
|
2246
|
+
* Dot tick — a small circle drawn with line segments at the endpoint.
|
|
2247
|
+
* Standard ISO tick for radius and diameter dimensions.
|
|
2248
|
+
* The circle is centred on the endpoint and independent of line direction.
|
|
2249
|
+
*/
|
|
2250
|
+
export declare const DotTick: LineTickBuilder;
|
|
2251
|
+
|
|
2252
|
+
/**
|
|
2253
|
+
* Flat annotation store for a {@link TechnicalDrawing}, keyed by UUID.
|
|
2254
|
+
*
|
|
2255
|
+
* Each entry bundles the owning system, the data, and the Three.js group —
|
|
2256
|
+
* so a single `drawing.annotations.get(uuid)` gives full access to all three.
|
|
2257
|
+
*
|
|
2258
|
+
* Systems write here when they create or update annotations; consumers read
|
|
2259
|
+
* from here or subscribe to system-level events (`onCommit`, `onDelete`).
|
|
2260
|
+
*
|
|
2261
|
+
* ```ts
|
|
2262
|
+
* // Get everything for a known UUID
|
|
2263
|
+
* const { system, data, three } = drawing.annotations.get(uuid)!;
|
|
2264
|
+
*
|
|
2265
|
+
* // Iterate all annotations owned by a specific system
|
|
2266
|
+
* for (const [uuid, dim] of drawing.annotations.getBySystem(dims)) { ... }
|
|
2267
|
+
* ```
|
|
2268
|
+
*/
|
|
2269
|
+
export declare class DrawingAnnotations extends FRAGS.DataMap<string, AnnotationEntry> {
|
|
2270
|
+
/**
|
|
2271
|
+
* Returns a snapshot map of `uuid → item` for all annotations owned by
|
|
2272
|
+
* `system` on this drawing. Filters the flat store by system identity.
|
|
2273
|
+
*
|
|
2274
|
+
* The returned `Map` is a snapshot — it does not update reactively.
|
|
2275
|
+
* Subscribe to system events (`onCommit`, `onDelete`, `onUpdate`) for
|
|
2276
|
+
* reactive updates.
|
|
2277
|
+
*/
|
|
2278
|
+
/**
|
|
2279
|
+
* Returns a snapshot map of `uuid → item` for all annotations owned by
|
|
2280
|
+
* `system` on this drawing. TypeScript infers the item type from the
|
|
2281
|
+
* system's `_item` declaration marker, avoiding DataMap event variance issues.
|
|
2282
|
+
*/
|
|
2283
|
+
getBySystem<T>(system: {
|
|
2284
|
+
readonly _item: T;
|
|
2285
|
+
}): Map<string, T>;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
/**
|
|
2289
|
+
* Result of a successful raycast against a {@link TechnicalDrawing}.
|
|
2290
|
+
* The `point` is in the drawing's **local coordinate space** (XZ plane, Y = 0).
|
|
2291
|
+
*/
|
|
2292
|
+
export declare interface DrawingIntersection {
|
|
2293
|
+
/** Hit position in drawing local space (X right, Z down-screen, Y = 0). */
|
|
2294
|
+
point: THREE.Vector3;
|
|
2295
|
+
/** The Three.js object that was intersected (e.g. a LineSegments). */
|
|
2296
|
+
object: THREE.Object3D;
|
|
2297
|
+
/**
|
|
2298
|
+
* The viewport whose camera was used for the raycast, or `null` when the
|
|
2299
|
+
* pick originated from a world-space camera (e.g. the 3D viewer).
|
|
2300
|
+
*/
|
|
2301
|
+
viewport: DrawingViewport | null;
|
|
2302
|
+
/**
|
|
2303
|
+
* The specific line segment that was hit, expressed as a `THREE.Line3`
|
|
2304
|
+
* in drawing local space. `null` when the hit object is not a LineSegments.
|
|
2305
|
+
*/
|
|
2306
|
+
line: THREE.Line3 | null;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
/**
|
|
2310
|
+
* A named organizational layer on a {@link TechnicalDrawing}.
|
|
2311
|
+
* Mirrors the layer concept in CAD applications (AutoCAD, DXF, etc.).
|
|
2312
|
+
*/
|
|
2313
|
+
export declare interface DrawingLayer {
|
|
2314
|
+
/** Unique name identifying this layer. */
|
|
2315
|
+
name: string;
|
|
2316
|
+
/** Whether objects on this layer are visible. Defaults to `true`. */
|
|
2317
|
+
visible: boolean;
|
|
2318
|
+
/**
|
|
2319
|
+
* Material applied to all projection `LineSegments` on this layer.
|
|
2320
|
+
* All objects on the same layer share this instance, so mutating it
|
|
2321
|
+
* (e.g. via {@link DrawingLayers.setColor}) is reflected immediately
|
|
2322
|
+
* without any traversal. Use {@link DrawingLayers.setMaterial} to
|
|
2323
|
+
* swap the instance entirely.
|
|
2324
|
+
*
|
|
2325
|
+
* Annotation systems always use their own style material — this field
|
|
2326
|
+
* does not affect them.
|
|
2327
|
+
*/
|
|
2328
|
+
material: THREE.LineBasicMaterial;
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* Manages the named layers of a {@link TechnicalDrawing}.
|
|
2333
|
+
*
|
|
2334
|
+
* Accessible via `drawing.layers`. Each layer owns a `THREE.LineBasicMaterial`
|
|
2335
|
+
* that is shared across all projection `LineSegments` assigned to it —
|
|
2336
|
+
* mutating the material (e.g. via {@link setColor}) is reflected on every line
|
|
2337
|
+
* immediately without any scene traversal. Annotation systems always use their
|
|
2338
|
+
* own style material and are not affected by layer materials.
|
|
2339
|
+
*
|
|
2340
|
+
* Extends `DataMap<string, DrawingLayer>` so consumers get reactive events
|
|
2341
|
+
* (`onItemSet`, `onItemDeleted`, …) directly on `drawing.layers`.
|
|
2342
|
+
*
|
|
2343
|
+
* Layer `"0"` always exists and cannot be removed.
|
|
2344
|
+
*
|
|
2345
|
+
* ```ts
|
|
2346
|
+
* drawing.layers.create("walls", { material: new THREE.LineBasicMaterial({ color: 0x333333 }) });
|
|
2347
|
+
* drawing.layers.setColor("walls", 0x888888);
|
|
2348
|
+
* drawing.layers.setVisibility("walls", false);
|
|
2349
|
+
* ```
|
|
2350
|
+
*/
|
|
2351
|
+
export declare class DrawingLayers extends FRAGS.DataMap<string, DrawingLayer> {
|
|
2352
|
+
private readonly _container;
|
|
2353
|
+
constructor(container: THREE.Group);
|
|
2354
|
+
/**
|
|
2355
|
+
* Creates a new layer. If a layer with the same name already exists, returns
|
|
2356
|
+
* the existing one without modifying it.
|
|
2357
|
+
*
|
|
2358
|
+
* @param name - Unique layer name.
|
|
2359
|
+
* @param options - Optional material and visibility. If no material is given,
|
|
2360
|
+
* a default black `LineBasicMaterial` is created. Visibility defaults to `true`.
|
|
2361
|
+
* @returns The (possibly pre-existing) layer object.
|
|
2362
|
+
*/
|
|
2363
|
+
create(name: string, options?: {
|
|
2364
|
+
material?: THREE.LineBasicMaterial;
|
|
2365
|
+
visible?: boolean;
|
|
2366
|
+
}): DrawingLayer;
|
|
2367
|
+
/**
|
|
2368
|
+
* Updates the color of a layer's material and fires reactive events.
|
|
2369
|
+
*
|
|
2370
|
+
* Because all `LineSegments` on the same layer share the same material
|
|
2371
|
+
* instance, the change is reflected immediately on all of them — no scene
|
|
2372
|
+
* traversal is required.
|
|
2373
|
+
*
|
|
2374
|
+
* Does nothing if the layer does not exist.
|
|
2375
|
+
*
|
|
2376
|
+
* @param name - Layer name.
|
|
2377
|
+
* @param color - Hex color (e.g. `0xff0000`).
|
|
2378
|
+
*/
|
|
2379
|
+
setColor(name: string, color: number): void;
|
|
2380
|
+
/**
|
|
2381
|
+
* Replaces the material of a layer and updates all `LineSegments` currently
|
|
2382
|
+
* assigned to it. The previous material is disposed.
|
|
2383
|
+
*
|
|
2384
|
+
* Does nothing if the layer does not exist.
|
|
2385
|
+
*
|
|
2386
|
+
* @param name - Layer name.
|
|
2387
|
+
* @param material - New material to assign.
|
|
2388
|
+
*/
|
|
2389
|
+
setMaterial(name: string, material: THREE.LineBasicMaterial): void;
|
|
2390
|
+
/**
|
|
2391
|
+
* Shows or hides all objects assigned to the given layer.
|
|
2392
|
+
*
|
|
2393
|
+
* Does nothing if the layer does not exist.
|
|
2394
|
+
*
|
|
2395
|
+
* @param name - Layer name.
|
|
2396
|
+
* @param visible - `true` to show, `false` to hide.
|
|
2397
|
+
*/
|
|
2398
|
+
setVisibility(name: string, visible: boolean): void;
|
|
2399
|
+
/**
|
|
2400
|
+
* Assigns an object to a named layer, applies the layer's material (if the
|
|
2401
|
+
* object is a `LineSegments`), and immediately reflects the layer's current
|
|
2402
|
+
* visibility state.
|
|
2403
|
+
*
|
|
2404
|
+
* Use this instead of setting `object.userData.layer` directly so that
|
|
2405
|
+
* the material and visibility are always in sync at insertion time.
|
|
2406
|
+
*
|
|
2407
|
+
* Does nothing if the layer does not exist.
|
|
2408
|
+
*
|
|
2409
|
+
* @param object - The Three.js object to assign.
|
|
2410
|
+
* @param name - Layer name.
|
|
2411
|
+
*/
|
|
2412
|
+
assign(object: THREE.Object3D, name: string): void;
|
|
2413
|
+
/* Excluded from this release type: resolveColor */
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
/**
|
|
2417
|
+
* Minimal interface consumed by {@link TechnicalDrawingHelper}.
|
|
2418
|
+
* Satisfied by {@link TechnicalDrawing} without a direct import.
|
|
2419
|
+
*/
|
|
2420
|
+
declare interface DrawingProjectionSource {
|
|
2421
|
+
far: number;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* "Type bag" descriptor that fully parameterises an annotation system.
|
|
2426
|
+
* Each system declares a concrete interface extending this.
|
|
2427
|
+
*
|
|
2428
|
+
* ```ts
|
|
2429
|
+
* interface LinearAnnotationSystem extends DrawingSystemDescriptor {
|
|
2430
|
+
* item: LinearAnnotation;
|
|
2431
|
+
* data: LinearAnnotationData;
|
|
2432
|
+
* style: LinearAnnotationStyle;
|
|
2433
|
+
* handle: "pointA" | "pointB" | "offset";
|
|
2434
|
+
* }
|
|
2435
|
+
* class LinearAnnotations extends AnnotationSystem<LinearAnnotationSystem> { ... }
|
|
2436
|
+
* ```
|
|
2437
|
+
*/
|
|
2438
|
+
export declare interface DrawingSystemDescriptor {
|
|
2439
|
+
item: {
|
|
2440
|
+
uuid: string;
|
|
2441
|
+
style: string;
|
|
2442
|
+
};
|
|
2443
|
+
data: object;
|
|
2444
|
+
style: BaseAnnotationStyle;
|
|
2445
|
+
handle: string;
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
/**
|
|
2449
|
+
* Represents a framed orthographic window into a {@link TechnicalDrawing}.
|
|
2450
|
+
*
|
|
2451
|
+
* The viewport lives in the drawing's local coordinate system (XZ plane, Y = 0).
|
|
2452
|
+
* Its {@link camera} must be added as a child of the drawing's container so that
|
|
2453
|
+
* any world-space transform applied to the container automatically moves the camera.
|
|
2454
|
+
*
|
|
2455
|
+
* The camera uses **layer 1** exclusively, so only geometry explicitly assigned
|
|
2456
|
+
* to layer 1 (projection lines, dimensions) is visible in paper-space renders.
|
|
2457
|
+
*
|
|
2458
|
+
* Local coordinate convention:
|
|
2459
|
+
* - X right → world +X
|
|
2460
|
+
* - Y up (screen) → world -Z
|
|
2461
|
+
* - Normal (out of plane) → world +Y
|
|
2462
|
+
*/
|
|
2463
|
+
export declare class DrawingViewport {
|
|
2464
|
+
/** Unique identifier for this viewport instance. */
|
|
2465
|
+
readonly uuid: string;
|
|
2466
|
+
/** Human-readable label for this viewport. */
|
|
2467
|
+
name: string;
|
|
2468
|
+
/**
|
|
2469
|
+
* The Three.js orthographic camera for this viewport.
|
|
2470
|
+
* Add it to the drawing container via {@link DrawingViewports.add}.
|
|
2471
|
+
*/
|
|
2472
|
+
readonly camera: THREE.OrthographicCamera;
|
|
2473
|
+
/** {@link Disposable.onDisposed} */
|
|
2474
|
+
readonly onDisposed: Event_2<void>;
|
|
2475
|
+
private _left;
|
|
2476
|
+
private _right;
|
|
2477
|
+
private _top;
|
|
2478
|
+
private _bottom;
|
|
2479
|
+
private _drawingScale;
|
|
2480
|
+
private _container;
|
|
2481
|
+
private _helper;
|
|
2482
|
+
private _helperVisible;
|
|
2483
|
+
get left(): number;
|
|
2484
|
+
set left(value: number);
|
|
2485
|
+
get right(): number;
|
|
2486
|
+
set right(value: number);
|
|
2487
|
+
get top(): number;
|
|
2488
|
+
set top(value: number);
|
|
2489
|
+
get bottom(): number;
|
|
2490
|
+
set bottom(value: number);
|
|
2491
|
+
/** Drawing scale denominator (e.g. 100 = 1:100). */
|
|
2492
|
+
get drawingScale(): number;
|
|
2493
|
+
set drawingScale(value: number);
|
|
2494
|
+
/**
|
|
2495
|
+
* The {@link DrawingViewportHelper} for this viewport.
|
|
2496
|
+
*
|
|
2497
|
+
* The helper is created lazily on first access and cached. It is a
|
|
2498
|
+
* `THREE.Group` on layer 0, so it is visible to the perspective camera but
|
|
2499
|
+
* invisible to the viewport's own orthographic camera (layer 1 only).
|
|
2500
|
+
*
|
|
2501
|
+
* Use {@link helperVisible} to attach/detach it to the drawing container
|
|
2502
|
+
* automatically, or manage it manually with `drawing.three.add/remove`.
|
|
2503
|
+
*/
|
|
2504
|
+
get helper(): DrawingViewportHelper;
|
|
2505
|
+
/**
|
|
2506
|
+
* Shows or hides the {@link DrawingViewportHelper} by attaching it to or
|
|
2507
|
+
* removing it from the drawing's container group.
|
|
2508
|
+
*
|
|
2509
|
+
* Setting this to `true` before the viewport has been registered via
|
|
2510
|
+
* `DrawingViewports.add()` has no effect until registration occurs.
|
|
2511
|
+
*/
|
|
2512
|
+
get helperVisible(): boolean;
|
|
2513
|
+
set helperVisible(value: boolean);
|
|
2514
|
+
/**
|
|
2515
|
+
* Axis-aligned bounding box of this viewport in world drawing space (Y = 0).
|
|
2516
|
+
* Used by {@link clipLine} and PDF/DXF exporters.
|
|
2517
|
+
*
|
|
2518
|
+
* Because screen-up = world −Z, the world Z range visible to the camera is
|
|
2519
|
+
* [−top, −bottom], not [bottom, top].
|
|
2520
|
+
*/
|
|
2521
|
+
get bbox(): THREE.Box3;
|
|
2522
|
+
/** Viewport size in millimetres (based on local units × 1000). */
|
|
2523
|
+
get size(): THREE.Vector2;
|
|
2524
|
+
/** Local X axis direction (world +X). */
|
|
2525
|
+
get localXAxis(): THREE.Vector3;
|
|
2526
|
+
/** Local Y axis direction (world -Z). */
|
|
2527
|
+
get localYAxis(): THREE.Vector3;
|
|
2528
|
+
/** Drawing plane normal (world +Y). */
|
|
2529
|
+
get normal(): THREE.Vector3;
|
|
2530
|
+
constructor(config: DrawingViewportConfig);
|
|
2531
|
+
/* Excluded from this release type: setContainer */
|
|
2532
|
+
/**
|
|
2533
|
+
* Clips a line segment to this viewport's bounding box.
|
|
2534
|
+
* Returns `null` when the line is entirely outside the viewport.
|
|
2535
|
+
*/
|
|
2536
|
+
clipLine(line: THREE.Line3): THREE.Line3 | null;
|
|
2537
|
+
/** Destroys this viewport. The camera must be removed from its parent separately. */
|
|
2538
|
+
dispose(): void;
|
|
2539
|
+
private get bboxPlanes();
|
|
2540
|
+
private getPlaneIntersections;
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
/**
|
|
2544
|
+
* Configuration to create a {@link DrawingViewport}.
|
|
2545
|
+
*/
|
|
2546
|
+
export declare interface DrawingViewportConfig {
|
|
2547
|
+
/** Left bound of the viewport in local drawing units. */
|
|
2548
|
+
left: number;
|
|
2549
|
+
/** Right bound of the viewport in local drawing units. */
|
|
2550
|
+
right: number;
|
|
2551
|
+
/**
|
|
2552
|
+
* Top bound of the viewport in local drawing units.
|
|
2553
|
+
* Maps to world -Z (screen Y up = local -Z).
|
|
2554
|
+
*/
|
|
2555
|
+
top: number;
|
|
2556
|
+
/**
|
|
2557
|
+
* Bottom bound of the viewport in local drawing units.
|
|
2558
|
+
* Maps to world +Z (screen Y down = local +Z).
|
|
2559
|
+
*/
|
|
2560
|
+
bottom: number;
|
|
2561
|
+
/**
|
|
2562
|
+
* Drawing scale denominator (e.g. 100 means 1:100).
|
|
2563
|
+
* Defaults to 100.
|
|
2564
|
+
*/
|
|
2565
|
+
scale?: number;
|
|
2566
|
+
/** Human-readable label for this viewport. Defaults to an empty string. */
|
|
2567
|
+
name?: string;
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
/**
|
|
2571
|
+
* Visualises the bounds of a `DrawingViewport` as a rectangle in the 3D scene.
|
|
2572
|
+
*
|
|
2573
|
+
* Works exactly like the built-in Three.js helpers (e.g. `THREE.CameraHelper`):
|
|
2574
|
+
* the result is a plain `THREE.Group` you can add wherever you like in the scene
|
|
2575
|
+
* graph. It renders on **layer 0**, so it is visible to the perspective camera
|
|
2576
|
+
* but invisible to the viewport's own orthographic camera (which only renders
|
|
2577
|
+
* layer 1).
|
|
2578
|
+
*
|
|
2579
|
+
* Typically you do not construct this directly — use
|
|
2580
|
+
* `DrawingViewport.helperVisible = true` instead, which attaches the helper to
|
|
2581
|
+
* the drawing container automatically.
|
|
2582
|
+
*
|
|
2583
|
+
* When {@link editable} is `true`, two kinds of interaction are enabled:
|
|
2584
|
+
*
|
|
2585
|
+
* - **Resize** — hover one of the eight handle spheres (corners + edge midpoints)
|
|
2586
|
+
* and drag to resize the viewport in that direction.
|
|
2587
|
+
* - **Move** — hover the border rectangle itself and drag to translate the
|
|
2588
|
+
* entire viewport while keeping its width and height constant.
|
|
2589
|
+
*
|
|
2590
|
+
* In both cases the border and the hovered element turn orange as visual
|
|
2591
|
+
* feedback, and {@link isDragging} becomes `true` for the duration of the drag.
|
|
2592
|
+
*
|
|
2593
|
+
* The class contains no browser API references and is safe in Node.js
|
|
2594
|
+
* environments; the consumer forwards events:
|
|
2595
|
+
*
|
|
2596
|
+
* ```ts
|
|
2597
|
+
* container.addEventListener("mousemove", (e) => {
|
|
2598
|
+
* raycaster.setFromCamera(getNDC(e), camera);
|
|
2599
|
+
* viewport.helper.onPointerMove(raycaster.ray);
|
|
2600
|
+
* });
|
|
2601
|
+
* container.addEventListener("mousedown", (e) => {
|
|
2602
|
+
* raycaster.setFromCamera(getNDC(e), camera);
|
|
2603
|
+
* viewport.helper.onPointerDown(raycaster.ray);
|
|
2604
|
+
* });
|
|
2605
|
+
* container.addEventListener("mouseup", () => viewport.helper.onPointerUp());
|
|
2606
|
+
* ```
|
|
2607
|
+
*/
|
|
2608
|
+
export declare class DrawingViewportHelper extends THREE.Group {
|
|
2609
|
+
private readonly _viewport;
|
|
2610
|
+
private readonly _border;
|
|
2611
|
+
private readonly _handles;
|
|
2612
|
+
private readonly _raycaster;
|
|
2613
|
+
private _resizable;
|
|
2614
|
+
private _movable;
|
|
2615
|
+
private _dragHandle;
|
|
2616
|
+
private _dragConstraints;
|
|
2617
|
+
private _hoveredHandle;
|
|
2618
|
+
private _moveDrag;
|
|
2619
|
+
private _hoveringBorder;
|
|
2620
|
+
private readonly _normalMat;
|
|
2621
|
+
private readonly _hoverMat;
|
|
2622
|
+
private readonly _borderMat;
|
|
2623
|
+
private static readonly _BORDER_COLOR;
|
|
2624
|
+
private static readonly _BORDER_HOVER_COLOR;
|
|
2625
|
+
private static readonly _LINE_THRESHOLD;
|
|
2626
|
+
private static readonly _HANDLE_DEFS;
|
|
2627
|
+
/**
|
|
2628
|
+
* When `true`, the eight handle spheres are shown and resize drag is enabled.
|
|
2629
|
+
*/
|
|
2630
|
+
get resizable(): boolean;
|
|
2631
|
+
set resizable(value: boolean);
|
|
2632
|
+
/**
|
|
2633
|
+
* When `true`, hovering and dragging the border rectangle translates the
|
|
2634
|
+
* entire viewport while keeping its width and height constant.
|
|
2635
|
+
*/
|
|
2636
|
+
get movable(): boolean;
|
|
2637
|
+
set movable(value: boolean);
|
|
2638
|
+
/** `true` while either a resize or a move drag is in progress. */
|
|
2639
|
+
get isDragging(): boolean;
|
|
2640
|
+
constructor(viewport: ViewportBoundsController);
|
|
2641
|
+
/**
|
|
2642
|
+
* Rebuilds the border geometry and repositions all handles to match the
|
|
2643
|
+
* current viewport bounds. Called automatically by the viewport whenever
|
|
2644
|
+
* any bound changes; you rarely need to call this yourself.
|
|
2645
|
+
*/
|
|
2646
|
+
update(): void;
|
|
2647
|
+
/**
|
|
2648
|
+
* Forward `mousemove` events here.
|
|
2649
|
+
*
|
|
2650
|
+
* - **Resize drag active**: updates the bound(s) controlled by the active handle.
|
|
2651
|
+
* - **Move drag active**: translates all four bounds by the cursor delta,
|
|
2652
|
+
* preserving the viewport's width and height.
|
|
2653
|
+
* - **No drag**: highlights handles on hover; highlights the border when the
|
|
2654
|
+
* cursor is over it and no handle is hovered.
|
|
2655
|
+
*
|
|
2656
|
+
* @param ray - World-space ray, e.g. from `THREE.Raycaster.setFromCamera`.
|
|
2657
|
+
*/
|
|
2658
|
+
onPointerMove(ray: THREE.Ray): void;
|
|
2659
|
+
/**
|
|
2660
|
+
* Forward `mousedown` events here.
|
|
2661
|
+
*
|
|
2662
|
+
* - If a handle is hovered, begins a **resize drag**.
|
|
2663
|
+
* - If the border is hovered (and no handle), begins a **move drag**.
|
|
2664
|
+
*
|
|
2665
|
+
* @param ray - World-space ray at the moment of the press.
|
|
2666
|
+
*/
|
|
2667
|
+
onPointerDown(ray: THREE.Ray): void;
|
|
2668
|
+
/** Forward `mouseup` events here to end any active drag. */
|
|
2669
|
+
onPointerUp(): void;
|
|
2670
|
+
/** Releases all Three.js geometry and material resources. */
|
|
2671
|
+
dispose(): void;
|
|
2672
|
+
/**
|
|
2673
|
+
* Projects a world-space ray onto this group's local Y = 0 plane and
|
|
2674
|
+
* returns the intersection in local coordinates.
|
|
2675
|
+
*/
|
|
2676
|
+
private _projectToLocal;
|
|
2677
|
+
/** Toggles the border hover colour and keeps `_hoveringBorder` in sync. */
|
|
2678
|
+
private _setBorderHover;
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
/**
|
|
2682
|
+
* Manages the viewports of a {@link TechnicalDrawing}.
|
|
2683
|
+
*
|
|
2684
|
+
* Accessible via `drawing.viewports`. Extends `DataMap` so consumers get
|
|
2685
|
+
* reactive events (`onItemSet`, `onBeforeDelete`, …) for free.
|
|
2686
|
+
*
|
|
2687
|
+
* ```ts
|
|
2688
|
+
* const vp = drawing.viewports.create({ left: -1, right: 5, top: 1, bottom: -4 });
|
|
2689
|
+
* drawing.viewports.delete(vp.uuid); // disposes and removes
|
|
2690
|
+
* ```
|
|
2691
|
+
*/
|
|
2692
|
+
export declare class DrawingViewports extends FRAGS.DataMap<string, DrawingViewport> {
|
|
2693
|
+
private readonly _container;
|
|
2694
|
+
constructor(container: THREE.Group);
|
|
2695
|
+
/**
|
|
2696
|
+
* Creates a new {@link DrawingViewport}, adds its camera to the drawing
|
|
2697
|
+
* container, and registers it.
|
|
2698
|
+
*
|
|
2699
|
+
* @param config - Bounds and scale for the new viewport.
|
|
2700
|
+
* @returns The newly created viewport.
|
|
2701
|
+
*/
|
|
2702
|
+
create(config: DrawingViewportConfig): DrawingViewport;
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
/** One drawing with one or more viewport placements to export. */
|
|
2706
|
+
export declare interface DxfDrawingEntry {
|
|
2707
|
+
drawing: TechnicalDrawing;
|
|
2708
|
+
viewports: DxfViewportEntry[];
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
/**
|
|
2712
|
+
* Serializes {@link TechnicalDrawing} content to DXF format (AC1015 / AutoCAD R2000).
|
|
2713
|
+
*
|
|
2714
|
+
* Used through {@link DxfManager}:
|
|
2715
|
+
* ```ts
|
|
2716
|
+
* const dxf = components.get(OBC.DxfManager).exporter.export([
|
|
2717
|
+
* { drawing, viewports: [{ viewport, x: 10, y: 10 }] },
|
|
2718
|
+
* ], { widthMm: 420, heightMm: 297, margin: 10 });
|
|
2719
|
+
* ```
|
|
2720
|
+
*/
|
|
2721
|
+
export declare class DxfExporter {
|
|
2722
|
+
private readonly _components;
|
|
2723
|
+
/** Decimal places used when formatting measurement text in DXF. */
|
|
2724
|
+
precision: number;
|
|
2725
|
+
/**
|
|
2726
|
+
* Export configuration options.
|
|
2727
|
+
* - `trueColor` — when `true`, upgrades the output to AC1018 (AutoCAD 2004+) and
|
|
2728
|
+
* emits group code 420 (RGB true color) alongside group code 62 (ACI) on every
|
|
2729
|
+
* entity. Modern viewers prioritize 420; older apps fall back to 62.
|
|
2730
|
+
* Note: the adaptive black/white behavior of ACI 7 is lost when true color is on,
|
|
2731
|
+
* since viewers treat the explicit RGB as fixed. Defaults to `false`.
|
|
2732
|
+
*/
|
|
2733
|
+
config: {
|
|
2734
|
+
trueColor: boolean;
|
|
2735
|
+
};
|
|
2736
|
+
private _viewport;
|
|
2737
|
+
private _paperSlot;
|
|
2738
|
+
private readonly _annotationLayers;
|
|
2739
|
+
private readonly _systemExporters;
|
|
2740
|
+
constructor(_components: Components);
|
|
2741
|
+
/**
|
|
2742
|
+
* Registers a custom DXF exporter for a {@link DrawingSystem} subclass.
|
|
2743
|
+
*/
|
|
2744
|
+
registerSystemExporter<T extends AnnotationSystem<any>>(SystemClass: new (...args: any[]) => T, handler: (sys: T, ctx: DxfWriteContext) => void): void;
|
|
2745
|
+
/**
|
|
2746
|
+
* Serializes one or more drawings to a DXF string.
|
|
2747
|
+
*
|
|
2748
|
+
* When `paper` is supplied the output uses millimetres (INSUNITS=4) and
|
|
2749
|
+
* each viewport is placed at its (`x`, `y`) position on the sheet.
|
|
2750
|
+
* Without `paper` the output uses world units (INSUNITS=6).
|
|
2751
|
+
*
|
|
2752
|
+
* @param entries - Drawings with their viewport placements.
|
|
2753
|
+
* @param paper - Optional paper sheet dimensions for paper-space export.
|
|
2754
|
+
*/
|
|
2755
|
+
export(entries: DxfDrawingEntry[], paper?: DxfPaperOptions): string;
|
|
2756
|
+
private _writeHeader;
|
|
2757
|
+
private _writeTables;
|
|
2758
|
+
private _writeBlocks;
|
|
2759
|
+
private _writeBlock;
|
|
2760
|
+
/** Writes a rectangular border for the active viewport (no-op when no viewport is set). */
|
|
2761
|
+
private _writeViewportBorder;
|
|
2762
|
+
/**
|
|
2763
|
+
* Writes drawing-area and full-sheet border rectangles in paper-space coordinates.
|
|
2764
|
+
* Origin (0, 0) is the top-left corner of the drawing area (inside margins).
|
|
2765
|
+
*/
|
|
2766
|
+
private _writePaperBorders;
|
|
2767
|
+
private _writeObjects;
|
|
2768
|
+
private _writeRawLines;
|
|
2769
|
+
private _writeLinearAnnotations;
|
|
2770
|
+
private _writeAngleAnnotations;
|
|
2771
|
+
private _writeLeaderAnnotations;
|
|
2772
|
+
private _writeSlopeAnnotations;
|
|
2773
|
+
private _writeCalloutAnnotations;
|
|
2774
|
+
private _writeBlockInsertions;
|
|
2775
|
+
private _writeGeoAsLines;
|
|
2776
|
+
private _writePairsAsLines;
|
|
2777
|
+
private _emitTrueColor;
|
|
2778
|
+
private _writeLine;
|
|
2779
|
+
/** Writes a LINE entity with coordinates already in DXF space (no transform applied). */
|
|
2780
|
+
private _writeRawLine;
|
|
2781
|
+
/**
|
|
2782
|
+
* Writes a single triangle as a DXF SOLID entity.
|
|
2783
|
+
* Coordinates are in drawing local space (XZ plane) — transform is applied internally.
|
|
2784
|
+
* The 4th vertex equals the 3rd (degenerate quad = triangle).
|
|
2785
|
+
*/
|
|
2786
|
+
private _writeSolid;
|
|
2787
|
+
/**
|
|
2788
|
+
* Writes a flat XYZ triangle array (9 values per triangle, XZ plane) as SOLID entities.
|
|
2789
|
+
* Matches the output format of {@link MeshTickBuilder}.
|
|
2790
|
+
*/
|
|
2791
|
+
private _writeMeshTriangles;
|
|
2792
|
+
private _writeText;
|
|
2793
|
+
/** Maps world X to DXF X. In paper-space, output is in mm from the drawing area origin. */
|
|
2794
|
+
private _tx;
|
|
2795
|
+
/**
|
|
2796
|
+
* Maps world Z to DXF Y.
|
|
2797
|
+
* In paper-space, output is in mm from the drawing area bottom (DXF Y-up).
|
|
2798
|
+
* In world-space mode, uses Y-down convention (Y=0 at viewport top).
|
|
2799
|
+
*/
|
|
2800
|
+
private _ty;
|
|
2801
|
+
/** Returns the coordinate scale factor: mm-per-world-unit in paper mode, 1 otherwise. */
|
|
2802
|
+
private _scale;
|
|
2803
|
+
private _clipSegment;
|
|
2804
|
+
private _inViewport;
|
|
2805
|
+
private _bboxFromPositions;
|
|
2806
|
+
private _fullyInViewport;
|
|
2807
|
+
private _textAngle;
|
|
2808
|
+
private _writeCustomSystems;
|
|
2809
|
+
private _makeContext;
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
/**
|
|
2813
|
+
* Manages DXF import and export for technical drawings.
|
|
2814
|
+
*
|
|
2815
|
+
* ```ts
|
|
2816
|
+
* const manager = components.get(OBC.DxfManager);
|
|
2817
|
+
* const dxf = manager.exporter.export([{ drawing, viewports: [{ viewport }] }]);
|
|
2818
|
+
* ```
|
|
2819
|
+
*/
|
|
2820
|
+
export declare class DxfManager extends Component {
|
|
2821
|
+
static readonly uuid: "e9a2c3d4-5f67-4b89-a012-1c3d5e7f9b2a";
|
|
2822
|
+
enabled: boolean;
|
|
2823
|
+
/** Handles DXF serialisation of {@link TechnicalDrawing} content. */
|
|
2824
|
+
readonly exporter: DxfExporter;
|
|
2825
|
+
constructor(components: Components);
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
/** Paper sheet dimensions for paper-space export. */
|
|
2829
|
+
export declare interface DxfPaperOptions {
|
|
2830
|
+
/** Total paper width in mm. */
|
|
2831
|
+
widthMm: number;
|
|
2832
|
+
/** Total paper height in mm. */
|
|
2833
|
+
heightMm: number;
|
|
2834
|
+
/** Uniform margin in mm. */
|
|
2835
|
+
margin: number;
|
|
2836
|
+
}
|
|
2837
|
+
|
|
2838
|
+
/** Optional text formatting overrides for {@link DxfWriteContext.writeText}. */
|
|
2839
|
+
export declare interface DxfTextOptions {
|
|
2840
|
+
layer?: string;
|
|
2841
|
+
aciColor?: number;
|
|
2842
|
+
rotDeg?: number;
|
|
2843
|
+
hAlign?: 0 | 1 | 2;
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
/** One viewport placement within a drawing entry. */
|
|
2847
|
+
export declare interface DxfViewportEntry {
|
|
2848
|
+
/** Viewport to clip and transform against. If omitted, exports the full drawing. */
|
|
2849
|
+
viewport?: DrawingViewport;
|
|
2850
|
+
/** Horizontal position in mm from the top-left of the drawing area (paper-space only). */
|
|
2851
|
+
x?: number;
|
|
2852
|
+
/** Vertical position in mm from the top-left of the drawing area (paper-space only). */
|
|
2853
|
+
y?: number;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
/**
|
|
2857
|
+
* Write-context passed to custom system exporters registered via
|
|
2858
|
+
* {@link DxfExporter.registerSystemExporter}.
|
|
2859
|
+
*/
|
|
2860
|
+
export declare interface DxfWriteContext {
|
|
2861
|
+
writeLine(x1: number, y1: number, x2: number, y2: number, layer?: string, aciColor?: number): void;
|
|
2862
|
+
writePairs(positions: ArrayLike<number>, layer?: string, aciColor?: number): void;
|
|
2863
|
+
writeText(text: string, x: number, y: number, height: number, options?: DxfTextOptions): void;
|
|
2864
|
+
/** Writes a flat XYZ triangle array (9 values per triangle) as DXF SOLID entities. */
|
|
2865
|
+
writeMeshTriangles(triangles: number[], layer?: string, aciColor?: number): void;
|
|
2866
|
+
hexToAci(hex: number): number;
|
|
2867
|
+
textAngle(dx: number, dz: number): number;
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
/**
|
|
2871
|
+
* Result of an edge projection, containing visible/hidden geometries
|
|
2872
|
+
* and a mapping from group indices to model item identifiers.
|
|
2873
|
+
*/
|
|
2874
|
+
export declare interface EdgeProjectionResult {
|
|
2875
|
+
/** Line segment geometry for visible edges. Has a `group` vertex attribute with group indices. */
|
|
2876
|
+
visible: THREE.BufferGeometry;
|
|
2877
|
+
/** Line segment geometry for hidden edges. Has a `group` vertex attribute with group indices. */
|
|
2878
|
+
hidden: THREE.BufferGeometry;
|
|
2879
|
+
/** Maps group index to `{ modelId, localId }` identifying the source item. */
|
|
2880
|
+
groups: Record<number, {
|
|
2881
|
+
modelId: string;
|
|
2882
|
+
localId: number;
|
|
2883
|
+
}>;
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
/**
|
|
2887
|
+
* Component that generates 2D edge projections from fragment model items.
|
|
2888
|
+
* It takes a ModelIdMap, converts items to meshes, and runs them through
|
|
2889
|
+
* the three-edge-projection library to produce visible/hidden line segment geometries.
|
|
2890
|
+
*/
|
|
2891
|
+
export declare class EdgeProjector extends Component implements Disposable_2 {
|
|
2892
|
+
static readonly uuid: "f2e76c3a-8b1d-4d5e-9a3f-7c6b2d4e8f1a";
|
|
2893
|
+
enabled: boolean;
|
|
2894
|
+
readonly onDisposed: Event_2<unknown>;
|
|
2895
|
+
/**
|
|
2896
|
+
* The underlying ProjectionGenerator from three-edge-projection.
|
|
2897
|
+
* You can configure angleThreshold, iterationTime, includeIntersectionEdges, and useWebGPU.
|
|
2898
|
+
*/
|
|
2899
|
+
readonly generator: any;
|
|
2900
|
+
/**
|
|
2901
|
+
* Resolution of the visibility culler in pixels per meter.
|
|
2902
|
+
* Higher values = more accurate occlusion but slower culling.
|
|
2903
|
+
*/
|
|
2904
|
+
cullerPixelsPerMeter: number;
|
|
2905
|
+
/**
|
|
2906
|
+
* The direction the projector looks along. Meshes are projected onto the plane
|
|
2907
|
+
* perpendicular to this direction. Default is top-down (plan view).
|
|
2908
|
+
*
|
|
2909
|
+
* Common values:
|
|
2910
|
+
* - Top/Plan: `(0, -1, 0)`
|
|
2911
|
+
* - Front: `(0, 0, -1)`
|
|
2912
|
+
* - Back: `(0, 0, 1)`
|
|
2913
|
+
* - Left: `(-1, 0, 0)`
|
|
2914
|
+
* - Right: `(1, 0, 0)`
|
|
2915
|
+
*/
|
|
2916
|
+
readonly projectionDirection: THREE.Vector3;
|
|
2917
|
+
/**
|
|
2918
|
+
* Near clipping plane along the projection direction.
|
|
2919
|
+
* Meshes whose AABB is fully "behind" this plane (closer to the viewer) are excluded.
|
|
2920
|
+
* Set to -Infinity to disable.
|
|
2921
|
+
*/
|
|
2922
|
+
nearPlane: number;
|
|
2923
|
+
/**
|
|
2924
|
+
* Far clipping plane along the projection direction.
|
|
2925
|
+
* Meshes whose AABB is fully "beyond" this plane (farther from the viewer) are excluded.
|
|
2926
|
+
* Set to Infinity to disable.
|
|
2927
|
+
*/
|
|
2928
|
+
farPlane: number;
|
|
2929
|
+
constructor(components: Components);
|
|
2930
|
+
/**
|
|
2931
|
+
* Generates 2D edge projections for the given model items.
|
|
2932
|
+
*
|
|
2933
|
+
* @param modelIdMap - A map of model IDs to sets of local IDs specifying items to project.
|
|
2934
|
+
* @param world - The world whose renderer will be used for visibility culling.
|
|
2935
|
+
* @param config - Optional configuration.
|
|
2936
|
+
* @param config.onProgress - Optional progress callback receiving (message, progress?, collector?).
|
|
2937
|
+
* @returns Visible/hidden geometries with a `group` vertex attribute, and a groups mapping.
|
|
2938
|
+
*/
|
|
2939
|
+
get(modelIdMap: ModelIdMap, world: World, config?: {
|
|
2940
|
+
onProgress?: (message: string, progress?: number) => void;
|
|
2941
|
+
}): Promise<EdgeProjectionResult>;
|
|
2942
|
+
dispose(): void;
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
/**
|
|
2946
|
+
* Defines a closed shape (cloud, rectangle, circle, etc.) that forms the
|
|
2947
|
+
* body of a callout annotation.
|
|
2948
|
+
*
|
|
2949
|
+
* `buildGeometry` returns flat XYZ triplet pairs suitable for `THREE.LineSegments`.
|
|
2950
|
+
* `getAttachmentPoint` returns the point on the enclosure boundary in the
|
|
2951
|
+
* given direction — needed because non-circular shapes have non-radial boundaries.
|
|
2952
|
+
*/
|
|
2953
|
+
export declare type EnclosureBuilder = {
|
|
2954
|
+
/** Returns flat XYZ line-segment pairs forming the enclosure outline. */
|
|
2955
|
+
buildGeometry: (center: THREE.Vector3, halfW: number, halfH: number) => number[];
|
|
2956
|
+
/**
|
|
2957
|
+
* Returns the point on the enclosure boundary in the direction `dir` from
|
|
2958
|
+
* `center`. `dir` is a unit vector in the XZ plane.
|
|
2959
|
+
*/
|
|
2960
|
+
getAttachmentPoint: (center: THREE.Vector3, halfW: number, halfH: number, dir: THREE.Vector3) => THREE.Vector3;
|
|
2961
|
+
};
|
|
2962
|
+
|
|
1557
2963
|
/**
|
|
1558
2964
|
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to `this`, you will need to declare the callback as an arrow function.
|
|
1559
2965
|
*/
|
|
@@ -1796,6 +3202,26 @@ export declare class FastModelPickers extends Component implements Disposable_2
|
|
|
1796
3202
|
dispose(): void;
|
|
1797
3203
|
}
|
|
1798
3204
|
|
|
3205
|
+
/**
|
|
3206
|
+
* Filled arrowhead tick (solid triangle, requires a `THREE.Mesh`).
|
|
3207
|
+
* Use this as `meshTick` on a style — pair with `NoTick` as `tick` if you
|
|
3208
|
+
* want only the filled shape and no line arrowhead.
|
|
3209
|
+
*/
|
|
3210
|
+
export declare const FilledArrowTick: MeshTickBuilder;
|
|
3211
|
+
|
|
3212
|
+
/**
|
|
3213
|
+
* Filled circle tick (solid disc, requires a `THREE.Mesh`).
|
|
3214
|
+
* The disc is centred on the endpoint and approximated with 16 triangles.
|
|
3215
|
+
*/
|
|
3216
|
+
export declare const FilledCircleTick: MeshTickBuilder;
|
|
3217
|
+
|
|
3218
|
+
/**
|
|
3219
|
+
* Filled square tick (solid square, requires a `THREE.Mesh`).
|
|
3220
|
+
* The square is centred on the endpoint and oriented along the dimension line.
|
|
3221
|
+
* Common in structural and steel drawings.
|
|
3222
|
+
*/
|
|
3223
|
+
export declare const FilledSquareTick: MeshTickBuilder;
|
|
3224
|
+
|
|
1799
3225
|
/**
|
|
1800
3226
|
* Represents a finder query for retrieving items based on specified parameters. This class encapsulates the query logic, caching mechanism, and result management.
|
|
1801
3227
|
*/
|
|
@@ -1873,6 +3299,15 @@ export declare class FirstPersonMode implements NavigationMode {
|
|
|
1873
3299
|
private setupFirstPersonCamera;
|
|
1874
3300
|
}
|
|
1875
3301
|
|
|
3302
|
+
/**
|
|
3303
|
+
* Converts a slope ratio to a human-readable string.
|
|
3304
|
+
*
|
|
3305
|
+
* @param slope - Rise / run ratio (e.g. `0.15` for 15 %).
|
|
3306
|
+
* @param format - Desired output format.
|
|
3307
|
+
* @returns Formatted string, e.g. `"15.00 %"`, `"1:6.67"`, or `"8.53°"`.
|
|
3308
|
+
*/
|
|
3309
|
+
export declare function formatSlope(slope: number, format: SlopeFormat): string;
|
|
3310
|
+
|
|
1876
3311
|
/**
|
|
1877
3312
|
* Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
|
|
1878
3313
|
*/
|
|
@@ -1960,6 +3395,30 @@ export declare class FragmentsManager extends Component implements Disposable_2
|
|
|
1960
3395
|
applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem?: THREE.Matrix4): THREE.Matrix4;
|
|
1961
3396
|
}
|
|
1962
3397
|
|
|
3398
|
+
/**
|
|
3399
|
+
* Returns the tip position and inward tangent direction for each tick endpoint
|
|
3400
|
+
* of an angle dimension arc. Used by {@link AngleDimensions} to build
|
|
3401
|
+
* `meshTick` geometry.
|
|
3402
|
+
*/
|
|
3403
|
+
export declare function getAngleTickEndpoints(dim: AngleAnnotation): Array<{
|
|
3404
|
+
tip: THREE.Vector3;
|
|
3405
|
+
dir: THREE.Vector3;
|
|
3406
|
+
}>;
|
|
3407
|
+
|
|
3408
|
+
/**
|
|
3409
|
+
* Returns the tip position and inward direction for each tick endpoint of a
|
|
3410
|
+
* linear dimension. Used by {@link LinearDimensions} to build `meshTick` geometry.
|
|
3411
|
+
*/
|
|
3412
|
+
export declare function getDimensionTickEndpoints(dim: LinearAnnotation): Array<{
|
|
3413
|
+
tip: THREE.Vector3;
|
|
3414
|
+
dir: THREE.Vector3;
|
|
3415
|
+
}>;
|
|
3416
|
+
|
|
3417
|
+
/**
|
|
3418
|
+
* Returns the tip position of a slope annotation in drawing local space.
|
|
3419
|
+
*/
|
|
3420
|
+
export declare function getSlopeTip(ann: SlopeAnnotation, length: number): THREE.Vector3;
|
|
3421
|
+
|
|
1963
3422
|
/**
|
|
1964
3423
|
* A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
|
|
1965
3424
|
*/
|
|
@@ -2454,6 +3913,26 @@ export declare class IfcLoader extends Component implements Disposable_2 {
|
|
|
2454
3913
|
/**
|
|
2455
3914
|
* Loads an IFC file and processes it for 3D visualization.
|
|
2456
3915
|
*
|
|
3916
|
+
* By default, the loader imports a minimal set of attributes and relations
|
|
3917
|
+
* needed for typical visualization workflows.
|
|
3918
|
+
*
|
|
3919
|
+
* **Default attributes**
|
|
3920
|
+
* - Base entities: Project, Site, Building, BuildingStorey
|
|
3921
|
+
* - Materials: IFC material definitions and layers
|
|
3922
|
+
* - Properties: Property Sets, quantities (area, volume, length, etc.)
|
|
3923
|
+
*
|
|
3924
|
+
* **Default relations**
|
|
3925
|
+
* - DefinesByProperties (IsDefinedBy / DefinesOccurrence)
|
|
3926
|
+
* - AssociatesMaterial (HasAssociations / AssociatedTo)
|
|
3927
|
+
* - Aggregates (IsDecomposedBy / Decomposes)
|
|
3928
|
+
* - ContainedInSpatialStructure (ContainsElements / ContainedInStructure)
|
|
3929
|
+
*
|
|
3930
|
+
* If you need *all* attributes or relations to be loaded, you can enable them
|
|
3931
|
+
* via the `instanceCallback`.
|
|
3932
|
+
*
|
|
3933
|
+
* The callback provides direct access to the underlying `IfcImporter`,
|
|
3934
|
+
* allowing advanced configuration before processing begins.
|
|
3935
|
+
*
|
|
2457
3936
|
* @param data - The Uint8Array containing the IFC file data.
|
|
2458
3937
|
* @param coordinate - Boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
2459
3938
|
* @param name - Name for the fragments model.
|
|
@@ -2462,6 +3941,17 @@ export declare class IfcLoader extends Component implements Disposable_2 {
|
|
|
2462
3941
|
* @returns A Promise that resolves to the FragmentsModel containing the loaded and processed IFC data.
|
|
2463
3942
|
*
|
|
2464
3943
|
* @example
|
|
3944
|
+
* // Load all attributes and relations using the instanceCallback
|
|
3945
|
+
* ```ts
|
|
3946
|
+
* const model = await ifcLoader.load(ifcData, true, "modelName", {
|
|
3947
|
+
* instanceCallback: (importer) => {
|
|
3948
|
+
* importer.addAllAttributes();
|
|
3949
|
+
* importer.addAllRelations();
|
|
3950
|
+
* },
|
|
3951
|
+
* });
|
|
3952
|
+
* ```
|
|
3953
|
+
* @example
|
|
3954
|
+
* // Default loading (built-in attributes and relations only)
|
|
2465
3955
|
* ```typescript
|
|
2466
3956
|
* const ifcLoader = components.get(IfcLoader);
|
|
2467
3957
|
* const model = await ifcLoader.load(ifcData);
|
|
@@ -2557,24 +4047,346 @@ export declare class ItemsFinder extends Component implements Serializable<Seria
|
|
|
2557
4047
|
* @param modelIds - An optional array of model IDs to filter fragments. If not provided, all fragments are processed.
|
|
2558
4048
|
* @returns An array with the categories used to create the queries
|
|
2559
4049
|
*/
|
|
2560
|
-
addFromCategories(modelIds?: RegExp[]): Promise<string[]>;
|
|
4050
|
+
addFromCategories(modelIds?: RegExp[]): Promise<string[]>;
|
|
4051
|
+
/**
|
|
4052
|
+
* Imports a list of `FinderQuery` instances from a `SerializationResult` containing serialized finder query data.
|
|
4053
|
+
*
|
|
4054
|
+
* @param result - The `SerializationResult` containing the serialized `SerializedFinderQuery` data.
|
|
4055
|
+
* @returns An array of `FinderQuery` instances created from the serialized data. Returns an empty array if the input data is null or undefined.
|
|
4056
|
+
*/
|
|
4057
|
+
import(result: SerializationResult<SerializedFinderQuery>): FinderQuery[];
|
|
4058
|
+
/**
|
|
4059
|
+
* Serializes the ItemsFinder's data into a format suitable for export.
|
|
4060
|
+
*
|
|
4061
|
+
* @returns An object containing an array of serialized finder queries.
|
|
4062
|
+
*/
|
|
4063
|
+
export(): {
|
|
4064
|
+
data: SerializedFinderQuery[];
|
|
4065
|
+
};
|
|
4066
|
+
}
|
|
4067
|
+
|
|
4068
|
+
/**
|
|
4069
|
+
* The committed data for a single leader annotation.
|
|
4070
|
+
* Stored in drawing local space (XZ plane, Y = 0).
|
|
4071
|
+
*/
|
|
4072
|
+
export declare interface LeaderAnnotation {
|
|
4073
|
+
/** Unique identifier. */
|
|
4074
|
+
uuid: string;
|
|
4075
|
+
/** Tip of the arrow — the annotated point. */
|
|
4076
|
+
arrowTip: THREE.Vector3;
|
|
4077
|
+
/** Elbow — the bend between the leader line and the extension. */
|
|
4078
|
+
elbow: THREE.Vector3;
|
|
4079
|
+
/** End of the horizontal extension line — anchor for the text. */
|
|
4080
|
+
extensionEnd: THREE.Vector3;
|
|
4081
|
+
/** The annotation text. */
|
|
4082
|
+
text: string;
|
|
4083
|
+
/** Name of the {@link LeaderAnnotationStyle} to use when rendering. */
|
|
4084
|
+
style: string;
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
/** Editable fields of {@link LeaderAnnotation} — everything except `uuid`. */
|
|
4088
|
+
export declare type LeaderAnnotationData = Omit<LeaderAnnotation, "uuid">;
|
|
4089
|
+
|
|
4090
|
+
export declare type LeaderAnnotationEvent =
|
|
4091
|
+
/** First event that starts the machine — carries the target drawing. */
|
|
4092
|
+
{
|
|
4093
|
+
type: "CLICK";
|
|
4094
|
+
point: THREE.Vector3;
|
|
4095
|
+
drawing?: TechnicalDrawing;
|
|
4096
|
+
}
|
|
4097
|
+
/** The cursor moved — drawing context is already set from the initial CLICK. */
|
|
4098
|
+
| {
|
|
4099
|
+
type: "MOUSE_MOVE";
|
|
4100
|
+
point: THREE.Vector3;
|
|
4101
|
+
}
|
|
4102
|
+
/**
|
|
4103
|
+
* Consumer supplies the annotation text after the machine enters
|
|
4104
|
+
* `enteringText`. Ignored in all other states.
|
|
4105
|
+
*/
|
|
4106
|
+
| {
|
|
4107
|
+
type: "SUBMIT_TEXT";
|
|
4108
|
+
text: string;
|
|
4109
|
+
}
|
|
4110
|
+
/** Cancel the current operation and return to the initial state. */
|
|
4111
|
+
| {
|
|
4112
|
+
type: "ESCAPE";
|
|
4113
|
+
};
|
|
4114
|
+
|
|
4115
|
+
/**
|
|
4116
|
+
* Pure state transition function for the leader annotation tool.
|
|
4117
|
+
* Returns the **same state reference** when no transition applies.
|
|
4118
|
+
*/
|
|
4119
|
+
export declare function leaderAnnotationMachine(state: LeaderAnnotationState, event: LeaderAnnotationEvent): LeaderAnnotationState;
|
|
4120
|
+
|
|
4121
|
+
/**
|
|
4122
|
+
* Global drawing system that manages leader (arrow + text) annotations across
|
|
4123
|
+
* all {@link TechnicalDrawing} instances.
|
|
4124
|
+
*/
|
|
4125
|
+
export declare class LeaderAnnotations extends AnnotationSystem<LeaderAnnotationSystem> implements Transitionable<LeaderAnnotationState, LeaderAnnotationEvent>, Disposable_2 {
|
|
4126
|
+
enabled: boolean;
|
|
4127
|
+
readonly _item: LeaderAnnotation;
|
|
4128
|
+
machineState: LeaderAnnotationState;
|
|
4129
|
+
readonly onMachineStateChanged: Event_2<LeaderAnnotationState>;
|
|
4130
|
+
private readonly _previewMeshMaterial;
|
|
4131
|
+
private _previewMeshObject;
|
|
4132
|
+
constructor(components: Components);
|
|
4133
|
+
pickHandle(drawing: TechnicalDrawing, ray: THREE.Ray, threshold?: number): {
|
|
4134
|
+
uuid: string;
|
|
4135
|
+
handle: "elbow" | "extensionEnd";
|
|
4136
|
+
} | null;
|
|
4137
|
+
sendMachineEvent(event: LeaderAnnotationEvent): void;
|
|
4138
|
+
protected _buildGroup(ann: LeaderAnnotation, style: LeaderAnnotationStyle): THREE.Group;
|
|
4139
|
+
protected _updatePreview(): void;
|
|
4140
|
+
protected _clearPreview(): void;
|
|
4141
|
+
protected _onDispose(): void;
|
|
4142
|
+
private _resetMachine;
|
|
4143
|
+
private _clearPreviewMesh;
|
|
4144
|
+
}
|
|
4145
|
+
|
|
4146
|
+
export declare type LeaderAnnotationState =
|
|
4147
|
+
/** Tool active, waiting for the first click (arrow tip). */
|
|
4148
|
+
{
|
|
4149
|
+
kind: "awaitingArrowTip";
|
|
4150
|
+
}
|
|
4151
|
+
/** Arrow tip placed. User moves toward the elbow point. */
|
|
4152
|
+
| {
|
|
4153
|
+
kind: "placingElbow";
|
|
4154
|
+
arrowTip: THREE.Vector3;
|
|
4155
|
+
cursor: THREE.Vector3 | null;
|
|
4156
|
+
}
|
|
4157
|
+
/** Elbow placed. User moves toward the extension end. */
|
|
4158
|
+
| {
|
|
4159
|
+
kind: "placingExtension";
|
|
4160
|
+
arrowTip: THREE.Vector3;
|
|
4161
|
+
elbow: THREE.Vector3;
|
|
4162
|
+
cursor: THREE.Vector3 | null;
|
|
4163
|
+
}
|
|
4164
|
+
/**
|
|
4165
|
+
* All geometry is set. The machine is paused waiting for the consumer to
|
|
4166
|
+
* supply the annotation text via a `SUBMIT_TEXT` event.
|
|
4167
|
+
*/
|
|
4168
|
+
| {
|
|
4169
|
+
kind: "enteringText";
|
|
4170
|
+
arrowTip: THREE.Vector3;
|
|
4171
|
+
elbow: THREE.Vector3;
|
|
4172
|
+
extensionEnd: THREE.Vector3;
|
|
4173
|
+
}
|
|
4174
|
+
/** Annotation just committed. */
|
|
4175
|
+
| {
|
|
4176
|
+
kind: "committed";
|
|
4177
|
+
annotation: LeaderAnnotation;
|
|
4178
|
+
};
|
|
4179
|
+
|
|
4180
|
+
/** Visual appearance of a leader annotation. */
|
|
4181
|
+
export declare interface LeaderAnnotationStyle extends BaseAnnotationStyle {
|
|
4182
|
+
/** Size of the tick at the arrow tip in drawing local units. */
|
|
4183
|
+
tickSize: number;
|
|
4184
|
+
/**
|
|
4185
|
+
* Distance from `extensionEnd` to the text label anchor,
|
|
4186
|
+
* measured along the extension direction.
|
|
4187
|
+
*/
|
|
4188
|
+
textOffset: number;
|
|
4189
|
+
/**
|
|
4190
|
+
* Leader line shape.
|
|
4191
|
+
* - `"angular"` (default) — two straight segments: arrowTip → elbow → extensionEnd.
|
|
4192
|
+
* - `"curved"` — quadratic Bézier with `elbow` as the control point.
|
|
4193
|
+
*/
|
|
4194
|
+
leaderShape?: "angular" | "curved";
|
|
4195
|
+
/**
|
|
4196
|
+
* Line-segment tick at the arrow tip — geometry is included in the same
|
|
4197
|
+
* `LineSegments` as the leader line.
|
|
4198
|
+
* When both `tick` and `meshTick` are absent, nothing is drawn at the tip.
|
|
4199
|
+
*/
|
|
4200
|
+
lineTick?: LineTickBuilder;
|
|
4201
|
+
/**
|
|
4202
|
+
* Filled (mesh) tick at the arrow tip — rendered as a separate `THREE.Mesh`.
|
|
4203
|
+
* Can be combined with `tick` (e.g. open circle + filled disc = target).
|
|
4204
|
+
*/
|
|
4205
|
+
meshTick?: MeshTickBuilder;
|
|
4206
|
+
}
|
|
4207
|
+
|
|
4208
|
+
declare interface LeaderAnnotationSystem {
|
|
4209
|
+
item: LeaderAnnotation;
|
|
4210
|
+
data: LeaderAnnotationData;
|
|
4211
|
+
style: LeaderAnnotationStyle;
|
|
4212
|
+
handle: "elbow" | "extensionEnd";
|
|
4213
|
+
}
|
|
4214
|
+
|
|
4215
|
+
/**
|
|
4216
|
+
* The committed data for a single linear annotation.
|
|
4217
|
+
* Stored in drawing local space (XZ plane, Y = 0).
|
|
4218
|
+
*/
|
|
4219
|
+
export declare interface LinearAnnotation {
|
|
4220
|
+
/** Unique identifier. */
|
|
4221
|
+
uuid: string;
|
|
4222
|
+
/** First measured point in drawing local space. */
|
|
4223
|
+
pointA: THREE.Vector3;
|
|
4224
|
+
/** Second measured point in drawing local space. */
|
|
4225
|
+
pointB: THREE.Vector3;
|
|
4226
|
+
/**
|
|
4227
|
+
* Signed distance from the AB segment to the dimension line,
|
|
4228
|
+
* measured along the direction perpendicular to the measurement axis.
|
|
4229
|
+
*/
|
|
4230
|
+
offset: number;
|
|
4231
|
+
/** Name of the {@link LinearAnnotationStyle} to use when rendering this annotation. */
|
|
4232
|
+
style: string;
|
|
4233
|
+
}
|
|
4234
|
+
|
|
4235
|
+
/** Editable fields of {@link LinearAnnotation} — everything except the `uuid`. */
|
|
4236
|
+
export declare type LinearAnnotationData = Omit<LinearAnnotation, "uuid">;
|
|
4237
|
+
|
|
4238
|
+
export declare type LinearAnnotationEvent =
|
|
4239
|
+
/**
|
|
4240
|
+
* A point in drawing local space was clicked.
|
|
4241
|
+
* Carries `drawing` so the machine can lock it in as `_previewDrawing` on the
|
|
4242
|
+
* first click — subsequent events reuse that cached context.
|
|
4243
|
+
*
|
|
4244
|
+
* `line` MUST be provided when in `awaitingFirstPoint` or `placingPoints` —
|
|
4245
|
+
* the machine silently ignores the click without it (only line snaps accepted).
|
|
4246
|
+
* It is optional in `positioningOffset` (free-space placement).
|
|
4247
|
+
*/
|
|
4248
|
+
{
|
|
4249
|
+
type: "CLICK";
|
|
4250
|
+
point: THREE.Vector3;
|
|
4251
|
+
line?: THREE.Line3;
|
|
4252
|
+
drawing?: TechnicalDrawing;
|
|
4253
|
+
}
|
|
4254
|
+
/** The cursor moved — drawing context is already cached from the initial CLICK or SELECT_LINE. */
|
|
4255
|
+
| {
|
|
4256
|
+
type: "MOUSE_MOVE";
|
|
4257
|
+
point: THREE.Vector3;
|
|
4258
|
+
}
|
|
4259
|
+
/**
|
|
4260
|
+
* Consumer signals "done placing points — move to offset positioning".
|
|
4261
|
+
* Relevant only in `sequential` mode; in `individual` the machine auto-advances.
|
|
4262
|
+
* The consumer decides the DOM mapping (Enter, double-click, etc.).
|
|
4263
|
+
*/
|
|
4264
|
+
| {
|
|
4265
|
+
type: "CONFIRM";
|
|
4266
|
+
}
|
|
4267
|
+
/**
|
|
4268
|
+
* Alternative first event: selects an entire line as the dimension's measured
|
|
4269
|
+
* segment, jumping directly to `positioningOffset`.
|
|
4270
|
+
* Carries `drawing` to set the drawing context (same role as the first CLICK).
|
|
4271
|
+
*/
|
|
4272
|
+
| {
|
|
4273
|
+
type: "SELECT_LINE";
|
|
4274
|
+
line: THREE.Line3;
|
|
4275
|
+
drawing?: TechnicalDrawing;
|
|
4276
|
+
}
|
|
4277
|
+
/** Cancel the current operation and return to the initial state. */
|
|
4278
|
+
| {
|
|
4279
|
+
type: "ESCAPE";
|
|
4280
|
+
};
|
|
4281
|
+
|
|
4282
|
+
/**
|
|
4283
|
+
* Global drawing system that manages linear dimension annotations across all
|
|
4284
|
+
* {@link TechnicalDrawing} instances.
|
|
4285
|
+
*/
|
|
4286
|
+
export declare class LinearAnnotations extends AnnotationSystem<LinearAnnotationSystem> implements Transitionable<LinearAnnotationState, LinearAnnotationEvent>, Disposable_2 {
|
|
4287
|
+
enabled: boolean;
|
|
4288
|
+
readonly _item: LinearAnnotation;
|
|
4289
|
+
machineState: LinearAnnotationState;
|
|
4290
|
+
readonly onMachineStateChanged: Event_2<LinearAnnotationState>;
|
|
4291
|
+
constructor(components: Components);
|
|
4292
|
+
pickHandle(drawing: TechnicalDrawing, ray: THREE.Ray, threshold?: number): {
|
|
4293
|
+
uuid: string;
|
|
4294
|
+
handle: "pointA" | "pointB" | "offset";
|
|
4295
|
+
} | null;
|
|
4296
|
+
sendMachineEvent(event: LinearAnnotationEvent): void;
|
|
4297
|
+
protected _buildGroup(dim: LinearAnnotation, style: LinearAnnotationStyle): THREE.Group;
|
|
4298
|
+
protected _updatePreview(): void;
|
|
4299
|
+
private _resetMachine;
|
|
4300
|
+
}
|
|
4301
|
+
|
|
4302
|
+
export declare type LinearAnnotationState =
|
|
4303
|
+
/** Tool is active but no interaction has started. */
|
|
4304
|
+
{
|
|
4305
|
+
kind: "awaitingFirstPoint";
|
|
4306
|
+
}
|
|
4307
|
+
/**
|
|
4308
|
+
* First point placed. Stores the direction of the measured lines so that
|
|
4309
|
+
* subsequent clicks can be validated (must be on parallel lines) and the
|
|
4310
|
+
* cursor preview constrained to the orthogonal measurement direction.
|
|
4311
|
+
*
|
|
4312
|
+
* In `individual` mode the tool auto-advances after the second CLICK.
|
|
4313
|
+
* In `sequential` mode the user accumulates points and sends CONFIRM when done.
|
|
4314
|
+
*/
|
|
4315
|
+
| {
|
|
4316
|
+
kind: "placingPoints";
|
|
4317
|
+
points: THREE.Vector3[];
|
|
4318
|
+
cursor: THREE.Vector3 | null;
|
|
4319
|
+
/** Normalised direction of the first (and all subsequent) measured lines. */
|
|
4320
|
+
lineDir: THREE.Vector3;
|
|
4321
|
+
/** The first line segment hit — used to reject clicks on the same segment. */
|
|
4322
|
+
firstLine: THREE.Line3;
|
|
4323
|
+
}
|
|
4324
|
+
/**
|
|
4325
|
+
* All measurement points are set. The user drags to define the perpendicular
|
|
4326
|
+
* offset of the dimension line, then clicks to commit.
|
|
4327
|
+
*/
|
|
4328
|
+
| {
|
|
4329
|
+
kind: "positioningOffset";
|
|
4330
|
+
points: THREE.Vector3[];
|
|
4331
|
+
cursor: THREE.Vector3 | null;
|
|
4332
|
+
}
|
|
4333
|
+
/** One or more annotations have just been committed. */
|
|
4334
|
+
| {
|
|
4335
|
+
kind: "committed";
|
|
4336
|
+
dimensions: LinearAnnotation[];
|
|
4337
|
+
};
|
|
4338
|
+
|
|
4339
|
+
/** Visual appearance of a linear annotation. Registered by name on the component. */
|
|
4340
|
+
export declare interface LinearAnnotationStyle extends BaseAnnotationStyle {
|
|
4341
|
+
/** Tick mark geometry builder. Use one of the built-in exports or provide a custom one. */
|
|
4342
|
+
lineTick: LineTickBuilder;
|
|
2561
4343
|
/**
|
|
2562
|
-
*
|
|
2563
|
-
*
|
|
2564
|
-
*
|
|
2565
|
-
* @returns An array of `FinderQuery` instances created from the serialized data. Returns an empty array if the input data is null or undefined.
|
|
4344
|
+
* Optional filled tick mark builder. When provided, a `THREE.Mesh` triangle
|
|
4345
|
+
* is rendered at each dimension endpoint in addition to (or instead of) the
|
|
4346
|
+
* line tick. Set `tick` to {@link NoTick} when you only want the filled shape.
|
|
2566
4347
|
*/
|
|
2567
|
-
|
|
4348
|
+
meshTick?: MeshTickBuilder;
|
|
4349
|
+
/** Size of the tick mark in drawing local units. */
|
|
4350
|
+
tickSize: number;
|
|
4351
|
+
/** Gap between the measured geometry and the start of each extension line. */
|
|
4352
|
+
extensionGap: number;
|
|
4353
|
+
/** How far extension lines overshoot beyond the dimension line. */
|
|
4354
|
+
extensionOvershoot: number;
|
|
2568
4355
|
/**
|
|
2569
|
-
*
|
|
2570
|
-
*
|
|
2571
|
-
*
|
|
4356
|
+
* Signed perpendicular distance from the dimension line to the text label,
|
|
4357
|
+
* measured outward from the measured geometry.
|
|
4358
|
+
* Positive moves the text away from the geometry; negative moves it inward.
|
|
2572
4359
|
*/
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
4360
|
+
textOffset: number;
|
|
4361
|
+
}
|
|
4362
|
+
|
|
4363
|
+
declare interface LinearAnnotationSystem {
|
|
4364
|
+
item: LinearAnnotation;
|
|
4365
|
+
data: LinearAnnotationData;
|
|
4366
|
+
style: LinearAnnotationStyle;
|
|
4367
|
+
handle: "pointA" | "pointB" | "offset";
|
|
2576
4368
|
}
|
|
2577
4369
|
|
|
4370
|
+
/**
|
|
4371
|
+
* Pure state transition function for the linear dimension tool.
|
|
4372
|
+
*
|
|
4373
|
+
* Given the current state and an incoming event, returns the next state.
|
|
4374
|
+
* Returns the **same state reference** when no transition applies (caller can
|
|
4375
|
+
* skip re-renders with a `===` check).
|
|
4376
|
+
*/
|
|
4377
|
+
export declare function linearDimensionMachine(state: LinearAnnotationState, event: LinearAnnotationEvent): LinearAnnotationState;
|
|
4378
|
+
|
|
4379
|
+
/**
|
|
4380
|
+
* A function that produces tick mark geometry at one endpoint of a dimension
|
|
4381
|
+
* or leader line. Returns a flat array of XYZ triplets (vertex pairs for
|
|
4382
|
+
* `LineSegments`).
|
|
4383
|
+
*
|
|
4384
|
+
* @param tip - The endpoint of the line (drawing local space).
|
|
4385
|
+
* @param lineDir - Normalised direction FROM `tip` TOWARD the other endpoint.
|
|
4386
|
+
* @param size - Tick size in drawing local units.
|
|
4387
|
+
*/
|
|
4388
|
+
export declare type LineTickBuilder = (tip: THREE.Vector3, lineDir: THREE.Vector3, size: number) => number[];
|
|
4389
|
+
|
|
2578
4390
|
/**
|
|
2579
4391
|
* Represents an edge measurement result.
|
|
2580
4392
|
*/
|
|
@@ -2644,6 +4456,19 @@ export declare class MeasurementUtils extends Component {
|
|
|
2644
4456
|
static convertUnits(value: number, fromUnit: string, toUnit: string, precision?: number): number;
|
|
2645
4457
|
}
|
|
2646
4458
|
|
|
4459
|
+
/**
|
|
4460
|
+
* A function that produces filled tick mark geometry (triangles) at one
|
|
4461
|
+
* endpoint. Returns a flat array of XYZ triplets forming non-indexed triangles
|
|
4462
|
+
* for a `THREE.Mesh`.
|
|
4463
|
+
*
|
|
4464
|
+
* Same signature as {@link LineTickBuilder} — swap one for the other freely.
|
|
4465
|
+
*
|
|
4466
|
+
* @param tip - The endpoint of the dimension or leader line.
|
|
4467
|
+
* @param lineDir - Normalised direction FROM `tip` TOWARD the other endpoint.
|
|
4468
|
+
* @param size - Tick/arrow size in drawing local units.
|
|
4469
|
+
*/
|
|
4470
|
+
export declare type MeshTickBuilder = (tip: THREE.Vector3, lineDir: THREE.Vector3, size: number) => number[];
|
|
4471
|
+
|
|
2647
4472
|
export declare type ModelIdDataMap<T> = FRAGS.DataMap<string, FRAGS.DataMap<number, T>>;
|
|
2648
4473
|
|
|
2649
4474
|
/**
|
|
@@ -2774,6 +4599,11 @@ export declare interface NoControl {
|
|
|
2774
4599
|
value: any;
|
|
2775
4600
|
}
|
|
2776
4601
|
|
|
4602
|
+
/**
|
|
4603
|
+
* No tick — dimension line ends cleanly at the extension lines.
|
|
4604
|
+
*/
|
|
4605
|
+
export declare const NoTick: LineTickBuilder;
|
|
4606
|
+
|
|
2777
4607
|
export declare interface NumberSettingControl {
|
|
2778
4608
|
type: "Number";
|
|
2779
4609
|
interpolable: boolean;
|
|
@@ -2782,6 +4612,11 @@ export declare interface NumberSettingControl {
|
|
|
2782
4612
|
value: number;
|
|
2783
4613
|
}
|
|
2784
4614
|
|
|
4615
|
+
/**
|
|
4616
|
+
* Open-V arrowhead tick — two lines from the tip to the wing points, no base.
|
|
4617
|
+
*/
|
|
4618
|
+
export declare const OpenArrowTick: LineTickBuilder;
|
|
4619
|
+
|
|
2785
4620
|
/**
|
|
2786
4621
|
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
2787
4622
|
*/
|
|
@@ -2992,6 +4827,12 @@ export declare class Raycasters extends Component implements Disposable_2 {
|
|
|
2992
4827
|
dispose(): void;
|
|
2993
4828
|
}
|
|
2994
4829
|
|
|
4830
|
+
/**
|
|
4831
|
+
* Rectangular enclosure — a plain axis-aligned rectangle centred on `center`.
|
|
4832
|
+
* Width = 2 × halfW, height = 2 × halfH.
|
|
4833
|
+
*/
|
|
4834
|
+
export declare const RectEnclosure: EnclosureBuilder;
|
|
4835
|
+
|
|
2995
4836
|
/**
|
|
2996
4837
|
* Configuration options for removing items from a classifier.
|
|
2997
4838
|
*/
|
|
@@ -3216,6 +5057,7 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
|
|
|
3216
5057
|
* This camera is used for rendering the scene.
|
|
3217
5058
|
*/
|
|
3218
5059
|
three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
5060
|
+
protected _resizeObserver: ResizeObserver | null;
|
|
3219
5061
|
private _allControls;
|
|
3220
5062
|
/**
|
|
3221
5063
|
* The object that controls the camera. An instance of
|
|
@@ -3422,6 +5264,10 @@ export declare class SimplePlane implements Disposable_2, Hideable {
|
|
|
3422
5264
|
private readonly _planeMesh;
|
|
3423
5265
|
private readonly _controls;
|
|
3424
5266
|
private readonly _hiddenMaterial;
|
|
5267
|
+
private _sizeMultiplier;
|
|
5268
|
+
private _autoScale;
|
|
5269
|
+
get autoScale(): boolean;
|
|
5270
|
+
set autoScale(value: boolean);
|
|
3425
5271
|
/**
|
|
3426
5272
|
* Getter for the enabled state of the clipping plane.
|
|
3427
5273
|
* @returns {boolean} The current enabled state.
|
|
@@ -3478,6 +5324,7 @@ export declare class SimplePlane implements Disposable_2, Hideable {
|
|
|
3478
5324
|
setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
|
|
3479
5325
|
/** {@link Updateable.update} */
|
|
3480
5326
|
update: () => void;
|
|
5327
|
+
private updateScale;
|
|
3481
5328
|
/** {@link Disposable.dispose} */
|
|
3482
5329
|
dispose(): void;
|
|
3483
5330
|
private reset;
|
|
@@ -3550,7 +5397,7 @@ export declare class SimpleRaycaster implements Disposable_2 {
|
|
|
3550
5397
|
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3551
5398
|
* @returns The first intersection found or `null` if no intersection was found.
|
|
3552
5399
|
*/
|
|
3553
|
-
castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
|
|
5400
|
+
castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
|
|
3554
5401
|
private intersect;
|
|
3555
5402
|
private filterClippingPlanes;
|
|
3556
5403
|
}
|
|
@@ -3686,7 +5533,7 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
|
|
|
3686
5533
|
/**
|
|
3687
5534
|
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
3688
5535
|
*/
|
|
3689
|
-
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
5536
|
+
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
3690
5537
|
/** {@link Updateable.onAfterUpdate} */
|
|
3691
5538
|
readonly onAfterUpdate: Event_2<unknown>;
|
|
3692
5539
|
/** {@link Updateable.onBeforeUpdate} */
|
|
@@ -3761,6 +5608,540 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
|
|
|
3761
5608
|
dispose(disposeResources?: boolean): void;
|
|
3762
5609
|
}
|
|
3763
5610
|
|
|
5611
|
+
/**
|
|
5612
|
+
* A single committed slope annotation.
|
|
5613
|
+
* All coordinates are in drawing local space (XZ plane, Y = 0).
|
|
5614
|
+
*/
|
|
5615
|
+
export declare interface SlopeAnnotation {
|
|
5616
|
+
/** Unique identifier. */
|
|
5617
|
+
uuid: string;
|
|
5618
|
+
/** Anchor point of the arrow tail in drawing local space. */
|
|
5619
|
+
position: THREE.Vector3;
|
|
5620
|
+
/** Normalised downhill direction in the XZ plane. */
|
|
5621
|
+
direction: THREE.Vector3;
|
|
5622
|
+
/**
|
|
5623
|
+
* Slope ratio: rise / run (e.g. `0.15` for a 15 % slope).
|
|
5624
|
+
* Use {@link formatSlope} to convert to the desired display string.
|
|
5625
|
+
*/
|
|
5626
|
+
slope: number;
|
|
5627
|
+
/** Name of the {@link SlopeAnnotationStyle} to use. */
|
|
5628
|
+
style: string;
|
|
5629
|
+
}
|
|
5630
|
+
|
|
5631
|
+
/** Editable fields of {@link SlopeAnnotation} — everything except the `uuid`. */
|
|
5632
|
+
export declare type SlopeAnnotationData = Omit<SlopeAnnotation, "uuid">;
|
|
5633
|
+
|
|
5634
|
+
/**
|
|
5635
|
+
* Global drawing system that manages slope annotations across all
|
|
5636
|
+
* {@link TechnicalDrawing} instances.
|
|
5637
|
+
*
|
|
5638
|
+
* Because slope data comes from the 3D model, there is no state machine.
|
|
5639
|
+
* Call {@link add} directly with the computed slope values:
|
|
5640
|
+
* ```ts
|
|
5641
|
+
* slopes.add(drawing, { position, direction, slope, style: "default" });
|
|
5642
|
+
* ```
|
|
5643
|
+
*/
|
|
5644
|
+
export declare class SlopeAnnotations extends AnnotationSystem<SlopeAnnotationSystem> implements Disposable_2 {
|
|
5645
|
+
enabled: boolean;
|
|
5646
|
+
readonly _item: SlopeAnnotation;
|
|
5647
|
+
constructor(components: Components);
|
|
5648
|
+
pickHandle(_drawing: TechnicalDrawing, _ray: THREE.Ray, _threshold?: number): {
|
|
5649
|
+
uuid: string;
|
|
5650
|
+
handle: string;
|
|
5651
|
+
} | null;
|
|
5652
|
+
protected _buildGroup(ann: SlopeAnnotation, style: SlopeAnnotationStyle): THREE.Group;
|
|
5653
|
+
}
|
|
5654
|
+
|
|
5655
|
+
/** Visual appearance of a slope annotation. */
|
|
5656
|
+
export declare interface SlopeAnnotationStyle extends BaseAnnotationStyle {
|
|
5657
|
+
/** Tick mark builder at the downhill tip of the arrow. */
|
|
5658
|
+
lineTick: LineTickBuilder;
|
|
5659
|
+
/** Optional filled tick mark builder at the downhill tip. */
|
|
5660
|
+
meshTick?: MeshTickBuilder;
|
|
5661
|
+
/** Tick size in drawing local units. */
|
|
5662
|
+
tickSize: number;
|
|
5663
|
+
/** Length of the arrow shaft in drawing local units. */
|
|
5664
|
+
length: number;
|
|
5665
|
+
/**
|
|
5666
|
+
* Distance from the arrow midpoint to the near edge of the text label,
|
|
5667
|
+
* measured perpendicularly to the slope direction.
|
|
5668
|
+
*/
|
|
5669
|
+
textOffset: number;
|
|
5670
|
+
/** How the slope ratio is formatted in the text label. */
|
|
5671
|
+
format: SlopeFormat;
|
|
5672
|
+
}
|
|
5673
|
+
|
|
5674
|
+
declare interface SlopeAnnotationSystem {
|
|
5675
|
+
item: SlopeAnnotation;
|
|
5676
|
+
data: SlopeAnnotationData;
|
|
5677
|
+
style: SlopeAnnotationStyle;
|
|
5678
|
+
handle: string;
|
|
5679
|
+
}
|
|
5680
|
+
|
|
5681
|
+
/** How the slope value is displayed in the text label. */
|
|
5682
|
+
export declare type SlopeFormat = "percentage" | "ratio" | "degrees";
|
|
5683
|
+
|
|
5684
|
+
/**
|
|
5685
|
+
* A single technical drawing — the core spatial aggregate.
|
|
5686
|
+
*
|
|
5687
|
+
* Brings together:
|
|
5688
|
+
* - A {@link three} (`THREE.Group`) that anchors the drawing in world space.
|
|
5689
|
+
* All 2D geometry (projection lines, dimensions) must be added as children of
|
|
5690
|
+
* this group so they inherit its world transform.
|
|
5691
|
+
* - A collection of {@link viewports}, each defining an orthographic framing
|
|
5692
|
+
* window and owning a camera that is itself a child of the container.
|
|
5693
|
+
*
|
|
5694
|
+
* Moving or rotating the container repositions the entire drawing — including
|
|
5695
|
+
* all its viewport cameras — in the 3D world without affecting any local
|
|
5696
|
+
* coordinates.
|
|
5697
|
+
*
|
|
5698
|
+
* ---
|
|
5699
|
+
*
|
|
5700
|
+
* ### Rotation convention
|
|
5701
|
+
*
|
|
5702
|
+
* The drawing projects geometry along its **local −Y axis**. The drawing
|
|
5703
|
+
* plane is the local **XZ plane** (Y = 0).
|
|
5704
|
+
*
|
|
5705
|
+
* When rotating `drawing.three`, two constraints must hold at the same time:
|
|
5706
|
+
*
|
|
5707
|
+
* 1. **Projection direction** — local −Y must point toward the surface you
|
|
5708
|
+
* want to capture.
|
|
5709
|
+
* 2. **Text orientation** — local +X must point toward the right side of the
|
|
5710
|
+
* screen when the drawing is viewed from the projection direction.
|
|
5711
|
+
* Violating this causes annotations and dimension text to appear mirrored.
|
|
5712
|
+
*
|
|
5713
|
+
* For the six standard orthographic views, use {@link orientTo} — it enforces
|
|
5714
|
+
* both constraints with a single call:
|
|
5715
|
+
*
|
|
5716
|
+
* ```ts
|
|
5717
|
+
* drawing.orientTo(new THREE.Vector3(0, -1, 0)); // top / plan
|
|
5718
|
+
* drawing.orientTo(new THREE.Vector3(0, 0, -1)); // front elevation
|
|
5719
|
+
* ```
|
|
5720
|
+
*
|
|
5721
|
+
* ---
|
|
5722
|
+
*
|
|
5723
|
+
* Typically created via {@link TechnicalDrawings.create}.
|
|
5724
|
+
*/
|
|
5725
|
+
export declare class TechnicalDrawing {
|
|
5726
|
+
/** Unique identifier for this drawing instance. */
|
|
5727
|
+
readonly uuid: string;
|
|
5728
|
+
private readonly _raycaster;
|
|
5729
|
+
private readonly _components;
|
|
5730
|
+
constructor(components: Components);
|
|
5731
|
+
/**
|
|
5732
|
+
* The world that hosts this drawing. Set automatically by
|
|
5733
|
+
* {@link TechnicalDrawings.create} — do not assign manually unless you are
|
|
5734
|
+
* managing the drawing's scene integration yourself.
|
|
5735
|
+
*/
|
|
5736
|
+
world: World | null;
|
|
5737
|
+
/**
|
|
5738
|
+
* Root Three.js group for all 2D content belonging to this drawing.
|
|
5739
|
+
* All geometry (projection lines, dimensions) must be added as children so
|
|
5740
|
+
* they inherit its world transform.
|
|
5741
|
+
*/
|
|
5742
|
+
readonly three: THREE.Group<THREE.Object3DEventMap>;
|
|
5743
|
+
/**
|
|
5744
|
+
* Typed access to all annotation data stored on this drawing.
|
|
5745
|
+
*
|
|
5746
|
+
* ```ts
|
|
5747
|
+
* const dims = techDrawings.use(OBC.LinearAnnotations);
|
|
5748
|
+
* const data = drawing.annotations.getBySystem(dims);
|
|
5749
|
+
* // DataMap<annotationUuid, LinearAnnotation>
|
|
5750
|
+
* ```
|
|
5751
|
+
*/
|
|
5752
|
+
readonly annotations: DrawingAnnotations;
|
|
5753
|
+
/**
|
|
5754
|
+
* Layer manager for this drawing.
|
|
5755
|
+
* Use it to create layers, set colors, control visibility, and subscribe to
|
|
5756
|
+
* lifecycle events for reactive UI.
|
|
5757
|
+
*
|
|
5758
|
+
* ```ts
|
|
5759
|
+
* drawing.layers.create("walls", { color: 0x333333 });
|
|
5760
|
+
* drawing.layers.setColor("walls", 0x888888);
|
|
5761
|
+
* drawing.layers.setVisibility("walls", false);
|
|
5762
|
+
* ```
|
|
5763
|
+
*/
|
|
5764
|
+
readonly layers: DrawingLayers;
|
|
5765
|
+
/**
|
|
5766
|
+
* Name of the layer new annotations will be assigned to when added via any
|
|
5767
|
+
* drawing system. Must be a layer registered via {@link DrawingLayers.create}.
|
|
5768
|
+
* Defaults to `"0"`.
|
|
5769
|
+
*/
|
|
5770
|
+
activeLayer: string;
|
|
5771
|
+
/**
|
|
5772
|
+
* Depth of the projection capture volume, in world units, measured from the
|
|
5773
|
+
* drawing plane along the local -Y axis (the projection direction).
|
|
5774
|
+
*
|
|
5775
|
+
* Used by {@link TechnicalDrawingHelper} to visualise the volume, and by
|
|
5776
|
+
* `addProjectionFromItems` to set the far clipping plane of the
|
|
5777
|
+
* {@link EdgeProjector} automatically.
|
|
5778
|
+
*
|
|
5779
|
+
* Defaults to `10`.
|
|
5780
|
+
*/
|
|
5781
|
+
far: number;
|
|
5782
|
+
/** All viewports registered on this drawing, keyed by their UUID. */
|
|
5783
|
+
readonly viewports: DrawingViewports;
|
|
5784
|
+
/** {@link Disposable.onDisposed} */
|
|
5785
|
+
readonly onDisposed: Event_2<void>;
|
|
5786
|
+
/**
|
|
5787
|
+
* Intersects a pre-built ray against all layer-1 `LineSegments` in this drawing.
|
|
5788
|
+
*
|
|
5789
|
+
* The caller is responsible for building the ray (via `THREE.Raycaster.setFromCamera`
|
|
5790
|
+
* or any other method) so this method stays agnostic to which camera or canvas
|
|
5791
|
+
* the pick originated from.
|
|
5792
|
+
*
|
|
5793
|
+
* The returned {@link DrawingIntersection.point} is in drawing **local space**
|
|
5794
|
+
* (XZ plane, Y = 0), ready to use for dimension creation or snapping.
|
|
5795
|
+
*
|
|
5796
|
+
* @param ray - World-space ray to cast.
|
|
5797
|
+
* @param viewport - The viewport the ray was built from, if any. Pass `null`
|
|
5798
|
+
* when picking from the 3D world camera.
|
|
5799
|
+
* @returns The closest intersection, or `null` if nothing was hit.
|
|
5800
|
+
*/
|
|
5801
|
+
raycast(ray: THREE.Ray, viewport?: DrawingViewport | null): DrawingIntersection | null;
|
|
5802
|
+
/**
|
|
5803
|
+
* Aligns this drawing to a target plane in 3D world space using three
|
|
5804
|
+
* point correspondences.
|
|
5805
|
+
*
|
|
5806
|
+
* Pass three points picked on the drawing (in drawing local space) and
|
|
5807
|
+
* three corresponding points picked on the 3D model (in world space).
|
|
5808
|
+
* The drawing's container will be repositioned, rotated, and uniformly
|
|
5809
|
+
* scaled so that the drawing points map to their world counterparts.
|
|
5810
|
+
*
|
|
5811
|
+
* @throws If either set of points is collinear or degenerate — see
|
|
5812
|
+
* {@link computeAlignmentMatrix} for details.
|
|
5813
|
+
*
|
|
5814
|
+
* @param drawingPoints - Three non-collinear points in drawing local space.
|
|
5815
|
+
* @param worldPoints - Three corresponding points in world space.
|
|
5816
|
+
*/
|
|
5817
|
+
alignTo(drawingPoints: THREE.Vector3[], worldPoints: THREE.Vector3[]): void;
|
|
5818
|
+
/**
|
|
5819
|
+
* Projects a `THREE.LineSegments` from any world-space position onto the
|
|
5820
|
+
* given drawing's local XZ plane (Y = 0), returning a new `THREE.LineSegments`
|
|
5821
|
+
* ready to be added to {@link container}.
|
|
5822
|
+
*
|
|
5823
|
+
* Vertex coordinates are transformed from the input object's local space →
|
|
5824
|
+
* world space → drawing local space, then Y is zeroed. The input object is
|
|
5825
|
+
* not modified.
|
|
5826
|
+
*
|
|
5827
|
+
* ```ts
|
|
5828
|
+
* const projected = TechnicalDrawing.toDrawingSpace(myIFCLines, drawing);
|
|
5829
|
+
* drawing.three.add(projected);
|
|
5830
|
+
* ```
|
|
5831
|
+
*
|
|
5832
|
+
* @param ls - Source `LineSegments` to project. Its world matrix must be
|
|
5833
|
+
* up-to-date (call `updateWorldMatrix(true, false)` if unsure).
|
|
5834
|
+
* @param drawing - Target drawing whose local XZ plane is used as destination.
|
|
5835
|
+
* @returns A new `LineSegments` with the projected geometry in drawing local
|
|
5836
|
+
* space. No material is assigned — set one before rendering.
|
|
5837
|
+
*/
|
|
5838
|
+
static toDrawingSpace(ls: THREE.LineSegments, drawing: TechnicalDrawing): THREE.LineSegments;
|
|
5839
|
+
/**
|
|
5840
|
+
* Adds a `THREE.LineSegments` to this drawing's {@link container} and
|
|
5841
|
+
* automatically computes a BVH on its geometry so that {@link raycast} can
|
|
5842
|
+
* pick individual line segments efficiently.
|
|
5843
|
+
*
|
|
5844
|
+
* Use this instead of `drawing.three.add()` whenever the geometry will
|
|
5845
|
+
* participate in picking. Plain `container.add()` still works for rendering,
|
|
5846
|
+
* but without BVH the raycast falls back to a brute-force O(n) test on every
|
|
5847
|
+
* segment — noticeably slow for dense projections.
|
|
5848
|
+
*
|
|
5849
|
+
* The layer assignment and Three.js rendering-layer setup (layer 1) are handled
|
|
5850
|
+
* internally — the caller does not need to touch `userData` or `ls.layers`.
|
|
5851
|
+
* If the named layer has a color defined, it is applied to the material immediately.
|
|
5852
|
+
*
|
|
5853
|
+
* ```ts
|
|
5854
|
+
* drawing.layers.create("walls", { color: 0x333333 });
|
|
5855
|
+
* drawing.addProjectionLines(wallLines, "walls");
|
|
5856
|
+
* ```
|
|
5857
|
+
*
|
|
5858
|
+
* @param ls - The `LineSegments` to add.
|
|
5859
|
+
* @param layer - Layer name to assign. Defaults to `"0"`. If the layer does not
|
|
5860
|
+
* exist, a warning is logged and the lines fall back to `"0"`.
|
|
5861
|
+
* @returns The same `LineSegments` instance, for chaining.
|
|
5862
|
+
*/
|
|
5863
|
+
addProjectionLines(ls: THREE.LineSegments, layer?: string): THREE.LineSegments;
|
|
5864
|
+
/**
|
|
5865
|
+
* Projects the visible and hidden edges of the given BIM model items onto
|
|
5866
|
+
* this drawing using {@link EdgeProjector}.
|
|
5867
|
+
*
|
|
5868
|
+
* The projection direction is inferred from the drawing's current world
|
|
5869
|
+
* orientation (local `-Y` axis). The capture volume extends from the drawing
|
|
5870
|
+
* plane by {@link far} world units along that direction. Items outside the
|
|
5871
|
+
* volume are excluded automatically.
|
|
5872
|
+
*
|
|
5873
|
+
* Both layer names must already exist on this drawing before calling this
|
|
5874
|
+
* method — create them with {@link DrawingLayers.create} beforehand.
|
|
5875
|
+
*
|
|
5876
|
+
* ```ts
|
|
5877
|
+
* drawing.layers.create("visible", { material: new THREE.LineBasicMaterial({ color: 0x000000 }) });
|
|
5878
|
+
* drawing.layers.create("hidden", { material: new THREE.LineDashedMaterial({ color: 0x888888, dashSize: 0.2, gapSize: 0.1 }) });
|
|
5879
|
+
*
|
|
5880
|
+
* await drawing.addProjectionFromItems(modelIdMap, {
|
|
5881
|
+
* layers: { visible: "visible", hidden: "hidden" },
|
|
5882
|
+
* onProgress: (msg, pct) => console.log(msg, pct),
|
|
5883
|
+
* });
|
|
5884
|
+
* ```
|
|
5885
|
+
*
|
|
5886
|
+
* @param modelIdMap - Items to project, keyed by model ID.
|
|
5887
|
+
* @param config - Required layer names and optional progress callback.
|
|
5888
|
+
*/
|
|
5889
|
+
addProjectionFromItems(modelIdMap: ModelIdMap, config: {
|
|
5890
|
+
layers: {
|
|
5891
|
+
visible: string;
|
|
5892
|
+
hidden: string;
|
|
5893
|
+
};
|
|
5894
|
+
onProgress?: (message: string, progress?: number) => void;
|
|
5895
|
+
}): Promise<void>;
|
|
5896
|
+
/**
|
|
5897
|
+
* Orients the drawing to one of the six standard orthographic projection
|
|
5898
|
+
* directions.
|
|
5899
|
+
*
|
|
5900
|
+
* Pass any of the six axis-aligned unit vectors. The method sets
|
|
5901
|
+
* `drawing.three.quaternion` to the correct rotation so that:
|
|
5902
|
+
* - The drawing's local **−Y** axis aligns with `direction`.
|
|
5903
|
+
* - The drawing's local **+X** axis points toward the right side of the
|
|
5904
|
+
* screen when the drawing is viewed from that direction, ensuring
|
|
5905
|
+
* annotations and text render without mirroring.
|
|
5906
|
+
*
|
|
5907
|
+
* ```ts
|
|
5908
|
+
* drawing.orientTo(new THREE.Vector3(0, -1, 0)); // top / plan
|
|
5909
|
+
* drawing.orientTo(new THREE.Vector3(0, 1, 0)); // bottom / RCP
|
|
5910
|
+
* drawing.orientTo(new THREE.Vector3(0, 0, -1)); // front elevation
|
|
5911
|
+
* drawing.orientTo(new THREE.Vector3(0, 0, 1)); // back elevation
|
|
5912
|
+
* drawing.orientTo(new THREE.Vector3(-1, 0, 0)); // right elevation
|
|
5913
|
+
* drawing.orientTo(new THREE.Vector3(1, 0, 0)); // left elevation
|
|
5914
|
+
* ```
|
|
5915
|
+
*
|
|
5916
|
+
* A console warning is emitted if `direction` does not match any of the six
|
|
5917
|
+
* standard axes.
|
|
5918
|
+
*
|
|
5919
|
+
* @param direction - Desired projection direction (need not be pre-normalized).
|
|
5920
|
+
*/
|
|
5921
|
+
orientTo(direction: THREE.Vector3): void;
|
|
5922
|
+
/** Disposes all viewports, layers, annotations and removes the container (and all its Three.js geometry) from memory. */
|
|
5923
|
+
dispose(): void;
|
|
5924
|
+
}
|
|
5925
|
+
|
|
5926
|
+
/**
|
|
5927
|
+
* Visualises a {@link TechnicalDrawing}'s projection volume in the 3D scene
|
|
5928
|
+
* and exposes three gizmo anchors for interactive control.
|
|
5929
|
+
*
|
|
5930
|
+
* Works exactly like the built-in Three.js helpers (e.g. `THREE.CameraHelper`):
|
|
5931
|
+
* add it as a child of `drawing.three` so it inherits the drawing's world
|
|
5932
|
+
* transform automatically.
|
|
5933
|
+
*
|
|
5934
|
+
* It renders on **layer 0** — visible to the perspective camera, invisible to
|
|
5935
|
+
* the drawing's orthographic cameras (which only render layer 1).
|
|
5936
|
+
*
|
|
5937
|
+
* The helper draws three things:
|
|
5938
|
+
* - A rectangular frame on the drawing plane (Y = 0 in drawing local space).
|
|
5939
|
+
* - Four pillar lines dropping from each corner along the projection direction
|
|
5940
|
+
* (local −Y) to the far boundary.
|
|
5941
|
+
* - A matching rectangle at the far boundary.
|
|
5942
|
+
*
|
|
5943
|
+
* ### Interactive control via gizmos
|
|
5944
|
+
*
|
|
5945
|
+
* Three `THREE.Object3D` anchors are exposed for `TransformControls`:
|
|
5946
|
+
*
|
|
5947
|
+
* | Anchor | Controls | Constrained axis |
|
|
5948
|
+
* |---|---|---|
|
|
5949
|
+
* | {@link farHandle} | `drawing.far` | local Y |
|
|
5950
|
+
* | {@link widthHandle} | {@link width} (symmetric) | local X |
|
|
5951
|
+
* | {@link heightHandle} | {@link height} (symmetric) | local Z |
|
|
5952
|
+
*
|
|
5953
|
+
* Use the corresponding `attach*Gizmo` methods instead of configuring the
|
|
5954
|
+
* gizmos manually — they enforce the correct axis constraints, local space,
|
|
5955
|
+
* and change listeners automatically:
|
|
5956
|
+
*
|
|
5957
|
+
* ```ts
|
|
5958
|
+
* const helper = new TechnicalDrawingHelper(drawing);
|
|
5959
|
+
* helper.width = 20;
|
|
5960
|
+
* helper.height = 15;
|
|
5961
|
+
* drawing.three.add(helper);
|
|
5962
|
+
*
|
|
5963
|
+
* // Main gizmo — full translate + rotate on drawing.three
|
|
5964
|
+
* const mainGizmo = new TransformControls(camera, domElement);
|
|
5965
|
+
* mainGizmo.attach(drawing.three);
|
|
5966
|
+
* scene.add(mainGizmo);
|
|
5967
|
+
*
|
|
5968
|
+
* // Depth gizmo — controls drawing.far
|
|
5969
|
+
* const farGizmo = new TransformControls(camera, domElement);
|
|
5970
|
+
* scene.add(farGizmo);
|
|
5971
|
+
* helper.attachFarGizmo(farGizmo);
|
|
5972
|
+
*
|
|
5973
|
+
* // Width gizmo
|
|
5974
|
+
* const widthGizmo = new TransformControls(camera, domElement);
|
|
5975
|
+
* scene.add(widthGizmo);
|
|
5976
|
+
* helper.attachWidthGizmo(widthGizmo);
|
|
5977
|
+
*
|
|
5978
|
+
* // Height gizmo
|
|
5979
|
+
* const heightGizmo = new TransformControls(camera, domElement);
|
|
5980
|
+
* scene.add(heightGizmo);
|
|
5981
|
+
* helper.attachHeightGizmo(heightGizmo);
|
|
5982
|
+
* ```
|
|
5983
|
+
*
|
|
5984
|
+
* Call {@link update} after changing {@link width}, {@link height}, or
|
|
5985
|
+
* `drawing.far` programmatically to rebuild the geometry.
|
|
5986
|
+
*/
|
|
5987
|
+
export declare class TechnicalDrawingHelper extends THREE.Group {
|
|
5988
|
+
private readonly _drawing;
|
|
5989
|
+
private readonly _topFrame;
|
|
5990
|
+
private readonly _pillars;
|
|
5991
|
+
private readonly _bottomFrame;
|
|
5992
|
+
private readonly _topPlane;
|
|
5993
|
+
private readonly _bottomPlane;
|
|
5994
|
+
private readonly _frameMat;
|
|
5995
|
+
private readonly _depthMat;
|
|
5996
|
+
private readonly _planeMat;
|
|
5997
|
+
private static readonly _FRAME_COLOR;
|
|
5998
|
+
private static readonly _DEPTH_COLOR;
|
|
5999
|
+
/**
|
|
6000
|
+
* Width of the drawing frame indicator along the local X axis, in world
|
|
6001
|
+
* units. Call {@link update} after changing this value programmatically.
|
|
6002
|
+
*/
|
|
6003
|
+
width: number;
|
|
6004
|
+
/**
|
|
6005
|
+
* Height of the drawing frame indicator along the local Z axis, in world
|
|
6006
|
+
* units. Call {@link update} after changing this value programmatically.
|
|
6007
|
+
*/
|
|
6008
|
+
height: number;
|
|
6009
|
+
/**
|
|
6010
|
+
* Gizmo anchor positioned at the centre of the bottom frame.
|
|
6011
|
+
* Pass a `TransformControls` instance to {@link attachFarGizmo} — do not
|
|
6012
|
+
* manipulate this object's position directly.
|
|
6013
|
+
*/
|
|
6014
|
+
readonly farHandle: THREE.Object3D<THREE.Object3DEventMap>;
|
|
6015
|
+
/**
|
|
6016
|
+
* Gizmo anchor positioned at the right-edge midpoint of the top frame.
|
|
6017
|
+
* Pass a `TransformControls` instance to {@link attachWidthGizmo} — do not
|
|
6018
|
+
* manipulate this object's position directly.
|
|
6019
|
+
*/
|
|
6020
|
+
readonly widthHandle: THREE.Object3D<THREE.Object3DEventMap>;
|
|
6021
|
+
/**
|
|
6022
|
+
* Gizmo anchor positioned at the bottom-edge midpoint of the top frame.
|
|
6023
|
+
* Pass a `TransformControls` instance to {@link attachHeightGizmo} — do not
|
|
6024
|
+
* manipulate this object's position directly.
|
|
6025
|
+
*/
|
|
6026
|
+
readonly heightHandle: THREE.Object3D<THREE.Object3DEventMap>;
|
|
6027
|
+
constructor(drawing: DrawingProjectionSource);
|
|
6028
|
+
/**
|
|
6029
|
+
* Rebuilds the helper geometry and repositions all gizmo anchors to match
|
|
6030
|
+
* the current {@link width}, {@link height}, and `drawing.far`. Call this
|
|
6031
|
+
* whenever any of those values change programmatically.
|
|
6032
|
+
*/
|
|
6033
|
+
update(): void;
|
|
6034
|
+
/**
|
|
6035
|
+
* Configures a `TransformControls` instance to control `drawing.far` and
|
|
6036
|
+
* attaches it to the {@link farHandle}.
|
|
6037
|
+
*
|
|
6038
|
+
* The gizmo is constrained to the drawing's local Y axis (the projection
|
|
6039
|
+
* direction) and wired to update `drawing.far` on every change. Call this
|
|
6040
|
+
* once — calling it again on the same gizmo accumulates listeners.
|
|
6041
|
+
*
|
|
6042
|
+
* @param gizmo - A `TransformControls` instance (or any {@link AxisGizmoLike}).
|
|
6043
|
+
*/
|
|
6044
|
+
attachFarGizmo(gizmo: AxisGizmoLike): void;
|
|
6045
|
+
/**
|
|
6046
|
+
* Configures a `TransformControls` instance to control {@link width} and
|
|
6047
|
+
* attaches it to the {@link widthHandle}.
|
|
6048
|
+
*
|
|
6049
|
+
* The gizmo is constrained to the drawing's local X axis. Width grows
|
|
6050
|
+
* symmetrically — dragging the right-edge handle outward expands both sides.
|
|
6051
|
+
*
|
|
6052
|
+
* @param gizmo - A `TransformControls` instance (or any {@link AxisGizmoLike}).
|
|
6053
|
+
*/
|
|
6054
|
+
attachWidthGizmo(gizmo: AxisGizmoLike): void;
|
|
6055
|
+
/**
|
|
6056
|
+
* Configures a `TransformControls` instance to control {@link height} and
|
|
6057
|
+
* attaches it to the {@link heightHandle}.
|
|
6058
|
+
*
|
|
6059
|
+
* The gizmo is constrained to the drawing's local Z axis. Height grows
|
|
6060
|
+
* symmetrically — dragging the bottom-edge handle outward expands both sides.
|
|
6061
|
+
*
|
|
6062
|
+
* @param gizmo - A `TransformControls` instance (or any {@link AxisGizmoLike}).
|
|
6063
|
+
*/
|
|
6064
|
+
attachHeightGizmo(gizmo: AxisGizmoLike): void;
|
|
6065
|
+
/** Releases all Three.js geometry and material resources. */
|
|
6066
|
+
dispose(): void;
|
|
6067
|
+
}
|
|
6068
|
+
|
|
6069
|
+
/**
|
|
6070
|
+
* OBC Component that creates and manages {@link TechnicalDrawing} instances.
|
|
6071
|
+
*
|
|
6072
|
+
* A TechnicalDrawing is a 2D drawing plane that lives in 3D world space.
|
|
6073
|
+
* It contains projection lines and dimension annotations (layer 1 geometry)
|
|
6074
|
+
* framed by one or more orthographic {@link DrawingViewport}s.
|
|
6075
|
+
*
|
|
6076
|
+
* The drawing's `container` (a `THREE.Group`) can be freely transformed in the
|
|
6077
|
+
* 3D world — all viewports and geometry move together as a single unit.
|
|
6078
|
+
*
|
|
6079
|
+
* @example
|
|
6080
|
+
* ```ts
|
|
6081
|
+
* const techDrawings = components.get(TechnicalDrawings);
|
|
6082
|
+
* const drawing = techDrawings.create(world);
|
|
6083
|
+
*
|
|
6084
|
+
* // Add layer-1 geometry to the drawing
|
|
6085
|
+
* const lines = new THREE.LineSegments(geometry, material);
|
|
6086
|
+
* lines.layers.set(1);
|
|
6087
|
+
* drawing.three.add(lines);
|
|
6088
|
+
*
|
|
6089
|
+
* // Add viewports
|
|
6090
|
+
* const vp = drawing.viewports.create({ left: -1, right: 5, top: 1, bottom: -4 });
|
|
6091
|
+
* ```
|
|
6092
|
+
*/
|
|
6093
|
+
export declare class TechnicalDrawings extends Component implements Disposable_2 {
|
|
6094
|
+
/**
|
|
6095
|
+
* A unique identifier for the component.
|
|
6096
|
+
* This UUID is used to register the component within the Components system.
|
|
6097
|
+
*/
|
|
6098
|
+
static readonly uuid: "5c7d3b9a-4e8f-4a2b-9c1d-0e3f2a5b7c8d";
|
|
6099
|
+
/** {@link Component.enabled} */
|
|
6100
|
+
enabled: boolean;
|
|
6101
|
+
/** All active drawings, keyed by their UUID. */
|
|
6102
|
+
readonly list: FRAGS.DataMap<string, TechnicalDrawing>;
|
|
6103
|
+
/**
|
|
6104
|
+
* Global system instances keyed by their constructor.
|
|
6105
|
+
* Register a system with {@link use}; inspect or iterate here for UI purposes.
|
|
6106
|
+
*/
|
|
6107
|
+
readonly systems: FRAGS.DataMap<Function, AnnotationSystem<any>>;
|
|
6108
|
+
/** {@link Disposable.onDisposed} */
|
|
6109
|
+
readonly onDisposed: Event_2<unknown>;
|
|
6110
|
+
constructor(components: Components);
|
|
6111
|
+
/**
|
|
6112
|
+
* Returns the global singleton instance of the given system, creating it if it
|
|
6113
|
+
* does not yet exist. The system constructor must accept `Components` as its
|
|
6114
|
+
* only argument (new-style global systems). Safe to call multiple times — always
|
|
6115
|
+
* returns the same instance.
|
|
6116
|
+
*
|
|
6117
|
+
* ```ts
|
|
6118
|
+
* const dims = techDrawings.use(OBC.LinearAnnotations);
|
|
6119
|
+
* dims.styles.set("default", { ... });
|
|
6120
|
+
* ```
|
|
6121
|
+
*/
|
|
6122
|
+
use<T extends AnnotationSystem<any>>(SystemClass: new (components: Components) => T): T;
|
|
6123
|
+
/**
|
|
6124
|
+
* Creates a new {@link TechnicalDrawing} hosted in the given world.
|
|
6125
|
+
*
|
|
6126
|
+
* The drawing's Three.js group is added to the world's scene and its
|
|
6127
|
+
* lifecycle is tied to the world — it is automatically removed when the
|
|
6128
|
+
* world is disposed. Three.js rendering layer 1 is enabled on the world
|
|
6129
|
+
* camera so that annotation geometry is visible in the 3D view. Both
|
|
6130
|
+
* perspective and orthographic cameras are configured when using
|
|
6131
|
+
* {@link OrthoPerspectiveCamera}.
|
|
6132
|
+
*
|
|
6133
|
+
* To hide the drawing from the 3D view without removing it from the world,
|
|
6134
|
+
* either set `drawing.three.visible = false` or disable layer 1 on the
|
|
6135
|
+
* world camera: `world.camera.three.layers.disable(1)`.
|
|
6136
|
+
*
|
|
6137
|
+
* @param world - The world that will host this drawing.
|
|
6138
|
+
* @returns The newly created drawing.
|
|
6139
|
+
*/
|
|
6140
|
+
create(world: World): TechnicalDrawing;
|
|
6141
|
+
/** {@link Disposable.dispose} */
|
|
6142
|
+
dispose(): void;
|
|
6143
|
+
}
|
|
6144
|
+
|
|
3764
6145
|
export declare interface TextSetSettingControl {
|
|
3765
6146
|
type: "TextSet";
|
|
3766
6147
|
value: Set<string>;
|
|
@@ -3897,6 +6278,60 @@ export declare class Topic implements BCFTopic {
|
|
|
3897
6278
|
serialize(): string;
|
|
3898
6279
|
}
|
|
3899
6280
|
|
|
6281
|
+
/**
|
|
6282
|
+
* Whether this component manages its interaction through an explicit state machine.
|
|
6283
|
+
* The machine is the single source of truth: the system can only be in one state at
|
|
6284
|
+
* a time, and every transition is deterministic given the current state and the event.
|
|
6285
|
+
*
|
|
6286
|
+
* @template TState - Discriminated union of all valid states (each with a `kind` string).
|
|
6287
|
+
* @template TEvent - Discriminated union of all accepted events (each with a `type` string).
|
|
6288
|
+
*/
|
|
6289
|
+
export declare interface Transitionable<TState extends {
|
|
6290
|
+
kind: string;
|
|
6291
|
+
}, TEvent extends {
|
|
6292
|
+
type: string;
|
|
6293
|
+
}> {
|
|
6294
|
+
/** The current state. TypeScript guarantees it is always a valid, well-typed state. */
|
|
6295
|
+
readonly machineState: TState;
|
|
6296
|
+
/**
|
|
6297
|
+
* Dispatches an event to the machine, producing a deterministic state transition.
|
|
6298
|
+
* Events that do not apply to the current state are silently ignored.
|
|
6299
|
+
*/
|
|
6300
|
+
sendMachineEvent(event: TEvent): void;
|
|
6301
|
+
/** Fired synchronously after every state transition with the new state as payload. */
|
|
6302
|
+
readonly onMachineStateChanged: Event_2<TState>;
|
|
6303
|
+
}
|
|
6304
|
+
|
|
6305
|
+
/**
|
|
6306
|
+
* Built-in {@link DimensionUnit} presets.
|
|
6307
|
+
*
|
|
6308
|
+
* ```ts
|
|
6309
|
+
* style.unit = OBC.Units.mm;
|
|
6310
|
+
* ```
|
|
6311
|
+
*/
|
|
6312
|
+
export declare const Units: {
|
|
6313
|
+
readonly m: {
|
|
6314
|
+
readonly factor: 1;
|
|
6315
|
+
readonly suffix: "m";
|
|
6316
|
+
};
|
|
6317
|
+
readonly cm: {
|
|
6318
|
+
readonly factor: 100;
|
|
6319
|
+
readonly suffix: "cm";
|
|
6320
|
+
};
|
|
6321
|
+
readonly mm: {
|
|
6322
|
+
readonly factor: 1000;
|
|
6323
|
+
readonly suffix: "mm";
|
|
6324
|
+
};
|
|
6325
|
+
readonly ft: {
|
|
6326
|
+
readonly factor: 3.28084;
|
|
6327
|
+
readonly suffix: "ft";
|
|
6328
|
+
};
|
|
6329
|
+
readonly in: {
|
|
6330
|
+
readonly factor: 39.3701;
|
|
6331
|
+
readonly suffix: "in";
|
|
6332
|
+
};
|
|
6333
|
+
};
|
|
6334
|
+
|
|
3900
6335
|
/** Whether this component should be updated each frame. */
|
|
3901
6336
|
export declare interface Updateable {
|
|
3902
6337
|
/** Actions that should be executed after updating the component. */
|
|
@@ -4568,6 +7003,18 @@ export declare interface ViewpointVisibility {
|
|
|
4568
7003
|
};
|
|
4569
7004
|
}
|
|
4570
7005
|
|
|
7006
|
+
/**
|
|
7007
|
+
* Minimal interface consumed by {@link DrawingViewportHelper}.
|
|
7008
|
+
* Satisfied by {@link DrawingViewport} without a direct import, which keeps
|
|
7009
|
+
* the two classes free of circular dependencies.
|
|
7010
|
+
*/
|
|
7011
|
+
declare interface ViewportBoundsController {
|
|
7012
|
+
left: number;
|
|
7013
|
+
right: number;
|
|
7014
|
+
top: number;
|
|
7015
|
+
bottom: number;
|
|
7016
|
+
}
|
|
7017
|
+
|
|
4571
7018
|
/**
|
|
4572
7019
|
* The `Views` class is responsible for managing and interacting with a collection of 2D sections. It provides methods for creating, opening, closing, and managing views, as well as generating views from specific configurations such as IFC storeys or bounding boxes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Views). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Views).
|
|
4573
7020
|
*/
|