build-dxf 0.0.20-1 → 0.0.20-10

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 (25) hide show
  1. package/package.json +1 -1
  2. package/src/build.js +28 -19
  3. package/src/index.css +56 -20
  4. package/src/index2.js +2 -14
  5. package/src/index3.js +1021 -345
  6. package/src/selectLocalFile.js +10 -9
  7. package/src/utils/CommandManager/CommandFlow.d.ts +16 -0
  8. package/src/utils/CommandManager/CommandManager.d.ts +23 -0
  9. package/src/utils/DxfSystem/components/Dxf.d.ts +1 -0
  10. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/CommandFlowComponent.d.ts +4 -1
  11. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/ConnectionLine.d.ts +33 -0
  12. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/Default.d.ts +0 -20
  13. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DeleteSelectLine.d.ts +28 -0
  14. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DeleteSelectWindow.d.ts +33 -0
  15. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawDoorLine.d.ts +19 -3
  16. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawLine.d.ts +20 -4
  17. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawWindow.d.ts +20 -1
  18. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/IntersectionConnectionLine.d.ts +33 -0
  19. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/MergeLine.d.ts +32 -0
  20. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/PointDrag.d.ts +14 -1
  21. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/SelectAll.d.ts +30 -0
  22. package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalCorrection.d.ts +63 -0
  23. package/src/utils/DxfSystem/plugin/Editor/components/index.d.ts +1 -0
  24. package/src/utils/Quadtree/LineSegment.d.ts +1 -0
  25. package/src/utils/Quadtree/Point.d.ts +2 -1
@@ -69,15 +69,17 @@ class Renderer extends Component {
69
69
  this.renderer.setSize(width, height);
70
70
  if (this.html2DRenderer) this.html2DRenderer.setSize(width, height);
71
71
  if (this.html3DRenderer) this.html3DRenderer.setSize(width, height);
72
- if (camera2 instanceof THREE.PerspectiveCamera) {
73
- camera2.aspect = width / height;
74
- } else if (camera2 instanceof THREE.OrthographicCamera) {
75
- camera2.left = -width * 0.5;
76
- camera2.right = width * 0.5;
77
- camera2.top = height * 0.5;
78
- camera2.bottom = -height * 0.5;
72
+ if (this.orbitControls) {
73
+ if (camera2 instanceof THREE.PerspectiveCamera) {
74
+ camera2.aspect = width / height;
75
+ } else if (camera2 instanceof THREE.OrthographicCamera) {
76
+ camera2.left = -width * 0.5;
77
+ camera2.right = width * 0.5;
78
+ camera2.top = height * 0.5;
79
+ camera2.bottom = -height * 0.5;
80
+ }
81
+ camera2.updateProjectionMatrix();
79
82
  }
80
- camera2.updateProjectionMatrix();
81
83
  this.onResize && this.onResize(width, height);
82
84
  this.dispatchEvent({ type: "resize", width, height });
83
85
  });
@@ -97,7 +99,6 @@ class Renderer extends Component {
97
99
  const directLight = new THREE.DirectionalLight(16777215, 4);
98
100
  directLight.position.set(100, -100, 100);
99
101
  this.scene.add(directLight);
100
- camera.position.set(10, 10, 10);
101
102
  }
102
103
  /**
103
104
  * 世界坐标转屏幕坐标
@@ -18,6 +18,22 @@ export declare class CommandFlow extends EventDispatcher<{
18
18
  finally: {};
19
19
  }> {
20
20
  list: CommandFlowCallBack[];
21
+ rollbacklist: ((data?: any) => void)[];
22
+ revokeRollbacklist: ((data?: any) => void)[];
23
+ /**
24
+ *
25
+ * @param operation
26
+ * @returns
27
+ */
21
28
  add(operation: CommandFlowCallBack): this;
29
+ /** 添加回滚回调列表
30
+ * @param callBack
31
+ */
32
+ addRollback(callBack: (data?: any) => void): this;
33
+ /** 添加撤回回滚回调列表
34
+ * @param callBack
35
+ * @returns
36
+ */
37
+ addRevokeRollback(callBack: (data?: any) => void): this;
22
38
  }
23
39
  export {};
@@ -1,5 +1,9 @@
1
1
  import { EventDispatcher } from '../ComponentManager';
2
2
  import { CommandFlow } from './CommandFlow';
3
+ export type Operation = {
4
+ name: string;
5
+ data: any;
6
+ };
3
7
  export declare class CommandManager extends EventDispatcher<{
4
8
  startedBefore: {
5
9
  name: string;
@@ -31,6 +35,12 @@ export declare class CommandManager extends EventDispatcher<{
31
35
  finally: {
32
36
  name: string;
33
37
  };
38
+ rollback: {
39
+ name: string;
40
+ };
41
+ revokeRollback: {
42
+ name: string;
43
+ };
34
44
  }> {
35
45
  commandFlowMap: Map<string, CommandFlow>;
36
46
  lock: boolean;
@@ -40,6 +50,11 @@ export declare class CommandManager extends EventDispatcher<{
40
50
  private _disabled;
41
51
  set disabled(disabled: boolean);
42
52
  get disabled(): boolean;
53
+ /**
54
+ * 操作记录
55
+ */
56
+ operationList: Operation[];
57
+ rollbackList: Operation[];
43
58
  constructor();
44
59
  /** 添加命令流
45
60
  * @param name
@@ -56,4 +71,12 @@ export declare class CommandManager extends EventDispatcher<{
56
71
  /** 取消当前命令
57
72
  */
58
73
  cancel(): void;
74
+ /**
75
+ * 回滚
76
+ */
77
+ rollback(): boolean;
78
+ /**
79
+ * 撤销回滚
80
+ */
81
+ revokeRollback(): boolean;
59
82
  }
@@ -22,6 +22,7 @@ export interface OriginalDataItem {
22
22
  z?: number;
23
23
  };
24
24
  }[];
25
+ length: number;
25
26
  isDoor?: boolean;
26
27
  doorDirectConnection?: boolean;
27
28
  drawDoorData?: {
@@ -3,6 +3,7 @@ import { Editor } from '../Editor';
3
3
  import { EventInput, Renderer } from '../../../RenderPlugin/components';
4
4
  import { CommandManager } from '../../../../../CommandManager';
5
5
  import { RenderManager } from '../RenderManager';
6
+ import { Default } from './Default';
6
7
  export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Component<TEventMap> {
7
8
  private _renderer?;
8
9
  get renderer(): Renderer;
@@ -16,6 +17,8 @@ export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Com
16
17
  get renderManager(): RenderManager;
17
18
  private _commandManager?;
18
19
  get commandManager(): CommandManager;
20
+ private _default?;
21
+ get default(): Default;
19
22
  interruptKeys: string[];
20
23
  commandName: string;
21
24
  constructor();
@@ -25,7 +28,7 @@ export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Com
25
28
  */
26
29
  cancel(): void;
27
30
  /**
28
- * 创建中断
31
+ * 创建中断处理命令节点
29
32
  * @returns
30
33
  */
31
34
  createInterrupt(): (next: any, data: any) => void;
@@ -0,0 +1,33 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ /**
4
+ * 连接选择的线段
5
+ */
6
+ export declare class ConnectionLine 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
+ * @param next
17
+ */
18
+ private connection;
19
+ /** 成功
20
+ * @param next
21
+ * @param selectLines
22
+ */
23
+ private completed;
24
+ /** 回滚操作
25
+ * @param data
26
+ */
27
+ private rollback;
28
+ /** 撤回回滚
29
+ * @param lines
30
+ * @returns
31
+ */
32
+ private revokeRollback;
33
+ }
@@ -26,26 +26,6 @@ export declare class Default extends Component<{
26
26
  * 移除所有选中线段
27
27
  */
28
28
  removeSelectLineAll(): void;
29
- /**
30
- * 删除选择的线段
31
- */
32
- deleteSelectLine(): void;
33
- /**
34
- * 删除选择线段上的窗户
35
- */
36
- deleteSelectWindow(): void;
37
- /**
38
- * 如果只选择两个线段,可为两个未链接的点创建连接
39
- */
40
- connection(): void;
41
- /**
42
- * 如果只选择两个线段,可为两个未链接的点创建连接, 通过计算交点,线段延长到交点
43
- */
44
- intersectionConnection(): void;
45
- /**
46
- * 如果只选择两个线段, 且两个线段在一条路径上,合并线段
47
- */
48
- mergeLine(): void;
49
29
  private _timer;
50
30
  /**
51
31
  * 更新选择的线段
@@ -0,0 +1,28 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ /**
4
+ * 删除选择的线段
5
+ */
6
+ export declare class DeleteSelectLine 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
+ * @param next
17
+ */
18
+ private delete;
19
+ /** 回滚操作
20
+ * @param data
21
+ */
22
+ private rollback;
23
+ /** 撤回回滚
24
+ * @param lines
25
+ * @returns
26
+ */
27
+ private revokeRollback;
28
+ }
@@ -0,0 +1,33 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ /**
4
+ * 删除选择的线段上的窗户线
5
+ */
6
+ export declare class DeleteSelectWindow 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
+ * @param next
17
+ */
18
+ private end;
19
+ /**
20
+ * 完成
21
+ * @param list
22
+ */
23
+ private completed;
24
+ /** 回滚操作
25
+ * @param data
26
+ */
27
+ private rollback;
28
+ /** 撤回回滚
29
+ * @param lines
30
+ * @returns
31
+ */
32
+ private revokeRollback;
33
+ }
@@ -1,5 +1,6 @@
1
1
  import { ComponentManager } from '../../../../../ComponentManager';
2
- import { Point } from '../../../../../Quadtree/Point';
2
+ import { LineSegment } from '../../../../../Quadtree/LineSegment';
3
+ import { LineUserData } from '../RenderManager';
3
4
  import { CommandFlowComponent } from './CommandFlowComponent';
4
5
  import * as THREE from "three";
5
6
  export declare class DrawDoorLine extends CommandFlowComponent<{}> {
@@ -12,8 +13,23 @@ export declare class DrawDoorLine extends CommandFlowComponent<{}> {
12
13
  /** 选择点
13
14
  * @param next
14
15
  */
15
- selectPoint(next: any): void;
16
+ private selectPoint;
17
+ /**
18
+ * 结束处理
19
+ * @param next
20
+ * @param points
21
+ */
22
+ private end;
16
23
  /** 执行完成
17
24
  */
18
- completed(points: Point[]): void;
25
+ completed(lines: LineSegment<LineUserData>[]): void;
26
+ /** 回滚操作
27
+ * @param data
28
+ */
29
+ private rollback;
30
+ /** 撤回回滚
31
+ * @param lines
32
+ * @returns
33
+ */
34
+ private revokeRollback;
19
35
  }
@@ -1,8 +1,11 @@
1
- import { Point } from '../../../../../Quadtree/Point';
2
1
  import { CommandFlowComponent } from './CommandFlowComponent';
3
2
  import { ComponentManager } from '../../../../../ComponentManager';
4
3
  import * as THREE from "three";
5
- export declare class DrawLine extends CommandFlowComponent<{}> {
4
+ export declare class DrawLine extends CommandFlowComponent<{
5
+ pointerMove: {
6
+ point: THREE.Vector3;
7
+ };
8
+ }> {
6
9
  static name: string;
7
10
  container: THREE.Group<THREE.Object3DEventMap>;
8
11
  interruptKeys: string[];
@@ -14,8 +17,21 @@ export declare class DrawLine extends CommandFlowComponent<{}> {
14
17
  /** 选择点
15
18
  * @param next
16
19
  */
17
- selectPoint(next: any): void;
20
+ private selectPoint;
21
+ /** 结束, 汇总结果
22
+ * @param points
23
+ */
24
+ private end;
18
25
  /** 执行完成
19
26
  */
20
- completed(points: Point[]): void;
27
+ private completed;
28
+ /** 回滚操作
29
+ * @param data
30
+ */
31
+ private rollback;
32
+ /** 撤回回滚
33
+ * @param lines
34
+ * @returns
35
+ */
36
+ private revokeRollback;
21
37
  }
@@ -1,5 +1,6 @@
1
1
  import { CommandFlowComponent } from './CommandFlowComponent';
2
2
  import { LineSegment } from '../../../../../Quadtree/LineSegment';
3
+ import { LineUserData } from '../RenderManager';
3
4
  import { ComponentManager } from '../../../../../ComponentManager';
4
5
  import * as THREE from "three";
5
6
  export declare class DrawWindow extends CommandFlowComponent<{}> {
@@ -20,7 +21,25 @@ export declare class DrawWindow extends CommandFlowComponent<{}> {
20
21
  point: THREE.Vector3;
21
22
  line: LineSegment;
22
23
  }): void;
24
+ /**
25
+ * 结束处理
26
+ * @param next
27
+ * @param points
28
+ */
29
+ private end;
23
30
  /** 执行完成
24
31
  */
25
- completed(data: any): void;
32
+ completed({ doorDataItem, line }: {
33
+ doorDataItem: any;
34
+ line: LineSegment<LineUserData>;
35
+ }): void;
36
+ /** 回滚操作
37
+ * @param data
38
+ */
39
+ private rollback;
40
+ /** 撤回回滚
41
+ * @param data
42
+ * @returns
43
+ */
44
+ private revokeRollback;
26
45
  }
@@ -0,0 +1,33 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ /**
4
+ * 连接选择的线段
5
+ */
6
+ export declare class IntersectionConnectionLine 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
+ * @param next
17
+ */
18
+ private connection;
19
+ /** 执行完成
20
+ * @param next
21
+ * @param selectLines
22
+ */
23
+ private completed;
24
+ /** 回滚操作
25
+ * @param data
26
+ */
27
+ private rollback;
28
+ /** 撤回回滚
29
+ * @param lines
30
+ * @returns
31
+ */
32
+ private revokeRollback;
33
+ }
@@ -0,0 +1,32 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ /**
4
+ * 合并同向线段
5
+ */
6
+ export declare class MergeLine 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
+ * @param next
17
+ */
18
+ private mergeLine;
19
+ /** 执行完成
20
+ * @param data
21
+ */
22
+ private completed;
23
+ /** 回滚操作
24
+ * @param data
25
+ */
26
+ private rollback;
27
+ /** 撤回回滚
28
+ * @param lines
29
+ * @returns
30
+ */
31
+ private revokeRollback;
32
+ }
@@ -2,7 +2,11 @@ import { CommandFlowComponent } from './CommandFlowComponent';
2
2
  import { LineSegment } from '../../../../../Quadtree/LineSegment';
3
3
  import { ComponentManager } from '../../../../../ComponentManager';
4
4
  import * as THREE from "three";
5
- export declare class PointDrag extends CommandFlowComponent<{}> {
5
+ export declare class PointDrag extends CommandFlowComponent<{
6
+ pointerMove: {
7
+ point: THREE.Vector3;
8
+ };
9
+ }> {
6
10
  static name: string;
7
11
  container: THREE.Group<THREE.Object3DEventMap>;
8
12
  interruptKeys: string[];
@@ -25,4 +29,13 @@ export declare class PointDrag extends CommandFlowComponent<{}> {
25
29
  /** 执行完成
26
30
  */
27
31
  completed(data: any): void;
32
+ /** 回滚操作
33
+ * @param data
34
+ */
35
+ private rollback;
36
+ /** 撤回回滚
37
+ * @param lines
38
+ * @returns
39
+ */
40
+ private revokeRollback;
28
41
  }
@@ -0,0 +1,30 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ import { LineSegment } from '../../../../../Quadtree/LineSegment';
4
+ import * as THREE from "three";
5
+ /**
6
+ * 选择全部命令
7
+ */
8
+ export declare class SelectAll extends CommandFlowComponent<{}> {
9
+ static name: string;
10
+ container: THREE.Group<THREE.Object3DEventMap>;
11
+ shortcutKeys: string[];
12
+ static commandName: string;
13
+ onAddFromParent(parent: ComponentManager): void;
14
+ /** 开始
15
+ * @param next
16
+ */
17
+ selectAll(next: any): void;
18
+ /** 执行完成
19
+ */
20
+ completed(lines: LineSegment[]): void;
21
+ /** 回滚操作
22
+ * @param lines
23
+ */
24
+ private rollback;
25
+ /** 撤回回滚
26
+ * @param lines
27
+ * @returns
28
+ */
29
+ private revokeRollback;
30
+ }
@@ -0,0 +1,63 @@
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
+ static commandName: string;
14
+ onAddFromParent(parent: ComponentManager): void;
15
+ /**
16
+ * 进入命令约束
17
+ */
18
+ constraint(next: any, selectLines: LineSegment[]): void;
19
+ /**
20
+ * 线段是否为结尾线段
21
+ * @param line
22
+ */
23
+ lineIsPathEnd(line: LineSegment): boolean;
24
+ /**
25
+ *
26
+ * @param line0
27
+ * @param line1
28
+ */
29
+ isTowLineSegmentConnect(line0: LineSegment, line1: LineSegment): boolean;
30
+ /**
31
+ * 获取所有相同点的位置信息
32
+ * @param point
33
+ * @param point2
34
+ */
35
+ getSamePointAll(point: Point, point2: Point): {
36
+ point: Point<Record<string, any>>;
37
+ oldPoint: Point<Record<string, any>>;
38
+ newPoint: Point<Record<string, any>>;
39
+ line: LineSegment;
40
+ }[];
41
+ /** 修正
42
+ * @param targettLine
43
+ * @param vistedList
44
+ */
45
+ correction(targettLine: LineSegment, resultList?: any[], vistedList?: Set<LineSegment>): any[] | undefined;
46
+ /** 开始
47
+ * @param next
48
+ */
49
+ verticalCorrection(next: any, selectLines: LineSegment[]): void;
50
+ /** 执行完成
51
+ * @param data
52
+ */
53
+ private completed;
54
+ /** 回滚操作
55
+ * @param data
56
+ */
57
+ private rollback;
58
+ /** 撤回回滚
59
+ * @param lines
60
+ * @returns
61
+ */
62
+ private revokeRollback;
63
+ }
@@ -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';
@@ -11,6 +11,7 @@ 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): void;
14
15
  /** 膨胀
15
16
  * @description 向线段的两个端点分别膨胀 width
16
17
  * @param width
@@ -125,9 +125,10 @@ export declare class Point<T = Record<string, any>> {
125
125
  x: number;
126
126
  y: number;
127
127
  }): void;
128
- toJson(): {
128
+ toJson(z?: number): {
129
129
  x: number;
130
130
  y: number;
131
+ z: number;
131
132
  };
132
133
  static from(arr: any): Point<Record<string, any>>;
133
134
  static zero(): Point<Record<string, any>>;