build-dxf 0.0.56 → 0.0.58
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/package.json +2 -2
- package/src/DomEventRegister.js +3117 -1926
- package/src/build.d.ts +33 -0
- package/src/build.js +12327 -5002
- package/src/constants.d.ts +7 -0
- package/src/index.css +773 -1
- package/src/index.js +12 -9
- package/src/index2.js +516 -327
- package/src/index3.js +2755 -1741
- package/src/pages/Test.vue.d.ts +2 -0
- package/src/pages/buildJson.vue.d.ts +4 -0
- package/src/pages/modelCarrier/index.vue.d.ts +2 -0
- package/src/utils/Debouncing.d.ts +7 -0
- package/src/utils/DxfSystem/DxfSystem.d.ts +4 -5
- package/src/utils/DxfSystem/components/CorrectionDxf.d.ts +126 -0
- package/src/utils/DxfSystem/components/Dxf.d.ts +2 -3
- package/src/utils/DxfSystem/plugin/Editor/EditorPlugin.d.ts +9 -0
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/Default.d.ts +16 -6
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DeleteSelectLine.d.ts +2 -6
- package/src/utils/DxfSystem/plugin/Editor/components/RenderManager.d.ts +2 -2
- package/src/utils/DxfSystem/plugin/Editor/components/index.d.ts +0 -1
- package/src/utils/DxfSystem/plugin/Editor/index.d.ts +3 -10
- package/src/utils/DxfSystem/plugin/ModelDataPlugin/components/WhiteModel.d.ts +1 -1
- package/src/utils/DxfSystem/type.d.ts +4 -1
- package/src/utils/DxfSystem/utils/AxisAlignCorr.d.ts +2 -2
- package/src/utils/DxfSystem/utils/CAD.d.ts +149 -4
- package/src/utils/DxfSystem/utils/LineGroupType.d.ts +11 -0
- package/src/utils/DxfSystem/utils/getWinDrawData.d.ts +18 -0
- package/src/utils/Map.d.ts +3 -0
- package/src/utils/Point.d.ts +3 -2
- package/src/utils/Polygon.d.ts +17 -1
- package/src/utils/Rectangle.d.ts +1 -0
- package/src/utils/modelScenario/scenario.d.ts +64 -0
- package/src/utils/DxfSystem/components/AngleCorrectionDxf.d.ts +0 -13
package/src/index2.js
CHANGED
|
@@ -1,113 +1,159 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import * as
|
|
3
|
-
import { Group
|
|
1
|
+
import { C as Component, L as Lines, P as Point, V as Variable, D as DxfSystem, M as ModelDataPlugin, a as DetailsPoint, W as WhiteModel, S as SelectLocalFile } from "./build.js";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
import { Group } from "three";
|
|
4
4
|
import "clipper-lib";
|
|
5
5
|
import "dxf-writer";
|
|
6
|
-
import { E as
|
|
7
|
-
import { defineComponent
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
import { E as ElButton, R as Renderer, D as DomEventRegister, a as DomContainer, b as ElCheckbox } from "./DomEventRegister.js";
|
|
7
|
+
import { defineComponent, createElementBlock, openBlock, createElementVNode, toDisplayString, createVNode, unref, withCtx, createTextVNode, createApp, ref, watch, onMounted, onUnmounted, createCommentVNode, createStaticVNode } from "vue";
|
|
8
|
+
function drawLinePathToPng(points, width, height, color = "#fff", lineWidth = 2) {
|
|
9
|
+
const can = document.createElement("canvas"), ctx = can.getContext("2d");
|
|
10
|
+
can.width = width;
|
|
11
|
+
can.height = height;
|
|
12
|
+
ctx?.clearRect(0, 0, width, height);
|
|
13
|
+
ctx?.save();
|
|
14
|
+
ctx.strokeStyle = color;
|
|
15
|
+
ctx.lineWidth = lineWidth;
|
|
16
|
+
ctx?.beginPath();
|
|
17
|
+
points.forEach((p, i) => {
|
|
18
|
+
if (i === 0) ctx?.moveTo(p[0], p[1]);
|
|
19
|
+
else ctx?.lineTo(p[0], p[1]);
|
|
20
|
+
});
|
|
21
|
+
ctx?.stroke();
|
|
22
|
+
ctx?.restore();
|
|
23
|
+
return can.toDataURL("image/png", 1);
|
|
13
24
|
}
|
|
14
|
-
const
|
|
25
|
+
const _hoisted_1$1 = { class: "bg-white rounded-lg p-[10px] w-[200px] text-[14px]" };
|
|
26
|
+
const _hoisted_2$1 = { class: "flex" };
|
|
27
|
+
const _hoisted_3$1 = { class: "flee-1 text-[14px] leading-[1.4em]" };
|
|
28
|
+
const _hoisted_4$1 = { class: "mt-[10px] ml-[1.4em]" };
|
|
29
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
15
30
|
__name: "Card",
|
|
16
31
|
props: {
|
|
17
32
|
message: {}
|
|
18
33
|
},
|
|
19
34
|
emits: ["look"],
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
22
|
-
return (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
setup(__props, { emit: __emit }) {
|
|
36
|
+
const emits = __emit;
|
|
37
|
+
return (_ctx, _cache) => {
|
|
38
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
39
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
40
|
+
_cache[1] || (_cache[1] = createElementVNode("div", { class: "size-[1.4em] flex justify-center items-center" }, [
|
|
41
|
+
createElementVNode("div", { class: "size-[6px] bg-[var(--el-color-primary)] rounded-[50px]" })
|
|
42
|
+
], -1)),
|
|
43
|
+
createElementVNode("p", _hoisted_3$1, toDisplayString(_ctx.message), 1)
|
|
44
|
+
]),
|
|
45
|
+
createElementVNode("div", _hoisted_4$1, [
|
|
46
|
+
createVNode(unref(ElButton), {
|
|
47
|
+
onClick: _cache[0] || (_cache[0] = () => emits("look")),
|
|
48
|
+
type: "primary",
|
|
49
|
+
size: "small"
|
|
50
|
+
}, {
|
|
51
|
+
default: withCtx(() => _cache[2] || (_cache[2] = [
|
|
52
|
+
createTextVNode(" 查看 ", -1)
|
|
53
|
+
])),
|
|
54
|
+
_: 1,
|
|
55
|
+
__: [2]
|
|
56
|
+
})
|
|
57
|
+
])
|
|
58
|
+
]);
|
|
59
|
+
};
|
|
43
60
|
}
|
|
44
|
-
})
|
|
45
|
-
|
|
61
|
+
});
|
|
62
|
+
const DES_POINT_DEFAULT_COLOR = "radial-gradient(circle at center, rgba(0,0,0, 1), transparent, rgba(0,0,0, 1))", DES_POINT_LINE_COLOR = "#409eff", DES_POINT_ACTIVE_COLOR = `radial-gradient(circle at center, ${DES_POINT_LINE_COLOR}, transparent, ${DES_POINT_LINE_COLOR})`;
|
|
63
|
+
class DetailsPointRender extends Component {
|
|
46
64
|
static name = "DetailsPointRender";
|
|
47
65
|
Dxf = null;
|
|
48
66
|
Renderer = null;
|
|
49
67
|
WhiteModel = null;
|
|
50
68
|
Variable = null;
|
|
51
|
-
desPointGroup = new
|
|
52
|
-
rayLineGroup = new
|
|
69
|
+
desPointGroup = new THREE.Group();
|
|
70
|
+
rayLineGroup = new THREE.Group();
|
|
53
71
|
data = [];
|
|
54
|
-
onAddFromParent(
|
|
55
|
-
this.Dxf =
|
|
56
|
-
|
|
57
|
-
this.Renderer
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
onAddFromParent(parent) {
|
|
73
|
+
this.Dxf = parent.findComponentByName("Dxf");
|
|
74
|
+
this.WhiteModel = parent.findComponentByName("WhiteModel");
|
|
75
|
+
this.Renderer = parent.findComponentByName("Renderer");
|
|
76
|
+
this.Variable = parent.findComponentByName("Variable");
|
|
77
|
+
const desPoint = parent.findComponentByName("DetailsPoint");
|
|
78
|
+
this.Renderer?.container.add(this.desPointGroup);
|
|
79
|
+
this.rayLineGroup.visible = false;
|
|
80
|
+
this.Variable?.addEventListener("whiteModelVisible", (e) => {
|
|
81
|
+
this.desPointGroup.visible = e.value;
|
|
82
|
+
});
|
|
83
|
+
this.Dxf?.addEventListener("setDta", () => this.updateModel());
|
|
84
|
+
desPoint?.addEventListener("handleSuccess", () => this.updateModel());
|
|
85
|
+
this.Variable?.addEventListener("isLook", (e) => {
|
|
86
|
+
if (!e.value) this.cancelLook();
|
|
87
|
+
});
|
|
88
|
+
this.Variable?.addEventListener("currentWheel", (e) => {
|
|
62
89
|
if (this.Variable?.isLook) {
|
|
63
|
-
const
|
|
64
|
-
|
|
90
|
+
const v = e.value > 0 ? -0.5 : 0.5;
|
|
91
|
+
const camera = this.Renderer?.camera;
|
|
92
|
+
camera.fov += v;
|
|
93
|
+
camera.updateProjectionMatrix();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
let rotationYSpeed = 0;
|
|
97
|
+
this.Variable?.addEventListener("pointerMove", (e) => {
|
|
98
|
+
rotationYSpeed = e.value.x * 2e-3;
|
|
99
|
+
});
|
|
100
|
+
this.addEventListener("update", () => {
|
|
101
|
+
const variable = this.Variable;
|
|
102
|
+
const renderer = this.Renderer;
|
|
103
|
+
if (variable.isLook) {
|
|
104
|
+
renderer.camera.rotation.y += rotationYSpeed;
|
|
105
|
+
rotationYSpeed *= 0.8;
|
|
106
|
+
if (Math.abs(rotationYSpeed) < 1e-5) rotationYSpeed = 0;
|
|
65
107
|
}
|
|
66
108
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}), this.Variable?.addEventListener("currentKeyUp", (n) => {
|
|
74
|
-
const o = this.Variable;
|
|
75
|
-
o.isLook && n.value === "escape" && o.set("isLook", !1), n.value === "r" && (this.rayLineGroup.visible = !this.rayLineGroup.visible);
|
|
109
|
+
this.Variable?.addEventListener("currentKeyUp", (e) => {
|
|
110
|
+
const variable = this.Variable;
|
|
111
|
+
if (variable.isLook) {
|
|
112
|
+
if (e.value === "escape") variable.set("isLook", false);
|
|
113
|
+
}
|
|
114
|
+
if (e.value === "r") this.rayLineGroup.visible = !this.rayLineGroup.visible;
|
|
76
115
|
});
|
|
77
116
|
}
|
|
78
117
|
/**
|
|
79
118
|
* 更新模型
|
|
80
119
|
*/
|
|
81
120
|
updateModel() {
|
|
82
|
-
this.createDesPoint()
|
|
121
|
+
this.createDesPoint();
|
|
122
|
+
this.createRayline();
|
|
83
123
|
}
|
|
84
124
|
createDesPoint() {
|
|
85
|
-
const
|
|
86
|
-
this.desPointGroup.clear()
|
|
87
|
-
|
|
88
|
-
|
|
125
|
+
const desPointHandle = this.parent?.findComponentByName("DetailsPoint");
|
|
126
|
+
this.desPointGroup.clear();
|
|
127
|
+
desPointHandle.desPoints.forEach(({ message, position, intersection }) => {
|
|
128
|
+
const div = document.createElement("div");
|
|
129
|
+
Object.assign(div.style, {
|
|
89
130
|
width: "15px",
|
|
90
131
|
height: "15px",
|
|
91
|
-
background:
|
|
132
|
+
background: DES_POINT_DEFAULT_COLOR,
|
|
92
133
|
borderRadius: "40px",
|
|
93
134
|
cursor: "pointer"
|
|
94
135
|
});
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
136
|
+
const css2DObject = new Renderer.CSS2DObject(div);
|
|
137
|
+
css2DObject.position.copy(intersection);
|
|
138
|
+
this.desPointGroup.add(css2DObject);
|
|
139
|
+
div.addEventListener("mousedown", (e) => {
|
|
140
|
+
e.stopPropagation();
|
|
141
|
+
this.showDesBox(intersection, div, { message, position });
|
|
98
142
|
});
|
|
99
143
|
});
|
|
100
144
|
}
|
|
101
145
|
createRayline() {
|
|
102
146
|
this.desPointGroup.add(this.rayLineGroup);
|
|
103
|
-
const
|
|
104
|
-
this.rayLineGroup.clear()
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
147
|
+
const desPointHandle = this.parent?.findComponentByName("DetailsPoint");
|
|
148
|
+
this.rayLineGroup.clear();
|
|
149
|
+
desPointHandle.raylines.forEach(([p1, p2], index2) => {
|
|
150
|
+
if (index2 % 2 === 0) {
|
|
151
|
+
const box = new THREE.Mesh(new THREE.SphereGeometry(0.05), new THREE.MeshBasicMaterial({ color: 65280 }));
|
|
152
|
+
box.position.copy(p1);
|
|
153
|
+
this.rayLineGroup.add(box);
|
|
108
154
|
}
|
|
109
|
-
const
|
|
110
|
-
this.rayLineGroup.add(
|
|
155
|
+
const lines = new Lines([p1, p2], index2 % 2 === 0 ? 16711680 : 65280);
|
|
156
|
+
this.rayLineGroup.add(lines);
|
|
111
157
|
});
|
|
112
158
|
}
|
|
113
159
|
_desBoxInfo;
|
|
@@ -118,140 +164,226 @@ class I extends P {
|
|
|
118
164
|
* @param param2
|
|
119
165
|
* @returns
|
|
120
166
|
*/
|
|
121
|
-
showDesBox(
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
167
|
+
showDesBox(point, div, { message, position }) {
|
|
168
|
+
const variable = this.Variable, renderer = this.Renderer;
|
|
169
|
+
if (variable.isLook) return;
|
|
124
170
|
this.hideDesBox();
|
|
125
|
-
const
|
|
126
|
-
Object.assign(
|
|
171
|
+
const content = document.createElement("div");
|
|
172
|
+
Object.assign(content.style, {
|
|
127
173
|
padding: "0px",
|
|
128
174
|
fontSize: "14px",
|
|
129
175
|
pointerEvents: "none"
|
|
130
176
|
});
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
177
|
+
const contentCss2DObject = new Renderer.CSS2DObject(content);
|
|
178
|
+
const width = 80, height = 40;
|
|
179
|
+
const img = document.createElement("img");
|
|
180
|
+
img.style.pointerEvents = "none";
|
|
181
|
+
img.style.width = width + "px";
|
|
182
|
+
img.style.height = height + "px";
|
|
183
|
+
img.style.marginTop = "1px";
|
|
184
|
+
img.src = drawLinePathToPng([[0, height - 1], [width * 0.2, height - 1], [width * 0.6, 2], [width, 2]], width, height, DES_POINT_LINE_COLOR, 2);
|
|
185
|
+
content.appendChild(img);
|
|
186
|
+
div.style.background = DES_POINT_ACTIVE_COLOR;
|
|
187
|
+
contentCss2DObject.position.copy(point);
|
|
188
|
+
this.desPointGroup.add(contentCss2DObject);
|
|
189
|
+
content.style.opacity = "0";
|
|
190
|
+
setTimeout(() => {
|
|
191
|
+
const { width: width2, height: height2 } = content.getBoundingClientRect();
|
|
192
|
+
content.style.marginLeft = width2 * 0.5 + "px";
|
|
193
|
+
content.style.marginTop = -height2 * 0.5 + "px";
|
|
194
|
+
content.style.opacity = "1";
|
|
195
|
+
}, 20);
|
|
196
|
+
this._desBoxInfo = {
|
|
197
|
+
targetEl: div,
|
|
198
|
+
css2DObject: contentCss2DObject
|
|
138
199
|
};
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
200
|
+
const main = document.createElement("div");
|
|
201
|
+
main.style.pointerEvents = "all";
|
|
202
|
+
main.style.position = "absolute";
|
|
203
|
+
main.style.left = "100%";
|
|
204
|
+
main.style.top = "0px";
|
|
205
|
+
main.style.margin = "-15px -20px";
|
|
206
|
+
content.appendChild(main);
|
|
207
|
+
createApp(_sfc_main$1, {
|
|
208
|
+
message,
|
|
142
209
|
onLook: () => {
|
|
143
|
-
this.onLook(
|
|
210
|
+
this.onLook(point, position);
|
|
144
211
|
}
|
|
145
|
-
}).mount(
|
|
146
|
-
|
|
147
|
-
|
|
212
|
+
}).mount(main);
|
|
213
|
+
renderer.orbitControls.enabled = false;
|
|
214
|
+
const cancelDesBox = () => {
|
|
215
|
+
if (variable.isLook) return;
|
|
216
|
+
renderer.orbitControls.enabled = true;
|
|
217
|
+
this.hideDesBox();
|
|
148
218
|
};
|
|
149
|
-
|
|
219
|
+
main.addEventListener("mousedown", (e) => e.stopPropagation());
|
|
220
|
+
document.addEventListener("mousedown", cancelDesBox);
|
|
150
221
|
}
|
|
151
222
|
/**
|
|
152
223
|
* 隐藏详情盒子
|
|
153
224
|
*/
|
|
154
225
|
hideDesBox() {
|
|
155
|
-
|
|
226
|
+
if (this._desBoxInfo) {
|
|
227
|
+
this._desBoxInfo.targetEl.style.background = DES_POINT_DEFAULT_COLOR;
|
|
228
|
+
this._desBoxInfo.css2DObject.removeFromParent();
|
|
229
|
+
this._desBoxInfo = null;
|
|
230
|
+
}
|
|
156
231
|
}
|
|
157
|
-
orbitControlsTarget = new
|
|
232
|
+
orbitControlsTarget = new THREE.Vector3();
|
|
158
233
|
fov = 0;
|
|
159
234
|
/**
|
|
160
235
|
* 查看详情点
|
|
161
236
|
* @param point
|
|
162
237
|
* @param position
|
|
163
238
|
*/
|
|
164
|
-
onLook(
|
|
165
|
-
const
|
|
166
|
-
|
|
239
|
+
onLook(point, position) {
|
|
240
|
+
const variable = this.Variable, renderer = this.Renderer;
|
|
241
|
+
variable.set("isLook", true);
|
|
242
|
+
this.orbitControlsTarget.copy(renderer.orbitControls.target);
|
|
243
|
+
renderer.orbitControls?.target.copy(point);
|
|
244
|
+
this.fov = renderer.camera.fov;
|
|
245
|
+
this.hideDesBox();
|
|
246
|
+
renderer.cameraTo(position, point);
|
|
247
|
+
renderer.html2DRenderer?.domElement.focus();
|
|
167
248
|
}
|
|
168
249
|
/**
|
|
169
250
|
* 取消查看详情点
|
|
170
251
|
*/
|
|
171
252
|
cancelLook() {
|
|
172
|
-
const
|
|
173
|
-
|
|
253
|
+
const renderer = this.Renderer;
|
|
254
|
+
renderer.cameraBack();
|
|
255
|
+
renderer.orbitControls.enabled = true;
|
|
256
|
+
renderer.orbitControls?.target.copy(this.orbitControlsTarget);
|
|
257
|
+
renderer.camera.fov = this.fov;
|
|
258
|
+
renderer.camera.updateProjectionMatrix();
|
|
174
259
|
}
|
|
175
260
|
}
|
|
176
|
-
class
|
|
261
|
+
class OriginalLineRender extends Component {
|
|
177
262
|
static name = "OriginalLineRender";
|
|
178
263
|
Dxf = null;
|
|
179
264
|
Renderer = null;
|
|
180
|
-
originalLineMode = new
|
|
181
|
-
appendLineMode = new
|
|
182
|
-
textGroup = new
|
|
183
|
-
pointGroup = new
|
|
184
|
-
distanceGroup = new
|
|
185
|
-
onAddFromParent(
|
|
186
|
-
this.Dxf =
|
|
187
|
-
|
|
188
|
-
|
|
265
|
+
originalLineMode = new THREE.LineSegments();
|
|
266
|
+
appendLineMode = new THREE.LineSegments();
|
|
267
|
+
textGroup = new THREE.Group();
|
|
268
|
+
pointGroup = new THREE.Group();
|
|
269
|
+
distanceGroup = new THREE.Group();
|
|
270
|
+
onAddFromParent(parent) {
|
|
271
|
+
this.Dxf = parent.findComponentByName("Dxf");
|
|
272
|
+
this.Renderer = parent.findComponentByName("Renderer");
|
|
273
|
+
const variable = parent.findComponentByName("Variable");
|
|
274
|
+
this.Renderer?.container.add(this.originalLineMode);
|
|
275
|
+
this.Renderer?.container.add(this.appendLineMode);
|
|
276
|
+
this.Renderer?.container.add(this.textGroup);
|
|
277
|
+
this.Renderer?.container.add(this.pointGroup);
|
|
278
|
+
this.Renderer?.container.add(this.distanceGroup);
|
|
279
|
+
this.appendLineMode.visible = false;
|
|
280
|
+
this.textGroup.visible = false;
|
|
281
|
+
this.pointGroup.visible = false;
|
|
282
|
+
this.distanceGroup.visible = false;
|
|
283
|
+
this.originalLineMode.material = new THREE.LineBasicMaterial({
|
|
189
284
|
color: 5745151
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
this.
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
285
|
+
});
|
|
286
|
+
this.Dxf?.addEventListener("setDta", (e) => {
|
|
287
|
+
this.pointGroup.clear();
|
|
288
|
+
this.updateMode(e.originalData);
|
|
289
|
+
const dxf = this.Dxf;
|
|
290
|
+
const center = dxf.originalBox.center;
|
|
291
|
+
this.Renderer?.orbitControls?.target.set(center.x, center.y, 0);
|
|
292
|
+
const lineAnalysis = parent.findComponentByName("LineAnalysis");
|
|
293
|
+
const array = lineAnalysis.appendLineSegmentList.flatMap((line) => line.points.flatMap((p) => [p.x, p.y, dxf.originalZAverage]));
|
|
294
|
+
this.appendLineMode.geometry = new THREE.BufferGeometry().setAttribute("position", new THREE.BufferAttribute(new Float32Array(array), 3, true));
|
|
295
|
+
this.appendLineMode.material = new THREE.LineBasicMaterial({ color: 16711935 });
|
|
296
|
+
});
|
|
297
|
+
variable?.addEventListener("originalLineVisible", (e) => {
|
|
298
|
+
this.originalLineMode.visible = e.value;
|
|
299
|
+
});
|
|
300
|
+
variable?.addEventListener("currentKeyUp", (e) => {
|
|
301
|
+
if (e.value === "q") variable.set("originalLineVisible", !variable.originalLineVisible);
|
|
302
|
+
else if (e.value === "a") this.appendLineMode.visible = !this.appendLineMode.visible;
|
|
303
|
+
else if (e.value === "t") this.textGroup.visible = !this.textGroup.visible;
|
|
304
|
+
else if (e.value === "p") this.pointGroup.visible = !this.pointGroup.visible;
|
|
305
|
+
else if (e.value === "l") this.distanceGroup.visible = !this.distanceGroup.visible;
|
|
200
306
|
});
|
|
201
307
|
}
|
|
202
|
-
updateMode(
|
|
203
|
-
const
|
|
204
|
-
this.textGroup.clear()
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
308
|
+
updateMode(data) {
|
|
309
|
+
const dxf = this.Dxf, renderer = this.Renderer;
|
|
310
|
+
this.textGroup.clear();
|
|
311
|
+
this.distanceGroup.clear();
|
|
312
|
+
const originalArray = new Float32Array(data.flatMap(({ start, end }, i) => {
|
|
313
|
+
const x = start.x + (end.x - start.x) * 0.5;
|
|
314
|
+
const y = start.y + (end.y - start.y) * 0.5;
|
|
315
|
+
renderer.createText(i, new THREE.Vector3(x, y, dxf.originalZAverage), { fontSize: "10px", color: "#ffff00" }, this.textGroup);
|
|
316
|
+
renderer.createText(
|
|
317
|
+
Number(Point.prototype.distance.call(start, end).toFixed(2)),
|
|
318
|
+
new THREE.Vector3(x, y, dxf.originalZAverage),
|
|
210
319
|
{ fontSize: "10px", color: "#00ff00" },
|
|
211
320
|
this.distanceGroup
|
|
212
|
-
)
|
|
321
|
+
);
|
|
322
|
+
renderer.createPointMesh(new THREE.Vector3(start.x, start.y, dxf.originalZAverage), 0.04, {
|
|
213
323
|
color: 16777215,
|
|
214
|
-
transparent:
|
|
324
|
+
transparent: true,
|
|
215
325
|
opacity: 0.5
|
|
216
|
-
}, this.pointGroup)
|
|
326
|
+
}, this.pointGroup);
|
|
327
|
+
renderer.createPointMesh(new THREE.Vector3(end.x, end.y, dxf.originalZAverage), 0.02, {
|
|
217
328
|
color: 16711680
|
|
218
|
-
}, this.pointGroup)
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
329
|
+
}, this.pointGroup);
|
|
330
|
+
return [
|
|
331
|
+
start.x,
|
|
332
|
+
start.y,
|
|
333
|
+
dxf.originalZAverage,
|
|
334
|
+
end.x,
|
|
335
|
+
end.y,
|
|
336
|
+
dxf.originalZAverage
|
|
225
337
|
];
|
|
226
338
|
}));
|
|
227
|
-
this.originalLineMode.geometry = new
|
|
339
|
+
this.originalLineMode.geometry = new THREE.BufferGeometry().setAttribute("position", new THREE.BufferAttribute(originalArray, 3, true));
|
|
228
340
|
}
|
|
229
341
|
}
|
|
230
|
-
class
|
|
342
|
+
class ModelDataRender extends Component {
|
|
231
343
|
static name = "ModelDataRender";
|
|
232
|
-
onAddFromParent(
|
|
233
|
-
this.dxf(
|
|
344
|
+
onAddFromParent(parent) {
|
|
345
|
+
this.dxf(parent);
|
|
346
|
+
this.whiteModel(parent);
|
|
234
347
|
}
|
|
235
|
-
dxf(
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
348
|
+
dxf(parent) {
|
|
349
|
+
const renderer = parent.findComponentByName("Renderer");
|
|
350
|
+
const variable = parent.findComponentByName("Variable");
|
|
351
|
+
const dxfLineModel = parent.findComponentByName("DxfLineModel");
|
|
352
|
+
const dxf = parent.findComponentByName("Dxf");
|
|
353
|
+
renderer.container.add(dxfLineModel.dxfModelGroup);
|
|
354
|
+
variable.addEventListener("dxfVisible", (e) => {
|
|
355
|
+
dxfLineModel.dxfModelGroup.visible = e.value;
|
|
239
356
|
});
|
|
240
|
-
let
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
357
|
+
let group = new Group();
|
|
358
|
+
dxfLineModel.dxfModelGroup.add(group);
|
|
359
|
+
variable?.addEventListener("currentKeyUp", (e) => {
|
|
360
|
+
if (e.value === "w") variable.set("dxfVisible", !variable.dxfVisible);
|
|
361
|
+
if (e.value === "b") {
|
|
362
|
+
if (group.visible) group.visible = false;
|
|
363
|
+
else {
|
|
364
|
+
group.visible = true;
|
|
365
|
+
group.clear();
|
|
366
|
+
dxf.wallsGroup.forEach((path, j) => {
|
|
367
|
+
path.forEach((p, i) => {
|
|
368
|
+
renderer.createText(`${j}-${i}`, p, { color: "#ff00ff", fontSize: "10px" }, group).position.z = dxf.originalZAverage * 0.99;
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
}
|
|
247
373
|
});
|
|
248
374
|
}
|
|
249
|
-
whiteModel(
|
|
250
|
-
const
|
|
251
|
-
|
|
375
|
+
whiteModel(parent) {
|
|
376
|
+
const renderer = parent.findComponentByName("Renderer");
|
|
377
|
+
const variable = parent.findComponentByName("Variable");
|
|
378
|
+
const whiteModel = parent.findComponentByName("WhiteModel");
|
|
379
|
+
renderer.container.add(whiteModel.whiteModelGroup);
|
|
380
|
+
renderer.container.add(whiteModel.originalWhiteMode);
|
|
381
|
+
whiteModel.originalWhiteMode.visible = false;
|
|
382
|
+
variable?.addEventListener("whiteModelVisible", (e) => whiteModel.whiteModelGroup.visible = e.value);
|
|
383
|
+
variable?.addEventListener("currentKeyUp", (e) => e.value === "e" && variable.set("whiteModelVisible", !variable.whiteModelVisible));
|
|
252
384
|
}
|
|
253
385
|
}
|
|
254
|
-
class
|
|
386
|
+
class EventInput extends Component {
|
|
255
387
|
static name = "EventInput";
|
|
256
388
|
keyList = /* @__PURE__ */ new Set();
|
|
257
389
|
mouseList = /* @__PURE__ */ new Set();
|
|
@@ -264,32 +396,50 @@ class F extends P {
|
|
|
264
396
|
*
|
|
265
397
|
* @param parent
|
|
266
398
|
*/
|
|
267
|
-
onAddFromParent(
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
this.
|
|
273
|
-
})
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
this.
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
|
|
399
|
+
onAddFromParent(parent) {
|
|
400
|
+
const variable = parent.findComponentByType(Variable);
|
|
401
|
+
variable.addEventListener("currentMouseDown", (e) => {
|
|
402
|
+
if (this.mouseList.has(e.value)) return;
|
|
403
|
+
this.mouseList.add(e.value);
|
|
404
|
+
this.dispatchEvent({ type: "codeChange", code: e.value, mode: "down" });
|
|
405
|
+
});
|
|
406
|
+
variable.addEventListener("currentMouseUp", (e) => {
|
|
407
|
+
this.mouseList.delete(e.value);
|
|
408
|
+
this.dispatchEvent({ type: "codeChange", code: e.value, mode: "up" });
|
|
409
|
+
});
|
|
410
|
+
variable.addEventListener("currentKeyDown", (e) => {
|
|
411
|
+
if (this.keyList.has(e.value)) return;
|
|
412
|
+
this.keyList.add(e.value);
|
|
413
|
+
this.dispatchEvent({ type: "codeChange", code: e.value, mode: "down" });
|
|
414
|
+
});
|
|
415
|
+
variable.addEventListener("currentKeyUp", (e) => {
|
|
416
|
+
this.keyList.delete(e.value);
|
|
417
|
+
this.dispatchEvent({ type: "codeChange", code: e.value, mode: "up" });
|
|
418
|
+
});
|
|
419
|
+
variable.addEventListener("focus", () => {
|
|
420
|
+
this.keyList.clear();
|
|
421
|
+
this.mouseList.clear();
|
|
422
|
+
});
|
|
423
|
+
this.addEventListener("codeChange", this._computedkeyCombination.bind(this));
|
|
424
|
+
this.addKeyCombination("save", ["control", "s"]);
|
|
425
|
+
this.addCancelDefaultBehavior((input) => input.isOnlyKeyDowns(["control", "s"]) || input.isOnlyKeyDown("alt"));
|
|
280
426
|
}
|
|
281
427
|
/** 添加取消浏览器默认行为规则
|
|
282
428
|
* @param callBack
|
|
283
429
|
*/
|
|
284
|
-
addCancelDefaultBehavior(
|
|
285
|
-
|
|
430
|
+
addCancelDefaultBehavior(callBack) {
|
|
431
|
+
const domEventRegister = this.parent?.findComponentByType(DomEventRegister);
|
|
432
|
+
domEventRegister.addCancelDefaultBehavior(() => {
|
|
433
|
+
return callBack(this);
|
|
434
|
+
});
|
|
286
435
|
}
|
|
287
436
|
/**
|
|
288
437
|
* 计算组合按键
|
|
289
438
|
*/
|
|
290
439
|
_computedkeyCombination() {
|
|
291
|
-
this.currentKeyCombinationMap.clear()
|
|
292
|
-
|
|
440
|
+
this.currentKeyCombinationMap.clear();
|
|
441
|
+
this.keyCombinationMap.forEach(
|
|
442
|
+
({ keys, count }, name) => this.isOnlyKeyDowns(keys) && this.currentKeyCombinationMap.set(name, count)
|
|
293
443
|
);
|
|
294
444
|
}
|
|
295
445
|
/**
|
|
@@ -298,231 +448,270 @@ class F extends P {
|
|
|
298
448
|
* @param keys
|
|
299
449
|
* @param count
|
|
300
450
|
*/
|
|
301
|
-
addKeyCombination(
|
|
302
|
-
this.keyCombinationMap.set(
|
|
451
|
+
addKeyCombination(name, keys, count = 1) {
|
|
452
|
+
this.keyCombinationMap.set(name, { keys, count });
|
|
303
453
|
}
|
|
304
454
|
/**
|
|
305
455
|
* 移除组合按键
|
|
306
456
|
* @param name
|
|
307
457
|
*/
|
|
308
|
-
removeKeyCombination(
|
|
309
|
-
this.keyCombinationMap.delete(
|
|
458
|
+
removeKeyCombination(name) {
|
|
459
|
+
this.keyCombinationMap.delete(name);
|
|
310
460
|
}
|
|
311
461
|
/**
|
|
312
462
|
* 是否按下按键
|
|
313
463
|
* @param key
|
|
314
464
|
* @returns
|
|
315
465
|
*/
|
|
316
|
-
isKeyDown(
|
|
317
|
-
return this.keyList.has(
|
|
466
|
+
isKeyDown(key) {
|
|
467
|
+
return this.keyList.has(key.toLocaleLowerCase()) || this.mouseList.has(key.toLocaleLowerCase());
|
|
318
468
|
}
|
|
319
469
|
/**
|
|
320
470
|
* 是否按下按键组
|
|
321
471
|
* @param keys
|
|
322
472
|
* @returns
|
|
323
473
|
*/
|
|
324
|
-
isKeyDowns(
|
|
325
|
-
return
|
|
474
|
+
isKeyDowns(keys) {
|
|
475
|
+
return keys.every((v) => this.isKeyDown(v));
|
|
326
476
|
}
|
|
327
477
|
/**
|
|
328
478
|
* 是否按下按键组中部分
|
|
329
479
|
* @param keys
|
|
330
480
|
* @returns
|
|
331
481
|
*/
|
|
332
|
-
isSomeKeyDowns(
|
|
333
|
-
return
|
|
482
|
+
isSomeKeyDowns(keys) {
|
|
483
|
+
return keys.some((v) => this.isKeyDown(v));
|
|
334
484
|
}
|
|
335
485
|
/**
|
|
336
486
|
* 是否按下按键组中所有,并且只按下按键组中的按键
|
|
337
487
|
* @param keys
|
|
338
488
|
* @returns
|
|
339
489
|
*/
|
|
340
|
-
isOnlyKeyDowns(
|
|
341
|
-
|
|
490
|
+
isOnlyKeyDowns(keys) {
|
|
491
|
+
if (keys.length !== this.codeCount) return false;
|
|
492
|
+
const keyList = keys.filter((v) => this.isKeyDown(v));
|
|
493
|
+
return keyList.length === keys.length;
|
|
342
494
|
}
|
|
343
495
|
/**
|
|
344
496
|
*
|
|
345
497
|
* @param keys
|
|
346
498
|
* @returns
|
|
347
499
|
*/
|
|
348
|
-
isOnlyKeyDown(
|
|
349
|
-
return this.codeCount === 1 && this.isKeyDown(
|
|
500
|
+
isOnlyKeyDown(key) {
|
|
501
|
+
return this.codeCount === 1 && this.isKeyDown(key);
|
|
350
502
|
}
|
|
351
503
|
/**
|
|
352
504
|
*
|
|
353
505
|
* @param name
|
|
354
506
|
*/
|
|
355
|
-
isKeyCombination(
|
|
356
|
-
if (this.currentKeyCombinationMap.has(
|
|
357
|
-
const
|
|
358
|
-
|
|
507
|
+
isKeyCombination(name) {
|
|
508
|
+
if (this.currentKeyCombinationMap.has(name)) {
|
|
509
|
+
const count = this.currentKeyCombinationMap.get(name);
|
|
510
|
+
if (count === 0) this.currentKeyCombinationMap.delete(name);
|
|
511
|
+
else this.currentKeyCombinationMap.set(name, count - 1);
|
|
512
|
+
return true;
|
|
359
513
|
}
|
|
360
|
-
return
|
|
514
|
+
return false;
|
|
361
515
|
}
|
|
362
516
|
}
|
|
363
|
-
const
|
|
517
|
+
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
364
518
|
__proto__: null,
|
|
365
|
-
DetailsPointRender
|
|
366
|
-
DomContainer
|
|
367
|
-
DomEventRegister
|
|
368
|
-
EventInput
|
|
369
|
-
ModelDataRender
|
|
370
|
-
OriginalLineRender
|
|
371
|
-
Renderer
|
|
372
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
|
519
|
+
DetailsPointRender,
|
|
520
|
+
DomContainer,
|
|
521
|
+
DomEventRegister,
|
|
522
|
+
EventInput,
|
|
523
|
+
ModelDataRender,
|
|
524
|
+
OriginalLineRender,
|
|
525
|
+
Renderer
|
|
526
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
527
|
+
const _hoisted_1 = { class: "pointer-events-none w-full flex justify-between absolute left-0 top-0 p-[10px] z-[1000] gap-[5px] select-none" };
|
|
528
|
+
const _hoisted_2 = { class: "pointer-events-auto" };
|
|
529
|
+
const _hoisted_3 = { class: "pointer-events-auto" };
|
|
530
|
+
const _hoisted_4 = { class: "text-[14px] bg-[rgba(255,255,255,1)] rounded-[6px] p-[0px_10px]" };
|
|
531
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
373
532
|
__name: "Dxf",
|
|
374
533
|
props: {
|
|
375
534
|
lines: {},
|
|
376
535
|
detailsPoint: {}
|
|
377
536
|
},
|
|
378
|
-
setup(
|
|
379
|
-
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
537
|
+
setup(__props) {
|
|
538
|
+
THREE.Object3D.DEFAULT_UP = new THREE.Vector3(0, 0, 1);
|
|
539
|
+
const props = __props;
|
|
540
|
+
const elRef = ref(), originalLineVisible = ref(true), dxfVisible = ref(true), whiteModelVisible = ref(true), isLook = ref(false), dxfSystem = new DxfSystem().usePlugin(ModelDataPlugin).usePlugin(RenderPlugin), desPoint = dxfSystem.findComponentByType(DetailsPoint), domContainer = dxfSystem.findComponentByType(DomContainer), whiteModel = dxfSystem.findComponentByType(WhiteModel);
|
|
541
|
+
watch(() => props.lines, () => props.lines && setLines(props.lines));
|
|
542
|
+
watch(() => props.detailsPoint, () => props.detailsPoint && desPoint?.set(props.detailsPoint));
|
|
543
|
+
function setLines(lines) {
|
|
544
|
+
if (lines) {
|
|
545
|
+
localStorage.setItem("lines", JSON.stringify(lines));
|
|
385
546
|
try {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
547
|
+
dxfSystem.Dxf.set(lines);
|
|
548
|
+
dxfSystem.Dxf.lineOffset();
|
|
549
|
+
} catch (error) {
|
|
550
|
+
console.log(error);
|
|
389
551
|
}
|
|
390
552
|
}
|
|
391
553
|
}
|
|
392
|
-
async function
|
|
393
|
-
const
|
|
394
|
-
Array.isArray(
|
|
554
|
+
async function selectLocalFile() {
|
|
555
|
+
const data = await SelectLocalFile.json();
|
|
556
|
+
if (Array.isArray(data)) {
|
|
557
|
+
localStorage.removeItem("orbitControls");
|
|
558
|
+
setLines(data);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
async function selectDetailsPointFile() {
|
|
562
|
+
const data = await SelectLocalFile.json();
|
|
563
|
+
if (Array.isArray(data)) desPoint?.set(data);
|
|
395
564
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
565
|
+
watch(originalLineVisible, () => dxfSystem.Variable.set("originalLineVisible", originalLineVisible.value));
|
|
566
|
+
watch(dxfVisible, () => dxfSystem.Variable.set("dxfVisible", dxfVisible.value));
|
|
567
|
+
watch(whiteModelVisible, () => dxfSystem.Variable.set("whiteModelVisible", whiteModelVisible.value));
|
|
568
|
+
dxfSystem.Variable.addEventListener("isLook", (e) => isLook.value = e.value);
|
|
569
|
+
dxfSystem.Variable.addEventListener("originalLineVisible", (e) => originalLineVisible.value = e.value);
|
|
570
|
+
dxfSystem.Variable.addEventListener("dxfVisible", (e) => dxfVisible.value = e.value);
|
|
571
|
+
dxfSystem.Variable.addEventListener("whiteModelVisible", (e) => whiteModelVisible.value = e.value);
|
|
572
|
+
if (localStorage.getItem("lines")) {
|
|
573
|
+
setLines(JSON.parse(localStorage.getItem("lines") ?? "{}"));
|
|
574
|
+
} else {
|
|
575
|
+
setLines(props.lines);
|
|
399
576
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
577
|
+
props.detailsPoint && desPoint?.set(props.detailsPoint);
|
|
578
|
+
onMounted(() => domContainer && elRef.value?.appendChild(domContainer.domElement));
|
|
579
|
+
onUnmounted(() => dxfSystem.destroy());
|
|
580
|
+
const renderer = dxfSystem.findComponentByType(Renderer);
|
|
581
|
+
renderer.orbitControls?.addEventListener("change", () => {
|
|
403
582
|
localStorage.setItem("orbitControls", JSON.stringify({
|
|
404
|
-
position:
|
|
405
|
-
target:
|
|
583
|
+
position: renderer.camera.position.toArray(),
|
|
584
|
+
target: renderer.orbitControls?.target.toArray()
|
|
406
585
|
}));
|
|
407
586
|
});
|
|
408
|
-
const
|
|
409
|
-
if (
|
|
410
|
-
const
|
|
587
|
+
const d = localStorage.getItem("orbitControls");
|
|
588
|
+
if (d) {
|
|
589
|
+
const data = JSON.parse(d);
|
|
411
590
|
setTimeout(() => {
|
|
412
|
-
|
|
591
|
+
renderer.camera.position.set(data.position[0], data.position[1], data.position[2]);
|
|
592
|
+
renderer.orbitControls?.target.set(data.target[0], data.target[1], data.target[2]);
|
|
413
593
|
});
|
|
414
594
|
}
|
|
415
|
-
return (
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
a.value ? (k(), R("div", {
|
|
468
|
-
key: 0,
|
|
469
|
-
onClick: l[2] || (l[2] = (g) => m(s).Variable.set("isLook", !1)),
|
|
470
|
-
class: "pointer-events-auto text-[#fff] h-fit text-[14px] rounded-[10px] bg-black p-[5px_20px] select-none cursor-pointer"
|
|
471
|
-
}, " 点击这或按 ESC 取消 ")) : ie("", !0),
|
|
472
|
-
y("div", he, [
|
|
473
|
-
y("div", me, [
|
|
474
|
-
x(m(G), {
|
|
475
|
-
modelValue: t.value,
|
|
476
|
-
"onUpdate:modelValue": l[3] || (l[3] = (g) => t.value = g),
|
|
477
|
-
label: "线(Q)"
|
|
478
|
-
}, null, 8, ["modelValue"]),
|
|
479
|
-
x(m(G), {
|
|
480
|
-
modelValue: n.value,
|
|
481
|
-
"onUpdate:modelValue": l[4] || (l[4] = (g) => n.value = g),
|
|
482
|
-
label: "dxf(W)"
|
|
483
|
-
}, null, 8, ["modelValue"]),
|
|
484
|
-
x(m(G), {
|
|
485
|
-
modelValue: o.value,
|
|
486
|
-
"onUpdate:modelValue": l[5] || (l[5] = (g) => o.value = g),
|
|
487
|
-
label: "墙体(E)"
|
|
488
|
-
}, null, 8, ["modelValue"])
|
|
595
|
+
return (_ctx, _cache) => {
|
|
596
|
+
return openBlock(), createElementBlock("div", {
|
|
597
|
+
ref_key: "elRef",
|
|
598
|
+
ref: elRef,
|
|
599
|
+
style: { "height": "100%", "width": "100%", "overflow": "hidden", "position": "relative" }
|
|
600
|
+
}, [
|
|
601
|
+
createElementVNode("div", _hoisted_1, [
|
|
602
|
+
createElementVNode("div", _hoisted_2, [
|
|
603
|
+
createVNode(unref(ElButton), {
|
|
604
|
+
size: "small",
|
|
605
|
+
type: "primary",
|
|
606
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(dxfSystem).Dxf.download("test.dxf"))
|
|
607
|
+
}, {
|
|
608
|
+
default: withCtx(() => _cache[6] || (_cache[6] = [
|
|
609
|
+
createTextVNode(" 下载 DXF ", -1)
|
|
610
|
+
])),
|
|
611
|
+
_: 1,
|
|
612
|
+
__: [6]
|
|
613
|
+
}),
|
|
614
|
+
createVNode(unref(ElButton), {
|
|
615
|
+
size: "small",
|
|
616
|
+
type: "primary",
|
|
617
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(whiteModel).downloadGltf("test.glb"))
|
|
618
|
+
}, {
|
|
619
|
+
default: withCtx(() => _cache[7] || (_cache[7] = [
|
|
620
|
+
createTextVNode(" 下载 白模 ", -1)
|
|
621
|
+
])),
|
|
622
|
+
_: 1,
|
|
623
|
+
__: [7]
|
|
624
|
+
}),
|
|
625
|
+
createVNode(unref(ElButton), {
|
|
626
|
+
size: "small",
|
|
627
|
+
type: "success",
|
|
628
|
+
onClick: selectLocalFile
|
|
629
|
+
}, {
|
|
630
|
+
default: withCtx(() => _cache[8] || (_cache[8] = [
|
|
631
|
+
createTextVNode(" 选择线路文件 ", -1)
|
|
632
|
+
])),
|
|
633
|
+
_: 1,
|
|
634
|
+
__: [8]
|
|
635
|
+
}),
|
|
636
|
+
createVNode(unref(ElButton), {
|
|
637
|
+
size: "small",
|
|
638
|
+
type: "success",
|
|
639
|
+
onClick: selectDetailsPointFile
|
|
640
|
+
}, {
|
|
641
|
+
default: withCtx(() => _cache[9] || (_cache[9] = [
|
|
642
|
+
createTextVNode(" 选择详情点文件 ", -1)
|
|
643
|
+
])),
|
|
644
|
+
_: 1,
|
|
645
|
+
__: [9]
|
|
646
|
+
})
|
|
489
647
|
]),
|
|
490
|
-
|
|
648
|
+
isLook.value ? (openBlock(), createElementBlock("div", {
|
|
649
|
+
key: 0,
|
|
650
|
+
onClick: _cache[2] || (_cache[2] = ($event) => unref(dxfSystem).Variable.set("isLook", false)),
|
|
651
|
+
class: "pointer-events-auto text-[#fff] h-fit text-[14px] rounded-[10px] bg-black p-[5px_20px] select-none cursor-pointer"
|
|
652
|
+
}, " 点击这或按 ESC 取消 ")) : createCommentVNode("", true),
|
|
653
|
+
createElementVNode("div", _hoisted_3, [
|
|
654
|
+
createElementVNode("div", _hoisted_4, [
|
|
655
|
+
createVNode(unref(ElCheckbox), {
|
|
656
|
+
modelValue: originalLineVisible.value,
|
|
657
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => originalLineVisible.value = $event),
|
|
658
|
+
label: "线(Q)"
|
|
659
|
+
}, null, 8, ["modelValue"]),
|
|
660
|
+
createVNode(unref(ElCheckbox), {
|
|
661
|
+
modelValue: dxfVisible.value,
|
|
662
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => dxfVisible.value = $event),
|
|
663
|
+
label: "dxf(W)"
|
|
664
|
+
}, null, 8, ["modelValue"]),
|
|
665
|
+
createVNode(unref(ElCheckbox), {
|
|
666
|
+
modelValue: whiteModelVisible.value,
|
|
667
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => whiteModelVisible.value = $event),
|
|
668
|
+
label: "墙体(E)"
|
|
669
|
+
}, null, 8, ["modelValue"])
|
|
670
|
+
]),
|
|
671
|
+
_cache[10] || (_cache[10] = createStaticVNode('<div class="mt-[5px] text-[#c9c9c9] text-[10px]"><p class="text-right">详情点射线辅助线快捷键:R</p><p class="text-right">墙壁合并追加线快捷键:A</p><p class="text-right">线段序号快捷键:T</p><p class="text-right">线段端点标示快捷键:P</p><p class="text-right">线段长度(单位米)快捷键:L</p></div>', 1))
|
|
672
|
+
])
|
|
491
673
|
])
|
|
492
|
-
])
|
|
493
|
-
|
|
674
|
+
], 512);
|
|
675
|
+
};
|
|
494
676
|
}
|
|
495
677
|
});
|
|
496
|
-
function
|
|
678
|
+
function RenderPlugin_(dxfSystem, option = {}) {
|
|
497
679
|
const {
|
|
498
|
-
originalLine
|
|
499
|
-
modelData
|
|
500
|
-
detailsPoint
|
|
501
|
-
orbitControls
|
|
502
|
-
camera
|
|
503
|
-
} =
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
680
|
+
originalLine = true,
|
|
681
|
+
modelData = true,
|
|
682
|
+
detailsPoint = true,
|
|
683
|
+
orbitControls = true,
|
|
684
|
+
camera = new THREE.PerspectiveCamera(45, 1, 0.01, 1e3)
|
|
685
|
+
} = option;
|
|
686
|
+
const domContainer = new DomContainer();
|
|
687
|
+
dxfSystem.addComponent(domContainer);
|
|
688
|
+
dxfSystem.addComponent(new Renderer({
|
|
689
|
+
canvas: domContainer.canvas,
|
|
690
|
+
camera,
|
|
507
691
|
htmlRenderer: {
|
|
508
|
-
"2d":
|
|
509
|
-
"3d":
|
|
692
|
+
"2d": domContainer.html2DRenderer,
|
|
693
|
+
"3d": domContainer.html3DRenderer
|
|
510
694
|
},
|
|
511
|
-
resizeObserver:
|
|
512
|
-
orbitControls:
|
|
513
|
-
domElement:
|
|
514
|
-
enableDamping:
|
|
695
|
+
resizeObserver: domContainer.domElement,
|
|
696
|
+
orbitControls: orbitControls ? {
|
|
697
|
+
domElement: domContainer.domElement,
|
|
698
|
+
enableDamping: true,
|
|
515
699
|
dampingFactor: 0.15
|
|
516
700
|
} : void 0
|
|
517
|
-
}))
|
|
701
|
+
}));
|
|
702
|
+
originalLine && dxfSystem.addComponent(new OriginalLineRender());
|
|
703
|
+
modelData && dxfSystem.addComponent(new ModelDataRender());
|
|
704
|
+
detailsPoint && dxfSystem.addComponent(new DetailsPointRender());
|
|
705
|
+
dxfSystem.addComponent(new DomEventRegister());
|
|
706
|
+
dxfSystem.addComponent(new EventInput());
|
|
518
707
|
}
|
|
519
|
-
const
|
|
520
|
-
create(
|
|
521
|
-
return (
|
|
708
|
+
const RenderPlugin = Object.assign(RenderPlugin_, {
|
|
709
|
+
create(option = {}) {
|
|
710
|
+
return (dxfSystem) => RenderPlugin_(dxfSystem, option);
|
|
522
711
|
}
|
|
523
712
|
});
|
|
524
713
|
export {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
714
|
+
_sfc_main as Dxf3DView,
|
|
715
|
+
RenderPlugin,
|
|
716
|
+
index as components
|
|
528
717
|
};
|