@maqiuyao/dxf-viewer 0.2.34 → 0.2.35
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/README.md +3 -1
- package/dist/dxf-viewer.cjs +51 -51
- package/dist/dxf-viewer.js +3433 -3285
- package/dist/src/dxfViewer/core/dxf-splitter/DxfSplitter.d.ts +33 -2
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ export interface DxfBBox {
|
|
|
16
16
|
maxY: number;
|
|
17
17
|
}
|
|
18
18
|
/** 图框识别来源 */
|
|
19
|
-
export type DxfFrameSource = "insert" | "line-rect" | "closed-polyline";
|
|
19
|
+
export type DxfFrameSource = "insert" | "line-rect" | "closed-polyline" | "manual";
|
|
20
20
|
/** 识别出的图框信息 */
|
|
21
21
|
export interface DxfFrameInfo {
|
|
22
22
|
/** 图框序号(0 起,按阅读顺序排列) */
|
|
@@ -94,6 +94,37 @@ export declare class DxfSplitter {
|
|
|
94
94
|
* 识别图框并完成实体归属。重复调用安全(内部有缓存)。
|
|
95
95
|
*/
|
|
96
96
|
detectFrames(): DxfFrameInfo[];
|
|
97
|
+
/** 标题栏固定标签/页码/日期/纯数字等噪声 */
|
|
98
|
+
private static readonly TITLE_NOISE;
|
|
99
|
+
/** 图号 token:字母数字+连字符段(QJKG-304-4 / SXJZ220D7-11 / 2F-1003-04),行内拼接时跳过 */
|
|
100
|
+
private static readonly DRAWING_NO;
|
|
101
|
+
private isTitleNoise;
|
|
102
|
+
/**
|
|
103
|
+
* 从图框右下角标题栏区域(宽 50% × 高 22%)的 TEXT/MTEXT 识别图纸名称:
|
|
104
|
+
* 过滤固定标签/页码/日期/图号 token 后,按 y 聚类成行、行内按 x 拼接,
|
|
105
|
+
* 优先取含"图"字且长度 ≥4 的行,否则取最长行。识别不到返回 null。
|
|
106
|
+
*/
|
|
107
|
+
private extractFrameTitle;
|
|
108
|
+
/** 用识别出的图名重命名图框;重名自动追加序号;识别失败保持"图框NN"占位 */
|
|
109
|
+
private applyTitleNames;
|
|
110
|
+
/**
|
|
111
|
+
* 手工框选:用图纸坐标矩形补一个图框(无需先调用 detectFrames,可纯手工模式)。
|
|
112
|
+
*
|
|
113
|
+
* 框内实体(包围盒与框重叠率 ≥ 50%,与自动归属同规则)会归属到该框
|
|
114
|
+
* (含从其他图框"抢走"),随后同样尝试右下角图名识别,失败则命名"手工框选N"。
|
|
115
|
+
* @returns 新增的图框信息;调用 split([frame.index]) 即可导出该框
|
|
116
|
+
*/
|
|
117
|
+
addManualFrame(bbox: DxfBBox): DxfFrameInfo | null;
|
|
118
|
+
/** 把手工框框内实体重新归属到该框(覆盖原归属),返回归属实体数 */
|
|
119
|
+
private reassignManualEntities;
|
|
120
|
+
/** 删除图框(自动识别/手工框选均可),其名下实体重回未归属状态 */
|
|
121
|
+
removeFrame(index: number): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* 更新图框范围(移动/拉伸后调用),并重新归属实体:
|
|
124
|
+
* 新框内实体从其他图框"抢回",移出框外的实体释放为未归属。
|
|
125
|
+
* @returns 更新后的图框信息
|
|
126
|
+
*/
|
|
127
|
+
updateFrameBBox(index: number, bbox: DxfBBox): DxfFrameInfo | null;
|
|
97
128
|
/**
|
|
98
129
|
* 按图框拆分为多张子 DXF。
|
|
99
130
|
* @param frameIndices 要导出的图框序号数组;不传则导出全部图框。
|
|
@@ -145,7 +176,7 @@ export declare class DxfSplitter {
|
|
|
145
176
|
private detectLineRects;
|
|
146
177
|
/** 候选去重、过滤、排序并命名 */
|
|
147
178
|
private filterAndSortCandidates;
|
|
148
|
-
/**
|
|
179
|
+
/** 把每个实体块归属到重叠率最大的图框(assignments 存图框 index,非数组位置) */
|
|
149
180
|
private assignEntities;
|
|
150
181
|
private report;
|
|
151
182
|
}
|