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

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 +442 -374
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  /// <reference types="@types/three" />
2
2
  declare namespace PilotWeb3D {
3
+ export class InitializerOptions {
4
+ libList?: string[];
5
+ language?: string;
6
+ }
3
7
  export class Localization {
4
8
  static initialize(options: any): Promise<void>;
5
9
  static translate(stringToTrans: string): string;
@@ -83,11 +87,11 @@ export interface ISettings {
83
87
  changeSetting<T>(name: string, value: T, notify?: boolean, providedData?: any): void;
84
88
  getSettingValue<T>(name: string): T;
85
89
  }
86
-
87
90
  export class BaseSettingsNames {
88
91
  static TOOLBAR: string;
89
92
  static TOOLBAR_DIRECTION: string;
90
93
  static TOOLBAR_CONTENT: string;
94
+ static THEME: string;
91
95
  }
92
96
  export class SettingChangedEvent extends Event {
93
97
  name: string;
@@ -102,6 +106,11 @@ export abstract class SettingsBase implements ISettings {
102
106
  getSettingValue<T>(name: string): T;
103
107
  protected abstract getKeyWithPrefix(key: string): string;
104
108
  }
109
+ export enum SettingsTheme {
110
+ LIGHT_THEME = "ascn-light",
111
+ DARK_THEME = "ascn-dark"
112
+ }
113
+ export const defaultThemeAppearance: string;
105
114
  export enum ToolbarDirection {
106
115
  TOP_FIXED = "ascn-toolbar-direction-fixed-top",
107
116
  TOP_FLUENT = "ascn-toolbar-direction-top",
@@ -127,6 +136,7 @@ export class ViewerConfiguration {
127
136
  settingsPrefix: string;
128
137
  appearance: ViewerSettings;
129
138
  createConfiguration(configuration: ViewerSettings, origin: ViewerSettings): void;
139
+ changeTheme(newTheme: string): void;
130
140
  }
131
141
  export type ErrorCallback = (message: string) => void;
132
142
  export type SuccessCallback = (modelId: any) => void;
@@ -159,6 +169,7 @@ export abstract class ViewerBase {
159
169
  finish(): void;
160
170
  onPostExtensionLoad(extension: ExtensionBase): void;
161
171
  protected loadExtensions(): void;
172
+ protected setThemeFromSettings(): void;
162
173
  }
163
174
  export class Control {
164
175
  container: HTMLElement;
@@ -238,6 +249,7 @@ export class Color {
238
249
  alpha(): number;
239
250
  fromArray(array: ArrayLike<number>, offset?: number): Color;
240
251
  toArray(array: Array<number>, offset?: number): Array<number>;
252
+ clone(): Color;
241
253
  }
242
254
  export abstract class ViewObject extends THREE.Object3D {
243
255
  protected _isDisposed: boolean;
@@ -706,6 +718,34 @@ export interface IEventSigner<Data> {
706
718
  allowMissing?: boolean;
707
719
  }): boolean;
708
720
  }
721
+
722
+ export enum SelectionMode {
723
+ Append = 0,
724
+ Replace = 1
725
+ }
726
+ export class RenderViewSettings {
727
+ telemetry?: boolean;
728
+ hideEdgesWhenNavigation?: boolean;
729
+ antiAliasing?: boolean;
730
+ displayMode?: DisplayMode;
731
+ /** Desired render framerate */
732
+ desiredFramerate?: number;
733
+ /** Allocated time for rendering operations, excluding scene rendering */
734
+ manageTime?: number;
735
+ /** Draw hovered meshes on the `selectionScene` */
736
+ hoverMeshes?: boolean;
737
+ /** Draw hovered edges on the `selectionScene` */
738
+ hoverEdges?: boolean;
739
+ /** Draw selected meshes on the `selectionScene` */
740
+ selectEdges?: boolean;
741
+ /** Draw selected edges on the `selectionScene` */
742
+ selectMeshes?: boolean;
743
+ }
744
+ export enum DisplayMode {
745
+ FACES_AND_EDGES = 0,
746
+ FACES = 1
747
+ }
748
+ export const defaultRenderViewSettings: RenderViewSettings;
709
749
  export interface IModelIntersectionChecker {
710
750
  /** Gets the center of the model*/
711
751
  get modelCenter(): THREE.Vector3;
@@ -718,13 +758,15 @@ export interface IModelIntersectionChecker {
718
758
  /**
719
759
  * Gets {@link THREE.Intersection} between a casted {@link ray} and model object.
720
760
  * @param ray
761
+ * @param camera
721
762
  */
722
- getIntersectionByRay(ray: THREE.Ray): THREE.Intersection<THREE.Object3D> | undefined;
763
+ getIntersectionByRay(ray: THREE.Ray, camera: THREE.Camera): THREE.Intersection<THREE.Object3D> | undefined;
723
764
  /**
724
765
  * Gets ID of the model object intersected by {@link ray}
725
766
  * @param ray
767
+ * @param camera
726
768
  */
727
- getIntersectionIDByRay(ray: THREE.Ray): {
769
+ getIntersectionIDByRay(ray: THREE.Ray, camera: THREE.Camera): {
728
770
  modelId: string;
729
771
  guid: string;
730
772
  } | undefined;
@@ -755,29 +797,60 @@ export interface IModelIntersectionChecker {
755
797
  guid: string;
756
798
  }[];
757
799
  }
758
- export class RenderViewSettings {
759
- telemetry?: boolean;
760
- hideEdgesWhenNavigation?: boolean;
761
- antiAliasing?: boolean;
762
- displayMode?: DisplayMode;
763
- /** Desired render framerate */
764
- desiredFramerate?: number;
765
- /** Allocated time for rendering operations, excluding scene rendering */
766
- manageTime?: number;
767
- /** Draw hovered meshes on the `selectionScene` */
768
- hoverMeshes?: boolean;
769
- /** Draw hovered edges on the `selectionScene` */
770
- hoverEdges?: boolean;
771
- /** Draw selected meshes on the `selectionScene` */
772
- selectEdges?: boolean;
773
- /** Draw selected edges on the `selectionScene` */
774
- selectMeshes?: boolean;
800
+ export interface I3DRenderer {
801
+ clear(color?: boolean, depth?: boolean, stencil?: boolean): void;
802
+ setClearColor(color: THREE.ColorRepresentation, alpha?: number): void;
803
+ clearDepth(): void;
804
+ render(scene: THREE.Object3D, camera: THREE.Camera): void;
805
+ getSize(target: THREE.Vector2): THREE.Vector2;
806
+ setSize(width: number, height: number, updateStyle?: boolean): void;
807
+ setViewport(x: THREE.Vector4 | number, y?: number, width?: number, height?: number): void;
808
+ clippingPlanes: THREE.Plane[];
809
+ domElement: HTMLCanvasElement;
775
810
  }
776
- export enum DisplayMode {
777
- FACES_AND_EDGES = 0,
778
- FACES = 1
811
+ export interface IRenderViewer3D {
812
+ /** Gets model inetrsection checker. */
813
+ getIntersectionChecker(): IModelIntersectionChecker;
814
+ /** Request a full redraw of the canvas. */
815
+ updateCurrentCanvas(): Promise<void>;
816
+ /**
817
+ * Place object on the scene.\
818
+ * An object can only be placed on one scene.
819
+ * @param iObj - object to place.
820
+ * @param sceneID - (optional) scene name. `MainScene` by default.
821
+ */
822
+ placeObjectOnScene(iObj: THREE.Object3D, sceneID?: string): Promise<void>;
823
+ /**
824
+ * Remove object from scene.
825
+ * @param iObj
826
+ */
827
+ removeObjectFromScene(iObj: THREE.Object3D): Promise<void>;
828
+ /**
829
+ * Set clipping planes for rendering.
830
+ * @param planes - array of clipping planes.
831
+ */
832
+ setClipping(planes: THREE.Plane[]): void;
833
+ /**
834
+ * Set active clipping planes: planes with colored sections
835
+ * @param indices - active planes indices in the array of clipping planes
836
+ */
837
+ setActiveClipPlaneIndices(indices: number[]): void;
838
+ /**
839
+ * Gets all render scenes.
840
+ */
841
+ getScenes(): IUserScene[];
842
+ /**
843
+ *
844
+ * @param name
845
+ * @param isClippable
846
+ */
847
+ addScene(name: string, isClippable: boolean): IUserScene;
848
+ /**
849
+ *
850
+ * @param scene
851
+ */
852
+ removeScene(scene: IUserScene): void;
779
853
  }
780
- export const defaultRenderViewSettings: RenderViewSettings;
781
854
  export interface IRenderOperationContext {
782
855
  /** If true, renderScenes operations will be forced*/
783
856
  isRedrawRequested: boolean;
@@ -843,6 +916,10 @@ export interface IUserScene {
843
916
  get intersectionChecker(): IModelIntersectionChecker | null;
844
917
  /** Gets the THREE.Object3D representation of the scene */
845
918
  get threeObjectRepresentation(): THREE.Object3D | null;
919
+ /** Sets clipping enable */
920
+ set clippingEnable(value: boolean);
921
+ /** Indicates whether the scene should be clipped */
922
+ get clippingEnable(): boolean;
846
923
  /** Place objects on scene */
847
924
  addRange(objects: THREE.Object3D[]): void;
848
925
  /** Update objects on scene */
@@ -864,109 +941,350 @@ export interface IUserScene {
864
941
  /** Dispose scene */
865
942
  dispose(): void;
866
943
  }
867
- export interface I3DRenderer {
868
- clear(color?: boolean, depth?: boolean, stencil?: boolean): void;
869
- clearDepth(): void;
870
- render(scene: THREE.Object3D, camera: THREE.Camera): void;
871
- getSize(target: THREE.Vector2): THREE.Vector2;
872
- setSize(width: number, height: number, updateStyle?: boolean): void;
873
- setViewport(x: THREE.Vector4 | number, y?: number, width?: number, height?: number): void;
874
- clippingPlanes: THREE.Plane[];
875
- domElement: HTMLCanvasElement;
944
+ export enum NavigationHandlerPriority {
945
+ DefaultNavigation = 0,
946
+ GizmoHandlers = 20,
947
+ EmbeddedExtensions = 40,
948
+ CustomExtensions = 100
876
949
  }
877
- export interface IRenderViewer3D {
878
- /** Gets model inetrsection checker. */
879
- getIntersectionChecker(): IModelIntersectionChecker;
880
- /** Request a full redraw of the canvas. */
881
- updateCurrentCanvas(): Promise<void>;
950
+ export class NavigationEventOptions implements EventListenerOptions {
951
+ /** If true, use event capturing instead of event bubbling*/
952
+ readonly capture: boolean;
953
+ /** Call priority of navigation event handlers, from highest to lowest*/
954
+ readonly priority: number | NavigationHandlerPriority;
955
+ /** Always handle, used if `NavigationEvent.isHandled` set to true*/
956
+ readonly alwaysHandle: boolean;
957
+ /** (optional) listener name*/
958
+ readonly navigationTargetName?: string;
959
+
960
+ constructor(
961
+ /** If true, use event capturing instead of event bubbling*/
962
+ capture?: boolean,
963
+ /** Call priority of navigation event handlers, from highest to lowest*/
964
+ priority?: number | NavigationHandlerPriority,
965
+ /** Always handle, used if `NavigationEvent.isHandled` set to true*/
966
+ alwaysHandle?: boolean,
967
+ /** (optional) listener name*/
968
+ navigationTargetName?: string);
969
+ }
970
+ export type NavigationEvent = {
882
971
  /**
883
- * Place object on the scene.\
884
- * An object can only be placed on one scene.
885
- * @param iObj - object to place.
886
- * @param sceneID - (optional) scene name. `MainScene` by default.
972
+ * (optional) Value indicating whether the NavigationEvent event was handled.
887
973
  */
888
- placeObjectOnScene(iObj: THREE.Object3D, sceneID?: string): Promise<void>;
974
+ isHandled?: boolean;
975
+ };
976
+ export interface INavigationEventSource {
889
977
  /**
890
- * Remove object from scene.
891
- * @param iObj
978
+ * Event fired on activity changed
892
979
  */
893
- removeObjectFromScene(iObj: THREE.Object3D): Promise<void>;
980
+ readonly eventSourceActivityChanged: IEventSigner<boolean>;
894
981
  /**
895
- * Set clipping planes for rendering.
896
- * @param planes - array of clipping planes.
982
+ * Activates or deactivate event source
983
+ * @param value - activate if true
897
984
  */
898
- setClipping(planes: THREE.Plane[]): void;
985
+ setActive(value: boolean): void;
986
+ addEventListener<T extends keyof HTMLElementEventMap>(type: T, listener: (this: object, ev: HTMLElementEventMap[T] & NavigationEvent) => void, options?: boolean | EventListenerOptions | NavigationEventOptions): void;
987
+ removeEventListener<T extends keyof HTMLElementEventMap>(type: T, listener: (this: object, ev: HTMLElementEventMap[T] & NavigationEvent) => void, options?: boolean | EventListenerOptions | NavigationEventOptions): void;
988
+ }
989
+ export interface INavigationAgent {
899
990
  /**
900
- * Set active clipping planes: planes with colored sections
901
- * @param indices - active planes indices in the array of clipping planes
991
+ * Canvas DOM-events source
902
992
  */
903
- setActiveClipPlaneIndices(indices: number[]): void;
993
+ readonly canvasNavigationSource: INavigationEventSource;
904
994
  /**
905
- * Gets all render scenes.
995
+ * Keyboard DOM-events source
906
996
  */
907
- getScenes(): IUserScene[];
908
- }
909
- export class ModelElement {
910
- get id(): string;
911
- get modelPartId(): string;
912
- get parent(): ModelElement | undefined;
913
- get type(): string;
914
- get name(): string;
915
- get children(): ModelElement[];
916
- get hasGeometry(): boolean;
917
- get boundingBoxCenter(): Point3;
997
+ readonly keyboardNavigationSource: INavigationEventSource;
998
+ /**
999
+ * Activates canvas and keyboard navigation event sources
1000
+ */
1001
+ setActive(value: boolean): void;
1002
+ /**
1003
+ * Gets rectangle of the navigation area
1004
+ */
1005
+ getNavigationArea(): DOMRect;
918
1006
  }
919
- export class ModelElementTree {
1007
+ export interface INavigationTool {
920
1008
  /**
921
- *
922
- * @param {string|ModelElement} element - element id or element instance
923
- * @param callback
924
- * @param recursive
1009
+ * Gets name of this navigation tool.
925
1010
  */
926
- enumElementChildren(element: string | ModelElement, callback: (guid: string) => void, recursive?: boolean): void;
1011
+ get name(): string;
927
1012
  /**
928
- * Gets the root element of the model part
929
- * @returns {ModelElement} - model element instance
1013
+ * Initialize navigation tool.
930
1014
  */
931
- getRootElement(): ModelElement;
1015
+ init(navAgent: INavigationAgent, cameraControl: ICameraControl, intersectionChecker: IModelIntersectionChecker): void;
932
1016
  /**
933
- * Gets all elements of the model part
934
- * @returns array of the model elements
1017
+ * Activates or deactivates this navigation tool.
935
1018
  */
936
- getAllElements(): ModelElement[];
1019
+ setActive(isActive: boolean): void;
937
1020
  /**
938
- * Gets model element by id
939
- * @param { string } id - model element id
940
- * @returns model element;
1021
+ * Gets the camera pivot point.
941
1022
  */
942
- getElement(id: string): ModelElement;
1023
+ getPivotPoint(): THREE.Vector3;
943
1024
  /**
944
- * Checks given element is viewable
945
- * @param {string|ModelElement} element - element id or element instance
946
- * @returns {boolean}
1025
+ * Sets the camera pivot point.
947
1026
  */
948
- isViewableElement(element: string | ModelElement): boolean;
1027
+ setPivotPoint(pivotPoint: THREE.Vector3): void;
949
1028
  /**
950
- * Checks given element is detached from the root element
951
- * @param {string|ModelElement} element - element id or element instance
952
- * @returns {boolean}
1029
+ * Sets the camera parameters.
1030
+ * @param iParams
953
1031
  */
954
- isDetachedElement(element: string | ModelElement): boolean;
1032
+ setCameraParameters(iParams: CameraParameters): void;
955
1033
  /**
956
- * Gets the element level in the element tree
957
- * @param {string|ModelElement} element - element id or element instance
958
- * @returns {number} - level of the element
1034
+ * Gets the camera parameters.
959
1035
  */
960
- getChildLevelNumber(element: string | ModelElement): number;
1036
+ getCameraParameters(): CameraParameters;
961
1037
  }
962
- export class ModelPart {
963
- get id(): string;
964
- get elementTree(): ModelElementTree;
1038
+ export class GizmoMaterials {
1039
+ static gizmoMaterial: THREE.MeshBasicMaterial;
1040
+ static matInvisible: THREE.MeshBasicMaterial;
1041
+ static matRed: THREE.MeshBasicMaterial;
1042
+ static matGreen: THREE.MeshBasicMaterial;
1043
+ static matBlue: THREE.MeshBasicMaterial;
1044
+ static matYellow: THREE.MeshBasicMaterial;
1045
+ static matViolet: THREE.MeshBasicMaterial;
1046
+ static matYellowTransparent: THREE.MeshBasicMaterial;
1047
+ static init(): void;
1048
+ }
1049
+ export interface IGizmoObject extends THREE.Object3D {
1050
+ getHovered(): boolean;
1051
+ setHovered(value: boolean): void;
1052
+ getActive(): boolean;
1053
+ setActive(value: boolean): void;
965
1054
  dispose(): void;
966
1055
  }
967
-
968
- export class SettingsNames {
969
- static TELEMETRY: string;
1056
+ export class GizmoObject extends THREE.Object3D implements IGizmoObject {
1057
+ protected _meshes: THREE.Mesh[];
1058
+ readonly baseMaterial: THREE.Material;
1059
+ readonly hoverMaterial: THREE.Material;
1060
+ readonly activeMaterial: THREE.Material;
1061
+
1062
+ constructor(_meshes: THREE.Mesh[], baseMaterial?: THREE.Material, hoverMaterial?: THREE.Material, activeMaterial?: THREE.Material);
1063
+ getHovered(): boolean;
1064
+ setHovered(value: boolean): void;
1065
+ getActive(): boolean;
1066
+ setActive(value: boolean): void;
1067
+ dispose(): void;
1068
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1069
+ }
1070
+ export abstract class GizmoAxis extends THREE.Object3D implements IGizmoObject {
1071
+ readonly handle: IGizmoObject;
1072
+ readonly picker?: IGizmoObject;
1073
+ readonly helper?: IGizmoObject;
1074
+ protected _isHovered: boolean;
1075
+ protected _isActive: boolean;
1076
+ protected _plane: THREE.Plane;
1077
+ protected _axisDir: THREE.Vector3;
1078
+ protected _raycaster: THREE.Raycaster;
1079
+ protected _worldPositionStart: THREE.Vector3;
1080
+ protected _worldQuaternionStart: THREE.Quaternion;
1081
+ protected _worldAxisDir: THREE.Vector3;
1082
+ protected _startPoint: THREE.Vector3;
1083
+ protected _endPoint: THREE.Vector3;
1084
+ getActive(): boolean;
1085
+ setActive(value: boolean): void;
1086
+ getHovered(): boolean;
1087
+ setHovered(value: boolean): void;
1088
+ dispose(): void;
1089
+ raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
1090
+ abstract moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
1091
+ protected abstract updateGizmoPlane(camera: THREE.Camera): void;
1092
+ protected setStartPt(ndcPos: THREE.Vector2, camera: THREE.Camera): void;
1093
+ }
1094
+ export class GizmoTranslationAxis extends GizmoAxis {
1095
+ readonly handle: IGizmoObject;
1096
+ readonly picker?: IGizmoObject;
1097
+ readonly helper?: IGizmoObject;
1098
+
1099
+ constructor(axisDir: THREE.Vector3, handle: IGizmoObject, picker?: IGizmoObject, helper?: IGizmoObject);
1100
+ moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
1101
+ protected updateGizmoPlane(camera: THREE.Camera): void;
1102
+ }
1103
+ export class GizmoRotationAxis extends GizmoAxis {
1104
+ readonly handle: IGizmoObject;
1105
+ readonly picker?: IGizmoObject;
1106
+ readonly helper?: IGizmoObject;
1107
+ moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
1108
+ protected updateGizmoPlane(camera: THREE.Camera): void;
1109
+ }
1110
+ export class GizmoScaleAxis extends GizmoAxis {
1111
+ readonly handle: IGizmoObject;
1112
+ readonly picker?: IGizmoObject;
1113
+ readonly helper?: IGizmoObject;
1114
+ moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
1115
+ protected updateGizmoPlane(camera: THREE.Camera): void;
1116
+ }
1117
+ export class GizmoControl extends THREE.Object3D {
1118
+
1119
+ constructor(camera: THREE.Camera, navAgent: INavigationAgent);
1120
+ attachTo(object: THREE.Object3D, asChild?: boolean): void;
1121
+ detach(): void;
1122
+ addAxis(axis: GizmoAxis): void;
1123
+ dispose(): void;
1124
+ updateMatrixWorld(force?: boolean): void;
1125
+ updateGizmoOffset(position?: THREE.Vector3, quaternion?: THREE.Quaternion): void;
1126
+ }
1127
+ export enum GizmoAxisDir {
1128
+ NONE = 0,
1129
+ X = 1,
1130
+ Y = 2,
1131
+ Z = 4,
1132
+ XY = 3,
1133
+ YZ = 6,
1134
+ XZ = 5,
1135
+ XYZ = 7
1136
+ }
1137
+ export class GizmoBuilder {
1138
+ static build(camera: THREE.Camera, navAgent: INavigationAgent, translation?: GizmoAxisDir, rotation?: GizmoAxisDir, scale?: GizmoAxisDir): GizmoControl;
1139
+ static buildTranslationAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material, pickerBaseMatrial?: THREE.Material, pickerHoveredMaterial?: THREE.Material, pickerSelectedMaterial?: THREE.Material): GizmoAxis;
1140
+ static buildRotationAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material, pickerBaseMatrial?: THREE.Material, pickerHoveredMaterial?: THREE.Material, pickerSelectedMaterial?: THREE.Material): GizmoAxis;
1141
+ static buildScaleAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material): GizmoAxis;
1142
+ }
1143
+ export interface LabelSpriteParameters {
1144
+ text?: string | undefined;
1145
+ sizeAttenuation?: boolean | undefined;
1146
+ fontFace?: string | FontFace | undefined;
1147
+ fontSize?: number | undefined;
1148
+ borderColor?: Color | undefined;
1149
+ backgroundColor?: Color | undefined;
1150
+ borderThickness?: number | undefined;
1151
+ borderRadius?: number | undefined;
1152
+ textColor?: Color | undefined;
1153
+ textPadding?: THREE.Vector4Tuple | undefined;
1154
+ }
1155
+ export class LabelSprite extends THREE.Sprite {
1156
+ readonly extraHeightFactor = 1.4;
1157
+
1158
+ constructor(parameters: LabelSpriteParameters);
1159
+ get sizeAttenuation(): boolean;
1160
+ set sizeAttenuation(value: boolean);
1161
+ /**
1162
+ * @default ''
1163
+ */
1164
+ get text(): string;
1165
+ set text(value: string);
1166
+ /**
1167
+ * @default 'Roboto, sans-serif'
1168
+ */
1169
+ get fontFace(): string | FontFace;
1170
+ set fontFace(value: string | FontFace);
1171
+ /**
1172
+ * @default 12
1173
+ */
1174
+ get fontSize(): number;
1175
+ set fontSize(value: number);
1176
+ /**
1177
+ * @default 2
1178
+ */
1179
+ get borderThickness(): number;
1180
+ set borderThickness(value: number);
1181
+ /**
1182
+ * @default new Color(0, 0, 0, 1.0)
1183
+ */
1184
+ get borderColor(): Color;
1185
+ set borderColor(value: Color);
1186
+ /**
1187
+ * @default 1
1188
+ */
1189
+ get borderRadius(): number;
1190
+ set borderRadius(value: number);
1191
+ /**
1192
+ * @default new Color(1.0, 1.0, 1.0, 1.0)
1193
+ */
1194
+ get backgroundColor(): Color;
1195
+ set backgroundColor(value: Color);
1196
+ /**
1197
+ * @default new Color(0, 0, 0, 1.0)
1198
+ */
1199
+ get textColor(): Color;
1200
+ set textColor(value: Color);
1201
+ /**
1202
+ * Label text padding: left, top, right, bottom
1203
+ * @default [0, 0, 0, 0]
1204
+ */
1205
+ get textPadding(): THREE.Vector4Tuple;
1206
+ set textPadding(value: THREE.Vector4Tuple);
1207
+ dispose(): void;
1208
+ }
1209
+ export interface EventEmitter<Data> {
1210
+ emit(data?: Data, options?: object): void;
1211
+ }
1212
+ export class EventDispatcher<Data> implements IEventSigner<Data>, EventEmitter<Data> {
1213
+ listen(func: EventFunction<Data>, options?: {
1214
+ bind?: object;
1215
+ }): IEventListener<Data>;
1216
+ unlisten(func: EventFunction<Data>, options?: {
1217
+ bind?: object;
1218
+ allowMissing?: boolean;
1219
+ }): boolean;
1220
+ emit(data?: Data): void;
1221
+ emitR(data?: Data): any[];
1222
+ asSigner(): IEventSigner<Data>;
1223
+ asEmitter(): EventEmitter<Data>;
1224
+ removeAllListeners(): void;
1225
+ }
1226
+ export class ModelElement {
1227
+ get id(): string;
1228
+ get modelPartId(): string;
1229
+ get parent(): ModelElement | undefined;
1230
+ get type(): string;
1231
+ get name(): string;
1232
+ get children(): ModelElement[];
1233
+ get hasGeometry(): boolean;
1234
+ get viewObject(): ViewObject | undefined;
1235
+ get boundingBoxCenter(): Point3 | null;
1236
+ }
1237
+ export class ModelElementTree {
1238
+ /**
1239
+ *
1240
+ * @param {string|ModelElement} element - element id or element instance
1241
+ * @param callback
1242
+ * @param recursive
1243
+ */
1244
+ enumElementChildren(element: string | ModelElement, callback: (guid: string) => void, recursive?: boolean): void;
1245
+ /**
1246
+ * Gets the root element of the model part
1247
+ * @returns {ModelElement} - model element instance
1248
+ */
1249
+ getRootElement(): ModelElement;
1250
+ /**
1251
+ * Gets all elements of the model part
1252
+ * @returns array of the model elements
1253
+ */
1254
+ getAllElements(): ModelElement[];
1255
+ /**
1256
+ * Gets model element by id
1257
+ * @param { string } id - model element id
1258
+ * @returns model element;
1259
+ */
1260
+ getElement(id: string): ModelElement;
1261
+ /**
1262
+ * Checks given element is viewable
1263
+ * @param {string|ModelElement} element - element id or element instance
1264
+ * @returns {boolean}
1265
+ */
1266
+ isViewableElement(element: string | ModelElement): boolean;
1267
+ /**
1268
+ * Checks given element is detached from the root element
1269
+ * @param {string|ModelElement} element - element id or element instance
1270
+ * @returns {boolean}
1271
+ */
1272
+ isDetachedElement(element: string | ModelElement): boolean;
1273
+ /**
1274
+ * Gets the element level in the element tree
1275
+ * @param {string|ModelElement} element - element id or element instance
1276
+ * @returns {number} - level of the element
1277
+ */
1278
+ getChildLevelNumber(element: string | ModelElement): number;
1279
+ }
1280
+ export class ModelPart {
1281
+ get id(): string;
1282
+ get elementTree(): ModelElementTree;
1283
+ dispose(): void;
1284
+ }
1285
+
1286
+ export class SettingsNames {
1287
+ static TELEMETRY: string;
970
1288
  static AXES: string;
971
1289
  static CAMERA_ANIMATION: string;
972
1290
  static HIDE_SMALL_ELEMENTS_WHEN_NAVIGATING: string;
@@ -2226,11 +2544,6 @@ export class ModelElementPropertyValue {
2226
2544
  bool_value?: boolean;
2227
2545
  get value(): unknown;
2228
2546
  }
2229
-
2230
- export enum SelectionMode {
2231
- Append = 0,
2232
- Replace = 1
2233
- }
2234
2547
  export class ModelElementIds {
2235
2548
  modelPartId: string;
2236
2549
  elementIds: string[];
@@ -2261,100 +2574,6 @@ export class HoverEvent extends Event {
2261
2574
  modelId: string;
2262
2575
  modelElementId: string;
2263
2576
  }
2264
- export enum NavigationHandlerPriority {
2265
- DefaultNavigation = 0,
2266
- GizmoHandlers = 20,
2267
- EmbeddedExtensions = 40,
2268
- CustomExtensions = 100
2269
- }
2270
- export class NavigationEventOptions implements EventListenerOptions {
2271
- /** If true, use event capturing instead of event bubbling*/
2272
- readonly capture: boolean;
2273
- /** Call priority of navigation event handlers, from highest to lowest*/
2274
- readonly priority: number | NavigationHandlerPriority;
2275
- /** Always handle, used if `NavigationEvent.isHandled` set to true*/
2276
- readonly alwaysHandle: boolean;
2277
- /** (optional) listener name*/
2278
- readonly navigationTargetName?: string;
2279
-
2280
- constructor(
2281
- /** If true, use event capturing instead of event bubbling*/
2282
- capture?: boolean,
2283
- /** Call priority of navigation event handlers, from highest to lowest*/
2284
- priority?: number | NavigationHandlerPriority,
2285
- /** Always handle, used if `NavigationEvent.isHandled` set to true*/
2286
- alwaysHandle?: boolean,
2287
- /** (optional) listener name*/
2288
- navigationTargetName?: string);
2289
- }
2290
- export type NavigationEvent = {
2291
- /**
2292
- * (optional) Value indicating whether the NavigationEvent event was handled.
2293
- */
2294
- isHandled?: boolean;
2295
- };
2296
- export interface INavigationEventSource {
2297
- /**
2298
- * Event fired on activity changed
2299
- */
2300
- readonly eventSourceActivityChanged: IEventSigner<boolean>;
2301
- /**
2302
- * Activates or deactivate event source
2303
- * @param value - activate if true
2304
- */
2305
- setActive(value: boolean): void;
2306
- addEventListener<T extends keyof HTMLElementEventMap>(type: T, listener: (this: object, ev: HTMLElementEventMap[T] & NavigationEvent) => void, options?: boolean | EventListenerOptions | NavigationEventOptions): void;
2307
- removeEventListener<T extends keyof HTMLElementEventMap>(type: T, listener: (this: object, ev: HTMLElementEventMap[T] & NavigationEvent) => void, options?: boolean | EventListenerOptions | NavigationEventOptions): void;
2308
- }
2309
- export interface INavigationAgent {
2310
- /**
2311
- * Canvas DOM-events source
2312
- */
2313
- readonly canvasNavigationSource: INavigationEventSource;
2314
- /**
2315
- * Keyboard DOM-events source
2316
- */
2317
- readonly keyboardNavigationSource: INavigationEventSource;
2318
- /**
2319
- * Activates canvas and keyboard navigation event sources
2320
- */
2321
- setActive(value: boolean): void;
2322
- /**
2323
- * Gets rectangle of the navigation area
2324
- */
2325
- getNavigationArea(): DOMRect;
2326
- }
2327
- export interface INavigationTool {
2328
- /**
2329
- * Gets name of this navigation tool.
2330
- */
2331
- get name(): string;
2332
- /**
2333
- * Initialize navigation tool.
2334
- */
2335
- init(navAgent: INavigationAgent, cameraControl: ICameraControl, intersectionChecker: IModelIntersectionChecker): void;
2336
- /**
2337
- * Activates or deactivates this navigation tool.
2338
- */
2339
- setActive(isActive: boolean): void;
2340
- /**
2341
- * Gets the camera pivot point.
2342
- */
2343
- getPivotPoint(): THREE.Vector3;
2344
- /**
2345
- * Sets the camera pivot point.
2346
- */
2347
- setPivotPoint(pivotPoint: THREE.Vector3): void;
2348
- /**
2349
- * Sets the camera parameters.
2350
- * @param iParams
2351
- */
2352
- setCameraParameters(iParams: CameraParameters): void;
2353
- /**
2354
- * Gets the camera parameters.
2355
- */
2356
- getCameraParameters(): CameraParameters;
2357
- }
2358
2577
  export interface INavigation {
2359
2578
  /**
2360
2579
  * Register navigation tool.
@@ -2422,12 +2641,6 @@ export class ModelLoadingOptions {
2422
2641
  guid: string;
2423
2642
  isConsolidatedModel?: boolean;
2424
2643
  }
2425
- export class EventsObserver {
2426
- protected eventsDispatcher: IEventsDispatcher;
2427
- protected _listeners: Map<string, EventListener>;
2428
- watch(): void;
2429
- dispose(): void;
2430
- }
2431
2644
  /**
2432
2645
  * This class describes the coordination model. The coordination model contains parts of the model (aka ModelPart).
2433
2646
  */
@@ -2577,6 +2790,7 @@ export class Viewer3D extends ViewerBase {
2577
2790
  * @returns Blob object representing render image.
2578
2791
  */
2579
2792
  makeScreenshot(mimeType?: string, quality?: number): Promise<Blob>;
2793
+ setThemeFromSettings(): void;
2580
2794
  }
2581
2795
  export class GuiViewer3D extends Viewer3D {
2582
2796
  loadModelPart(buffer: ArrayBuffer, options: ModelLoadingOptions, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
@@ -2599,177 +2813,6 @@ export class Extension extends ExtensionBase {
2599
2813
 
2600
2814
  constructor(viewer: Viewer3D, options?: object);
2601
2815
  }
2602
- export class GizmoMaterials {
2603
- static gizmoMaterial: THREE.MeshBasicMaterial;
2604
- static matInvisible: THREE.MeshBasicMaterial;
2605
- static matRed: THREE.MeshBasicMaterial;
2606
- static matGreen: THREE.MeshBasicMaterial;
2607
- static matBlue: THREE.MeshBasicMaterial;
2608
- static matYellow: THREE.MeshBasicMaterial;
2609
- static matViolet: THREE.MeshBasicMaterial;
2610
- static matYellowTransparent: THREE.MeshBasicMaterial;
2611
- static init(): void;
2612
- }
2613
- export interface IGizmoObject extends THREE.Object3D {
2614
- getHovered(): boolean;
2615
- setHovered(value: boolean): void;
2616
- getActive(): boolean;
2617
- setActive(value: boolean): void;
2618
- dispose(): void;
2619
- }
2620
- export class GizmoObject extends THREE.Object3D implements IGizmoObject {
2621
- protected _meshes: THREE.Mesh[];
2622
- readonly baseMaterial: THREE.Material;
2623
- readonly hoverMaterial: THREE.Material;
2624
- readonly activeMaterial: THREE.Material;
2625
-
2626
- constructor(_meshes: THREE.Mesh[], baseMaterial?: THREE.Material, hoverMaterial?: THREE.Material, activeMaterial?: THREE.Material);
2627
- getHovered(): boolean;
2628
- setHovered(value: boolean): void;
2629
- getActive(): boolean;
2630
- setActive(value: boolean): void;
2631
- dispose(): void;
2632
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
2633
- }
2634
- export abstract class GizmoAxis extends THREE.Object3D implements IGizmoObject {
2635
- readonly handle: IGizmoObject;
2636
- readonly picker?: IGizmoObject;
2637
- readonly helper?: IGizmoObject;
2638
- protected _isHovered: boolean;
2639
- protected _isActive: boolean;
2640
- protected _plane: THREE.Plane;
2641
- protected _axisDir: THREE.Vector3;
2642
- protected _raycaster: THREE.Raycaster;
2643
- protected _worldPositionStart: THREE.Vector3;
2644
- protected _worldQuaternionStart: THREE.Quaternion;
2645
- protected _worldAxisDir: THREE.Vector3;
2646
- protected _startPoint: THREE.Vector3;
2647
- protected _endPoint: THREE.Vector3;
2648
- getActive(): boolean;
2649
- setActive(value: boolean): void;
2650
- getHovered(): boolean;
2651
- setHovered(value: boolean): void;
2652
- dispose(): void;
2653
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
2654
- abstract moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2655
- protected abstract updateGizmoPlane(camera: THREE.Camera): void;
2656
- protected setStartPt(ndcPos: THREE.Vector2, camera: THREE.Camera): void;
2657
- }
2658
- export class GizmoTranslationAxis extends GizmoAxis {
2659
- readonly handle: IGizmoObject;
2660
- readonly picker?: IGizmoObject;
2661
- readonly helper?: IGizmoObject;
2662
-
2663
- constructor(axisDir: THREE.Vector3, handle: IGizmoObject, picker?: IGizmoObject, helper?: IGizmoObject);
2664
- moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2665
- protected updateGizmoPlane(camera: THREE.Camera): void;
2666
- }
2667
- export class GizmoRotationAxis extends GizmoAxis {
2668
- readonly handle: IGizmoObject;
2669
- readonly picker?: IGizmoObject;
2670
- readonly helper?: IGizmoObject;
2671
- moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2672
- protected updateGizmoPlane(camera: THREE.Camera): void;
2673
- }
2674
- export class GizmoScaleAxis extends GizmoAxis {
2675
- readonly handle: IGizmoObject;
2676
- readonly picker?: IGizmoObject;
2677
- readonly helper?: IGizmoObject;
2678
- moveByNdcPt(ndcPos: THREE.Vector2, camera: THREE.Camera): THREE.Matrix4;
2679
- protected updateGizmoPlane(camera: THREE.Camera): void;
2680
- }
2681
- export class GizmoControl extends THREE.Object3D {
2682
-
2683
- constructor(camera: THREE.Camera, navAgent: INavigationAgent);
2684
- attachTo(object: THREE.Object3D, asChild?: boolean): void;
2685
- detach(): void;
2686
- addAxis(axis: GizmoAxis): void;
2687
- dispose(): void;
2688
- updateMatrixWorld(force?: boolean): void;
2689
- updateGizmoOffset(position?: THREE.Vector3, quaternion?: THREE.Quaternion): void;
2690
- }
2691
- export enum GizmoAxisDir {
2692
- NONE = 0,
2693
- X = 1,
2694
- Y = 2,
2695
- Z = 4,
2696
- XY = 3,
2697
- YZ = 6,
2698
- XZ = 5,
2699
- XYZ = 7
2700
- }
2701
- export class GizmoBuilder {
2702
- static build(camera: THREE.Camera, navAgent: INavigationAgent, translation?: GizmoAxisDir, rotation?: GizmoAxisDir, scale?: GizmoAxisDir): GizmoControl;
2703
- static buildTranslationAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material, pickerBaseMatrial?: THREE.Material, pickerHoveredMaterial?: THREE.Material, pickerSelectedMaterial?: THREE.Material): GizmoAxis;
2704
- static buildRotationAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material, pickerBaseMatrial?: THREE.Material, pickerHoveredMaterial?: THREE.Material, pickerSelectedMaterial?: THREE.Material): GizmoAxis;
2705
- static buildScaleAxis(axisDir: THREE.Vector3, handleBaseMatrial?: THREE.Material, handleHoveredMaterial?: THREE.Material, handleSelectedMaterial?: THREE.Material): GizmoAxis;
2706
- }
2707
- export interface LabelSpriteParameters {
2708
- text?: string | undefined;
2709
- sizeAttenuation?: boolean | undefined;
2710
- fontFace?: string | FontFace | undefined;
2711
- fontSize?: number | undefined;
2712
- borderColor?: Color | undefined;
2713
- backgroundColor?: Color | undefined;
2714
- borderThickness?: number | undefined;
2715
- borderRadius?: number | undefined;
2716
- textColor?: Color | undefined;
2717
- textPadding?: THREE.Vector4Tuple | undefined;
2718
- }
2719
- export class LabelSprite extends THREE.Sprite {
2720
- readonly extraHeightFactor = 1.4;
2721
-
2722
- constructor(parameters: LabelSpriteParameters);
2723
- get sizeAttenuation(): boolean;
2724
- set sizeAttenuation(value: boolean);
2725
- /**
2726
- * @default ''
2727
- */
2728
- get text(): string;
2729
- set text(value: string);
2730
- /**
2731
- * @default 'Roboto, sans-serif'
2732
- */
2733
- get fontFace(): string | FontFace;
2734
- set fontFace(value: string | FontFace);
2735
- /**
2736
- * @default 12
2737
- */
2738
- get fontSize(): number;
2739
- set fontSize(value: number);
2740
- /**
2741
- * @default 2
2742
- */
2743
- get borderThickness(): number;
2744
- set borderThickness(value: number);
2745
- /**
2746
- * @default new Color(0, 0, 0, 1.0)
2747
- */
2748
- get borderColor(): Color;
2749
- set borderColor(value: Color);
2750
- /**
2751
- * @default 1
2752
- */
2753
- get borderRadius(): number;
2754
- set borderRadius(value: number);
2755
- /**
2756
- * @default new Color(1.0, 1.0, 1.0, 1.0)
2757
- */
2758
- get backgroundColor(): Color;
2759
- set backgroundColor(value: Color);
2760
- /**
2761
- * @default new Color(0, 0, 0, 1.0)
2762
- */
2763
- get textColor(): Color;
2764
- set textColor(value: Color);
2765
- /**
2766
- * Label text padding: left, top, right, bottom
2767
- * @default [0, 0, 0, 0]
2768
- */
2769
- get textPadding(): THREE.Vector4Tuple;
2770
- set textPadding(value: THREE.Vector4Tuple);
2771
- dispose(): void;
2772
- }
2773
2816
  export interface IWindowStyle {
2774
2817
  width: string;
2775
2818
  height: string;
@@ -2797,6 +2840,30 @@ export class Dragger {
2797
2840
  constructor(allowedDraggableElement: HTMLElement, draggableContainer: HTMLElement, containerToRestriction: HTMLElement, windowStater?: WindowStater);
2798
2841
  get windowState(): IWindowStyle | null;
2799
2842
  }
2843
+ export namespace Viewer3DIcons {
2844
+ const VIEWER_SETTINGS_ICON: string;
2845
+ const VIEWER_MODEL_BROWSER_ICON: string;
2846
+ const VIEWER_FULL_SCREEN_ICON: string;
2847
+ const VIEWER_COLLAPSE_ICON: string;
2848
+ const VIEWER_ELEMENT_PROPERTIES_ICON: string;
2849
+ const VIEWER_ADD_CLIPPING_PLANE_ICON: string;
2850
+ const VIEWER_CLIPPING_FLIP_ICON: string;
2851
+ const VIEWER_DELETE_CLIPPING_PLANE_ICON: string;
2852
+ const VIEWER_CLIPPING_CUBE_ICON: string;
2853
+ const VIEWER_DISABLED_DELETE_CLIPPING_PLANE_ICON: string;
2854
+ const VIEWER_DISABLED_CLIPPING_FLIP_ICON: string;
2855
+ const VIEWER_ADD_REMARK_ICON: string;
2856
+ }
2857
+ export namespace ViewerGeneralIcons {
2858
+ const ZOOM_IN: string;
2859
+ const ZOOM_OUT: string;
2860
+ const CLOSE: string;
2861
+ const STRETCH_WINDOW: string;
2862
+ const EXPAND_TREE: string;
2863
+ const COLLAPSE_TREE: string;
2864
+ const ARROW_DROP_DOWN: string;
2865
+ const ARROW_DROP_RIGHT: string;
2866
+ }
2800
2867
  export class Button extends Control {
2801
2868
 
2802
2869
  constructor(id: string);
@@ -2804,6 +2871,7 @@ export class Button extends Control {
2804
2871
  setState(state: Button.State): boolean;
2805
2872
  getState(): Button.State;
2806
2873
  setIcon(iconClassName: string): void;
2874
+ setFromSvgTemlate(template: string): void;
2807
2875
  /**
2808
2876
  * Override this method to be notified when the user clicks on the button.
2809
2877
  * @param {MouseEvent} event
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pilotdev/pilot-web-3d",
3
- "version": "23.0.5",
3
+ "version": "23.0.6-alpha.2",
4
4
  "description": "TypeScript definitions for ASCON PilotWeb3D component",
5
5
  "main": "",
6
6
  "types": "index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "author": "JSC Ascon",
9
9
  "license": "MIT",
10
10
  "typeScriptVersion": "4.9.4",
11
- "devDependencies": {
11
+ "dependencies": {
12
12
  "@types/three": "0.148.0"
13
13
  },
14
14
  "keywords": [