@xeokit/xeokit-sdk 2.6.38 → 2.6.40

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.
@@ -333,13 +333,13 @@ var visitItems=function visitItems(itemsCfg){var menuId=_this3._getNextId();var
333
333
  return"ContextMenu_"+this._id+"_"+this._nextId++;// Start ID with alpha chars to make a valid DOM element selector
334
334
  }},{key:"_createUI",value:function _createUI(){var _this4=this;// Builds DOM elements for the entire menu tree
335
335
  var visitMenu=function visitMenu(menu){_this4._createMenuUI(menu);var groups=menu.groups;for(var _i5=0,len=groups.length;_i5<len;_i5++){var group=groups[_i5];var groupItems=group.items;for(var j=0,lenj=groupItems.length;j<lenj;j++){var item=groupItems[j];var subMenu=item.subMenu;if(subMenu){visitMenu(subMenu);}}}};visitMenu(this._rootMenu);}},{key:"_createMenuUI",value:function _createMenuUI(menu){var _this5=this;// Builds DOM elements for a menu
336
- var groups=menu.groups;var html=[];html.push('<div class="xeokit-context-menu '+menu.id+'" style="z-index:300000; position: absolute;">');html.push('<ul>');if(groups){for(var _i6=0,len=groups.length;_i6<len;_i6++){var group=groups[_i6];var groupIdx=_i6;var groupLen=len;var groupItems=group.items;if(groupItems){for(var j=0,lenj=groupItems.length;j<lenj;j++){var item=groupItems[j];var itemSubMenu=item.subMenu;var actionTitle=item.title||"";if(itemSubMenu){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item">'+actionTitle+' [MORE]'+'</li>');if(!(groupIdx===groupLen-1||j<lenj-1)){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item-seperator"></li>');}}else{html.push('<li id="'+item.id+'" class="xeokit-context-menu-item">'+actionTitle+'</li>');if(!(groupIdx===groupLen-1||j<lenj-1)){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item-seperator"></li>');}}}}}}html.push('</ul>');html.push('</div>');var htmlString=html.join("");document.body.insertAdjacentHTML('beforeend',htmlString);var menuElement=document.querySelector("."+menu.id);menu.menuElement=menuElement;menuElement.style["border-radius"]=4+"px";menuElement.style.display='none';menuElement.style["z-index"]=300000;menuElement.style.background="white";menuElement.style.border="1px solid black";menuElement.style["box-shadow"]="0 4px 5px 0 gray";menuElement.oncontextmenu=function(e){e.preventDefault();};// Bind event handlers
336
+ var groups=menu.groups;var html=[];html.push('<div class="xeokit-context-menu '+menu.id+'" style="z-index:300000; position: absolute;">');html.push('<ul>');if(groups){for(var _i6=0,len=groups.length;_i6<len;_i6++){var group=groups[_i6];var groupIdx=_i6;var groupLen=len;var groupItems=group.items;if(groupItems){for(var j=0,lenj=groupItems.length;j<lenj;j++){var item=groupItems[j];var itemSubMenu=item.subMenu;var actionTitle=item.title||"";if(itemSubMenu){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item">'+actionTitle+' [MORE]'+'</li>');if(!(groupIdx===groupLen-1||j<lenj-1)){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item-separator"></li>');}}else{html.push('<li id="'+item.id+'" class="xeokit-context-menu-item">'+actionTitle+'</li>');if(!(groupIdx===groupLen-1||j<lenj-1)){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item-separator"></li>');}}}}}}html.push('</ul>');html.push('</div>');var htmlString=html.join("");document.body.insertAdjacentHTML('beforeend',htmlString);var menuElement=document.querySelector("."+menu.id);menu.menuElement=menuElement;menuElement.style["border-radius"]=4+"px";menuElement.style.display='none';menuElement.style["z-index"]=300000;menuElement.style.background="white";menuElement.style.border="1px solid black";menuElement.style["box-shadow"]="0 4px 5px 0 gray";menuElement.oncontextmenu=function(e){e.preventDefault();};// Bind event handlers
337
337
  var self=this;var lastSubMenu=null;if(groups){for(var _i7=0,_len2=groups.length;_i7<_len2;_i7++){var _group=groups[_i7];var _groupItems=_group.items;if(_groupItems){var _loop2=function _loop2(_j2,_lenj){var item=_groupItems[_j2];var itemSubMenu=item.subMenu;item.itemElement=document.getElementById(item.id);if(!item.itemElement){console.error("ContextMenu item element not found: "+item.id);return"continue";}item.itemElement.addEventListener("mouseenter",function(event){event.preventDefault();var subMenu=item.subMenu;if(!subMenu){if(lastSubMenu){self._hideMenu(lastSubMenu.id);lastSubMenu=null;}return;}if(lastSubMenu&&lastSubMenu.id!==subMenu.id){self._hideMenu(lastSubMenu.id);lastSubMenu=null;}if(item.enabled===false){return;}var itemElement=item.itemElement;var subMenuElement=subMenu.menuElement;var itemRect=itemElement.getBoundingClientRect();subMenuElement.getBoundingClientRect();var subMenuWidth=200;// TODO
338
338
  var showOnLeft=itemRect.right+subMenuWidth>window.innerWidth;if(showOnLeft){self._showMenu(subMenu.id,itemRect.left-subMenuWidth,itemRect.top-1);}else{self._showMenu(subMenu.id,itemRect.right-5,itemRect.top-1);}lastSubMenu=subMenu;});if(!itemSubMenu){// Item without sub-menu
339
339
  // clicking item fires the item's action callback
340
340
  item.itemElement.addEventListener("click",function(event){event.preventDefault();if(!self._context){return;}if(item.enabled===false){return;}if(item.doAction){item.doAction(self._context);}if(_this5._hideOnAction){self.hide();}else{self._updateItemsTitles();self._updateItemsEnabledStatus();}});item.itemElement.addEventListener("mouseup",function(event){if(event.which!==3){return;}event.preventDefault();if(!self._context){return;}if(item.enabled===false){return;}if(item.doAction){item.doAction(self._context);}if(_this5._hideOnAction){self.hide();}else{self._updateItemsTitles();self._updateItemsEnabledStatus();}});item.itemElement.addEventListener("mouseenter",function(event){event.preventDefault();if(item.enabled===false){return;}if(item.doHover){item.doHover(self._context);}});}};for(var _j2=0,_lenj=_groupItems.length;_j2<_lenj;_j2++){var _ret=_loop2(_j2,_lenj);if(_ret==="continue")continue;}}}}}},{key:"_updateItemsTitles",value:function _updateItemsTitles(){// Dynamically updates the title of each Item to the result of Item#getTitle()
341
341
  if(!this._context){return;}for(var _i8=0,len=this._itemList.length;_i8<len;_i8++){var item=this._itemList[_i8];var itemElement=item.itemElement;if(!itemElement){continue;}var getShown=item.getShown;if(!getShown||!getShown(this._context)){continue;}var title=item.getTitle(this._context);if(item.subMenu){itemElement.innerText=title;}else{itemElement.innerText=title;}}}},{key:"_updateItemsEnabledStatus",value:function _updateItemsEnabledStatus(){// Enables or disables each Item, depending on the result of Item#getEnabled()
342
- if(!this._context){return;}for(var _i9=0,len=this._itemList.length;_i9<len;_i9++){var item=this._itemList[_i9];var itemElement=item.itemElement;if(!itemElement){continue;}var getEnabled=item.getEnabled;if(!getEnabled){continue;}var getShown=item.getShown;if(!getShown){continue;}var shown=getShown(this._context);item.shown=shown;if(!shown){itemElement.classList.remove("xeokit-context-menu-item-visible");itemElement.classList.add("xeokit-context-menu-item-hidden");continue;}else{itemElement.classList.remove("ceokit-context-menu-item-hidden");itemElement.classList.add("xeokit-context-menu-item-visible");}var enabled=getEnabled(this._context);item.enabled=enabled;if(!enabled){itemElement.classList.add("disabled");}else{itemElement.classList.remove("disabled");}}}},{key:"_showMenu",value:function _showMenu(menuId,pageX,pageY){// Shows the given menu, at the specified page coordinates
342
+ if(!this._context){return;}for(var _i9=0,len=this._itemList.length;_i9<len;_i9++){var item=this._itemList[_i9];var itemElement=item.itemElement;if(!itemElement){continue;}var getEnabled=item.getEnabled;if(!getEnabled){continue;}var getShown=item.getShown;if(!getShown){continue;}var shown=getShown(this._context);item.shown=shown;if(!shown){itemElement.style.display="none";continue;}else{itemElement.style.display="";}var enabled=getEnabled(this._context);item.enabled=enabled;if(!enabled){itemElement.classList.add("disabled");}else{itemElement.classList.remove("disabled");}}}},{key:"_showMenu",value:function _showMenu(menuId,pageX,pageY){// Shows the given menu, at the specified page coordinates
343
343
  var menu=this._menuMap[menuId];if(!menu){console.error("Menu not found: "+menuId);return;}if(menu.shown){return;}var menuElement=menu.menuElement;if(menuElement){this._showMenuElement(menuElement,pageX,pageY);menu.shown=true;}}},{key:"_hideMenu",value:function _hideMenu(menuId){// Hides the given menu
344
344
  var menu=this._menuMap[menuId];if(!menu){console.error("Menu not found: "+menuId);return;}if(!menu.shown){return;}var menuElement=menu.menuElement;if(menuElement){this._hideMenuElement(menuElement);menu.shown=false;}}},{key:"_hideAllMenus",value:function _hideAllMenus(){for(var _i10=0,len=this._menuList.length;_i10<len;_i10++){var menu=this._menuList[_i10];this._hideMenu(menu.id);}}},{key:"_showMenuElement",value:function _showMenuElement(menuElement,pageX,pageY){// Shows the given menu element, at the specified page coordinates
345
345
  menuElement.style.display='block';var menuHeight=menuElement.offsetHeight;var menuWidth=menuElement.offsetWidth;if(pageY+menuHeight>window.innerHeight){pageY=window.innerHeight-menuHeight;}if(pageX+menuWidth>window.innerWidth){pageX=window.innerWidth-menuWidth;}menuElement.style.left=pageX+'px';menuElement.style.top=pageY+'px';}},{key:"_hideMenuElement",value:function _hideMenuElement(menuElement){menuElement.style.display='none';}}]);return ContextMenu;}();/**
@@ -19652,12 +19652,12 @@ _this86._xAxisLabelCulled=false;_this86._yAxisLabelCulled=false;_this86._zAxisLa
19652
19652
  *
19653
19653
  * @type {number[]}
19654
19654
  */function get(){return this._axesBasis;},set:function set(value){this._axesBasis=value.slice();this._wpDirty=true;this._needUpdate(0);// No lag
19655
- }},{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,0);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
19655
+ }},{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){var delta=math.subVec3(this._targetWorld,this._originWorld,tmpVec3);/**
19656
+ * The length detected for each measurement axis.
19657
+ */this._factors=math.transformVec3(this._axesBasis,delta);this._measurementOrientation=determineMeasurementOrientation(this._originWorld,this._targetWorld,0);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
19656
19658
  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
19657
19659
  this._wp[9]=this._targetWorld[1];//y-axis
19658
- 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{var delta=math.subVec3(this._targetWorld,this._originWorld,tmpVec3);/**
19659
- * The length detected for each measurement axis.
19660
- */this._factors=math.transformVec3(this._axesBasis,delta);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]+this._axesBasis[0]*this._factors[0];this._wp[5]=this._originWorld[1]+this._axesBasis[4]*this._factors[0];this._wp[6]=this._originWorld[2]+this._axesBasis[8]*this._factors[0];this._wp[7]=1.0;this._wp[8]=this._originWorld[0]+this._axesBasis[0]*this._factors[0]+this._axesBasis[1]*this._factors[1];this._wp[9]=this._originWorld[1]+this._axesBasis[4]*this._factors[0]+this._axesBasis[5]*this._factors[1];this._wp[10]=this._originWorld[2]+this._axesBasis[8]*this._factors[0]+this._axesBasis[9]*this._factors[1];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._originDot.viewPos[2];var vpz2=this._targetDot.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._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._factors[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._factors[1]*_scale5).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){if(this._measurementOrientation==='Vertical'&&this.useRotationAdjustment){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._factors[2]*_scale5).toFixed(2)+unitAbbrev);}this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
19660
+ 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._originWorld[0]+this._axesBasis[0]*this._factors[0];this._wp[5]=this._originWorld[1]+this._axesBasis[4]*this._factors[0];this._wp[6]=this._originWorld[2]+this._axesBasis[8]*this._factors[0];this._wp[7]=1.0;this._wp[8]=this._originWorld[0]+this._axesBasis[0]*this._factors[0]+this._axesBasis[1]*this._factors[1];this._wp[9]=this._originWorld[1]+this._axesBasis[4]*this._factors[0]+this._axesBasis[5]*this._factors[1];this._wp[10]=this._originWorld[2]+this._axesBasis[8]*this._factors[0]+this._axesBasis[9]*this._factors[1];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._originDot.viewPos[2];var vpz2=this._targetDot.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._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._factors[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._factors[1]*_scale5).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){if(this._measurementOrientation==='Vertical'&&this.useRotationAdjustment){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._factors[2]*_scale5).toFixed(2)+unitAbbrev);}this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
19661
19661
  // this._yAxisLabel.setVisible(this.axisVisible && this.yAxisVisible);
19662
19662
  // this._zAxisLabel.setVisible(this.axisVisible && this.zAxisVisible);
19663
19663
  // this._lengthLabel.setVisible(false);
@@ -27132,7 +27132,7 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
27132
27132
  * @param {Object} node The node to create.
27133
27133
 
27134
27134
  * @return {HTMLElement} The html element for the node.
27135
- */},{key:"createNodeElement",value:function createNodeElement(node,expandHandler,checkHandler,contextmenuHandler,titleClickHandler){var nodeElement=document.createElement('li');nodeElement.id=node.nodeId;if(node.xrayed){nodeElement.classList.add('xrayed-node');}if(node.children.length>0){var switchElement=document.createElement('a');switchElement.href='#';switchElement.id="switch-".concat(node.nodeId);switchElement.textContent='+';switchElement.classList.add('plus');if(expandHandler)switchElement.addEventListener('click',expandHandler);nodeElement.appendChild(switchElement);}var checkbox=document.createElement('input');checkbox.id="checkbox-".concat(node.nodeId);checkbox.type="checkbox";checkbox.checked=node.checked;checkbox.style["pointer-events"]="all";if(checkHandler)checkbox.addEventListener("change",checkHandler);nodeElement.appendChild(checkbox);var span=document.createElement('span');span.textContent=node.title;nodeElement.appendChild(span);if(contextmenuHandler){span.oncontextmenu=contextmenuHandler;}if(titleClickHandler){span.onclick=titleClickHandler;}return nodeElement;}},{key:"createDisabledNodeElement",value:function createDisabledNodeElement(rootName){var li=document.createElement('li');var switchElement=document.createElement('a');switchElement.href='#';switchElement.textContent='!';switchElement.classList.add('warn');switchElement.classList.add('warning');li.appendChild(switchElement);var span=document.createElement('span');span.textContent=rootName;li.appendChild(span);return li;}},{key:"addChildren",value:function addChildren(element,nodes){var ul=document.createElement('ul');nodes.forEach(function(nodeElement){ul.appendChild(nodeElement);});element.parentElement.appendChild(ul);}},{key:"expand",value:function expand(element,expandHandler,collapseHandler){element.classList.remove('plus');element.classList.add('minus');element.textContent='-';element.removeEventListener('click',expandHandler);element.addEventListener('click',collapseHandler);}},{key:"collapse",value:function collapse(element,expandHandler,collapseHandler){if(!element){return;}var parent=element.parentElement;if(!parent){return;}var ul=parent.querySelector('ul');if(!ul){return;}parent.removeChild(ul);element.classList.remove('minus');element.classList.add('plus');element.textContent='+';element.removeEventListener('click',collapseHandler);element.addEventListener('click',expandHandler);}},{key:"isExpanded",value:function isExpanded(element){var parentElement=element.parentElement;return parentElement.getElementsByTagName('li')[0]!==undefined;}},{key:"getId",value:function getId(element){var parentElement=element.parentElement;return parentElement.id;}},{key:"getIdFromCheckbox",value:function getIdFromCheckbox(element){return element.id.replace('checkbox-','');}},{key:"getSwitchElement",value:function getSwitchElement(nodeId){return document.getElementById("switch-".concat(nodeId));}},{key:"isChecked",value:function isChecked(element){return element.checked;}},{key:"setCheckbox",value:function setCheckbox(nodeId,checked){var checkbox=document.getElementById("checkbox-".concat(nodeId));if(checkbox){if(checked!==checkbox.checked){checkbox.checked=checked;}}}},{key:"setXRayed",value:function setXRayed(nodeId,xrayed){var treeNode=document.getElementById(nodeId);if(treeNode){if(xrayed){treeNode.classList.add('xrayed-node');}else{treeNode.classList.remove('xrayed-node');}}}},{key:"setHighlighted",value:function setHighlighted(nodeId,highlighted){var treeNode=document.getElementById(nodeId);if(treeNode){if(highlighted){treeNode.scrollIntoView({block:"center"});treeNode.classList.add('highlighted-node');}else{treeNode.classList.remove('highlighted-node');}}}}]);return RenderService;}();var treeViews=[];/**
27135
+ */},{key:"createNodeElement",value:function createNodeElement(node,expandHandler,checkHandler,contextmenuHandler,titleClickHandler){var nodeElement=document.createElement('li');nodeElement.id=node.nodeId;if(node.xrayed){nodeElement.classList.add('xrayed-node');}if(node.children.length>0){var switchElement=document.createElement('a');switchElement.href='#';switchElement.id="switch-".concat(node.nodeId);switchElement.textContent='+';switchElement.classList.add('plus');if(expandHandler)switchElement.addEventListener('click',expandHandler);nodeElement.appendChild(switchElement);}var checkbox=document.createElement('input');checkbox.id="checkbox-".concat(node.nodeId);checkbox.type="checkbox";checkbox.checked=node.checked;checkbox.style["pointer-events"]="all";if(checkHandler)checkbox.addEventListener("change",checkHandler);nodeElement.appendChild(checkbox);var span=document.createElement('span');span.textContent=node.title;nodeElement.appendChild(span);if(contextmenuHandler){span.oncontextmenu=contextmenuHandler;}if(titleClickHandler){span.onclick=titleClickHandler;}return nodeElement;}},{key:"createDisabledNodeElement",value:function createDisabledNodeElement(rootName){var li=document.createElement('li');var switchElement=document.createElement('a');switchElement.href='#';switchElement.textContent='!';switchElement.classList.add('warn');switchElement.classList.add('warning');li.appendChild(switchElement);var span=document.createElement('span');span.textContent=rootName;li.appendChild(span);return li;}},{key:"addChildren",value:function addChildren(element,nodes){var ul=document.createElement('ul');nodes.forEach(function(nodeElement){ul.appendChild(nodeElement);});element.parentElement.appendChild(ul);}},{key:"expand",value:function expand(element,expandHandler,collapseHandler){element.classList.remove('plus');element.classList.add('minus');element.textContent='-';element.removeEventListener('click',expandHandler);element.addEventListener('click',collapseHandler);}},{key:"collapse",value:function collapse(element,expandHandler,collapseHandler){if(!element){return;}var parent=element.parentElement;if(!parent){return;}var ul=parent.querySelector('ul');if(!ul){return;}parent.removeChild(ul);element.classList.remove('minus');element.classList.add('plus');element.textContent='+';element.removeEventListener('click',collapseHandler);element.addEventListener('click',expandHandler);}},{key:"isExpanded",value:function isExpanded(element){var parentElement=element.parentElement;return parentElement.getElementsByTagName('li')[0]!==undefined;}},{key:"getId",value:function getId(element){var parentElement=element.parentElement;return parentElement.id;}},{key:"getIdFromCheckbox",value:function getIdFromCheckbox(element){return element.id.replace('checkbox-','');}},{key:"getSwitchElement",value:function getSwitchElement(nodeId){return document.getElementById("switch-".concat(nodeId));}},{key:"isChecked",value:function isChecked(element){return element.checked;}},{key:"setCheckbox",value:function setCheckbox(nodeId,checked){var indeterminate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var checkbox=document.getElementById("checkbox-".concat(nodeId));if(checkbox){if(checked!==checkbox.checked){checkbox.checked=checked;}if(indeterminate!==checkbox.indeterminate){checkbox.indeterminate=indeterminate;}}}},{key:"setXRayed",value:function setXRayed(nodeId,xrayed){var treeNode=document.getElementById(nodeId);if(treeNode){if(xrayed){treeNode.classList.add('xrayed-node');}else{treeNode.classList.remove('xrayed-node');}}}},{key:"setHighlighted",value:function setHighlighted(nodeId,highlighted){var treeNode=document.getElementById(nodeId);if(treeNode){if(highlighted){treeNode.scrollIntoView({block:"center"});treeNode.classList.add('highlighted-node');}else{treeNode.classList.remove('highlighted-node');}}}}]);return RenderService;}();var treeViews=[];/**
27136
27136
  * @desc A {@link Viewer} plugin that provides an HTML tree view to navigate the IFC elements in models.
27137
27137
  * <br>
27138
27138
  *
@@ -27487,7 +27487,8 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
27487
27487
  * vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.
27488
27488
  * @param {Boolean} [cfg.pruneEmptyNodes=true] When true, will not contain nodes that don't have content in the {@link Scene}. These are nodes whose {@link MetaObject}s don't have {@link Entity}s.
27489
27489
  * @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
27490
- */function TreeViewPlugin(viewer){var _this152;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this152=_super166.call(this,"TreeViewPlugin",viewer);/**
27490
+ * @param {Boolean} [cfg.showIndeterminate=false] When true, will show indeterminate state for checkboxes when some but not all child nodes are checked
27491
+ */function TreeViewPlugin(viewer){var _cfg$showIndeterminat;var _this152;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this152=_super166.call(this,"TreeViewPlugin",viewer);/**
27491
27492
  * Contains messages for any errors found while last rebuilding this TreeView.
27492
27493
  * @type {String[]}
27493
27494
  */_this152.errors=[];/**
@@ -27496,9 +27497,9 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
27496
27497
  */_this152.valid=true;var containerElement=cfg.containerElement||document.getElementById(cfg.containerElementId);if(!(containerElement instanceof HTMLElement)){_this152.error("Mandatory config expected: valid containerElementId or containerElement");return _possibleConstructorReturn(_this152);}for(var _i544=0;;_i544++){if(!treeViews[_i544]){treeViews[_i544]=_assertThisInitialized(_this152);_this152._index=_i544;_this152._id="tree-".concat(_i544);break;}}_this152._containerElement=containerElement;_this152._metaModels={};_this152._autoAddModels=cfg.autoAddModels!==false;_this152._autoExpandDepth=cfg.autoExpandDepth||0;_this152._sortNodes=cfg.sortNodes!==false;_this152._viewer=viewer;_this152._rootElement=null;_this152._muteSceneEvents=false;_this152._muteTreeEvents=false;_this152._rootNodes=[];_this152._objectNodes={};// Object ID -> Node
27497
27498
  _this152._nodeNodes={};// Node ID -> Node
27498
27499
  _this152._rootNames={};// Node ID -> Root name
27499
- _this152._sortNodes=cfg.sortNodes;_this152._pruneEmptyNodes=cfg.pruneEmptyNodes;_this152._showListItemElementId=null;_this152._renderService=cfg.renderService||new RenderService();if(!_this152._renderService){throw new Error('TreeViewPlugin: no render service set');}_this152._containerElement.oncontextmenu=function(e){e.preventDefault();};_this152._onObjectVisibility=_this152._viewer.scene.on("objectVisibility",function(entity){if(_this152._muteSceneEvents){return;}var objectId=entity.id;var node=_this152._objectNodes[objectId];if(!node){return;// Not in this tree
27500
- }var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this152._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}_this152._renderService.setCheckbox(node.nodeId,visible);var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}_this152._renderService.setCheckbox(parent.nodeId,parent.numVisibleEntities>0);parent=parent.parent;}_this152._muteTreeEvents=false;});_this152._onObjectXrayed=_this152._viewer.scene.on('objectXRayed',function(entity){if(_this152._muteSceneEvents){return;}var objectId=entity.id;var node=_this152._objectNodes[objectId];if(!node){return;// Not in this tree
27501
- }_this152._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this152._renderService.setXRayed(node.nodeId,xrayed);_this152._muteTreeEvents=false;});_this152._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this152._expandSwitchElement(switchElement);};_this152._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this152._collapseSwitchElement(switchElement);};_this152._checkboxChangeHandler=function(event){if(_this152._muteTreeEvents){return;}_this152._muteSceneEvents=true;var checkbox=event.target;var visible=_this152._renderService.isChecked(checkbox);var nodeId=_this152._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this152._nodeNodes[nodeId];var objects=_this152._viewer.scene.objects;var numUpdated=0;_this152._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;_this152._renderService.setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}});var parent=checkedNode.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities+=numUpdated;}else{parent.numVisibleEntities-=numUpdated;}_this152._renderService.setCheckbox(parent.nodeId,parent.numVisibleEntities>0);parent=parent.parent;}_this152._muteSceneEvents=false;};_this152._hierarchy=cfg.hierarchy||"containment";_this152._autoExpandDepth=cfg.autoExpandDepth||0;if(_this152._autoAddModels){var modelIds=Object.keys(_this152.viewer.metaScene.metaModels);for(var _i545=0,len=modelIds.length;_i545<len;_i545++){var modelId=modelIds[_i545];var metaModel=_this152.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this152.addModel(modelId);}}_this152.viewer.scene.on("modelLoaded",function(modelId){if(_this152.viewer.metaScene.metaModels[modelId]){_this152.addModel(modelId);}});}_this152.hierarchy=cfg.hierarchy;return _this152;}/**
27500
+ _this152._sortNodes=cfg.sortNodes;_this152._pruneEmptyNodes=cfg.pruneEmptyNodes;_this152._showListItemElementId=null;_this152._renderService=cfg.renderService||new RenderService();_this152._showIndeterminate=(_cfg$showIndeterminat=cfg.showIndeterminate)!==null&&_cfg$showIndeterminat!==void 0?_cfg$showIndeterminat:false;if(!_this152._renderService){throw new Error('TreeViewPlugin: no render service set');}_this152._containerElement.oncontextmenu=function(e){e.preventDefault();};_this152._onObjectVisibility=_this152._viewer.scene.on("objectVisibility",function(entity){if(_this152._muteSceneEvents){return;}var objectId=entity.id;var node=_this152._objectNodes[objectId];if(!node){return;// Not in this tree
27501
+ }var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this152._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}_this152._renderService.setCheckbox(node.nodeId,visible);var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}var indeterminate=_this152._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;_this152._renderService.setCheckbox(parent.nodeId,parent.numVisibleEntities>0,indeterminate);parent=parent.parent;}_this152._muteTreeEvents=false;});_this152._onObjectXrayed=_this152._viewer.scene.on('objectXRayed',function(entity){if(_this152._muteSceneEvents){return;}var objectId=entity.id;var node=_this152._objectNodes[objectId];if(!node){return;// Not in this tree
27502
+ }_this152._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this152._renderService.setXRayed(node.nodeId,xrayed);_this152._muteTreeEvents=false;});_this152._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this152._expandSwitchElement(switchElement);};_this152._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this152._collapseSwitchElement(switchElement);};_this152._checkboxChangeHandler=function(event){if(_this152._muteTreeEvents){return;}_this152._muteSceneEvents=true;var checkbox=event.target;var visible=_this152._renderService.isChecked(checkbox);var nodeId=_this152._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this152._nodeNodes[nodeId];var objects=_this152._viewer.scene.objects;var numUpdated=0;_this152._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;_this152._renderService.setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}});var parent=checkedNode.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities+=numUpdated;}else{parent.numVisibleEntities-=numUpdated;}var indeterminate=_this152._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;_this152._renderService.setCheckbox(parent.nodeId,parent.numVisibleEntities>0,indeterminate);parent=parent.parent;}_this152._muteSceneEvents=false;};_this152._hierarchy=cfg.hierarchy||"containment";_this152._autoExpandDepth=cfg.autoExpandDepth||0;if(_this152._autoAddModels){var modelIds=Object.keys(_this152.viewer.metaScene.metaModels);for(var _i545=0,len=modelIds.length;_i545<len;_i545++){var modelId=modelIds[_i545];var metaModel=_this152.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this152.addModel(modelId);}}_this152.viewer.scene.on("modelLoaded",function(modelId){if(_this152.viewer.metaScene.metaModels[modelId]){_this152.addModel(modelId);}});}_this152.hierarchy=cfg.hierarchy;return _this152;}/**
27502
27503
  * Sets how the nodes are organized within this tree view.
27503
27504
  *
27504
27505
  * Accepted values are:
@@ -27566,7 +27567,7 @@ _this152._sortNodes=cfg.sortNodes;_this152._pruneEmptyNodes=cfg.pruneEmptyNodes;
27566
27567
  * @param {Number} depth Depth to expand to.
27567
27568
  */},{key:"expandToDepth",value:function expandToDepth(depth){var _this154=this;this.collapse();var expand=function expand(node,countDepth){if(countDepth===depth){return;}var switchElement=_this154._renderService.getSwitchElement(node.nodeId);if(switchElement){_this154._expandSwitchElement(switchElement);var childNodes=node.children;for(var i=0,len=childNodes.length;i<len;i++){var childNode=childNodes[i];expand(childNode,countDepth+1);}}};for(var _i547=0,len=this._rootNodes.length;_i547<len;_i547++){var rootNode=this._rootNodes[_i547];expand(rootNode,0);}}/**
27568
27569
  * Closes all the nodes in the tree.
27569
- */},{key:"collapse",value:function collapse(){for(var _i548=0,len=this._rootNodes.length;_i548<len;_i548++){var rootNode=this._rootNodes[_i548];var objectId=rootNode.objectId;this._collapseNode(objectId);}}/**
27570
+ */},{key:"collapse",value:function collapse(){for(var _i548=0,len=this._rootNodes.length;_i548<len;_i548++){var rootNode=this._rootNodes[_i548];var nodeId=rootNode.nodeId;this._collapseNode(nodeId);}}/**
27570
27571
  * Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
27571
27572
  * node in depth-first pre-order.
27572
27573
  *
@@ -30116,8 +30117,8 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
30116
30117
  * set ````true```` and will be registered by {@link Entity#id} in {@link Scene#objects}.
30117
30118
  * * When loading, can set the World-space position, scale and rotation of each model within World space,
30118
30119
  * along with initial properties for all the model's {@link Entity}s.
30119
- * * Allows to mask which IFC types we want to load.
30120
- * * Allows to configure initial viewer state for specified IFC types (color, visibility, selection, highlighted, X-rayed, pickable, etc).
30120
+ * * Allows to mask which types we want to load.
30121
+ * * Allows to configure initial viewer state for specified types (color, visibility, selection, highlighted, X-rayed, pickable, etc).
30121
30122
  *
30122
30123
  * ## Usage
30123
30124
  *
@@ -30187,9 +30188,9 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
30187
30188
  * });
30188
30189
  * ````
30189
30190
  *
30190
- * ## Including and excluding IFC types
30191
+ * ## Including and excluding types
30191
30192
  *
30192
- * We can also load only those objects that have the specified IFC types. In the example below, we'll load only the
30193
+ * We can also load only those objects that have the specified types. In the example below, we'll load only the
30193
30194
  * objects that represent walls.
30194
30195
  *
30195
30196
  * ````javascript
@@ -30200,7 +30201,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
30200
30201
  * });
30201
30202
  * ````
30202
30203
  *
30203
- * We can also load only those objects that **don't** have the specified IFC types. In the example below, we'll load only the
30204
+ * We can also load only those objects that **don't** have the specified types. In the example below, we'll load only the
30204
30205
  * objects that do not represent empty space.
30205
30206
  *
30206
30207
  * ````javascript
@@ -30211,13 +30212,13 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
30211
30212
  * });
30212
30213
  * ````
30213
30214
  *
30214
- * # Configuring initial IFC object appearances
30215
+ * # Configuring initial object appearances
30215
30216
  *
30216
- * We can specify the custom initial appearance of loaded objects according to their IFC types.
30217
+ * We can specify the custom initial appearance of loaded objects according to their types.
30217
30218
  *
30218
30219
  * This is useful for things like:
30219
30220
  *
30220
- * * setting the colors to our objects according to their IFC types,
30221
+ * * setting the colors to our objects according to their types,
30221
30222
  * * automatically hiding ````IfcSpace```` objects, and
30222
30223
  * * ensuring that ````IfcWindow```` objects are always transparent.
30223
30224
  * <br>
@@ -30249,7 +30250,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
30249
30250
  * });
30250
30251
  * ````
30251
30252
  *
30252
- * When we don't customize the appearance of IFC types, as just above, then IfcSpace elements tend to obscure other
30253
+ * When we don't customize the appearance of types, as just above, then IfcSpace elements tend to obscure other
30253
30254
  * elements, which can be confusing.
30254
30255
  *
30255
30256
  * It's often helpful to make IfcSpaces transparent and unpickable, like this:
@@ -30368,7 +30369,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
30368
30369
  * @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}
30369
30370
  */,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this177=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
30370
30371
  if(!params.src&&!params.dotBIM){this.error("load() param expected: src or dotBIM");return sceneModel;// Return new empty model
30371
- }var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i609=0,len=params.includeTypes.length;_i609<len;_i609++){includeTypes[params.includeTypes[_i609]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i610=0,_len128=params.excludeTypes.length;_i610<_len128;_i610++){includeTypes[params.excludeTypes[_i610]]=true;}}var parseDotBIM=function parseDotBIM(ctx){var fileData=ctx.fileData;var sceneModel=ctx.sceneModel;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:[]};var parseDBMesh=function parseDBMesh(dbMeshId,element){if(dbMeshLoaded[dbMeshId]){return;}var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});sceneModel.createGeometry({id:dbMeshId,primitive:"triangles",positions:dbMesh.coordinates,indices:dbMesh.indices});dbMeshLoaded[dbMeshId]=true;};var dbElements=fileData.elements;var _loop8=function _loop8(_i611,_len129){var element=dbElements[_i611];var elementType=element.type;if(excludeTypes&&excludeTypes[elementType]){return"continue";}if(includeTypes&&!includeTypes[elementType]){return"continue";}var info=element.info;var objectId=element.guid!==undefined?"".concat(element.guid):info!==undefined&&info.id!==undefined?info.id:_i611;var dbMeshId=element.mesh_id;var vector=element.vector;var rotation=element.rotation;var props=objectDefaults?objectDefaults[elementType]||objectDefaults["DEFAULT"]:null;var visible=true;var pickable=true;if(element.face_colors===undefined){parseDBMesh(dbMeshId,element);var meshId="".concat(objectId,"-mesh");var _color12=element.color?[element.color.r/255.0,element.color.g/255.0,element.color.b/255.0]:[1,1,1];var _opacity7=element.color?element.color.a/255.0: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});}else{var faceColors=element.face_colors;var coloredTrianglesDictionary={};var currentTriangleIndicesCount=0;var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});for(var _i612=0,_len130=faceColors.length;_i612<_len130;_i612+=4){var faceColor=[faceColors[_i612],faceColors[_i612+1],faceColors[_i612+2],faceColors[_i612+3]];if(coloredTrianglesDictionary[faceColor]===undefined){coloredTrianglesDictionary[faceColor]=[];}var indexForPoint0=dbMesh.indices[currentTriangleIndicesCount];var x0=dbMesh.coordinates[indexForPoint0*3];var y0=dbMesh.coordinates[indexForPoint0*3+1];var z0=dbMesh.coordinates[indexForPoint0*3+2];var indexForPoint1=dbMesh.indices[currentTriangleIndicesCount+1];var x1=dbMesh.coordinates[indexForPoint1*3];var y1=dbMesh.coordinates[indexForPoint1*3+1];var z1=dbMesh.coordinates[indexForPoint1*3+2];var indexForPoint2=dbMesh.indices[currentTriangleIndicesCount+2];var x2=dbMesh.coordinates[indexForPoint2*3];var y2=dbMesh.coordinates[indexForPoint2*3+1];var z2=dbMesh.coordinates[indexForPoint2*3+2];coloredTrianglesDictionary[faceColor].push(x0,y0,z0,x1,y1,z1,x2,y2,z2);currentTriangleIndicesCount+=3;}var meshIds=[];for(var _i613=0,_Object$entries5=Object.entries(coloredTrianglesDictionary);_i613<_Object$entries5.length;_i613++){var _Object$entries5$_i=_slicedToArray(_Object$entries5[_i613],2),_faceColor=_Object$entries5$_i[0],trianglesCoordinates=_Object$entries5$_i[1];sceneModel.createGeometry({id:"".concat(dbMeshId,"-").concat(_faceColor),primitive:"triangles",positions:trianglesCoordinates,indices:_toConsumableArray(Array(trianglesCoordinates.length/3).keys())});var _meshId3="".concat(objectId,"-mesh-").concat(_faceColor);var faceColorArray=_faceColor.split(',').map(Number);var _color13=[faceColorArray[0]/255.0,faceColorArray[1]/255.0,faceColorArray[2]/255.0];var _opacity8=faceColorArray[3]/255.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color13=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity8=props.opacity;}}sceneModel.createMesh({id:_meshId3,geometryId:"".concat(dbMeshId,"-").concat(_faceColor),color:_color13,opacity:_opacity8,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});meshIds.push(_meshId3);}sceneModel.createEntity({id:objectId,meshIds:meshIds,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]});};for(var _i611=0,_len129=dbElements.length;_i611<_len129;_i611++){var _ret2=_loop8(_i611,_len129);if(_ret2==="continue")continue;}sceneModel.finalize();_this177.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
30372
+ }var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i609=0,len=params.includeTypes.length;_i609<len;_i609++){includeTypes[params.includeTypes[_i609]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i610=0,_len128=params.excludeTypes.length;_i610<_len128;_i610++){includeTypes[params.excludeTypes[_i610]]=true;}}var parseDotBIM=function parseDotBIM(ctx){var fileData=ctx.fileData;var sceneModel=ctx.sceneModel;var dbMeshLoaded={};var projectId=math.createUUID();var siteId=math.createUUID();var buildingId=math.createUUID();var buildingStoryId=math.createUUID();var metaModelData={metaObjects:[{id:projectId,name:"Project",type:"Project",parent:null},{id:siteId,name:"Site",type:"Site",parent:projectId},{id:buildingId,name:"Building",type:"Building",parent:siteId},{id:buildingStoryId,name:"BuildingStorey",type:"BuildingStorey",parent:buildingId}],propertySets:[]};var parseDBMesh=function parseDBMesh(dbMeshId,element){if(dbMeshLoaded[dbMeshId]){return;}var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});sceneModel.createGeometry({id:dbMeshId,primitive:"triangles",positions:dbMesh.coordinates,indices:dbMesh.indices});dbMeshLoaded[dbMeshId]=true;};var dbElements=fileData.elements;var _loop8=function _loop8(_i611,_len129){var element=dbElements[_i611];var elementType=element.type;if(excludeTypes&&excludeTypes[elementType]){return"continue";}if(includeTypes&&!includeTypes[elementType]){return"continue";}var info=element.info;var objectId=element.guid!==undefined?"".concat(element.guid):info!==undefined&&info.id!==undefined?info.id:_i611;var dbMeshId=element.mesh_id;var vector=element.vector;var rotation=element.rotation;var props=objectDefaults?objectDefaults[elementType]||objectDefaults["DEFAULT"]:null;var visible=true;var pickable=true;if(element.face_colors===undefined){parseDBMesh(dbMeshId,element);var meshId="".concat(objectId,"-mesh");var _color12=element.color?[element.color.r/255.0,element.color.g/255.0,element.color.b/255.0]:[1,1,1];var _opacity7=element.color?element.color.a/255.0: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});}else{var faceColors=element.face_colors;var coloredTrianglesDictionary={};var currentTriangleIndicesCount=0;var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});for(var _i612=0,_len130=faceColors.length;_i612<_len130;_i612+=4){var faceColor=[faceColors[_i612],faceColors[_i612+1],faceColors[_i612+2],faceColors[_i612+3]];if(coloredTrianglesDictionary[faceColor]===undefined){coloredTrianglesDictionary[faceColor]=[];}var indexForPoint0=dbMesh.indices[currentTriangleIndicesCount];var x0=dbMesh.coordinates[indexForPoint0*3];var y0=dbMesh.coordinates[indexForPoint0*3+1];var z0=dbMesh.coordinates[indexForPoint0*3+2];var indexForPoint1=dbMesh.indices[currentTriangleIndicesCount+1];var x1=dbMesh.coordinates[indexForPoint1*3];var y1=dbMesh.coordinates[indexForPoint1*3+1];var z1=dbMesh.coordinates[indexForPoint1*3+2];var indexForPoint2=dbMesh.indices[currentTriangleIndicesCount+2];var x2=dbMesh.coordinates[indexForPoint2*3];var y2=dbMesh.coordinates[indexForPoint2*3+1];var z2=dbMesh.coordinates[indexForPoint2*3+2];coloredTrianglesDictionary[faceColor].push(x0,y0,z0,x1,y1,z1,x2,y2,z2);currentTriangleIndicesCount+=3;}var meshIds=[];for(var _i613=0,_Object$entries5=Object.entries(coloredTrianglesDictionary);_i613<_Object$entries5.length;_i613++){var _Object$entries5$_i=_slicedToArray(_Object$entries5[_i613],2),_faceColor=_Object$entries5$_i[0],trianglesCoordinates=_Object$entries5$_i[1];sceneModel.createGeometry({id:"".concat(dbMeshId,"-").concat(_faceColor),primitive:"triangles",positions:trianglesCoordinates,indices:_toConsumableArray(Array(trianglesCoordinates.length/3).keys())});var _meshId3="".concat(objectId,"-mesh-").concat(_faceColor);var faceColorArray=_faceColor.split(',').map(Number);var _color13=[faceColorArray[0]/255.0,faceColorArray[1]/255.0,faceColorArray[2]/255.0];var _opacity8=faceColorArray[3]/255.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color13=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity8=props.opacity;}}sceneModel.createMesh({id:_meshId3,geometryId:"".concat(dbMeshId,"-").concat(_faceColor),color:_color13,opacity:_opacity8,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});meshIds.push(_meshId3);}sceneModel.createEntity({id:objectId,meshIds:meshIds,visible:visible,pickable:pickable,isObject:true});}var properties=[];for(var infoKey in info){properties.push({name:infoKey,value:info[infoKey]});}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:buildingStoryId,propertySetIds:[objectId]});};for(var _i611=0,_len129=dbElements.length;_i611<_len129;_i611++){var _ret2=_loop8(_i611,_len129);if(_ret2==="continue")continue;}sceneModel.finalize();_this177.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
30372
30373
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
30373
30374
  });};if(params.src){var src=params.src;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getDotBIM(src,function(fileData){// OK
30374
30375
  var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);_this177.viewer.scene.canvas.spinner.processes--;},function(err){_this177.viewer.scene.canvas.spinner.processes--;_this177.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(){_this177.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**