@pilotdev/pilot-web-3d 1.0.0 → 1.0.3

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 (3) hide show
  1. package/README.md +2 -2
  2. package/index.d.ts +133 -104
  3. package/package.json +13 -14
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Installation
2
- > `npm install --save @team-pilot/pilot-web-3d`
2
+ > `npm install --save-dev @pilotdev/pilot-web-3d`
3
3
 
4
4
  # Summary
5
5
  This package contains type definitions for Ascon pilot-web-3d.js library (https://pilotcloud.ascon.net/).
6
6
 
7
7
  ### Additional Details
8
- * Last updated: Thu, 25 Aug 2022 14:10:25 GMT
8
+ * Last updated: Thu, 25 Aug 2022 17:10:25 GMT
9
9
  * Global values: `PilotWeb3d`
package/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export namespace PilotWeb3D {
2
2
 
3
3
  export type InitializeSuccessCallback = () => void;
4
- export declare function Initializer(options: any, callback: InitializeSuccessCallback): void;
5
- export declare function shutdown(): void;
4
+ export function Initializer(options: any, callback: InitializeSuccessCallback): void;
5
+ export function shutdown(): void;
6
6
  export type ErrorCallback = (message: string) => void;
7
7
  export type SuccessCallback = (modelId: any) => void;
8
8
  export enum DocumentType {
@@ -17,15 +17,97 @@
17
17
  onPostExtensionLoad(extension: Extension): void;
18
18
  }
19
19
 
20
+ export class Model {
21
+ /**
22
+ * Returns all model parts loaded in the viewer.
23
+ * @returns {ModelPart[]} - An array of visible and hidden model parts
24
+ */
25
+ getAllModelParts(): ModelPart[];
26
+ /**
27
+ * Gets visible model parst
28
+ * @returns {ModelPart[]} - An array of visible model parts
29
+ */
30
+ getVisibleModelParts(): ModelPart[];
31
+ /**
32
+ * Gets hidden model parts
33
+ * @returns {ModelPart[]} - An array of hidden model parts
34
+ */
35
+ getHiddenModelParts(): ModelPart[];
36
+ /**
37
+ * Temporarily remove a model part from the Viewer, but keep loaders, materials, and geometry alive.
38
+ * @param {string | ModelPart} modelPart - model part id or model part instance
39
+ */
40
+ hideModelPart(modelPart: string | ModelPart): void;
41
+ /**
42
+ * Shows hidden model part
43
+ * @param {string | ModelPart} modelPart - model part id or model part instance
44
+ */
45
+ showModelPart(modelPart: string | ModelPart): void;
46
+ /**
47
+ * Hide model elements
48
+ * @param {string[]|string} elementIds - An array of model elements id or just a single model element id.
49
+ * @param {string | ModelPart} modelPart - id of the model part that contains the element ids. By default uses the initial model part loaded into the scene.
50
+ */
51
+ hide(elementIds: string[] | string, modelPart?: string | ModelPart): void;
52
+ /**
53
+ * Hides all elements and model parts from the viewer
54
+ */
55
+ hideAll(): void;
56
+ /**
57
+ * Ensures the passed in elements are shown.
58
+ *
59
+ * @param {string[] | string} elementIds - An array of model elements or just a single model element.
60
+ * @param {string | ModelPart} modelPart - id of the model part that contains the model element id. By default uses the initial model part loaded into the scene.
61
+ *
62
+ */
63
+ show(elementIds: string[] | string, modelPart?: string | ModelPart): void;
64
+ /**
65
+ * Shows all elements and model parts
66
+ */
67
+ showAll(): void;
68
+ /**
69
+ * Selects the array of model elements. You can also pass in a single model element id instead of an array.
70
+ *
71
+ * @param {string[] | string} elementIds - element or array of elements to select.
72
+ * @param {string | ModelPart} modelPart - model part id or the model part instance containing the elements.
73
+ *
74
+ */
75
+ select(elementIds: string[] | string, modelPart?: string | ModelPart): void;
76
+ /**
77
+ * Unselect all model elements in all model parts
78
+ */
79
+ clearSelection(): void;
80
+ /**
81
+ * Returns the current selection.
82
+ * @returns {ModelElementIds[]} Array of the currently selected model elements.
83
+ */
84
+ getSelection(): ModelElementIds[];
85
+ /**
86
+ * Sets color to elements
87
+ * @param {string[] | string} elementIds - element or array of elements to change color.
88
+ * @param {number} r - red
89
+ * @param {number} g - green
90
+ * @param {number} b - blue
91
+ * @param {number} a - alpha
92
+ * @param {string | ModelPart} modelPart - id of the model part or model part instance containing the elements.
93
+ */
94
+ setColor(elementIds: string[] | string, r: number, g: number, b: number, a: number, modelPart?: string | ModelPart): void;
95
+ /**
96
+ * Resets all changed colors for all elements in all model parts
97
+ * @param {string | ModelPart} model - id of the model part or model part instance.
98
+ */
99
+ clearColors(model?: string | ModelPart): void;
100
+ }
101
+
20
102
  export class ModelPart {
21
103
  get id(): string;
22
104
  get elementTree(): ModelElementTree;
23
105
  dispose(): void;
24
106
  }
25
107
 
26
- export class Selection {
27
- modelId: string;
28
- selected: string[];
108
+ export class ModelElementIds {
109
+ modelPartId: string;
110
+ elementIds: string[];
29
111
  }
30
112
 
31
113
  export class ModelElementTree {
@@ -68,98 +150,52 @@
68
150
  clearListeners(): void;
69
151
  }
70
152
 
153
+ export type CameraPosition = {
154
+ position: THREE.Vector3;
155
+ direction: THREE.Vector3;
156
+ };
157
+ export var ViewerInstance: Viewer3D;
71
158
  export class Viewer3D extends ViewerBase {
72
- start(): number;
73
- finish(): void;
74
- loadModel(buffer: ArrayBuffer, options: {}, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
75
- unloadModel(model: string | ModelPart): void;
76
- /**
77
- * Returns all models loaded in the viewer.
78
- * @returns {ModelPart[]} - An array of visible and hidden models
79
- */
80
- getAllModels(): ModelPart[];
81
- /**
82
- * @returns {ModelPart[]} - An array of visible models
83
- */
84
- getVisibleModels(): ModelPart[];
85
- /**
86
- * @returns {ModelPart[]} - An array of hidden models
87
- */
88
- getHiddenModels(): ModelPart[];
89
- /**
90
- * Temporarily remove a model from the Viewer, but keep loaders, materials, and geometry alive.
91
- * @param {string | ModelPart} model - model id or ModelPart object
92
- * @returns {boolean} true indicates success, i.e., modelId referred to a visible model that is now hidden
93
- */
94
- hideModel(model: string | ModelPart): void;
95
- /**
96
- *
97
- * @param {string | ModelPart} model - model id or ModelPart object
98
- */
99
- showModel(model: string | ModelPart): void;
100
- /**
101
- * Returns the current selection.
102
- * @returns {Selection[]} Array of the currently selected nodes.
103
- */
104
- getSelection(): Selection[];
105
- /**
106
- * Hide elements
107
- * @param {string[]|string} elementIds - An array of elements (elementIds) or just a single element.
108
- * @param {string | ModelPart} model - id of the model that contains the elementIds. By default uses the initial model loaded into the scene.
109
- */
110
- hide(elementIds: string[] | string, model?: string | ModelPart): void;
111
- /**
112
- *
113
- */
114
- hideAll(): void;
115
- /**
116
- * Ensures the passed in elements (elementIds) are shown.
117
- *
118
- * @param {string[] | string} elementIds - An array of elements (elementIds) or just a single node.
119
- * @param {string | ModelPart} model - id of the model that contains the elementId. By default uses the initial model loaded into the scene.
120
- *
121
- */
122
- show(elementIds: string[] | string, model?: string | ModelPart): void;
123
- /**
124
- *
125
- */
126
- showAll(): void;
127
- /**
128
- * Toggles the selection for a given elementIds.
129
- * If it was unselected, it is selected.
130
- * If it was selected, it is unselected.
131
- *
132
- * @param {string} elementIds
133
- * @param {string | ModelPart} model - model that contains the elementIds. Uses the initial model loaded by default.
134
- */
135
- toggleSelect(elementIds: string[] | string, model?: string | ModelPart): void;
136
- /**
137
- * Selects the array of ids. You can also pass in a single id instead of an array.
138
- *
139
- * @param {string[] | string} elementIds - element or array of elements to select.
140
- * @param {string | ModelPart} model - model id or the model instance containing the ids.
141
- *
142
- */
143
- select(elementIds: string[] | string, model?: string | ModelPart): void;
144
- /**
145
- * Unselect all nodes in all models
146
- */
147
- clearSelection(): void;
148
- /**
149
- *
150
- * @param {string[] | string} elementIds - element or array of elements to change color.
151
- * @param color -
152
- * @param {string | ModelPart} model - id of the model or model instance containing the ids.
153
- */
154
- setColor(elementIds: string[] | string, color: THREE.Color, model?: string | ModelPart): void;
155
- /**
156
- *
157
- * @param {string | ModelPart} model - id of the model or model instance.
158
- */
159
- clearColors(model?: string | ModelPart): void;
159
+ start(): number;
160
+ finish(): void;
161
+ /**
162
+ * Loads new model part to the viewer
163
+ * @param buffer
164
+ * @param options
165
+ * @param onSuccessCallback
166
+ * @param onErrorCallback
167
+ */
168
+ loadModelPart(buffer: ArrayBuffer, options: {}, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
169
+ /**
170
+ * unloads model part from the viewer
171
+ * @param modelPart - model part id or model part instance
172
+ */
173
+ unloadModelPart(modelPart: string | ModelPart): void;
174
+ /**
175
+ * Returns general model
176
+ * @returns { Model } - general model
177
+ */
178
+ get model(): Model;
179
+ /**
180
+ * Sets the cameras point of view.
181
+ * @param cameraPosition camera position and direction.
182
+ */
183
+ setCameraPosition(cameraPosition: CameraPosition): void;
184
+ /**
185
+ * Gets the cameras point of view.
186
+ * @returns camera position and direction.
187
+ */
188
+ getCameraPosition(): CameraPosition;
189
+ /**
190
+ * Makes screenshot
191
+ * @param {string} [mimeType=image/png] Image MIME type.
192
+ * @param {number} [qualityArgument=1.0] Image quality to be used for image/jpeg or image/webp formats.
193
+ * @returns Blob object representing render image.
194
+ */
195
+ makeScreenshot(mimeType?: string, quality?: number): Promise<Blob>;
160
196
  }
161
-
162
- export abstract class ViewerBase {
197
+
198
+ export abstract class ViewerBase {
163
199
  container: HTMLElement;
164
200
  layerManagers: Map<number, ILayerManager>;
165
201
  extensionsLoader: ExtensionLoader;
@@ -173,18 +209,11 @@
173
209
  *
174
210
  */
175
211
  finish(): void;
176
- /**
177
- *
178
- * @param buffer
179
- * @param options
180
- * @param onSuccessCallback
181
- * @param onErrorCallback
182
- */
183
- loadModel(buffer: ArrayBuffer, options: {}, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
212
+
184
213
  onPostExtensionLoad(extension: Extension): void;
185
214
  }
186
215
 
187
- export class ExtensionLoader {
216
+ export class ExtensionLoader {
188
217
  loadExtension(extensionId: string): Promise<Extension>;
189
218
  unloadExtension(extensionId: string): Promise<boolean>;
190
219
  getExtensions(): Extension[];
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
- {
2
- "name": "@pilotdev/pilot-web-3d",
3
- "version": "1.0.0",
4
- "description": "TypeScript definitions for ASCON pilotweb3d.js library",
5
- "main": "",
6
- "types": "index.d.ts",
7
- "scripts": {},
8
- "author": "",
9
- "license": "ISC",
10
- "typeScriptVersion": "4.4.3",
11
- "devDependencies": {
12
- "@types/three": "0.135.0"
13
- }
14
- }
1
+ {
2
+ "name": "@pilotdev/pilot-web-3d",
3
+ "version": "1.0.3",
4
+ "description": "TypeScript definitions for ASCON Pilot.Web.3D component",
5
+ "main": "",
6
+ "types": "index.d.ts",
7
+ "scripts": {},
8
+ "license": "MIT",
9
+ "typeScriptVersion": "4.4.3",
10
+ "dependencies": {
11
+ "@types/three": "0.135.0"
12
+ }
13
+ }