@xeokit/xeokit-sdk 2.4.2-beta-30 → 2.4.2-beta-32
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 +175 -39
- package/dist/xeokit-sdk.es.js +175 -39
- package/dist/xeokit-sdk.es5.js +87 -13
- package/dist/xeokit-sdk.min.cjs.js +2 -2
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +35 -10
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +39 -15
- package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +100 -13
- package/src/viewer/scene/scene/Scene.js +1 -1
- package/types/plugins/XKTLoaderPlugin/XKTLoaderPlugin.d.ts +235 -231
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -11894,7 +11894,25 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
11894
11894
|
|
|
11895
11895
|
this._currentAngleMeasurement = null;
|
|
11896
11896
|
|
|
11897
|
+
// init markerDiv element (think about making its style configurable)
|
|
11898
|
+
this._initMarkerDiv();
|
|
11899
|
+
|
|
11900
|
+
this._onMouseHoverSurface = null;
|
|
11901
|
+
this._onHoverNothing = null;
|
|
11902
|
+
this._onPickedNothing = null;
|
|
11903
|
+
this._onPickedSurface = null;
|
|
11904
|
+
|
|
11905
|
+
this._onInputMouseDown = null;
|
|
11906
|
+
this._onInputMouseUp = null;
|
|
11907
|
+
|
|
11908
|
+
this._snapping = cfg.snapping !== false;
|
|
11909
|
+
|
|
11910
|
+
this._attachPlugin(angleMeasurementsPlugin, cfg);
|
|
11911
|
+
}
|
|
11912
|
+
|
|
11913
|
+
_initMarkerDiv() {
|
|
11897
11914
|
const markerDiv = document.createElement('div');
|
|
11915
|
+
markerDiv.setAttribute('id', 'myMarkerDiv');
|
|
11898
11916
|
const canvas = this.scene.canvas.canvas;
|
|
11899
11917
|
canvas.parentNode.insertBefore(markerDiv, canvas);
|
|
11900
11918
|
|
|
@@ -11909,17 +11927,14 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
11909
11927
|
markerDiv.style.pointerEvents = "none";
|
|
11910
11928
|
|
|
11911
11929
|
this.markerDiv = markerDiv;
|
|
11912
|
-
|
|
11913
|
-
this._onHoverNothing = null;
|
|
11914
|
-
this._onPickedNothing = null;
|
|
11915
|
-
this._onPickedSurface = null;
|
|
11916
|
-
|
|
11917
|
-
this._onInputMouseDown = null;
|
|
11918
|
-
this._onInputMouseUp = null;
|
|
11919
|
-
|
|
11920
|
-
this._snapping = cfg.snapping !== false;
|
|
11930
|
+
}
|
|
11921
11931
|
|
|
11922
|
-
|
|
11932
|
+
_destroyMarkerDiv() {
|
|
11933
|
+
if (this._markerDiv) {
|
|
11934
|
+
const element = document.getElementById('myMarkerDiv');
|
|
11935
|
+
element.parentNode.removeChild(element);
|
|
11936
|
+
this._markerDiv = null;
|
|
11937
|
+
}
|
|
11923
11938
|
}
|
|
11924
11939
|
|
|
11925
11940
|
_attachPlugin(angleMeasurementsPlugin, cfg = {}) {
|
|
@@ -11987,6 +12002,9 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
11987
12002
|
if (this._active) {
|
|
11988
12003
|
return;
|
|
11989
12004
|
}
|
|
12005
|
+
if (!this.markerDiv) {
|
|
12006
|
+
this._initMarkerDiv(); // if the marker is destroyed after deactivation, we recreate it
|
|
12007
|
+
}
|
|
11990
12008
|
this.angleMeasurementsPlugin;
|
|
11991
12009
|
const scene = this.scene;
|
|
11992
12010
|
scene.input;
|
|
@@ -12191,6 +12209,9 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12191
12209
|
if (this.pointerLens) {
|
|
12192
12210
|
this.pointerLens.visible = false;
|
|
12193
12211
|
}
|
|
12212
|
+
if (this._markerDiv) {
|
|
12213
|
+
this._destroyMarkerDiv();
|
|
12214
|
+
}
|
|
12194
12215
|
this.reset();
|
|
12195
12216
|
const canvas = this.scene.canvas.canvas;
|
|
12196
12217
|
canvas.removeEventListener("mousedown", this._onMouseDown);
|
|
@@ -12215,6 +12236,10 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12215
12236
|
if (!this._active) {
|
|
12216
12237
|
return;
|
|
12217
12238
|
}
|
|
12239
|
+
|
|
12240
|
+
this._destroyMarkerDiv();
|
|
12241
|
+
this._initMarkerDiv();
|
|
12242
|
+
|
|
12218
12243
|
if (this._currentAngleMeasurement) {
|
|
12219
12244
|
this._currentAngleMeasurement.destroy();
|
|
12220
12245
|
this._currentAngleMeasurement = null;
|
|
@@ -30231,7 +30256,7 @@ class Scene extends Component {
|
|
|
30231
30256
|
* - it runs maximum once per scene-tick
|
|
30232
30257
|
*
|
|
30233
30258
|
* @param {Function} cb The function to tickify
|
|
30234
|
-
* @returns {Function
|
|
30259
|
+
* @returns {Function}
|
|
30235
30260
|
*/
|
|
30236
30261
|
tickify(cb) {
|
|
30237
30262
|
const cbString = cb.toString();
|
|
@@ -49959,21 +49984,6 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
49959
49984
|
|
|
49960
49985
|
this._active = false;
|
|
49961
49986
|
|
|
49962
|
-
const markerDiv = document.createElement('div');
|
|
49963
|
-
const canvas = this.scene.canvas.canvas;
|
|
49964
|
-
canvas.parentNode.insertBefore(markerDiv, canvas);
|
|
49965
|
-
markerDiv.style.background = "black";
|
|
49966
|
-
markerDiv.style.border = "2px solid blue";
|
|
49967
|
-
markerDiv.style.borderRadius = "10px";
|
|
49968
|
-
markerDiv.style.width = "5px";
|
|
49969
|
-
markerDiv.style.height = "5px";
|
|
49970
|
-
markerDiv.style.margin = "-200px -200px";
|
|
49971
|
-
markerDiv.style.zIndex = "100";
|
|
49972
|
-
markerDiv.style.position = "absolute";
|
|
49973
|
-
markerDiv.style.pointerEvents = "none";
|
|
49974
|
-
|
|
49975
|
-
this._markerDiv = markerDiv;
|
|
49976
|
-
|
|
49977
49987
|
this._currentDistanceMeasurement = null;
|
|
49978
49988
|
|
|
49979
49989
|
this._currentDistanceMeasurementInitState = {
|
|
@@ -49985,6 +49995,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
49985
49995
|
targetVisible: null,
|
|
49986
49996
|
};
|
|
49987
49997
|
|
|
49998
|
+
this._initMarkerDiv();
|
|
49999
|
+
|
|
49988
50000
|
this._onCameraControlHoverSnapOrSurface = null;
|
|
49989
50001
|
this._onCameraControlHoverSnapOrSurfaceOff = null;
|
|
49990
50002
|
this._onMouseDown = null;
|
|
@@ -49997,6 +50009,32 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
49997
50009
|
this._attachPlugin(distanceMeasurementsPlugin, cfg);
|
|
49998
50010
|
}
|
|
49999
50011
|
|
|
50012
|
+
_initMarkerDiv() {
|
|
50013
|
+
const markerDiv = document.createElement('div');
|
|
50014
|
+
markerDiv.setAttribute('id', 'myMarkerDiv');
|
|
50015
|
+
const canvas = this.scene.canvas.canvas;
|
|
50016
|
+
canvas.parentNode.insertBefore(markerDiv, canvas);
|
|
50017
|
+
markerDiv.style.background = "black";
|
|
50018
|
+
markerDiv.style.border = "2px solid blue";
|
|
50019
|
+
markerDiv.style.borderRadius = "10px";
|
|
50020
|
+
markerDiv.style.width = "5px";
|
|
50021
|
+
markerDiv.style.height = "5px";
|
|
50022
|
+
markerDiv.style.margin = "-200px -200px";
|
|
50023
|
+
markerDiv.style.zIndex = "100";
|
|
50024
|
+
markerDiv.style.position = "absolute";
|
|
50025
|
+
markerDiv.style.pointerEvents = "none";
|
|
50026
|
+
|
|
50027
|
+
this._markerDiv = markerDiv;
|
|
50028
|
+
}
|
|
50029
|
+
|
|
50030
|
+
_destroyMarkerDiv() {
|
|
50031
|
+
if (this._markerDiv) {
|
|
50032
|
+
const element = document.getElementById('myMarkerDiv');
|
|
50033
|
+
element.parentNode.removeChild(element);
|
|
50034
|
+
this._markerDiv = null;
|
|
50035
|
+
}
|
|
50036
|
+
}
|
|
50037
|
+
|
|
50000
50038
|
_attachPlugin(distanceMeasurementsPlugin, cfg = {}) {
|
|
50001
50039
|
|
|
50002
50040
|
/**
|
|
@@ -50062,6 +50100,10 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
50062
50100
|
return;
|
|
50063
50101
|
}
|
|
50064
50102
|
|
|
50103
|
+
if (!this._markerDiv) {
|
|
50104
|
+
this._initMarkerDiv();
|
|
50105
|
+
}
|
|
50106
|
+
|
|
50065
50107
|
this.fire("activated", true);
|
|
50066
50108
|
|
|
50067
50109
|
const distanceMeasurementsPlugin = this.distanceMeasurementsPlugin;
|
|
@@ -50217,6 +50259,9 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
50217
50259
|
if (this.pointerLens) {
|
|
50218
50260
|
this.pointerLens.visible = false;
|
|
50219
50261
|
}
|
|
50262
|
+
if (this._markerDiv) {
|
|
50263
|
+
this._destroyMarkerDiv();
|
|
50264
|
+
}
|
|
50220
50265
|
this.reset();
|
|
50221
50266
|
const canvas = this.scene.canvas.canvas;
|
|
50222
50267
|
canvas.removeEventListener("mousedown", this._onMouseDown);
|
|
@@ -50243,6 +50288,10 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
50243
50288
|
if (!this._active) {
|
|
50244
50289
|
return;
|
|
50245
50290
|
}
|
|
50291
|
+
|
|
50292
|
+
this._destroyMarkerDiv();
|
|
50293
|
+
this._initMarkerDiv();
|
|
50294
|
+
|
|
50246
50295
|
if (this._currentDistanceMeasurement) {
|
|
50247
50296
|
this.distanceMeasurementsPlugin.fire("measurementCancel", this._currentDistanceMeasurement);
|
|
50248
50297
|
this._currentDistanceMeasurement.destroy();
|
|
@@ -122549,6 +122598,15 @@ parsers[ParserV10.version] = ParserV10;
|
|
|
122549
122598
|
* myViewer.scene.setObjectVisibilities("myModel1#0BTBFw6f90Nfh9rP1dlXrb", true);
|
|
122550
122599
|
*````
|
|
122551
122600
|
*
|
|
122601
|
+
* We can also provide an HTTP URL to the XKT file:
|
|
122602
|
+
*
|
|
122603
|
+
* ````javascript
|
|
122604
|
+
* const sceneModel = xktLoader.load({
|
|
122605
|
+
* manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/models/xkt/Schependomlaan.xkt",
|
|
122606
|
+
* id: "myModel",
|
|
122607
|
+
* });
|
|
122608
|
+
* ````
|
|
122609
|
+
*
|
|
122552
122610
|
* # Loading a model from a manifest of XKT files
|
|
122553
122611
|
*
|
|
122554
122612
|
* The `ifc2gltf` tool from Creoox, which converts IFC files into glTF geometry and JSON metadata files, has the option to
|
|
@@ -122635,6 +122693,65 @@ parsers[ParserV10.version] = ParserV10;
|
|
|
122635
122693
|
* They work much reliably (and faster) when processing smaller files (eg. 20MB) than when processing large files (eg. 500MB), where
|
|
122636
122694
|
* they have less trouble allocating the system memory they need for conversion and parsing.
|
|
122637
122695
|
*
|
|
122696
|
+
* We can also provide an HTTP URL to the manifest:
|
|
122697
|
+
*
|
|
122698
|
+
* ````javascript
|
|
122699
|
+
* const sceneModel = xktLoader.load({
|
|
122700
|
+
* manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt.manifest.json",
|
|
122701
|
+
* id: "myModel",
|
|
122702
|
+
* });
|
|
122703
|
+
* ````
|
|
122704
|
+
*
|
|
122705
|
+
* We can also provide the manifest as parameter object:
|
|
122706
|
+
*
|
|
122707
|
+
* ````javascript
|
|
122708
|
+
* const sceneModel = xktLoader.load({
|
|
122709
|
+
* id: "myModel",
|
|
122710
|
+
* manifest: {
|
|
122711
|
+
* inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
|
|
122712
|
+
* converterApplication: "convert2xkt",
|
|
122713
|
+
* converterApplicationVersion: "v1.1.10",
|
|
122714
|
+
* conversionDate": "09-11-2023- 18-29-01",
|
|
122715
|
+
* xktFiles: [
|
|
122716
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
|
|
122717
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
|
|
122718
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
|
|
122719
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
|
|
122720
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
|
|
122721
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
|
|
122722
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
|
|
122723
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
|
|
122724
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
|
|
122725
|
+
* ]
|
|
122726
|
+
* }
|
|
122727
|
+
* });
|
|
122728
|
+
* ````
|
|
122729
|
+
*
|
|
122730
|
+
* We can also provide the paths to the XKT files as HTTP URLs:
|
|
122731
|
+
*
|
|
122732
|
+
* ````javascript
|
|
122733
|
+
* const sceneModel = xktLoader.load({
|
|
122734
|
+
* id: "myModel",
|
|
122735
|
+
* manifest: {
|
|
122736
|
+
* inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
|
|
122737
|
+
* converterApplication: "convert2xkt",
|
|
122738
|
+
* converterApplicationVersion: "v1.1.10",
|
|
122739
|
+
* conversionDate": "09-11-2023- 18-29-01",
|
|
122740
|
+
* xktFiles: [
|
|
122741
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
|
|
122742
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
|
|
122743
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
|
|
122744
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
|
|
122745
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
|
|
122746
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
|
|
122747
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
|
|
122748
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
|
|
122749
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
|
|
122750
|
+
* ]
|
|
122751
|
+
* }
|
|
122752
|
+
* });
|
|
122753
|
+
* ````
|
|
122754
|
+
*
|
|
122638
122755
|
* @class XKTLoaderPlugin
|
|
122639
122756
|
*/
|
|
122640
122757
|
class XKTLoaderPlugin extends Plugin {
|
|
@@ -122904,10 +123021,14 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
122904
123021
|
*
|
|
122905
123022
|
* @param {*} params Loading parameters.
|
|
122906
123023
|
* @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
|
|
122907
|
-
* @param {String} [params.src] Path to
|
|
123024
|
+
* @param {String} [params.src] Path or URL to an *````.xkt````* file, as an alternative to the ````xkt```` parameter.
|
|
122908
123025
|
* @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
|
|
122909
|
-
* @param {String} [params.metaModelSrc] Path to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
123026
|
+
* @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
122910
123027
|
* @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
|
|
123028
|
+
* @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
123029
|
+
* multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
|
|
123030
|
+
* @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
123031
|
+
* multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
|
|
122911
123032
|
* @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
122912
123033
|
* @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
122913
123034
|
* @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
@@ -122943,8 +123064,8 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
122943
123064
|
delete params.id;
|
|
122944
123065
|
}
|
|
122945
123066
|
|
|
122946
|
-
if (!params.src && !params.xkt && !params.manifestSrc) {
|
|
122947
|
-
this.error("load() param expected: src, xkt or
|
|
123067
|
+
if (!params.src && !params.xkt && !params.manifestSrc && !params.manifest) {
|
|
123068
|
+
this.error("load() param expected: src, xkt, manifestSrc or manifestData");
|
|
122948
123069
|
return sceneModel; // Return new empty model
|
|
122949
123070
|
}
|
|
122950
123071
|
|
|
@@ -123072,8 +123193,8 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123072
123193
|
} else if (params.xkt) {
|
|
123073
123194
|
this._parseModel(params.xkt, params, options, sceneModel, metaModel, manifestCtx);
|
|
123074
123195
|
finish();
|
|
123075
|
-
} else if (params.manifestSrc) {
|
|
123076
|
-
const baseDir = getBaseDirectory(params.manifestSrc);
|
|
123196
|
+
} else if (params.manifestSrc || params.manifest) {
|
|
123197
|
+
const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
|
|
123077
123198
|
const loadJSONs = (metaDataFiles, done, error) => {
|
|
123078
123199
|
let i = 0;
|
|
123079
123200
|
const loadNext = () => {
|
|
@@ -123093,7 +123214,6 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123093
123214
|
};
|
|
123094
123215
|
loadNext();
|
|
123095
123216
|
};
|
|
123096
|
-
|
|
123097
123217
|
const loadXKTs = (xktFiles, done, error) => {
|
|
123098
123218
|
let i = 0;
|
|
123099
123219
|
const loadNext = () => {
|
|
@@ -123109,11 +123229,8 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123109
123229
|
};
|
|
123110
123230
|
loadNext();
|
|
123111
123231
|
};
|
|
123112
|
-
|
|
123113
|
-
|
|
123114
|
-
if (sceneModel.destroyed) {
|
|
123115
|
-
return;
|
|
123116
|
-
}
|
|
123232
|
+
if (params.manifest) {
|
|
123233
|
+
const manifestData = params.manifest;
|
|
123117
123234
|
const xktFiles = manifestData.xktFiles;
|
|
123118
123235
|
if (!xktFiles || xktFiles.length === 0) {
|
|
123119
123236
|
error(`load(): Failed to load model manifest - manifest not valid`);
|
|
@@ -123127,7 +123244,26 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
123127
123244
|
} else {
|
|
123128
123245
|
loadXKTs(xktFiles, finish, error);
|
|
123129
123246
|
}
|
|
123130
|
-
}
|
|
123247
|
+
} else {
|
|
123248
|
+
this._dataSource.getManifest(params.manifestSrc, (manifestData) => {
|
|
123249
|
+
if (sceneModel.destroyed) {
|
|
123250
|
+
return;
|
|
123251
|
+
}
|
|
123252
|
+
const xktFiles = manifestData.xktFiles;
|
|
123253
|
+
if (!xktFiles || xktFiles.length === 0) {
|
|
123254
|
+
error(`load(): Failed to load model manifest - manifest not valid`);
|
|
123255
|
+
return;
|
|
123256
|
+
}
|
|
123257
|
+
const metaModelFiles = manifestData.metaModelFiles;
|
|
123258
|
+
if (metaModelFiles) {
|
|
123259
|
+
loadJSONs(metaModelFiles, () => {
|
|
123260
|
+
loadXKTs(xktFiles, finish, error);
|
|
123261
|
+
}, error);
|
|
123262
|
+
} else {
|
|
123263
|
+
loadXKTs(xktFiles, finish, error);
|
|
123264
|
+
}
|
|
123265
|
+
}, error);
|
|
123266
|
+
}
|
|
123131
123267
|
}
|
|
123132
123268
|
}
|
|
123133
123269
|
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -2949,7 +2949,8 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._cornerDot.s
|
|
|
2949
2949
|
* @param {*} [cfg] Configuration
|
|
2950
2950
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
2951
2951
|
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
|
|
2952
|
-
*/function AngleMeasurementsMouseControl(angleMeasurementsPlugin){var _this18;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurementsMouseControl);_this18=_super7.call(this,angleMeasurementsPlugin.viewer.scene);_this18.pointerLens=cfg.pointerLens;_this18._active=false;_this18._mouseState=MOUSE_FINDING_ORIGIN;_this18._currentAngleMeasurement=null
|
|
2952
|
+
*/function AngleMeasurementsMouseControl(angleMeasurementsPlugin){var _this18;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurementsMouseControl);_this18=_super7.call(this,angleMeasurementsPlugin.viewer.scene);_this18.pointerLens=cfg.pointerLens;_this18._active=false;_this18._mouseState=MOUSE_FINDING_ORIGIN;_this18._currentAngleMeasurement=null;// init markerDiv element (think about making its style configurable)
|
|
2953
|
+
_this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothing=null;_this18._onPickedNothing=null;_this18._onPickedSurface=null;_this18._onInputMouseDown=null;_this18._onInputMouseUp=null;_this18._snapping=cfg.snapping!==false;_this18._attachPlugin(angleMeasurementsPlugin,cfg);return _this18;}_createClass(AngleMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement('div');markerDiv.setAttribute('id','myMarkerDiv');var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this.markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this._markerDiv){var element=document.getElementById('myMarkerDiv');element.parentNode.removeChild(element);this._markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(angleMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
|
|
2953
2954
|
* The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.
|
|
2954
2955
|
*
|
|
2955
2956
|
* @type {AngleMeasurementsPlugin}
|
|
@@ -2979,17 +2980,18 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._cornerDot.s
|
|
|
2979
2980
|
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
2980
2981
|
*/function get(){return this._snapping;}/**
|
|
2981
2982
|
* Activates this AngleMeasurementsMouseControl, ready to respond to input.
|
|
2982
|
-
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this19=this;if(this._active){return;}
|
|
2983
|
+
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this19=this;if(this._active){return;}if(!this.markerDiv){this._initMarkerDiv();// if the marker is destroyed after deactivation, we recreate it
|
|
2984
|
+
}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var mouseHoverEntity=false;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;mouseHoverEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:_this19.markerDiv.style.marginLeft="".concat(canvasPos[0]-5,"px");_this19.markerDiv.style.marginTop="".concat(canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.cornerVisible=true;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.corner.worldPos=event.worldPos;}_this19.markerDiv.style.marginLeft="-10000px";_this19.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.targetWireVisible=true;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.worldPos=event.worldPos;}_this19.markerDiv.style.marginLeft="-10000px";_this19.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}lastMouseCanvasX=e.clientX;lastMouseCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this19._currentAngleMeasurement=_this19.angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{entity:mouseHoverEntity,worldPos:mouseWorldPos},corner:{entity:mouseHoverEntity,worldPos:mouseWorldPos},target:{entity:mouseHoverEntity,worldPos:mouseWorldPos},approximate:true});_this19._currentAngleMeasurement.clickable=false;_this19._currentAngleMeasurement.originVisible=true;_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.angleVisible=false;_this19._mouseState=MOUSE_FINDING_CORNER;_this19.angleMeasurementsPlugin.fire("measurementStart",_this19._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._mouseState=MOUSE_FINDING_TARGET;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.clickable=true;_this19.angleMeasurementsPlugin.fire("measurementEnd",_this19._currentAngleMeasurement);_this19._currentAngleMeasurement=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.pointerPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.marginLeft="-100px";_this19.markerDiv.style.marginTop="-100px";if(_this19._currentAngleMeasurement){switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:_this19._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.originWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._active=true;}/**
|
|
2983
2985
|
* Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.
|
|
2984
2986
|
*
|
|
2985
2987
|
* Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
|
|
2986
|
-
*/},{key:"deactivate",value:function deactivate(){if(!this._active){return;}if(this.pointerLens){this.pointerLens.visible=false;}this.reset();var canvas=this.scene.canvas.canvas;canvas.removeEventListener("mousedown",this._onMouseDown);canvas.removeEventListener("mouseup",this._onMouseUp);var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;cameraControl.off(this._onMouseHoverSurface);cameraControl.off(this._onPickedSurface);cameraControl.off(this._onHoverNothing);cameraControl.off(this._onPickedNothing);this._currentAngleMeasurement=null;this._active=false;}/**
|
|
2988
|
+
*/},{key:"deactivate",value:function deactivate(){if(!this._active){return;}if(this.pointerLens){this.pointerLens.visible=false;}if(this._markerDiv){this._destroyMarkerDiv();}this.reset();var canvas=this.scene.canvas.canvas;canvas.removeEventListener("mousedown",this._onMouseDown);canvas.removeEventListener("mouseup",this._onMouseUp);var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;cameraControl.off(this._onMouseHoverSurface);cameraControl.off(this._onPickedSurface);cameraControl.off(this._onHoverNothing);cameraControl.off(this._onPickedNothing);this._currentAngleMeasurement=null;this._active=false;}/**
|
|
2987
2989
|
* Resets this AngleMeasurementsMouseControl.
|
|
2988
2990
|
*
|
|
2989
2991
|
* Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
|
|
2990
2992
|
*
|
|
2991
2993
|
* Does nothing if the AngleMeasurementsMouseControl is not active.
|
|
2992
|
-
*/},{key:"reset",value:function reset(){if(!this._active){return;}if(this._currentAngleMeasurement){this._currentAngleMeasurement.destroy();this._currentAngleMeasurement=null;}this._mouseState=MOUSE_FINDING_ORIGIN;}/**
|
|
2994
|
+
*/},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentAngleMeasurement){this._currentAngleMeasurement.destroy();this._currentAngleMeasurement=null;}this._mouseState=MOUSE_FINDING_ORIGIN;}/**
|
|
2993
2995
|
* Destroys this AngleMeasurementsMouseControl.
|
|
2994
2996
|
*/},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(AngleMeasurementsMouseControl.prototype),"destroy",this).call(this);}}]);return AngleMeasurementsMouseControl;}(AngleMeasurementsControl);/**
|
|
2995
2997
|
* {@link Viewer} plugin for measuring angles.
|
|
@@ -9616,7 +9618,7 @@ return entity.aabb;}ids=[ids];// Must be an entity type
|
|
|
9616
9618
|
* - it runs maximum once per scene-tick
|
|
9617
9619
|
*
|
|
9618
9620
|
* @param {Function} cb The function to tickify
|
|
9619
|
-
* @returns {Function
|
|
9621
|
+
* @returns {Function}
|
|
9620
9622
|
*/},{key:"tickify",value:function tickify(cb){var cbString=cb.toString();/**
|
|
9621
9623
|
* Check if the function is already tickified, and if so return the cached one.
|
|
9622
9624
|
*/if(cbString in this._tickifiedFunctions){return this._tickifiedFunctions[cbString].wrapperFunc;}var alreadyRun=0;var needToRun=0;var lastArgs;/**
|
|
@@ -14486,7 +14488,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
14486
14488
|
* @param [cfg] Configuration
|
|
14487
14489
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
14488
14490
|
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
|
|
14489
|
-
*/function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var _this71;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsMouseControl);_this71=_super49.call(this,distanceMeasurementsPlugin.viewer.scene);_this71.pointerLens=cfg.pointerLens;_this71._active=false;var markerDiv=document.createElement('div');var canvas=
|
|
14491
|
+
*/function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var _this71;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsMouseControl);_this71=_super49.call(this,distanceMeasurementsPlugin.viewer.scene);_this71.pointerLens=cfg.pointerLens;_this71._active=false;_this71._currentDistanceMeasurement=null;_this71._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this71._initMarkerDiv();_this71._onCameraControlHoverSnapOrSurface=null;_this71._onCameraControlHoverSnapOrSurfaceOff=null;_this71._onMouseDown=null;_this71._onMouseUp=null;_this71._onCanvasTouchStart=null;_this71._onCanvasTouchEnd=null;_this71._snapping=cfg.snapping!==false;_this71._mouseState=MOUSE_FIRST_CLICK_EXPECTED;_this71._attachPlugin(distanceMeasurementsPlugin,cfg);return _this71;}_createClass(DistanceMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement('div');markerDiv.setAttribute('id','myMarkerDiv');var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this._markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this._markerDiv){var element=document.getElementById('myMarkerDiv');element.parentNode.removeChild(element);this._markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
|
|
14490
14492
|
* The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.
|
|
14491
14493
|
* @type {DistanceMeasurementsPlugin}
|
|
14492
14494
|
*/this.distanceMeasurementsPlugin=distanceMeasurementsPlugin;/**
|
|
@@ -14514,17 +14516,17 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
14514
14516
|
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
14515
14517
|
*/function get(){return this._snapping;}/**
|
|
14516
14518
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
14517
|
-
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this72=this;if(this._active){return;}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this72._mouseState===MOUSE_FIRST_CLICK_EXPECTED){_this72._markerDiv.style.marginLeft="".concat(canvasPos[0]-5,"px");_this72._markerDiv.style.marginTop="".concat(canvasPos[1]-5,"px");_this72._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this72.pointerLens){_this72.pointerLens.visible=true;_this72.pointerLens.canvasPos=event.canvasPos;_this72.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this72.pointerLens.snapped=true;}_this72._markerDiv.style.background="greenyellow";_this72._markerDiv.style.border="2px solid green";}else{if(_this72.pointerLens){_this72.pointerLens.visible=true;_this72.pointerLens.canvasPos=event.canvasPos;_this72.pointerLens.snappedCanvasPos=event.canvasPos;_this72.pointerLens.snapped=false;}_this72._markerDiv.style.background="pink";_this72._markerDiv.style.border="2px solid red";}}else{_this72._markerDiv.style.marginLeft="-10000px";_this72._markerDiv.style.marginTop="-10000px";}canvas.style.cursor="pointer";if(_this72._currentDistanceMeasurement){_this72._currentDistanceMeasurement.wireVisible=_this72._currentDistanceMeasurementInitState.wireVisible;_this72._currentDistanceMeasurement.axisVisible=_this72._currentDistanceMeasurementInitState.axisVisible&&_this72.distanceMeasurementsPlugin.defaultAxisVisible;_this72._currentDistanceMeasurement.xAxisVisible=_this72._currentDistanceMeasurementInitState.xAxisVisible&&_this72.distanceMeasurementsPlugin.defaultXAxisVisible;_this72._currentDistanceMeasurement.yAxisVisible=_this72._currentDistanceMeasurementInitState.yAxisVisible&&_this72.distanceMeasurementsPlugin.defaultYAxisVisible;_this72._currentDistanceMeasurement.zAxisVisible=_this72._currentDistanceMeasurementInitState.zAxisVisible&&_this72.distanceMeasurementsPlugin.defaultZAxisVisible;_this72._currentDistanceMeasurement.targetVisible=_this72._currentDistanceMeasurementInitState.targetVisible;_this72._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this72._markerDiv.style.marginLeft="-10000px";_this72._markerDiv.style.marginTop="-10000px";}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this72._currentDistanceMeasurement){if(mouseHovering){_this72._currentDistanceMeasurement.clickable=true;_this72.distanceMeasurementsPlugin.fire("measurementEnd",_this72._currentDistanceMeasurement);_this72._currentDistanceMeasurement=null;}else{_this72._currentDistanceMeasurement.destroy();_this72.distanceMeasurementsPlugin.fire("measurementCancel",_this72._currentDistanceMeasurement);_this72._currentDistanceMeasurement=null;}}else{if(mouseHovering){_this72._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},approximate:true});_this72._currentDistanceMeasurementInitState.axisVisible=_this72._currentDistanceMeasurement.axisVisible&&_this72.distanceMeasurementsPlugin.defaultAxisVisible;_this72._currentDistanceMeasurementInitState.xAxisVisible=_this72._currentDistanceMeasurement.xAxisVisible&&_this72.distanceMeasurementsPlugin.defaultXAxisVisible;_this72._currentDistanceMeasurementInitState.yAxisVisible=_this72._currentDistanceMeasurement.yAxisVisible&&_this72.distanceMeasurementsPlugin.defaultYAxisVisible;_this72._currentDistanceMeasurementInitState.zAxisVisible=_this72._currentDistanceMeasurement.zAxisVisible&&_this72.distanceMeasurementsPlugin.defaultZAxisVisible;_this72._currentDistanceMeasurementInitState.wireVisible=_this72._currentDistanceMeasurement.wireVisible;_this72._currentDistanceMeasurementInitState.targetVisible=_this72._currentDistanceMeasurement.targetVisible;_this72._currentDistanceMeasurement.clickable=false;_this72.fire("measurementStart",_this72._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this72.pointerLens){_this72.pointerLens.visible=true;_this72.pointerLens.canvasPos=event.canvasPos;_this72.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this72._markerDiv.style.marginLeft="-100px";_this72._markerDiv.style.marginTop="-100px";if(_this72._currentDistanceMeasurement){_this72._currentDistanceMeasurement.wireVisible=false;_this72._currentDistanceMeasurement.targetVisible=false;_this72._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
|
|
14519
|
+
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this72=this;if(this._active){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this72._mouseState===MOUSE_FIRST_CLICK_EXPECTED){_this72._markerDiv.style.marginLeft="".concat(canvasPos[0]-5,"px");_this72._markerDiv.style.marginTop="".concat(canvasPos[1]-5,"px");_this72._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this72.pointerLens){_this72.pointerLens.visible=true;_this72.pointerLens.canvasPos=event.canvasPos;_this72.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this72.pointerLens.snapped=true;}_this72._markerDiv.style.background="greenyellow";_this72._markerDiv.style.border="2px solid green";}else{if(_this72.pointerLens){_this72.pointerLens.visible=true;_this72.pointerLens.canvasPos=event.canvasPos;_this72.pointerLens.snappedCanvasPos=event.canvasPos;_this72.pointerLens.snapped=false;}_this72._markerDiv.style.background="pink";_this72._markerDiv.style.border="2px solid red";}}else{_this72._markerDiv.style.marginLeft="-10000px";_this72._markerDiv.style.marginTop="-10000px";}canvas.style.cursor="pointer";if(_this72._currentDistanceMeasurement){_this72._currentDistanceMeasurement.wireVisible=_this72._currentDistanceMeasurementInitState.wireVisible;_this72._currentDistanceMeasurement.axisVisible=_this72._currentDistanceMeasurementInitState.axisVisible&&_this72.distanceMeasurementsPlugin.defaultAxisVisible;_this72._currentDistanceMeasurement.xAxisVisible=_this72._currentDistanceMeasurementInitState.xAxisVisible&&_this72.distanceMeasurementsPlugin.defaultXAxisVisible;_this72._currentDistanceMeasurement.yAxisVisible=_this72._currentDistanceMeasurementInitState.yAxisVisible&&_this72.distanceMeasurementsPlugin.defaultYAxisVisible;_this72._currentDistanceMeasurement.zAxisVisible=_this72._currentDistanceMeasurementInitState.zAxisVisible&&_this72.distanceMeasurementsPlugin.defaultZAxisVisible;_this72._currentDistanceMeasurement.targetVisible=_this72._currentDistanceMeasurementInitState.targetVisible;_this72._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this72._markerDiv.style.marginLeft="-10000px";_this72._markerDiv.style.marginTop="-10000px";}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this72._currentDistanceMeasurement){if(mouseHovering){_this72._currentDistanceMeasurement.clickable=true;_this72.distanceMeasurementsPlugin.fire("measurementEnd",_this72._currentDistanceMeasurement);_this72._currentDistanceMeasurement=null;}else{_this72._currentDistanceMeasurement.destroy();_this72.distanceMeasurementsPlugin.fire("measurementCancel",_this72._currentDistanceMeasurement);_this72._currentDistanceMeasurement=null;}}else{if(mouseHovering){_this72._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},approximate:true});_this72._currentDistanceMeasurementInitState.axisVisible=_this72._currentDistanceMeasurement.axisVisible&&_this72.distanceMeasurementsPlugin.defaultAxisVisible;_this72._currentDistanceMeasurementInitState.xAxisVisible=_this72._currentDistanceMeasurement.xAxisVisible&&_this72.distanceMeasurementsPlugin.defaultXAxisVisible;_this72._currentDistanceMeasurementInitState.yAxisVisible=_this72._currentDistanceMeasurement.yAxisVisible&&_this72.distanceMeasurementsPlugin.defaultYAxisVisible;_this72._currentDistanceMeasurementInitState.zAxisVisible=_this72._currentDistanceMeasurement.zAxisVisible&&_this72.distanceMeasurementsPlugin.defaultZAxisVisible;_this72._currentDistanceMeasurementInitState.wireVisible=_this72._currentDistanceMeasurement.wireVisible;_this72._currentDistanceMeasurementInitState.targetVisible=_this72._currentDistanceMeasurement.targetVisible;_this72._currentDistanceMeasurement.clickable=false;_this72.fire("measurementStart",_this72._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this72.pointerLens){_this72.pointerLens.visible=true;_this72.pointerLens.canvasPos=event.canvasPos;_this72.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this72._markerDiv.style.marginLeft="-100px";_this72._markerDiv.style.marginTop="-100px";if(_this72._currentDistanceMeasurement){_this72._currentDistanceMeasurement.wireVisible=false;_this72._currentDistanceMeasurement.targetVisible=false;_this72._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
|
|
14518
14520
|
* Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.
|
|
14519
14521
|
*
|
|
14520
14522
|
* Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
|
|
14521
|
-
*/},{key:"deactivate",value:function deactivate(){if(!this._active){return;}this.fire("activated",false);if(this.pointerLens){this.pointerLens.visible=false;}this.reset();var canvas=this.scene.canvas.canvas;canvas.removeEventListener("mousedown",this._onMouseDown);canvas.removeEventListener("mouseup",this._onMouseUp);var cameraControl=this.distanceMeasurementsPlugin.viewer.cameraControl;cameraControl.off(this._onCameraControlHoverSnapOrSurface);cameraControl.off(this._onCameraControlHoverSnapOrSurfaceOff);if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}this._active=false;}/**
|
|
14523
|
+
*/},{key:"deactivate",value:function deactivate(){if(!this._active){return;}this.fire("activated",false);if(this.pointerLens){this.pointerLens.visible=false;}if(this._markerDiv){this._destroyMarkerDiv();}this.reset();var canvas=this.scene.canvas.canvas;canvas.removeEventListener("mousedown",this._onMouseDown);canvas.removeEventListener("mouseup",this._onMouseUp);var cameraControl=this.distanceMeasurementsPlugin.viewer.cameraControl;cameraControl.off(this._onCameraControlHoverSnapOrSurface);cameraControl.off(this._onCameraControlHoverSnapOrSurfaceOff);if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}this._active=false;}/**
|
|
14522
14524
|
* Resets this DistanceMeasurementsMouseControl.
|
|
14523
14525
|
*
|
|
14524
14526
|
* Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
|
|
14525
14527
|
*
|
|
14526
14528
|
* Does nothing if the DistanceMeasurementsMouseControl is not active.
|
|
14527
|
-
*/},{key:"reset",value:function reset(){if(!this._active){return;}if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}}/**
|
|
14529
|
+
*/},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}}/**
|
|
14528
14530
|
* Destroys this DistanceMeasurementsMouseControl.
|
|
14529
14531
|
*
|
|
14530
14532
|
* Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
|
|
@@ -26658,6 +26660,15 @@ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName
|
|
|
26658
26660
|
* myViewer.scene.setObjectVisibilities("myModel1#0BTBFw6f90Nfh9rP1dlXrb", true);
|
|
26659
26661
|
*````
|
|
26660
26662
|
*
|
|
26663
|
+
* We can also provide an HTTP URL to the XKT file:
|
|
26664
|
+
*
|
|
26665
|
+
* ````javascript
|
|
26666
|
+
* const sceneModel = xktLoader.load({
|
|
26667
|
+
* manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/models/xkt/Schependomlaan.xkt",
|
|
26668
|
+
* id: "myModel",
|
|
26669
|
+
* });
|
|
26670
|
+
* ````
|
|
26671
|
+
*
|
|
26661
26672
|
* # Loading a model from a manifest of XKT files
|
|
26662
26673
|
*
|
|
26663
26674
|
* The `ifc2gltf` tool from Creoox, which converts IFC files into glTF geometry and JSON metadata files, has the option to
|
|
@@ -26744,6 +26755,65 @@ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName
|
|
|
26744
26755
|
* They work much reliably (and faster) when processing smaller files (eg. 20MB) than when processing large files (eg. 500MB), where
|
|
26745
26756
|
* they have less trouble allocating the system memory they need for conversion and parsing.
|
|
26746
26757
|
*
|
|
26758
|
+
* We can also provide an HTTP URL to the manifest:
|
|
26759
|
+
*
|
|
26760
|
+
* ````javascript
|
|
26761
|
+
* const sceneModel = xktLoader.load({
|
|
26762
|
+
* manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt.manifest.json",
|
|
26763
|
+
* id: "myModel",
|
|
26764
|
+
* });
|
|
26765
|
+
* ````
|
|
26766
|
+
*
|
|
26767
|
+
* We can also provide the manifest as parameter object:
|
|
26768
|
+
*
|
|
26769
|
+
* ````javascript
|
|
26770
|
+
* const sceneModel = xktLoader.load({
|
|
26771
|
+
* id: "myModel",
|
|
26772
|
+
* manifest: {
|
|
26773
|
+
* inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
|
|
26774
|
+
* converterApplication: "convert2xkt",
|
|
26775
|
+
* converterApplicationVersion: "v1.1.10",
|
|
26776
|
+
* conversionDate": "09-11-2023- 18-29-01",
|
|
26777
|
+
* xktFiles: [
|
|
26778
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
|
|
26779
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
|
|
26780
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
|
|
26781
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
|
|
26782
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
|
|
26783
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
|
|
26784
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
|
|
26785
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
|
|
26786
|
+
* "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
|
|
26787
|
+
* ]
|
|
26788
|
+
* }
|
|
26789
|
+
* });
|
|
26790
|
+
* ````
|
|
26791
|
+
*
|
|
26792
|
+
* We can also provide the paths to the XKT files as HTTP URLs:
|
|
26793
|
+
*
|
|
26794
|
+
* ````javascript
|
|
26795
|
+
* const sceneModel = xktLoader.load({
|
|
26796
|
+
* id: "myModel",
|
|
26797
|
+
* manifest: {
|
|
26798
|
+
* inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
|
|
26799
|
+
* converterApplication: "convert2xkt",
|
|
26800
|
+
* converterApplicationVersion: "v1.1.10",
|
|
26801
|
+
* conversionDate": "09-11-2023- 18-29-01",
|
|
26802
|
+
* xktFiles: [
|
|
26803
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
|
|
26804
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
|
|
26805
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
|
|
26806
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
|
|
26807
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
|
|
26808
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
|
|
26809
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
|
|
26810
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
|
|
26811
|
+
* "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
|
|
26812
|
+
* ]
|
|
26813
|
+
* }
|
|
26814
|
+
* });
|
|
26815
|
+
* ````
|
|
26816
|
+
*
|
|
26747
26817
|
* @class XKTLoaderPlugin
|
|
26748
26818
|
*/var XKTLoaderPlugin=/*#__PURE__*/function(_Plugin17){_inherits(XKTLoaderPlugin,_Plugin17);var _super150=_createSuper(XKTLoaderPlugin);/**
|
|
26749
26819
|
* @constructor
|
|
@@ -26909,10 +26979,14 @@ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName
|
|
|
26909
26979
|
*
|
|
26910
26980
|
* @param {*} params Loading parameters.
|
|
26911
26981
|
* @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
|
|
26912
|
-
* @param {String} [params.src] Path to
|
|
26982
|
+
* @param {String} [params.src] Path or URL to an *````.xkt````* file, as an alternative to the ````xkt```` parameter.
|
|
26913
26983
|
* @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
|
|
26914
|
-
* @param {String} [params.metaModelSrc] Path to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
26984
|
+
* @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
26915
26985
|
* @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
|
|
26986
|
+
* @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
26987
|
+
* multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
|
|
26988
|
+
* @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
26989
|
+
* multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
|
|
26916
26990
|
* @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
26917
26991
|
* @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
26918
26992
|
* @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
@@ -26940,12 +27014,12 @@ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName
|
|
|
26940
27014
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
26941
27015
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
26942
27016
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
|
|
26943
|
-
*/},{key:"load",value:function load(){var _this153=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xkt&&!params.manifestSrc){this.error("load() param expected: src, xkt or
|
|
27017
|
+
*/},{key:"load",value:function load(){var _this153=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xkt&&!params.manifestSrc&&!params.manifest){this.error("load() param expected: src, xkt, manifestSrc or manifestData");return sceneModel;// Return new empty model
|
|
26944
27018
|
}var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&¶ms.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i536=0,len=includeTypes.length;_i536<len;_i536++){options.includeTypesMap[includeTypes[_i536]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i537=0,_len120=excludeTypes.length;_i537<_len120;_i537++){options.excludeTypesMap[excludeTypes[_i537]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&¶ms.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
|
|
26945
27019
|
var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
|
|
26946
27020
|
sceneModel.finalize();metaModel.finalize();_this153.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this153.viewer.metaScene.destroyMetaModel(metaModel.id);});sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
26947
27021
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
26948
|
-
});};var error=function error(errMsg){_this153.viewer.scene.canvas.spinner.processes--;_this153.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this153._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this153._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc){var baseDir=getBaseDirectory(params.manifestSrc);var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=metaDataFiles.length){done();}else{_this153._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;loadNext();},error);}};loadNext();};var loadXKTs=function loadXKTs(xktFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=xktFiles.length){done();}else{_this153._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this153._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);i++;loadNext();},error);}};loadNext();};this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs(xktFiles,finish,error);},error);}else{loadXKTs(xktFiles,finish,error);}},error);}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this154=this;this._dataSource.getXKT(params.src,function(arrayBuffer){_this154._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);done();},error);}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){if(sceneModel.destroyed){return;}var dataView=new DataView(arrayBuffer);var dataArray=new Uint8Array(arrayBuffer);var xktVersion=dataView.getUint32(0,true);var parser=parsers[xktVersion];if(!parser){this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return;}this.log("Loading .xkt V"+xktVersion);var numElements=dataView.getUint32(4,true);var elements=[];var byteOffset=(numElements+2)*4;for(var _i538=0;_i538<numElements;_i538++){var elementSize=dataView.getUint32((_i538+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
|
|
27022
|
+
});};var error=function error(errMsg){_this153.viewer.scene.canvas.spinner.processes--;_this153.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this153._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this153._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=metaDataFiles.length){done();}else{_this153._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;loadNext();},error);}};loadNext();};var loadXKTs=function loadXKTs(xktFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=xktFiles.length){done();}else{_this153._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this153._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);i++;loadNext();},error);}};loadNext();};if(params.manifest){var manifestData=params.manifest;var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs(xktFiles,finish,error);},error);}else{loadXKTs(xktFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs(xktFiles,finish,error);},error);}else{loadXKTs(xktFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this154=this;this._dataSource.getXKT(params.src,function(arrayBuffer){_this154._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);done();},error);}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){if(sceneModel.destroyed){return;}var dataView=new DataView(arrayBuffer);var dataArray=new Uint8Array(arrayBuffer);var xktVersion=dataView.getUint32(0,true);var parser=parsers[xktVersion];if(!parser){this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return;}this.log("Loading .xkt V"+xktVersion);var numElements=dataView.getUint32(4,true);var elements=[];var byteOffset=(numElements+2)*4;for(var _i538=0;_i538<numElements;_i538++){var elementSize=dataView.getUint32((_i538+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
|
|
26949
27023
|
//
|
|
26950
27024
|
// const metaModelId = sceneModel.id;
|
|
26951
27025
|
//
|