@pilotdev/pilot-web-3d 1.0.1 → 1.0.4
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 +162 -133
- 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,34 +1,116 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference path="./three/three.d.ts" />
|
|
2
|
+
declare namespace PilotWeb3D {
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 {
|
|
9
10
|
UNKNOWN = 0,
|
|
10
11
|
DOCUMENT_2D = 1,
|
|
11
12
|
DOCUMENT_3D = 2
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
loadModel(buffer: ArrayBuffer, options: {}, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
|
|
15
|
+
class GuiViewer3D extends Viewer3D {
|
|
16
16
|
getToolbar(): ViewerToolbar;
|
|
17
17
|
onPostExtensionLoad(extension: Extension): void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
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 {
|
|
21
103
|
get id(): string;
|
|
22
104
|
get elementTree(): ModelElementTree;
|
|
23
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[];
|
|
@@ -37,7 +119,7 @@
|
|
|
37
119
|
getChildLevelNumber(element: string | ModelElement): number;
|
|
38
120
|
}
|
|
39
121
|
|
|
40
|
-
|
|
122
|
+
class ModelElement {
|
|
41
123
|
get id(): string;
|
|
42
124
|
get parent(): ModelElement | undefined;
|
|
43
125
|
get type(): string;
|
|
@@ -45,22 +127,22 @@
|
|
|
45
127
|
get children(): ModelElement[];
|
|
46
128
|
}
|
|
47
129
|
|
|
48
|
-
|
|
130
|
+
class CoreEventTypes {
|
|
49
131
|
static VIEWER_RESIZE_EVENT: string;
|
|
50
132
|
static VIEWER_MOUSE_DOWN_EVENT: string;
|
|
51
133
|
static VIEWER_MOUSE_MOVE_EVENT: string;
|
|
52
134
|
static VIEWER_MOUSE_UP_EVENT: string;
|
|
53
135
|
static VIEWER_MOUSE_LONG_TOUCH_EVENT: string;
|
|
54
136
|
}
|
|
55
|
-
|
|
137
|
+
class EventTypes extends CoreEventTypes {
|
|
56
138
|
static SELECTION_CHANGED_EVENT: string;
|
|
57
139
|
}
|
|
58
|
-
|
|
140
|
+
class SelectionEvent extends Event {
|
|
59
141
|
selected: string[];
|
|
60
142
|
modelId: string;
|
|
61
143
|
}
|
|
62
144
|
|
|
63
|
-
|
|
145
|
+
interface EventsDispatcher {
|
|
64
146
|
addEventListener(event: string, listener: EventListener, options?: any): void;
|
|
65
147
|
removeEventListener(event: string, listener: EventListener): void;
|
|
66
148
|
hasEventListener(event: string, listener: EventListener): boolean;
|
|
@@ -68,98 +150,52 @@
|
|
|
68
150
|
clearListeners(): void;
|
|
69
151
|
}
|
|
70
152
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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;
|
|
153
|
+
type CameraPosition = {
|
|
154
|
+
position: THREE.Vector3;
|
|
155
|
+
direction: THREE.Vector3;
|
|
156
|
+
};
|
|
157
|
+
var ViewerInstance: Viewer3D;
|
|
158
|
+
class Viewer3D extends ViewerBase {
|
|
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
|
-
|
|
197
|
+
|
|
198
|
+
abstract class ViewerBase {
|
|
163
199
|
container: HTMLElement;
|
|
164
200
|
layerManagers: Map<number, ILayerManager>;
|
|
165
201
|
extensionsLoader: ExtensionLoader;
|
|
@@ -173,32 +209,25 @@
|
|
|
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
|
-
|
|
216
|
+
class ExtensionLoader {
|
|
188
217
|
loadExtension(extensionId: string): Promise<Extension>;
|
|
189
218
|
unloadExtension(extensionId: string): Promise<boolean>;
|
|
190
219
|
getExtensions(): Extension[];
|
|
191
220
|
}
|
|
192
221
|
|
|
193
|
-
|
|
222
|
+
function CreateViewer(container: HTMLElement): GuiViewer3D;
|
|
194
223
|
|
|
195
|
-
|
|
224
|
+
interface ILayerManager {
|
|
196
225
|
createLayer(name: string): ILayer;
|
|
197
226
|
deleteLayer(name: string): boolean;
|
|
198
227
|
getLayer(name: string): ILayer | null;
|
|
199
228
|
hasLayer(name: string): boolean;
|
|
200
229
|
}
|
|
201
|
-
|
|
230
|
+
interface ILayer {
|
|
202
231
|
addOverlay(overlay: Overlay): boolean;
|
|
203
232
|
removeOverlay(overlay: Overlay): boolean;
|
|
204
233
|
getOverlays(): Overlay[];
|
|
@@ -206,37 +235,37 @@
|
|
|
206
235
|
getViewBox(): LayerViewBox;
|
|
207
236
|
dispose(): void;
|
|
208
237
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
238
|
+
type Overlay = HTMLElement | any;
|
|
239
|
+
type LayerContainer = HTMLElement | any;
|
|
240
|
+
type LayerViewBox = DOMRect | any;
|
|
212
241
|
|
|
213
|
-
|
|
242
|
+
class Toolbar extends Control {
|
|
214
243
|
addControl(control: Control): void;
|
|
215
244
|
removeControl(id: string): void;
|
|
216
245
|
}
|
|
217
246
|
|
|
218
|
-
|
|
247
|
+
class Control {
|
|
219
248
|
container: HTMLElement;
|
|
220
249
|
id: string;
|
|
221
250
|
addClass(cssClass: string): void;
|
|
222
251
|
removeClass(cssClass: string): void;
|
|
223
252
|
}
|
|
224
253
|
|
|
225
|
-
|
|
254
|
+
class ViewerToolbar extends Toolbar {
|
|
226
255
|
}
|
|
227
256
|
|
|
228
|
-
|
|
257
|
+
class ToolbarBuilder {
|
|
229
258
|
addButton(id: string): ButtonBuilder;
|
|
230
259
|
removeItem(id: string): void;
|
|
231
260
|
}
|
|
232
|
-
|
|
261
|
+
class ButtonBuilder {
|
|
233
262
|
withCaption(caption: string): ButtonBuilder;
|
|
234
263
|
withIcon(icon: string): ButtonBuilder;
|
|
235
264
|
withClickAction(action: EventListener): ButtonBuilder;
|
|
236
265
|
withIsChecked(value: boolean): ButtonBuilder;
|
|
237
266
|
}
|
|
238
267
|
|
|
239
|
-
|
|
268
|
+
class Extension {
|
|
240
269
|
constructor(viewer3D: ViewerBase, options?: object);
|
|
241
270
|
load(): boolean | Promise<boolean>;
|
|
242
271
|
unload(): boolean;
|
|
@@ -252,10 +281,10 @@
|
|
|
252
281
|
onToolbarCreated(builder: ToolbarBuilder): void;
|
|
253
282
|
}
|
|
254
283
|
|
|
255
|
-
|
|
284
|
+
class ExtensionManager {
|
|
256
285
|
registerExtensionType(extensionId: string, extension: typeof Extension): boolean;
|
|
257
286
|
unregisterExtensionType(extensionId: string): boolean;
|
|
258
287
|
getExtensionType(extensionId: string): typeof Extension;
|
|
259
288
|
}
|
|
260
|
-
|
|
289
|
+
const theExtensionManager: ExtensionManager;
|
|
261
290
|
}
|
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",
|
|
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
|
+
}
|