yanchengPowerSupply/node_modules/mxdraw/dist/lib/MxModule/MxDbCoord/index.js

1 line
1.3 KiB
JavaScript

import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import MxDbEntity from"../MxDbEntity";import drawMxDbCoord from"./draw";class MxDbCoord extends MxDbEntity{constructor(){super(...arguments),this.point1=new THREE.Vector3,this.point2=new THREE.Vector3}worldDraw(t){let o=t.getMxObject();t.drawLine(this.point1,this.point2);let i=this.point2.clone();var r=o.screenCoordLong2Doc(20),n=6*r;i.x=i.x+n,t.drawLine(this.point2,i);var e=new THREE.Vector3,p=new THREE.Vector3;let s=o.docCoord2Cad(this.point1.x,this.point1.y,this.point1.z),d=s.x.toFixed(3),x=s.y.toFixed(3);e.x=this.point2.x+.3*r+.5*n,e.y=this.point2.y+.1*r+.5*r,t.drawText(d,r,0,e),p.x=this.point2.x+.3*r+.5*n,p.y=this.point2.y-.1*r-.5*r,t.drawText(x,r,0,p)}getGripPoints(){let t=[];return t.push(this.point1),t.push(this.point2),t}moveGripPointsAt(t,o){return 0==t?this.point1.add(o):1==t&&this.point2.add(o),!0}dwgIn(t){return this.onDwgIn(t),this.point1.copy(t.point1),this.point2.copy(t.point2),!0}dwgOut(t){return this.onDwgOut(t),t.point1=this.point1,t.point2=this.point2,t}create(){return new MxDbCoord}transformBy(t){this.point1.applyMatrix4(t),this.point2.applyMatrix4(t)}getTypeName(){return"MxDbCoord"}}MxDbCoord.cmd="Mx_Coord",MxDbCoord.draw=drawMxDbCoord,addRegisterMxDbEntity(MxDbCoord);export default MxDbCoord;