@pilotdev/pilot-web-3d 23.0.8 → 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 +1321 -1279
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -26,12 +26,16 @@ export enum UpdateType {
26
26
  }
27
27
  export const zeroGuid = "00000000-0000-0000-0000-000000000000";
28
28
  export class Color {
29
- r: number;
30
- g: number;
31
- b: number;
32
- a: number;
33
29
 
34
30
  constructor(r: number, g: number, b: number, a: number);
31
+ get r(): number;
32
+ set r(value: number);
33
+ get g(): number;
34
+ set g(value: number);
35
+ get b(): number;
36
+ set b(value: number);
37
+ get a(): number;
38
+ set a(value: number);
35
39
  static fromThreeColor(color: THREE.Color, alpha?: number): Color;
36
40
  static fromColorRepresentation(representation: THREE.ColorRepresentation): Color;
37
41
  static fromMaterial(material: THREE.Material): Color;
@@ -47,7 +51,10 @@ export abstract class ViewObject extends THREE.Object3D {
47
51
  protected _isHovered: boolean;
48
52
  protected _isVisible: boolean;
49
53
  protected _isHidden: boolean;
54
+ protected _isDecomposed: boolean;
55
+ protected _isGhosted: boolean;
50
56
  protected _originalColor: Color;
57
+ protected _color: Color;
51
58
  /**
52
59
  * model element entity guid
53
60
  * @default zeroGuid
@@ -73,8 +80,14 @@ export abstract class ViewObject extends THREE.Object3D {
73
80
  remove(...object: THREE.Object3D<THREE.Event>[]): this;
74
81
  updateMatrixWorld(force?: boolean): void;
75
82
  updateWorldMatrix(updateParents: boolean, updateChildren: boolean): void;
83
+ updateMatrix(): void;
84
+ applyMatrix4(matrix: THREE.Matrix4): void;
85
+ /** Decompose object matrix to position, rotation and scale vectors or free these vectors to reduce memory consumption. */
86
+ setDecomposed(value: boolean): void;
87
+ /**Check if object is decomposed: have valid position, quaternion, scale, up vectors */
88
+ isDecomposed(): boolean;
76
89
  /**Set visibility of this object */
77
- setVisible(iVal: boolean): void;
90
+ setVisible(value: boolean): void;
78
91
  /**Get visibility of this object */
79
92
  isVisible(): boolean;
80
93
  /**Hide this object from the scene */
@@ -82,35 +95,44 @@ export abstract class ViewObject extends THREE.Object3D {
82
95
  /**Check if object is hidden from the scene */
83
96
  isHidden(): boolean;
84
97
  /**Select this object */
85
- setSelected(iVal: boolean): void;
98
+ setSelected(value: boolean): void;
86
99
  /**Check if object is selected */
87
100
  isSelected(): boolean;
88
101
  /**Hover this object */
89
- setHovered(iVal: boolean): void;
102
+ setHovered(value: boolean): void;
90
103
  /**Check if object is hovered */
91
104
  isHovered(): boolean;
92
105
  /**Set color for this object */
93
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;
94
113
  /**Reset color to original color for this object */
95
114
  resetColor(): void;
96
115
  /**Gets original color for this object */
97
116
  getOriginalColor(): Color;
117
+ getRelativePosition(absPosition: THREE.Vector3): THREE.Vector3;
98
118
  /**Dispose geometry */
99
119
  dispose(): void;
100
120
  /**User defined bounding box calculation for this object. Returns an empty THREE.Box3 by default.*/
101
121
  getBoundingBox(): THREE.Box3;
102
- /**User defined raycast implementation for this object. Emty method by default. */
122
+ /**User defined raycast implementation for this object. Empty method by default. */
103
123
  raycast(iRaycaster: THREE.Raycaster, oIntersects: THREE.Intersection[]): void;
104
- /**User defined hover behavior for this object. Emty method by default. */
105
- protected setHoveredForObject(iVal: boolean): void;
106
- /**User defined selection behavior for this object. Emty method by default. */
107
- 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;
108
128
  /**User defined hide behavior for this object. Has default implementation used on the MainScene only. */
109
129
  protected setHiddenForObject(iVal: boolean): void;
110
130
  /**User defined visibility behavior for this object. Sets THREE.Object3D visibility by default. */
111
- protected setVisibleForObject(iVal: boolean): void;
112
- /**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. */
113
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;
114
136
  /**Reset color to the original color for this object. */
115
137
  protected resetColorForObject(): void;
116
138
  /**
@@ -126,355 +148,470 @@ export class ModelElementIds {
126
148
  modelPartId: string;
127
149
  elementIds: string[];
128
150
  }
129
- export abstract class CustomMaterial extends THREE.ShaderMaterial {
151
+ export class InitializerOptions {
152
+ libList?: string[];
153
+ language?: string;
154
+ }
155
+ class Global {
156
+ G: any;
157
+ RESOURCE_ROOT: string;
158
+ initializeResourceRoot(options: InitializerOptions): void;
159
+ getResourceUrl(resourceRelativePath: string): string;
160
+ }
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;
171
+ }
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;
180
+ }
181
+ export interface IWindowStyle {
182
+ width: string;
183
+ height: string;
184
+ left: string;
185
+ top: string;
186
+ }
187
+ export interface IWindowStateOptions {
188
+ saveKey: string;
189
+ restoreWindowSize?: boolean;
190
+ restoreWindowPosition?: boolean;
191
+ }
192
+ export class WindowStater {
193
+ get windowStylesState(): IWindowStyle;
194
+ get windowOptionsState(): IWindowStateOptions;
195
+ restore(): void;
196
+ saveWindowState(): void;
197
+ }
198
+ export class Resizer {
130
199
 
131
- constructor();
132
- copy(source: CustomMaterial): this;
133
- protected refreshUniforms(uniforms: {
134
- [uniform: string]: THREE.IUniform;
135
- }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
136
- protected onBeforeCompileCallback(shader: THREE.Shader): void;
137
- protected refreshTransformUniform(map: THREE.Texture, uniform: THREE.IUniform): void;
138
- protected onBeforeRender(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.BufferGeometry, material: THREE.Material, group: THREE.Group): void;
200
+ constructor(resizableContainer: HTMLElement, containerToRestriction: HTMLElement, elementAnchor?: HTMLElement, windowStater?: WindowStater);
201
+ get windowState(): IWindowStyle | null;
139
202
  }
140
- export interface CustomMeshLambertMaterialParameters extends THREE.ShaderMaterialParameters, THREE.MeshLambertMaterialParameters {
141
- instancing?: boolean | undefined;
142
- instancingColor?: boolean | undefined;
203
+ export class Dragger {
204
+
205
+ constructor(allowedDraggableElement: HTMLElement, draggableContainer: HTMLElement, containerToRestriction: HTMLElement, windowStater?: WindowStater);
206
+ get windowState(): IWindowStyle | null;
143
207
  }
144
- export class CustomMeshLambertMaterial extends CustomMaterial {
145
- type: string;
208
+ export namespace Viewer3DIcons {
209
+ const VIEWER_SETTINGS_ICON: string;
210
+ const VIEWER_MODEL_BROWSER_ICON: string;
211
+ const VIEWER_FULL_SCREEN_ICON: string;
212
+ const VIEWER_COLLAPSE_ICON: string;
213
+ const VIEWER_ELEMENT_PROPERTIES_ICON: string;
214
+ const VIEWER_ADD_CLIPPING_PLANE_ICON: string;
215
+ const VIEWER_CLIPPING_FLIP_ICON: string;
216
+ const VIEWER_DELETE_CLIPPING_PLANE_ICON: string;
217
+ const VIEWER_CLIPPING_CUBE_ICON: string;
218
+ const VIEWER_ADD_REMARK_ICON: string;
219
+ const VIEWER_MEASUREMENT_EDGE_ICON: string;
220
+ const VIEWER_MEASUREMENT_PLANE_ICON: string;
221
+ const VIEWER_MEASUREMENT_DIMENSION_ICON: string;
222
+ }
223
+ export namespace ViewerGeneralIcons {
224
+ const CLOSE: string;
225
+ const STRETCH_WINDOW: string;
226
+ const EXPAND_TREE: string;
227
+ const COLLAPSE_TREE: string;
228
+ const ARROW_DROP_DOWN: string;
229
+ const ARROW_DROP_RIGHT: string;
230
+ const CIRCLE_ICON: string;
231
+ const SHOW: string;
232
+ const HIDE: string;
233
+ const TRASH: string;
234
+ const ARROW_DR: string;
235
+ }
236
+ export namespace Viewer2DIcons {
237
+ const REMARK_CIRCLE_ICON: string;
238
+ const ZOOM_IN: string;
239
+ const ZOOM_OUT: string;
240
+ const FIT_WIDTH: string;
241
+ }
242
+ export interface ISettings {
243
+ changeSetting<T>(name: string, value: T, notify?: boolean, providedData?: any): void;
244
+ getSettingValue<T>(name: string): T;
245
+ }
246
+ export enum BaseSettingsNames {
247
+ TOOLBAR = "toolbar",
248
+ TOOLBAR_POSITION = "toolbarPosition",
249
+ TOOLBAR_CONTENT_ALIGNMENT = "toolbarContent",
250
+ THEME = "theme"
251
+ }
252
+ export class SettingChangedEvent extends Event {
253
+ name: string;
254
+ oldValue: any;
255
+ newValue: any;
256
+ providedData: any;
257
+ }
258
+ export class LoadingSpinner {
259
+ addToDOM(container: HTMLElement): void;
260
+ removeFromDOM(container: HTMLElement): void;
261
+ }
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;
278
+ }
279
+ export class ExtensionEvent extends Event {
280
+ extensionName: string;
281
+ }
282
+ export namespace ControlState {
283
+ enum State {
284
+ ACTIVE = 0,
285
+ INACTIVE = 1,
286
+ DISABLED = 2
287
+ }
288
+ }
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;
295
+ }
296
+ export class Control implements IControl {
297
+ container: HTMLElement;
146
298
 
147
- constructor(parameters?: CustomMeshLambertMaterialParameters);
148
- /**
149
- * @default false
150
- */
151
- get instancing(): boolean;
152
- set instancing(value: boolean);
153
- /**
154
- * @default false
155
- */
156
- get instancingColor(): boolean;
157
- set instancingColor(value: boolean);
158
- /**
159
- * @default new THREE.Color( 0xffffff )
160
- */
161
- color: THREE.Color;
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;
306
+ }
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"
312
+ }
313
+ export enum ToolbarContentAlignment {
314
+ CENTER = "ascn-toolbar-content-center",
315
+ START = "ascn-toolbar-content-start",
316
+ END = "ascn-toolbar-content-end"
317
+ }
318
+ export interface ToolbarStyle {
319
+ [BaseSettingsNames.TOOLBAR_POSITION]?: ToolbarPosition;
320
+ [BaseSettingsNames.TOOLBAR_CONTENT_ALIGNMENT]?: ToolbarContentAlignment;
321
+ }
322
+ export const defaultToolbarAppearance: ToolbarStyle;
323
+ export interface IMenu {
324
+ controls: IControl[];
325
+ addControl(control: IControl, index?: number): void;
326
+ removeControl(index: number): void;
327
+ }
328
+ interface IToolbarButton {
329
+ button: IControl;
330
+ index: number;
331
+ }
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;
339
+ }
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;
162
350
  /**
163
- * @default null
164
- */
165
- bumpMap: THREE.Texture | null;
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;
364
+ }
365
+ export class ExtensionManager {
366
+ registerExtensionType(extensionId: string, extension: typeof ExtensionBase): boolean;
367
+ unregisterExtensionType(extensionId: string): boolean;
368
+ getExtensionType(extensionId: string): typeof ExtensionBase;
369
+ }
370
+ export const theExtensionManager: ExtensionManager;
371
+ export class ExtensionLoader {
166
372
  /**
167
- * @default 1
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.
168
379
  */
169
- bumpScale: number;
380
+ loadExtension(extensionId: string, options?: object): Promise<ExtensionBase>;
170
381
  /**
171
- * @default null
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.
172
386
  */
173
- displacementMap: THREE.Texture | null;
387
+ unloadExtension(extensionId: string): Promise<boolean>;
174
388
  /**
175
- * @default 1
389
+ * Returns all loaded extensions.
390
+ * @returns {?string[]} - Ids of loaded extensions.
176
391
  */
177
- displacementScale: number;
392
+ getExtensions(): string[];
178
393
  /**
179
- * @default 0
394
+ * Returns the loaded extension.
395
+ * @param {string} extensionId - The string id of the extension.
396
+ * @returns {?ExtensionBase} - Extension.
180
397
  */
181
- displacementBias: number;
182
- /**
183
- * @default new THREE.Color( 0x000000 )
184
- */
185
- emissive: THREE.Color;
186
- /**
187
- * @default 1
188
- */
189
- emissiveIntensity: number;
190
- /**
191
- * @default null
192
- */
193
- emissiveMap: THREE.Texture | null;
194
- /**
195
- * @default false
196
- */
197
- flatShading: boolean;
198
- /**
199
- * @default null
200
- */
201
- map: THREE.Texture | null;
202
- /**
203
- * @default null
204
- */
205
- lightMap: THREE.Texture | null;
206
- /**
207
- * @default 1
208
- */
209
- lightMapIntensity: number;
210
- /**
211
- * @default null
212
- */
213
- normalMap: THREE.Texture | null;
214
- normalMapType: THREE.NormalMapTypes;
215
- /**
216
- * @default new THREE.Vector2( 1, 1 )
217
- */
218
- normalScale: THREE.Vector2;
219
- /**
220
- * @default null
221
- */
222
- aoMap: THREE.Texture | null;
223
- /**
224
- * @default 1
225
- */
226
- aoMapIntensity: number;
227
- /**
228
- * @default null
229
- */
230
- specularMap: THREE.Texture | null;
231
- /**
232
- * @default null
233
- */
234
- alphaMap: THREE.Texture | null;
235
- /**
236
- * @default null
237
- */
238
- envMap: THREE.Texture | null;
239
- /**
240
- * @default THREE.MultiplyOperation
241
- */
242
- combine: THREE.Combine;
243
- /**
244
- * @default 1
245
- */
246
- reflectivity: number;
247
- /**
248
- * @default 0.98
249
- */
250
- refractionRatio: number;
251
- /**
252
- * @default false
253
- */
254
- wireframe: boolean;
255
- /**
256
- * @default 1
257
- */
258
- wireframeLinewidth: number;
259
- /**
260
- * @default 'round'
261
- */
262
- wireframeLinecap: string;
263
- /**
264
- * @default 'round'
265
- */
266
- wireframeLinejoin: string;
267
- /**
268
- * Whether the material is affected by fog. Default is true.
269
- * @default fog
270
- */
271
- fog: boolean;
272
- protected refreshUniformsCommon(uniforms: {
273
- [uniform: string]: THREE.IUniform;
274
- }, material: CustomMeshLambertMaterial, renderer: THREE.WebGLRenderer): void;
275
- protected refreshUniforms(uniforms: {
276
- [uniform: string]: THREE.IUniform<any>;
277
- }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
278
- copy(source: CustomMeshLambertMaterial): this;
398
+ getExtension(extensionId: string): ExtensionBase;
279
399
  }
280
- export interface CustomLineMaterialParameters extends THREE.ShaderMaterialParameters {
281
- instancing?: boolean | undefined;
282
- instancingColor?: boolean | undefined;
283
- color?: THREE.ColorRepresentation | undefined;
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;
284
407
  }
285
- export class CustomLineMaterial extends CustomMaterial {
286
- type: string;
287
-
288
- constructor(parameters?: CustomLineMaterialParameters);
289
- /**
290
- * @default false
291
- */
292
- get instancing(): boolean;
293
- set instancing(value: boolean);
408
+ export enum SettingsTheme {
409
+ LIGHT_THEME = "ascn-light",
410
+ DARK_THEME = "ascn-dark"
411
+ }
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;
420
+ }
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
427
+ }
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;
294
440
  /**
295
- * @default false
441
+ *
442
+ * @returns
296
443
  */
297
- get instancingColor(): boolean;
298
- set instancingColor(value: boolean);
444
+ start(): Promise<number>;
299
445
  /**
300
- * @default 0xffffff
446
+ *
301
447
  */
302
- color: THREE.Color;
303
- copy(source: CustomLineMaterial): this;
304
- protected refreshUniforms(uniforms: {
305
- [uniform: string]: THREE.IUniform;
306
- }, material: CustomLineMaterial, renderer: THREE.WebGLRenderer): 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;
307
454
  }
308
- export interface MeshLineMaterialParameters extends THREE.ShaderMaterialParameters {
309
- color?: THREE.ColorRepresentation | undefined;
310
- dashed?: boolean | undefined;
311
- dashScale?: number | undefined;
312
- dashSize?: number | undefined;
313
- dashOffset?: number | undefined;
314
- gapSize?: number | undefined;
315
- worldUnits?: boolean | undefined;
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;
316
463
  }
317
- export class MeshLineMaterial extends CustomMaterial {
318
- type: string;
464
+ export class Button extends Control {
319
465
 
320
- constructor(parameters: MeshLineMaterialParameters);
321
- /**
322
- * @default false
323
- */
324
- get worldUnits(): boolean;
325
- set worldUnits(value: boolean);
326
- /**
327
- * @default false
328
- */
329
- get dashed(): boolean;
330
- set dashed(value: boolean);
331
- get resolution(): THREE.Vector2;
332
- /**
333
- * @default 0xffffff
334
- */
335
- color: THREE.Color;
336
- /**
337
- * @default 1
338
- */
339
- dashScale: number;
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;
340
473
  /**
341
- * @default 1
474
+ * Override this method to be notified when the user clicks on the button.
475
+ * @param {MouseEvent} event
342
476
  */
343
- dashSize: number;
477
+ onClick: (event: MouseEvent) => void;
344
478
  /**
345
- * @default 0
479
+ * Override this method to be notified when the mouse enters the button.
480
+ * @param {MouseEvent} event
346
481
  */
347
- dashOffset: number;
482
+ onMouseOver: (event: MouseEvent) => void;
348
483
  /**
349
- * @default 1
484
+ * Override this method to be notified when the mouse leaves the button.
485
+ * @param {MouseEvent} event
350
486
  */
351
- gapSize: number;
352
- copy(source: MeshLineMaterial): this;
353
- protected refreshUniforms(uniforms: {
354
- [uniform: string]: THREE.IUniform<any>;
355
- }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
487
+ onMouseOut: (event: MouseEvent) => void;
356
488
  }
357
- export interface CustomPointMaterialParameters extends THREE.ShaderMaterialParameters, THREE.PointsMaterialParameters {
489
+ export namespace Button {
490
+ enum Event {
491
+ STATE_CHANGED = "Button.StateChanged",
492
+ CLICK = "click"
493
+ }
358
494
  }
359
- export class CustomPointMaterial extends CustomMaterial {
360
- type: string;
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;
505
+ }
506
+ export class ComboButton extends Control {
361
507
 
362
- constructor(parameters?: CustomPointMaterialParameters);
363
- /**
364
- * @default new THREE.Color( 0xffffff )
365
- */
366
- color: THREE.Color;
367
- /**
368
- * @default null
369
- */
370
- map: THREE.Texture | null;
371
- /**
372
- * @default null
373
- */
374
- alphaMap: THREE.Texture | null;
375
- /**
376
- * @default 1
377
- */
378
- size: number;
508
+ constructor(id: string, selectedIndex?: number);
509
+ get subMenu(): SubMenu;
379
510
  /**
380
- * @default true
511
+ * Override this method to be notified when the user clicks on the button.
512
+ * @param {MouseEvent} event
381
513
  */
382
- sizeAttenuation: boolean;
383
- copy(source: CustomPointMaterial): this;
384
- protected refreshUniformsCommon(uniforms: {
385
- [uniform: string]: THREE.IUniform;
386
- }, material: CustomPointMaterial, renderer: THREE.WebGLRenderer): void;
387
- protected refreshUniforms(uniforms: {
388
- [uniform: string]: THREE.IUniform<any>;
389
- }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
390
- }
391
- export namespace Viewer3DIcons {
392
- const VIEWER_SETTINGS_ICON: string;
393
- const VIEWER_MODEL_BROWSER_ICON: string;
394
- const VIEWER_FULL_SCREEN_ICON: string;
395
- const VIEWER_COLLAPSE_ICON: string;
396
- const VIEWER_ELEMENT_PROPERTIES_ICON: string;
397
- const VIEWER_ADD_CLIPPING_PLANE_ICON: string;
398
- const VIEWER_CLIPPING_FLIP_ICON: string;
399
- const VIEWER_DELETE_CLIPPING_PLANE_ICON: string;
400
- const VIEWER_CLIPPING_CUBE_ICON: string;
401
- const VIEWER_ADD_REMARK_ICON: string;
402
- const VIEWER_MEASUREMENT_EDGE_ICON: string;
403
- const VIEWER_MEASUREMENT_PLANE_ICON: string;
404
- const VIEWER_MEASUREMENT_DIMENSION_ICON: string;
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;
405
520
  }
406
- export namespace ViewerGeneralIcons {
407
- const CLOSE: string;
408
- const STRETCH_WINDOW: string;
409
- const EXPAND_TREE: string;
410
- const COLLAPSE_TREE: string;
411
- const ARROW_DROP_DOWN: string;
412
- const ARROW_DROP_RIGHT: string;
413
- const CIRCLE_ICON: string;
414
- const SHOW: string;
415
- const HIDE: string;
416
- const TRASH: string;
417
- const ARROW_DR: string;
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;
418
531
  }
419
- export namespace Viewer2DIcons {
420
- const REMARK_CIRCLE_ICON: string;
421
- const ZOOM_IN: string;
422
- const ZOOM_OUT: string;
532
+ interface ISelectItem {
533
+ text: string;
534
+ value: string;
423
535
  }
424
- export class MeshLineGeometry extends THREE.InstancedBufferGeometry {
425
- type: string;
426
- instanceStart: THREE.BufferAttribute;
427
- instanceEnd: THREE.BufferAttribute;
428
- instanceColorStart: THREE.BufferAttribute;
429
- instanceColorEnd: THREE.BufferAttribute;
536
+ export class Select {
430
537
 
431
- constructor();
432
- applyMatrix4(matrix: THREE.Matrix4): this;
433
- updatePoint(index: number, point: THREE.Vector3): void;
434
- updateColor(index: number, color: Color): void;
435
- setPoints(points: THREE.Vector3[]): this;
436
- setPositions(array: ArrayLike<number>): this;
437
- setColors(array: ArrayLike<number>): this;
438
- computeLineDistances(): this;
439
- toBufferGeometry(): THREE.BufferGeometry;
440
- toWireframeGeometry(): THREE.BufferGeometry;
441
- fromWireframeGeometry(geometry: THREE.WireframeGeometry): this;
442
- fromEdgesGeometry(geometry: THREE.EdgesGeometry): this;
443
- fromMesh(mesh: THREE.Mesh): this;
444
- fromLineSegments(lineSegments: THREE.LineSegments): this;
445
- computeBoundingBox(): void;
446
- computeBoundingSphere(): void;
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;
447
553
  }
448
- export class MeshLine extends THREE.Mesh {
449
- type: string;
450
- material: MeshLineMaterial;
451
- geometry: MeshLineGeometry;
452
-
453
- constructor(geometry?: MeshLineGeometry, material?: MeshLineMaterial);
454
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
554
+ export {};
555
+ export class ViewerToolbar extends Toolbar {
455
556
  }
456
- export class TPair<TKey, TValue> {
557
+ interface ElementClass {
558
+ panelClassName?: string;
559
+ contentClassName?: string;
560
+ headerClassName?: string;
561
+ }
562
+ export class Dialog extends Control {
563
+ responseDialog: (state?: boolean) => void;
457
564
 
458
- constructor(key: TKey, value: TValue);
459
- get key(): TKey;
460
- get value(): TValue;
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;
461
583
  }
462
- export interface IEventsDispatcher {
463
- addEventListener(event: string, listener: EventListener, options?: object): void;
464
- removeEventListener(event: string, listener: EventListener): void;
465
- hasEventListener(event: string, listener: EventListener): boolean;
466
- dispatchEvent(event: string | Event): void;
467
- dispatchEventAsync(event: string | Event): void;
468
- clearListeners(): void;
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[];
469
591
  }
470
- export class EventsDispatcherCore implements IEventsDispatcher {
471
- dispatchEventAsync(event: string | Event): void;
472
- hasEventListener(type: string, listener: EventListener): boolean;
473
- dispatchEvent(event: string | Event): void;
474
- addEventListener(type: string, listener: EventListener, options?: object): void;
475
- removeEventListener(type: string, listener: EventListener): void;
476
- removeEvent(type: string): void;
477
- clearListeners(): void;
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;
478
615
  }
479
616
  export const MouseButtons: {
480
617
  Left: number;
@@ -482,13 +619,12 @@ export const MouseButtons: {
482
619
  Right: number;
483
620
  };
484
621
  export class RenderEventTypes {
485
- static SELECTION_CHANGED_EVENT: string;
486
- static SELECTION_RESET_EVENT: string;
487
622
  static CAMERA_CHANGED_EVENT: string;
488
623
  static CAMERA_NAVIGATION_MODE_CHANGED_EVENT: string;
489
624
  static RENDER_CLICK_EVENT: string;
490
625
  static RENDER_HOVER_EVENT: string;
491
626
  static RENDER_DOUBLE_CLICK_EVENT: string;
627
+ static RENDER_SELECTION_RESET_EVENT: string;
492
628
  }
493
629
  export class SelectionChangedEvent extends Event {
494
630
  selectedIds: ModelElementIds[];
@@ -511,35 +647,6 @@ export class HoverEvent extends Event {
511
647
  export class GlobalEvents {
512
648
  static events: EventsDispatcherCore;
513
649
  }
514
-
515
- export enum SelectionMode {
516
- Append = 0,
517
- Replace = 1
518
- }
519
- export interface ISettingsStorage {
520
- clear(): void;
521
- getItem<T>(key: string): T | null;
522
- removeItem(key: string): void;
523
- setItem<T>(key: string, value: T): void;
524
- getKeys(): string[];
525
- }
526
- export class SettingsStorageFactory {
527
- getSettingsStorage(): ISettingsStorage;
528
- }
529
- export class LocalSettingsStorage implements ISettingsStorage {
530
- clear(): void;
531
- getItem<T>(key: string): T | null;
532
- removeItem(key: string): void;
533
- setItem<T>(key: string, value: T): void;
534
- getKeys(): string[];
535
- }
536
- export class InMemorySettingsStorage implements ISettingsStorage {
537
- clear(): void;
538
- getItem<T>(key: string): T | null;
539
- removeItem(key: string): void;
540
- setItem<T>(key: string, value: T): void;
541
- getKeys(): string[];
542
- }
543
650
  export type Point3 = {
544
651
  x: number;
545
652
  y: number;
@@ -650,156 +757,66 @@ export interface ICameraControl {
650
757
  */
651
758
  setNavigationMode(mode: CameraNavigationMode, isEnable: boolean, duration?: number): void;
652
759
  }
653
- export interface IModelIntersectionChecker {
654
- /** Gets the center of the model*/
655
- get modelCenter(): THREE.Vector3;
656
- /** Gets the bounding box of the model*/
657
- get boundingBox(): THREE.Box3;
658
- /**
659
- * Gets intersection point of the last casted ray
660
- */
661
- getIntersectionPoint(): THREE.Intersection<THREE.Object3D> | undefined;
662
- /**
663
- * Gets {@link THREE.Intersection} between a casted {@link ray} and model object.
664
- * @param ray
665
- * @param camera
666
- */
667
- getIntersectionByRay(ray: THREE.Ray, camera: THREE.Camera): THREE.Intersection<THREE.Object3D> | undefined;
668
- /**
669
- * Gets ID of the model object intersected by {@link ray}
670
- * @param ray
671
- * @param camera
672
- */
673
- getIntersectionIDByRay(ray: THREE.Ray, camera: THREE.Camera): {
674
- modelId: string;
675
- guid: string;
676
- } | undefined;
677
- /**
678
- * Gets {@link THREE.Intersection} between a ray, casted from {@link camera} to {@link ndcPoint}, and model object.
679
- * @param ndcPoint
680
- * @param camera
681
- */
682
- getIntersectionByNdcPt(ndcPoint: THREE.Vector2, camera: THREE.Camera): THREE.Intersection<THREE.Object3D> | undefined;
683
- /**
684
- * Gets ID of the model object intersected by ray, casted from {@link camera} to {@link ndcPoint}.
685
- * @param ndcPoint
686
- * @param camera
687
- */
688
- getIntersectionIDByNdcPt(ndcPoint: THREE.Vector2, camera: THREE.Camera): {
689
- modelId: string;
690
- guid: string;
691
- } | undefined;
692
- /**
693
- * Gets IDs of the model objects intersected by frustum
694
- * @param ndcFrustumBox - frustum in the NDC space
695
- * @param unProjMatrix - NDC to World projection matrix
696
- * @param isContainsOnly - if true, gets only fully contained objects in the frustum
697
- * @param isClippingEnable - if true, intersect objects only in the clipping space
698
- */
699
- getIntersectionIDByFrustumNdcPt(ndcFrustumBox: THREE.Box3, unProjMatrix: THREE.Matrix4, isContainsOnly: boolean, isClippingEnable?: boolean): {
700
- modelId: string;
701
- guid: string;
702
- }[];
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;
703
772
  }
704
- export enum NavigationHandlerPriority {
705
- DefaultNavigation = 0,
706
- GizmoHandlers = 20,
707
- EmbeddedExtensions = 40,
708
- CustomExtensions = 100
773
+ export class ModelPartEvent extends Event {
774
+ modelPartId: string;
709
775
  }
710
- export class NavigationEventOptions implements EventListenerOptions {
711
- /** If true, use event capturing instead of event bubbling*/
712
- readonly capture: boolean;
713
- /** Call priority of navigation event handlers, from highest to lowest*/
714
- readonly priority: number | NavigationHandlerPriority;
715
- /** Always handle, used if `NavigationEvent.isHandled` set to true*/
716
- readonly alwaysHandle: boolean;
717
- /** (optional) listener name*/
718
- readonly navigationTargetName?: string;
719
-
720
- constructor(
721
- /** If true, use event capturing instead of event bubbling*/
722
- capture?: boolean,
723
- /** Call priority of navigation event handlers, from highest to lowest*/
724
- priority?: number | NavigationHandlerPriority,
725
- /** Always handle, used if `NavigationEvent.isHandled` set to true*/
726
- alwaysHandle?: boolean,
727
- /** (optional) listener name*/
728
- navigationTargetName?: string);
776
+ export class ModelPartUpdateEvent extends ModelPartEvent {
777
+ updatedElementIds?: string[];
778
+ removedElementIds?: string[];
779
+ addedElementIds?: string[];
729
780
  }
730
- export type NavigationEvent = {
731
- /**
732
- * (optional) Value indicating whether the NavigationEvent event was handled.
733
- */
734
- isHandled?: boolean;
735
- };
736
- export interface ActiveEvent extends Event {
737
- readonly isActive: boolean;
781
+ export class VirtualOriginEvent extends Event {
782
+ virtualOrigin: Point3;
783
+ delta: Point3;
738
784
  }
739
- export interface NavigationEventSourceEventMap extends HTMLElementEventMap {
740
- /**
741
- * Occurs when the {@link INavigationEventSource.isActive} property changes.
742
- */
743
- "active": ActiveEvent;
785
+ export class DeleteEvent extends Event {
786
+ deletedIds: ModelElementIds[];
744
787
  }
745
- export interface INavigationEventSource {
746
- /**
747
- * Activity of the event source
748
- */
749
- get isActive(): boolean;
750
- set isActive(value: boolean);
751
- addEventListener<T extends keyof NavigationEventSourceEventMap>(type: T, listener: (this: object, ev: NavigationEventSourceEventMap[T] & NavigationEvent) => void, options?: boolean | EventListenerOptions | NavigationEventOptions): void;
752
- removeEventListener<T extends keyof NavigationEventSourceEventMap>(type: T, listener: (this: object, ev: NavigationEventSourceEventMap[T] & NavigationEvent) => void, options?: boolean | EventListenerOptions | NavigationEventOptions): void;
788
+
789
+ export enum SelectionMode {
790
+ Append = 0,
791
+ Replace = 1
753
792
  }
754
- export interface INavigationAgent {
755
- /**
756
- * Canvas DOM-events source
757
- */
758
- readonly canvasNavigationSource: INavigationEventSource;
759
- /**
760
- * Keyboard DOM-events source
761
- */
762
- readonly keyboardNavigationSource: INavigationEventSource;
763
- /**
764
- * Activity of the navigation agent
765
- */
766
- get isActive(): boolean;
767
- set isActive(value: boolean);
768
- /**
769
- * Gets rectangle of the navigation area
770
- */
771
- getNavigationArea(): DOMRect;
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;
772
814
  }
773
- export interface INavigationTool {
774
- /**
775
- * Gets name of this navigation tool.
776
- */
777
- get name(): string;
778
- /**
779
- * Initialize navigation tool.
780
- */
781
- init(navAgent: INavigationAgent, cameraControl: ICameraControl, intersectionChecker: IModelIntersectionChecker): void;
782
- /**
783
- * Activates or deactivates this navigation tool.
784
- */
785
- setActive(isActive: boolean): void;
786
- /**
787
- * Gets the camera pivot point.
788
- */
789
- getPivotPoint(): THREE.Vector3;
790
- /**
791
- * Sets the camera pivot point.
792
- */
793
- setPivotPoint(pivotPoint: THREE.Vector3): void;
794
- /**
795
- * Sets the camera parameters.
796
- * @param iParams
797
- */
798
- setCameraParameters(iParams: CameraParameters): void;
799
- /**
800
- * Gets the camera parameters.
801
- */
802
- getCameraParameters(): CameraParameters;
815
+ export enum ValueType {
816
+ STRING = 0,
817
+ NUMBER = 1,
818
+ ENUM = 2,
819
+ BOOL = 3
803
820
  }
804
821
  export class RenderViewSettings {
805
822
  telemetry?: boolean;
@@ -810,6 +827,8 @@ export class RenderViewSettings {
810
827
  desiredFramerate?: number;
811
828
  /** Allocated time for rendering operations, excluding scene rendering */
812
829
  manageTime?: number;
830
+ /** Number of scene updates managed at once */
831
+ chunkUpdateSize?: number;
813
832
  /** Draw hovered meshes on the `selectionScene` */
814
833
  hoverMeshes?: boolean;
815
834
  /** Draw hovered edges on the `selectionScene` */
@@ -824,6 +843,87 @@ export enum DisplayMode {
824
843
  FACES = 1
825
844
  }
826
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
+ }
827
927
  export interface IRenderOperationContext {
828
928
  /** If true, renderScenes operations will be forced*/
829
929
  isRedrawRequested: boolean;
@@ -837,6 +937,8 @@ export interface IRenderOperationContext {
837
937
  get settings(): RenderViewSettings;
838
938
  /** Indicates whether the navigation is in progress */
839
939
  get isNavigation(): boolean;
940
+ /** Indicates whether faces and edges should be drawn */
941
+ get displayMode(): DisplayMode;
840
942
  /** Indicates whether the operation has been requested to be suspended by the scheduler*/
841
943
  get isSuspensionRequested(): boolean;
842
944
  /** Gets the remaining time for the render operations in current iteration*/
@@ -878,6 +980,10 @@ export enum OperationPriority {
878
980
  afterAll = 100
879
981
  }
880
982
  export type RenderOperationDelegate = (context: IRenderOperationContext) => OperationStatus;
983
+ export enum SceneNames {
984
+ Main = "MainScene",
985
+ Overlay = "OverlayScene"
986
+ }
881
987
  export interface IUserScene extends THREE.Scene {
882
988
  /** Scene name */
883
989
  readonly name: string;
@@ -886,7 +992,7 @@ export interface IUserScene extends THREE.Scene {
886
992
  /** Indicates whether the scene should be redrawn*/
887
993
  get needsRedraw(): boolean;
888
994
  /** Gets the scene intersection checker */
889
- get intersectionChecker(): IModelIntersectionChecker | null;
995
+ get intersectionChecker(): ISceneIntersectionChecker | null;
890
996
  /** Sets clipping enable */
891
997
  set clippingEnable(value: boolean);
892
998
  /** Indicates whether the scene should be clipped */
@@ -906,11 +1012,13 @@ export interface IUserScene extends THREE.Scene {
906
1012
  /** Manage scene, manage updates on scene */
907
1013
  manageScene(context?: IRenderOperationContext): boolean;
908
1014
  /** Render scene */
909
- render(context: IRenderOperationContext): void;
1015
+ render(context?: IRenderOperationContext): void;
910
1016
  /** Dispose scene */
911
1017
  dispose(): void;
912
1018
  }
913
1019
  export interface I3DRenderer {
1020
+ clippingPlanes: THREE.Plane[];
1021
+ domElement: HTMLCanvasElement;
914
1022
  clear(color?: boolean, depth?: boolean, stencil?: boolean): void;
915
1023
  setClearColor(color: THREE.ColorRepresentation, alpha?: number): void;
916
1024
  clearDepth(): void;
@@ -919,194 +1027,425 @@ export interface I3DRenderer {
919
1027
  setSize(width: number, height: number, updateStyle?: boolean): void;
920
1028
  setViewport(x: THREE.Vector4 | number, y?: number, width?: number, height?: number): void;
921
1029
  getViewport(target: THREE.Vector4): THREE.Vector4;
922
- clippingPlanes: THREE.Plane[];
923
- domElement: HTMLCanvasElement;
1030
+ dispose(): void;
924
1031
  }
925
1032
  export interface IRenderViewer3D {
926
1033
  /** Gets model inetrsection checker. */
927
1034
  getIntersectionChecker(): IModelIntersectionChecker;
928
1035
  /** Request a full redraw of the canvas. */
929
- updateCurrentCanvas(): Promise<void>;
1036
+ updateCurrentCanvas(force?: boolean): Promise<void>;
1037
+ /**
1038
+ * Place object on the scene.\
1039
+ * An object can only be placed on one scene.
1040
+ * @param iObj - object to place.
1041
+ * @param sceneID - (optional) scene name. `MainScene` by default.
1042
+ */
1043
+ placeObjectOnScene(iObj: THREE.Object3D, sceneID?: string): Promise<void>;
1044
+ /**
1045
+ * Remove object from scene.
1046
+ * @param iObj
1047
+ */
1048
+ removeObjectFromScene(iObj: THREE.Object3D): Promise<void>;
1049
+ /**
1050
+ * Set clipping planes for rendering.
1051
+ * @param planes - array of clipping planes.
1052
+ */
1053
+ setClipping(planes: THREE.Plane[]): void;
1054
+ /**
1055
+ * Set active clipping planes: planes with colored sections
1056
+ * @param indices - active planes indices in the array of clipping planes
1057
+ */
1058
+ setActiveClipPlaneIndices(indices: number[]): void;
1059
+ /**
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
1188
+ */
1189
+ color: THREE.Color;
1190
+ /**
1191
+ * @default 1
1192
+ */
1193
+ dashScale: number;
930
1194
  /**
931
- * Place object on the scene.\
932
- * An object can only be placed on one scene.
933
- * @param iObj - object to place.
934
- * @param sceneID - (optional) scene name. `MainScene` by default.
1195
+ * @default 1
935
1196
  */
936
- placeObjectOnScene(iObj: THREE.Object3D, sceneID?: string): Promise<void>;
1197
+ dashSize: number;
937
1198
  /**
938
- * Remove object from scene.
939
- * @param iObj
1199
+ * @default 0
940
1200
  */
941
- removeObjectFromScene(iObj: THREE.Object3D): Promise<void>;
1201
+ dashOffset: number;
942
1202
  /**
943
- * Set clipping planes for rendering.
944
- * @param planes - array of clipping planes.
1203
+ * @default 1
945
1204
  */
946
- setClipping(planes: THREE.Plane[]): void;
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);
947
1217
  /**
948
- * Set active clipping planes: planes with colored sections
949
- * @param indices - active planes indices in the array of clipping planes
1218
+ * @default new THREE.Color( 0xffffff )
950
1219
  */
951
- setActiveClipPlaneIndices(indices: number[]): void;
1220
+ color: THREE.Color;
952
1221
  /**
953
- * Gets all render scenes.
1222
+ * @default null
954
1223
  */
955
- getScenes(): IUserScene[];
1224
+ map: THREE.Texture | null;
956
1225
  /**
957
- *
958
- * @param name
959
- * @param isClippable
1226
+ * @default null
960
1227
  */
961
- addScene(name: string, isClippable: boolean): IUserScene;
1228
+ alphaMap: THREE.Texture | null;
962
1229
  /**
963
- *
964
- * @param scene
1230
+ * @default 1
965
1231
  */
966
- removeScene(scene: IUserScene): void;
1232
+ size: number;
1233
+ /**
1234
+ * @default true
1235
+ */
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 InitializerOptions {
969
- libList?: string[];
970
- language?: string;
1245
+ export enum NavigationHandlerPriority {
1246
+ DefaultNavigation = 0,
1247
+ GizmoHandlers = 20,
1248
+ EmbeddedExtensions = 40,
1249
+ CustomExtensions = 100
971
1250
  }
972
- class Global {
973
- G: any;
974
- RESOURCE_ROOT: string;
975
- initializeResourceRoot(options: InitializerOptions): void;
976
- getResourceUrl(resourceRelativePath: string): string;
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);
977
1270
  }
978
- export const global: Global;
979
- export {};
980
- export type StringMap = {
981
- [key: string]: any;
1271
+ export type NavigationEvent = {
1272
+ /**
1273
+ * (optional) Value indicating whether the NavigationEvent event was handled.
1274
+ */
1275
+ isHandled?: boolean;
982
1276
  };
983
- export class Localization {
984
- static initialize(options: any): Promise<void>;
985
- static translate<T extends (string | StringMap) = string>(stringToTrans: string): T;
986
- static setLanguage(language: string): Promise<void>;
987
- static extendLocalization(locales: any): boolean;
1277
+ export interface ActiveEvent extends Event {
1278
+ readonly isActive: boolean;
988
1279
  }
989
- export class ModelElement {
990
- get id(): string;
991
- get modelPartId(): string;
992
- get parent(): ModelElement | undefined;
993
- get type(): string;
994
- get name(): string;
995
- get children(): ModelElement[];
996
- get hasGeometry(): boolean;
997
- get viewObject(): ViewObject | undefined;
998
- get boundingBoxCenter(): Point3 | null;
1280
+ export interface NavigationEventSourceEventMap extends HTMLElementEventMap {
1281
+ /**
1282
+ * Occurs when the {@link INavigationEventSource.isActive} property changes.
1283
+ */
1284
+ "active": ActiveEvent;
999
1285
  }
1000
- export class ModelElementTree {
1286
+ export interface INavigationEventSource {
1001
1287
  /**
1002
- *
1003
- * @param {string|ModelElement} element - element id or element instance
1004
- * @param callback
1005
- * @param recursive
1288
+ * Activity of the event source
1006
1289
  */
1007
- enumElementChildren(element: string | ModelElement, callback: (guid: string) => void, recursive?: 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 {
1008
1296
  /**
1009
- * Gets the root element of the model part
1010
- * @returns {ModelElement} - model element instance
1297
+ * Canvas DOM-events source
1011
1298
  */
1012
- getRootElement(): ModelElement;
1299
+ readonly canvasNavigationSource: INavigationEventSource;
1013
1300
  /**
1014
- * Gets all elements of the model part
1015
- * @returns array of the model elements
1301
+ * Keyboard DOM-events source
1016
1302
  */
1017
- getAllElements(): ModelElement[];
1303
+ readonly keyboardNavigationSource: INavigationEventSource;
1018
1304
  /**
1019
- * Gets model element by id
1020
- * @param { string } id - model element id
1021
- * @returns model element;
1305
+ * Activity of the navigation agent
1022
1306
  */
1023
- getElement(id: string): ModelElement;
1307
+ get isActive(): boolean;
1308
+ set isActive(value: boolean);
1024
1309
  /**
1025
- * Checks given element is viewable
1026
- * @param {string|ModelElement} element - element id or element instance
1027
- * @returns {boolean}
1310
+ * Gets rectangle of the navigation area
1028
1311
  */
1029
- isViewableElement(element: string | ModelElement): boolean;
1312
+ getNavigationArea(): DOMRect;
1313
+ }
1314
+ export interface INavigationTool {
1030
1315
  /**
1031
- * Checks given element is detached from the root element
1032
- * @param {string|ModelElement} element - element id or element instance
1033
- * @returns {boolean}
1316
+ * Gets name of this navigation tool.
1034
1317
  */
1035
- isDetachedElement(element: string | ModelElement): boolean;
1318
+ get name(): string;
1036
1319
  /**
1037
- * Gets the element level in the element tree
1038
- * @param {string|ModelElement} element - element id or element instance
1039
- * @returns {number} - level of the element
1320
+ * Initialize navigation tool.
1040
1321
  */
1041
- getChildLevelNumber(element: string | ModelElement): number;
1322
+ init(navAgent: INavigationAgent, cameraControl: ICameraControl, intersectionChecker: IModelIntersectionChecker): void;
1323
+ /**
1324
+ * Activates or deactivates this navigation tool.
1325
+ */
1326
+ setActive(isActive: boolean): void;
1327
+ /**
1328
+ * Gets the camera pivot point.
1329
+ */
1330
+ getPivotPoint(): THREE.Vector3;
1331
+ /**
1332
+ * Sets the camera pivot point.
1333
+ */
1334
+ setPivotPoint(pivotPoint: THREE.Vector3): void;
1335
+ /**
1336
+ * Sets the camera parameters.
1337
+ * @param iParams
1338
+ */
1339
+ setCameraParameters(iParams: CameraParameters): void;
1340
+ /**
1341
+ * Gets the camera parameters.
1342
+ */
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;
1042
1416
  }
1043
- export class ModelPart {
1044
- get id(): string;
1045
- get elementTree(): ModelElementTree;
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;
1046
1430
  dispose(): void;
1431
+ updateMatrixWorld(force?: boolean): void;
1432
+ updateGizmoOffset(position?: THREE.Vector3, quaternion?: THREE.Quaternion): void;
1047
1433
  }
1048
- export interface INavigation {
1049
- /**
1050
- * Register navigation tool.
1051
- */
1052
- registerNavigation(navigationTool: INavigationTool): void;
1053
- /**
1054
- * Unregister navigation tool.
1055
- */
1056
- unregisterNavigation(navigationTool: INavigationTool): void;
1057
- /**
1058
- * Activate or deactivate registered navigation tool.
1059
- * NB: There can be only one active navigation tool at time.
1060
- */
1061
- setActive(navigationToolName: string, isActive: boolean): void;
1062
- /**
1063
- * Get active navigation tool.
1064
- */
1065
- getActiveNavigation(): INavigationTool | null;
1066
- /**
1067
- * Get navigation agent.
1068
- */
1069
- getNavigationAgent(): INavigationAgent;
1070
- /**
1071
- * Gets navigation area rectangle
1072
- */
1073
- getNavigationArea(): DOMRect;
1074
- /**
1075
- * Sets the camera parameters.
1076
- */
1077
- setCameraParameters(params: CameraParameters): void;
1078
- /**
1079
- * Gets the camera parameters.
1080
- */
1081
- getCameraParameters(): CameraParameters;
1082
- /**
1083
- * Gets the camera control.
1084
- */
1085
- getCameraControl(): ICameraControl;
1086
- /**
1087
- * Gets the Three.js camera.
1088
- */
1089
- getCamera(): THREE.Camera;
1090
- /**
1091
- * Fits camera to objects by IDs.
1092
- * @param {string[] | string} elementIds - element or array of elements
1093
- * @param {string | ModelPart} modelPart - the model part id or the model part instance containing the elements.
1094
- * @param {boolean} immediate - true to avoid the default transition.
1095
- * @returns
1096
- */
1097
- fitToView(elementIds: string[] | string, modelPart: string | ModelPart, immediate?: boolean): void;
1098
- /**
1099
- * Sets the camera pivot point.
1100
- */
1101
- setPivotPoint(point: Point3): void;
1102
- /**
1103
- * Gets the camera pivot point.
1104
- */
1105
- getPivotPoint(): Point3;
1106
- /**
1107
- * Reset the camera pivot point.
1108
- */
1109
- resetPivotPoint(): void;
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;
1110
1449
  }
1111
1450
  export interface CustomSpriteMaterialParameters extends THREE.ShaderMaterialParameters {
1112
1451
  color?: THREE.ColorRepresentation | undefined;
@@ -1165,236 +1504,161 @@ export class CustomSpriteMaterial extends CustomMaterial {
1165
1504
  [uniform: string]: THREE.IUniform<any>;
1166
1505
  }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
1167
1506
  }
1168
-
1169
- export class SettingsNames {
1170
- static TELEMETRY: string;
1171
- static AXES: string;
1172
- static CAMERA_ANIMATION: string;
1173
- static HIDE_SMALL_ELEMENTS_WHEN_NAVIGATING: string;
1174
- static GLOBAL_LIGHT: string;
1175
- static LIGHT_SOURCE: string;
1176
- static ANTI_ALIASING: string;
1177
- static HIDE_SMALL_ELEMENTS_MOVING: string;
1178
- static SMALL_ELEMENT_SIZE: string;
1179
- static LABEL_LINE_LENGTH: string;
1180
- static HIDE_EDGES_WHEN_NAVIGATING: string;
1181
- static DISPLAY_MODE: string;
1182
- static NAVIGATION_CUBE: string;
1183
- static DESIRED_FRAMERATE: string;
1184
- static MANAGE_TIME: string;
1185
- static HOVER_MESHES: string;
1186
- static HOVER_EDGES: string;
1187
- static SELECT_MESHES: string;
1188
- static SELECT_EDGES: string;
1189
- }
1190
- export enum ValueType {
1191
- STRING = 0,
1192
- NUMBER = 1,
1193
- ENUM = 2,
1194
- BOOL = 3
1195
- }
1196
- export interface ISettings {
1197
- changeSetting<T>(name: string, value: T, notify?: boolean, providedData?: any): void;
1198
- getSettingValue<T>(name: string): T;
1199
- }
1200
- export enum BaseSettingsNames {
1201
- TOOLBAR = "toolbar",
1202
- TOOLBAR_POSITION = "toolbarPosition",
1203
- TOOLBAR_CONTENT_ALIGNMENT = "toolbarContent",
1204
- THEME = "theme"
1205
- }
1206
- export class SettingChangedEvent extends Event {
1207
- name: string;
1208
- oldValue: any;
1209
- newValue: any;
1210
- providedData: any;
1211
- }
1212
- export enum SettingsTheme {
1213
- LIGHT_THEME = "ascn-light",
1214
- DARK_THEME = "ascn-dark"
1215
- }
1216
- export const defaultThemeAppearance: string;
1217
- export enum ToolbarPosition {
1218
- TOP_FIXED = "ascn-toolbar-position-fixed-top",
1219
- TOP_FLUENT = "ascn-toolbar-position-top",
1220
- BOTTOM_FIXED = "ascn-toolbar-position-fixed-bottom",
1221
- BOTTOM_FLUENT = "ascn-toolbar-position-bottom"
1222
- }
1223
- export enum ToolbarContentAlignment {
1224
- CENTER = "ascn-toolbar-content-center",
1225
- START = "ascn-toolbar-content-start",
1226
- END = "ascn-toolbar-content-end"
1227
- }
1228
- export interface ToolbarStyle {
1229
- [BaseSettingsNames.TOOLBAR_POSITION]?: ToolbarPosition;
1230
- [BaseSettingsNames.TOOLBAR_CONTENT_ALIGNMENT]?: ToolbarContentAlignment;
1231
- }
1232
- export const defaultToolbarAppearance: ToolbarStyle;
1233
- export type ViewerSettings = Record<string, any>;
1234
- export class ViewerConfiguration {
1235
- settingsPrefix: string;
1236
- appearance: ViewerSettings;
1237
- createConfiguration(configuration: ViewerSettings, origin: ViewerSettings): void;
1238
- mergeConfigurationAndSettings(configuration: ViewerSettings, settings: ISettings): void;
1239
- changeTheme(newTheme: string): void;
1240
- }
1241
- export class Viewer3DConfiguration extends ViewerConfiguration {
1242
- render: ViewerSettings;
1243
-
1244
- constructor(appearance?: ViewerSettings, render?: ViewerSettings);
1245
- }
1246
- export const defaultViewer3DSettings: ViewerSettings;
1247
- export class LoadingSpinner {
1248
- addToDOM(container: HTMLElement): void;
1249
- removeFromDOM(container: HTMLElement): void;
1250
- }
1251
- export class CoreEventTypes {
1252
- static VIEWER_RESIZE_EVENT: string;
1253
- static VIEWER_MOUSE_DOWN_EVENT: string;
1254
- static VIEWER_MOUSE_MOVE_EVENT: string;
1255
- static VIEWER_MOUSE_UP_EVENT: string;
1256
- static VIEWER_MOUSE_LONG_TOUCH_EVENT: string;
1257
- static VIEWER_TOUCHSTART_EVENT: string;
1258
- static VIEWER_TOUCHEND_EVENT: string;
1259
- static SETTING_CHANGED_EVENT: string;
1260
- static SETTING_RESET_EVENT: string;
1261
- static SETTING_LANGUAGE_CHANGED_EVENT: string;
1262
- static SETTING_THEME_CHANGED_EVENT: string;
1263
- }
1264
- export namespace ControlState {
1265
- enum State {
1266
- ACTIVE = 0,
1267
- INACTIVE = 1,
1268
- DISABLED = 2
1269
- }
1270
- }
1271
- export interface IControl {
1272
- container: HTMLElement;
1273
- getId(): string;
1274
- setToolTip(tooltipText: string): void;
1275
- setText(text: string): void;
1276
- setState(state: ControlState.State): void;
1277
- }
1278
- export class Control implements IControl {
1279
- container: HTMLElement;
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;
1280
1513
 
1281
- constructor(id: string);
1282
- addClass(cssClass: string): void;
1283
- removeClass(cssClass: string): void;
1284
- getId(): string;
1285
- setToolTip(tooltipText: string): void;
1286
- setText(text: string): void;
1287
- setState(state: ControlState.State): void;
1288
- }
1289
- export interface IMenu {
1290
- controls: IControl[];
1291
- addControl(control: IControl, index?: number): void;
1292
- removeControl(index: number): void;
1293
- }
1294
- interface IToolbarButton {
1295
- button: IControl;
1296
- index: number;
1297
- }
1298
- export class Toolbar extends Control implements IMenu {
1299
- readonly controls: IControl[];
1300
- addControl(control: IControl, index?: number): void;
1301
- removeControl(index: number): void;
1302
- getControls(): IToolbarButton[];
1303
- changeToolbarPosition(direction: ToolbarPosition): void;
1304
- changeToolbarContentAlignment(content: ToolbarContentAlignment): 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;
1305
1530
  }
1306
- export {};
1307
- export class ExtensionBase {
1308
- protected _viewer: ViewerBase;
1309
- protected _options: object;
1531
+ export class MeshLine extends THREE.Mesh {
1532
+ type: string;
1533
+ material: MeshLineMaterial;
1534
+ geometry: MeshLineGeometry;
1310
1535
 
1311
- constructor(viewer3D: ViewerBase, options?: object);
1312
- load(): boolean | Promise<boolean>;
1313
- unload(): boolean;
1314
- activate(): boolean;
1315
- deactivate(): boolean;
1316
- /**
1317
- * Gets the name of the extension.
1318
- * @returns {string} Returns the name of the extension.
1319
- */
1320
- getName(): string;
1321
- addCursorPhantomFromSvg(template: string): void;
1322
- removeCursorPhantom(): void;
1323
- onMouseDown(event: MouseEvent): void;
1324
- onMouseMove(event: MouseEvent): void;
1325
- onMouseUp(event: MouseEvent): void;
1326
- onMouseLongTouch(event: MouseEvent): void;
1327
- onToolbarCreated(toolbar: Toolbar): void;
1328
- onTouchStart(event: TouchEvent): void;
1329
- onTouchEnd(event: TouchEvent): void;
1330
- protected bindDomEvents(): void;
1536
+ constructor(geometry?: MeshLineGeometry, material?: MeshLineMaterial);
1537
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
1331
1538
  }
1332
- export class ExtensionManager {
1333
- registerExtensionType(extensionId: string, extension: typeof ExtensionBase): boolean;
1334
- unregisterExtensionType(extensionId: string): boolean;
1335
- getExtensionType(extensionId: string): typeof ExtensionBase;
1539
+ export class CustomSprite extends THREE.Sprite {
1540
+ material: CustomSpriteMaterial;
1541
+
1542
+ constructor(material: CustomSpriteMaterial);
1543
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1544
+ dispose(): void;
1336
1545
  }
1337
- export const theExtensionManager: ExtensionManager;
1338
- export class ExtensionLoader {
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;
1557
+ }
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);
1339
1564
  /**
1340
- * Loads the extension with the given id and options.
1341
- *
1342
- * @param {string} extensionId - The string id of the extension.
1343
- * @param {object} options - An optional dictionary of options.
1344
- *
1345
- * @returns {Promise<ExtensionBase>} - Resolves with the extension requested.
1565
+ * @default ''
1346
1566
  */
1347
- loadExtension(extensionId: string, options?: object): Promise<ExtensionBase>;
1567
+ get text(): string;
1568
+ set text(value: string);
1348
1569
  /**
1349
- * Unloads the extension with the given id.
1350
- *
1351
- * @param {string} extensionId - The string id of the extension.
1352
- * @returns {Promise<boolean>} - True if the extension was successfully unloaded.
1353
- */
1354
- unloadExtension(extensionId: string): Promise<boolean>;
1570
+ * @default 'Roboto, sans-serif'
1571
+ */
1572
+ get fontFace(): string | FontFace;
1573
+ set fontFace(value: string | FontFace);
1355
1574
  /**
1356
- * Returns all loaded extensions.
1357
- * @returns {?string[]} - Ids of loaded extensions.
1358
- */
1359
- getExtensions(): string[];
1575
+ * @default 12
1576
+ */
1577
+ get fontSize(): number;
1578
+ set fontSize(value: number);
1360
1579
  /**
1361
- * Returns the loaded extension.
1362
- * @param {string} extensionId - The string id of the extension.
1363
- * @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]
1364
1607
  */
1365
- getExtension(extensionId: string): ExtensionBase;
1608
+ get textPadding(): THREE.Vector4Tuple;
1609
+ set textPadding(value: THREE.Vector4Tuple);
1610
+ dispose(): void;
1366
1611
  }
1367
- export type ErrorCallback = (message: string) => void;
1368
- export type SuccessCallback = (modelId: any) => void;
1369
- export enum DocumentType {
1370
- UNKNOWN = 0,
1371
- DOCUMENT_2D = 1,
1372
- DOCUMENT_3D = 2
1612
+ export interface MeshPointMaterialParameters extends THREE.ShaderMaterialParameters {
1613
+ sizeAttenuation?: boolean | undefined;
1614
+ discreteClipping?: boolean | undefined;
1373
1615
  }
1374
- export const defaultBaseSettings: ViewerConfiguration;
1375
- export abstract class ViewerBase {
1376
- protected _clientContainer: HTMLElement;
1377
- protected _loadingSpinner: LoadingSpinner;
1378
- protected _documentType: DocumentType;
1379
- protected _configuration: ViewerConfiguration;
1380
- readonly container: HTMLElement;
1381
- readonly extensionsLoader: ExtensionLoader;
1382
- abstract settings: ISettings;
1383
- abstract events: IEventsDispatcher;
1384
- get rootContainer(): HTMLElement;
1385
- getConfiguration(): ViewerConfiguration;
1616
+ export class MeshPointMaterial extends CustomMaterial {
1617
+
1618
+ constructor(parameters?: MeshPointMaterialParameters);
1386
1619
  /**
1387
- *
1388
- * @returns
1620
+ * @default true
1389
1621
  */
1390
- start(): Promise<number>;
1622
+ get discreteClipping(): boolean;
1623
+ set discreteClipping(value: boolean);
1624
+ get resolution(): THREE.Vector2;
1391
1625
  /**
1392
- *
1626
+ * @default true
1393
1627
  */
1394
- finish(): void;
1395
- onPostExtensionLoad(extension: ExtensionBase): void;
1396
- protected loadExtensions(): void;
1397
- 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;
1398
1662
  }
1399
1663
  export enum IfcType {
1400
1664
  IfcAbsorbedDoseMeasure = 0,
@@ -2624,6 +2888,77 @@ export class ModelElementPropertyValue {
2624
2888
  bool_value?: boolean;
2625
2889
  get value(): unknown;
2626
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
+ }
2627
2962
  /**
2628
2963
  * This class describes the coordination model. The coordination model contains parts of the model (aka ModelPart).
2629
2964
  */
@@ -2680,6 +3015,17 @@ export class Model {
2680
3015
  * Shows all elements and model parts
2681
3016
  */
2682
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;
2683
3029
  /**
2684
3030
  * Selects the array of model elements. You can also pass in a single model element id instead of an array.
2685
3031
  *
@@ -2712,6 +3058,11 @@ export class Model {
2712
3058
  * @returns {ModelElementIds[]} Array of the currently visible model elements.
2713
3059
  */
2714
3060
  getVisibleElements(): ModelElementIds[];
3061
+ /**
3062
+ * Returns the isolated element ids.
3063
+ * @returns {ModelElementIds[]} Array of the currently visible model elements.
3064
+ */
3065
+ getIsolatedElements(): ModelElementIds[];
2715
3066
  /**
2716
3067
  * Sets color to elements
2717
3068
  * @param {string[] | string} elementIds - element or array of elements to change color.
@@ -2726,7 +3077,12 @@ export class Model {
2726
3077
  * Resets all changed colors for all elements in all model parts
2727
3078
  * @param {string | ModelPart} modelPart - id of the model part or model part instance.
2728
3079
  */
2729
- clearColors(modelPart?: string | ModelPart): void;
3080
+ clearColors(modelPart?: string | ModelPart): void;
3081
+ /**
3082
+ * Sets ghost mode for the hidden elements of the model.
3083
+ * @param value - indicates whether ghost mode is on or off.
3084
+ */
3085
+ setGhostMode(value: boolean): void;
2730
3086
  /**
2731
3087
  *
2732
3088
  * @param {string} elementId - element id
@@ -2736,468 +3092,154 @@ export class Model {
2736
3092
  * @returns {ModelElementPropertySet[]} - property data array.
2737
3093
  */
2738
3094
  getElementProperties(elementId: string, modelPart?: string | ModelPart, version?: bigint): ModelElementPropertySet[];
2739
- }
2740
- export class EventTypes extends CoreEventTypes {
2741
- static MODEL_PART_LOADED: string;
2742
- static MODEL_PART_UNLOADED: string;
2743
- static VIRTUAL_ORIGIN_CHANGED: string;
2744
- static SELECTION_CHANGED_EVENT: string;
2745
- static CAMERA_CHANGE_EVENT: string;
2746
- static CAMERA_NAVIGATION_MODE_CHANGED_EVENT: string;
2747
- static RENDER_CLICK_EVENT: string;
2748
- static RENDER_HOVER_EVENT: string;
2749
- static RENDER_DOUBLE_CLICK_EVENT: string;
2750
- }
2751
- export class ModelPartEvent extends Event {
2752
- modelPartId: string;
2753
- }
2754
- export class VirtualOriginEvent extends Event {
2755
- virtualOrigin: Point3;
2756
- delta: Point3;
2757
- }
2758
- export class ModelLoadingOptions {
2759
- guid: string;
2760
- isConsolidatedModel?: boolean;
2761
- }
2762
- export let ViewerInstance: Viewer3D;
2763
- export class Viewer3D extends ViewerBase {
2764
- protected _configuration: Viewer3DConfiguration;
2765
- settings: Readonly<ISettings>;
2766
- events: Readonly<IEventsDispatcher>;
2767
3095
  /**
2768
- * Returns general model
2769
- * @returns { Model } - general model
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.
2770
3099
  */
2771
- get model(): Model;
2772
- get renderView(): IRenderViewer3D;
2773
- get canvas(): HTMLCanvasElement;
2774
- get navigation(): INavigation;
2775
- getConfiguration(): Viewer3DConfiguration;
2776
- start(): Promise<number>;
2777
- finish(): void;
3100
+ canDelete(elementIds: ModelElementIds[]): boolean;
2778
3101
  /**
2779
- * Loads new model part to the viewer
2780
- * @param buffer
2781
- * @param options
2782
- * @param onSuccessCallback
2783
- * @param onErrorCallback
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.
2784
3105
  */
2785
- loadModelPart(data: ArrayBuffer | string, options: ModelLoadingOptions, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
3106
+ delete(elementIds: ModelElementIds[]): boolean;
2786
3107
  /**
2787
- * unloads model part from the viewer
2788
- * @param modelPart - model part id or model part instance
3108
+ * Add deletion filter.
3109
+ * @param filter - filter to add.
2789
3110
  */
2790
- unloadModelPart(modelPart?: string | ModelPart): void;
2791
- setVirtualOrigin(point: Point3): void;
2792
- getVirtualOrigin(): Point3;
3111
+ addDeletionFilter(filter: DeleteEventFilter): void;
2793
3112
  /**
2794
- * Makes screenshot
2795
- * @param {string} [mimeType=image/png] Image MIME type.
2796
- * @param {number} [qualityArgument=1.0] Image quality to be used for image/jpeg or image/webp formats.
2797
- * @returns Blob object representing render image.
3113
+ * Remove deletion filter.
3114
+ * @param filter - filter to remove.
2798
3115
  */
2799
- makeScreenshot(mimeType?: string, quality?: number): Promise<Blob>;
2800
- setThemeFromSettings(): void;
2801
- }
2802
- export class ViewerToolbar extends Toolbar {
2803
- }
2804
- export class GuiViewer3D extends Viewer3D {
2805
- loadModelPart(buffer: ArrayBuffer, options: ModelLoadingOptions, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
2806
- getToolbar(): ViewerToolbar;
2807
- onPostExtensionLoad(extension: ExtensionBase): void;
2808
- protected getToolbarHeight(): number;
2809
- }
2810
- export abstract class SettingsBase implements ISettings {
2811
- protected _eventDispatcher: IEventsDispatcher;
2812
- protected _storage: ISettingsStorage;
2813
- changeSetting<T>(name: string, value: T, notify?: boolean, providedData?: any): void;
2814
- getSettingValue<T>(name: string): T;
2815
- protected abstract getKeyWithPrefix(key: string): string;
2816
- }
2817
- export type InitializeSuccessCallback = () => void;
2818
- export function coreInitializer(options: InitializerOptions, callback: InitializeSuccessCallback): void;
2819
- export function coreShutdown(): void;
2820
- export function CreateViewer(container: HTMLElement, configuration?: Viewer3DConfiguration): GuiViewer3D;
2821
- export function CreateBasicViewer(container: HTMLElement, configuration?: Viewer3DConfiguration): Viewer3D;
2822
- /**
2823
- * @param options
2824
- * @param callback
2825
- */
2826
- export function Initializer(options: InitializerOptions, callback: InitializeSuccessCallback): void;
2827
- export function shutdown(): void;
2828
- export class Extension extends ExtensionBase {
2829
- protected _viewer: Viewer3D;
2830
-
2831
- constructor(viewer: Viewer3D, options?: object);
2832
- }
2833
- export class GizmoMaterials {
2834
- static gizmoMaterial: THREE.MeshBasicMaterial;
2835
- static matInvisible: THREE.MeshBasicMaterial;
2836
- static matRed: THREE.MeshBasicMaterial;
2837
- static matGreen: THREE.MeshBasicMaterial;
2838
- static matBlue: THREE.MeshBasicMaterial;
2839
- static matYellow: THREE.MeshBasicMaterial;
2840
- static matViolet: THREE.MeshBasicMaterial;
2841
- static matYellowTransparent: THREE.MeshBasicMaterial;
2842
- static init(): void;
2843
- }
2844
- export interface IGizmoObject extends THREE.Object3D {
2845
- getHovered(): boolean;
2846
- setHovered(value: boolean): void;
2847
- getActive(): boolean;
2848
- setActive(value: boolean): void;
2849
- dispose(): void;
2850
- }
2851
- export class GizmoObject extends THREE.Object3D implements IGizmoObject {
2852
- protected _meshes: THREE.Mesh[];
2853
- readonly baseMaterial: THREE.Material;
2854
- readonly hoverMaterial: THREE.Material;
2855
- readonly activeMaterial: THREE.Material;
2856
-
2857
- constructor(_meshes: THREE.Mesh[], baseMaterial?: THREE.Material, hoverMaterial?: THREE.Material, activeMaterial?: THREE.Material);
2858
- getHovered(): boolean;
2859
- setHovered(value: boolean): void;
2860
- getActive(): boolean;
2861
- setActive(value: boolean): void;
2862
- dispose(): void;
2863
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
2864
- }
2865
- export abstract class GizmoAxis extends THREE.Object3D implements IGizmoObject {
2866
- readonly handle: IGizmoObject;
2867
- readonly picker?: IGizmoObject;
2868
- readonly helper?: IGizmoObject;
2869
- protected _isHovered: boolean;
2870
- protected _isActive: boolean;
2871
- protected _plane: THREE.Plane;
2872
- protected _axisDir: THREE.Vector3;
2873
- protected _raycaster: THREE.Raycaster;
2874
- protected _worldPositionStart: THREE.Vector3;
2875
- protected _worldQuaternionStart: THREE.Quaternion;
2876
- protected _worldAxisDir: THREE.Vector3;
2877
- protected _startPoint: THREE.Vector3;
2878
- protected _endPoint: THREE.Vector3;
2879
- getActive(): boolean;
2880
- setActive(value: boolean): void;
2881
- getHovered(): boolean;
2882
- setHovered(value: boolean): void;
2883
- dispose(): void;
2884
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
2885
- abstract moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2886
- protected abstract updateGizmoPlane(camera: THREE.Camera): void;
2887
- protected setStartPt(ndcPos: THREE.Vector2, camera: THREE.Camera): void;
2888
- }
2889
- export class GizmoTranslationAxis extends GizmoAxis {
2890
- readonly handle: IGizmoObject;
2891
- readonly picker?: IGizmoObject;
2892
- readonly helper?: IGizmoObject;
2893
-
2894
- constructor(axisDir: THREE.Vector3, handle: IGizmoObject, picker?: IGizmoObject, helper?: IGizmoObject);
2895
- moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2896
- protected updateGizmoPlane(camera: THREE.Camera): void;
2897
- }
2898
- export class GizmoRotationAxis extends GizmoAxis {
2899
- readonly handle: IGizmoObject;
2900
- readonly picker?: IGizmoObject;
2901
- readonly helper?: IGizmoObject;
2902
- moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2903
- protected updateGizmoPlane(camera: THREE.Camera): void;
2904
- }
2905
- export class GizmoScaleAxis extends GizmoAxis {
2906
- readonly handle: IGizmoObject;
2907
- readonly picker?: IGizmoObject;
2908
- readonly helper?: IGizmoObject;
2909
- moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2910
- protected updateGizmoPlane(camera: THREE.Camera): void;
2911
- }
2912
- export class GizmoControl extends THREE.Object3D {
2913
-
2914
- constructor(camera: THREE.Camera, navAgent: INavigationAgent);
2915
- attachTo(object: THREE.Object3D, asChild?: boolean): void;
2916
- detach(): void;
2917
- addAxis(axis: GizmoAxis): void;
2918
- dispose(): void;
2919
- updateMatrixWorld(force?: boolean): void;
2920
- updateGizmoOffset(position?: THREE.Vector3, quaternion?: THREE.Quaternion): void;
2921
- }
2922
- export enum GizmoAxisDir {
2923
- NONE = 0,
2924
- X = 1,
2925
- Y = 2,
2926
- Z = 4,
2927
- XY = 3,
2928
- YZ = 6,
2929
- XZ = 5,
2930
- XYZ = 7
2931
- }
2932
- export class GizmoBuilder {
2933
- static build(camera: THREE.Camera, navAgent: INavigationAgent, translation?: GizmoAxisDir, rotation?: GizmoAxisDir, scale?: GizmoAxisDir): GizmoControl;
2934
- static buildTranslationAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material, pickerBaseMatrial?: THREE.Material, pickerHoveredMaterial?: THREE.Material, pickerSelectedMaterial?: THREE.Material): GizmoAxis;
2935
- static buildRotationAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material, pickerBaseMatrial?: THREE.Material, pickerHoveredMaterial?: THREE.Material, pickerSelectedMaterial?: THREE.Material): GizmoAxis;
2936
- static buildScaleAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material): GizmoAxis;
2937
- }
2938
- export interface LabelSpriteParameters {
2939
- text?: string | undefined;
2940
- sizeAttenuation?: boolean | undefined;
2941
- fontFace?: string | FontFace | undefined;
2942
- fontSize?: number | undefined;
2943
- borderColor?: Color | undefined;
2944
- backgroundColor?: Color | undefined;
2945
- borderThickness?: number | undefined;
2946
- borderRadius?: number | undefined;
2947
- textColor?: Color | undefined;
2948
- textPadding?: THREE.Vector4Tuple | undefined;
3116
+ removeDeletionFilter(filter: DeleteEventFilter): void;
2949
3117
  }
2950
- export class LabelSprite extends THREE.Sprite {
2951
- readonly extraHeightFactor = 1.4;
2952
- material: CustomSpriteMaterial;
2953
-
2954
- constructor(parameters: LabelSpriteParameters);
2955
- get sizeAttenuation(): boolean;
2956
- set sizeAttenuation(value: boolean);
3118
+ export interface INavigation {
2957
3119
  /**
2958
- * @default ''
3120
+ * Register navigation tool.
2959
3121
  */
2960
- get text(): string;
2961
- set text(value: string);
3122
+ registerNavigation(navigationTool: INavigationTool): void;
2962
3123
  /**
2963
- * @default 'Roboto, sans-serif'
2964
- */
2965
- get fontFace(): string | FontFace;
2966
- set fontFace(value: string | FontFace);
3124
+ * Unregister navigation tool.
3125
+ */
3126
+ unregisterNavigation(navigationTool: INavigationTool): void;
2967
3127
  /**
2968
- * @default 12
2969
- */
2970
- get fontSize(): number;
2971
- set fontSize(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;
2972
3132
  /**
2973
- * @default 2
2974
- */
2975
- get borderThickness(): number;
2976
- set borderThickness(value: number);
3133
+ * Get active navigation tool.
3134
+ */
3135
+ getActiveNavigation(): INavigationTool | null;
2977
3136
  /**
2978
- * @default new Color(0, 0, 0, 1.0)
2979
- */
2980
- get borderColor(): Color;
2981
- set borderColor(value: Color);
3137
+ * Get navigation agent.
3138
+ */
3139
+ getNavigationAgent(): INavigationAgent;
2982
3140
  /**
2983
- * @default 1
2984
- */
2985
- get borderRadius(): number;
2986
- set borderRadius(value: number);
3141
+ * Gets navigation area rectangle
3142
+ */
3143
+ getNavigationArea(): DOMRect;
2987
3144
  /**
2988
- * @default new Color(1.0, 1.0, 1.0, 1.0)
2989
- */
2990
- get backgroundColor(): Color;
2991
- set backgroundColor(value: Color);
3145
+ * Sets the camera parameters.
3146
+ */
3147
+ setCameraParameters(params: CameraParameters): void;
2992
3148
  /**
2993
- * @default new Color(0, 0, 0, 1.0)
2994
- */
2995
- get textColor(): Color;
2996
- set textColor(value: Color);
3149
+ * Gets the camera parameters.
3150
+ */
3151
+ getCameraParameters(): CameraParameters;
2997
3152
  /**
2998
- * Label text padding: left, top, right, bottom
2999
- * @default [0, 0, 0, 0]
3153
+ * Gets the camera control.
3000
3154
  */
3001
- get textPadding(): THREE.Vector4Tuple;
3002
- set textPadding(value: THREE.Vector4Tuple);
3003
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
3004
- dispose(): void;
3005
- }
3006
- export interface MeshPointMaterialParameters extends THREE.ShaderMaterialParameters {
3007
- sizeAttenuation?: boolean | undefined;
3008
- discreteClipping?: boolean | undefined;
3009
- }
3010
- export class MeshPointMaterial extends CustomMaterial {
3011
-
3012
- constructor(parameters?: MeshPointMaterialParameters);
3155
+ getCameraControl(): ICameraControl;
3013
3156
  /**
3014
- * @default true
3157
+ * Gets the Three.js camera.
3015
3158
  */
3016
- get discreteClipping(): boolean;
3017
- set discreteClipping(value: boolean);
3018
- get resolution(): THREE.Vector2;
3159
+ getCamera(): THREE.Camera;
3019
3160
  /**
3020
- * @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
3021
3166
  */
3022
- sizeAttenuation: boolean;
3023
- copy(source: MeshPointMaterial): this;
3024
- protected refreshUniforms(uniforms: {
3025
- [uniform: string]: THREE.IUniform<any>;
3026
- }, material: CustomMaterial, renderer: THREE.WebGLRenderer): void;
3027
- }
3028
- export interface MeshPointParamter {
3029
- point?: THREE.Vector3;
3030
- color?: Color;
3031
- size?: number;
3032
- }
3033
- export class MeshPoints extends THREE.Mesh {
3034
- geometry: THREE.InstancedBufferGeometry;
3035
- material: MeshPointMaterial;
3036
-
3037
- constructor();
3167
+ fitToView(elementIds: string[] | string, modelPart: string | ModelPart, immediate?: boolean): void;
3038
3168
  /**
3039
- * @default new Color( 1,1,1,1 )
3040
- */
3041
- color: Color;
3169
+ * Sets the camera pivot point.
3170
+ */
3171
+ setPivotPoint(point: Point3): void;
3042
3172
  /**
3043
- * @default 1
3044
- */
3045
- pointSize: number;
3173
+ * Gets the camera pivot point.
3174
+ */
3175
+ getPivotPoint(): Point3;
3046
3176
  /**
3047
- * @default new THREE.Vector3(0, 0, 0)
3048
- */
3049
- point: THREE.Vector3;
3050
- addPoint(pointParameter?: MeshPointParamter): number;
3051
- updatePoint(index: number, pointParameter: MeshPointParamter): void;
3052
- removePoint(index: number): this;
3053
- updateAttributes(): void;
3054
- dispose(): void;
3055
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
3056
- }
3057
- export interface IWindowStyle {
3058
- width: string;
3059
- height: string;
3060
- left: string;
3061
- right: string;
3062
- top: string;
3063
- }
3064
- export interface IWindowStateOptions {
3065
- saveKey: string;
3066
- restoreWindowSize: boolean;
3067
- }
3068
- export class WindowStater {
3069
- get windowStylesState(): IWindowStyle;
3070
- get windowOptionsState(): IWindowStateOptions;
3071
- restore(): void;
3072
- saveWindowState(): void;
3073
- }
3074
- export class Resizer {
3075
-
3076
- constructor(resizableContainer: HTMLElement, containerToRestriction: HTMLElement, elementAnchor?: HTMLElement, windowStater?: WindowStater);
3077
- get windowState(): IWindowStyle | null;
3177
+ * Reset the camera pivot point.
3178
+ */
3179
+ resetPivotPoint(): void;
3078
3180
  }
3079
- export class Dragger {
3080
-
3081
- constructor(allowedDraggableElement: HTMLElement, draggableContainer: HTMLElement, containerToRestriction: HTMLElement, windowStater?: WindowStater);
3082
- get windowState(): IWindowStyle | null;
3181
+ export class ModelLoadingOptions {
3182
+ guid: string;
3183
+ isConsolidatedModel?: boolean;
3083
3184
  }
3084
- export class Button extends Control {
3085
-
3086
- constructor(id: string);
3087
- setIsChecked(value: boolean): void;
3088
- setState(state: ControlState.State): boolean;
3089
- setText(text: string): void;
3090
- getState(): ControlState.State;
3091
- setIcon(iconClassName: string): void;
3092
- 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>;
3093
3190
  /**
3094
- * Override this method to be notified when the user clicks on the button.
3095
- * @param {MouseEvent} event
3191
+ * Returns general model
3192
+ * @returns { Model } - general model
3096
3193
  */
3097
- 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;
3098
3201
  /**
3099
- * Override this method to be notified when the mouse enters the button.
3100
- * @param {MouseEvent} event
3202
+ * Loads new model part to the viewer
3203
+ * @param buffer
3204
+ * @param options
3205
+ * @param onSuccessCallback
3206
+ * @param onErrorCallback
3101
3207
  */
3102
- onMouseOver: (event: MouseEvent) => void;
3208
+ loadModelPart(data: ArrayBuffer | string, options: ModelLoadingOptions, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
3103
3209
  /**
3104
- * Override this method to be notified when the mouse leaves the button.
3105
- * @param {MouseEvent} event
3210
+ * unloads model part from the viewer
3211
+ * @param modelPart - model part id or model part instance
3106
3212
  */
3107
- onMouseOut: (event: MouseEvent) => void;
3108
- }
3109
- export namespace Button {
3110
- enum Event {
3111
- STATE_CHANGED = "Button.StateChanged",
3112
- CLICK = "click"
3113
- }
3114
- }
3115
- export class SubMenu implements IMenu {
3116
- readonly controls: IControl[];
3117
- set selectedIndex(value: number);
3118
- get selectedIndex(): number;
3119
- setEnabled(index: number, value: boolean): void;
3120
- addControl(control: IControl, index?: number): void;
3121
- removeControl(index?: number): void;
3122
- clearList(): void;
3123
- changeControl(item: IControl, index: number): void;
3124
- getControlsCount(): number;
3125
- }
3126
- export class ComboButton extends Control {
3127
-
3128
- constructor(id: string, selectedIndex?: number);
3129
- get subMenu(): SubMenu;
3213
+ unloadModelPart(modelPart?: string | ModelPart): void;
3214
+ setVirtualOrigin(point: Point3): Promise<void>;
3215
+ getVirtualOrigin(): Point3;
3130
3216
  /**
3131
- * Override this method to be notified when the user clicks on the button.
3132
- * @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.
3133
3221
  */
3134
- onClick: (event: PointerEvent) => void;
3135
- onOpen: () => void;
3136
- onClose: () => void;
3137
- setState(state: ControlState.State): boolean;
3138
- setText(text: string): void;
3139
- setFromSvgTemlate(template: string): void;
3140
- }
3141
- export class Checkbox {
3142
-
3143
- constructor(id: string, checked: boolean, disabled: boolean, placeholder: string);
3144
- get checked(): boolean;
3145
- set checked(value: boolean);
3146
- get disabled(): boolean;
3147
- set disabled(value: boolean);
3148
- get label(): HTMLLabelElement;
3149
- onChange(value: boolean): void;
3150
- createElement(): Element;
3151
- }
3152
- interface ISelectItem {
3153
- text: string;
3154
- value: string;
3155
- }
3156
- export class Select {
3157
-
3158
- constructor(id: string, items: ISelectItem[], placeholder: string);
3159
- get select(): HTMLElement;
3160
- get disabled(): boolean;
3161
- set disabled(value: boolean);
3162
- get selectedIndex(): number;
3163
- set selectedIndex(value: number);
3164
- get placeholder(): string;
3165
- set placeholder(value: string);
3166
- get label(): HTMLElement;
3167
- get previousSelectedIndex(): number;
3168
- onChange({ index, value }: {
3169
- index: any;
3170
- value: any;
3171
- }): void;
3172
- update(array: ISelectItem[], selectedIndex?: number): void;
3222
+ makeScreenshot(mimeType?: string, quality?: number): Promise<Blob>;
3223
+ setThemeFromSettings(): void;
3173
3224
  }
3174
- export {};
3175
- interface ElementClass {
3176
- panelClassName?: string;
3177
- contentClassName?: string;
3178
- 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;
3179
3230
  }
3180
- export class Dialog extends Control {
3181
- 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;
3182
3241
 
3183
- constructor(id: string, panelToAttach: HTMLElement);
3184
- get dialog(): HTMLElement;
3185
- get dialogContent(): HTMLElement;
3186
- get resizable(): boolean;
3187
- setDialogContent(value: HTMLElement): Dialog;
3188
- setHeader(value: HTMLElement): Dialog;
3189
- setCaption(value: string): Dialog;
3190
- setSvgIcon(template: string): Dialog;
3191
- setFooter(value: HTMLElement): Dialog;
3192
- setDialogElementClassNames(value: ElementClass): Dialog;
3193
- setResizable(value: boolean): Dialog;
3194
- setWindowOptions(value: IWindowStateOptions): Dialog;
3195
- setDraggable(value: boolean): Dialog;
3196
- openDialog(x?: number, y?: number): HTMLElement;
3197
- destroyDialog(): void;
3198
- isDialogShown(): boolean;
3199
- subscribe(fn: (state: boolean) => void): void;
3242
+ constructor(viewer: Viewer3D, options?: object);
3200
3243
  }
3201
- export {};
3202
3244
 
3203
3245
  }