dxfview 0.0.3 → 0.0.4-beta.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.
@@ -215,7 +215,7 @@ export declare class DxfLoader extends THREE.Loader {
215
215
  private timer;
216
216
  private ignorePaperSpace;
217
217
  font?: FontManager;
218
- private encoding;
218
+ encoding: string;
219
219
  private overrideColor?;
220
220
  private overrideHatchPatternLineThickness?;
221
221
  angBase: number | IPoint;
@@ -1 +1 @@
1
- export declare const DEFAULT_PUBLIC_KEY_HEX = "0xe93f27a3147a0e2f67b718dffbf7553981ec8d9bb8bf7d18a4ba1f491736ea78";
1
+ export declare const DEFAULT_PUBLIC_KEY_HEX = "0xe98c5ce23e9da75c9169a670637a1ff68e373ddbf7e98cb85efdfb8a6106bf33";
@@ -445,7 +445,7 @@ export declare class MergeUtils {
445
445
  *
446
446
  * @returns 是否可以合并 - true表示两个对象兼容,可以合并
447
447
  */
448
- static areObjectsMergeable(o1: THREE.Object3D, o2: THREE.Object3D): any;
448
+ static areObjectsMergeable(o1: THREE.Object3D, o2: THREE.Object3D): boolean | undefined;
449
449
  /**
450
450
  * 检查网格是否为合并后的对象
451
451
  *
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 判断是否为utf-8
3
+ */
4
+ export declare function isUTF8(bytes: Uint8Array): boolean;
@@ -15,12 +15,60 @@ export declare class AnnotationPlugin extends Plugin {
15
15
  private activeAnnotationType;
16
16
  private mobileTouchHelper?;
17
17
  private selectedMaskColor?;
18
+ private readonly partitionLabels;
18
19
  constructor(viewer: BaseViewer);
19
20
  getDrawableList(): {
20
21
  id: string;
21
22
  position: THREE.Vector3;
22
23
  title: string;
24
+ details: import("./BaseAnnotationDrawable").ClosedShape;
23
25
  }[];
26
+ getDrawableDatas(): AnnotationData[];
27
+ setDrawableDatas(datas: AnnotationData[]): void;
28
+ getAigcJson(): {
29
+ properties: {
30
+ uuid: number;
31
+ name: string;
32
+ modelLibraries: string[];
33
+ }[];
34
+ CAD: ({
35
+ itemName: string;
36
+ data: number[];
37
+ keyObjects?: undefined;
38
+ roomObjects?: undefined;
39
+ } | {
40
+ keyObjects: object[];
41
+ itemName?: undefined;
42
+ data?: undefined;
43
+ roomObjects?: undefined;
44
+ } | {
45
+ roomObjects: object[];
46
+ itemName?: undefined;
47
+ data?: undefined;
48
+ keyObjects?: undefined;
49
+ })[];
50
+ LLM: never[];
51
+ };
52
+ /**
53
+ * 获取标注的分区方案信息
54
+ */
55
+ getAiPartitionScheme(): object[];
56
+ /**
57
+ * 扁平化points
58
+ */
59
+ private flattenPoints;
60
+ /**
61
+ * 检查标题是否匹配标签列表
62
+ */
63
+ private isMatchingLabel;
64
+ /**
65
+ * 计算方向角度(基于第一条边)
66
+ */
67
+ private calculateDirection;
68
+ /**
69
+ * 中文标签映射到英文
70
+ */
71
+ private mapChineseToEnglish;
24
72
  private initEvents;
25
73
  protected get canvas(): HTMLCanvasElement;
26
74
  protected get raycaster(): any;
@@ -72,6 +120,7 @@ export declare class AnnotationPlugin extends Plugin {
72
120
  * @description {zh} 取消当前的标注绘制。这并不会退出标注,用户可以开始一个新的标注。
73
121
  */
74
122
  cancel(): void;
123
+ private getLastDrawable;
75
124
  /**
76
125
  *
77
126
  * @param {AnnotationData[]} dataArray
@@ -95,10 +95,16 @@ export declare abstract class BaseAnnotation extends Event<AnnotationEvents> {
95
95
  dblclick: () => void;
96
96
  protected onMouseClick(e: EventInfo): void;
97
97
  protected selectAnnotationByEvent(e: EventInfo): void;
98
+ /**
99
+ * 撤销当前绘制的最后一个点。
100
+ * @returns 是否成功撤销
101
+ */
102
+ undoLastPoint(): boolean;
98
103
  keydown: (e: EventInfo) => void;
99
104
  abstract exitDrawing(): void;
100
105
  abstract cancel(): void;
101
106
  protected abstract complete(): void;
107
+ protected getMinPointsToComplete(): number;
102
108
  protected abstract setTooltipContent(): void;
103
109
  protected abstract createAnnotationDrawable(): BaseAnnotationDrawable | undefined;
104
110
  protected onMouseMove(position: THREE.Vector3): void;
@@ -58,6 +58,10 @@ export declare abstract class BaseAnnotationDrawable extends Drawable {
58
58
  protected details: ClosedShape;
59
59
  protected ctx?: CanvasRenderingContext2D;
60
60
  parent?: BaseAnnotationDrawable;
61
+ protected segmentLabelOffset: number;
62
+ protected segmentLabelFontSize: number;
63
+ protected segmentLabelPaddingX: number;
64
+ protected segmentLabelPaddingY: number;
61
65
  protected annotationType?: AnnotationType;
62
66
  protected titleText?: string;
63
67
  protected annotationProperty?: AnnotationProperty;
@@ -106,6 +110,7 @@ export declare abstract class BaseAnnotationDrawable extends Drawable {
106
110
  isPointInPath(p: THREE.Vector3): boolean;
107
111
  setData(data: AnnotationData): void;
108
112
  setParent(parent: BaseAnnotationDrawable): void;
113
+ setParentId(parentId: string): void;
109
114
  update(points: THREE.Vector3[]): this;
110
115
  /**
111
116
  * 对封闭图形的点按从左上角顺时针方向排序
@@ -136,4 +141,9 @@ export declare abstract class BaseAnnotationDrawable extends Drawable {
136
141
  * 停用射线检测器
137
142
  */
138
143
  deactivateRaycaster(): void;
144
+ protected drawSegmentLengths(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
145
+ private drawSegmentLengthLabel;
146
+ private drawRoundedRect;
147
+ protected getPointsForSegmentLength(): THREE.Vector3[];
148
+ protected shouldCloseSegments(): boolean;
139
149
  }
@@ -56,4 +56,12 @@ export declare class FreeDrawAnnotation extends BaseAnnotation {
56
56
  * 将世界坐标转换为屏幕坐标
57
57
  */
58
58
  private worldToScreen;
59
+ /**
60
+ * 从数据恢复标注
61
+ * 专用于JSON数据恢复,支持保持原始ID不变
62
+ * @param points 点集合
63
+ * @param customId 自定义ID,用于保持JSON中的原始ID
64
+ * @returns 创建的标注ID
65
+ */
66
+ restoreFromData(points: THREE.Vector3[], customId?: string): string | undefined;
59
67
  }
@@ -50,4 +50,5 @@ export declare class RectAnnotation extends BaseAnnotation {
50
50
  * 重写鼠标移动处理,用于实时预览
51
51
  */
52
52
  protected onMouseMove(position: THREE.Vector3): void;
53
+ private updateRectanglePoints;
53
54
  }
@@ -13,16 +13,21 @@ export declare class RectDrawable extends BaseAnnotationDrawable {
13
13
  constructor(id: string, osnapHelper: OSnapHelper, points: THREE.Vector3[], viewer?: BaseViewer);
14
14
  draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
15
15
  /**
16
- * 根据两个对角点计算矩形的四个顶点
16
+ * 根据当前点数据计算矩形的四个顶点
17
17
  */
18
18
  private getRectPoints;
19
19
  isPointInPath(p: THREE.Vector3): boolean;
20
20
  getVertexes(): THREE.Vector3[];
21
+ protected getPointsForSegmentLength(): THREE.Vector3[];
21
22
  getClassType(): string;
22
23
  /**
23
- * 重写更新方法,确保矩形只需要两个点
24
+ * 重写更新方法,绘制时保持2个对角点,完成时转换为4个顶点
24
25
  */
25
26
  update(points: THREE.Vector3[]): this;
27
+ /**
28
+ * 完成绘制时,确保使用完整的4个顶点
29
+ */
30
+ finalizePoints(): void;
26
31
  /**
27
32
  * 重写拖拽开始方法,处理4个顶点的拖拽
28
33
  */
@@ -39,4 +44,5 @@ export declare class RectDrawable extends BaseAnnotationDrawable {
39
44
  * 根据拖拽的顶点更新矩形的两个对角点
40
45
  */
41
46
  private updateRectFromVertexDrag;
47
+ private computeRectFromDiagonal;
42
48
  }
@@ -8,6 +8,7 @@ export declare class FreeDrawDrawable extends BaseAnnotationDrawable {
8
8
  draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
9
9
  isPointInPath(p: THREE.Vector3): boolean;
10
10
  getVertexes(): THREE.Vector3[];
11
+ protected shouldCloseSegments(): boolean;
11
12
  getClassType(): string;
12
13
  /**
13
14
  * 检查当前图形是否为闭合图形
@@ -55,6 +55,7 @@ export interface PartitionDoorProperty extends BaseAnnotationProperty {
55
55
  doorDirection: number;
56
56
  doorArea: number;
57
57
  openingAngle?: number;
58
+ crowdDensity?: number;
58
59
  material?: string;
59
60
  }
60
61
  export interface PartitionWindowProperty extends BaseAnnotationProperty {
@@ -1,3 +1,4 @@
1
+ import { FrameDrawable } from "./FrameDrawable";
1
2
  import type { DivideFrameInfo } from "./types";
2
3
  import type { BaseViewer } from "../../core/viewers";
3
4
  import { Plugin } from "../../core/viewers/Plugin";
@@ -172,10 +173,17 @@ export declare class DividePlugin extends Plugin {
172
173
  * @param title 图框标题
173
174
  * @param category 图框分类
174
175
  */
175
- createFrameWithInfo(drawable: any, title: string, category: string): void;
176
+ createFrameWithInfo(drawable: FrameDrawable, title: string, category: string): void;
176
177
  /**
177
178
  * 取消图框创建
178
179
  * @param drawable 要取消的绘制数据
179
180
  */
180
- cancelFrameCreation(drawable: any): void;
181
+ cancelFrameCreation(drawable: FrameDrawable): void;
182
+ /**
183
+ * 从JSON数据恢复图框
184
+ * 根据保存的角点坐标重新创建图框
185
+ * @param framesData 图框数据数组
186
+ * @returns 成功恢复的图框数量
187
+ */
188
+ restoreFrames(framesData: DivideFrameInfo[]): number;
181
189
  }
package/package.json CHANGED
@@ -1,90 +1,90 @@
1
- {
2
- "name": "dxfview",
3
- "version": "0.0.3",
4
- "homepage": "",
5
- "module": "dist/dxfview.esm.min.js",
6
- "main": "dist/dxfview.esm.min.js",
7
- "types": "dist/types/index.d.ts",
8
- "type": "module",
9
- "scripts": {
10
- "clean": "rimraf dist build",
11
- "build:release": "node --loader ts-node/esm esbuild.config.ts -mode=production",
12
- "build:prebuild": "node --loader ts-node/esm esbuild.config.ts -mode=prebuild",
13
- "build:datatype": "tsc && tsc-alias",
14
- "build": "npm run clean && npm run lint-fix && npm run build:datatype && npm run build:release",
15
- "build:dev": "npm run clean && npm run lint-fix && npm run build:prebuild",
16
- "build:dev:watch": "npm run clean && npm run lint-fix && npm run build:datatype && node --loader ts-node/esm esbuild.config.ts -mode=devwatch",
17
- "demo": "npm run build:dev && node demo/index.cjs",
18
- "start": "node --loader ts-node/esm esbuild.config.ts -mode=development",
19
- "lint": "eslint src --ext ts",
20
- "lint-fix": "npm run lint -- --fix",
21
- "docs": "typedoc src/export.doc.ts --excludePrivate --excludeProtected --excludeInternal --exclude src/pathes/*"
22
- },
23
- "files": [
24
- "/dist"
25
- ],
26
- "repository": {
27
- "type": "git"
28
- },
29
- "author": "dxfview",
30
- "license": "UNLICENSED",
31
- "dependencies": {
32
- "@noble/ed25519": "^2.0.0",
33
- "@noble/hashes": "^1.4.0",
34
- "@types/concaveman": "^1.1.3",
35
- "@types/lodash": "^4.14.165",
36
- "@types/resize-observer-browser": "^0.1.7",
37
- "2d-polygon-boolean": "^1.0.1",
38
- "2d-polygon-self-intersections": "^1.3.1",
39
- "camera-controls": "^1.37.4",
40
- "clipper-lib": "^6.4.2",
41
- "concaveman": "^1.2.1",
42
- "core-js": "^3.27.1",
43
- "disable-devtool": "^0.3.9",
44
- "i18next": "^21.6.0",
45
- "intl-pluralrules": "^1.3.1",
46
- "javascript-obfuscator": "^4.1.1",
47
- "js-base64": "^3.7.2",
48
- "jsbi": "^4.3.0",
49
- "lodash": "^4.17.20",
50
- "loglevel": "^1.8.0",
51
- "mitt": "^3.0.0",
52
- "opentype.js": "^1.3.4",
53
- "poly-extrude": "^0.2.0",
54
- "polybooljs": "^1.2.0",
55
- "polygon-clipping": "^0.15.3",
56
- "regenerator-runtime": "^0.13.11",
57
- "screenfull": "^6.0.0",
58
- "stream": "^0.0.2",
59
- "three": "^0.155.0",
60
- "three-mesh-bvh": "^0.5.21"
61
- },
62
- "devDependencies": {
63
- "@fal-works/esbuild-plugin-global-externals": "^2.1.2",
64
- "@types/eslint": "^8.21.1",
65
- "@types/node": "^18.11.19",
66
- "@types/resize-observer-browser": "^0.1.7",
67
- "@types/sha256": "^0.2.0",
68
- "@types/three": "^0.155.0",
69
- "@typescript-eslint/eslint-plugin": "^5.0.0",
70
- "@typescript-eslint/parser": "^5.47.1",
71
- "esbuild": "^0.16.17",
72
- "esbuild-plugin-inline-worker": "^0.1.1",
73
- "esbuild-plugin-sass": "^1.0.1",
74
- "eslint": "^8.15.0",
75
- "eslint-config-prettier": "^8.5.0",
76
- "eslint-import-resolver-typescript": "^3.5.2",
77
- "eslint-plugin-import": "2.26.0",
78
- "eslint-plugin-prettier": "^4.2.1",
79
- "express": "^4.17.1",
80
- "live-server": "^1.2.2",
81
- "prettier": "^2.5.1",
82
- "rimraf": "^3.0.2",
83
- "sha256": "^0.2.0",
84
- "terser": "^5.16.2",
85
- "ts-node": "^10.9.1",
86
- "tsc-alias": "^1.8.2",
87
- "typedoc": "^0.22.12",
88
- "typescript": "^4.5.2"
89
- }
90
- }
1
+ {
2
+ "name": "dxfview",
3
+ "version": "0.0.4-beta.10",
4
+ "homepage": "",
5
+ "module": "dist/dxfview.esm.min.js",
6
+ "main": "dist/dxfview.esm.min.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "type": "module",
9
+ "scripts": {
10
+ "clean": "rimraf dist build",
11
+ "build:release": "node --loader ts-node/esm esbuild.config.ts -mode=production",
12
+ "build:prebuild": "node --loader ts-node/esm esbuild.config.ts -mode=prebuild",
13
+ "build:datatype": "tsc && tsc-alias",
14
+ "build": "npm run clean && npm run lint-fix && npm run build:datatype && npm run build:release",
15
+ "build:dev": "npm run clean && npm run lint-fix && npm run build:prebuild",
16
+ "build:dev:watch": "npm run clean && npm run lint-fix && npm run build:datatype && node --loader ts-node/esm esbuild.config.ts -mode=devwatch",
17
+ "demo": "npm run build:dev && node demo/index.cjs",
18
+ "start": "node --loader ts-node/esm esbuild.config.ts -mode=development",
19
+ "lint": "eslint src --ext ts",
20
+ "lint-fix": "npm run lint -- --fix",
21
+ "docs": "typedoc src/export.doc.ts --excludePrivate --excludeProtected --excludeInternal --exclude src/pathes/*"
22
+ },
23
+ "files": [
24
+ "/dist"
25
+ ],
26
+ "repository": {
27
+ "type": "git"
28
+ },
29
+ "author": "dxfview",
30
+ "license": "UNLICENSED",
31
+ "dependencies": {
32
+ "@noble/ed25519": "^2.0.0",
33
+ "@noble/hashes": "^1.4.0",
34
+ "@types/concaveman": "^1.1.3",
35
+ "@types/lodash": "^4.14.165",
36
+ "@types/resize-observer-browser": "^0.1.7",
37
+ "2d-polygon-boolean": "^1.0.1",
38
+ "2d-polygon-self-intersections": "^1.3.1",
39
+ "camera-controls": "^1.37.4",
40
+ "clipper-lib": "^6.4.2",
41
+ "concaveman": "^1.2.1",
42
+ "core-js": "^3.27.1",
43
+ "disable-devtool": "^0.3.9",
44
+ "i18next": "^21.6.0",
45
+ "intl-pluralrules": "^1.3.1",
46
+ "javascript-obfuscator": "^4.1.1",
47
+ "js-base64": "^3.7.2",
48
+ "jsbi": "^4.3.0",
49
+ "lodash": "^4.17.20",
50
+ "loglevel": "^1.8.0",
51
+ "mitt": "^3.0.0",
52
+ "opentype.js": "^1.3.4",
53
+ "poly-extrude": "^0.2.0",
54
+ "polybooljs": "^1.2.0",
55
+ "polygon-clipping": "^0.15.3",
56
+ "regenerator-runtime": "^0.13.11",
57
+ "screenfull": "^6.0.0",
58
+ "stream": "^0.0.2",
59
+ "three": "^0.155.0",
60
+ "three-mesh-bvh": "^0.5.21"
61
+ },
62
+ "devDependencies": {
63
+ "@fal-works/esbuild-plugin-global-externals": "^2.1.2",
64
+ "@types/eslint": "^8.21.1",
65
+ "@types/node": "^18.11.19",
66
+ "@types/resize-observer-browser": "^0.1.7",
67
+ "@types/sha256": "^0.2.0",
68
+ "@types/three": "^0.155.0",
69
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
70
+ "@typescript-eslint/parser": "^5.47.1",
71
+ "esbuild": "^0.16.17",
72
+ "esbuild-plugin-inline-worker": "^0.1.1",
73
+ "esbuild-plugin-sass": "^1.0.1",
74
+ "eslint": "^8.15.0",
75
+ "eslint-config-prettier": "^8.5.0",
76
+ "eslint-import-resolver-typescript": "^3.5.2",
77
+ "eslint-plugin-import": "2.26.0",
78
+ "eslint-plugin-prettier": "^4.2.1",
79
+ "express": "^4.17.1",
80
+ "live-server": "^1.2.2",
81
+ "prettier": "^2.5.1",
82
+ "rimraf": "^3.0.2",
83
+ "sha256": "^0.2.0",
84
+ "terser": "^5.16.2",
85
+ "ts-node": "^10.9.1",
86
+ "tsc-alias": "^1.8.2",
87
+ "typedoc": "^0.22.12",
88
+ "typescript": "^4.5.2"
89
+ }
90
+ }