@xeokit/xeokit-sdk 2.5.2-beta-3 → 2.5.2-beta-5

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.
@@ -355,9 +355,9 @@ parsers[ParserV10.version] = ParserV10;
355
355
  * }
356
356
  *
357
357
  * // Gets the contents of the given .XKT file in an arraybuffer
358
- * getXKT(src, ok, error) {
358
+ * getXKT(xKTSrc, ok, error) {
359
359
  * console.log("MyDataSource#getXKT(" + xKTSrc + ", ... )");
360
- * utils.loadArraybuffer(src,
360
+ * utils.loadArraybuffer(xKTSrc,
361
361
  * (arraybuffer) => {
362
362
  * ok(arraybuffer);
363
363
  * },
@@ -957,13 +957,14 @@ class XKTLoaderPlugin extends Plugin {
957
957
  sceneModel.once("destroyed", () => {
958
958
  this.viewer.metaScene.destroyMetaModel(metaModel.id);
959
959
  });
960
- sceneModel.scene.once("tick", () => {
960
+ window.setTimeout(() => {
961
+
961
962
  if (sceneModel.destroyed) {
962
963
  return;
963
964
  }
964
965
  sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
965
966
  sceneModel.fire("loaded", true, false); // Don't forget the event, for late subscribers
966
- });
967
+ }, 100);
967
968
  }
968
969
 
969
970
  const error = (errMsg) => {
@@ -1041,7 +1042,7 @@ class XKTLoaderPlugin extends Plugin {
1041
1042
  globalizeObjectIds: options.globalizeObjectIds
1042
1043
  });
1043
1044
  i++;
1044
- this.viewer.scene.once("tick", loadNext);
1045
+ window.setTimeout( loadNext, 100);
1045
1046
  }, error);
1046
1047
  }
1047
1048
  }
@@ -1056,7 +1057,7 @@ class XKTLoaderPlugin extends Plugin {
1056
1057
  this._dataSource.getXKT(`${baseDir}${xktFiles[i]}`, (arrayBuffer) => {
1057
1058
  this._parseModel(arrayBuffer, params, options, sceneModel, metaModel, manifestCtx);
1058
1059
  i++;
1059
- this.viewer.scene.once("tick", loadNext);
1060
+ window.setTimeout(loadNext, 100);
1060
1061
  }, error);
1061
1062
  }
1062
1063
  }
@@ -230,4 +230,13 @@ function renderScenes() {
230
230
 
231
231
  (window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(frame);
232
232
 
233
+ function compileScenes() {
234
+
235
+ for (let id in core.scenes) {
236
+ core.scenes[id].compile();
237
+ }
238
+ }
239
+
240
+ window.setInterval(compileScenes, 1000 / 60);
241
+
233
242
  export {core};
@@ -1192,7 +1192,7 @@ class Scene extends Component {
1192
1192
  }
1193
1193
 
1194
1194
  _deRegisterColorizedObject(entity) {
1195
- delete this.colorizedObjects[entity.id];
1195
+ delete this.colorizedObjects[entity.id];
1196
1196
  this._numColorizedObjects--;
1197
1197
  this._colorizedObjectIds = null; // Lazy regenerate
1198
1198
  }
@@ -1209,7 +1209,7 @@ class Scene extends Component {
1209
1209
  }
1210
1210
 
1211
1211
  _deRegisterOpacityObject(entity) {
1212
- delete this.opacityObjects[entity.id];
1212
+ delete this.opacityObjects[entity.id];
1213
1213
  this._numOpacityObjects--;
1214
1214
  this._opacityObjectIds = null; // Lazy regenerate
1215
1215
  }
@@ -1226,7 +1226,7 @@ class Scene extends Component {
1226
1226
  }
1227
1227
 
1228
1228
  _deRegisterOffsetObject(entity) {
1229
- delete this.offsetObjects[entity.id];
1229
+ delete this.offsetObjects[entity.id];
1230
1230
  this._numOffsetObjects--;
1231
1231
  this._offsetObjectIds = null; // Lazy regenerate
1232
1232
  }
@@ -1499,6 +1499,18 @@ class Scene extends Component {
1499
1499
  this._saveAmbientColor();
1500
1500
  }
1501
1501
 
1502
+
1503
+ /**
1504
+ * @private
1505
+ */
1506
+ compile() {
1507
+ if (this._needRecompile) {
1508
+ this._recompile();
1509
+ this._renderer.imageDirty();
1510
+ this._needRecompile = false;
1511
+ }
1512
+ }
1513
+
1502
1514
  _recompile() {
1503
1515
  for (const id in this._compilables) {
1504
1516
  if (this._compilables.hasOwnProperty(id)) {
@@ -34,6 +34,8 @@ export declare type NavCubePluginConfiguration = {
34
34
  bottomColor?: string;
35
35
  /** Custom color for highlighting regions on the NavCube as we hover the pointer over them. */
36
36
  hoverColor?: string;
37
+ /** Custom text color for labels of the NavCube. */
38
+ textColor?: string;
37
39
  /** Sets whether the axis, corner and edge-aligned views will fit the view to the entire {@link Scene} or just to visible object-{@link Entity}s. Entitys are visible objects when {@link Entity.isObject} and {@link Entity.visible} are both ````true````. */
38
40
  fitVisible?: boolean;
39
41
  /** Sets whether the NavCube switches between perspective and orthographic projections in synchrony with the {@link Camera}. When ````false````, the NavCube will always be rendered with perspective projection. */
@@ -1,6 +1,6 @@
1
1
  import { Plugin, Viewer } from "../../viewer";
2
- import { ModelTreeView } from "./ModelTreeView";
3
2
  import { TreeViewNode } from "./TreeViewNode";
3
+ import { ITreeViewRenderService } from "./renderService";
4
4
 
5
5
  export declare type TreeViewPluginConfiguration = {
6
6
  /** DOM element ID to contain the TreeViewPlugin */
@@ -17,6 +17,8 @@ export declare type TreeViewPluginConfiguration = {
17
17
  sortNodes?: boolean;
18
18
  /** When true, will not contain nodes that don't have content in the {@link Scene}. These are nodes whose {@link MetaObject}s don't have {@link Entity}s. */
19
19
  pruneEmptyNodes?: boolean;
20
+ /** Optional {@link ITreeViewRenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}. */
21
+ renderService?: ITreeViewRenderService;
20
22
  };
21
23
 
22
24
  /**
@@ -47,15 +49,6 @@ export declare class TreeViewPlugin extends Plugin {
47
49
  */
48
50
  get hierarchy(): "containment" | "storeys" | "types";
49
51
 
50
- /**
51
- * Returns the map of {@link ModelTreeView}s.
52
- *
53
- * Each ModelTreeView is mapped to the ID of its model.
54
- *
55
- * @return {*|{}}
56
- */
57
- get modelTreeViews(): any;
58
-
59
52
  /**
60
53
  * Adds a model to this tree view.
61
54
  *
@@ -69,13 +62,10 @@ export declare class TreeViewPlugin extends Plugin {
69
62
  * @param {String} [options.rootName] Optional display name for the root node. Ordinary, for "containment"
70
63
  * and "storeys" hierarchy types, the tree would derive the root node name from the model's "IfcProject" element
71
64
  * name. This option allows to override that name when it is not suitable as a display name.
72
- * @returns {ModelTreeView} ModelTreeView for the newly-added model. If this method succeeded in adding the model,
73
- * then {@link ModelTreeView.valid} will equal ````true````. Otherwise, that property will be ````false````
74
- * and {@link ModelTreeView.errors} will contain error messages.
75
65
  */
76
66
  addModel(modelId: string, options?: {
77
- rootName?: string;
78
- }): ModelTreeView;
67
+ rootName?: string;
68
+ }): void;
79
69
 
80
70
  /**
81
71
  * Removes a model from this tree view.
@@ -86,11 +76,6 @@ export declare class TreeViewPlugin extends Plugin {
86
76
  */
87
77
  removeModel(modelId: string): void;
88
78
 
89
- /**
90
- * Collapses all trees within this tree view.
91
- */
92
- collapse(): void;
93
-
94
79
  /**
95
80
  * Highlights the tree view node that represents the given object {@link Entity}.
96
81
  *
@@ -127,6 +112,12 @@ export declare class TreeViewPlugin extends Plugin {
127
112
  */
128
113
  expandToDepth(depth: number): void;
129
114
 
115
+
116
+ /**
117
+ * Closes all the nodes in the tree.
118
+ */
119
+ collapse(): void;
120
+
130
121
  /**
131
122
  * Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
132
123
  * node in depth-first pre-order.
@@ -136,17 +127,22 @@ export declare class TreeViewPlugin extends Plugin {
136
127
  */
137
128
  withNodeTree(node: TreeViewNode, callback: (node: TreeViewNode) => void): void;
138
129
 
130
+ /**
131
+ * Destroys this TreeViewPlugin.
132
+ */
133
+ destroy(): void;
134
+
139
135
  /**
140
136
  * Fires on right click to show contextmenu.
141
137
  * @param {String} event The contextmenu event
142
138
  * @param {Function} callback Callback fired on the event
143
139
  */
144
- on(event: "contextmenu", callback: (data: {event: MouseEvent, viewer: Viewer, treeViewPlugin: TreeViewPlugin, treeViewNode: TreeViewNode })=> void): void;
140
+ on(event: "contextmenu", callback: (data: { event: MouseEvent, viewer: Viewer, treeViewPlugin: TreeViewPlugin, treeViewNode: TreeViewNode }) => void): void;
145
141
 
146
142
  /**
147
143
  * Fires when an title is clicked.
148
144
  * @param {String} event The nodeTitleClicked event
149
145
  * @param {Function} callback Callback fired on the event
150
146
  */
151
- on(event: "nodeTitleClicked", callback: (data: {event: MouseEvent, viewer: Viewer, treeViewPlugin: TreeViewPlugin, treeViewNode: TreeViewNode })=> void): void;
147
+ on(event: "nodeTitleClicked", callback: (data: { event: MouseEvent, viewer: Viewer, treeViewPlugin: TreeViewPlugin, treeViewNode: TreeViewNode }) => void): void;
152
148
  }
@@ -0,0 +1,128 @@
1
+ import { TreeViewNode } from "./TreeViewNode";
2
+ type genericHandler = (event: any) => void;
3
+
4
+ export declare interface ITreeViewRenderService {
5
+
6
+ /**
7
+ * Creates the root node element.
8
+ */
9
+ createRootNode(): HTMLElement;
10
+
11
+ /**
12
+ * Creates a tree node element.
13
+ *
14
+ * @param node {TreeViewNode} The node.
15
+ * @param expandHandler {genericHandler} The handler for expanding the node.
16
+ * @param checkHandler {genericHandler} The handler for checking the node.
17
+ * @param contextmenuHandler {genericHandler} The handler for the context menu.
18
+ * @param titleClickHandler {genericHandler} The handler for the title click.
19
+ *
20
+ * @returns {HTMLElement} The tree node element.
21
+ */
22
+ createNodeElement(node: TreeViewNode, expandHandler: genericHandler, checkHandler: genericHandler, contextmenuHandler: genericHandler, titleClickHandler: genericHandler): HTMLElement;
23
+
24
+ /**
25
+ * Creates a tree node element for a disabled node.
26
+ *
27
+ * @param rootName {String} The root name.
28
+ *
29
+ * @returns {HTMLElement} The disabled node element.
30
+ */
31
+ createDisabledNodeElement(rootName: string): HTMLElement;
32
+
33
+ /**
34
+ * Adds the child nodes to the parent node.
35
+ *
36
+ * @param element {HTMLElement} The node element.
37
+ * @param nodes {Array<HTMLElement>} The children elements.
38
+ */
39
+ addChildren(element: HTMLElement, nodes: Array<HTMLElement>): void;
40
+
41
+ /**
42
+ * Expands a node, changes the icon and changes the handlers.
43
+ *
44
+ * @param element {HTMLElement} The node element.
45
+ * @param expandHandler {genericHandler} The handler for expanding the node.
46
+ * @param collapseHandler {genericHandler} The handler for collapsing the node.
47
+ */
48
+ expand(element: HTMLElement, expandHandler: genericHandler, collapseHandler: genericHandler): void;
49
+
50
+ /**
51
+ * Collapses a node, changes the icon and changes the handlers.
52
+ *
53
+ * @param element {HTMLElement} The node element.
54
+ * @param expandHandler {genericHandler} The handler for expanding the node.
55
+ * @param collapseHandler {genericHandler} The handler for collapsing the node.
56
+ */
57
+ collapse(element: HTMLElement, expandHandler: genericHandler, collapseHandler: genericHandler): void;
58
+
59
+ /**
60
+ * Returns whether the node is expanded.
61
+ *
62
+ * @param element {HTMLElement} The node element.
63
+ *
64
+ * @returns {Boolean} Whether the node is expanded.
65
+ */
66
+ isExpanded(element: HTMLElement): boolean;
67
+
68
+ /**
69
+ * Returns the node id from the treeview element.
70
+ *
71
+ * @param element {HTMLElement} The node element.
72
+ *
73
+ * @returns {String} The node id.
74
+ */
75
+ getId(element: HTMLElement): string;
76
+
77
+ /**
78
+ * Returns the node id from the checkbox element.
79
+ *
80
+ * @param element {HTMLElement} The node element.
81
+ *
82
+ * @returns {String} The node id.
83
+ */
84
+ getIdFromCheckbox(element: HTMLElement): string;
85
+
86
+ /**
87
+ * Returns the expand/collapse element.
88
+ *
89
+ * @param nodeId {String} The node id.
90
+ *
91
+ * @returns {HTMLElement} The expand/collapse element.
92
+ */
93
+ getSwitchElement(nodeId: string): HTMLElement
94
+
95
+ /**
96
+ * Returns the node's checkbox state.
97
+ *
98
+ * @param element {HTMLElement} The node element.
99
+ *
100
+ * @returns {Boolean} Whether the node is checked.
101
+ */
102
+ isChecked(element: HTMLElement): boolean;
103
+
104
+ /**
105
+ * Sets the node's checkbox state.
106
+ *
107
+ * @param nodeId {String} The node id.
108
+ * @param checked {Boolean} Whether the node is checked.
109
+ */
110
+ setCheckbox(nodeId: string, checked: boolean): void;
111
+
112
+ /**
113
+ * Sets the node's xrayed state.
114
+ *
115
+ * @param nodeId {String} The node is.
116
+ * @param xrayed {Boolean} Whether the node is xrayed.
117
+ */
118
+ setXRayed(nodeId: string, xrayed: boolean): void;
119
+
120
+ /**
121
+ * Sets the node's highlight state.
122
+ * When the node is highlighted, it will be expanded and scrolled into view.
123
+ *
124
+ * @param nodeId {String} The node id.
125
+ * @param highlighted {Boolean} Whether the node is highlighted.
126
+ */
127
+ setHighlighted(nodeId: string, highlighted: boolean): void;
128
+ }
@@ -17,4 +17,30 @@ export declare abstract class Configs {
17
17
  * @returns {Boolean}
18
18
  */
19
19
  get doublePrecisionEnabled(): boolean;
20
+
21
+ /**
22
+ * Sets the maximum data texture height.
23
+ *
24
+ * Should be a multiple of 1024. Default is 4096, which is the maximum allowed value.
25
+ */
26
+ set maxDataTextureHeight(value: number);
27
+
28
+ /**
29
+ * Gets maximum data texture height.
30
+ */
31
+ get maxDataTextureHeight(): number;
32
+
33
+ /**
34
+ * Sets the maximum batched geometry VBO size.
35
+ *
36
+ * Default value is 5000000, which is the maximum size.
37
+ *
38
+ * Minimum size is 100000.
39
+ */
40
+ set maxGeometryBatchSize(value: number);
41
+
42
+ /**
43
+ * Gets the maximum batched geometry VBO size.
44
+ */
45
+ get maxGeometryBatchSize(): number;
20
46
  }
@@ -38,7 +38,7 @@ export declare type ViewerConfiguration = {
38
38
  /**When ````transparent```` is false, set this ````true```` to derive the canvas background color from {@link AmbientLight.color}, or ````false```` to set the canvas background to ````backgroundColor````. */
39
39
  backgroundColorFromAmbientLight?: boolean;
40
40
  /** The measurement unit type. */
41
- units?: "meters" | "centimeters" | "millimeters" | "yards" | "feet" | "inches" ;
41
+ units?: "meters" | "centimeters" | "millimeters" | "yards" | "feet" | "inches";
42
42
  /** The number of Real-space units in each World-space coordinate system unit. */
43
43
  scale?: number;
44
44
  /** The Real-space 3D origin, in current measurement units, at which the World-space coordinate origin ````[0,0,0]```` sits. */
@@ -55,10 +55,16 @@ export declare type ViewerConfiguration = {
55
55
  pickSurfacePrecisionEnabled?: boolean;
56
56
  /** Whether to enable logarithmic depth buffer. */
57
57
  logarithmicDepthBufferEnabled?: boolean;
58
+ /** Whether to enable base color texture rendering. */
59
+ colorTextureEnabled?: boolean;
58
60
  /** Whether to enable physically-based rendering. */
59
61
  pbrEnabled?: boolean;
60
62
  /** Optional locale-based translation service. */
61
63
  localeService?: LocaleService;
64
+ /** Whether to enable data texture-based (DTX) scene representation within the Viewer. */
65
+ dtxEnabled?: boolean;
66
+ /** Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity of SectionPlanes.*/
67
+ numCachedSectionPlanes?: number;
62
68
  };
63
69
 
64
70
  /**
@@ -196,7 +202,7 @@ export declare class Viewer {
196
202
  * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
197
203
  * @returns {String} String-encoded image data URI.
198
204
  */
199
- getSnapshot(params: { width?: number, height?: number, format?: "jpeg" | "png"| "bmp", includeGizmos?: boolean }): string;
205
+ getSnapshot(params: { width?: number, height?: number, format?: "jpeg" | "png" | "bmp", includeGizmos?: boolean }): string;
200
206
 
201
207
  /**
202
208
  * Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image which includes
@@ -224,8 +230,8 @@ export declare class Viewer {
224
230
  * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
225
231
  * @returns {Promise} Promise which returns a string-encoded image data URI.
226
232
  */
227
- getSnapshotWithPlugins(params: { width?: number, height?: number, format?: "jpeg" | "png"| "bmp", includeGizmos?: boolean }): Promise<String>;
228
-
233
+ getSnapshotWithPlugins(params: { width?: number, height?: number, format?: "jpeg" | "png" | "bmp", includeGizmos?: boolean }): Promise<String>;
234
+
229
235
  /**
230
236
  * Exits snapshot mode.
231
237
  *
@@ -1,24 +0,0 @@
1
- import { MetaModel } from "../../viewer/metadata";
2
-
3
- /**
4
- * Represents a model tree view within a {@link TreeViewPlugin}.
5
- */
6
- export declare class ModelTreeView {
7
- /**
8
- * Contains messages for any errors found in the MetaModel for this ModelTreeView.
9
- * @type {String[]}
10
- */
11
- errors: string[];
12
-
13
- /**
14
- * True if errors were found in the MetaModel for this ModelTreeView.
15
- * @type {boolean}
16
- */
17
- valid: boolean;
18
-
19
- /**
20
- * The MetaModel corresponding to this ModelTreeView.
21
- * @type {MetaModel}
22
- */
23
- metaModel: MetaModel;
24
- }