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