build-dxf 0.0.20-14 → 0.0.20-16

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.
@@ -0,0 +1,9 @@
1
+ import { ComponentManager } from '../../ComponentManager';
2
+ import { Dxf } from './Dxf';
3
+ /**
4
+ * 角度修正过后的DXF格式数据
5
+ */
6
+ export declare class AngleCorrectionDxf extends Dxf<{}> {
7
+ static name: string;
8
+ onAddFromParent(parent: ComponentManager): void;
9
+ }
@@ -38,6 +38,7 @@ export interface OriginalDataItem {
38
38
  };
39
39
  };
40
40
  isWindow?: boolean;
41
+ isVerticalReferenceLine?: boolean;
41
42
  drawWindow?: {
42
43
  p: {
43
44
  x: number;
@@ -52,6 +53,19 @@ export interface OriginalDataItem {
52
53
  * [开始点, 结束点, 相交点, 是否是门, 索引]
53
54
  */
54
55
  export type DataItem = [Point, Point, number[], boolean, number];
56
+ export type DrawData = {
57
+ unit: Unit;
58
+ line: [number, number, number, number, string][];
59
+ arc: [number, number, number, number, number, string][];
60
+ dimensionLine: number[][];
61
+ center: {
62
+ x: number;
63
+ y: number;
64
+ };
65
+ width: number;
66
+ height: number;
67
+ scale: number;
68
+ };
55
69
  /**
56
70
  *
57
71
  */
@@ -62,7 +76,7 @@ export interface PointGroup {
62
76
  /**
63
77
  * 将点云结构转换为DXF格式
64
78
  */
65
- export declare class Dxf extends Component<{
79
+ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
66
80
  setDta: {
67
81
  originalData: OriginalDataItem[];
68
82
  data: DataItem[];
@@ -73,7 +87,7 @@ export declare class Dxf extends Component<{
73
87
  createGroup: {
74
88
  groups: Point[][][];
75
89
  };
76
- }> {
90
+ } & TEventMap> {
77
91
  static name: string;
78
92
  shortLine: number;
79
93
  width: number;
@@ -89,7 +103,8 @@ export declare class Dxf extends Component<{
89
103
  lineSegments: LineSegment<{
90
104
  isDoor: boolean;
91
105
  isWindow: boolean;
92
- drawDoorData: any[];
106
+ drawDoorData: any;
107
+ drawWindow: any[];
93
108
  }>[];
94
109
  originalZAverage: number;
95
110
  static EndType: {
@@ -107,7 +122,8 @@ export declare class Dxf extends Component<{
107
122
  get lines(): LineSegment<{
108
123
  isDoor: boolean;
109
124
  isWindow: boolean;
110
- drawDoorData: any[];
125
+ drawDoorData: any;
126
+ drawWindow: any[];
111
127
  }>[];
112
128
  /**初始化
113
129
  * @param data 点云数据
@@ -175,7 +191,16 @@ export declare class Dxf extends Component<{
175
191
  */
176
192
  private getArcAngleRange;
177
193
  /**
178
- * 将点云结构转换为string
194
+ * 转为绘制数据
195
+ */
196
+ toDrawDataJson(unit?: Unit): DrawData;
197
+ /**
198
+ *
199
+ * @param type
200
+ */
201
+ toDxfImageBlob(unit?: Unit, type?: string): Promise<any>;
202
+ /**
203
+ * 将点json结构转换为Dxf string
179
204
  */
180
205
  toDxfString(unit?: Unit): string;
181
206
  /**
@@ -188,6 +213,11 @@ export declare class Dxf extends Component<{
188
213
  * @param filename
189
214
  */
190
215
  download(filename: string, unit?: Unit): Promise<void>;
216
+ /**
217
+ * 下载
218
+ * @param filename
219
+ */
220
+ downloadImage(filename: string, unit?: Unit, type?: string): Promise<boolean>;
191
221
  /**
192
222
  * 计算原始数据的边界框
193
223
  * @description 计算所有线段的起点和终点的最小最大值,形成一个边界框
@@ -13,7 +13,9 @@ type ProjectionAnalysisResult = {
13
13
  project: LineSegment;
14
14
  project2: LineSegment;
15
15
  };
16
- export declare class LineAnalysis extends Component {
16
+ export declare class LineAnalysis extends Component<{
17
+ analysisCompleted: {};
18
+ }> {
17
19
  static name: string;
18
20
  Dxf: Dxf | null;
19
21
  Variable: Variable | null;
@@ -1,8 +1,10 @@
1
1
  import { ComponentManager } from '../ComponentManager';
2
+ import { AngleCorrectionDxf } from './components/AngleCorrectionDxf';
2
3
  import { Dxf } from './components/Dxf';
3
4
  import { Variable } from './components/Variable';
4
5
  export declare class DxfSystem extends ComponentManager {
5
6
  Dxf: Dxf;
7
+ AngleCorrectionDxf: AngleCorrectionDxf;
6
8
  Variable: Variable;
7
9
  wallWidth: number;
8
10
  environment: "node" | "browser" | "unknown";
@@ -34,28 +34,34 @@ export declare class VerticalCorrection extends CommandFlowComponent<{}> {
34
34
  * @param point
35
35
  * @param point2
36
36
  */
37
- getSamePointAll(point: Point, point2: Point): {
38
- point: Point<Record<string, any>>;
39
- oldPoint: Point<Record<string, any>>;
40
- newPoint: Point<Record<string, any>>;
41
- line: LineSegment;
42
- }[];
43
- /** 修正
44
- * @param targettLine
45
- * @param vistedList
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
46
52
  */
47
- correction0(targettLine: LineSegment, resultList?: any[], vistedList?: Set<LineSegment>): any[] | undefined;
53
+ setLine(line: LineSegment, point: Point, newPoint: Point, record?: any[]): void;
48
54
  /** 修正2
49
55
  * 第一步:确定需要修复的线段
50
56
  * 第二步:查找与该线段相交的其他线段
51
57
  * 第三步:找出两端点相交的线段,其他为区间相交
52
- * 第四步:找出两端点相交的线段数量,大于2, 该点不能修
53
- * 第五步:修正
54
- * 第六步:修正同向线段
58
+ * 第四步:修正相交的线段的另一个端点
59
+ * 第五步:判断是否有方向一致的线段,有就调整,调整方法:查找连续平行的线段,求点在线段方向的投影,直到不平行的线段结束
60
+ * 第六步: 中间线段采用投影修正
55
61
  * @param targettLine
56
62
  * @param vistedList
57
63
  */
58
- correction(targettLine: LineSegment, resultList?: any[], vistedList?: Set<LineSegment>): any[] | undefined;
64
+ correction(targettLine: LineSegment, entryPoint?: Point, resultList?: any[], vistedList?: Set<LineSegment | Point>): any[] | undefined;
59
65
  /** 开始
60
66
  * @param next
61
67
  */
@@ -0,0 +1,21 @@
1
+ import { CommandFlowComponent } from './CommandFlowComponent';
2
+ import { ComponentManager } from '../../../../../ComponentManager';
3
+ /**
4
+ * 设置垂直基准线段
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
+ }
@@ -1,15 +1,21 @@
1
1
  import { CommandFlowComponent } from './CommandFlowComponent';
2
2
  import { ComponentManager } from '../../../../../ComponentManager';
3
3
  /**
4
- * 查看线段角度
4
+ * 合并同向线段
5
5
  */
6
6
  export declare class ViewAngle extends CommandFlowComponent<{}> {
7
7
  static name: string;
8
8
  shortcutKeys: string[];
9
9
  static commandName: string;
10
10
  onAddFromParent(parent: ComponentManager): void;
11
- /** 执行完成
12
- * @param data
11
+ /**
12
+ * 进入命令约束
13
13
  */
14
- private completed;
14
+ private constraint;
15
+ /**
16
+ *
17
+ * @param next
18
+ * @param selectLines
19
+ */
20
+ private viewAngle;
15
21
  }
@@ -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
  /** 重新设置数据
@@ -11,7 +11,25 @@ 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
+ 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
+ sameEndpointAsEnd(line: LineSegment): boolean;
15
33
  /** 膨胀
16
34
  * @description 向线段的两个端点分别膨胀 width
17
35
  * @param width
@@ -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,7 +130,7 @@ export declare class Point<T = Record<string, any>> {
124
130
  copy(p: {
125
131
  x: number;
126
132
  y: number;
127
- }): void;
133
+ }): this;
128
134
  toJson(z?: number): {
129
135
  x: number;
130
136
  y: number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 实现深度克隆函数
3
+ * @param value 要克隆的值
4
+ * @returns 克隆后的新对象
5
+ */
6
+ export declare function deepClone<T>(value: T): T;