@pilotdev/pilot-web-3d 23.0.10 → 23.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +1413 -1304
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -52,7 +52,9 @@ export abstract class ViewObject extends THREE.Object3D {
52
52
  protected _isVisible: boolean;
53
53
  protected _isHidden: boolean;
54
54
  protected _isDecomposed: boolean;
55
+ protected _isGhosted: boolean;
55
56
  protected _originalColor: Color;
57
+ protected _color: Color;
56
58
  /**
57
59
  * model element entity guid
58
60
  * @default zeroGuid
@@ -80,12 +82,12 @@ export abstract class ViewObject extends THREE.Object3D {
80
82
  updateWorldMatrix(updateParents: boolean, updateChildren: boolean): void;
81
83
  updateMatrix(): void;
82
84
  applyMatrix4(matrix: THREE.Matrix4): void;
83
- /** */
85
+ /** Decompose object matrix to position, rotation and scale vectors or free these vectors to reduce memory consumption. */
84
86
  setDecomposed(value: boolean): void;
85
87
  /**Check if object is decomposed: have valid position, quaternion, scale, up vectors */
86
88
  isDecomposed(): boolean;
87
89
  /**Set visibility of this object */
88
- setVisible(iVal: boolean): void;
90
+ setVisible(value: boolean): void;
89
91
  /**Get visibility of this object */
90
92
  isVisible(): boolean;
91
93
  /**Hide this object from the scene */
@@ -93,35 +95,44 @@ export abstract class ViewObject extends THREE.Object3D {
93
95
  /**Check if object is hidden from the scene */
94
96
  isHidden(): boolean;
95
97
  /**Select this object */
96
- setSelected(iVal: boolean): void;
98
+ setSelected(value: boolean): void;
97
99
  /**Check if object is selected */
98
100
  isSelected(): boolean;
99
101
  /**Hover this object */
100
- setHovered(iVal: boolean): void;
102
+ setHovered(value: boolean): void;
101
103
  /**Check if object is hovered */
102
104
  isHovered(): boolean;
103
105
  /**Set color for this object */
104
106
  setColor(color: Color): void;
107
+ /**Get color of this object */
108
+ getColor(): Color;
109
+ /**Check if object is in ghost mode */
110
+ isGhosted(): boolean;
111
+ /**Set ghost mode for this object */
112
+ setGhosted(value: boolean): void;
105
113
  /**Reset color to original color for this object */
106
114
  resetColor(): void;
107
115
  /**Gets original color for this object */
108
116
  getOriginalColor(): Color;
117
+ getRelativePosition(absPosition: THREE.Vector3): THREE.Vector3;
109
118
  /**Dispose geometry */
110
119
  dispose(): void;
111
120
  /**User defined bounding box calculation for this object. Returns an empty THREE.Box3 by default.*/
112
121
  getBoundingBox(): THREE.Box3;
113
- /**User defined raycast implementation for this object. Emty method by default. */
122
+ /**User defined raycast implementation for this object. Empty method by default. */
114
123
  raycast(iRaycaster: THREE.Raycaster, oIntersects: THREE.Intersection[]): void;
115
- /**User defined hover behavior for this object. Emty method by default. */
116
- protected setHoveredForObject(iVal: boolean): void;
117
- /**User defined selection behavior for this object. Emty method by default. */
118
- protected setSelectedForObject(iVal: boolean): void;
124
+ /**User defined hover behavior for this object. Empty method by default. */
125
+ protected setHoveredForObject(value: boolean): void;
126
+ /**User defined selection behavior for this object. Empty method by default. */
127
+ protected setSelectedForObject(value: boolean): void;
119
128
  /**User defined hide behavior for this object. Has default implementation used on the MainScene only. */
120
129
  protected setHiddenForObject(iVal: boolean): void;
121
130
  /**User defined visibility behavior for this object. Sets THREE.Object3D visibility by default. */
122
- protected setVisibleForObject(iVal: boolean): void;
123
- /**User defined change color behavior for this object. Emty method by default. */
131
+ protected setVisibleForObject(value: boolean): void;
132
+ /**User defined change color behavior for this object. Empty method by default. */
124
133
  protected setColorForObject(color: Color): void;
134
+ /**User defined ghost mode behavior for this object. Empty method by default. */
135
+ protected setGhostModeForObject(value: boolean): void;
125
136
  /**Reset color to the original color for this object. */
126
137
  protected resetColorForObject(): void;
127
138
  /**
@@ -137,174 +148,62 @@ export class ModelElementIds {
137
148
  modelPartId: string;
138
149
  elementIds: string[];
139
150
  }
140
- export abstract class CustomMaterial extends THREE.ShaderMaterial {
141
-
142
- constructor();
143
- copy(source: CustomMaterial): this;
144
- protected refreshUniforms(uniforms: {
145
- [uniform: string]: THREE.IUniform;
146
- }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
147
- protected onBeforeCompileCallback(shader: THREE.Shader): void;
148
- protected refreshTransformUniform(map: THREE.Texture, uniform: THREE.IUniform): void;
149
- protected onBeforeRender(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.BufferGeometry, material: THREE.Material, group: THREE.Group): void;
151
+ export class InitializerOptions {
152
+ libList?: string[];
153
+ language?: string;
150
154
  }
151
- export interface CustomMeshLambertMaterialParameters extends THREE.ShaderMaterialParameters {
152
- instancing?: boolean | undefined;
153
- instancingColor?: boolean | undefined;
154
- color?: THREE.ColorRepresentation | undefined;
155
- emissive?: THREE.ColorRepresentation | undefined;
156
- emissiveIntensity?: number | undefined;
157
- fog?: boolean | undefined;
155
+ class Global {
156
+ G: any;
157
+ RESOURCE_ROOT: string;
158
+ initializeResourceRoot(options: InitializerOptions): void;
159
+ getResourceUrl(resourceRelativePath: string): string;
158
160
  }
159
- export class CustomMeshLambertMaterial extends CustomMaterial {
160
- type: string;
161
-
162
- constructor(parameters?: CustomMeshLambertMaterialParameters);
163
- /**
164
- * @default false
165
- */
166
- get instancing(): boolean;
167
- set instancing(value: boolean);
168
- /**
169
- * @default false
170
- */
171
- get instancingColor(): boolean;
172
- set instancingColor(value: boolean);
173
- /**
174
- * @default new THREE.Color( 0xffffff )
175
- */
176
- color: THREE.Color;
177
- /**
178
- * @default new THREE.Color( 0x000000 )
179
- */
180
- emissive: THREE.Color;
181
- /**
182
- * @default 1
183
- */
184
- emissiveIntensity: number;
185
- /**
186
- * Whether the material is affected by fog. Default is true.
187
- * @default fog
188
- */
189
- fog: boolean;
190
- protected refreshUniformsCommon(uniforms: {
191
- [uniform: string]: THREE.IUniform;
192
- }, material: CustomMeshLambertMaterial, renderer: THREE.WebGLRenderer): void;
193
- protected refreshUniforms(uniforms: {
194
- [uniform: string]: THREE.IUniform<any>;
195
- }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
196
- copy(source: CustomMeshLambertMaterial): this;
161
+ export const global: Global;
162
+ export {};
163
+ export type StringMap = {
164
+ [key: string]: any;
165
+ };
166
+ export class Localization {
167
+ static initialize(options: any): Promise<void>;
168
+ static translate<T extends (string | StringMap) = string>(stringToTrans: string): T;
169
+ static setLanguage(language: string): Promise<void>;
170
+ static extendLocalization(locales: any): boolean;
197
171
  }
198
- export interface CustomLineMaterialParameters extends THREE.ShaderMaterialParameters {
199
- instancing?: boolean | undefined;
200
- instancingColor?: boolean | undefined;
201
- color?: THREE.ColorRepresentation | undefined;
172
+ export type InitializeSuccessCallback = () => void;
173
+ export function coreInitializer(options: InitializerOptions, callback: InitializeSuccessCallback): void;
174
+ export function coreShutdown(): void;
175
+ export class DeviceEventHandler {
176
+ static isMobile: boolean;
177
+ static eventStartType: string;
178
+ static eventProcessType: string;
179
+ static eventEndType: string;
202
180
  }
203
- export class CustomLineMaterial extends CustomMaterial {
204
- type: string;
205
-
206
- constructor(parameters?: CustomLineMaterialParameters);
207
- /**
208
- * @default false
209
- */
210
- get instancing(): boolean;
211
- set instancing(value: boolean);
212
- /**
213
- * @default false
214
- */
215
- get instancingColor(): boolean;
216
- set instancingColor(value: boolean);
217
- /**
218
- * @default 0xffffff
219
- */
220
- color: THREE.Color;
221
- copy(source: CustomLineMaterial): this;
222
- protected refreshUniforms(uniforms: {
223
- [uniform: string]: THREE.IUniform;
224
- }, material: CustomLineMaterial, renderer: THREE.WebGLRenderer): void;
181
+ export interface IWindowStyle {
182
+ width: string;
183
+ height: string;
184
+ left: string;
185
+ top: string;
225
186
  }
226
- export interface MeshLineMaterialParameters extends THREE.ShaderMaterialParameters {
227
- color?: THREE.ColorRepresentation | undefined;
228
- dashed?: boolean | undefined;
229
- dashScale?: number | undefined;
230
- dashSize?: number | undefined;
231
- dashOffset?: number | undefined;
232
- gapSize?: number | undefined;
233
- worldUnits?: boolean | undefined;
187
+ export interface IWindowStateOptions {
188
+ saveKey: string;
189
+ restoreWindowSize?: boolean;
190
+ restoreWindowPosition?: boolean;
234
191
  }
235
- export class MeshLineMaterial extends CustomMaterial {
236
- type: string;
237
-
238
- constructor(parameters: MeshLineMaterialParameters);
239
- /**
240
- * @default false
241
- */
242
- get worldUnits(): boolean;
243
- set worldUnits(value: boolean);
244
- /**
245
- * @default false
246
- */
247
- get dashed(): boolean;
248
- set dashed(value: boolean);
249
- get resolution(): THREE.Vector2;
250
- /**
251
- * @default 0xffffff
252
- */
253
- color: THREE.Color;
254
- /**
255
- * @default 1
256
- */
257
- dashScale: number;
258
- /**
259
- * @default 1
260
- */
261
- dashSize: number;
262
- /**
263
- * @default 0
264
- */
265
- dashOffset: number;
266
- /**
267
- * @default 1
268
- */
269
- gapSize: number;
270
- copy(source: MeshLineMaterial): this;
271
- protected refreshUniforms(uniforms: {
272
- [uniform: string]: THREE.IUniform<any>;
273
- }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
192
+ export class WindowStater {
193
+ get windowStylesState(): IWindowStyle;
194
+ get windowOptionsState(): IWindowStateOptions;
195
+ restore(): void;
196
+ saveWindowState(): void;
274
197
  }
275
- export interface CustomPointMaterialParameters extends THREE.ShaderMaterialParameters, THREE.PointsMaterialParameters {
198
+ export class Resizer {
199
+
200
+ constructor(resizableContainer: HTMLElement, containerToRestriction: HTMLElement, elementAnchor?: HTMLElement, windowStater?: WindowStater);
201
+ get windowState(): IWindowStyle | null;
276
202
  }
277
- export class CustomPointMaterial extends CustomMaterial {
278
- type: string;
203
+ export class Dragger {
279
204
 
280
- constructor(parameters?: CustomPointMaterialParameters);
281
- /**
282
- * @default new THREE.Color( 0xffffff )
283
- */
284
- color: THREE.Color;
285
- /**
286
- * @default null
287
- */
288
- map: THREE.Texture | null;
289
- /**
290
- * @default null
291
- */
292
- alphaMap: THREE.Texture | null;
293
- /**
294
- * @default 1
295
- */
296
- size: number;
297
- /**
298
- * @default true
299
- */
300
- sizeAttenuation: boolean;
301
- copy(source: CustomPointMaterial): this;
302
- protected refreshUniformsCommon(uniforms: {
303
- [uniform: string]: THREE.IUniform;
304
- }, material: CustomPointMaterial, renderer: THREE.WebGLRenderer): void;
305
- protected refreshUniforms(uniforms: {
306
- [uniform: string]: THREE.IUniform<any>;
307
- }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
205
+ constructor(allowedDraggableElement: HTMLElement, draggableContainer: HTMLElement, containerToRestriction: HTMLElement, windowStater?: WindowStater);
206
+ get windowState(): IWindowStyle | null;
308
207
  }
309
208
  export namespace Viewer3DIcons {
310
209
  const VIEWER_SETTINGS_ICON: string;
@@ -340,416 +239,692 @@ export namespace Viewer2DIcons {
340
239
  const ZOOM_OUT: string;
341
240
  const FIT_WIDTH: string;
342
241
  }
343
- export class MeshLineGeometry extends THREE.InstancedBufferGeometry {
344
- type: string;
345
- instanceStart: THREE.BufferAttribute;
346
- instanceEnd: THREE.BufferAttribute;
347
- instanceColorStart: THREE.BufferAttribute;
348
- instanceColorEnd: THREE.BufferAttribute;
349
-
350
- constructor();
351
- applyMatrix4(matrix: THREE.Matrix4): this;
352
- updatePoint(index: number, point: THREE.Vector3): void;
353
- updateColor(index: number, color: Color): void;
354
- setPoints(points: THREE.Vector3[]): this;
355
- setPositions(array: ArrayLike<number>): this;
356
- setColors(array: ArrayLike<number>): this;
357
- computeLineDistances(): this;
358
- toBufferGeometry(): THREE.BufferGeometry;
359
- toWireframeGeometry(): THREE.BufferGeometry;
360
- fromWireframeGeometry(geometry: THREE.WireframeGeometry): this;
361
- fromEdgesGeometry(geometry: THREE.EdgesGeometry): this;
362
- fromMesh(mesh: THREE.Mesh): this;
363
- fromLineSegments(lineSegments: THREE.LineSegments): this;
364
- computeBoundingBox(): void;
365
- computeBoundingSphere(): void;
242
+ export interface ISettings {
243
+ changeSetting<T>(name: string, value: T, notify?: boolean, providedData?: any): void;
244
+ getSettingValue<T>(name: string): T;
366
245
  }
367
- export class MeshLine extends THREE.Mesh {
368
- type: string;
369
- material: MeshLineMaterial;
370
- geometry: MeshLineGeometry;
371
-
372
- constructor(geometry?: MeshLineGeometry, material?: MeshLineMaterial);
373
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
246
+ export enum BaseSettingsNames {
247
+ TOOLBAR = "toolbar",
248
+ TOOLBAR_POSITION = "toolbarPosition",
249
+ TOOLBAR_CONTENT_ALIGNMENT = "toolbarContent",
250
+ THEME = "theme"
374
251
  }
375
- export class TPair<TKey, TValue> {
376
-
377
- constructor(key: TKey, value: TValue);
378
- get key(): TKey;
379
- get value(): TValue;
252
+ export class SettingChangedEvent extends Event {
253
+ name: string;
254
+ oldValue: any;
255
+ newValue: any;
256
+ providedData: any;
380
257
  }
381
- export interface IEventsDispatcher {
382
- addEventListener(event: string, listener: EventListener, options?: object): void;
383
- removeEventListener(event: string, listener: EventListener): void;
384
- hasEventListener(event: string, listener: EventListener): boolean;
385
- dispatchEvent(event: string | Event): void;
386
- dispatchEventAsync(event: string | Event): void;
387
- clearListeners(): void;
258
+ export class LoadingSpinner {
259
+ addToDOM(container: HTMLElement): void;
260
+ removeFromDOM(container: HTMLElement): void;
388
261
  }
389
- export class EventsDispatcherCore implements IEventsDispatcher {
390
- dispatchEventAsync(event: string | Event): void;
391
- hasEventListener(type: string, listener: EventListener): boolean;
392
- dispatchEvent(event: string | Event): void;
393
- addEventListener(type: string, listener: EventListener, options?: object): void;
394
- removeEventListener(type: string, listener: EventListener): void;
395
- removeEvent(type: string): void;
396
- clearListeners(): void;
262
+ export class CoreEventTypes {
263
+ static VIEWER_RESIZE_EVENT: string;
264
+ static VIEWER_MOUSE_DOWN_EVENT: string;
265
+ static VIEWER_MOUSE_MOVE_EVENT: string;
266
+ static VIEWER_MOUSE_UP_EVENT: string;
267
+ static VIEWER_MOUSE_LONG_TOUCH_EVENT: string;
268
+ static VIEWER_MOUSE_WHEEL: string;
269
+ static VIEWER_TOUCHSTART_EVENT: string;
270
+ static VIEWER_TOUCHEND_EVENT: string;
271
+ static SETTING_CHANGED_EVENT: string;
272
+ static SETTING_RESET_EVENT: string;
273
+ static SETTING_LANGUAGE_CHANGED_EVENT: string;
274
+ static SETTING_THEME_CHANGED_EVENT: string;
275
+ static EXTENSION_LOADED: string;
276
+ static EXTENSION_UNLOADING: string;
277
+ static EXTENSION_UNLOADED: string;
397
278
  }
398
- export const MouseButtons: {
399
- Left: number;
400
- Middle: number;
401
- Right: number;
402
- };
403
- export class RenderEventTypes {
404
- static SELECTION_CHANGED_EVENT: string;
405
- static SELECTION_RESET_EVENT: string;
406
- static CAMERA_CHANGED_EVENT: string;
407
- static CAMERA_NAVIGATION_MODE_CHANGED_EVENT: string;
408
- static RENDER_CLICK_EVENT: string;
409
- static RENDER_HOVER_EVENT: string;
410
- static RENDER_DOUBLE_CLICK_EVENT: string;
411
- static RENDER_DELETE_EVENT: string;
279
+ export class ExtensionEvent extends Event {
280
+ extensionName: string;
412
281
  }
413
- export class SelectionChangedEvent extends Event {
414
- selectedIds: ModelElementIds[];
415
-
416
- constructor(type: string, selectedIds?: ModelElementIds[]);
282
+ export namespace ControlState {
283
+ enum State {
284
+ ACTIVE = 0,
285
+ INACTIVE = 1,
286
+ DISABLED = 2
287
+ }
417
288
  }
418
- export class ClickedEvent extends Event {
419
- modelId: string;
420
- modelElementId: string;
421
- ctrlKey: boolean;
422
-
423
- constructor(type: string, modelId: string, modelElementId: string, ctrlKey: boolean);
289
+ export interface IControl {
290
+ container: HTMLElement;
291
+ getId(): string;
292
+ setToolTip(tooltipText: string): void;
293
+ setText(text: string): void;
294
+ setState(state: ControlState.State): void;
424
295
  }
425
- export class HoverEvent extends Event {
426
- modelId: string;
427
- modelElementId: string;
296
+ export class Control implements IControl {
297
+ container: HTMLElement;
428
298
 
429
- constructor(type: string, modelId: string, modelElementId: string);
299
+ constructor(id: string);
300
+ addClass(cssClass: string): void;
301
+ removeClass(cssClass: string): void;
302
+ getId(): string;
303
+ setToolTip(tooltipText: string): void;
304
+ setText(text: string): void;
305
+ setState(state: ControlState.State): void;
430
306
  }
431
- export class DeleteEvent extends Event {
432
- deletedIds: ModelElementIds[];
433
-
434
- constructor(type: string, deletedIds?: ModelElementIds[]);
307
+ export enum ToolbarPosition {
308
+ TOP_FIXED = "ascn-toolbar-position-fixed-top",
309
+ TOP_FLUENT = "ascn-toolbar-position-top",
310
+ BOTTOM_FIXED = "ascn-toolbar-position-fixed-bottom",
311
+ BOTTOM_FLUENT = "ascn-toolbar-position-bottom"
435
312
  }
436
- export class GlobalEvents {
437
- static events: EventsDispatcherCore;
313
+ export enum ToolbarContentAlignment {
314
+ CENTER = "ascn-toolbar-content-center",
315
+ START = "ascn-toolbar-content-start",
316
+ END = "ascn-toolbar-content-end"
438
317
  }
439
-
440
- export enum SelectionMode {
441
- Append = 0,
442
- Replace = 1
318
+ export interface ToolbarStyle {
319
+ [BaseSettingsNames.TOOLBAR_POSITION]?: ToolbarPosition;
320
+ [BaseSettingsNames.TOOLBAR_CONTENT_ALIGNMENT]?: ToolbarContentAlignment;
443
321
  }
444
- export interface ISettingsStorage {
445
- clear(): void;
446
- getItem<T>(key: string): T | null;
447
- removeItem(key: string): void;
448
- setItem<T>(key: string, value: T): void;
449
- getKeys(): string[];
322
+ export const defaultToolbarAppearance: ToolbarStyle;
323
+ export interface IMenu {
324
+ controls: IControl[];
325
+ addControl(control: IControl, index?: number): void;
326
+ removeControl(index: number): void;
450
327
  }
451
- export class SettingsStorageFactory {
452
- getSettingsStorage(): ISettingsStorage;
328
+ interface IToolbarButton {
329
+ button: IControl;
330
+ index: number;
453
331
  }
454
- export class LocalSettingsStorage implements ISettingsStorage {
455
- clear(): void;
456
- getItem<T>(key: string): T | null;
457
- removeItem(key: string): void;
458
- setItem<T>(key: string, value: T): void;
459
- getKeys(): string[];
332
+ export class Toolbar extends Control implements IMenu {
333
+ readonly controls: IControl[];
334
+ addControl(control: IControl, index?: number): void;
335
+ removeControl(index: number): void;
336
+ getControls(): IToolbarButton[];
337
+ changeToolbarPosition(direction: ToolbarPosition): void;
338
+ changeToolbarContentAlignment(content: ToolbarContentAlignment): void;
460
339
  }
461
- export class InMemorySettingsStorage implements ISettingsStorage {
462
- clear(): void;
463
- getItem<T>(key: string): T | null;
464
- removeItem(key: string): void;
465
- setItem<T>(key: string, value: T): void;
466
- getKeys(): string[];
340
+ export {};
341
+ export class ExtensionBase {
342
+ protected _viewer: ViewerBase;
343
+ protected _options: object;
344
+
345
+ constructor(viewer3D: ViewerBase, options?: object);
346
+ load(): boolean | Promise<boolean>;
347
+ unload(): boolean;
348
+ activate(): boolean;
349
+ deactivate(): boolean;
350
+ /**
351
+ * Gets the name of the extension.
352
+ * @returns {string} Returns the name of the extension.
353
+ */
354
+ getName(): string;
355
+ addCursorPhantomFromSvg(template: string): void;
356
+ removeCursorPhantom(): void;
357
+ onMouseDown(event: MouseEvent): void;
358
+ onMouseMove(event: MouseEvent): void;
359
+ onMouseUp(event: MouseEvent): void;
360
+ onMouseLongTouch(event: MouseEvent): void;
361
+ onToolbarCreated(toolbar: Toolbar): void;
362
+ onTouchStart(event: TouchEvent): void;
363
+ onTouchEnd(event: TouchEvent): void;
467
364
  }
468
- export type Point3 = {
469
- x: number;
470
- y: number;
471
- z: number;
472
- };
473
- export function pointToVector3(point: Point3): THREE.Vector3;
474
- export type CameraParameters = {
475
- /** Camera position */
476
- position: Point3;
477
- /** Camera view direction: vector pointing from camera to target */
478
- eyeDir: Point3;
479
- /** Field of view: angle in radians */
480
- angle: number;
481
- /** (optional) Camera up vector*/
482
- upDir?: Point3;
483
- /** (optional) Vector pointing to the center of viewing area.*/
484
- viewCenter?: Point3;
485
- };
486
- export type CameraOrientation = {
487
- /** Camera view direction: vector pointing from camera to target */
488
- viewDir: THREE.Vector3;
489
- /** (optional) Camera up vector */
490
- upDir?: THREE.Vector3;
491
- };
492
- export enum CameraNavigationMode {
493
- None = 0,
494
- Rotation = 1,
495
- Translation = 2,
496
- Spin = 4,
497
- Zoom = 8
365
+ export class ExtensionManager {
366
+ registerExtensionType(extensionId: string, extension: typeof ExtensionBase): boolean;
367
+ unregisterExtensionType(extensionId: string): boolean;
368
+ getExtensionType(extensionId: string): typeof ExtensionBase;
498
369
  }
499
- export interface ICameraControl {
500
- /**
501
- * Gets the Three.js camera.
502
- */
503
- getCamera(): THREE.Camera;
504
- /**
505
- * Gets the camera parameters.
506
- */
507
- getCameraParameters(): CameraParameters;
508
- /**
509
- * Sets the camera parameters.
510
- */
511
- setCameraParameters(iParams: CameraParameters): void;
512
- /**
513
- * Sets the camera view point.
514
- * @param viewCenter - view point
515
- */
516
- setViewCenter(viewCenter: THREE.Vector3): void;
517
- /**
518
- * Gets the camera view point.
519
- */
520
- getViewCenter(): THREE.Vector3;
521
- /**
522
- * Sets the aspect ratio.
523
- */
524
- setAspectRatio(width: number, heigth: number): boolean;
525
- /**
526
- * Rotates camera around the rotationCenter
527
- * @param movement - offset in the screen space
528
- * @param rotationCenter - the center of rotation
529
- */
530
- rotate(movement: THREE.Vector2, rotationCenter: THREE.Vector3): void;
370
+ export const theExtensionManager: ExtensionManager;
371
+ export class ExtensionLoader {
531
372
  /**
532
- * Translates the camera relative to the viewCenter
533
- * @param startNdcPos - start position in the NDC space
534
- * @param endNdcPos - end position in the NDC space
535
- * @param viewCenter - relative translation point
373
+ * Loads the extension with the given id and options.
374
+ *
375
+ * @param {string} extensionId - The string id of the extension.
376
+ * @param {object} options - An optional dictionary of options.
377
+ *
378
+ * @returns {Promise<ExtensionBase>} - Resolves with the extension requested.
536
379
  */
537
- translate(startNdcPos: THREE.Vector2, endNdcPos: THREE.Vector2, viewCenter: THREE.Vector3): void;
380
+ loadExtension(extensionId: string, options?: object): Promise<ExtensionBase>;
538
381
  /**
539
- * Rotates the camera around the Up vector
540
- * @param movement - offset in the screen space
382
+ * Unloads the extension with the given id.
383
+ *
384
+ * @param {string} extensionId - The string id of the extension.
385
+ * @returns {Promise<boolean>} - True if the extension was successfully unloaded.
541
386
  */
542
- spin(movement: THREE.Vector2): void;
387
+ unloadExtension(extensionId: string): Promise<boolean>;
543
388
  /**
544
- * Gets the camera orientation.
389
+ * Returns all loaded extensions.
390
+ * @returns {?string[]} - Ids of loaded extensions.
545
391
  */
546
- getCameraOrientation(): CameraOrientation;
392
+ getExtensions(): string[];
547
393
  /**
548
- * Orient the camera
549
- * @param iOrientation
550
- * @param isAnimationEnabled
394
+ * Returns the loaded extension.
395
+ * @param {string} extensionId - The string id of the extension.
396
+ * @returns {?ExtensionBase} - Extension.
551
397
  */
552
- setCameraOrientation(iOrientation: CameraOrientation, isAnimationEnabled?: boolean): void;
553
- /**
554
- * Zoom camera to the point
555
- * @param deltaSign - zoom distance
556
- * @param point - zoom point
557
- */
558
- zoomToPoint(deltaSign: number, point: THREE.Vector3): void;
559
- /**
560
- * Zoom camera to fit {@link boundingBox} and apply {@link iOrientation}
561
- * @param boundingBox
562
- * @param iOrientation - camera orientation after zooming (optional)
563
- * @param isAnimationEnabled - is animated zoom enabled
564
- */
565
- zoomToFit(bb: THREE.Box3, iOrientation?: CameraOrientation, iAnimationEnabled?: boolean): void;
566
- /**
567
- * Gets the navigation mode.
568
- */
569
- getNavigationMode(): CameraNavigationMode;
570
- /**
571
- * Sets the navigation mode
572
- * @param mode - navigation mode or group of modes.
573
- * @param isEnable - Turns navigation mode on or off.
574
- * @param duration - (optional) navigation duration, used if {@link isEnable} is true. If defined: turns off navigation {@link mode} after {@link duration} delay.
575
- */
576
- setNavigationMode(mode: CameraNavigationMode, isEnable: boolean, duration?: number): void;
398
+ getExtension(extensionId: string): ExtensionBase;
577
399
  }
578
- export interface IModelIntersectionChecker {
579
- /** Gets the center of the model*/
580
- get modelCenter(): THREE.Vector3;
581
- /** Gets the bounding box of the model*/
582
- get boundingBox(): THREE.Box3;
583
- /**
584
- * Gets intersection point of the last casted ray
585
- */
586
- getIntersectionPoint(): THREE.Intersection<THREE.Object3D> | undefined;
587
- /**
588
- * Gets {@link THREE.Intersection} between a casted {@link ray} and model object.
589
- * @param ray
590
- * @param camera
591
- */
592
- getIntersectionByRay(ray: THREE.Ray, camera: THREE.Camera): THREE.Intersection<THREE.Object3D> | undefined;
593
- /**
594
- * Gets ID of the model object intersected by {@link ray}
595
- * @param ray
596
- * @param camera
597
- */
598
- getIntersectionIDByRay(ray: THREE.Ray, camera: THREE.Camera): {
599
- modelId: string;
600
- guid: string;
601
- } | undefined;
602
- /**
603
- * Gets {@link THREE.Intersection} between a ray, casted from {@link camera} to {@link ndcPoint}, and model object.
604
- * @param ndcPoint
605
- * @param camera
606
- */
607
- getIntersectionByNdcPt(ndcPoint: THREE.Vector2, camera: THREE.Camera): THREE.Intersection<THREE.Object3D> | undefined;
608
- /**
609
- * Gets ID of the model object intersected by ray, casted from {@link camera} to {@link ndcPoint}.
610
- * @param ndcPoint
611
- * @param camera
612
- */
613
- getIntersectionIDByNdcPt(ndcPoint: THREE.Vector2, camera: THREE.Camera): {
614
- modelId: string;
615
- guid: string;
616
- } | undefined;
617
- /**
618
- * Gets IDs of the model objects intersected by frustum
619
- * @param ndcFrustumBox - frustum in the NDC space
620
- * @param unProjMatrix - NDC to World projection matrix
621
- * @param isContainsOnly - if true, gets only fully contained objects in the frustum
622
- * @param isClippingEnable - if true, intersect objects only in the clipping space
623
- */
624
- getIntersectionIDByFrustumNdcPt(ndcFrustumBox: THREE.Box3, unProjMatrix: THREE.Matrix4, isContainsOnly: boolean, isClippingEnable?: boolean): {
625
- modelId: string;
626
- guid: string;
627
- }[];
400
+ export interface IEventsDispatcher {
401
+ addEventListener(event: string, listener: EventListener, options?: object): void;
402
+ removeEventListener(event: string, listener: EventListener): void;
403
+ hasEventListener(event: string, listener: EventListener): boolean;
404
+ dispatchEvent(event: string | Event): void;
405
+ dispatchEventAsync(event: string | Event): void;
406
+ clearListeners(): void;
628
407
  }
629
- export enum NavigationHandlerPriority {
630
- DefaultNavigation = 0,
631
- GizmoHandlers = 20,
632
- EmbeddedExtensions = 40,
633
- CustomExtensions = 100
408
+ export enum SettingsTheme {
409
+ LIGHT_THEME = "ascn-light",
410
+ DARK_THEME = "ascn-dark"
634
411
  }
635
- export class NavigationEventOptions implements EventListenerOptions {
636
- /** If true, use event capturing instead of event bubbling*/
637
- readonly capture: boolean;
638
- /** Call priority of navigation event handlers, from highest to lowest*/
639
- readonly priority: number | NavigationHandlerPriority;
640
- /** Always handle, used if `NavigationEvent.isHandled` set to true*/
641
- readonly alwaysHandle: boolean;
642
- /** (optional) listener name*/
643
- readonly navigationTargetName?: string;
644
-
645
- constructor(
646
- /** If true, use event capturing instead of event bubbling*/
647
- capture?: boolean,
648
- /** Call priority of navigation event handlers, from highest to lowest*/
649
- priority?: number | NavigationHandlerPriority,
650
- /** Always handle, used if `NavigationEvent.isHandled` set to true*/
651
- alwaysHandle?: boolean,
652
- /** (optional) listener name*/
653
- navigationTargetName?: string);
412
+ export const defaultThemeAppearance: string;
413
+ export type ViewerSettings = Record<string, any>;
414
+ export class ViewerConfiguration {
415
+ settingsPrefix: string;
416
+ appearance: ViewerSettings;
417
+ createConfiguration(configuration: ViewerSettings, origin: ViewerSettings): void;
418
+ mergeConfigurationAndSettings(configuration: ViewerSettings, settings: ISettings): void;
419
+ changeTheme(newTheme: string): void;
654
420
  }
655
- export type NavigationEvent = {
656
- /**
657
- * (optional) Value indicating whether the NavigationEvent event was handled.
658
- */
659
- isHandled?: boolean;
660
- };
661
- export interface ActiveEvent extends Event {
662
- readonly isActive: boolean;
421
+ export type ErrorCallback = (message: string) => void;
422
+ export type SuccessCallback = (modelId: any) => void;
423
+ export enum DocumentType {
424
+ UNKNOWN = 0,
425
+ DOCUMENT_2D = 1,
426
+ DOCUMENT_3D = 2
663
427
  }
664
- export interface NavigationEventSourceEventMap extends HTMLElementEventMap {
428
+ export const defaultBaseSettings: ViewerConfiguration;
429
+ export abstract class ViewerBase {
430
+ protected _clientContainer: HTMLElement;
431
+ protected _loadingSpinner: LoadingSpinner;
432
+ protected _documentType: DocumentType;
433
+ protected _configuration: ViewerConfiguration;
434
+ readonly container: HTMLElement;
435
+ readonly extensionsLoader: ExtensionLoader;
436
+ abstract settings: ISettings;
437
+ abstract events: IEventsDispatcher;
438
+ get rootContainer(): HTMLElement;
439
+ getConfiguration(): ViewerConfiguration;
665
440
  /**
666
- * Occurs when the {@link INavigationEventSource.isActive} property changes.
441
+ *
442
+ * @returns
667
443
  */
668
- "active": ActiveEvent;
669
- }
670
- export interface INavigationEventSource {
444
+ start(): Promise<number>;
671
445
  /**
672
- * Activity of the event source
446
+ *
673
447
  */
674
- get isActive(): boolean;
675
- set isActive(value: boolean);
676
- addEventListener<T extends keyof NavigationEventSourceEventMap>(type: T, listener: (this: object, ev: NavigationEventSourceEventMap[T] & NavigationEvent) => void, options?: boolean | EventListenerOptions | NavigationEventOptions): void;
677
- removeEventListener<T extends keyof NavigationEventSourceEventMap>(type: T, listener: (this: object, ev: NavigationEventSourceEventMap[T] & NavigationEvent) => void, options?: boolean | EventListenerOptions | NavigationEventOptions): void;
448
+ finish(): void;
449
+ onPostExtensionLoad(extension: ExtensionBase): void;
450
+ onExtensionUnloading(extension: ExtensionBase): void;
451
+ onPostExtensionUnload(extension: ExtensionBase): void;
452
+ protected loadExtensions(): void;
453
+ protected setThemeFromSettings(): void;
678
454
  }
679
- export interface INavigationAgent {
680
- /**
681
- * Canvas DOM-events source
682
- */
683
- readonly canvasNavigationSource: INavigationEventSource;
684
- /**
685
- * Keyboard DOM-events source
686
- */
687
- readonly keyboardNavigationSource: INavigationEventSource;
688
- /**
689
- * Activity of the navigation agent
690
- */
691
- get isActive(): boolean;
692
- set isActive(value: boolean);
693
- /**
694
- * Gets rectangle of the navigation area
695
- */
696
- getNavigationArea(): DOMRect;
455
+ export class EventsDispatcherCore implements IEventsDispatcher {
456
+ dispatchEventAsync(event: string | Event): void;
457
+ hasEventListener(type: string, listener: EventListener): boolean;
458
+ dispatchEvent(event: string | Event): void;
459
+ addEventListener(type: string, listener: EventListener, options?: object): void;
460
+ removeEventListener(type: string, listener: EventListener): void;
461
+ removeEvent(type: string): void;
462
+ clearListeners(): void;
697
463
  }
698
- export interface INavigationTool {
699
- /**
700
- * Gets name of this navigation tool.
701
- */
702
- get name(): string;
703
- /**
704
- * Initialize navigation tool.
705
- */
706
- init(navAgent: INavigationAgent, cameraControl: ICameraControl, intersectionChecker: IModelIntersectionChecker): void;
707
- /**
708
- * Activates or deactivates this navigation tool.
709
- */
710
- setActive(isActive: boolean): void;
711
- /**
712
- * Gets the camera pivot point.
713
- */
714
- getPivotPoint(): THREE.Vector3;
464
+ export class Button extends Control {
465
+
466
+ constructor(id: string);
467
+ setIsChecked(value: boolean): void;
468
+ setState(state: ControlState.State): boolean;
469
+ setText(text: string): void;
470
+ getState(): ControlState.State;
471
+ setIcon(iconClassName: string): void;
472
+ setFromSvgTemlate(template: string): void;
715
473
  /**
716
- * Sets the camera pivot point.
474
+ * Override this method to be notified when the user clicks on the button.
475
+ * @param {MouseEvent} event
717
476
  */
718
- setPivotPoint(pivotPoint: THREE.Vector3): void;
477
+ onClick: (event: MouseEvent) => void;
719
478
  /**
720
- * Sets the camera parameters.
721
- * @param iParams
479
+ * Override this method to be notified when the mouse enters the button.
480
+ * @param {MouseEvent} event
722
481
  */
723
- setCameraParameters(iParams: CameraParameters): void;
482
+ onMouseOver: (event: MouseEvent) => void;
724
483
  /**
725
- * Gets the camera parameters.
484
+ * Override this method to be notified when the mouse leaves the button.
485
+ * @param {MouseEvent} event
726
486
  */
727
- getCameraParameters(): CameraParameters;
487
+ onMouseOut: (event: MouseEvent) => void;
728
488
  }
729
- export class RenderViewSettings {
730
- telemetry?: boolean;
731
- hideEdgesWhenNavigation?: boolean;
732
- antiAliasing?: boolean;
733
- displayMode?: DisplayMode;
734
- /** Desired render framerate */
735
- desiredFramerate?: number;
736
- /** Allocated time for rendering operations, excluding scene rendering */
737
- manageTime?: number;
738
- /** Draw hovered meshes on the `selectionScene` */
739
- hoverMeshes?: boolean;
740
- /** Draw hovered edges on the `selectionScene` */
741
- hoverEdges?: boolean;
742
- /** Draw selected meshes on the `selectionScene` */
743
- selectEdges?: boolean;
744
- /** Draw selected edges on the `selectionScene` */
745
- selectMeshes?: boolean;
489
+ export namespace Button {
490
+ enum Event {
491
+ STATE_CHANGED = "Button.StateChanged",
492
+ CLICK = "click"
493
+ }
746
494
  }
747
- export enum DisplayMode {
748
- FACES_AND_EDGES = 0,
749
- FACES = 1
495
+ export class SubMenu implements IMenu {
496
+ readonly controls: IControl[];
497
+ set selectedIndex(value: number);
498
+ get selectedIndex(): number;
499
+ setEnabled(index: number, value: boolean): void;
500
+ addControl(control: IControl, index?: number): void;
501
+ removeControl(index?: number): void;
502
+ clearList(): void;
503
+ changeControl(item: IControl, index: number): void;
504
+ getControlsCount(): number;
750
505
  }
751
- export const defaultRenderViewSettings: RenderViewSettings;
752
- export interface IRenderOperationContext {
506
+ export class ComboButton extends Control {
507
+
508
+ constructor(id: string, selectedIndex?: number);
509
+ get subMenu(): SubMenu;
510
+ /**
511
+ * Override this method to be notified when the user clicks on the button.
512
+ * @param {MouseEvent} event
513
+ */
514
+ onClick: (event: PointerEvent) => void;
515
+ onOpen: () => void;
516
+ onClose: () => void;
517
+ setState(state: ControlState.State): boolean;
518
+ setText(text: string): void;
519
+ setFromSvgTemlate(template: string): void;
520
+ }
521
+ export class Checkbox {
522
+
523
+ constructor(id: string, checked: boolean, disabled: boolean, placeholder: string);
524
+ get checked(): boolean;
525
+ set checked(value: boolean);
526
+ get disabled(): boolean;
527
+ set disabled(value: boolean);
528
+ get label(): HTMLLabelElement;
529
+ onChange(value: boolean): void;
530
+ createElement(): Element;
531
+ }
532
+ interface ISelectItem {
533
+ text: string;
534
+ value: string;
535
+ }
536
+ export class Select {
537
+
538
+ constructor(id: string, items: ISelectItem[], placeholder: string);
539
+ get select(): HTMLElement;
540
+ get disabled(): boolean;
541
+ set disabled(value: boolean);
542
+ get selectedIndex(): number;
543
+ set selectedIndex(value: number);
544
+ get placeholder(): string;
545
+ set placeholder(value: string);
546
+ get label(): HTMLElement;
547
+ get previousSelectedIndex(): number;
548
+ onChange({ index, value }: {
549
+ index: any;
550
+ value: any;
551
+ }): void;
552
+ update(array: ISelectItem[], selectedIndex?: number): void;
553
+ }
554
+ export {};
555
+ export class ViewerToolbar extends Toolbar {
556
+ }
557
+ interface ElementClass {
558
+ panelClassName?: string;
559
+ contentClassName?: string;
560
+ headerClassName?: string;
561
+ }
562
+ export class Dialog extends Control {
563
+ responseDialog: (state?: boolean) => void;
564
+
565
+ constructor(id: string, panelToAttach: HTMLElement);
566
+ get dialog(): HTMLElement;
567
+ get dialogContent(): HTMLElement;
568
+ get resizable(): boolean;
569
+ setDialogContent(value: HTMLElement): Dialog;
570
+ setHeader(value: HTMLElement): Dialog;
571
+ setCaption(value: string): Dialog;
572
+ setSvgIcon(template: string): Dialog;
573
+ setFooter(value: HTMLElement): Dialog;
574
+ setDialogElementClassNames(value: ElementClass): Dialog;
575
+ setResizable(value: boolean): Dialog;
576
+ setWindowOptions(value: IWindowStateOptions): Dialog;
577
+ setDraggable(value: boolean): Dialog;
578
+ setCloseble(value: boolean): Dialog;
579
+ openDialog(x?: number, y?: number): HTMLElement;
580
+ destroyDialog(): void;
581
+ isDialogShown(): boolean;
582
+ subscribe(fn: (state: boolean) => void): void;
583
+ }
584
+ export {};
585
+ export interface ISettingsStorage {
586
+ clear(): void;
587
+ getItem<T>(key: string): T | null;
588
+ removeItem(key: string): void;
589
+ setItem<T>(key: string, value: T): void;
590
+ getKeys(): string[];
591
+ }
592
+ export class SettingsStorageFactory {
593
+ getSettingsStorage(): ISettingsStorage;
594
+ }
595
+ export class LocalSettingsStorage implements ISettingsStorage {
596
+ clear(): void;
597
+ getItem<T>(key: string): T | null;
598
+ removeItem(key: string): void;
599
+ setItem<T>(key: string, value: T): void;
600
+ getKeys(): string[];
601
+ }
602
+ export class InMemorySettingsStorage implements ISettingsStorage {
603
+ clear(): void;
604
+ getItem<T>(key: string): T | null;
605
+ removeItem(key: string): void;
606
+ setItem<T>(key: string, value: T): void;
607
+ getKeys(): string[];
608
+ }
609
+ export abstract class SettingsBase implements ISettings {
610
+ protected _eventDispatcher: IEventsDispatcher;
611
+ protected _storage: ISettingsStorage;
612
+ changeSetting<T>(name: string, value: T, notify?: boolean, providedData?: any): void;
613
+ getSettingValue<T>(name: string): T;
614
+ protected abstract getKeyWithPrefix(key: string): string;
615
+ }
616
+ export const MouseButtons: {
617
+ Left: number;
618
+ Middle: number;
619
+ Right: number;
620
+ };
621
+ export class RenderEventTypes {
622
+ static CAMERA_CHANGED_EVENT: string;
623
+ static CAMERA_NAVIGATION_MODE_CHANGED_EVENT: string;
624
+ static RENDER_CLICK_EVENT: string;
625
+ static RENDER_HOVER_EVENT: string;
626
+ static RENDER_DOUBLE_CLICK_EVENT: string;
627
+ static RENDER_SELECTION_RESET_EVENT: string;
628
+ }
629
+ export class SelectionChangedEvent extends Event {
630
+ selectedIds: ModelElementIds[];
631
+
632
+ constructor(type: string, selectedIds?: ModelElementIds[]);
633
+ }
634
+ export class ClickedEvent extends Event {
635
+ modelId: string;
636
+ modelElementId: string;
637
+ ctrlKey: boolean;
638
+
639
+ constructor(type: string, modelId: string, modelElementId: string, ctrlKey: boolean);
640
+ }
641
+ export class HoverEvent extends Event {
642
+ modelId: string;
643
+ modelElementId: string;
644
+
645
+ constructor(type: string, modelId: string, modelElementId: string);
646
+ }
647
+ export class GlobalEvents {
648
+ static events: EventsDispatcherCore;
649
+ }
650
+ export type Point3 = {
651
+ x: number;
652
+ y: number;
653
+ z: number;
654
+ };
655
+ export function pointToVector3(point: Point3): THREE.Vector3;
656
+ export type CameraParameters = {
657
+ /** Camera position */
658
+ position: Point3;
659
+ /** Camera view direction: vector pointing from camera to target */
660
+ eyeDir: Point3;
661
+ /** Field of view: angle in radians */
662
+ angle: number;
663
+ /** (optional) Camera up vector*/
664
+ upDir?: Point3;
665
+ /** (optional) Vector pointing to the center of viewing area.*/
666
+ viewCenter?: Point3;
667
+ };
668
+ export type CameraOrientation = {
669
+ /** Camera view direction: vector pointing from camera to target */
670
+ viewDir: THREE.Vector3;
671
+ /** (optional) Camera up vector */
672
+ upDir?: THREE.Vector3;
673
+ };
674
+ export enum CameraNavigationMode {
675
+ None = 0,
676
+ Rotation = 1,
677
+ Translation = 2,
678
+ Spin = 4,
679
+ Zoom = 8
680
+ }
681
+ export interface ICameraControl {
682
+ /**
683
+ * Gets the Three.js camera.
684
+ */
685
+ getCamera(): THREE.Camera;
686
+ /**
687
+ * Gets the camera parameters.
688
+ */
689
+ getCameraParameters(): CameraParameters;
690
+ /**
691
+ * Sets the camera parameters.
692
+ */
693
+ setCameraParameters(iParams: CameraParameters): void;
694
+ /**
695
+ * Sets the camera view point.
696
+ * @param viewCenter - view point
697
+ */
698
+ setViewCenter(viewCenter: THREE.Vector3): void;
699
+ /**
700
+ * Gets the camera view point.
701
+ */
702
+ getViewCenter(): THREE.Vector3;
703
+ /**
704
+ * Sets the aspect ratio.
705
+ */
706
+ setAspectRatio(width: number, heigth: number): boolean;
707
+ /**
708
+ * Rotates camera around the rotationCenter
709
+ * @param movement - offset in the screen space
710
+ * @param rotationCenter - the center of rotation
711
+ */
712
+ rotate(movement: THREE.Vector2, rotationCenter: THREE.Vector3): void;
713
+ /**
714
+ * Translates the camera relative to the viewCenter
715
+ * @param startNdcPos - start position in the NDC space
716
+ * @param endNdcPos - end position in the NDC space
717
+ * @param viewCenter - relative translation point
718
+ */
719
+ translate(startNdcPos: THREE.Vector2, endNdcPos: THREE.Vector2, viewCenter: THREE.Vector3): void;
720
+ /**
721
+ * Rotates the camera around the Up vector
722
+ * @param movement - offset in the screen space
723
+ */
724
+ spin(movement: THREE.Vector2): void;
725
+ /**
726
+ * Gets the camera orientation.
727
+ */
728
+ getCameraOrientation(): CameraOrientation;
729
+ /**
730
+ * Orient the camera
731
+ * @param iOrientation
732
+ * @param isAnimationEnabled
733
+ */
734
+ setCameraOrientation(iOrientation: CameraOrientation, isAnimationEnabled?: boolean): void;
735
+ /**
736
+ * Zoom camera to the point
737
+ * @param deltaSign - zoom distance
738
+ * @param point - zoom point
739
+ */
740
+ zoomToPoint(deltaSign: number, point: THREE.Vector3): void;
741
+ /**
742
+ * Zoom camera to fit {@link boundingBox} and apply {@link iOrientation}
743
+ * @param boundingBox
744
+ * @param iOrientation - camera orientation after zooming (optional)
745
+ * @param isAnimationEnabled - is animated zoom enabled
746
+ */
747
+ zoomToFit(bb: THREE.Box3, iOrientation?: CameraOrientation, iAnimationEnabled?: boolean): void;
748
+ /**
749
+ * Gets the navigation mode.
750
+ */
751
+ getNavigationMode(): CameraNavigationMode;
752
+ /**
753
+ * Sets the navigation mode
754
+ * @param mode - navigation mode or group of modes.
755
+ * @param isEnable - Turns navigation mode on or off.
756
+ * @param duration - (optional) navigation duration, used if {@link isEnable} is true. If defined: turns off navigation {@link mode} after {@link duration} delay.
757
+ */
758
+ setNavigationMode(mode: CameraNavigationMode, isEnable: boolean, duration?: number): void;
759
+ }
760
+ export class EventTypes extends CoreEventTypes {
761
+ static MODEL_PART_LOADED: string;
762
+ static MODEL_PART_UPDATED: string;
763
+ static MODEL_PART_UNLOADED: string;
764
+ static VIRTUAL_ORIGIN_CHANGED: string;
765
+ static SELECTION_CHANGED_EVENT: string;
766
+ static DELETE_OBJECTS_EVENT: string;
767
+ static CAMERA_CHANGE_EVENT: string;
768
+ static CAMERA_NAVIGATION_MODE_CHANGED_EVENT: string;
769
+ static RENDER_CLICK_EVENT: string;
770
+ static RENDER_HOVER_EVENT: string;
771
+ static RENDER_DOUBLE_CLICK_EVENT: string;
772
+ }
773
+ export class ModelPartEvent extends Event {
774
+ modelPartId: string;
775
+ }
776
+ export class ModelPartUpdateEvent extends ModelPartEvent {
777
+ updatedElementIds?: string[];
778
+ removedElementIds?: string[];
779
+ addedElementIds?: string[];
780
+ }
781
+ export class VirtualOriginEvent extends Event {
782
+ virtualOrigin: Point3;
783
+ delta: Point3;
784
+ }
785
+ export class DeleteEvent extends Event {
786
+ deletedIds: ModelElementIds[];
787
+ }
788
+
789
+ export enum SelectionMode {
790
+ Append = 0,
791
+ Replace = 1
792
+ }
793
+
794
+ export class SettingsNames {
795
+ static TELEMETRY: string;
796
+ static AXES: string;
797
+ static CAMERA_ANIMATION: string;
798
+ static HIDE_SMALL_ELEMENTS_WHEN_NAVIGATING: string;
799
+ static GLOBAL_LIGHT: string;
800
+ static LIGHT_SOURCE: string;
801
+ static ANTI_ALIASING: string;
802
+ static HIDE_SMALL_ELEMENTS_MOVING: string;
803
+ static SMALL_ELEMENT_SIZE: string;
804
+ static LABEL_LINE_LENGTH: string;
805
+ static HIDE_EDGES_WHEN_NAVIGATING: string;
806
+ static DISPLAY_MODE: string;
807
+ static NAVIGATION_CUBE: string;
808
+ static DESIRED_FRAMERATE: string;
809
+ static MANAGE_TIME: string;
810
+ static HOVER_MESHES: string;
811
+ static HOVER_EDGES: string;
812
+ static SELECT_MESHES: string;
813
+ static SELECT_EDGES: string;
814
+ }
815
+ export enum ValueType {
816
+ STRING = 0,
817
+ NUMBER = 1,
818
+ ENUM = 2,
819
+ BOOL = 3
820
+ }
821
+ export class RenderViewSettings {
822
+ telemetry?: boolean;
823
+ hideEdgesWhenNavigation?: boolean;
824
+ antiAliasing?: boolean;
825
+ displayMode?: DisplayMode;
826
+ /** Desired render framerate */
827
+ desiredFramerate?: number;
828
+ /** Allocated time for rendering operations, excluding scene rendering */
829
+ manageTime?: number;
830
+ /** Number of scene updates managed at once */
831
+ chunkUpdateSize?: number;
832
+ /** Draw hovered meshes on the `selectionScene` */
833
+ hoverMeshes?: boolean;
834
+ /** Draw hovered edges on the `selectionScene` */
835
+ hoverEdges?: boolean;
836
+ /** Draw selected meshes on the `selectionScene` */
837
+ selectEdges?: boolean;
838
+ /** Draw selected edges on the `selectionScene` */
839
+ selectMeshes?: boolean;
840
+ }
841
+ export enum DisplayMode {
842
+ FACES_AND_EDGES = 0,
843
+ FACES = 1
844
+ }
845
+ export const defaultRenderViewSettings: RenderViewSettings;
846
+ export class Viewer3DConfiguration extends ViewerConfiguration {
847
+ render: ViewerSettings;
848
+
849
+ constructor(appearance?: ViewerSettings, render?: ViewerSettings);
850
+ }
851
+ export const defaultViewer3DSettings: ViewerSettings;
852
+ export interface SceneCheckOptions {
853
+ /** specify whether intersections should be filtered by clippings */
854
+ filterByClipping?: boolean;
855
+ }
856
+ export interface ModelCheckOptions extends SceneCheckOptions {
857
+ /** Scene names to check intersections. */
858
+ sceneNames?: string[];
859
+ }
860
+ export interface IIntersectionChecker<TOptions> {
861
+ /**
862
+ * Gets intersection point of the last casted ray
863
+ */
864
+ getIntersectionPoint(): THREE.Intersection<THREE.Object3D> | undefined;
865
+ /**
866
+ * Gets {@link THREE.Intersection} between a casted {@link ray} and model object.
867
+ * @param ray
868
+ * @param camera
869
+ * @param options - (optional) intersection check options.
870
+ */
871
+ getIntersectionByRay(ray: THREE.Ray, camera: THREE.Camera, options?: TOptions): THREE.Intersection<THREE.Object3D> | undefined;
872
+ /**
873
+ * Gets ID of the model object intersected by {@link ray}
874
+ * @param ray
875
+ * @param camera
876
+ * @param options - (optional) intersection check options.
877
+ */
878
+ getIntersectionIDByRay(ray: THREE.Ray, camera: THREE.Camera, options?: TOptions): {
879
+ modelId: string;
880
+ guid: string;
881
+ } | undefined;
882
+ /**
883
+ * Gets {@link THREE.Intersection} between a ray, casted from {@link camera} to {@link ndcPoint}, and model object.
884
+ * @param ndcPoint
885
+ * @param camera
886
+ * @param options - (optional) intersection check options.
887
+ */
888
+ getIntersectionByNdcPt(ndcPoint: THREE.Vector2, camera: THREE.Camera, options?: TOptions): THREE.Intersection<THREE.Object3D> | undefined;
889
+ /**
890
+ * Gets ID of the model object intersected by ray, casted from {@link camera} to {@link ndcPoint}.
891
+ * @param ndcPoint
892
+ * @param camera
893
+ * @param options - (optional) intersection check options.
894
+ */
895
+ getIntersectionIDByNdcPt(ndcPoint: THREE.Vector2, camera: THREE.Camera, options?: TOptions): {
896
+ modelId: string;
897
+ guid: string;
898
+ } | undefined;
899
+ /**
900
+ * Gets IDs of the model objects intersected by frustum.
901
+ * @param ndcFrustumBox - frustum in the NDC space.
902
+ * @param unProjMatrix - NDC to World projection matrix.
903
+ * @param isContainsOnly - if true, gets only fully contained objects in the frustum.
904
+ * @param options - (optional) intersection check options.
905
+ */
906
+ getIntersectionIDByFrustumNdcPt(ndcFrustumBox: THREE.Box3, unProjMatrix: THREE.Matrix4, isContainsOnly: boolean, options?: TOptions): {
907
+ modelId: string;
908
+ guid: string;
909
+ }[];
910
+ }
911
+ export interface ISceneIntersectionChecker extends IIntersectionChecker<SceneCheckOptions> {
912
+ /** Gets the bounding box of the scene*/
913
+ get boundingBox(): THREE.Box3;
914
+ }
915
+ export interface IModelIntersectionChecker extends IIntersectionChecker<ModelCheckOptions> {
916
+ /** Gets the bounding box of the model*/
917
+ get boundingBox(): THREE.Box3;
918
+ /** Gets the center of the model*/
919
+ get modelCenter(): THREE.Vector3;
920
+ }
921
+ export class TPair<TKey, TValue> {
922
+
923
+ constructor(key: TKey, value: TValue);
924
+ get key(): TKey;
925
+ get value(): TValue;
926
+ }
927
+ export interface IRenderOperationContext {
753
928
  /** If true, renderScenes operations will be forced*/
754
929
  isRedrawRequested: boolean;
755
930
  /** If true - operations will not be suspended by the scheduler*/
@@ -762,6 +937,8 @@ export interface IRenderOperationContext {
762
937
  get settings(): RenderViewSettings;
763
938
  /** Indicates whether the navigation is in progress */
764
939
  get isNavigation(): boolean;
940
+ /** Indicates whether faces and edges should be drawn */
941
+ get displayMode(): DisplayMode;
765
942
  /** Indicates whether the operation has been requested to be suspended by the scheduler*/
766
943
  get isSuspensionRequested(): boolean;
767
944
  /** Gets the remaining time for the render operations in current iteration*/
@@ -803,6 +980,10 @@ export enum OperationPriority {
803
980
  afterAll = 100
804
981
  }
805
982
  export type RenderOperationDelegate = (context: IRenderOperationContext) => OperationStatus;
983
+ export enum SceneNames {
984
+ Main = "MainScene",
985
+ Overlay = "OverlayScene"
986
+ }
806
987
  export interface IUserScene extends THREE.Scene {
807
988
  /** Scene name */
808
989
  readonly name: string;
@@ -811,7 +992,7 @@ export interface IUserScene extends THREE.Scene {
811
992
  /** Indicates whether the scene should be redrawn*/
812
993
  get needsRedraw(): boolean;
813
994
  /** Gets the scene intersection checker */
814
- get intersectionChecker(): IModelIntersectionChecker | null;
995
+ get intersectionChecker(): ISceneIntersectionChecker | null;
815
996
  /** Sets clipping enable */
816
997
  set clippingEnable(value: boolean);
817
998
  /** Indicates whether the scene should be clipped */
@@ -831,11 +1012,13 @@ export interface IUserScene extends THREE.Scene {
831
1012
  /** Manage scene, manage updates on scene */
832
1013
  manageScene(context?: IRenderOperationContext): boolean;
833
1014
  /** Render scene */
834
- render(context: IRenderOperationContext): void;
1015
+ render(context?: IRenderOperationContext): void;
835
1016
  /** Dispose scene */
836
1017
  dispose(): void;
837
1018
  }
838
1019
  export interface I3DRenderer {
1020
+ clippingPlanes: THREE.Plane[];
1021
+ domElement: HTMLCanvasElement;
839
1022
  clear(color?: boolean, depth?: boolean, stencil?: boolean): void;
840
1023
  setClearColor(color: THREE.ColorRepresentation, alpha?: number): void;
841
1024
  clearDepth(): void;
@@ -844,14 +1027,13 @@ export interface I3DRenderer {
844
1027
  setSize(width: number, height: number, updateStyle?: boolean): void;
845
1028
  setViewport(x: THREE.Vector4 | number, y?: number, width?: number, height?: number): void;
846
1029
  getViewport(target: THREE.Vector4): THREE.Vector4;
847
- clippingPlanes: THREE.Plane[];
848
- domElement: HTMLCanvasElement;
1030
+ dispose(): void;
849
1031
  }
850
1032
  export interface IRenderViewer3D {
851
1033
  /** Gets model inetrsection checker. */
852
1034
  getIntersectionChecker(): IModelIntersectionChecker;
853
1035
  /** Request a full redraw of the canvas. */
854
- updateCurrentCanvas(): Promise<void>;
1036
+ updateCurrentCanvas(force?: boolean): Promise<void>;
855
1037
  /**
856
1038
  * Place object on the scene.\
857
1039
  * An object can only be placed on one scene.
@@ -875,163 +1057,395 @@ export interface IRenderViewer3D {
875
1057
  */
876
1058
  setActiveClipPlaneIndices(indices: number[]): void;
877
1059
  /**
878
- * Gets all render scenes.
1060
+ * Gets all render scenes.
1061
+ */
1062
+ getScenes(): IUserScene[];
1063
+ /**
1064
+ *
1065
+ * @param name
1066
+ * @param isClippable
1067
+ */
1068
+ addScene(name: string, isClippable: boolean): IUserScene;
1069
+ /**
1070
+ *
1071
+ * @param scene
1072
+ */
1073
+ removeScene(scene: IUserScene): void;
1074
+ }
1075
+ export abstract class CustomMaterial extends THREE.ShaderMaterial {
1076
+
1077
+ constructor();
1078
+ get hash(): number;
1079
+ copy(source: CustomMaterial): this;
1080
+ protected refreshUniforms(uniforms: {
1081
+ [uniform: string]: THREE.IUniform;
1082
+ }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
1083
+ protected onBeforeCompileCallback(shader: THREE.Shader): void;
1084
+ protected refreshTransformUniform(map: THREE.Texture, uniform: THREE.IUniform): void;
1085
+ protected onBeforeRender(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.BufferGeometry, material: THREE.Material, group: THREE.Group): void;
1086
+ }
1087
+ export interface CustomMeshLambertMaterialParameters extends THREE.ShaderMaterialParameters {
1088
+ instancing?: boolean | undefined;
1089
+ instancingColor?: boolean | undefined;
1090
+ color?: THREE.ColorRepresentation | undefined;
1091
+ emissive?: THREE.ColorRepresentation | undefined;
1092
+ emissiveIntensity?: number | undefined;
1093
+ fog?: boolean | undefined;
1094
+ }
1095
+ export class CustomMeshLambertMaterial extends CustomMaterial {
1096
+ type: string;
1097
+
1098
+ constructor(parameters?: CustomMeshLambertMaterialParameters);
1099
+ /**
1100
+ * @default false
1101
+ */
1102
+ get instancing(): boolean;
1103
+ set instancing(value: boolean);
1104
+ /**
1105
+ * @default false
1106
+ */
1107
+ get instancingColor(): boolean;
1108
+ set instancingColor(value: boolean);
1109
+ /**
1110
+ * @default new THREE.Color( 0xffffff )
1111
+ */
1112
+ color: THREE.Color;
1113
+ /**
1114
+ * @default new THREE.Color( 0x000000 )
1115
+ */
1116
+ emissive: THREE.Color;
1117
+ /**
1118
+ * @default 1
1119
+ */
1120
+ emissiveIntensity: number;
1121
+ /**
1122
+ * Whether the material is affected by fog. Default is true.
1123
+ * @default fog
1124
+ */
1125
+ fog: boolean;
1126
+ protected refreshUniformsCommon(uniforms: {
1127
+ [uniform: string]: THREE.IUniform;
1128
+ }, material: CustomMeshLambertMaterial, renderer: THREE.WebGLRenderer): void;
1129
+ protected refreshUniforms(uniforms: {
1130
+ [uniform: string]: THREE.IUniform<any>;
1131
+ }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
1132
+ copy(source: CustomMeshLambertMaterial): this;
1133
+ }
1134
+ export interface CustomLineMaterialParameters extends THREE.ShaderMaterialParameters {
1135
+ instancing?: boolean | undefined;
1136
+ instancingColor?: boolean | undefined;
1137
+ color?: THREE.ColorRepresentation | undefined;
1138
+ }
1139
+ export class CustomLineMaterial extends CustomMaterial {
1140
+ type: string;
1141
+
1142
+ constructor(parameters?: CustomLineMaterialParameters);
1143
+ /**
1144
+ * @default false
1145
+ */
1146
+ get instancing(): boolean;
1147
+ set instancing(value: boolean);
1148
+ /**
1149
+ * @default false
1150
+ */
1151
+ get instancingColor(): boolean;
1152
+ set instancingColor(value: boolean);
1153
+ /**
1154
+ * @default 0xffffff
1155
+ */
1156
+ color: THREE.Color;
1157
+ copy(source: CustomLineMaterial): this;
1158
+ protected refreshUniforms(uniforms: {
1159
+ [uniform: string]: THREE.IUniform;
1160
+ }, material: CustomLineMaterial, renderer: THREE.WebGLRenderer): void;
1161
+ }
1162
+ export interface MeshLineMaterialParameters extends THREE.ShaderMaterialParameters {
1163
+ color?: THREE.ColorRepresentation | undefined;
1164
+ dashed?: boolean | undefined;
1165
+ dashScale?: number | undefined;
1166
+ dashSize?: number | undefined;
1167
+ dashOffset?: number | undefined;
1168
+ gapSize?: number | undefined;
1169
+ worldUnits?: boolean | undefined;
1170
+ }
1171
+ export class MeshLineMaterial extends CustomMaterial {
1172
+ type: string;
1173
+
1174
+ constructor(parameters: MeshLineMaterialParameters);
1175
+ /**
1176
+ * @default false
1177
+ */
1178
+ get worldUnits(): boolean;
1179
+ set worldUnits(value: boolean);
1180
+ /**
1181
+ * @default false
1182
+ */
1183
+ get dashed(): boolean;
1184
+ set dashed(value: boolean);
1185
+ get resolution(): THREE.Vector2;
1186
+ /**
1187
+ * @default 0xffffff
879
1188
  */
880
- getScenes(): IUserScene[];
1189
+ color: THREE.Color;
881
1190
  /**
882
- *
883
- * @param name
884
- * @param isClippable
1191
+ * @default 1
885
1192
  */
886
- addScene(name: string, isClippable: boolean): IUserScene;
1193
+ dashScale: number;
887
1194
  /**
888
- *
889
- * @param scene
1195
+ * @default 1
890
1196
  */
891
- removeScene(scene: IUserScene): void;
892
- }
893
- export class InitializerOptions {
894
- libList?: string[];
895
- language?: string;
896
- }
897
- class Global {
898
- G: any;
899
- RESOURCE_ROOT: string;
900
- initializeResourceRoot(options: InitializerOptions): void;
901
- getResourceUrl(resourceRelativePath: string): string;
902
- }
903
- export const global: Global;
904
- export {};
905
- export type StringMap = {
906
- [key: string]: any;
907
- };
908
- export class Localization {
909
- static initialize(options: any): Promise<void>;
910
- static translate<T extends (string | StringMap) = string>(stringToTrans: string): T;
911
- static setLanguage(language: string): Promise<void>;
912
- static extendLocalization(locales: any): boolean;
913
- }
914
- export class ModelElement {
915
- get id(): string;
916
- get modelPartId(): string;
917
- get parent(): ModelElement | undefined;
918
- get type(): string;
919
- get name(): string;
920
- get children(): ModelElement[];
921
- get hasGeometry(): boolean;
922
- get viewObject(): ViewObject | undefined;
923
- get boundingBoxCenter(): Point3 | null;
924
- }
925
- export class ModelElementTree {
1197
+ dashSize: number;
926
1198
  /**
927
- *
928
- * @param {string|ModelElement} element - element id or element instance
929
- * @param callback
930
- * @param recursive
1199
+ * @default 0
931
1200
  */
932
- enumElementChildren(element: string | ModelElement, callback: (guid: string) => void, recursive?: boolean): void;
1201
+ dashOffset: number;
933
1202
  /**
934
- * Gets the root element of the model part
935
- * @returns {ModelElement} - model element instance
1203
+ * @default 1
936
1204
  */
937
- getRootElement(): ModelElement | undefined;
1205
+ gapSize: number;
1206
+ copy(source: MeshLineMaterial): this;
1207
+ protected refreshUniforms(uniforms: {
1208
+ [uniform: string]: THREE.IUniform<any>;
1209
+ }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
1210
+ }
1211
+ export interface CustomPointMaterialParameters extends THREE.ShaderMaterialParameters, THREE.PointsMaterialParameters {
1212
+ }
1213
+ export class CustomPointMaterial extends CustomMaterial {
1214
+ type: string;
1215
+
1216
+ constructor(parameters?: CustomPointMaterialParameters);
938
1217
  /**
939
- * Gets all elements of the model part
940
- * @returns array of the model elements
1218
+ * @default new THREE.Color( 0xffffff )
941
1219
  */
942
- getAllElements(): ModelElement[];
1220
+ color: THREE.Color;
943
1221
  /**
944
- * Gets model element by id
945
- * @param { string } id - model element id
946
- * @returns model element;
1222
+ * @default null
947
1223
  */
948
- getElement(id: string): ModelElement | undefined;
1224
+ map: THREE.Texture | null;
949
1225
  /**
950
- * Checks given element is viewable
951
- * @param {string|ModelElement} element - element id or element instance
952
- * @returns {boolean}
1226
+ * @default null
953
1227
  */
954
- isViewableElement(element: string | ModelElement): boolean;
1228
+ alphaMap: THREE.Texture | null;
955
1229
  /**
956
- * Checks given element is detached from the root element
957
- * @param {string|ModelElement} element - element id or element instance
958
- * @returns {boolean}
1230
+ * @default 1
959
1231
  */
960
- isDetachedElement(element: string | ModelElement): boolean;
1232
+ size: number;
961
1233
  /**
962
- * Gets the element level in the element tree
963
- * @param {string|ModelElement} element - element id or element instance
964
- * @returns {number} - level of the element
1234
+ * @default true
965
1235
  */
966
- getChildLevelNumber(element: string | ModelElement): number;
1236
+ sizeAttenuation: boolean;
1237
+ copy(source: CustomPointMaterial): this;
1238
+ protected refreshUniformsCommon(uniforms: {
1239
+ [uniform: string]: THREE.IUniform;
1240
+ }, material: CustomPointMaterial, renderer: THREE.WebGLRenderer): void;
1241
+ protected refreshUniforms(uniforms: {
1242
+ [uniform: string]: THREE.IUniform<any>;
1243
+ }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
967
1244
  }
968
- export class ModelPart {
969
- get id(): string;
970
- get elementTree(): ModelElementTree;
971
- dispose(): void;
1245
+ export enum NavigationHandlerPriority {
1246
+ DefaultNavigation = 0,
1247
+ GizmoHandlers = 20,
1248
+ EmbeddedExtensions = 40,
1249
+ CustomExtensions = 100
972
1250
  }
973
- export interface INavigation {
1251
+ export class NavigationEventOptions implements EventListenerOptions {
1252
+ /** If true, use event capturing instead of event bubbling*/
1253
+ readonly capture: boolean;
1254
+ /** Call priority of navigation event handlers, from highest to lowest*/
1255
+ readonly priority: number | NavigationHandlerPriority;
1256
+ /** Always handle, used if `NavigationEvent.isHandled` set to true*/
1257
+ readonly alwaysHandle: boolean;
1258
+ /** (optional) listener name*/
1259
+ readonly navigationTargetName?: string;
1260
+
1261
+ constructor(
1262
+ /** If true, use event capturing instead of event bubbling*/
1263
+ capture?: boolean,
1264
+ /** Call priority of navigation event handlers, from highest to lowest*/
1265
+ priority?: number | NavigationHandlerPriority,
1266
+ /** Always handle, used if `NavigationEvent.isHandled` set to true*/
1267
+ alwaysHandle?: boolean,
1268
+ /** (optional) listener name*/
1269
+ navigationTargetName?: string);
1270
+ }
1271
+ export type NavigationEvent = {
974
1272
  /**
975
- * Register navigation tool.
1273
+ * (optional) Value indicating whether the NavigationEvent event was handled.
976
1274
  */
977
- registerNavigation(navigationTool: INavigationTool): void;
1275
+ isHandled?: boolean;
1276
+ };
1277
+ export interface ActiveEvent extends Event {
1278
+ readonly isActive: boolean;
1279
+ }
1280
+ export interface NavigationEventSourceEventMap extends HTMLElementEventMap {
978
1281
  /**
979
- * Unregister navigation tool.
1282
+ * Occurs when the {@link INavigationEventSource.isActive} property changes.
980
1283
  */
981
- unregisterNavigation(navigationTool: INavigationTool): void;
1284
+ "active": ActiveEvent;
1285
+ }
1286
+ export interface INavigationEventSource {
982
1287
  /**
983
- * Activate or deactivate registered navigation tool.
984
- * NB: There can be only one active navigation tool at time.
1288
+ * Activity of the event source
985
1289
  */
986
- setActive(navigationToolName: string, isActive: boolean): void;
1290
+ get isActive(): boolean;
1291
+ set isActive(value: boolean);
1292
+ addEventListener<T extends keyof NavigationEventSourceEventMap>(type: T, listener: (this: object, ev: NavigationEventSourceEventMap[T] & NavigationEvent) => void, options?: boolean | EventListenerOptions | NavigationEventOptions): void;
1293
+ removeEventListener<T extends keyof NavigationEventSourceEventMap>(type: T, listener: (this: object, ev: NavigationEventSourceEventMap[T] & NavigationEvent) => void, options?: boolean | EventListenerOptions | NavigationEventOptions): void;
1294
+ }
1295
+ export interface INavigationAgent {
987
1296
  /**
988
- * Get active navigation tool.
1297
+ * Canvas DOM-events source
989
1298
  */
990
- getActiveNavigation(): INavigationTool | null;
1299
+ readonly canvasNavigationSource: INavigationEventSource;
991
1300
  /**
992
- * Get navigation agent.
1301
+ * Keyboard DOM-events source
993
1302
  */
994
- getNavigationAgent(): INavigationAgent;
1303
+ readonly keyboardNavigationSource: INavigationEventSource;
995
1304
  /**
996
- * Gets navigation area rectangle
1305
+ * Activity of the navigation agent
997
1306
  */
998
- getNavigationArea(): DOMRect;
1307
+ get isActive(): boolean;
1308
+ set isActive(value: boolean);
999
1309
  /**
1000
- * Sets the camera parameters.
1310
+ * Gets rectangle of the navigation area
1001
1311
  */
1002
- setCameraParameters(params: CameraParameters): void;
1312
+ getNavigationArea(): DOMRect;
1313
+ }
1314
+ export interface INavigationTool {
1003
1315
  /**
1004
- * Gets the camera parameters.
1316
+ * Gets name of this navigation tool.
1005
1317
  */
1006
- getCameraParameters(): CameraParameters;
1318
+ get name(): string;
1007
1319
  /**
1008
- * Gets the camera control.
1320
+ * Initialize navigation tool.
1009
1321
  */
1010
- getCameraControl(): ICameraControl;
1322
+ init(navAgent: INavigationAgent, cameraControl: ICameraControl, intersectionChecker: IModelIntersectionChecker): void;
1011
1323
  /**
1012
- * Gets the Three.js camera.
1324
+ * Activates or deactivates this navigation tool.
1013
1325
  */
1014
- getCamera(): THREE.Camera;
1326
+ setActive(isActive: boolean): void;
1015
1327
  /**
1016
- * Fits camera to objects by IDs.
1017
- * @param {string[] | string} elementIds - element or array of elements
1018
- * @param {string | ModelPart} modelPart - the model part id or the model part instance containing the elements.
1019
- * @param {boolean} immediate - true to avoid the default transition.
1020
- * @returns
1328
+ * Gets the camera pivot point.
1021
1329
  */
1022
- fitToView(elementIds: string[] | string, modelPart: string | ModelPart, immediate?: boolean): void;
1330
+ getPivotPoint(): THREE.Vector3;
1023
1331
  /**
1024
1332
  * Sets the camera pivot point.
1025
1333
  */
1026
- setPivotPoint(point: Point3): void;
1334
+ setPivotPoint(pivotPoint: THREE.Vector3): void;
1027
1335
  /**
1028
- * Gets the camera pivot point.
1336
+ * Sets the camera parameters.
1337
+ * @param iParams
1029
1338
  */
1030
- getPivotPoint(): Point3;
1339
+ setCameraParameters(iParams: CameraParameters): void;
1031
1340
  /**
1032
- * Reset the camera pivot point.
1341
+ * Gets the camera parameters.
1033
1342
  */
1034
- resetPivotPoint(): void;
1343
+ getCameraParameters(): CameraParameters;
1344
+ }
1345
+ export class GizmoMaterials {
1346
+ static gizmoMaterial: THREE.MeshBasicMaterial;
1347
+ static matInvisible: THREE.MeshBasicMaterial;
1348
+ static matRed: THREE.MeshBasicMaterial;
1349
+ static matGreen: THREE.MeshBasicMaterial;
1350
+ static matBlue: THREE.MeshBasicMaterial;
1351
+ static matYellow: THREE.MeshBasicMaterial;
1352
+ static matViolet: THREE.MeshBasicMaterial;
1353
+ static matYellowTransparent: THREE.MeshBasicMaterial;
1354
+ static init(): void;
1355
+ }
1356
+ export interface IGizmoObject extends THREE.Object3D {
1357
+ getHovered(): boolean;
1358
+ setHovered(value: boolean): void;
1359
+ getActive(): boolean;
1360
+ setActive(value: boolean): void;
1361
+ dispose(): void;
1362
+ }
1363
+ export class GizmoObject extends THREE.Object3D implements IGizmoObject {
1364
+ protected _meshes: THREE.Mesh[];
1365
+ readonly baseMaterial: THREE.Material;
1366
+ readonly hoverMaterial: THREE.Material;
1367
+ readonly activeMaterial: THREE.Material;
1368
+
1369
+ constructor(_meshes: THREE.Mesh[], baseMaterial?: THREE.Material, hoverMaterial?: THREE.Material, activeMaterial?: THREE.Material);
1370
+ getHovered(): boolean;
1371
+ setHovered(value: boolean): void;
1372
+ getActive(): boolean;
1373
+ setActive(value: boolean): void;
1374
+ dispose(): void;
1375
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1376
+ }
1377
+ export abstract class GizmoAxis extends THREE.Object3D implements IGizmoObject {
1378
+ readonly handle: IGizmoObject;
1379
+ readonly picker?: IGizmoObject;
1380
+ readonly helper?: IGizmoObject;
1381
+ protected _isHovered: boolean;
1382
+ protected _isActive: boolean;
1383
+ protected _plane: THREE.Plane;
1384
+ protected _axisDir: THREE.Vector3;
1385
+ protected _raycaster: THREE.Raycaster;
1386
+ protected _worldPositionStart: THREE.Vector3;
1387
+ protected _worldQuaternionStart: THREE.Quaternion;
1388
+ protected _worldAxisDir: THREE.Vector3;
1389
+ protected _startPoint: THREE.Vector3;
1390
+ protected _endPoint: THREE.Vector3;
1391
+ getActive(): boolean;
1392
+ setActive(value: boolean): void;
1393
+ getHovered(): boolean;
1394
+ setHovered(value: boolean): void;
1395
+ dispose(): void;
1396
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1397
+ abstract moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
1398
+ protected abstract updateGizmoPlane(camera: THREE.Camera): void;
1399
+ protected setStartPt(ndcPos: THREE.Vector2, camera: THREE.Camera): void;
1400
+ }
1401
+ export class GizmoTranslationAxis extends GizmoAxis {
1402
+ readonly handle: IGizmoObject;
1403
+ readonly picker?: IGizmoObject;
1404
+ readonly helper?: IGizmoObject;
1405
+
1406
+ constructor(axisDir: THREE.Vector3, handle: IGizmoObject, picker?: IGizmoObject, helper?: IGizmoObject);
1407
+ moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
1408
+ protected updateGizmoPlane(camera: THREE.Camera): void;
1409
+ }
1410
+ export class GizmoRotationAxis extends GizmoAxis {
1411
+ readonly handle: IGizmoObject;
1412
+ readonly picker?: IGizmoObject;
1413
+ readonly helper?: IGizmoObject;
1414
+ moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
1415
+ protected updateGizmoPlane(camera: THREE.Camera): void;
1416
+ }
1417
+ export class GizmoScaleAxis extends GizmoAxis {
1418
+ readonly handle: IGizmoObject;
1419
+ readonly picker?: IGizmoObject;
1420
+ readonly helper?: IGizmoObject;
1421
+ moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
1422
+ protected updateGizmoPlane(camera: THREE.Camera): void;
1423
+ }
1424
+ export class GizmoControl extends THREE.Object3D {
1425
+
1426
+ constructor(camera: THREE.Camera, navAgent: INavigationAgent);
1427
+ attachTo(object: THREE.Object3D, asChild?: boolean): void;
1428
+ detach(): void;
1429
+ addAxis(axis: GizmoAxis): void;
1430
+ dispose(): void;
1431
+ updateMatrixWorld(force?: boolean): void;
1432
+ updateGizmoOffset(position?: THREE.Vector3, quaternion?: THREE.Quaternion): void;
1433
+ }
1434
+ export enum GizmoAxisDir {
1435
+ NONE = 0,
1436
+ X = 1,
1437
+ Y = 2,
1438
+ Z = 4,
1439
+ XY = 3,
1440
+ YZ = 6,
1441
+ XZ = 5,
1442
+ XYZ = 7
1443
+ }
1444
+ export class GizmoBuilder {
1445
+ static build(camera: THREE.Camera, navAgent: INavigationAgent, translation?: GizmoAxisDir, rotation?: GizmoAxisDir, scale?: GizmoAxisDir): GizmoControl;
1446
+ static buildTranslationAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material, pickerBaseMatrial?: THREE.Material, pickerHoveredMaterial?: THREE.Material, pickerSelectedMaterial?: THREE.Material): GizmoAxis;
1447
+ static buildRotationAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material, pickerBaseMatrial?: THREE.Material, pickerHoveredMaterial?: THREE.Material, pickerSelectedMaterial?: THREE.Material): GizmoAxis;
1448
+ static buildScaleAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material): GizmoAxis;
1035
1449
  }
1036
1450
  export interface CustomSpriteMaterialParameters extends THREE.ShaderMaterialParameters {
1037
1451
  color?: THREE.ColorRepresentation | undefined;
@@ -1090,236 +1504,161 @@ export class CustomSpriteMaterial extends CustomMaterial {
1090
1504
  [uniform: string]: THREE.IUniform<any>;
1091
1505
  }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
1092
1506
  }
1093
-
1094
- export class SettingsNames {
1095
- static TELEMETRY: string;
1096
- static AXES: string;
1097
- static CAMERA_ANIMATION: string;
1098
- static HIDE_SMALL_ELEMENTS_WHEN_NAVIGATING: string;
1099
- static GLOBAL_LIGHT: string;
1100
- static LIGHT_SOURCE: string;
1101
- static ANTI_ALIASING: string;
1102
- static HIDE_SMALL_ELEMENTS_MOVING: string;
1103
- static SMALL_ELEMENT_SIZE: string;
1104
- static LABEL_LINE_LENGTH: string;
1105
- static HIDE_EDGES_WHEN_NAVIGATING: string;
1106
- static DISPLAY_MODE: string;
1107
- static NAVIGATION_CUBE: string;
1108
- static DESIRED_FRAMERATE: string;
1109
- static MANAGE_TIME: string;
1110
- static HOVER_MESHES: string;
1111
- static HOVER_EDGES: string;
1112
- static SELECT_MESHES: string;
1113
- static SELECT_EDGES: string;
1114
- }
1115
- export enum ValueType {
1116
- STRING = 0,
1117
- NUMBER = 1,
1118
- ENUM = 2,
1119
- BOOL = 3
1120
- }
1121
- export interface ISettings {
1122
- changeSetting<T>(name: string, value: T, notify?: boolean, providedData?: any): void;
1123
- getSettingValue<T>(name: string): T;
1124
- }
1125
- export enum BaseSettingsNames {
1126
- TOOLBAR = "toolbar",
1127
- TOOLBAR_POSITION = "toolbarPosition",
1128
- TOOLBAR_CONTENT_ALIGNMENT = "toolbarContent",
1129
- THEME = "theme"
1130
- }
1131
- export class SettingChangedEvent extends Event {
1132
- name: string;
1133
- oldValue: any;
1134
- newValue: any;
1135
- providedData: any;
1136
- }
1137
- export enum SettingsTheme {
1138
- LIGHT_THEME = "ascn-light",
1139
- DARK_THEME = "ascn-dark"
1140
- }
1141
- export const defaultThemeAppearance: string;
1142
- export enum ToolbarPosition {
1143
- TOP_FIXED = "ascn-toolbar-position-fixed-top",
1144
- TOP_FLUENT = "ascn-toolbar-position-top",
1145
- BOTTOM_FIXED = "ascn-toolbar-position-fixed-bottom",
1146
- BOTTOM_FLUENT = "ascn-toolbar-position-bottom"
1147
- }
1148
- export enum ToolbarContentAlignment {
1149
- CENTER = "ascn-toolbar-content-center",
1150
- START = "ascn-toolbar-content-start",
1151
- END = "ascn-toolbar-content-end"
1152
- }
1153
- export interface ToolbarStyle {
1154
- [BaseSettingsNames.TOOLBAR_POSITION]?: ToolbarPosition;
1155
- [BaseSettingsNames.TOOLBAR_CONTENT_ALIGNMENT]?: ToolbarContentAlignment;
1156
- }
1157
- export const defaultToolbarAppearance: ToolbarStyle;
1158
- export type ViewerSettings = Record<string, any>;
1159
- export class ViewerConfiguration {
1160
- settingsPrefix: string;
1161
- appearance: ViewerSettings;
1162
- createConfiguration(configuration: ViewerSettings, origin: ViewerSettings): void;
1163
- mergeConfigurationAndSettings(configuration: ViewerSettings, settings: ISettings): void;
1164
- changeTheme(newTheme: string): void;
1165
- }
1166
- export class Viewer3DConfiguration extends ViewerConfiguration {
1167
- render: ViewerSettings;
1507
+ export class MeshLineGeometry extends THREE.InstancedBufferGeometry {
1508
+ type: string;
1509
+ instanceStart: THREE.BufferAttribute;
1510
+ instanceEnd: THREE.BufferAttribute;
1511
+ instanceColorStart: THREE.BufferAttribute;
1512
+ instanceColorEnd: THREE.BufferAttribute;
1168
1513
 
1169
- constructor(appearance?: ViewerSettings, render?: ViewerSettings);
1170
- }
1171
- export const defaultViewer3DSettings: ViewerSettings;
1172
- export class LoadingSpinner {
1173
- addToDOM(container: HTMLElement): void;
1174
- removeFromDOM(container: HTMLElement): void;
1175
- }
1176
- export class CoreEventTypes {
1177
- static VIEWER_RESIZE_EVENT: string;
1178
- static VIEWER_MOUSE_DOWN_EVENT: string;
1179
- static VIEWER_MOUSE_MOVE_EVENT: string;
1180
- static VIEWER_MOUSE_UP_EVENT: string;
1181
- static VIEWER_MOUSE_LONG_TOUCH_EVENT: string;
1182
- static VIEWER_MOUSE_WHEEL: string;
1183
- static VIEWER_TOUCHSTART_EVENT: string;
1184
- static VIEWER_TOUCHEND_EVENT: string;
1185
- static SETTING_CHANGED_EVENT: string;
1186
- static SETTING_RESET_EVENT: string;
1187
- static SETTING_LANGUAGE_CHANGED_EVENT: string;
1188
- static SETTING_THEME_CHANGED_EVENT: string;
1189
- }
1190
- export namespace ControlState {
1191
- enum State {
1192
- ACTIVE = 0,
1193
- INACTIVE = 1,
1194
- DISABLED = 2
1195
- }
1196
- }
1197
- export interface IControl {
1198
- container: HTMLElement;
1199
- getId(): string;
1200
- setToolTip(tooltipText: string): void;
1201
- setText(text: string): void;
1202
- setState(state: ControlState.State): void;
1514
+ constructor();
1515
+ applyMatrix4(matrix: THREE.Matrix4): this;
1516
+ updatePoint(index: number, point: THREE.Vector3): void;
1517
+ updateColor(index: number, color: Color): void;
1518
+ setPoints(points: THREE.Vector3[]): this;
1519
+ setPositions(array: ArrayLike<number>): this;
1520
+ setColors(array: ArrayLike<number>): this;
1521
+ computeLineDistances(): this;
1522
+ toBufferGeometry(): THREE.BufferGeometry;
1523
+ toWireframeGeometry(): THREE.BufferGeometry;
1524
+ fromWireframeGeometry(geometry: THREE.WireframeGeometry): this;
1525
+ fromEdgesGeometry(geometry: THREE.EdgesGeometry): this;
1526
+ fromMesh(mesh: THREE.Mesh): this;
1527
+ fromLineSegments(lineSegments: THREE.LineSegments): this;
1528
+ computeBoundingBox(): void;
1529
+ computeBoundingSphere(): void;
1203
1530
  }
1204
- export class Control implements IControl {
1205
- container: HTMLElement;
1531
+ export class MeshLine extends THREE.Mesh {
1532
+ type: string;
1533
+ material: MeshLineMaterial;
1534
+ geometry: MeshLineGeometry;
1206
1535
 
1207
- constructor(id: string);
1208
- addClass(cssClass: string): void;
1209
- removeClass(cssClass: string): void;
1210
- getId(): string;
1211
- setToolTip(tooltipText: string): void;
1212
- setText(text: string): void;
1213
- setState(state: ControlState.State): void;
1214
- }
1215
- export interface IMenu {
1216
- controls: IControl[];
1217
- addControl(control: IControl, index?: number): void;
1218
- removeControl(index: number): void;
1219
- }
1220
- interface IToolbarButton {
1221
- button: IControl;
1222
- index: number;
1223
- }
1224
- export class Toolbar extends Control implements IMenu {
1225
- readonly controls: IControl[];
1226
- addControl(control: IControl, index?: number): void;
1227
- removeControl(index: number): void;
1228
- getControls(): IToolbarButton[];
1229
- changeToolbarPosition(direction: ToolbarPosition): void;
1230
- changeToolbarContentAlignment(content: ToolbarContentAlignment): void;
1536
+ constructor(geometry?: MeshLineGeometry, material?: MeshLineMaterial);
1537
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
1231
1538
  }
1232
- export {};
1233
- export class ExtensionBase {
1234
- protected _viewer: ViewerBase;
1235
- protected _options: object;
1539
+ export class CustomSprite extends THREE.Sprite {
1540
+ material: CustomSpriteMaterial;
1236
1541
 
1237
- constructor(viewer3D: ViewerBase, options?: object);
1238
- load(): boolean | Promise<boolean>;
1239
- unload(): boolean;
1240
- activate(): boolean;
1241
- deactivate(): boolean;
1242
- /**
1243
- * Gets the name of the extension.
1244
- * @returns {string} Returns the name of the extension.
1245
- */
1246
- getName(): string;
1247
- addCursorPhantomFromSvg(template: string): void;
1248
- removeCursorPhantom(): void;
1249
- onMouseDown(event: MouseEvent): void;
1250
- onMouseMove(event: MouseEvent): void;
1251
- onMouseUp(event: MouseEvent): void;
1252
- onMouseLongTouch(event: MouseEvent): void;
1253
- onToolbarCreated(toolbar: Toolbar): void;
1254
- onTouchStart(event: TouchEvent): void;
1255
- onTouchEnd(event: TouchEvent): void;
1542
+ constructor(material: CustomSpriteMaterial);
1543
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1544
+ dispose(): void;
1256
1545
  }
1257
- export class ExtensionManager {
1258
- registerExtensionType(extensionId: string, extension: typeof ExtensionBase): boolean;
1259
- unregisterExtensionType(extensionId: string): boolean;
1260
- getExtensionType(extensionId: string): typeof ExtensionBase;
1546
+ export interface LabelSpriteParameters {
1547
+ text?: string | undefined;
1548
+ sizeAttenuation?: boolean | undefined;
1549
+ fontFace?: string | FontFace | undefined;
1550
+ fontSize?: number | undefined;
1551
+ borderColor?: Color | undefined;
1552
+ backgroundColor?: Color | undefined;
1553
+ borderThickness?: number | undefined;
1554
+ borderRadius?: number | undefined;
1555
+ textColor?: Color | undefined;
1556
+ textPadding?: THREE.Vector4Tuple | undefined;
1261
1557
  }
1262
- export const theExtensionManager: ExtensionManager;
1263
- export class ExtensionLoader {
1558
+ export class LabelSprite extends CustomSprite {
1559
+ readonly extraHeightFactor = 1.4;
1560
+
1561
+ constructor(parameters: LabelSpriteParameters);
1562
+ get sizeAttenuation(): boolean;
1563
+ set sizeAttenuation(value: boolean);
1264
1564
  /**
1265
- * Loads the extension with the given id and options.
1266
- *
1267
- * @param {string} extensionId - The string id of the extension.
1268
- * @param {object} options - An optional dictionary of options.
1269
- *
1270
- * @returns {Promise<ExtensionBase>} - Resolves with the extension requested.
1565
+ * @default ''
1271
1566
  */
1272
- loadExtension(extensionId: string, options?: object): Promise<ExtensionBase>;
1567
+ get text(): string;
1568
+ set text(value: string);
1273
1569
  /**
1274
- * Unloads the extension with the given id.
1275
- *
1276
- * @param {string} extensionId - The string id of the extension.
1277
- * @returns {Promise<boolean>} - True if the extension was successfully unloaded.
1278
- */
1279
- unloadExtension(extensionId: string): Promise<boolean>;
1570
+ * @default 'Roboto, sans-serif'
1571
+ */
1572
+ get fontFace(): string | FontFace;
1573
+ set fontFace(value: string | FontFace);
1280
1574
  /**
1281
- * Returns all loaded extensions.
1282
- * @returns {?string[]} - Ids of loaded extensions.
1283
- */
1284
- getExtensions(): string[];
1575
+ * @default 12
1576
+ */
1577
+ get fontSize(): number;
1578
+ set fontSize(value: number);
1285
1579
  /**
1286
- * Returns the loaded extension.
1287
- * @param {string} extensionId - The string id of the extension.
1288
- * @returns {?ExtensionBase} - Extension.
1580
+ * @default 2
1581
+ */
1582
+ get borderThickness(): number;
1583
+ set borderThickness(value: number);
1584
+ /**
1585
+ * @default new Color(0, 0, 0, 1.0)
1586
+ */
1587
+ get borderColor(): Color;
1588
+ set borderColor(value: Color);
1589
+ /**
1590
+ * @default 1
1591
+ */
1592
+ get borderRadius(): number;
1593
+ set borderRadius(value: number);
1594
+ /**
1595
+ * @default new Color(1.0, 1.0, 1.0, 1.0)
1596
+ */
1597
+ get backgroundColor(): Color;
1598
+ set backgroundColor(value: Color);
1599
+ /**
1600
+ * @default new Color(0, 0, 0, 1.0)
1601
+ */
1602
+ get textColor(): Color;
1603
+ set textColor(value: Color);
1604
+ /**
1605
+ * Label text padding: left, top, right, bottom
1606
+ * @default [0, 0, 0, 0]
1289
1607
  */
1290
- getExtension(extensionId: string): ExtensionBase;
1608
+ get textPadding(): THREE.Vector4Tuple;
1609
+ set textPadding(value: THREE.Vector4Tuple);
1610
+ dispose(): void;
1291
1611
  }
1292
- export type ErrorCallback = (message: string) => void;
1293
- export type SuccessCallback = (modelId: any) => void;
1294
- export enum DocumentType {
1295
- UNKNOWN = 0,
1296
- DOCUMENT_2D = 1,
1297
- DOCUMENT_3D = 2
1612
+ export interface MeshPointMaterialParameters extends THREE.ShaderMaterialParameters {
1613
+ sizeAttenuation?: boolean | undefined;
1614
+ discreteClipping?: boolean | undefined;
1298
1615
  }
1299
- export const defaultBaseSettings: ViewerConfiguration;
1300
- export abstract class ViewerBase {
1301
- protected _clientContainer: HTMLElement;
1302
- protected _loadingSpinner: LoadingSpinner;
1303
- protected _documentType: DocumentType;
1304
- protected _configuration: ViewerConfiguration;
1305
- readonly container: HTMLElement;
1306
- readonly extensionsLoader: ExtensionLoader;
1307
- abstract settings: ISettings;
1308
- abstract events: IEventsDispatcher;
1309
- get rootContainer(): HTMLElement;
1310
- getConfiguration(): ViewerConfiguration;
1616
+ export class MeshPointMaterial extends CustomMaterial {
1617
+
1618
+ constructor(parameters?: MeshPointMaterialParameters);
1311
1619
  /**
1312
- *
1313
- * @returns
1620
+ * @default true
1314
1621
  */
1315
- start(): Promise<number>;
1622
+ get discreteClipping(): boolean;
1623
+ set discreteClipping(value: boolean);
1624
+ get resolution(): THREE.Vector2;
1316
1625
  /**
1317
- *
1626
+ * @default true
1318
1627
  */
1319
- finish(): void;
1320
- onPostExtensionLoad(extension: ExtensionBase): void;
1321
- protected loadExtensions(): void;
1322
- protected setThemeFromSettings(): void;
1628
+ sizeAttenuation: boolean;
1629
+ copy(source: MeshPointMaterial): this;
1630
+ protected refreshUniforms(uniforms: {
1631
+ [uniform: string]: THREE.IUniform<any>;
1632
+ }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
1633
+ }
1634
+ export interface MeshPointParamter {
1635
+ point?: THREE.Vector3;
1636
+ color?: Color;
1637
+ size?: number;
1638
+ }
1639
+ export class MeshPoints extends THREE.Mesh {
1640
+ geometry: THREE.InstancedBufferGeometry;
1641
+ material: MeshPointMaterial;
1642
+
1643
+ constructor();
1644
+ /**
1645
+ * @default new Color( 1,1,1,1 )
1646
+ */
1647
+ color: Color;
1648
+ /**
1649
+ * @default 1
1650
+ */
1651
+ pointSize: number;
1652
+ /**
1653
+ * @default new THREE.Vector3(0, 0, 0)
1654
+ */
1655
+ point: THREE.Vector3;
1656
+ addPoint(pointParameter?: MeshPointParamter): number;
1657
+ updatePoint(index: number, pointParameter: MeshPointParamter): void;
1658
+ removePoint(index: number): this;
1659
+ updateAttributes(): void;
1660
+ dispose(): void;
1661
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1323
1662
  }
1324
1663
  export enum IfcType {
1325
1664
  IfcAbsorbedDoseMeasure = 0,
@@ -2549,6 +2888,77 @@ export class ModelElementPropertyValue {
2549
2888
  bool_value?: boolean;
2550
2889
  get value(): unknown;
2551
2890
  }
2891
+ export interface ModelElement {
2892
+ get id(): string;
2893
+ get modelPartId(): string;
2894
+ get parent(): ModelElement | undefined;
2895
+ get type(): string;
2896
+ get name(): string;
2897
+ get children(): ModelElement[];
2898
+ get hasGeometry(): boolean;
2899
+ get viewObject(): ViewObject | undefined;
2900
+ }
2901
+ export interface ModelElementTree {
2902
+ /**
2903
+ *
2904
+ * @param {string|ModelElement} element - element id or element instance
2905
+ * @param callback
2906
+ * @param recursive
2907
+ */
2908
+ enumElementChildren(element: string | ModelElement, callback: (guid: string) => void, recursive?: boolean): void;
2909
+ /**
2910
+ * Gets the root element of the model part
2911
+ * @returns {ModelElement} - model element instance
2912
+ */
2913
+ getRootElement(): ModelElement | undefined;
2914
+ /**
2915
+ * Gets all elements of the model part
2916
+ * @returns array of the model elements
2917
+ */
2918
+ getAllElements(): ModelElement[];
2919
+ /**
2920
+ * Gets model element by id
2921
+ * @param { string } id - model element id
2922
+ * @returns model element;
2923
+ */
2924
+ getElement(id: string): ModelElement | undefined;
2925
+ /**
2926
+ * Checks given element is viewable
2927
+ * @param {string|ModelElement} element - element id or element instance
2928
+ * @returns {boolean}
2929
+ */
2930
+ isViewableElement(element: string | ModelElement): boolean;
2931
+ /**
2932
+ * Checks given element is detached from the root element
2933
+ * @param {string|ModelElement} element - element id or element instance
2934
+ * @returns {boolean}
2935
+ */
2936
+ isDetachedElement(element: string | ModelElement): boolean;
2937
+ /**
2938
+ * Gets the element level in the element tree
2939
+ * @param {string|ModelElement} element - element id or element instance
2940
+ * @returns {number} - level of the element
2941
+ */
2942
+ getChildLevelNumber(element: string | ModelElement): number;
2943
+ }
2944
+ export interface ModelPart {
2945
+ get id(): string;
2946
+ get elementTree(): ModelElementTree;
2947
+ dispose(): void;
2948
+ }
2949
+ export interface DeleteEventListener extends EventListener {
2950
+ (evt: DeleteEvent): void;
2951
+ }
2952
+ export interface DeleteEventFilter {
2953
+ (modelId: string, entityId: string): boolean;
2954
+ }
2955
+ export class DeletionManager {
2956
+ readonly eventsDispatcher: IEventsDispatcher;
2957
+ addDeletionFilter(filter: DeleteEventFilter): void;
2958
+ removeDeletionFilter(filter: DeleteEventFilter): void;
2959
+ delete(objectsToDelete: ModelElementIds[]): boolean;
2960
+ isDeletionEnable(objectsToDelete: ModelElementIds[]): boolean;
2961
+ }
2552
2962
  /**
2553
2963
  * This class describes the coordination model. The coordination model contains parts of the model (aka ModelPart).
2554
2964
  */
@@ -2605,6 +3015,17 @@ export class Model {
2605
3015
  * Shows all elements and model parts
2606
3016
  */
2607
3017
  showAll(): void;
3018
+ /**
3019
+ * Isolate elements of one model part.
3020
+ * @param elementIds - An array of model elements or just a single model element.
3021
+ * @param modelPart - id of the model part that contains the model element id. By default uses the initial model part loaded into the scene.
3022
+ */
3023
+ isolate(elementIds: string[], modelPart: string | ModelPart): void;
3024
+ /**
3025
+ * Isolate group of elements.
3026
+ * @param elements - Array of grouped model elements to isolate.
3027
+ */
3028
+ isolateMultiple(elements: ModelElementIds[]): void;
2608
3029
  /**
2609
3030
  * Selects the array of model elements. You can also pass in a single model element id instead of an array.
2610
3031
  *
@@ -2637,6 +3058,11 @@ export class Model {
2637
3058
  * @returns {ModelElementIds[]} Array of the currently visible model elements.
2638
3059
  */
2639
3060
  getVisibleElements(): ModelElementIds[];
3061
+ /**
3062
+ * Returns the isolated element ids.
3063
+ * @returns {ModelElementIds[]} Array of the currently visible model elements.
3064
+ */
3065
+ getIsolatedElements(): ModelElementIds[];
2640
3066
  /**
2641
3067
  * Sets color to elements
2642
3068
  * @param {string[] | string} elementIds - element or array of elements to change color.
@@ -2645,492 +3071,175 @@ export class Model {
2645
3071
  * @param {number} b - blue
2646
3072
  * @param {number} a - alpha
2647
3073
  * @param {string | ModelPart} modelPart - id of the model part or model part instance containing the elements.
2648
- */
2649
- setColor(elementIds: string[] | string, r: number, g: number, b: number, a: number, modelPart?: string | ModelPart): void;
2650
- /**
2651
- * Resets all changed colors for all elements in all model parts
2652
- * @param {string | ModelPart} modelPart - id of the model part or model part instance.
2653
- */
2654
- clearColors(modelPart?: string | ModelPart): void;
2655
- /**
2656
- *
2657
- * @param {string} elementId - element id
2658
- * @param {string?} modelPart - id of the model part or model part instance.
2659
- * @param {BigInt} version - version of the model in ticks.
2660
- *
2661
- * @returns {ModelElementPropertySet[]} - property data array.
2662
- */
2663
- getElementProperties(elementId: string, modelPart?: string | ModelPart, version?: bigint): ModelElementPropertySet[];
2664
- }
2665
- export class EventTypes extends CoreEventTypes {
2666
- static MODEL_PART_LOADED: string;
2667
- static MODEL_PART_UNLOADED: string;
2668
- static VIRTUAL_ORIGIN_CHANGED: string;
2669
- static SELECTION_CHANGED_EVENT: string;
2670
- static CAMERA_CHANGE_EVENT: string;
2671
- static CAMERA_NAVIGATION_MODE_CHANGED_EVENT: string;
2672
- static RENDER_CLICK_EVENT: string;
2673
- static RENDER_HOVER_EVENT: string;
2674
- static RENDER_DOUBLE_CLICK_EVENT: string;
2675
- static RENDER_DELETE_EVENT: string;
2676
- }
2677
- export class ModelPartEvent extends Event {
2678
- modelPartId: string;
2679
- }
2680
- export class VirtualOriginEvent extends Event {
2681
- virtualOrigin: Point3;
2682
- delta: Point3;
2683
- }
2684
- export class ModelLoadingOptions {
2685
- guid: string;
2686
- isConsolidatedModel?: boolean;
2687
- }
2688
- export let ViewerInstance: Viewer3D;
2689
- export class Viewer3D extends ViewerBase {
2690
- protected _configuration: Viewer3DConfiguration;
2691
- settings: Readonly<ISettings>;
2692
- events: Readonly<IEventsDispatcher>;
3074
+ */
3075
+ setColor(elementIds: string[] | string, r: number, g: number, b: number, a: number, modelPart?: string | ModelPart): void;
2693
3076
  /**
2694
- * Returns general model
2695
- * @returns { Model } - general model
3077
+ * Resets all changed colors for all elements in all model parts
3078
+ * @param {string | ModelPart} modelPart - id of the model part or model part instance.
2696
3079
  */
2697
- get model(): Model;
2698
- get renderView(): IRenderViewer3D;
2699
- get canvas(): HTMLCanvasElement;
2700
- get navigation(): INavigation;
2701
- getConfiguration(): Viewer3DConfiguration;
2702
- start(): Promise<number>;
2703
- finish(): void;
3080
+ clearColors(modelPart?: string | ModelPart): void;
2704
3081
  /**
2705
- * Loads new model part to the viewer
2706
- * @param buffer
2707
- * @param options
2708
- * @param onSuccessCallback
2709
- * @param onErrorCallback
3082
+ * Sets ghost mode for the hidden elements of the model.
3083
+ * @param value - indicates whether ghost mode is on or off.
2710
3084
  */
2711
- loadModelPart(data: ArrayBuffer | string, options: ModelLoadingOptions, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
3085
+ setGhostMode(value: boolean): void;
2712
3086
  /**
2713
- * unloads model part from the viewer
2714
- * @param modelPart - model part id or model part instance
3087
+ *
3088
+ * @param {string} elementId - element id
3089
+ * @param {string?} modelPart - id of the model part or model part instance.
3090
+ * @param {BigInt} version - version of the model in ticks.
3091
+ *
3092
+ * @returns {ModelElementPropertySet[]} - property data array.
2715
3093
  */
2716
- unloadModelPart(modelPart?: string | ModelPart): void;
2717
- setVirtualOrigin(point: Point3): void;
2718
- getVirtualOrigin(): Point3;
3094
+ getElementProperties(elementId: string, modelPart?: string | ModelPart, version?: bigint): ModelElementPropertySet[];
2719
3095
  /**
2720
- * Makes screenshot
2721
- * @param {string} [mimeType=image/png] Image MIME type.
2722
- * @param {number} [qualityArgument=1.0] Image quality to be used for image/jpeg or image/webp formats.
2723
- * @returns Blob object representing render image.
3096
+ * Indicates whether objects can be removed - all objects match at least one deletion filter.
3097
+ * @param elementIds - Array of grouped model elements to delete.
3098
+ * @returns true if objects can be removed.
2724
3099
  */
2725
- makeScreenshot(mimeType?: string, quality?: number): Promise<Blob>;
2726
- setThemeFromSettings(): void;
2727
- }
2728
- export class ViewerToolbar extends Toolbar {
2729
- }
2730
- export class GuiViewer3D extends Viewer3D {
2731
- loadModelPart(buffer: ArrayBuffer, options: ModelLoadingOptions, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
2732
- getToolbar(): ViewerToolbar;
2733
- onPostExtensionLoad(extension: ExtensionBase): void;
2734
- protected getToolbarHeight(): number;
2735
- }
2736
- export abstract class SettingsBase implements ISettings {
2737
- protected _eventDispatcher: IEventsDispatcher;
2738
- protected _storage: ISettingsStorage;
2739
- changeSetting<T>(name: string, value: T, notify?: boolean, providedData?: any): void;
2740
- getSettingValue<T>(name: string): T;
2741
- protected abstract getKeyWithPrefix(key: string): string;
2742
- }
2743
- export type InitializeSuccessCallback = () => void;
2744
- export function coreInitializer(options: InitializerOptions, callback: InitializeSuccessCallback): void;
2745
- export function coreShutdown(): void;
2746
- export function CreateViewer(container: HTMLElement, configuration?: Viewer3DConfiguration): GuiViewer3D;
2747
- export function CreateBasicViewer(container: HTMLElement, configuration?: Viewer3DConfiguration): Viewer3D;
2748
- /**
2749
- * @param options
2750
- * @param callback
2751
- */
2752
- export function Initializer(options: InitializerOptions, callback: InitializeSuccessCallback): void;
2753
- export function shutdown(): void;
2754
- export class Extension extends ExtensionBase {
2755
- protected _viewer: Viewer3D;
2756
-
2757
- constructor(viewer: Viewer3D, options?: object);
2758
- }
2759
- export class GizmoMaterials {
2760
- static gizmoMaterial: THREE.MeshBasicMaterial;
2761
- static matInvisible: THREE.MeshBasicMaterial;
2762
- static matRed: THREE.MeshBasicMaterial;
2763
- static matGreen: THREE.MeshBasicMaterial;
2764
- static matBlue: THREE.MeshBasicMaterial;
2765
- static matYellow: THREE.MeshBasicMaterial;
2766
- static matViolet: THREE.MeshBasicMaterial;
2767
- static matYellowTransparent: THREE.MeshBasicMaterial;
2768
- static init(): void;
2769
- }
2770
- export interface IGizmoObject extends THREE.Object3D {
2771
- getHovered(): boolean;
2772
- setHovered(value: boolean): void;
2773
- getActive(): boolean;
2774
- setActive(value: boolean): void;
2775
- dispose(): void;
2776
- }
2777
- export class GizmoObject extends THREE.Object3D implements IGizmoObject {
2778
- protected _meshes: THREE.Mesh[];
2779
- readonly baseMaterial: THREE.Material;
2780
- readonly hoverMaterial: THREE.Material;
2781
- readonly activeMaterial: THREE.Material;
2782
-
2783
- constructor(_meshes: THREE.Mesh[], baseMaterial?: THREE.Material, hoverMaterial?: THREE.Material, activeMaterial?: THREE.Material);
2784
- getHovered(): boolean;
2785
- setHovered(value: boolean): void;
2786
- getActive(): boolean;
2787
- setActive(value: boolean): void;
2788
- dispose(): void;
2789
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
2790
- }
2791
- export abstract class GizmoAxis extends THREE.Object3D implements IGizmoObject {
2792
- readonly handle: IGizmoObject;
2793
- readonly picker?: IGizmoObject;
2794
- readonly helper?: IGizmoObject;
2795
- protected _isHovered: boolean;
2796
- protected _isActive: boolean;
2797
- protected _plane: THREE.Plane;
2798
- protected _axisDir: THREE.Vector3;
2799
- protected _raycaster: THREE.Raycaster;
2800
- protected _worldPositionStart: THREE.Vector3;
2801
- protected _worldQuaternionStart: THREE.Quaternion;
2802
- protected _worldAxisDir: THREE.Vector3;
2803
- protected _startPoint: THREE.Vector3;
2804
- protected _endPoint: THREE.Vector3;
2805
- getActive(): boolean;
2806
- setActive(value: boolean): void;
2807
- getHovered(): boolean;
2808
- setHovered(value: boolean): void;
2809
- dispose(): void;
2810
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
2811
- abstract moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2812
- protected abstract updateGizmoPlane(camera: THREE.Camera): void;
2813
- protected setStartPt(ndcPos: THREE.Vector2, camera: THREE.Camera): void;
2814
- }
2815
- export class GizmoTranslationAxis extends GizmoAxis {
2816
- readonly handle: IGizmoObject;
2817
- readonly picker?: IGizmoObject;
2818
- readonly helper?: IGizmoObject;
2819
-
2820
- constructor(axisDir: THREE.Vector3, handle: IGizmoObject, picker?: IGizmoObject, helper?: IGizmoObject);
2821
- moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2822
- protected updateGizmoPlane(camera: THREE.Camera): void;
2823
- }
2824
- export class GizmoRotationAxis extends GizmoAxis {
2825
- readonly handle: IGizmoObject;
2826
- readonly picker?: IGizmoObject;
2827
- readonly helper?: IGizmoObject;
2828
- moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2829
- protected updateGizmoPlane(camera: THREE.Camera): void;
2830
- }
2831
- export class GizmoScaleAxis extends GizmoAxis {
2832
- readonly handle: IGizmoObject;
2833
- readonly picker?: IGizmoObject;
2834
- readonly helper?: IGizmoObject;
2835
- moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2836
- protected updateGizmoPlane(camera: THREE.Camera): void;
2837
- }
2838
- export class GizmoControl extends THREE.Object3D {
2839
-
2840
- constructor(camera: THREE.Camera, navAgent: INavigationAgent);
2841
- attachTo(object: THREE.Object3D, asChild?: boolean): void;
2842
- detach(): void;
2843
- addAxis(axis: GizmoAxis): void;
2844
- dispose(): void;
2845
- updateMatrixWorld(force?: boolean): void;
2846
- updateGizmoOffset(position?: THREE.Vector3, quaternion?: THREE.Quaternion): void;
2847
- }
2848
- export enum GizmoAxisDir {
2849
- NONE = 0,
2850
- X = 1,
2851
- Y = 2,
2852
- Z = 4,
2853
- XY = 3,
2854
- YZ = 6,
2855
- XZ = 5,
2856
- XYZ = 7
2857
- }
2858
- export class GizmoBuilder {
2859
- static build(camera: THREE.Camera, navAgent: INavigationAgent, translation?: GizmoAxisDir, rotation?: GizmoAxisDir, scale?: GizmoAxisDir): GizmoControl;
2860
- static buildTranslationAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material, pickerBaseMatrial?: THREE.Material, pickerHoveredMaterial?: THREE.Material, pickerSelectedMaterial?: THREE.Material): GizmoAxis;
2861
- static buildRotationAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material, pickerBaseMatrial?: THREE.Material, pickerHoveredMaterial?: THREE.Material, pickerSelectedMaterial?: THREE.Material): GizmoAxis;
2862
- static buildScaleAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material): GizmoAxis;
2863
- }
2864
- export interface LabelSpriteParameters {
2865
- text?: string | undefined;
2866
- sizeAttenuation?: boolean | undefined;
2867
- fontFace?: string | FontFace | undefined;
2868
- fontSize?: number | undefined;
2869
- borderColor?: Color | undefined;
2870
- backgroundColor?: Color | undefined;
2871
- borderThickness?: number | undefined;
2872
- borderRadius?: number | undefined;
2873
- textColor?: Color | undefined;
2874
- textPadding?: THREE.Vector4Tuple | undefined;
2875
- }
2876
- export class LabelSprite extends THREE.Sprite {
2877
- readonly extraHeightFactor = 1.4;
2878
- material: CustomSpriteMaterial;
2879
-
2880
- constructor(parameters: LabelSpriteParameters);
2881
- get sizeAttenuation(): boolean;
2882
- set sizeAttenuation(value: boolean);
3100
+ canDelete(elementIds: ModelElementIds[]): boolean;
2883
3101
  /**
2884
- * @default ''
3102
+ * Raise DELETE_OBJECTS_EVENT on passed objects, if all object match at least one deletion filter.
3103
+ * @param elementIds - Array of grouped model elements to delete.
3104
+ * @returns true on success.
2885
3105
  */
2886
- get text(): string;
2887
- set text(value: string);
3106
+ delete(elementIds: ModelElementIds[]): boolean;
2888
3107
  /**
2889
- * @default 'Roboto, sans-serif'
2890
- */
2891
- get fontFace(): string | FontFace;
2892
- set fontFace(value: string | FontFace);
3108
+ * Add deletion filter.
3109
+ * @param filter - filter to add.
3110
+ */
3111
+ addDeletionFilter(filter: DeleteEventFilter): void;
2893
3112
  /**
2894
- * @default 12
2895
- */
2896
- get fontSize(): number;
2897
- set fontSize(value: number);
3113
+ * Remove deletion filter.
3114
+ * @param filter - filter to remove.
3115
+ */
3116
+ removeDeletionFilter(filter: DeleteEventFilter): void;
3117
+ }
3118
+ export interface INavigation {
2898
3119
  /**
2899
- * @default 2
2900
- */
2901
- get borderThickness(): number;
2902
- set borderThickness(value: number);
3120
+ * Register navigation tool.
3121
+ */
3122
+ registerNavigation(navigationTool: INavigationTool): void;
2903
3123
  /**
2904
- * @default new Color(0, 0, 0, 1.0)
2905
- */
2906
- get borderColor(): Color;
2907
- set borderColor(value: Color);
3124
+ * Unregister navigation tool.
3125
+ */
3126
+ unregisterNavigation(navigationTool: INavigationTool): void;
2908
3127
  /**
2909
- * @default 1
2910
- */
2911
- get borderRadius(): number;
2912
- set borderRadius(value: number);
3128
+ * Activate or deactivate registered navigation tool.
3129
+ * NB: There can be only one active navigation tool at time.
3130
+ */
3131
+ setActive(navigationToolName: string, isActive: boolean): void;
2913
3132
  /**
2914
- * @default new Color(1.0, 1.0, 1.0, 1.0)
2915
- */
2916
- get backgroundColor(): Color;
2917
- set backgroundColor(value: Color);
3133
+ * Get active navigation tool.
3134
+ */
3135
+ getActiveNavigation(): INavigationTool | null;
2918
3136
  /**
2919
- * @default new Color(0, 0, 0, 1.0)
2920
- */
2921
- get textColor(): Color;
2922
- set textColor(value: Color);
3137
+ * Get navigation agent.
3138
+ */
3139
+ getNavigationAgent(): INavigationAgent;
2923
3140
  /**
2924
- * Label text padding: left, top, right, bottom
2925
- * @default [0, 0, 0, 0]
3141
+ * Gets navigation area rectangle
3142
+ */
3143
+ getNavigationArea(): DOMRect;
3144
+ /**
3145
+ * Sets the camera parameters.
3146
+ */
3147
+ setCameraParameters(params: CameraParameters): void;
3148
+ /**
3149
+ * Gets the camera parameters.
3150
+ */
3151
+ getCameraParameters(): CameraParameters;
3152
+ /**
3153
+ * Gets the camera control.
2926
3154
  */
2927
- get textPadding(): THREE.Vector4Tuple;
2928
- set textPadding(value: THREE.Vector4Tuple);
2929
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
2930
- dispose(): void;
2931
- }
2932
- export interface MeshPointMaterialParameters extends THREE.ShaderMaterialParameters {
2933
- sizeAttenuation?: boolean | undefined;
2934
- discreteClipping?: boolean | undefined;
2935
- }
2936
- export class MeshPointMaterial extends CustomMaterial {
2937
-
2938
- constructor(parameters?: MeshPointMaterialParameters);
3155
+ getCameraControl(): ICameraControl;
2939
3156
  /**
2940
- * @default true
3157
+ * Gets the Three.js camera.
2941
3158
  */
2942
- get discreteClipping(): boolean;
2943
- set discreteClipping(value: boolean);
2944
- get resolution(): THREE.Vector2;
3159
+ getCamera(): THREE.Camera;
2945
3160
  /**
2946
- * @default true
3161
+ * Fits camera to objects by IDs.
3162
+ * @param {string[] | string} elementIds - element or array of elements
3163
+ * @param {string | ModelPart} modelPart - the model part id or the model part instance containing the elements.
3164
+ * @param {boolean} immediate - true to avoid the default transition.
3165
+ * @returns
2947
3166
  */
2948
- sizeAttenuation: boolean;
2949
- copy(source: MeshPointMaterial): this;
2950
- protected refreshUniforms(uniforms: {
2951
- [uniform: string]: THREE.IUniform<any>;
2952
- }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
2953
- }
2954
- export interface MeshPointParamter {
2955
- point?: THREE.Vector3;
2956
- color?: Color;
2957
- size?: number;
2958
- }
2959
- export class MeshPoints extends THREE.Mesh {
2960
- geometry: THREE.InstancedBufferGeometry;
2961
- material: MeshPointMaterial;
2962
-
2963
- constructor();
3167
+ fitToView(elementIds: string[] | string, modelPart: string | ModelPart, immediate?: boolean): void;
2964
3168
  /**
2965
- * @default new Color( 1,1,1,1 )
2966
- */
2967
- color: Color;
3169
+ * Sets the camera pivot point.
3170
+ */
3171
+ setPivotPoint(point: Point3): void;
2968
3172
  /**
2969
- * @default 1
2970
- */
2971
- pointSize: number;
3173
+ * Gets the camera pivot point.
3174
+ */
3175
+ getPivotPoint(): Point3;
2972
3176
  /**
2973
- * @default new THREE.Vector3(0, 0, 0)
2974
- */
2975
- point: THREE.Vector3;
2976
- addPoint(pointParameter?: MeshPointParamter): number;
2977
- updatePoint(index: number, pointParameter: MeshPointParamter): void;
2978
- removePoint(index: number): this;
2979
- updateAttributes(): void;
2980
- dispose(): void;
2981
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
2982
- }
2983
- export class DeviceEventHandler {
2984
- static isMobile: boolean;
2985
- static eventStartType: string;
2986
- static eventProcessType: string;
2987
- static eventEndType: string;
2988
- }
2989
- export interface IWindowStyle {
2990
- width: string;
2991
- height: string;
2992
- left: string;
2993
- top: string;
2994
- }
2995
- export interface IWindowStateOptions {
2996
- saveKey: string;
2997
- restoreWindowSize?: boolean;
2998
- restoreWindowPosition?: boolean;
2999
- }
3000
- export class WindowStater {
3001
- get windowStylesState(): IWindowStyle;
3002
- get windowOptionsState(): IWindowStateOptions;
3003
- restore(): void;
3004
- saveWindowState(): void;
3005
- }
3006
- export class Resizer {
3007
-
3008
- constructor(resizableContainer: HTMLElement, containerToRestriction: HTMLElement, elementAnchor?: HTMLElement, windowStater?: WindowStater);
3009
- get windowState(): IWindowStyle | null;
3177
+ * Reset the camera pivot point.
3178
+ */
3179
+ resetPivotPoint(): void;
3010
3180
  }
3011
- export class Dragger {
3012
-
3013
- constructor(allowedDraggableElement: HTMLElement, draggableContainer: HTMLElement, containerToRestriction: HTMLElement, windowStater?: WindowStater);
3014
- get windowState(): IWindowStyle | null;
3181
+ export class ModelLoadingOptions {
3182
+ guid: string;
3183
+ isConsolidatedModel?: boolean;
3015
3184
  }
3016
- export class Button extends Control {
3017
-
3018
- constructor(id: string);
3019
- setIsChecked(value: boolean): void;
3020
- setState(state: ControlState.State): boolean;
3021
- setText(text: string): void;
3022
- getState(): ControlState.State;
3023
- setIcon(iconClassName: string): void;
3024
- setFromSvgTemlate(template: string): void;
3185
+ export let ViewerInstance: Viewer3D;
3186
+ export class Viewer3D extends ViewerBase {
3187
+ protected _configuration: Viewer3DConfiguration;
3188
+ settings: Readonly<ISettings>;
3189
+ events: Readonly<IEventsDispatcher>;
3025
3190
  /**
3026
- * Override this method to be notified when the user clicks on the button.
3027
- * @param {MouseEvent} event
3191
+ * Returns general model
3192
+ * @returns { Model } - general model
3028
3193
  */
3029
- onClick: (event: MouseEvent) => void;
3194
+ get model(): Model;
3195
+ get renderView(): IRenderViewer3D;
3196
+ get canvas(): HTMLCanvasElement;
3197
+ get navigation(): INavigation;
3198
+ getConfiguration(): Viewer3DConfiguration;
3199
+ start(): Promise<number>;
3200
+ finish(): void;
3030
3201
  /**
3031
- * Override this method to be notified when the mouse enters the button.
3032
- * @param {MouseEvent} event
3202
+ * Loads new model part to the viewer
3203
+ * @param buffer
3204
+ * @param options
3205
+ * @param onSuccessCallback
3206
+ * @param onErrorCallback
3033
3207
  */
3034
- onMouseOver: (event: MouseEvent) => void;
3208
+ loadModelPart(data: ArrayBuffer | string, options: ModelLoadingOptions, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
3035
3209
  /**
3036
- * Override this method to be notified when the mouse leaves the button.
3037
- * @param {MouseEvent} event
3210
+ * unloads model part from the viewer
3211
+ * @param modelPart - model part id or model part instance
3038
3212
  */
3039
- onMouseOut: (event: MouseEvent) => void;
3040
- }
3041
- export namespace Button {
3042
- enum Event {
3043
- STATE_CHANGED = "Button.StateChanged",
3044
- CLICK = "click"
3045
- }
3046
- }
3047
- export class SubMenu implements IMenu {
3048
- readonly controls: IControl[];
3049
- set selectedIndex(value: number);
3050
- get selectedIndex(): number;
3051
- setEnabled(index: number, value: boolean): void;
3052
- addControl(control: IControl, index?: number): void;
3053
- removeControl(index?: number): void;
3054
- clearList(): void;
3055
- changeControl(item: IControl, index: number): void;
3056
- getControlsCount(): number;
3057
- }
3058
- export class ComboButton extends Control {
3059
-
3060
- constructor(id: string, selectedIndex?: number);
3061
- get subMenu(): SubMenu;
3213
+ unloadModelPart(modelPart?: string | ModelPart): void;
3214
+ setVirtualOrigin(point: Point3): Promise<void>;
3215
+ getVirtualOrigin(): Point3;
3062
3216
  /**
3063
- * Override this method to be notified when the user clicks on the button.
3064
- * @param {MouseEvent} event
3217
+ * Makes screenshot
3218
+ * @param {string} [mimeType=image/png] Image MIME type.
3219
+ * @param {number} [qualityArgument=1.0] Image quality to be used for image/jpeg or image/webp formats.
3220
+ * @returns Blob object representing render image.
3065
3221
  */
3066
- onClick: (event: PointerEvent) => void;
3067
- onOpen: () => void;
3068
- onClose: () => void;
3069
- setState(state: ControlState.State): boolean;
3070
- setText(text: string): void;
3071
- setFromSvgTemlate(template: string): void;
3072
- }
3073
- export class Checkbox {
3074
-
3075
- constructor(id: string, checked: boolean, disabled: boolean, placeholder: string);
3076
- get checked(): boolean;
3077
- set checked(value: boolean);
3078
- get disabled(): boolean;
3079
- set disabled(value: boolean);
3080
- get label(): HTMLLabelElement;
3081
- onChange(value: boolean): void;
3082
- createElement(): Element;
3083
- }
3084
- interface ISelectItem {
3085
- text: string;
3086
- value: string;
3087
- }
3088
- export class Select {
3089
-
3090
- constructor(id: string, items: ISelectItem[], placeholder: string);
3091
- get select(): HTMLElement;
3092
- get disabled(): boolean;
3093
- set disabled(value: boolean);
3094
- get selectedIndex(): number;
3095
- set selectedIndex(value: number);
3096
- get placeholder(): string;
3097
- set placeholder(value: string);
3098
- get label(): HTMLElement;
3099
- get previousSelectedIndex(): number;
3100
- onChange({ index, value }: {
3101
- index: any;
3102
- value: any;
3103
- }): void;
3104
- update(array: ISelectItem[], selectedIndex?: number): void;
3222
+ makeScreenshot(mimeType?: string, quality?: number): Promise<Blob>;
3223
+ setThemeFromSettings(): void;
3105
3224
  }
3106
- export {};
3107
- interface ElementClass {
3108
- panelClassName?: string;
3109
- contentClassName?: string;
3110
- headerClassName?: string;
3225
+ export class GuiViewer3D extends Viewer3D {
3226
+ loadModelPart(buffer: ArrayBuffer, options: ModelLoadingOptions, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
3227
+ getToolbar(): ViewerToolbar;
3228
+ onPostExtensionLoad(extension: ExtensionBase): void;
3229
+ protected getToolbarHeight(): number;
3111
3230
  }
3112
- export class Dialog extends Control {
3113
- responseDialog: (state?: boolean) => void;
3231
+ export function CreateViewer(container: HTMLElement, configuration?: Viewer3DConfiguration): GuiViewer3D;
3232
+ export function CreateBasicViewer(container: HTMLElement, configuration?: Viewer3DConfiguration): Viewer3D;
3233
+ /**
3234
+ * @param options
3235
+ * @param callback
3236
+ */
3237
+ export function Initializer(options: InitializerOptions, callback: InitializeSuccessCallback): void;
3238
+ export function shutdown(): void;
3239
+ export class Extension extends ExtensionBase {
3240
+ protected _viewer: Viewer3D;
3114
3241
 
3115
- constructor(id: string, panelToAttach: HTMLElement);
3116
- get dialog(): HTMLElement;
3117
- get dialogContent(): HTMLElement;
3118
- get resizable(): boolean;
3119
- setDialogContent(value: HTMLElement): Dialog;
3120
- setHeader(value: HTMLElement): Dialog;
3121
- setCaption(value: string): Dialog;
3122
- setSvgIcon(template: string): Dialog;
3123
- setFooter(value: HTMLElement): Dialog;
3124
- setDialogElementClassNames(value: ElementClass): Dialog;
3125
- setResizable(value: boolean): Dialog;
3126
- setWindowOptions(value: IWindowStateOptions): Dialog;
3127
- setDraggable(value: boolean): Dialog;
3128
- setCloseble(value: boolean): Dialog;
3129
- openDialog(x?: number, y?: number): HTMLElement;
3130
- destroyDialog(): void;
3131
- isDialogShown(): boolean;
3132
- subscribe(fn: (state: boolean) => void): void;
3242
+ constructor(viewer: Viewer3D, options?: object);
3133
3243
  }
3134
- export {};
3135
3244
 
3136
3245
  }