@pilotdev/pilot-web-3d 1.0.2 → 1.0.4-1
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.
- package/README.md +3 -3
- package/index.d.ts +168 -145
- package/package.json +11 -13
- package/three/three.d.ts +5348 -0
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Installation
|
|
2
|
-
> `npm install --save
|
|
2
|
+
> `npm install --save @pilotdev/pilot-web-3d`
|
|
3
3
|
|
|
4
4
|
# Summary
|
|
5
|
-
This package contains type definitions for Ascon
|
|
5
|
+
This package contains type definitions for Ascon Pilot.Web.3D component (https://pilotcloud.ascon.net/).
|
|
6
6
|
|
|
7
7
|
### Additional Details
|
|
8
|
-
* Last updated: Thu,
|
|
8
|
+
* Last updated: Thu, 2 Sept 2022 10:10:25 GMT
|
|
9
9
|
* Global values: `PilotWeb3d`
|
package/index.d.ts
CHANGED
|
@@ -1,66 +1,156 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference path="./three/three.d.ts" />
|
|
2
|
+
declare namespace PilotWeb3D {
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
type InitializeSuccessCallback = () => void;
|
|
5
|
+
function Initializer(options: any, callback: InitializeSuccessCallback): void;
|
|
6
|
+
function shutdown(): void;
|
|
7
|
+
type ErrorCallback = (message: string) => void;
|
|
8
|
+
type SuccessCallback = (modelId: any) => void;
|
|
9
|
+
enum DocumentType {
|
|
10
|
+
UNKNOWN = 0,
|
|
11
|
+
DOCUMENT_2D = 1,
|
|
12
|
+
DOCUMENT_3D = 2
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onPostExtensionLoad(extension: Extension): void;
|
|
15
|
+
class GuiViewer3D extends Viewer3D {
|
|
16
|
+
getToolbar(): ViewerToolbar;
|
|
17
|
+
onPostExtensionLoad(extension: Extension): void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
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
|
+
|
|
102
|
+
class ModelPart {
|
|
103
|
+
get id(): string;
|
|
104
|
+
get elementTree(): ModelElementTree;
|
|
105
|
+
dispose(): void;
|
|
24
106
|
}
|
|
25
107
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
108
|
+
class ModelElementIds {
|
|
109
|
+
modelPartId: string;
|
|
110
|
+
elementIds: string[];
|
|
29
111
|
}
|
|
30
112
|
|
|
31
|
-
|
|
113
|
+
class ModelElementTree {
|
|
32
114
|
enumElementChildren(element: string | ModelElement, callback: (guid: string) => void, recursive?: boolean): void;
|
|
33
115
|
getRootElement(): ModelElement;
|
|
34
116
|
getAllElements(): ModelElement[];
|
|
117
|
+
getElement(id: string) : ModelElement;
|
|
35
118
|
isViewableElement(element: string | ModelElement): boolean;
|
|
36
119
|
isDetachedElement(element: string | ModelElement): boolean;
|
|
37
120
|
getChildLevelNumber(element: string | ModelElement): number;
|
|
38
121
|
}
|
|
39
122
|
|
|
40
|
-
|
|
123
|
+
class ModelElement {
|
|
41
124
|
get id(): string;
|
|
125
|
+
get modelPartId(): string;
|
|
42
126
|
get parent(): ModelElement | undefined;
|
|
43
127
|
get type(): string;
|
|
44
128
|
get name(): string;
|
|
45
129
|
get children(): ModelElement[];
|
|
46
130
|
}
|
|
47
131
|
|
|
48
|
-
|
|
132
|
+
class CoreEventTypes {
|
|
49
133
|
static VIEWER_RESIZE_EVENT: string;
|
|
50
134
|
static VIEWER_MOUSE_DOWN_EVENT: string;
|
|
51
135
|
static VIEWER_MOUSE_MOVE_EVENT: string;
|
|
52
136
|
static VIEWER_MOUSE_UP_EVENT: string;
|
|
53
137
|
static VIEWER_MOUSE_LONG_TOUCH_EVENT: string;
|
|
54
138
|
}
|
|
55
|
-
|
|
56
|
-
|
|
139
|
+
class EventTypes extends CoreEventTypes {
|
|
140
|
+
static SELECTION_CHANGED_EVENT: string;
|
|
141
|
+
static MODEL_PART_LOADED: string;
|
|
142
|
+
static MODEL_PART_UNLOADED: string;
|
|
143
|
+
}
|
|
144
|
+
class SelectionEvent extends Event {
|
|
145
|
+
selected: string[];
|
|
146
|
+
modelPartId: string;
|
|
57
147
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
148
|
+
|
|
149
|
+
class ModelPartEvent extends Event {
|
|
150
|
+
modelPartId: string;
|
|
61
151
|
}
|
|
62
152
|
|
|
63
|
-
|
|
153
|
+
interface EventsDispatcher {
|
|
64
154
|
addEventListener(event: string, listener: EventListener, options?: any): void;
|
|
65
155
|
removeEventListener(event: string, listener: EventListener): void;
|
|
66
156
|
hasEventListener(event: string, listener: EventListener): boolean;
|
|
@@ -68,113 +158,52 @@
|
|
|
68
158
|
clearListeners(): void;
|
|
69
159
|
}
|
|
70
160
|
|
|
71
|
-
|
|
161
|
+
type CameraPosition = {
|
|
72
162
|
position: THREE.Vector3;
|
|
73
163
|
direction: THREE.Vector3;
|
|
74
164
|
};
|
|
75
|
-
|
|
76
|
-
|
|
165
|
+
var ViewerInstance: Viewer3D;
|
|
166
|
+
class Viewer3D extends ViewerBase {
|
|
77
167
|
start(): number;
|
|
78
168
|
finish(): void;
|
|
79
|
-
loadModel(buffer: ArrayBuffer, options: {}, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
|
|
80
|
-
unloadModel(model: string | ModelPart): void;
|
|
81
|
-
/**
|
|
82
|
-
* Returns all models loaded in the viewer.
|
|
83
|
-
* @returns {ModelPart[]} - An array of visible and hidden models
|
|
84
|
-
*/
|
|
85
|
-
getAllModels(): ModelPart[];
|
|
86
|
-
/**
|
|
87
|
-
* @returns {ModelPart[]} - An array of visible models
|
|
88
|
-
*/
|
|
89
|
-
getVisibleModels(): ModelPart[];
|
|
90
|
-
/**
|
|
91
|
-
* @returns {ModelPart[]} - An array of hidden models
|
|
92
|
-
*/
|
|
93
|
-
getHiddenModels(): ModelPart[];
|
|
94
|
-
/**
|
|
95
|
-
* Temporarily remove a model from the Viewer, but keep loaders, materials, and geometry alive.
|
|
96
|
-
* @param {string | ModelPart} model - model id or ModelPart object
|
|
97
|
-
* @returns {boolean} true indicates success, i.e., modelId referred to a visible model that is now hidden
|
|
98
|
-
*/
|
|
99
|
-
hideModel(model: string | ModelPart): void;
|
|
100
|
-
/**
|
|
101
|
-
*
|
|
102
|
-
* @param {string | ModelPart} model - model id or ModelPart object
|
|
103
|
-
*/
|
|
104
|
-
showModel(model: string | ModelPart): void;
|
|
105
|
-
/**
|
|
106
|
-
* Returns the current selection.
|
|
107
|
-
* @returns {Selection[]} Array of the currently selected nodes.
|
|
108
|
-
*/
|
|
109
|
-
getSelection(): Selection[];
|
|
110
|
-
/**
|
|
111
|
-
* Hide elements
|
|
112
|
-
* @param {string[]|string} elementIds - An array of elements (elementIds) or just a single element.
|
|
113
|
-
* @param {string | ModelPart} model - id of the model that contains the elementIds. By default uses the initial model loaded into the scene.
|
|
114
|
-
*/
|
|
115
|
-
hide(elementIds: string[] | string, model?: string | ModelPart): void;
|
|
116
|
-
/**
|
|
117
|
-
*
|
|
118
|
-
*/
|
|
119
|
-
hideAll(): void;
|
|
120
169
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* @param
|
|
124
|
-
* @param
|
|
125
|
-
*
|
|
170
|
+
* Loads new model part to the viewer
|
|
171
|
+
* @param buffer
|
|
172
|
+
* @param options
|
|
173
|
+
* @param onSuccessCallback
|
|
174
|
+
* @param onErrorCallback
|
|
126
175
|
*/
|
|
127
|
-
|
|
176
|
+
loadModelPart(buffer: ArrayBuffer, options: {}, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
|
|
128
177
|
/**
|
|
129
|
-
*
|
|
178
|
+
* unloads model part from the viewer
|
|
179
|
+
* @param modelPart - model part id or model part instance
|
|
130
180
|
*/
|
|
131
|
-
|
|
181
|
+
unloadModelPart(modelPart: string | ModelPart): void;
|
|
132
182
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* If it was selected, it is unselected.
|
|
136
|
-
*
|
|
137
|
-
* @param {string} elementIds
|
|
138
|
-
* @param {string | ModelPart} model - model that contains the elementIds. Uses the initial model loaded by default.
|
|
183
|
+
* Returns general model
|
|
184
|
+
* @returns { Model } - general model
|
|
139
185
|
*/
|
|
140
|
-
|
|
186
|
+
get model(): Model;
|
|
141
187
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* @param {string[] | string} elementIds - element or array of elements to select.
|
|
145
|
-
* @param {string | ModelPart} model - model id or the model instance containing the ids.
|
|
146
|
-
*
|
|
188
|
+
* Sets the cameras point of view.
|
|
189
|
+
* @param cameraPosition camera position and direction.
|
|
147
190
|
*/
|
|
148
|
-
|
|
191
|
+
setCameraPosition(cameraPosition: CameraPosition): void;
|
|
149
192
|
/**
|
|
150
|
-
*
|
|
193
|
+
* Gets the cameras point of view.
|
|
194
|
+
* @returns camera position and direction.
|
|
151
195
|
*/
|
|
152
|
-
|
|
196
|
+
getCameraPosition(): CameraPosition;
|
|
153
197
|
/**
|
|
154
|
-
*
|
|
155
|
-
* @param {string[]
|
|
156
|
-
* @param
|
|
157
|
-
* @
|
|
158
|
-
*/
|
|
159
|
-
setColor(elementIds: string[] | string, color: THREE.Color, model?: string | ModelPart): void;
|
|
160
|
-
/**
|
|
161
|
-
*
|
|
162
|
-
* @param {string | ModelPart} model - id of the model or model instance.
|
|
163
|
-
*/
|
|
164
|
-
clearColors(model?: string | ModelPart): void;
|
|
165
|
-
/**
|
|
166
|
-
* Sets the cameras point of view
|
|
167
|
-
* @param viewPoint camera position and direction
|
|
198
|
+
* Makes screenshot
|
|
199
|
+
* @param {string} [mimeType=image/png] Image MIME type.
|
|
200
|
+
* @param {number} [qualityArgument=1.0] Image quality to be used for image/jpeg or image/webp formats.
|
|
201
|
+
* @returns Blob object representing render image.
|
|
168
202
|
*/
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Gets the cameras point of view
|
|
172
|
-
* @returns camera position and direction
|
|
173
|
-
*/
|
|
174
|
-
getCameraViewPoint(): ViewPointType;
|
|
203
|
+
makeScreenshot(mimeType?: string, quality?: number): Promise<Blob>;
|
|
175
204
|
}
|
|
176
205
|
|
|
177
|
-
|
|
206
|
+
abstract class ViewerBase {
|
|
178
207
|
container: HTMLElement;
|
|
179
208
|
layerManagers: Map<number, ILayerManager>;
|
|
180
209
|
extensionsLoader: ExtensionLoader;
|
|
@@ -188,32 +217,25 @@
|
|
|
188
217
|
*
|
|
189
218
|
*/
|
|
190
219
|
finish(): void;
|
|
191
|
-
|
|
192
|
-
*
|
|
193
|
-
* @param buffer
|
|
194
|
-
* @param options
|
|
195
|
-
* @param onSuccessCallback
|
|
196
|
-
* @param onErrorCallback
|
|
197
|
-
*/
|
|
198
|
-
loadModel(buffer: ArrayBuffer, options: {}, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
|
|
220
|
+
|
|
199
221
|
onPostExtensionLoad(extension: Extension): void;
|
|
200
222
|
}
|
|
201
223
|
|
|
202
|
-
|
|
224
|
+
class ExtensionLoader {
|
|
203
225
|
loadExtension(extensionId: string): Promise<Extension>;
|
|
204
226
|
unloadExtension(extensionId: string): Promise<boolean>;
|
|
205
227
|
getExtensions(): Extension[];
|
|
206
228
|
}
|
|
207
229
|
|
|
208
|
-
|
|
230
|
+
function CreateViewer(container: HTMLElement): GuiViewer3D;
|
|
209
231
|
|
|
210
|
-
|
|
232
|
+
interface ILayerManager {
|
|
211
233
|
createLayer(name: string): ILayer;
|
|
212
234
|
deleteLayer(name: string): boolean;
|
|
213
235
|
getLayer(name: string): ILayer | null;
|
|
214
236
|
hasLayer(name: string): boolean;
|
|
215
237
|
}
|
|
216
|
-
|
|
238
|
+
interface ILayer {
|
|
217
239
|
addOverlay(overlay: Overlay): boolean;
|
|
218
240
|
removeOverlay(overlay: Overlay): boolean;
|
|
219
241
|
getOverlays(): Overlay[];
|
|
@@ -221,37 +243,38 @@
|
|
|
221
243
|
getViewBox(): LayerViewBox;
|
|
222
244
|
dispose(): void;
|
|
223
245
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
246
|
+
type Overlay = HTMLElement | any;
|
|
247
|
+
type LayerContainer = HTMLElement | any;
|
|
248
|
+
type LayerViewBox = DOMRect | any;
|
|
227
249
|
|
|
228
|
-
|
|
250
|
+
class Toolbar extends Control {
|
|
229
251
|
addControl(control: Control): void;
|
|
230
252
|
removeControl(id: string): void;
|
|
231
253
|
}
|
|
232
254
|
|
|
233
|
-
|
|
255
|
+
class Control {
|
|
234
256
|
container: HTMLElement;
|
|
235
257
|
id: string;
|
|
236
258
|
addClass(cssClass: string): void;
|
|
237
259
|
removeClass(cssClass: string): void;
|
|
238
260
|
}
|
|
239
261
|
|
|
240
|
-
|
|
262
|
+
class ViewerToolbar extends Toolbar {
|
|
241
263
|
}
|
|
242
264
|
|
|
243
|
-
|
|
265
|
+
class ToolbarBuilder {
|
|
244
266
|
addButton(id: string): ButtonBuilder;
|
|
245
267
|
removeItem(id: string): void;
|
|
246
268
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
269
|
+
class ButtonBuilder {
|
|
270
|
+
withCaption(caption: string): ButtonBuilder;
|
|
271
|
+
withIcon(icon: string): ButtonBuilder;
|
|
272
|
+
withClickAction(action: EventListener): ButtonBuilder;
|
|
273
|
+
withIsChecked(value: boolean): ButtonBuilder;
|
|
252
274
|
}
|
|
253
275
|
|
|
254
|
-
|
|
276
|
+
class Extension {
|
|
277
|
+
protected _viewer: ViewerBase;
|
|
255
278
|
constructor(viewer3D: ViewerBase, options?: object);
|
|
256
279
|
load(): boolean | Promise<boolean>;
|
|
257
280
|
unload(): boolean;
|
|
@@ -267,10 +290,10 @@
|
|
|
267
290
|
onToolbarCreated(builder: ToolbarBuilder): void;
|
|
268
291
|
}
|
|
269
292
|
|
|
270
|
-
|
|
293
|
+
class ExtensionManager {
|
|
271
294
|
registerExtensionType(extensionId: string, extension: typeof Extension): boolean;
|
|
272
295
|
unregisterExtensionType(extensionId: string): boolean;
|
|
273
296
|
getExtensionType(extensionId: string): typeof Extension;
|
|
274
297
|
}
|
|
275
|
-
|
|
298
|
+
const theExtensionManager: ExtensionManager;
|
|
276
299
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pilotdev/pilot-web-3d",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "TypeScript definitions for ASCON
|
|
5
|
-
"main": "",
|
|
6
|
-
"types": "index.d.ts",
|
|
7
|
-
"scripts": {},
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"typeScriptVersion": "4.4.3",
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@pilotdev/pilot-web-3d",
|
|
3
|
+
"version": "1.0.4-1",
|
|
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
|
+
}
|