@xeokit/xeokit-sdk 2.6.9 → 2.6.13

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.
Files changed (38) hide show
  1. package/dist/web-ifc.wasm +0 -0
  2. package/dist/xeokit-sdk.cjs.js +1164 -134
  3. package/dist/xeokit-sdk.es.js +1163 -135
  4. package/dist/xeokit-sdk.es5.js +521 -53
  5. package/dist/xeokit-sdk.min.cjs.js +5 -5
  6. package/dist/xeokit-sdk.min.es.js +5 -5
  7. package/dist/xeokit-sdk.min.es5.js +4 -4
  8. package/package.json +1 -1
  9. package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +10 -0
  10. package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +9 -0
  11. package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js +9 -0
  12. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +182 -42
  13. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +11 -0
  14. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +11 -0
  15. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +18 -1
  16. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js +15 -0
  17. package/src/plugins/DotBIMLoaderPlugin/DotBIMDefaultDataSource.js +29 -0
  18. package/src/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.js +536 -0
  19. package/src/plugins/DotBIMLoaderPlugin/index.js +2 -0
  20. package/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +74 -0
  21. package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +53 -58
  22. package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +59 -2
  23. package/src/plugins/index.js +2 -1
  24. package/src/plugins/lib/html/Dot.js +38 -6
  25. package/src/plugins/lib/html/Label.js +48 -7
  26. package/src/plugins/lib/html/Wire.js +38 -6
  27. package/src/viewer/Viewer.js +1 -1
  28. package/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +2 -2
  29. package/src/viewer/scene/marker/Marker.js +3 -3
  30. package/src/viewer/scene/model/SceneModel.js +17 -9
  31. package/src/viewer/utils/os.js +11 -0
  32. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts +7 -0
  33. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts +8 -0
  34. package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.d.ts +8 -0
  35. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.d.ts +70 -0
  36. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts +7 -0
  37. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.d.ts +8 -0
  38. package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.d.ts +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.9",
3
+ "version": "2.6.13",
4
4
  "description": "Web Programming Toolkit for 3D/2D BIM and AEC Graphics",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -72,6 +72,16 @@ export class AngleMeasurementsControl extends Component {
72
72
  reset() {
73
73
  }
74
74
 
75
+ /**
76
+ * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsControl, if any.
77
+ *
78
+ * @returns {null|AngleMeasurement}
79
+ * @abstract
80
+ */
81
+ get currentMeasurement() {
82
+ return null;
83
+ }
84
+
75
85
  /**
76
86
  * Destroys this AngleMeasurementsMouseControl.
77
87
  *
@@ -440,6 +440,15 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
440
440
  this._mouseState = MOUSE_FINDING_ORIGIN;
441
441
  }
442
442
 
443
+ /**
444
+ * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl, if any.
445
+ *
446
+ * @returns {null|AngleMeasurement}
447
+ */
448
+ get currentMeasurement() {
449
+ return this._currentAngleMeasurement;
450
+ }
451
+
443
452
  /**
444
453
  * Destroys this AngleMeasurementsMouseControl.
445
454
  */
@@ -908,6 +908,15 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
908
908
  }
909
909
  }
910
910
 
911
+ /**
912
+ * Gets the {@link AngleMeasurement} under construction by this AngleMeasurementsTouchControl, if any.
913
+ *
914
+ * @returns {null|AngleMeasurement}
915
+ */
916
+ get currentMeasurement() {
917
+ return this._currentAngleMeasurement;
918
+ }
919
+
911
920
  /**
912
921
  * Destroys this AngleMeasurementsTouchControl.
913
922
  */
@@ -14,6 +14,14 @@ const lengthWire = (x1, y1, x2, y2) => {
14
14
  return Math.sqrt(a * a + b * b);
15
15
  };
16
16
 
17
+ function determineMeasurementOrientation(A, B, distance) {
18
+ const yDiff = Math.abs(B[1] - A[1]);
19
+
20
+ return yDiff > distance ? 'Vertical' : 'Horizontal';
21
+ }
22
+
23
+ // function findDistance
24
+
17
25
  /**
18
26
  * @desc Measures the distance between two 3D points.
19
27
  *
@@ -42,17 +50,16 @@ class DistanceMeasurement extends Component {
42
50
  this._eventSubs = {};
43
51
 
44
52
  var scene = this.plugin.viewer.scene;
45
-
46
53
  this._originMarker = new Marker(scene, cfg.origin);
47
54
  this._targetMarker = new Marker(scene, cfg.target);
48
55
 
49
56
  this._originWorld = math.vec3();
50
57
  this._targetWorld = math.vec3();
51
58
 
52
- this._wp = new Float64Array(24);
53
- this._vp = new Float64Array(24);
59
+ this._wp = new Float64Array(24); //world position
60
+ this._vp = new Float64Array(24); //view position
54
61
  this._pp = new Float64Array(24);
55
- this._cp = new Float64Array(8);
62
+ this._cp = new Float64Array(8); //canvas position
56
63
 
57
64
  this._xAxisLabelCulled = false;
58
65
  this._yAxisLabelCulled = false;
@@ -226,6 +233,7 @@ class DistanceMeasurement extends Component {
226
233
  onContextMenu
227
234
  });
228
235
 
236
+ this._measurementOrientation = 'Horizontal';
229
237
  this._wpDirty = false;
230
238
  this._vpDirty = false;
231
239
  this._cpDirty = false;
@@ -240,18 +248,22 @@ class DistanceMeasurement extends Component {
240
248
  this._yAxisVisible = false;
241
249
  this._zAxisVisible = false;
242
250
  this._axisEnabled = true;
251
+ this._xLabelEnabled = false;
252
+ this._yLabelEnabled = false;
253
+ this._zLabelEnabled = false;
254
+ this._lengthLabelEnabled = false;
243
255
  this._labelsVisible = false;
244
256
  this._labelsOnWires = false;
245
257
  this._clickable = false;
246
258
 
247
259
  this._originMarker.on("worldPos", (value) => {
248
- this._originWorld.set(value || [0, 0, 0]);
260
+ this._originWorld.set(value || [0,0,0]);
249
261
  this._wpDirty = true;
250
262
  this._needUpdate(0); // No lag
251
263
  });
252
264
 
253
265
  this._targetMarker.on("worldPos", (value) => {
254
- this._targetWorld.set(value || [0, 0, 0]);
266
+ this._targetWorld.set(value || [0,0,0]);
255
267
  this._wpDirty = true;
256
268
  this._needUpdate(0); // No lag
257
269
  });
@@ -300,6 +312,10 @@ class DistanceMeasurement extends Component {
300
312
  this.xAxisVisible = cfg.xAxisVisible;
301
313
  this.yAxisVisible = cfg.yAxisVisible;
302
314
  this.zAxisVisible = cfg.zAxisVisible;
315
+ this.xLabelEnabled = cfg.xLabelEnabled;
316
+ this.yLabelEnabled = cfg.yLabelEnabled;
317
+ this.zLabelEnabled = cfg.zLabelEnabled;
318
+ this.lengthLabelEnabled = cfg.lengthLabelEnabled;
303
319
  this.labelsVisible = cfg.labelsVisible;
304
320
  this.labelsOnWires = cfg.labelsOnWires;
305
321
  }
@@ -314,25 +330,50 @@ class DistanceMeasurement extends Component {
314
330
 
315
331
  if (this._wpDirty) {
316
332
 
317
- this._wp[0] = this._originWorld[0];
318
- this._wp[1] = this._originWorld[1];
319
- this._wp[2] = this._originWorld[2];
320
- this._wp[3] = 1.0;
321
-
322
- this._wp[4] = this._targetWorld[0];
323
- this._wp[5] = this._originWorld[1];
324
- this._wp[6] = this._originWorld[2];
325
- this._wp[7] = 1.0;
326
-
327
- this._wp[8] = this._targetWorld[0];
328
- this._wp[9] = this._targetWorld[1];
329
- this._wp[10] = this._originWorld[2];
330
- this._wp[11] = 1.0;
331
-
332
- this._wp[12] = this._targetWorld[0];
333
- this._wp[13] = this._targetWorld[1];
334
- this._wp[14] = this._targetWorld[2];
335
- this._wp[15] = 1.0;
333
+ this._measurementOrientation = determineMeasurementOrientation(this._originWorld, this._targetWorld, 1);
334
+ if(this._measurementOrientation === 'Vertical'){
335
+ this._wp[0] = this._originWorld[0];
336
+ this._wp[1] = this._originWorld[1];
337
+ this._wp[2] = this._originWorld[2];
338
+ this._wp[3] = 1.0;
339
+
340
+ this._wp[4] = this._originWorld[0]; //x-axis
341
+ this._wp[5] = this._originWorld[1];
342
+ this._wp[6] = this._originWorld[2];
343
+ this._wp[7] = 1.0;
344
+
345
+ this._wp[8] = this._originWorld[0]; //x-axis
346
+ this._wp[9] = this._targetWorld[1]; //y-axis
347
+ this._wp[10] = this._originWorld[2];
348
+ this._wp[11] = 1.0;
349
+
350
+ this._wp[12] = this._targetWorld[0];
351
+ this._wp[13] = this._targetWorld[1];
352
+ this._wp[14] = this._targetWorld[2];
353
+ this._wp[15] = 1.0;
354
+ }
355
+ else {
356
+ this._wp[0] = this._originWorld[0];
357
+ this._wp[1] = this._originWorld[1];
358
+ this._wp[2] = this._originWorld[2];
359
+ this._wp[3] = 1.0;
360
+
361
+ this._wp[4] = this._targetWorld[0];
362
+ this._wp[5] = this._originWorld[1];
363
+ this._wp[6] = this._originWorld[2];
364
+ this._wp[7] = 1.0;
365
+
366
+ this._wp[8] = this._targetWorld[0];
367
+ this._wp[9] = this._targetWorld[1];
368
+ this._wp[10] = this._originWorld[2];
369
+ this._wp[11] = 1.0;
370
+
371
+ this._wp[12] = this._targetWorld[0];
372
+ this._wp[13] = this._targetWorld[1];
373
+ this._wp[14] = this._targetWorld[2];
374
+ this._wp[15] = 1.0;
375
+ }
376
+
336
377
 
337
378
  this._wpDirty = false;
338
379
  this._vpDirty = true;
@@ -503,7 +544,14 @@ class DistanceMeasurement extends Component {
503
544
  }
504
545
 
505
546
  if (!this._zAxisLabelCulled) {
506
- this._zAxisLabel.setText(tilde + Math.abs((this._targetWorld[2] - this._originWorld[2]) * scale).toFixed(2) + unitAbbrev);
547
+ if(this._measurementOrientation === 'Vertical') {
548
+ this._zAxisLabel.setPrefix("");
549
+ this._zAxisLabel.setText(tilde + Math.abs(math.lenVec3(math.subVec3(this._targetWorld, [this._originWorld[0], this._targetWorld[1], this._originWorld[2]], distVec3)) * scale).toFixed(2) + unitAbbrev);
550
+ }
551
+ else {
552
+ this._zAxisLabel.setPrefix("Z");
553
+ this._zAxisLabel.setText(tilde + Math.abs((this._targetWorld[2] - this._originWorld[2]) * scale).toFixed(2) + unitAbbrev);
554
+ }
507
555
  this._zAxisLabel.setCulled(!this.axisVisible);
508
556
  } else {
509
557
  this._zAxisLabel.setCulled(true);
@@ -623,7 +671,7 @@ class DistanceMeasurement extends Component {
623
671
  this._originDot.setVisible(this._visible && this._originVisible);
624
672
  this._targetDot.setVisible(this._visible && this._targetVisible);
625
673
  this._lengthWire.setVisible(this._visible && this._wireVisible);
626
- this._lengthLabel.setVisible(this._visible && this._wireVisible);
674
+ this._lengthLabel.setVisible(this._visible && this._wireVisible && this._lengthLabelEnabled);
627
675
 
628
676
  const xAxisVisible = this._visible && this._axisVisible && this._xAxisVisible;
629
677
  const yAxisVisible = this._visible && this._axisVisible && this._yAxisVisible;
@@ -633,9 +681,9 @@ class DistanceMeasurement extends Component {
633
681
  this._yAxisWire.setVisible(yAxisVisible);
634
682
  this._zAxisWire.setVisible(zAxisVisible);
635
683
 
636
- this._xAxisLabel.setVisible(xAxisVisible && !this._xAxisLabelCulled);
637
- this._yAxisLabel.setVisible(yAxisVisible && !this._yAxisLabelCulled);
638
- this._zAxisLabel.setVisible(zAxisVisible && !this._zAxisLabelCulled);
684
+ this._xAxisLabel.setVisible(xAxisVisible && !this._xAxisLabelCulled && this._EnabledVisible);
685
+ this._yAxisLabel.setVisible(yAxisVisible && !this._yAxisLabelCulled && this._yLabelEnabled);
686
+ this._zAxisLabel.setVisible(zAxisVisible && !this._zAxisLabelCulled && this._zLabelEnabled);
639
687
 
640
688
  this._cpDirty = true;
641
689
 
@@ -705,9 +753,9 @@ class DistanceMeasurement extends Component {
705
753
  this._xAxisWire.setVisible(axisVisible && this._xAxisVisible);
706
754
  this._yAxisWire.setVisible(axisVisible && this._yAxisVisible);
707
755
  this._zAxisWire.setVisible(axisVisible && this._zAxisVisible);
708
- this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled&& this._xAxisVisible);
709
- this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled&& this._xAxisVisible);
710
- this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled&& this._xAxisVisible);
756
+ this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled&& this._xAxisVisible && this._xLabelEnabled);
757
+ this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled&& this._xAxisVisible && this._yLabelEnabled);
758
+ this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled&& this._xAxisVisible && this._zLabelEnabled);
711
759
  this._cpDirty = true;
712
760
  this._needUpdate();
713
761
  }
@@ -767,7 +815,7 @@ class DistanceMeasurement extends Component {
767
815
  this._xAxisVisible = value;
768
816
  const axisVisible = this._visible && this._axisVisible && this._xAxisVisible && this._axisEnabled;
769
817
  this._xAxisWire.setVisible(axisVisible);
770
- this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
818
+ this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled && this._xLabelEnabled);
771
819
  this._cpDirty = true;
772
820
  this._needUpdate();
773
821
  }
@@ -795,7 +843,7 @@ class DistanceMeasurement extends Component {
795
843
  this._yAxisVisible = value;
796
844
  const axisVisible = this._visible && this._axisVisible && this._yAxisVisible && this._axisEnabled;
797
845
  this._yAxisWire.setVisible(axisVisible);
798
- this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
846
+ this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled && this._yLabelEnabled);
799
847
  this._cpDirty = true;
800
848
  this._needUpdate();
801
849
  }
@@ -823,7 +871,7 @@ class DistanceMeasurement extends Component {
823
871
  this._zAxisVisible = value;
824
872
  const axisVisible = this._visible && this._axisVisible && this._zAxisVisible && this._axisEnabled;
825
873
  this._zAxisWire.setVisible(axisVisible);
826
- this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
874
+ this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled && this._zLabelEnabled);
827
875
  this._cpDirty = true;
828
876
  this._needUpdate();
829
877
  }
@@ -848,7 +896,7 @@ class DistanceMeasurement extends Component {
848
896
  value = value !== undefined ? Boolean(value) : this.plugin.defaultWireVisible;
849
897
  this._wireVisible = value;
850
898
  var wireVisible = this._visible && this._wireVisible;
851
- this._lengthLabel.setVisible(wireVisible);
899
+ this._lengthLabel.setVisible(wireVisible && this._lengthLabelEnabled);
852
900
  this._lengthWire.setVisible(wireVisible);
853
901
  }
854
902
 
@@ -862,7 +910,7 @@ class DistanceMeasurement extends Component {
862
910
  }
863
911
 
864
912
  /**
865
- * Sets if the labels are visible.
913
+ * Sets if the labels are visible except the length label.
866
914
  *
867
915
  * @type {Boolean}
868
916
  */
@@ -870,10 +918,10 @@ class DistanceMeasurement extends Component {
870
918
  value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsVisible;
871
919
  this._labelsVisible = value;
872
920
  var labelsVisible = this._visible && this._labelsVisible;
873
- this._xAxisLabel.setVisible(labelsVisible && !this._xAxisLabelCulled && this._clickable && this._axisEnabled);
874
- this._yAxisLabel.setVisible(labelsVisible && !this._yAxisLabelCulled && this._clickable && this._axisEnabled);
875
- this._zAxisLabel.setVisible(labelsVisible && !this._zAxisLabelCulled && this._clickable && this._axisEnabled);
876
- this._lengthLabel.setVisible(labelsVisible);
921
+ this._xAxisLabel.setVisible(labelsVisible && !this._xAxisLabelCulled && this._clickable && this._axisEnabled && this._xLabelEnabled);
922
+ this._yAxisLabel.setVisible(labelsVisible && !this._yAxisLabelCulled && this._clickable && this._axisEnabled && this._yLabelEnabled);
923
+ this._zAxisLabel.setVisible(labelsVisible && !this._zAxisLabelCulled && this._clickable && this._axisEnabled && this._zLabelEnabled);
924
+ this._lengthLabel.setVisible(labelsVisible && this._lengthLabelEnabled);
877
925
  this._cpDirty = true;
878
926
  this._needUpdate();
879
927
  }
@@ -887,6 +935,98 @@ class DistanceMeasurement extends Component {
887
935
  return this._labelsVisible;
888
936
  }
889
937
 
938
+ /**
939
+ * Sets if the x label is enabled.
940
+ *
941
+ * @type {Boolean}
942
+ */
943
+ set xLabelEnabled(value) {
944
+ value = value !== undefined ? Boolean(value) : this.plugin.defaultXLabelEnabled;
945
+ this._xLabelEnabled = value;
946
+ var labelsVisible = this._visible && this._labelsVisible;
947
+ this._xAxisLabel.setVisible(labelsVisible && !this._xAxisLabelCulled && this._clickable && this._axisEnabled && this._xLabelEnabled);
948
+ this._cpDirty = true;
949
+ this._needUpdate();
950
+ }
951
+
952
+ /**
953
+ * Gets if the x label is enabled.
954
+ *
955
+ * @type {Boolean}
956
+ */
957
+ get xLabelEnabled(){
958
+ return this._xLabelEnabled;
959
+ }
960
+
961
+ /**
962
+ * Sets if the y label is enabled.
963
+ *
964
+ * @type {Boolean}
965
+ */
966
+ set yLabelEnabled(value) {
967
+ value = value !== undefined ? Boolean(value) : this.plugin.defaultYLabelEnabled;
968
+ this._yLabelEnabled = value;
969
+ var labelsVisible = this._visible && this._labelsVisible;
970
+ this._yAxisLabel.setVisible(labelsVisible && !this._yAxisLabelCulled && this._clickable && this._axisEnabled && this._yLabelEnabled);
971
+ this._cpDirty = true;
972
+ this._needUpdate();
973
+ }
974
+
975
+ /**
976
+ * Gets if the y label is enabled.
977
+ *
978
+ * @type {Boolean}
979
+ */
980
+ get yLabelEnabled(){
981
+ return this._yLabelEnabled;
982
+ }
983
+
984
+ /**
985
+ * Sets if the z label is enabled.
986
+ *
987
+ * @type {Boolean}
988
+ */
989
+ set zLabelEnabled(value) {
990
+ value = value !== undefined ? Boolean(value) : this.plugin.defaultZLabelEnabled;
991
+ this._zLabelEnabled = value;
992
+ var labelsVisible = this._visible && this._labelsVisible;
993
+ this._zAxisLabel.setVisible(labelsVisible && !this._zAxisLabelCulled && this._clickable && this._axisEnabled && this._zLabelEnabled);
994
+ this._cpDirty = true;
995
+ this._needUpdate();
996
+ }
997
+
998
+ /**
999
+ * Gets if the z label is enabled.
1000
+ *
1001
+ * @type {Boolean}
1002
+ */
1003
+ get zLabelEnabled(){
1004
+ return this._zLabelEnabled;
1005
+ }
1006
+
1007
+ /**
1008
+ * Sets if the length label is enabled.
1009
+ *
1010
+ * @type {Boolean}
1011
+ */
1012
+ set lengthLabelEnabled(value) {
1013
+ value = value !== undefined ? Boolean(value) : this.plugin.defaultLengthLabelEnabled;
1014
+ this._lengthLabelEnabled = value;
1015
+ var labelsVisible = this._visible && this._labelsVisible;
1016
+ this._lengthLabel.setVisible(labelsVisible && !this._lengthAxisLabelCulled && this._clickable && this._axisEnabled && this._lengthLabelEnabled);
1017
+ this._cpDirty = true;
1018
+ this._needUpdate();
1019
+ }
1020
+
1021
+ /**
1022
+ * Gets if the length label is enabled.
1023
+ *
1024
+ * @type {Boolean}
1025
+ */
1026
+ get lengthLabelEnabled(){
1027
+ return this._lengthLabelEnabled;
1028
+ }
1029
+
890
1030
  /**
891
1031
  * Sets if labels should be positioned on the wires.
892
1032
  *
@@ -72,6 +72,17 @@ export class DistanceMeasurementsControl extends Component {
72
72
  reset() {
73
73
  }
74
74
 
75
+ /**
76
+ * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl, if any.
77
+ *
78
+ * @returns {null|DistanceMeasurement}
79
+ *
80
+ * @abstract
81
+ */
82
+ get currentMeasurement() {
83
+ return null;
84
+ }
85
+
75
86
  /**
76
87
  * Destroys this DistanceMeasurementsControl.
77
88
  *
@@ -397,6 +397,17 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
397
397
  this._currentDistanceMeasurement.destroy();
398
398
  this._currentDistanceMeasurement = null;
399
399
  }
400
+
401
+ this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;
402
+ }
403
+
404
+ /**
405
+ * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl, if any.
406
+ *
407
+ * @returns {null|DistanceMeasurement}
408
+ */
409
+ get currentMeasurement() {
410
+ return this._currentDistanceMeasurement;
400
411
  }
401
412
 
402
413
  /**
@@ -276,6 +276,10 @@ class DistanceMeasurementsPlugin extends Plugin {
276
276
  * @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
277
277
  * @param {boolean} [cfg.defaultWireVisible=true] The default value of the DistanceMeasurements `wireVisible` property.
278
278
  * @param {boolean} [cfg.defaultLabelsVisible=true] The default value of the DistanceMeasurements `labelsVisible` property.
279
+ * @param {boolean} [cfg.defaultXLabelEnabled=true] The default value of the DistanceMeasurements `xLabelEnabled` property.
280
+ * @param {boolean} [cfg.defaultYLabelEnabled=true] The default value of the DistanceMeasurements `yLabelEnabled` property.
281
+ * @param {boolean} [cfg.defaultZLabelEnabled=true] The default value of the DistanceMeasurements `zLabelEnabled` property.
282
+ * @param {boolean} [cfg.defaultLengthLabelEnabled=true] The default value of the DistanceMeasurements `lengthLabelEnabled` property.
279
283
  * @param {boolean} [cfg.defaultAxisVisible=true] The default value of the DistanceMeasurements `axisVisible` property.
280
284
  * @param {boolean} [cfg.defaultXAxisVisible=true] The default value of the DistanceMeasurements `xAxisVisible` property.
281
285
  * @param {boolean} [cfg.defaultYAxisVisible=true] The default value of the DistanceMeasurements `yAxisVisible` property.
@@ -298,11 +302,14 @@ class DistanceMeasurementsPlugin extends Plugin {
298
302
  this._measurements = {};
299
303
 
300
304
  this.labelMinAxisLength = cfg.labelMinAxisLength;
301
-
302
305
  this.defaultVisible = cfg.defaultVisible !== false;
303
306
  this.defaultOriginVisible = cfg.defaultOriginVisible !== false;
304
307
  this.defaultTargetVisible = cfg.defaultTargetVisible !== false;
305
308
  this.defaultWireVisible = cfg.defaultWireVisible !== false;
309
+ this.defaultXLabelEnabled = cfg.defaultXLabelEnabled !== false;
310
+ this.defaultYLabelEnabled = cfg.defaultYLabelEnabled !== false;
311
+ this.defaultZLabelEnabled = cfg.defaultZLabelEnabled !== false;
312
+ this.defaultLengthLabelEnabled = cfg.defaultLengthLabelEnabled !== false;
306
313
  this.defaultLabelsVisible = cfg.defaultLabelsVisible !== false;
307
314
  this.defaultAxisVisible = cfg.defaultAxisVisible !== false;
308
315
  this.defaultXAxisVisible = cfg.defaultXAxisVisible !== false;
@@ -431,7 +438,12 @@ class DistanceMeasurementsPlugin extends Plugin {
431
438
  * @param {Boolean} [params.xAxisVisible=true] Whether to initially show the X-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
432
439
  * @param {Boolean} [params.yAxisVisible=true] Whether to initially show the Y-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
433
440
  * @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
441
+ * @param {Boolean} [params.xLabelEnabled=true] Whether to initially show the x label.
442
+ * @param {Boolean} [params.yLabelEnabled=true] Whether to initially show the y label.
443
+ * @param {Boolean} [params.zLabelEnabled=true] Whether to initially show the z label.
444
+ * @param {Boolean} [params.lengthLabelEnabled=true] Whether to initially show the length label.
434
445
  * @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
446
+ * @param {Boolean} [params.lengthLabelVisible=true] Whether to initially show the labels.
435
447
  * @param {string} [params.color] The color of the length dot, wire and label.
436
448
  * @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
437
449
  * @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
@@ -461,6 +473,10 @@ class DistanceMeasurementsPlugin extends Plugin {
461
473
  xAxisVisible: params.xAxisVisible !== false && this.defaultXAxisVisible !== false,
462
474
  yAxisVisible: params.yAxisVisible !== false && this.defaultYAxisVisible !== false,
463
475
  zAxisVisible: params.zAxisVisible !== false && this.defaultZAxisVisible !== false,
476
+ xLabelEnabled: params.xLabelEnabled !== false && this.defaultXLabelEnabled !== false,
477
+ yLabelEnabled: params.yLabelEnabled !== false && this.defaultYLabelEnabled !== false,
478
+ zLabelEnabled: params.zLabelEnabled !== false && this.defaultZLabelEnabled !== false,
479
+ lengthLabelEnabled: params.lengthLabelEnabled !== false && this.defaultLengthLabelEnabled !== false,
464
480
  labelsVisible: params.labelsVisible !== false && this.defaultLabelsVisible !== false,
465
481
  originVisible: params.originVisible,
466
482
  targetVisible: params.targetVisible,
@@ -471,6 +487,7 @@ class DistanceMeasurementsPlugin extends Plugin {
471
487
  onContextMenu: this._onContextMenu
472
488
  });
473
489
  this._measurements[measurement.id] = measurement;
490
+ measurement.clickable = true;
474
491
  measurement.on("destroyed", () => {
475
492
  delete this._measurements[measurement.id];
476
493
  });
@@ -666,6 +666,10 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
666
666
  this._currentDistanceMeasurement.targetVisible = true;
667
667
  this._currentDistanceMeasurement.wireVisible = true;
668
668
  this._currentDistanceMeasurement.labelsVisible = true;
669
+ this._currentDistanceMeasurement.xAxisVisible = true;
670
+ this._currentDistanceMeasurement.yAxisVisible = true;
671
+ this._currentDistanceMeasurement.zAxisVisible = true;
672
+ this._currentDistanceMeasurement.clickable = true;
669
673
  this.distanceMeasurementsPlugin.fire("measurementEnd", this._currentDistanceMeasurement);
670
674
  this._currentDistanceMeasurement = null;
671
675
  } else {
@@ -681,6 +685,7 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
681
685
  break;
682
686
 
683
687
  case WAITING_FOR_TARGET_LONG_TOUCH_END:
688
+ console.log('long touch');
684
689
  if (this.pointerLens) {
685
690
  this.pointerLens.visible = false;
686
691
  }
@@ -748,6 +753,16 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
748
753
  this._currentDistanceMeasurement.destroy();
749
754
  this._currentDistanceMeasurement = null;
750
755
  }
756
+ this._mouseState = WAITING_FOR_ORIGIN_TOUCH_START;
757
+ }
758
+
759
+ /**
760
+ * Gets the {@link DistanceMeasurement} under construction by this DistanceMeasurementsTouchControl, if any.
761
+ *
762
+ * @returns {null|DistanceMeasurement}
763
+ */
764
+ get currentMeasurement() {
765
+ return this._currentDistanceMeasurement;
751
766
  }
752
767
 
753
768
  /**
@@ -0,0 +1,29 @@
1
+ import {utils} from "../../viewer/scene/utils.js";
2
+
3
+ /**
4
+ * Default data access strategy for {@link DotBIMLoaderPlugin}.
5
+ *
6
+ * This just loads assets using XMLHttpRequest.
7
+ */
8
+ export class DotBIMDefaultDataSource {
9
+
10
+ constructor() {
11
+ }
12
+
13
+ /**
14
+ * Gets .BIM JSON.
15
+ *
16
+ * @param {String|Number} dotBIMSrc Identifies the .BIM JSON asset.
17
+ * @param {Function} ok Fired on successful loading of the .BIM JSON asset.
18
+ * @param {Function} error Fired on error while loading the .BIM JSON asset.
19
+ */
20
+ getDotBIM(dotBIMSrc, ok, error) {
21
+ utils.loadJSON(dotBIMSrc,
22
+ (json) => {
23
+ ok(json);
24
+ },
25
+ function (errMsg) {
26
+ error(errMsg);
27
+ });
28
+ }
29
+ }