@pilotdev/pilot-web-3d 1.0.0

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 (4) hide show
  1. package/LICENCE +21 -0
  2. package/README.md +9 -0
  3. package/index.d.ts +261 -0
  4. package/package.json +14 -0
package/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # Installation
2
+ > `npm install --save @team-pilot/pilot-web-3d`
3
+
4
+ # Summary
5
+ This package contains type definitions for Ascon pilot-web-3d.js library (https://pilotcloud.ascon.net/).
6
+
7
+ ### Additional Details
8
+ * Last updated: Thu, 25 Aug 2022 14:10:25 GMT
9
+ * Global values: `PilotWeb3d`
package/index.d.ts ADDED
@@ -0,0 +1,261 @@
1
+ export namespace PilotWeb3D {
2
+
3
+ export type InitializeSuccessCallback = () => void;
4
+ export declare function Initializer(options: any, callback: InitializeSuccessCallback): void;
5
+ export declare function shutdown(): void;
6
+ export type ErrorCallback = (message: string) => void;
7
+ export type SuccessCallback = (modelId: any) => void;
8
+ export enum DocumentType {
9
+ UNKNOWN = 0,
10
+ DOCUMENT_2D = 1,
11
+ DOCUMENT_3D = 2
12
+ }
13
+
14
+ export class GuiViewer3D extends Viewer3D {
15
+ loadModel(buffer: ArrayBuffer, options: {}, onSuccessCallback: SuccessCallback, onErrorCallback: ErrorCallback): void;
16
+ getToolbar(): ViewerToolbar;
17
+ onPostExtensionLoad(extension: Extension): void;
18
+ }
19
+
20
+ export class ModelPart {
21
+ get id(): string;
22
+ get elementTree(): ModelElementTree;
23
+ dispose(): void;
24
+ }
25
+
26
+ export class Selection {
27
+ modelId: string;
28
+ selected: string[];
29
+ }
30
+
31
+ export class ModelElementTree {
32
+ enumElementChildren(element: string | ModelElement, callback: (guid: string) => void, recursive?: boolean): void;
33
+ getRootElement(): ModelElement;
34
+ getAllElements(): ModelElement[];
35
+ isViewableElement(element: string | ModelElement): boolean;
36
+ isDetachedElement(element: string | ModelElement): boolean;
37
+ getChildLevelNumber(element: string | ModelElement): number;
38
+ }
39
+
40
+ export class ModelElement {
41
+ get id(): string;
42
+ get parent(): ModelElement | undefined;
43
+ get type(): string;
44
+ get name(): string;
45
+ get children(): ModelElement[];
46
+ }
47
+
48
+ export class CoreEventTypes {
49
+ static VIEWER_RESIZE_EVENT: string;
50
+ static VIEWER_MOUSE_DOWN_EVENT: string;
51
+ static VIEWER_MOUSE_MOVE_EVENT: string;
52
+ static VIEWER_MOUSE_UP_EVENT: string;
53
+ static VIEWER_MOUSE_LONG_TOUCH_EVENT: string;
54
+ }
55
+ export class EventTypes extends CoreEventTypes {
56
+ static SELECTION_CHANGED_EVENT: string;
57
+ }
58
+ export class SelectionEvent extends Event {
59
+ selected: string[];
60
+ modelId: string;
61
+ }
62
+
63
+ export interface EventsDispatcher {
64
+ addEventListener(event: string, listener: EventListener, options?: any): void;
65
+ removeEventListener(event: string, listener: EventListener): void;
66
+ hasEventListener(event: string, listener: EventListener): boolean;
67
+ dispatchEvent(event: string | Event): void;
68
+ clearListeners(): void;
69
+ }
70
+
71
+ 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;
160
+ }
161
+
162
+ export abstract class ViewerBase {
163
+ container: HTMLElement;
164
+ layerManagers: Map<number, ILayerManager>;
165
+ extensionsLoader: ExtensionLoader;
166
+ get events(): EventsDispatcher;
167
+ /**
168
+ *
169
+ * @returns
170
+ */
171
+ start(): number;
172
+ /**
173
+ *
174
+ */
175
+ 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;
184
+ onPostExtensionLoad(extension: Extension): void;
185
+ }
186
+
187
+ export class ExtensionLoader {
188
+ loadExtension(extensionId: string): Promise<Extension>;
189
+ unloadExtension(extensionId: string): Promise<boolean>;
190
+ getExtensions(): Extension[];
191
+ }
192
+
193
+ export function CreateViewer(container: HTMLDivElement): GuiViewer3D;
194
+
195
+ export interface ILayerManager {
196
+ createLayer(name: string): ILayer;
197
+ deleteLayer(name: string): boolean;
198
+ getLayer(name: string): ILayer | null;
199
+ hasLayer(name: string): boolean;
200
+ }
201
+ export interface ILayer {
202
+ addOverlay(overlay: Overlay): boolean;
203
+ removeOverlay(overlay: Overlay): boolean;
204
+ getOverlays(): Overlay[];
205
+ getContainer(): LayerContainer;
206
+ getViewBox(): LayerViewBox;
207
+ dispose(): void;
208
+ }
209
+ export type Overlay = HTMLElement | any;
210
+ export type LayerContainer = HTMLElement | any;
211
+ export type LayerViewBox = DOMRect | any;
212
+
213
+ export class Toolbar extends Control {
214
+ addControl(control: Control): void;
215
+ removeControl(id: string): void;
216
+ }
217
+
218
+ export class Control {
219
+ container: HTMLElement;
220
+ id: string;
221
+ addClass(cssClass: string): void;
222
+ removeClass(cssClass: string): void;
223
+ }
224
+
225
+ export class ViewerToolbar extends Toolbar {
226
+ }
227
+
228
+ export class ToolbarBuilder {
229
+ addButton(id: string): ButtonBuilder;
230
+ removeItem(id: string): void;
231
+ }
232
+ export class ButtonBuilder {
233
+ withCaption(caption: string): ButtonBuilder;
234
+ withIcon(icon: string): ButtonBuilder;
235
+ withClickAction(action: EventListener): ButtonBuilder;
236
+ withIsChecked(value: boolean): ButtonBuilder;
237
+ }
238
+
239
+ export class Extension {
240
+ constructor(viewer3D: ViewerBase, options?: object);
241
+ load(): boolean | Promise<boolean>;
242
+ unload(): boolean;
243
+ /**
244
+ * Gets the name of the extension.
245
+ * @returns {string} Returns the name of the extension.
246
+ */
247
+ getName(): string;
248
+ onMouseDown(event: MouseEvent): void;
249
+ onMouseMove(event: MouseEvent): void;
250
+ onMouseUp(event: MouseEvent): void;
251
+ onMouseLongTouch(event: MouseEvent): void;
252
+ onToolbarCreated(builder: ToolbarBuilder): void;
253
+ }
254
+
255
+ export class ExtensionManager {
256
+ registerExtensionType(extensionId: string, extension: typeof Extension): boolean;
257
+ unregisterExtensionType(extensionId: string): boolean;
258
+ getExtensionType(extensionId: string): typeof Extension;
259
+ }
260
+ export const theExtensionManager: ExtensionManager;
261
+ }
package/package.json ADDED
@@ -0,0 +1,14 @@
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
+ }