build-dxf 0.0.20 → 0.0.21

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.
Files changed (41) hide show
  1. package/README.md +3 -0
  2. package/package.json +6 -4
  3. package/src/build.d.ts +6 -0
  4. package/src/build.js +1404 -1915
  5. package/src/index.css +1 -641
  6. package/src/index.js +7 -7
  7. package/src/index2.js +327 -528
  8. package/src/index3.js +1951 -1714
  9. package/src/selectLocalFile.js +1960 -3145
  10. package/src/utils/CommandManager/CommandFlow.d.ts +17 -0
  11. package/src/utils/CommandManager/CommandManager.d.ts +23 -0
  12. package/src/utils/DxfSystem/components/AngleCorrectionDxf.d.ts +10 -0
  13. package/src/utils/DxfSystem/components/Dxf.d.ts +36 -5
  14. package/src/utils/DxfSystem/components/LineAnalysis.d.ts +3 -1
  15. package/src/utils/DxfSystem/index.d.ts +2 -0
  16. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/ClippingLine.d.ts +45 -0
  17. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/CommandFlowComponent.d.ts +4 -1
  18. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/ConnectionLine.d.ts +33 -0
  19. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/Default.d.ts +0 -20
  20. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DeleteSelectLine.d.ts +28 -0
  21. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DeleteSelectWindow.d.ts +33 -0
  22. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawDoorLine.d.ts +22 -4
  23. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawLine.d.ts +20 -4
  24. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawWindow.d.ts +25 -2
  25. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/IntersectionConnectionLine.d.ts +33 -0
  26. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/MergeLine.d.ts +33 -0
  27. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/PointDrag.d.ts +14 -1
  28. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/SelectAll.d.ts +30 -0
  29. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalCorrection copy.d.ts +82 -0
  30. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalCorrection.d.ts +75 -0
  31. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalReferenceLine.d.ts +21 -0
  32. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/ViewAngle.d.ts +21 -0
  33. package/src/utils/DxfSystem/plugin/Editor/components/Editor.d.ts +4 -1
  34. package/src/utils/DxfSystem/plugin/Editor/components/RenderManager.d.ts +4 -1
  35. package/src/utils/DxfSystem/plugin/Editor/components/index.d.ts +1 -0
  36. package/src/utils/DxfSystem/plugin/RenderPlugin/components/Renderer.d.ts +3 -0
  37. package/src/utils/PointVirtualGrid/index.d.ts +8 -0
  38. package/src/utils/Quadtree/LineSegment.d.ts +34 -1
  39. package/src/utils/Quadtree/Point.d.ts +9 -2
  40. package/src/utils/Quadtree/Quadtree.d.ts +1 -1
  41. package/src/utils/deepClone.d.ts +6 -0
@@ -0,0 +1,82 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ import { LineSegment } from '../../../../../Quadtree/LineSegment';
4
+ import { Point } from '../../../../../Quadtree/Point';
5
+ import * as THREE from "three";
6
+ /**
7
+ * 垂直纠正
8
+ */
9
+ export declare class VerticalCorrection extends CommandFlowComponent<{}> {
10
+ static name: string;
11
+ container: THREE.Group<THREE.Object3DEventMap>;
12
+ shortcutKeys: string[];
13
+ shortcutKeys2: string[];
14
+ static commandName: string;
15
+ recursion: boolean;
16
+ onAddFromParent(parent: ComponentManager): void;
17
+ /**
18
+ * 进入命令约束
19
+ */
20
+ constraint(next: any, selectLines: LineSegment[]): void;
21
+ /**
22
+ * 线段是否为结尾线段
23
+ * @param line
24
+ */
25
+ lineIsPathEnd(line: LineSegment): boolean;
26
+ /**
27
+ *
28
+ * @param line0
29
+ * @param line1
30
+ */
31
+ isTowLineSegmentConnect(line0: LineSegment, line1: LineSegment): boolean;
32
+ /**
33
+ * 获取所有相同点的位置信息
34
+ * @param point
35
+ * @param point2
36
+ */
37
+ getSamePointAll(point: Point, line: LineSegment): {
38
+ queryList: {
39
+ point: Point;
40
+ userData?: LineSegment<import('..').LineUserData> | undefined;
41
+ }[];
42
+ parallelList: {
43
+ point: Point;
44
+ userData?: LineSegment<import('..').LineUserData> | undefined;
45
+ }[];
46
+ };
47
+ /**
48
+ *
49
+ * @param line
50
+ * @param point
51
+ * @param newPoint
52
+ */
53
+ setLinePoint(line: LineSegment, newStartPoint?: Point, newEndPoint?: Point, mode?: "start" | "end" | "all", record?: any[]): void;
54
+ /** 修正2
55
+ * 第一步:确定需要修复的线段
56
+ * 第二步:查找与该线段相交的其他线段
57
+ * 第三步:找出两端点相交的线段,其他为区间相交
58
+ * 第四步:修正相交的线段的另一个端点
59
+ * 第五步:判断是否有方向一致的线段,有就调整,调整方法:查找连续平行的线段,求点在线段方向的投影,直到不平行的线段结束
60
+ * 第六步: 中间线段采用投影修正
61
+ * @param targettLine
62
+ * @param vistedList
63
+ */
64
+ correction(targettLine: LineSegment, entryPoint?: Point, resultList?: any[], vistedList?: Set<LineSegment | Point>): any[] | undefined;
65
+ /** 开始
66
+ * @param next
67
+ */
68
+ verticalCorrection(next: any, selectLines: LineSegment[]): void;
69
+ /** 执行完成
70
+ * @param data
71
+ */
72
+ private completed;
73
+ /** 回滚操作
74
+ * @param data
75
+ */
76
+ private rollback;
77
+ /** 撤回回滚
78
+ * @param lines
79
+ * @returns
80
+ */
81
+ private revokeRollback;
82
+ }
@@ -0,0 +1,75 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ import { LineSegment } from '../../../../../Quadtree/LineSegment';
4
+ import { Point } from '../../../../../Quadtree/Point';
5
+ import { LineUserData } from '../RenderManager';
6
+ import * as THREE from "three";
7
+ /**
8
+ * 垂直纠正
9
+ */
10
+ export declare class VerticalCorrection extends CommandFlowComponent<{}> {
11
+ static name: string;
12
+ container: THREE.Group<THREE.Object3DEventMap>;
13
+ shortcutKeys: string[];
14
+ shortcutKeys2: string[];
15
+ static commandName: string;
16
+ recursion: boolean;
17
+ onAddFromParent(parent: ComponentManager): void;
18
+ /**
19
+ * 进入命令约束
20
+ */
21
+ constraint(next: any, selectLines: LineSegment[]): void;
22
+ /**
23
+ * 线段是否为结尾线段
24
+ * @param line
25
+ */
26
+ lineIsPathEnd(line: LineSegment): boolean;
27
+ /**
28
+ *
29
+ * @param line0
30
+ * @param line1
31
+ */
32
+ isTowLineSegmentConnect(line0: LineSegment, line1: LineSegment): boolean;
33
+ /**
34
+ *
35
+ * @param line
36
+ * @param newStartPoint
37
+ * @param newEndPoint
38
+ * @param mode 需要匹配的点
39
+ * @param record
40
+ * @param id
41
+ * @returns
42
+ */
43
+ setLinePoint(line: LineSegment, newStartPoint: Point, newEndPoint: Point, mode?: "start" | "end" | "all" | "none", resultList?: any[], id?: string): {
44
+ point: Point;
45
+ userData?: LineSegment<LineUserData>;
46
+ }[];
47
+ /** 修正2
48
+ * 第一步:确定需要修复的线段
49
+ * 第二步:查找与该线段相交的其他线段
50
+ * 第三步:找出两端点相交的线段,其他为区间相交
51
+ * 第四步:修正相交的线段的另一个端点
52
+ * 第五步:判断是否有方向一致的线段,有就调整,调整方法:查找连续平行的线段,求点在线段方向的投影,直到不平行的线段结束
53
+ * 第六步: 中间线段采用投影修正
54
+ * @param targettLine
55
+ * @param vistedList
56
+ */
57
+ correction(targettLine: LineSegment, resultList?: any[], vistedList?: Set<LineSegment>): any[];
58
+ /** 开始
59
+ * @param next
60
+ */
61
+ verticalCorrection(next: any, selectLines: LineSegment[]): void;
62
+ /** 执行完成
63
+ * @param data
64
+ */
65
+ private completed;
66
+ /** 回滚操作
67
+ * @param data
68
+ */
69
+ private rollback;
70
+ /** 撤回回滚
71
+ * @param lines
72
+ * @returns
73
+ */
74
+ private revokeRollback;
75
+ }
@@ -0,0 +1,21 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ /**
4
+ * 设置y轴垂直基准线段
5
+ */
6
+ export declare class VerticalReferenceLine extends CommandFlowComponent<{}> {
7
+ static name: string;
8
+ shortcutKeys: string[];
9
+ static commandName: string;
10
+ onAddFromParent(parent: ComponentManager): void;
11
+ /**
12
+ * 进入命令约束
13
+ */
14
+ private constraint;
15
+ /**
16
+ *
17
+ * @param next
18
+ * @param selectLines
19
+ */
20
+ private verticalReferenceLine;
21
+ }
@@ -0,0 +1,21 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ /**
4
+ * 合并同向线段
5
+ */
6
+ export declare class ViewAngle extends CommandFlowComponent<{}> {
7
+ static name: string;
8
+ shortcutKeys: string[];
9
+ static commandName: string;
10
+ onAddFromParent(parent: ComponentManager): void;
11
+ /**
12
+ * 进入命令约束
13
+ */
14
+ private constraint;
15
+ /**
16
+ *
17
+ * @param next
18
+ * @param selectLines
19
+ */
20
+ private viewAngle;
21
+ }
@@ -5,6 +5,7 @@ import { DomContainer, DomEventRegister, EventInput, Renderer } from '../../Rend
5
5
  import { RenderManager } from './RenderManager';
6
6
  import { CommandManager } from '../../../../CommandManager';
7
7
  import { App } from 'vue';
8
+ import { DxfSystem } from '../../../../../build';
8
9
  import * as THREE from "three";
9
10
  export declare class Editor extends Component<{
10
11
  pointerPositionChange: {
@@ -26,8 +27,10 @@ export declare class Editor extends Component<{
26
27
  app?: App<Element>;
27
28
  domElement: HTMLDivElement;
28
29
  viewPermission?: "admin";
30
+ imgEl: HTMLImageElement;
31
+ imgWidth: number;
29
32
  constructor(viewPermission?: "admin");
30
- onAddFromParent(): void;
33
+ onAddFromParent(parent: DxfSystem): void;
31
34
  /**
32
35
  * 取消命令,由其他命令组件监听事件后注册事件监听实现
33
36
  */
@@ -12,11 +12,13 @@ export type LineUserData = {
12
12
  doorDirectConnection?: boolean;
13
13
  isDoor?: boolean;
14
14
  isWindow?: boolean;
15
- drawDoorData?: {
15
+ isVerticalReferenceLine?: boolean;
16
+ drawWindow?: {
16
17
  p: THREE.Vector3;
17
18
  width: number;
18
19
  full: boolean;
19
20
  }[];
21
+ drawDoorData?: any;
20
22
  quadtreeNode?: QuadtreeNode;
21
23
  };
22
24
  export declare class RenderManager extends Component<{}> {
@@ -29,6 +31,7 @@ export declare class RenderManager extends Component<{}> {
29
31
  type: "addLine" | "removeLine";
30
32
  data: any;
31
33
  }>;
34
+ verticalReferenceLineFlag: THREE.Mesh<THREE.PlaneGeometry, THREE.MeshBasicMaterial, THREE.Object3DEventMap>;
32
35
  onAddFromParent(): void;
33
36
  private updatedMode;
34
37
  /** 重新设置数据
@@ -4,3 +4,4 @@ export * from './CommandFlow/Default';
4
4
  export * from './CommandFlow/DrawDoorLine';
5
5
  export * from './CommandFlow/DrawLine';
6
6
  export * from './CommandFlow/DrawWindow';
7
+ export * from './CommandFlow/VerticalCorrection';
@@ -46,8 +46,11 @@ export declare class Renderer extends Component<{
46
46
  container: THREE.Group<THREE.Object3DEventMap>;
47
47
  onUpdate?: () => void;
48
48
  onResize?: (width: number, height: number) => void;
49
+ width: number;
50
+ height: number;
49
51
  private tweenTaskList;
50
52
  constructor(description: RendererDescription);
53
+ render(): void;
51
54
  /**
52
55
  * 世界坐标转屏幕坐标
53
56
  * @param worldPosition
@@ -72,5 +72,13 @@ export declare class PointVirtualGrid<T = Record<string, any>> {
72
72
  point: Point;
73
73
  userData?: T;
74
74
  }[];
75
+ /**
76
+ * 查找点自己
77
+ * @param point
78
+ */
79
+ queryPointSelf(point: Point): {
80
+ point: Point;
81
+ userData: T;
82
+ } | null;
75
83
  }
76
84
  export {};
@@ -11,6 +11,31 @@ export declare class LineSegment<T = Record<string, any>> {
11
11
  get start(): Point<Record<string, any>>;
12
12
  get end(): Point<Record<string, any>>;
13
13
  constructor(p1?: Point, p2?: Point);
14
+ set(p1: Point, p2: Point): this;
15
+ /**
16
+ * 是否有相同端点
17
+ * @param line
18
+ * @returns
19
+ */
20
+ sameEndpoint(line: LineSegment): boolean;
21
+ /**
22
+ * 相同端点是否为开始
23
+ * @param line
24
+ * @returns
25
+ */
26
+ sameEndpointAsStart(line: LineSegment): boolean;
27
+ /**
28
+ * 获取共线点
29
+ * @param line
30
+ * @returns
31
+ */
32
+ getSameEndpoint(line: LineSegment): Point<Record<string, any>>[] | null;
33
+ /**
34
+ * 相同端点是否为结束
35
+ * @param line
36
+ * @returns
37
+ */
38
+ sameEndpointAsEnd(line: LineSegment): boolean;
14
39
  /** 膨胀
15
40
  * @description 向线段的两个端点分别膨胀 width
16
41
  * @param width
@@ -73,8 +98,16 @@ export declare class LineSegment<T = Record<string, any>> {
73
98
  /**
74
99
  * 判断线段是否与另一条线段相交(包含共用端点或部分重合的情况)
75
100
  * @param line
101
+ * @param endpoint 是否包含端点相交
102
+ * @returns
103
+ */
104
+ intersectLineSegment(line: LineSegment, endpoint?: boolean): boolean;
105
+ /**
106
+ * 判断一个点是否在线段上(含端点)
107
+ * @param pt 要判断的点
108
+ * @returns 如果点在当前线段上返回 true,否则返回 false
76
109
  */
77
- intersectLineSegment(line: LineSegment): boolean;
110
+ containsPoint(pt: Point): boolean;
78
111
  /**
79
112
  * 获取交点
80
113
  * @param line
@@ -54,6 +54,12 @@ export declare class Point<T = Record<string, any>> {
54
54
  * @returns
55
55
  */
56
56
  add(point: Point): this;
57
+ /**
58
+ * 绕point旋转angle
59
+ * @param point
60
+ * @param angle 旋转角度,单位为弧度
61
+ */
62
+ rotate(point: Point, angle: number): this;
57
63
  /**
58
64
  * 保留小数位数
59
65
  * @param count
@@ -124,10 +130,11 @@ export declare class Point<T = Record<string, any>> {
124
130
  copy(p: {
125
131
  x: number;
126
132
  y: number;
127
- }): void;
128
- toJson(): {
133
+ }): this;
134
+ toJson(z?: number): {
129
135
  x: number;
130
136
  y: number;
137
+ z: number;
131
138
  };
132
139
  static from(arr: any): Point<Record<string, any>>;
133
140
  static zero(): Point<Record<string, any>>;
@@ -60,7 +60,7 @@ export declare class Quadtree<T = any> {
60
60
  * @param lineSegment 线段
61
61
  * @returns 相交的节点数组
62
62
  */
63
- queryLineSegment(lineSegment: LineSegment): QuadtreeNode<T>[];
63
+ queryLineSegment(lineSegment: LineSegment, endpoint?: boolean): QuadtreeNode<T>[];
64
64
  /**
65
65
  * 包围盒转换为数组
66
66
  * @param array
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 实现深度克隆函数
3
+ * @param value 要克隆的值
4
+ * @returns 克隆后的新对象
5
+ */
6
+ export declare function deepClone<T>(value: T): T;