@xeokit/xeokit-sdk 2.6.13 → 2.6.16

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.
@@ -86582,6 +86582,7 @@ class DistanceMeasurement extends Component {
86582
86582
  this.lengthLabelEnabled = cfg.lengthLabelEnabled;
86583
86583
  this.labelsVisible = cfg.labelsVisible;
86584
86584
  this.labelsOnWires = cfg.labelsOnWires;
86585
+ this.useRotationAdjustment = cfg.useRotationAdjustment;
86585
86586
  }
86586
86587
 
86587
86588
  _update() {
@@ -86595,7 +86596,7 @@ class DistanceMeasurement extends Component {
86595
86596
  if (this._wpDirty) {
86596
86597
 
86597
86598
  this._measurementOrientation = determineMeasurementOrientation(this._originWorld, this._targetWorld, 1);
86598
- if(this._measurementOrientation === 'Vertical'){
86599
+ if(this._measurementOrientation === 'Vertical' && this.useRotationAdjustment){
86599
86600
  this._wp[0] = this._originWorld[0];
86600
86601
  this._wp[1] = this._originWorld[1];
86601
86602
  this._wp[2] = this._originWorld[2];
@@ -88175,304 +88176,322 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
88175
88176
  * ````
88176
88177
  */
88177
88178
  class DistanceMeasurementsPlugin extends Plugin {
88179
+ /**
88180
+ * @constructor
88181
+ * @param {Viewer} viewer The Viewer.
88182
+ * @param {Object} [cfg] Plugin configuration.
88183
+ * @param {String} [cfg.id="DistanceMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
88184
+ * @param {Number} [cfg.labelMinAxisLength=25] The minimum length, in pixels, of an axis wire beyond which its label is shown.
88185
+ * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.
88186
+ * @param {boolean} [cfg.defaultVisible=true] The default value of the DistanceMeasurements `visible` property.
88187
+ * @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
88188
+ * @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
88189
+ * @param {boolean} [cfg.defaultWireVisible=true] The default value of the DistanceMeasurements `wireVisible` property.
88190
+ * @param {boolean} [cfg.defaultLabelsVisible=true] The default value of the DistanceMeasurements `labelsVisible` property.
88191
+ * @param {boolean} [cfg.defaultXLabelEnabled=true] The default value of the DistanceMeasurements `xLabelEnabled` property.
88192
+ * @param {boolean} [cfg.defaultYLabelEnabled=true] The default value of the DistanceMeasurements `yLabelEnabled` property.
88193
+ * @param {boolean} [cfg.defaultZLabelEnabled=true] The default value of the DistanceMeasurements `zLabelEnabled` property.
88194
+ * @param {boolean} [cfg.defaultLengthLabelEnabled=true] The default value of the DistanceMeasurements `lengthLabelEnabled` property.
88195
+ * @param {boolean} [cfg.defaultAxisVisible=true] The default value of the DistanceMeasurements `axisVisible` property.
88196
+ * @param {boolean} [cfg.defaultXAxisVisible=true] The default value of the DistanceMeasurements `xAxisVisible` property.
88197
+ * @param {boolean} [cfg.defaultYAxisVisible=true] The default value of the DistanceMeasurements `yAxisVisible` property.
88198
+ * @param {boolean} [cfg.defaultZAxisVisible=true] The default value of the DistanceMeasurements `zAxisVisible` property.
88199
+ * @param {boolean} [cfg.useRotationAdjustment=false] The default value of DistanceMeasurements `useRotationAdjustment` property.
88200
+ * @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
88201
+ * @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
88202
+ * @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.
88203
+ * @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
88204
+ */
88205
+ constructor(viewer, cfg = {}) {
88206
+ super("DistanceMeasurements", viewer);
88207
+
88208
+ this._pointerLens = cfg.pointerLens;
88209
+
88210
+ this._container = cfg.container || document.body;
88211
+
88212
+ this._defaultControl = null;
88213
+
88214
+ this._measurements = {};
88215
+
88216
+ this.labelMinAxisLength = cfg.labelMinAxisLength;
88217
+ this.defaultVisible = cfg.defaultVisible !== false;
88218
+ this.defaultOriginVisible = cfg.defaultOriginVisible !== false;
88219
+ this.defaultTargetVisible = cfg.defaultTargetVisible !== false;
88220
+ this.defaultWireVisible = cfg.defaultWireVisible !== false;
88221
+ this.defaultXLabelEnabled = cfg.defaultXLabelEnabled !== false;
88222
+ this.defaultYLabelEnabled = cfg.defaultYLabelEnabled !== false;
88223
+ this.defaultZLabelEnabled = cfg.defaultZLabelEnabled !== false;
88224
+ this.defaultLengthLabelEnabled = cfg.defaultLengthLabelEnabled !== false;
88225
+ this.defaultLabelsVisible = cfg.defaultLabelsVisible !== false;
88226
+ this.defaultAxisVisible = cfg.defaultAxisVisible !== false;
88227
+ this.defaultXAxisVisible = cfg.defaultXAxisVisible !== false;
88228
+ this.defaultYAxisVisible = cfg.defaultYAxisVisible !== false;
88229
+ this.defaultZAxisVisible = cfg.defaultZAxisVisible !== false;
88230
+ this.defaultColor =cfg.defaultColor !== undefined ? cfg.defaultColor : "#00BBFF";
88231
+ this.zIndex = cfg.zIndex || 10000;
88232
+ this.defaultLabelsOnWires = cfg.defaultLabelsOnWires !== false;
88233
+ this.useRotationAdjustment = cfg.useRotationAdjustment !== undefined ? cfg.useRotationAdjustment !== false : false;
88234
+
88235
+ this._onMouseOver = (event, measurement) => {
88236
+ this.fire("mouseOver", {
88237
+ plugin: this,
88238
+ distanceMeasurement: measurement,
88239
+ measurement,
88240
+ event,
88241
+ });
88242
+ };
88178
88243
 
88179
- /**
88180
- * @constructor
88181
- * @param {Viewer} viewer The Viewer.
88182
- * @param {Object} [cfg] Plugin configuration.
88183
- * @param {String} [cfg.id="DistanceMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
88184
- * @param {Number} [cfg.labelMinAxisLength=25] The minimum length, in pixels, of an axis wire beyond which its label is shown.
88185
- * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.
88186
- * @param {boolean} [cfg.defaultVisible=true] The default value of the DistanceMeasurements `visible` property.
88187
- * @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
88188
- * @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
88189
- * @param {boolean} [cfg.defaultWireVisible=true] The default value of the DistanceMeasurements `wireVisible` property.
88190
- * @param {boolean} [cfg.defaultLabelsVisible=true] The default value of the DistanceMeasurements `labelsVisible` property.
88191
- * @param {boolean} [cfg.defaultXLabelEnabled=true] The default value of the DistanceMeasurements `xLabelEnabled` property.
88192
- * @param {boolean} [cfg.defaultYLabelEnabled=true] The default value of the DistanceMeasurements `yLabelEnabled` property.
88193
- * @param {boolean} [cfg.defaultZLabelEnabled=true] The default value of the DistanceMeasurements `zLabelEnabled` property.
88194
- * @param {boolean} [cfg.defaultLengthLabelEnabled=true] The default value of the DistanceMeasurements `lengthLabelEnabled` property.
88195
- * @param {boolean} [cfg.defaultAxisVisible=true] The default value of the DistanceMeasurements `axisVisible` property.
88196
- * @param {boolean} [cfg.defaultXAxisVisible=true] The default value of the DistanceMeasurements `xAxisVisible` property.
88197
- * @param {boolean} [cfg.defaultYAxisVisible=true] The default value of the DistanceMeasurements `yAxisVisible` property.
88198
- * @param {boolean} [cfg.defaultZAxisVisible=true] The default value of the DistanceMeasurements `zAxisVisible` property.
88199
- * @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
88200
- * @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
88201
- * @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.
88202
- * @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
88203
- */
88204
- constructor(viewer, cfg = {}) {
88205
-
88206
- super("DistanceMeasurements", viewer);
88207
-
88208
- this._pointerLens = cfg.pointerLens;
88209
-
88210
- this._container = cfg.container || document.body;
88211
-
88212
- this._defaultControl = null;
88213
-
88214
- this._measurements = {};
88215
-
88216
- this.labelMinAxisLength = cfg.labelMinAxisLength;
88217
- this.defaultVisible = cfg.defaultVisible !== false;
88218
- this.defaultOriginVisible = cfg.defaultOriginVisible !== false;
88219
- this.defaultTargetVisible = cfg.defaultTargetVisible !== false;
88220
- this.defaultWireVisible = cfg.defaultWireVisible !== false;
88221
- this.defaultXLabelEnabled = cfg.defaultXLabelEnabled !== false;
88222
- this.defaultYLabelEnabled = cfg.defaultYLabelEnabled !== false;
88223
- this.defaultZLabelEnabled = cfg.defaultZLabelEnabled !== false;
88224
- this.defaultLengthLabelEnabled = cfg.defaultLengthLabelEnabled !== false;
88225
- this.defaultLabelsVisible = cfg.defaultLabelsVisible !== false;
88226
- this.defaultAxisVisible = cfg.defaultAxisVisible !== false;
88227
- this.defaultXAxisVisible = cfg.defaultXAxisVisible !== false;
88228
- this.defaultYAxisVisible = cfg.defaultYAxisVisible !== false;
88229
- this.defaultZAxisVisible = cfg.defaultZAxisVisible !== false;
88230
- this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : "#00BBFF";
88231
- this.zIndex = cfg.zIndex || 10000;
88232
- this.defaultLabelsOnWires = cfg.defaultLabelsOnWires !== false;
88233
-
88234
- this._onMouseOver = (event, measurement) => {
88235
- this.fire("mouseOver", {
88236
- plugin: this,
88237
- distanceMeasurement: measurement,
88238
- measurement,
88239
- event
88240
- });
88241
- };
88242
-
88243
- this._onMouseLeave = (event, measurement) => {
88244
- this.fire("mouseLeave", {
88245
- plugin: this,
88246
- distanceMeasurement: measurement,
88247
- measurement,
88248
- event
88249
- });
88250
- };
88251
-
88252
- this._onContextMenu = (event, measurement) => {
88253
- this.fire("contextMenu", {
88254
- plugin: this,
88255
- distanceMeasurement: measurement,
88256
- measurement,
88257
- event
88258
- });
88259
- };
88260
- }
88261
-
88262
- /**
88263
- * Gets the plugin's HTML container element, if any.
88264
- * @returns {*|HTMLElement|HTMLElement}
88265
- */
88266
- getContainerElement() {
88267
- return this._container;
88268
- }
88269
-
88270
- /**
88271
- * @private
88272
- */
88273
- send(name, value) {
88274
-
88275
- }
88276
-
88277
- /**
88278
- * Gets the PointerLens attached to this DistanceMeasurementsPlugin.
88279
- * @returns {PointerCircle}
88280
- */
88281
- get pointerLens() {
88282
- return this._pointerLens;
88283
- }
88284
-
88285
- /**
88286
- * Gets the default {@link DistanceMeasurementsControl}.
88287
- *
88288
- * @type {DistanceMeasurementsControl}
88289
- * @deprecated
88290
- */
88291
- get control() {
88292
- if (!this._defaultControl) {
88293
- this._defaultControl = new DistanceMeasurementsMouseControl(this, {});
88294
- }
88295
- return this._defaultControl;
88296
- }
88297
-
88298
- /**
88299
- * Gets the existing {@link DistanceMeasurement}s, each mapped to its {@link DistanceMeasurement#id}.
88300
- *
88301
- * @type {{String:DistanceMeasurement}}
88302
- */
88303
- get measurements() {
88304
- return this._measurements;
88305
- }
88306
-
88307
- /**
88308
- * Sets the minimum length, in pixels, of an axis wire beyond which its label is shown.
88309
- *
88310
- * The axis wire's label is not shown when its length is less than this value.
88311
- *
88312
- * This is ````25```` pixels by default.
88313
- *
88314
- * Must not be less than ````1````.
88315
- *
88316
- * @type {number}
88317
- */
88318
- set labelMinAxisLength(labelMinAxisLength) {
88319
- if (labelMinAxisLength < 1) {
88320
- this.error("labelMinAxisLength must be >= 1; defaulting to 25");
88321
- labelMinAxisLength = 25;
88322
- }
88323
- this._labelMinAxisLength = labelMinAxisLength || 25;
88324
- }
88325
-
88326
- /**
88327
- * Gets the minimum length, in pixels, of an axis wire beyond which its label is shown.
88328
- * @returns {number}
88329
- */
88330
- get labelMinAxisLength() {
88331
- return this._labelMinAxisLength;
88332
- }
88244
+ this._onMouseLeave = (event, measurement) => {
88245
+ this.fire("mouseLeave", {
88246
+ plugin: this,
88247
+ distanceMeasurement: measurement,
88248
+ measurement,
88249
+ event,
88250
+ });
88251
+ };
88333
88252
 
88334
- /**
88335
- * Creates a {@link DistanceMeasurement}.
88336
- *
88337
- * The DistanceMeasurement is then registered by {@link DistanceMeasurement#id} in {@link DistanceMeasurementsPlugin#measurements}.
88338
- *
88339
- * @param {Object} params {@link DistanceMeasurement} configuration.
88340
- * @param {String} params.id Unique ID to assign to {@link DistanceMeasurement#id}. The DistanceMeasurement will be registered by this in {@link DistanceMeasurementsPlugin#measurements} and {@link Scene.components}. Must be unique among all components in the {@link Viewer}.
88341
- * @param {Number[]} params.origin.worldPos Origin World-space 3D position.
88342
- * @param {Entity} params.origin.entity Origin Entity.
88343
- * @param {Number[]} params.target.worldPos Target World-space 3D position.
88344
- * @param {Entity} params.target.entity Target Entity.
88345
- * @param {Boolean} [params.visible=true] Whether to initially show the {@link DistanceMeasurement}.
88346
- * @param {Boolean} [params.originVisible=true] Whether to initially show the {@link DistanceMeasurement} origin.
88347
- * @param {Boolean} [params.targetVisible=true] Whether to initially show the {@link DistanceMeasurement} target.
88348
- * @param {Boolean} [params.wireVisible=true] Whether to initially show the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88349
- * @param {Boolean} [params.axisVisible=true] Whether to initially show the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88350
- * @param {Boolean} [params.xAxisVisible=true] Whether to initially show the X-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88351
- * @param {Boolean} [params.yAxisVisible=true] Whether to initially show the Y-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88352
- * @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88353
- * @param {Boolean} [params.xLabelEnabled=true] Whether to initially show the x label.
88354
- * @param {Boolean} [params.yLabelEnabled=true] Whether to initially show the y label.
88355
- * @param {Boolean} [params.zLabelEnabled=true] Whether to initially show the z label.
88356
- * @param {Boolean} [params.lengthLabelEnabled=true] Whether to initially show the length label.
88357
- * @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
88358
- * @param {Boolean} [params.lengthLabelVisible=true] Whether to initially show the labels.
88359
- * @param {string} [params.color] The color of the length dot, wire and label.
88360
- * @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
88361
- * @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
88362
- */
88363
- createMeasurement(params = {}) {
88364
- if (this.viewer.scene.components[params.id]) {
88365
- this.error("Viewer scene component with this ID already exists: " + params.id);
88366
- delete params.id;
88367
- }
88368
- const origin = params.origin;
88369
- const target = params.target;
88370
- const measurement = new DistanceMeasurement(this, {
88371
- id: params.id,
88372
- plugin: this,
88373
- container: this._container,
88374
- origin: {
88375
- entity: origin.entity,
88376
- worldPos: origin.worldPos
88377
- },
88378
- target: {
88379
- entity: target.entity,
88380
- worldPos: target.worldPos
88381
- },
88382
- visible: params.visible,
88383
- wireVisible: params.wireVisible,
88384
- axisVisible: params.axisVisible !== false && this.defaultAxisVisible !== false,
88385
- xAxisVisible: params.xAxisVisible !== false && this.defaultXAxisVisible !== false,
88386
- yAxisVisible: params.yAxisVisible !== false && this.defaultYAxisVisible !== false,
88387
- zAxisVisible: params.zAxisVisible !== false && this.defaultZAxisVisible !== false,
88388
- xLabelEnabled: params.xLabelEnabled !== false && this.defaultXLabelEnabled !== false,
88389
- yLabelEnabled: params.yLabelEnabled !== false && this.defaultYLabelEnabled !== false,
88390
- zLabelEnabled: params.zLabelEnabled !== false && this.defaultZLabelEnabled !== false,
88391
- lengthLabelEnabled: params.lengthLabelEnabled !== false && this.defaultLengthLabelEnabled !== false,
88392
- labelsVisible: params.labelsVisible !== false && this.defaultLabelsVisible !== false,
88393
- originVisible: params.originVisible,
88394
- targetVisible: params.targetVisible,
88395
- color: params.color,
88396
- labelsOnWires: params.labelsOnWires !== false && this.defaultLabelsOnWires !== false,
88397
- onMouseOver: this._onMouseOver,
88398
- onMouseLeave: this._onMouseLeave,
88399
- onContextMenu: this._onContextMenu
88400
- });
88401
- this._measurements[measurement.id] = measurement;
88402
- measurement.clickable = true;
88403
- measurement.on("destroyed", () => {
88404
- delete this._measurements[measurement.id];
88405
- });
88406
- this.fire("measurementCreated", measurement);
88407
- return measurement;
88408
- }
88253
+ this._onContextMenu = (event, measurement) => {
88254
+ this.fire("contextMenu", {
88255
+ plugin: this,
88256
+ distanceMeasurement: measurement,
88257
+ measurement,
88258
+ event,
88259
+ });
88260
+ };
88261
+ }
88409
88262
 
88410
- /**
88411
- * Destroys a {@link DistanceMeasurement}.
88412
- *
88413
- * @param {String} id ID of DistanceMeasurement to destroy.
88414
- */
88415
- destroyMeasurement(id) {
88416
- const measurement = this._measurements[id];
88417
- if (!measurement) {
88418
- this.log("DistanceMeasurement not found: " + id);
88419
- return;
88420
- }
88421
- measurement.destroy();
88422
- this.fire("measurementDestroyed", measurement);
88263
+ /**
88264
+ * Gets the plugin's HTML container element, if any.
88265
+ * @returns {*|HTMLElement|HTMLElement}
88266
+ */
88267
+ getContainerElement() {
88268
+ return this._container;
88269
+ }
88270
+
88271
+ /**
88272
+ * @private
88273
+ */
88274
+ send(name, value) {}
88275
+
88276
+ /**
88277
+ * Gets the PointerLens attached to this DistanceMeasurementsPlugin.
88278
+ * @returns {PointerCircle}
88279
+ */
88280
+ get pointerLens() {
88281
+ return this._pointerLens;
88282
+ }
88283
+
88284
+ /**
88285
+ * Gets the default {@link DistanceMeasurementsControl}.
88286
+ *
88287
+ * @type {DistanceMeasurementsControl}
88288
+ * @deprecated
88289
+ */
88290
+ get control() {
88291
+ if (!this._defaultControl) {
88292
+ this._defaultControl = new DistanceMeasurementsMouseControl(this, {});
88293
+ }
88294
+ return this._defaultControl;
88295
+ }
88296
+
88297
+ /**
88298
+ * Gets the existing {@link DistanceMeasurement}s, each mapped to its {@link DistanceMeasurement#id}.
88299
+ *
88300
+ * @type {{String:DistanceMeasurement}}
88301
+ */
88302
+ get measurements() {
88303
+ return this._measurements;
88304
+ }
88305
+
88306
+ /**
88307
+ * Sets the minimum length, in pixels, of an axis wire beyond which its label is shown.
88308
+ *
88309
+ * The axis wire's label is not shown when its length is less than this value.
88310
+ *
88311
+ * This is ````25```` pixels by default.
88312
+ *
88313
+ * Must not be less than ````1````.
88314
+ *
88315
+ * @type {number}
88316
+ */
88317
+ set labelMinAxisLength(labelMinAxisLength) {
88318
+ if (labelMinAxisLength < 1) {
88319
+ this.error("labelMinAxisLength must be >= 1; defaulting to 25");
88320
+ labelMinAxisLength = 25;
88321
+ }
88322
+ this._labelMinAxisLength = labelMinAxisLength || 25;
88323
+ }
88324
+
88325
+ /**
88326
+ * Gets the minimum length, in pixels, of an axis wire beyond which its label is shown.
88327
+ * @returns {number}
88328
+ */
88329
+ get labelMinAxisLength() {
88330
+ return this._labelMinAxisLength;
88331
+ }
88332
+
88333
+ /**
88334
+ * Sets whether the measurement added is rotation adjusted or not.
88335
+ *
88336
+ * @type {boolean}
88337
+ */
88338
+ set useRotationAdjustment(_useRotationAdjustment) {
88339
+ _useRotationAdjustment = _useRotationAdjustment !== undefined ? Boolean(_useRotationAdjustment) : false;
88340
+ this._useRotationAdjustment = _useRotationAdjustment;
88341
+ }
88342
+
88343
+ /**
88344
+ * Gets whether the measurement added is rotation adjusted or not.
88345
+ * @returns {number}
88346
+ */
88347
+ get useRotationAdjustment(){
88348
+ return this._useRotationAdjustment;
88349
+ }
88350
+ /**
88351
+ * Creates a {@link DistanceMeasurement}.
88352
+ *
88353
+ * The DistanceMeasurement is then registered by {@link DistanceMeasurement#id} in {@link DistanceMeasurementsPlugin#measurements}.
88354
+ *
88355
+ * @param {Object} params {@link DistanceMeasurement} configuration.
88356
+ * @param {String} params.id Unique ID to assign to {@link DistanceMeasurement#id}. The DistanceMeasurement will be registered by this in {@link DistanceMeasurementsPlugin#measurements} and {@link Scene.components}. Must be unique among all components in the {@link Viewer}.
88357
+ * @param {Number[]} params.origin.worldPos Origin World-space 3D position.
88358
+ * @param {Entity} params.origin.entity Origin Entity.
88359
+ * @param {Number[]} params.target.worldPos Target World-space 3D position.
88360
+ * @param {Entity} params.target.entity Target Entity.
88361
+ * @param {Boolean} [params.visible=true] Whether to initially show the {@link DistanceMeasurement}.
88362
+ * @param {Boolean} [params.originVisible=true] Whether to initially show the {@link DistanceMeasurement} origin.
88363
+ * @param {Boolean} [params.targetVisible=true] Whether to initially show the {@link DistanceMeasurement} target.
88364
+ * @param {Boolean} [params.wireVisible=true] Whether to initially show the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88365
+ * @param {Boolean} [params.axisVisible=true] Whether to initially show the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88366
+ * @param {Boolean} [params.xAxisVisible=true] Whether to initially show the X-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88367
+ * @param {Boolean} [params.yAxisVisible=true] Whether to initially show the Y-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88368
+ * @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
88369
+ * @param {Boolean} [params.xLabelEnabled=true] Whether to initially show the x label.
88370
+ * @param {Boolean} [params.yLabelEnabled=true] Whether to initially show the y label.
88371
+ * @param {Boolean} [params.zLabelEnabled=true] Whether to initially show the z label.
88372
+ * @param {Boolean} [params.lengthLabelEnabled=true] Whether to initially show the length label.
88373
+ * @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
88374
+ * @param {Boolean} [params.lengthLabelVisible=true] Whether to initially show the labels.
88375
+ * @param {string} [params.color] The color of the length dot, wire and label.
88376
+ * @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
88377
+ * @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
88378
+ */
88379
+ createMeasurement(params = {}) {
88380
+ if (this.viewer.scene.components[params.id]) {
88381
+ this.error(
88382
+ "Viewer scene component with this ID already exists: " + params.id
88383
+ );
88384
+ delete params.id;
88385
+ }
88386
+ const origin = params.origin;
88387
+ const target = params.target;
88388
+ const measurement = new DistanceMeasurement(this, {
88389
+ id: params.id,
88390
+ plugin: this,
88391
+ container: this._container,
88392
+ origin: {
88393
+ entity: origin.entity,
88394
+ worldPos: origin.worldPos,
88395
+ },
88396
+ target: {
88397
+ entity: target.entity,
88398
+ worldPos: target.worldPos,
88399
+ },
88400
+ visible: params.visible,
88401
+ wireVisible: params.wireVisible,
88402
+ axisVisible: params.axisVisible !== false && this.defaultAxisVisible !== false,
88403
+ xAxisVisible: params.xAxisVisible !== false && this.defaultXAxisVisible !== false,
88404
+ yAxisVisible: params.yAxisVisible !== false && this.defaultYAxisVisible !== false,
88405
+ zAxisVisibld: params.zAxisVisible !== false && this.defaultZAxisVisible !== false,
88406
+ xLabelEnabled: params.xLabelEnabled !== false && this.defaultXLabelEnabled !== false,
88407
+ yLabelEnabled: params.yLabelEnabled !== false && this.defaultYLabelEnabled !== false,
88408
+ zLabelEnabled: params.zLabelEnabled !== false && this.defaultZLabelEnabled !== false,
88409
+ lengthLabelEnabled: params.lengthLabelEnabled !== false && this.defaultLengthLabelEnabled !== false,
88410
+ labelsVisible: params.labelsVisible !== false && this.defaultLabelsVisible !== false,
88411
+ useRotationAdjustment: this.useRotationAdjustment,
88412
+ originVisible: params.originVisible,
88413
+ targetVisible: params.targetVisible,
88414
+ color: params.color,
88415
+ labelsOnWires:params.labelsOnWires !== false && this.defaultLabelsOnWires !== false,
88416
+ onMouseOver: this._onMouseOver,
88417
+ onMouseLeave: this._onMouseLeave,
88418
+ onContextMenu: this._onContextMenu,
88419
+ });
88420
+ this._measurements[measurement.id] = measurement;
88421
+ measurement.clickable = true;
88422
+ measurement.on("destroyed", () => {
88423
+ delete this._measurements[measurement.id];
88424
+ });
88425
+ this.fire("measurementCreated", measurement);
88426
+ return measurement;
88427
+ }
88428
+
88429
+ /**
88430
+ * Destroys a {@link DistanceMeasurement}.
88431
+ *
88432
+ * @param {String} id ID of DistanceMeasurement to destroy.
88433
+ */
88434
+ destroyMeasurement(id) {
88435
+ const measurement = this._measurements[id];
88436
+ if (!measurement) {
88437
+ this.log("DistanceMeasurement not found: " + id);
88438
+ return;
88423
88439
  }
88440
+ measurement.destroy();
88441
+ this.fire("measurementDestroyed", measurement);
88442
+ }
88424
88443
 
88425
- /**
88426
- * Shows all or hides the distance label of each {@link DistanceMeasurement}.
88427
- *
88428
- * @param {Boolean} labelsShown Whether or not to show the labels.
88429
- */
88430
- setLabelsShown(labelsShown) {
88431
- for (const [key, measurement] of Object.entries(this.measurements)) {
88432
- measurement.labelShown = labelsShown;
88433
- }
88444
+ /**
88445
+ * Shows all or hides the distance label of each {@link DistanceMeasurement}.
88446
+ *
88447
+ * @param {Boolean} labelsShown Whether or not to show the labels.
88448
+ */
88449
+ setLabelsShown(labelsShown) {
88450
+ for (const [key, measurement] of Object.entries(this.measurements)) {
88451
+ measurement.labelShown = labelsShown;
88434
88452
  }
88453
+ }
88435
88454
 
88436
- /**
88437
- * Shows all or hides the axis wires of each {@link DistanceMeasurement}.
88438
- *
88439
- * @param {Boolean} labelsShown Whether or not to show the axis wires.
88440
- */
88441
- setAxisVisible(axisVisible) {
88442
- for (const [key, measurement] of Object.entries(this.measurements)) {
88443
- measurement.axisVisible = axisVisible;
88444
- }
88445
- this.defaultAxisVisible = axisVisible;
88455
+ /**
88456
+ * Shows all or hides the axis wires of each {@link DistanceMeasurement}.
88457
+ *
88458
+ * @param {Boolean} labelsShown Whether or not to show the axis wires.
88459
+ */
88460
+ setAxisVisible(axisVisible) {
88461
+ for (const [key, measurement] of Object.entries(this.measurements)) {
88462
+ measurement.axisVisible = axisVisible;
88446
88463
  }
88464
+ this.defaultAxisVisible = axisVisible;
88465
+ }
88447
88466
 
88448
- /**
88449
- * Gets if the axis wires of each {@link DistanceMeasurement} are visible.
88450
- *
88451
- * @returns {Boolean} Whether or not the axis wires are visible.
88452
- */
88453
- getAxisVisible() {
88454
- return this.defaultAxisVisible;
88455
- }
88467
+ /**
88468
+ * Gets if the axis wires of each {@link DistanceMeasurement} are visible.
88469
+ *
88470
+ * @returns {Boolean} Whether or not the axis wires are visible.
88471
+ */
88472
+ getAxisVisible() {
88473
+ return this.defaultAxisVisible;
88474
+ }
88456
88475
 
88457
- /**
88458
- * Destroys all {@link DistanceMeasurement}s.
88459
- */
88460
- clear() {
88461
- const ids = Object.keys(this._measurements);
88462
- for (var i = 0, len = ids.length; i < len; i++) {
88463
- this.destroyMeasurement(ids[i]);
88464
- }
88476
+ /**
88477
+ * Destroys all {@link DistanceMeasurement}s.
88478
+ */
88479
+ clear() {
88480
+ const ids = Object.keys(this._measurements);
88481
+ for (var i = 0, len = ids.length; i < len; i++) {
88482
+ this.destroyMeasurement(ids[i]);
88465
88483
  }
88484
+ }
88466
88485
 
88467
- /**
88468
- * Destroys this DistanceMeasurementsPlugin.
88469
- *
88470
- * Destroys all {@link DistanceMeasurement}s first.
88471
- */
88472
- destroy() {
88473
- this.clear();
88474
- super.destroy();
88475
- }
88486
+ /**
88487
+ * Destroys this DistanceMeasurementsPlugin.
88488
+ *
88489
+ * Destroys all {@link DistanceMeasurement}s first.
88490
+ */
88491
+ destroy() {
88492
+ this.clear();
88493
+ super.destroy();
88494
+ }
88476
88495
  }
88477
88496
 
88478
88497
  const WAITING_FOR_ORIGIN_TOUCH_START = 0;
@@ -135459,7 +135478,7 @@ class LASLoaderPlugin extends Plugin {
135459
135478
  }
135460
135479
 
135461
135480
  function readIntensities(attributesIntensity) {
135462
- const intensities = attributesIntensity.intensity;
135481
+ const intensities = attributesIntensity.value;
135463
135482
  const colorsCompressedSize = intensities.length * 4;
135464
135483
  const colorsCompressed = new Uint8Array(colorsCompressedSize);
135465
135484
  for (let i = 0, j = 0, len = intensities.length; i < len; i++, j += 4) {
@@ -135644,7 +135663,7 @@ class LASLoaderPlugin extends Plugin {
135644
135663
 
135645
135664
  function chunkArray(array, chunkSize) {
135646
135665
  if (chunkSize >= array.length) {
135647
- return array;
135666
+ return [array];
135648
135667
  }
135649
135668
  let result = [];
135650
135669
  for (let i = 0; i < array.length; i += chunkSize) {
@@ -137229,7 +137248,7 @@ class DotBIMDefaultDataSource {
137229
137248
  * excludeTypes: ["IfcSpace"]
137230
137249
  * });
137231
137250
  * ````
137232
- *
137251
+ *
137233
137252
  * # Configuring initial IFC object appearances
137234
137253
  *
137235
137254
  * We can specify the custom initial appearance of loaded objects according to their IFC types.
@@ -137589,11 +137608,31 @@ class DotBIMLoaderPlugin extends Plugin {
137589
137608
  isObject: true
137590
137609
  });
137591
137610
 
137611
+ for (let infoKey in info) {
137612
+ let properties;
137613
+ if (infoKey.startsWith("IFC_Pset_")) {
137614
+ if (!properties) {
137615
+ properties = [];
137616
+ }
137617
+ properties.push({
137618
+ name: infoKey,
137619
+ value: info[infoKey]
137620
+ });
137621
+ }
137622
+ if (properties) {
137623
+ metaModelData.propertySets.push({
137624
+ id: objectId,
137625
+ properties
137626
+ });
137627
+ }
137628
+ }
137629
+
137592
137630
  metaModelData.metaObjects.push({
137593
137631
  id: objectId,
137594
137632
  name: info && info.Name && info.Name !== "None" ? info.Name : `${element.type} ${objectId}`,
137595
137633
  type: element.type,
137596
- parent: ifcBuildingStoryId
137634
+ parent: ifcBuildingStoryId,
137635
+ propertySetIds: [objectId]
137597
137636
  });
137598
137637
  }
137599
137638