@xeokit/xeokit-sdk 2.6.63 → 2.6.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/xeokit-sdk.cjs.js +506 -1069
- package/dist/xeokit-sdk.es.js +506 -1069
- package/dist/xeokit-sdk.es5.js +120 -151
- package/dist/xeokit-sdk.min.cjs.js +4 -4
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +3 -3
- package/package.json +1 -1
- package/src/plugins/SectionPlanesPlugin/Control.js +527 -1118
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -22978,7 +22978,7 @@ this.pickResult=this._scene.pick({canvasPos:this.pickCursorPos});if(this.pickRes
|
|
|
22978
22978
|
* @private
|
|
22979
22979
|
*/var canvasPos=math.vec2();var getCanvasPosFromEvent$3=function getCanvasPosFromEvent$3(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;var totalScrollX=0;var totalScrollY=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;totalScrollX+=element.scrollLeft;totalScrollY+=element.scrollTop;element=element.offsetParent;}canvasPos[0]=event.pageX+totalScrollX-totalOffsetLeft;canvasPos[1]=event.pageY+totalScrollY-totalOffsetTop;}return canvasPos;};/**
|
|
22980
22980
|
* @private
|
|
22981
|
-
*/var MousePanRotateDollyHandler=/*#__PURE__*/function(){function MousePanRotateDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,MousePanRotateDollyHandler);this._scene=scene;var pickController=controllers.pickController;var cameraControl=controllers.cameraControl;var lastX=0;var lastY=0;var lastXDown=0;var lastYDown=0;var mouseDownLeft;var mouseDownMiddle;var mouseDownRight;var mouseDownPicked=false;var pickedWorldPos=math.vec3();var mouseMovedOnCanvasSinceLastWheel=true;var canvas=this._scene.canvas.canvas;var keyDown=[];document.addEventListener("keydown",this._documentKeyDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}var keyCode=e.keyCode;keyDown[keyCode]=true;});document.addEventListener("keyup",this._documentKeyUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}var keyCode=e.keyCode;keyDown[keyCode]=false;});function setMousedownState(){var pick=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;setMousedownPositions();if(pick){setMousedownPick();}}function setMousedownPositions(){lastX=states.pointerCanvasPos[0];lastY=states.pointerCanvasPos[1];lastXDown=states.pointerCanvasPos[0];lastYDown=states.pointerCanvasPos[1];}function setMousedownPick(){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){mouseDownPicked=true;pickedWorldPos.set(pickController.pickResult.worldPos);}else{mouseDownPicked=false;}}function isPanning(){return configs.planView||cameraControl._isKeyDownForAction(cameraControl.MOUSE_PAN,keyDown);}function isRotating(){return cameraControl._isKeyDownForAction(cameraControl.MOUSE_ROTATE,keyDown);}canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}switch(e.which){case 1:// Left button
|
|
22981
|
+
*/var MousePanRotateDollyHandler=/*#__PURE__*/function(){function MousePanRotateDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,MousePanRotateDollyHandler);this._scene=scene;var pickController=controllers.pickController;var cameraControl=controllers.cameraControl;var lastX=0;var lastY=0;var lastXDown=0;var lastYDown=0;var mouseDownLeft;var mouseDownMiddle;var mouseDownRight;var mouseDownPicked=false;var pickedWorldPos=math.vec3();var mouseMovedOnCanvasSinceLastWheel=true;var canvas=this._scene.canvas.canvas;var keyDown=[];document.addEventListener("keydown",this._documentKeyDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}var keyCode=e.keyCode;keyDown[keyCode]=true;});document.addEventListener("keyup",this._documentKeyUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}var keyCode=e.keyCode;keyDown[keyCode]=false;});document.addEventListener("visibilitychange",this._onVisibilityChange=function(){keyDown.splice(0);});window.addEventListener("blur",this._onBlur=function(){keyDown.splice(0);});function setMousedownState(){var pick=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;setMousedownPositions();if(pick){setMousedownPick();}}function setMousedownPositions(){lastX=states.pointerCanvasPos[0];lastY=states.pointerCanvasPos[1];lastXDown=states.pointerCanvasPos[0];lastYDown=states.pointerCanvasPos[1];}function setMousedownPick(){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){mouseDownPicked=true;pickedWorldPos.set(pickController.pickResult.worldPos);}else{mouseDownPicked=false;}}function isPanning(){return configs.planView||cameraControl._isKeyDownForAction(cameraControl.MOUSE_PAN,keyDown);}function isRotating(){return cameraControl._isKeyDownForAction(cameraControl.MOUSE_ROTATE,keyDown);}canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}switch(e.which){case 1:// Left button
|
|
22982
22982
|
if(keyDown[scene.input.KEY_SHIFT]||configs.planView){mouseDownLeft=true;keyDown[scene.input.MOUSE_LEFT_BUTTON]=true;setMousedownState();}else{mouseDownLeft=true;keyDown[scene.input.MOUSE_LEFT_BUTTON]=true;setMousedownState(false);}break;case 2:// Middle/both buttons
|
|
22983
22983
|
mouseDownMiddle=true;keyDown[scene.input.MOUSE_MIDDLE_BUTTON]=true;setMousedownState();break;case 3:// Right button
|
|
22984
22984
|
mouseDownRight=true;keyDown[scene.input.MOUSE_RIGHT_BUTTON]=true;if(configs.panRightClick){setMousedownState();}break;}});document.addEventListener("mousemove",this._documentMouseMoveHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}if(!mouseDownLeft&&!mouseDownMiddle&&!mouseDownRight){return;}// Scaling drag-rotate to canvas boundary
|
|
@@ -22989,7 +22989,7 @@ mouseDownLeft=false;mouseDownMiddle=false;mouseDownRight=false;keyDown[scene.inp
|
|
|
22989
22989
|
mouseDownLeft=false;mouseDownMiddle=false;mouseDownRight=false;keyDown[scene.input.MOUSE_LEFT_BUTTON]=false;keyDown[scene.input.MOUSE_MIDDLE_BUTTON]=false;keyDown[scene.input.MOUSE_RIGHT_BUTTON]=false;break;case 3:// Right button
|
|
22990
22990
|
mouseDownLeft=false;mouseDownMiddle=false;mouseDownRight=false;keyDown[scene.input.MOUSE_LEFT_BUTTON]=false;keyDown[scene.input.MOUSE_MIDDLE_BUTTON]=false;keyDown[scene.input.MOUSE_RIGHT_BUTTON]=false;break;}});canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}switch(e.which){case 3:// Right button
|
|
22991
22991
|
getCanvasPosFromEvent$3(e,canvasPos);var x=canvasPos[0];var y=canvasPos[1];if(Math.abs(x-lastXDown)<3&&Math.abs(y-lastYDown)<3){controllers.cameraControl.fire("rightClick",{// For context menus
|
|
22992
|
-
pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:canvasPos,event:e},true);}break;}canvas.style.removeProperty("cursor");});canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){if(!(configs.active&&configs.pointerEnabled)){return;}});var maxElapsed=1/20;var minElapsed=1/60;var secsNowLast=null;canvas.addEventListener("wheel",this._mouseWheelHandler=function(e){if(!(configs.active&&configs.pointerEnabled&&configs.zoomOnMouseWheel&&cameraControl._isKeyDownForAction(cameraControl.MOUSE_DOLLY,keyDown))){return;}var secsNow=performance.now()/1000.0;var secsElapsed=secsNowLast!==null?secsNow-secsNowLast:0;secsNowLast=secsNow;if(secsElapsed>maxElapsed){secsElapsed=maxElapsed;}if(secsElapsed<minElapsed){secsElapsed=minElapsed;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}var normalizedDelta=delta/Math.abs(delta);updates.dollyDelta+=-normalizedDelta*secsElapsed*configs.mouseWheelDollyRate;if(mouseMovedOnCanvasSinceLastWheel){states.followPointerDirty=true;mouseMovedOnCanvasSinceLastWheel=false;}},{passive:true});}_createClass(MousePanRotateDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){var canvas=this._scene.canvas.canvas;document.removeEventListener("keydown",this._documentKeyDownHandler);document.removeEventListener("keyup",this._documentKeyUpHandler);canvas.removeEventListener("mousedown",this._mouseDownHandler);document.removeEventListener("mousemove",this._documentMouseMoveHandler);canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);document.removeEventListener("mouseup",this._documentMouseUpHandler);canvas.removeEventListener("mouseup",this._mouseUpHandler);canvas.removeEventListener("mouseenter",this._mouseEnterHandler);canvas.removeEventListener("wheel",this._mouseWheelHandler);}}]);return MousePanRotateDollyHandler;}();var center=math.vec3();var tempVec3a$5=math.vec3();var tempVec3b$2=math.vec3();var tempVec3c$1=math.vec3();var tempVec3d=math.vec3();var tempCameraTarget={eye:math.vec3(),look:math.vec3(),up:math.vec3()};/**
|
|
22992
|
+
pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:canvasPos,event:e},true);}break;}canvas.style.removeProperty("cursor");});canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){if(!(configs.active&&configs.pointerEnabled)){return;}});var maxElapsed=1/20;var minElapsed=1/60;var secsNowLast=null;canvas.addEventListener("wheel",this._mouseWheelHandler=function(e){if(!(configs.active&&configs.pointerEnabled&&configs.zoomOnMouseWheel&&cameraControl._isKeyDownForAction(cameraControl.MOUSE_DOLLY,keyDown))){return;}var secsNow=performance.now()/1000.0;var secsElapsed=secsNowLast!==null?secsNow-secsNowLast:0;secsNowLast=secsNow;if(secsElapsed>maxElapsed){secsElapsed=maxElapsed;}if(secsElapsed<minElapsed){secsElapsed=minElapsed;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}var normalizedDelta=delta/Math.abs(delta);updates.dollyDelta+=-normalizedDelta*secsElapsed*configs.mouseWheelDollyRate;if(mouseMovedOnCanvasSinceLastWheel){states.followPointerDirty=true;mouseMovedOnCanvasSinceLastWheel=false;}},{passive:true});}_createClass(MousePanRotateDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){var canvas=this._scene.canvas.canvas;document.removeEventListener("keydown",this._documentKeyDownHandler);document.removeEventListener("keyup",this._documentKeyUpHandler);document.removeEventListener("visibilitychange",this._onVisibilityChange);window.removeEventListener("blur",this._onBlur);canvas.removeEventListener("mousedown",this._mouseDownHandler);document.removeEventListener("mousemove",this._documentMouseMoveHandler);canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);document.removeEventListener("mouseup",this._documentMouseUpHandler);canvas.removeEventListener("mouseup",this._mouseUpHandler);canvas.removeEventListener("mouseenter",this._mouseEnterHandler);canvas.removeEventListener("wheel",this._mouseWheelHandler);}}]);return MousePanRotateDollyHandler;}();var center=math.vec3();var tempVec3a$5=math.vec3();var tempVec3b$2=math.vec3();var tempVec3c$1=math.vec3();var tempVec3d=math.vec3();var tempCameraTarget={eye:math.vec3(),look:math.vec3(),up:math.vec3()};/**
|
|
22993
22993
|
* @private
|
|
22994
22994
|
*/var KeyboardAxisViewHandler=/*#__PURE__*/function(){function KeyboardAxisViewHandler(scene,controllers,configs,states){_classCallCheck(this,KeyboardAxisViewHandler);this._scene=scene;var cameraControl=controllers.cameraControl;var camera=scene.camera;this._onSceneKeyDown=scene.input.on("keydown",function(){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(configs.keyboardEnabledOnlyIfMouseover&&!states.mouseover){return;}var axisViewRight=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_RIGHT);var axisViewBack=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BACK);var axisViewLeft=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_LEFT);var axisViewFront=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_FRONT);var axisViewTop=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_TOP);var axisViewBottom=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BOTTOM);if(!axisViewRight&&!axisViewBack&&!axisViewLeft&&!axisViewFront&&!axisViewTop&&!axisViewBottom){return;}var aabb=scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var perspectiveDist=Math.abs(diag/Math.tan(controllers.cameraFlight.fitFOV*math.DEGTORAD));var orthoScale=diag*1.1;tempCameraTarget.orthoScale=orthoScale;if(axisViewRight){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,perspectiveDist,tempVec3a$5),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewBack){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,perspectiveDist,tempVec3a$5),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewLeft){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,-perspectiveDist,tempVec3a$5),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewFront){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,-perspectiveDist,tempVec3a$5),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewTop){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,perspectiveDist,tempVec3a$5),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,1,tempVec3b$2),tempVec3c$1));}else if(axisViewBottom){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,-perspectiveDist,tempVec3a$5),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,-1,tempVec3b$2)));}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(center);}if(controllers.cameraFlight.duration>0){controllers.cameraFlight.flyTo(tempCameraTarget,function(){if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}});}else{controllers.cameraFlight.jumpTo(tempCameraTarget);if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}}});}_createClass(KeyboardAxisViewHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this._scene.input.off(this._onSceneKeyDown);}}]);return KeyboardAxisViewHandler;}();/**
|
|
22995
22995
|
* @private
|
|
@@ -23012,14 +23012,14 @@ if(pickedSubs||pickedNothingSubs||pickedSurfaceSubs){pickController.pickCursorPo
|
|
|
23012
23012
|
pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();var firstClickPickResult=pickController.pickResult;var firstClickPickSurface=pickController.pickedSurface;_this118._timeout=setTimeout(function(){if(firstClickPickResult){cameraControl.fire("picked",firstClickPickResult,true);if(firstClickPickSurface){cameraControl.fire("pickedSurface",firstClickPickResult,true);if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(firstClickPickResult.worldPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}_this118._clicks=0;},configs.doubleClickTimeFrame);}else{// Second click
|
|
23013
23013
|
if(_this118._timeout!==null){window.clearTimeout(_this118._timeout);_this118._timeout=null;}pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo||doublePickedSubs||doublePickedSurfaceSubs;pickController.schedulePickSurface=pickController.schedulePickEntity&&doublePickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("doublePicked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult,true);}if(configs.doublePickFlyTo){flyCameraTo(pickController.pickResult);if(!configs.firstPerson&&configs.followPointer){var pickedEntityAABB=pickController.pickResult.entity.aabb;var pickedEntityCenterPos=math.getAABB3Center(pickedEntityAABB);controllers.pivotController.setPivotPos(pickedEntityCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("doublePickedNothing",{canvasPos:states.pointerCanvasPos},true);if(configs.doublePickFlyTo){flyCameraTo();if(!configs.firstPerson&&configs.followPointer){var sceneAABB=scene.aabb;var sceneCenterPos=math.getAABB3Center(sceneAABB);controllers.pivotController.setPivotPos(sceneCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}_this118._clicks=0;}},false);}_createClass(MousePickHandler,[{key:"reset",value:function reset(){this._clicks=0;this._lastPickedEntityId=null;if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}},{key:"destroy",value:function destroy(){var canvas=this._scene.canvas.canvas;canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);canvas.removeEventListener("mousedown",this._canvasMouseDownHandler);document.removeEventListener("mouseup",this._documentMouseUpHandler);canvas.removeEventListener("mouseup",this._canvasMouseUpHandler);if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}}]);return MousePickHandler;}();/**
|
|
23014
23014
|
* @private
|
|
23015
|
-
*/var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;var input=scene.input;var keyDownMap=[];scene.canvas.canvas;var mouseMovedSinceLastKeyboardDolly=true;this._onSceneMouseMove=input.on("mousemove",function(){mouseMovedSinceLastKeyboardDolly=true;});this._onSceneKeyDown=input.on("keydown",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(configs.keyboardEnabledOnlyIfMouseover&&!states.mouseover){return;}keyDownMap[keyCode]=true;});this._onSceneKeyUp=input.on("keyup",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}keyDownMap[keyCode]=false;if(controllers.pivotController.getPivoting()){controllers.pivotController.endPivot();}});this._onTick=scene.on("tick",function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(configs.keyboardEnabledOnlyIfMouseover&&!states.mouseover){return;}var cameraControl=controllers.cameraControl;var elapsedSecs=e.deltaTime/1000.0;//-------------------------------------------------------------------------------------------------
|
|
23015
|
+
*/var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;var input=scene.input;var keyDownMap=[];scene.canvas.canvas;var mouseMovedSinceLastKeyboardDolly=true;this._onSceneMouseMove=input.on("mousemove",function(){mouseMovedSinceLastKeyboardDolly=true;});this._onSceneKeyDown=input.on("keydown",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(configs.keyboardEnabledOnlyIfMouseover&&!states.mouseover){return;}keyDownMap[keyCode]=true;});this._onSceneKeyUp=input.on("keyup",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}keyDownMap[keyCode]=false;if(controllers.pivotController.getPivoting()){controllers.pivotController.endPivot();}});document.addEventListener("visibilitychange",this._onVisibilityChange=function(){keyDownMap.splice(0);});window.addEventListener("blur",this._onBlur=function(){keyDownMap.splice(0);});this._onTick=scene.on("tick",function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(configs.keyboardEnabledOnlyIfMouseover&&!states.mouseover){return;}var cameraControl=controllers.cameraControl;var elapsedSecs=e.deltaTime/1000.0;//-------------------------------------------------------------------------------------------------
|
|
23016
23016
|
// Keyboard rotation
|
|
23017
23017
|
//-------------------------------------------------------------------------------------------------
|
|
23018
23018
|
if(!configs.planView){var rotateYPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_POS,keyDownMap);var rotateYNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_NEG,keyDownMap);var rotateXPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_POS,keyDownMap);var rotateXNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG,keyDownMap);var orbitDelta=elapsedSecs*configs.keyboardRotationRate;if(rotateYPos||rotateYNeg||rotateXPos||rotateXNeg){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(rotateYPos){updates.rotateDeltaY+=orbitDelta;}else if(rotateYNeg){updates.rotateDeltaY-=orbitDelta;}if(rotateXPos){updates.rotateDeltaX+=orbitDelta;}else if(rotateXNeg){updates.rotateDeltaX-=orbitDelta;}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}}}//-------------------------------------------------------------------------------------------------
|
|
23019
23019
|
// Keyboard panning
|
|
23020
23020
|
//-------------------------------------------------------------------------------------------------
|
|
23021
23021
|
if(!keyDownMap[input.KEY_CTRL]&&!keyDownMap[input.KEY_ALT]){var dollyBackwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS,keyDownMap);var dollyForwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS,keyDownMap);if(dollyBackwards||dollyForwards){var dollyDelta=elapsedSecs*configs.keyboardDollyRate;if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(dollyForwards){updates.dollyDelta-=dollyDelta;}else if(dollyBackwards){updates.dollyDelta+=dollyDelta;}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}var panForwards=cameraControl._isKeyDownForAction(cameraControl.PAN_FORWARDS,keyDownMap);var panBackwards=cameraControl._isKeyDownForAction(cameraControl.PAN_BACKWARDS,keyDownMap);var panLeft=cameraControl._isKeyDownForAction(cameraControl.PAN_LEFT,keyDownMap);var panRight=cameraControl._isKeyDownForAction(cameraControl.PAN_RIGHT,keyDownMap);var panUp=cameraControl._isKeyDownForAction(cameraControl.PAN_UP,keyDownMap);var panDown=cameraControl._isKeyDownForAction(cameraControl.PAN_DOWN,keyDownMap);var panDelta=(keyDownMap[input.KEY_ALT]?0.3:1.0)*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
|
|
23022
|
-
if(panForwards||panBackwards||panLeft||panRight||panUp||panDown){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(panDown){updates.panDeltaY+=panDelta;}else if(panUp){updates.panDeltaY+=-panDelta;}if(panRight){updates.panDeltaX+=-panDelta;}else if(panLeft){updates.panDeltaX+=panDelta;}if(panBackwards){updates.panDeltaZ+=panDelta;}else if(panForwards){updates.panDeltaZ+=-panDelta;}}});}_createClass(KeyboardPanRotateDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this._scene.off(this._onTick);this._scene.input.off(this._onSceneMouseMove);this._scene.input.off(this._onSceneKeyDown);this._scene.input.off(this._onSceneKeyUp);}}]);return KeyboardPanRotateDollyHandler;}();var SCALE_DOLLY_EACH_FRAME=1;// Recalculate dolly speed for eye->target distance on each Nth frame
|
|
23022
|
+
if(panForwards||panBackwards||panLeft||panRight||panUp||panDown){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(panDown){updates.panDeltaY+=panDelta;}else if(panUp){updates.panDeltaY+=-panDelta;}if(panRight){updates.panDeltaX+=-panDelta;}else if(panLeft){updates.panDeltaX+=panDelta;}if(panBackwards){updates.panDeltaZ+=panDelta;}else if(panForwards){updates.panDeltaZ+=-panDelta;}}});}_createClass(KeyboardPanRotateDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this._scene.off(this._onTick);this._scene.input.off(this._onSceneMouseMove);this._scene.input.off(this._onSceneKeyDown);document.removeEventListener("visibilitychange",this._onVisibilityChange);window.removeEventListener("blur",this._onBlur);this._scene.input.off(this._onSceneKeyUp);}}]);return KeyboardPanRotateDollyHandler;}();var SCALE_DOLLY_EACH_FRAME=1;// Recalculate dolly speed for eye->target distance on each Nth frame
|
|
23023
23023
|
var EPSILON=0.001;var tempVec3$2=math.vec3();/**
|
|
23024
23024
|
* Handles camera updates on each "tick" that were scheduled by the various controllers.
|
|
23025
23025
|
*
|
|
@@ -25908,31 +25908,55 @@ var src=params.src;if(!src){this.error("load() param expected: src");return mode
|
|
|
25908
25908
|
* Controls a {@link SectionPlane} with mouse and touch input.
|
|
25909
25909
|
*
|
|
25910
25910
|
* @private
|
|
25911
|
-
*/var Control=/*#__PURE__*/function(){/** @private */function Control(plugin){_classCallCheck(this,Control);/**
|
|
25911
|
+
*/var Control=/*#__PURE__*/function(){/** @private */function Control(plugin){var _this141=this;_classCallCheck(this,Control);/**
|
|
25912
25912
|
* ID of this Control.
|
|
25913
25913
|
*
|
|
25914
25914
|
* SectionPlaneControls are mapped by this ID in {@link SectionPlanesPlugin#sectionPlaneControls}.
|
|
25915
25915
|
*
|
|
25916
25916
|
* @property id
|
|
25917
25917
|
* @type {String|Number}
|
|
25918
|
-
*/this.id=null;
|
|
25919
|
-
|
|
25920
|
-
|
|
25921
|
-
|
|
25922
|
-
|
|
25923
|
-
|
|
25918
|
+
*/this.id=null;var viewer=plugin.viewer;var camera=viewer.camera;var cameraControl=viewer.cameraControl;var scene=viewer.scene;var canvas=scene.canvas.canvas;this._visible=false;var ignoreNextSectionPlaneDirUpdate=false;// Builds the Entities that represent this Control.
|
|
25919
|
+
var NO_STATE_INHERIT=false;var arrowLength=1.0;var handleRadius=0.09;var tubeRadius=0.01;var rootNode=new Node$2(scene,{// Root of Node graph that represents this control in the 3D scene
|
|
25920
|
+
position:[0,0,0],scale:[5,5,5],isObject:false});var pos=math.vec3();var setPos=function(){var origin=math.vec3();var rtcPos=math.vec3();return function(p){pos.set(p);worldToRTCPos(p,origin,rtcPos);rootNode.origin=origin;rootNode.position=rtcPos;};}();var arrowGeometry=function arrowGeometry(radiusBottom,height){return new ReadableGeometry(rootNode,buildCylinderGeometry({radiusTop:0.001,radiusBottom:radiusBottom,radialSegments:32,heightSegments:1,height:height,openEnded:false}));};var tubeGeometry=function tubeGeometry(radius,height,radialSegments){return new ReadableGeometry(rootNode,buildCylinderGeometry({radiusTop:radius,radiusBottom:radius,radialSegments:radialSegments,heightSegments:1,height:height,openEnded:false}));};var torusGeometry=function torusGeometry(tube,arcFraction,tubeSegments){return new ReadableGeometry(rootNode,buildTorusGeometry({radius:arrowLength-0.2,tube:tube,radialSegments:64,tubeSegments:tubeSegments,arc:Math.PI*2.0*arcFraction}));};var shapes={// Reusable geometries
|
|
25921
|
+
curve:torusGeometry(tubeRadius,0.25,14),curveHandle:torusGeometry(handleRadius,0.25,14),hoop:torusGeometry(tubeRadius,1,8),arrowHead:arrowGeometry(0.07,0.2),arrowHeadBig:arrowGeometry(0.09,0.25),arrowHeadHandle:tubeGeometry(handleRadius,0.37,8),axis:tubeGeometry(tubeRadius,arrowLength,20),axisHandle:tubeGeometry(handleRadius,arrowLength,20)};var colorMaterial=function colorMaterial(rgb){return new PhongMaterial(rootNode,{diffuse:rgb,emissive:rgb,ambient:[0.0,0.0,0.0],specular:[.6,.6,.3],shininess:80,lineWidth:2});};var highlightMaterial=function highlightMaterial(rgb,fillAlpha){return new EmphasisMaterial(rootNode,{edges:false,fill:true,fillColor:rgb,fillAlpha:fillAlpha});};var pickableMaterial=new PhongMaterial(rootNode,{// Invisible material for pickable handles, which define a pickable 3D area
|
|
25922
|
+
diffuse:[1,1,0],alpha:0,// Invisible
|
|
25923
|
+
alphaMode:"blend"});var handlers={};var addAxis=function addAxis(rgb,axisDirection,hoopDirection){var material=colorMaterial(rgb);var rotateToHorizontal=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());var hoopRotation=math.quaternionToRotationMat4(math.vec3PairToQuaternion([0,1,0],hoopDirection),math.identityMat4());var hoopMatrix=math.mulMat4(hoopRotation,rotateToHorizontal,math.identityMat4());var scale=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());var scaledArrowMatrix=function scaledArrowMatrix(t,matR){var matT=math.translateMat4v(t,math.identityMat4());var ret=math.identityMat4();math.mulMat4(matT,matR,ret);math.mulMat4(hoopMatrix,ret,ret);return math.mulMat4(ret,scale,math.identityMat4());};var curve=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.curve,material:material,matrix:hoopMatrix,pickable:false,collidable:true,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT);var rotateHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.curveHandle,material:pickableMaterial,matrix:hoopMatrix,pickable:true,collidable:true,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT);var arrow1=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:material,matrix:scaledArrowMatrix([.8,.07,0],math.rotationMat4v(180*math.DEGTORAD,[0,0,1],math.identityMat4())),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);var arrow2=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:material,matrix:scaledArrowMatrix([.07,.8,0],math.rotationMat4v(90*math.DEGTORAD,[0,0,1],math.identityMat4())),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);var hoop=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:material,highlighted:true,highlightMaterial:highlightMaterial(rgb,0.6),matrix:hoopMatrix,pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);var axisRotation=math.quaternionToRotationMat4(math.vec3PairToQuaternion([0,1,0],axisDirection),math.identityMat4());var translatedAxisMatrix=function translatedAxisMatrix(yOffset){return math.mulMat4(axisRotation,math.translateMat4c(0,yOffset,0,math.identityMat4()),math.identityMat4());};var arrowMatrix=translatedAxisMatrix(arrowLength+.1);var shaftMatrix=translatedAxisMatrix(arrowLength/2);var arrow=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:material,matrix:arrowMatrix,pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);var arrowHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadHandle,material:pickableMaterial,matrix:arrowMatrix,pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);var shaft=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axis,material:material,matrix:shaftMatrix,pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);var shaftHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axisHandle,material:pickableMaterial,matrix:shaftMatrix,pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);var bigArrowHead=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:material,matrix:arrowMatrix,pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);var closestPointOnAxis=function(){var worldAxis=math.vec4();var org=math.vec3();var dir=math.vec3();return function(canvasPos,dst){localToWorldVec(rgb,worldAxis);var P=pos;var D=worldAxis;math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,org,dir);var d01=math.dotVec3(D,dir);var v=math.subVec3(org,P,dst);var v0=math.dotVec3(v,D);var v1=math.dotVec3(v,dir);var det=1-d01*d01;if(Math.abs(det)>1e-10){// if lines are not parallel
|
|
25924
|
+
var _s2=(v0-d01*v1)/det;math.addVec3(P,math.mulVec3Scalar(D,_s2,dst),dst);return true;}else{return false;}};}();var initOffset=math.vec3();var tempVec3=math.vec3();handlers[arrowHandle.id]=handlers[shaftHandle.id]={setActivated:function setActivated(a){return bigArrowHead.visible=a;},initDragAction:function initDragAction(initCanvasPos){return closestPointOnAxis(initCanvasPos,initOffset)&&math.subVec3(initOffset,pos,initOffset)&&function(canvasPos){if(closestPointOnAxis(canvasPos,tempVec3)){math.subVec3(tempVec3,initOffset,tempVec3);setPos(tempVec3);if(self._sectionPlane){self._sectionPlane.pos=tempVec3;}}};}};var lastCanvasPos=math.vec2();handlers[rotateHandle.id]={setActivated:function setActivated(a){return hoop.visible=a;},initDragAction:function initDragAction(initCanvasPos){lastCanvasPos.set(initCanvasPos);return function(canvasPos){dragRotateSectionPlane(rgb,lastCanvasPos,canvasPos);lastCanvasPos.set(canvasPos);};}};return{set visible(v){arrow.visible=arrowHandle.visible=shaft.visible=shaftHandle.visible=curve.visible=rotateHandle.visible=arrow1.visible=arrow2.visible=v;if(!v){bigArrowHead.visible=v;hoop.visible=v;}},set culled(c){arrow.culled=arrowHandle.culled=shaft.culled=shaftHandle.culled=curve.culled=rotateHandle.culled=arrow1.culled=arrow2.culled=c;if(!c){bigArrowHead.culled=c;hoop.culled=c;}}};};this._displayMeshes=[// Meshes that are always visible
|
|
25925
|
+
rootNode.addChild(new Mesh(rootNode,{// plane
|
|
25926
|
+
geometry:new ReadableGeometry(rootNode,{primitive:"triangles",positions:[0.5,0.5,0.0,0.5,-0.5,0.0,// 0
|
|
25927
|
+
-0.5,-0.5,0.0,-0.5,0.5,0.0,// 1
|
|
25928
|
+
0.5,0.5,-0.0,0.5,-0.5,-0.0,// 2
|
|
25929
|
+
-0.5,-0.5,-0.0,-0.5,0.5,-0.0// 3
|
|
25930
|
+
],indices:[0,1,2,2,3,0]}),material:new PhongMaterial(rootNode,{emissive:[0,0.0,0],diffuse:[0,0,0],backfaces:true}),opacity:0.6,ghosted:true,ghostMaterial:new EmphasisMaterial(rootNode,{edges:false,filled:true,fillColor:[1,1,0],edgeColor:[0,0,0],fillAlpha:0.1,backfaces:true}),pickable:false,collidable:true,clippable:false,visible:false,scale:[2.4,2.4,1],isObject:false}),NO_STATE_INHERIT),rootNode.addChild(new Mesh(rootNode,{// Visible frame
|
|
25931
|
+
geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:1.7,tube:tubeRadius*2,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),//highlighted: true,
|
|
25932
|
+
highlightMaterial:new EmphasisMaterial(rootNode,{edges:false,edgeColor:[0.0,0.0,0.0],filled:true,fillColor:[0.8,0.8,0.8],fillAlpha:1.0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,.1],rotation:[0,0,45],isObject:false}),NO_STATE_INHERIT),rootNode.addChild(new Mesh(rootNode,{// center
|
|
25933
|
+
geometry:new ReadableGeometry(rootNode,buildSphereGeometry({radius:0.05})),material:new PhongMaterial(rootNode,{diffuse:[0.0,0.0,0.0],emissive:[0,0,0],ambient:[0.0,0.0,0.0],specular:[.6,.6,.3],shininess:80}),pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),//----------------------------------------------------------------------------------------------------------
|
|
25934
|
+
//
|
|
25935
|
+
//----------------------------------------------------------------------------------------------------------
|
|
25936
|
+
addAxis([1,0,0],[1,0,0],[1,0,0]),addAxis([0,1,0],[0,-1,0],[0,1,0]),addAxis([0,0,1],[0,0,-1],[0,0,-1])];var cleanups=[];{// Keep gizmo screen size constant
|
|
25937
|
+
var lastDist=-1;var setRootNodeScale=function setRootNodeScale(size){return rootNode.scale=[size,size,size];};var onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.distVec3(camera.eye,pos));if(camera.projection==="perspective"){if(dist!==lastDist){setRootNodeScale(0.07*dist*Math.tan(camera.perspective.fov*math.DEGTORAD));}}else if(camera.projection==="ortho"){setRootNodeScale(camera.ortho.scale/10);}lastDist=dist;});cleanups.push(function(){return scene.off(onSceneTick);});}var localToWorldVec=function(){var mat=math.mat4();return function(localVec,worldVec){math.quaternionToMat4(rootNode.quaternion,mat);math.transformVec3(mat,localVec,worldVec);math.normalizeVec3(worldVec);return worldVec;};}();var getTranslationPlane=function getTranslationPlane(worldAxis,planeNormal){var absX=Math.abs(worldAxis[0]);if(absX>Math.abs(worldAxis[1])&&absX>Math.abs(worldAxis[2])){math.cross3Vec3(worldAxis,[0,1,0],planeNormal);}else{math.cross3Vec3(worldAxis,[1,0,0],planeNormal);}math.cross3Vec3(planeNormal,worldAxis,planeNormal);math.normalizeVec3(planeNormal);};var self=this;var dragRotateSectionPlane=function(){var p1=math.vec4();var p2=math.vec4();var c=math.vec4();var worldAxis=math.vec4();var dir=math.vec3();var mat=math.mat4();var planeNormal=math.vec3();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var hasData=getPointerPlaneIntersect(fromMouse,worldAxis,p1)&&getPointerPlaneIntersect(toMouse,worldAxis,p2);if(!hasData){// Find intersections with view plane and project down to origin
|
|
25938
|
+
getTranslationPlane(worldAxis,planeNormal);getPointerPlaneIntersect(fromMouse,planeNormal,p1,1);// Ensure plane moves closer to camera so angles become workable
|
|
25939
|
+
getPointerPlaneIntersect(toMouse,planeNormal,p2,1);var dot=math.dotVec3(p1,worldAxis);p1[0]-=dot*worldAxis[0];p1[1]-=dot*worldAxis[1];p1[2]-=dot*worldAxis[2];dot=math.dotVec3(p2,worldAxis);p2[0]-=dot*worldAxis[0];p2[1]-=dot*worldAxis[1];p2[2]-=dot*worldAxis[2];}math.normalizeVec3(p1);math.normalizeVec3(p2);dot=math.dotVec3(p1,p2);dot=math.clamp(dot,-1.0,1.0);// Rounding errors cause dot to exceed allowed range
|
|
25940
|
+
var incDegrees=Math.acos(dot)*math.RADTODEG;math.cross3Vec3(p1,p2,c);if(math.dotVec3(c,worldAxis)<0.0){incDegrees=-incDegrees;}rootNode.rotate(baseAxis,incDegrees);if(self._sectionPlane){math.quaternionToMat4(rootNode.quaternion,mat);// << ---
|
|
25941
|
+
math.transformVec3(mat,[0,0,1],dir);ignoreNextSectionPlaneDirUpdate=true;self._sectionPlane.dir=dir;}};}();var getPointerPlaneIntersect=function(){var dir=math.vec4([0,0,0,1]);var matrix=math.mat4();return function(mouse,axis,dest,offset){offset=offset||0;dir[0]=mouse[0]/canvas.width*2.0-1.0;dir[1]=-(mouse[1]/canvas.height*2.0-1.0);dir[2]=0.0;dir[3]=1.0;math.mulMat4(camera.projMatrix,camera.viewMatrix,matrix);// Unproject norm device coords to view coords
|
|
25942
|
+
math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(dir,1.0/dir[3]);// This is now point A on the ray in world space
|
|
25943
|
+
var rayO=camera.eye;// The direction
|
|
25944
|
+
math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
|
|
25945
|
+
var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();{var deactivateActive=null;var currentDrag=null;cleanups.push(function(){if(currentDrag){currentDrag.cleanup();}});var _canvasPos3=math.vec2();var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);};var pickHandler=function pickHandler(e){copyCanvasPos(e,_canvasPos3);var pickResult=viewer.scene.pick({canvasPos:_canvasPos3});var pickEntity=pickResult&&pickResult.entity;var pickId=pickEntity&&pickEntity.id;return pickId in handlers&&handlers[pickId];};var startDrag=function startDrag(event,matchesEvent){var handler=pickHandler(matchesEvent(event));if(handler){if(currentDrag){currentDrag.cleanup();}var dragAction=handler.initDragAction(_canvasPos3);if(dragAction){cameraControl.pointerEnabled=false;// or .active = false ?
|
|
25946
|
+
handler.setActivated(true);currentDrag={onChange:function onChange(event){var e=matchesEvent(event);if(e){copyCanvasPos(e,_canvasPos3);dragAction(_canvasPos3);}},cleanup:function cleanup(){currentDrag=null;cameraControl.pointerEnabled=true;// or .active = true ?
|
|
25947
|
+
handler.setActivated(false);}};}}};var addCanvasEventListener=function addCanvasEventListener(type,listener){canvas.addEventListener(type,listener);cleanups.push(function(){return canvas.removeEventListener(type,listener);});};addCanvasEventListener("mousedown",function(e){e.preventDefault();if(e.which===1){startDrag(e,function(event){return event.which===1&&event;});}});addCanvasEventListener("mousemove",function(e){if(currentDrag){currentDrag.onChange(e);}else{if(deactivateActive){deactivateActive();}var handler=pickHandler(e);if(handler){handler.setActivated(true);deactivateActive=function deactivateActive(){return handler.setActivated(false);};}else{deactivateActive=null;}}});addCanvasEventListener("mouseup",function(e){if(currentDrag){currentDrag.onChange(e);currentDrag.cleanup();}});addCanvasEventListener("touchstart",function(event){event.preventDefault();if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}});addCanvasEventListener("touchmove",function(event){event.preventDefault();currentDrag&¤tDrag.onChange(event);});addCanvasEventListener("touchend",function(event){event.preventDefault();if(currentDrag){currentDrag.onChange(event);currentDrag.cleanup();}});}this._unbindSectionPlane=function(){};this.__setSectionPlane=function(sectionPlane){_this141.id=sectionPlane.id;_this141._sectionPlane=sectionPlane;var setPosFromSectionPlane=function setPosFromSectionPlane(){return setPos(sectionPlane.pos);};var setDirFromSectionPlane=function setDirFromSectionPlane(){return rootNode.quaternion=math.vec3PairToQuaternion(zeroVec$1,sectionPlane.dir,quat$1);};setPosFromSectionPlane();setDirFromSectionPlane();var onSectionPlanePos=sectionPlane.on("pos",setPosFromSectionPlane);var onSectionPlaneDir=sectionPlane.on("dir",function(){if(!ignoreNextSectionPlaneDirUpdate){setDirFromSectionPlane();}else{ignoreNextSectionPlaneDirUpdate=false;}});_this141._unbindSectionPlane=function(){_this141.id=null;_this141._sectionPlane=null;sectionPlane.off(onSectionPlanePos);sectionPlane.off(onSectionPlaneDir);_this141._unbindSectionPlane=function(){};};};this.__destroy=function(){cleanups.forEach(function(c){return c();});_this141._unbindSectionPlane();rootNode.destroy();_this141._displayMeshes=[];for(var id in handlers){delete handlers[id];}};}_createClass(Control,[{key:"_destroy",value:function _destroy(){this.__destroy();}/**
|
|
25924
25948
|
* Called by SectionPlanesPlugin to assign this Control to a SectionPlane.
|
|
25925
25949
|
* SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
|
|
25926
25950
|
* Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
|
|
25927
25951
|
* @private
|
|
25928
|
-
*/
|
|
25952
|
+
*/},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){this._unbindSectionPlane();if(sectionPlane){this.__setSectionPlane(sectionPlane);}}/**
|
|
25929
25953
|
* Gets the {@link SectionPlane} controlled by this Control.
|
|
25930
25954
|
* @returns {SectionPlane} The SectionPlane.
|
|
25931
|
-
*/},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
|
|
25955
|
+
*/},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
|
|
25932
25956
|
* Sets if this Control is visible.
|
|
25933
25957
|
*
|
|
25934
25958
|
* @type {Boolean}
|
|
25935
|
-
*/},{key:"setVisible",value:function setVisible(){var visible=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this._visible
|
|
25959
|
+
*/},{key:"setVisible",value:function setVisible(){var visible=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this._visible!==visible){this._visible=visible;this._displayMeshes.forEach(function(m){return m.visible=visible;});}}/**
|
|
25936
25960
|
* Gets if this Control is visible.
|
|
25937
25961
|
*
|
|
25938
25962
|
* @type {Boolean}
|
|
@@ -25940,66 +25964,11 @@ this._ignoreNextSectionPlaneDirUpdate=false;this._createNodes();this._bindEvents
|
|
|
25940
25964
|
* Sets if this Control is culled. This is called by SectionPlanesPlugin to
|
|
25941
25965
|
* temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
|
|
25942
25966
|
* @param culled
|
|
25943
|
-
*/},{key:"setCulled",value:function setCulled(culled){
|
|
25944
|
-
* Builds the Entities that represent this Control.
|
|
25945
|
-
* @private
|
|
25946
|
-
*/},{key:"_createNodes",value:function _createNodes(){var NO_STATE_INHERIT=false;var scene=this._viewer.scene;var radius=1.0;var handleTubeRadius=0.06;var hoopRadius=radius-0.2;var tubeRadius=0.01;var arrowRadius=0.07;this._rootNode=new Node$2(scene,{position:[0,0,0],scale:[5,5,5],isObject:false});var rootNode=this._rootNode;var shapes={// Reusable geometries
|
|
25947
|
-
arrowHead:new ReadableGeometry(rootNode,buildCylinderGeometry({radiusTop:0.001,radiusBottom:arrowRadius,radialSegments:32,heightSegments:1,height:0.2,openEnded:false})),arrowHeadBig:new ReadableGeometry(rootNode,buildCylinderGeometry({radiusTop:0.001,radiusBottom:0.09,radialSegments:32,heightSegments:1,height:0.25,openEnded:false})),arrowHeadHandle:new ReadableGeometry(rootNode,buildCylinderGeometry({radiusTop:0.09,radiusBottom:0.09,radialSegments:8,heightSegments:1,height:0.37,openEnded:false})),curve:new ReadableGeometry(rootNode,buildTorusGeometry({radius:hoopRadius,tube:tubeRadius,radialSegments:64,tubeSegments:14,arc:Math.PI*2.0/4.0})),curveHandle:new ReadableGeometry(rootNode,buildTorusGeometry({radius:hoopRadius,tube:handleTubeRadius,radialSegments:64,tubeSegments:14,arc:Math.PI*2.0/4.0})),hoop:new ReadableGeometry(rootNode,buildTorusGeometry({radius:hoopRadius,tube:tubeRadius,radialSegments:64,tubeSegments:8,arc:Math.PI*2.0})),axis:new ReadableGeometry(rootNode,buildCylinderGeometry({radiusTop:tubeRadius,radiusBottom:tubeRadius,radialSegments:20,heightSegments:1,height:radius,openEnded:false})),axisHandle:new ReadableGeometry(rootNode,buildCylinderGeometry({radiusTop:0.08,radiusBottom:0.08,radialSegments:20,heightSegments:1,height:radius,openEnded:false}))};var materials={// Reusable materials
|
|
25948
|
-
pickable:new PhongMaterial(rootNode,{// Invisible material for pickable handles, which define a pickable 3D area
|
|
25949
|
-
diffuse:[1,1,0],alpha:0,// Invisible
|
|
25950
|
-
alphaMode:"blend"}),red:new PhongMaterial(rootNode,{diffuse:[1,0.0,0.0],emissive:[1,0.0,0.0],ambient:[0.0,0.0,0.0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new EmphasisMaterial(rootNode,{// Emphasis for red rotation affordance hoop
|
|
25951
|
-
edges:false,fill:true,fillColor:[1,0,0],fillAlpha:0.6}),green:new PhongMaterial(rootNode,{diffuse:[0.0,1,0.0],emissive:[0.0,1,0.0],ambient:[0.0,0.0,0.0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightGreen:new EmphasisMaterial(rootNode,{// Emphasis for green rotation affordance hoop
|
|
25952
|
-
edges:false,fill:true,fillColor:[0,1,0],fillAlpha:0.6}),blue:new PhongMaterial(rootNode,{diffuse:[0.0,0.0,1],emissive:[0.0,0.0,1],ambient:[0.0,0.0,0.0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightBlue:new EmphasisMaterial(rootNode,{// Emphasis for blue rotation affordance hoop
|
|
25953
|
-
edges:false,fill:true,fillColor:[0,0,1],fillAlpha:0.2}),center:new PhongMaterial(rootNode,{diffuse:[0.0,0.0,0.0],emissive:[0,0,0],ambient:[0.0,0.0,0.0],specular:[.6,.6,.3],shininess:80}),highlightBall:new EmphasisMaterial(rootNode,{edges:false,fill:true,fillColor:[0.5,0.5,0.5],fillAlpha:0.5,vertices:false}),highlightPlane:new EmphasisMaterial(rootNode,{edges:true,edgeWidth:3,fill:false,fillColor:[0.5,0.5,.5],fillAlpha:0.5,vertices:false})};this._displayMeshes={plane:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,{primitive:"triangles",positions:[0.5,0.5,0.0,0.5,-0.5,0.0,// 0
|
|
25954
|
-
-0.5,-0.5,0.0,-0.5,0.5,0.0,// 1
|
|
25955
|
-
0.5,0.5,-0.0,0.5,-0.5,-0.0,// 2
|
|
25956
|
-
-0.5,-0.5,-0.0,-0.5,0.5,-0.0// 3
|
|
25957
|
-
],indices:[0,1,2,2,3,0]}),material:new PhongMaterial(rootNode,{emissive:[0,0.0,0],diffuse:[0,0,0],backfaces:true}),opacity:0.6,ghosted:true,ghostMaterial:new EmphasisMaterial(rootNode,{edges:false,filled:true,fillColor:[1,1,0],edgeColor:[0,0,0],fillAlpha:0.1,backfaces:true}),pickable:false,collidable:true,clippable:false,visible:false,scale:[2.4,2.4,1],isObject:false}),NO_STATE_INHERIT),planeFrame:rootNode.addChild(new Mesh(rootNode,{// Visible frame
|
|
25958
|
-
geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:1.7,tube:tubeRadius*2,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),//highlighted: true,
|
|
25959
|
-
highlightMaterial:new EmphasisMaterial(rootNode,{edges:false,edgeColor:[0.0,0.0,0.0],filled:true,fillColor:[0.8,0.8,0.8],fillAlpha:1.0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,.1],rotation:[0,0,45],isObject:false}),NO_STATE_INHERIT),//----------------------------------------------------------------------------------------------------------
|
|
25960
|
-
//
|
|
25961
|
-
//----------------------------------------------------------------------------------------------------------
|
|
25962
|
-
xCurve:rootNode.addChild(new Mesh(rootNode,{// Red hoop about Y-axis
|
|
25963
|
-
geometry:shapes.curve,material:materials.red,matrix:function(){var rotate2=math.rotationMat4v(90*math.DEGTORAD,[0,1,0],math.identityMat4());var rotate1=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate1,rotate2,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xCurveHandle:rootNode.addChild(new Mesh(rootNode,{// Red hoop about Y-axis
|
|
25964
|
-
geometry:shapes.curveHandle,material:materials.pickable,matrix:function(){var rotate2=math.rotationMat4v(90*math.DEGTORAD,[0,1,0],math.identityMat4());var rotate1=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate1,rotate2,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xCurveArrow1:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.red,matrix:function(){var translate=math.translateMat4c(0.,-0.07,-0.8,math.identityMat4());var scale=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());var rotate=math.rotationMat4v(0*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(math.mulMat4(translate,scale,math.identityMat4()),rotate,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),xCurveArrow2:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.red,matrix:function(){var translate=math.translateMat4c(0.0,-0.8,-0.07,math.identityMat4());var scale=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());var rotate=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(math.mulMat4(translate,scale,math.identityMat4()),rotate,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),//----------------------------------------------------------------------------------------------------------
|
|
25965
|
-
//
|
|
25966
|
-
//----------------------------------------------------------------------------------------------------------
|
|
25967
|
-
yCurve:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.curve,material:materials.green,rotation:[-90,0,0],pickable:false,collidable:true,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),yCurveHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.curveHandle,material:materials.pickable,rotation:[-90,0,0],pickable:true,collidable:true,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),yCurveArrow1:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.green,matrix:function(){var translate=math.translateMat4c(0.07,0,-0.8,math.identityMat4());var scale=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());var rotate=math.rotationMat4v(90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(math.mulMat4(translate,scale,math.identityMat4()),rotate,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yCurveArrow2:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.green,matrix:function(){var translate=math.translateMat4c(0.8,0.0,-0.07,math.identityMat4());var scale=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());var rotate=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(math.mulMat4(translate,scale,math.identityMat4()),rotate,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),//----------------------------------------------------------------------------------------------------------
|
|
25968
|
-
//
|
|
25969
|
-
//----------------------------------------------------------------------------------------------------------
|
|
25970
|
-
zCurve:rootNode.addChild(new Mesh(rootNode,{// Blue hoop about Z-axis
|
|
25971
|
-
geometry:shapes.curve,material:materials.blue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zCurveHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.curveHandle,material:materials.pickable,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zCurveCurveArrow1:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var translate=math.translateMat4c(.8,-0.07,0,math.identityMat4());var scale=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());return math.mulMat4(translate,scale,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zCurveArrow2:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var translate=math.translateMat4c(.05,-0.8,0,math.identityMat4());var scale=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());var rotate=math.rotationMat4v(90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(math.mulMat4(translate,scale,math.identityMat4()),rotate,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),//----------------------------------------------------------------------------------------------------------
|
|
25972
|
-
//
|
|
25973
|
-
//----------------------------------------------------------------------------------------------------------
|
|
25974
|
-
center:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildSphereGeometry({radius:0.05})),material:materials.center,pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),//----------------------------------------------------------------------------------------------------------
|
|
25975
|
-
//
|
|
25976
|
-
//----------------------------------------------------------------------------------------------------------
|
|
25977
|
-
xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.red,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrowHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadHandle,material:materials.pickable,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),xAxis:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axis,material:materials.red,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axisHandle,material:materials.pickable,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),//----------------------------------------------------------------------------------------------------------
|
|
25978
|
-
//
|
|
25979
|
-
//----------------------------------------------------------------------------------------------------------
|
|
25980
|
-
yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.green,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrowHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadHandle,material:materials.pickable,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,visible:false,opacity:0.2,isObject:false}),NO_STATE_INHERIT),yShaft:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axis,material:materials.green,position:[0,-radius/2,0],pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yShaftHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axisHandle,material:materials.pickable,position:[0,-radius/2,0],pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),//----------------------------------------------------------------------------------------------------------
|
|
25981
|
-
//
|
|
25982
|
-
//----------------------------------------------------------------------------------------------------------
|
|
25983
|
-
zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrowHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadHandle,material:materials.pickable,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:true,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zShaft:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axis,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),clippable:false,pickable:false,collidable:true,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axisHandle,material:materials.pickable,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),clippable:false,pickable:true,collidable:true,visible:false,isObject:false}),NO_STATE_INHERIT)};this._affordanceMeshes={planeFrame:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:2,tube:tubeRadius,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:true,highlightMaterial:new EmphasisMaterial(rootNode,{edges:false,filled:true,fillColor:[1,1,0],fillAlpha:1.0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,1],rotation:[0,0,45],isObject:false}),NO_STATE_INHERIT),xHoop:rootNode.addChild(new Mesh(rootNode,{// Full
|
|
25984
|
-
geometry:shapes.hoop,material:materials.red,highlighted:true,highlightMaterial:materials.highlightRed,matrix:function(){var rotate2=math.rotationMat4v(90*math.DEGTORAD,[0,1,0],math.identityMat4());var rotate1=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate1,rotate2,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.green,highlighted:true,highlightMaterial:materials.highlightGreen,rotation:[-90,0,0],pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zHoop:rootNode.addChild(new Mesh(rootNode,{// Blue hoop about Z-axis
|
|
25985
|
-
geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:materials.highlightBlue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:true,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.red,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.green,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};}},{key:"_bindEvents",value:function _bindEvents(){var _this142=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};var rootNode=this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
|
|
25986
|
-
var dragAction=null;// Action we're doing while we drag an arrow or hoop.
|
|
25987
|
-
var lastCanvasPos=math.vec2();var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;{// Keep gizmo screen size constant
|
|
25988
|
-
var _tempVec3a=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this142._pos,_tempVec3a)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;var size=0.07*worldSize;rootNode.scale=[size,size,size];lastDist=dist;}}if(camera.projection==="ortho"){var _worldSize=camera.ortho.scale/10;var _size=_worldSize;rootNode.scale=[_size,_size,_size];lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var localToWorldVec=function(){var mat=math.mat4();return function(localVec,worldVec){math.quaternionToMat4(self._rootNode.quaternion,mat);math.transformVec3(mat,localVec,worldVec);math.normalizeVec3(worldVec);return worldVec;};}();var getTranslationPlane=function(){var planeNormal=math.vec3();return function(worldAxis){var absX=Math.abs(worldAxis[0]);if(absX>Math.abs(worldAxis[1])&&absX>Math.abs(worldAxis[2])){math.cross3Vec3(worldAxis,[0,1,0],planeNormal);}else{math.cross3Vec3(worldAxis,[1,0,0],planeNormal);}math.cross3Vec3(planeNormal,worldAxis,planeNormal);math.normalizeVec3(planeNormal);return planeNormal;};}();var dragTranslateSectionPlane=function(){var p1=math.vec3();var p2=math.vec3();var worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);self._pos[0]+=worldAxis[0]*dot;self._pos[1]+=worldAxis[1]*dot;self._pos[2]+=worldAxis[2]*dot;self._rootNode.position=self._pos;if(self._sectionPlane){self._sectionPlane.pos=self._pos;}};}();var dragRotateSectionPlane=function(){var p1=math.vec4();var p2=math.vec4();var c=math.vec4();var worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var hasData=getPointerPlaneIntersect(fromMouse,worldAxis,p1)&&getPointerPlaneIntersect(toMouse,worldAxis,p2);if(!hasData){// Find intersections with view plane and project down to origin
|
|
25989
|
-
var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1,1);// Ensure plane moves closer to camera so angles become workable
|
|
25990
|
-
getPointerPlaneIntersect(toMouse,planeNormal,p2,1);var dot=math.dotVec3(p1,worldAxis);p1[0]-=dot*worldAxis[0];p1[1]-=dot*worldAxis[1];p1[2]-=dot*worldAxis[2];dot=math.dotVec3(p2,worldAxis);p2[0]-=dot*worldAxis[0];p2[1]-=dot*worldAxis[1];p2[2]-=dot*worldAxis[2];}math.normalizeVec3(p1);math.normalizeVec3(p2);dot=math.dotVec3(p1,p2);dot=math.clamp(dot,-1.0,1.0);// Rounding errors cause dot to exceed allowed range
|
|
25991
|
-
var incDegrees=Math.acos(dot)*math.RADTODEG;math.cross3Vec3(p1,p2,c);if(math.dotVec3(c,worldAxis)<0.0){incDegrees=-incDegrees;}self._rootNode.rotate(baseAxis,incDegrees);rotateSectionPlane();};}();var getPointerPlaneIntersect=function(){var dir=math.vec4([0,0,0,1]);var matrix=math.mat4();return function(mouse,axis,dest,offset){offset=offset||0;dir[0]=mouse[0]/canvas.width*2.0-1.0;dir[1]=-(mouse[1]/canvas.height*2.0-1.0);dir[2]=0.0;dir[3]=1.0;math.mulMat4(camera.projMatrix,camera.viewMatrix,matrix);// Unproject norm device coords to view coords
|
|
25992
|
-
math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(dir,1.0/dir[3]);// This is now point A on the ray in world space
|
|
25993
|
-
var rayO=camera.eye;// The direction
|
|
25994
|
-
math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
|
|
25995
|
-
var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();var rotateSectionPlane=function(){var dir=math.vec3();var mat=math.mat4();return function(){if(self.sectionPlane){math.quaternionToMat4(rootNode.quaternion,mat);// << ---
|
|
25996
|
-
math.transformVec3(mat,[0,0,1],dir);self._setSectionPlaneDir(dir);}};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this142._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this142._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this142._displayMeshes.xAxisHandle.id:affordanceMesh=_this142._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this142._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this142._displayMeshes.yShaftHandle.id:affordanceMesh=_this142._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this142._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this142._displayMeshes.zAxisHandle.id:affordanceMesh=_this142._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this142._displayMeshes.xCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this142._displayMeshes.yCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this142._displayMeshes.zCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
|
|
25997
|
-
}if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOutEntity",function(hit){if(!_this142._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;});canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this142._visible){return;}if(!grabbed){return;}_this142._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
|
|
25998
|
-
down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];break;}});canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this142._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this142._visible){return;}_this142._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;});canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this142._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);return Control;}();/**
|
|
25967
|
+
*/},{key:"setCulled",value:function setCulled(culled){this._displayMeshes.forEach(function(m){return m.culled=culled;});}}]);return Control;}();/**
|
|
25999
25968
|
* Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.
|
|
26000
25969
|
*
|
|
26001
25970
|
* @private
|
|
26002
|
-
*/var Plane$1=/*#__PURE__*/function(){/** @private */function Plane$1(overview,overviewScene,sectionPlane){var
|
|
25971
|
+
*/var Plane$1=/*#__PURE__*/function(){/** @private */function Plane$1(overview,overviewScene,sectionPlane){var _this142=this;_classCallCheck(this,Plane$1);/**
|
|
26003
25972
|
* The ID of this SectionPlanesOverviewPlane.
|
|
26004
25973
|
*
|
|
26005
25974
|
* @type {String}
|
|
@@ -26007,7 +25976,7 @@ down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction
|
|
|
26007
25976
|
* The {@link SectionPlane} represented by this SectionPlanesOverviewPlane.
|
|
26008
25977
|
*
|
|
26009
25978
|
* @type {SectionPlane}
|
|
26010
|
-
*/this._sectionPlane=sectionPlane;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:.5,ySize:.5,zSize:.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec=math.vec3([0,0,1]);var _quat=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=
|
|
25979
|
+
*/this._sectionPlane=sectionPlane;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:.5,ySize:.5,zSize:.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec=math.vec3([0,0,1]);var _quat=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=_this142._sectionPlane.scene.center;var negDir=[-_this142._sectionPlane.dir[0],-_this142._sectionPlane.dir[1],-_this142._sectionPlane.dir[2]];math.subVec3(origin,_this142._sectionPlane.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec,_this142._sectionPlane.dir,_quat);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this142._mesh.quaternion=quaternion;_this142._mesh.position=pos3;};this._onSectionPlanePos=this._sectionPlane.on("pos",update);this._onSectionPlaneDir=this._sectionPlane.on("dir",update);// update();
|
|
26011
25980
|
}this._highlighted=false;this._selected=false;}/**
|
|
26012
25981
|
* Sets if this SectionPlanesOverviewPlane is highlighted.
|
|
26013
25982
|
*
|
|
@@ -26040,7 +26009,7 @@ down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction
|
|
|
26040
26009
|
* @private
|
|
26041
26010
|
*/var Overview$1=/*#__PURE__*/function(){/**
|
|
26042
26011
|
* @private
|
|
26043
|
-
*/function Overview$1(plugin,cfg){var
|
|
26012
|
+
*/function Overview$1(plugin,cfg){var _this143=this;_classCallCheck(this,Overview$1);if(!cfg.onHoverEnterPlane||!cfg.onHoverLeavePlane||!cfg.onClickedNothing||!cfg.onClickedPlane){throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";}/**
|
|
26044
26013
|
* The {@link SectionPlanesPlugin} that owns this SectionPlanesOverview.
|
|
26045
26014
|
*
|
|
26046
26015
|
* @type {SectionPlanesPlugin}
|
|
@@ -26053,12 +26022,12 @@ this._canvas=cfg.overviewCanvas;//----------------------------------------------
|
|
|
26053
26022
|
this._scene=new Scene(this._viewer,{canvasId:this._canvas.id,transparent:true});this._scene.clearLights();new DirLight(this._scene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:1.0,space:"view"});new DirLight(this._scene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:1.0,space:"view"});new DirLight(this._scene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:1.0,space:"view"});this._scene.camera;this._scene.camera.perspective.fov=70;this._zUp=false;//--------------------------------------------------------------------------------------------------------------
|
|
26054
26023
|
// Synchronize overview scene camera with viewer camera
|
|
26055
26024
|
//--------------------------------------------------------------------------------------------------------------
|
|
26056
|
-
{var camera=this._scene.camera;var _matrix2=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var _eyeLookVec3=math.vec3();var eyeLookVecOverview=math.vec3();var upOverview=math.vec3();this._synchCamera=function(){var eye=
|
|
26025
|
+
{var camera=this._scene.camera;var _matrix2=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var _eyeLookVec3=math.vec3();var eyeLookVecOverview=math.vec3();var upOverview=math.vec3();this._synchCamera=function(){var eye=_this143._viewer.camera.eye;var look=_this143._viewer.camera.look;var up=_this143._viewer.camera.up;math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,_eyeLookVec3)),7);if(_this143._zUp){// +Z up
|
|
26057
26026
|
math.transformVec3(_matrix2,_eyeLookVec3,eyeLookVecOverview);math.transformVec3(_matrix2,up,upOverview);camera.look=[0,0,0];camera.eye=math.transformVec3(_matrix2,_eyeLookVec3,eyeLookVecOverview);camera.up=math.transformPoint3(_matrix2,up,upOverview);}else{// +Y up
|
|
26058
|
-
camera.look=[0,0,0];camera.eye=_eyeLookVec3;camera.up=up;}};}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera);this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera);this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",function(fov){
|
|
26027
|
+
camera.look=[0,0,0];camera.eye=_eyeLookVec3;camera.up=up;}};}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera);this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera);this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",function(fov){_this143._scene.camera.perspective.fov=fov;});//--------------------------------------------------------------------------------------------------------------
|
|
26059
26028
|
// Bind overview canvas events
|
|
26060
26029
|
//--------------------------------------------------------------------------------------------------------------
|
|
26061
|
-
{var hoveredEntity=null;this._onInputMouseMove=this._scene.input.on("mousemove",function(coords){var hit=
|
|
26030
|
+
{var hoveredEntity=null;this._onInputMouseMove=this._scene.input.on("mousemove",function(coords){var hit=_this143._scene.pick({canvasPos:coords});if(hit){if(!hoveredEntity||hit.entity.id!==hoveredEntity.id){if(hoveredEntity){var _plane=_this143._planes[hoveredEntity.id];if(_plane){_this143._onHoverLeavePlane(hoveredEntity.id);}}hoveredEntity=hit.entity;var plane=_this143._planes[hoveredEntity.id];if(plane){_this143._onHoverEnterPlane(hoveredEntity.id);}}}else{if(hoveredEntity){_this143._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}}});this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){if(hoveredEntity){var plane=_this143._planes[hoveredEntity.id];if(plane){_this143._onClickedPlane(hoveredEntity.id);}}else{_this143._onClickedNothing();}});this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){if(hoveredEntity){_this143._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}});}//--------------------------------------------------------------------------------------------------------------
|
|
26062
26031
|
// Configure overview
|
|
26063
26032
|
//--------------------------------------------------------------------------------------------------------------
|
|
26064
26033
|
this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSectionPlane()
|
|
@@ -26166,10 +26135,10 @@ this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSe
|
|
|
26166
26135
|
* @param {String} [cfg.id="SectionPlanes"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
26167
26136
|
* @param {String} [cfg.overviewCanvasId] ID of a canvas element to display the overview.
|
|
26168
26137
|
* @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.
|
|
26169
|
-
*/function SectionPlanesPlugin(viewer){var
|
|
26138
|
+
*/function SectionPlanesPlugin(viewer){var _this144;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this144=_super161.call(this,"SectionPlanes",viewer);_this144._freeControls=[];_this144._sectionPlanes=viewer.scene.sectionPlanes;_this144._controls={};_this144._shownControlId=null;if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this144.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this144._overview=new Overview$1(_assertThisInitialized(_this144),{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this144._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this144._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this144.getShownControl()===id){_this144.hideControl();return;}_this144.showControl(id);var sectionPlane=_this144.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB$1.set(_this144.viewer.scene.aabb);math.getAABB3Center(tempAABB$1,tempVec3$1);tempAABB$1[0]+=sectionPlanePos[0]-tempVec3$1[0];tempAABB$1[1]+=sectionPlanePos[1]-tempVec3$1[1];tempAABB$1[2]+=sectionPlanePos[2]-tempVec3$1[2];tempAABB$1[3]+=sectionPlanePos[0]-tempVec3$1[0];tempAABB$1[4]+=sectionPlanePos[1]-tempVec3$1[1];tempAABB$1[5]+=sectionPlanePos[2]-tempVec3$1[2];_this144.viewer.cameraFlight.flyTo({aabb:tempAABB$1,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this144.hideControl();}});}}_this144._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
|
|
26170
26139
|
// instantiating a SectionPlane independently of SectionPlanesPlugin, which can be done
|
|
26171
26140
|
// by BCFViewpointsPlugin#loadViewpoint().
|
|
26172
|
-
|
|
26141
|
+
_this144._sectionPlaneCreated(sectionPlane);});return _this144;}/**
|
|
26173
26142
|
* Sets if the overview canvas is visible.
|
|
26174
26143
|
*
|
|
26175
26144
|
* @param {Boolean} visible Whether or not the overview canvas is visible.
|
|
@@ -26194,7 +26163,7 @@ _this145._sectionPlaneCreated(sectionPlane);});return _this145;}/**
|
|
|
26194
26163
|
* @returns {SectionPlane} The new {@link SectionPlane}.
|
|
26195
26164
|
*/},{key:"createSectionPlane",value:function createSectionPlane(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id!==undefined&¶ms.id!==null&&this.viewer.scene.components[params.id]){this.error("Viewer component with this ID already exists: "+params.id);delete params.id;}// Note that SectionPlane constructor fires "sectionPlaneCreated" on the Scene,
|
|
26196
26165
|
// which SectionPlanesPlugin handles and calls #_sectionPlaneCreated to create gizmo and add to overview canvas.
|
|
26197
|
-
var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos,dir:params.dir,active:true});return sectionPlane;}},{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var
|
|
26166
|
+
var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos,dir:params.dir,active:true});return sectionPlane;}},{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this145=this;var control=this._freeControls.length>0?this._freeControls.pop():new Control(this);control._setSectionPlane(sectionPlane);control.setVisible(false);this._controls[sectionPlane.id]=control;if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this145._sectionPlaneDestroyed(sectionPlane);});}/**
|
|
26198
26167
|
* Inverts the direction of {@link SectionPlane#dir} on every existing SectionPlane.
|
|
26199
26168
|
*
|
|
26200
26169
|
* Inverts all SectionPlanes, including those that were not created with SectionPlanesPlugin.
|
|
@@ -26537,7 +26506,7 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
|
|
|
26537
26506
|
* @param {Object} cfg Plugin configuration.
|
|
26538
26507
|
* @param {String} [cfg.id="StoreyViews"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
26539
26508
|
* @param {Boolean} [cfg.fitStoreyMaps=false] If enabled, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different floor map images. If disabled, each floor map image will display the model's extents, ensuring a consistent scale across all images.
|
|
26540
|
-
*/function StoreyViewsPlugin(viewer){var
|
|
26509
|
+
*/function StoreyViewsPlugin(viewer){var _this146;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,StoreyViewsPlugin);_this146=_super162.call(this,"StoreyViews",viewer);_this146._objectsMemento=new ObjectsMemento();_this146._cameraMemento=new CameraMemento();/**
|
|
26541
26510
|
* A {@link Storey} for each ````IfcBuildingStorey```.
|
|
26542
26511
|
*
|
|
26543
26512
|
* There will be a {@link Storey} for every existing {@link MetaObject} whose {@link MetaObject#type} equals "IfcBuildingStorey".
|
|
@@ -26545,13 +26514,13 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
|
|
|
26545
26514
|
* These are created and destroyed automatically as models are loaded and destroyed.
|
|
26546
26515
|
*
|
|
26547
26516
|
* @type {{String:Storey}}
|
|
26548
|
-
*/
|
|
26517
|
+
*/_this146.storeys={};_this146._storeysList=null;/**
|
|
26549
26518
|
* A set of {@link Storey}s for each {@link MetaModel}.
|
|
26550
26519
|
*
|
|
26551
26520
|
* These are created and destroyed automatically as models are loaded and destroyed.
|
|
26552
26521
|
*
|
|
26553
26522
|
* @type {{String: {String:Storey}}}
|
|
26554
|
-
*/
|
|
26523
|
+
*/_this146.modelStoreys={};_this146._fitStoreyMaps=!!cfg.fitStoreyMaps;_this146._onModelLoaded=_this146.viewer.scene.on("modelLoaded",function(modelId){_this146._registerModelStoreys(modelId);_this146.fire("storeys",_this146.storeys);});return _this146;}_createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this147=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var _i532=0,len=storeyIds.length;_i532<len;_i532++){var storeyId=storeyIds[_i532];var metaObject=metaScene.metaObjects[storeyId];var childObjectIds=metaObject.getObjectIDsInSubtree();var storeyAABB=scene.getAABB(childObjectIds);var numObjects=Math.random()>0.5?childObjectIds.length:0;var storey=new Storey(this,model.aabb,storeyAABB,modelId,storeyId,numObjects);storey._onModelDestroyed=model.once("destroyed",function(){_this147._deregisterModelStoreys(modelId);_this147.fire("storeys",_this147.storeys);});this.storeys[storeyId]=storey;this._storeysList=null;if(!this.modelStoreys[modelId]){this.modelStoreys[modelId]={};}this.modelStoreys[modelId][storeyId]=storey;}}this._clipBoundingBoxes();}},{key:"_clipBoundingBoxes",value:function _clipBoundingBoxes(){var storeysList=this.storeysList;var metaScene=this.viewer.metaScene;var camera=this.viewer.camera;var worldUp=camera.worldUp;var xUp=worldUp[0]>worldUp[1]&&worldUp[0]>worldUp[2];var yUp=!xUp&&worldUp[1]>worldUp[0]&&worldUp[1]>worldUp[2];!xUp&&!yUp&&worldUp[2]>worldUp[0]&&worldUp[2]>worldUp[1];var bbIndex;if(xUp)bbIndex=0;else if(yUp)bbIndex=1;else bbIndex=2;for(var _i533=0,len=storeysList.length;_i533<len;_i533++){var storeyMetaObjectCur=metaScene.metaObjects[storeysList[_i533].storeyId];var elevationCur=storeyMetaObjectCur.attributes.elevation;if(isNaN(elevationCur))return;var bb=storeysList[_i533].storeyAABB;bb[bbIndex]=Math.max(bb[1],parseFloat(elevationCur));if(_i533>0){var storeyMetaObjectNext=metaScene.metaObjects[storeysList[_i533-1].storeyId];var elevationNext=storeyMetaObjectNext.attributes.elevation;bb[4]=Math.min(bb[bbIndex+3],parseFloat(elevationNext));}this.storeys[storeysList[_i533].storeyId].storeyAABB=bb;}}},{key:"_deregisterModelStoreys",value:function _deregisterModelStoreys(modelId){var storeys=this.modelStoreys[modelId];if(storeys){var scene=this.viewer.scene;for(var storyObjectId in storeys){if(storeys.hasOwnProperty(storyObjectId)){var storey=storeys[storyObjectId];var model=scene.models[storey.modelId];if(model){model.off(storey._onModelDestroyed);}delete this.storeys[storyObjectId];this._storeysList=null;}}delete this.modelStoreys[modelId];}}/**
|
|
26555
26524
|
* When true, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different
|
|
26556
26525
|
* floor map images. If false, each floor map image will display the model's extents, ensuring a consistent scale across all images.
|
|
26557
26526
|
* @returns {*|boolean}
|
|
@@ -26653,7 +26622,7 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
|
|
|
26653
26622
|
* Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
|
|
26654
26623
|
*
|
|
26655
26624
|
* @returns {null}
|
|
26656
|
-
*/},{key:"storeysList",get:function get(){if(!this._storeysList){this._storeysList=Object.values(this.storeys);this._storeysList.sort(this._getSpatialSortFunc());}return this._storeysList;}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){var
|
|
26625
|
+
*/},{key:"storeysList",get:function get(){if(!this._storeysList){this._storeysList=Object.values(this.storeys);this._storeysList.sort(this._getSpatialSortFunc());}return this._storeysList;}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){var _this148=this;var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;return this._spatialSortFunc||(this._spatialSortFunc=function(storey1,storey2){var idx=0;if(camera.xUp){idx=0;}else if(camera.yUp){idx=1;}else{idx=2;}var metaScene=_this148.viewer.metaScene;var storey1MetaObject=metaScene.metaObjects[storey1.storeyId];var storey2MetaObject=metaScene.metaObjects[storey2.storeyId];if(storey1MetaObject&&storey1MetaObject.attributes&&storey1MetaObject.attributes.elevation!==undefined&&storey2MetaObject&&storey2MetaObject.attributes&&storey2MetaObject.attributes.elevation!==undefined){var elevation1=Number.parseFloat(storey1MetaObject.attributes.elevation);var elevation2=Number.parseFloat(storey2MetaObject.attributes.elevation);if(elevation1>elevation2){return-1;}if(elevation1<elevation2){return 1;}return 0;}else{if(storey1.aabb[idx]>storey2.aabb[idx]){return-1;}if(storey1.aabb[idx]<storey2.aabb[idx]){return 1;}return 0;}});}},{key:"_filterStoreys",value:function _filterStoreys(modelId){return Object.fromEntries(Object.entries(this.storeys).filter(function(_ref21){var _ref22=_slicedToArray(_ref21,2),_=_ref22[0],value=_ref22[1];return value.modelId===modelId;}));}}]);return StoreyViewsPlugin;}(Plugin);var zeroVec=new Float64Array([0,0,1]);var quat=new Float64Array(4);/**
|
|
26657
26626
|
* Controls a {@link SectionPlane} with mouse and touch input.
|
|
26658
26627
|
*/var FaceAlignedSectionPlanesControl=/*#__PURE__*/function(){/** @private */function FaceAlignedSectionPlanesControl(plugin){_classCallCheck(this,FaceAlignedSectionPlanesControl);/**
|
|
26659
26628
|
* ID of this FaceAlignedSectionPlanesControl.
|
|
@@ -26672,7 +26641,7 @@ this._ignoreNextSectionPlaneDirUpdate=false;this._createNodes();this._bindEvents
|
|
|
26672
26641
|
* FaceAlignedSectionPlanesPlugin keeps FaceAlignedSectionPlanesControls in a reuse pool.
|
|
26673
26642
|
* Call with a null or undefined value to disconnect the FaceAlignedSectionPlanesControl ffrom whatever SectionPlane it was assigned to.
|
|
26674
26643
|
* @private
|
|
26675
|
-
*/_createClass(FaceAlignedSectionPlanesControl,[{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var
|
|
26644
|
+
*/_createClass(FaceAlignedSectionPlanesControl,[{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this149=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.id;this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this149._setPos(_this149._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this149._ignoreNextSectionPlaneDirUpdate){_this149._setDir(_this149._sectionPlane.dir);}else{_this149._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
|
|
26676
26645
|
* Gets the {@link SectionPlane} controlled by this FaceAlignedSectionPlanesControl.
|
|
26677
26646
|
* @returns {SectionPlane} The SectionPlane.
|
|
26678
26647
|
*/},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/** @private */},{key:"_setPos",value:function _setPos(xyz){this._pos.set(xyz);worldToRTCPos(this._pos,this._origin,this._rtcPos);this._rootNode.origin=this._origin;this._rootNode.position=this._rtcPos;}/** @private */},{key:"_setDir",value:function _setDir(xyz){this._baseDir.set(xyz);this._rootNode.quaternion=math.vec3PairToQuaternion(zeroVec,xyz,quat);}},{key:"_setSectionPlaneDir",value:function _setSectionPlaneDir(dir){if(this._sectionPlane){this._ignoreNextSectionPlaneDirUpdate=true;this._sectionPlane.dir=dir;}}/**
|
|
@@ -26698,15 +26667,15 @@ edges:false,fill:true,fillColor:[1,0,0],fillAlpha:0.6})};this._displayMeshes={pl
|
|
|
26698
26667
|
0.5,0.5,-0.0,0.5,-0.5,-0.0,// 2
|
|
26699
26668
|
-0.5,-0.5,-0.0,-0.5,0.5,-0.0// 3
|
|
26700
26669
|
],indices:[0,1,2,2,3,0]}),material:new PhongMaterial(rootNode,{emissive:[0,0.0,0],diffuse:[0,0,0],backfaces:true}),opacity:0.6,ghosted:true,pickable:false,collidable:true,clippable:false,visible:false,scale:[2.4,2.4,1]}),NO_STATE_INHERIT),planeFrame:rootNode.addChild(new Mesh(rootNode,{// Visible frame
|
|
26701
|
-
geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:1.7,tube:tubeRadius*2,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,.1],rotation:[0,0,45]}),NO_STATE_INHERIT),center:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildSphereGeometry({radius:0.05})),material:materials.center,pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT),zShaft:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axis,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),clippable:false,pickable:false,collidable:true,visible:false}),NO_STATE_INHERIT)};this._affordanceMeshes={planeFrame:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:2,tube:tubeRadius,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:true,highlightMaterial:new EmphasisMaterial(rootNode,{edges:false,filled:true,fillColor:[1,1,0],fillAlpha:1.0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,1],rotation:[0,0,45]}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT)};}},{key:"_bindEvents",value:function _bindEvents(){var
|
|
26702
|
-
var
|
|
26703
|
-
down=true;var canvasPos=getClickCoordsWithinElement(e);lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];break;}});this._plugin._controlElement.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!
|
|
26704
|
-
return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];moveSectionPlane(y-lastCanvasPos[1]);lastCanvasPos[0]=x;lastCanvasPos[1]=y;});this._plugin._controlElement.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!
|
|
26705
|
-
return;}waitForTick=true;touchEndY=e.touches[0].clientY;if(lastTouchY!==null){deltaUpdate+=touchEndY-lastTouchY;}lastTouchY=touchEndY;});this._plugin._controlElement.addEventListener("touchend",this._handleTouchEnd=function(e){e.stopPropagation();e.preventDefault();if(!
|
|
26670
|
+
geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:1.7,tube:tubeRadius*2,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,.1],rotation:[0,0,45]}),NO_STATE_INHERIT),center:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildSphereGeometry({radius:0.05})),material:materials.center,pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT),zShaft:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axis,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),clippable:false,pickable:false,collidable:true,visible:false}),NO_STATE_INHERIT)};this._affordanceMeshes={planeFrame:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:2,tube:tubeRadius,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:true,highlightMaterial:new EmphasisMaterial(rootNode,{edges:false,filled:true,fillColor:[1,1,0],fillAlpha:1.0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,1],rotation:[0,0,45]}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:true,clippable:false,visible:false}),NO_STATE_INHERIT)};}},{key:"_bindEvents",value:function _bindEvents(){var _this150=this;var rootNode=this._rootNode;var lastCanvasPos=math.vec2();var camera=this._viewer.camera;var scene=this._viewer.scene;var deltaUpdate=0;var waitForTick=false;{// Keep gizmo screen size constant
|
|
26671
|
+
var _tempVec3a=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){waitForTick=false;var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this150._pos,_tempVec3a)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;var size=0.07*worldSize;rootNode.scale=[size,size,size];lastDist=dist;}}if(camera.projection==="ortho"){var _worldSize=camera.ortho.scale/10;var _size=_worldSize;rootNode.scale=[_size,_size,_size];lastDist=dist;}if(deltaUpdate!==0){moveSectionPlane(deltaUpdate);deltaUpdate=0;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var moveSectionPlane=function moveSectionPlane(delta){var pos=_this150._sectionPlane.pos;var dir=_this150._sectionPlane.dir;math.addVec3(pos,math.mulVec3Scalar(dir,0.1*delta*_this150._plugin.getDragSensitivity(),math.vec3()));_this150._sectionPlane.pos=pos;};{var down=false;this._plugin._controlElement.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this150._visible){return;}_this150._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
|
|
26672
|
+
down=true;var canvasPos=getClickCoordsWithinElement(e);lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];break;}});this._plugin._controlElement.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this150._visible){return;}if(!down){return;}if(waitForTick){// Limit changes detection to one per frame
|
|
26673
|
+
return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];moveSectionPlane(y-lastCanvasPos[1]);lastCanvasPos[0]=x;lastCanvasPos[1]=y;});this._plugin._controlElement.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this150._visible){return;}_this150._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;});this._plugin._controlElement.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this150._visible){return;}deltaUpdate+=Math.max(-1,Math.min(1,-e.deltaY*40));});}{var touchStartY,touchEndY;var lastTouchY=null;this._plugin._controlElement.addEventListener("touchstart",this._handleTouchStart=function(e){e.stopPropagation();e.preventDefault();if(!_this150._visible){return;}touchStartY=e.touches[0].clientY;lastTouchY=touchStartY;deltaUpdate=0;});this._plugin._controlElement.addEventListener("touchmove",this._handleTouchMove=function(e){e.stopPropagation();e.preventDefault();if(!_this150._visible){return;}if(waitForTick){// Limit changes detection to one per frame
|
|
26674
|
+
return;}waitForTick=true;touchEndY=e.touches[0].clientY;if(lastTouchY!==null){deltaUpdate+=touchEndY-lastTouchY;}lastTouchY=touchEndY;});this._plugin._controlElement.addEventListener("touchend",this._handleTouchEnd=function(e){e.stopPropagation();e.preventDefault();if(!_this150._visible){return;}touchStartY=null;touchEndY=null;deltaUpdate=0;});}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var controlElement=this._plugin._controlElement;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);controlElement.removeEventListener("touchstart",this._handleTouchStart);controlElement.removeEventListener("touchmove",this._handleTouchMove);controlElement.removeEventListener("touchend",this._handleTouchEnd);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);return FaceAlignedSectionPlanesControl;}();/**
|
|
26706
26675
|
* Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.
|
|
26707
26676
|
*
|
|
26708
26677
|
* @private
|
|
26709
|
-
*/var Plane=/*#__PURE__*/function(){/** @private */function Plane(overview,overviewScene,sectionPlane){var
|
|
26678
|
+
*/var Plane=/*#__PURE__*/function(){/** @private */function Plane(overview,overviewScene,sectionPlane){var _this151=this;_classCallCheck(this,Plane);/**
|
|
26710
26679
|
* The ID of this SectionPlanesOverviewPlane.
|
|
26711
26680
|
*
|
|
26712
26681
|
* @type {String}
|
|
@@ -26714,7 +26683,7 @@ return;}waitForTick=true;touchEndY=e.touches[0].clientY;if(lastTouchY!==null){de
|
|
|
26714
26683
|
* The {@link SectionPlane} represented by this SectionPlanesOverviewPlane.
|
|
26715
26684
|
*
|
|
26716
26685
|
* @type {SectionPlane}
|
|
26717
|
-
*/this._sectionPlane=sectionPlane;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:.5,ySize:.5,zSize:.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec2=math.vec3([0,0,1]);var _quat2=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=
|
|
26686
|
+
*/this._sectionPlane=sectionPlane;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:.5,ySize:.5,zSize:.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec2=math.vec3([0,0,1]);var _quat2=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=_this151._sectionPlane.scene.center;var negDir=[-_this151._sectionPlane.dir[0],-_this151._sectionPlane.dir[1],-_this151._sectionPlane.dir[2]];math.subVec3(origin,_this151._sectionPlane.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec2,_this151._sectionPlane.dir,_quat2);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this151._mesh.quaternion=quaternion;_this151._mesh.position=pos3;};this._onSectionPlanePos=this._sectionPlane.on("pos",update);this._onSectionPlaneDir=this._sectionPlane.on("dir",update);// update();
|
|
26718
26687
|
}this._highlighted=false;this._selected=false;}/**
|
|
26719
26688
|
* Sets if this SectionPlanesOverviewPlane is highlighted.
|
|
26720
26689
|
*
|
|
@@ -26747,7 +26716,7 @@ return;}waitForTick=true;touchEndY=e.touches[0].clientY;if(lastTouchY!==null){de
|
|
|
26747
26716
|
* @private
|
|
26748
26717
|
*/var Overview=/*#__PURE__*/function(){/**
|
|
26749
26718
|
* @private
|
|
26750
|
-
*/function Overview(plugin,cfg){var
|
|
26719
|
+
*/function Overview(plugin,cfg){var _this152=this;_classCallCheck(this,Overview);if(!cfg.onHoverEnterPlane||!cfg.onHoverLeavePlane||!cfg.onClickedNothing||!cfg.onClickedPlane){throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";}/**
|
|
26751
26720
|
* The {@link FaceAlignedSectionPlanesPlugin} that owns this SectionPlanesOverview.
|
|
26752
26721
|
*
|
|
26753
26722
|
* @type {FaceAlignedSectionPlanesPlugin}
|
|
@@ -26760,12 +26729,12 @@ this._canvas=cfg.overviewCanvas;//----------------------------------------------
|
|
|
26760
26729
|
this._scene=new Scene(this._viewer,{canvasId:this._canvas.id,transparent:true});this._scene.clearLights();new DirLight(this._scene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:1.0,space:"view"});new DirLight(this._scene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:1.0,space:"view"});new DirLight(this._scene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:1.0,space:"view"});this._scene.camera;this._scene.camera.perspective.fov=70;this._zUp=false;//--------------------------------------------------------------------------------------------------------------
|
|
26761
26730
|
// Synchronize overview scene camera with viewer camera
|
|
26762
26731
|
//--------------------------------------------------------------------------------------------------------------
|
|
26763
|
-
{var camera=this._scene.camera;var _matrix3=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var _eyeLookVec4=math.vec3();var eyeLookVecOverview=math.vec3();var upOverview=math.vec3();this._synchCamera=function(){var eye=
|
|
26732
|
+
{var camera=this._scene.camera;var _matrix3=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var _eyeLookVec4=math.vec3();var eyeLookVecOverview=math.vec3();var upOverview=math.vec3();this._synchCamera=function(){var eye=_this152._viewer.camera.eye;var look=_this152._viewer.camera.look;var up=_this152._viewer.camera.up;math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,_eyeLookVec4)),7);if(_this152._zUp){// +Z up
|
|
26764
26733
|
math.transformVec3(_matrix3,_eyeLookVec4,eyeLookVecOverview);math.transformVec3(_matrix3,up,upOverview);camera.look=[0,0,0];camera.eye=math.transformVec3(_matrix3,_eyeLookVec4,eyeLookVecOverview);camera.up=math.transformPoint3(_matrix3,up,upOverview);}else{// +Y up
|
|
26765
|
-
camera.look=[0,0,0];camera.eye=_eyeLookVec4;camera.up=up;}};}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera);this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera);this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",function(fov){
|
|
26734
|
+
camera.look=[0,0,0];camera.eye=_eyeLookVec4;camera.up=up;}};}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera);this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera);this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",function(fov){_this152._scene.camera.perspective.fov=fov;});//--------------------------------------------------------------------------------------------------------------
|
|
26766
26735
|
// Bind overview canvas events
|
|
26767
26736
|
//--------------------------------------------------------------------------------------------------------------
|
|
26768
|
-
{var hoveredEntity=null;this._onInputMouseMove=this._scene.input.on("mousemove",function(coords){var hit=
|
|
26737
|
+
{var hoveredEntity=null;this._onInputMouseMove=this._scene.input.on("mousemove",function(coords){var hit=_this152._scene.pick({canvasPos:coords});if(hit){if(!hoveredEntity||hit.entity.id!==hoveredEntity.id){if(hoveredEntity){var _plane2=_this152._planes[hoveredEntity.id];if(_plane2){_this152._onHoverLeavePlane(hoveredEntity.id);}}hoveredEntity=hit.entity;var plane=_this152._planes[hoveredEntity.id];if(plane){_this152._onHoverEnterPlane(hoveredEntity.id);}}}else{if(hoveredEntity){_this152._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}}});this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){if(hoveredEntity){var plane=_this152._planes[hoveredEntity.id];if(plane){_this152._onClickedPlane(hoveredEntity.id);}}else{_this152._onClickedNothing();}});this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){if(hoveredEntity){_this152._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}});}//--------------------------------------------------------------------------------------------------------------
|
|
26769
26738
|
// Configure overview
|
|
26770
26739
|
//--------------------------------------------------------------------------------------------------------------
|
|
26771
26740
|
this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSectionPlane()
|
|
@@ -26878,10 +26847,10 @@ this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSe
|
|
|
26878
26847
|
* @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.
|
|
26879
26848
|
* @param {String} cfg.controlElementId ID of an HTML element that catches drag events to move the active SectionPlane.
|
|
26880
26849
|
* @param {Number} [cfg.dragSensitivity=1] Sensitivity factor that governs the rate at which dragging on the control element moves SectionPlane.
|
|
26881
|
-
*/function FaceAlignedSectionPlanesPlugin(viewer){var
|
|
26850
|
+
*/function FaceAlignedSectionPlanesPlugin(viewer){var _this153;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,FaceAlignedSectionPlanesPlugin);_this153=_super163.call(this,"FaceAlignedSectionPlanesPlugin",viewer);_this153._freeControls=[];_this153._sectionPlanes=viewer.scene.sectionPlanes;_this153._controls={};_this153._shownControlId=null;_this153._dragSensitivity=cfg.dragSensitivity||1;if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this153.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this153._overview=new Overview(_assertThisInitialized(_this153),{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this153._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this153._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this153.getShownControl()===id){_this153.hideControl();return;}_this153.showControl(id);var sectionPlane=_this153.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB.set(_this153.viewer.scene.aabb);math.getAABB3Center(tempAABB,tempVec3);tempAABB[0]+=sectionPlanePos[0]-tempVec3[0];tempAABB[1]+=sectionPlanePos[1]-tempVec3[1];tempAABB[2]+=sectionPlanePos[2]-tempVec3[2];tempAABB[3]+=sectionPlanePos[0]-tempVec3[0];tempAABB[4]+=sectionPlanePos[1]-tempVec3[1];tempAABB[5]+=sectionPlanePos[2]-tempVec3[2];_this153.viewer.cameraFlight.flyTo({aabb:tempAABB,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this153.hideControl();}});}}if(cfg.controlElementId===null||cfg.controlElementId===undefined){_this153.error("Parameter expected: controlElementId");}else{_this153._controlElement=document.getElementById(cfg.controlElementId);if(!_this153._controlElement){_this153.warn("Can't find control element: '"+cfg.controlElementId+"' - will create plugin without control element");}}_this153._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via FaceAlignedSectionPlanesPlugin#createSectionPlane(), or by directly
|
|
26882
26851
|
// instantiating a SectionPlane independently of FaceAlignedSectionPlanesPlugin, which can be done
|
|
26883
26852
|
// by BCFViewpointsPlugin#loadViewpoint().
|
|
26884
|
-
|
|
26853
|
+
_this153._sectionPlaneCreated(sectionPlane);});return _this153;}/**
|
|
26885
26854
|
* Sets the factor that governs how fast a SectionPlane moves as we drag on the control element.
|
|
26886
26855
|
*
|
|
26887
26856
|
* @param {Number} dragSensitivity The dragging sensitivity factor.
|
|
@@ -26914,7 +26883,7 @@ _this154._sectionPlaneCreated(sectionPlane);});return _this154;}/**
|
|
|
26914
26883
|
* @returns {SectionPlane} The new {@link SectionPlane}.
|
|
26915
26884
|
*/},{key:"createSectionPlane",value:function createSectionPlane(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id!==undefined&¶ms.id!==null&&this.viewer.scene.components[params.id]){this.error("Viewer component with this ID already exists: "+params.id);delete params.id;}// Note that SectionPlane constructor fires "sectionPlaneCreated" on the Scene,
|
|
26916
26885
|
// which FaceAlignedSectionPlanesPlugin handles and calls #_sectionPlaneCreated to create gizmo and add to overview canvas.
|
|
26917
|
-
var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos,dir:params.dir,active:true});return sectionPlane;}},{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var
|
|
26886
|
+
var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos,dir:params.dir,active:true});return sectionPlane;}},{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this154=this;var control=this._freeControls.length>0?this._freeControls.pop():new FaceAlignedSectionPlanesControl(this);control._setSectionPlane(sectionPlane);control.setVisible(false);this._controls[sectionPlane.id]=control;if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this154._sectionPlaneDestroyed(sectionPlane);});}/**
|
|
26918
26887
|
* Inverts the direction of {@link SectionPlane#dir} on every existing SectionPlane.
|
|
26919
26888
|
*
|
|
26920
26889
|
* Inverts all SectionPlanes, including those that were not created with FaceAlignedSectionPlanesPlugin.
|
|
@@ -27000,7 +26969,7 @@ for(var _id5 in this._controls){if(this._controls.hasOwnProperty(_id5)){this._co
|
|
|
27000
26969
|
* });
|
|
27001
26970
|
*
|
|
27002
26971
|
* @class SkyboxesPlugin
|
|
27003
|
-
*/var SkyboxesPlugin=/*#__PURE__*/function(_Plugin13){_inherits(SkyboxesPlugin,_Plugin13);var _super164=_createSuper(SkyboxesPlugin);function SkyboxesPlugin(viewer){var
|
|
26972
|
+
*/var SkyboxesPlugin=/*#__PURE__*/function(_Plugin13){_inherits(SkyboxesPlugin,_Plugin13);var _super164=_createSuper(SkyboxesPlugin);function SkyboxesPlugin(viewer){var _this155;_classCallCheck(this,SkyboxesPlugin);_this155=_super164.call(this,"skyboxes",viewer);_this155.skyboxes={};return _this155;}/**
|
|
27004
26973
|
* @private
|
|
27005
26974
|
*/_createClass(SkyboxesPlugin,[{key:"send",value:function send(name,value){switch(name){case"clear":this.clear();break;}}/**
|
|
27006
26975
|
Creates a skybox.
|
|
@@ -27224,9 +27193,9 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
|
|
|
27224
27193
|
* @param {Object} [cfg] Plugin configuration.
|
|
27225
27194
|
* @param {String} [cfg.id="STLLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
27226
27195
|
* @param {Object} [cfg.dataSource] A custom data source through which the STLLoaderPlugin can load STL files. Defaults to an instance of {@link STLDefaultDataSource}, which loads over HTTP.
|
|
27227
|
-
*/function STLLoaderPlugin(viewer){var
|
|
27196
|
+
*/function STLLoaderPlugin(viewer){var _this156;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,STLLoaderPlugin);_this156=_super165.call(this,"STLLoader",viewer,cfg);/**
|
|
27228
27197
|
* @private
|
|
27229
|
-
*/
|
|
27198
|
+
*/_this156._sceneGraphLoader=new STLSceneGraphLoader();_this156.dataSource=cfg.dataSource;return _this156;}/**
|
|
27230
27199
|
* Sets a custom data source through which the STLLoaderPlugin can load STL files.
|
|
27231
27200
|
*
|
|
27232
27201
|
* Default value is {@link STLDefaultDataSource}, which loads via an XMLHttpRequest.
|
|
@@ -27625,18 +27594,18 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
|
|
|
27625
27594
|
* @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
|
|
27626
27595
|
* @param {Boolean} [cfg.showIndeterminate=false] When true, will show indeterminate state for checkboxes when some but not all child nodes are checked
|
|
27627
27596
|
* @param {Boolean} [cfg.showProjectNode=false] When true, will show top level project node when hierarchy is set to "storeys"
|
|
27628
|
-
*/function TreeViewPlugin(viewer){var _cfg$showIndeterminat,_cfg$showProjectNode;var
|
|
27597
|
+
*/function TreeViewPlugin(viewer){var _cfg$showIndeterminat,_cfg$showProjectNode;var _this157;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this157=_super166.call(this,"TreeViewPlugin",viewer);/**
|
|
27629
27598
|
* Contains messages for any errors found while last rebuilding this TreeView.
|
|
27630
27599
|
* @type {String[]}
|
|
27631
|
-
*/
|
|
27600
|
+
*/_this157.errors=[];/**
|
|
27632
27601
|
* True if errors were found generating this TreeView.
|
|
27633
27602
|
* @type {boolean}
|
|
27634
|
-
*/
|
|
27635
|
-
|
|
27636
|
-
|
|
27637
|
-
|
|
27638
|
-
}var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}
|
|
27639
|
-
}
|
|
27603
|
+
*/_this157.valid=true;var containerElement=cfg.containerElement||document.getElementById(cfg.containerElementId);if(!(containerElement instanceof HTMLElement)){_this157.error("Mandatory config expected: valid containerElementId or containerElement");return _possibleConstructorReturn(_this157);}for(var _i538=0;;_i538++){if(!treeViews[_i538]){treeViews[_i538]=_assertThisInitialized(_this157);_this157._index=_i538;_this157._id="tree-".concat(_i538);break;}}_this157._containerElement=containerElement;_this157._metaModels={};_this157._autoAddModels=cfg.autoAddModels!==false;_this157._autoExpandDepth=cfg.autoExpandDepth||0;_this157._sortNodes=cfg.sortNodes!==false;_this157._viewer=viewer;_this157._rootElement=null;_this157._muteSceneEvents=false;_this157._muteTreeEvents=false;_this157._rootNodes=[];_this157._objectNodes={};// Object ID -> Node
|
|
27604
|
+
_this157._nodeNodes={};// Node ID -> Node
|
|
27605
|
+
_this157._rootNames={};// Node ID -> Root name
|
|
27606
|
+
_this157._sortNodes=cfg.sortNodes;_this157._pruneEmptyNodes=cfg.pruneEmptyNodes;_this157._showListItemElementId=null;_this157._renderService=cfg.renderService||new RenderService();_this157._showIndeterminate=(_cfg$showIndeterminat=cfg.showIndeterminate)!==null&&_cfg$showIndeterminat!==void 0?_cfg$showIndeterminat:false;_this157._showProjectNode=(_cfg$showProjectNode=cfg.showProjectNode)!==null&&_cfg$showProjectNode!==void 0?_cfg$showProjectNode:false;if(!_this157._renderService){throw new Error('TreeViewPlugin: no render service set');}_this157._containerElement.oncontextmenu=function(e){e.preventDefault();};_this157._onObjectVisibility=_this157._viewer.scene.on("objectVisibility",function(entity){if(_this157._muteSceneEvents){return;}var objectId=entity.id;var node=_this157._objectNodes[objectId];if(!node){return;// Not in this tree
|
|
27607
|
+
}var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this157._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}_this157._renderService.setCheckbox(node.nodeId,visible);var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}var indeterminate=_this157._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;_this157._renderService.setCheckbox(parent.nodeId,parent.numVisibleEntities>0,indeterminate);parent=parent.parent;}_this157._muteTreeEvents=false;});_this157._onObjectXrayed=_this157._viewer.scene.on('objectXRayed',function(entity){if(_this157._muteSceneEvents){return;}var objectId=entity.id;var node=_this157._objectNodes[objectId];if(!node){return;// Not in this tree
|
|
27608
|
+
}_this157._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this157._renderService.setXRayed(node.nodeId,xrayed);_this157._muteTreeEvents=false;});_this157._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this157._expandSwitchElement(switchElement);};_this157._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this157._collapseSwitchElement(switchElement);};_this157._checkboxChangeHandler=function(event){if(_this157._muteTreeEvents){return;}_this157._muteSceneEvents=true;var checkbox=event.target;var visible=_this157._renderService.isChecked(checkbox);var nodeId=_this157._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this157._nodeNodes[nodeId];var objects=_this157._viewer.scene.objects;var numUpdated=0;_this157._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;_this157._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=_this157._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;_this157._renderService.setCheckbox(parent.nodeId,parent.numVisibleEntities>0,indeterminate);parent=parent.parent;}_this157._muteSceneEvents=false;};_this157._hierarchy=cfg.hierarchy||"containment";_this157._autoExpandDepth=cfg.autoExpandDepth||0;if(_this157._autoAddModels){var modelIds=Object.keys(_this157.viewer.metaScene.metaModels);for(var _i539=0,len=modelIds.length;_i539<len;_i539++){var modelId=modelIds[_i539];var metaModel=_this157.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this157.addModel(modelId);}}_this157.viewer.scene.on("modelLoaded",function(modelId){if(_this157.viewer.metaScene.metaModels[modelId]){_this157.addModel(modelId);}});}_this157.hierarchy=cfg.hierarchy;return _this157;}/**
|
|
27640
27609
|
* Sets how the nodes are organized within this tree view.
|
|
27641
27610
|
*
|
|
27642
27611
|
* Accepted values are:
|
|
@@ -27668,7 +27637,7 @@ _this158._sortNodes=cfg.sortNodes;_this158._pruneEmptyNodes=cfg.pruneEmptyNodes;
|
|
|
27668
27637
|
* @param {String} [options.rootName] Optional display name for the root node. Ordinary, for "containment"
|
|
27669
27638
|
* and "storeys" hierarchy types, the tree would derive the root node name from the model's "IfcProject" element
|
|
27670
27639
|
* name. This option allows to override that name when it is not suitable as a display name.
|
|
27671
|
-
*/,set:function set(hierarchy){hierarchy=hierarchy||"containment";if(hierarchy!=="containment"&&hierarchy!=="storeys"&&hierarchy!=="types"){this.error("Unsupported value for `hierarchy' - defaulting to 'containment'");hierarchy="containment";}if(this._hierarchy===hierarchy){return;}this._hierarchy=hierarchy;this._createNodes();}},{key:"addModel",value:function addModel(modelId){var
|
|
27640
|
+
*/,set:function set(hierarchy){hierarchy=hierarchy||"containment";if(hierarchy!=="containment"&&hierarchy!=="storeys"&&hierarchy!=="types"){this.error("Unsupported value for `hierarchy' - defaulting to 'containment'");hierarchy="containment";}if(this._hierarchy===hierarchy){return;}this._hierarchy=hierarchy;this._createNodes();}},{key:"addModel",value:function addModel(modelId){var _this158=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!this._containerElement){return;}var model=this.viewer.scene.models[modelId];if(!model){throw"Model not found: "+modelId;}var metaModel=this.viewer.metaScene.metaModels[modelId];if(!metaModel){this.error("MetaModel not found: "+modelId);return;}if(this._metaModels[modelId]){this.warn("Model already added: "+modelId);return;}this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){_this158.removeModel(model.id);});this._createNodes();}/**
|
|
27672
27641
|
* Removes a model from this tree view.
|
|
27673
27642
|
*
|
|
27674
27643
|
* Does nothing if model not currently in tree view.
|
|
@@ -27702,7 +27671,7 @@ _this158._sortNodes=cfg.sortNodes;_this158._pruneEmptyNodes=cfg.pruneEmptyNodes;
|
|
|
27702
27671
|
* Collapses the tree first.
|
|
27703
27672
|
*
|
|
27704
27673
|
* @param {Number} depth Depth to expand to.
|
|
27705
|
-
*/},{key:"expandToDepth",value:function expandToDepth(depth){var
|
|
27674
|
+
*/},{key:"expandToDepth",value:function expandToDepth(depth){var _this159=this;this.collapse();var expand=function expand(node,countDepth){if(countDepth===depth){return;}var switchElement=_this159._renderService.getSwitchElement(node.nodeId);if(switchElement){_this159._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 _i541=0,len=this._rootNodes.length;_i541<len;_i541++){var rootNode=this._rootNodes[_i541];expand(rootNode,0);}}/**
|
|
27706
27675
|
* Closes all the nodes in the tree.
|
|
27707
27676
|
*/},{key:"collapse",value:function collapse(){for(var _i542=0,len=this._rootNodes.length;_i542<len;_i542++){var rootNode=this._rootNodes[_i542];var nodeId=rootNode.nodeId;this._collapseNode(nodeId);}}/**
|
|
27708
27677
|
* Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
|
|
@@ -27739,9 +27708,9 @@ _this158._sortNodes=cfg.sortNodes;_this158._pruneEmptyNodes=cfg.pruneEmptyNodes;
|
|
|
27739
27708
|
// // errors.push("Can't build storeys hierarchy: no IfcBuildingStoreys found");
|
|
27740
27709
|
// }
|
|
27741
27710
|
// }
|
|
27742
|
-
return true;}},{key:"_createEnabledNodes",value:function _createEnabledNodes(){if(this._pruneEmptyNodes){this._findEmptyNodes();}switch(this._hierarchy){case"storeys":this._createStoreysNodes();if(this._rootNodes.length===0){this.error("Failed to build storeys hierarchy");}break;case"types":this._createTypesNodes();break;case"containment":default:this._createContainmentNodes();}if(this._sortNodes){this._doSortNodes();}this._synchNodesToEntities();this._createTrees();this.expandToDepth(this._autoExpandDepth);}},{key:"_createDisabledNodes",value:function _createDisabledNodes(){var rootNode=this._renderService.createRootNode();this._rootElement=rootNode;this._containerElement.appendChild(rootNode);var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){var rootMetaObject=rootMetaObjects[objectId];var metaObjectType=rootMetaObject.type;var metaObjectName=rootMetaObject.name;var rootName=metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType;var childNode=this._renderService.createDisabledNodeElement(rootName);rootNode.appendChild(childNode);}}},{key:"_findEmptyNodes",value:function _findEmptyNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){this._findEmptyNodes2(rootMetaObjects[objectId]);}}},{key:"_findEmptyNodes2",value:function _findEmptyNodes2(metaObject){var countEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewer=this.viewer;var scene=viewer.scene;var children=metaObject.children;var objectId=metaObject.id;var entity=scene.objects[objectId];metaObject._countEntities=0;if(entity){metaObject._countEntities++;}if(children){for(var _i544=0,len=children.length;_i544<len;_i544++){var childMetaObject=children[_i544];childMetaObject._countEntities=this._findEmptyNodes2(childMetaObject);metaObject._countEntities+=childMetaObject._countEntities;}}return metaObject._countEntities;}},{key:"_createStoreysNodes",value:function _createStoreysNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createStoreysNodes2(rootMetaObjects[id],null,null,null,null);}}},{key:"_createStoreysNodes2",value:function _createStoreysNodes2(metaObject,projectNode,buildingNode,storeyNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(this._showProjectNode&&metaObjectType==='IfcProject'){projectNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(projectNode);this._objectNodes[projectNode.objectId]=projectNode;this._nodeNodes[projectNode.nodeId]=projectNode;}else if(metaObjectType==="IfcBuilding"){buildingNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:projectNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(projectNode){projectNode.children.push(buildingNode);}else{this._rootNodes.push(buildingNode);}this._objectNodes[buildingNode.objectId]=buildingNode;this._nodeNodes[buildingNode.nodeId]=buildingNode;}else if(metaObjectType==="IfcBuildingStorey"){if(!buildingNode){this.error("Failed to build storeys hierarchy for model - model does not have an IfcBuilding object, or is not an IFC model");return;}storeyNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:buildingNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};buildingNode.children.push(storeyNode);this._objectNodes[storeyNode.objectId]=storeyNode;this._nodeNodes[storeyNode.nodeId]=storeyNode;typeNodes={};}else{if(storeyNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){typeNodes=typeNodes||{};var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(storeyNode.objectId,"-").concat(metaObjectType),objectId:"".concat(storeyNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:storeyNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};storeyNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node6={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node6);this._objectNodes[_node6.objectId]=_node6;this._nodeNodes[_node6.nodeId]=_node6;}}}if(children){for(var _i545=0,len=children.length;_i545<len;_i545++){var childMetaObject=children[_i545];this._createStoreysNodes2(childMetaObject,projectNode,buildingNode,storeyNode,typeNodes);}}}},{key:"_createTypesNodes",value:function _createTypesNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createTypesNodes2(rootMetaObjects[id],null,null);}}},{key:"_createTypesNodes2",value:function _createTypesNodes2(metaObject,rootNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(!metaObject.parent){rootNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(rootNode);this._objectNodes[rootNode.objectId]=rootNode;this._nodeNodes[rootNode.nodeId]=rootNode;typeNodes={};}else{if(rootNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(rootNode.objectId,"-").concat(metaObjectType),objectId:"".concat(rootNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:rootNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};rootNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node7={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node7);this._objectNodes[_node7.objectId]=_node7;this._nodeNodes[_node7.nodeId]=_node7;}}}if(children){for(var _i546=0,len=children.length;_i546<len;_i546++){var childMetaObject=children[_i546];this._createTypesNodes2(childMetaObject,rootNode,typeNodes);}}}},{key:"_createContainmentNodes",value:function _createContainmentNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createContainmentNodes2(rootMetaObjects[id],null);}}},{key:"_createContainmentNodes2",value:function _createContainmentNodes2(metaObject,parent){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name||metaObjectType;var children=metaObject.children;var objectId=metaObject.id;var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:!parent?metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||metaObjectName:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:parent,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(parent){parent.children.push(node);}else{this._rootNodes.push(node);}this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;if(children){for(var _i547=0,len=children.length;_i547<len;_i547++){var childMetaObject=children[_i547];this._createContainmentNodes2(childMetaObject,node);}}}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i548=0,len=this._rootNodes.length;_i548<len;_i548++){var rootNode=this._rootNodes[_i548];this._sortChildren(rootNode);}}},{key:"_sortChildren",value:function _sortChildren(node){var children=node.children;if(!children||children.length===0){return;}var firstChild=children[0];if((this._hierarchy==="storeys"||this._hierarchy==="containment")&&firstChild.type==="IfcBuildingStorey"){children.sort(this._getSpatialSortFunc());}else{children.sort(this._alphaSortFunc);}for(var _i549=0,len=children.length;_i549<len;_i549++){var _node8=children[_i549];this._sortChildren(_node8);}}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){var _this161=this;var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;return this._spatialSortFunc||(this._spatialSortFunc=function(storey1,storey2){if(camera.xUp);else if(camera.yUp);else;var metaScene=_this161.viewer.metaScene;var storey1MetaObject=metaScene.metaObjects[storey1.objectId];var storey2MetaObject=metaScene.metaObjects[storey2.objectId];if(storey1MetaObject&&storey1MetaObject.attributes&&storey1MetaObject.attributes.elevation!==undefined&&storey2MetaObject&&storey2MetaObject.attributes&&storey2MetaObject.attributes.elevation!==undefined){var elevation1=Number.parseFloat(storey1MetaObject.attributes.elevation);var elevation2=Number.parseFloat(storey2MetaObject.attributes.elevation);if(elevation1>elevation2){return-1;}if(elevation1<elevation2){return 1;}return 0;}else{return 0;}});}},{key:"_alphaSortFunc",value:function _alphaSortFunc(node1,node2){var title1=node1.title.toUpperCase();// FIXME: Should be case sensitive?
|
|
27711
|
+
return true;}},{key:"_createEnabledNodes",value:function _createEnabledNodes(){if(this._pruneEmptyNodes){this._findEmptyNodes();}switch(this._hierarchy){case"storeys":this._createStoreysNodes();if(this._rootNodes.length===0){this.error("Failed to build storeys hierarchy");}break;case"types":this._createTypesNodes();break;case"containment":default:this._createContainmentNodes();}if(this._sortNodes){this._doSortNodes();}this._synchNodesToEntities();this._createTrees();this.expandToDepth(this._autoExpandDepth);}},{key:"_createDisabledNodes",value:function _createDisabledNodes(){var rootNode=this._renderService.createRootNode();this._rootElement=rootNode;this._containerElement.appendChild(rootNode);var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){var rootMetaObject=rootMetaObjects[objectId];var metaObjectType=rootMetaObject.type;var metaObjectName=rootMetaObject.name;var rootName=metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType;var childNode=this._renderService.createDisabledNodeElement(rootName);rootNode.appendChild(childNode);}}},{key:"_findEmptyNodes",value:function _findEmptyNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){this._findEmptyNodes2(rootMetaObjects[objectId]);}}},{key:"_findEmptyNodes2",value:function _findEmptyNodes2(metaObject){var countEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewer=this.viewer;var scene=viewer.scene;var children=metaObject.children;var objectId=metaObject.id;var entity=scene.objects[objectId];metaObject._countEntities=0;if(entity){metaObject._countEntities++;}if(children){for(var _i544=0,len=children.length;_i544<len;_i544++){var childMetaObject=children[_i544];childMetaObject._countEntities=this._findEmptyNodes2(childMetaObject);metaObject._countEntities+=childMetaObject._countEntities;}}return metaObject._countEntities;}},{key:"_createStoreysNodes",value:function _createStoreysNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createStoreysNodes2(rootMetaObjects[id],null,null,null,null);}}},{key:"_createStoreysNodes2",value:function _createStoreysNodes2(metaObject,projectNode,buildingNode,storeyNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(this._showProjectNode&&metaObjectType==='IfcProject'){projectNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(projectNode);this._objectNodes[projectNode.objectId]=projectNode;this._nodeNodes[projectNode.nodeId]=projectNode;}else if(metaObjectType==="IfcBuilding"){buildingNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:projectNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(projectNode){projectNode.children.push(buildingNode);}else{this._rootNodes.push(buildingNode);}this._objectNodes[buildingNode.objectId]=buildingNode;this._nodeNodes[buildingNode.nodeId]=buildingNode;}else if(metaObjectType==="IfcBuildingStorey"){if(!buildingNode){this.error("Failed to build storeys hierarchy for model - model does not have an IfcBuilding object, or is not an IFC model");return;}storeyNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:buildingNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};buildingNode.children.push(storeyNode);this._objectNodes[storeyNode.objectId]=storeyNode;this._nodeNodes[storeyNode.nodeId]=storeyNode;typeNodes={};}else{if(storeyNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){typeNodes=typeNodes||{};var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(storeyNode.objectId,"-").concat(metaObjectType),objectId:"".concat(storeyNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:storeyNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};storeyNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node6={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node6);this._objectNodes[_node6.objectId]=_node6;this._nodeNodes[_node6.nodeId]=_node6;}}}if(children){for(var _i545=0,len=children.length;_i545<len;_i545++){var childMetaObject=children[_i545];this._createStoreysNodes2(childMetaObject,projectNode,buildingNode,storeyNode,typeNodes);}}}},{key:"_createTypesNodes",value:function _createTypesNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createTypesNodes2(rootMetaObjects[id],null,null);}}},{key:"_createTypesNodes2",value:function _createTypesNodes2(metaObject,rootNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(!metaObject.parent){rootNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(rootNode);this._objectNodes[rootNode.objectId]=rootNode;this._nodeNodes[rootNode.nodeId]=rootNode;typeNodes={};}else{if(rootNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(rootNode.objectId,"-").concat(metaObjectType),objectId:"".concat(rootNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:rootNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};rootNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var _node7={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(_node7);this._objectNodes[_node7.objectId]=_node7;this._nodeNodes[_node7.nodeId]=_node7;}}}if(children){for(var _i546=0,len=children.length;_i546<len;_i546++){var childMetaObject=children[_i546];this._createTypesNodes2(childMetaObject,rootNode,typeNodes);}}}},{key:"_createContainmentNodes",value:function _createContainmentNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createContainmentNodes2(rootMetaObjects[id],null);}}},{key:"_createContainmentNodes2",value:function _createContainmentNodes2(metaObject,parent){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name||metaObjectType;var children=metaObject.children;var objectId=metaObject.id;var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:!parent?metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||metaObjectName:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:parent,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(parent){parent.children.push(node);}else{this._rootNodes.push(node);}this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;if(children){for(var _i547=0,len=children.length;_i547<len;_i547++){var childMetaObject=children[_i547];this._createContainmentNodes2(childMetaObject,node);}}}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i548=0,len=this._rootNodes.length;_i548<len;_i548++){var rootNode=this._rootNodes[_i548];this._sortChildren(rootNode);}}},{key:"_sortChildren",value:function _sortChildren(node){var children=node.children;if(!children||children.length===0){return;}var firstChild=children[0];if((this._hierarchy==="storeys"||this._hierarchy==="containment")&&firstChild.type==="IfcBuildingStorey"){children.sort(this._getSpatialSortFunc());}else{children.sort(this._alphaSortFunc);}for(var _i549=0,len=children.length;_i549<len;_i549++){var _node8=children[_i549];this._sortChildren(_node8);}}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){var _this160=this;var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;return this._spatialSortFunc||(this._spatialSortFunc=function(storey1,storey2){if(camera.xUp);else if(camera.yUp);else;var metaScene=_this160.viewer.metaScene;var storey1MetaObject=metaScene.metaObjects[storey1.objectId];var storey2MetaObject=metaScene.metaObjects[storey2.objectId];if(storey1MetaObject&&storey1MetaObject.attributes&&storey1MetaObject.attributes.elevation!==undefined&&storey2MetaObject&&storey2MetaObject.attributes&&storey2MetaObject.attributes.elevation!==undefined){var elevation1=Number.parseFloat(storey1MetaObject.attributes.elevation);var elevation2=Number.parseFloat(storey2MetaObject.attributes.elevation);if(elevation1>elevation2){return-1;}if(elevation1<elevation2){return 1;}return 0;}else{return 0;}});}},{key:"_alphaSortFunc",value:function _alphaSortFunc(node1,node2){var title1=node1.title.toUpperCase();// FIXME: Should be case sensitive?
|
|
27743
27712
|
var title2=node2.title.toUpperCase();if(title1<title2){return-1;}if(title1>title2){return 1;}return 0;}},{key:"_synchNodesToEntities",value:function _synchNodesToEntities(){var objectIds=Object.keys(this.viewer.metaScene.metaObjects);var metaObjects=this._viewer.metaScene.metaObjects;var objects=this._viewer.scene.objects;for(var _i550=0,len=objectIds.length;_i550<len;_i550++){var objectId=objectIds[_i550];var metaObject=metaObjects[objectId];if(metaObject){var _node9=this._objectNodes[objectId];if(_node9){var entity=objects[objectId];if(entity){var visible=entity.visible;_node9.numEntities=1;_node9.xrayed=entity.xrayed;if(visible){_node9.numVisibleEntities=1;_node9.checked=true;}else{_node9.numVisibleEntities=0;_node9.checked=false;}var parent=_node9.parent;// Synch parents
|
|
27744
|
-
while(parent){parent.numEntities++;if(visible){parent.numVisibleEntities++;parent.checked=true;}parent=parent.parent;}}}}}}},{key:"_withNodeTree",value:function _withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i551=0,len=children.length;_i551<len;_i551++){this._withNodeTree(children[_i551],callback);}}},{key:"_createTrees",value:function _createTrees(){var
|
|
27713
|
+
while(parent){parent.numEntities++;if(visible){parent.numVisibleEntities++;parent.checked=true;}parent=parent.parent;}}}}}}},{key:"_withNodeTree",value:function _withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i551=0,len=children.length;_i551<len;_i551++){this._withNodeTree(children[_i551],callback);}}},{key:"_createTrees",value:function _createTrees(){var _this161=this;if(this._rootNodes.length===0){return;}var rootNodeElements=this._rootNodes.map(function(rootNode){return _this161._createNodeElement(rootNode);});var rootNode=this._renderService.createRootNode();rootNodeElements.forEach(function(nodeElement){rootNode.appendChild(nodeElement);});this._containerElement.appendChild(rootNode);this._rootElement=rootNode;}},{key:"_createNodeElement",value:function _createNodeElement(node){var _this162=this;var contextmenuHandler=function contextmenuHandler(event){_this162.fire("contextmenu",{event:event,viewer:_this162._viewer,treeViewPlugin:_this162,treeViewNode:node});event.preventDefault();};var onclickHandler=function onclickHandler(event){_this162.fire("nodeTitleClicked",{event:event,viewer:_this162._viewer,treeViewPlugin:_this162,treeViewNode:node});event.preventDefault();};return this._renderService.createNodeElement(node,this._switchExpandHandler,this._checkboxChangeHandler,contextmenuHandler,onclickHandler);}},{key:"_expandSwitchElement",value:function _expandSwitchElement(switchElement){var _this163=this;var expanded=this._renderService.isExpanded(switchElement);if(expanded){return;}var nodeId=this._renderService.getId(switchElement);var nodeElements=this._nodeNodes[nodeId].children.map(function(node){return _this163._createNodeElement(node);});this._renderService.addChildren(switchElement,nodeElements);this._renderService.expand(switchElement,this._switchExpandHandler,this._switchCollapseHandler);}},{key:"_collapseNode",value:function _collapseNode(nodeId){var switchElement=this._renderService.getSwitchElement(nodeId);this._collapseSwitchElement(switchElement);}},{key:"_collapseSwitchElement",value:function _collapseSwitchElement(switchElement){this._renderService.collapse(switchElement,this._switchExpandHandler,this._switchCollapseHandler);}}]);return TreeViewPlugin;}(Plugin);/**
|
|
27745
27714
|
* For each Entity in its Scene, efficiently combines updates from multiple culling systems into a single "culled" state.
|
|
27746
27715
|
*
|
|
27747
27716
|
* Two culling systems are supported:
|
|
@@ -27753,12 +27722,12 @@ while(parent){parent.numEntities++;if(visible){parent.numVisibleEntities++;paren
|
|
|
27753
27722
|
*/var ObjectCullStates=/*#__PURE__*/function(){/**
|
|
27754
27723
|
* @private
|
|
27755
27724
|
* @param scene
|
|
27756
|
-
*/function ObjectCullStates(scene){var
|
|
27725
|
+
*/function ObjectCullStates(scene){var _this164=this;_classCallCheck(this,ObjectCullStates);this._scene=scene;this._objects=[];// Array of all Entity instances that represent objects
|
|
27757
27726
|
this._objectsViewCulled=[];// A flag for each object to indicate its view-cull status
|
|
27758
27727
|
this._objectsDetailCulled=[];// A flag for each object to indicate its detail-cull status
|
|
27759
27728
|
this._objectsChanged=[];// A flag for each object, set whenever its cull status has changed since last _applyChanges()
|
|
27760
27729
|
this._objectsChangedList=[];// A list of objects whose cull status has changed, applied and cleared by _applyChanges()
|
|
27761
|
-
this._modelInfos={};this._numObjects=0;this._lenObjectsChangedList=0;this._dirty=true;this._onModelLoaded=scene.on("modelLoaded",function(modelId){var model=scene.models[modelId];if(model){
|
|
27730
|
+
this._modelInfos={};this._numObjects=0;this._lenObjectsChangedList=0;this._dirty=true;this._onModelLoaded=scene.on("modelLoaded",function(modelId){var model=scene.models[modelId];if(model){_this164._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this164._dirty){_this164._build();}_this164._applyChanges();});}_createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this165=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this165._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._dirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._dirty=true;}}},{key:"_build",value:function _build(){if(!this._dirty){return;}this._applyChanges();var objects=this._scene.objects;for(var _i552=0;_i552<this._numObjects;_i552++){this._objects[_i552]=null;}this._numObjects=0;for(var objectId in objects){var entity=objects[objectId];this._objects[this._numObjects++]=entity;}this._lenObjectsChangedList=0;this._dirty=false;}},{key:"_applyChanges",value:function _applyChanges(){if(this._lenObjectsChangedList>0){for(var _i553=0;_i553<this._lenObjectsChangedList;_i553++){var objectIdx=this._objectsChangedList[_i553];var object=this._objects[objectIdx];var viewCulled=this._objectsViewCulled[objectIdx];var detailCulled=this._objectsDetailCulled[objectIdx];var culled=viewCulled||detailCulled;object.culled=culled;this._objectsChanged[objectIdx]=false;}this._lenObjectsChangedList=0;}}/**
|
|
27762
27731
|
* Array of {@link Entity} instances that represent objects in the {@link Scene}.
|
|
27763
27732
|
*
|
|
27764
27733
|
* ObjectCullStates rebuilds this from {@link Scene#objects} whenever ````Scene```` fires a ````modelLoaded```` event.
|
|
@@ -27825,8 +27794,8 @@ var kdTreeDimLength=new Float32Array(3);/**
|
|
|
27825
27794
|
* @param {Object} cfg Plugin configuration.
|
|
27826
27795
|
* @param {String} [cfg.id="ViewCull"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
27827
27796
|
* @param {Number} [cfg.maxTreeDepth=8] Maximum depth of the kd-tree.
|
|
27828
|
-
*/function ViewCullPlugin(viewer){var
|
|
27829
|
-
|
|
27797
|
+
*/function ViewCullPlugin(viewer){var _this166;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ViewCullPlugin);_this166=_super167.call(this,"ViewCull",viewer);_this166._objectCullStates=getObjectCullStates(viewer.scene);// Combines updates from multiple culling systems for its Scene's Entities
|
|
27798
|
+
_this166._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this166._modelInfos={};_this166._frustum=new Frustum$1();_this166._kdRoot=null;_this166._frustumDirty=false;_this166._kdTreeDirty=false;_this166._onViewMatrix=viewer.scene.camera.on("viewMatrix",function(){_this166._frustumDirty=true;});_this166._onProjMatrix=viewer.scene.camera.on("projMatMatrix",function(){_this166._frustumDirty=true;});_this166._onModelLoaded=viewer.scene.on("modelLoaded",function(modelId){var model=_this166.viewer.scene.models[modelId];if(model){_this166._addModel(model);}});_this166._onSceneTick=viewer.scene.on("tick",function(){_this166._doCull();});return _this166;}/**
|
|
27830
27799
|
* Sets whether view culling is enabled.
|
|
27831
27800
|
*
|
|
27832
27801
|
* @param {Boolean} enabled Whether to enable view culling.
|
|
@@ -27834,7 +27803,7 @@ _this167._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this167._modelInfos=
|
|
|
27834
27803
|
* Gets whether view culling is enabled.
|
|
27835
27804
|
*
|
|
27836
27805
|
* @retutns {Boolean} Whether view culling is enabled.
|
|
27837
|
-
*/function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var
|
|
27806
|
+
*/function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this167=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this167._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._kdTreeDirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._kdTreeDirty=true;}}},{key:"_doCull",value:function _doCull(){var cullDirty=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty){this._buildFrustum();}if(this._kdTreeDirty){this._buildKDTree();}if(cullDirty){var kdNode=this._kdRoot;if(kdNode){this._visitKDNode(kdNode);}}}},{key:"_buildFrustum",value:function _buildFrustum(){var camera=this.viewer.scene.camera;setFrustum(this._frustum,camera.viewMatrix,camera.projMatrix);this._frustumDirty=false;}},{key:"_buildKDTree",value:function _buildKDTree(){var viewer=this.viewer;var scene=viewer.scene;var depth=0;if(this._kdRoot);this._kdRoot={aabb:scene.getAABB(),intersection:Frustum$1.INTERSECT};for(var objectIdx=0,len=this._objectCullStates.numObjects;objectIdx<len;objectIdx++){var entity=this._objectCullStates.objects[objectIdx];this._insertEntityIntoKDTree(this._kdRoot,entity,objectIdx,depth+1);}this._kdTreeDirty=false;}},{key:"_insertEntityIntoKDTree",value:function _insertEntityIntoKDTree(kdNode,entity,objectIdx,depth){var entityAABB=entity.aabb;if(depth>=this._maxTreeDepth){kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);return;}if(kdNode.left){if(math.containsAABB3(kdNode.left.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(kdNode.right){if(math.containsAABB3(kdNode.right.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}var nodeAABB=kdNode.aabb;kdTreeDimLength[0]=nodeAABB[3]-nodeAABB[0];kdTreeDimLength[1]=nodeAABB[4]-nodeAABB[1];kdTreeDimLength[2]=nodeAABB[5]-nodeAABB[2];var dim=0;if(kdTreeDimLength[1]>kdTreeDimLength[dim]){dim=1;}if(kdTreeDimLength[2]>kdTreeDimLength[dim]){dim=2;}if(!kdNode.left){var aabbLeft=nodeAABB.slice();aabbLeft[dim+3]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.left={aabb:aabbLeft,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbLeft,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(!kdNode.right){var aabbRight=nodeAABB.slice();aabbRight[dim]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.right={aabb:aabbRight,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbRight,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);}},{key:"_visitKDNode",value:function _visitKDNode(kdNode){var intersects=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Frustum$1.INTERSECT;if(intersects!==Frustum$1.INTERSECT&&kdNode.intersects===intersects){return;}if(intersects===Frustum$1.INTERSECT){intersects=frustumIntersectsAABB3(this._frustum,kdNode.aabb);kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var objects=kdNode.objects;if(objects&&objects.length>0){for(var _i554=0,len=objects.length;_i554<len;_i554++){var objectIdx=objects[_i554];this._objectCullStates.setObjectViewCulled(objectIdx,culled);}}if(kdNode.left){this._visitKDNode(kdNode.left,intersects);}if(kdNode.right){this._visitKDNode(kdNode.right,intersects);}}/**
|
|
27838
27807
|
* @private
|
|
27839
27808
|
*/},{key:"send",value:function send(name,value){}/**
|
|
27840
27809
|
* Destroys this ViewCullPlugin.
|
|
@@ -28621,7 +28590,7 @@ var ParserV11={version:11,parseArrayBuffer:function parseArrayBuffer(viewer,opti
|
|
|
28621
28590
|
* and faster rendering speed. It's recommended to keep this somewhere roughly between ````50000```` and ````50000000```.
|
|
28622
28591
|
* @param {KTX2TextureTranscoder} [cfg.textureTranscoder] Transcoder used internally to transcode KTX2
|
|
28623
28592
|
* textures within the XKT. Only required when the XKT is version 10 or later, and contains KTX2 textures.
|
|
28624
|
-
*/function XKTLoaderPlugin(viewer){var
|
|
28593
|
+
*/function XKTLoaderPlugin(viewer){var _this168;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,XKTLoaderPlugin);_this168=_super168.call(this,"XKTLoader",viewer,cfg);_this168._maxGeometryBatchSize=cfg.maxGeometryBatchSize;_this168.textureTranscoder=cfg.textureTranscoder;_this168.dataSource=cfg.dataSource;_this168.objectDefaults=cfg.objectDefaults;_this168.includeTypes=cfg.includeTypes;_this168.excludeTypes=cfg.excludeTypes;_this168.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;_this168.reuseGeometries=cfg.reuseGeometries;return _this168;}/**
|
|
28625
28594
|
* Gets the ````.xkt```` format versions supported by this XKTLoaderPlugin/
|
|
28626
28595
|
* @returns {string[]}
|
|
28627
28596
|
*/_createClass(XKTLoaderPlugin,[{key:"supportedVersions",get:function get(){return Object.keys(parsers);}/**
|
|
@@ -28801,13 +28770,13 @@ var ParserV11={version:11,parseArrayBuffer:function parseArrayBuffer(viewer,opti
|
|
|
28801
28770
|
* SceneModels are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent
|
|
28802
28771
|
* render pass.
|
|
28803
28772
|
* @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}.
|
|
28804
|
-
*/},{key:"load",value:function load(){var
|
|
28773
|
+
*/},{key:"load",value:function load(){var _this169=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;}if(!params.src&&!params.xkt&&!params.manifestSrc&&!params.manifest)throw new Error("XKTLoaderPlugin: load() param expected: src, xkt, manifestSrc or manifestData");var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&¶ms.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i580=0,len=includeTypes.length;_i580<len;_i580++){options.includeTypesMap[includeTypes[_i580]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i581=0,_len117=excludeTypes.length;_i581<_len117;_i581++){options.excludeTypesMap[excludeTypes[_i581]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&¶ms.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled,renderOrder:params.renderOrder}));var modelId=sceneModel.id;// In case ID was auto-generated
|
|
28805
28774
|
var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){if(sceneModel.destroyed){return;}// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
|
|
28806
|
-
sceneModel.finalize();metaModel.finalize();
|
|
28775
|
+
sceneModel.finalize();metaModel.finalize();_this169.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this169.viewer.metaScene.destroyMetaModel(metaModel.id);});_this169.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
28807
28776
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
28808
|
-
});};var error=function error(errMsg){
|
|
28809
|
-
var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{
|
|
28810
|
-
var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{
|
|
28777
|
+
});};var error=function error(errMsg){_this169.viewer.scene.canvas.spinner.processes--;_this169.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this169._loadModel(params.src,options,sceneModel,null,manifestCtx,finish,error);}else{_this169._parseModel(params.xkt,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=metaDataFiles.length){done();}else{_this169._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this169.scheduleTask(loadNext,200);},error);}};loadNext();};var loadXKTs_excludeTheirMetaModels=function loadXKTs_excludeTheirMetaModels(xktFiles,done,error){// Load XKTs, ignore metamodels in the XKT
|
|
28778
|
+
var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this169._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this169._parseModel(arrayBuffer,options,sceneModel,null/* Ignore metamodel in XKT */,manifestCtx);sceneModel.preFinalize();i++;_this169.scheduleTask(loadNext,200);},error);}};loadNext();};var loadXKTs_includeTheirMetaModels=function loadXKTs_includeTheirMetaModels(xktFiles,done,error){// Load XKTs, parse metamodels from the XKT
|
|
28779
|
+
var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this169._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this169._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this169.scheduleTask(loadNext,200);},error);}};loadNext();};if(params.manifest){var manifestData=params.manifest;var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs_excludeTheirMetaModels(xktFiles,finish,error);},error);}else{loadXKTs_includeTheirMetaModels(xktFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs_excludeTheirMetaModels(xktFiles,finish,error);},error);}else{loadXKTs_includeTheirMetaModels(xktFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,options,sceneModel,metaModel,manifestCtx,done,error){var _this170=this;this._dataSource.getXKT(src,function(arrayBuffer){_this170._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(arrayBuffer,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,xktVersion,parser,numElements,elements,byteOffset,_i582,elementSize;return _regeneratorRuntime().wrap(function _callee7$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:if(!sceneModel.destroyed){_context11.next=2;break;}return _context11.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);xktVersion=dataView.getUint32(0,true);parser=parsers[xktVersion];if(parser){_context11.next=9;break;}this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return _context11.abrupt("return");case 9:if(!parser.parseArrayBuffer){_context11.next=12;break;}parser.parseArrayBuffer(this.viewer,options,arrayBuffer,sceneModel,metaModel,manifestCtx);return _context11.abrupt("return");case 12:numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i582=0;_i582<numElements;_i582++){elementSize=dataView.getUint32((_i582+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 17:case"end":return _context11.stop();}}},_callee7,this);}));function _parseModel(_x100,_x101,_x102,_x103,_x104){return _parseModel2.apply(this,arguments);}return _parseModel;}()}]);return XKTLoaderPlugin;}(Plugin);function getBaseDirectory(filePath){if(filePath.indexOf('?')>-1){filePath=filePath.split('?')[0];}var pathArray=filePath.split('/');pathArray.pop();// Remove the file name or the last segment of the path
|
|
28811
28780
|
return pathArray.join('/')+'/';}/*
|
|
28812
28781
|
Copyright (c) 2013 Gildas Lormeau. All rights reserved.
|
|
28813
28782
|
|
|
@@ -29148,13 +29117,13 @@ var json=xmlToJSON(xmlDoc,{});ok(xmlDoc,json);});};function xmlToJSON(node,attri
|
|
|
29148
29117
|
* contains the script that is used by zip.js to instantiate Web workers, which assist with unzipping the 3DXML, which is a ZIP archive.
|
|
29149
29118
|
* @param {String} [cfg.materialType="PhongMaterial"] What type of materials to create while loading: "MetallicMaterial" to create {@link MetallicMaterial}s, "SpecularMaterial" to create {@link SpecularMaterial}s or "PhongMaterial" to create {@link PhongMaterial}s. As it loads XML3D's Phong materials, the XMLLoaderPlugin will do its best approximate conversion of those to the specified workflow.
|
|
29150
29119
|
* @param {Boolean} [cfg.createMetaModel=false] When true, will create a {@link MetaModel} for the model in {@link MetaScene#metaModels}.
|
|
29151
|
-
*/function XML3DLoaderPlugin(viewer){var
|
|
29120
|
+
*/function XML3DLoaderPlugin(viewer){var _this171;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,XML3DLoaderPlugin);_this171=_super169.call(this,"XML3DLoader",viewer,cfg);if(!cfg.workerScriptsPath){_this171.error("Config expected: workerScriptsPath");return _possibleConstructorReturn(_this171);}_this171._workerScriptsPath=cfg.workerScriptsPath;/**
|
|
29152
29121
|
* @private
|
|
29153
|
-
*/
|
|
29122
|
+
*/_this171._loader=new XML3DSceneGraphLoader(_assertThisInitialized(_this171),cfg);/**
|
|
29154
29123
|
* Supported 3DXML schema versions
|
|
29155
29124
|
* @property supportedSchemas
|
|
29156
29125
|
* @type {string[]}
|
|
29157
|
-
*/
|
|
29126
|
+
*/_this171.supportedSchemas=_this171._loader.supportedSchemas;return _this171;}/**
|
|
29158
29127
|
* Loads a 3DXML model from a file into this XML3DLoaderPlugin's {@link Viewer}.
|
|
29159
29128
|
*
|
|
29160
29129
|
* Creates a tree of {@link Entity}s within the Viewer's {@link Scene} that represents the model.
|
|
@@ -29542,7 +29511,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
|
|
|
29542
29511
|
* @param {String[]} [cfg.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
29543
29512
|
* @param {String[]} [cfg.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
29544
29513
|
* @param {Boolean} [cfg.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.
|
|
29545
|
-
*/function WebIFCLoaderPlugin(viewer){var
|
|
29514
|
+
*/function WebIFCLoaderPlugin(viewer){var _this172;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,WebIFCLoaderPlugin);_this172=_super170.call(this,"ifcLoader",viewer,cfg);_this172.dataSource=cfg.dataSource;_this172.objectDefaults=cfg.objectDefaults;_this172.includeTypes=cfg.includeTypes;_this172.excludeTypes=cfg.excludeTypes;_this172.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;if(!cfg.WebIFC){throw"Parameter expected: WebIFC";}if(!cfg.IfcAPI){throw"Parameter expected: IfcAPI";}_this172._webIFC=cfg.WebIFC;_this172._ifcAPI=cfg.IfcAPI;return _this172;}/**
|
|
29546
29515
|
* Gets the ````IFC```` format versions supported by this WebIFCLoaderPlugin.
|
|
29547
29516
|
* @returns {string[]}
|
|
29548
29517
|
*/_createClass(WebIFCLoaderPlugin,[{key:"supportedVersions",get:function get(){return["2x3","4"];}/**
|
|
@@ -29675,10 +29644,10 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
|
|
|
29675
29644
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
29676
29645
|
* @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}.
|
|
29677
29646
|
*/},{key:"load",value:function load(){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.ifc){this.error("load() param expected: src or IFC");return sceneModel;// Return new empty model
|
|
29678
|
-
}var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i583=0,len=includeTypes.length;_i583<len;_i583++){options.includeTypesMap[includeTypes[_i583]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i584=0,_len118=excludeTypes.length;_i584<_len118;_i584++){options.excludeTypesMap[excludeTypes[_i584]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var
|
|
29647
|
+
}var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i583=0,len=includeTypes.length;_i583<len;_i583++){options.includeTypesMap[includeTypes[_i583]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i584=0,_len118=excludeTypes.length;_i584<_len118;_i584++){options.excludeTypesMap[excludeTypes[_i584]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this173=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this173._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this173.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";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;if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:null;var ctx={modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:{},options:options,log:function log(msg){},nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i585=0,len=options.includeTypes.length;_i585<len;_i585++){ctx.includeTypes[options.includeTypes[_i585]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i586=0,_len119=options.excludeTypes.length;_i586<_len119;_i586++){ctx.excludeTypes[options.excludeTypes[_i586]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.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
|
|
29679
29648
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
29680
|
-
});}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,'RelatingObject','RelatedObjects',this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,'RelatingStructure','RelatedElements',this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var
|
|
29681
|
-
var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=
|
|
29649
|
+
});}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,'RelatingObject','RelatedObjects',this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,'RelatingStructure','RelatedElements',this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this174=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i587=0;_i587<lines.size();_i587++){var relID=lines.get(_i587);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this174._ifcAPI.GetLine(ctx.modelID,element2.value);_this174._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i588=0;_i588<lines.size();_i588++){var relID=lines.get(_i588);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i589=0,len=props.length;_i589<len;_i589++){var prop=props[_i589];var _name8=prop.Name;var nominalValue=prop.NominalValue;if(_name8&&nominalValue){var property={name:_name8.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i590=0,_len120=relatedObjects.length;_i590<_len120;_i590++){var relatedObject=relatedObjects[_i590];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this175=this;this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
|
|
29650
|
+
var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this175._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);var globalId=properties.GlobalId.value;if(ctx.loadMetadata){var metaObjectId=globalId;var metaObject=ctx.metaObjects[metaObjectId];if(ctx.includeTypes&&(!metaObject||!ctx.includeTypes[metaObject.type])){return;}if(ctx.excludeTypes&&(!metaObject||ctx.excludeTypes[metaObject.type])){return;}}var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this175._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this175._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this175._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
|
|
29682
29651
|
var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,_l4=0,lenk=vertexData.length/6;k<lenk;k++,_l4+=3){positions[_l4+0]=vertexData[k*6+0];positions[_l4+1]=vertexData[k*6+1];positions[_l4+2]=vertexData[k*6+2];}matrix.set(placedGeometry.flatTransformation);math.transformPositions3(matrix,positions);var rtcNeeded=worldToRTCPositions(positions,positions,origin);if(!ctx.options.autoNormals){for(var _k2=0,_l5=0,_lenk=vertexData.length/6;_k2<_lenk;_k2++,_l5+=3){normals[_l5+0]=vertexData[_k2*6+3];normals[_l5+1]=vertexData[_k2*6+4];normals[_l5+2]=vertexData[_k2*6+5];}}ctx.stats.numGeometries++;ctx.stats.numVertices+=positions.length/3;ctx.stats.numTriangles+=indices.length/3;var meshId="mesh"+ctx.nextId++;ctx.sceneModel.createMesh({id:meshId,primitive:"triangles",// TODO
|
|
29683
29652
|
origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});}}]);return WebIFCLoaderPlugin;}(Plugin);/**
|
|
29684
29653
|
* Default data access strategy for {@link LASLoaderPlugin}.
|
|
@@ -29899,7 +29868,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
29899
29868
|
* @param {Boolean} [cfg.rotateX=false] Whether to rotate the LAS point positions 90 degrees. Applied after "center".
|
|
29900
29869
|
* @param {Number[]} [cfg.rotate=[0,0,0]] Rotations to immediately apply to the LAS points, given as Euler angles in degrees, for each of the X, Y and Z axis. Rotation is applied after "center" and "rotateX".
|
|
29901
29870
|
* @param {Number[]} [cfg.transform] 4x4 transform matrix to immediately apply to the LAS points. This is applied after "center", "rotateX" and "rotate". Typically used instead of "rotateX" and "rotate".
|
|
29902
|
-
*/function LASLoaderPlugin(viewer){var
|
|
29871
|
+
*/function LASLoaderPlugin(viewer){var _this176;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LASLoaderPlugin);_this176=_super171.call(this,"lasLoader",viewer,cfg);_this176.dataSource=cfg.dataSource;_this176.skip=cfg.skip;_this176.fp64=cfg.fp64;_this176.colorDepth=cfg.colorDepth;_this176.center=cfg.center;_this176.rotate=cfg.rotate;_this176.rotateX=cfg.rotateX;_this176.transform=cfg.transform;return _this176;}/**
|
|
29903
29872
|
* Gets the custom data source through which the LASLoaderPlugin can load LAS files.
|
|
29904
29873
|
*
|
|
29905
29874
|
* Default value is {@link LASDefaultDataSource}, which loads via HTTP.
|
|
@@ -30026,8 +29995,8 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
30026
29995
|
* @param {Number[]} [params.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] The model's world transform matrix. Overrides the position, scale and rotation parameters. Relative to ````origin````.
|
|
30027
29996
|
* @param {Object} [params.stats] Collects model statistics.
|
|
30028
29997
|
* @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}.
|
|
30029
|
-
*/},{key:"load",value:function load(){var
|
|
30030
|
-
}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--;
|
|
29998
|
+
*/},{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,{maxGeometryBatchSize:MAX_VERTICES,isModel:true}));if(!params.src&&!params.las){this.error("load() param expected: src or las");return sceneModel;// Return new empty model
|
|
29999
|
+
}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--;_this177.error(errMsg);sceneModel.fire("error",errMsg);});}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this178=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this178._parseModel(arrayBuffer,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this178.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this178.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this179=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this179._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i592=0,len=positionsValue.length;_i592<len;_i592+=3){centerPos[0]+=positionsValue[_i592+0];centerPos[1]+=positionsValue[_i592+1];centerPos[2]+=positionsValue[_i592+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i593=0,_len121=positionsValue.length;_i593<_len121;_i593+=3){positionsValue[_i593+0]-=centerPos[0];positionsValue[_i593+1]-=centerPos[1];positionsValue[_i593+2]-=centerPos[2];}}if(_this179._rotateX){if(positionsValue){for(var _i594=0,_len122=positionsValue.length;_i594<_len122;_i594+=3){var temp=positionsValue[_i594+1];positionsValue[_i594+1]=positionsValue[_i594+2];positionsValue[_i594+2]=temp;}}}if(_this179._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this179._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i595=0,_len123=positionsValue.length;_i595<_len123;_i595+=3){pos[0]=positionsValue[_i595+0];pos[1]=positionsValue[_i595+1];pos[2]=positionsValue[_i595+2];math.transformPoint3(mat,pos,pos);positionsValue[_i595+0]=pos[0];positionsValue[_i595+1]=pos[1];positionsValue[_i595+2]=pos[2];}}if(_this179._transform){var _mat=math.mat4(_this179._transform);var _pos=math.vec3();for(var _i596=0,_len124=positionsValue.length;_i596<_len124;_i596+=3){_pos[0]=positionsValue[_i596+0];_pos[1]=positionsValue[_i596+1];_pos[2]=positionsValue[_i596+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i596+0]=_pos[0];positionsValue[_i596+1]=_pos[1];positionsValue[_i596+2]=_pos[2];}}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 _i597=0,j=0,k=0,len=intensities.length;_i597<len;_i597++,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[_i597]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i598=0,j=0,len=intensities.length;_i598<len;_i598++,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i598]/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 _i599=0,len=pointsChunks.length;_i599<len;_i599++){var meshId="pointsMesh".concat(_i599);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i599],colorsCompressed:_i599<colorsChunks.length?colorsChunks[_i599]:null});}/*
|
|
30031
30000
|
const pointsChunks = chunkArray(positionsValue, MAX_VERTICES * 3);
|
|
30032
30001
|
const colorsChunks = chunkArray(colorsCompressed, MAX_VERTICES * 4);
|
|
30033
30002
|
const meshIds = [];
|
|
@@ -30050,7 +30019,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
30050
30019
|
geometryId
|
|
30051
30020
|
});
|
|
30052
30021
|
}
|
|
30053
|
-
*/var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;
|
|
30022
|
+
*/var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this179.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;_this179.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
|
|
30054
30023
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
30055
30024
|
});resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);return LASLoaderPlugin;}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i600=0;_i600<array.length;_i600+=chunkSize){result.push(array.slice(_i600,_i600+chunkSize));}return result;}/**
|
|
30056
30025
|
* Default data access strategy for {@link CityJSONLoaderPlugin}.
|
|
@@ -30248,7 +30217,7 @@ earcut.flatten=function(data){var dim=data[0][0].length,result={vertices:[],hole
|
|
|
30248
30217
|
* @param {String} [cfg.id="cityJSONLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
30249
30218
|
* @param {Object} [cfg.dataSource] A custom data source through which the CityJSONLoaderPlugin can load model and
|
|
30250
30219
|
* metadata files. Defaults to an instance of {@link CityJSONDefaultDataSource}, which loads over HTTP.
|
|
30251
|
-
*/function CityJSONLoaderPlugin(viewer){var
|
|
30220
|
+
*/function CityJSONLoaderPlugin(viewer){var _this180;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CityJSONLoaderPlugin);_this180=_super172.call(this,"cityJSONLoader",viewer,cfg);_this180.dataSource=cfg.dataSource;return _this180;}/**
|
|
30252
30221
|
* Gets the custom data source through which the CityJSONLoaderPlugin can load CityJSON files.
|
|
30253
30222
|
*
|
|
30254
30223
|
* Default value is {@link CityJSONDefaultDataSource}, which loads via HTTP.
|
|
@@ -30280,7 +30249,7 @@ earcut.flatten=function(data){var dim=data[0][0].length,result={vertices:[],hole
|
|
|
30280
30249
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
30281
30250
|
* @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}.
|
|
30282
30251
|
*/},{key:"load",value:function load(){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,edges:true}));if(!params.src&&!params.cityJSON){this.error("load() param expected: src or cityJSON");return sceneModel;// Return new empty model
|
|
30283
|
-
}var options={};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.cityJSON,params,options,sceneModel);spinner.processes--;}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var
|
|
30252
|
+
}var options={};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.cityJSON,params,options,sceneModel);spinner.processes--;}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this181=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getCityJSON(params.src,function(data){_this181._parseModel(data,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this181.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(data,params,options,sceneModel){if(sceneModel.destroyed){return;}var vertices=data.transform?this._transformVertices(data.vertices,data.transform,options.rotateX):data.vertices;var stats=params.stats||{};stats.sourceFormat=data.type||"CityJSON";stats.schemaVersion=data.version||"";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;var loadMetadata=params.loadMetadata!==false;var rootMetaObject=loadMetadata?{id:math.createUUID(),name:"Model",type:"Model"}:null;var metadata=loadMetadata?{id:"",projectId:"",author:"",createdAt:"",schema:data.version||"",creatingApplication:"",metaObjects:[rootMetaObject],propertySets:[]}:null;var ctx={data:data,vertices:vertices,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,rootMetaObject:rootMetaObject,nextId:0,stats:stats};this._parseCityJSON(ctx);sceneModel.finalize();if(loadMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.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
|
|
30284
30253
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
30285
30254
|
});}},{key:"_transformVertices",value:function _transformVertices(vertices,transform,rotateX){var transformedVertices=[];var scale=transform.scale||math.vec3([1,1,1]);var translate=transform.translate||math.vec3([0,0,0]);for(var _i601=0,j=0;_i601<vertices.length;_i601++,j+=3){var x=vertices[_i601][0]*scale[0]+translate[0];var y=vertices[_i601][1]*scale[1]+translate[1];var _z5=vertices[_i601][2]*scale[2]+translate[2];if(rotateX){transformedVertices.push([x,_z5,y]);}else{transformedVertices.push([x,y,_z5]);}}return transformedVertices;}},{key:"_parseCityJSON",value:function _parseCityJSON(ctx){var data=ctx.data;var cityObjects=data.CityObjects;for(var objectId in cityObjects){if(cityObjects.hasOwnProperty(objectId)){var cityObject=cityObjects[objectId];this._parseCityObject(ctx,cityObject,objectId);}}}},{key:"_parseCityObject",value:function _parseCityObject(ctx,cityObject,objectId){var sceneModel=ctx.sceneModel;var data=ctx.data;if(ctx.loadMetadata){var metaObjectId=objectId;var metaObjectType=cityObject.type;var metaObjectName=metaObjectType+" : "+objectId;var parentMetaObjectId=cityObject.parents?cityObject.parents[0]:ctx.rootMetaObject.id;ctx.metadata.metaObjects.push({id:metaObjectId,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId});}ctx.stats.numMetaObjects++;if(!(cityObject.geometry&&cityObject.geometry.length>0)){return;}var meshIds=[];for(var _i602=0,len=cityObject.geometry.length;_i602<len;_i602++){var geometry=cityObject.geometry[_i602];var objectMaterial=void 0;var surfaceMaterials=void 0;var appearance=data.appearance;if(appearance){var materials=appearance.materials;if(materials){var geometryMaterial=geometry.material;if(geometryMaterial){var themeIds=Object.keys(geometryMaterial);if(themeIds.length>0){var themeId=themeIds[0];var theme=geometryMaterial[themeId];if(theme.value!==undefined){objectMaterial=materials[theme.value];}else{var values=theme.values;if(values){surfaceMaterials=[];for(var j=0,lenj=values.length;j<lenj;j++){var value=values[_i602];var surfaceMaterial=materials[value];surfaceMaterials.push(surfaceMaterial);}}}}}}}if(surfaceMaterials){this._parseGeometrySurfacesWithOwnMaterials(ctx,geometry,surfaceMaterials,meshIds);}else{this._parseGeometrySurfacesWithSharedMaterial(ctx,geometry,objectMaterial,meshIds);}}if(meshIds.length>0){sceneModel.createEntity({id:objectId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;}}},{key:"_parseGeometrySurfacesWithOwnMaterials",value:function _parseGeometrySurfacesWithOwnMaterials(ctx,geometry,surfaceMaterials,meshIds){var geomType=geometry.type;switch(geomType){case"MultiPoint":break;case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":var surfaces=geometry.boundaries;this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,surfaces,meshIds);break;case"Solid":var shells=geometry.boundaries;for(var j=0;j<shells.length;j++){var _surfaces=shells[j];this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,_surfaces,meshIds);}break;case"MultiSolid":case"CompositeSolid":var solids=geometry.boundaries;for(var _j4=0;_j4<solids.length;_j4++){for(var k=0;k<solids[_j4].length;k++){var _surfaces2=solids[_j4][k];this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,_surfaces2,meshIds);}}break;}}},{key:"_parseSurfacesWithOwnMaterials",value:function _parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,surfaces,meshIds){var vertices=ctx.vertices;var sceneModel=ctx.sceneModel;for(var _i603=0;_i603<surfaces.length;_i603++){var surface=surfaces[_i603];var surfaceMaterial=surfaceMaterials[_i603]||{diffuseColor:[0.8,0.8,0.8],transparency:1.0};var face=[];var holes=[];var sharedIndices=[];var geometryCfg={positions:[],indices:[]};for(var j=0;j<surface.length;j++){if(face.length>0){holes.push(face.length);}var newFace=this._extractLocalIndices(ctx,surface[j],sharedIndices,geometryCfg);face.push.apply(face,_toConsumableArray(newFace));}if(face.length===3){// Triangle
|
|
30286
30255
|
geometryCfg.indices.push(face[0]);geometryCfg.indices.push(face[1]);geometryCfg.indices.push(face[2]);}else if(face.length>3){// Polygon
|
|
@@ -30520,7 +30489,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
30520
30489
|
* @param {String} [cfg.id="DotBIMLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
30521
30490
|
* @param {Object} [cfg.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
30522
30491
|
* @param {Object} [cfg.dataSource] A custom data source through which the DotBIMLoaderPlugin can load metadata, glTF and binary attachments. Defaults to an instance of {@link DotBIMDefaultDataSource}, which loads over HTTP.
|
|
30523
|
-
*/function DotBIMLoaderPlugin(viewer){var
|
|
30492
|
+
*/function DotBIMLoaderPlugin(viewer){var _this182;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DotBIMLoaderPlugin);_this182=_super173.call(this,"DotBIMLoader",viewer,cfg);_this182.dataSource=cfg.dataSource;_this182.objectDefaults=cfg.objectDefaults;return _this182;}/**
|
|
30524
30493
|
* Sets a custom data source through which the DotBIMLoaderPlugin can .BIM files.
|
|
30525
30494
|
*
|
|
30526
30495
|
* Default value is {@link DotBIMDefaultDataSource}, which loads via an XMLHttpRequest.
|
|
@@ -30564,12 +30533,12 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
30564
30533
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
30565
30534
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
30566
30535
|
* @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}
|
|
30567
|
-
*/,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var
|
|
30536
|
+
*/,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this183=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
|
|
30568
30537
|
if(!params.src&&!params.dotBIM){this.error("load() param expected: src or dotBIM");return sceneModel;// Return new empty model
|
|
30569
|
-
}var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i607=0,len=params.includeTypes.length;_i607<len;_i607++){includeTypes[params.includeTypes[_i607]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i608=0,_len125=params.excludeTypes.length;_i608<_len125;_i608++){includeTypes[params.excludeTypes[_i608]]=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(_i609,_len126){var element=dbElements[_i609];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:_i609;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 _i610=0,_len127=faceColors.length;_i610<_len127;_i610+=4){var faceColor=[faceColors[_i610],faceColors[_i610+1],faceColors[_i610+2],faceColors[_i610+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 _i611=0,_Object$entries5=Object.entries(coloredTrianglesDictionary);_i611<_Object$entries5.length;_i611++){var _Object$entries5$_i=_slicedToArray(_Object$entries5[_i611],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,name:"Properties",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 _i609=0,_len126=dbElements.length;_i609<_len126;_i609++){var _ret2=_loop8(_i609,_len126);if(_ret2==="continue")continue;}sceneModel.finalize();
|
|
30538
|
+
}var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i607=0,len=params.includeTypes.length;_i607<len;_i607++){includeTypes[params.includeTypes[_i607]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i608=0,_len125=params.excludeTypes.length;_i608<_len125;_i608++){includeTypes[params.excludeTypes[_i608]]=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(_i609,_len126){var element=dbElements[_i609];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:_i609;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 _i610=0,_len127=faceColors.length;_i610<_len127;_i610+=4){var faceColor=[faceColors[_i610],faceColors[_i610+1],faceColors[_i610+2],faceColors[_i610+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 _i611=0,_Object$entries5=Object.entries(coloredTrianglesDictionary);_i611<_Object$entries5.length;_i611++){var _Object$entries5$_i=_slicedToArray(_Object$entries5[_i611],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,name:"Properties",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 _i609=0,_len126=dbElements.length;_i609<_len126;_i609++){var _ret2=_loop8(_i609,_len126);if(_ret2==="continue")continue;}sceneModel.finalize();_this183.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
|
|
30570
30539
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
30571
30540
|
});};if(params.src){var src=params.src;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getDotBIM(src,function(fileData){// OK
|
|
30572
|
-
var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);
|
|
30541
|
+
var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);_this183.viewer.scene.canvas.spinner.processes--;},function(err){_this183.viewer.scene.canvas.spinner.processes--;_this183.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(){_this183.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
|
|
30573
30542
|
* Destroys this DotBIMLoaderPlugin.
|
|
30574
30543
|
*/},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(DotBIMLoaderPlugin.prototype),"destroy",this).call(this);}}]);return DotBIMLoaderPlugin;}(Plugin);var hex2rgb=function hex2rgb(color){var rgb=function rgb(idx){return parseInt(color.substr(idx+1,2),16)/255;};return[rgb(0),rgb(2),rgb(4)];};var triangulateEarClipping=function triangulateEarClipping(planeCoords){var polygonVertices=[];for(var _i612=0;_i612<planeCoords.length;++_i612){polygonVertices.push(_i612);}var isCCW=function(){var ba=math.vec2();var bc=math.vec2();var anglesSum=0;for(var _i613=0;_i613<polygonVertices.length;++_i613){var _a9=planeCoords[polygonVertices[_i613]];var b=planeCoords[polygonVertices[(_i613+1)%polygonVertices.length]];var c=planeCoords[polygonVertices[(_i613+2)%polygonVertices.length]];math.subVec2(_a9,b,ba);math.subVec2(c,b,bc);var theta=math.dotVec2(ba,bc)/Math.sqrt(math.sqLenVec2(ba)*math.sqLenVec2(bc));var _angle2=Math.acos(Math.max(-1,Math.min(theta,1)));var convex=ba[0]*bc[1]-ba[1]*bc[0]>=0;anglesSum+=convex?_angle2:2*Math.PI-_angle2;}return anglesSum<polygonVertices.length*Math.PI;}();var pointInTriangle=function(){var sign=function sign(p1,p2,p3){return(p1[0]-p3[0])*(p2[1]-p3[1])-(p2[0]-p3[0])*(p1[1]-p3[1]);};return function(pt,v1,v2,v3){var d1=sign(pt,v1,v2);var d2=sign(pt,v2,v3);var d3=sign(pt,v3,v1);var has_neg=d1<0||d2<0||d3<0;var has_pos=d1>0||d2>0||d3>0;return!(has_neg&&has_pos);};}();var baseTriangles=[];var vertices=(isCCW?polygonVertices:polygonVertices.slice(0).reverse()).map(function(i){return{idx:i};});vertices.forEach(function(v,i){v.prev=vertices[(i-1+vertices.length)%vertices.length];v.next=vertices[(i+1)%vertices.length];});var ba=math.vec2();var bc=math.vec2();while(vertices.length>2){var earIdx=0;var _loop9=function _loop9(){if(earIdx>=vertices.length){throw"isCCW = ".concat(isCCW,"; earIdx = ").concat(earIdx,"; len = ").concat(vertices.length);}var v=vertices[earIdx];var a=planeCoords[v.prev.idx];var b=planeCoords[v.idx];var c=planeCoords[v.next.idx];math.subVec2(a,b,ba);math.subVec2(c,b,bc);if(ba[0]*bc[1]-ba[1]*bc[0]>=0// a convex vertex
|
|
30575
30544
|
&&vertices.every(// no other vertices inside
|
|
@@ -30578,24 +30547,24 @@ var ind=(_ref25=[]).concat.apply(_ref25,_toConsumableArray(baseTriangles));mesh=
|
|
|
30578
30547
|
geometry:new ReadableGeometry(scene,{positions:positions,indices:ind,normals:math.buildNormals(positions,ind)}),material:new PhongMaterial(scene,{alpha:alpha!==undefined?alpha:0.5,backfaces:true,diffuse:hex2rgb(color)})});}catch(e){mesh=null;}}if(mesh){mesh.visible=!!points;}};updateBase(null);return{updateBase:updateBase,destroy:function destroy(){return mesh&&mesh.destroy();}};};var startAARectCreateUI=function startAARectCreateUI(scene,markersColor,pointerLens,select3dPoint,withPoints,onPointsSelected){var marker1=marker3D(scene,markersColor);var marker2=marker3D(scene,markersColor);var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker1.update(null);},function(canvasPos,worldPos){updatePointerLens(canvasPos);marker1.update(worldPos);},function(point1CanvasPos,point1WorldPos){marker1.update(point1WorldPos);deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker2.update(null);withPoints(null);},function(canvasPos,point2WorldPos){updatePointerLens(canvasPos);marker2.update(point2WorldPos);withPoints(math.distVec3(point1WorldPos,point2WorldPos)>0.01&&[point1WorldPos,point2WorldPos]);},function(point2CanvasPos,point2WorldPos){// `marker2.update' makes sure marker's position has been updated from its default [0,0,0]
|
|
30579
30548
|
// This works around an unidentified bug somewhere around OcclusionLayer, that causes error
|
|
30580
30549
|
// [.WebGL-0x13400c47e00] GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call
|
|
30581
|
-
marker2.update(point2WorldPos);marker1.destroy();marker2.destroy();updatePointerLens(null);onPointsSelected([point1WorldPos,point2WorldPos]);});});return{deactivate:function deactivate(){deactivatePointSelection();marker1.destroy();marker2.destroy();updatePointerLens(null);}};};var mousePointSelector=function mousePointSelector(viewer,ray2WorldPos){return function(onCancel,onChange,onCommit){var scene=viewer.scene;var canvas=scene.canvas.canvas;var moveTolerance=20;var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var buttonDown=false;var resetAction=function resetAction(){buttonDown=false;};var cleanup=function cleanup(){resetAction();canvas.removeEventListener("mousedown",onMouseDown);canvas.removeEventListener("mousemove",onMouseMove);viewer.cameraControl.off(onCameraControlRayMove);canvas.removeEventListener("mouseup",onMouseUp);};var startCanvasPos=math.vec2();var onMouseDown=function onMouseDown(event){if(event.which===1){copyCanvasPos(event,startCanvasPos);buttonDown=true;}};canvas.addEventListener("mousedown",onMouseDown);var onMouseMove=function onMouseMove(event){var canvasPos=copyCanvasPos(event,math.vec2());if(buttonDown&&math.distVec2(startCanvasPos,canvasPos)>moveTolerance){resetAction();onCancel();}};canvas.addEventListener("mousemove",onMouseMove);var onCameraControlRayMove=viewer.cameraControl.on("rayMove",function(event){var canvasPos=event.canvasPos;onChange(canvasPos,pickWorldPos(canvasPos));});var onMouseUp=function onMouseUp(event){if(event.which===1&&buttonDown){cleanup();var
|
|
30550
|
+
marker2.update(point2WorldPos);marker1.destroy();marker2.destroy();updatePointerLens(null);onPointsSelected([point1WorldPos,point2WorldPos]);});});return{deactivate:function deactivate(){deactivatePointSelection();marker1.destroy();marker2.destroy();updatePointerLens(null);}};};var mousePointSelector=function mousePointSelector(viewer,ray2WorldPos){return function(onCancel,onChange,onCommit){var scene=viewer.scene;var canvas=scene.canvas.canvas;var moveTolerance=20;var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var buttonDown=false;var resetAction=function resetAction(){buttonDown=false;};var cleanup=function cleanup(){resetAction();canvas.removeEventListener("mousedown",onMouseDown);canvas.removeEventListener("mousemove",onMouseMove);viewer.cameraControl.off(onCameraControlRayMove);canvas.removeEventListener("mouseup",onMouseUp);};var startCanvasPos=math.vec2();var onMouseDown=function onMouseDown(event){if(event.which===1){copyCanvasPos(event,startCanvasPos);buttonDown=true;}};canvas.addEventListener("mousedown",onMouseDown);var onMouseMove=function onMouseMove(event){var canvasPos=copyCanvasPos(event,math.vec2());if(buttonDown&&math.distVec2(startCanvasPos,canvasPos)>moveTolerance){resetAction();onCancel();}};canvas.addEventListener("mousemove",onMouseMove);var onCameraControlRayMove=viewer.cameraControl.on("rayMove",function(event){var canvasPos=event.canvasPos;onChange(canvasPos,pickWorldPos(canvasPos));});var onMouseUp=function onMouseUp(event){if(event.which===1&&buttonDown){cleanup();var _canvasPos4=copyCanvasPos(event,math.vec2());onCommit(_canvasPos4,pickWorldPos(_canvasPos4));}};canvas.addEventListener("mouseup",onMouseUp);return cleanup;};};var planeIntersect=function planeIntersect(p0,n,origin,direction){var t=-(math.dotVec3(origin,n)-p0)/math.dotVec3(direction,n);{var worldPos=math.vec3();math.mulVec3Scalar(direction,t,worldPos);math.addVec3(origin,worldPos,worldPos);return worldPos;}};/**
|
|
30582
30551
|
* @desc Renders a transparent box between two 3D points.
|
|
30583
30552
|
*
|
|
30584
30553
|
* See {@link ZonesPlugin} for more info.
|
|
30585
30554
|
*/var Zone=/*#__PURE__*/function(_Component42){_inherits(Zone,_Component42);var _super174=_createSuper(Zone);/**
|
|
30586
30555
|
* @private
|
|
30587
|
-
*/function Zone(plugin){var
|
|
30556
|
+
*/function Zone(plugin){var _this184;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Zone);_this184=_super174.call(this,plugin.viewer.scene,cfg);/**
|
|
30588
30557
|
* The {@link ZonesPlugin} that owns this Zone.
|
|
30589
30558
|
* @type {ZonesPlugin}
|
|
30590
|
-
*/
|
|
30559
|
+
*/_this184.plugin=plugin;_this184._container=cfg.container;if(!_this184._container){throw"config missing: container";}_this184._eventSubs={};_this184.plugin.viewer.scene;_this184._geometry=cfg.geometry;cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this184));_this184.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover',event));}:null;cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this184));_this184.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave',event));}:null;cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this184));}:null;_this184._alpha="alpha"in cfg&&cfg.alpha!==undefined?cfg.alpha:0.5;_this184.color=cfg.color;_this184._visible=true;_this184._rebuildMesh();return _this184;}_createClass(Zone,[{key:"_rebuildMesh",value:function _rebuildMesh(){var _ref26,_this185=this;var scene=this.plugin.viewer.scene;var planeCoords=this._geometry.planeCoordinates.slice();var downward=this._geometry.height<0;var altitude=this._geometry.altitude+(downward?this._geometry.height:0);var height=this._geometry.height*(downward?-1:1);var _triangulateEarClippi3=triangulateEarClipping(planeCoords),_triangulateEarClippi4=_slicedToArray(_triangulateEarClippi3,3),baseVertices=_triangulateEarClippi4[0],baseTriangles=_triangulateEarClippi4[1],isCCW=_triangulateEarClippi4[2];// TODO: prevent crossing edges
|
|
30591
30560
|
var pos=[];var ind=[];var addPlane=function addPlane(isCeiling){var baseIdx=pos.length;var _iterator42=_createForOfIteratorHelper(baseVertices),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var c=_step42.value;pos.push([c[0],altitude+(isCeiling?height:0),c[1]]);}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}var _iterator43=_createForOfIteratorHelper(baseTriangles),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var t=_step43.value;ind.push.apply(ind,_toConsumableArray((isCeiling?t:t.slice(0).reverse()).map(function(i){return i+baseIdx;})));}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}};addPlane(false);// floor
|
|
30592
30561
|
addPlane(true);// ceiling
|
|
30593
30562
|
// sides
|
|
30594
|
-
var _loop10=function _loop10(_i614){var a=baseVertices[_i614];var b=baseVertices[(baseVertices.length+_i614+(isCCW?1:-1))%baseVertices.length];var f=altitude;var c=altitude+height;var baseIdx=pos.length;pos.push([a[0],f,a[1]],[b[0],f,b[1]],[b[0],c,b[1]],[a[0],c,a[1]]);ind.push.apply(ind,_toConsumableArray([0,1,2,0,2,3].map(function(i){return i+baseIdx;})));};for(var _i614=0;_i614<baseVertices.length;++_i614){_loop10(_i614);}if(this._zoneMesh){this._zoneMesh.destroy();}var min=function min(idx){return Math.min.apply(Math,_toConsumableArray(pos.map(function(p){return p[idx];})));};var max=function max(idx){return Math.max.apply(Math,_toConsumableArray(pos.map(function(p){return p[idx];})));};var xmin=min(0);var ymin=min(1);var zmin=min(2);var xmax=max(0);var ymax=max(1);var zmax=max(2);this._center=math.vec3([(xmin+xmax)/2,(ymin+ymax)/2,(zmin+zmax)/2]);var positions=(_ref26=[]).concat.apply(_ref26,_toConsumableArray(pos.map(function(p){return math.subVec3(p,
|
|
30563
|
+
var _loop10=function _loop10(_i614){var a=baseVertices[_i614];var b=baseVertices[(baseVertices.length+_i614+(isCCW?1:-1))%baseVertices.length];var f=altitude;var c=altitude+height;var baseIdx=pos.length;pos.push([a[0],f,a[1]],[b[0],f,b[1]],[b[0],c,b[1]],[a[0],c,a[1]]);ind.push.apply(ind,_toConsumableArray([0,1,2,0,2,3].map(function(i){return i+baseIdx;})));};for(var _i614=0;_i614<baseVertices.length;++_i614){_loop10(_i614);}if(this._zoneMesh){this._zoneMesh.destroy();}var min=function min(idx){return Math.min.apply(Math,_toConsumableArray(pos.map(function(p){return p[idx];})));};var max=function max(idx){return Math.max.apply(Math,_toConsumableArray(pos.map(function(p){return p[idx];})));};var xmin=min(0);var ymin=min(1);var zmin=min(2);var xmax=max(0);var ymax=max(1);var zmax=max(2);this._center=math.vec3([(xmin+xmax)/2,(ymin+ymax)/2,(zmin+zmax)/2]);var positions=(_ref26=[]).concat.apply(_ref26,_toConsumableArray(pos.map(function(p){return math.subVec3(p,_this185._center,p);})));this._zoneMesh=new Mesh(scene,{origin:this._center,edges:this._edges,geometry:new ReadableGeometry(scene,{positions:positions,indices:ind,normals:math.buildNormals(positions,ind)}),material:new PhongMaterial(scene,{alpha:this._alpha,backfaces:true,diffuse:hex2rgb(this._color)}),visible:this._visible});this._zoneMesh.highlighted=this._highlighted;this._zoneMesh.zone=this;{var _u2=math.vec2();var v=math.vec2();var baseArea=0;var _iterator44=_createForOfIteratorHelper(baseTriangles),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var t=_step44.value;var p0=baseVertices[t[0]];var p1=baseVertices[t[1]];var p2=baseVertices[t[2]];math.subVec2(p1,p0,_u2);math.subVec2(p2,p0,v);baseArea+=Math.abs(_u2[0]*v[1]-_u2[1]*v[0]);}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}this._baseArea=baseArea/2;}this._metrics=null;}},{key:"baseArea",get:function get(){return this._baseArea;}},{key:"area",get:function get(){return this._getMetrics().area;}},{key:"volume",get:function get(){return this._getMetrics().volume;}},{key:"_getMetrics",value:function _getMetrics(){if(this._metrics===null){// Sum the volume of tetrahedrons formed by the origin and face triangles
|
|
30595
30564
|
var volume=0;var _area4=0;var geo=this._zoneMesh.geometry;var pts=[math.vec3(),math.vec3(),math.vec3()];var tmpVec3=math.vec3();for(var _i615=0;_i615<geo.indices.length;_i615+=3){for(var off=0;off<3;++off){var _p4=pts[off];var pIdx=3*geo.indices[_i615+off];for(var c=0;c<3;++c){_p4[c]=geo.positions[pIdx+c];}}volume+=math.dotVec3(pts[0],math.cross3Vec3(pts[1],pts[2],tmpVec3));math.subVec3(pts[1],pts[0],pts[1]);math.subVec3(pts[2],pts[0],pts[2]);_area4+=math.lenVec3(math.cross3Vec3(pts[1],pts[2],tmpVec3));}this._metrics={area:_area4/2,volume:volume/6};}return this._metrics;}},{key:"sectionedAverage",value:function sectionedAverage(sectionPlanes){var planeCoords=this._geometry.planeCoordinates.slice();var faces=[];{var h=this._geometry.height;var _a10=this._geometry.altitude;var c=_a10+Math.max(0,h);var _f2=_a10+Math.min(0,h);var addPlane=function addPlane(isCeiling){var face=planeCoords.map(function(p){return[p[0],isCeiling?c:_f2,p[1]];});faces.push(isCeiling?face:face.slice(0).reverse());};addPlane(true);// ceiling
|
|
30596
30565
|
addPlane(false);// floor
|
|
30597
30566
|
// sides
|
|
30598
|
-
var _p5=function _p5(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var _i616=0;_i616<planeCoords.length;++_i616){var _j6=(_i616+1)%planeCoords.length;faces.push([_p5(_i616,_f2),_p5(_j6,_f2),_p5(_j6,c),_p5(_i616,c)]);}}var _iterator45=_createForOfIteratorHelper(sectionPlanes),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var
|
|
30567
|
+
var _p5=function _p5(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var _i616=0;_i616<planeCoords.length;++_i616){var _j6=(_i616+1)%planeCoords.length;faces.push([_p5(_i616,_f2),_p5(_j6,_f2),_p5(_j6,c),_p5(_i616,c)]);}}var _iterator45=_createForOfIteratorHelper(sectionPlanes),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var _s3=_step45.value;var dir=_s3.dir;var dist=_s3.dist;var newFaces=[];var _iterator48=_createForOfIteratorHelper(faces),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var face=_step48.value;var _EPSILON=1e-5;var COPLANAR=0;var FRONT=1;var BACK=2;var SPANNING=3;// Classify each point as well as the entire polygon into one of the above four classes.
|
|
30599
30568
|
var polygonType=0;var types=[];for(var _i617=0;_i617<face.length;_i617++){var t=math.dotVec3(dir,face[_i617])+dist;var type=t<-_EPSILON?BACK:t>_EPSILON?FRONT:COPLANAR;polygonType|=type;types.push(type);}// Put the polygon in the correct list, splitting it when necessary.
|
|
30600
30569
|
switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.push(face);break;case BACK:break;case SPANNING:var _f4=[];for(var _i618=0;_i618<face.length;_i618++){var j=(_i618+1)%face.length;var ti=types[_i618];var tj=types[j];var vi=face[_i618];var vj=face[j];if(ti!==BACK){_f4.push(vi);}if((ti|tj)===SPANNING){var diff=math.vec3();math.subVec3(vj,vi,diff);var _t7=-(dist+math.dotVec3(dir,vi))/math.dotVec3(dir,diff);var v=[0,0,0];math.lerpVec3(_t7,0,1,vi,vj,v);_f4.push(v);}}if(_f4.length>=3){newFaces.push(_f4);}break;}}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}faces=newFaces;}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}if(faces.length===0){return null;}else{var avg=math.vec3([0,0,0]);var unique=new Set();var _iterator46=_createForOfIteratorHelper(faces),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var _f3=_step46.value;var _iterator47=_createForOfIteratorHelper(_f3),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _p6=_step47.value;var id=_p6.map(function(x){return x.toFixed(3);}).join(":");if(!unique.has(id)){unique.add(id);math.addVec3(avg,_p6,avg);}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}math.mulVec3Scalar(avg,1/unique.size,avg);return avg;}}},{key:"center",get:function get(){return this._center;}},{key:"altitude",get:function get(){return this._geometry.altitude;},set:function set(value){this._geometry.altitude=value;this._rebuildMesh();}},{key:"height",get:function get(){return this._geometry.height;},set:function set(value){this._geometry.height=value;this._rebuildMesh();}},{key:"highlighted",get:function get(){return this._highlighted;},set:function set(value){this._highlighted=value;if(this._zoneMesh){this._zoneMesh.highlighted=value;}}},{key:"color",get:function get(){return this._color;},set:function set(value){this._color=value;if(this._zoneMesh){this._zoneMesh.material.diffuse=hex2rgb(this._color);}}},{key:"alpha",get:function get(){return this._alpha;},set:function set(value){this._alpha=value;if(this._zoneMesh){this._zoneMesh.material.alpha=this._alpha;}}},{key:"edges",get:function get(){return this._edges;},set:function set(edges){this._edges=edges;if(this._zoneMesh){this._zoneMesh.edges=this._edges;}}/**
|
|
30601
30570
|
* Sets whether this Zone is visible or not.
|
|
@@ -30646,11 +30615,11 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
30646
30615
|
* @param {ZonesPlugin} zonesPlugin The ZonesPlugin to control.
|
|
30647
30616
|
* @param [cfg] Configuration
|
|
30648
30617
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
30649
|
-
*/function ZonesAAZoneControl(zonesPlugin,cfg,createSelect3dPoint){var
|
|
30618
|
+
*/function ZonesAAZoneControl(zonesPlugin,cfg,createSelect3dPoint){var _this186;_classCallCheck(this,ZonesAAZoneControl);_this186=_super175.call(this,zonesPlugin.viewer.scene);_this186.zonesPlugin=zonesPlugin;_this186.pointerLens=cfg.pointerLens;_this186.createSelect3dPoint=createSelect3dPoint;_this186._deactivate=null;return _this186;}_createClass(ZonesAAZoneControl,[{key:"active",get:function get(){return!!this._deactivate;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(this._deactivate){return;}if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=this.createSelect3dPoint(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){var basePolygon=basePolygon3D(scene,zoneColor,zoneAlpha);var deactivate=startAARectCreateUI(scene,zoneColor,self.pointerLens,select3dPoint,function(points){if(points){var p0=points[0];var p1=points[1];var min=function min(idx){return Math.min(p0[idx],p1[idx]);};var max=function max(idx){return Math.max(p0[idx],p1[idx]);};var xmin=min(0);var ymin=min(1);var zmin=min(2);var xmax=max(0);max(1);var zmax=max(2);basePolygon.updateBase([[xmin,ymin,zmax],[xmax,ymin,zmax],[xmax,ymin,zmin],[xmin,ymin,zmin]]);}else{basePolygon.updateBase(null);}},function(points){basePolygon.destroy();var zone=createAAZoneFromPoints(points[0],points[1],zoneAltitude,zoneHeight,zoneColor,zoneAlpha,zonesPlugin);var reactivate=true;self._deactivate=function(){reactivate=false;};self.fire("zoneEnd",zone);if(reactivate){rec();}}).deactivate;self._deactivate=function(){deactivate();basePolygon.destroy();};})();}},{key:"deactivate",value:function deactivate(){if(this._deactivate){this._deactivate();this._deactivate=null;}}/**
|
|
30650
30619
|
* Destroys this ZonesMouseControl.
|
|
30651
30620
|
*
|
|
30652
30621
|
* Destroys any {@link Zone} under construction by this ZonesMouseControl.
|
|
30653
|
-
*/},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesAAZoneControl.prototype),"destroy",this).call(this);}}]);return ZonesAAZoneControl;}(Component);var ZonesMouseControl=/*#__PURE__*/function(_ZonesAAZoneControl){_inherits(ZonesMouseControl,_ZonesAAZoneControl);var _super176=_createSuper(ZonesMouseControl);function ZonesMouseControl(zonesPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesMouseControl);return _super176.call(this,zonesPlugin,cfg,function(viewer,ray2WorldPos){return mousePointSelector(viewer,ray2WorldPos);});}return _createClass(ZonesMouseControl);}(ZonesAAZoneControl);var ZonesTouchControl=/*#__PURE__*/function(_ZonesAAZoneControl2){_inherits(ZonesTouchControl,_ZonesAAZoneControl2);var _super177=_createSuper(ZonesTouchControl);function ZonesTouchControl(zonesPlugin){var
|
|
30622
|
+
*/},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesAAZoneControl.prototype),"destroy",this).call(this);}}]);return ZonesAAZoneControl;}(Component);var ZonesMouseControl=/*#__PURE__*/function(_ZonesAAZoneControl){_inherits(ZonesMouseControl,_ZonesAAZoneControl);var _super176=_createSuper(ZonesMouseControl);function ZonesMouseControl(zonesPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesMouseControl);return _super176.call(this,zonesPlugin,cfg,function(viewer,ray2WorldPos){return mousePointSelector(viewer,ray2WorldPos);});}return _createClass(ZonesMouseControl);}(ZonesAAZoneControl);var ZonesTouchControl=/*#__PURE__*/function(_ZonesAAZoneControl2){_inherits(ZonesTouchControl,_ZonesAAZoneControl2);var _super177=_createSuper(ZonesTouchControl);function ZonesTouchControl(zonesPlugin){var _this187;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesTouchControl);var pointerCircle=new PointerCircle(zonesPlugin.viewer);_this187=_super177.call(this,zonesPlugin,cfg,function(viewer,ray2WorldPos){return touchPointSelector(viewer,pointerCircle,ray2WorldPos);});_this187.pointerCircle=pointerCircle;return _this187;}_createClass(ZonesTouchControl,[{key:"destroy",value:function destroy(){this.pointerCircle.destroy();_get(_getPrototypeOf(ZonesTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesTouchControl;}(ZonesAAZoneControl);/**
|
|
30654
30623
|
* ZonesPlugin documentation to be added, mostly compatible with DistanceMeasurementsPlugin.
|
|
30655
30624
|
*/var ZonesPlugin=/*#__PURE__*/function(_Plugin23){_inherits(ZonesPlugin,_Plugin23);var _super178=_createSuper(ZonesPlugin);/**
|
|
30656
30625
|
* @constructor
|
|
@@ -30661,7 +30630,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
30661
30630
|
* @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
|
|
30662
30631
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
30663
30632
|
* @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
|
|
30664
|
-
*/function ZonesPlugin(viewer){var
|
|
30633
|
+
*/function ZonesPlugin(viewer){var _this188;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPlugin);_this188=_super178.call(this,"Zones",viewer);_this188._pointerLens=cfg.pointerLens;_this188._container=cfg.container||document.body;_this188._zones=[];_this188.defaultColor=cfg.defaultColor!==undefined?cfg.defaultColor:"#00BBFF";_this188.zIndex=cfg.zIndex||10000;_this188._onMouseOver=function(event,zone){_this188.fire("mouseOver",{plugin:_assertThisInitialized(_this188),zone:zone,event:event});};_this188._onMouseLeave=function(event,zone){_this188.fire("mouseLeave",{plugin:_assertThisInitialized(_this188),zone:zone,event:event});};_this188._onContextMenu=function(event,zone){_this188.fire("contextMenu",{plugin:_assertThisInitialized(_this188),zone:zone,event:event});};return _this188;}/**
|
|
30665
30634
|
* Creates a {@link Zone}.
|
|
30666
30635
|
*
|
|
30667
30636
|
* The Zone is then registered by {@link Zone#id} in {@link ZonesPlugin#zones}.
|
|
@@ -30674,7 +30643,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
30674
30643
|
* @param {Entity} params.target.entity Target Entity.
|
|
30675
30644
|
* @param {string} [params.color] The color of the length dot, wire and label.
|
|
30676
30645
|
* @returns {Zone} The new {@link Zone}.
|
|
30677
|
-
*/_createClass(ZonesPlugin,[{key:"createZone",value:function createZone(){var
|
|
30646
|
+
*/_createClass(ZonesPlugin,[{key:"createZone",value:function createZone(){var _this189=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 zone=new Zone(this,{id:params.id,plugin:this,container:this._container,geometry:params.geometry,alpha:params.alpha,color:params.color,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});this._zones.push(zone);zone.on("destroyed",function(){var idx=_this189._zones.indexOf(zone);if(idx>=0){_this189._zones.splice(idx,1);}});this.fire("zoneCreated",zone);return zone;}/**
|
|
30678
30647
|
* Gets the existing {@link Zone}s, each mapped to its {@link Zone#id}.
|
|
30679
30648
|
*
|
|
30680
30649
|
* @type {{String:Zone}}
|
|
@@ -30693,4 +30662,4 @@ o4===0&&onSegment(c,b,d))// c, d and b are collinear and b lies on segment cd
|
|
|
30693
30662
|
{return true;}}return false;};}();deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker.update(null);wire&&wire.update(null);basePolygon.updateBase(markers.length>2?markers.map(function(m){return m.getWorldPos();}):null);},function(canvasPos,worldPos){var snappedFirst=markers.length>2&&getSnappedFirst(canvasPos);firstMarker&&firstMarker.setHighlighted(!!snappedFirst);updatePointerLens(snappedFirst?snappedFirst.canvasPos:canvasPos);marker.update(!snappedFirst&&worldPos);wire&&wire.update(snappedFirst?snappedFirst.worldPos:worldPos);if(markers.length>=2){var pos=markers.map(function(m){return m.getWorldPos();}).concat(snappedFirst?[]:[worldPos]);var inter=lastSegmentIntersects(pos.map(function(p){return[p[0],p[2]];}),snappedFirst);basePolygon.updateBase(inter?null:pos);}else basePolygon.updateBase(null);},function(canvasPos,worldPos){var snappedFirst=markers.length>2&&getSnappedFirst(canvasPos);var pos=markers.map(function(m){return m.getWorldPos();}).concat(snappedFirst?[]:[worldPos]);basePolygon.updateBase(pos);var pos2D=pos.map(function(p){return[p[0],p[2]];});if(markers.length>2&&lastSegmentIntersects(pos2D,snappedFirst)){cleanups.pop()();selectNextPoint(markers);}else if(snappedFirst){// `marker2.update' makes sure marker's position has been updated from its default [0,0,0]
|
|
30694
30663
|
// This works around an unidentified bug somewhere around OcclusionLayer, that causes error
|
|
30695
30664
|
// [.WebGL-0x13400c47e00] GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call
|
|
30696
|
-
marker.update(worldPos);cleanups.forEach(function(c){return c();});onZoneCreated(zonesPlugin.createZone({id:math.createUUID(),geometry:{planeCoordinates:pos2D,altitude:zoneAltitude,height:zoneHeight},alpha:zoneAlpha,color:zoneColor}));}else{marker.update(worldPos);wire&&wire.update(worldPos);selectNextPoint(markers.concat(marker));}});})([]);return{closeSurface:function closeSurface(){throw"TODO";},deactivate:function deactivate(){deactivatePointSelection();cleanups.forEach(function(c){return c();});}};};var ZonesPolysurfaceMouseControl=/*#__PURE__*/function(_Component44){_inherits(ZonesPolysurfaceMouseControl,_Component44);var _super179=_createSuper(ZonesPolysurfaceMouseControl);function ZonesPolysurfaceMouseControl(zonesPlugin){var _this191;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceMouseControl);_this191=_super179.call(this,zonesPlugin.viewer.scene);_this191.zonesPlugin=zonesPlugin;_this191.pointerLens=cfg.pointerLens;_this191._action=null;return _this191;}_createClass(ZonesPolysurfaceMouseControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=mousePointSelector(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceMouseControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceMouseControl;}(Component);var ZonesPolysurfaceTouchControl=/*#__PURE__*/function(_Component45){_inherits(ZonesPolysurfaceTouchControl,_Component45);var _super180=_createSuper(ZonesPolysurfaceTouchControl);function ZonesPolysurfaceTouchControl(zonesPlugin){var _this192;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceTouchControl);_this192=_super180.call(this,zonesPlugin.viewer.scene);_this192.zonesPlugin=zonesPlugin;_this192.pointerLens=cfg.pointerLens;_this192.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this192._action=null;return _this192;}_createClass(ZonesPolysurfaceTouchControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceTouchControl;}(Component);var ZoneEditControl=/*#__PURE__*/function(_Component46){_inherits(ZoneEditControl,_Component46);var _super181=_createSuper(ZoneEditControl);function ZoneEditControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this193;_classCallCheck(this,ZoneEditControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;_this193=_super181.call(this,scene);var altitude=zone._geometry.altitude;var dots=zone._geometry.planeCoordinates.map(function(planeCoord){var dotParent=scene.canvas.canvas.ownerDocument.body;var dot=new Dot3D(scene,{},dotParent,{fillColor:zone._color});dot.worldPos=math.vec3([planeCoord[0],altitude,planeCoord[1]]);dot.on("worldPos",function(){planeCoord[0]=dot.worldPos[0];planeCoord[1]=dot.worldPos[2];try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}});return dot;});var cleanupDrag=activateDraggableDots({viewer:viewer,handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,pointerLens:cfg&&cfg.pointerLens,dots:dots,ray2WorldPos:function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);},onEnd:function onEnd(initPos,dot){if(zone._zoneMesh){_this193.fire("edited");}return!!zone._zoneMesh;}});var cleanup=function cleanup(){cleanupDrag();dots.forEach(function(d){return d.destroy();});};var destroyCb=zone.on("destroyed",cleanup);_this193._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this193;}_createClass(ZoneEditControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneEditControl.prototype),"destroy",this).call(this);}}]);return ZoneEditControl;}(Component);var ZoneEditMouseControl=/*#__PURE__*/function(_ZoneEditControl){_inherits(ZoneEditMouseControl,_ZoneEditControl);var _super182=_createSuper(ZoneEditMouseControl);function ZoneEditMouseControl(zone,cfg){_classCallCheck(this,ZoneEditMouseControl);return _super182.call(this,zone,cfg,true,false);}return _createClass(ZoneEditMouseControl);}(ZoneEditControl);var ZoneEditTouchControl=/*#__PURE__*/function(_ZoneEditControl2){_inherits(ZoneEditTouchControl,_ZoneEditControl2);var _super183=_createSuper(ZoneEditTouchControl);function ZoneEditTouchControl(zone,cfg){_classCallCheck(this,ZoneEditTouchControl);return _super183.call(this,zone,cfg,false,true);}return _createClass(ZoneEditTouchControl);}(ZoneEditControl);var ZoneTranslateControl=/*#__PURE__*/function(_Component47){_inherits(ZoneTranslateControl,_Component47);var _super184=_createSuper(ZoneTranslateControl);function ZoneTranslateControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this194;_classCallCheck(this,ZoneTranslateControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;_this194=_super184.call(this,scene);var self=_assertThisInitialized(_this194);var altitude=zone._geometry.altitude;var pointerLens=cfg&&cfg.pointerLens;var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var ray2WorldPos=function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var canvasHandle=function canvasHandle(type,cb){var callback=function callback(event){event.preventDefault();cb(event);};canvas.addEventListener(type,callback);return function(){return canvas.removeEventListener(type,callback);};};var _cleanupCurrentDrag=function cleanupCurrentDrag(){};var startDrag=function startDrag(event,onMoveType,onEndType,matchesEvent){var e=matchesEvent(event);var canvasPos=copyCanvasPos(e,math.vec2());var pickRecord=viewer.scene.pick({canvasPos:canvasPos,includeEntities:[zone._zoneMesh.id]});var pickZone=pickRecord&&pickRecord.entity&&pickRecord.entity.zone;if(pickZone===zone){_cleanupCurrentDrag();canvas.style.cursor="move";viewer.cameraControl.active=false;var onChange=function(){var initCoords=zone._geometry.planeCoordinates.map(function(c){return c.slice();});var initWorldPos=pickWorldPos(canvasPos);var initDragCoord=math.vec2([initWorldPos[0],initWorldPos[2]]);var dPos=math.vec2();return function(canvasPos){var worldPos=pickWorldPos(canvasPos);dPos[0]=worldPos[0];dPos[1]=worldPos[2];math.subVec2(initDragCoord,dPos,dPos);zone._geometry.planeCoordinates.forEach(function(planeCoord,idx){math.subVec2(initCoords[idx],dPos,planeCoord);});try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}};}();var cleanupMove=canvasHandle(onMoveType,function(event){var e=matchesEvent(event);if(e){var _canvasPos4=copyCanvasPos(e,math.vec2());onChange(_canvasPos4);updatePointerLens(_canvasPos4);}});var cleanupEnd=canvasHandle(onEndType,function(event){var e=matchesEvent(event);if(e){var _canvasPos5=copyCanvasPos(e,math.vec2());onChange(_canvasPos5);updatePointerLens(null);_cleanupCurrentDrag();self.fire("translated");}});_cleanupCurrentDrag=function cleanupCurrentDrag(){_cleanupCurrentDrag=function cleanupCurrentDrag(){};canvas.style.cursor="default";viewer.cameraControl.active=true;cleanupMove();cleanupEnd();};}};var startDragCbs=[];if(handleMouseEvents){startDragCbs.push(canvasHandle("mousedown",function(event){if(event.which===1){startDrag(event,"mousemove","mouseup",function(event){return event.which===1&&event;});}}));}if(handleTouchEvents){startDragCbs.push(canvasHandle("touchstart",function(event){if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,"touchmove","touchend",function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}}));}var cleanup=function cleanup(){_cleanupCurrentDrag();startDragCbs.forEach(function(cb){return cb();});updatePointerLens(null);};var destroyCb=zone.on("destroyed",cleanup);_this194._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this194;}_createClass(ZoneTranslateControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneTranslateControl.prototype),"destroy",this).call(this);}}]);return ZoneTranslateControl;}(Component);var ZoneTranslateMouseControl=/*#__PURE__*/function(_ZoneTranslateControl){_inherits(ZoneTranslateMouseControl,_ZoneTranslateControl);var _super185=_createSuper(ZoneTranslateMouseControl);function ZoneTranslateMouseControl(zone,cfg){_classCallCheck(this,ZoneTranslateMouseControl);return _super185.call(this,zone,cfg,true,false);}return _createClass(ZoneTranslateMouseControl);}(ZoneTranslateControl);var ZoneTranslateTouchControl=/*#__PURE__*/function(_ZoneTranslateControl2){_inherits(ZoneTranslateTouchControl,_ZoneTranslateControl2);var _super186=_createSuper(ZoneTranslateTouchControl);function ZoneTranslateTouchControl(zone,cfg){_classCallCheck(this,ZoneTranslateTouchControl);return _super186.call(this,zone,cfg,false,true);}return _createClass(ZoneTranslateTouchControl);}(ZoneTranslateControl);export{AlphaFormat,AmbientLight,AngleMeasurementEditMouseControl,AngleMeasurementEditTouchControl,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,CityJSONLoaderPlugin,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,ContextMenu,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementEditControl,DistanceMeasurementEditMouseControl,DistanceMeasurementEditTouchControl,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsTouchControl,Dot3D,DotBIMDefaultDataSource,DotBIMLoaderPlugin,EdgeMaterial,EmphasisMaterial,FaceAlignedSectionPlanesPlugin,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,Label3D,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,MarqueePicker,MarqueePickerMouseControl,Mesh,MeshSurfaceArea,MeshVolume,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$2 as Node,OBJLoaderPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,PickResult,Plugin,PointLight,PointerCircle,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,RepeatWrapping,STLDefaultDataSource,STLLoaderPlugin,SceneModel,SceneModelMesh,SceneModelTransform,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,Wire3D,WorkerPool$1 as WorkerPool,XKTDefaultDataSource,XKTLoaderPlugin,XML3DLoaderPlugin,ZoneEditControl,ZoneEditMouseControl,ZoneEditTouchControl,ZoneTranslateControl,ZoneTranslateMouseControl,ZoneTranslateTouchControl,ZonesMouseControl,ZonesPlugin,ZonesPolysurfaceMouseControl,ZonesPolysurfaceTouchControl,ZonesTouchControl,activateDraggableDot,activateDraggableDots,buildBoxGeometry,buildBoxLinesGeometry,buildBoxLinesGeometryFromAABB,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,isTriangleMeshSolid,load3DSGeometry,loadOBJGeometry,math,meshSurfaceArea,meshVolume,os,rtcToWorldPos,sRGBEncoding,setFrustum,stats,touchPointSelector,transformToNode,utils,worldToRTCPos,worldToRTCPositions};
|
|
30665
|
+
marker.update(worldPos);cleanups.forEach(function(c){return c();});onZoneCreated(zonesPlugin.createZone({id:math.createUUID(),geometry:{planeCoordinates:pos2D,altitude:zoneAltitude,height:zoneHeight},alpha:zoneAlpha,color:zoneColor}));}else{marker.update(worldPos);wire&&wire.update(worldPos);selectNextPoint(markers.concat(marker));}});})([]);return{closeSurface:function closeSurface(){throw"TODO";},deactivate:function deactivate(){deactivatePointSelection();cleanups.forEach(function(c){return c();});}};};var ZonesPolysurfaceMouseControl=/*#__PURE__*/function(_Component44){_inherits(ZonesPolysurfaceMouseControl,_Component44);var _super179=_createSuper(ZonesPolysurfaceMouseControl);function ZonesPolysurfaceMouseControl(zonesPlugin){var _this190;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceMouseControl);_this190=_super179.call(this,zonesPlugin.viewer.scene);_this190.zonesPlugin=zonesPlugin;_this190.pointerLens=cfg.pointerLens;_this190._action=null;return _this190;}_createClass(ZonesPolysurfaceMouseControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=mousePointSelector(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceMouseControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceMouseControl;}(Component);var ZonesPolysurfaceTouchControl=/*#__PURE__*/function(_Component45){_inherits(ZonesPolysurfaceTouchControl,_Component45);var _super180=_createSuper(ZonesPolysurfaceTouchControl);function ZonesPolysurfaceTouchControl(zonesPlugin){var _this191;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceTouchControl);_this191=_super180.call(this,zonesPlugin.viewer.scene);_this191.zonesPlugin=zonesPlugin;_this191.pointerLens=cfg.pointerLens;_this191.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this191._action=null;return _this191;}_createClass(ZonesPolysurfaceTouchControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceTouchControl;}(Component);var ZoneEditControl=/*#__PURE__*/function(_Component46){_inherits(ZoneEditControl,_Component46);var _super181=_createSuper(ZoneEditControl);function ZoneEditControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this192;_classCallCheck(this,ZoneEditControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;_this192=_super181.call(this,scene);var altitude=zone._geometry.altitude;var dots=zone._geometry.planeCoordinates.map(function(planeCoord){var dotParent=scene.canvas.canvas.ownerDocument.body;var dot=new Dot3D(scene,{},dotParent,{fillColor:zone._color});dot.worldPos=math.vec3([planeCoord[0],altitude,planeCoord[1]]);dot.on("worldPos",function(){planeCoord[0]=dot.worldPos[0];planeCoord[1]=dot.worldPos[2];try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}});return dot;});var cleanupDrag=activateDraggableDots({viewer:viewer,handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,pointerLens:cfg&&cfg.pointerLens,dots:dots,ray2WorldPos:function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);},onEnd:function onEnd(initPos,dot){if(zone._zoneMesh){_this192.fire("edited");}return!!zone._zoneMesh;}});var cleanup=function cleanup(){cleanupDrag();dots.forEach(function(d){return d.destroy();});};var destroyCb=zone.on("destroyed",cleanup);_this192._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this192;}_createClass(ZoneEditControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneEditControl.prototype),"destroy",this).call(this);}}]);return ZoneEditControl;}(Component);var ZoneEditMouseControl=/*#__PURE__*/function(_ZoneEditControl){_inherits(ZoneEditMouseControl,_ZoneEditControl);var _super182=_createSuper(ZoneEditMouseControl);function ZoneEditMouseControl(zone,cfg){_classCallCheck(this,ZoneEditMouseControl);return _super182.call(this,zone,cfg,true,false);}return _createClass(ZoneEditMouseControl);}(ZoneEditControl);var ZoneEditTouchControl=/*#__PURE__*/function(_ZoneEditControl2){_inherits(ZoneEditTouchControl,_ZoneEditControl2);var _super183=_createSuper(ZoneEditTouchControl);function ZoneEditTouchControl(zone,cfg){_classCallCheck(this,ZoneEditTouchControl);return _super183.call(this,zone,cfg,false,true);}return _createClass(ZoneEditTouchControl);}(ZoneEditControl);var ZoneTranslateControl=/*#__PURE__*/function(_Component47){_inherits(ZoneTranslateControl,_Component47);var _super184=_createSuper(ZoneTranslateControl);function ZoneTranslateControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this193;_classCallCheck(this,ZoneTranslateControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;_this193=_super184.call(this,scene);var self=_assertThisInitialized(_this193);var altitude=zone._geometry.altitude;var pointerLens=cfg&&cfg.pointerLens;var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var ray2WorldPos=function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var canvasHandle=function canvasHandle(type,cb){var callback=function callback(event){event.preventDefault();cb(event);};canvas.addEventListener(type,callback);return function(){return canvas.removeEventListener(type,callback);};};var _cleanupCurrentDrag=function cleanupCurrentDrag(){};var startDrag=function startDrag(event,onMoveType,onEndType,matchesEvent){var e=matchesEvent(event);var canvasPos=copyCanvasPos(e,math.vec2());var pickRecord=viewer.scene.pick({canvasPos:canvasPos,includeEntities:[zone._zoneMesh.id]});var pickZone=pickRecord&&pickRecord.entity&&pickRecord.entity.zone;if(pickZone===zone){_cleanupCurrentDrag();canvas.style.cursor="move";viewer.cameraControl.active=false;var onChange=function(){var initCoords=zone._geometry.planeCoordinates.map(function(c){return c.slice();});var initWorldPos=pickWorldPos(canvasPos);var initDragCoord=math.vec2([initWorldPos[0],initWorldPos[2]]);var dPos=math.vec2();return function(canvasPos){var worldPos=pickWorldPos(canvasPos);dPos[0]=worldPos[0];dPos[1]=worldPos[2];math.subVec2(initDragCoord,dPos,dPos);zone._geometry.planeCoordinates.forEach(function(planeCoord,idx){math.subVec2(initCoords[idx],dPos,planeCoord);});try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}};}();var cleanupMove=canvasHandle(onMoveType,function(event){var e=matchesEvent(event);if(e){var _canvasPos5=copyCanvasPos(e,math.vec2());onChange(_canvasPos5);updatePointerLens(_canvasPos5);}});var cleanupEnd=canvasHandle(onEndType,function(event){var e=matchesEvent(event);if(e){var _canvasPos6=copyCanvasPos(e,math.vec2());onChange(_canvasPos6);updatePointerLens(null);_cleanupCurrentDrag();self.fire("translated");}});_cleanupCurrentDrag=function cleanupCurrentDrag(){_cleanupCurrentDrag=function cleanupCurrentDrag(){};canvas.style.cursor="default";viewer.cameraControl.active=true;cleanupMove();cleanupEnd();};}};var startDragCbs=[];if(handleMouseEvents){startDragCbs.push(canvasHandle("mousedown",function(event){if(event.which===1){startDrag(event,"mousemove","mouseup",function(event){return event.which===1&&event;});}}));}if(handleTouchEvents){startDragCbs.push(canvasHandle("touchstart",function(event){if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,"touchmove","touchend",function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}}));}var cleanup=function cleanup(){_cleanupCurrentDrag();startDragCbs.forEach(function(cb){return cb();});updatePointerLens(null);};var destroyCb=zone.on("destroyed",cleanup);_this193._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this193;}_createClass(ZoneTranslateControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneTranslateControl.prototype),"destroy",this).call(this);}}]);return ZoneTranslateControl;}(Component);var ZoneTranslateMouseControl=/*#__PURE__*/function(_ZoneTranslateControl){_inherits(ZoneTranslateMouseControl,_ZoneTranslateControl);var _super185=_createSuper(ZoneTranslateMouseControl);function ZoneTranslateMouseControl(zone,cfg){_classCallCheck(this,ZoneTranslateMouseControl);return _super185.call(this,zone,cfg,true,false);}return _createClass(ZoneTranslateMouseControl);}(ZoneTranslateControl);var ZoneTranslateTouchControl=/*#__PURE__*/function(_ZoneTranslateControl2){_inherits(ZoneTranslateTouchControl,_ZoneTranslateControl2);var _super186=_createSuper(ZoneTranslateTouchControl);function ZoneTranslateTouchControl(zone,cfg){_classCallCheck(this,ZoneTranslateTouchControl);return _super186.call(this,zone,cfg,false,true);}return _createClass(ZoneTranslateTouchControl);}(ZoneTranslateControl);export{AlphaFormat,AmbientLight,AngleMeasurementEditMouseControl,AngleMeasurementEditTouchControl,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,CityJSONLoaderPlugin,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,ContextMenu,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementEditControl,DistanceMeasurementEditMouseControl,DistanceMeasurementEditTouchControl,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsTouchControl,Dot3D,DotBIMDefaultDataSource,DotBIMLoaderPlugin,EdgeMaterial,EmphasisMaterial,FaceAlignedSectionPlanesPlugin,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,Label3D,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,MarqueePicker,MarqueePickerMouseControl,Mesh,MeshSurfaceArea,MeshVolume,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$2 as Node,OBJLoaderPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,PickResult,Plugin,PointLight,PointerCircle,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,RepeatWrapping,STLDefaultDataSource,STLLoaderPlugin,SceneModel,SceneModelMesh,SceneModelTransform,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,Wire3D,WorkerPool$1 as WorkerPool,XKTDefaultDataSource,XKTLoaderPlugin,XML3DLoaderPlugin,ZoneEditControl,ZoneEditMouseControl,ZoneEditTouchControl,ZoneTranslateControl,ZoneTranslateMouseControl,ZoneTranslateTouchControl,ZonesMouseControl,ZonesPlugin,ZonesPolysurfaceMouseControl,ZonesPolysurfaceTouchControl,ZonesTouchControl,activateDraggableDot,activateDraggableDots,buildBoxGeometry,buildBoxLinesGeometry,buildBoxLinesGeometryFromAABB,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,isTriangleMeshSolid,load3DSGeometry,loadOBJGeometry,math,meshSurfaceArea,meshVolume,os,rtcToWorldPos,sRGBEncoding,setFrustum,stats,touchPointSelector,transformToNode,utils,worldToRTCPos,worldToRTCPositions};
|