@bimdata/viewer 2.0.0-beta.74 → 2.0.0-beta.76

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.
@@ -1,75 +1,79 @@
1
1
  declare namespace BDV {
2
- interface PluginConfig {
2
+ interface PluginDefinition {
3
3
  name: string;
4
4
  isViewer?: boolean;
5
- i18n: Object;
6
- component?: Object;
5
+ i18n: any;
6
+ addToWindows?: string[];
7
+ component?: any;
8
+ window?: Window;
7
9
  button?: {
8
10
  position: string;
9
11
  stance?: number;
10
12
  tooltip: string;
11
13
  content: "free" | "simple" | "panel";
12
14
  keepOpen?: boolean;
15
+ overlapWith?: string[];
13
16
  icon: {
14
17
  imgUri?: string;
15
- component?: Object;
16
- options?: {
17
- props: Object;
18
- };
18
+ component?: any;
19
+ options?: { props: Object; };
19
20
  };
20
21
  };
21
22
  startupScript?: ($viewer: $Viewer) => void;
22
- addToWindows?: string[];
23
- window?: Window;
23
+
24
+ // Appended properties
25
+ id?: number;
26
+ componentInstance?: PluginInstance;
27
+ shown?: boolean;
24
28
  }
25
29
 
26
- interface Plugin {
30
+ interface PluginInstance {
27
31
  name: string;
32
+ plugin: PluginDefinition;
28
33
  $cfg: any;
29
- $plugin: any;
30
34
  $viewer: $Viewer;
31
- viewer?: any;
35
+ $show(): void;
36
+ $hide(): void;
32
37
  $open?: () => void;
33
38
  onOpen?: () => void;
34
39
  $close?: () => void;
35
40
  onClose?: () => void;
36
41
  }
37
42
 
38
- interface PluginViewer extends Plugin {
43
+ interface ModelViewerConfig {
44
+ modelLoader?: "hidden" | "disabled";
45
+ }
46
+
47
+ interface ModelViewerInstance extends PluginInstance {
48
+ viewer?: any;
39
49
  modelTypes?: string[];
50
+ annotationMode: boolean;
40
51
 
41
52
  getLoadedModels: () => StateModel[];
42
53
  loadModels: (models: StateModel[]) => Promise<void>;
43
54
  unloadModels: (models: StateModel[]) => Promise<void>;
44
-
45
- getViewpoint: (options: any) => void | Promise<void>;
55
+ getViewpoint: (options?: any) => any | Promise<any>;
46
56
  setViewpoint: (viewpoint: any, options?: any) => void | Promise<void>;
47
-
48
- annotationMode: boolean;
49
57
  startAnnotationMode: (callback: AnnotationCallback) => void;
50
58
  stopAnnotationMode: () => void;
51
-
52
59
  fitView: (options?: any) => void;
53
60
  showUI: (options?: any) => void;
54
61
  hideUI: (options?: { exceptions: string[] }) => Promise<void>;
55
62
  }
56
63
 
57
64
  interface PluginManager {
58
- cfg: ViewerConfigPlugins; // ?
59
- windows: Window[];
60
- pluginsUnits: PluginsUnit[];
61
- readonly pluginsUnit: PluginsUnit;
62
- readonly registeredPlugins: Plugin[];
65
+ cfg: ViewerConfigPlugins;
66
+ readonly registeredPlugins: Map<string, PluginDefinition>;
67
+ readonly pluginsUnits: PluginsUnit[];
63
68
 
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
+ getPluginCopy(name: string, silent?: boolean): PluginDefinition;
70
+ registerPlugin(plugin: PluginDefinition): void;
69
71
  registerPluginsTranslations(i18nPlugin: any): void;
70
72
  runPluginsScripts($viewer: $Viewer): void;
73
+ }
71
74
 
72
- getLocalContext(component: any): LocalContext;
75
+ interface PluginsUnit {
76
+ localContext: LocalContext;
73
77
  }
74
78
 
75
79
  type AnnotationCallback = (params: AnnotationParams) => void;
@@ -1,7 +1,7 @@
1
1
  declare namespace BDV {
2
2
  interface Shortcut {
3
3
  name: string;
4
- context: Object;
4
+ context: GlobalContext | LocalContext;
5
5
  key: string;
6
6
  ctrlKey: boolean;
7
7
  shiftKey: boolean;
@@ -11,12 +11,13 @@ declare namespace BDV {
11
11
 
12
12
  interface ShortcutManager {
13
13
  active: boolean;
14
+ activeLocalContext?: LocalContext;
14
15
  shortcuts: Shortcut[];
15
- currentContext: any;
16
16
 
17
17
  getShortcuts(context: GlobalContext | LocalContext): Shortcut[];
18
18
  getShortcut(name: string, context: GlobalContext | LocalContext): Shortcut;
19
19
  registerShortcut(shortcut: Shortcut, context: GlobalContext | LocalContext): boolean;
20
20
  unregisterShortcut(name: string, context: GlobalContext | LocalContext): boolean;
21
+ destroy(): void;
21
22
  }
22
23
  }
package/types/state.d.ts CHANGED
@@ -3,51 +3,102 @@ 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[]);
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 */
@@ -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
 
@@ -185,6 +245,7 @@ declare namespace BDV {
185
245
  }
186
246
 
187
247
  interface StatePlan extends ApiPlan {
248
+ plan?: ApiPlan;
188
249
  model: StateModel;
189
250
  storey: StateStorey;
190
251
  positioning: StatePositionning;
@@ -209,6 +270,6 @@ declare namespace BDV {
209
270
  y: number;
210
271
  z: number;
211
272
  component: any;
212
- props: any;
273
+ props?: any;
213
274
  }
214
275
  }
@@ -5,5 +5,13 @@ declare namespace BDV {
5
5
  icon: { imgUri: string; };
6
6
  plugins?: string[];
7
7
  menu?: boolean;
8
+ modelTypes?: string[];
9
+ multiModel: boolean;
10
+ }
11
+
12
+ interface WindowManager {
13
+ registeredWindows: Map<string, Window>;
14
+ registerWindow(window: Window): Window;
15
+ unregisterWindow(name: string): void;
8
16
  }
9
17
  }
@@ -1,5 +0,0 @@
1
- declare namespace BDV {
2
- interface PluginsUnit {
3
- localContext: LocalContext;
4
- }
5
- }