@pilotdev/pilot-web-3d 23.0.6-alpha.1 → 23.0.6

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 +191 -54
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -4,9 +4,20 @@ export class InitializerOptions {
4
4
  libList?: string[];
5
5
  language?: string;
6
6
  }
7
+ class Global {
8
+ G: any;
9
+ RESOURCE_ROOT: string;
10
+ initializeResourceRoot(options: InitializerOptions): void;
11
+ getResourceUrl(resourceRelativePath: string): string;
12
+ }
13
+ export const global: Global;
14
+ export {};
15
+ export type StringMap = {
16
+ [key: string]: any;
17
+ };
7
18
  export class Localization {
8
19
  static initialize(options: any): Promise<void>;
9
- static translate(stringToTrans: string): string;
20
+ static translate<T extends (string | StringMap) = string>(stringToTrans: string): T;
10
21
  static setLanguage(language: string): Promise<void>;
11
22
  static extendLocalization(locales: any): boolean;
12
23
  }
@@ -24,6 +35,7 @@ export class ExtensionLoader {
24
35
  loadExtension(extensionId: string): Promise<ExtensionBase>;
25
36
  unloadExtension(extensionId: string): Promise<boolean>;
26
37
  getExtensions(): string[];
38
+ getExtension(extensionId: string): ExtensionBase;
27
39
  }
28
40
  export interface ILayerManager {
29
41
  createLayer(name: string): ILayer;
@@ -58,6 +70,7 @@ export class CoreEventTypes {
58
70
  static VIEWER_MOUSE_LONG_TOUCH_EVENT: string;
59
71
  static SETTING_CHANGED_EVENT: string;
60
72
  static SETTING_RESET_EVENT: string;
73
+ static SETTING_LANGUAGE_CHANGED_EVENT: string;
61
74
  }
62
75
  export interface ISettingsStorage {
63
76
  clear(): void;
@@ -87,11 +100,11 @@ export interface ISettings {
87
100
  changeSetting<T>(name: string, value: T, notify?: boolean, providedData?: any): void;
88
101
  getSettingValue<T>(name: string): T;
89
102
  }
90
- export class BaseSettingsNames {
91
- static TOOLBAR: string;
92
- static TOOLBAR_DIRECTION: string;
93
- static TOOLBAR_CONTENT: string;
94
- static THEME: string;
103
+ export enum BaseSettingsNames {
104
+ TOOLBAR = "toolbar",
105
+ TOOLBAR_DIRECTION = "toolbarDirection",
106
+ TOOLBAR_CONTENT = "toolbarContent",
107
+ THEME = "theme"
95
108
  }
96
109
  export class SettingChangedEvent extends Event {
97
110
  name: string;
@@ -122,13 +135,9 @@ export enum ToolbarContent {
122
135
  START = "ascn-toolbar-content-start",
123
136
  END = "ascn-toolbar-content-end"
124
137
  }
125
- export interface ToolbarOptions {
126
- height: number;
127
- direction: ToolbarDirection;
128
- }
129
138
  export interface ToolbarStyle {
130
- direction?: ToolbarDirection;
131
- content?: ToolbarContent;
139
+ [BaseSettingsNames.TOOLBAR_DIRECTION]?: ToolbarDirection;
140
+ [BaseSettingsNames.TOOLBAR_CONTENT]?: ToolbarContent;
132
141
  }
133
142
  export const defaultToolbarAppearance: ToolbarStyle;
134
143
  export type ViewerSettings = Record<string, any>;
@@ -136,6 +145,7 @@ export class ViewerConfiguration {
136
145
  settingsPrefix: string;
137
146
  appearance: ViewerSettings;
138
147
  createConfiguration(configuration: ViewerSettings, origin: ViewerSettings): void;
148
+ mergeConfigurationAndSettings(configuration: ViewerSettings, settings: ISettings): void;
139
149
  changeTheme(newTheme: string): void;
140
150
  }
141
151
  export type ErrorCallback = (message: string) => void;
@@ -183,7 +193,7 @@ export class Control {
183
193
  export class Toolbar extends Control {
184
194
 
185
195
  constructor(id: string, toolbarContainer: HTMLElement, options?: ToolbarStyle);
186
- addControl(control: Control): void;
196
+ addControl(control: Control, index?: number): void;
187
197
  removeControl(id: string): void;
188
198
  changeToolbarPosition(direction: string): void;
189
199
  changeToolbarContent(content: string): void;
@@ -258,12 +268,18 @@ export abstract class ViewObject extends THREE.Object3D {
258
268
  protected _isVisible: boolean;
259
269
  protected _isHidden: boolean;
260
270
  protected _originalColor: Color;
261
- /**model element entity guid */
271
+ /**
272
+ * model element entity guid
273
+ * @default zeroGuid
274
+ */
262
275
  readonly entityGuid: string;
263
- /**model part guid */
276
+ /**
277
+ * model part guid
278
+ * @default zeroGuid
279
+ */
264
280
  readonly modelGuid: string;
265
281
 
266
- constructor(entityGuid: string, modelGuid: string, color: Color);
282
+ constructor(entityGuid?: string, modelGuid?: string, color?: Color);
267
283
  /**Mesh representation of the object */
268
284
  abstract get mesh(): THREE.Mesh | null;
269
285
  /**Edge representation of the object */
@@ -575,6 +591,34 @@ export class CustomPointMaterial extends CustomMaterial {
575
591
  protected onBeforeRender(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.BufferGeometry, material: THREE.Material, group: THREE.Group): void;
576
592
  copy(source: CustomPointMaterial): this;
577
593
  }
594
+ export namespace Viewer3DIcons {
595
+ const VIEWER_SETTINGS_ICON: string;
596
+ const VIEWER_MODEL_BROWSER_ICON: string;
597
+ const VIEWER_FULL_SCREEN_ICON: string;
598
+ const VIEWER_COLLAPSE_ICON: string;
599
+ const VIEWER_ELEMENT_PROPERTIES_ICON: string;
600
+ const VIEWER_ADD_CLIPPING_PLANE_ICON: string;
601
+ const VIEWER_CLIPPING_FLIP_ICON: string;
602
+ const VIEWER_DELETE_CLIPPING_PLANE_ICON: string;
603
+ const VIEWER_CLIPPING_CUBE_ICON: string;
604
+ const VIEWER_ADD_REMARK_ICON: string;
605
+ const VIEWER_MEASUREMENT_EDGE_ICON: string;
606
+ const VIEWER_MEASUREMENT_PLANE_ICON: string;
607
+ const VIEWER_MEASUREMENT_DIMENSION_ICON: string;
608
+ }
609
+ export namespace ViewerGeneralIcons {
610
+ const ZOOM_IN: string;
611
+ const ZOOM_OUT: string;
612
+ const CLOSE: string;
613
+ const STRETCH_WINDOW: string;
614
+ const EXPAND_TREE: string;
615
+ const COLLAPSE_TREE: string;
616
+ const ARROW_DROP_DOWN: string;
617
+ const ARROW_DROP_RIGHT: string;
618
+ const CIRCLE_ICON: string;
619
+ const SHOW: string;
620
+ const HIDE: string;
621
+ }
578
622
  export class MeshLineGeometry extends THREE.InstancedBufferGeometry {
579
623
  type: string;
580
624
  instanceStart: THREE.BufferAttribute;
@@ -718,11 +762,33 @@ export interface IEventSigner<Data> {
718
762
  allowMissing?: boolean;
719
763
  }): boolean;
720
764
  }
721
-
765
+ export interface IDisposable {
766
+ dispose(): void;
767
+ }
768
+ export class DisposeBy implements IDisposable {
769
+
770
+ constructor(callback: () => void);
771
+ dispose(): void;
772
+ }
773
+ class RevertProperty<T, P extends keyof T> implements IDisposable {
774
+ dispose(): void;
775
+ }
776
+ export function changeProperty<T, P extends keyof T>(who: T, propName: P, newValue: T[P]): RevertProperty<T, P>;
777
+ export class MergeDisposables implements IDisposable {
778
+
779
+ constructor(handles: IDisposable[]);
780
+ push(...moreHandles: IDisposable[]): void;
781
+ dispose(): void;
782
+ }
783
+ class RemoveDomHandler implements IDisposable {
784
+ dispose(): void;
785
+ }
786
+ export function addDomListener<DomElement extends HTMLElement, Type extends keyof HTMLElementEventMap>(domElement: DomElement, type: Type, listener: (this: HTMLElement, ev: HTMLElementEventMap[Type]) => any): RemoveDomHandler;
787
+ export {};
722
788
  export interface EventEmitter<Data> {
723
789
  emit(data?: Data, options?: object): void;
724
790
  }
725
- export class EventListener<Data> implements IEventListener<Data>, Disposable {
791
+ export class RenderEventListener<Data> implements IEventListener<Data>, IDisposable {
726
792
 
727
793
  constructor(event: IEventSigner<Data>, func: EventFunction<Data>, options: {
728
794
  bind?: object;
@@ -732,7 +798,7 @@ export class EventListener<Data> implements IEventListener<Data>, Disposable {
732
798
  export class EventDispatcher<Data> implements IEventSigner<Data>, EventEmitter<Data> {
733
799
  listen(func: EventFunction<Data>, options?: {
734
800
  bind?: object;
735
- }): EventListener<Data>;
801
+ }): IEventListener<Data>;
736
802
  unlisten(func: EventFunction<Data>, options?: {
737
803
  bind?: object;
738
804
  allowMissing?: boolean;
@@ -871,7 +937,7 @@ export enum OperationPriority {
871
937
  afterAll = 100
872
938
  }
873
939
  export type RenderOperationDelegate = (context: IRenderOperationContext) => OperationStatus;
874
- export interface IUserScene {
940
+ export interface IUserScene extends THREE.Scene {
875
941
  /** Scene name */
876
942
  readonly name: string;
877
943
  /** Indicates whether the scene should to be updated (should to be managed)*/
@@ -880,8 +946,6 @@ export interface IUserScene {
880
946
  get needsRedraw(): boolean;
881
947
  /** Gets the scene intersection checker */
882
948
  get intersectionChecker(): IModelIntersectionChecker | null;
883
- /** Gets the THREE.Object3D representation of the scene */
884
- get threeObjectRepresentation(): THREE.Object3D | null;
885
949
  /** Sets clipping enable */
886
950
  set clippingEnable(value: boolean);
887
951
  /** Indicates whether the scene should be clipped */
@@ -903,13 +967,13 @@ export interface IUserScene {
903
967
  /** Render scene */
904
968
  render(context: IRenderOperationContext): void;
905
969
  /** Clear scene */
906
- clear(): void;
970
+ clear(): this;
907
971
  /** Dispose scene */
908
972
  dispose(): void;
909
973
  }
910
974
  export interface I3DRenderer {
911
975
  clear(color?: boolean, depth?: boolean, stencil?: boolean): void;
912
- setClearColor(color: ColorRepresentation, alpha?: number): void;
976
+ setClearColor(color: THREE.ColorRepresentation, alpha?: number): void;
913
977
  clearDepth(): void;
914
978
  render(scene: THREE.Object3D, camera: THREE.Camera): void;
915
979
  getSize(target: THREE.Vector2): THREE.Vector2;
@@ -2299,6 +2363,7 @@ export class EventTypes extends CoreEventTypes {
2299
2363
  static CAMERA_NAVIGATION_MODE_CHANGED_EVENT: string;
2300
2364
  static RENDER_CLICK_EVENT: string;
2301
2365
  static RENDER_HOVER_EVENT: string;
2366
+ static RENDER_DOUBLE_CLICK_EVENT: string;
2302
2367
  }
2303
2368
  export class SelectionChangedEvent extends Event {
2304
2369
  selectedIds: ModelElementIds[];
@@ -2474,16 +2539,65 @@ export interface INavigation {
2474
2539
  */
2475
2540
  resetPivotPoint(): void;
2476
2541
  }
2542
+ export interface CustomSpriteMaterialParameters extends THREE.ShaderMaterialParameters {
2543
+ color?: THREE.ColorRepresentation | undefined;
2544
+ map?: THREE.Texture | null | undefined;
2545
+ alphaMap?: THREE.Texture | null | undefined;
2546
+ rotation?: number | undefined;
2547
+ sizeAttenuation?: boolean | undefined;
2548
+ fog?: boolean | undefined;
2549
+ center?: THREE.Vector2 | undefined;
2550
+ }
2551
+ export class CustomSpriteMaterial extends CustomMaterial {
2552
+ type: string;
2553
+ readonly isSpriteMaterial: true;
2554
+
2555
+ constructor(parameters?: CustomSpriteMaterialParameters);
2556
+ /**
2557
+ * @default new THREE.Color( 0xffffff )
2558
+ */
2559
+ color: THREE.Color;
2560
+ /**
2561
+ * @default null
2562
+ */
2563
+ map: THREE.Texture | null;
2564
+ /**
2565
+ * @default null
2566
+ */
2567
+ alphaMap: THREE.Texture | null;
2568
+ /**
2569
+ * @default 0
2570
+ */
2571
+ rotation: number;
2572
+ /**
2573
+ * @default true
2574
+ */
2575
+ sizeAttenuation: boolean;
2576
+ /**
2577
+ * @default true
2578
+ */
2579
+ transparent: boolean;
2580
+ /**
2581
+ * Whether the material is affected by fog. Default is true.
2582
+ * @default fog
2583
+ */
2584
+ fog: boolean;
2585
+ /**
2586
+ * @default new THREE.Vector2(0.5, 0.5)
2587
+ */
2588
+ center: THREE.Vector2;
2589
+ get resolution(): THREE.Vector2;
2590
+ set resolution(value: THREE.Vector2);
2591
+ protected refreshUniformsCommon(uniforms: {
2592
+ [uniform: string]: THREE.IUniform;
2593
+ }, material: CustomSpriteMaterial, renderer: THREE.WebGLRenderer): void;
2594
+ protected onBeforeRender(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.BufferGeometry, material: THREE.Material, group: THREE.Group): void;
2595
+ copy(source: CustomSpriteMaterial): this;
2596
+ }
2477
2597
  export class ModelLoadingOptions {
2478
2598
  guid: string;
2479
2599
  isConsolidatedModel?: boolean;
2480
2600
  }
2481
- export class EventsObserver {
2482
- protected eventsDispatcher: IEventsDispatcher;
2483
- protected _listeners: Map<string, EventListener>;
2484
- watch(): void;
2485
- dispose(): void;
2486
- }
2487
2601
  /**
2488
2602
  * This class describes the coordination model. The coordination model contains parts of the model (aka ModelPart).
2489
2603
  */
@@ -2827,6 +2941,53 @@ export class LabelSprite extends THREE.Sprite {
2827
2941
  set textPadding(value: THREE.Vector4Tuple);
2828
2942
  dispose(): void;
2829
2943
  }
2944
+ export interface MeshPointMaterialParameters extends THREE.ShaderMaterialParameters {
2945
+ sizeAttenuation?: boolean | undefined;
2946
+ }
2947
+ export class MeshPointMaterial extends CustomMaterial {
2948
+
2949
+ constructor(parameters?: MeshPointMaterialParameters);
2950
+ /**
2951
+ * @default true
2952
+ */
2953
+ sizeAttenuation: boolean;
2954
+ get resolution(): THREE.Vector2;
2955
+ set resolution(value: THREE.Vector2);
2956
+ protected refreshUniformsCommon(uniforms: {
2957
+ [uniform: string]: THREE.IUniform;
2958
+ }, material: MeshPointMaterial, renderer: THREE.WebGLRenderer): void;
2959
+ protected onBeforeRender(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.BufferGeometry, material: THREE.Material, group: THREE.Group): void;
2960
+ copy(source: MeshPointMaterial): this;
2961
+ }
2962
+ export interface MeshPointParamter {
2963
+ point?: THREE.Vector3;
2964
+ color?: Color;
2965
+ size?: number;
2966
+ }
2967
+ export class MeshPoints extends THREE.Mesh {
2968
+ geometry: THREE.InstancedBufferGeometry;
2969
+ material: MeshPointMaterial;
2970
+
2971
+ constructor();
2972
+ /**
2973
+ * @default new Color( 1,1,1,1 )
2974
+ */
2975
+ color: Color;
2976
+ /**
2977
+ * @default 1
2978
+ */
2979
+ pointSize: number;
2980
+ /**
2981
+ * @default new THREE.Vector3(0, 0, 0)
2982
+ */
2983
+ point: THREE.Vector3;
2984
+ addPoint(pointParameter?: MeshPointParamter): number;
2985
+ updatePoint(index: number, pointParameter: MeshPointParamter): void;
2986
+ removePoint(index: number): this;
2987
+ updateAttributes(): void;
2988
+ dispose(): void;
2989
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
2990
+ }
2830
2991
  export interface IWindowStyle {
2831
2992
  width: string;
2832
2993
  height: string;
@@ -2854,30 +3015,6 @@ export class Dragger {
2854
3015
  constructor(allowedDraggableElement: HTMLElement, draggableContainer: HTMLElement, containerToRestriction: HTMLElement, windowStater?: WindowStater);
2855
3016
  get windowState(): IWindowStyle | null;
2856
3017
  }
2857
- export namespace Viewer3DIcons {
2858
- const VIEWER_SETTINGS_ICON: string;
2859
- const VIEWER_MODEL_BROWSER_ICON: string;
2860
- const VIEWER_FULL_SCREEN_ICON: string;
2861
- const VIEWER_COLLAPSE_ICON: string;
2862
- const VIEWER_ELEMENT_PROPERTIES_ICON: string;
2863
- const VIEWER_ADD_CLIPPING_PLANE_ICON: string;
2864
- const VIEWER_CLIPPING_FLIP_ICON: string;
2865
- const VIEWER_DELETE_CLIPPING_PLANE_ICON: string;
2866
- const VIEWER_CLIPPING_CUBE_ICON: string;
2867
- const VIEWER_DISABLED_DELETE_CLIPPING_PLANE_ICON: string;
2868
- const VIEWER_DISABLED_CLIPPING_FLIP_ICON: string;
2869
- const VIEWER_ADD_REMARK_ICON: string;
2870
- }
2871
- export namespace ViewerGeneralIcons {
2872
- const ZOOM_IN: string;
2873
- const ZOOM_OUT: string;
2874
- const CLOSE: string;
2875
- const STRETCH_WINDOW: string;
2876
- const EXPAND_TREE: string;
2877
- const COLLAPSE_TREE: string;
2878
- const ARROW_DROP_DOWN: string;
2879
- const ARROW_DROP_RIGHT: string;
2880
- }
2881
3018
  export class Button extends Control {
2882
3019
 
2883
3020
  constructor(id: string);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pilotdev/pilot-web-3d",
3
- "version": "23.0.6-alpha.1",
3
+ "version": "23.0.6",
4
4
  "description": "TypeScript definitions for ASCON PilotWeb3D component",
5
5
  "main": "",
6
6
  "types": "index.d.ts",