Files
DianZhanDemo/app/supreium_viewer/package/dist/index.mjs

144 lines
472 KiB
JavaScript
Raw Normal View History

2025-12-11 01:29:41 +08:00
import{OrthographicCamera as e,Matrix4 as t,PerspectiveCamera as i,Float32BufferAttribute as n,Uint16BufferAttribute as s,Vector2 as r,Vector3 as a,BufferGeometry as o,Object3D as h,InstancedMesh as d,InstancedBufferAttribute as p,CylinderGeometry as l,MeshLambertMaterial as c,ConeGeometry as u,Color as g,ShaderChunk as f,UniformsLib as m,ShaderMaterial as w,ShaderLib as v,UniformsUtils as x,MultiplyOperation as y,NoBlending as M,DataTexture as b,RGBAFormat as E,Mesh as S,Group as T,AmbientLight as C,PointLight as _,Light as R,Scene as A,WebGLRenderTarget as P,FloatType as O,NormalBlending as L,WebGLMultipleRenderTargets as D,NearestFilter as z,ClampToEdgeWrapping as I,LinearEncoding as B,RedFormat as F,RawShaderMaterial as N,CustomBlending as U,OneMinusSrcAlphaFactor as G,OneFactor as H,AddEquation as k,LessDepth as j,ZeroFactor as V,Raycaster as W,DoubleSide as K,Triangle as Y,Quaternion as X,Box3 as q,Box2 as Z,MeshBasicMaterial as Q,Loader as $,LoaderUtils as J,Texture as ee,ImageLoader as te,Vector4 as ie,LineSegments as ne,LineBasicMaterial as se,Plane as re,NotEqualStencilFunc as ae,KeepStencilOp as oe,DepthTexture as he,DepthStencilFormat as de,UnsignedInt248Type as pe,AlwaysStencilFunc as le,BackSide as ce,IncrementWrapStencilOp as ue,FrontSide as ge,DecrementWrapStencilOp as fe,Material as me,Ray as we,Line as ve,EdgesGeometry as xe,Sprite as ye,SpriteMaterial as Me,CanvasTexture as be,SphereGeometry as Ee,Matrix3 as Se,Int32BufferAttribute as Te,DataArrayTexture as Ce,LinearFilter as _e,UnsignedByteType as Re,Uint32BufferAttribute as Ae,InstancedInterleavedBuffer as Pe,InterleavedBufferAttribute as Oe,PointsMaterial as Le,Points as De,MeshPhongMaterial as ze,Line3 as Ie,BoxGeometry as Be}from"three";import{v4 as Fe}from"uuid";import"polyfill-node16";import{Lut as Ne,LineMaterial as Ue,CopyShader as Ge,FullScreenQuad as He,Pass as ke,ShaderPass as je,FXAAShader as Ve,EffectComposer as We,PLYLoader as Ke,STLLoader as Ye,Stats as Xe,LineSegmentsGeometry as qe,LineSegments2 as Ze}from"supreium-threejs-examples";import{Blob as Qe}from"buffer";import $e from"axios";import{toArrayBuffer as Je,adaptImage as et,drawImage as tt,createRenderer as it}from"supreium-node-threejs";import{range as nt}from"lodash-es";import st from"number-precision";import{createCanvas as rt}from"canvas";import{BidirectionMultipleValueMap as at,BidirectionMap as ot}from"bidirection-map";function ht(e){return void 0!==e.afterProjectionMatrix}class dt{handlers=[];add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter((t=>t!==e))}trigger(e){this.handlers.slice(0).forEach((t=>t(e)))}}const pt=1.732;class lt extends e{wrappedAfterProjectionMatrix=new t;wrappedOriginProjectMatrix=new t;cameraChangedEvent=new dt;constructor(e,t,i,n,s,r){super(e,t,i,n,s,r),this.updateProjectionMatrix()}get originProjectMatrix(){return this.wrappedOriginProjectMatrix}get afterProjectionMatrix(){return this.wrappedAfterProjectionMatrix}set afterProjectionMatrix(e){this.wrappedAfterProjectionMatrix.equals(e)||(this.wrappedAfterProjectionMatrix=e,this.updateProjectionMatrix())}raiseCameraChangeEvent(){this.cameraChangedEvent.trigger()}updateProjectionMatrix(){super.updateProjectionMatrix(),this.wrappedAfterProjectionMatrix&&(this.wrappedOriginProjectMatrix=this.projectionMatrix.clone(),this.projectionMatrix.copy(this.wrappedAfterProjectionMatrix.clone().multiply(this.projectionMatrix)),this.projectionMatrixInverse.copy(this.projectionMatrix).invert())}}class ct extends i{wrappedAfterProjectionMatrix=new t;wrappedOriginProjectMatrix=new t;cameraChangedEvent=new dt;constructor(e,t,i,n){super(e,t,i,n),this.updateProjectionMatrix()}get originProjectMatrix(){return this.wrappedOriginProjectMatrix}get afterProjectionMatrix(){return this.wrappedAfterProjectionMatrix}set afterProjectionMatrix(e){this.wrappedAfterProjectionMatrix.equals(e)||(this.wrappedAfterProjectionMatrix=e,this.updateProjectionMatrix())}raiseCameraChangeEvent(){this.cameraChangedEvent.trigger()}updateProjectionMatrix(){super.updateProjectionMatrix(),this.wrappedAfterProjectionMatrix&&(this.
get factor(){return this.wrappedFactor}set factor(e){this.factor!==e&&(this.wrappedFactor=e,this.changedEvent.trigger())}get location(){return this.wrappedLocation}set location(e){this.wrappedLocation=e,this.changedEvent.trigger()}get size(){return this.wrappedSize}set size(e){this.wrappedSize=e,this.changedEvent.trigger()}get lut(){return this.wrappedLut}set lut(e){this.wrappedLut=e,this.changedEvent.trigger()}get type(){return this.wrappedType}set type(e){this.wrappedType=e,this.changedEvent.trigger()}get label(){return this.wrappedLabel}set label(e){this.wrappedLabel=e,this.changedEvent.trigger()}get labelFontSize(){return this.wrappedLabelFontSize}set labelFontSize(e){this.wrappedLabelFontSize=e,this.changedEvent.trigger()}get title(){return this.wrappedTitle}set title(e){this.wrappedTitle=e,this.changedEvent.trigger()}get titleFontSize(){return this.wrappedTitleFontSize}set titleFontSize(e){this.wrappedTitleFontSize=e,this.changedEvent.trigger()}get font(){return this.wrappedFont}set font(e){this.wrappedFont=e,this.changedEvent.trigger()}get color(){return this.wrappedColor}set color(e){this.wrappedColor=e,this.changedEvent.trigger()}get minFontSize(){return this.wrappedMinFontSize}set minFontSize(e){this.wrappedMinFontSize=e,this.changedEvent.trigger()}get maxFontSize(){return this.wrappedMaxFontSize}set maxFontSize(e){this.wrappedMaxFontSize=e,this.changedEvent.trigger()}draw(e){const t=this.wrappedSize[0],i=this.wrappedSize[1],n=.5*i,s=.1*t,r=.8*i,a=.1*t,o=.1*a;e.font="Normal 32px Arial",e.fillStyle="rgba(200, 0, 0, 1)",e.strokeStyle=this.wrappedColor,e.lineWidth=.3,this.drawColorBar(e,s,n,a,r),this.drawMarks(e,s,n,a,r,o),this.drawLabels(e,s,n,a,r,o),this.drawTitle(e,s,n,r)}drawColorBar(e,t,i,n,s){switch(this.wrappedType){case ss.Discrete:this.drawDiscreteColorBar(e,t,i,n,s);break;case ss.Nearest:this.drawNearestColorBar(e,t,i,n,s);break;case ss.Gradient:this.drawGradientColorBar(e,t,i,n,s);break;default:throw Error("Unknown legend type")}}drawLabels(e,t,i,n,s,r){switch(this.wrappedType){case ss.Gradient:case ss.Nearest:this.drawGradientLabels(e,t,i,n,s,r);break;case ss.Discrete:this.drawDiscreteLabels(e,t,i,n,s,r)}}drawGradientLabels(e,t,i,n,s,r){const a=this.wrappedLut[0].value,o=this.wrappedLut[this.wrappedLut.length-1].value-a;let h=Number.MAX_VALUE;for(let e=0;e<this.wrappedLut.length-1;e+=1){const t=this.wrappedLut[e+1].value-this.wrappedLut[e].value;t<h&&(h=t)}let d=void 0===this.wrappedLabelFontSize?h/o*s*.5:this.wrappedLabelFontSize;void 0!==this.wrappedMaxFontSize&&d>this.wrappedMaxFontSize?d=this.wrappedMaxFontSize:void 0!==this.wrappedMinFontSize&&d<this.wrappedMinFontSize&&(d=this.wrappedMinFontSize);let p=0;const l=t+n+2*r;e.font=`Normal ${d}px ${this.wrappedFont}`,e.fillStyle=this.wrappedColor,e.textAlign="left",e.textBaseline="middle";for(let t=0;t<this.wrappedLut.length;t+=1){const n=(this.wrappedLut[t].value*this.factor).toPrecision(3).toString(),r=e.measureText(n);p<r.width&&(p=r.width);const h=(this.wrappedLut[t].value-a)/o;e.fillText(n,l,i+(1-h)*s)}}drawDiscreteLabels(e,t,i,n,s,r){const a=1/this.wrappedLut.length;let o=void 0===this.wrappedLabelFontSize?a*s*.5:this.wrappedLabelFontSize;void 0!==this.wrappedMaxFontSize&&o>this.wrappedMaxFontSize?o=this.wrappedMaxFontSize:void 0!==this.wrappedMinFontSize&&o<this.wrappedMinFontSize&&(o=this.wrappedMinFontSize);let h=0;const d=t+n+2*r;e.font=`Normal ${o}px ${this.wrappedFont}`,e.fillStyle=this.wrappedColor,e.textAlign="left",e.textBaseline="middle";for(let t=0;t<this.wrappedLut.length;t+=1){const n=(this.wrappedLut[t].value*this.factor).toPrecision(3).toString(),r=e.measureText(n);h<r.width&&(h=r.width);const o=t*a+a/2;e.fillText(n,d,i+(1-o)*s)}}drawTitle(e,t,i,n){const s=void 0===this.wrappedTitleFontSize?Math.round(.1*n):this.wrappedTitleFontSize;e.font=`Normal ${s}px ${this.wrappedFont}`,e.fillStyle=this.wrappedColor;const r=`${this.wrappedTitle}`;e.fillText(r,t-s,i-1.2*s)}drawGradientColorBar(e,t,i,n,s){const r=this.wrappedLut[0].value,a=this.wrappedLut[this.wrappedLut.length-1].value-r,o=e.createLinearGradient(t,i+s,t,i);for(let e=0;e<this.
shape;//! hit shape
x;//! hit coord
y;z;index;//! hit index(maybe line, point or triangle)
element;//! hit element, line: {index1, index2}, triangle: {index1, index2, index3}, point: {index}
constructor(e,t,i,n,s,r,a){this.distance=e,this.shape=t,this.x=i,this.y=n,this.z=s,this.index=r,this.element=a}}class Zr{order=0;toHitTestResult(e){const{object:t}=e;if(t instanceof vs)return{type:"Text3D",object:t}}}class Qr{scenes;trianglesCollection=new Ir;linesCollection=new Sr;pointsCollection=new Or;annotationTextCollection=new ir;text3DCollection=new or;annotationLine2DCollection=new Qs;annotations=new qs;clippingSurfaceFactory;initEvent=new dt;selectableShapes=[];selectionEvent=new dt;selectionHandler=new Wr;pointsRayCastResultConverter=new Xr;linesRayCastResultConverter=new Cr;text3DRayCastResultConverter=new Zr;clippingManager;engine;set selectTol(e){this.selectionHandler.tolerance=e}get selectTol(){return this.selectionHandler.tolerance}get enableSelection(){return this.selectionHandler.isEnabled}set enableSelection(e){this.selectionHandler.isEnabled=e}get enableDynSel(){return this.selectionHandler.enableDynSel}set enableDynSel(e){this.selectionHandler.enableDynSel=e}get showLines(){return this.linesCollection.visible}set showLines(e){this.linesCollection.visible=e}get showPoints(){return this.pointsCollection.visible}set showPoints(e){this.pointsCollection.visible=e}get showTriangles(){return this.trianglesCollection.visible}set showTriangles(e){this.trianglesCollection.visible=e}constructor(e){this.clippingManager=e,this.clippingSurfaceFactory=new kr(this.trianglesCollection),this.selectionHandler.tolerance=3,this.selectionHandler.conditionCallback=e=>{let t=!1;return this.selectableShapes.forEach((i=>{if(!t)if(i instanceof gr&&i.visible)i.getConfig(e)&&(t=!0);else if(i instanceof rr){if(e instanceof vs){i===this.text3DCollection.queryText3D(e)&&(t=!0)}}else if(i instanceof er){if(e instanceof Ks){i===this.annotationTextCollection.queryText2D(e)&&(t=!0)}}else if(i instanceof ks&&e instanceof Xs){i===this.annotationLine2DCollection.queryLine(e)&&(t=!0)}})),t},this.selectionHandler.mouseMoveOnEvent.add((e=>{if(!e)throw Error("invalid args.");const t=e,{on:i}=e;if(i){const e=[];i.forEach((t=>{const i=this.convertHitTestResult(t);i&&e.push(i)})),this.selectionEvent.trigger({type:Ur.MoveOn,info:e}),t.processed=!0}else this.selectionEvent.trigger({type:Ur.MoveOn})})),this.selectionHandler.selectionEvent.add((e=>{if(!e)throw Error("invalid args.");const t=e,{on:i}=e;if(i){const n=[];i.forEach((e=>{const t=this.convertHitTestResult(e);t&&n.push(t)})),this.selectionEvent.trigger({type:Ur.ClickOn,info:n,pos2:e.pos2}),t.processed=!0}else this.selectionEvent.trigger({type:Ur.ClickOn,pos2:e.pos2})}))}async init(){{const e=new jr;this.trianglesCollection.factoryHub.registerMeshFactory(e)}{const e=new Vr;this.trianglesCollection.factoryHub.registerMeshFactory(e)}{const e=new Dr;await e.init(),this.pointsCollection.factoryHub.registerMeshFactory(e)}{const e=new wr;this.linesCollection.factoryHub.registerMeshFactory(e)}{const e=new mr;this.linesCollection.factoryHub.registerMeshFactory(e)}this.clippingManager?.sealingSurfaceFactoryHub.register(this.clippingSurfaceFactory),this.initEvent.trigger()}focus(e){if(!this.engine)throw Error("engine is empty.");let t;if(e instanceof gr){const i=[];Li(e.configs(),(t=>{const n=e.getMesh(t);n&&i.push(n)})),t=i}else t=e;this.engine.scenes.forEachScene(((e,t)=>{t.updateMatrixWorld(!0)}));const i=an.calculateBoundingBox(t);if(!i)return;const{camera:n}=this.engine;an.focusCamera(i,n),n.raiseCameraChangeEvent()}bind(e){this.engine!==e&&(void 0!==this.engine&&this.onUnbind(),this.engine=e,this.engine&&this.onBind())}onBind(){if(!this.engine)throw Error("engine is empty.");if(this.scenes=this.engine.scenes,this.restore(),this.trianglesCollection.bind(this.engine),this.linesCollection.bind(this.engine),this.pointsCollection.bind(this.engine),this.engine.rayCastResultConvertHub.register(this.pointsRayCastResultConverter),this.engine.rayCastResultConvertHub.register(this.linesRayCastResultConverter),this.engine.rayCastResultConvertHub.register(this.text3DRayCastResultConverter),this.engine.addActionHandler(this.selectionHandler),this.engine.rayCasterConfigCallback=(e,t)=>{e.params.Line2={thresh
constructor(e,t,i){this.xyz=new Jr(e,t,i)}setCoord(e,t,i){this.xyz.set(e,t,i)}x(){return this.xyz.x}y(){return this.xyz.y}z(){return this.xyz.z}static toFloat32Array(e){return new Float32Array(this.toArray(e))}static toArray(e){const t=new Array;return e.forEach((e=>{t.push(e.x(),e.y(),e.z())})),t}static toArrayVec(e){const t=new Array;return e.forEach((e=>{t.push(e.x,e.y,e.z)})),t}}class aa extends ra{applayMatrix4(e){this.xyz.applyMatrix4(e)}}class oa{nodes;//! 点列表,为连续的点序列
constructor(){this.nodes=new Array}get nodeList(){return this.nodes}set nodeList(e){this.nodes=e}static createIndex(e,t){const i=[];for(let n=1;n<e;n+=1)i.push(t+n-1,t+n);return i}bndBox(){const e=new ta;return this.nodeList.forEach((t=>e.expandByPoint(t.xyz))),e}}class ha{parent=null;props;constructor(e,t){this.parent=e,void 0!==t&&t.props&&(this.props=t.props)}name(){return this.props?.name}findEdge(e){throw new Error("Method not implemented.")}findFace(e){throw new Error("Method not implemented.")}findVertex(e){throw new Error("Method not implemented.")}getAllFaces(){return[]}getAllEdges(){return[]}getAllVertices(){return[]}static findBRep(e,t){if(Array.isArray(e)){const i=e;return t.find((e=>{const t=e.name();if(Array.isArray(t)){let e=!0;return i.forEach((i=>{t.includes(i)||(e=!1)})),e}return!1}))}return t.find((t=>{const i=t.name();return!Array.isArray(i)&&i===e}))}body(){if(this.parent)return this.parent.body();throw new Error("Method not implemented.")}}!function(e){e[e.COMPOUND=0]="COMPOUND",e[e.SOLID=2]="SOLID",e[e.SHELL=3]="SHELL",e[e.FACE=4]="FACE",e[e.WIRE=5]="WIRE",e[e.EDGE=6]="EDGE",e[e.VERTEX=7]="VERTEX",e[e.LOOP=9]="LOOP",e[e.HALFEDGE=10]="HALFEDGE"}(Gr||(Gr={})),function(e){e[e.BT_SolidBody=0]="BT_SolidBody",e[e.BT_ShellBody=1]="BT_ShellBody",e[e.BT_WireBody=2]="BT_WireBody",e[e.BT_AcornBody=3]="BT_AcornBody",e[e.BT_CompoundBody=4]="BT_CompoundBody"}(Hr||(Hr={}));class da extends ha{geomType;//! 几何曲线类型
polygon;//! 用于显示的多边形
start;//! 起点
end;//! 末点
constructor(e,t){super(t,e),this.geomType=e.type,this.polygon=new oa,e.nodes.forEach((e=>{this.polygon.nodeList.push(new aa(e[0],e[1],e[2]))})),this.start=t.findVertex(e.start),this.end=t.findVertex(e.end)}isGeom(){return!0}getAllEdges(){return[this]}getAllVertices(){return this.start===this.end?[this.start]:[this.start,this.end]}shapeType(){return Gr.EDGE}}class pa extends ra{constructor(e,t,i){super(e,t,i),this.xyz.normalize()}applayMatrix4(e){const t=new na(this.xyz.x,this.xyz.y,this.xyz.z,0);t.applyMatrix4(e).normalize(),this.xyz.set(t.x,t.y,t.z)}}class la{node1;//! 顶点1
node2;//! 顶点2
node3;//! 顶点3
constructor(e,t,i){this.node1=e,this.node2=t,this.node3=i}}class ca{nodes;//! 顶点列表
normals;//! 顶点法向
triangles;//! 三角面片列表
constructor(){this.nodes=new Array,this.triangles=new Array,this.normals=new Array}get nodeList(){return this.nodes}set nodeList(e){this.nodes=e}get triangleList(){return this.triangles}set triangleList(e){this.triangles=e}get normalList(){return this.normals}set normalList(e){this.normals=e}static toUint32Array(e){return new Uint32Array(this.toArray(e))}static toArray(e,t=0){const i=new Array;return e.forEach((e=>{i.push(e.node1+t,e.node2+t,e.node3+t)})),i}static createFromBufferGeometry(e){if(!e.hasAttribute("position"))return null;const t=new ca,i=e.attributes.position;for(let e=0;e<i.array.length;e+=3)t.nodes.push(new aa(i.array[e],i.array[e+1],i.array[e+2]));if(e.index&&e.index.array.length>0){const i=e.index;for(let e=0;e<i.array.length;e+=3)t.triangleList.push(new la(i.array[e],i.array[e+1],i.array[e+2]))}else for(let e=0;e<t.nodes.length;e+=3)t.triangleList.push(new la(e,e+1,e+2));return t}applayMatrix4(e){this.nodeList.forEach((t=>t.applayMatrix4(e))),this.normalList.forEach((t=>t.applayMatrix4(e)))}bndBox(){const e=new ta;return this.nodeList.forEach((t=>e.expandByPoint(t.xyz))),e}expandSharedPoint(){const e=new Array,t=new Array;this.triangles.forEach((i=>{const n=t.length;e.push(new la(n,n+1,n+2)),t.push(this.nodes[i.node1],this.nodes[i.node2],this.nodes[i.node3])})),this.nodes=t,this.triangles=e}}class ua extends ha{edge;//! 半边所引用的边
reversed;//! 是否与引用边反向
constructor(e,t){super(e,t),this.edge=e.parent?.parent?.findEdge(t.edge),this.reversed=t.reversed}shapeType(){return Gr.HALFEDGE}isGeom(){return!1}getAllEdges(){return[this.edge]}getAllVertices(){return this.edge.getAllVertices()}}class ga extends ha{halfEdges=[];//! 环所包含的半边
isOut;//! 是否为外环
constructor(e,t){super(e,t),this.isOut=t.isOut,t.halfEdges.forEach((e=>{this.halfEdges.push(new ua(this,e))}))}shapeType(){return Gr.LOOP}isGeom(){return!1}getAllEdges(){const e=[];return this.halfEdges.forEach((t=>e.push(t.edge))),e}getAllVertices(){const e=[];return this.getAllEdges().forEach((t=>{e.find((e=>e===t.start))||e.push(t.start),e.find((e=>e===t.end))||e.push(t.end)})),e}}class fa extends ha{geomType;//! 几何面类型
triangulation;//! 用于显示的面片集合
loops=[];//! 限定Face的环第一个始终为外环
constructor(e,t){super(t,e),this.geomType=e.type,this.triangulation=new ca,e.nodes.forEach((e=>{this.triangulation.nodeList.push(new aa(e[0],e[1],e[2]))})),e.normals.forEach((e=>{this.triangulation.normalList.push(new pa(e[0],e[1],e[2]))})),e.indices.forEach((e=>{this.triangulation.triangleList.push(new la(e[0],e[1],e[2]))})),e.loops&&e.loops.forEach((e=>{this.loops.push(new ga(this,e))}))}hasInnerLoop(){return this.loops.length>1}isGeom(){return!0}getAllFaces(){return[this]}getAllEdges(){const e=[];return this.loops.forEach((t=>{e.push(...t.getAllEdges())})),e}getAllVertices(){const e=[];return this.loops.forEach((t=>{e.push(...t.getAllVertices())})),e}shapeType(){return Gr.FACE}}class ma extends ha{point;//! 点坐标数据
wrappedBody=null;//! 所属的body
constructor(e,t=null){super(t,e),this.point=new aa(e.coord[0],e.coord[1],e.coord[2])}isGeom(){return!0}shapeType(){return Gr.VERTEX}getAllVertices(){return[this]}body(){return this.wrappedBody?this.wrappedBody:super.body()}setBody(e){this.wrappedBody=e}}class wa extends ha{faces=[];//! BRep面集合
edges=[];//! 边集合
vertices=[];//! 顶点集合
wrappedBody=null;//! 所属的body
constructor(e,t=null){super(t,e),e.vertices?.forEach((e=>{this.vertices.push(new ma(e,this))})),e.edges?.forEach((e=>{this.edges.push(new da(e,this))})),e.faces?.forEach((e=>{this.faces.push(new fa(e,this))}))}findVertex(e){const t=ha.findBRep(e,this.vertices);if(t)return t}findEdge(e){const t=ha.findBRep(e,this.edges);if(t)return t}findFace(e){const t=ha.findBRep(e,this.faces);if(t)return t}shapeType(){return Gr.SHELL}isGeom(){return!1}getAllFaces(){return[...this.faces]}getAllEdges(){return[...this.edges]}getAllVertices(){return[...this.vertices]}body(){return this.wrappedBody?this.wrappedBody:super.body()}setBody(e){this.wrappedBody=e}}class va extends ha{shells=[];//! 壳数组
wrappedBody=null;//! 所属的body
constructor(e){super(null,e),e.shells.forEach((e=>{this.shells.push(new wa(e,this))}))}shapeType(){return Gr.SOLID}isGeom(){return!1}findVertex(e){for(const t of this.shells){const i=t.findVertex(e);if(i)return i}}findEdge(e){for(const t of this.shells){const i=t.findEdge(e);if(i)return i}}findFace(e){for(const t of this.shells){const i=t.findFace(e);if(i)return i}}getAllFaces(){const e=[];return this.shells.forEach((t=>e.push(...t.getAllFaces()))),e}getAllEdges(){const e=[];return this.shells.forEach((t=>e.push(...t.getAllEdges()))),e}getAllVertices(){const e=[];return this.shells.forEach((t=>e.push(...t.getAllVertices()))),e}body(){return this.wrappedBody?this.wrappedBody:super.body()}setBody(e){this.wrappedBody=e}}class xa extends ha{edges=[];//! 边集合
vertices=[];//! 顶点集合
wrappedBody=null;//! 所属的body
constructor(e){super(null,e),void 0!==e&&(e.vertices.forEach((e=>{this.vertices.push(new ma(e,this))})),e.edges.forEach((e=>{this.edges.push(new da(e,this))})))}findVertex(e){const t=ha.findBRep(e,this.vertices);if(t)return t}findEdge(e){const t=ha.findBRep(e,this.edges);if(t)return t}isGeom(){return!1}shapeType(){return Gr.WIRE}getAllEdges(){return[...this.edges]}getAllVertices(){return[...this.vertices]}body(){return this.wrappedBody?this.wrappedBody:super.body()}setBody(e){this.wrappedBody=e}}class ya{toSolid(){throw new Error("Method not implemented.")}toShell(){throw new Error("Method not implemented.")}toWire(){throw new Error("Method not implemented.")}toAcorn(){throw new Error("Method not implemented.")}toCompound(){throw new Error("Method not implemented.")}findVertex(e){}findEdge(e){}findFace(e){}findWire(e){}findShell(e){}findSolid(e){}findBRepObject(e){return this.findFace(e)??this.findSolid(e)??this.findVertex(e)??this.findEdge(e)??this.findWire(e)??this.findShell(e)}static calcuBox(e){const t=e.shapeType();if(t===Gr.EDGE)return e.polygon.bndBox();if(t===Gr.FACE)return e.triangulation.bndBox();if(t===Gr.VERTEX){const t=e.point.xyz;return new ta(t,t)}if(t===Gr.WIRE){const t=e,i=new ta;return t.edges.forEach((e=>i.union(this.calcuBox(e)))),i}if(t===Gr.SHELL){const t=e,i=new ta;return t.faces.forEach((e=>i.union(this.calcuBox(e)))),i}if(t===Gr.SOLID){const t=e,i=new ta;return t.shells.forEach((e=>i.union(this.calcuBox(e)))),i}return new ta}}class Ma extends ya{solid;//! brep实体对象
constructor(e){super(),this.solid=e,e.setBody(this)}bodyType(){return Hr.BT_SolidBody}toSolid(){return this}findVertex(e){return this.solid.findVertex(e)}findEdge(e){return this.solid.findEdge(e)}findFace(e){return this.solid.findFace(e)}findSolid(e){return e===this.solid.name()?this.solid:void 0}bndBox(){return ya.calcuBox(this.solid)}}class ba extends ya{shell;//! brep壳对象
constructor(e){super(),this.shell=e,e.setBody(this)}bodyType(){return Hr.BT_ShellBody}toShell(){return this}findVertex(e){return this.shell.findVertex(e)}findEdge(e){return this.shell.findEdge(e)}findFace(e){return this.shell.findFace(e)}findShell(e){return e===this.shell.name()?this.shell:void 0}bndBox(){return ya.calcuBox(this.shell)}}class Ea extends ya{wire;//! brep wire对象
constructor(e){super(),this.wire=e,e.setBody(this)}toWire(){return this}bodyType(){return Hr.BT_WireBody}findVertex(e){return this.wire.findVertex(e)}findEdge(e){return this.wire.findEdge(e)}findWire(e){return e===this.wire.name()?this.wire:void 0}bndBox(){return ya.calcuBox(this.wire)}}class Sa extends ya{point;//! BRep 点对象
constructor(e){super(),this.point=e,e.setBody(this)}bodyType(){return Hr.BT_AcornBody}toAcorn(){return this}findVertex(e){return e===this.point.name()?this.point:void 0}bndBox(){return ya.calcuBox(this.point)}}class Ta extends ya{solids=[];//! 实体对象数组
shells=[];//! 壳对象数组
wires=[];//! 线框对象数组
acorns=[];//! 顶点数组
bodyType(){return Hr.BT_CompoundBody}toCompound(){return this}addSubShape(e){switch(e.type){case Gr.SOLID:{const t=new va(e);return this.solids.push(t),t.setBody(this),!0}case Gr.WIRE:{const t=new xa(e);return this.wires.push(t),t.setBody(this),!0}case Gr.SHELL:{const t=new wa(e);return this.shells.push(t),t.setBody(this),!0}case Gr.VERTEX:{const t=new ma(e);return this.acorns.push(t),t.setBody(this),!0}default:return!1}}findVertex(e){for(const t of this.solids){const i=t.findVertex(e);if(i)return i}for(const t of this.shells){const i=t.findVertex(e);if(i)return i}for(const t of this.wires){const i=t.findVertex(e);if(i)return i}for(const t of this.acorns)if(t.name()===e)return t}findEdge(e){for(const t of this.solids){const i=t.findEdge(e);if(i)return i}for(const t of this.shells){const i=t.findEdge(e);if(i)return i}for(const t of this.wires){const i=t.findEdge(e);if(i)return i}}findFace(e){for(const t of this.solids){const i=t.findFace(e);if(i)return i}for(const t of this.shells){const i=t.findFace(e);if(i)return i}}findSolid(e){for(const t of this.solids)if(t.name()===e)return t}findShell(e){for(const t of this.shells)if(t.name()===e)return t}findWire(e){for(const t of this.wires)if(t.name()===e)return t}bndBox(){const e=new ta;return this.solids.forEach((t=>e.union(ya.calcuBox(t)))),this.shells.forEach((t=>e.union(ya.calcuBox(t)))),this.wires.forEach((t=>e.union(ya.calcuBox(t)))),this.acorns.forEach((t=>e.union(ya.calcuBox(t)))),e}}const Ca=e=>{switch(e.type){case Gr.SOLID:return new Ma(new va(e));case Gr.WIRE:return new Ea(new xa(e));case Gr.SHELL:return new ba(new wa(e));case Gr.VERTEX:return new Sa(new ma(e));case Gr.COMPOUND:{const t=new Ta,i=e=>{if(e.type===Gr.COMPOUND){const{subShapes:t}=e;t.forEach((e=>{i(e)}))}else t.addSubShape(e)};return i(e),t}default:return null}};class _a{subAssemblies=[];bodies=[];props;name(){return this.props?.name}static fromCompound(e){if(e.subShapes.length<=0)return null;const t=new _a,{subShapes:i}=e;return i.forEach((e=>{if(e.type===Gr.COMPOUND){const i=this.fromCompound(e);i&&t.subAssemblies.push(i)}else{const i=Ca(e);i&&t.bodies.push(i)}})),e.props&&(t.props={name:e.props.name}),t}}class Ra{pos=new Jr(0,0,0);zDir=new Jr(0,0,1);xDir=new Jr(1,0,0);constructor(e,t,i){e&&this.pos.set(e.x,e.y,e.z),t&&this.zDir.set(t.x,t.y,t.z),i&&this.xDir.set(i.x,i.y,i.z),(t||i)&&this.normalize()}get yDir(){return this.zDir.clone().cross(this.xDir)}normalize(){this.zDir.normalize();const e=(e,t)=>{const i=e.angleTo(t);return i<1e-4||Math.abs(i-Math.PI)<1e-4};let t;t=e(this.zDir,this.xDir)?e(this.zDir,new Jr(1,0,0))?this.zDir.clone().cross(new Jr(0,1,0)):this.zDir.clone().cross(new Jr(1,0,0)):this.zDir.clone().cross(this.xDir),t=t.cross(this.zDir),this.xDir.set(t.x,t.y,t.z),this.xDir.normalize()}toMatrix4(){const e=new ia,t=new Jr(0,0,1),i=new Jr(1,0,0),n=this.zDir.angleTo(t);if(n>1e-4){const s=t.clone().cross(this.zDir).normalize();Math.abs(n-Math.PI)<1e-4&&s.set(i.x,i.y,i.z),e.premultiply((new ia).makeRotationAxis(s,n)),i.applyMatrix4(e)}const s=this.xDir.angleTo(i);if(s>1e-4){const t=i.clone().cross(this.xDir).normalize();Math.abs(s-Math.PI)<1e-4&&t.set(this.zDir.x,this.zDir.y,this.zDir.z),e.premultiply((new ia).makeRotationAxis(t,s))}return this.pos.length()>1e-4&&e.premultiply((new ia).makeTranslation(this.pos.x,this.pos.y,this.pos.z)),e}}var Aa,Pa,Oa,La,Da,za,Ia,Ba,Fa,Na,Ua,Ga,Ha,ka,ja,Va,Wa;!function(e){e[e.Line=0]="Line",e[e.Circle=1]="Circle",e[e.Ellipse=2]="Ellipse",e[e.Parabola=3]="Parabola",e[e.Hyperbola=4]="Hyperbola",e[e.OffsetCurve=5]="OffsetCurve",e[e.BezierCurve=6]="BezierCurve",e[e.BSplineCurve=7]="BSplineCurve",e[e.Other=8]="Other"}(Aa||(Aa={}));class Ka{Aabb;Shape;ParentNode;LeftNode;RightNode;constructor(e,t,i,n,s){this.Aabb=e,this.Shape=t,this.ParentNode=i,this.LeftNode=n,this.RightNode=s}get IsLeaf(){return void 0===this.LeftNode}}class Ya{rootNode;shapeToNodeMap;constructor(){this.shapeToNodeMap=new Map}addShape(e){const t=e.getAABB();if(void 0===this.rootNode)return this.rootNode=new Ka(t,e,void 0,void 0,void 0),void this.shapeToNodeMap.set(e,this.rootNode);let i=this.rootNo
static zeroTol=1e-7;//! 等于0的误差判断
static floatEqual(e,t){return Math.abs(e-t)<this.zeroTol}static cone(e,t,i,n){if(e<0||t<0||i<=0)return console.log("Param is valid!"),null;if(Math.abs(e)<$a.zeroTol&&Math.abs(t)<$a.zeroTol)return console.log("Param is valid!"),null;const s=new ca,a=Math.floor(2*Math.PI/$a.angleTol),o=2*Math.PI/a,h=[],d=[];for(let n=0;n<a;n+=1){const s=n*o,a=Math.sin(s),p=Math.cos(s),l=new r(i,t-e).normalize();h.push(new aa(p,a,0)),d.push(new pa(l.x*p,l.x*a,l.y))}let p=0;if(e>$a.zeroTol){s.nodeList.push(new aa(0,0,0)),s.normalList.push(new pa(0,0,-1)),p+=1;for(let t=0;t<a;t+=1)s.nodeList.push(new aa(e*h[t].x(),e*h[t].y(),0)),s.normalList.push(new pa(0,0,-1)),s.triangleList.push(new la(p-1,t===a-1?p:p+t+1,p+t));p+=a}for(let n=0;n<a;n+=1){s.nodeList.push(new aa(e*h[n].x(),e*h[n].y(),0)),s.nodeList.push(new aa(t*h[n].x(),t*h[n].y(),i)),s.normalList.push(new pa(d[n].x(),d[n].y(),d[n].z())),s.normalList.push(new pa(d[n].x(),d[n].y(),d[n].z()));const r=p+2*n,o=p+2*n+1,l=n===a-1?p:p+2*n+2,c=n===a-1?p+1:p+2*n+3;e>1e-4&&s.triangleList.push(new la(o,r,l)),t>1e-4&&s.triangleList.push(new la(l,c,o))}if(p+=2*a,t>1e-4){s.nodeList.push(new aa(0,0,i)),s.normalList.push(new pa(0,0,1)),p+=1;for(let e=0;e<a;e+=1)s.nodeList.push(new aa(t*h[e].x(),t*h[e].y(),i)),s.normalList.push(new pa(0,0,1)),s.triangleList.push(new la(p-1,p+e,e===a-1?p:p+e+1));p+=a}if(n){const e=n.toMatrix4();s.applayMatrix4(e)}return s}static arrow(e,t,i,n,s){const r=this.cone(e,e,t,s);if(!r)return null;let o;if(s){const e=s.pos.clone().add(s.zDir.clone().multiplyScalar(t));o=new Ra(e,s.zDir)}else o=new Ra(new a(0,0,t));const h=this.cone(i,0,n,o);if(!h)return null;const d=r.nodeList.length;return h.nodeList.forEach((e=>r.nodeList.push(e))),h.normalList.forEach((e=>r.normalList.push(e))),h.triangleList.forEach((e=>{r.triangleList.push(new la(d+e.node1,d+e.node2,d+e.node3))})),r}static cutPlaneByBox(e,t){const i=-t.zDir.dot(t.pos),n=new re(t.zDir,i);if(!n.intersectsBox(e))return null;const{min:s}=e,{max:r}=e,o=[s,new a(r.x,s.y,s.z),new a(r.x,r.y,s.z),new a(s.x,r.y,s.z),new a(s.x,s.y,r.z),new a(r.x,s.y,r.z),r,new a(s.x,r.y,r.z)],h=[0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7],d=[];for(let e=0;e<h.length;e+=2){const t=new Ie(o[h[e]],o[h[e+1]]),i=new a,s=n.intersectLine(t,i);s&&void 0===d.find((e=>e.distanceTo(s)<1e-4))&&d.push(s)}if(d.length<3)return null;const p=d[0].clone();for(let e=1;e<d.length;e+=1)p.add(d[e]);p.multiplyScalar(1/d.length);const l=[0],c=d[0].clone().sub(p).normalize();for(let e=1;e<d.length;e+=1){const t=d[e].clone().sub(p).normalize(),i=c.angleTo(t);c.clone().cross(t).dot(n.normal)>0?l.push(i):l.push(-i)}const u=new Qa(d),g=[];for(let e=0;e<l.length;e+=1){const t=l[e];let i=0;for(;i<g.length;i+=1){if(t<l[g[i]])break}g.splice(i,0,e)}g.push(g[0]),u.lines.push({indices:g,isSegment:!1});const f=[];for(let e=2;e<g.length-1;e+=1)f.push(new la(g[0],g[e-1],g[e]));return u.surfs.push({triangles:f}),u}static box(e,t,i){const n=t.clone().sub(e);if(n.x<this.zeroTol||n.y<this.zeroTol||n.z<this.zeroTol)return null;const s=new Be(n.x,n.y,n.z);s.translate((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2);const r=ca.createFromBufferGeometry(s);if(!r)return null;i&&r.applayMatrix4(i.toMatrix4());const a=[];r.nodeList.forEach((e=>{a.push(e.xyz.clone())}));const o=new Qa(a);for(let e=0;e<r.triangleList.length;e+=2)o.surfs.push({triangles:[r.triangleList[e],r.triangleList[e+1]]});const h=!0;return o.lines.push({indices:[0,1],isSegment:h},{indices:[0,2],isSegment:h},{indices:[2,3],isSegment:h},{indices:[3,1],isSegment:h},{indices:[4,5],isSegment:h},{indices:[4,6],isSegment:h},{indices:[6,7],isSegment:h},{indices:[7,5],isSegment:h},{indices:[0,5],isSegment:h},{indices:[1,4],isSegment:h},{indices:[2,7],isSegment:h},{indices:[3,6],isSegment:h}),o}static sphere(e,t,i,n=32){if(e<this.zeroTol)throw new Error("Radius cannot be zero");const s=new Ee(e,n,n);s.translate(...t.toArray());const r=ca.createFromBufferGeometry(s);if(!r)throw new Error("Make Triangulation from SphereGeometry(BufferGeometry) failed");return i&&r.applayMatrix4(i.toMatrix4()),r}static computeArcNodes(e,t,i,n,s,r=1,o=!0){let h=n;for(;h<i
nodes=[];//! 网格单元节点列表
faces=[];//! 网格面数据
edges=[];//! 网格边数据
constructor(e,t){this.id=e,this.nodes.push(...t),this.initEdgesAndFaces()}setNodes(e){this.nodes.splice(0,this.nodes.length),this.edges.splice(0,this.edges.length),this.faces.splice(0,this.faces.length),this.nodes.push(...e),this.initEdgesAndFaces()}}class eo extends Ja{type(){return Oa.Hexahedron_8}initEdgesAndFaces(){if(this.nodes.length<8)throw Error("Invalid mesh node length!");this.edges.push({node1:this.nodes[0],node2:this.nodes[1]}),this.edges.push({node1:this.nodes[1],node2:this.nodes[2]}),this.edges.push({node1:this.nodes[2],node2:this.nodes[3]}),this.edges.push({node1:this.nodes[3],node2:this.nodes[0]}),this.edges.push({node1:this.nodes[0],node2:this.nodes[4]}),this.edges.push({node1:this.nodes[1],node2:this.nodes[5]}),this.edges.push({node1:this.nodes[2],node2:this.nodes[6]}),this.edges.push({node1:this.nodes[3],node2:this.nodes[7]}),this.edges.push({node1:this.nodes[4],node2:this.nodes[5]}),this.edges.push({node1:this.nodes[5],node2:this.nodes[6]}),this.edges.push({node1:this.nodes[6],node2:this.nodes[7]}),this.edges.push({node1:this.nodes[7],node2:this.nodes[4]}),this.faces.push({nodes:[this.nodes[0],this.nodes[3],this.nodes[2],this.nodes[1]],triangles:[new la(0,1,2),new la(2,3,0)]}),this.faces.push({nodes:[this.nodes[0],this.nodes[1],this.nodes[5],this.nodes[4]],triangles:[new la(0,1,2),new la(2,3,0)]}),this.faces.push({nodes:[this.nodes[1],this.nodes[2],this.nodes[6],this.nodes[5]],triangles:[new la(0,1,2),new la(2,3,0)]}),this.faces.push({nodes:[this.nodes[2],this.nodes[3],this.nodes[7],this.nodes[6]],triangles:[new la(0,1,2),new la(2,3,0)]}),this.faces.push({nodes:[this.nodes[3],this.nodes[0],this.nodes[4],this.nodes[7]],triangles:[new la(0,1,2),new la(2,3,0)]}),this.faces.push({nodes:[this.nodes[4],this.nodes[5],this.nodes[6],this.nodes[7]],triangles:[new la(0,1,2),new la(2,3,0)]})}copy(){return new eo(this.id,this.nodes)}}class to extends Ja{type(){return Oa.Quadrangle_4}initEdgesAndFaces(){if(this.nodes.length<4)throw Error("Invalid mesh node length!");this.edges.push({node1:this.nodes[0],node2:this.nodes[1]}),this.edges.push({node1:this.nodes[1],node2:this.nodes[2]}),this.edges.push({node1:this.nodes[2],node2:this.nodes[3]}),this.edges.push({node1:this.nodes[3],node2:this.nodes[0]}),this.faces.push({nodes:this.nodes,triangles:[new la(0,1,2),new la(2,3,0)]})}copy(){return new to(this.id,this.nodes)}}class io extends Ja{type(){return Oa.Tetrahedron_4}initEdgesAndFaces(){if(this.nodes.length<4)throw Error("Invalid mesh node length!");this.edges.push({node1:this.nodes[0],node2:this.nodes[1]}),this.edges.push({node1:this.nodes[1],node2:this.nodes[2]}),this.edges.push({node1:this.nodes[2],node2:this.nodes[0]}),this.edges.push({node1:this.nodes[0],node2:this.nodes[3]}),this.edges.push({node1:this.nodes[1],node2:this.nodes[3]}),this.edges.push({node1:this.nodes[2],node2:this.nodes[3]}),this.faces.push({nodes:[this.nodes[0],this.nodes[2],this.nodes[1]],triangles:[new la(0,1,2)]}),this.faces.push({nodes:[this.nodes[0],this.nodes[1],this.nodes[3]],triangles:[new la(0,1,2)]}),this.faces.push({nodes:[this.nodes[1],this.nodes[2],this.nodes[3]],triangles:[new la(0,1,2)]}),this.faces.push({nodes:[this.nodes[2],this.nodes[0],this.nodes[3]],triangles:[new la(0,1,2)]})}copy(){return new io(this.id,this.nodes)}}class no extends Ja{type(){return Oa.Triangle_3}initEdgesAndFaces(){if(this.nodes.length<3)throw Error("Invalid mesh node length!");this.edges.push({node1:this.nodes[0],node2:this.nodes[1]}),this.edges.push({node1:this.nodes[1],node2:this.nodes[2]}),this.edges.push({node1:this.nodes[2],node2:this.nodes[0]}),this.faces.push({nodes:this.nodes,triangles:[new la(0,1,2)]})}copy(){return new no(this.id,this.nodes)}}class so extends Ja{type(){return Oa.Line_2}initEdgesAndFaces(){if(this.nodes.length<2)throw Error("Invalid mesh node length!");this.edges.push({node1:this.nodes[0],node2:this.nodes[1]})}copy(){return new so(this.id,this.nodes)}}class ro extends eo{type(){return Oa.Hexahedron_20_Order2}copy(){return new ro(this.id,this.nodes)}}class ao extends eo{type(){return Oa.Hexahedron_27_Order2}copy(){return new ao(th
elements=new Map;//! 网格单元数组
props=[];//! 属性数据
constructor(e,t){e.forEach((e=>{this.nodes.set(e.id,e)})),t.forEach((e=>{this.elements.set(e.id,e)}))}getNodesFromFace(e,t){const i=this.getMeshFacesFromFace(t,e,void 0),n=new Set,s=[],r=e=>{!n.has(e)&&this.nodes.has(e)&&(s.push(this.nodes.get(e)),n.add(e))};return i.forEach((e=>{e.nodes.forEach((e=>r(e)))})),s}getMeshFaces(e,t){return this.getMeshFacesFromFace(t,void 0,e)}getMeshFacesFromFace(e,t,i){const n=new co(uo),s=new co(go);this.elements.forEach((e=>{e.faces.forEach((e=>{let t=!0;if(e.nodes.forEach((e=>{this.nodes.has(e)||(t=!1)})),!t)return;s.has(e)||s.set(e,new lo(uo));const i=s.get(e);for(let t=0;t<e.nodes.length;t+=1){const s={node1:e.nodes[t],node2:e.nodes[t+1<e.nodes.length?t+1:0]};i.add(s),n.has(s)||n.set(s,new lo(go)),n.get(s).add(e)}}))}));let r=null;if(i&&(r=i),t)for(const e of n.getKeys()){const i=n.get(e);if(void 0!==i&&0!==i.size&&(e.node1===t.id||e.node2===t.id)){r=i.firstKey();break}}if(null===r)return[];const a=new co(go),o=e=>{const t=a.get(e);if(t)return t;const i=[];if(e.nodes.forEach((e=>{const t=this.nodes.get(e);t&&i.push(t)})),i.length<3)return null;const n=new Jr(i[1].coord[0]-i[0].coord[0],i[1].coord[1]-i[0].coord[1],i[1].coord[2]-i[0].coord[2]).normalize(),s=new Jr(i[2].coord[0]-i[1].coord[0],i[2].coord[1]-i[1].coord[1],i[2].coord[2]-i[1].coord[2]).normalize(),r=n.cross(s).normalize();return a.set(e,r),r},h=new co(uo),d=new lo(uo),p=new lo(go);for(p.add(r),s.get(r)?.getKeys().forEach((e=>h.set(e,r)));h.size>0;){const t=h.firstKey(),i=h.firstValue();if(void 0===t||void 0===i)break;h.remove(t),d.add(t);const r=n.get(t)?.getKeys();if(void 0===r||0===r.length)continue;const a=go(i),l=o(i);if(null!==l)for(const t of r){if(go(t)===a)continue;const i=o(t);if(null!==i&&i.angleTo(l)<e){p.add(t);const e=s.get(t);e&&e.getKeys().forEach((e=>{h.has(e)?(h.remove(e),d.add(e)):d.has(e)||h.set(e,t)}))}}}return p.getKeys()}getMeshEdgesByFeat(e,t){const i=this.getEdgeBorders();if(!i.has(t))return[t];const n=[t];let s=this.nodes.get(t.node1),r=this.nodes.get(t.node2);const a=t=>{const a=()=>{t?s=void 0:r=void 0},o=t?s:r;if(void 0===o)return;const h=i.getKeys().find((e=>e.node1===o.id||e.node2===o.id));if(void 0===h)return void a();const d=t?n[0]:n[n.length-1],p=this.nodes.get(d.node1===o.id?d.node2:d.node1),l=this.nodes.get(h.node1===o.id?h.node2:h.node1);if(void 0===p||void 0===l)return void a();const c=new Jr(p.coord[0],p.coord[1],p.coord[2]),u=new Jr(o.coord[0],o.coord[1],o.coord[2]),g=new Jr(l.coord[0],l.coord[1],l.coord[2]).sub(u),f=u.sub(c);g.angleTo(f)<e?(t?(s=l,n.unshift(h)):(r=l,n.push(h)),i.remove(h)):a()};for(i.remove(t);void 0!==s;)a(!0);for(;void 0!==r;)a(!1);return n}getEdgeBorders(){const e=new co(uo);return this.elements.forEach((t=>{t.edges.forEach((i=>{e.has(i)?e.remove(i):e.set(i,t.id)}))})),e}static createFromData(e){const t=[],i=[];e.nodes.forEach((e=>{t.push({id:e[0],coord:[e[1],e[2],e[3]]})}));const n=new Map;return e.faces?.forEach((e=>{n.set(e[0],e.slice(1))})),e.elements.forEach((t=>{const s=e.faces?Oa.FaceBasedEle:t[0];if(s===Oa.Triangle_3)i.push(new no(t[1],t.slice(2)));else if(s===Oa.Quadrangle_4)i.push(new to(t[1],t.slice(2)));else if(s===Oa.Tetrahedron_4)i.push(new io(t[1],t.slice(2)));else if(s===Oa.Hexahedron_8)i.push(new eo(t[1],t.slice(2)));else if(s===Oa.Plane_Polygon)i.push(new ho(t[1],t.slice(2)));else if(s===Oa.Tetrahedron_10_Order2)i.push(new oo(t[1],t.slice(2)));else if(s===Oa.Hexahedron_20_Order2)i.push(new ro(t[1],t.slice(2)));else if(s===Oa.Hexahedron_27_Order2)i.push(new ao(t[1],t.slice(2)));else if(s===Oa.Line_2)i.push(new so(t[1],t.slice(2)));else if(s===Oa.FaceBasedEle){const e=new po(t[0],[]);t.slice(1).forEach((t=>{const i=n.get(t);i&&e.addFace(i)})),i.push(e)}})),new fo(t,i)}attachProperty(e,t,i,n){if(""===e)return!1;if(void 0!==this.props.find((t=>t.name===e)))return!1;const s=e=>{let t=0;return e.forEach((e=>{t+=e*e})),Math.sqrt(t)},r=new Map,a={min:n.slice(1,t+1),max:n.slice(1,t+1)};if(t>1){const e=s(a.min);a.min.push(e),a.max.push(e)}for(let e=0;e<n.length;e+=t+1){const i=n.slice(e+1,e+t+1);t>1&&i.push(s(i));for(let e=0;e<i.length;e+=1)i[e]<a.min[e]&&(
constructor(e){this.wrappedGroup=e,e.eles.push(this)}isGeomEle(){return!1}isAnnotation(){return!1}unHilight(){this.hilight(this.wrappedGroup.config)}hilightOwner(e,t){}unHilightOwner(e){}get group(){return this.wrappedGroup}}class xo{wrappedOwner=null;//! 所关联的对象
wrappedEle;//! 所属的渲染元素
wrappedStartIndex=-1;//! 在attribute中起始下标
wrappedLength=0;//! 在attribute中的长度
constructor(e){this.wrappedEle=e}get owner(){return this.wrappedOwner}set owner(e){this.wrappedOwner=e}get element(){return this.wrappedEle}get start(){return this.wrappedStartIndex}set start(e){this.wrappedStartIndex=e}get length(){return this.wrappedLength}set length(e){this.wrappedLength=e}}class yo extends vo{items=[];//! element组成单元列表
wrappedShapes=null;//! 底层显示元素对象
constructor(e){super(e)}isGeomEle(){return!0}transform(e){this.shapes&&(this.shapes.matrix=e)}removeByOwner(e,t,i){this.shapes?.startBatchConfigUpdate();return[...this.items].forEach((e=>{e.owner?.owner===t&&this.removeItem(e,i)})),this.shapes?.finishBatchConfigUpdate(),!0}isEmpty(){return 0===this.items.length}get visible(){return!!this.shapes&&this.shapes.visible}set visible(e){this.shapes&&(this.shapes.visible=e)}get shapes(){return this.wrappedShapes}set shapes(e){this.wrappedShapes=e}getRenderItem(e){return this.items.find((t=>t.owner?.owner===e))}remove(e){return!!this.shapes&&(e.remove(this.shapes),!0)}createItem(e,t,i){const n=new xo(this);return n.owner=e,n.start=t,n.length=i,this.items.push(n),n}displayItem(e,t,i=!1){if(!this.shapes)return!1;if(i)this.shapes.updateConfig(t.start,t.length,e);else{const i=this.wrappedGroup.config.customCfgs.get(t);this.shapes.updateConfig(t.start,t.length,i||e)}return!0}displayAllItems(e,t=!1){this.wrappedShapes?.startBatchConfigUpdate(),this.items.forEach((i=>{this.displayItem(e,i,t)})),this.wrappedShapes?.finishBatchConfigUpdate()}removeItem(e,t=!1){if(!this.shapes)return!1;const i=this.items.indexOf(e);return!(i<0)&&(this.shapes.updateConfig(e.start,e.length,void 0),t&&this.items.splice(i,1),!0)}removeAllItems(e=!1){if(!this.shapes)return!1;let t=!0;return this.wrappedShapes?.startBatchConfigUpdate(),this.items.forEach((i=>{this.removeItem(i,e)||(t=!1)})),this.wrappedShapes?.finishBatchConfigUpdate(),t}get group(){return this.wrappedGroup}}class Mo extends yo{display(e,t){return!!this.shapes&&(e.add(this.shapes,t.clippingMethod),this.displayAllItems(t.lineConfig),!0)}posAttr(){if(!this.shapes)throw Error("Null shape data!");return this.shapes.position}type(){return Da.LineSegments}fillData(e,t,i){this.shapes=i?new fr(lr.Segment,e,t,...i):new fr(lr.Segment,e,t)}copyData(e){const i=new Mo(e);return i.shapes=new fr(lr.Segment,this.shapes.position,this.shapes.index),this.shapes.matrix.equals(new t)||i.transform(this.shapes.matrix),i}isSameGeom(e){return e.type()===Da.LineSegments&&this.shapes.position===e.shapes.position}hilight(e){this.displayAllItems(e.lineConfig,!0)}unHilight(){this.displayAllItems(this.group.config.lineConfig,!1)}hilightOwner(e,t){const i=this.items.find((e=>e.owner?.owner===t));i&&this.displayItem(e.lineConfig,i,!0)}unHilightOwner(e){const t=this.items.find((t=>t.owner?.owner===e));t&&this.displayItem(this.group.config.lineConfig,t,!1)}}class bo extends yo{display(e,t){return!!this.shapes&&(e.add(this.shapes,t.clippingMethod),e.setClippingColor(this.shapes,t.clippingColor),this.displayAllItems(t.triConfig),!0)}posAttr(){if(!this.shapes)throw Error("Null shape data!");return this.shapes.position}type(){return Da.Mesh}fillData(e,t,i,n){this.shapes=n?new zr(e,t,i,...n):new zr(e,t,i)}copyData(e){const i=new bo(e),n=this.shapes;return i.shapes=new zr(n.position,n.normal,n.index),n.matrix.equals(new t)||(i.shapes.matrix=n.matrix),i}isSameGeom(e){return e.type()===Da.Mesh&&this.shapes.position===e.shapes.position}hilight(e){this.displayAllItems(e.triConfig,!0)}unHilight(){this.displayAllItems(this.group.config.triConfig,!1)}hilightOwner(e,t){const i=this.items.find((e=>e.owner?.owner===t));i&&this.displayItem(e.triConfig,i)}unHilightOwner(e){const t=this.items.find((t=>t.owner?.owner===e));t&&this.displayItem(this.group.config.triConfig,t,!1)}}class Eo extends yo{display(e,t){return!!this.shapes&&(e.add(this.shapes,t.clippingMethod),this.displayAllItems(t.pntConfig),!0)}posAttr(){if(!this.shapes)throw Error("Null shape data!");return this.shapes.position}type(){return Da.Points}fillData(e,t){this.shapes=new Pr(e,t)}copyData(e){const i=new Eo(e);return i.shapes=new Pr(this.shapes.position,this.shapes.index),this.shapes.matrix.equals(new t)||i.transform(this.shapes.matrix),i}isSameGeom(e){return e.type()===Da.Points&&this.shapes.position===e.shapes.position}hilight(e){this.displayAllItems(e.pntConfig,!0)}unHilight(){this.displayAllItems(this.group.config.pntConfig,!1)}hilightOwner(e,t){const i=this.items.find((e=>e.owner?.owner===t));i&&this.displayItem(e.pntConfig,i
object;//! 所属的拾取对象
owner;//! owner对象
enable=!0;//! enable or not
constructor(e,t,i){this.selectMode=e,this.owner=t,this.object=i}}function To(e){switch(e){case Gr.VERTEX:return za.SM_BRepVertex;case Gr.EDGE:return za.SM_BRepEdge;case Gr.FACE:return za.SM_BRepFace;case Gr.WIRE:return za.SM_BRepWire;case Gr.SHELL:return za.SM_BRepShell;case Gr.SOLID:return za.SM_BRepSolid;default:return-1}}!function(e){e[e.SM_None=0]="SM_None",e[e.SM_BRepVertex=1]="SM_BRepVertex",e[e.SM_BRepEdge=2]="SM_BRepEdge",e[e.SM_BRepFace=3]="SM_BRepFace",e[e.SM_BRepWire=4]="SM_BRepWire",e[e.SM_BRepShell=5]="SM_BRepShell",e[e.SM_BRepSolid=6]="SM_BRepSolid",e[e.SM_BRepCompound=7]="SM_BRepCompound",e[e.SM_MeshNode=8]="SM_MeshNode",e[e.SM_MeshEdge=9]="SM_MeshEdge",e[e.SM_MeshFace=10]="SM_MeshFace",e[e.SM_MeshElement=11]="SM_MeshElement"}(za||(za={})),function(e){e[e.ESM_Undefined=0]="ESM_Undefined",e[e.ESM_MeshSurfNodes=1]="ESM_MeshSurfNodes",e[e.ESM_MeshAllNodes=2]="ESM_MeshAllNodes",e[e.ESM_MeshSurfFaces=3]="ESM_MeshSurfFaces",e[e.ESM_MeshAllFaces=4]="ESM_MeshAllFaces",e[e.ESM_MeshCurveEdges=5]="ESM_MeshCurveEdges"}(Ia||(Ia={})),function(e){e[e.SET_Single=0]="SET_Single",e[e.SET_Group=1]="SET_Group"}(Ba||(Ba={}));class Co extends So{subElements=[];//! 子对象
isSelected(e){for(const t of this.subElements)if(t.isSelected(e))return!0;return!1}getSelRender(e,t){for(const i of this.subElements)if(!i.getSelRender(e,t))return!1;return!0}type(){return Ba.SET_Group}getRelatedRenders(){const e=[];return this.subElements.forEach((t=>{e.push(...t.getRelatedRenders())})),e}hilight(e){return this.subElements.forEach((t=>{t.hilight(e)})),!0}unHiligth(){return this.subElements.forEach((e=>{e.unHiligth()})),!0}}class _o extends So{target;//! 目标显示对象
constructor(e,t,i){super(t,e.owner,i),this.target=e}isSelected(e){const t=e;if(t.shape!==this.target.element.shapes)return!1;const i=this.target.element.shapes===t.shape,n=t.index>=this.target.start&&t.index<this.target.start+this.target.length;return!(!i||!n)}getSelRender(e,t){let i=e.eles.find((e=>!!e.isGeomEle()&&e.isSameGeom(this.target.element)));i||(i=this.target.element.copyData(e));const n=new wo(t,La.OT_SelectOwner);return i.createItem(n,this.target.start,this.target.length),!0}type(){return Ba.SET_Single}getRelatedRenders(){return[this.target.element]}hilight(e){return this.target.element.hilightOwner(e,this.owner.owner),!0}unHiligth(){return this.target.element.unHilightOwner(this.owner.owner),!0}}!function(e){e[e.WireFrame=0]="WireFrame",e[e.Shaded=1]="Shaded",e[e.WireShaded=2]="WireShaded"}(Fa||(Fa={}));class Ro{wrappedTriConfig;//! mesh config
wrappedLineConfig;//! line config
wrappedPntConfig;//! point config
clippingMethod=Fr.Seal;clippingColor=new g(65535);customCfgs=new Map;//! 自定义的对象显示配置
textCfg;line2DCfg;constructor(){this.wrappedTriConfig=new Br({color:new g(16711680),style:cr.Regular,side:ge}),this.wrappedLineConfig=new xr({color:new g(65280),config:new Tr(1),style:cr.Regular}),this.wrappedPntConfig=new Lr({color:new g(255),shape:Rr.Ball,style:cr.Regular,size:1}),this.textCfg=new sr({color:new g(0,0,1),font:"Microsoft YaHei",size:20,alignment:Hs.BottomMiddle}),this.line2DCfg=new $s({color:new g(0),width:2,arrow:{length:20,width:5}})}get lineConfig(){return this.wrappedLineConfig}get pntConfig(){return this.wrappedPntConfig}get triConfig(){return this.wrappedTriConfig}get textConfig(){return this.textCfg}}class Ao{eles=[];//! 组内的渲染元素
config;//! group的渲染设置
wrappedObject;//! group所属的object
constructor(e=null){this.wrappedObject=e,this.config=new Ro}get visible(){return 0!==this.eles.length&&this.eles[0].visible}set visible(e){this.eles.forEach((t=>{t.visible=e}))}transform(e){this.eles.forEach((t=>{t.transform(e)}))}getRenderItem(e){for(const t of this.eles)if(t.isGeomEle()){const i=t.getRenderItem(e);if(i)return i}}display(e){let t=!1;return this.eles.forEach((i=>{const n=i.display(e,this.config);n&&(t=n)})),t}remove(e,t=!1){let i=!0;return this.eles.forEach((t=>{t.remove(e)||(i=!1)})),t&&this.clearData(),i}removeElement(e,t,i=!1){return!!t.remove(e)&&(i&&this.clearElement(t),!0)}removeByOwner(e,t,i=!1){[...this.eles].forEach((n=>{n.removeByOwner(e,t,i),i&&n.isEmpty()&&this.clearElement(n)}))}clearData(){this.eles.splice(0,this.eles.length)}clearElement(e){const t=this.eles.indexOf(e);t>=0&&this.eles.splice(t,1)}hilight(e){this.eles.forEach((t=>{t.hilight(e)}))}unHilight(){this.eles.forEach((e=>{e.unHilight()}))}}!function(e){e[e.Redisplay=0]="Redisplay",e[e.ViewModeChanged=1]="ViewModeChanged",e[e.Update=2]="Update"}(Na||(Na={}));class Po{updateEvent=new dt;wrappedGroup;//! 每个显示模式所对应的渲染对象
wrappedBox=new ta;//! 边界包围盒
wrappedVisible=!0;constructor(){this.wrappedGroup=new Ao(this)}get visible(){return this.wrappedVisible}set visible(e){this.wrappedVisible!==e&&(this.wrappedVisible=e,this.wrappedGroup.visible=e)}setFaceColor(e){this.wrappedGroup.config.triConfig.color=new g(e),this.setClippingColor(e)}setLineColor(e){this.wrappedGroup.config.lineConfig.color=new g(e)}setLineWidth(e){this.wrappedGroup.config.lineConfig.config.lineWidth=e}setPntColor(e){this.wrappedGroup.config.pntConfig.color=new g(e)}setPntSize(e){this.wrappedGroup.config.pntConfig.size=e}setPntShape(e){this.wrappedGroup.config.pntConfig.shape=e}setClippingColor(e){this.wrappedGroup.config.clippingColor=new g(e)}transform(e){this.wrappedGroup.transform(e)}get boundingBox(){return this.wrappedBox}updateBox(){this.wrappedBox=new ta,this.group.eles.forEach((e=>{if(e.isGeomEle()){const t=new ta;t.setFromBufferAttribute(e.posAttr()),this.boundingBox.union(t)}}))}setAllTransparent(e){this.wrappedGroup.config.triConfig.opacity=e,this.wrappedGroup.config.customCfgs.forEach((t=>{const i=t;i.opacity&&(i.opacity=e,e<.95&&(i.side=K))})),e<.95&&(this.wrappedGroup.config.triConfig.side=K)}setTransparent(e){this.wrappedGroup.config.triConfig.opacity=e,e<.95&&(this.wrappedGroup.config.triConfig.side=K)}setItemCustomCfg(e,t){this.wrappedGroup.config.customCfgs.set(e,t),e.element.displayItem(t,e)}unSetItemCustomCfg(e){let t=null;const i=e.element.type();i===Da.Points?t=this.group.config.pntConfig:i===Da.LineSegments?t=this.group.config.lineConfig:i===Da.Mesh&&(t=this.group.config.triConfig),t&&(this.wrappedGroup.config.customCfgs.delete(e),e.element.displayItem(t,e))}unSetAllCustomCfg(){this.group.config.customCfgs.forEach(((e,t)=>{let i=null;const n=t.element.type();n===Da.Points?i=this.group.config.pntConfig:n===Da.LineSegments?i=this.group.config.lineConfig:n===Da.Mesh&&(i=this.group.config.triConfig),i&&t.element.displayItem(i,t)})),this.group.config.customCfgs=new Map}get group(){return this.wrappedGroup}}class Oo extends Po{wrappedSelections;//! 每个显示模式所对应的拾取对象
wrappedActiveModes;//! 使能的拾取模式
constructor(){super(),this.wrappedSelections=new Map,this.wrappedActiveModes=[]}getSelects(e){if(!this.wrappedSelections.has(e)&&!this.computeSelects(e))throw Error("Unsupport view mode!");return this.wrappedSelections.get(e)||new Array}get activeModes(){return this.wrappedActiveModes}set activeModes(e){this.wrappedActiveModes=e}}class Lo extends Oo{isBind=!1;//! 是否绑定到View内部使用
wrappedViewMode=null;display(e,t){if(this.wrappedGroup.clearData(),!this.computeRenders(t))return!1;this.updateBox();const i=this.wrappedGroup.display(e);return!1===this.visible&&(this.wrappedVisible=!0,this.visible=!1),i}remove(e){return this.wrappedGroup.remove(e)}onViewModeChanged(e,t){this.wrappedGroup.remove(e,!0),this.display(e,t)}get viewMode(){return this.wrappedViewMode}set viewMode(e){this.wrappedViewMode!==e&&this.updateEvent.trigger({type:Na.ViewModeChanged,arg:{object:this,mode:e}}),this.wrappedViewMode=e}clearData(){this.group.clearData(),this.wrappedSelections.clear()}}!function(e){e[e.Invalid=0]="Invalid",e[e.BRepType=1]="BRepType",e[e.CellMeshType=2]="CellMeshType",e[e.NodeMeshType=3]="NodeMeshType",e[e.VectorGraphType=4]="VectorGraphType",e[e.StreamLineType=5]="StreamLineType",e[e.TriangulationType=6]="TriangulationType",e[e.PlaneType=7]="PlaneType",e[e.PolyGeomType=8]="PolyGeomType",e[e.DatumPointType=9]="DatumPointType",e[e.DatumAxisType=10]="DatumAxisType",e[e.LengthDim3DType=11]="LengthDim3DType",e[e.AnnoPlaneType=12]="AnnoPlaneType",e[e.AnnoLabelType=13]="AnnoLabelType",e[e.CustomType=1e3]="CustomType"}(Ua||(Ua={}));class Do extends Lo{wrappedBody;//! BRep对象
wrappedRenders=new Map;//! 显示对象枚举
constructor(e){super(),this.body=e,this.setFaceColor(12632256),this.setLineColor(0),this.setPntColor(0),this.wrappedGroup.config.lineConfig.polygonOffset=-1,this.wrappedGroup.config.pntConfig.polygonOffset=-2,this.wrappedGroup.config.triConfig.side=K}type(){return Ua.BRepType}computeSelects(e){if(this.wrappedSelections.has(e))return!0;const t=[],i=e=>e===za.SM_BRepEdge?this.wrappedRenders.get("edges"):e===za.SM_BRepFace?this.wrappedRenders.get("faces"):e===za.SM_BRepVertex?this.wrappedRenders.get("vertices"):void 0,n=(e,t,n)=>{e.forEach((e=>{const s=i(t)?.getRenderItem(e);if(!s)throw Error("Can't find render item of brep object!");const r=new _o(s,t,this);n.push(r)}))},s=(i,s)=>{const r=[];e!==Fa.Shaded&&e!==Fa.WireShaded||n(i.faces,za.SM_BRepFace,r),e!==Fa.WireFrame&&e!==Fa.WireShaded||(n(i.edges,za.SM_BRepEdge,r),n(i.vertices,za.SM_BRepVertex,r)),s.push(...r);const a=new wo(i,La.OT_BRepOwner),o=new Co(za.SM_BRepShell,a,this);return o.subElements.push(...r),t.push(o),s.push(o),o},r=(e,t)=>{const i=[];e.shells.forEach((e=>{const n=s(e,t);i.push(n)}));const n=new wo(e,La.OT_BRepOwner),r=new Co(za.SM_BRepSolid,n,this);return r.subElements.push(...i),t.push(r),r},a=(e,i)=>{const s=[];n(e.edges,za.SM_BRepEdge,s),n(e.vertices,za.SM_BRepVertex,s),i.push(...s);const r=new wo(e,La.OT_BRepOwner),a=new Co(za.SM_BRepWire,r,this);return a.subElements.push(...s),t.push(a),a},o=e=>{const i=[];e.solids.forEach((e=>{i.push(r(e,t))})),e.shells.forEach((e=>{i.push(s(e,t))})),e.wires.forEach((e=>{i.push(a(e,t))}));const o=[];n(e.acorns,za.SM_BRepVertex,o),i.push(...o),t.push(...o);const h=new wo(e,La.OT_Custom),d=new Co(za.SM_BRepWire,h,this);d.subElements.push(...i),t.push(d)};switch(this.body.bodyType()){case Hr.BT_SolidBody:p=this.body.toSolid(),r(p.solid,t);break;case Hr.BT_ShellBody:d=this.body.toShell(),s(d.shell,t);break;case Hr.BT_WireBody:h=this.body.toWire(),a(h.wire,t);break;case Hr.BT_AcornBody:(e=>{const i=[e.point];n(i,za.SM_BRepVertex,t)})(this.body.toAcorn());break;case Hr.BT_CompoundBody:o(this.body.toCompound());break;default:throw Error("Not supported body type!")}var h,d,p;return this.wrappedSelections.set(e,t),!0}computeRenders(e){const t=this.wrappedGroup,i=(e,t)=>{if(0===e.length)return;if(this.wrappedRenders.has("faces"))return void t.eles.push(this.wrappedRenders.get("faces"));const i=new bo(t);let n=0;const s=[],r=[],a=[];e.forEach((e=>{const t=e.triangulation;a.push(...ca.toArray(t.triangleList,s.length/3)),s.push(...ra.toArray(t.nodeList)),r.push(...ra.toArray(t.normalList));const{length:o}=t.triangleList,h=new wo(e,La.OT_BRepOwner);i.createItem(h,n,o),n+=o})),i.fillData(s,r,a),this.wrappedRenders.set("faces",i)},n=(e,t)=>{if(0===e.length)return;if(this.wrappedRenders.has("edges"))return void t.eles.push(this.wrappedRenders.get("edges"));const i=new Mo(t);let n=0;const s=[],r=[];e.forEach((e=>{const t=e.polygon,a=oa.createIndex(t.nodeList.length,s.length/3);s.push(...ra.toArray(t.nodeList)),r.push(...a);const o=a.length/2,h=new wo(e,La.OT_BRepOwner);i.createItem(h,n,o),n+=o})),i.fillData(s,r),this.wrappedRenders.set("edges",i)},s=(e,t)=>{if(0===e.length)return;if(this.wrappedRenders.has("vertices"))return void t.eles.push(this.wrappedRenders.get("vertices"));const i=new Eo(t),n=[],s=[];e.forEach((e=>{n.push(e.point.x(),e.point.y(),e.point.z());const{length:t}=s;s.push(t);const r=new wo(e,La.OT_BRepOwner);i.createItem(r,t,1)})),i.fillData(n,s),this.wrappedRenders.set("vertices",i)};switch(this.body.bodyType()){case Hr.BT_SolidBody:((e,t,r)=>{const a=[],o=[],h=[];e.solid.shells.forEach((e=>{a.push(...e.faces),o.push(...e.edges),h.push(...e.vertices)})),t!==Fa.Shaded&&t!==Fa.WireShaded||i(a,r),t!==Fa.WireFrame&&t!==Fa.WireShaded||(n(o,r),s(h,r))})(this.body.toSolid(),e,t);break;case Hr.BT_ShellBody:r=this.body.toShell(),o=t,(a=e)!==Fa.Shaded&&a!==Fa.WireShaded||i(r.shell.faces,o),a!==Fa.WireFrame&&a!==Fa.WireShaded||(n(r.shell.edges,o),s(r.shell.vertices,o));break;case Hr.BT_WireBody:((e,t,i)=>{n(e.wire.edges,i),s(e.wire.vertices,i)})(this.body.toWire(),0,t);break;case Hr.BT_AcornBody:((e,t,i)=>{const n=[e.point];
wrappedMesh;//! 网格对象
wrappedMeshBak=null;//! 备份网格对象(当使用2d->3d功能时此项用于备份原网格对象)
wrappedRenders=new Map;//! 显示对象数组
wrappedCurProp="";//! 当前使能属性
wrappedDeformFactor=1;//! 变形因子
wrappedDeformOn=!1;//! 变形开始与否
wrappedDeformAttr="";//! 变形属性名
wrappedSolidColor=new g(12632256);wrappedLineColor=new g(0);wrappedNodeItemMap=new Map;//! node和item映射
wrappedFaceItemMap=new Map;//! face和item映射
wrappedEdgeItemMap=new Map;//! edge和item映射
wrappedShowNode=!1;wrappedLineContour=!1;constructor(e){super(),this.wrappedMesh=e,this.setLineColor(0),this.setPntColor(0),this.wrappedGroup.config.lineConfig.polygonOffset=-1,this.wrappedGroup.config.pntConfig.polygonOffset=-2,this.wrappedGroup.config.pntConfig.size=5,this.wrappedGroup.config.triConfig.side=K,this.updateProperty()}unbindLegend=e=>{this.legend&&this.legend.updateEvent.remove(this.onLegendUpdateCB),e===this.legend&&(this.wrappedLegend=null)};useLegend=!0;onLegendUpdateCB=e=>{e?.type!==Ga.Range&&e?.type!==Ga.Colors&&e?.type!==Ga.Type||this.updateProperty()};bindLegend=e=>{this.wrappedLegend=e,this.legend&&(this.legend.updateEvent.add(this.onLegendUpdateCB),this.updateProperty())};setNodesColor(e,t){const i=[];if(e.forEach((e=>{const t=this.mesh.nodes.get(e);if(t){const e=this.wrappedNodeItemMap.get(t);e&&i.push(e)}})),i.length>0){const e=new Lr(this.group.config.pntConfig);e.color=new ea(t),i[0].element.shapes?.startBatchConfigUpdate(),i.forEach((t=>{this.setItemCustomCfg(t,e)})),i[0].element.shapes?.finishBatchConfigUpdate()}}type(){return Ua.NodeMeshType}computeSelects(e){if(this.wrappedSelections.has(e))return!0;const t=[],i=new Set,n=new Set,s=new Set,r=r=>{const a=new wo(r,La.OT_MeshElement),o=new Co(za.SM_MeshElement,a,this);t.push(o),e!==Fa.WireFrame&&e!==Fa.WireShaded||(r.nodes.forEach((e=>{if(i.has(e))return;i.add(e);const n=this.wrappedMesh.nodes.get(e);if(void 0===n)return;const s=this.wrappedNodeItemMap.get(n);if(void 0===s)return;const r=new _o(s,za.SM_MeshNode,this);t.push(r),o.subElements.push(r)})),r.edges.forEach((e=>{const i=(e=>e.node1>e.node2?`${e.node2.toFixed(0)}-${e.node1.toFixed(0)}`:`${e.node1.toFixed(0)}-${e.node2.toFixed(0)}`)(e);if(n.has(i))return;n.add(i);const s=this.wrappedEdgeItemMap.get(e);if(!s)return;const r=new _o(s,za.SM_MeshEdge,this);t.push(r),o.subElements.push(r)}))),e!==Fa.Shaded&&e!==Fa.WireShaded||r.faces.forEach((e=>{const i=(e=>{const t=e.nodes.map((e=>e));t.sort(((e,t)=>e-t));let i="";return t.forEach((e=>{i+=`-${e.toFixed(0)}`})),i})(e);if(s.has(i))return;s.add(i);const n=this.wrappedFaceItemMap.get(e);if(!n)return;const r=new _o(n,za.SM_MeshFace,this);t.push(r),o.subElements.push(r)})),t.push(o)};return this.wrappedMesh.elements.forEach((e=>{r(e)})),this.wrappedSelections.set(e,t),!0}computeRenders(e){const t=new Map;//! 节点id和pos属性index映射key为节点idvalue为属性index
let i=null;const s=this.mesh.getProperty(this.wrappedDeformAttr),r=e=>{const t=[0,0,0];if(this.wrappedDeformOn&&s){const i=s.data.get(e);i&&(t[0]=i[0]*this.wrappedDeformFactor,s.size>1&&(t[1]=i[1]*this.wrappedDeformFactor),s.size>2&&(t[2]=i[2]*this.wrappedDeformFactor))}return t},a=()=>{if(i)return;const e=[];let s=0;this.wrappedMesh.nodes.forEach((i=>{const n=r(i.id);e.push(i.coord[0]+n[0],i.coord[1]+n[1],i.coord[2]+n[2]),t.set(i.id,s),s+=1})),i=new n(e,3)},o=()=>{if(this.wrappedRenders.has("nodes"))return void this.wrappedGroup.eles.push(this.wrappedRenders.get("nodes"));a();const e=new Eo(this.wrappedGroup),t=[];let n=0;this.wrappedMesh.nodes.forEach((i=>{t.push(n);const s=new wo(i,La.OT_MeshNode),r=e.createItem(s,n,1);this.wrappedNodeItemMap.set(i,r),n+=1})),e.fillData(i,t),this.wrappedRenders.set("nodes",e)},h=()=>{if(this.wrappedRenders.has("edges"))return void this.wrappedGroup.eles.push(this.wrappedRenders.get("edges"));a();const e=new Mo(this.wrappedGroup),n=[];let s=0;this.wrappedMesh.elements.forEach((i=>{i.edges.forEach((i=>{const r=t.get(i.node1),a=t.get(i.node2);if(void 0!==r&&void 0!==a){n.push(r,a);const t=new wo(i,La.OT_MeshEdge),o=e.createItem(t,s,1);this.wrappedEdgeItemMap.set(i,o),s+=1}}))})),e.fillData(i,n),this.wrappedRenders.set("edges",e)},d=()=>{if(this.wrappedRenders.has("faces"))return void this.wrappedGroup.eles.push(this.wrappedRenders.get("faces"));const e=[];if(this.wrappedMesh.elements.forEach((t=>{t.faces.forEach((t=>{e.push(t)}))})),0===e.length)return;const t=new bo(this.wrappedGroup),i=[],n=[];let s=0;e.forEach((e=>{const a=[];for(const t of e.nodes){const e=this.wrappedMesh.nodes.get(t);if(void 0===e)return;a.push(e)}const o=[];a.forEach((e=>{o.push(i.length/3);const t=r(e.id);i.push(e.coord[0]+t[0],e.coord[1]+t[1],e.coord[2]+t[2])})),e.triangles.forEach((e=>{n.push(o[e.node1],o[e.node2],o[e.node3])}));const h=new wo(e,La.OT_MeshFace),d=t.createItem(h,s,e.triangles.length);this.wrappedFaceItemMap.set(e,d),s+=e.triangles.length})),t.fillData(i,[],n),this.wrappedRenders.set("faces",t)};if(e!==Fa.Shaded&&e!==Fa.WireShaded||d(),e!==Fa.WireFrame&&e!==Fa.WireShaded||(h(),o(),this.updateNodeVisible()),""!==this.wrappedCurProp){const e=this.wrappedCurProp.slice(0,this.wrappedCurProp.lastIndexOf("-")),t=Number(this.wrappedCurProp.slice(this.wrappedCurProp.lastIndexOf("-")+1));this.attachProperty(e,t)}return!0}attachProperty(e,t){const i=this.wrappedMesh.getProperty(e);if(void 0===i)return!1;if(t>0&&t>i.size)return!1;const s=new Map;if(i.forNode)i.data.forEach(((e,i)=>{s.set(i,e[t])}));else{const e=new Map;i.data.forEach(((i,n)=>{this.wrappedMesh.elements.get(n)?.nodes.forEach((n=>{e.has(n)||e.set(n,[]),e.get(n)?.push(i[t])}))})),e.forEach(((e,t)=>{let i=0;e.forEach((e=>{i+=e}));const n=i/e.length;s.set(t,n)}))}const r=[];this.wrappedMesh.elements.forEach((e=>{e.faces.forEach((e=>{const t=[];for(const i of e.nodes){if(void 0===this.wrappedMesh.nodes.get(i))return;const e=s.get(i);if(void 0===e)throw Error(`Node prop is not exist! id: ${i}`);t.push(e)}r.push(...t)}))})),r.forEach((e=>{}));const a=[];this.wrappedMesh.nodes.forEach((e=>{const t=s.get(e.id);if(void 0===t)throw Error(`Node prop is not exist! id: ${e}`);a.push(t)}));const o=new n(r,1),h=new n(a,1),d=`${e}-${t}`;if(this.wrappedRenders.has("faces")){const e=this.wrappedRenders.get("faces").shapes;e&&(e.customAttributes.clear(),e.customAttributes.set(d,o))}if(this.wrappedRenders.has("edges")){const e=this.wrappedRenders.get("edges").shapes;e&&(e.customAttributes.clear(),e.customAttributes.set(d,h))}return!0}activeProperty(e,t=0){const i=`${e}-${t}`;if(this.wrappedCurProp===i)return!0;if(""===e)this.wrappedCurProp="";else if(this.wrappedCurProp=i,!this.attachProperty(e,t))return!1;return this.updateProperty(),!0}setFaceColor(e){this.wrappedSolidColor=new g(e),this.setClippingColor(e),this.updateProperty()}setLineColor(e){this.wrappedLineColor=new g(e),this.updateProperty()}updateProperty(){if(""===this.wrappedCurProp)this.group.config.triConfig.color=new dr(Wt.Fragment_Color_Map,[this.wrappedSolidColor],this.wrappedCurProp,pr.Liner,0,0)
wrappedSelInfos=[];//! 拾取信息数组
wrappedEngine=null;//! 底层显示引擎
wrappedShapeSelMap=new Map;//! shape和拾取元素的映射
wrappedHitInfos=new Map;//! 记录hit信息
loadSelectObj(e,t){if(!this.engine)return!1;return e.getSelects(t).forEach((e=>{if(!e.enable)return;e.getRelatedRenders().forEach((t=>{if(!t.isGeomEle())return;const i=t.shapes;this.wrappedShapeSelMap.has(i)||this.wrappedShapeSelMap.set(i,new Set),this.wrappedShapeSelMap.get(i)?.add(e)}))})),this.engine.selectableShapes=Array.from(this.wrappedShapeSelMap.keys()),!0}removeSelectObj(e,t){return!!this.engine&&(e.group.eles.forEach((e=>{if(e.isGeomEle()){const t=e.shapes;if(!this.wrappedShapeSelMap.get(t))return;this.wrappedShapeSelMap.delete(t)}})),this.engine.selectableShapes=Array.from(this.wrappedShapeSelMap.keys()),!0)}select(e){return!!this.engine&&(this.wrappedSelInfos=e,!0)}boxSelect(e,t){return!0}getSelectEles(){const e=[];return this.wrappedHitInfos.clear(),this.infos.forEach((t=>{const i=t;i.shape&&this.wrappedShapeSelMap.get(i.shape)?.forEach((i=>{if(!i.enable)return;let n;this.filters.forEach((e=>{e.func(i)?void 0===n&&(n=!0):e.force&&(n=!1)})),n&&i.isSelected(t)&&(e.push(i),this.wrappedHitInfos.set(i,t))}))})),e}getHitInfo(e){return this.wrappedHitInfos.get(e)}get selTol(){return this.engine?this.engine.selectTol:1}set selTol(e){this.engine&&(this.engine.selectTol=e)}get infos(){return this.wrappedSelInfos}get engine(){return this.wrappedEngine}set engine(e){this.wrappedEngine=e}}class ko{legend=new zo;legendPanel=new as;constructor(){this.legendPanel.addLegend(this.legend)}bindObject(e){e.useLegend&&e.bindLegend(this.legend)}unbindObject(e){e.useLegend&&e.unbindLegend(this.legend)}}class jo extends vo{owner=null;isAnnotation(){return!0}}class Vo extends jo{wrappedText=null;constructor(e,t,i=null){super(t),this.createText(e,i||t.config.textCfg)}get text(){return this.wrappedText?this.wrappedText.text:""}set text(e){this.wrappedText&&(this.wrappedText.text=e)}createText(e,t){"3D"===t.type?this.wrappedText=new rr(t,e,new Jr(1,1,1),new Jr(1,1,0),new Jr(0,1,1)):"2D"===t.type&&(this.wrappedText=new er(t,e,new Jr,0))}get anchorPnt(){return this.wrappedText?.anchorPoint}set anchorPnt(e){this.wrappedText&&(this.wrappedText.anchorPoint=e)}get direction(){if("2D"===this.wrappedText?.type)return this.wrappedText.direction;if("3D"===this.wrappedText?.type)return this.wrappedText.textDirection;throw Error("Unsupported text type!")}set direction(e){if("2D"===this.wrappedText?.type)this.wrappedText.direction=e;else{if("3D"!==this.wrappedText?.type)throw Error("Unsupported text type!");if("number"==typeof e)throw Error("Direction must be an vector for 3D text!");this.wrappedText.textDirection=e}}get facing(){return"3D"===this.wrappedText?.type?this.wrappedText.facingDirection:new Jr}set facing(e){"3D"===this.wrappedText?.type&&(this.wrappedText.facingDirection=e)}get visible(){return!0}set visible(e){console.log(e)}transform(e){if(this.wrappedText){const t=this.wrappedText.anchorPoint.applyMatrix4(e);this.wrappedText.anchorPoint=t}}type(){return Da.Text}display(e,t){return!!this.wrappedText&&(this.wrappedText.config=t.textCfg,e.addText(this.wrappedText),!0)}remove(e){return this.wrappedText&&e.removeText(this.wrappedText),!0}removeByOwner(e,t,i){return this.owner===t&&(this.remove(e),i&&(this.wrappedText=null),!0)}isEmpty(){return null===this.wrappedText}copyData(e){return new Vo(this.text,e)}hilight(e){this.wrappedText&&(this.wrappedText.config.color=e.textCfg.color,this.wrappedText.config.size=e.textCfg.size)}}!function(e){e[e.AddSelect=0]="AddSelect",e[e.DelSelect=1]="DelSelect"}(Ha||(Ha={})),function(e){e[e.Top=0]="Top",e[e.Bottom=1]="Bottom",e[e.Front=2]="Front",e[e.Back=3]="Back",e[e.Left=4]="Left",e[e.Right=5]="Right",e[e.TopFrontLeft=6]="TopFrontLeft"}(ka||(ka={})),function(e){e[e.Dynamic=0]="Dynamic",e[e.XAxis=1]="XAxis",e[e.YAxis=2]="YAxis",e[e.ZAxis=3]="ZAxis",e[e.Custom=4]="Custom"}(ja||(ja={})),function(e){e[e.Normal=0]="Normal",e[e.CreateLine=1]="CreateLine"}(Va||(Va={})),function(e){e[e.SelectStart=0]="SelectStart",e[e.SelectEnd=1]="SelectEnd"}(Wa||(Wa={}));class Wo{selectMode=za.SM_BRepFace;//! 拾取模式
selectEvent=new dt;interEvent=new dt;legendMgr=new ko;extendSelMode=Ia.ESM_Undefined;extendSelParam=[];wrappedEngine=void 0;//! render engine
wrappedObjects=[];//! view objects
wrappedViewMode=Fa.WireShaded;//! 显示模式
wrappedSelManager=new Ho;//! 拾取管理器
wrappedSelectGroup;//! 拾取显示节点
wrappedDynSelGroup;//! 高亮显示节点
wrappedDetectedEle=null;//! 检测到的拾取对象
wrappedSelectedEles=[];//! 拾取到的拾取对象
wrappedEnableClipping=!1;wrappedEnableDynSel=!1;wrappedInterMode=Va.Normal;wrappedCLPS=null;//! 两点连线首点
wrappedCLPE=null;//! 两点连线末点
wrappedCLRender=null;//! 两点连线显示数据
get dynSelCfg(){return this.wrappedDynSelGroup.config}get selConfig(){return this.wrappedSelectGroup.config}constructor(){this.wrappedSelectGroup=new Ao,this.wrappedSelectGroup.config.lineConfig.color=new g(16776960),this.wrappedSelectGroup.config.pntConfig.color=new g(16776960),this.wrappedSelectGroup.config.pntConfig.size=10,this.wrappedSelectGroup.config.lineConfig.config.lineWidth=6,this.wrappedSelectGroup.config.triConfig.color=new g(16776960),this.wrappedSelectGroup.config.triConfig.side=K,this.wrappedSelectGroup.config.clippingMethod=Fr.NoSeal,this.wrappedSelectGroup.config.triConfig.polygonOffset=-1,this.wrappedSelectGroup.config.lineConfig.polygonOffset=-2,this.wrappedSelectGroup.config.pntConfig.polygonOffset=-3,this.wrappedDynSelGroup=new Ao,this.wrappedDynSelGroup.config.lineConfig.color=new g(65535),this.wrappedDynSelGroup.config.pntConfig.color=new g(65535),this.wrappedDynSelGroup.config.pntConfig.size=10,this.wrappedDynSelGroup.config.triConfig.color=new g(65535),this.wrappedDynSelGroup.config.triConfig.side=K,this.wrappedDynSelGroup.config.clippingMethod=Fr.NoSeal,this.wrappedDynSelGroup.config.triConfig.polygonOffset=-2,this.wrappedDynSelGroup.config.lineConfig.polygonOffset=-3,this.wrappedDynSelGroup.config.pntConfig.polygonOffset=-4,this.wrappedSelManager.filters.push({func:e=>e.selectMode===this.selectMode||this.selectMode===za.SM_None,force:!1})}bindEngine(e){if(this.wrappedEngine=e,this.wrappedSelManager.engine=e,this.wrappedEngine.enableClipping=this.wrappedEnableClipping,this.wrappedEngine.enableDynSel=this.wrappedEnableDynSel,e.selectionEvent.add((e=>{this.wrappedInterMode===Va.Normal?(e?.type===Ur.MoveOn&&this.detect(e.info),e?.type===Ur.ClickOn&&(e.info?this.select(e.info):this.selectDetected())):this.wrappedInterMode===Va.CreateLine&&(e?.info?this.createLineEvent(e.info[0]):e?.pos2&&this.createLineEvent(e.pos2))})),this.wrappedEngine.engine){const e=new a(-100,-100,-100),t=new a(100,100,100);this.wrappedEngine.engine.userDefinedAdaptRange=new q(e,t)}}get enableClipping(){return this.wrappedEnableClipping}set enableClipping(e){this.wrappedEnableClipping!==e&&(this.wrappedEngine&&(this.wrappedEngine.enableClipping=e),this.wrappedEnableClipping=e)}get enableDynSel(){return this.wrappedEnableDynSel}set enableDynSel(e){this.wrappedEnableDynSel=e,this.wrappedEngine&&(this.wrappedEngine.enableDynSel=e)}set selectTol(e){this.wrappedSelManager.selTol=e}get selectTol(){return this.wrappedSelManager.selTol}fitRange(){const e=this.engine?.engine;e&&(e.userDefinedAdaptRange=e.domainRange)}fitRotCenter(e){const t=this.engine?.engine;if(!t)return;let i;if(e?i=e:(i=new Array,this.wrappedObjects.forEach((e=>{e.visible&&i.push(e)}))),0===i.length)t.rotationCenter=new a(0,0,0);else{const e=new q;i.forEach((t=>{e.union(t.boundingBox)})),t.rotationCenter=e.getCenter(new a)}}fitAll(){this.fitRange(),this.fitRotCenter();const e=[];this.wrappedObjects.forEach((t=>{t.visible&&e.push(t)})),this.fitObjects(e)}fitObjects(e){const t=[];e.forEach((e=>{e.group.eles.forEach((e=>{if(!e.isGeomEle())return;const i=e.shapes?.meshes();if(!i)return;let n=i.next();for(;!n.done;)t.push(n.value),n=i.next()}))})),t.length>0&&this.wrappedEngine?.focus(t)}updateCB=e=>{if(void 0!==e){if(e.type===Na.Redisplay&&this.reDisplay(e.arg),e.type===Na.ViewModeChanged){const t=e.arg;this.updateObjViewMode(t.object,null===t.mode?this.viewMode:t.mode)}if(e.type===Na.Update){const t=e.arg,i=t.viewMode??this.viewMode;this.updateObject(t,i,i)}}};display(e){if(!this.wrappedEngine||this.wrappedObjects.indexOf(e)>=0)return!1;if(e.isBind)throw Error("This object has been displayed on another view!");const t=null!==e.viewMode?e.viewMode:this.viewMode;return!!e.display(this.wrappedEngine,t)&&(this.wrappedSelManager.loadSelectObj(e,t),e.updateEvent.add(this.updateCB),this.legendMgr.bindObject(e),this.wrappedObjects.push(e),e.isBind=!0,!0)}reDisplay(e){return this.remove(e),this.display(e)}remove(e){return!(!this.wrappedEngine||this.wrappedObjects.indexOf(e)<0)&&(!!e.remove(this.wrappedEngine)&&(!!this.wrappedSelManager.removeSelectObj(e,e.viewMode??this.view
wrappedPos=null;//! 位置信息
constructor(e){super(),this.wrappedTriangles=e}get triangulation(){return this.wrappedTriangles}set triangulation(e){this.wrappedTriangles=e,this.updateEvent.trigger({type:Na.Redisplay,arg:this})}type(){return Ua.TriangulationType}computeSelects(e){if(this.wrappedSelections.has(e))return!0;const t=[];if(e===Fa.WireFrame){const e=this.wrappedRenders.get("edges")?.items[0];if(!e)return!1;const i=new _o(e,za.SM_None,this);t.push(i)}if(e===Fa.WireShaded||e===Fa.Shaded){const e=this.wrappedRenders.get("faces")?.items[0];if(!e)return!1;const i=new _o(e,za.SM_None,this);t.push(i)}return this.wrappedSelections.set(e,t),!0}computeRenders(e){if(0===this.triangulation.triangleList.length)return!1;const t=()=>{if(this.wrappedPos)return;const e=[],t=this.triangulation;ra.toArray(t.nodeList).forEach((t=>{e.push(t)})),this.wrappedPos=new n(e,3)},i=()=>{if(this.wrappedRenders.has("faces"))this.group.eles.push(this.wrappedRenders.get("faces"));else{t();const e=new bo(this.group),i=[],n=[],s=this.triangulation;ca.toArray(s.triangleList).forEach((e=>{n.push(e)})),ra.toArray(s.normalList).forEach((e=>{i.push(e)}));const r=new wo(s,La.OT_Triangulation);e.createItem(r,0,s.triangleList.length),e.fillData(this.wrappedPos,i,n),this.wrappedRenders.set("faces",e)}},s=()=>{if(this.wrappedRenders.has("edges"))this.group.eles.push(this.wrappedRenders.get("edges"));else{t();const e=new Mo(this.group),i=[],n=this.triangulation;n.triangleList.forEach((e=>{i.push(e.node1,e.node2,e.node2,e.node3,e.node3,e.node1)}));const s=new wo(n,La.OT_Triangulation);e.createItem(s,0,i.length/2),e.fillData(this.wrappedPos,i),this.wrappedRenders.set("edges",e)}};return e!==Fa.Shaded&&e!==Fa.WireShaded||i(),e!==Fa.WireFrame&&e!==Fa.WireShaded||s(),!0}clearData(){super.clearData(),this.wrappedRenders.clear(),this.wrappedPos=null}}class Yo extends Lo{origin=new Jr(0,0,0);normal=new Jr(0,0,1);xdir=new Jr(1,0,0);uMin=-10;uMax=10;vMin=-10;vMax=10;wrappedRenders=new Map;//! 显示对象枚举
wrappedRenderTexts=[];constructor(e,t,i){super(),e&&this.origin.copy(e),t&&this.normal.copy(t),i&&this.xdir.copy(i),this.setTransparent(0),this.setLineColor(11184810),this.setLineWidth(.5),this.setFaceColor(16777215),this.group.config.triConfig.side=K,this.group.config.textConfig.alignment=Hs.TopLeft,this.group.config.textConfig.color=new g(0),this.group.config.textConfig.size=14}type(){return Ua.PlaneType}computeSelects(e){if(this.wrappedSelections.has(e))return!0;const t=[],i=new Co(za.SM_None,new wo(this,La.OT_Custom),this);if(e===Fa.WireFrame||e===Fa.WireShaded){const e=this.wrappedRenders.get("edges")?.items[0];if(!e)return!1;const t=new _o(e,za.SM_None,this);t.enable=!1,i.subElements.push(t)}if(e===Fa.Shaded||e===Fa.WireShaded){const e=this.wrappedRenders.get("faces")?.items[0];if(!e)return!1;const t=new _o(e,za.SM_None,this);t.enable=!1,i.subElements.push(t)}return t.push(i),this.wrappedSelections.set(e,t),!0}computeRenders(e){const t=this.normal.clone().cross(this.xdir).normalize(),i=this.normal.normalize(),n=this.xdir.normalize();if(i.length()<1e-4||n.length()<1e-4||t.length()<1e-4)return console.error("Plane attr is not valid!"),!1;const s=n.clone().multiplyScalar(this.uMin),r=n.clone().multiplyScalar(this.uMax),a=t.clone().multiplyScalar(this.vMin),o=t.clone().multiplyScalar(this.vMax),h=this.origin.clone().add(s).add(a),d=this.origin.clone().add(s).add(o),p=this.origin.clone().add(r).add(o),l=this.origin.clone().add(r).add(a),c=()=>{if(this.wrappedRenders.has("faces"))this.group.eles.push(this.wrappedRenders.get("faces"));else{const e=new bo(this.group),t=[],n=[];[h,d,p,l].forEach((e=>{t.push(e.x,e.y,e.z),n.push(i.x,i.y,i.z)}));const s=[0,1,2,2,3,0],r=new wo(this,La.OT_Custom);e.createItem(r,0,2),e.fillData(t,n,s),this.wrappedRenders.set("faces",e)}},u=()=>{if(this.wrappedRenders.has("edge"))this.group.eles.push(this.wrappedRenders.get("edges"));else{const e=new Mo(this.group),t=[0,1,1,2,2,3,3,0],i=this.wrappedRenders.get("faces"),n=new wo(this,La.OT_Custom);e.createItem(n,0,t.length/2),e.fillData(i.posAttr(),t),this.wrappedRenders.set("edges",e)}};return e!==Fa.Shaded&&e!==Fa.WireShaded||c(),e!==Fa.WireFrame&&e!==Fa.WireShaded||u(),this.wrappedRenderTexts.length>0&&this.wrappedRenderTexts.forEach((e=>this.group.eles.push(e))),!0}appendText(e,t){const i=new Vo(e,this.group);i.anchorPnt=new Jr(t[0],t[1],t[2]),this.wrappedRenderTexts.push(i)}clearData(){super.clearData(),this.wrappedRenders.clear()}}class Xo extends Lo{wrappedLegend=null;//! 绑定的legend
wrappedMesh;//! 网格对象
wrappedRenders=new Map;//! 显示对象数组
wrappedProperties=new Map;//! 属性列表
wrappedCurProp="";//! 当前使能属性
wrappedSolidColor=new g(12632256);wrappedLevelStates=new Map;constructor(e){super(),this.wrappedMesh=e,e.meshes.forEach((e=>this.wrappedLevelStates.set(e.level,!0))),this.setLineColor(0),this.setPntColor(0),this.wrappedGroup.config.lineConfig.polygonOffset=-1,this.wrappedGroup.config.pntConfig.polygonOffset=-2,this.wrappedGroup.config.pntConfig.size=5,this.wrappedGroup.config.triConfig.side=K,this.updateProperty()}onLegendUpdateCB=e=>{e?.type!==Ga.Range&&e?.type!==Ga.Colors&&e?.type!==Ga.Type||this.updateProperty()};unbindLegend=e=>{this.legend&&this.legend.updateEvent.remove(this.onLegendUpdateCB),e===this.legend&&(this.wrappedLegend=null)};useLegend=!0;bindLegend=e=>{this.wrappedLegend=e,this.legend&&(this.legend.updateEvent.add(this.onLegendUpdateCB),this.updateProperty())};type(){return Ua.CellMeshType}computeSelects(e){return!0}computeRenders(e){const t=(t,i)=>{this.wrappedRenders.has(t.level)||this.wrappedRenders.set(t.level,new Map);const s=this.wrappedRenders.get(t.level);let r=null;if(s){const e=s.get("edges");e&&(r=e.posAttr());const t=s.get("faces");t&&(r=t.posAttr())}if(null===r){const e=[];1===i?t.cells.forEach((i=>{const n=t.xCoords[i.i],s=t.xCoords[i.i+1];e.push(n,0,0,s,0,0)})):2===i?t.cells.forEach((i=>{const n=t.xCoords[i.i],s=t.xCoords[i.i+1],r=t.yCoords[i.j],a=t.yCoords[i.j+1];e.push(n,r,0),e.push(s,r,0),e.push(s,a,0),e.push(n,a,0)})):3===i&&t.cells.forEach((i=>{const n=t.xCoords[i.i],s=t.xCoords[i.i+1],r=t.yCoords[i.j],a=t.yCoords[i.j+1],o=t.zCoords[i.k],h=t.zCoords[i.k+1];e.push(n,r,o),e.push(s,r,o),e.push(s,a,o),e.push(n,a,o),e.push(n,r,h),e.push(s,r,h),e.push(s,a,h),e.push(n,a,h),e.push(n,r,o),e.push(s,r,o),e.push(s,r,h),e.push(n,r,h),e.push(n,a,o),e.push(n,a,h),e.push(s,a,h),e.push(s,a,o),e.push(n,r,o),e.push(n,r,h),e.push(n,a,h),e.push(n,a,o),e.push(s,r,o),e.push(s,a,o),e.push(s,a,h),e.push(s,r,h)})),r=new n(e,3)}const a=()=>{if(s&&s.has("edges"))return void this.wrappedGroup.eles.push(s.get("edges"));const e=new Mo(this.wrappedGroup),n=[];let a=0;1===i?t.cells.forEach((t=>{n.push(2*a,2*a+1);const i=new wo(t,La.OT_MeshElement);e.createItem(i,a,1),a+=1})):2===i?t.cells.forEach((t=>{n.push(a,a+1),n.push(a+1,a+2),n.push(a+2,a+3),n.push(a+3,a);const i=new wo(t,La.OT_MeshElement);e.createItem(i,a,4),a+=4})):3===i&&t.cells.forEach((t=>{n.push(2*a,2*a+1),n.push(2*a+1,2*a+2),n.push(2*a+2,2*a+3),n.push(2*a+3,2*a),n.push(2*a+4,2*a+5),n.push(2*a+5,2*a+6),n.push(2*a+6,2*a+7),n.push(2*a+7,2*a+4),n.push(2*a,2*a+4),n.push(2*a+1,2*a+5),n.push(2*a+2,2*a+6),n.push(2*a+3,2*a+7);const i=new wo(t,La.OT_MeshElement);e.createItem(i,a,12),a+=12})),e.fillData(r,n),s&&s.set("edges",e)},o=()=>{if(s&&s.has("faces"))return void this.wrappedGroup.eles.push(s.get("faces"));const e=new bo(this.wrappedGroup),n=[];let a=0;2===i?t.cells.forEach((t=>{n.push(a,a+1,a+2),n.push(a+2,a+3,a);const i=new wo(t,La.OT_MeshElement);e.createItem(i,a,2),a+=2})):3===i&&t.cells.forEach((t=>{n.push(2*a,2*a+1,2*a+2),n.push(2*a+2,2*a+3,2*a),n.push(2*a+4,2*a+5,2*a+6),n.push(2*a+6,2*a+7,2*a+4),n.push(2*a+8,2*a+9,2*a+10),n.push(2*a+10,2*a+11,2*a+8),n.push(2*a+12,2*a+13,2*a+14),n.push(2*a+14,2*a+15,2*a+12),n.push(2*a+16,2*a+17,2*a+18),n.push(2*a+18,2*a+19,2*a+16),n.push(2*a+20,2*a+21,2*a+22),n.push(2*a+22,2*a+23,2*a+20);const i=new wo(t,La.OT_MeshElement);e.createItem(i,a,12),a+=12}));const o=[];if(this.wrappedProperties.has(t.level)){const e=this.wrappedProperties.get(t.level);e&&e.forEach(((e,t)=>{o.push({name:t,attr:e.attr})}))}e.fillData(r,[],n,o),s&&s.set("faces",e)};e!==Fa.WireFrame&&e!==Fa.WireShaded||a(),e!==Fa.Shaded&&e!==Fa.WireShaded||i>1&&o()},i=this.wrappedMesh.dimension;return this.wrappedLevelStates.forEach(((e,n)=>{if(!1===e)return;const s=this.mesh.meshes.find((e=>e.level===n));s&&t(s,i)})),!0}attachProperty(e,t,i){const s=this.wrappedMesh.meshes.find((t=>t.level===e));if(void 0===s)return!1;const r=this.wrappedMesh.dimension;this.wrappedProperties.has(e)||this.wrappedProperties.set(e,new Map);const a=new Map;let o=0;for(;o<i.length;){const e=i[o],t=i[o+1];a.set(e,t),o+=2}const h=[];let d=Number.MAX_VALUE,p=-Number.MAX_VALUE;s.cells.fo
wrappedData;//! 网格对象
wrappedRenders=new Map;//! 显示对象数组
wrappedProperty=null;//! 属性
wrappedUseProp=!1;//! 使能属性
wrappedScaled=!0;//! 使能放缩
wrappedOrigin=0;//! 属性放缩原点
wrappedFactor=5;//! 放缩系数
wrappedSolidColor=new g(12632256);constructor(e){super(),this.wrappedData=e,this.setLineColor(0),this.setPntColor(0),this.wrappedGroup.config.lineConfig.polygonOffset=-1,this.wrappedGroup.config.pntConfig.polygonOffset=-2,this.wrappedGroup.config.pntConfig.size=5,this.wrappedGroup.config.triConfig.side=K,this.updateProperty(),this.arrowCfg={scale:!0,tailLen:1,tailRad:.04,headLen:.3,headRad:.1}}onLegendUpdateCB=e=>{e?.type!==Ga.Range&&e?.type!==Ga.Colors&&e?.type!==Ga.Type||this.updateProperty()};unbindLegend=e=>{this.legend&&this.legend.updateEvent.remove(this.onLegendUpdateCB),e===this.legend&&(this.wrappedLegend=null)};useLegend=!0;bindLegend=e=>{this.wrappedLegend=e,this.legend&&(this.legend.updateEvent.add(this.onLegendUpdateCB),this.updateProperty())};type(){return Ua.VectorGraphType}computeSelects(e){return!0}computeRenders(e){const t=()=>{if(this.wrappedRenders.has("faces"))return void this.wrappedGroup.eles.push(this.wrappedRenders.get("faces"));const e=new bo(this.group),t=[],i=[],s=[],r=[],o=[],h=new q;let d=Number.MAX_VALUE,p=-Number.MAX_VALUE;const l=this.wrappedData.vectors;for(let e=0;e<l.length;e+=6){const t=new a(l[e],l[e+1],l[e+2]),i=new a(l[e+3],l[e+4],l[e+5]),n=i.length()-this.wrappedOrigin;i.normalize(),o.push({pos:t,vec:i,prop:n}),n>p&&(p=n),n<d&&(d=n),h.expandByPoint(t)}const c=h.getSize(new a),u=Math.max(c.x,c.y,c.z),g=Math.max(Math.abs(p),Math.abs(d)),f=u<1e-4?100:u/g;o.forEach((e=>{const n=new Ra(e.pos,e.vec),a=(this.scaled?e.prop:g)*this.wrappedFactor/100*f,o=$a.arrow(a*this.arrowCfg.tailRad,a*this.arrowCfg.tailLen,a*this.arrowCfg.headRad,a*this.arrowCfg.headLen,n);if(!o)return;const h=o;ca.toArray(h.triangleList,t.length/3).forEach((e=>{s.push(e)})),ra.toArray(h.nodeList).forEach((e=>{t.push(e)})),h.nodeList.forEach((()=>r.push(e.prop+this.wrappedOrigin))),ra.toArray(h.normalList).forEach((e=>{i.push(e)}))}));const m=new wo(this,La.OT_Custom);e.createItem(m,0,s.length/3);const w=new n(r,1);e.fillData(t,i,s,[{name:"property",attr:w}]),p+=this.wrappedOrigin,d+=this.wrappedOrigin,this.wrappedProperty={attr:w,max:p,min:d},this.updateProperty(),this.wrappedRenders.set("faces",e)};return e!==Fa.Shaded&&e!==Fa.WireShaded&&e!==Fa.WireFrame||t(),!0}get useProperty(){return this.wrappedUseProp}set useProperty(e){e!==this.useProperty&&(this.wrappedUseProp=e,this.updateProperty())}setFaceColor(e){this.wrappedSolidColor=new g(e),this.setClippingColor(e)}updateProperty(){if(this.useProperty){if(null===this.wrappedProperty)return;const e=this.legend?.range;this.group.config.triConfig.color=new dr(Wt.Fragment_Color_Map,this.legend?this.legend.colors:[this.wrappedSolidColor],"property",this.legend?.type===ss.Nearest?pr.Nearest:pr.Liner,e?e.min:this.wrappedProperty.min,e?e.max:this.wrappedProperty.max),this.group.config.triConfig.color.attributeName="property"}else this.group.config.triConfig.color=new dr(Wt.Fragment_Color_Map,[this.wrappedSolidColor],"",pr.Liner,0,0)}get legend(){return this.wrappedLegend}get data(){return this.wrappedData}get factor(){return this.wrappedFactor}set factor(e){this.wrappedFactor=e,this.updateEvent.trigger({type:Na.Redisplay,arg:this})}get origin(){return this.wrappedOrigin}set origin(e){this.wrappedOrigin=e,this.updateEvent.trigger({type:Na.Redisplay,arg:this})}get scaled(){return this.wrappedScaled}set scaled(e){this.wrappedScaled=e,this.updateEvent.trigger({type:Na.Redisplay,arg:this})}get prop(){return this.wrappedProperty}clearData(){super.clearData(),this.wrappedRenders.clear()}}class Zo extends Lo{wrappedGeom;wrappedRenders=new Map;//! 显示对象枚举
wrappedPos=null;//! 位置信息
wrappedShowTriangles=!1;//! 是否显示平面
wrappedTrianglesCfg=new xr({color:new g(11184810),config:new Tr(1),style:cr.Regular});constructor(e){super(),this.wrappedGeom=e,this.setLineColor(0),this.setLineWidth(3),this.setFaceColor(16777215),this.group.config.triConfig.side=K,this.group.config.textConfig.alignment=Hs.TopLeft,this.group.config.textConfig.color=new g(0),this.group.config.textConfig.size=14,this.group.config.lineConfig.polygonOffset=-1,this.wrappedTrianglesCfg.polygonOffset=-1}setTrianglesLineColor(e){this.wrappedTrianglesCfg.color=new g(e)}setTrianglesLineWidth(e){this.wrappedTrianglesCfg.config.lineWidth=e}type(){return Ua.PolyGeomType}computeSelects(e){if(this.wrappedSelections.has(e))return!0;const t=[];return e===Fa.WireFrame&&this.wrappedRenders.get("edges")?.items?.forEach((e=>{const i=new _o(e,za.SM_None,this);t.push(i)})),e!==Fa.WireShaded&&e!==Fa.Shaded||this.wrappedRenders.get("faces")?.items?.forEach((e=>{const i=new _o(e,za.SM_None,this);t.push(i)})),this.wrappedRenders.get("lines")?.items?.forEach((e=>{const i=new _o(e,za.SM_None,this);t.push(i)})),this.wrappedSelections.set(e,t),!0}computeRenders(e){if(0===this.geom.lines.length&&0===this.geom.surfs.length)return console.error("Poly geometry is not valid!"),!1;const t=()=>{if(this.wrappedPos)return;const e=[];ra.toArrayVec(this.geom.nodes).forEach((t=>{e.push(t)})),this.wrappedPos=new n(e,3)},i=()=>{if(this.wrappedRenders.has("faces"))this.group.eles.push(this.wrappedRenders.get("faces"));else{t();const e=new bo(this.group),i=[],n=[];this.geom.surfs.forEach((t=>{const n=i.length/3;ca.toArray(t.triangles,0).forEach((e=>{i.push(e)}));const s=new wo(t,La.OT_PolyGeometry);e.createItem(s,n,t.triangles.length)})),e.fillData(this.wrappedPos,n,i),this.wrappedRenders.set("faces",e)}},s=()=>{if(this.wrappedRenders.has("edges"))this.group.eles.push(this.wrappedRenders.get("edges"));else{t();const e=new Mo(this.group),i=[];this.geom.surfs.forEach((t=>{const n=i.length/2;t.triangles.forEach((e=>{i.push(e.node1,e.node2,e.node2,e.node3,e.node3,e.node1)}));const s=new wo(t,La.OT_PolyGeometry);e.createItem(s,n,3*t.triangles.length)})),e.fillData(this.wrappedPos,i),this.wrappedRenders.set("edges",e),e.items.forEach((e=>this.group.config.customCfgs.set(e,this.wrappedTrianglesCfg)))}},r=()=>{if(this.wrappedRenders.has("lines"))this.group.eles.push(this.wrappedRenders.get("lines"));else{t();const e=new Mo(this.group),i=[];this.geom.lines.forEach((t=>{const n=i.length/2;Qa.createIndex(t).forEach((e=>i.push(e)));const s=new wo(t,La.OT_PolyGeometry);e.createItem(s,n,i.length/2-n)})),e.fillData(this.wrappedPos,i),this.wrappedRenders.set("lines",e)}};return e!==Fa.Shaded&&e!==Fa.WireShaded||(i(),s()),e!==Fa.WireFrame&&e!==Fa.WireShaded||r(),this.updateVisibility(),!0}updateVisibility(){const e=this.wrappedRenders.get("edges");e&&(e.visible=this.showTriangles)}get geom(){return this.wrappedGeom}set geom(e){this.wrappedGeom=e,this.updateEvent.trigger({type:Na.Redisplay,arg:this})}get showTriangles(){return this.wrappedShowTriangles}set showTriangles(e){e!==this.wrappedShowTriangles&&(this.wrappedShowTriangles=e,this.updateVisibility())}get visible(){return this.wrappedVisible}set visible(e){this.wrappedVisible!==e&&(this.wrappedVisible=e,this.wrappedGroup.visible=e,this.updateVisibility())}clearData(){super.clearData(),this.wrappedRenders.clear(),this.wrappedPos=null}}class Qo extends jo{wrappedLine;constructor(e,t,i,n=!0,s=!0){super(t),this.wrappedLine=new ks(i,e,n,s)}get points(){return this.wrappedLine.points}set points(e){this.wrappedLine.points=e}get headArrow(){return this.wrappedLine.headArrow||!1}set headArrow(e){this.wrappedLine.headArrow=e}get tailArrow(){return this.wrappedLine.tailArrow||!1}set tailArrow(e){this.wrappedLine.tailArrow=e}get visible(){return!0}set visible(e){console.log(e)}get config(){return this.wrappedLine.config}set config(e){this.wrappedLine.config=e}transform(e){const t=[];this.points.forEach((i=>{t.push(new na(i.x,i.y,i.z).applyMatrix4(e))})),this.points=t}type(){return Da.AnnoLine}display(e,t){return e.addLine2D(this.wrappedLine),!0}remove(e){return e.removeLine2D(this.wrappedL
wrappedPos=null;//! 位置信息
wrappedShowTriangles=!1;//! 是否显示平面
wrappedTrianglesCfg=new xr({color:new g(11184810),config:new Tr(1),style:cr.Regular});constructor(e){super(),this.wrappedGeom=e,this.setLineColor(0),this.setLineWidth(3),this.setFaceColor(16777215),this.group.config.triConfig.side=K,this.group.config.textConfig.alignment=Hs.TopLeft,this.group.config.textConfig.color=new g(0),this.group.config.textConfig.size=14,this.group.config.lineConfig.polygonOffset=-1,this.wrappedTrianglesCfg.polygonOffset=-1,this.group.config.line2DCfg.color=new g(16711680),this.group.config.line2DCfg.dashPattern=[20,2,2,2]}setTrianglesLineColor(e){this.wrappedTrianglesCfg.color=new g(e)}setTrianglesLineWidth(e){this.wrappedTrianglesCfg.config.lineWidth=e}type(){return Ua.PolyGeomType}computeSelects(e){if(this.wrappedSelections.has(e))return!0;const t=[];return e===Fa.WireFrame&&this.wrappedRenders.get("edges")?.items?.forEach((e=>{const i=new _o(e,za.SM_None,this);t.push(i)})),e!==Fa.WireShaded&&e!==Fa.Shaded||this.wrappedRenders.get("faces")?.items?.forEach((e=>{const i=new _o(e,za.SM_None,this);t.push(i)})),this.wrappedRenders.get("lines")?.items?.forEach((e=>{const i=new _o(e,za.SM_None,this);t.push(i)})),this.wrappedSelections.set(e,t),!0}computeRenders(e){if(0===this.geom.lines.length&&0===this.geom.surfs.length)return console.error("Poly geometry is not valid!"),!1;const t=()=>{if(this.wrappedPos)return;const e=[];ra.toArrayVec(this.geom.nodes).forEach((t=>{e.push(t)})),this.wrappedPos=new n(e,3)},i=()=>{if(this.wrappedRenders.has("faces"))this.group.eles.push(this.wrappedRenders.get("faces"));else{t();const e=new bo(this.group),i=[],n=[];this.geom.surfs.forEach((t=>{const n=i.length/3;ca.toArray(t.triangles,0).forEach((e=>{i.push(e)}));const s=new wo(t,La.OT_PolyGeometry);e.createItem(s,n,t.triangles.length)})),e.fillData(this.wrappedPos,n,i),this.wrappedRenders.set("faces",e)}},s=()=>{if(this.wrappedRenders.has("edges"))this.group.eles.push(this.wrappedRenders.get("edges"));else{t();const e=new Mo(this.group),i=[];this.geom.surfs.forEach((t=>{const n=i.length/2;t.triangles.forEach((e=>{i.push(e.node1,e.node2,e.node2,e.node3,e.node3,e.node1)}));const s=new wo(t,La.OT_PolyGeometry);e.createItem(s,n,3*t.triangles.length)})),e.fillData(this.wrappedPos,i),this.wrappedRenders.set("edges",e),e.items.forEach((e=>this.group.config.customCfgs.set(e,this.wrappedTrianglesCfg)))}};return e!==Fa.Shaded&&e!==Fa.WireShaded||(i(),s()),(()=>{if(this.wrappedRenders.has("lines"))this.group.eles.push(this.wrappedRenders.get("lines"));else{t();const e=new Mo(this.group),i=[];this.geom.lines.forEach((t=>{const n=i.length/2;Qa.createIndex(t).forEach((e=>i.push(e)));const s=new wo(t,La.OT_PolyGeometry);e.createItem(s,n,i.length/2-n)})),e.fillData(this.wrappedPos,i),this.wrappedRenders.set("lines",e)}})(),(()=>{const e=this.geom.bndBox(),t=e.max.y-e.min.y,i=e.min.y-.2*t,n=e.max.y+.2*t;new Qo([new a(0,i,0),new a(0,n,0)],this.group,this.group.config.line2DCfg,!1,!1).visible=!0})(),this.updateVisibility(),!0}updateVisibility(){const e=this.wrappedRenders.get("edges");e&&(e.visible=this.showTriangles)}get geom(){return this.wrappedGeom}set geom(e){this.wrappedGeom=e,this.updateEvent.trigger({type:Na.Redisplay,arg:this})}get showTriangles(){return this.wrappedShowTriangles}set showTriangles(e){e!==this.wrappedShowTriangles&&(this.wrappedShowTriangles=e,this.updateVisibility())}get visible(){return this.wrappedVisible}set visible(e){this.wrappedVisible!==e&&(this.wrappedVisible=e,this.wrappedGroup.visible=e,this.updateVisibility())}clearData(){super.clearData(),this.wrappedRenders.clear(),this.wrappedPos=null}}class Jo extends Lo{wrappedLegend=null;//! 绑定的legend
wrappedGeom;//! 流线几何对象
wrappedRenders=new Map;//! 显示对象数组
wrappedProperties=new Map;//! 属性列表
wrappedCurProp="";//! 当前使能属性
wrappedLineColor=new g(16711935);constructor(e){super(),this.wrappedGeom=e,this.setLineWidth(3),this.updateProperty()}onLegendUpdateCB=e=>{e?.type!==Ga.Range&&e?.type!==Ga.Colors&&e?.type!==Ga.Type||this.updateProperty()};unbindLegend=e=>{this.legend&&this.legend.updateEvent.remove(this.onLegendUpdateCB),e===this.legend&&(this.wrappedLegend=null)};useLegend=!0;bindLegend=e=>{this.wrappedLegend=e,this.legend&&(this.legend.updateEvent.add(this.onLegendUpdateCB),this.updateProperty())};type(){return Ua.StreamLineType}computeSelects(e){return!0}computeRenders(e){return(()=>{if(this.wrappedRenders.has("lines"))return void this.wrappedGroup.eles.push(this.wrappedRenders.get("lines"));const e=new Mo(this.wrappedGroup),t=[],i=[];let n=0;this.wrappedGeom.lines.forEach((e=>{t.push(...e);for(let t=1;t<e.length/3;t+=1)i.push(t+n-1,t+n);n+=e.length/3}));const s=[];this.wrappedProperties.forEach(((e,t)=>{s.push({name:t,attr:e.attr})})),e.fillData(t,i,s),e.createItem(new wo(null,La.OT_Custom),0,i.length/2),this.wrappedRenders.set("edges",e)})(),!0}attachProperty(e){const t=[];for(let i=0;i<e.data.length;i+=1){if(this.wrappedGeom.lines[i].length/3!=e.data[i].length/e.size)throw Error("Invalid stream line property data! Size error!");t.push(...e.data[i])}let i=Number.MAX_VALUE,s=-Number.MAX_VALUE;t.forEach((e=>{e>s&&(s=e),e<i&&(i=e)}));const r=new n(t,e.size);return this.wrappedProperties.set(e.name,{attr:r,max:s,min:i,size:e.size}),!0}activeProperty(e){return this.wrappedCurProp=e,this.updateProperty(),!0}setLineColor(e){this.wrappedLineColor=new g(e)}updateProperty(){if(""===this.wrappedCurProp)this.group.config.lineConfig.color=new dr(Wt.Fragment_Color_Map,[this.wrappedLineColor],this.wrappedCurProp,pr.Liner,0,0);else{const e=this.wrappedProperties.get(this.wrappedCurProp);if(void 0===e)return;const t=this.legend?.range;this.group.config.lineConfig.color=new dr(Wt.Fragment_Color_Map,this.legend?this.legend.colors:[new g(1,0,0),new g(0,1,0),new g(0,0,1)],this.wrappedCurProp,this.legend?.type===ss.Nearest?pr.Nearest:pr.Liner,t?t.min:e.min,t?t.max:e.max),this.group.config.triConfig.color.attributeName=this.wrappedCurProp}}legendCB=e=>{void 0!==e&&(e.type!==Ga.Colors&&e.type!==Ga.Range||this.updateProperty())};get legend(){return this.wrappedLegend}get geom(){return this.wrappedGeom}get props(){return this.wrappedProperties}clearData(){super.clearData(),this.wrappedRenders.clear()}}class eh extends Lo{wrappedStart;wrappedEnd;wrappedTxt;wrappedEles=new Map;constructor(e,t,i){super(),this.wrappedStart=new Jr(e.x,e.y,e.z),this.wrappedEnd=new Jr(t.x,t.y,t.z),this.wrappedTxt=i,this.group.config.textCfg.color=new ea(0),this.group.config.line2DCfg.arrow={length:20,width:10}}get start(){return this.wrappedStart}set start(e){const t=new Jr(e.x,e.y,e.z);t.equals(this.wrappedStart)||(this.wrappedStart=t,this.updatePnts())}get end(){return this.wrappedEnd}set end(e){const t=new Jr(e.x,e.y,e.z);t.equals(this.wrappedEnd)||(this.wrappedEnd=t,this.updatePnts())}get customTxt(){return this.wrappedTxt}set customTxt(e){e!==this.customTxt&&(this.wrappedTxt=e,this.updateTxt())}get length(){return this.start.distanceTo(this.end)}updatePnts(){const e=this.wrappedEles.get("line");if(e){const t=[this.start,this.end];e.points=t,this.updateTxt()}}updateTxt(){const e=this.wrappedEles.get("label");if(e){const t=e;t.anchorPnt=this.start.clone().add(this.end).divideScalar(2);const i=this.customTxt||this.length.toFixed(2);t.text=i,t.direction=this.end.clone().sub(this.start)}}type(){return Ua.LengthDim3DType}computeSelects(e){return!0}computeRenders(e){if(0===this.wrappedEles.size){const e=new Qo([this.start,this.end],this.group,this.group.config.line2DCfg,!0,!0);this.wrappedEles.set("line",e);const t=new Vo("",this.group,this.group.config.textCfg);return this.wrappedEles.set("label",t),this.updateTxt(),!0}return!0}clearData(){super.clearData(),this.wrappedEles.clear()}}const th=(e,t)=>{const i=[new Jr(0,-t.tail.width/2,0),new Jr(t.tail.length,-t.tail.width/2,0),new Jr(t.tail.length,-t.head.width/2,0),new Jr(t.tail.length+t.head.length,0,0),new Jr(t.tail.length,t.head.
wrappedAnchor;//! label锚定位置
wrappedTextAnchor;//! 文本锚定位置
wrappedTxtEle=null;//! 文本单元
wrappedLinEle=null;//! 引线单元
wrappedAnchorEle=null;//! 锚定点单元
constructor(e,t,i){super(),this.wrappedAnchor=t,this.wrappedText=e,this.wrappedTextAnchor=i,this.group.config.pntConfig.color=new g(16711680),this.group.config.pntConfig.size=20}type(){return Ua.AnnoLabelType}get text(){return this.wrappedText}set text(e){this.wrappedText=e,this.updateText()}computeSelects(e){return!0}updateAnnoLine(){this.wrappedAnchorEle||(this.wrappedAnchorEle=new Eo(this.group),this.wrappedAnchorEle.createItem(new wo(null,La.OT_Custom),0,1),this.wrappedAnchorEle.fillData([this.wrappedAnchor.x,this.wrappedAnchor.y,this.wrappedAnchor.z],[0])),void 0===this.group.eles.find((e=>e===this.wrappedAnchorEle))&&this.group.eles.push(this.wrappedAnchorEle),this.wrappedLinEle||(this.wrappedLinEle=new Qo([this.wrappedAnchor,this.wrappedTextAnchor],this.group,this.group.config.line2DCfg,!1,!1)),void 0===this.group.eles.find((e=>e===this.wrappedLinEle))&&this.group.eles.push(this.wrappedLinEle)}updateText(){const e=this.wrappedText;this.wrappedTxtEle||(this.wrappedTxtEle=new Vo(e,this.group,this.group.config.textCfg));const t=this.wrappedTxtEle;t.text=e,t.anchorPnt=this.wrappedTextAnchor,void 0===this.group.eles.find((e=>e===this.wrappedTxtEle))&&this.group.eles.push(this.wrappedTxtEle)}computeRenders(e){return this.updateAnnoLine(),this.updateText(),!0}clearData(){super.clearData(),this.wrappedTxtEle=null,this.wrappedLinEle=null}}const sh=globalThis;if(sh.poseidonEngineCoreLoaded)throw new Error("multiple instances of poseidon-engine-core to load");sh.poseidonEngineCoreLoaded=!0;export{yr as ABOVE_ALL_SCENE,Mr as ABOVE_ALL_SCENE_ORDER,Tn as ActionHandlerBase,Ct as ActivePlaneBoundaryBufferGeometry,_t as AggregateMesh,Vi as AnimationHelper,ih as AnnoArrow,nh as AnnoLabel,Vs as AnnotationGroup,Kr as AnnotationHitInfo,Ms as AnnotationLayer,Xs as AnnotationLine,Ys as AnnotationLineConfig,js as AnnotationObject,Ks as AnnotationText,Ws as AnnotationTextConfig,qs as Annotations,_r as ArrowConfig,At as ArrowsMesh,Yi as AsyncDebouncer,cn as AxisMesh,pn as AxisMode,Sa as BRepAcornBody,_a as BRepAssembly,ya as BRepBody,Ta as BRepCompoundBody,da as BRepEdge,fa as BRepFace,ua as BRepHalfEdge,ga as BRepLoop,ha as BRepObject,wa as BRepShell,ba as BRepShellBody,va as BRepSolid,Ma as BRepSolidBody,To as BRepTypeToSelectType,ma as BRepVertex,Do as BRepViewObject,xa as BRepWire,Ea as BRepWireBody,Vt as BasicMapMaterial,Hr as BodyType,_n as BoxActionHandler,Pn as BoxBoundaryHelper,Gn as CLIPPING_SEALING_GROUP,Ln as CLIPPING_TRAIT_NAME,On as CLIPPING_UNIVERSAL_GROUP,mn as CURSOR_TYPE,Qr as CadComponents,$r as CadView,It as CallbackStack,wn as CameraType,Wi as CancelError,mo as CellBasedMesh,Xo as CellBasedMeshVO,qi as ClashDetectHelper,Dn as ClippingDetectMaterialFactory,kn as ClippingManager,is as ClippingManagerWithSections,Fr as ClippingMethod,dr as ColorMapColoring,Yt as ColorMapExLambertMaterial,ti as ColorMapLambertMaterial,rs as ColorMapLegend,ss as ColorMapLegendType,hi as ColorMapLineMaterial,mr as ColorMapLineMeshFactory,Ci as ColorMapMaterial,Wt as ColorMapMode,ii as ColorMapPhongMaterial,Vr as ColorMapTriangleMeshFactory,Yr as ContentManager,ra as Coord,Ra as Coordinate,Un as CopyWithDepthShader,os as CrossRulerManager,Aa as CurveType,In as CustomSealingSurfaceCreateMethod,Hn as DEBOUNCE_DELAY,Lt as DEFAULT_SCENE,jn as DEFAULT_SECTION_CONFIG,Ei as DagDwtMaterial,ni as DagMapLambertMaterial,Mi as DagMapMaterial,yi as DagMapShader,ri as DagThresholdMaterial,si as DagWireFrameMaterial,_i as DefaultDetectMaterialFactory,ns as DefaultSealingSurfaceFactory,oi as DetectMaterial,ai as DetectMode,pa as Direct,vn as Direction,Nn as DirectionMaps,Ji as EffectComposerHelper,fn as EngineActionState,$i as EngineRenderPass,Ia as ExtendSelMode,xi as GBufferMaterial,$a as GeometryBuilder,bs as GeometryFactoryBase,Es as GeometryFactoryHub,Ro as GroupConfig,Pi as GroupHelper,ro as HexOrder2N20Ele,ao as HexOrder2N27Ele,eo as HexahedronEle,un as IdentityBoxBoundaryBufferGeometry,yn as IdentityBoxBufferGeometry,Mn as IdentityPlaneBufferGeometry,Nr as InitStatus,Wa as InterEventType,Va as InteractiveMode,pr as InterpreterMode,as as LegendPanel,