build-dxf 0.0.47 → 0.0.49

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.
@@ -21,6 +21,8 @@ export declare class CommandFlow extends EventDispatcher<{
21
21
  rollbacklist: ((data?: any) => void)[];
22
22
  revokeRollbacklist: ((data?: any) => void)[];
23
23
  writeOperationList: boolean;
24
+ loop: boolean;
25
+ setLoop(loop: boolean): this;
24
26
  /**
25
27
  *
26
28
  * @param operation
@@ -6,7 +6,7 @@ import { RenderManager } from '../RenderManager';
6
6
  import { Default } from './Default';
7
7
  import { LineSegment } from '../../../../../LineSegment';
8
8
  import { Point } from '../../../../../Point';
9
- export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Component<TEventMap> {
9
+ export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Component<TEventMap & {}> {
10
10
  private _renderer?;
11
11
  get renderer(): Renderer;
12
12
  private _domElement?;
@@ -5,6 +5,13 @@ export declare class DrawLine extends CommandFlowComponent<{
5
5
  pointerMove: {
6
6
  point: THREE.Vector3;
7
7
  };
8
+ appendLine: {
9
+ points: THREE.Vector3[];
10
+ };
11
+ revoke: {
12
+ points: THREE.Vector3[];
13
+ };
14
+ start: {};
8
15
  }> {
9
16
  static name: string;
10
17
  container: THREE.Group<THREE.Object3DEventMap>;
@@ -1,6 +1,10 @@
1
1
  import { QuadtreeNode } from '../Quadtree';
2
2
  import { Point } from '../Point';
3
3
  export type Unit = "Unitless" | "Inches" | "Feet" | "Miles" | "Millimeters" | "Centimeters" | "Meters" | "Kilometers" | "Microinches" | "Mils" | "Yards" | "Angstroms" | "Nanometers" | "Microns" | "Decimeters" | "Decameters" | "Hectometers" | "Gigameters" | "Astronomical units" | "Light years" | "Parsecs";
4
+ export interface GroupItem {
5
+ id: string;
6
+ type?: string;
7
+ }
4
8
  export interface OriginalDataItem {
5
9
  start: {
6
10
  x: number;
@@ -23,6 +27,7 @@ export interface OriginalDataItem {
23
27
  length: number;
24
28
  isDoor?: boolean;
25
29
  doorDirectConnection?: boolean;
30
+ doorAutomaticFind?: boolean;
26
31
  drawDoorData?: {
27
32
  start: {
28
33
  x: number;
@@ -37,6 +42,7 @@ export interface OriginalDataItem {
37
42
  };
38
43
  wallWidth?: number;
39
44
  isWindow?: boolean;
45
+ isBayWindow?: boolean;
40
46
  rooftopPz?: number;
41
47
  isVerticalReferenceLine?: boolean;
42
48
  groupId?: string;
@@ -59,6 +65,9 @@ export type LineUserData = {
59
65
  rooftopPz?: number;
60
66
  groupId?: string;
61
67
  groupType?: string;
68
+ groups?: GroupItem[];
69
+ doorAutomaticFind?: boolean;
70
+ isBayWindow?: boolean;
62
71
  drawWindow?: {
63
72
  p: {
64
73
  x: number;
@@ -121,7 +130,6 @@ export type AxisAlignmentCorrectionOption = {
121
130
  * 吸附方式, 默认 adsorption
122
131
  */
123
132
  adsorptionMethod?: "originalInterPoint" | "adsorption";
124
- removeClosedLine?: boolean;
125
133
  wallGroup?: boolean;
126
134
  };
127
135
  /**
@@ -1,13 +1,17 @@
1
1
  import { LineSegment } from '../../LineSegment';
2
2
  import { Point } from '../../Point';
3
- import { OriginalDataItem } from '../type';
3
+ import { LineUserData, OriginalDataItem } from '../type';
4
4
  export declare class BoundExt {
5
5
  /** 通过轨迹点查找外墙
6
6
  * @param lines
7
7
  * @param trajectoryPoints
8
8
  * @returns
9
9
  */
10
- static findExtWallByTraj(lines: LineSegment[], trajectoryPoints: Point[], minWidth?: number): LineSegment<Record<string, any>>[];
10
+ static findExtWallByTraj(lines: LineSegment<LineUserData & {
11
+ expandDirect?: 'left' | 'right' | 'on';
12
+ }>[], trajectoryPoints: Point[], minWidth?: number): LineSegment<LineUserData & {
13
+ expandDirect?: "left" | "right" | "on";
14
+ }>[];
11
15
  /** 通过轨迹点外扩边线
12
16
  * @param lines
13
17
  * @param trajectoryPoints
@@ -10,7 +10,6 @@ export declare class DoubleWallHelper {
10
10
  */
11
11
  private static projectionAnalysis;
12
12
  /**
13
- *
14
13
  * @param lines
15
14
  * @param wallWidth
16
15
  * @returns
@@ -0,0 +1,81 @@
1
+ import { LineSegment } from '../../LineSegment';
2
+ import { LineUserData } from '../type';
3
+ export declare class LineGroupType {
4
+ /**
5
+ * 获取线段的所有分组信息
6
+ * @param line
7
+ * @returns
8
+ */
9
+ static get(line: LineSegment<LineUserData>): {
10
+ id: string;
11
+ type?: string;
12
+ }[];
13
+ /**
14
+ * 为线段添加新的分组
15
+ * @param line
16
+ * @param id
17
+ * @param type
18
+ * @returns
19
+ */
20
+ static set(line: LineSegment<LineUserData>, id: string, type: string): void;
21
+ /**
22
+ * 替换线段中的分组信息
23
+ * @param line
24
+ * @param id
25
+ * @param type
26
+ * @returns
27
+ */
28
+ static replace(line: LineSegment<LineUserData>, id: string, type: string): boolean;
29
+ /**
30
+ * 检查线段是否包含指定的分组ID
31
+ * @param line
32
+ * @param id
33
+ * @returns
34
+ */
35
+ static hasId(line: LineSegment<LineUserData>, id: string): boolean | undefined;
36
+ /**
37
+ * 检查线段是否包含指定的分组类型
38
+ * @param line
39
+ * @param type
40
+ * @returns
41
+ */
42
+ static hasType(line: LineSegment<LineUserData>, type: string): boolean;
43
+ /**
44
+ * 检查线段是否包含所有指定的分组类型
45
+ * @param line
46
+ * @param types
47
+ * @returns
48
+ */
49
+ static hasTypes(line: LineSegment<LineUserData>, types: string[]): boolean;
50
+ /**
51
+ * 检查线段是否包含所有指定的分组类型
52
+ * @param lines
53
+ * @param type
54
+ * @returns
55
+ */
56
+ static everyType(lines: LineSegment<LineUserData>[], type: string): boolean;
57
+ /**
58
+ * 获取所有线段的交集类型(所有线段都包含的类型)
59
+ * @param lines
60
+ * @returns
61
+ */
62
+ static getIntersectionTypes(lines: LineSegment<LineUserData>[]): string[];
63
+ /**
64
+ * 获取所有线段的交集类型(所有线段都包含的类型)
65
+ * @param lines
66
+ * @returns
67
+ */
68
+ static getUnionTypes(lines: LineSegment<LineUserData>[]): string[];
69
+ /**
70
+ * 获取所有线段的交集类型(所有线段都包含的类型)
71
+ * @param line
72
+ * @param id
73
+ * @returns
74
+ */
75
+ static remove(line: LineSegment<LineUserData>, id: string): boolean;
76
+ /**
77
+ * 清空线段的所有分组信息
78
+ * @param line
79
+ */
80
+ static clear(line: LineSegment<LineUserData>): void;
81
+ }
@@ -1,27 +1,14 @@
1
1
  import { LineSegment } from '../../LineSegment';
2
- import { Point } from '../../Point';
3
- /** 将线段路径转换为点路径
4
- * @param lines
5
- */
6
- export declare function linePathToPointPath(lines: LineSegment[]): Point<Record<string, any>>[];
7
2
  /** 通过并查集,查找为环的一部分边
3
+ * @description
8
4
  * @param lines
9
5
  */
10
6
  export declare function findRingEdges(lines: LineSegment[]): LineSegment<Record<string, any>>[];
11
- /** 根据已知环线查找环
12
- * @param lines
13
- */
14
- export declare function findRing(lines: LineSegment[], ringEdges: LineSegment[]): {
15
- ringLines: LineSegment<Record<string, any>>[];
16
- removeLines: Set<LineSegment<Record<string, any>>>;
17
- ringList: LineSegment<Record<string, any>>[][];
18
- };
19
7
  /**
20
8
  * 从线段集合中提取所有闭合多边形
21
9
  */
22
10
  export declare function findClosedPolygons(lines: LineSegment[]): {
23
- lines: LineSegment<Record<string, any>>[];
24
- removeLines: LineSegment<Record<string, any>>[];
25
- groups: LineSegment<Record<string, any>>[][];
26
- ringLines: LineSegment<Record<string, any>>[];
11
+ newLines: LineSegment<Record<string, any>>[];
12
+ rings: LineSegment<Record<string, any>>[][];
13
+ internalEdges: LineSegment<Record<string, any>>[];
27
14
  };
@@ -1,6 +1,6 @@
1
1
  import { PointVirtualGrid } from '../../PointVirtualGrid';
2
2
  import { LineSegment } from '../../LineSegment';
3
- /** 查找有游离的点的线段
3
+ /** 查找有游离的点的线段,也就是有一端没有其他链接线的线段
4
4
  * @param lines
5
5
  * @param grid
6
6
  * @returns
@@ -0,0 +1,14 @@
1
+ import { LineSegment } from '../../LineSegment';
2
+ /** 通过并查集,查找为环的一部分边
3
+ * @description
4
+ * @param lines
5
+ */
6
+ export declare function findCircleEdges(lines: LineSegment[]): LineSegment<Record<string, any>>[];
7
+ /**
8
+ * 从线段集合中提取所有闭合多边形
9
+ */
10
+ export declare function findLargestCircle(lines: LineSegment[]): {
11
+ newLines: LineSegment<Record<string, any>>[];
12
+ rings: LineSegment<Record<string, any>>[][];
13
+ internalEdges: LineSegment<Record<string, any>>[];
14
+ };
@@ -2,4 +2,15 @@ export * from './AxisAlignCorr';
2
2
  export * from './BoundExt';
3
3
  export * from './lineDataToOriginalData';
4
4
  export * from './lineSegmentClipping';
5
+ export * from './DoubleWallHelper';
6
+ export * from './clippingDoubleWall';
7
+ export * from './clippingLineUserData';
8
+ export * from './closedPathArea';
9
+ export * from './createPointVirtualGrid';
10
+ export * from './findLargestCircle';
11
+ export * from './findDiscretePointLine';
12
+ export * from './findVerticalReference';
13
+ export * from './lineDataToOriginalData';
14
+ export * from './mergeLineUserData';
15
+ export * from './originalDataToLineData';
5
16
  export * from './recomputedWindow';
@@ -0,0 +1,14 @@
1
+ import { LineSegment } from '../../LineSegment';
2
+ /** 环去重
3
+ * @param rings
4
+ */
5
+ export declare function ringsDeduplication(rings: LineSegment[][]): LineSegment<Record<string, any>>[][];
6
+ /** 合并最小环、只留下外围环线
7
+ * @description
8
+ * @param lines
9
+ * @param ringEdges
10
+ */
11
+ export declare function mergeSmallestCircle(rings: LineSegment[][]): {
12
+ internalEdges: LineSegment<Record<string, any>>[];
13
+ rings: LineSegment<Record<string, any>>[][];
14
+ };
@@ -5,3 +5,8 @@ import { LineUserData } from '../type';
5
5
  * @param windowLines
6
6
  */
7
7
  export declare function recomputedWindow(...windowLines: LineSegment<LineUserData>[]): void;
8
+ /**
9
+ * 重新计算窗户位置
10
+ * @param windowLines
11
+ */
12
+ export declare function recomputedWindowCenter(...windowLines: LineSegment<LineUserData>[]): void;
@@ -0,0 +1,6 @@
1
+ import { LineSegment } from '../../LineSegment';
2
+ /** 查找同侧能构成的最小环
3
+ * @param lines
4
+ * @param ringEdges
5
+ */
6
+ export declare function smallestCircle<T = any>(lines: LineSegment[], ringEdges: LineSegment[], halfCircle?: boolean): LineSegment<T>[][];
@@ -0,0 +1,12 @@
1
+ import { LineSegment } from './LineSegment';
2
+ export declare class LineIndexGenerator {
3
+ private index;
4
+ get size(): number;
5
+ constructor(lines?: LineSegment[]);
6
+ private next;
7
+ reset(): void;
8
+ map: Map<LineSegment<Record<string, any>>, number>;
9
+ lineMap: Map<number, LineSegment<Record<string, any>>>;
10
+ getIndex(key: LineSegment): number;
11
+ getLine(index: number): LineSegment | undefined;
12
+ }
@@ -10,7 +10,6 @@ export declare class LineSegment<T = Record<string, any>> {
10
10
  get center(): Point<Record<string, any>>;
11
11
  get start(): Point<Record<string, any>>;
12
12
  get end(): Point<Record<string, any>>;
13
- id: number;
14
13
  constructor(p1?: Point, p2?: Point);
15
14
  set(p1: Point, p2: Point): this;
16
15
  getAnotherPoint(point: Point): Point<Record<string, any>>;
@@ -65,6 +64,16 @@ export declare class LineSegment<T = Record<string, any>> {
65
64
  * @param size
66
65
  */
67
66
  directionMove(direct: Point, size: number): this;
67
+ /** 旋转
68
+ * @param angle 弧度
69
+ */
70
+ rotate(angle: number): this;
71
+ /** 镜像线段
72
+ */
73
+ mirror(): void;
74
+ /** 交换两个端点
75
+ */
76
+ swap(): void;
68
77
  /** 膨胀为矩形
69
78
  *
70
79
  * @param width
@@ -103,6 +112,9 @@ export declare class LineSegment<T = Record<string, any>> {
103
112
  * @returns 投影并裁剪后的线段
104
113
  */
105
114
  projectPoint(p1: Point, clip?: boolean): Point | null;
115
+ /** 获取点的投影值
116
+ */
117
+ projectValue(point: Point): number;
106
118
  /**
107
119
  * 判断两条线段,是否在同一直线上:
108
120
  * - 返回 -1:不在同一直线(不共线)
@@ -201,6 +213,16 @@ export declare class LineSegment<T = Record<string, any>> {
201
213
  * @returns
202
214
  */
203
215
  static groupByPosition(lines: LineSegment[], line: LineSegment): LineSegment<Record<string, any>>[][];
216
+ /** 通过路径,给线段分组
217
+ * @param lines
218
+ * @returns
219
+ */
220
+ static groupByPath(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
221
+ /** 分组,通过点
222
+ * @param lines
223
+ * @returns
224
+ */
225
+ static groupByPoint(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
204
226
  /** 合并线段到最长线段
205
227
  * @param lines
206
228
  * @returns
@@ -15,3 +15,6 @@ export declare class MapEnhance<K, V> extends Map<K, V> {
15
15
  export declare class ArrayMap<K, V> extends MapEnhance<K, V[]> {
16
16
  append(k: K, ...arr: V[]): this;
17
17
  }
18
+ export declare class CountMap<K> extends MapEnhance<K, number> {
19
+ set(key: K): this;
20
+ }
@@ -63,6 +63,7 @@ export declare class Point<T = Record<string, any>> {
63
63
  * @returns
64
64
  */
65
65
  add(point: Point): this;
66
+ parseInt(): this;
66
67
  /**
67
68
  * 绕point旋转angle
68
69
  * @param point
@@ -6,6 +6,11 @@ type Target<T> = {
6
6
  userData?: T;
7
7
  };
8
8
  type NodeSet<T> = Set<Target<T>>;
9
+ export type PvgTarget<T> = Target<T>;
10
+ export declare class PvgList<T = any> extends Array<Target<T>> {
11
+ userDataList(): (T | undefined)[];
12
+ points(): Point<Record<string, any>>[];
13
+ }
9
14
  export declare class PointVirtualGrid<T = Record<string, any>> {
10
15
  map: Map<string, NodeSet<T>>;
11
16
  gridSize: number;
@@ -16,7 +21,7 @@ export declare class PointVirtualGrid<T = Record<string, any>> {
16
21
  * @param point
17
22
  * @param userData
18
23
  */
19
- insert(point: Point, userData?: T): void;
24
+ insert(point: Point, userData?: T): this;
20
25
  /**
21
26
  * 批量加入
22
27
  * @param points
@@ -28,14 +33,18 @@ export declare class PointVirtualGrid<T = Record<string, any>> {
28
33
  /** 移除点
29
34
  * @param point
30
35
  */
31
- remove(point: Point): void;
32
- update(point: Point): void;
36
+ remove(point: Point): this;
37
+ update(point: Point): boolean;
33
38
  /**
34
39
  * 获取通过坐标,获取唯一网格索引
35
40
  * @param point
36
41
  * @returns
37
42
  */
38
43
  getGridId(point: Point): string;
44
+ /**
45
+ * 清空所有数据
46
+ */
47
+ clear(): void;
39
48
  /**
40
49
  *
41
50
  * @param gridId
@@ -71,10 +80,7 @@ export declare class PointVirtualGrid<T = Record<string, any>> {
71
80
  * 查找相同点
72
81
  * @param point
73
82
  */
74
- queryPoint(point: Point, excludeOneself?: boolean): {
75
- point: Point;
76
- userData?: T;
77
- }[];
83
+ queryPoint(point: Point, excludeOneself?: boolean): PvgList<T>;
78
84
  /**
79
85
  * 查找点自己
80
86
  * @param point
@@ -0,0 +1,26 @@
1
+ import { LineSegment } from './LineSegment';
2
+ import { Point } from './Point';
3
+ export declare class Polygon<T = any> extends Array<Point<T>> {
4
+ constructor(points?: Point<T>[]);
5
+ /**
6
+ * 获取点相对于多边形的位置
7
+ * @param point
8
+ * @returns 'on' 边上,'inside' 内部,'outside' 外部
9
+ */
10
+ pointPosition(point: Point): "on" | "outside" | "inside";
11
+ /** 点在多边形上:包括路径和内部
12
+ * @param point
13
+ * @returns
14
+ */
15
+ pointIn(point: Point): boolean;
16
+ /** 点在多边形内部,不包括路径上
17
+ * @param point
18
+ * @returns
19
+ */
20
+ pointWithin(point: Point): boolean;
21
+ /** 通过线段创建
22
+ * @param lines
23
+ * @returns
24
+ */
25
+ static fromByLines(lines: LineSegment[]): Polygon<Record<string, any>>;
26
+ }
@@ -31,6 +31,7 @@ export declare class Quadtree<T = any> {
31
31
  * @param node
32
32
  */
33
33
  update(node: QuadtreeNode<T> | LineSegment): void;
34
+ clear(): void;
34
35
  /**
35
36
  * 获取线段所属的象限
36
37
  * @param line 线段
@@ -16,13 +16,43 @@ export declare class UndirectedGraph {
16
16
  forEach(callbackFun: (node: number, neighbors: Set<number>) => void): void;
17
17
  }
18
18
  export declare class LineSegmentUndirectedGraph extends UndirectedGraph {
19
- constructor(lines: LineSegment[]);
20
- private lineMap;
21
- protected create(lines: LineSegment[]): void;
22
- getLine(n1: number, n2: number): LineSegment<Record<string, any>> | undefined;
23
- private indexMap;
24
- private pointMap;
25
- private currentIndex;
26
- getIndex(point: Point): number;
27
- getPoint(index: number): Point<Record<string, any>> | undefined;
19
+ private readonly lineMap;
20
+ private readonly pointToIndex;
21
+ private readonly indexToPoint;
22
+ private nextIndex;
23
+ constructor(lines?: readonly LineSegment[]);
24
+ private buildFromLines;
25
+ /**
26
+ * 获取两点之间的线段(无向)
27
+ */
28
+ getLine(a: number, b: number): LineSegment | undefined;
29
+ /**
30
+ * 获取或创建点的索引
31
+ */
32
+ private getOrCreateIndex;
33
+ /**
34
+ * 安全获取点索引(已存在才返回)
35
+ */
36
+ getIndex(point: Point): number | undefined;
37
+ /**
38
+ * @param index
39
+ * @returns
40
+ */
41
+ getPoint(index: number): Point | undefined;
42
+ /**
43
+ * 获取所有点(只读数组,懒计算或缓存可进一步优化)
44
+ */
45
+ get points(): readonly Point[];
46
+ /**
47
+ * 获取所有线段
48
+ */
49
+ get lines(): readonly LineSegment[];
50
+ /**
51
+ * 批量添加线段(比逐条 addLine 更快)
52
+ */
53
+ addLines(lines: readonly LineSegment[]): this;
54
+ /**
55
+ * 清空图
56
+ */
57
+ clear(): void;
28
58
  }
@@ -0,0 +1,17 @@
1
+ export * from './Box2';
2
+ export * from './LineIndexGenerator';
3
+ export * from './LineSegment';
4
+ export * from './Lines';
5
+ export * from './Map';
6
+ export * from './Point';
7
+ export * from './Polygon';
8
+ export * from './Quadtree';
9
+ export * from './Rectangle';
10
+ export * from './UndirectedGraph';
11
+ export * from './UnionFindSet';
12
+ export * from './cloneUserData';
13
+ export * from './selectLocalFile';
14
+ export * from './PointVirtualGrid';
15
+ export * as dxfSystem from './DxfSystem';
16
+ export * as commandManager from './CommandManager';
17
+ export * as componentManager from './ComponentManager';
@@ -1,22 +0,0 @@
1
- import { PointVirtualGrid } from '../../PointVirtualGrid';
2
- import { LineSegment } from '../../LineSegment';
3
- /** 分组,通过路径
4
- * @param lines
5
- */
6
- export declare function groupByPath(lines: LineSegment[], grid?: PointVirtualGrid<LineSegment>): LineSegment<Record<string, any>>[][];
7
- /** 移除非环线
8
- * @param lines
9
- */
10
- export declare function removeNotRingLine(lines: LineSegment[], removeLines?: Set<LineSegment<Record<string, any>>>, grid0?: PointVirtualGrid<LineSegment>): LineSegment<Record<string, any>>[][];
11
- /** 查找线段组成的最大环
12
- * @param lines
13
- */
14
- export declare function findMaxRing(lines: LineSegment[], grid?: PointVirtualGrid<LineSegment>): LineSegment<Record<string, any>>[];
15
- /**
16
- * 从线段集合中提取所有闭合多边形
17
- */
18
- export declare function findClosedPolygons(lines: LineSegment[]): {
19
- removeLines: LineSegment<Record<string, any>>[];
20
- groups: LineSegment<Record<string, any>>[][];
21
- lines: LineSegment<Record<string, any>>[];
22
- };