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