dxfview 0.0.4-beta.1 → 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.
- package/dist/dxfview.esm.min.js +2 -2
- package/dist/types/core/dxf/DxfLoader.d.ts +1 -1
- package/dist/types/core/utils/MergeUtils.d.ts +1 -1
- package/dist/types/core/utils/utf8OrGBK.d.ts +4 -0
- package/dist/types/plugins/annotation/AnnotationPlugin.d.ts +8 -0
- package/dist/types/plugins/annotation/BaseAnnotation.d.ts +6 -0
- package/dist/types/plugins/annotation/BaseAnnotationDrawable.d.ts +10 -0
- package/dist/types/plugins/annotation/FreeDrawAnnotation.d.ts +8 -0
- package/dist/types/plugins/annotation/RectAnnotation.d.ts +1 -0
- package/dist/types/plugins/annotation/RectDrawable.d.ts +3 -1
- package/dist/types/plugins/annotation/freeDrawDrawable.d.ts +1 -0
- package/dist/types/plugins/annotation/type.d.ts +1 -0
- package/dist/types/plugins/divide/DividePlugin.d.ts +10 -2
- package/package.json +90 -90
|
@@ -215,7 +215,7 @@ export declare class DxfLoader extends THREE.Loader {
|
|
|
215
215
|
private timer;
|
|
216
216
|
private ignorePaperSpace;
|
|
217
217
|
font?: FontManager;
|
|
218
|
-
|
|
218
|
+
encoding: string;
|
|
219
219
|
private overrideColor?;
|
|
220
220
|
private overrideHatchPatternLineThickness?;
|
|
221
221
|
angBase: number | IPoint;
|
|
@@ -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):
|
|
448
|
+
static areObjectsMergeable(o1: THREE.Object3D, o2: THREE.Object3D): boolean | undefined;
|
|
449
449
|
/**
|
|
450
450
|
* 检查网格是否为合并后的对象
|
|
451
451
|
*
|
|
@@ -15,6 +15,7 @@ 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;
|
|
@@ -22,6 +23,8 @@ export declare class AnnotationPlugin extends Plugin {
|
|
|
22
23
|
title: string;
|
|
23
24
|
details: import("./BaseAnnotationDrawable").ClosedShape;
|
|
24
25
|
}[];
|
|
26
|
+
getDrawableDatas(): AnnotationData[];
|
|
27
|
+
setDrawableDatas(datas: AnnotationData[]): void;
|
|
25
28
|
getAigcJson(): {
|
|
26
29
|
properties: {
|
|
27
30
|
uuid: number;
|
|
@@ -50,6 +53,10 @@ export declare class AnnotationPlugin extends Plugin {
|
|
|
50
53
|
* 获取标注的分区方案信息
|
|
51
54
|
*/
|
|
52
55
|
getAiPartitionScheme(): object[];
|
|
56
|
+
/**
|
|
57
|
+
* 扁平化points
|
|
58
|
+
*/
|
|
59
|
+
private flattenPoints;
|
|
53
60
|
/**
|
|
54
61
|
* 检查标题是否匹配标签列表
|
|
55
62
|
*/
|
|
@@ -113,6 +120,7 @@ export declare class AnnotationPlugin extends Plugin {
|
|
|
113
120
|
* @description {zh} 取消当前的标注绘制。这并不会退出标注,用户可以开始一个新的标注。
|
|
114
121
|
*/
|
|
115
122
|
cancel(): void;
|
|
123
|
+
private getLastDrawable;
|
|
116
124
|
/**
|
|
117
125
|
*
|
|
118
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
|
}
|
|
@@ -18,13 +18,14 @@ export declare class RectDrawable extends BaseAnnotationDrawable {
|
|
|
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;
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
+
* 完成绘制时,确保使用完整的4个顶点
|
|
28
29
|
*/
|
|
29
30
|
finalizePoints(): void;
|
|
30
31
|
/**
|
|
@@ -43,4 +44,5 @@ export declare class RectDrawable extends BaseAnnotationDrawable {
|
|
|
43
44
|
* 根据拖拽的顶点更新矩形的两个对角点
|
|
44
45
|
*/
|
|
45
46
|
private updateRectFromVertexDrag;
|
|
47
|
+
private computeRectFromDiagonal;
|
|
46
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:
|
|
176
|
+
createFrameWithInfo(drawable: FrameDrawable, title: string, category: string): void;
|
|
176
177
|
/**
|
|
177
178
|
* 取消图框创建
|
|
178
179
|
* @param drawable 要取消的绘制数据
|
|
179
180
|
*/
|
|
180
|
-
cancelFrameCreation(drawable:
|
|
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.4-beta.
|
|
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
|
+
}
|