@xeokit/xeokit-sdk 2.6.65 → 2.6.67
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/{LICENSE.txt → LICENSE} +30 -27
- package/README.md +13 -6
- package/dist/xeokit-sdk.cjs.js +50322 -25848
- package/dist/xeokit-sdk.es.js +50322 -25848
- package/dist/xeokit-sdk.es5.js +7982 -4807
- package/dist/xeokit-sdk.min.cjs.js +5 -5
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +34 -32
- package/src/extras/PointerCircle/PointerCircle.js +1 -1
- package/src/plugins/AnnotationsPlugin/Annotation.js +45 -5
- package/src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js +1 -1
- package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +3 -2
- package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +1 -1
- package/src/plugins/SectionPlanesPlugin/Control.js +11 -12
- package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +57 -2
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js +6 -0
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV11.js +6 -0
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV12.js +822 -0
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +6 -0
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +6 -0
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +6 -0
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV9.js +6 -0
- package/src/{plugins/lib → viewer/scene/libs}/earcut.js +194 -189
- package/src/viewer/scene/materials/EmphasisMaterial.js +5 -1
- package/src/viewer/scene/math/math.js +6 -2
- package/src/viewer/scene/model/SceneModel.js +1 -0
- package/src/viewer/scene/model/SceneModelEntity.js +26 -0
- package/src/viewer/scene/model/SceneModelMesh.js +4 -0
- package/src/viewer/scene/model/dtx/triangles/DTXTrianglesLayer.js +1 -1
- package/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js +1 -1
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js +4 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js +4 -1
- package/src/viewer/scene/scene/Scene.js +50 -6
- package/src/viewer/scene/sectionCaps/SectionCaps.js +774 -0
- package/src/viewer/scene/sectionCaps/index.js +1 -0
- package/src/viewer/scene/sectionPlane/SectionPlane.js +79 -1
- package/src/viewer/scene/webgl/Renderer.js +19 -10
- package/types/extras/PointerCircle/PointerCircle.d.ts +50 -0
- package/types/extras/PointerCircle/index.d.ts +1 -0
- package/types/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.d.ts +2 -1
- package/types/plugins/XKTLoaderPlugin/XKTLoaderPlugin.d.ts +28 -0
- package/types/plugins/index.d.ts +1 -0
- package/types/plugins/lib/ui/index.d.ts +12 -0
- package/types/viewer/scene/models/SceneModelMesh.d.ts +7 -0
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xeokit/xeokit-sdk",
|
|
3
|
-
"version": "2.6.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.6.67",
|
|
4
|
+
"description": "3D BIM IFC Viewer SDK for AEC engineering applications. Open Source JavaScript Toolkit based on pure WebGL for top performance, real-world coordinates and full double precision",
|
|
5
5
|
"module": "./dist/xeokit-sdk.es.js",
|
|
6
6
|
"main": "./dist/xeokit-sdk.cjs.js",
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
8
|
-
|
|
9
8
|
"scripts": {
|
|
10
9
|
"build": "rollup --config rollup.config.js; rollup --config rollup.minified.config.js",
|
|
11
10
|
"dev-build": "rollup --config rollup.dev.config.js",
|
|
12
11
|
"docs": "rm -Rf ./docs/*; ./node_modules/.bin/esdoc",
|
|
13
12
|
"typedocs": "rm -Rf ./docs/*; typedoc --tsconfig tsconfig.json",
|
|
14
13
|
"publish": "npm publish --access public",
|
|
15
|
-
"changelog": "git fetch; auto-changelog --commit-limit false --package --template changelog-template.hbs"
|
|
14
|
+
"changelog": "git fetch; auto-changelog --commit-limit false --package --template changelog-template.hbs",
|
|
15
|
+
"test": "npx percy exec -- npx playwright test"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "
|
|
19
|
+
"url": "https://github.com/xeokit/xeokit-sdk.git"
|
|
20
20
|
},
|
|
21
21
|
"auto-changelog": {
|
|
22
22
|
"output": "CHANGELOG.md",
|
|
@@ -25,47 +25,50 @@
|
|
|
25
25
|
"commitLimit": false
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
28
|
+
"ifc-viewer",
|
|
29
|
+
"bim-viewer",
|
|
30
|
+
"3d-web-viewer",
|
|
31
|
+
"point-cloud-viewer",
|
|
32
|
+
"online-viewer",
|
|
33
|
+
"web-gl",
|
|
34
|
+
"viewer-sdk",
|
|
35
|
+
"3d-viewers",
|
|
36
36
|
"bim",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"ifc",
|
|
38
|
+
"geometry",
|
|
39
|
+
"point-cloud",
|
|
40
|
+
"las-viewer",
|
|
41
|
+
"laz-viewer",
|
|
42
|
+
"webgl-viewer",
|
|
43
|
+
"javascript-viewer",
|
|
39
44
|
"buildingsmart",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"gltf",
|
|
44
|
-
"3dxml",
|
|
45
|
-
"obj",
|
|
46
|
-
"stl",
|
|
47
|
-
"laz",
|
|
48
|
-
"las",
|
|
49
|
-
"pointcloud",
|
|
50
|
-
"3d-viewer"
|
|
45
|
+
"geospatial",
|
|
46
|
+
"gis",
|
|
47
|
+
"3d-tiles"
|
|
51
48
|
],
|
|
52
49
|
"author": "Lindsay Kay",
|
|
53
|
-
"license": "
|
|
50
|
+
"license": "AGPL-3.0",
|
|
54
51
|
"bugs": {
|
|
55
52
|
"url": "https://github.com/xeokit/xeokit-sdk/issues"
|
|
56
53
|
},
|
|
57
54
|
"homepage": "https://xeokit.io",
|
|
58
55
|
"dependencies": {
|
|
59
|
-
"@loaders.gl/core": "^3.
|
|
60
|
-
"@loaders.gl/gltf": "^3.
|
|
61
|
-
"@loaders.gl/las": "^3.
|
|
56
|
+
"@loaders.gl/core": "^4.3.3",
|
|
57
|
+
"@loaders.gl/gltf": "^4.3.3",
|
|
58
|
+
"@loaders.gl/las": "^4.3.3",
|
|
62
59
|
"html2canvas": "^1.4.1"
|
|
63
60
|
},
|
|
64
61
|
"devDependencies": {
|
|
65
62
|
"@babel/core": "^7.18.6",
|
|
66
63
|
"@babel/preset-env": "^7.18.6",
|
|
64
|
+
"@percy/cli": "^1.30.7",
|
|
65
|
+
"@percy/playwright": "^1.0.7",
|
|
66
|
+
"@playwright/test": "^1.49.1",
|
|
67
67
|
"@rollup/plugin-babel": "^5.3.1",
|
|
68
68
|
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
69
|
+
"@types/node": "^22.10.6",
|
|
70
|
+
"auto-changelog": "^2.4.0",
|
|
71
|
+
"dotenv": "^16.4.7",
|
|
69
72
|
"esdoc": "^1.1.0",
|
|
70
73
|
"esdoc-custom-theme": "^1.4.2",
|
|
71
74
|
"esdoc-publish-html-plugin": "^1.1.2",
|
|
@@ -74,8 +77,7 @@
|
|
|
74
77
|
"parse5": "^7.0.0",
|
|
75
78
|
"rollup": "^2.70.2",
|
|
76
79
|
"rollup-plugin-terser": "^7.0.2",
|
|
77
|
-
"typedoc": "^0.22.15"
|
|
78
|
-
"auto-changelog": "^2.4.0"
|
|
80
|
+
"typedoc": "^0.22.15"
|
|
79
81
|
},
|
|
80
82
|
"files": [
|
|
81
83
|
"/src",
|
|
@@ -40,6 +40,8 @@ class Annotation extends Marker {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
this._htmlDirty = false;
|
|
43
|
+
this._curMarkerWidth = undefined;
|
|
44
|
+
this._curLabelWidth = 0;
|
|
43
45
|
|
|
44
46
|
if (cfg.markerElement) {
|
|
45
47
|
this._marker = cfg.markerElement;
|
|
@@ -210,27 +212,65 @@ class Annotation extends Marker {
|
|
|
210
212
|
/**
|
|
211
213
|
* @private
|
|
212
214
|
*/
|
|
213
|
-
|
|
215
|
+
_updateWithCurWidths() {
|
|
214
216
|
const px = x => x + "px";
|
|
215
217
|
const boundary = this.scene.canvas.boundary;
|
|
216
218
|
const left = boundary[0] + this.canvasPos[0];
|
|
217
219
|
const top = boundary[1] + this.canvasPos[1];
|
|
218
|
-
const
|
|
219
|
-
const markerWidth = markerRect.width;
|
|
220
|
+
const markerWidth = this._curMarkerWidth;
|
|
220
221
|
const markerDir = (this._markerAlign === "right") ? -1 : ((this._markerAlign === "center") ? 0 : 1);
|
|
221
222
|
const markerCenter = left + markerDir * (markerWidth / 2 - 12);
|
|
222
223
|
this._marker.style.left = px(markerCenter - markerWidth / 2);
|
|
223
224
|
this._marker.style.top = px(top - 12);
|
|
224
225
|
this._marker.style["z-index"] = 90005 + Math.floor(this._viewPos[2]) + 1;
|
|
225
226
|
|
|
226
|
-
const
|
|
227
|
-
const labelWidth = labelRect.width;
|
|
227
|
+
const labelWidth = this._curLabelWidth;
|
|
228
228
|
const labelDir = Math.sign(this._labelPosition);
|
|
229
229
|
this._label.style.left = px(markerCenter + labelDir * (markerWidth / 2 + Math.abs(this._labelPosition) + labelWidth / 2) - labelWidth / 2);
|
|
230
230
|
this._label.style.top = px(top - 17);
|
|
231
231
|
this._label.style["z-index"] = 90005 + Math.floor(this._viewPos[2]) + 1;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
/**
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
237
|
+
_updateIfWidthsChanged() {
|
|
238
|
+
let needsUpdate = false;
|
|
239
|
+
const markerWidth = this._marker.getBoundingClientRect().width;
|
|
240
|
+
if (this._curMarkerWidth !== markerWidth) {
|
|
241
|
+
this._curMarkerWidth = markerWidth;
|
|
242
|
+
needsUpdate = true;
|
|
243
|
+
}
|
|
244
|
+
const labelDir = Math.sign(this._labelPosition);
|
|
245
|
+
// if (labelDir === 1) then don't perform relatively expensive label.getBoundingClientRect call
|
|
246
|
+
if (labelDir !== 1) {
|
|
247
|
+
const labelWidth = this._label.getBoundingClientRect().width;
|
|
248
|
+
if (this._curLabelWidth !== labelWidth) {
|
|
249
|
+
this._curLabelWidth = labelWidth;
|
|
250
|
+
needsUpdate = true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (needsUpdate) {
|
|
254
|
+
this._updateWithCurWidths();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @private
|
|
260
|
+
*/
|
|
261
|
+
_updatePosition() {
|
|
262
|
+
if (this._curMarkerWidth === undefined) {
|
|
263
|
+
this._updateIfWidthsChanged();
|
|
264
|
+
} else {
|
|
265
|
+
// Update position with cached width values
|
|
266
|
+
// and postpone expensive Annotation's getBoundingClientRect calls
|
|
267
|
+
// so they don't interfere with e.g. interactive scene manipulation
|
|
268
|
+
this._updateWithCurWidths();
|
|
269
|
+
window.clearTimeout(this._widthTimeout);
|
|
270
|
+
this._widthTimeout = window.setTimeout(() => this._updateIfWidthsChanged(), 500);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
234
274
|
/**
|
|
235
275
|
* @private
|
|
236
276
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {math, Plugin, SceneModel, utils} from "../../viewer/index.js";
|
|
2
2
|
import {CityJSONDefaultDataSource} from "./CityJSONDefaultDataSource.js";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import earcut from '../../viewer/scene/libs/earcut.js';
|
|
5
5
|
|
|
6
6
|
const tempVec2a = math.vec2();
|
|
7
7
|
const tempVec3a = math.vec3();
|
|
@@ -4,7 +4,7 @@ import {core} from "../../viewer/scene/core.js";
|
|
|
4
4
|
import {sRGBEncoding} from "../../viewer/scene/constants/constants.js";
|
|
5
5
|
import {worldToRTCPositions} from "../../viewer/scene/math/rtcCoords.js";
|
|
6
6
|
import {parse} from '@loaders.gl/core';
|
|
7
|
-
import {GLTFLoader} from '@loaders.gl/gltf
|
|
7
|
+
import {GLTFLoader, postProcessGLTF} from '@loaders.gl/gltf';
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
ClampToEdgeWrapping,
|
|
@@ -104,6 +104,7 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
|
|
|
104
104
|
parse(gltf, GLTFLoader, {
|
|
105
105
|
baseUri: options.basePath
|
|
106
106
|
}).then((gltfData) => {
|
|
107
|
+
const processedGLTF = postProcessGLTF(gltfData);
|
|
107
108
|
const ctx = {
|
|
108
109
|
src: src,
|
|
109
110
|
entityId: options.entityId,
|
|
@@ -115,7 +116,7 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
|
|
|
115
116
|
basePath: options.basePath,
|
|
116
117
|
handlenode: options.handlenode,
|
|
117
118
|
backfaces: !!options.backfaces,
|
|
118
|
-
gltfData:
|
|
119
|
+
gltfData: processedGLTF,
|
|
119
120
|
scene: sceneModel.scene,
|
|
120
121
|
plugin: plugin,
|
|
121
122
|
sceneModel: sceneModel,
|
|
@@ -4,7 +4,7 @@ import {Plugin} from "../../viewer/Plugin.js";
|
|
|
4
4
|
import {LASDefaultDataSource} from "./LASDefaultDataSource.js";
|
|
5
5
|
import {math} from "../../viewer/index.js";
|
|
6
6
|
import {parse} from '@loaders.gl/core';
|
|
7
|
-
import {LASLoader} from '@loaders.gl/las
|
|
7
|
+
import {LASLoader} from '@loaders.gl/las';
|
|
8
8
|
import {loadLASHeader} from "./loadLASHeader";
|
|
9
9
|
|
|
10
10
|
const MAX_VERTICES = 500000; // TODO: Rough estimate
|
|
@@ -132,15 +132,13 @@ class Control {
|
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
const handlers = { };
|
|
135
|
-
const addAxis = (rgb,
|
|
135
|
+
const addAxis = (rgb, hoopRot) => {
|
|
136
|
+
const axisDirection = math.mulVec3Scalar(rgb, -1, math.vec3());
|
|
136
137
|
const material = colorMaterial(rgb);
|
|
137
138
|
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
const hoopMatrix = math.mulMat4(hoopRotation, rotateToHorizontal, math.identityMat4());
|
|
141
|
-
|
|
139
|
+
const hoopMatrix = math.quaternionToRotationMat4(hoopRot, math.identityMat4());
|
|
140
|
+
math.mulMat4(math.rotationMat4v(Math.PI, [0,1,0], math.mat4()), hoopMatrix, hoopMatrix);
|
|
142
141
|
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
|
|
143
|
-
|
|
144
142
|
const scaledArrowMatrix = (t, matR) => {
|
|
145
143
|
const matT = math.translateMat4v(t, math.identityMat4());
|
|
146
144
|
const ret = math.identityMat4();
|
|
@@ -209,7 +207,8 @@ class Control {
|
|
|
209
207
|
}), NO_STATE_INHERIT);
|
|
210
208
|
|
|
211
209
|
|
|
212
|
-
const axisRotation = math.quaternionToRotationMat4(math.vec3PairToQuaternion([ 0, 1, 0 ],
|
|
210
|
+
const axisRotation = math.quaternionToRotationMat4(math.vec3PairToQuaternion([ 0, 1, 0 ], rgb), math.identityMat4());
|
|
211
|
+
math.mulMat4(math.rotationMat4v(Math.PI, [0,1,0], math.mat4()), axisRotation, axisRotation);
|
|
213
212
|
|
|
214
213
|
const translatedAxisMatrix = (yOffset) => math.mulMat4(axisRotation, math.translateMat4c(0, yOffset, 0, math.identityMat4()), math.identityMat4());
|
|
215
214
|
const arrowMatrix = translatedAxisMatrix(arrowLength + .1);
|
|
@@ -338,7 +337,7 @@ class Control {
|
|
|
338
337
|
rootNode.rotate(rgb, (rotation - lastRotation) * 180 / Math.PI);
|
|
339
338
|
if (this._sectionPlane) {
|
|
340
339
|
ignoreNextSectionPlaneDirUpdate = true;
|
|
341
|
-
this._sectionPlane.
|
|
340
|
+
this._sectionPlane.quaternion = rootNode.quaternion;
|
|
342
341
|
}
|
|
343
342
|
lastRotation = rotation;
|
|
344
343
|
};
|
|
@@ -452,9 +451,9 @@ class Control {
|
|
|
452
451
|
//
|
|
453
452
|
//----------------------------------------------------------------------------------------------------------
|
|
454
453
|
|
|
455
|
-
addAxis([1,0,0], [
|
|
456
|
-
addAxis([0,1,0], [
|
|
457
|
-
addAxis([0,0,1],
|
|
454
|
+
addAxis([1,0,0], math.vec3PairToQuaternion([1,0,0], [0,0,1])),
|
|
455
|
+
addAxis([0,1,0], math.eulerToQuaternion([90,0,0], "XYZ")),
|
|
456
|
+
addAxis([0,0,1], math.identityQuaternion())
|
|
458
457
|
];
|
|
459
458
|
|
|
460
459
|
const cleanups = [ ];
|
|
@@ -592,7 +591,7 @@ class Control {
|
|
|
592
591
|
this.id = sectionPlane.id;
|
|
593
592
|
this._sectionPlane = sectionPlane;
|
|
594
593
|
const setPosFromSectionPlane = () => setPos(sectionPlane.pos);
|
|
595
|
-
const setDirFromSectionPlane = () => rootNode.quaternion =
|
|
594
|
+
const setDirFromSectionPlane = () => rootNode.quaternion = sectionPlane.quaternion;
|
|
596
595
|
setPosFromSectionPlane();
|
|
597
596
|
setDirFromSectionPlane();
|
|
598
597
|
const onSectionPlanePos = sectionPlane.on("pos", setPosFromSectionPlane);
|
|
@@ -16,6 +16,7 @@ import {ParserV8} from "./parsers/ParserV8.js";
|
|
|
16
16
|
import {ParserV9} from "./parsers/ParserV9.js";
|
|
17
17
|
import {ParserV10} from "./parsers/ParserV10.js";
|
|
18
18
|
import {ParserV11} from "./parsers/ParserV11.js";
|
|
19
|
+
import {ParserV12} from './parsers/ParserV12.js';
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
const parsers = {};
|
|
@@ -31,6 +32,7 @@ parsers[ParserV8.version] = ParserV8;
|
|
|
31
32
|
parsers[ParserV9.version] = ParserV9;
|
|
32
33
|
parsers[ParserV10.version] = ParserV10;
|
|
33
34
|
parsers[ParserV11.version] = ParserV11;
|
|
35
|
+
parsers[ParserV12.version] = ParserV12;
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
* {@link Viewer} plugin that loads models from xeokit's optimized *````.XKT````* format.
|
|
@@ -253,6 +255,20 @@ parsers[ParserV11.version] = ParserV11;
|
|
|
253
255
|
* });
|
|
254
256
|
* ````
|
|
255
257
|
*
|
|
258
|
+
* # Including specific elements by id
|
|
259
|
+
*
|
|
260
|
+
* We can also load only those objects that have the specified ids.
|
|
261
|
+
*
|
|
262
|
+
* In the example below, we'll load only the objects that represent a specified wall with 4 windows.
|
|
263
|
+
*
|
|
264
|
+
* ````javascript
|
|
265
|
+
* const model4 = xktLoader.load({
|
|
266
|
+
* id: "myModel4",
|
|
267
|
+
* src: "../../assets/models/xkt/v10/glTF-Embedded/Duplex_A_20110505.glTFEmbedded.xkt",
|
|
268
|
+
* includeIds: ["2O2Fr$t4X7Zf8NOew3FLOH", "1hOSvn6df7F8_7GcBWlS_W", "1hOSvn6df7F8_7GcBWlS4Q", "1hOSvn6df7F8_7GcBWlS1M", "1hOSvn6df7F8_7GcBWlS2V"],
|
|
269
|
+
* });
|
|
270
|
+
* ````
|
|
271
|
+
*
|
|
256
272
|
* # Configuring initial IFC object appearances
|
|
257
273
|
*
|
|
258
274
|
* We can specify the custom initial appearance of loaded objects according to their IFC types.
|
|
@@ -747,6 +763,34 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
747
763
|
this._excludeTypes = value;
|
|
748
764
|
}
|
|
749
765
|
|
|
766
|
+
/**
|
|
767
|
+
* Gets the whitelist of the specified elements loaded by this XKTLoaderPlugin.
|
|
768
|
+
*
|
|
769
|
+
* When loading models with metadata, causes this XKTLoaderPlugin to only load objects whose ids are in this
|
|
770
|
+
* list. An object's id is indicated by its {@link MetaObject}'s {@link MetaObject#id}.
|
|
771
|
+
*
|
|
772
|
+
* Default value is ````undefined````.
|
|
773
|
+
*
|
|
774
|
+
* @type {String[]}
|
|
775
|
+
*/
|
|
776
|
+
get includeIds() {
|
|
777
|
+
return this._includeIds;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Sets the whitelist of the specified elements by this XKTLoaderPlugin.
|
|
782
|
+
*
|
|
783
|
+
* When loading models with metadata, causes this XKTLoaderPlugin to only load objects whose ids are in this
|
|
784
|
+
* list. An object's id is indicated by its {@link MetaObject}'s {@link MetaObject#id}.
|
|
785
|
+
*
|
|
786
|
+
* Default value is ````undefined````.
|
|
787
|
+
*
|
|
788
|
+
* @type {String[]}
|
|
789
|
+
*/
|
|
790
|
+
set includeIds(value) {
|
|
791
|
+
this._includeIds = value;
|
|
792
|
+
}
|
|
793
|
+
|
|
750
794
|
/**
|
|
751
795
|
* Gets whether we load objects that don't have IFC types.
|
|
752
796
|
*
|
|
@@ -859,6 +903,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
859
903
|
* @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
860
904
|
* @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
861
905
|
* @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
906
|
+
* @param {String[]} [params.includeIds] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#id} values in this list.
|
|
862
907
|
* @param {Boolean} [params.edges=false] Whether or not xeokit renders the model with edges emphasized.
|
|
863
908
|
* @param {Number[]} [params.origin=[0,0,0]] The model's World-space double-precision 3D origin. Use this to position the model within xeokit's World coordinate system, using double-precision coordinates.
|
|
864
909
|
* @param {Number[]} [params.position=[0,0,0]] The model single-precision 3D position, relative to the ````origin```` parameter.
|
|
@@ -900,6 +945,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
900
945
|
const options = {};
|
|
901
946
|
const includeTypes = params.includeTypes || this._includeTypes;
|
|
902
947
|
const excludeTypes = params.excludeTypes || this._excludeTypes;
|
|
948
|
+
const includeIds = params.includeIds || this._includeIds;
|
|
903
949
|
const objectDefaults = params.objectDefaults || this._objectDefaults;
|
|
904
950
|
|
|
905
951
|
options.reuseGeometries = (params.reuseGeometries !== null && params.reuseGeometries !== undefined) ? params.reuseGeometries : (this._reuseGeometries !== false);
|
|
@@ -918,6 +964,13 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
918
964
|
}
|
|
919
965
|
}
|
|
920
966
|
|
|
967
|
+
if (includeIds) {
|
|
968
|
+
options.includeIdsMap = {};
|
|
969
|
+
for (let i = 0, len = includeIds.length; i < len; i++) {
|
|
970
|
+
options.includeIdsMap[includeIds[i]] = true;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
921
974
|
if (objectDefaults) {
|
|
922
975
|
options.objectDefaults = objectDefaults;
|
|
923
976
|
}
|
|
@@ -1139,7 +1192,9 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
1139
1192
|
}
|
|
1140
1193
|
const dataView = new DataView(arrayBuffer);
|
|
1141
1194
|
const dataArray = new Uint8Array(arrayBuffer);
|
|
1142
|
-
const
|
|
1195
|
+
const firstUint = dataView.getUint32(0, true);
|
|
1196
|
+
const xktVersion = firstUint & 0x7fffffff;
|
|
1197
|
+
const zipped = (xktVersion < 11) || ((xktVersion >= 12) && (firstUint >>> 31));
|
|
1143
1198
|
const parser = parsers[xktVersion];
|
|
1144
1199
|
if (!parser) {
|
|
1145
1200
|
this.error("Unsupported .XKT file version: " + xktVersion + " - this XKTLoaderPlugin supports versions " + Object.keys(parsers));
|
|
@@ -1147,7 +1202,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
1147
1202
|
}
|
|
1148
1203
|
// this.log("Loading .xkt V" + xktVersion);
|
|
1149
1204
|
|
|
1150
|
-
if (
|
|
1205
|
+
if (!zipped) {
|
|
1151
1206
|
parser.parseArrayBuffer(this.viewer, options, arrayBuffer, sceneModel, metaModel, manifestCtx);
|
|
1152
1207
|
return;
|
|
1153
1208
|
}
|
|
@@ -320,6 +320,12 @@ function load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx)
|
|
|
320
320
|
continue;
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
+
// Mask loading of object ids
|
|
324
|
+
|
|
325
|
+
if (options.includeIdsMap && metaObject.id && (!options.includeIdsMap[metaObject.id])) {
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
|
|
323
329
|
// Get initial property values for object types
|
|
324
330
|
|
|
325
331
|
const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults["DEFAULT"] : null;
|
|
@@ -313,6 +313,12 @@ function load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx)
|
|
|
313
313
|
continue;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
// Mask loading of object ids
|
|
317
|
+
|
|
318
|
+
if (options.includeIdsMap && metaObject.id && (!options.includeIdsMap[metaObject.id])) {
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
|
|
316
322
|
// Get initial property values for object types
|
|
317
323
|
|
|
318
324
|
const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults["DEFAULT"] : null;
|