@xtctwins/tctwins-dxf-next-viewer 0.0.5 → 0.0.7
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 +73 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# xtd 二维文件查看器
|
|
1
|
+
# xtd 二维文件查看器
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 安装相关依赖
|
|
4
4
|
|
|
5
5
|
## 网络请求 axios
|
|
6
6
|
|
|
@@ -31,7 +31,7 @@ npm i mitt
|
|
|
31
31
|
<https://www.npmjs.com/package/pinia>
|
|
32
32
|
|
|
33
33
|
```ssh
|
|
34
|
-
npm i pinia
|
|
34
|
+
npm i pinia@3
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## 3D three
|
|
@@ -45,7 +45,10 @@ npm i three
|
|
|
45
45
|
# 安装依赖
|
|
46
46
|
|
|
47
47
|
```ssh
|
|
48
|
+
// 安装依赖
|
|
48
49
|
npm i @xtctwins/tctwins-dxf-next-viewer
|
|
50
|
+
// 引入样式
|
|
51
|
+
import "@xtctwins/tctwins-dxf-next-viewer/dist/tctwins-dxf-next-viewer.css";
|
|
49
52
|
```
|
|
50
53
|
|
|
51
54
|
# 拷贝资源
|
|
@@ -56,7 +59,7 @@ npm i @xtctwins/tctwins-dxf-next-viewer
|
|
|
56
59
|
|
|
57
60
|
# Example
|
|
58
61
|
|
|
59
|
-
```
|
|
62
|
+
```ts
|
|
60
63
|
<template>
|
|
61
64
|
<TctwinsDxf
|
|
62
65
|
is-pc
|
|
@@ -97,6 +100,8 @@ npm i @xtctwins/tctwins-dxf-next-viewer
|
|
|
97
100
|
</template>
|
|
98
101
|
<script setup>
|
|
99
102
|
import { ref } from "vue";
|
|
103
|
+
// 引入样式
|
|
104
|
+
import "@xtctwins/tctwins-dxf-next-viewer/dist/tctwins-dxf-next-viewer.css";
|
|
100
105
|
import { TctwinsDxf } from "@xtctwins/tctwins-dxf-next-viewer";
|
|
101
106
|
const fileUrl = ref("https://xxxxxx/demo.xtd");
|
|
102
107
|
// 字体链接列表,默认字体可取tctwins-dxf-viewer/fonts下的文字路径
|
|
@@ -136,9 +141,9 @@ const eventHandle = (event) => {
|
|
|
136
141
|
|
|
137
142
|
### Events
|
|
138
143
|
|
|
139
|
-
| 事件名 | 说明 | 回调参数
|
|
140
|
-
| ----------- | -------- |
|
|
141
|
-
| eventHandle |
|
|
144
|
+
| 事件名 | 说明 | 回调参数 |
|
|
145
|
+
| ----------- | -------- | -------------------------------------------------------------------------------------- |
|
|
146
|
+
| eventHandle | 通知事件 | event: { isTool: booolean; event_target: string; event_name: string; content: object;} |
|
|
142
147
|
|
|
143
148
|
### Slots
|
|
144
149
|
|
|
@@ -273,3 +278,64 @@ closeAllTool();
|
|
|
273
278
|
// 显示所有工具
|
|
274
279
|
toggleAllTool(true);
|
|
275
280
|
```
|
|
281
|
+
|
|
282
|
+
# 交互操作
|
|
283
|
+
|
|
284
|
+
## 数据存储格式
|
|
285
|
+
|
|
286
|
+
```ts
|
|
287
|
+
interface Data {
|
|
288
|
+
id: string || number;
|
|
289
|
+
content: {
|
|
290
|
+
[key: string]: any; // 数据
|
|
291
|
+
}; // 创建方法返回的数据
|
|
292
|
+
[key: string]: any; // 用户自定义的其他数据
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## 测量相关
|
|
297
|
+
|
|
298
|
+
1. 测量列表
|
|
299
|
+
window.dxfViewer.measureTool.showMeasureList([] as Data[]);
|
|
300
|
+
2. 删除测量
|
|
301
|
+
window.dxfViewer.measureTool.deleteTargetObjectById(event.content.id);
|
|
302
|
+
|
|
303
|
+
## 批注相关
|
|
304
|
+
|
|
305
|
+
1. 批注列表
|
|
306
|
+
window.dxfViewer.commentTool.showCommentList([] as Data[]);
|
|
307
|
+
2. 删除批注
|
|
308
|
+
window.dxfViewer.commentTool.deleteTargetObjectById(event.content.id);
|
|
309
|
+
|
|
310
|
+
## 标注相关
|
|
311
|
+
|
|
312
|
+
1. 标注列表
|
|
313
|
+
window.dxfViewer.annotationTool.showAnnotationList([] as Data[]);
|
|
314
|
+
2. 删除标注
|
|
315
|
+
删除记录后重新绘制即可
|
|
316
|
+
|
|
317
|
+
## 图层数据源
|
|
318
|
+
|
|
319
|
+
```ts
|
|
320
|
+
// 定义 LayerData 接口,用于描述图层的数据结构
|
|
321
|
+
interface LayerData {
|
|
322
|
+
color: number; // 图层的颜色,使用数字表示
|
|
323
|
+
displayName: string; // 图层的显示名称
|
|
324
|
+
lineType: string; // 图层的线条类型
|
|
325
|
+
name: string; // 图层的名称
|
|
326
|
+
objects: any[]; // 图层包含的对象数组
|
|
327
|
+
visible: boolean; // 图层是否可见
|
|
328
|
+
}
|
|
329
|
+
// 使用 Map 类型来存储图层数据,键为字符串,值为 LayerData 对象
|
|
330
|
+
const layerMap: Map<string, LayerData> = new Map(window.dxfViewer.layers);
|
|
331
|
+
// 遍历图层数据,获取每个图层的信息
|
|
332
|
+
for (const [key, value] of layerMap) {
|
|
333
|
+
console.log(`图层名称:${value.name}`);
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
# 说明
|
|
338
|
+
|
|
339
|
+
1. 是否支持移动端查看?
|
|
340
|
+
|
|
341
|
+
- 目前不支持
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xtctwins/tctwins-dxf-next-viewer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/tctwins-dxf-next-viewer.umd.js",
|
|
7
7
|
"module": "dist/tctwins-dxf-next-viewer.es.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"axios": "^1.7.9",
|
|
20
20
|
"element-plus": "^2.9.3",
|
|
21
21
|
"mitt": "^3.0.1",
|
|
22
|
-
"pinia": "^
|
|
22
|
+
"pinia": "^3.0.1",
|
|
23
23
|
"three": "^0.173.0",
|
|
24
24
|
"vue": "^3.5.13"
|
|
25
25
|
},
|