mxdraw 0.1.122 → 0.1.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/MxModule/Mx3PointArc/draw.d.ts +1 -0
- package/dist/lib/MxModule/Mx3PointArc/draw.js +1 -0
- package/dist/lib/MxModule/Mx3PointArc/index.d.ts +5 -1
- package/dist/lib/MxModule/Mx3PointArc/index.js +1 -1
- package/dist/lib/MxModule/MxDb2LineAngularDimension/draw.d.ts +2 -0
- package/dist/lib/MxModule/MxDb2LineAngularDimension/draw.js +1 -0
- package/dist/lib/MxModule/MxDb2LineAngularDimension/index.d.ts +5 -1
- package/dist/lib/MxModule/MxDb2LineAngularDimension/index.js +1 -1
- package/dist/lib/MxModule/MxDbAlignedDimension/draw.d.ts +2 -0
- package/dist/lib/MxModule/MxDbAlignedDimension/draw.js +1 -0
- package/dist/lib/MxModule/MxDbAlignedDimension/index.d.ts +5 -1
- package/dist/lib/MxModule/MxDbAlignedDimension/index.js +1 -1
- package/dist/lib/MxModule/MxDbAnyLine/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbAnyLine/draw.js +1 -0
- package/dist/lib/MxModule/MxDbAnyLine/index.d.ts +5 -1
- package/dist/lib/MxModule/MxDbAnyLine/index.js +1 -1
- package/dist/lib/MxModule/MxDbArcShape/index.d.ts +2 -2
- package/dist/lib/MxModule/MxDbArcShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbArcShapeDraw/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbArcShapeDraw/draw.js +1 -0
- package/dist/lib/MxModule/MxDbArcShapeDraw/index.d.ts +6 -1
- package/dist/lib/MxModule/MxDbArcShapeDraw/index.js +1 -1
- package/dist/lib/MxModule/MxDbArea/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbArea/draw.js +1 -0
- package/dist/lib/MxModule/MxDbArea/index.d.ts +5 -1
- package/dist/lib/MxModule/MxDbArea/index.js +1 -1
- package/dist/lib/MxModule/MxDbArrow/draw.d.ts +2 -0
- package/dist/lib/MxModule/MxDbArrow/draw.js +1 -0
- package/dist/lib/MxModule/MxDbArrow/index.d.ts +5 -1
- package/dist/lib/MxModule/MxDbArrow/index.js +1 -1
- package/dist/lib/MxModule/MxDbCircleArc/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbCircleArc/draw.js +1 -0
- package/dist/lib/MxModule/MxDbCircleArc/index.d.ts +5 -1
- package/dist/lib/MxModule/MxDbCircleArc/index.js +1 -1
- package/dist/lib/MxModule/MxDbCloudLine/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbCloudLine/draw.js +1 -0
- package/dist/lib/MxModule/MxDbCloudLine/index.d.ts +6 -1
- package/dist/lib/MxModule/MxDbCloudLine/index.js +1 -1
- package/dist/lib/MxModule/MxDbCoord/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbCoord/draw.js +1 -0
- package/dist/lib/MxModule/MxDbCoord/index.d.ts +5 -2
- package/dist/lib/MxModule/MxDbCoord/index.js +1 -1
- package/dist/lib/MxModule/MxDbEllipse/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbEllipse/draw.js +1 -0
- package/dist/lib/MxModule/MxDbEllipse/index.d.ts +5 -1
- package/dist/lib/MxModule/MxDbEllipse/index.js +1 -1
- package/dist/lib/MxModule/MxDbEllipseArc/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbEllipseArc/draw.js +1 -0
- package/dist/lib/MxModule/MxDbEllipseArc/index.d.ts +8 -7
- package/dist/lib/MxModule/MxDbEllipseArc/index.js +1 -1
- package/dist/lib/MxModule/MxDbEntity/index.d.ts +11 -0
- package/dist/lib/MxModule/MxDbEntity/index.js +1 -1
- package/dist/lib/MxModule/MxDbGradientLine/index.d.ts +2 -1
- package/dist/lib/MxModule/MxDbGradientLine/index.js +1 -1
- package/dist/lib/MxModule/MxDbHatch/index.d.ts +2 -1
- package/dist/lib/MxModule/MxDbHatch/index.js +1 -1
- package/dist/lib/MxModule/MxDbImage/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbImage/draw.js +1 -0
- package/dist/lib/MxModule/MxDbImage/index.d.ts +5 -2
- package/dist/lib/MxModule/MxDbImage/index.js +1 -1
- package/dist/lib/MxModule/MxDbLeadComment/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbLeadComment/draw.js +1 -0
- package/dist/lib/MxModule/MxDbLeadComment/index.d.ts +5 -2
- package/dist/lib/MxModule/MxDbLeadComment/index.js +1 -1
- package/dist/lib/MxModule/MxDbLeadTag/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbLeadTag/draw.js +1 -0
- package/dist/lib/MxModule/MxDbLeadTag/index.d.ts +5 -2
- package/dist/lib/MxModule/MxDbLeadTag/index.js +1 -1
- package/dist/lib/MxModule/MxDbLine/draw.d.ts +2 -0
- package/dist/lib/MxModule/MxDbLine/draw.js +1 -0
- package/dist/lib/MxModule/MxDbLine/index.d.ts +5 -2
- package/dist/lib/MxModule/MxDbLine/index.js +1 -1
- package/dist/lib/MxModule/MxDbLineShape/index.d.ts +2 -1
- package/dist/lib/MxModule/MxDbLineShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbPolyline/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbPolyline/draw.js +1 -0
- package/dist/lib/MxModule/MxDbPolyline/index.d.ts +5 -2
- package/dist/lib/MxModule/MxDbPolyline/index.js +1 -1
- package/dist/lib/MxModule/MxDbRect/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbRect/draw.js +1 -0
- package/dist/lib/MxModule/MxDbRect/index.d.ts +5 -1
- package/dist/lib/MxModule/MxDbRect/index.js +1 -1
- package/dist/lib/MxModule/MxDbRectBoxLeadComment/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbRectBoxLeadComment/draw.js +1 -0
- package/dist/lib/MxModule/MxDbRectBoxLeadComment/index.d.ts +5 -1
- package/dist/lib/MxModule/MxDbRectBoxLeadComment/index.js +1 -1
- package/dist/lib/MxModule/MxDbRegularPolygon/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbRegularPolygon/draw.js +1 -0
- package/dist/lib/MxModule/MxDbRegularPolygon/index.d.ts +5 -1
- package/dist/lib/MxModule/MxDbRegularPolygon/index.js +1 -1
- package/dist/lib/MxModule/MxDbRegularPolygonShape/index.d.ts +2 -1
- package/dist/lib/MxModule/MxDbRegularPolygonShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbRingShape/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbRingShape/draw.js +1 -0
- package/dist/lib/MxModule/MxDbRingShape/index.d.ts +14 -1
- package/dist/lib/MxModule/MxDbRingShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbSVG/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbSVG/draw.js +1 -0
- package/dist/lib/MxModule/MxDbSVG/index.d.ts +5 -2
- package/dist/lib/MxModule/MxDbSVG/index.js +1 -1
- package/dist/lib/MxModule/MxDbShape/index.d.ts +3 -1
- package/dist/lib/MxModule/MxDbShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbStarShape/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbStarShape/draw.js +1 -0
- package/dist/lib/MxModule/MxDbStarShape/index.d.ts +17 -2
- package/dist/lib/MxModule/MxDbStarShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbText/MxDbText.d.ts +3 -0
- package/dist/lib/MxModule/MxDbText/MxDbText.js +1 -1
- package/dist/lib/MxModule/MxDbText/draw.d.ts +1 -0
- package/dist/lib/MxModule/MxDbText/draw.js +1 -0
- package/dist/lib/MxModule/MxDbText/index.js +1 -1
- package/dist/lib/MxModule/MxPaintBrush/index.d.ts +44 -0
- package/dist/lib/MxModule/MxPaintBrush/index.js +1 -0
- package/dist/lib/MxModule/loadCoreCode/index.js +1 -1
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -1
- package/dist/lib/MxModule/store/Pubsub.d.ts +6 -0
- package/dist/lib/MxModule/store/Pubsub.js +1 -1
- package/dist/{index.d.ts → lib/MxModule.d.ts} +172 -22
- package/dist/lib/mxdraw.d.ts +1 -0
- package/dist/lib/mxdraw.js +1 -1
- package/dist/lib/tools/dynamicImport/index.js +1 -1
- package/dist/lib/tools/registerMxDbEntity/index.d.ts +5 -0
- package/dist/lib/tools/registerMxDbEntity/index.js +1 -0
- package/dist/mxdraw.es.js +1 -1
- package/dist/mxdraw.umd.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function drawMx3PointArc(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createThreePointArc}from"../../tools/three";import Mx3PointArc from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrBaseReturn from"../MrxDbgUiPrBaseReturn";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export default function drawMx3PointArc(){const r=new MrxDbgUiPrPoint,t=new McEdGetPointWorldDrawObject,e=new Mx3PointArc;e.closed=!1,e.setColor("#ff0000").setLineWidth(10),r.setUserDraw(t),r.setMessage("\n确定圆弧开始点:"),r.go(o=>{o===MrxDbgUiPrBaseReturn.kOk&&(e.point1=r.value(),t.setDraw(r=>{t.drawLine(e.point1,r)})),r.setMessage("\n确定圆弧结束点:"),r.go(o=>{o===MrxDbgUiPrBaseReturn.kOk&&(e.point2=r.value(),t.setDraw(r=>{e.point3=r,t.drawCustomEntity(e)})),r.setMessage("\n确定圆弧上任意一点:"),r.go(r=>{if(r===MrxDbgUiPrBaseReturn.kOk){MxFun.getCurrentDraw().addMxEntity(e);const{radius:r,angle:t,arcLength:o}=createThreePointArc(e.point1,e.point2,e.point3,!0);console.log("半径:",r),console.log("圆弧圆心角度:",t),console.log("圆弧弧长:",o)}})})})};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbCircleShape from "../MxDbCircleShape";
|
|
3
|
+
import drawMx3PointArc from "./draw";
|
|
3
4
|
/** 三点动态绘制圆弧 point1圆弧起始点 point2是圆弧结束点, point3圆弧任意一点 */
|
|
4
|
-
|
|
5
|
+
declare class Mx3PointArc extends MxDbCircleShape {
|
|
6
|
+
static cmd: string;
|
|
7
|
+
static draw: typeof drawMx3PointArc;
|
|
5
8
|
constructor();
|
|
6
9
|
point1: import("three").Vector3;
|
|
7
10
|
point2: import("three").Vector3;
|
|
@@ -22,3 +25,4 @@ export default class Mx3PointArc extends MxDbCircleShape {
|
|
|
22
25
|
upDataClockwise(angle1: number, angle2: number, angle3: number): void;
|
|
23
26
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
24
27
|
}
|
|
28
|
+
export default Mx3PointArc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{calculateArcAngle,calculateArcOrigin,calculateRadiusArc,judgementArcRenderDirection}from"../../tools/three";import MxDbCircleShape from"../MxDbCircleShape";
|
|
1
|
+
import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import{calculateArcAngle,calculateArcOrigin,calculateRadiusArc,judgementArcRenderDirection}from"../../tools/three";import MxDbCircleShape from"../MxDbCircleShape";import drawMx3PointArc from"./draw";class Mx3PointArc extends MxDbCircleShape{constructor(){super(),this.point1=new THREE.Vector3,this.point2=new THREE.Vector3,this.point3=new THREE.Vector3,this.autoClockwise=!0,this._propertyDbKeys=[...this._propertyDbKeys,"point1","point2","point3","autoClockwise"]}getTypeName(){return"Mx3PointArc"}create(){return new Mx3PointArc}worldDraw(t){let{point1:i,point2:e,point3:r}=this;this.upDateCenter(i,e,r),this.upDateRadius(i);const[n,o,s]=this.compute3PointAngle();this.upDataClockwise(n,o,s),this.startAngle=THREE.MathUtils.degToRad(n),this.endAngle=THREE.MathUtils.degToRad(o),this.drawEllipseShape(t)}getGripPoints(){return[this.point1,this.point2,this.point3,this.center]}compute3PointAngle(){const{point1:t,point2:i,point3:e}=this,r=calculateArcAngle(t,this.center,this.radius),n=calculateArcAngle(i,this.center,this.radius),o=calculateArcAngle(e,this.center,this.radius);return[r.angle,n.angle,o.angle]}upDateCenter(t,i,e){return this.center=calculateArcOrigin(t,i,e),this.center}upDateRadius(t){return this.radius=calculateRadiusArc(t,this.center),this.radius}upDataClockwise(t,i,e){const{autoClockwise:r}=this;r&&(this.clockwise=judgementArcRenderDirection(i,t,e))}moveGripPointsAt(t,i){return 0===t?this.point1.add(i):1===t?this.point2.add(i):2===t?this.point3.add(i):3===t&&(this.point1.add(i),this.point2.add(i),this.point3.add(i)),this.upDateCenter(this.point1,this.point2,this.point3),!0}}Mx3PointArc.cmd="Mx_3PointArc",Mx3PointArc.draw=drawMx3PointArc,addRegisterMxDbEntity(Mx3PointArc);export default Mx3PointArc;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import MxDb2LineAngularDimension from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export default function drawMxDb2LineAngularDimension(){const n=new MrxDbgUiPrPoint,t=MxFun.getCurrentDraw(),e=new MxDb2LineAngularDimension,r=new McEdGetPointWorldDrawObject;return n.setMessage("\n指定第一点:"),n.go(o=>{0===o&&(n.setMessage("\n指定第二个角度点:"),e.point1=n.value(),r.setDraw((n,t)=>{e.point2=n,r.drawLine(e.point1,n)}),n.setUserDraw(r),n.go(o=>{n.setMessage("\n指定最后一个点:"),0===o&&(e.point2=n.value(),r.setDraw((n,t)=>{e.point3=n,r.drawCustomEntity(e)}),n.go(n=>{0===n&&t.addMxEntity(e)}))}))}),e};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import McGiWorldDraw from '../McGiWorldDraw';
|
|
2
2
|
import MxDbEntity from '../MxDbEntity';
|
|
3
3
|
import { MxColorType, UnstableColor } from '../MxType';
|
|
4
|
-
|
|
4
|
+
import drawMxDb2LineAngularDimension from './draw';
|
|
5
|
+
declare class MxDb2LineAngularDimension extends MxDbEntity {
|
|
6
|
+
static cmd: string;
|
|
7
|
+
static draw: typeof drawMxDb2LineAngularDimension;
|
|
5
8
|
/**
|
|
6
9
|
* MxDb2LineAngularDimension
|
|
7
10
|
* 显示角度测量的图形
|
|
@@ -57,3 +60,4 @@ export default class MxDb2LineAngularDimension extends MxDbEntity {
|
|
|
57
60
|
transformBy(mat: THREE.Matrix4): void;
|
|
58
61
|
getTypeName(): string;
|
|
59
62
|
}
|
|
63
|
+
export default MxDb2LineAngularDimension;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _ from"lodash";import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbEntity from"../MxDbEntity";const propertyDbKeys=["colors","point1","point2","point3"];
|
|
1
|
+
import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import _ from"lodash";import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbEntity from"../MxDbEntity";import drawMxDb2LineAngularDimension from"./draw";const propertyDbKeys=["colors","point1","point2","point3"];class MxDb2LineAngularDimension extends MxDbEntity{constructor(t){if(super(),this.point1=new THREE.Vector3,this.point2=new THREE.Vector3,this.point3=new THREE.Vector3,this.colors=[],t){const{points:i,colors:n}=t;i&&this.setPoints(i),n&&this.setColor(n)}}calculateLineAngle(t,i,n){const o=2*Math.PI/360;return{startAngle:180*Math.atan2(i.y-t.y,i.x-t.x)/Math.PI*o,endAngle:180*Math.atan2(n.y-t.y,n.x-t.x)/Math.PI*o}}setPoints(t){const[i,n,o]=t;return i&&(this.point1=i),n&&(this.point2=n),o&&(this.point3=o),this}setColor(t){return _.isArray(t)?this.colors=t:this.color=t,this}worldDraw(t){if(t.getType()==McGiWorldDrawType.kWorldDraw||t.getType()==McGiWorldDrawType.kDynDragDraw){const[i,n,o,e]=this.colors||[],r=this.getColor(),s=t.getMxObject();t.setColor(i||r),t.drawLine(this.point1,this.point2),t.setColor(n||r),t.drawLine(this.point2,this.point3);const{startAngle:a,endAngle:p}=this.calculateLineAngle(this.point2,this.point1,this.point3),l=this.point2.distanceTo(this.point1),h=this.point2.distanceTo(this.point3),d=Math.min(l,h)/4;let c=THREE.MathUtils.radToDeg(a-p);c<0&&(c+=360);let D=s.screenCoordLong2Doc(50);const g=new THREE.ArcCurve(this.point2.x,this.point2.y,d,a,p,!0),y=(new THREE.Geometry).setFromPoints(g.getPoints(50));t.setColor(o||r),t.drawGeometryLines(y);const w=g.getPoint(.5);let u=new THREE.Vector3(w.x,w.y,0);const M=u.sub(this.point2),m=M.length()+.5*D;M.normalize().multiplyScalar(m),u=this.point2.clone().add(M),t.setColor(e||r),t.drawText(c.toFixed(3)+"°",.5*D,0,u)}else t.drawLine(this.point1,this.point2),t.drawLine(this.point3,this.point2)}getGripPoints(){return[this.point1,this.point2,this.point3]}moveGripPointsAt(t,i){return 0===t?this.point1.add(i):1===t?this.point2.add(i):2===t&&this.point3.add(i),!0}dwgIn(t){return this.onDwgIn(t),this.dwgInHelp(t,propertyDbKeys),!0}dwgOut(t){return this.onDwgOut(t),this.dwgOutHelp(t,propertyDbKeys),t}create(){return new MxDb2LineAngularDimension}transformBy(t){this.point1.applyMatrix4(t),this.point2.applyMatrix4(t)}getTypeName(){return"MxDb2LineAngularDimension"}}MxDb2LineAngularDimension.cmd="Mx_AngleSurveying",MxDb2LineAngularDimension.draw=drawMxDb2LineAngularDimension,addRegisterMxDbEntity(MxDb2LineAngularDimension);export default MxDb2LineAngularDimension;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import MxDbAlignedDimension from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";import MxType from"../MxType";export default function drawMxDbAlignedDimension(){let t=new MxDbAlignedDimension;const e=new MrxDbgUiPrPoint;return e.setMessage("\n指定第一点:"),e.go(n=>{if(0!=n)return;const o=e.value();t.setPoint1(o),t.setColor(65314);const r=new McEdGetPointWorldDrawObject;r.setDraw(e=>{t.setPoint2(e),r.drawCustomEntity(t)}),e.setBasePt(o),e.setUseBasePt(!0),e.setUserDraw(r),e.setMessage("\n指定第二点:"),e.setInputToucheType(MxType.InputToucheType.kGetEnd),e.go(n=>{if(0!=n)return void console.log(n);const o=e.value();t.setPoint2(o),MxFun.getCurrentDraw().addMxEntity(t)})}),t};
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
import McGiWorldDraw from '../McGiWorldDraw';
|
|
3
3
|
import MxDbEntity from '../MxDbEntity';
|
|
4
4
|
import { MxColorType, UnstableColor } from '../MxType';
|
|
5
|
+
import drawMxDbAlignedDimension from './draw';
|
|
5
6
|
/**
|
|
6
7
|
* MxDbAlignedDimension 尺寸标注
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
declare class MxDbAlignedDimension extends MxDbEntity {
|
|
10
|
+
static cmd: string;
|
|
11
|
+
static draw: typeof drawMxDbAlignedDimension;
|
|
9
12
|
/**
|
|
10
13
|
* MxDbAlignedDimension
|
|
11
14
|
* 尺寸标注
|
|
@@ -61,3 +64,4 @@ export default class MxDbAlignedDimension extends MxDbEntity {
|
|
|
61
64
|
dwgOut(obj: any): object;
|
|
62
65
|
create(): MxDbAlignedDimension;
|
|
63
66
|
}
|
|
67
|
+
export default MxDbAlignedDimension;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _ from"lodash";import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbEntity from"../MxDbEntity";import MxThreeJS from"../MxThreeJS";const propertyDbKeys=["point1","point2","fontColor"];
|
|
1
|
+
import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import _ from"lodash";import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbEntity from"../MxDbEntity";import MxThreeJS from"../MxThreeJS";import drawMxDbAlignedDimension from"./draw";const propertyDbKeys=["point1","point2","fontColor"];class MxDbAlignedDimension extends MxDbEntity{constructor(t){if(super(),this.point1=new THREE.Vector3,this.point2=new THREE.Vector3,t){const{points:e,fontColor:n}=t;e&&this.setPoints(e),n&&(this.fontColor=n)}}setPoints(t){const[e,n]=t;e&&(this.point1=e),n&&(this.point2=n)}getTypeName(){return"MxDbAlignedDimension"}getDirection(t,e,n){const i=new THREE.Vector3(t.x,t.y,0),o=new THREE.Vector3(1,0,0),r=t.angleTo(o);let a=-1;(r<7*Math.PI/18||r>10*Math.PI/18)&&e.x>n.x&&(a=1);const s=new THREE.Matrix4;return s.makeRotationZ(Math.PI/2*a),i.applyMatrix4(s),i}getDimText(){return new THREE.Vector3(this.point1.x-this.point2.x,this.point1.y-this.point2.y,0).length().toFixed(3)}worldDraw(t){if(t.getType()==McGiWorldDrawType.kWorldDraw||t.getType()==McGiWorldDrawType.kDynDragDraw){const e=this.point1,n=this.point2;let i,o,r,a,s,x,y;const c=new THREE.Vector3(e.x-n.x,e.y-n.y,0),p=this.getDirection(c,e,n),E=new THREE.Matrix4;E.makeScale(.01,.01,.01);const l=new THREE.Vector3(p.x,p.y,0);l.applyMatrix4(E);const h=new THREE.Vector3(e.x+l.x,e.y+l.y,0),w=new THREE.Vector3(n.x+l.x,n.y+l.y,0),M=this.getColor();x=MxThreeJS.createPoint(e,M),y=MxThreeJS.createPoint(n,M);{E.identity(),E.makeScale(.2,.2,0),new THREE.Vector3(p.x,p.y,0).applyMatrix4(E),E.identity(),E.makeScale(.02,.02,0);const r=new THREE.Vector3(p.x,p.y,0);r.applyMatrix4(E),t.drawLine(h,w),i=MxThreeJS.createLine(new THREE.Vector3(h.x+2*r.x,h.y+2*r.y,0),new THREE.Vector3(e.x+r.x,e.y+r.y,0),M),o=MxThreeJS.createLine(new THREE.Vector3(w.x+2*r.x,w.y+2*r.y,0),new THREE.Vector3(n.x+r.x,n.y+r.y,0),M)}{const i=new THREE.Vector3(1,0,0);let o=c.angleTo(i);const a=new THREE.Vector3(p.x,p.y,0);a.normalize();const s=e.distanceTo(n);c.y<0?o=o<Math.PI/2?2*Math.PI-o:Math.PI-o:o>Math.PI/2&&(o=Math.PI+o);const x=t.getMxObject();x&&(o-=x.getViewAngle());const y=this.getDimText();null!=(r=MxThreeJS.creatTextSprite(y,new THREE.Vector3(w.x+c.x/2+a.x*s/30,w.y+c.y/2+a.y*s/30,0),.07*s,o,this.fontColor||M))&&t.drawEntity(r)}{E.identity(),E.makeScale(.08,.08,.08);const t=new THREE.Matrix4;t.makeRotationZ(17*Math.PI/18);let e=new THREE.Vector3(c.x,c.y,0);e.applyMatrix4(E),e.applyMatrix4(t),t.identity(),t.makeRotationZ(17*-Math.PI/18);let n=new THREE.Vector3(c.x,c.y,0);n.applyMatrix4(E),n.applyMatrix4(t);const i=new Array;i.push(new THREE.Vector3(h.x,h.y,0),new THREE.Vector3(h.x+e.x,h.y+e.y,0),new THREE.Vector3(h.x+n.x,h.y+n.y,0)),a=MxThreeJS.createTriangle(i,M),t.identity(),t.makeRotationZ(Math.PI/18),(e=new THREE.Vector3(c.x,c.y,0)).applyMatrix4(E),e.applyMatrix4(t),t.identity(),t.makeRotationZ(-Math.PI/18),(n=new THREE.Vector3(c.x,c.y,0)).applyMatrix4(E),n.applyMatrix4(t);const o=new Array;o.push(new THREE.Vector3(w.x,w.y,0),new THREE.Vector3(w.x+e.x,w.y+e.y,0),new THREE.Vector3(w.x+n.x,w.y+n.y,0)),s=MxThreeJS.createTriangle(o,M)}t.drawEntity(i),t.drawEntity(o),a&&t.drawEntity(a),s&&t.drawEntity(s),t.drawEntity(x),t.drawEntity(y)}else t.drawLine(this.point1,this.point2)}setPoint1(t){this.point1=t}setPoint2(t){this.point2=t}setColor(t){return _.isArray(t)?([this.color=this.color,this.fontColor=this.fontColor||this.color]=t,console.log("this.fontColor : ",this.fontColor)):this.color=t,this}getGripPoints(){let t=[];return t.push(this.point1),t.push(this.point2),t}moveGripPointsAt(t,e){return 0==t?this.point1.add(e):(t=1)&&this.point2.add(e),!0}dwgIn(t){return this.onDwgIn(t),this.dwgInHelp(t,propertyDbKeys),!0}dwgOut(t){return this.onDwgOut(t),this.dwgOutHelp(t,propertyDbKeys),t}create(){return new MxDbAlignedDimension}}MxDbAlignedDimension.cmd="Mx_DimensionMeasurement",MxDbAlignedDimension.draw=drawMxDbAlignedDimension,addRegisterMxDbEntity(MxDbAlignedDimension);export default MxDbAlignedDimension;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function drawMxDbAnyLine(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import MxDbAnyLine from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrBaseReturn from"../MrxDbgUiPrBaseReturn";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export default function drawMxDbAnyLine(){const r=new MrxDbgUiPrPoint,t=MxFun.getCurrentDraw(),e=new McEdGetPointWorldDrawObject,n=new MxDbAnyLine;r.setUserDraw(e),r.setMessage("\n点击开始画线:"),r.go(o=>{o===MrxDbgUiPrBaseReturn.kOk&&(n.points.push(r.value()),e.setDraw(r=>{n.points.push(r.clone()),e.drawCustomEntity(n)})),r.setMessage("\n再次点击结束画线:"),r.go(r=>{r===MrxDbgUiPrBaseReturn.kOk&&t.addMxEntity(n)})})};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/** @module MxDbAnyLine*/
|
|
2
2
|
import McGiWorldDraw from '../McGiWorldDraw';
|
|
3
3
|
import MxDbEntity from '../MxDbEntity';
|
|
4
|
+
import drawMxDbAnyLine from './draw';
|
|
4
5
|
/**
|
|
5
6
|
* MxDbAnyLine
|
|
6
7
|
* 任意线段
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
declare class MxDbAnyLine extends MxDbEntity {
|
|
10
|
+
static cmd: string;
|
|
11
|
+
static draw: typeof drawMxDbAnyLine;
|
|
9
12
|
/** 构成线段的顶点坐标集合 */
|
|
10
13
|
points: THREE.Vector3[];
|
|
11
14
|
getTypeName(): string;
|
|
@@ -22,3 +25,4 @@ export default class MxDbAnyLine extends MxDbEntity {
|
|
|
22
25
|
dwgIn(obj: any): boolean;
|
|
23
26
|
dwgOut(obj: any): object;
|
|
24
27
|
}
|
|
28
|
+
export default MxDbAnyLine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import MxDbEntity from"../MxDbEntity";import McGiWorldDrawType from"../McGiWorldDrawType";const propertyDbKeys=["points"];
|
|
1
|
+
import MxDbEntity from"../MxDbEntity";import McGiWorldDrawType from"../McGiWorldDrawType";import drawMxDbAnyLine from"./draw";import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";const propertyDbKeys=["points"];class MxDbAnyLine extends MxDbEntity{constructor(){super(...arguments),this.points=[]}getTypeName(){return"MxDbAnyLine"}create(){return new MxDbAnyLine}worldDraw(t){let e=t.getMxObject();const n=(new THREE.Box3).setFromPoints(this.points);let r=new THREE.Vector3;if(n.getCenter(r),t.drawLines(this.points),t.getType()===McGiWorldDrawType.kSelectDraw){const i=new THREE.Vector3;n.getSize(i),i.addScalar(e.screenCoordLong2Doc(20));const o=i.x/2,s=i.y/2,y={x:r.x-o,y:r.y-s},x={x:r.x+o,y:r.y-s},d={x:r.x+o,y:r.y+s},p={x:r.x-o,y:r.y+s};t.drawLine(y.x,y.y,x.x,x.y),t.drawLine(x.x,x.y,d.x,d.y),t.drawLine(d.x,d.y,p.x,p.y),t.drawLine(p.x,p.y,y.x,y.y)}}setPoints(t){return this.points=t,this}getCenter(){const t=new THREE.Geometry;t.vertices=this.points;const e=new THREE.Vector3;return t.computeBoundingBox(),t.boundingBox.getCenter(e),e}getGripPoints(){return[this.getCenter()]}moveGripPointsAt(t,e){return 0===t&&this.points.forEach(t=>{t.add(e)}),!0}dwgIn(t){return this.onDwgIn(t),this.dwgInHelp(t,propertyDbKeys),!0}dwgOut(t){return this.onDwgOut(t),this.dwgOutHelp(t,propertyDbKeys),t}}MxDbAnyLine.cmd="Mx_AnyLine",MxDbAnyLine.draw=drawMxDbAnyLine,addRegisterMxDbEntity(MxDbAnyLine);export default MxDbAnyLine;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbCircleArc from "../MxDbCircleArc";
|
|
3
|
-
|
|
3
|
+
declare class MxDbArcShape extends MxDbCircleArc {
|
|
4
4
|
/** 环形 */
|
|
5
5
|
constructor();
|
|
6
6
|
getTypeName(): string;
|
|
7
|
-
create(): MxDbArcShape;
|
|
8
7
|
center: import("three").Vector3;
|
|
9
8
|
innerRadius: number;
|
|
10
9
|
outerRadius: number;
|
|
@@ -13,3 +12,4 @@ export default class MxDbArcShape extends MxDbCircleArc {
|
|
|
13
12
|
getGripPoints(): THREE.Vector3[];
|
|
14
13
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
15
14
|
}
|
|
15
|
+
export default MxDbArcShape;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import MxDbCircleArc from"../MxDbCircleArc";
|
|
1
|
+
import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbCircleArc from"../MxDbCircleArc";class MxDbArcShape extends MxDbCircleArc{constructor(){super(),this.center=new THREE.Vector3,this.innerRadius=10,this.outerRadius=20,this._propertyDbKeys=[...this._propertyDbKeys,"center","innerRadius","outerRadius"]}getTypeName(){return"MxDbArcShape"}worldDraw(e){e.getType()===McGiWorldDrawType.kDynDragDraw?(e.drawCircle(this.center,this.innerRadius),e.drawCircle(this.center,this.outerRadius)):this.drawArcShape(e)}drawArcShape(e){const{center:r,startAngle:t,endAngle:i,clockwise:s}=this,{x:a,y:c}=r;this.isClosedToCenter=!1;const n=this.createEllipseCurve(a,c,this.innerRadius,this.innerRadius,t,i,s),h=this.createEllipseCurve(a,c,this.outerRadius,this.outerRadius,i,t,!s),o=this.createPaths([n,h]);let d=this.getShapePoints(o);this._draw(e,d),this._drawStoreLine(e,d)}getGripPoints(){return[this.center]}moveGripPointsAt(e,r){return 0===e&&this.center.add(r),!0}}export default MxDbArcShape;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function drawMxDbArcShape(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function c(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,c)}u((n=n.apply(t,e||[])).next())})};import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxDbArcShapeDraw from".";import MxFun from"../MxFun";export default function drawMxDbArcShape(){const t=new MrxDbgUiPrPoint,e=MxFun.getCurrentDraw(),r=new McEdGetPointWorldDrawObject;let n=new MxDbArcShapeDraw;t.setMessage("\n确定圆弧中点:"),t.setUserDraw(r),t.go(()=>__awaiter(this,void 0,void 0,function*(){t.setMessage("\n确定圆弧开始点:"),n.center=t.value(),r.setDraw(t=>{n.interRadiusPoint=t,r.drawCircle(n.center,t.distanceTo(n.center))}),n.interRadiusPoint=(yield t.go())||new THREE.Vector3,r.setDraw(t=>{n.outerRadiusPoint=t,r.drawCustomEntity(n)}),n.outerRadiusPoint=(yield t.go())||new THREE.Vector3,e.addMxEntity(n)}))};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbArcShape from "../MxDbArcShape";
|
|
3
|
-
|
|
3
|
+
import drawMxDbArcShape from "./draw";
|
|
4
|
+
declare class MxDbArcShapeDraw extends MxDbArcShape {
|
|
5
|
+
static isRegister: boolean;
|
|
6
|
+
static cmd: string;
|
|
7
|
+
static draw: typeof drawMxDbArcShape;
|
|
4
8
|
getTypeName(): string;
|
|
5
9
|
/** 绘制弧形 */
|
|
6
10
|
constructor();
|
|
@@ -10,3 +14,4 @@ export default class MxDbArcShapeDraw extends MxDbArcShape {
|
|
|
10
14
|
getGripPoints(): THREE.Vector3[];
|
|
11
15
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
12
16
|
}
|
|
17
|
+
export default MxDbArcShapeDraw;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{calculateArcAngle}from"../../tools/three";import MxDbArcShape from"../MxDbArcShape";
|
|
1
|
+
import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import{calculateArcAngle}from"../../tools/three";import MxDbArcShape from"../MxDbArcShape";import drawMxDbArcShape from"./draw";class MxDbArcShapeDraw extends MxDbArcShape{constructor(){super(),this.outerRadiusPoint=new THREE.Vector3,this.interRadiusPoint=new THREE.Vector3,this._propertyDbKeys=[...this._propertyDbKeys,"interRadiusPoint","outerRadiusPoint"]}getTypeName(){return"MxDbArcShapeDraw"}worldDraw(t){this.innerRadius=this.center.distanceTo(this.interRadiusPoint),this.outerRadius=this.center.distanceTo(this.outerRadiusPoint),this.startAngle=THREE.MathUtils.degToRad(calculateArcAngle(this.interRadiusPoint,this.center,this.innerRadius).angle),this.endAngle=THREE.MathUtils.degToRad(calculateArcAngle(this.outerRadiusPoint,this.center,this.outerRadius).angle),this.drawArcShape(t)}getGripPoints(){return[this.center,this.interRadiusPoint,this.outerRadiusPoint]}moveGripPointsAt(t,e){return 0===t&&(this.center.add(e),this.interRadiusPoint.add(e),this.outerRadiusPoint.add(e)),1===t&&this.interRadiusPoint.add(e),2===t&&this.outerRadiusPoint.add(e),!0}}MxDbArcShapeDraw.isRegister=!1,MxDbArcShapeDraw.cmd="Mx_MxDbArcShape",MxDbArcShapeDraw.draw=drawMxDbArcShape,addRegisterMxDbEntity(MxDbArcShapeDraw);export default MxDbArcShapeDraw;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function drawMxDbArea(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import MxDbArea from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export default function drawMxDbArea(){const t=new MrxDbgUiPrPoint;t.setMessage("\n指定第一点:"),t.go(r=>{if(0!=r)return;const e=t.value();let o=new MxDbArea;o.addPoint(e);const n=new McEdGetPointWorldDrawObject;n.setDraw((t,r)=>{let e=o.clone();e.addPoint(t),n.drawCustomEntity(e)}),t.setUserDraw(n),t.setMessage("\n指定下一点:"),t.goWhile(r=>{if(0==r){const r=t.value();o.addPoint(r)}},t=>{o.isFill=!0,o.fillOpacity=.7,o.fillColor=6697540,MxFun.getCurrentDraw().addMxEntity(o)})})};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import McGiWorldDraw from '../McGiWorldDraw';
|
|
2
2
|
import MxDbEntity from '../MxDbEntity';
|
|
3
3
|
import { MxColorType } from '../MxType';
|
|
4
|
+
import drawMxDbArea from './draw';
|
|
4
5
|
/**
|
|
5
6
|
* MxDbArea 任意不规则多边形
|
|
6
7
|
* */
|
|
7
|
-
|
|
8
|
+
declare class MxDbArea extends MxDbEntity {
|
|
9
|
+
static cmd: string;
|
|
10
|
+
static draw: typeof drawMxDbArea;
|
|
8
11
|
/** 构成多边形的顶点集合 */
|
|
9
12
|
points: Array<THREE.Vector3>;
|
|
10
13
|
isFill: boolean;
|
|
@@ -35,3 +38,4 @@ export default class MxDbArea extends MxDbEntity {
|
|
|
35
38
|
* */
|
|
36
39
|
clearPoint(): void;
|
|
37
40
|
}
|
|
41
|
+
export default MxDbArea;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import McGeTool from"../McGeTool";import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbEntity from"../MxDbEntity";import MxDbHatch from"../MxDbHatch";import MxFun from"../MxFun";import MxThreeJS from"../MxThreeJS";
|
|
1
|
+
import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import McGeTool from"../McGeTool";import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbEntity from"../MxDbEntity";import MxDbHatch from"../MxDbHatch";import MxFun from"../MxFun";import MxThreeJS from"../MxThreeJS";import drawMxDbArea from"./draw";class MxDbArea extends MxDbEntity{constructor(){super(...arguments),this.points=[],this.isFill=!1,this.fillColor=6697540,this.fillOpacity=.7}getTypeName(){return"MxDbArea"}create(){return new MxDbArea}getDimText(){return McGeTool.calcArea(this.points).toFixed(2)}worldDraw(t){if(this.points.length<3)return void(2==this.points.length&&t.drawLine(this.points[0],this.points[1]));let i=this.points[0],r=i.clone(),e=i.clone(),o=this.points.length;for(let s=1;s<o;s++){let o=this.points[s];r.x>o.x&&(r.x=o.x),r.y>o.y&&(r.y=o.y),e.x<o.x&&(e.x=o.x),e.y<o.y&&(e.y=o.y),t.drawLine(i,o),i=o}t.drawLine(i,this.points[0]);let s=new THREE.Vector3(r.x+.5*(e.x-r.x),r.y+.5*(e.y-r.y));const n=t.getColor();let l=MxFun.screenCoordLong2Doc(20),p=MxThreeJS.creatTextSprite(this.getDimText(),s,l,0,n);if(null!=p&&t.drawEntity(p),t.getType()==McGiWorldDrawType.kWorldDraw&&this.isFill){t.setColor(this.fillColor),t.setOpacity(this.fillOpacity),t.setRenderOrder(t.getRenderOrder()-1);const i=new MxDbHatch;i.points=this.points,i.worldDraw(t)}}getGripPoints(){return this.points}moveGripPointsAt(t,i){return!(t>=this.points.length)&&(this.points[t].add(i),!0)}dwgIn(t){this.onDwgIn(t);let i=t.points;return this.points=[],i.forEach(t=>{this.points.push(new THREE.Vector3(t.x,t.y,t.z))}),this.dwgInHelp(t,["isFill","fillColor","fillOpacity"]),!0}dwgOut(t){return this.onDwgOut(t),t.points=this.points,this.dwgOutHelp(t,["isFill","fillColor","fillOpacity"]),t}addPoint(t){this.points.push(t.clone())}getPoints(){return this.points}clearPoint(){this.points=[]}}MxDbArea.cmd="Mx_Area",MxDbArea.draw=drawMxDbArea,addRegisterMxDbEntity(MxDbArea);export default MxDbArea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function c(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,c)}u((r=r.apply(t,e||[])).next())})};import MxDbArrow from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export function getScreenPixel(t,e){let n=MxFun.screenCoordLong2World(e?t:t-t/3);return n=MxFun.worldCoordLong2Doc(n)};export default function drawMxDbArrow(){const t=new McEdGetPointWorldDrawObject,e=new MxDbArrow,n=MxFun.getCurrentDraw(),r=new MrxDbgUiPrPoint;r.setUserDraw(t),e.setLineWidth(10),r.go(()=>{e.innerOffset=getScreenPixel(10),e.outerOffset=getScreenPixel(22),e.topOffset=getScreenPixel(36),e.startPoint=r.value(),t.setDraw(n=>{e.endPoint=n,t.drawCustomEntity(e)}),r.go(t=>__awaiter(this,void 0,void 0,function*(){e.endPoint=r.value(),n.addMxEntity(e)}))})};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbShape from "../MxDbShape";
|
|
3
|
-
|
|
3
|
+
import drawMxDbArrow from "./draw";
|
|
4
|
+
declare class MxDbArrow extends MxDbShape {
|
|
5
|
+
static cmd: string;
|
|
6
|
+
static draw: typeof drawMxDbArrow;
|
|
4
7
|
/** 箭头图形 */
|
|
5
8
|
constructor();
|
|
6
9
|
/** 开始是否为尖角 */
|
|
@@ -18,3 +21,4 @@ export default class MxDbArrow extends MxDbShape {
|
|
|
18
21
|
getGripPoints(): THREE.Vector3[];
|
|
19
22
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
20
23
|
}
|
|
24
|
+
export default MxDbArrow;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import MxDbShape from"../MxDbShape";
|
|
1
|
+
import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import MxDbShape from"../MxDbShape";import drawMxDbArrow from"./draw";class MxDbArrow extends MxDbShape{constructor(){super(),this.isSharpCorner=!0,this.innerOffset=10,this.outerOffset=22,this.topOffset=36,this.startPoint=new THREE.Vector3,this.endPoint=new THREE.Vector3,this._propertyDbKeys=[...this._propertyDbKeys,"outerOffset","topOffset","innerOffset","isSharpCorner","startPoint","endPoint"]}worldDraw(t){const r=this.getArrowVertex(this.startPoint,this.endPoint);r&&(this._draw(t,r),this._drawStoreLine(t,r))}getArrowVertex(t,r,e=this.isSharpCorner){let{innerOffset:o,topOffset:s,outerOffset:i}=this;const n=[];n[3]=r;const x=Math.sqrt((t.x-r.x)*(t.x-r.x)+(t.y-r.y)*(t.y-r.y));if(0===x)return;const y=-(r.x-t.x)/x,h=(r.y-t.y)/x,a=t.x+o,d=t.y+x-s,w=t.x+i,f=t.y+x-s,E=t.x-o,p=t.y+x-s,c=t.x-i,D=t.y+x-s;return e?(n[0]=t,n[6]=n[0]):(n[0]=new THREE.Vector3(t.x-(E-t.x)*h,t.y-(E-t.x)*y),n[6]=new THREE.Vector3(t.x+(E-t.x)*h,t.y+(E-t.x)*y),n[7]=n[0]),n[1]=new THREE.Vector3(t.x+(a-t.x)*h-(d-t.y)*y,t.y+(a-t.x)*y+(d-t.y)*h),n[2]=new THREE.Vector3(t.x+(w-t.x)*h-(f-t.y)*y,t.y+(w-t.x)*y+(f-t.y)*h),n[4]=new THREE.Vector3(t.x+(c-t.x)*h-(D-t.y)*y,t.y+(c-t.x)*y+(D-t.y)*h),n[5]=new THREE.Vector3(t.x+(E-t.x)*h-(p-t.y)*y,t.y+(E-t.x)*y+(p-t.y)*h),n}getGripPoints(){const t=new THREE.Vector3;return new THREE.Line3(this.startPoint,this.endPoint).getCenter(t),[this.startPoint,t,this.endPoint]}moveGripPointsAt(t,r){return 0===t&&this.startPoint.add(r),1===t&&(this.startPoint.add(r),this.endPoint.add(r)),2===t&&this.endPoint.add(r),!0}}MxDbArrow.cmd="Mx_MxDbArrow",MxDbArrow.draw=drawMxDbArrow,addRegisterMxDbEntity(MxDbArrow);export default MxDbArrow;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function drawMxDbCircleArc(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function c(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,c)}s((n=n.apply(t,e||[])).next())})};import MxDbCircleArc from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export default function drawMxDbCircleArc(){const t=new MrxDbgUiPrPoint,e=MxFun.getCurrentDraw(),r=new McEdGetPointWorldDrawObject;let n=new MxDbCircleArc;n.stroke="#ff0000",t.setUserDraw(r),t.setMessage("\n确定圆弧中点:"),t.go(()=>__awaiter(this,void 0,void 0,function*(){n.center=t.value(),r.setDraw(t=>{r.drawLine(n.center,t)}),t.setMessage("\n确定圆弧开始点:"),n.startPoint=(yield t.go())||new THREE.Vector3,r.setDraw(t=>{n.endPoint=t,r.drawCustomEntity(n)}),t.setMessage("\n确定圆弧结束点:"),n.endPoint=(yield t.go())||new THREE.Vector3,r.setDraw(()=>{}),e.addMxEntity(n)}))};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbCircleShape from "../MxDbCircleShape";
|
|
3
|
-
|
|
3
|
+
import drawMxDbCircleArc from "./draw";
|
|
4
|
+
declare class MxDbCircleArc extends MxDbCircleShape {
|
|
5
|
+
static cmd: string;
|
|
6
|
+
static draw: typeof drawMxDbCircleArc;
|
|
4
7
|
/** 根据圆心、起始点、结束点位置动态绘制圆弧 **/
|
|
5
8
|
constructor();
|
|
6
9
|
getTypeName(): string;
|
|
@@ -15,3 +18,4 @@ export default class MxDbCircleArc extends MxDbCircleShape {
|
|
|
15
18
|
getGripPoints(): import("three").Vector3[];
|
|
16
19
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
17
20
|
}
|
|
21
|
+
export default MxDbCircleArc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{calculateArcAngle}from"../../tools/three";import MxDbCircleShape from"../MxDbCircleShape";
|
|
1
|
+
import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import{calculateArcAngle}from"../../tools/three";import MxDbCircleShape from"../MxDbCircleShape";import drawMxDbCircleArc from"./draw";class MxDbCircleArc extends MxDbCircleShape{constructor(){super(),this._propertyDbKeys=[...this._propertyDbKeys,"startPoint","endPoint"]}getTypeName(){return"MxDbCircleArc"}setStartPoint(t){return this.startPoint=t,this}setEndPoint(t){return this.endPoint=t,this}worldDraw(t){let{startPoint:r,endPoint:e}=this;if(r&&(this.startAngle=this.computePointAngle(r)),e&&(this.endAngle=this.computePointAngle(e)),r&&e){const{points:r}=this.drawEllipseShape(t);this.startPoint=r[0]}}computePointAngle(t){return this.radius=this.center.distanceTo(t),THREE.MathUtils.degToRad(calculateArcAngle(t,this.center,this.radius).angle)}getGripPoints(){return[this.center,this.startPoint,this.endPoint]}moveGripPointsAt(t,r){return 0===t?(this.center.add(r),this.startPoint.add(r),this.endPoint.add(r)):1===t?this.startPoint.add(r):2===t&&this.endPoint.add(r),!0}}MxDbCircleArc.cmd="Mx_MxDbCircleArc",MxDbCircleArc.draw=drawMxDbCircleArc,addRegisterMxDbEntity(MxDbCircleArc);export default MxDbCircleArc;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function drawMxDbCloudLine(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import MxDbCloudLine from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export default function drawMxDbCloudLine(){const t=new MrxDbgUiPrPoint,o=MxFun.getCurrentDraw(),e=new McEdGetPointWorldDrawObject;t.setMessage("\n点击开启绘制云线:"),t.go(()=>{const n=MxFun.screenCoordLong2Doc(16);let r=t.value();const i=new MxDbCloudLine;i.setRadius(n),i.addPoint(r),e.setDraw(t=>{r.distanceTo(t)>n&&(r=t.clone(),i.addPoint(t,!0)),e.drawCustomEntity(i)}),t.setUserDraw(e),t.setMessage("\n再次点击结束绘制云线:"),t.go(()=>{o.addMxEntity(i)})})};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/** @module MxDbCloudLine*/
|
|
2
2
|
import McGiWorldDraw from '../McGiWorldDraw';
|
|
3
3
|
import MxDbEntity from '../MxDbEntity';
|
|
4
|
+
import drawMxDbCloudLine from './draw';
|
|
4
5
|
/**
|
|
5
6
|
* MxDbCloudLine 对象. 绘制任意的云线
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
declare class MxDbCloudLine extends MxDbEntity {
|
|
9
|
+
static isRegister: boolean;
|
|
10
|
+
static cmd: string;
|
|
11
|
+
static draw: typeof drawMxDbCloudLine;
|
|
8
12
|
private points;
|
|
9
13
|
private radius;
|
|
10
14
|
private cachePoint;
|
|
@@ -45,3 +49,4 @@ export default class MxDbCloudLine extends MxDbEntity {
|
|
|
45
49
|
dwgIn(obj: any): boolean;
|
|
46
50
|
dwgOut(obj: any): object;
|
|
47
51
|
}
|
|
52
|
+
export default MxDbCloudLine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import MxDbEntity from"../MxDbEntity";import McGiWorldDrawType from"../McGiWorldDrawType";import MxType from"../MxType";const propertyDbKeys=["points","radius"];
|
|
1
|
+
import MxDbEntity from"../MxDbEntity";import McGiWorldDrawType from"../McGiWorldDrawType";import MxType from"../MxType";import drawMxDbCloudLine from"./draw";import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";const propertyDbKeys=["points","radius"];class MxDbCloudLine extends MxDbEntity{constructor(){super(...arguments),this.points=[],this.radius=16,this.cachePoint=null}getTypeName(){return"MxDbCloudLine"}create(){return new MxDbCloudLine}setRadius(t){this.radius=t}getRadius(){return this.radius}getCachePoint(){return this.cachePoint}clacNewArcDiameterPoint(t){if(0==this.points.length)return t;let e=this.points[this.points.length-1];const n=2*this.radius,i=e.distanceTo(t);if(i<n)return null;const r=n*(t.x-e.x)/i+e.x,o=n*(t.y-e.y)/i+e.y;return new THREE.Vector3(r,o,e.z)}createCloudArcCurvePoints(t,e,n){const i=new THREE.Vector3((t.x+e.x)/2,(t.y+e.y)/2,0);n||(n=i.distanceTo(t));const{startAngle:r,endAngle:o}=function(t,e,n){const i=2*Math.PI/360;return{startAngle:180*Math.atan2(e.y-t.y,e.x-t.x)/Math.PI*i,endAngle:180*Math.atan2(n.y-t.y,n.x-t.x)/Math.PI*i}}(i,t,e);return new THREE.ArcCurve(i.x,i.y,n,r,o,!0).getPoints(10)}addPoint(t,e){let n=this.clacNewArcDiameterPoint(t);n&&(this.points.push(n),this.cachePoint=null,e&&(this.cachePoint=this.reCalculateDrawGeometryPoint()))}addLine(t,e){this.addPoint(t);const n=2*this.radius;let i=this.points[this.points.length-1],r=i.distanceTo(e);const o=Math.round(r/n);for(let t=0;t<o;t++){r=i.distanceTo(e);const t=n*(e.x-i.x)/r+i.x,o=n*(e.y-i.y)/r+i.y;let s=new THREE.Vector3(t,o,e.z);this.addPoint(s),i=s}return this.points[this.points.length-1]}reCalculateDrawGeometryPoint(){if(this.points.length<2)return null;let t=this.points[0],e=this.points.length,n=[];for(let i=1;i<e;i++){let e=this.points[i];this.createCloudArcCurvePoints(t,e).forEach(t=>{n.push(new THREE.Vector3(t.x,t.y,0))}),t=e}return n}worldDraw(t){if(this.cachePoint||(this.cachePoint=this.reCalculateDrawGeometryPoint()),this.cachePoint)if(t.getType()===McGiWorldDrawType.kSelectDraw){let e=new THREE.Geometry;this.cachePoint.forEach(t=>{e.vertices.push(new THREE.Vector3(t.x,t.y,0))}),e.computeBoundingBox();const n=new THREE.Vector3;e.boundingBox.getSize(n);let i=new THREE.Vector3;e.boundingBox.getCenter(i);const r=n.x/2,o=n.y/2,s={x:i.x-r,y:i.y-o},a={x:i.x+r,y:i.y-o},c={x:i.x+r,y:i.y+o},h={x:i.x-r,y:i.y+o};t.drawLine(s.x,s.y,a.x,a.y),t.drawLine(a.x,a.y,c.x,c.y),t.drawLine(c.x,c.y,h.x,h.y),t.drawLine(h.x,h.y,s.x,s.y)}else t.drawLines(this.cachePoint)}getCenter(){const t=new THREE.Geometry;t.vertices=this.points;let e=new THREE.Vector3;return t.computeBoundingBox(),t.boundingBox.getCenter(e),e}getGripPoints(){return[this.getCenter()]}moveGripPointsAt(t,e){return this.points.forEach(t=>{t.add(e)}),this.cachePoint=null,!0}dwgIn(t){return this.onDwgIn(t),this.dwgInHelp(t,propertyDbKeys),this.cachePoint=null,!0}dwgOut(t){return this.onDwgOut(t),this.dwgOutHelp(t,propertyDbKeys),t.type===MxType.MxCloneType.kSaveDwgClone&&this.dwgOutHelp(t,["cachePoint"]),t}}MxDbCloudLine.isRegister=!1,MxDbCloudLine.cmd="Mx_CloudLine",MxDbCloudLine.draw=drawMxDbCloudLine,addRegisterMxDbEntity(MxDbCloudLine);export default MxDbCloudLine;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function drawMxDbCoord(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import MxDbCoord from".";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export default function drawMxDbCoord(){const o=new MrxDbgUiPrPoint;o.setMessage("\n指定坐标点:"),o.go(t=>{if(0!=t)return;const e=o.value();let r=new MxDbCoord;r.point1=e,r.point2=e.clone(),o.setBasePt(e),o.setUseBasePt(!0),o.setUserDraw((o,t)=>{r.point2=o,t.drawCustomEntity(r)}),o.setMessage("\n指定标注点:"),o.go(t=>{0==t?(r.point2=o.value(),MxFun.addToCurrentSpace(r)):console.log(t)})})};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
/** @module MxDbCoord*/
|
|
2
1
|
import McGiWorldDraw from '../McGiWorldDraw';
|
|
3
2
|
import MxDbEntity from '../MxDbEntity';
|
|
3
|
+
import drawMxDbCoord from './draw';
|
|
4
4
|
/**
|
|
5
5
|
* MxDbCoord 引线坐标测量
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
declare class MxDbCoord extends MxDbEntity {
|
|
8
|
+
static cmd: string;
|
|
9
|
+
static draw: typeof drawMxDbCoord;
|
|
8
10
|
/** 测量点位置 */
|
|
9
11
|
point1: THREE.Vector3;
|
|
10
12
|
/** 测量结果显示位置 */
|
|
@@ -18,3 +20,4 @@ export default class MxDbCoord extends MxDbEntity {
|
|
|
18
20
|
transformBy(mat: THREE.Matrix4): void;
|
|
19
21
|
getTypeName(): string;
|
|
20
22
|
}
|
|
23
|
+
export default MxDbCoord;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import MxDbEntity from"../MxDbEntity";
|
|
1
|
+
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function drawMxDbEllipse(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import MxDbEllipse from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export default function drawMxDbEllipse(){const t=new MrxDbgUiPrPoint,r=MxFun.getCurrentDraw(),e=new McEdGetPointWorldDrawObject,o=new MxDbEllipse;t.setMessage("\n点击开始绘制椭圆:"),t.go(()=>{o.point1=t.value(),e.setDraw(t=>{o.point2=t,e.drawCustomEntity(o)}),t.setUserDraw(e),t.setMessage("\n再次点击结束绘制椭圆:"),t.go(()=>{r.addMxEntity(o)})})};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbEllipseShape from "../MxDbEllipseShape";
|
|
3
|
+
import drawMxDbEllipse from "./draw";
|
|
3
4
|
/** 通过两个构成矩形的点绘制椭圆形 */
|
|
4
|
-
|
|
5
|
+
declare class MxDbEllipse extends MxDbEllipseShape {
|
|
6
|
+
static cmd: string;
|
|
7
|
+
static draw: typeof drawMxDbEllipse;
|
|
5
8
|
constructor();
|
|
6
9
|
getTypeName(): string;
|
|
7
10
|
create(): MxDbEllipse;
|
|
@@ -17,3 +20,4 @@ export default class MxDbEllipse extends MxDbEllipseShape {
|
|
|
17
20
|
getGripPoints(): THREE.Vector3[];
|
|
18
21
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
19
22
|
}
|
|
23
|
+
export default MxDbEllipse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbEllipseShape from"../MxDbEllipseShape";
|
|
1
|
+
import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbEllipseShape from"../MxDbEllipseShape";import drawMxDbEllipse from"./draw";class MxDbEllipse extends MxDbEllipseShape{constructor(){super(),this.point1=new THREE.Vector3,this.point2=new THREE.Vector3,this.isClosedToCenter=!1,this.closed=!1,this._propertyDbKeys=[...this._propertyDbKeys,"point1","point2"]}getTypeName(){return"MxDbEllipse"}create(){return new MxDbEllipse}setPoint1(t){return this.point1=t,this}setPoint2(t){return this.point2=t,this}worldDraw(t){const{point1:i,point2:e}=this,s=i.clone().set(e.x,i.y,e.z),r=e.clone().set(i.x,e.y,i.z);this.xRadius=i.distanceTo(s)/2,this.yRadius=i.distanceTo(r)/2;const o=i.x>e.x,p=i.y>e.y,n=o?i.x-this.xRadius:i.x+this.xRadius,l=p?i.y-this.yRadius:i.y+this.yRadius;this.center=new THREE.Vector3(n,l,0),this.drawEllipseShape(t),t.getType()===McGiWorldDrawType.kSelectDraw&&t.drawLines([i,new THREE.Vector3(i.x,e.y),e,new THREE.Vector3(e.x,i.y),i])}getGripPoints(){let t=new THREE.Vector3(.5*(this.point2.x+this.point1.x),.5*(this.point2.y+this.point1.y),0);return[this.point1,this.point2,t]}moveGripPointsAt(t,i){return 0===t?this.point1.add(i):1===t?this.point2.add(i):2===t&&(this.point1.add(i),this.point2.add(i)),!0}}MxDbEllipse.cmd="Mx_Ellipse",MxDbEllipse.draw=drawMxDbEllipse,addRegisterMxDbEntity(MxDbEllipse);export default MxDbEllipse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function drawMxDbEllipseArc(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,n,r,e){return new(r||(r=Promise))(function(i,o){function a(t){try{d(e.next(t))}catch(t){o(t)}}function c(t){try{d(e.throw(t))}catch(t){o(t)}}function d(t){var n;t.done?i(t.value):(n=t.value,n instanceof r?n:new r(function(t){t(n)})).then(a,c)}d((e=e.apply(t,n||[])).next())})};import MxDbEllipseArc from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export default function drawMxDbEllipseArc(){const t=new MrxDbgUiPrPoint,n=MxFun.getCurrentDraw(),r=new McEdGetPointWorldDrawObject;let e=new MxDbEllipseArc;t.setUserDraw(r),t.go(()=>__awaiter(this,void 0,void 0,function*(){e.center=t.value(),r.setDraw((t,n)=>{e.startPoint=t,e.yRadius=e.center.distanceTo(t),n.drawCustomEntity(e)}),e.startPoint=(yield t.go())||new THREE.Vector3,r.setDraw((t,n)=>{e.endPoint=t,n.drawCustomEntity(e)}),e.endPoint=(yield t.go())||new THREE.Vector3,n.addMxEntity(e)}))};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbEllipseShape from "../MxDbEllipseShape";
|
|
3
|
-
|
|
3
|
+
import drawMxDbEllipseArc from "./draw";
|
|
4
|
+
/**
|
|
5
|
+
* 根据中心点、椭圆开始点和结束点确定椭圆弧
|
|
6
|
+
* */
|
|
7
|
+
declare class MxDbEllipseArc extends MxDbEllipseShape {
|
|
8
|
+
static cmd: string;
|
|
9
|
+
static draw: typeof drawMxDbEllipseArc;
|
|
4
10
|
getTypeName(): string;
|
|
5
|
-
/**
|
|
6
|
-
* 根据中心点、椭圆开始点和结束点确定椭圆弧
|
|
7
|
-
* */
|
|
8
11
|
constructor();
|
|
9
12
|
/** 椭圆弧决定开始点 控制x轴半径和开始角度 */
|
|
10
13
|
startPoint: THREE.Vector3;
|
|
@@ -12,10 +15,8 @@ export default class MxDbEllipseArc extends MxDbEllipseShape {
|
|
|
12
15
|
/** 椭圆弧决定结束点 控制y轴半径和结束角度*/
|
|
13
16
|
endPoint: THREE.Vector3;
|
|
14
17
|
setEndPoint(endPoint: THREE.Vector3): this;
|
|
15
|
-
/** 控制椭圆弧旋转角度的点 */
|
|
16
|
-
rotationPoint: THREE.Vector3;
|
|
17
|
-
setRotationPoint(rotationPoint: THREE.Vector3): this;
|
|
18
18
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
19
19
|
getGripPoints(): import("three").Vector3[];
|
|
20
20
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
21
21
|
}
|
|
22
|
+
export default MxDbEllipseArc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{calculateArcAngle}from"../../tools/three";import MxDbEllipseShape from"../MxDbEllipseShape";
|
|
1
|
+
import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import{calculateArcAngle}from"../../tools/three";import MxDbEllipseShape from"../MxDbEllipseShape";import drawMxDbEllipseArc from"./draw";class MxDbEllipseArc extends MxDbEllipseShape{constructor(){super(),this._propertyDbKeys=[...this._propertyDbKeys,"startPoint","endPoint"]}getTypeName(){return"MxDbEllipseArc"}setStartPoint(t){return this.startPoint=t,this}setEndPoint(t){return this.endPoint=t,this}worldDraw(t){let{center:e,startPoint:i,endPoint:s}=this;i&&(this.xRadius=e.distanceTo(i),this.startAngle=THREE.MathUtils.degToRad(calculateArcAngle(i,e,this.xRadius).angle)),s&&(this.yRadius=e.distanceTo(s),this.endAngle=THREE.MathUtils.degToRad(calculateArcAngle(s,e,this.yRadius).angle)),this.drawEllipseShape(t)}getGripPoints(){return[this.center,this.startPoint,this.endPoint]}moveGripPointsAt(t,e){return 0===t&&(this.center.add(e),this.startPoint.add(e),this.endPoint.add(e)),1===t&&this.startPoint.add(e),2===t&&this.endPoint.add(e),!0}}MxDbEllipseArc.cmd="Mx_MxDbEllipseArc",MxDbEllipseArc.draw=drawMxDbEllipseArc,addRegisterMxDbEntity(MxDbEllipseArc);export default MxDbEllipseArc;
|
|
@@ -32,6 +32,17 @@ export declare const MXDBDATATYPE = "datatype";
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
export default abstract class MxDbEntity {
|
|
35
|
+
constructor();
|
|
36
|
+
/** 该类注册的cmd命令名称 */
|
|
37
|
+
static cmd: string;
|
|
38
|
+
/** 该类注册的cmd命令绘制函数 */
|
|
39
|
+
static draw: Function;
|
|
40
|
+
/** 该类是否已注册 */
|
|
41
|
+
static isRegister: boolean;
|
|
42
|
+
/** 注册该类的cmd命令和初始化 (引入该类时自动注册 当该类的isRegister为ture时表示已经注册) */
|
|
43
|
+
static register(): void;
|
|
44
|
+
/** 使用该类的cmd命令 执行默认的绘制功能 */
|
|
45
|
+
static use(): Promise<void>;
|
|
35
46
|
/**
|
|
36
47
|
* 颜色值
|
|
37
48
|
* */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _ from"lodash";import MxType from"../MxType";import store from"../store";export var DataType;!function(t){t[t.Default=0]="Default",t[t.Color=1]="Color",t[t.Vector2=2]="Vector2",t[t.Vector3=3]="Vector3",t[t.Vector4=4]="Vector4",t[t.Matrix3=5]="Matrix3",t[t.Matrix4=6]="Matrix4"}(DataType||(DataType={}));export const MXDBDATATYPE="datatype";const propertyDbKeys=["color","renderOrder","opacity","visible","userData","sGuid","dLineWidth","lineWidthByPixels","dDashArray","dDashRatio","layer"];function getDwgKeyVal(t,e){let i,r="";return _.isObject(e)?(i=e.default,r=e.key):"string"==typeof e&&(r=e),[r,void 0===t[r]?i:t[r]]}export default class MxDbEntity{constructor(){this.color=16777215,this.renderOrder=30,this.opacity=1,this.visible=!0,this.userData={},this.sGuid="",this.dLineWidth=0,this.lineWidthByPixels=!0,this.dDashArray=0,this.dDashRatio=0,this.layer="",this._event={}}initGuid(t){this.sGuid.length>0?console.log("mx: init guid error"):this.sGuid=t}dwgInHelp(t,e,i){let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone||t.type===MxType.MxCloneType.kSaveDwgClone,a=t=>{if(!t)return;const{value:e,[MXDBDATATYPE]:r}=t;switch(r){case DataType.Color:return new THREE.Color(...e);case DataType.Vector2:return new THREE.Vector2(...e);case DataType.Vector3:return new THREE.Vector3(...e);case DataType.Vector4:return new THREE.Vector4(...e);case DataType.Matrix3:return(new THREE.Matrix3).fromArray(e);case DataType.Matrix4:return(new THREE.Matrix4).fromArray(e)}return i&&i.getCacheVal?i.getCacheVal(t):void 0};function n(t){return t instanceof THREE.Color||t instanceof THREE.Vector2||t instanceof THREE.Vector3||t instanceof THREE.Vector4||t instanceof THREE.Matrix3||t instanceof THREE.Matrix4?t.clone():i&&i.getVal?i.getVal(t):void 0}return e.forEach(e=>{const[i,o]=getDwgKeyVal(t,e);r[i]=_.cloneDeepWith(o,s?a:n)}),!0}dwgOutHelp(t,e){const i=t=>t instanceof THREE.Color?{[MXDBDATATYPE]:DataType.Color,value:t.toArray()}:t instanceof THREE.Vector2?{[MXDBDATATYPE]:DataType.Vector2,value:t.toArray()}:t instanceof THREE.Vector3?{[MXDBDATATYPE]:DataType.Vector3,value:t.toArray()}:t instanceof THREE.Vector4?{[MXDBDATATYPE]:DataType.Vector4,value:t.toArray()}:t instanceof THREE.Matrix3?{[MXDBDATATYPE]:DataType.Matrix3,value:t.toArray()}:t instanceof THREE.Matrix4?{[MXDBDATATYPE]:DataType.Matrix4,value:t.toArray()}:void 0;let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone||t.type===MxType.MxCloneType.kSaveDwgClone;return e.forEach(e=>{const[a,n]=getDwgKeyVal(r,e);t[a]=s?_.cloneDeepWith(n,i):n}),t}callEvent(t,e){return void 0!=this._event[t]?this._event[t](e):void 0}create(t){return new(0,this.constructor)(t)}transformBy(t){}getGeomExtents(){return null}getClosestPointTo(t,e=0){return null}getImp(){return this.MxDbEntityImp}setNeedUpdateDisplay(t){let e=this.getImp();return!!e&&(t?e.upDisplay():e.setDirtyDisplay(!0),!0)}getMxObject(){let t=this.getImp();return t?t.getMxObject():null}onViewChange(){return!1}objectId(){let t=this.getImp();return t?t.objectId():0}erase(){let t=this.getImp();return!!t&&t.erase()}setLayer(t){let e=this.getImp();e&&e.nodifySetLayer(),this.layer=t}getLayer(){return this.layer}setColor(t){return this.color=t,this}getColor(){return this.color||16777215}clone(t){let e=this.create(),i={type:t||MxType.MxCloneType.kClone};return this.dwgOut(i),e.dwgIn(i),e.sGuid="",e}onDwgIn(t){this.color=t.color,this.renderOrder=t.renderOrder,this.opacity=t.opacity,this.visible=t.visible,t.userData?this.userData=JSON.parse(JSON.stringify(t.userData)):this.userData={},this.dLineWidth=t.lineWidth,this.lineWidthByPixels=t.lineWidthByPixels,this.dDashArray=t.dashArray,this.dDashRatio=t.dashRatio,this.layer=t.layer,t.guid&&(this.sGuid=t.guid)}onDwgOut(t){t.color=this.color,t.renderOrder=this.renderOrder,t.opacity=this.opacity,t.visible=this.visible,t.lineWidth=this.dLineWidth,t.lineWidthByPixels=this.lineWidthByPixels,t.dashArray=this.dDashArray,t.dashRatio=this.dDashRatio,t.layer=this.layer,t.guid=this.sGuid,Object.keys(this.userData).length>0&&(t.userData=this.userData)}rxInit(){store.state.MxFun.initMxDbEntityType(this)}setRenderOrder(t){this.renderOrder=t}getRenderOrder(){return this.renderOrder}setLineWidthByPixels(t){return this.lineWidthByPixels=t,this}getLineWidthByPixels(){return this.lineWidthByPixels}setLineWidth(t){return this.dLineWidth=t,this}getLineWidth(){return this.dLineWidth}getGetLength(){return 0}setDashLen(t){let e=this.getGetLength();if(e<1e-6||t<1e-6)return this;let i=Math.floor(e/t);return i<1e-6&&(this.dDashRatio=0),this.dDashArray=1/i,this}setDashRatio(t){return this.dDashRatio=t,this}setDashArray(t){return this.dDashArray=t,this}setDash(t,e){return this.dDashArray=t,this.dDashRatio=e,0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0),this}getDash(){return{dDashArray:this.dDashArray,dDashRatio:this.dDashRatio}}setDashLineDisplay(t){return t?(this.dDashArray<1e-5&&(this.dDashArray=.03),this.dDashRatio<1e-5&&(this.dDashRatio=.1),0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0)):(this.dDashArray=0,this.dDashRatio=0),this}isDashLineDisplay(){return this.dDashArray>0&&this.dDashRatio>0}guid(){return this.sGuid}onEndGripEidt(){this.callEvent("onEndGripEidt")}onStartGripEidt(){return this.callEvent("onStartGripEidt")}addEvent(t,e){this._event[t]=e}removeEvent(t){this._event[t]=void 0}toJsonString(t=MxType.MxCloneType.kMxFileClone){let e={type:t};return this.dwgOut(e),e.TypeName=this.getTypeName(),JSON.stringify(e)}fromJsonString(t){let e=JSON.parse(t);return(e.type==MxType.MxCloneType.kMxFileClone||e.type==MxType.MxCloneType.kClone)&&this.dwgIn(e)}};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))(function(s,a){function n(t){try{h(r.next(t))}catch(t){a(t)}}function o(t){try{h(r.throw(t))}catch(t){a(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,o)}h((r=r.apply(t,e||[])).next())})};import _ from"lodash";import MxFun from"../MxFun";import MxPaintBrush from"../MxPaintBrush";import MxType from"../MxType";import store from"../store";export var DataType;!function(t){t[t.Default=0]="Default",t[t.Color=1]="Color",t[t.Vector2=2]="Vector2",t[t.Vector3=3]="Vector3",t[t.Vector4=4]="Vector4",t[t.Matrix3=5]="Matrix3",t[t.Matrix4=6]="Matrix4"}(DataType||(DataType={}));export const MXDBDATATYPE="datatype";const propertyDbKeys=["color","renderOrder","opacity","visible","userData","sGuid","dLineWidth","lineWidthByPixels","dDashArray","dDashRatio","layer"];function getDwgKeyVal(t,e){let i,r="";return _.isObject(e)?(i=e.default,r=e.key):"string"==typeof e&&(r=e),[r,void 0===t[r]?i:t[r]]}export default class MxDbEntity{constructor(){this.color=16777215,this.renderOrder=30,this.opacity=1,this.visible=!0,this.userData={},this.sGuid="",this.dLineWidth=0,this.lineWidthByPixels=!0,this.dDashArray=0,this.dDashRatio=0,this.layer="",this._event={};const t=this.constructor;t.isPaintBrushDraw&&(MxPaintBrush.use(this),t.isPaintBrushDraw=!1)}static register(){const t=this;t.isRegister||(t.cmd&&t.draw&&MxFun.addCommand(t.cmd,t.draw),(new t).rxInit(),t.isRegister=!0)}static use(){return __awaiter(this,void 0,void 0,function*(){this.register(),this.isPaintBrushDraw=!0,this.cmd&&MxFun.sendStringToExecute(this.cmd)})}initGuid(t){this.sGuid.length>0?console.log("mx: init guid error"):this.sGuid=t}dwgInHelp(t,e,i){let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone||t.type===MxType.MxCloneType.kSaveDwgClone,a=t=>{if(!t)return;const{value:e,[MXDBDATATYPE]:r}=t;switch(r){case DataType.Color:return new THREE.Color(...e);case DataType.Vector2:return new THREE.Vector2(...e);case DataType.Vector3:return new THREE.Vector3(...e);case DataType.Vector4:return new THREE.Vector4(...e);case DataType.Matrix3:return(new THREE.Matrix3).fromArray(e);case DataType.Matrix4:return(new THREE.Matrix4).fromArray(e)}return i&&i.getCacheVal?i.getCacheVal(t):void 0};function n(t){return t instanceof THREE.Color||t instanceof THREE.Vector2||t instanceof THREE.Vector3||t instanceof THREE.Vector4||t instanceof THREE.Matrix3||t instanceof THREE.Matrix4?t.clone():i&&i.getVal?i.getVal(t):void 0}return e.forEach(e=>{const[i,o]=getDwgKeyVal(t,e);r[i]=_.cloneDeepWith(o,s?a:n)}),!0}dwgOutHelp(t,e){const i=t=>t instanceof THREE.Color?{[MXDBDATATYPE]:DataType.Color,value:t.toArray()}:t instanceof THREE.Vector2?{[MXDBDATATYPE]:DataType.Vector2,value:t.toArray()}:t instanceof THREE.Vector3?{[MXDBDATATYPE]:DataType.Vector3,value:t.toArray()}:t instanceof THREE.Vector4?{[MXDBDATATYPE]:DataType.Vector4,value:t.toArray()}:t instanceof THREE.Matrix3?{[MXDBDATATYPE]:DataType.Matrix3,value:t.toArray()}:t instanceof THREE.Matrix4?{[MXDBDATATYPE]:DataType.Matrix4,value:t.toArray()}:void 0;let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone||t.type===MxType.MxCloneType.kSaveDwgClone;return e.forEach(e=>{const[a,n]=getDwgKeyVal(r,e);t[a]=s?_.cloneDeepWith(n,i):n}),t}callEvent(t,e){return void 0!=this._event[t]?this._event[t](e):void 0}create(t){return new(0,this.constructor)(t)}transformBy(t){}getGeomExtents(){return null}getClosestPointTo(t,e=0){return null}getImp(){return this.MxDbEntityImp}setNeedUpdateDisplay(t){let e=this.getImp();return!!e&&(t?e.upDisplay():e.setDirtyDisplay(!0),!0)}getMxObject(){let t=this.getImp();return t?t.getMxObject():null}onViewChange(){return!1}objectId(){let t=this.getImp();return t?t.objectId():0}erase(){let t=this.getImp();return!!t&&t.erase()}setLayer(t){let e=this.getImp();e&&e.nodifySetLayer(),this.layer=t}getLayer(){return this.layer}setColor(t){return this.color=t,this}getColor(){return this.color||16777215}clone(t){let e=this.create(),i={type:t||MxType.MxCloneType.kClone};return this.dwgOut(i),e.dwgIn(i),e.sGuid="",e}onDwgIn(t){this.color=t.color,this.renderOrder=t.renderOrder,this.opacity=t.opacity,this.visible=t.visible,t.userData?this.userData=JSON.parse(JSON.stringify(t.userData)):this.userData={},this.dLineWidth=t.lineWidth,this.lineWidthByPixels=t.lineWidthByPixels,this.dDashArray=t.dashArray,this.dDashRatio=t.dashRatio,this.layer=t.layer,t.guid&&(this.sGuid=t.guid)}onDwgOut(t){t.color=this.color,t.renderOrder=this.renderOrder,t.opacity=this.opacity,t.visible=this.visible,t.lineWidth=this.dLineWidth,t.lineWidthByPixels=this.lineWidthByPixels,t.dashArray=this.dDashArray,t.dashRatio=this.dDashRatio,t.layer=this.layer,t.guid=this.sGuid,Object.keys(this.userData).length>0&&(t.userData=this.userData)}rxInit(){store.state.MxFun.initMxDbEntityType(this)}setRenderOrder(t){this.renderOrder=t}getRenderOrder(){return this.renderOrder}setLineWidthByPixels(t){return this.lineWidthByPixels=t,this}getLineWidthByPixels(){return this.lineWidthByPixels}setLineWidth(t){return this.dLineWidth=t,this}getLineWidth(){return this.dLineWidth}getGetLength(){return 0}setDashLen(t){let e=this.getGetLength();if(e<1e-6||t<1e-6)return this;let i=Math.floor(e/t);return i<1e-6&&(this.dDashRatio=0),this.dDashArray=1/i,this}setDashRatio(t){return this.dDashRatio=t,this}setDashArray(t){return this.dDashArray=t,this}setDash(t,e){return this.dDashArray=t,this.dDashRatio=e,0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0),this}getDash(){return{dDashArray:this.dDashArray,dDashRatio:this.dDashRatio}}setDashLineDisplay(t){return t?(this.dDashArray<1e-5&&(this.dDashArray=.03),this.dDashRatio<1e-5&&(this.dDashRatio=.1),0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0)):(this.dDashArray=0,this.dDashRatio=0),this}isDashLineDisplay(){return this.dDashArray>0&&this.dDashRatio>0}guid(){return this.sGuid}onEndGripEidt(){this.callEvent("onEndGripEidt")}onStartGripEidt(){return this.callEvent("onStartGripEidt")}addEvent(t,e){this._event[t]=e}removeEvent(t){this._event[t]=void 0}toJsonString(t=MxType.MxCloneType.kMxFileClone){let e={type:t};return this.dwgOut(e),e.TypeName=this.getTypeName(),JSON.stringify(e)}fromJsonString(t){let e=JSON.parse(t);return(e.type==MxType.MxCloneType.kMxFileClone||e.type==MxType.MxCloneType.kClone)&&this.dwgIn(e)}};MxDbEntity.isRegister=!1;
|