@xeokit/xeokit-sdk 2.5.2-beta-4 → 2.5.2-beta-7
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/dist/xeokit-sdk.cjs.js +300 -182
- package/dist/xeokit-sdk.es.js +387 -269
- package/dist/xeokit-sdk.es5.js +55 -36
- package/dist/xeokit-sdk.min.cjs.js +3 -3
- package/dist/xeokit-sdk.min.es.js +3 -3
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +1 -1
- package/src/plugins/NavCubePlugin/CubeTextureCanvas.js +2 -1
- package/src/plugins/NavCubePlugin/NavCubePlugin.js +2 -1
- package/src/plugins/TreeViewPlugin/RenderService.js +169 -0
- package/src/plugins/TreeViewPlugin/TreeViewNode.js +11 -7
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +94 -151
- package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +2 -2
- package/src/viewer/scene/model/SceneModel.js +30 -26
- package/types/plugins/NavCubePlugin/NavCubePlugin.d.ts +2 -0
- package/types/plugins/TreeViewPlugin/TreeViewNode.d.ts +12 -14
- package/types/plugins/TreeViewPlugin/TreeViewPlugin.d.ts +18 -22
- package/types/plugins/TreeViewPlugin/renderService.d.ts +128 -0
- package/types/viewer/Configs.d.ts +26 -0
- package/types/viewer/Viewer.d.ts +10 -4
- package/types/viewer/scene/models/SceneModel.d.ts +17 -7
- package/types/plugins/TreeViewPlugin/ModelTreeView.d.ts +0 -24
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -80319,8 +80319,6 @@ class SceneModel extends Component {
|
|
|
80319
80319
|
this._vboBatchingLayers = {};
|
|
80320
80320
|
this._dtxLayers = {};
|
|
80321
80321
|
|
|
80322
|
-
this._meshList = [];
|
|
80323
|
-
|
|
80324
80322
|
this.layerList = []; // For GL state efficiency when drawing, InstancingLayers are in first part, BatchingLayers are in second
|
|
80325
80323
|
this._entityList = [];
|
|
80326
80324
|
|
|
@@ -80333,6 +80331,7 @@ class SceneModel extends Component {
|
|
|
80333
80331
|
this._entities = {};
|
|
80334
80332
|
|
|
80335
80333
|
this._scheduledMeshes = {};
|
|
80334
|
+
this._meshesCfgsBeforeMeshCreation = {};
|
|
80336
80335
|
|
|
80337
80336
|
/** @private **/
|
|
80338
80337
|
this.renderFlags = new RenderFlags();
|
|
@@ -81863,7 +81862,7 @@ class SceneModel extends Component {
|
|
|
81863
81862
|
/**
|
|
81864
81863
|
* Creates a new {@link SceneModelMesh} within this SceneModel.
|
|
81865
81864
|
*
|
|
81866
|
-
* *
|
|
81865
|
+
* * It prepares and saves data for a SceneModelMesh {@link SceneModel#meshes} creation. SceneModelMesh will be created only once the SceneModelEntity (which references this particular SceneModelMesh) will be created.
|
|
81867
81866
|
* * The SceneModelMesh can either define its own geometry or share it with other SceneModelMeshes. To define own geometry, provide the
|
|
81868
81867
|
* various geometry arrays to this method. To share a geometry, provide the ID of a geometry created earlier
|
|
81869
81868
|
* with {@link SceneModel#createGeometry}.
|
|
@@ -81898,18 +81897,18 @@ class SceneModel extends Component {
|
|
|
81898
81897
|
* @param {Number} [cfg.opacity=1] Opacity in range ````[0..1]````. Overridden by texture set ````colorTexture````.
|
|
81899
81898
|
* @param {Number} [cfg.metallic=0] Metallic factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.
|
|
81900
81899
|
* @param {Number} [cfg.roughness=1] Roughness factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.
|
|
81901
|
-
* @returns {
|
|
81900
|
+
* @returns {Boolean} True if mesh was successfully created, else false if an error occurred.
|
|
81902
81901
|
*/
|
|
81903
81902
|
createMesh(cfg) {
|
|
81904
81903
|
|
|
81905
81904
|
if (cfg.id === undefined || cfg.id === null) {
|
|
81906
81905
|
this.error("[createMesh] SceneModel.createMesh() config missing: id");
|
|
81907
|
-
return;
|
|
81906
|
+
return false;
|
|
81908
81907
|
}
|
|
81909
81908
|
|
|
81910
81909
|
if (this._scheduledMeshes[cfg.id]) {
|
|
81911
81910
|
this.error(`[createMesh] SceneModel already has a mesh with this ID: ${cfg.id}`);
|
|
81912
|
-
return;
|
|
81911
|
+
return false;
|
|
81913
81912
|
}
|
|
81914
81913
|
|
|
81915
81914
|
const instancing = (cfg.geometryId !== undefined);
|
|
@@ -81924,31 +81923,31 @@ class SceneModel extends Component {
|
|
|
81924
81923
|
}
|
|
81925
81924
|
if (cfg.primitive !== "points" && cfg.primitive !== "lines" && cfg.primitive !== "triangles" && cfg.primitive !== "solid" && cfg.primitive !== "surface") {
|
|
81926
81925
|
this.error(`Unsupported value for 'primitive': '${primitive}' ('geometryId' is absent) - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'.`);
|
|
81927
|
-
return;
|
|
81926
|
+
return false;
|
|
81928
81927
|
}
|
|
81929
81928
|
if (!cfg.positions && !cfg.positionsCompressed && !cfg.buckets) {
|
|
81930
81929
|
this.error("Param expected: 'positions', 'positionsCompressed' or `buckets` ('geometryId' is absent)");
|
|
81931
|
-
return
|
|
81930
|
+
return false;
|
|
81932
81931
|
}
|
|
81933
81932
|
if (cfg.positions && (cfg.positionsDecodeMatrix || cfg.positionsDecodeBoundary)) {
|
|
81934
81933
|
this.error("Illegal params: 'positions' not expected with 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)");
|
|
81935
|
-
return
|
|
81934
|
+
return false;
|
|
81936
81935
|
}
|
|
81937
81936
|
if (cfg.positionsCompressed && !cfg.positionsDecodeMatrix && !cfg.positionsDecodeBoundary) {
|
|
81938
81937
|
this.error("Param expected: 'positionsCompressed' should be accompanied by 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)");
|
|
81939
|
-
return
|
|
81938
|
+
return false;
|
|
81940
81939
|
}
|
|
81941
81940
|
if (cfg.uvCompressed && !cfg.uvDecodeMatrix) {
|
|
81942
81941
|
this.error("Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)");
|
|
81943
|
-
return
|
|
81942
|
+
return false;
|
|
81944
81943
|
}
|
|
81945
81944
|
if (!cfg.buckets && !cfg.indices && cfg.primitive !== "points") {
|
|
81946
81945
|
this.error(`Param expected: indices (required for '${cfg.primitive}' primitive type)`);
|
|
81947
|
-
return
|
|
81946
|
+
return false;
|
|
81948
81947
|
}
|
|
81949
81948
|
if ((cfg.matrix || cfg.position || cfg.rotation || cfg.scale) && (cfg.positionsCompressed || cfg.positionsDecodeBoundary)) {
|
|
81950
81949
|
this.error("Unexpected params: 'matrix', 'rotation', 'scale', 'position' not allowed with 'positionsCompressed'");
|
|
81951
|
-
return
|
|
81950
|
+
return false;
|
|
81952
81951
|
}
|
|
81953
81952
|
|
|
81954
81953
|
const useDTX = (!!this._dtxEnabled && (cfg.primitive === "triangles"
|
|
@@ -82113,7 +82112,7 @@ class SceneModel extends Component {
|
|
|
82113
82112
|
cfg.textureSet = this._textureSets[cfg.textureSetId];
|
|
82114
82113
|
if (!cfg.textureSet) {
|
|
82115
82114
|
this.error(`[createMesh] Texture set not found: ${cfg.textureSetId} - ensure that you create it first with createTextureSet()`);
|
|
82116
|
-
return;
|
|
82115
|
+
return false;
|
|
82117
82116
|
}
|
|
82118
82117
|
}
|
|
82119
82118
|
}
|
|
@@ -82124,13 +82123,13 @@ class SceneModel extends Component {
|
|
|
82124
82123
|
|
|
82125
82124
|
if (cfg.positions || cfg.positionsCompressed || cfg.indices || cfg.edgeIndices || cfg.normals || cfg.normalsCompressed || cfg.uv || cfg.uvCompressed || cfg.positionsDecodeMatrix) {
|
|
82126
82125
|
this.error(`Mesh geometry parameters not expected when instancing a geometry (not expected: positions, positionsCompressed, indices, edgeIndices, normals, normalsCompressed, uv, uvCompressed, positionsDecodeMatrix)`);
|
|
82127
|
-
return;
|
|
82126
|
+
return false;
|
|
82128
82127
|
}
|
|
82129
82128
|
|
|
82130
82129
|
cfg.geometry = this._geometries[cfg.geometryId];
|
|
82131
82130
|
if (!cfg.geometry) {
|
|
82132
82131
|
this.error(`[createMesh] Geometry not found: ${cfg.geometryId} - ensure that you create it first with createGeometry()`);
|
|
82133
|
-
return;
|
|
82132
|
+
return false;
|
|
82134
82133
|
}
|
|
82135
82134
|
|
|
82136
82135
|
cfg.origin = cfg.origin ? math.addVec3(this._origin, cfg.origin, math.vec3()) : this._origin;
|
|
@@ -82144,7 +82143,7 @@ class SceneModel extends Component {
|
|
|
82144
82143
|
|
|
82145
82144
|
if (!cfg.transform) {
|
|
82146
82145
|
this.error(`[createMesh] Transform not found: ${cfg.transformId} - ensure that you create it first with createTransform()`);
|
|
82147
|
-
return;
|
|
82146
|
+
return false;
|
|
82148
82147
|
}
|
|
82149
82148
|
|
|
82150
82149
|
cfg.aabb = cfg.geometry.aabb;
|
|
@@ -82212,7 +82211,7 @@ class SceneModel extends Component {
|
|
|
82212
82211
|
cfg.textureSet = this._textureSets[cfg.textureSetId];
|
|
82213
82212
|
// if (!cfg.textureSet) {
|
|
82214
82213
|
// this.error(`[createMesh] Texture set not found: ${cfg.textureSetId} - ensure that you create it first with createTextureSet()`);
|
|
82215
|
-
// return;
|
|
82214
|
+
// return false;
|
|
82216
82215
|
// }
|
|
82217
82216
|
}
|
|
82218
82217
|
}
|
|
@@ -82220,7 +82219,9 @@ class SceneModel extends Component {
|
|
|
82220
82219
|
|
|
82221
82220
|
cfg.numPrimitives = this._getNumPrimitives(cfg);
|
|
82222
82221
|
|
|
82223
|
-
|
|
82222
|
+
this._meshesCfgsBeforeMeshCreation[cfg.id] = cfg;
|
|
82223
|
+
|
|
82224
|
+
return true;
|
|
82224
82225
|
}
|
|
82225
82226
|
|
|
82226
82227
|
_createMesh(cfg) {
|
|
@@ -82252,8 +82253,6 @@ class SceneModel extends Component {
|
|
|
82252
82253
|
cfg.meshMatrix = cfg.transform.worldMatrix;
|
|
82253
82254
|
}
|
|
82254
82255
|
mesh.portionId = mesh.layer.createPortion(mesh, cfg);
|
|
82255
|
-
this._meshes[cfg.id] = mesh;
|
|
82256
|
-
this._meshList.push(mesh);
|
|
82257
82256
|
return mesh;
|
|
82258
82257
|
}
|
|
82259
82258
|
|
|
@@ -82612,10 +82611,15 @@ class SceneModel extends Component {
|
|
|
82612
82611
|
let meshes = [];
|
|
82613
82612
|
for (let i = 0, len = cfg.meshIds.length; i < len; i++) {
|
|
82614
82613
|
const meshId = cfg.meshIds[i];
|
|
82615
|
-
|
|
82614
|
+
let mesh = this._meshes[meshId];
|
|
82616
82615
|
if (!mesh) {
|
|
82617
|
-
|
|
82618
|
-
|
|
82616
|
+
let meshCfg = this._meshesCfgsBeforeMeshCreation[meshId];
|
|
82617
|
+
if (!meshCfg) {
|
|
82618
|
+
this.error(`Mesh with this ID not found: "${meshId}" - ignoring this mesh`);
|
|
82619
|
+
continue;
|
|
82620
|
+
}
|
|
82621
|
+
mesh = this._createMesh(meshCfg);
|
|
82622
|
+
this._meshes[cfg.id] = mesh;
|
|
82619
82623
|
}
|
|
82620
82624
|
if (mesh.parent) {
|
|
82621
82625
|
this.error(`Mesh with ID "${meshId}" already belongs to object with ID "${mesh.parent.id}" - ignoring this mesh`);
|
|
@@ -97220,94 +97224,94 @@ function arrayToMap(array) {
|
|
|
97220
97224
|
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
|
97221
97225
|
* Released under MIT License
|
|
97222
97226
|
*/
|
|
97223
|
-
/*! *****************************************************************************
|
|
97224
|
-
Copyright (c) Microsoft Corporation.
|
|
97225
|
-
|
|
97226
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
97227
|
-
purpose with or without fee is hereby granted.
|
|
97228
|
-
|
|
97229
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
97230
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
97231
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
97232
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
97233
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
97234
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
97235
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
97236
|
-
***************************************************************************** */
|
|
97237
|
-
/* global Reflect, Promise */
|
|
97238
|
-
|
|
97239
|
-
var extendStatics = function(d, b) {
|
|
97240
|
-
extendStatics = Object.setPrototypeOf ||
|
|
97241
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
97242
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
97243
|
-
return extendStatics(d, b);
|
|
97244
|
-
};
|
|
97245
|
-
|
|
97246
|
-
function __extends(d, b) {
|
|
97247
|
-
if (typeof b !== "function" && b !== null)
|
|
97248
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
97249
|
-
extendStatics(d, b);
|
|
97250
|
-
function __() { this.constructor = d; }
|
|
97251
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
97252
|
-
}
|
|
97253
|
-
|
|
97254
|
-
var __assign = function() {
|
|
97255
|
-
__assign = Object.assign || function __assign(t) {
|
|
97256
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
97257
|
-
s = arguments[i];
|
|
97258
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
97259
|
-
}
|
|
97260
|
-
return t;
|
|
97261
|
-
};
|
|
97262
|
-
return __assign.apply(this, arguments);
|
|
97263
|
-
};
|
|
97264
|
-
|
|
97265
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
97266
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
97267
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
97268
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
97269
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
97270
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
97271
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
97272
|
-
});
|
|
97273
|
-
}
|
|
97274
|
-
|
|
97275
|
-
function __generator(thisArg, body) {
|
|
97276
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
97277
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
97278
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
97279
|
-
function step(op) {
|
|
97280
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
97281
|
-
while (_) try {
|
|
97282
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
97283
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
97284
|
-
switch (op[0]) {
|
|
97285
|
-
case 0: case 1: t = op; break;
|
|
97286
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
97287
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
97288
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
97289
|
-
default:
|
|
97290
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
97291
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
97292
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
97293
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
97294
|
-
if (t[2]) _.ops.pop();
|
|
97295
|
-
_.trys.pop(); continue;
|
|
97296
|
-
}
|
|
97297
|
-
op = body.call(thisArg, _);
|
|
97298
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
97299
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
97300
|
-
}
|
|
97301
|
-
}
|
|
97302
|
-
|
|
97303
|
-
function __spreadArray(to, from, pack) {
|
|
97304
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
97305
|
-
if (ar || !(i in from)) {
|
|
97306
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
97307
|
-
ar[i] = from[i];
|
|
97308
|
-
}
|
|
97309
|
-
}
|
|
97310
|
-
return to.concat(ar || from);
|
|
97227
|
+
/*! *****************************************************************************
|
|
97228
|
+
Copyright (c) Microsoft Corporation.
|
|
97229
|
+
|
|
97230
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
97231
|
+
purpose with or without fee is hereby granted.
|
|
97232
|
+
|
|
97233
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
97234
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
97235
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
97236
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
97237
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
97238
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
97239
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
97240
|
+
***************************************************************************** */
|
|
97241
|
+
/* global Reflect, Promise */
|
|
97242
|
+
|
|
97243
|
+
var extendStatics = function(d, b) {
|
|
97244
|
+
extendStatics = Object.setPrototypeOf ||
|
|
97245
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
97246
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
97247
|
+
return extendStatics(d, b);
|
|
97248
|
+
};
|
|
97249
|
+
|
|
97250
|
+
function __extends(d, b) {
|
|
97251
|
+
if (typeof b !== "function" && b !== null)
|
|
97252
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
97253
|
+
extendStatics(d, b);
|
|
97254
|
+
function __() { this.constructor = d; }
|
|
97255
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
97256
|
+
}
|
|
97257
|
+
|
|
97258
|
+
var __assign = function() {
|
|
97259
|
+
__assign = Object.assign || function __assign(t) {
|
|
97260
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
97261
|
+
s = arguments[i];
|
|
97262
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
97263
|
+
}
|
|
97264
|
+
return t;
|
|
97265
|
+
};
|
|
97266
|
+
return __assign.apply(this, arguments);
|
|
97267
|
+
};
|
|
97268
|
+
|
|
97269
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
97270
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
97271
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
97272
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
97273
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
97274
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
97275
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
97276
|
+
});
|
|
97277
|
+
}
|
|
97278
|
+
|
|
97279
|
+
function __generator(thisArg, body) {
|
|
97280
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
97281
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
97282
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
97283
|
+
function step(op) {
|
|
97284
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
97285
|
+
while (_) try {
|
|
97286
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
97287
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
97288
|
+
switch (op[0]) {
|
|
97289
|
+
case 0: case 1: t = op; break;
|
|
97290
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
97291
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
97292
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
97293
|
+
default:
|
|
97294
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
97295
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
97296
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
97297
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
97298
|
+
if (t[2]) _.ops.pop();
|
|
97299
|
+
_.trys.pop(); continue;
|
|
97300
|
+
}
|
|
97301
|
+
op = body.call(thisArg, _);
|
|
97302
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
97303
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
97304
|
+
}
|
|
97305
|
+
}
|
|
97306
|
+
|
|
97307
|
+
function __spreadArray(to, from, pack) {
|
|
97308
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
97309
|
+
if (ar || !(i in from)) {
|
|
97310
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
97311
|
+
ar[i] = from[i];
|
|
97312
|
+
}
|
|
97313
|
+
}
|
|
97314
|
+
return to.concat(ar || from);
|
|
97311
97315
|
}
|
|
97312
97316
|
|
|
97313
97317
|
var Bounds = /** @class */ (function () {
|
|
@@ -114014,6 +114018,7 @@ function CubeTextureCanvas(viewer, navCubeScene, cfg = {}) {
|
|
|
114014
114018
|
|
|
114015
114019
|
const cubeColor = "lightgrey";
|
|
114016
114020
|
const cubeHighlightColor = cfg.hoverColor || "rgba(0,0,0,0.4)";
|
|
114021
|
+
const textColor = cfg.textColor || "black";
|
|
114017
114022
|
|
|
114018
114023
|
const height = 500;
|
|
114019
114024
|
const width = height + (height / 3);
|
|
@@ -114163,7 +114168,7 @@ function CubeTextureCanvas(viewer, navCubeScene, cfg = {}) {
|
|
|
114163
114168
|
}
|
|
114164
114169
|
}
|
|
114165
114170
|
if (area.label) {
|
|
114166
|
-
context.fillStyle =
|
|
114171
|
+
context.fillStyle = textColor;
|
|
114167
114172
|
context.font = '60px sans-serif';
|
|
114168
114173
|
context.textAlign = "center";
|
|
114169
114174
|
var xcenter = xmin + (width * 0.5);
|
|
@@ -114367,7 +114372,7 @@ class NavCubePlugin extends Plugin {
|
|
|
114367
114372
|
* @param {String} [cfg.cameraFly=true] Whether the {@link Camera} flies or jumps to each selected axis or diagonal.
|
|
114368
114373
|
* @param {String} [cfg.cameraFitFOV=45] How much of the field-of-view, in degrees, that the 3D scene should fill the {@link Canvas} when the {@link Camera} moves to an axis or diagonal.
|
|
114369
114374
|
* @param {String} [cfg.cameraFlyDuration=0.5] When flying the {@link Camera} to each new axis or diagonal, how long, in seconds, that the Camera takes to get there.
|
|
114370
|
-
* @param {String} [cfg.color="lightgrey] Custom uniform color for the faces of the NavCube.
|
|
114375
|
+
* @param {String} [cfg.color="lightgrey"] Custom uniform color for the faces of the NavCube.
|
|
114371
114376
|
* @param {String} [cfg.frontColor="#55FF55"] Custom color for the front face of the NavCube. Overrides ````color````.
|
|
114372
114377
|
* @param {String} [cfg.backColor="#55FF55"] Custom color for the back face of the NavCube. Overrides ````color````.
|
|
114373
114378
|
* @param {String} [cfg.leftColor="#FF5555"] Custom color for the left face of the NavCube. Overrides ````color````.
|
|
@@ -114375,6 +114380,7 @@ class NavCubePlugin extends Plugin {
|
|
|
114375
114380
|
* @param {String} [cfg.topColor="#5555FF"] Custom color for the top face of the NavCube. Overrides ````color````.
|
|
114376
114381
|
* @param {String} [cfg.bottomColor="#5555FF"] Custom color for the bottom face of the NavCube. Overrides ````color````.
|
|
114377
114382
|
* @param {String} [cfg.hoverColor="rgba(0,0,0,0.4)"] Custom color for highlighting regions on the NavCube as we hover the pointer over them.
|
|
114383
|
+
* @param {String} [cfg.textColor="black"] Custom text color for labels of the NavCube.
|
|
114378
114384
|
* @param {Boolean} [cfg.fitVisible=false] Sets whether the axis, corner and edge-aligned views will fit the
|
|
114379
114385
|
* 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````.
|
|
114380
114386
|
* @param {Boolean} [cfg.synchProjection=false] 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.
|
|
@@ -121077,6 +121083,176 @@ class STLLoaderPlugin extends Plugin {
|
|
|
121077
121083
|
}
|
|
121078
121084
|
}
|
|
121079
121085
|
|
|
121086
|
+
/**
|
|
121087
|
+
* @desc A {@link TreeViewPlugin} render class.
|
|
121088
|
+
*
|
|
121089
|
+
*/
|
|
121090
|
+
class RenderService {
|
|
121091
|
+
|
|
121092
|
+
/*
|
|
121093
|
+
* Creates the root node of the tree.
|
|
121094
|
+
* @return {HTMLElement} The root node of the tree.
|
|
121095
|
+
*/
|
|
121096
|
+
createRootNode() {
|
|
121097
|
+
return document.createElement('ul')
|
|
121098
|
+
}
|
|
121099
|
+
|
|
121100
|
+
/*
|
|
121101
|
+
* Creates node of the tree.
|
|
121102
|
+
* @param {Object} node The node to create.
|
|
121103
|
+
|
|
121104
|
+
* @return {HTMLElement} The html element for the node.
|
|
121105
|
+
*/
|
|
121106
|
+
createNodeElement(node, expandHandler, checkHandler, contextmenuHandler, titleClickHandler) {
|
|
121107
|
+
const nodeElement = document.createElement('li');
|
|
121108
|
+
nodeElement.id = node.nodeId;
|
|
121109
|
+
|
|
121110
|
+
if (node.xrayed) {
|
|
121111
|
+
nodeElement.classList.add('xrayed-node');
|
|
121112
|
+
}
|
|
121113
|
+
|
|
121114
|
+
if (node.children.length > 0) {
|
|
121115
|
+
const switchElement = document.createElement('a');
|
|
121116
|
+
switchElement.href = '#';
|
|
121117
|
+
switchElement.id = `switch-${node.nodeId}`;
|
|
121118
|
+
switchElement.textContent = '+';
|
|
121119
|
+
switchElement.classList.add('plus');
|
|
121120
|
+
if (expandHandler) switchElement.addEventListener('click', expandHandler);
|
|
121121
|
+
nodeElement.appendChild(switchElement);
|
|
121122
|
+
}
|
|
121123
|
+
|
|
121124
|
+
const checkbox = document.createElement('input');
|
|
121125
|
+
checkbox.id = `checkbox-${node.nodeId}`;
|
|
121126
|
+
checkbox.type = "checkbox";
|
|
121127
|
+
checkbox.checked = node.checked;
|
|
121128
|
+
checkbox.style["pointer-events"] = "all";
|
|
121129
|
+
if (checkHandler) checkbox.addEventListener("change", checkHandler);
|
|
121130
|
+
nodeElement.appendChild(checkbox);
|
|
121131
|
+
|
|
121132
|
+
const span = document.createElement('span');
|
|
121133
|
+
span.textContent = node.title;
|
|
121134
|
+
nodeElement.appendChild(span);
|
|
121135
|
+
|
|
121136
|
+
if (contextmenuHandler) {
|
|
121137
|
+
span.oncontextmenu = contextmenuHandler;
|
|
121138
|
+
}
|
|
121139
|
+
|
|
121140
|
+
if (titleClickHandler) {
|
|
121141
|
+
span.onclick = titleClickHandler;
|
|
121142
|
+
}
|
|
121143
|
+
|
|
121144
|
+
return nodeElement;
|
|
121145
|
+
}
|
|
121146
|
+
|
|
121147
|
+
createDisabledNodeElement(rootName) {
|
|
121148
|
+
const li = document.createElement('li');
|
|
121149
|
+
|
|
121150
|
+
const switchElement = document.createElement('a');
|
|
121151
|
+
switchElement.href = '#';
|
|
121152
|
+
switchElement.textContent = '!';
|
|
121153
|
+
switchElement.classList.add('warn');
|
|
121154
|
+
switchElement.classList.add('warning');
|
|
121155
|
+
li.appendChild(switchElement);
|
|
121156
|
+
|
|
121157
|
+
const span = document.createElement('span');
|
|
121158
|
+
span.textContent = rootName;
|
|
121159
|
+
li.appendChild(span);
|
|
121160
|
+
|
|
121161
|
+
return li;
|
|
121162
|
+
}
|
|
121163
|
+
|
|
121164
|
+
addChildren(element, nodes) {
|
|
121165
|
+
const ul = document.createElement('ul');
|
|
121166
|
+
nodes.forEach((nodeElement) => {
|
|
121167
|
+
ul.appendChild(nodeElement);
|
|
121168
|
+
});
|
|
121169
|
+
|
|
121170
|
+
element.parentElement.appendChild(ul);
|
|
121171
|
+
}
|
|
121172
|
+
|
|
121173
|
+
expand(element, expandHandler, collapseHandler) {
|
|
121174
|
+
element.classList.remove('plus');
|
|
121175
|
+
element.classList.add('minus');
|
|
121176
|
+
element.textContent = '-';
|
|
121177
|
+
element.removeEventListener('click', expandHandler);
|
|
121178
|
+
element.addEventListener('click', collapseHandler);
|
|
121179
|
+
}
|
|
121180
|
+
|
|
121181
|
+
collapse(element, expandHandler, collapseHandler) {
|
|
121182
|
+
if (!element) {
|
|
121183
|
+
return;
|
|
121184
|
+
}
|
|
121185
|
+
const parent = element.parentElement;
|
|
121186
|
+
if (!parent) {
|
|
121187
|
+
return;
|
|
121188
|
+
}
|
|
121189
|
+
const ul = parent.querySelector('ul');
|
|
121190
|
+
if (!ul) {
|
|
121191
|
+
return;
|
|
121192
|
+
}
|
|
121193
|
+
parent.removeChild(ul);
|
|
121194
|
+
element.classList.remove('minus');
|
|
121195
|
+
element.classList.add('plus');
|
|
121196
|
+
element.textContent = '+';
|
|
121197
|
+
element.removeEventListener('click', collapseHandler);
|
|
121198
|
+
element.addEventListener('click', expandHandler);
|
|
121199
|
+
}
|
|
121200
|
+
|
|
121201
|
+
isExpanded(element) {
|
|
121202
|
+
const parentElement = element.parentElement;
|
|
121203
|
+
return parentElement.getElementsByTagName('li')[0] !== undefined;
|
|
121204
|
+
}
|
|
121205
|
+
|
|
121206
|
+
getId(element) {
|
|
121207
|
+
const parentElement = element.parentElement;
|
|
121208
|
+
return parentElement.id;
|
|
121209
|
+
}
|
|
121210
|
+
|
|
121211
|
+
getIdFromCheckbox(element) {
|
|
121212
|
+
return element.id.replace('checkbox-', '');
|
|
121213
|
+
}
|
|
121214
|
+
|
|
121215
|
+
getSwitchElement(nodeId) {
|
|
121216
|
+
return document.getElementById(`switch-${nodeId}`);
|
|
121217
|
+
}
|
|
121218
|
+
|
|
121219
|
+
isChecked(element) {
|
|
121220
|
+
return element.checked;
|
|
121221
|
+
}
|
|
121222
|
+
|
|
121223
|
+
setCheckbox(nodeId, checked) {
|
|
121224
|
+
const checkbox = document.getElementById(`checkbox-${nodeId}`);
|
|
121225
|
+
if (checkbox) {
|
|
121226
|
+
if (checked !== checkbox.checked) {
|
|
121227
|
+
checkbox.checked = checked;
|
|
121228
|
+
}
|
|
121229
|
+
}
|
|
121230
|
+
}
|
|
121231
|
+
|
|
121232
|
+
setXRayed(nodeId, xrayed) {
|
|
121233
|
+
const treeNode = document.getElementById(nodeId);
|
|
121234
|
+
if (treeNode) {
|
|
121235
|
+
if (xrayed) {
|
|
121236
|
+
treeNode.classList.add('xrayed-node');
|
|
121237
|
+
} else {
|
|
121238
|
+
treeNode.classList.remove('xrayed-node');
|
|
121239
|
+
}
|
|
121240
|
+
}
|
|
121241
|
+
}
|
|
121242
|
+
|
|
121243
|
+
setHighlighted(nodeId, highlighted) {
|
|
121244
|
+
const treeNode = document.getElementById(nodeId);
|
|
121245
|
+
if (treeNode) {
|
|
121246
|
+
if (highlighted) {
|
|
121247
|
+
treeNode.scrollIntoView({block: "center"});
|
|
121248
|
+
treeNode.classList.add('highlighted-node');
|
|
121249
|
+
} else {
|
|
121250
|
+
treeNode.classList.remove('highlighted-node');
|
|
121251
|
+
}
|
|
121252
|
+
}
|
|
121253
|
+
}
|
|
121254
|
+
}
|
|
121255
|
+
|
|
121080
121256
|
const treeViews = [];
|
|
121081
121257
|
|
|
121082
121258
|
/**
|
|
@@ -121436,6 +121612,7 @@ class TreeViewPlugin extends Plugin {
|
|
|
121436
121612
|
* ````IfcBuildingStorey```` nodes will be ordered spatially, from the highest storey down to the lowest, on the
|
|
121437
121613
|
* vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.
|
|
121438
121614
|
* @param {Boolean} [cfg.pruneEmptyNodes=true] 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.
|
|
121615
|
+
* @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
|
|
121439
121616
|
*/
|
|
121440
121617
|
constructor(viewer, cfg = {}) {
|
|
121441
121618
|
|
|
@@ -121475,7 +121652,6 @@ class TreeViewPlugin extends Plugin {
|
|
|
121475
121652
|
this._autoAddModels = (cfg.autoAddModels !== false);
|
|
121476
121653
|
this._autoExpandDepth = (cfg.autoExpandDepth || 0);
|
|
121477
121654
|
this._sortNodes = (cfg.sortNodes !== false);
|
|
121478
|
-
this._pruneEmptyNodes = (cfg.pruneEmptyNodes !== false);
|
|
121479
121655
|
this._viewer = viewer;
|
|
121480
121656
|
this._rootElement = null;
|
|
121481
121657
|
this._muteSceneEvents = false;
|
|
@@ -121483,10 +121659,15 @@ class TreeViewPlugin extends Plugin {
|
|
|
121483
121659
|
this._rootNodes = [];
|
|
121484
121660
|
this._objectNodes = {}; // Object ID -> Node
|
|
121485
121661
|
this._nodeNodes = {}; // Node ID -> Node
|
|
121486
|
-
this.
|
|
121662
|
+
this._rootNames = {}; // Node ID -> Root name
|
|
121487
121663
|
this._sortNodes = cfg.sortNodes;
|
|
121488
121664
|
this._pruneEmptyNodes = cfg.pruneEmptyNodes;
|
|
121489
121665
|
this._showListItemElementId = null;
|
|
121666
|
+
this._renderService = cfg.renderService || new RenderService();
|
|
121667
|
+
|
|
121668
|
+
if (!this._renderService) {
|
|
121669
|
+
throw new Error('TreeViewPlugin: no render service set');
|
|
121670
|
+
}
|
|
121490
121671
|
|
|
121491
121672
|
this._containerElement.oncontextmenu = (e) => {
|
|
121492
121673
|
e.preventDefault();
|
|
@@ -121513,10 +121694,9 @@ class TreeViewPlugin extends Plugin {
|
|
|
121513
121694
|
} else {
|
|
121514
121695
|
node.numVisibleEntities--;
|
|
121515
121696
|
}
|
|
121516
|
-
|
|
121517
|
-
|
|
121518
|
-
|
|
121519
|
-
}
|
|
121697
|
+
|
|
121698
|
+
this._renderService.setCheckbox(node.nodeId, visible);
|
|
121699
|
+
|
|
121520
121700
|
let parent = node.parent;
|
|
121521
121701
|
while (parent) {
|
|
121522
121702
|
parent.checked = visible;
|
|
@@ -121525,15 +121705,12 @@ class TreeViewPlugin extends Plugin {
|
|
|
121525
121705
|
} else {
|
|
121526
121706
|
parent.numVisibleEntities--;
|
|
121527
121707
|
}
|
|
121528
|
-
|
|
121529
|
-
|
|
121530
|
-
|
|
121531
|
-
if (newChecked !== parentCheckbox.checked) {
|
|
121532
|
-
parentCheckbox.checked = newChecked;
|
|
121533
|
-
}
|
|
121534
|
-
}
|
|
121708
|
+
|
|
121709
|
+
this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
|
|
121710
|
+
|
|
121535
121711
|
parent = parent.parent;
|
|
121536
121712
|
}
|
|
121713
|
+
|
|
121537
121714
|
this._muteTreeEvents = false;
|
|
121538
121715
|
});
|
|
121539
121716
|
|
|
@@ -121553,15 +121730,8 @@ class TreeViewPlugin extends Plugin {
|
|
|
121553
121730
|
return;
|
|
121554
121731
|
}
|
|
121555
121732
|
node.xrayed = xrayed;
|
|
121556
|
-
|
|
121557
|
-
|
|
121558
|
-
if (listItemElement !== null) {
|
|
121559
|
-
if (xrayed) {
|
|
121560
|
-
listItemElement.classList.add('xrayed-node');
|
|
121561
|
-
} else {
|
|
121562
|
-
listItemElement.classList.remove('xrayed-node');
|
|
121563
|
-
}
|
|
121564
|
-
}
|
|
121733
|
+
|
|
121734
|
+
this._renderService.setXRayed(node.nodeId, xrayed);
|
|
121565
121735
|
this._muteTreeEvents = false;
|
|
121566
121736
|
});
|
|
121567
121737
|
|
|
@@ -121585,14 +121755,15 @@ class TreeViewPlugin extends Plugin {
|
|
|
121585
121755
|
}
|
|
121586
121756
|
this._muteSceneEvents = true;
|
|
121587
121757
|
const checkbox = event.target;
|
|
121588
|
-
const visible = checkbox
|
|
121589
|
-
const nodeId =
|
|
121758
|
+
const visible = this._renderService.isChecked(checkbox);
|
|
121759
|
+
const nodeId = this._renderService.getIdFromCheckbox(checkbox);
|
|
121760
|
+
|
|
121590
121761
|
const checkedNode = this._nodeNodes[nodeId];
|
|
121591
121762
|
const objects = this._viewer.scene.objects;
|
|
121592
121763
|
let numUpdated = 0;
|
|
121764
|
+
|
|
121593
121765
|
this._withNodeTree(checkedNode, (node) => {
|
|
121594
121766
|
const objectId = node.objectId;
|
|
121595
|
-
const checkBoxId = `checkbox-${node.nodeId}`;
|
|
121596
121767
|
const entity = objects[objectId];
|
|
121597
121768
|
const isLeaf = (node.children.length === 0);
|
|
121598
121769
|
node.numVisibleEntities = visible ? node.numEntities : 0;
|
|
@@ -121600,27 +121771,26 @@ class TreeViewPlugin extends Plugin {
|
|
|
121600
121771
|
numUpdated++;
|
|
121601
121772
|
}
|
|
121602
121773
|
node.checked = visible;
|
|
121603
|
-
|
|
121604
|
-
|
|
121605
|
-
|
|
121606
|
-
}
|
|
121774
|
+
|
|
121775
|
+
this._renderService.setCheckbox(node.nodeId, visible);
|
|
121776
|
+
|
|
121607
121777
|
if (entity) {
|
|
121608
121778
|
entity.visible = visible;
|
|
121609
121779
|
}
|
|
121610
121780
|
});
|
|
121781
|
+
|
|
121611
121782
|
let parent = checkedNode.parent;
|
|
121612
121783
|
while (parent) {
|
|
121613
121784
|
parent.checked = visible;
|
|
121614
|
-
|
|
121785
|
+
|
|
121615
121786
|
if (visible) {
|
|
121616
121787
|
parent.numVisibleEntities += numUpdated;
|
|
121617
121788
|
} else {
|
|
121618
121789
|
parent.numVisibleEntities -= numUpdated;
|
|
121619
121790
|
}
|
|
121620
|
-
|
|
121621
|
-
|
|
121622
|
-
|
|
121623
|
-
}
|
|
121791
|
+
|
|
121792
|
+
this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
|
|
121793
|
+
|
|
121624
121794
|
parent = parent.parent;
|
|
121625
121795
|
}
|
|
121626
121796
|
this._muteSceneEvents = false;
|
|
@@ -121718,6 +121888,11 @@ class TreeViewPlugin extends Plugin {
|
|
|
121718
121888
|
return;
|
|
121719
121889
|
}
|
|
121720
121890
|
this._metaModels[modelId] = metaModel;
|
|
121891
|
+
|
|
121892
|
+
if (options && options.rootName) {
|
|
121893
|
+
this._rootNames[modelId] = options.rootName;
|
|
121894
|
+
}
|
|
121895
|
+
|
|
121721
121896
|
model.on("destroyed", () => {
|
|
121722
121897
|
this.removeModel(model.id);
|
|
121723
121898
|
});
|
|
@@ -121739,6 +121914,11 @@ class TreeViewPlugin extends Plugin {
|
|
|
121739
121914
|
if (!metaModel) {
|
|
121740
121915
|
return;
|
|
121741
121916
|
}
|
|
121917
|
+
|
|
121918
|
+
if (this._rootNames[modelId]) {
|
|
121919
|
+
delete this._rootNames[modelId];
|
|
121920
|
+
}
|
|
121921
|
+
|
|
121742
121922
|
delete this._metaModels[modelId];
|
|
121743
121923
|
this._createNodes();
|
|
121744
121924
|
}
|
|
@@ -121760,21 +121940,22 @@ class TreeViewPlugin extends Plugin {
|
|
|
121760
121940
|
* @param {String} objectId ID of the {@link Entity}.
|
|
121761
121941
|
*/
|
|
121762
121942
|
showNode(objectId) {
|
|
121763
|
-
|
|
121764
|
-
|
|
121765
|
-
}
|
|
121943
|
+
this.unShowNode();
|
|
121944
|
+
|
|
121766
121945
|
const node = this._objectNodes[objectId];
|
|
121767
121946
|
if (!node) {
|
|
121768
121947
|
return; // Node may not exist for the given object if (this._pruneEmptyNodes == true)
|
|
121769
121948
|
}
|
|
121949
|
+
|
|
121770
121950
|
const nodeId = node.nodeId;
|
|
121771
|
-
|
|
121772
|
-
const switchElement =
|
|
121951
|
+
|
|
121952
|
+
const switchElement = this._renderService.getSwitchElement(nodeId);
|
|
121773
121953
|
if (switchElement) {
|
|
121774
121954
|
this._expandSwitchElement(switchElement);
|
|
121775
121955
|
switchElement.scrollIntoView();
|
|
121776
|
-
return;
|
|
121956
|
+
return true;
|
|
121777
121957
|
}
|
|
121958
|
+
|
|
121778
121959
|
const path = [];
|
|
121779
121960
|
path.unshift(node);
|
|
121780
121961
|
let parent = node.parent;
|
|
@@ -121782,20 +121963,17 @@ class TreeViewPlugin extends Plugin {
|
|
|
121782
121963
|
path.unshift(parent);
|
|
121783
121964
|
parent = parent.parent;
|
|
121784
121965
|
}
|
|
121966
|
+
|
|
121785
121967
|
for (let i = 0, len = path.length; i < len; i++) {
|
|
121786
|
-
const
|
|
121787
|
-
const nodeId = node.nodeId;
|
|
121788
|
-
const switchElementId = "switch-" + nodeId;
|
|
121789
|
-
const switchElement = document.getElementById(switchElementId);
|
|
121968
|
+
const switchElement = this._renderService.getSwitchElement(path[i].nodeId);
|
|
121790
121969
|
if (switchElement) {
|
|
121791
121970
|
this._expandSwitchElement(switchElement);
|
|
121792
121971
|
}
|
|
121793
121972
|
}
|
|
121794
|
-
|
|
121795
|
-
|
|
121796
|
-
|
|
121797
|
-
|
|
121798
|
-
this._showListItemElementId = listItemElementId;
|
|
121973
|
+
|
|
121974
|
+
this._renderService.setHighlighted(nodeId, true);
|
|
121975
|
+
|
|
121976
|
+
this._showListItemElementId = nodeId;
|
|
121799
121977
|
}
|
|
121800
121978
|
|
|
121801
121979
|
/**
|
|
@@ -121809,12 +121987,9 @@ class TreeViewPlugin extends Plugin {
|
|
|
121809
121987
|
if (!this._showListItemElementId) {
|
|
121810
121988
|
return;
|
|
121811
121989
|
}
|
|
121812
|
-
|
|
121813
|
-
|
|
121814
|
-
|
|
121815
|
-
return;
|
|
121816
|
-
}
|
|
121817
|
-
listItemElement.classList.remove("highlighted-node");
|
|
121990
|
+
|
|
121991
|
+
this._renderService.setHighlighted(this._showListItemElementId, false);
|
|
121992
|
+
|
|
121818
121993
|
this._showListItemElementId = null;
|
|
121819
121994
|
}
|
|
121820
121995
|
|
|
@@ -121831,9 +122006,8 @@ class TreeViewPlugin extends Plugin {
|
|
|
121831
122006
|
if (countDepth === depth) {
|
|
121832
122007
|
return;
|
|
121833
122008
|
}
|
|
121834
|
-
|
|
121835
|
-
const
|
|
121836
|
-
const switchElement = document.getElementById(switchElementId);
|
|
122009
|
+
|
|
122010
|
+
const switchElement = this._renderService.getSwitchElement(node.nodeId);
|
|
121837
122011
|
if (switchElement) {
|
|
121838
122012
|
this._expandSwitchElement(switchElement);
|
|
121839
122013
|
const childNodes = node.children;
|
|
@@ -121988,11 +122162,12 @@ class TreeViewPlugin extends Plugin {
|
|
|
121988
122162
|
|
|
121989
122163
|
_createDisabledNodes() {
|
|
121990
122164
|
|
|
121991
|
-
const
|
|
121992
|
-
this._rootElement =
|
|
121993
|
-
this._containerElement.appendChild(
|
|
122165
|
+
const rootNode = this._renderService.createRootNode();
|
|
122166
|
+
this._rootElement = rootNode;
|
|
122167
|
+
this._containerElement.appendChild(rootNode);
|
|
121994
122168
|
|
|
121995
122169
|
const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;
|
|
122170
|
+
|
|
121996
122171
|
for (let objectId in rootMetaObjects) {
|
|
121997
122172
|
const rootMetaObject = rootMetaObjects[objectId];
|
|
121998
122173
|
const metaObjectType = rootMetaObject.type;
|
|
@@ -122000,17 +122175,9 @@ class TreeViewPlugin extends Plugin {
|
|
|
122000
122175
|
const rootName = ((metaObjectName && metaObjectName !== ""
|
|
122001
122176
|
&& metaObjectName !== "Undefined"
|
|
122002
122177
|
&& metaObjectName !== "Default") ? metaObjectName : metaObjectType);
|
|
122003
|
-
|
|
122004
|
-
|
|
122005
|
-
|
|
122006
|
-
switchElement.href = '#';
|
|
122007
|
-
switchElement.textContent = '!';
|
|
122008
|
-
switchElement.classList.add('warn');
|
|
122009
|
-
switchElement.classList.add('warning');
|
|
122010
|
-
li.appendChild(switchElement);
|
|
122011
|
-
const span = document.createElement('span');
|
|
122012
|
-
span.textContent = rootName;
|
|
122013
|
-
li.appendChild(span);
|
|
122178
|
+
|
|
122179
|
+
const childNode = this._renderService.createDisabledNodeElement(rootName);
|
|
122180
|
+
rootNode.appendChild(childNode);
|
|
122014
122181
|
}
|
|
122015
122182
|
}
|
|
122016
122183
|
|
|
@@ -122061,7 +122228,7 @@ class TreeViewPlugin extends Plugin {
|
|
|
122061
122228
|
buildingNode = {
|
|
122062
122229
|
nodeId: `${this._id}-${objectId}`,
|
|
122063
122230
|
objectId: objectId,
|
|
122064
|
-
title: this.
|
|
122231
|
+
title: this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
|
|
122065
122232
|
type: metaObjectType,
|
|
122066
122233
|
parent: null,
|
|
122067
122234
|
numEntities: 0,
|
|
@@ -122164,7 +122331,7 @@ class TreeViewPlugin extends Plugin {
|
|
|
122164
122331
|
rootNode = {
|
|
122165
122332
|
nodeId: `${this._id}-${objectId}`,
|
|
122166
122333
|
objectId: objectId,
|
|
122167
|
-
title: this.
|
|
122334
|
+
title: this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
|
|
122168
122335
|
type: metaObjectType,
|
|
122169
122336
|
parent: null,
|
|
122170
122337
|
numEntities: 0,
|
|
@@ -122245,7 +122412,7 @@ class TreeViewPlugin extends Plugin {
|
|
|
122245
122412
|
const node = {
|
|
122246
122413
|
nodeId: `${this._id}-${objectId}`,
|
|
122247
122414
|
objectId: objectId,
|
|
122248
|
-
title: (!parent) ? (this.
|
|
122415
|
+
title: (!parent) ? (this._rootNames[metaObject.metaModels[0].id] || metaObjectName) : (metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType,
|
|
122249
122416
|
type: metaObjectType,
|
|
122250
122417
|
parent: parent,
|
|
122251
122418
|
numEntities: 0,
|
|
@@ -122393,112 +122560,63 @@ class TreeViewPlugin extends Plugin {
|
|
|
122393
122560
|
const rootNodeElements = this._rootNodes.map((rootNode) => {
|
|
122394
122561
|
return this._createNodeElement(rootNode);
|
|
122395
122562
|
});
|
|
122396
|
-
|
|
122563
|
+
|
|
122564
|
+
const rootNode = this._renderService.createRootNode();
|
|
122397
122565
|
rootNodeElements.forEach((nodeElement) => {
|
|
122398
|
-
|
|
122566
|
+
rootNode.appendChild(nodeElement);
|
|
122399
122567
|
});
|
|
122400
|
-
|
|
122401
|
-
this.
|
|
122568
|
+
|
|
122569
|
+
this._containerElement.appendChild(rootNode);
|
|
122570
|
+
this._rootElement = rootNode;
|
|
122402
122571
|
}
|
|
122403
122572
|
|
|
122404
122573
|
_createNodeElement(node) {
|
|
122405
|
-
const
|
|
122406
|
-
|
|
122407
|
-
|
|
122408
|
-
if (node.xrayed) {
|
|
122409
|
-
nodeElement.classList.add('xrayed-node');
|
|
122410
|
-
}
|
|
122411
|
-
nodeElement.id = nodeId;
|
|
122412
|
-
if (node.children.length > 0) {
|
|
122413
|
-
const switchElementId = "switch-" + nodeId;
|
|
122414
|
-
const switchElement = document.createElement('a');
|
|
122415
|
-
switchElement.href = '#';
|
|
122416
|
-
switchElement.id = switchElementId;
|
|
122417
|
-
switchElement.textContent = '+';
|
|
122418
|
-
switchElement.classList.add('plus');
|
|
122419
|
-
switchElement.addEventListener('click', this._switchExpandHandler);
|
|
122420
|
-
nodeElement.appendChild(switchElement);
|
|
122421
|
-
}
|
|
122422
|
-
const checkbox = document.createElement('input');
|
|
122423
|
-
checkbox.id = `checkbox-${nodeId}`;
|
|
122424
|
-
checkbox.type = "checkbox";
|
|
122425
|
-
checkbox.checked = node.checked;
|
|
122426
|
-
checkbox.style["pointer-events"] = "all";
|
|
122427
|
-
checkbox.addEventListener("change", this._checkboxChangeHandler);
|
|
122428
|
-
nodeElement.appendChild(checkbox);
|
|
122429
|
-
const span = document.createElement('span');
|
|
122430
|
-
span.textContent = node.title;
|
|
122431
|
-
nodeElement.appendChild(span);
|
|
122432
|
-
span.oncontextmenu = (e) => {
|
|
122433
|
-
this.fire("contextmenu", {
|
|
122434
|
-
event: e,
|
|
122574
|
+
const contextmenuHandler = (event) =>{
|
|
122575
|
+
this.fire("contextmenu", {
|
|
122576
|
+
event: event,
|
|
122435
122577
|
viewer: this._viewer,
|
|
122436
122578
|
treeViewPlugin: this,
|
|
122437
122579
|
treeViewNode: node
|
|
122438
122580
|
});
|
|
122439
|
-
|
|
122581
|
+
event.preventDefault();
|
|
122440
122582
|
};
|
|
122441
|
-
|
|
122583
|
+
const onclickHandler = (event) => {
|
|
122442
122584
|
this.fire("nodeTitleClicked", {
|
|
122443
|
-
event:
|
|
122585
|
+
event: event,
|
|
122444
122586
|
viewer: this._viewer,
|
|
122445
122587
|
treeViewPlugin: this,
|
|
122446
122588
|
treeViewNode: node
|
|
122447
122589
|
});
|
|
122448
|
-
|
|
122590
|
+
event.preventDefault();
|
|
122449
122591
|
};
|
|
122450
|
-
|
|
122592
|
+
|
|
122593
|
+
return this._renderService.createNodeElement(node, this._switchExpandHandler, this._checkboxChangeHandler, contextmenuHandler, onclickHandler);
|
|
122451
122594
|
}
|
|
122452
122595
|
|
|
122453
122596
|
_expandSwitchElement(switchElement) {
|
|
122454
|
-
const
|
|
122455
|
-
const expanded = parentElement.getElementsByTagName('li')[0];
|
|
122597
|
+
const expanded = this._renderService.isExpanded(switchElement);
|
|
122456
122598
|
if (expanded) {
|
|
122457
122599
|
return;
|
|
122458
122600
|
}
|
|
122459
|
-
|
|
122460
|
-
const
|
|
122461
|
-
|
|
122462
|
-
const nodeElements =
|
|
122601
|
+
|
|
122602
|
+
const nodeId = this._renderService.getId(switchElement);
|
|
122603
|
+
|
|
122604
|
+
const nodeElements = this._nodeNodes[nodeId].children.map((node) => {
|
|
122463
122605
|
return this._createNodeElement(node);
|
|
122464
122606
|
});
|
|
122465
|
-
|
|
122466
|
-
|
|
122467
|
-
|
|
122468
|
-
|
|
122469
|
-
|
|
122470
|
-
|
|
122471
|
-
|
|
122472
|
-
switchElement
|
|
122473
|
-
switchElement.removeEventListener('click', this._switchExpandHandler);
|
|
122474
|
-
switchElement.addEventListener('click', this._switchCollapseHandler);
|
|
122475
|
-
}
|
|
122476
|
-
|
|
122477
|
-
_collapseNode(objectId) {
|
|
122478
|
-
const nodeId = objectId;
|
|
122479
|
-
const switchElementId = "switch-" + nodeId;
|
|
122480
|
-
const switchElement = document.getElementById(switchElementId);
|
|
122607
|
+
|
|
122608
|
+
this._renderService.addChildren(switchElement, nodeElements);
|
|
122609
|
+
|
|
122610
|
+
this._renderService.expand(switchElement, this._switchExpandHandler, this._switchCollapseHandler);
|
|
122611
|
+
}
|
|
122612
|
+
|
|
122613
|
+
_collapseNode(nodeId) {
|
|
122614
|
+
const switchElement = this._renderService.getSwitchElement(nodeId);
|
|
122481
122615
|
this._collapseSwitchElement(switchElement);
|
|
122482
122616
|
}
|
|
122483
122617
|
|
|
122484
122618
|
_collapseSwitchElement(switchElement) {
|
|
122485
|
-
|
|
122486
|
-
return;
|
|
122487
|
-
}
|
|
122488
|
-
const parent = switchElement.parentElement;
|
|
122489
|
-
if (!parent) {
|
|
122490
|
-
return;
|
|
122491
|
-
}
|
|
122492
|
-
const ul = parent.querySelector('ul');
|
|
122493
|
-
if (!ul) {
|
|
122494
|
-
return;
|
|
122495
|
-
}
|
|
122496
|
-
parent.removeChild(ul);
|
|
122497
|
-
switchElement.classList.remove('minus');
|
|
122498
|
-
switchElement.classList.add('plus');
|
|
122499
|
-
switchElement.textContent = '+';
|
|
122500
|
-
switchElement.removeEventListener('click', this._switchCollapseHandler);
|
|
122501
|
-
switchElement.addEventListener('click', this._switchExpandHandler);
|
|
122619
|
+
this._renderService.collapse(switchElement, this._switchExpandHandler, this._switchCollapseHandler);
|
|
122502
122620
|
}
|
|
122503
122621
|
}
|
|
122504
122622
|
|
|
@@ -126983,9 +127101,9 @@ parsers[ParserV10.version] = ParserV10;
|
|
|
126983
127101
|
* }
|
|
126984
127102
|
*
|
|
126985
127103
|
* // Gets the contents of the given .XKT file in an arraybuffer
|
|
126986
|
-
* getXKT(
|
|
127104
|
+
* getXKT(xKTSrc, ok, error) {
|
|
126987
127105
|
* console.log("MyDataSource#getXKT(" + xKTSrc + ", ... )");
|
|
126988
|
-
* utils.loadArraybuffer(
|
|
127106
|
+
* utils.loadArraybuffer(xKTSrc,
|
|
126989
127107
|
* (arraybuffer) => {
|
|
126990
127108
|
* ok(arraybuffer);
|
|
126991
127109
|
* },
|