@bimdata/viewer 2.0.0-beta.13 → 2.0.0-beta.130

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/types/state.d.ts CHANGED
@@ -3,55 +3,106 @@ declare namespace BDV {
3
3
  hub: EventHandler<StateEvents>;
4
4
 
5
5
  /**** models ****/
6
- models: StateModel[];
7
- modelsMap: Map<number, StateModel>;
8
- loadModels(modelIds: string[]): Promise<StateModel[]>;
9
- unloadModels(modelIds: string[]);
10
- getModel(id: number): StateModel;
6
+ readonly models: StateModel[];
7
+ readonly modelsMap: Map<number, StateModel>;
8
+ loadModels(modelIds: number[]): Promise<StateModel[]>;
9
+ unloadModels(modelIds: number[]): void;
10
+ getStoreyFromAbsoluteElevation(model: StateModel, elevation: number): StateStorey;
11
11
 
12
12
  /**** objects ****/
13
- objects: StateObject[];
14
- objectsMap: Map<number, StateObject>;
15
- uuidsMap: { get(uuid: string): StateObject[]; };
16
- selectedObjects: StateObject[];
17
- colorizedObjects: StateObject[];
18
- deselectedObjects: StateObject[];
19
- highlightedObjects: StateObject[];
20
- unhighlightedObjects: StateObject[];
21
- visibleObjects: StateObject[];
22
- unvisibleObjects: StateObject[];
23
- xrayedObjects: StateObject[];
24
- unxrayedObjects: StateObject[];
13
+ readonly objects: StateObject[];
14
+ readonly objectsIds: number[];
15
+ readonly objectsUuids: string[];
16
+ readonly objectsMap: Map<number, StateObject>;
17
+ readonly uuidsMap: { get(uuid: string): StateObject[]; };
25
18
  getObject(id: number): StateObject;
26
19
  getObjectsByUuids(uuids: string[]): StateObject[];
27
- selectObjects(ids: number[]): void;
28
- colorizeObjects(ids: number[], color?: string): void;
29
- deselectObjects(ids: number[]): void;
30
- highlightObjects(ids: number[]): void;
31
- unhighlightObjects(ids: number[]): void;
32
- showObjects(ids: number[]): void;
33
- hideObjects(ids: number[]): void;
34
- xrayObjects(ids: number[]): void;
35
- unxrayObjects(ids: number[]): void;
36
- isolateObjects(ids: number[]): void;
37
- reintegrateObjects(): void;
20
+ getObjectsOfType(type: string): StateObject[];
21
+ getObjectsWithTheSameTypeAs(ids: number[]): StateObject[];
22
+ getTypesOf(ids: number[]): string[];
23
+
24
+ readonly visibleObjects: StateObject[];
25
+ readonly visibleObjectsIds: number[];
26
+ readonly visibleObjectsUuids: string[];
27
+ showObjects(ids: number[], options?: any): void;
28
+ showObjectsByUuids(uuids: string[], options?: any): void;
29
+
30
+ readonly unvisibleObjects: StateObject[];
31
+ readonly unvisibleObjectsIds: number[];
32
+ readonly unvisibleObjectsUuids: string[];
33
+ hideObjects(ids: number[], options?: any): void;
34
+ hideObjectsByUuids(uuids: string[], options?: any): void;
35
+
36
+ readonly pickableObjects: StateObject[];
37
+ readonly pickableObjectsIds: number[];
38
+ readonly pickableObjectsUuids: string[];
39
+ setObjectsPickable(ids: number[], options?: any): void;
40
+ setObjectsPickableByUuids(uuids: string[], options?: any): void;
41
+
42
+ readonly unpickableObjects: StateObject[];
43
+ readonly unpickableObjectsIds: number[];
44
+ readonly unpickableObjectsUuids: string[];
45
+ setObjectsUnpickable(ids: number[], options?: any): void;
46
+ setObjectsUnpickableByUuids(uuids: string[], options?: any): void;
47
+
48
+ readonly selectedObjects: StateObject[];
49
+ readonly selectedObjectsIds: number[];
50
+ readonly selectedObjectsUuids: string[];
51
+ selectObjects(ids: number[], options?: any): void;
52
+ selectObjectsByUuids(uuids: string[], options?: any): void;
53
+
54
+ readonly deselectedObjects: StateObject[];
55
+ readonly deselectedObjectsIds: number[];
56
+ readonly deselectedObjectsUuids: string[];
57
+ deselectObjects(ids: number[], options?: any): void;
58
+ deselectObjectsByUuids(uuids: string[], options?: any): void;
59
+
60
+ readonly highlightedObjects: StateObject[];
61
+ readonly highlightedObjectsIds: number[];
62
+ readonly highlightedObjectsUuids: string[];
63
+ highlightObjects(ids: number[], options?: any): void;
64
+ highlightObjectsByUuids(uuids: string[], options?: any): void;
65
+
66
+ readonly unhighlightedObjects: StateObject[];
67
+ readonly unhighlightedObjectsIds: number[];
68
+ readonly unhighlightedObjectsUuids: string[];
69
+ unhighlightObjects(ids: number[], options?: any): void;
70
+ unhighlightObjectsByUuids(uuids: string[], options?: any): void;
71
+
72
+ readonly xrayedObjects: StateObject[];
73
+ readonly xrayedObjectsIds: number[];
74
+ readonly xrayedObjectsUuids: string[];
75
+ xrayObjects(ids: number[], options?: any): void;
76
+ xrayObjectsByUuids(uuids: string[], options?: any): void;
77
+
78
+ readonly unxrayedObjects: StateObject[];
79
+ readonly unxrayedObjectsIds: number[];
80
+ readonly unxrayedObjectsUuids: string[];
81
+ unxrayObjects(ids: number[], options?: any): void;
82
+ unxrayObjectsByUuids(uuids: string[], options?: any): void;
83
+
84
+ readonly colorizedObjects: StateObject[];
85
+ readonly colorizedObjectsIds: number[];
86
+ readonly colorizedObjectsUuids: string[];
87
+ colorizeObjects(ids: number[], color?: string, options?: any): void;
88
+ colorizeObjectsByUuids(uuids: string[], color?: string, options?: any): void;
38
89
 
39
90
  /**** annotations ****/
40
91
  readonly annotations: StateAnnotation[];
41
- addAnnotation(annotation: StateAnnotation, options: any): StateAnnotation;
42
- removeAnnotation(annotation: any, options: any): boolean;
92
+ addAnnotation(annotation: StateAnnotation, options?: any): StateAnnotation;
93
+ removeAnnotation(annotation: StateAnnotation, options?: any): boolean;
43
94
  clearAnnotations(): void;
44
95
 
45
96
  // ---
46
97
 
47
98
  /** @deprecated use `models` instead */
48
- ifcs: StateModel[];
99
+ readonly ifcs: StateModel[];
49
100
  /** @deprecated use `modelsMap` instead */
50
- ifcsMap: Map<number, StateModel>;
101
+ readonly ifcsMap: Map<number, StateModel>;
51
102
  /** @deprecated use `loadModels` instead */
52
103
  loadIfcs(ifcIds: string[]): Promise<StateModel[]>;
53
104
  /** @deprecated use `unloadModels` instead */
54
- unloadIfcs(ifcIds: string[]);
105
+ unloadIfcs(ifcIds: string[]): void;
55
106
  /** @deprecated use `getModel` instead */
56
107
  getIfc(id: number): StateModel;
57
108
  }
@@ -71,55 +122,63 @@ declare namespace BDV {
71
122
  "objects-removed": {
72
123
  objects: StateObject[];
73
124
  };
74
- "objects-selected": {
125
+ "objects-shown": {
75
126
  objects: StateObject[];
76
- options?: Object;
127
+ options?: any;
77
128
  };
78
- "objects-deselected": {
129
+ "objects-hidden": {
79
130
  objects: StateObject[];
80
- options?: Object;
131
+ options?: any;
81
132
  };
82
- "objects-highlighted": {
133
+ "objects-pickable": {
83
134
  objects: StateObject[];
84
- options?: Object;
135
+ options?: any;
85
136
  };
86
- "objects-unhighlighted": {
137
+ "objects-unpickable": {
87
138
  objects: StateObject[];
88
- options?: Object;
139
+ options?: any;
89
140
  };
90
- "objects-shown": {
141
+ "objects-selected": {
91
142
  objects: StateObject[];
92
- options?: Object;
143
+ options?: any;
93
144
  };
94
- "objects-hidden": {
145
+ "objects-deselected": {
146
+ objects: StateObject[];
147
+ options?: any;
148
+ };
149
+ "objects-highlighted": {
95
150
  objects: StateObject[];
96
- $options?: Object;
151
+ options?: any;
152
+ };
153
+ "objects-unhighlighted": {
154
+ objects: StateObject[];
155
+ options?: any;
97
156
  };
98
157
  "objects-xrayed": {
99
158
  objects: StateObject[];
100
- options?: Object;
159
+ options?: any;
101
160
  };
102
161
  "objects-unxrayed": {
103
162
  objects: StateObject[];
104
- options?: Object;
163
+ options?: any;
105
164
  };
106
165
  "objects-colorized": {
107
166
  objects: StateObject[];
108
167
  color: number;
109
- options?: Object;
168
+ options?: any;
110
169
  };
111
170
  // annotations events
112
171
  "annotation-added": {
113
- annotation: Object;
114
- options?: Object;
172
+ annotation: StateAnnotation;
173
+ options?: any;
115
174
  };
116
175
  "annotation-updated": {
117
- annotation: Object;
118
- options?: Object;
176
+ annotation: StateAnnotation;
177
+ options?: any;
119
178
  };
120
179
  "annotation-removed": {
121
- annotation: Object;
122
- options?: Object;
180
+ annotation: StateAnnotation;
181
+ options?: any;
123
182
  };
124
183
 
125
184
  // ---
@@ -134,20 +193,18 @@ declare namespace BDV {
134
193
  };
135
194
  };
136
195
 
137
- interface StateModel {
138
- id: number;
139
- name: string;
140
- type: ModelType;
141
- status: ModelStatus;
196
+ interface StateModel extends ApiModel {
142
197
  structure: Object;
143
- objects: StateObject[];
144
198
  uuids: Map<string, StateObject>;
199
+ objects: StateObject[];
145
200
  storeys: StateStorey[];
146
201
  }
147
202
 
148
203
  interface StateObject extends ApiObject {
149
204
  id: number;
150
205
  model: StateModel;
206
+
207
+ // Object state
151
208
  visible: boolean;
152
209
  pickable: boolean;
153
210
  selected: boolean;
@@ -158,9 +215,12 @@ declare namespace BDV {
158
215
  // Advanced getters
159
216
  readonly descendants: StateObject[];
160
217
  readonly ancestors: StateObject[];
218
+ readonly site: StateObject;
219
+ readonly building: StateObject;
220
+ readonly storey: StateObject;
221
+ readonly layout: StateObject;
222
+ readonly space: StateObject;
161
223
  getFirstAncestorWithType: (type: string) => StateObject;
162
- storey: StateObject;
163
- space: StateObject;
164
224
 
165
225
  // ---
166
226
 
@@ -184,24 +244,20 @@ declare namespace BDV {
184
244
  selected: boolean;
185
245
  }
186
246
 
187
- interface StatePlan extends ApiPlan {
247
+ interface StatePlan extends StatePositionning {
188
248
  model: StateModel;
189
249
  storey: StateStorey;
190
- positioning: StatePositionning;
191
-
192
- key: string;
193
250
  index: number;
194
- loading: boolean;
195
- editing: boolean;
196
- selected: boolean;
251
+ key: string;
197
252
  }
198
253
 
199
254
  interface StatePositionning {
200
- x: number;
201
- y: number;
202
- angle: number;
255
+ translation_x: number;
256
+ translation_y: number;
257
+ rotate_z: number;
203
258
  scale: number;
204
259
  opacity: number;
260
+ plan?: ApiPlan;
205
261
  }
206
262
 
207
263
  interface StateAnnotation {
@@ -209,6 +265,6 @@ declare namespace BDV {
209
265
  y: number;
210
266
  z: number;
211
267
  component: any;
212
- props: any;
268
+ props?: any;
213
269
  }
214
270
  }
@@ -1,17 +0,0 @@
1
- declare namespace BDV {
2
- interface $Viewer {
3
- cfg: ViewerConfig;
4
- i18n: any;
5
- readonly api: Api;
6
- readonly state: State;
7
-
8
- readonly pluginManager: PluginManager;
9
- readonly shortcutManager: ShortcutManager;
10
- readonly globalContext: GlobalContext;
11
- readonly localContext: LocalContext;
12
- getLocalContexts(window: string): LocalContext[];
13
-
14
- currentContext: any;
15
- contextMenu: ContextMenu;
16
- }
17
- }
package/types/events.d.ts DELETED
@@ -1,23 +0,0 @@
1
- type Events = {
2
- [eventName: string]: Object;
3
- };
4
-
5
- interface EventOptions {
6
- getLastEvent?: boolean;
7
- }
8
-
9
- interface EventHandler<T extends Events> {
10
- on<N extends keyof T>(
11
- eventName: N,
12
- callback: (arg: T[N]) => void,
13
- options?: EventOptions
14
- ): number;
15
- once<N extends keyof T>(
16
- eventName: N,
17
- callback: (arg: T[N]) => void,
18
- options?: EventOptions
19
- ): number;
20
- off(subscriptionId: number): void;
21
- emit<N extends keyof T>(eventName: N, payload: T[N]): void;
22
- clear(): void;
23
- }
@@ -1,43 +0,0 @@
1
- declare namespace BDV {
2
- interface GlobalContext {
3
- hub: EventHandler<LocalContextEvents & GlobalContextEvents>;
4
-
5
- areas: any;
6
- areasSettingsDisplayed: boolean;
7
- areasSwapEnabled: boolean;
8
- areasSettingsFullOption: boolean;
9
- bcfManagerDisplayed: boolean;
10
- mouseover: boolean;
11
-
12
- /** @deprecated */
13
- getPlugins(name: string): Plugin[];
14
- plugins: Map<string, Plugin>;
15
-
16
- // ---
17
-
18
- loading: boolean;
19
- loadingProcessStart(): void;
20
- loadingProcessEnd(): void;
21
-
22
- registerShortcut(shortcut: Shortcut, context: GlobalContext): boolean;
23
- unregisterShortcut(name: string, context: GlobalContext): boolean;
24
-
25
- modals: {
26
- pushModal(component: Object, options?: { args: Object }): void;
27
- clearModal(): void;
28
- };
29
- }
30
-
31
- type GlobalContextEvents = {
32
- "plan-model-loaded": {
33
- model: ApiModel;
34
- plugin: ViewerDwg.Plugin;
35
- };
36
- "plan-model-unloaded": {
37
- model: ApiModel;
38
- plugin: ViewerDwg.Plugin;
39
- };
40
- "window-open": Window;
41
- "window-close": Window;
42
- };
43
- }
@@ -1,91 +0,0 @@
1
- declare namespace BDV {
2
- interface LocalContext {
3
- hub: EventHandler<LocalContextEvents>;
4
-
5
- area: any;
6
- el: Element;
7
- width: number;
8
- height: number;
9
-
10
- /** @deprecated */
11
- getPlugin(name: string): Plugin;
12
- plugins: Map<string, Plugin>;
13
-
14
- // ---
15
-
16
- loading: boolean;
17
- loadingProcessStart(): void;
18
- loadingProcessEnd(): void;
19
-
20
- registerShortcut(shortcut: Shortcut, context: LocalContext): boolean;
21
- unregisterShortcut(name: string, context: LocalContext): boolean;
22
-
23
- modals: {
24
- pushModal(component: Object, options?: { args: Object }): void;
25
- clearModal(): void;
26
- };
27
- }
28
-
29
- type LocalContextEvents = {
30
- "3d-model-loaded": {
31
- model: StateModel;
32
- plugin: ViewerIfc3D.Plugin;
33
- /** @deprecated use `model` instead */
34
- ifc: StateModel;
35
- };
36
- "3d-model-unloaded": {
37
- model: StateModel;
38
- plugin: ViewerIfc3D.Plugin;
39
- /** @deprecated use `model` instead */
40
- ifc: StateModel;
41
- };
42
- "2d-model-loaded": {
43
- model: StateModel;
44
- plugin: ViewerIfc2D.Plugin;
45
- /** @deprecated use `model` instead */
46
- ifc: StateModel;
47
- };
48
- "2d-model-unloaded": {
49
- model: StateModel;
50
- plugin: ViewerIfc2D.Plugin;
51
- /** @deprecated use `model` instead */
52
- ifc: StateModel;
53
- };
54
- "dwg-model-loaded": {
55
- dwg: Document;
56
- model: StateModel;
57
- plugin: ViewerDwg.Plugin;
58
- };
59
- "dwg-model-unloaded": {
60
- plugin: ViewerDwg.Plugin;
61
- };
62
- "dxf-model-loaded": {
63
- dxf: Document;
64
- model: StateModel;
65
- plugin: ViewerDwg.Plugin;
66
- };
67
- "dxf-model-unloaded": {
68
- plugin: ViewerDwg.Plugin;
69
- };
70
- "plan-model-loaded": {
71
- model: ApiModel;
72
- plugin: ViewerDwg.Plugin;
73
- };
74
- "plan-model-unloaded": {
75
- model: ApiModel;
76
- plugin: ViewerDwg.Plugin;
77
- };
78
- "plugin-created": {
79
- pluginName: string;
80
- plugin: Plugin;
81
- };
82
- "plugin-destroyed": {
83
- pluginName: string;
84
- plugin: Plugin;
85
- };
86
- "plugin-menu-open": Plugin;
87
- "plugin-menu-close": Plugin;
88
- "context-resize": { width: number; height: number };
89
- alert: { type: string; message: string };
90
- };
91
- }
@@ -1,5 +0,0 @@
1
- declare namespace BDV {
2
- interface PluginsUnit {
3
- localContext: LocalContext;
4
- }
5
- }
@@ -1,77 +0,0 @@
1
- declare namespace BDV {
2
- interface PluginConfig {
3
- name: string;
4
- isViewer?: boolean;
5
- i18n: Object;
6
- component?: Object;
7
- button?: {
8
- position: string;
9
- stance?: number;
10
- tooltip: string;
11
- content: "free" | "simple" | "panel";
12
- keepOpen?: boolean;
13
- icon: {
14
- imgUri?: string;
15
- component?: Object;
16
- options?: {
17
- props: Object;
18
- };
19
- };
20
- };
21
- startupScript?: ($viewer: $Viewer) => void;
22
- addToWindows?: string[];
23
- window?: Window;
24
- }
25
-
26
- interface Plugin {
27
- name: string;
28
- $cfg: any;
29
- $plugin: any;
30
- $viewer: $Viewer;
31
- viewer?: any;
32
- $open?: () => void;
33
- onOpen?: () => void;
34
- $close?: () => void;
35
- onClose?: () => void;
36
- }
37
-
38
- interface PluginViewer extends Plugin {
39
- modelTypes?: string[];
40
-
41
- getLoadedModels: () => StateModel[];
42
- loadModels: (models: StateModel[]) => Promise<void>;
43
- unloadModels: (models: StateModel[]) => Promise<void>;
44
-
45
- getViewpoint: () => void | Promise<void>;
46
- setViewpoint: (viewpoint: any, options?: any) => void | Promise<void>;
47
-
48
- annotationMode: boolean;
49
- startAnnotationMode: (callback: AnnotationCallback) => void;
50
- stopAnnotationMode: () => void;
51
-
52
- fitView: (args?: any) => void;
53
- showUI: () => void;
54
- hideUI: (options: { exceptions: string[] }) => void;
55
- }
56
-
57
- interface PluginManager {
58
- cfg: ViewerConfigPlugins; // ?
59
- windows: Window[];
60
- pluginsUnits: PluginsUnit[];
61
- readonly pluginsUnit: PluginsUnit;
62
- readonly registeredPlugins: Plugin[];
63
-
64
- getWindow(name: string): Window;
65
- registerWindow(window: Window): Window;
66
- unregisterWindow(name: string): boolean;
67
- getPluginCopy(name: string, silent?: boolean): Plugin;
68
- registerPlugin(plugin: Plugin, cfg: PluginConfig): void;
69
- registerPluginsTranslations(i18nPlugin: any): void;
70
- runPluginsScripts($viewer: $Viewer): void;
71
-
72
- getLocalContext(component: any): LocalContext;
73
- }
74
-
75
- type AnnotationCallback = (params: AnnotationParams) => void;
76
- type AnnotationParams = { x: number, y: number, z: number, models: StateModel[], storey?: StateStorey, page?: number };
77
- }
@@ -1,9 +0,0 @@
1
- declare namespace BDV {
2
- interface Window {
3
- name: string;
4
- label: string;
5
- icon: { imgUri: string; };
6
- plugins?: string[];
7
- menu?: boolean;
8
- }
9
- }