@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.
@@ -19303,7 +19303,7 @@ _this84._xAxisLabelCulled=false;_this84._yAxisLabelCulled=false;_this84._zAxisLa
19303
19303
  });_this84._targetMarker.on("worldPos",function(value){_this84._targetWorld.set(value||[0,0,0]);_this84._wpDirty=true;_this84._needUpdate(0);// No lag
19304
19304
  });_this84._onViewMatrix=scene.camera.on("viewMatrix",function(){_this84._vpDirty=true;_this84._needUpdate(0);// No lag
19305
19305
  });_this84._onProjMatrix=scene.camera.on("projMatrix",function(){_this84._cpDirty=true;_this84._needUpdate();});_this84._onCanvasBoundary=scene.canvas.on("boundary",function(){_this84._cpDirty=true;_this84._needUpdate(0);// No lag
19306
- });_this84._onMetricsUnits=scene.metrics.on("units",function(){_this84._cpDirty=true;_this84._needUpdate();});_this84._onMetricsScale=scene.metrics.on("scale",function(){_this84._cpDirty=true;_this84._needUpdate();});_this84._onMetricsOrigin=scene.metrics.on("origin",function(){_this84._cpDirty=true;_this84._needUpdate();});_this84._onSectionPlaneUpdated=scene.on("sectionPlaneUpdated",function(){_this84._sectionPlanesDirty=true;_this84._needUpdate();});_this84.approximate=cfg.approximate;_this84.visible=cfg.visible;_this84.originVisible=cfg.originVisible;_this84.targetVisible=cfg.targetVisible;_this84.wireVisible=cfg.wireVisible;_this84.axisVisible=cfg.axisVisible;_this84.xAxisVisible=cfg.xAxisVisible;_this84.yAxisVisible=cfg.yAxisVisible;_this84.zAxisVisible=cfg.zAxisVisible;_this84.xLabelEnabled=cfg.xLabelEnabled;_this84.yLabelEnabled=cfg.yLabelEnabled;_this84.zLabelEnabled=cfg.zLabelEnabled;_this84.lengthLabelEnabled=cfg.lengthLabelEnabled;_this84.labelsVisible=cfg.labelsVisible;_this84.labelsOnWires=cfg.labelsOnWires;return _this84;}_createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){this._measurementOrientation=determineMeasurementOrientation(this._originWorld,this._targetWorld,1);if(this._measurementOrientation==='Vertical'){this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._originWorld[0];//x-axis
19306
+ });_this84._onMetricsUnits=scene.metrics.on("units",function(){_this84._cpDirty=true;_this84._needUpdate();});_this84._onMetricsScale=scene.metrics.on("scale",function(){_this84._cpDirty=true;_this84._needUpdate();});_this84._onMetricsOrigin=scene.metrics.on("origin",function(){_this84._cpDirty=true;_this84._needUpdate();});_this84._onSectionPlaneUpdated=scene.on("sectionPlaneUpdated",function(){_this84._sectionPlanesDirty=true;_this84._needUpdate();});_this84.approximate=cfg.approximate;_this84.visible=cfg.visible;_this84.originVisible=cfg.originVisible;_this84.targetVisible=cfg.targetVisible;_this84.wireVisible=cfg.wireVisible;_this84.axisVisible=cfg.axisVisible;_this84.xAxisVisible=cfg.xAxisVisible;_this84.yAxisVisible=cfg.yAxisVisible;_this84.zAxisVisible=cfg.zAxisVisible;_this84.xLabelEnabled=cfg.xLabelEnabled;_this84.yLabelEnabled=cfg.yLabelEnabled;_this84.zLabelEnabled=cfg.zLabelEnabled;_this84.lengthLabelEnabled=cfg.lengthLabelEnabled;_this84.labelsVisible=cfg.labelsVisible;_this84.labelsOnWires=cfg.labelsOnWires;_this84.useRotationAdjustment=cfg.useRotationAdjustment;return _this84;}_createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){this._measurementOrientation=determineMeasurementOrientation(this._originWorld,this._targetWorld,1);if(this._measurementOrientation==='Vertical'&&this.useRotationAdjustment){this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._originWorld[0];//x-axis
19307
19307
  this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._originWorld[0];//x-axis
19308
19308
  this._wp[9]=this._targetWorld[1];//y-axis
19309
19309
  this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;}else{this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._targetWorld[0];this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._targetWorld[0];this._wp[9]=this._targetWorld[1];this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;}this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}if(this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld)){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setCulled(true);this._yAxisWire.setCulled(true);this._zAxisWire.setCulled(true);this._lengthWire.setCulled(true);this._originDot.setCulled(true);this._targetDot.setCulled(true);return;}else{this._xAxisLabel.setCulled(false);this._yAxisLabel.setCulled(false);this._zAxisLabel.setCulled(false);this._lengthLabel.setCulled(false);this._xAxisWire.setCulled(false);this._yAxisWire.setCulled(false);this._zAxisWire.setCulled(false);this._lengthWire.setCulled(false);this._originDot.setCulled(false);this._targetDot.setCulled(false);}this._sectionPlanesDirty=true;}var near=-0.3;var vpz1=this._originMarker.viewPos[2];var vpz2=this._targetMarker.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale5=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._originDot.setPos(cp[0],cp[1]);this._targetDot.setPos(cp[6],cp[7]);this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);if(this.labelsOnWires){this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);}else{var labelOffset=35;var currentLabelOffset=labelOffset;this._xAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._yAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._zAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);}var tilde=this._approximate?" ~ ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale5).toFixed(2)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;if(this.labelsOnWires){this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;}else{this._xAxisLabelCulled=false;this._yAxisLabelCulled=false;this._zAxisLabelCulled=false;}if(!this._xAxisLabelCulled){this._xAxisLabel.setText(tilde+Math.abs((this._targetWorld[0]-this._originWorld[0])*_scale5).toFixed(2)+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yAxisLabel.setText(tilde+Math.abs((this._targetWorld[1]-this._originWorld[1])*_scale5).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){if(this._measurementOrientation==='Vertical'){this._zAxisLabel.setPrefix("");this._zAxisLabel.setText(tilde+Math.abs(math.lenVec3(math.subVec3(this._targetWorld,[this._originWorld[0],this._targetWorld[1],this._originWorld[2]],distVec3))*_scale5).toFixed(2)+unitAbbrev);}else{this._zAxisLabel.setPrefix("Z");this._zAxisLabel.setText(tilde+Math.abs((this._targetWorld[2]-this._originWorld[2])*_scale5).toFixed(2)+unitAbbrev);}this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
@@ -19891,110 +19891,118 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
19891
19891
  * distanceMeasurementsTouchControl.activate();
19892
19892
  * ````
19893
19893
  */var DistanceMeasurementsPlugin=/*#__PURE__*/function(_Plugin5){_inherits(DistanceMeasurementsPlugin,_Plugin5);var _super120=_createSuper(DistanceMeasurementsPlugin);/**
19894
- * @constructor
19895
- * @param {Viewer} viewer The Viewer.
19896
- * @param {Object} [cfg] Plugin configuration.
19897
- * @param {String} [cfg.id="DistanceMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
19898
- * @param {Number} [cfg.labelMinAxisLength=25] The minimum length, in pixels, of an axis wire beyond which its label is shown.
19899
- * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.
19900
- * @param {boolean} [cfg.defaultVisible=true] The default value of the DistanceMeasurements `visible` property.
19901
- * @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
19902
- * @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
19903
- * @param {boolean} [cfg.defaultWireVisible=true] The default value of the DistanceMeasurements `wireVisible` property.
19904
- * @param {boolean} [cfg.defaultLabelsVisible=true] The default value of the DistanceMeasurements `labelsVisible` property.
19905
- * @param {boolean} [cfg.defaultXLabelEnabled=true] The default value of the DistanceMeasurements `xLabelEnabled` property.
19906
- * @param {boolean} [cfg.defaultYLabelEnabled=true] The default value of the DistanceMeasurements `yLabelEnabled` property.
19907
- * @param {boolean} [cfg.defaultZLabelEnabled=true] The default value of the DistanceMeasurements `zLabelEnabled` property.
19908
- * @param {boolean} [cfg.defaultLengthLabelEnabled=true] The default value of the DistanceMeasurements `lengthLabelEnabled` property.
19909
- * @param {boolean} [cfg.defaultAxisVisible=true] The default value of the DistanceMeasurements `axisVisible` property.
19910
- * @param {boolean} [cfg.defaultXAxisVisible=true] The default value of the DistanceMeasurements `xAxisVisible` property.
19911
- * @param {boolean} [cfg.defaultYAxisVisible=true] The default value of the DistanceMeasurements `yAxisVisible` property.
19912
- * @param {boolean} [cfg.defaultZAxisVisible=true] The default value of the DistanceMeasurements `zAxisVisible` property.
19913
- * @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
19914
- * @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
19915
- * @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.
19916
- * @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
19917
- */function DistanceMeasurementsPlugin(viewer){var _this87;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsPlugin);_this87=_super120.call(this,"DistanceMeasurements",viewer);_this87._pointerLens=cfg.pointerLens;_this87._container=cfg.container||document.body;_this87._defaultControl=null;_this87._measurements={};_this87.labelMinAxisLength=cfg.labelMinAxisLength;_this87.defaultVisible=cfg.defaultVisible!==false;_this87.defaultOriginVisible=cfg.defaultOriginVisible!==false;_this87.defaultTargetVisible=cfg.defaultTargetVisible!==false;_this87.defaultWireVisible=cfg.defaultWireVisible!==false;_this87.defaultXLabelEnabled=cfg.defaultXLabelEnabled!==false;_this87.defaultYLabelEnabled=cfg.defaultYLabelEnabled!==false;_this87.defaultZLabelEnabled=cfg.defaultZLabelEnabled!==false;_this87.defaultLengthLabelEnabled=cfg.defaultLengthLabelEnabled!==false;_this87.defaultLabelsVisible=cfg.defaultLabelsVisible!==false;_this87.defaultAxisVisible=cfg.defaultAxisVisible!==false;_this87.defaultXAxisVisible=cfg.defaultXAxisVisible!==false;_this87.defaultYAxisVisible=cfg.defaultYAxisVisible!==false;_this87.defaultZAxisVisible=cfg.defaultZAxisVisible!==false;_this87.defaultColor=cfg.defaultColor!==undefined?cfg.defaultColor:"#00BBFF";_this87.zIndex=cfg.zIndex||10000;_this87.defaultLabelsOnWires=cfg.defaultLabelsOnWires!==false;_this87._onMouseOver=function(event,measurement){_this87.fire("mouseOver",{plugin:_assertThisInitialized(_this87),distanceMeasurement:measurement,measurement:measurement,event:event});};_this87._onMouseLeave=function(event,measurement){_this87.fire("mouseLeave",{plugin:_assertThisInitialized(_this87),distanceMeasurement:measurement,measurement:measurement,event:event});};_this87._onContextMenu=function(event,measurement){_this87.fire("contextMenu",{plugin:_assertThisInitialized(_this87),distanceMeasurement:measurement,measurement:measurement,event:event});};return _this87;}/**
19918
- * Gets the plugin's HTML container element, if any.
19919
- * @returns {*|HTMLElement|HTMLElement}
19920
- */_createClass(DistanceMeasurementsPlugin,[{key:"getContainerElement",value:function getContainerElement(){return this._container;}/**
19921
- * @private
19922
- */},{key:"send",value:function send(name,value){}/**
19923
- * Gets the PointerLens attached to this DistanceMeasurementsPlugin.
19924
- * @returns {PointerCircle}
19925
- */},{key:"pointerLens",get:function get(){return this._pointerLens;}/**
19926
- * Gets the default {@link DistanceMeasurementsControl}.
19927
- *
19928
- * @type {DistanceMeasurementsControl}
19929
- * @deprecated
19930
- */},{key:"control",get:function get(){if(!this._defaultControl){this._defaultControl=new DistanceMeasurementsMouseControl(this,{});}return this._defaultControl;}/**
19931
- * Gets the existing {@link DistanceMeasurement}s, each mapped to its {@link DistanceMeasurement#id}.
19932
- *
19933
- * @type {{String:DistanceMeasurement}}
19934
- */},{key:"measurements",get:function get(){return this._measurements;}/**
19935
- * Sets the minimum length, in pixels, of an axis wire beyond which its label is shown.
19936
- *
19937
- * The axis wire's label is not shown when its length is less than this value.
19938
- *
19939
- * This is ````25```` pixels by default.
19940
- *
19941
- * Must not be less than ````1````.
19942
- *
19943
- * @type {number}
19944
- */},{key:"labelMinAxisLength",get:/**
19945
- * Gets the minimum length, in pixels, of an axis wire beyond which its label is shown.
19946
- * @returns {number}
19947
- */function get(){return this._labelMinAxisLength;}/**
19948
- * Creates a {@link DistanceMeasurement}.
19949
- *
19950
- * The DistanceMeasurement is then registered by {@link DistanceMeasurement#id} in {@link DistanceMeasurementsPlugin#measurements}.
19951
- *
19952
- * @param {Object} params {@link DistanceMeasurement} configuration.
19953
- * @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}.
19954
- * @param {Number[]} params.origin.worldPos Origin World-space 3D position.
19955
- * @param {Entity} params.origin.entity Origin Entity.
19956
- * @param {Number[]} params.target.worldPos Target World-space 3D position.
19957
- * @param {Entity} params.target.entity Target Entity.
19958
- * @param {Boolean} [params.visible=true] Whether to initially show the {@link DistanceMeasurement}.
19959
- * @param {Boolean} [params.originVisible=true] Whether to initially show the {@link DistanceMeasurement} origin.
19960
- * @param {Boolean} [params.targetVisible=true] Whether to initially show the {@link DistanceMeasurement} target.
19961
- * @param {Boolean} [params.wireVisible=true] Whether to initially show the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
19962
- * @param {Boolean} [params.axisVisible=true] Whether to initially show the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
19963
- * @param {Boolean} [params.xAxisVisible=true] Whether to initially show the X-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
19964
- * @param {Boolean} [params.yAxisVisible=true] Whether to initially show the Y-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
19965
- * @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
19966
- * @param {Boolean} [params.xLabelEnabled=true] Whether to initially show the x label.
19967
- * @param {Boolean} [params.yLabelEnabled=true] Whether to initially show the y label.
19968
- * @param {Boolean} [params.zLabelEnabled=true] Whether to initially show the z label.
19969
- * @param {Boolean} [params.lengthLabelEnabled=true] Whether to initially show the length label.
19970
- * @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
19971
- * @param {Boolean} [params.lengthLabelVisible=true] Whether to initially show the labels.
19972
- * @param {string} [params.color] The color of the length dot, wire and label.
19973
- * @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
19974
- * @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
19975
- */,set:function set(labelMinAxisLength){if(labelMinAxisLength<1){this.error("labelMinAxisLength must be >= 1; defaulting to 25");labelMinAxisLength=25;}this._labelMinAxisLength=labelMinAxisLength||25;}},{key:"createMeasurement",value:function createMeasurement(){var _this88=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(this.viewer.scene.components[params.id]){this.error("Viewer scene component with this ID already exists: "+params.id);delete params.id;}var origin=params.origin;var target=params.target;var measurement=new DistanceMeasurement(this,{id:params.id,plugin:this,container:this._container,origin:{entity:origin.entity,worldPos:origin.worldPos},target:{entity:target.entity,worldPos:target.worldPos},visible:params.visible,wireVisible:params.wireVisible,axisVisible:params.axisVisible!==false&&this.defaultAxisVisible!==false,xAxisVisible:params.xAxisVisible!==false&&this.defaultXAxisVisible!==false,yAxisVisible:params.yAxisVisible!==false&&this.defaultYAxisVisible!==false,zAxisVisible:params.zAxisVisible!==false&&this.defaultZAxisVisible!==false,xLabelEnabled:params.xLabelEnabled!==false&&this.defaultXLabelEnabled!==false,yLabelEnabled:params.yLabelEnabled!==false&&this.defaultYLabelEnabled!==false,zLabelEnabled:params.zLabelEnabled!==false&&this.defaultZLabelEnabled!==false,lengthLabelEnabled:params.lengthLabelEnabled!==false&&this.defaultLengthLabelEnabled!==false,labelsVisible:params.labelsVisible!==false&&this.defaultLabelsVisible!==false,originVisible:params.originVisible,targetVisible:params.targetVisible,color:params.color,labelsOnWires:params.labelsOnWires!==false&&this.defaultLabelsOnWires!==false,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});this._measurements[measurement.id]=measurement;measurement.clickable=true;measurement.on("destroyed",function(){delete _this88._measurements[measurement.id];});this.fire("measurementCreated",measurement);return measurement;}/**
19976
- * Destroys a {@link DistanceMeasurement}.
19977
- *
19978
- * @param {String} id ID of DistanceMeasurement to destroy.
19979
- */},{key:"destroyMeasurement",value:function destroyMeasurement(id){var measurement=this._measurements[id];if(!measurement){this.log("DistanceMeasurement not found: "+id);return;}measurement.destroy();this.fire("measurementDestroyed",measurement);}/**
19980
- * Shows all or hides the distance label of each {@link DistanceMeasurement}.
19981
- *
19982
- * @param {Boolean} labelsShown Whether or not to show the labels.
19983
- */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i453=0,_Object$entries2=Object.entries(this.measurements);_i453<_Object$entries2.length;_i453++){var _Object$entries2$_i=_slicedToArray(_Object$entries2[_i453],2),key=_Object$entries2$_i[0],measurement=_Object$entries2$_i[1];measurement.labelShown=labelsShown;}}/**
19984
- * Shows all or hides the axis wires of each {@link DistanceMeasurement}.
19985
- *
19986
- * @param {Boolean} labelsShown Whether or not to show the axis wires.
19987
- */},{key:"setAxisVisible",value:function setAxisVisible(axisVisible){for(var _i454=0,_Object$entries3=Object.entries(this.measurements);_i454<_Object$entries3.length;_i454++){var _Object$entries3$_i=_slicedToArray(_Object$entries3[_i454],2),key=_Object$entries3$_i[0],measurement=_Object$entries3$_i[1];measurement.axisVisible=axisVisible;}this.defaultAxisVisible=axisVisible;}/**
19988
- * Gets if the axis wires of each {@link DistanceMeasurement} are visible.
19989
- *
19990
- * @returns {Boolean} Whether or not the axis wires are visible.
19991
- */},{key:"getAxisVisible",value:function getAxisVisible(){return this.defaultAxisVisible;}/**
19992
- * Destroys all {@link DistanceMeasurement}s.
19993
- */},{key:"clear",value:function clear(){var ids=Object.keys(this._measurements);for(var i=0,len=ids.length;i<len;i++){this.destroyMeasurement(ids[i]);}}/**
19994
- * Destroys this DistanceMeasurementsPlugin.
19995
- *
19996
- * Destroys all {@link DistanceMeasurement}s first.
19997
- */},{key:"destroy",value:function destroy(){this.clear();_get(_getPrototypeOf(DistanceMeasurementsPlugin.prototype),"destroy",this).call(this);}}]);return DistanceMeasurementsPlugin;}(Plugin);var WAITING_FOR_ORIGIN_TOUCH_START=0;var WAITING_FOR_ORIGIN_QUICK_TOUCH_END=1;var WAITING_FOR_ORIGIN_LONG_TOUCH_END=2;var WAITING_FOR_TARGET_TOUCH_START=3;var WAITING_FOR_TARGET_QUICK_TOUCH_END=4;var WAITING_FOR_TARGET_LONG_TOUCH_END=5;var TOUCH_CANCELING=7;/**
19894
+ * @constructor
19895
+ * @param {Viewer} viewer The Viewer.
19896
+ * @param {Object} [cfg] Plugin configuration.
19897
+ * @param {String} [cfg.id="DistanceMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
19898
+ * @param {Number} [cfg.labelMinAxisLength=25] The minimum length, in pixels, of an axis wire beyond which its label is shown.
19899
+ * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.
19900
+ * @param {boolean} [cfg.defaultVisible=true] The default value of the DistanceMeasurements `visible` property.
19901
+ * @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
19902
+ * @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
19903
+ * @param {boolean} [cfg.defaultWireVisible=true] The default value of the DistanceMeasurements `wireVisible` property.
19904
+ * @param {boolean} [cfg.defaultLabelsVisible=true] The default value of the DistanceMeasurements `labelsVisible` property.
19905
+ * @param {boolean} [cfg.defaultXLabelEnabled=true] The default value of the DistanceMeasurements `xLabelEnabled` property.
19906
+ * @param {boolean} [cfg.defaultYLabelEnabled=true] The default value of the DistanceMeasurements `yLabelEnabled` property.
19907
+ * @param {boolean} [cfg.defaultZLabelEnabled=true] The default value of the DistanceMeasurements `zLabelEnabled` property.
19908
+ * @param {boolean} [cfg.defaultLengthLabelEnabled=true] The default value of the DistanceMeasurements `lengthLabelEnabled` property.
19909
+ * @param {boolean} [cfg.defaultAxisVisible=true] The default value of the DistanceMeasurements `axisVisible` property.
19910
+ * @param {boolean} [cfg.defaultXAxisVisible=true] The default value of the DistanceMeasurements `xAxisVisible` property.
19911
+ * @param {boolean} [cfg.defaultYAxisVisible=true] The default value of the DistanceMeasurements `yAxisVisible` property.
19912
+ * @param {boolean} [cfg.defaultZAxisVisible=true] The default value of the DistanceMeasurements `zAxisVisible` property.
19913
+ * @param {boolean} [cfg.useRotationAdjustment=false] The default value of DistanceMeasurements `useRotationAdjustment` property.
19914
+ * @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
19915
+ * @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
19916
+ * @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.
19917
+ * @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
19918
+ */function DistanceMeasurementsPlugin(viewer){var _this87;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsPlugin);_this87=_super120.call(this,"DistanceMeasurements",viewer);_this87._pointerLens=cfg.pointerLens;_this87._container=cfg.container||document.body;_this87._defaultControl=null;_this87._measurements={};_this87.labelMinAxisLength=cfg.labelMinAxisLength;_this87.defaultVisible=cfg.defaultVisible!==false;_this87.defaultOriginVisible=cfg.defaultOriginVisible!==false;_this87.defaultTargetVisible=cfg.defaultTargetVisible!==false;_this87.defaultWireVisible=cfg.defaultWireVisible!==false;_this87.defaultXLabelEnabled=cfg.defaultXLabelEnabled!==false;_this87.defaultYLabelEnabled=cfg.defaultYLabelEnabled!==false;_this87.defaultZLabelEnabled=cfg.defaultZLabelEnabled!==false;_this87.defaultLengthLabelEnabled=cfg.defaultLengthLabelEnabled!==false;_this87.defaultLabelsVisible=cfg.defaultLabelsVisible!==false;_this87.defaultAxisVisible=cfg.defaultAxisVisible!==false;_this87.defaultXAxisVisible=cfg.defaultXAxisVisible!==false;_this87.defaultYAxisVisible=cfg.defaultYAxisVisible!==false;_this87.defaultZAxisVisible=cfg.defaultZAxisVisible!==false;_this87.defaultColor=cfg.defaultColor!==undefined?cfg.defaultColor:"#00BBFF";_this87.zIndex=cfg.zIndex||10000;_this87.defaultLabelsOnWires=cfg.defaultLabelsOnWires!==false;_this87.useRotationAdjustment=cfg.useRotationAdjustment!==undefined?cfg.useRotationAdjustment!==false:false;_this87._onMouseOver=function(event,measurement){_this87.fire("mouseOver",{plugin:_assertThisInitialized(_this87),distanceMeasurement:measurement,measurement:measurement,event:event});};_this87._onMouseLeave=function(event,measurement){_this87.fire("mouseLeave",{plugin:_assertThisInitialized(_this87),distanceMeasurement:measurement,measurement:measurement,event:event});};_this87._onContextMenu=function(event,measurement){_this87.fire("contextMenu",{plugin:_assertThisInitialized(_this87),distanceMeasurement:measurement,measurement:measurement,event:event});};return _this87;}/**
19919
+ * Gets the plugin's HTML container element, if any.
19920
+ * @returns {*|HTMLElement|HTMLElement}
19921
+ */_createClass(DistanceMeasurementsPlugin,[{key:"getContainerElement",value:function getContainerElement(){return this._container;}/**
19922
+ * @private
19923
+ */},{key:"send",value:function send(name,value){}/**
19924
+ * Gets the PointerLens attached to this DistanceMeasurementsPlugin.
19925
+ * @returns {PointerCircle}
19926
+ */},{key:"pointerLens",get:function get(){return this._pointerLens;}/**
19927
+ * Gets the default {@link DistanceMeasurementsControl}.
19928
+ *
19929
+ * @type {DistanceMeasurementsControl}
19930
+ * @deprecated
19931
+ */},{key:"control",get:function get(){if(!this._defaultControl){this._defaultControl=new DistanceMeasurementsMouseControl(this,{});}return this._defaultControl;}/**
19932
+ * Gets the existing {@link DistanceMeasurement}s, each mapped to its {@link DistanceMeasurement#id}.
19933
+ *
19934
+ * @type {{String:DistanceMeasurement}}
19935
+ */},{key:"measurements",get:function get(){return this._measurements;}/**
19936
+ * Sets the minimum length, in pixels, of an axis wire beyond which its label is shown.
19937
+ *
19938
+ * The axis wire's label is not shown when its length is less than this value.
19939
+ *
19940
+ * This is ````25```` pixels by default.
19941
+ *
19942
+ * Must not be less than ````1````.
19943
+ *
19944
+ * @type {number}
19945
+ */},{key:"labelMinAxisLength",get:/**
19946
+ * Gets the minimum length, in pixels, of an axis wire beyond which its label is shown.
19947
+ * @returns {number}
19948
+ */function get(){return this._labelMinAxisLength;}/**
19949
+ * Sets whether the measurement added is rotation adjusted or not.
19950
+ *
19951
+ * @type {boolean}
19952
+ */,set:function set(labelMinAxisLength){if(labelMinAxisLength<1){this.error("labelMinAxisLength must be >= 1; defaulting to 25");labelMinAxisLength=25;}this._labelMinAxisLength=labelMinAxisLength||25;}},{key:"useRotationAdjustment",get:/**
19953
+ * Gets whether the measurement added is rotation adjusted or not.
19954
+ * @returns {number}
19955
+ */function get(){return this._useRotationAdjustment;}/**
19956
+ * Creates a {@link DistanceMeasurement}.
19957
+ *
19958
+ * The DistanceMeasurement is then registered by {@link DistanceMeasurement#id} in {@link DistanceMeasurementsPlugin#measurements}.
19959
+ *
19960
+ * @param {Object} params {@link DistanceMeasurement} configuration.
19961
+ * @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}.
19962
+ * @param {Number[]} params.origin.worldPos Origin World-space 3D position.
19963
+ * @param {Entity} params.origin.entity Origin Entity.
19964
+ * @param {Number[]} params.target.worldPos Target World-space 3D position.
19965
+ * @param {Entity} params.target.entity Target Entity.
19966
+ * @param {Boolean} [params.visible=true] Whether to initially show the {@link DistanceMeasurement}.
19967
+ * @param {Boolean} [params.originVisible=true] Whether to initially show the {@link DistanceMeasurement} origin.
19968
+ * @param {Boolean} [params.targetVisible=true] Whether to initially show the {@link DistanceMeasurement} target.
19969
+ * @param {Boolean} [params.wireVisible=true] Whether to initially show the direct point-to-point wire between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
19970
+ * @param {Boolean} [params.axisVisible=true] Whether to initially show the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
19971
+ * @param {Boolean} [params.xAxisVisible=true] Whether to initially show the X-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
19972
+ * @param {Boolean} [params.yAxisVisible=true] Whether to initially show the Y-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
19973
+ * @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
19974
+ * @param {Boolean} [params.xLabelEnabled=true] Whether to initially show the x label.
19975
+ * @param {Boolean} [params.yLabelEnabled=true] Whether to initially show the y label.
19976
+ * @param {Boolean} [params.zLabelEnabled=true] Whether to initially show the z label.
19977
+ * @param {Boolean} [params.lengthLabelEnabled=true] Whether to initially show the length label.
19978
+ * @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
19979
+ * @param {Boolean} [params.lengthLabelVisible=true] Whether to initially show the labels.
19980
+ * @param {string} [params.color] The color of the length dot, wire and label.
19981
+ * @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
19982
+ * @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
19983
+ */,set:function set(_useRotationAdjustment){_useRotationAdjustment=_useRotationAdjustment!==undefined?Boolean(_useRotationAdjustment):false;this._useRotationAdjustment=_useRotationAdjustment;}},{key:"createMeasurement",value:function createMeasurement(){var _this88=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(this.viewer.scene.components[params.id]){this.error("Viewer scene component with this ID already exists: "+params.id);delete params.id;}var origin=params.origin;var target=params.target;var measurement=new DistanceMeasurement(this,{id:params.id,plugin:this,container:this._container,origin:{entity:origin.entity,worldPos:origin.worldPos},target:{entity:target.entity,worldPos:target.worldPos},visible:params.visible,wireVisible:params.wireVisible,axisVisible:params.axisVisible!==false&&this.defaultAxisVisible!==false,xAxisVisible:params.xAxisVisible!==false&&this.defaultXAxisVisible!==false,yAxisVisible:params.yAxisVisible!==false&&this.defaultYAxisVisible!==false,zAxisVisibld:params.zAxisVisible!==false&&this.defaultZAxisVisible!==false,xLabelEnabled:params.xLabelEnabled!==false&&this.defaultXLabelEnabled!==false,yLabelEnabled:params.yLabelEnabled!==false&&this.defaultYLabelEnabled!==false,zLabelEnabled:params.zLabelEnabled!==false&&this.defaultZLabelEnabled!==false,lengthLabelEnabled:params.lengthLabelEnabled!==false&&this.defaultLengthLabelEnabled!==false,labelsVisible:params.labelsVisible!==false&&this.defaultLabelsVisible!==false,useRotationAdjustment:this.useRotationAdjustment,originVisible:params.originVisible,targetVisible:params.targetVisible,color:params.color,labelsOnWires:params.labelsOnWires!==false&&this.defaultLabelsOnWires!==false,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});this._measurements[measurement.id]=measurement;measurement.clickable=true;measurement.on("destroyed",function(){delete _this88._measurements[measurement.id];});this.fire("measurementCreated",measurement);return measurement;}/**
19984
+ * Destroys a {@link DistanceMeasurement}.
19985
+ *
19986
+ * @param {String} id ID of DistanceMeasurement to destroy.
19987
+ */},{key:"destroyMeasurement",value:function destroyMeasurement(id){var measurement=this._measurements[id];if(!measurement){this.log("DistanceMeasurement not found: "+id);return;}measurement.destroy();this.fire("measurementDestroyed",measurement);}/**
19988
+ * Shows all or hides the distance label of each {@link DistanceMeasurement}.
19989
+ *
19990
+ * @param {Boolean} labelsShown Whether or not to show the labels.
19991
+ */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i453=0,_Object$entries2=Object.entries(this.measurements);_i453<_Object$entries2.length;_i453++){var _Object$entries2$_i=_slicedToArray(_Object$entries2[_i453],2),key=_Object$entries2$_i[0],measurement=_Object$entries2$_i[1];measurement.labelShown=labelsShown;}}/**
19992
+ * Shows all or hides the axis wires of each {@link DistanceMeasurement}.
19993
+ *
19994
+ * @param {Boolean} labelsShown Whether or not to show the axis wires.
19995
+ */},{key:"setAxisVisible",value:function setAxisVisible(axisVisible){for(var _i454=0,_Object$entries3=Object.entries(this.measurements);_i454<_Object$entries3.length;_i454++){var _Object$entries3$_i=_slicedToArray(_Object$entries3[_i454],2),key=_Object$entries3$_i[0],measurement=_Object$entries3$_i[1];measurement.axisVisible=axisVisible;}this.defaultAxisVisible=axisVisible;}/**
19996
+ * Gets if the axis wires of each {@link DistanceMeasurement} are visible.
19997
+ *
19998
+ * @returns {Boolean} Whether or not the axis wires are visible.
19999
+ */},{key:"getAxisVisible",value:function getAxisVisible(){return this.defaultAxisVisible;}/**
20000
+ * Destroys all {@link DistanceMeasurement}s.
20001
+ */},{key:"clear",value:function clear(){var ids=Object.keys(this._measurements);for(var i=0,len=ids.length;i<len;i++){this.destroyMeasurement(ids[i]);}}/**
20002
+ * Destroys this DistanceMeasurementsPlugin.
20003
+ *
20004
+ * Destroys all {@link DistanceMeasurement}s first.
20005
+ */},{key:"destroy",value:function destroy(){this.clear();_get(_getPrototypeOf(DistanceMeasurementsPlugin.prototype),"destroy",this).call(this);}}]);return DistanceMeasurementsPlugin;}(Plugin);var WAITING_FOR_ORIGIN_TOUCH_START=0;var WAITING_FOR_ORIGIN_QUICK_TOUCH_END=1;var WAITING_FOR_ORIGIN_LONG_TOUCH_END=2;var WAITING_FOR_TARGET_TOUCH_START=3;var WAITING_FOR_TARGET_QUICK_TOUCH_END=4;var WAITING_FOR_TARGET_LONG_TOUCH_END=5;var TOUCH_CANCELING=7;/**
19998
20006
  * Creates {@link DistanceMeasurement}s from touch input.
19999
20007
  *
20000
20008
  * See {@link DistanceMeasurementsPlugin} for more info.
@@ -29427,7 +29435,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29427
29435
  * @param {Object} [params.stats] Collects model statistics.
29428
29436
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
29429
29437
  */},{key:"load",value:function load(){var _this168=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true}));if(!params.src&&!params.las){this.error("load() param expected: src or las");return sceneModel;// Return new empty model
29430
- }var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.las,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this168.error(errMsg);sceneModel.fire("error",errMsg);});}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this169=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this169._parseModel(arrayBuffer,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this169.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this169.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this170=this;function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(params.rotateX){if(positionsValue){for(var _i579=0,len=positionsValue.length;_i579<len;_i579+=3){var temp=positionsValue[_i579+1];positionsValue[_i579+1]=positionsValue[_i579+2];positionsValue[_i579+2]=temp;}}}return positionsValue;}function readColorsAndIntensities(attributesColor,attributesIntensity){var colors=attributesColor.value;var colorSize=attributesColor.size;var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i580=0,j=0,k=0,len=intensities.length;_i580<len;_i580++,k+=colorSize,j+=4){colorsCompressed[j+0]=colors[k+0];colorsCompressed[j+1]=colors[k+1];colorsCompressed[j+2]=colors[k+2];colorsCompressed[j+3]=Math.round(intensities[_i580]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.intensity;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i581=0,j=0,len=intensities.length;_i581<len;_i581++,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i581]/65536*255);}return colorsCompressed;}return new Promise(function(resolve,reject){if(sceneModel.destroyed){reject();return;}var stats=params.stats||{};stats.sourceFormat="LAS";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;try{var lasHeader=loadLASHeader(arrayBuffer);parse$3(arrayBuffer,LASLoader,options).then(function(parsedData){var attributes=parsedData.attributes;var loaderData=parsedData.loaderData;var pointsFormatId=loaderData.pointsFormatId!==undefined?loaderData.pointsFormatId:-1;if(!attributes.POSITION){sceneModel.finalize();reject("No positions found in file");return;}var positionsValue;var colorsCompressed;switch(pointsFormatId){case 0:positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 1:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 2:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;case 3:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;}var pointsChunks=chunkArray(positionsValue,MAX_VERTICES*3);var colorsChunks=chunkArray(colorsCompressed,MAX_VERTICES*4);var meshIds=[];for(var _i582=0,len=pointsChunks.length;_i582<len;_i582++){var meshId="pointsMesh".concat(_i582);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i582],colorsCompressed:_i582<colorsChunks.length?colorsChunks[_i582]:null});}/*
29438
+ }var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.las,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this168.error(errMsg);sceneModel.fire("error",errMsg);});}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this169=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this169._parseModel(arrayBuffer,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this169.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this169.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this170=this;function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(params.rotateX){if(positionsValue){for(var _i579=0,len=positionsValue.length;_i579<len;_i579+=3){var temp=positionsValue[_i579+1];positionsValue[_i579+1]=positionsValue[_i579+2];positionsValue[_i579+2]=temp;}}}return positionsValue;}function readColorsAndIntensities(attributesColor,attributesIntensity){var colors=attributesColor.value;var colorSize=attributesColor.size;var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i580=0,j=0,k=0,len=intensities.length;_i580<len;_i580++,k+=colorSize,j+=4){colorsCompressed[j+0]=colors[k+0];colorsCompressed[j+1]=colors[k+1];colorsCompressed[j+2]=colors[k+2];colorsCompressed[j+3]=Math.round(intensities[_i580]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i581=0,j=0,len=intensities.length;_i581<len;_i581++,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i581]/65536*255);}return colorsCompressed;}return new Promise(function(resolve,reject){if(sceneModel.destroyed){reject();return;}var stats=params.stats||{};stats.sourceFormat="LAS";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;try{var lasHeader=loadLASHeader(arrayBuffer);parse$3(arrayBuffer,LASLoader,options).then(function(parsedData){var attributes=parsedData.attributes;var loaderData=parsedData.loaderData;var pointsFormatId=loaderData.pointsFormatId!==undefined?loaderData.pointsFormatId:-1;if(!attributes.POSITION){sceneModel.finalize();reject("No positions found in file");return;}var positionsValue;var colorsCompressed;switch(pointsFormatId){case 0:positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 1:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 2:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;case 3:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;}var pointsChunks=chunkArray(positionsValue,MAX_VERTICES*3);var colorsChunks=chunkArray(colorsCompressed,MAX_VERTICES*4);var meshIds=[];for(var _i582=0,len=pointsChunks.length;_i582<len;_i582++){var meshId="pointsMesh".concat(_i582);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i582],colorsCompressed:_i582<colorsChunks.length?colorsChunks[_i582]:null});}/*
29431
29439
  const pointsChunks = chunkArray(positionsValue, MAX_VERTICES * 3);
29432
29440
  const colorsChunks = chunkArray(colorsCompressed, MAX_VERTICES * 4);
29433
29441
  const meshIds = [];
@@ -29452,7 +29460,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29452
29460
  }
29453
29461
  */var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this170.viewer.metaScene.createMetaModel(metaModelId,params.metaModelJSON,options);}else if(params.loadMetadata!==false){var rootMetaObjectId=math.createUUID();var metadata={projectId:"",author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[{id:rootMetaObjectId,name:"Model",type:"Model"},{id:pointsObjectId,name:"PointCloud (LAS)",type:"PointCloud",parent:rootMetaObjectId,attributes:lasHeader||{}}],propertySets:[]};var _metaModelId=sceneModel.id;_this170.viewer.metaScene.createMetaModel(_metaModelId,metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
29454
29462
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
29455
- });resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);return LASLoaderPlugin;}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return array;}var result=[];for(var _i583=0;_i583<array.length;_i583+=chunkSize){result.push(array.slice(_i583,_i583+chunkSize));}return result;}/**
29463
+ });resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);return LASLoaderPlugin;}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i583=0;_i583<array.length;_i583+=chunkSize){result.push(array.slice(_i583,_i583+chunkSize));}return result;}/**
29456
29464
  * Default data access strategy for {@link CityJSONLoaderPlugin}.
29457
29465
  */var CityJSONDefaultDataSource=/*#__PURE__*/function(){function CityJSONDefaultDataSource(){_classCallCheck(this,CityJSONDefaultDataSource);}/**
29458
29466
  * Gets the contents of the given CityJSON file.
@@ -29808,7 +29816,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
29808
29816
  * excludeTypes: ["IfcSpace"]
29809
29817
  * });
29810
29818
  * ````
29811
- *
29819
+ *
29812
29820
  * # Configuring initial IFC object appearances
29813
29821
  *
29814
29822
  * We can specify the custom initial appearance of loaded objects according to their IFC types.
@@ -29966,7 +29974,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
29966
29974
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
29967
29975
  */,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this174=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,backfaces:params.backfaces,dtxEnabled:params.dtxEnabled,rotation:params.rotation,origin:params.origin}));var modelId=sceneModel.id;// In case ID was auto-generated
29968
29976
  if(!params.src&&!params.dotBIM){this.error("load() param expected: src or dotBIM");return sceneModel;// Return new empty model
29969
- }var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i590=0,len=params.includeTypes.length;_i590<len;_i590++){includeTypes[params.includeTypes[_i590]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i591=0,_len123=params.excludeTypes.length;_i591<_len123;_i591++){includeTypes[params.excludeTypes[_i591]]=true;}}var parseDotBIM=function parseDotBIM(ctx){var fileData=ctx.fileData;var sceneModel=ctx.sceneModel;var dbMeshIndices={};var dbMeshLoaded={};var ifcProjectId=math.createUUID();var ifcSiteId=math.createUUID();var ifcBuildingId=math.createUUID();var ifcBuildingStoryId=math.createUUID();var metaModelData={metaObjects:[{id:ifcProjectId,name:"IfcProject",type:"IfcProject",parent:null},{id:ifcSiteId,name:"IfcSite",type:"IfcSite",parent:ifcProjectId},{id:ifcBuildingId,name:"IfcBuilding",type:"IfcBuilding",parent:ifcSiteId},{id:ifcBuildingStoryId,name:"IfcBuildingStorey",type:"IfcBuildingStorey",parent:ifcBuildingId}],propertySets:[]};for(var _i592=0,_len124=fileData.meshes.length;_i592<_len124;_i592++){var dbMesh=fileData.meshes[_i592];dbMeshIndices[dbMesh.mesh_id]=_i592;}var parseDBMesh=function parseDBMesh(dbMeshId){if(dbMeshLoaded[dbMeshId]){return;}var dbMeshIndex=dbMeshIndices[dbMeshId];var dbMesh=fileData.meshes[dbMeshIndex];sceneModel.createGeometry({id:dbMeshId,primitive:"triangles",positions:dbMesh.coordinates,indices:dbMesh.indices});dbMeshLoaded[dbMeshId]=true;};var dbElements=fileData.elements;for(var _i593=0,_len125=dbElements.length;_i593<_len125;_i593++){var element=dbElements[_i593];var elementType=element.type;if(excludeTypes&&excludeTypes[elementType]){continue;}if(includeTypes&&!includeTypes[elementType]){continue;}var info=element.info;var objectId=element.guid!==undefined?"".concat(element.guid):info!==undefined&&info.id!==undefined?info.id:_i593;var dbMeshId=element.mesh_id;parseDBMesh(dbMeshId);var meshId="".concat(objectId,"-mesh");var vector=element.vector;var rotation=element.rotation;var props=objectDefaults?objectDefaults[elementType]||objectDefaults["DEFAULT"]:null;var visible=true;var pickable=true;var _color12=element.color?[element.color.r/255,element.color.g/255,element.color.b/255]:[1,1,1];var _opacity7=element.color?element.color.a/255:1.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color12=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity7=props.opacity;}}sceneModel.createMesh({id:meshId,geometryId:dbMeshId,color:_color12,opacity:_opacity7,quaternion:rotation&&(rotation.qz!==0||rotation.qy!==0||rotation.qx!==0||rotation.qw!==1.0)?[rotation.qx,rotation.qy,rotation.qz,rotation.qw]:undefined,position:vector?[vector.x,vector.y,vector.z]:undefined});sceneModel.createEntity({id:objectId,meshIds:[meshId],visible:visible,pickable:pickable,isObject:true});metaModelData.metaObjects.push({id:objectId,name:info&&info.Name&&info.Name!=="None"?info.Name:"".concat(element.type," ").concat(objectId),type:element.type,parent:ifcBuildingStoryId});}sceneModel.finalize();_this174.viewer.metaScene.createMetaModel(modelId,metaModelData);sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
29977
+ }var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i590=0,len=params.includeTypes.length;_i590<len;_i590++){includeTypes[params.includeTypes[_i590]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i591=0,_len123=params.excludeTypes.length;_i591<_len123;_i591++){includeTypes[params.excludeTypes[_i591]]=true;}}var parseDotBIM=function parseDotBIM(ctx){var fileData=ctx.fileData;var sceneModel=ctx.sceneModel;var dbMeshIndices={};var dbMeshLoaded={};var ifcProjectId=math.createUUID();var ifcSiteId=math.createUUID();var ifcBuildingId=math.createUUID();var ifcBuildingStoryId=math.createUUID();var metaModelData={metaObjects:[{id:ifcProjectId,name:"IfcProject",type:"IfcProject",parent:null},{id:ifcSiteId,name:"IfcSite",type:"IfcSite",parent:ifcProjectId},{id:ifcBuildingId,name:"IfcBuilding",type:"IfcBuilding",parent:ifcSiteId},{id:ifcBuildingStoryId,name:"IfcBuildingStorey",type:"IfcBuildingStorey",parent:ifcBuildingId}],propertySets:[]};for(var _i592=0,_len124=fileData.meshes.length;_i592<_len124;_i592++){var dbMesh=fileData.meshes[_i592];dbMeshIndices[dbMesh.mesh_id]=_i592;}var parseDBMesh=function parseDBMesh(dbMeshId){if(dbMeshLoaded[dbMeshId]){return;}var dbMeshIndex=dbMeshIndices[dbMeshId];var dbMesh=fileData.meshes[dbMeshIndex];sceneModel.createGeometry({id:dbMeshId,primitive:"triangles",positions:dbMesh.coordinates,indices:dbMesh.indices});dbMeshLoaded[dbMeshId]=true;};var dbElements=fileData.elements;for(var _i593=0,_len125=dbElements.length;_i593<_len125;_i593++){var element=dbElements[_i593];var elementType=element.type;if(excludeTypes&&excludeTypes[elementType]){continue;}if(includeTypes&&!includeTypes[elementType]){continue;}var info=element.info;var objectId=element.guid!==undefined?"".concat(element.guid):info!==undefined&&info.id!==undefined?info.id:_i593;var dbMeshId=element.mesh_id;parseDBMesh(dbMeshId);var meshId="".concat(objectId,"-mesh");var vector=element.vector;var rotation=element.rotation;var props=objectDefaults?objectDefaults[elementType]||objectDefaults["DEFAULT"]:null;var visible=true;var pickable=true;var _color12=element.color?[element.color.r/255,element.color.g/255,element.color.b/255]:[1,1,1];var _opacity7=element.color?element.color.a/255:1.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color12=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity7=props.opacity;}}sceneModel.createMesh({id:meshId,geometryId:dbMeshId,color:_color12,opacity:_opacity7,quaternion:rotation&&(rotation.qz!==0||rotation.qy!==0||rotation.qx!==0||rotation.qw!==1.0)?[rotation.qx,rotation.qy,rotation.qz,rotation.qw]:undefined,position:vector?[vector.x,vector.y,vector.z]:undefined});sceneModel.createEntity({id:objectId,meshIds:[meshId],visible:visible,pickable:pickable,isObject:true});for(var infoKey in info){var properties=void 0;if(infoKey.startsWith("IFC_Pset_")){if(!properties){properties=[];}properties.push({name:infoKey,value:info[infoKey]});}if(properties){metaModelData.propertySets.push({id:objectId,properties:properties});}}metaModelData.metaObjects.push({id:objectId,name:info&&info.Name&&info.Name!=="None"?info.Name:"".concat(element.type," ").concat(objectId),type:element.type,parent:ifcBuildingStoryId,propertySetIds:[objectId]});}sceneModel.finalize();_this174.viewer.metaScene.createMetaModel(modelId,metaModelData);sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
29970
29978
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
29971
29979
  });};if(params.src){var src=params.src;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getDotBIM(src,function(fileData){// OK
29972
29980
  var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);_this174.viewer.scene.canvas.spinner.processes--;},function(err){_this174.viewer.scene.canvas.spinner.processes--;_this174.error(err);});}else if(params.dotBIM){var ctx={fileData:params.dotBIM,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);}sceneModel.once("destroyed",function(){_this174.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**