ss-component-new 1.1.921 → 1.1.923
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/{animationData-D-XvnkSQ.js → animationData-CTpjCYhK.js} +6 -6
- package/dist/{animationData-Dg5nZmQb.cjs → animationData-DLXZgNpV.cjs} +1 -1
- package/dist/{index-DqUIDEgN.js → index-0G_JDDWb.js} +2 -2
- package/dist/{index-DlHjuMCk.cjs → index-8mTZLO_A.cjs} +1 -1
- package/dist/{index-TTLLjKU5.js → index-AGPHpTKJ.js} +1 -1
- package/dist/index-B-aQ-kqX.cjs +1 -0
- package/dist/{index-BfLjlx67.cjs → index-B0OjCXz7.cjs} +1 -1
- package/dist/{index-98RJ1w0g.js → index-B4VYJrHF.js} +12 -11
- package/dist/{index-CmT-zy5L.cjs → index-B6oh3-Ct.cjs} +1 -1
- package/dist/{index-CZJTN1uo.cjs → index-BAMDj-rG.cjs} +1 -1
- package/dist/{index-C5M-qhEj.js → index-BCfdDcDu.js} +1 -1
- package/dist/{index-gnffGsTk.js → index-BJYEogKi.js} +1 -1
- package/dist/{index-Bi_pZDT_.cjs → index-BQ6f71Dz.cjs} +1 -1
- package/dist/{index-B-yzrEZh.js → index-BVbjjK1V.js} +537 -530
- package/dist/{index-BmsooG86.js → index-BYaXG121.js} +4 -4
- package/dist/{index-Q-Cy1_j8.js → index-BkZETTsT.js} +2 -2
- package/dist/{index-CFLovJ0i.cjs → index-BkdQ5sK9.cjs} +1 -1
- package/dist/{index-C4JMEa6C.js → index-Bm70BpWE.js} +1 -1
- package/dist/{index-BuPTgVC7.js → index-BrSQozru.js} +1 -1
- package/dist/{index-BwUkB1sf.js → index-Bv21n18_.js} +3 -3
- package/dist/{index-Cc5_TOfF.js → index-Bzn8NssG.js} +2 -2
- package/dist/{index-DsZFwAYZ.cjs → index-C4dYFyeW.cjs} +1 -1
- package/dist/{index-D-gYKwIE.cjs → index-CDlfv8iZ.cjs} +1 -1
- package/dist/{index-DHlQLt05.cjs → index-CEBtluXF.cjs} +1 -1
- package/dist/{index-CMYZuZzH.js → index-CHuYFd6z.js} +3 -3
- package/dist/{index-2sGzSWRf.js → index-CI-zI74o.js} +5 -5
- package/dist/{index-BhrZuBcV.cjs → index-CM2e-aFr.cjs} +1 -1
- package/dist/{index-BKeI2lR9.cjs → index-CWaNzrIi.cjs} +4 -4
- package/dist/{index-BDU3vXVs.js → index-CX3oEbIN.js} +1 -1
- package/dist/{index-BSOLJb49.js → index-CagNaxdj.js} +1 -1
- package/dist/{index-DSvhBEUe.js → index-D0SmzMV2.js} +1 -1
- package/dist/{index-CsXU1cJh.js → index-DEb_fTQX.js} +2 -2
- package/dist/{index-BWITrhZP.js → index-DG6cei-2.js} +2 -2
- package/dist/{index-CyIZxplK.js → index-DIawaN-i.js} +2 -2
- package/dist/{index-CLaIyeHj.cjs → index-DN_jbDym.cjs} +1 -1
- package/dist/{index-DxUI9x_B.cjs → index-DeOGzCvI.cjs} +1 -1
- package/dist/{index-Cj75iy0b.cjs → index-DeWYtW4K.cjs} +1 -1
- package/dist/{index-BKzt_jIN.cjs → index-Dl5T9uDS.cjs} +1 -1
- package/dist/{index-Cd2PkOxm.js → index-DlBzL_XU.js} +9 -9
- package/dist/{index-BSbSyRCe.js → index-DmQjZHnn.js} +3 -3
- package/dist/{index-RowSWjcw.js → index-DmRh8D1t.js} +1 -1
- package/dist/{index-C1gMK2BS.cjs → index-DxkGOvjA.cjs} +1 -1
- package/dist/{index-hu4gkaPI.cjs → index-Sb4ZvuY9.cjs} +1 -1
- package/dist/{index-PTwO2-GZ.js → index-Z3Su0Iq4.js} +340 -331
- package/dist/{index-CqHUGQDa.js → index-d_JKmLxj.js} +4 -4
- package/dist/{index-CZk6uo11.js → index-fbKgXoj0.js} +2 -2
- package/dist/{index-M6TcCTD5.js → index-oR_RD2vE.js} +1 -1
- package/dist/{index-BoEjfIjV.js → index-rX-we4sR.js} +7 -7
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-QmzkrVn5.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C0FUSSZR.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_6ecb5a6a_lang-_oi2LBsJ.js → index.vue_vue_type_style_index_0_scoped_6ecb5a6a_lang-DL3zuTIY.js} +10 -10
- package/dist/{index.vue_vue_type_style_index_0_scoped_6ecb5a6a_lang-DKbr2pqk.cjs → index.vue_vue_type_style_index_0_scoped_6ecb5a6a_lang-DqH34Kgb.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-Bv3C9m69.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-DGmgy87A.js} +5 -5
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-BT8bM4Yz.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-DZ5tdbkA.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-yLsHUO4i.js → index.vue_vue_type_style_index_1_lang-BxhwL7ff.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_1_lang-X-7YscJh.cjs → index.vue_vue_type_style_index_1_lang-CDMiAXNP.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-VCE6rYmh.js → index.vue_vue_type_style_index_1_lang-DXdi5Q8-.js} +2 -2
- package/dist/{main-XwkiTQ0-.cjs → main-D8Iwnwan.cjs} +1 -1
- package/dist/{main-DfbZ-tFN.js → main-Dxvq8o_X.js} +3 -3
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +2 -2
- package/dist/ss-component.js +10 -10
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +11 -11
- package/dist/{threeLatheView-QelyxFIt.cjs → threeLatheView-BoPqISuU.cjs} +1 -1
- package/dist/{threeLatheView-CWy7WIwu.js → threeLatheView-CdkQ2EqM.js} +4 -4
- package/dist/{threeModel-DDFQzI8g.cjs → threeModel-3DlefrGj.cjs} +1 -1
- package/dist/{threeModel-C7pPh28B.js → threeModel-Djxu_n4l.js} +2 -2
- package/dist/{threeSceneView-C1EIO3Ye.js → threeSceneView-BOr_zjMB.js} +5 -5
- package/dist/{threeSceneView-CsOGlGwZ.cjs → threeSceneView-BpOW9IUT.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-DVGCogkM.js → threeSceneViewForCPMPIP-BA9YBmBn.js} +1 -1
- package/dist/{threeSceneViewForCPMPIP-CHlcmYWA.cjs → threeSceneViewForCPMPIP-D6gUCU6_.cjs} +1 -1
- package/dist/{threeViewerHost-WZZDtK9s.cjs → threeViewerHost-DPZKsQRj.cjs} +1 -1
- package/dist/{threeViewerHost-BxDCbtxz.js → threeViewerHost-DSHtm4tg.js} +2 -2
- package/package.json +1 -1
- package/dist/index-BO8ABe6N.cjs +0 -1
package/dist/ss-component.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { defineAsyncComponent as o } from "vue";
|
|
2
2
|
import { S as I } from "./index-BHtNKL1L.js";
|
|
3
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
4
|
-
import { u as C } from "./index.vue_vue_type_style_index_1_lang-
|
|
3
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C0FUSSZR.js";
|
|
4
|
+
import { u as C } from "./index.vue_vue_type_style_index_1_lang-BxhwL7ff.js";
|
|
5
5
|
import "./index-BQYjK74w.js";
|
|
6
6
|
import h from "./ss-component2.js";
|
|
7
7
|
import { c as g, b as P } from "./index-CLCVb66q.js";
|
|
8
|
-
const e = o(() => import("./main-
|
|
8
|
+
const e = o(() => import("./main-Dxvq8o_X.js"));
|
|
9
9
|
e.install = (t) => {
|
|
10
10
|
t.component("ssComponent", e);
|
|
11
11
|
};
|
|
12
|
-
const s = o(() => import("./index-
|
|
12
|
+
const s = o(() => import("./index-BVbjjK1V.js").then((t) => t.l));
|
|
13
13
|
s.install = (t) => {
|
|
14
14
|
t.component("ssTab", s);
|
|
15
15
|
};
|
|
16
|
-
const r = o(() => import("./index-
|
|
16
|
+
const r = o(() => import("./index-D0SmzMV2.js"));
|
|
17
17
|
r.install = (t) => {
|
|
18
18
|
t.component("ssMenu", r);
|
|
19
19
|
};
|
|
20
|
-
const m = o(() => import("./index-
|
|
20
|
+
const m = o(() => import("./index-DlBzL_XU.js"));
|
|
21
21
|
m.install = (t) => {
|
|
22
22
|
t.component("ssMenuComponent", m);
|
|
23
23
|
};
|
|
24
|
-
const i = o(() => import("./index-
|
|
24
|
+
const i = o(() => import("./index-CagNaxdj.js"));
|
|
25
25
|
i.install = (t) => {
|
|
26
26
|
t.component("ssCanvas", i);
|
|
27
27
|
};
|
|
@@ -29,15 +29,15 @@ const c = o(() => import("./index-DiRBJiMW.js"));
|
|
|
29
29
|
c.install = (t) => {
|
|
30
30
|
t.component("ssFold", c);
|
|
31
31
|
};
|
|
32
|
-
const l = o(() => import("./index-
|
|
32
|
+
const l = o(() => import("./index-AGPHpTKJ.js").then((t) => t.i));
|
|
33
33
|
l.install = (t) => {
|
|
34
34
|
t.component("ssAvatar", l);
|
|
35
35
|
};
|
|
36
|
-
const a = o(() => import("./threeModel-
|
|
36
|
+
const a = o(() => import("./threeModel-Djxu_n4l.js"));
|
|
37
37
|
a.install = (t) => {
|
|
38
38
|
t.component("ssThree", a);
|
|
39
39
|
};
|
|
40
|
-
const p = o(() => import("./threeViewerHost-
|
|
40
|
+
const p = o(() => import("./threeViewerHost-DSHtm4tg.js").then((t) => t.a));
|
|
41
41
|
p.install = (t) => {
|
|
42
42
|
t.component("threeViewerHost", p);
|
|
43
43
|
};
|
package/dist/ss-component2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("vue-router"),t=[{path:"/tenant",name:"Tenant",component:async()=>Promise.resolve().then(()=>require("./index-CxnH4vfV.cjs"))},{path:"/login",name:"Login",component:async()=>Promise.resolve().then(()=>require("./index-C3BbbkQo.cjs"))},{path:"/",name:"Model",component:async()=>Promise.resolve().then(()=>require("./index-
|
|
1
|
+
"use strict";const n=require("vue-router"),t=[{path:"/tenant",name:"Tenant",component:async()=>Promise.resolve().then(()=>require("./index-CxnH4vfV.cjs"))},{path:"/login",name:"Login",component:async()=>Promise.resolve().then(()=>require("./index-C3BbbkQo.cjs"))},{path:"/",name:"Model",component:async()=>Promise.resolve().then(()=>require("./index-B-aQ-kqX.cjs")),children:[{path:"系统配置/站内信",name:"Message",component:async()=>Promise.resolve().then(()=>require("./index-DPIg2S6M.cjs"))},{path:"系统配置/自动生成",name:"Automatic",component:async()=>Promise.resolve().then(()=>require("./index-B2BAJXIH.cjs"))},{path:"平台管理/菜单管理",name:"Menu",component:async()=>Promise.resolve().then(()=>require("./index-DxkGOvjA.cjs"))},{path:"平台管理/主菜单管理",name:"MainMenu",component:async()=>Promise.resolve().then(()=>require("./index-CDlfv8iZ.cjs"))},{path:"系统管理/个人中心",name:"PersonalCenter",component:async()=>Promise.resolve().then(()=>require("./index-8mTZLO_A.cjs"))},{path:"系统管理/职位管理",name:"Post",component:async()=>Promise.resolve().then(()=>require("./index-DN_jbDym.cjs"))},{path:"系统管理/用户管理",name:"User",component:async()=>Promise.resolve().then(()=>require("./index-DeOGzCvI.cjs"))},{path:"系统管理/角色管理",name:"Role",component:async()=>Promise.resolve().then(()=>require("./index-CM2e-aFr.cjs"))},{path:"系统管理/部门管理",name:"Dept",component:async()=>Promise.resolve().then(()=>require("./index-BQ6f71Dz.cjs"))},{path:"系统维护/登录日志",name:"LoginLog",component:async()=>Promise.resolve().then(()=>require("./index-BAMDj-rG.cjs"))},{path:"系统维护/操作日志",name:"OperateLog",component:async()=>Promise.resolve().then(()=>require("./index-Sb4ZvuY9.cjs"))}]}],o=n.createRouter({history:n.createWebHashHistory(),routes:t});o.beforeEach((r,s,e)=>{!sessionStorage.getItem("loginToken")&&r.path!=="/login"?e("/login"):e()});module.exports=o;
|
package/dist/ss-component2.js
CHANGED
|
@@ -8,12 +8,12 @@ const a = [
|
|
|
8
8
|
{
|
|
9
9
|
path: "/login",
|
|
10
10
|
name: "Login",
|
|
11
|
-
component: async () => import("./index-
|
|
11
|
+
component: async () => import("./index-DEb_fTQX.js")
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
path: "/",
|
|
15
15
|
name: "Model",
|
|
16
|
-
component: async () => import("./index-
|
|
16
|
+
component: async () => import("./index-Z3Su0Iq4.js"),
|
|
17
17
|
// component: async ()=>import('@/components/views/model/component/main.vue'),
|
|
18
18
|
// component: async ()=>import('@/components/views/canvas/index.vue'),
|
|
19
19
|
// component: async ()=>import('@/components/views/test/index.vue'),
|
|
@@ -31,47 +31,47 @@ const a = [
|
|
|
31
31
|
{
|
|
32
32
|
path: "平台管理/菜单管理",
|
|
33
33
|
name: "Menu",
|
|
34
|
-
component: async () => import("./index-
|
|
34
|
+
component: async () => import("./index-d_JKmLxj.js")
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
path: "平台管理/主菜单管理",
|
|
38
38
|
name: "MainMenu",
|
|
39
|
-
component: async () => import("./index-
|
|
39
|
+
component: async () => import("./index-DIawaN-i.js")
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
path: "系统管理/个人中心",
|
|
43
43
|
name: "PersonalCenter",
|
|
44
|
-
component: async () => import("./index-
|
|
44
|
+
component: async () => import("./index-CI-zI74o.js")
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
path: "系统管理/职位管理",
|
|
48
48
|
name: "Post",
|
|
49
|
-
component: async () => import("./index-
|
|
49
|
+
component: async () => import("./index-DmQjZHnn.js")
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
path: "系统管理/用户管理",
|
|
53
53
|
name: "User",
|
|
54
|
-
component: async () => import("./index-
|
|
54
|
+
component: async () => import("./index-BkZETTsT.js")
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
path: "系统管理/角色管理",
|
|
58
58
|
name: "Role",
|
|
59
|
-
component: async () => import("./index-
|
|
59
|
+
component: async () => import("./index-Bzn8NssG.js")
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
path: "系统管理/部门管理",
|
|
63
63
|
name: "Dept",
|
|
64
|
-
component: async () => import("./index-
|
|
64
|
+
component: async () => import("./index-BYaXG121.js")
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
path: "系统维护/登录日志",
|
|
68
68
|
name: "LoginLog",
|
|
69
|
-
component: async () => import("./index-
|
|
69
|
+
component: async () => import("./index-DG6cei-2.js")
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
path: "系统维护/操作日志",
|
|
73
73
|
name: "OperateLog",
|
|
74
|
-
component: async () => import("./index-
|
|
74
|
+
component: async () => import("./index-0G_JDDWb.js")
|
|
75
75
|
}
|
|
76
76
|
// {
|
|
77
77
|
// path: 'priority',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("./iconfont-BRr5XwJN.cjs");require("./URDFLoader-DUt8-G_J.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bdvwk9N0.cjs");const G=require("./index-1z9RrjZc.cjs");require("./index.vue_vue_type_style_index_1_lang-CWXvUeB2.cjs");require("./index-BpPyaNFa.cjs");require("./index.vue_vue_type_style_index_1_lang-X-7YscJh.cjs");const C=require("./STLLoader-Ck442nWz.cjs");require("./index-CDwRBEHj.cjs");;/* empty css */const T=require("./urdfTree-hY-C0CsG.cjs"),O=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function Y(i){const n=[];return i.forEach(a=>{const[o,r,s]=a.trim().split(/\s+/);n.push(+o,+r,+s)}),n}function j(i,n,a){switch(i){case"X":n.x=+a||0;break;case"Y":n.y=+a||0;break;case"Z":n.z=+a||0;break}}function Z(i){const n=[],a=["X","Y","Z"];return i.forEach(o=>{const r={x:0,y:0,z:0},s=o.trim();if(!s)return;let u=null,d="";for(let m=0;m<(s==null?void 0:s.length);m++){const f=s[m],v=a.find(h=>h===f);if(v){u&&j(u,r,d),d="",u=v;continue}d=d+f}j(u,r,d),n.push(r.x,r.y,r.z)}),n}async function J(i){var r,s;const n=(r=i==null?void 0:i.trim())==null?void 0:r.split(/\r?\n/),a=n==null?void 0:n[0],o=(s=a==null?void 0:a.trim())==null?void 0:s.split(/\s+/);if((o==null?void 0:o.length)>=3)return Y(n);if((o==null?void 0:o.length)===1)return Z(n)}async function F(i){const n=i.trim().split(/\r?\n/),a=[];return n.forEach(o=>{const r=o.trim().split(/\s+/);if(r.length!=3)return;const[s,u,d]=r;a.push(+s,+u,+d)}),a}async function _(i){const n=i.trim().split(/\r?\n/),a=[];return n.forEach(o=>{const r=o.trim().split(/\s+/);if(r.length!=3)return;const[s,u,d]=r;a.push(+s,+u,+d)}),a}async function H(i,n){const{isCyd:a,isUv:o,isCpt:r}=n;return o?J(i):a?_(i):r?F(i):[]}function W(i,n,a,o=4,r=50){let s=1/0,u=-1/0,d=1/0,m=-1/0,f=1/0,v=-1/0;for(let V=0;V<i.length;V+=3){const N=i[V],w=i[V+1],b=i[V+2];s=Math.min(s,N),u=Math.max(u,N),d=Math.min(d,w),m=Math.max(m,w),f=Math.min(f,b),v=Math.max(v,b)}const y=Math.sqrt((u-s)**2+(m-d)**2+(v-f)**2)*.05,k=C.MathUtils.degToRad(n.fov),E=2*Math.tan(k/2)*r,S=y/E*a.domElement.height*(o/4);return Math.max(1,S)}function K(i){const n=new C.BufferGeometry;n.setAttribute("position",new C.Float32BufferAttribute(i,3));const a=new C.PointsMaterial({color:55551,size:1,sizeAttenuation:!1});return new C.Points(n,a)}function Q(i,n){if(!n)return;const{scene:a,camera:o,renderer:r,controls:s}=i(),u=K(n);u.name="轨迹路径",a.add(u);const d=W(n,o,r,.5,50);u.material.size=d;const m=new C.Box3().setFromObject(u),f=m.getCenter(new C.Vector3),v=m.getSize(new C.Vector3),h=Math.max(v.x,v.y,v.z),y=o.fov*(Math.PI/180);let k=Math.abs(h/2/Math.tan(y/2));k*=1.2,o.position.set(f.x,f.y,f.z+k),o.lookAt(f),s==null||s.target.copy(f)}const ee={class:"obj-viewer-container"},te={class:"buttonGroup-top"},ne={class:"buttonGroup-topLeft"},oe={class:"buttonGroup-left"},ie={class:"buttonGroup-right"},ae={class:"buttonGroup-bottom"},le={class:"left-panel"},re={class:"panel-header"},se={class:"panel-body"},ce={key:1,class:"clipping-content"},ue={class:"radio-group"},de={class:"radio-label"},fe={class:"radio-label"},ve={class:"radio-label"},me={class:"radio-label"},ge={class:"right-panel"},pe={class:"panel-header"},he={class:"panel-body"},Ve={key:0,class:"loading-overlay"},Ne=e.defineComponent({__name:"threeLatheView",props:{threeData:{default:()=>""},trackFileType:{}},emits:["getAnimationData","getThreeData"],setup(i,{emit:n}){const a=n,o=i,r=e.ref(null),s=e.ref(!1),u=e.ref(""),d=e.ref(!1),m=e.ref(""),f=e.ref(!1),v=e.ref(""),h=e.shallowRef(null),y=e.shallowRef(null),{currentModels:k,resetView:E,initThreeJS:S,handleResize:V,getThreeJSObjects:N,cleanup:w,axesHelperVisible:b,toggleAxesVisibility:R}=l.useThreeJS(r),{isAnimating:P,toggleAnimation:q,stopAnimation:A}=l.useAnimation(N,k),{isClipping:B,activeClippingAxis:p,toggleClipping:U,updateClippingPlanes:z}=l.useClipping(N,k),L=()=>{R()},x=g=>{d.value=!0,m.value=g,g==="剖面视图"&&!B.value&&U()},I=g=>{f.value=!0,v.value=g,g==="动画仿真"&&a("getAnimationData")},X=()=>{a("getThreeData")},D=e.ref([]);return e.watch(()=>o.threeData,async()=>{if(!o.threeData)return;D.value=await H(o.threeData,o.trackFileType);const g=D.value;Q(N,g)},{immediate:!0,deep:!0}),e.onMounted(async()=>{try{S(),window.addEventListener("resize",V);const g=N();y.value=g.scene,y.value&&(y.value.name="CPMPIP")}catch(g){console.error("Three.js 初始化失败:",g),G.ElMessage.error("渲染引擎初始化失败!")}}),e.onBeforeUnmount(()=>{m.value="",v.value="",window.removeEventListener("resize",V),P.value&&A(),w()}),(g,t)=>{const M=e.resolveComponent("el-scrollbar"),$=e.resolveComponent("PointPanel");return e.openBlock(),e.createElementBlock("div",ee,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:r,class:"threejs-container"},null,512),e.createElementVNode("div",te,[e.createVNode(l.SvgIcon,{name:"guanjianjiexi",size:"34"}),e.createVNode(l.SvgIcon,{name:"guanjiekongzhi",size:"34"}),e.createVNode(l.SvgIcon,{name:"gongyishengcheng",size:"34"}),e.createVNode(l.SvgIcon,{name:"buchangshezhi",size:"34"}),e.createVNode(l.SvgIcon,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",ne,[e.createVNode(l.SvgIcon,{name:"viewReset",size:"24",onClick:e.unref(E),title:"重置"},null,8,["onClick"]),e.createVNode(l.SvgIcon,{name:"fangda",size:"24",title:"放大"}),e.createVNode(l.SvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(l.SvgIcon,{name:"lookAround",size:"24",onClick:e.unref(q),title:e.unref(P)?"停止动画":"动画视图"},null,8,["onClick","title"]),e.createVNode(l.SvgIcon,{name:"zuobiaoxi",size:"24",active:e.unref(b),onClick:L,title:"显隐坐标轴"},null,8,["active"])]),e.createElementVNode("div",oe,[e.createVNode(l.SvgIcon,{name:"jiegoushu",size:"24",onClick:t[0]||(t[0]=c=>x("场景树")),active:d.value&&m.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(l.SvgIcon,{name:"clipping",size:"24",onClick:t[1]||(t[1]=c=>x("剖面视图")),active:d.value&&m.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24",onClick:t[2]||(t[2]=c=>x("场景树3"))}),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24",onClick:t[3]||(t[3]=c=>x("场景4"))})]),e.createElementVNode("div",ie,[e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24"}),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24"}),e.createVNode(l.SvgIcon,{name:"guanjiekongzhi",size:"24",onClick:t[4]||(t[4]=c=>I("关节控制")),active:f.value&&v.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:t[5]||(t[5]=c=>I("动画仿真")),active:f.value&&v.value==="动画仿真"},null,8,["active"]),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24",title:"urdf动画",onClick:t[6]||(t[6]=c=>I("urdf动画")),active:f.value&&v.value==="urdf动画"},null,8,["active"]),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",ae,[e.createVNode(l.SvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:t[7]||(t[7]=()=>{})}),e.createVNode(l.SvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:g.play},null,8,["onClick"]),e.createVNode(l.SvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:t[8]||(t[8]=()=>{})}),e.createVNode(l.SvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:t[9]||(t[9]=()=>{})}),e.createVNode(l.SvgIcon,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:t[10]||(t[10]=()=>{})})]),e.withDirectives(e.createElementVNode("div",le,[e.createElementVNode("div",re,[e.createElementVNode("span",null,e.toDisplayString(m.value),1),e.createElementVNode("span",{class:"close",onClick:t[11]||(t[11]=c=>d.value=!1)}," X ")]),e.createElementVNode("div",se,[e.createVNode(M,{height:"100%"},{default:e.withCtx(()=>[m.value==="场景树"?(e.openBlock(),e.createBlock(T.UrdfTree,{key:0,model:h.value},null,8,["model"])):e.createCommentVNode("",!0),m.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",ue,[e.createElementVNode("label",de,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":t[12]||(t[12]=c=>e.isRef(p)?p.value=c:null),onChange:t[13]||(t[13]=(...c)=>e.unref(z)&&e.unref(z)(...c))},null,544),[[e.vModelRadio,e.unref(p)]]),t[21]||(t[21]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",fe,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":t[14]||(t[14]=c=>e.isRef(p)?p.value=c:null),onChange:t[15]||(t[15]=(...c)=>e.unref(z)&&e.unref(z)(...c))},null,544),[[e.vModelRadio,e.unref(p)]]),t[22]||(t[22]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",ve,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":t[16]||(t[16]=c=>e.isRef(p)?p.value=c:null),onChange:t[17]||(t[17]=(...c)=>e.unref(z)&&e.unref(z)(...c))},null,544),[[e.vModelRadio,e.unref(p)]]),t[23]||(t[23]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",me,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":t[18]||(t[18]=c=>e.isRef(p)?p.value=c:null),onChange:t[19]||(t[19]=(...c)=>e.unref(z)&&e.unref(z)(...c))},null,544),[[e.vModelRadio,e.unref(p)]]),t[24]||(t[24]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})])],512),[[e.vShow,d.value]]),e.withDirectives(e.createElementVNode("div",ge,[e.createElementVNode("div",pe,[e.createElementVNode("span",null,e.toDisplayString(v.value),1),e.createElementVNode("span",{class:"close",onClick:t[20]||(t[20]=c=>f.value=!1)}," X ")]),e.createElementVNode("div",he,[e.createVNode(M,{height:"100%"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(T.JointPanel,{model:h.value},null,8,["model"]),[[e.vShow,v.value==="关节控制"]]),e.withDirectives(e.createVNode($,{model:h.value,onGetThreeData:X,threeData:o.threeData,isSelfWindow:o.isSelfWindow,getThreeJSObjects:e.unref(N)},null,8,["model","threeData","isSelfWindow","getThreeJSObjects"]),[[e.vShow,v.value==="动画仿真"]])]),_:1})])],512),[[e.vShow,f.value]]),s.value?(e.openBlock(),e.createElementBlock("div",Ve,[t[25]||(t[25]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(u.value),1)])):e.createCommentVNode("",!0)])}}}),ze=O._export_sfc(Ne,[["__scopeId","data-v-9ec38ab1"]]);exports.default=ze;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("./iconfont-BRr5XwJN.cjs");require("./URDFLoader-DUt8-G_J.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bdvwk9N0.cjs");const G=require("./index-1z9RrjZc.cjs");require("./index.vue_vue_type_style_index_1_lang-CWXvUeB2.cjs");require("./index-BpPyaNFa.cjs");require("./index.vue_vue_type_style_index_1_lang-CDMiAXNP.cjs");const C=require("./STLLoader-Ck442nWz.cjs");require("./index-CDwRBEHj.cjs");;/* empty css */const T=require("./urdfTree-hY-C0CsG.cjs"),O=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function Y(i){const n=[];return i.forEach(a=>{const[o,r,s]=a.trim().split(/\s+/);n.push(+o,+r,+s)}),n}function j(i,n,a){switch(i){case"X":n.x=+a||0;break;case"Y":n.y=+a||0;break;case"Z":n.z=+a||0;break}}function Z(i){const n=[],a=["X","Y","Z"];return i.forEach(o=>{const r={x:0,y:0,z:0},s=o.trim();if(!s)return;let u=null,d="";for(let m=0;m<(s==null?void 0:s.length);m++){const f=s[m],v=a.find(h=>h===f);if(v){u&&j(u,r,d),d="",u=v;continue}d=d+f}j(u,r,d),n.push(r.x,r.y,r.z)}),n}async function J(i){var r,s;const n=(r=i==null?void 0:i.trim())==null?void 0:r.split(/\r?\n/),a=n==null?void 0:n[0],o=(s=a==null?void 0:a.trim())==null?void 0:s.split(/\s+/);if((o==null?void 0:o.length)>=3)return Y(n);if((o==null?void 0:o.length)===1)return Z(n)}async function F(i){const n=i.trim().split(/\r?\n/),a=[];return n.forEach(o=>{const r=o.trim().split(/\s+/);if(r.length!=3)return;const[s,u,d]=r;a.push(+s,+u,+d)}),a}async function _(i){const n=i.trim().split(/\r?\n/),a=[];return n.forEach(o=>{const r=o.trim().split(/\s+/);if(r.length!=3)return;const[s,u,d]=r;a.push(+s,+u,+d)}),a}async function H(i,n){const{isCyd:a,isUv:o,isCpt:r}=n;return o?J(i):a?_(i):r?F(i):[]}function W(i,n,a,o=4,r=50){let s=1/0,u=-1/0,d=1/0,m=-1/0,f=1/0,v=-1/0;for(let V=0;V<i.length;V+=3){const N=i[V],w=i[V+1],b=i[V+2];s=Math.min(s,N),u=Math.max(u,N),d=Math.min(d,w),m=Math.max(m,w),f=Math.min(f,b),v=Math.max(v,b)}const y=Math.sqrt((u-s)**2+(m-d)**2+(v-f)**2)*.05,k=C.MathUtils.degToRad(n.fov),E=2*Math.tan(k/2)*r,S=y/E*a.domElement.height*(o/4);return Math.max(1,S)}function K(i){const n=new C.BufferGeometry;n.setAttribute("position",new C.Float32BufferAttribute(i,3));const a=new C.PointsMaterial({color:55551,size:1,sizeAttenuation:!1});return new C.Points(n,a)}function Q(i,n){if(!n)return;const{scene:a,camera:o,renderer:r,controls:s}=i(),u=K(n);u.name="轨迹路径",a.add(u);const d=W(n,o,r,.5,50);u.material.size=d;const m=new C.Box3().setFromObject(u),f=m.getCenter(new C.Vector3),v=m.getSize(new C.Vector3),h=Math.max(v.x,v.y,v.z),y=o.fov*(Math.PI/180);let k=Math.abs(h/2/Math.tan(y/2));k*=1.2,o.position.set(f.x,f.y,f.z+k),o.lookAt(f),s==null||s.target.copy(f)}const ee={class:"obj-viewer-container"},te={class:"buttonGroup-top"},ne={class:"buttonGroup-topLeft"},oe={class:"buttonGroup-left"},ie={class:"buttonGroup-right"},ae={class:"buttonGroup-bottom"},le={class:"left-panel"},re={class:"panel-header"},se={class:"panel-body"},ce={key:1,class:"clipping-content"},ue={class:"radio-group"},de={class:"radio-label"},fe={class:"radio-label"},ve={class:"radio-label"},me={class:"radio-label"},ge={class:"right-panel"},pe={class:"panel-header"},he={class:"panel-body"},Ve={key:0,class:"loading-overlay"},Ne=e.defineComponent({__name:"threeLatheView",props:{threeData:{default:()=>""},trackFileType:{}},emits:["getAnimationData","getThreeData"],setup(i,{emit:n}){const a=n,o=i,r=e.ref(null),s=e.ref(!1),u=e.ref(""),d=e.ref(!1),m=e.ref(""),f=e.ref(!1),v=e.ref(""),h=e.shallowRef(null),y=e.shallowRef(null),{currentModels:k,resetView:E,initThreeJS:S,handleResize:V,getThreeJSObjects:N,cleanup:w,axesHelperVisible:b,toggleAxesVisibility:R}=l.useThreeJS(r),{isAnimating:P,toggleAnimation:q,stopAnimation:A}=l.useAnimation(N,k),{isClipping:B,activeClippingAxis:p,toggleClipping:U,updateClippingPlanes:z}=l.useClipping(N,k),L=()=>{R()},x=g=>{d.value=!0,m.value=g,g==="剖面视图"&&!B.value&&U()},I=g=>{f.value=!0,v.value=g,g==="动画仿真"&&a("getAnimationData")},X=()=>{a("getThreeData")},D=e.ref([]);return e.watch(()=>o.threeData,async()=>{if(!o.threeData)return;D.value=await H(o.threeData,o.trackFileType);const g=D.value;Q(N,g)},{immediate:!0,deep:!0}),e.onMounted(async()=>{try{S(),window.addEventListener("resize",V);const g=N();y.value=g.scene,y.value&&(y.value.name="CPMPIP")}catch(g){console.error("Three.js 初始化失败:",g),G.ElMessage.error("渲染引擎初始化失败!")}}),e.onBeforeUnmount(()=>{m.value="",v.value="",window.removeEventListener("resize",V),P.value&&A(),w()}),(g,t)=>{const M=e.resolveComponent("el-scrollbar"),$=e.resolveComponent("PointPanel");return e.openBlock(),e.createElementBlock("div",ee,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:r,class:"threejs-container"},null,512),e.createElementVNode("div",te,[e.createVNode(l.SvgIcon,{name:"guanjianjiexi",size:"34"}),e.createVNode(l.SvgIcon,{name:"guanjiekongzhi",size:"34"}),e.createVNode(l.SvgIcon,{name:"gongyishengcheng",size:"34"}),e.createVNode(l.SvgIcon,{name:"buchangshezhi",size:"34"}),e.createVNode(l.SvgIcon,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",ne,[e.createVNode(l.SvgIcon,{name:"viewReset",size:"24",onClick:e.unref(E),title:"重置"},null,8,["onClick"]),e.createVNode(l.SvgIcon,{name:"fangda",size:"24",title:"放大"}),e.createVNode(l.SvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(l.SvgIcon,{name:"lookAround",size:"24",onClick:e.unref(q),title:e.unref(P)?"停止动画":"动画视图"},null,8,["onClick","title"]),e.createVNode(l.SvgIcon,{name:"zuobiaoxi",size:"24",active:e.unref(b),onClick:L,title:"显隐坐标轴"},null,8,["active"])]),e.createElementVNode("div",oe,[e.createVNode(l.SvgIcon,{name:"jiegoushu",size:"24",onClick:t[0]||(t[0]=c=>x("场景树")),active:d.value&&m.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(l.SvgIcon,{name:"clipping",size:"24",onClick:t[1]||(t[1]=c=>x("剖面视图")),active:d.value&&m.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24",onClick:t[2]||(t[2]=c=>x("场景树3"))}),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24",onClick:t[3]||(t[3]=c=>x("场景4"))})]),e.createElementVNode("div",ie,[e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24"}),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24"}),e.createVNode(l.SvgIcon,{name:"guanjiekongzhi",size:"24",onClick:t[4]||(t[4]=c=>I("关节控制")),active:f.value&&v.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:t[5]||(t[5]=c=>I("动画仿真")),active:f.value&&v.value==="动画仿真"},null,8,["active"]),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24",title:"urdf动画",onClick:t[6]||(t[6]=c=>I("urdf动画")),active:f.value&&v.value==="urdf动画"},null,8,["active"]),e.createVNode(l.SvgIcon,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",ae,[e.createVNode(l.SvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:t[7]||(t[7]=()=>{})}),e.createVNode(l.SvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:g.play},null,8,["onClick"]),e.createVNode(l.SvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:t[8]||(t[8]=()=>{})}),e.createVNode(l.SvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:t[9]||(t[9]=()=>{})}),e.createVNode(l.SvgIcon,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:t[10]||(t[10]=()=>{})})]),e.withDirectives(e.createElementVNode("div",le,[e.createElementVNode("div",re,[e.createElementVNode("span",null,e.toDisplayString(m.value),1),e.createElementVNode("span",{class:"close",onClick:t[11]||(t[11]=c=>d.value=!1)}," X ")]),e.createElementVNode("div",se,[e.createVNode(M,{height:"100%"},{default:e.withCtx(()=>[m.value==="场景树"?(e.openBlock(),e.createBlock(T.UrdfTree,{key:0,model:h.value},null,8,["model"])):e.createCommentVNode("",!0),m.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",ue,[e.createElementVNode("label",de,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":t[12]||(t[12]=c=>e.isRef(p)?p.value=c:null),onChange:t[13]||(t[13]=(...c)=>e.unref(z)&&e.unref(z)(...c))},null,544),[[e.vModelRadio,e.unref(p)]]),t[21]||(t[21]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",fe,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":t[14]||(t[14]=c=>e.isRef(p)?p.value=c:null),onChange:t[15]||(t[15]=(...c)=>e.unref(z)&&e.unref(z)(...c))},null,544),[[e.vModelRadio,e.unref(p)]]),t[22]||(t[22]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",ve,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":t[16]||(t[16]=c=>e.isRef(p)?p.value=c:null),onChange:t[17]||(t[17]=(...c)=>e.unref(z)&&e.unref(z)(...c))},null,544),[[e.vModelRadio,e.unref(p)]]),t[23]||(t[23]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",me,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":t[18]||(t[18]=c=>e.isRef(p)?p.value=c:null),onChange:t[19]||(t[19]=(...c)=>e.unref(z)&&e.unref(z)(...c))},null,544),[[e.vModelRadio,e.unref(p)]]),t[24]||(t[24]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})])],512),[[e.vShow,d.value]]),e.withDirectives(e.createElementVNode("div",ge,[e.createElementVNode("div",pe,[e.createElementVNode("span",null,e.toDisplayString(v.value),1),e.createElementVNode("span",{class:"close",onClick:t[20]||(t[20]=c=>f.value=!1)}," X ")]),e.createElementVNode("div",he,[e.createVNode(M,{height:"100%"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(T.JointPanel,{model:h.value},null,8,["model"]),[[e.vShow,v.value==="关节控制"]]),e.withDirectives(e.createVNode($,{model:h.value,onGetThreeData:X,threeData:o.threeData,isSelfWindow:o.isSelfWindow,getThreeJSObjects:e.unref(N)},null,8,["model","threeData","isSelfWindow","getThreeJSObjects"]),[[e.vShow,v.value==="动画仿真"]])]),_:1})])],512),[[e.vShow,f.value]]),s.value?(e.openBlock(),e.createElementBlock("div",Ve,[t[25]||(t[25]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(u.value),1)])):e.createCommentVNode("",!0)])}}}),ze=O._export_sfc(Ne,[["__scopeId","data-v-9ec38ab1"]]);exports.default=ze;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineComponent as ne, ref as x, shallowRef as Z, watch as ie, onMounted as oe, onBeforeUnmount as ae, resolveComponent as J, createElementBlock as $, openBlock as A, createElementVNode as i, withDirectives as w, createCommentVNode as G, createVNode as o, unref as p, toDisplayString as L, withCtx as O, createBlock as se, isRef as V, vModelRadio as U, vShow as E } from "vue";
|
|
2
2
|
import { u as le, a as re, b as ue, S as r } from "./iconfont-BUMO0kCy.js";
|
|
3
3
|
import "./URDFLoader-BbJ84yMW.js";
|
|
4
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
4
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C0FUSSZR.js";
|
|
5
5
|
import { E as ce } from "./index-BQYjK74w.js";
|
|
6
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
6
|
+
import "./index.vue_vue_type_style_index_1_lang-BxhwL7ff.js";
|
|
7
7
|
import "./index-BHtNKL1L.js";
|
|
8
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
8
|
+
import "./index.vue_vue_type_style_index_1_lang-DXdi5Q8-.js";
|
|
9
9
|
import { B as de, V as F, a6 as fe, av as me, a1 as ve, ab as ge, l as pe } from "./STLLoader-CXf8uOlr.js";
|
|
10
|
-
import "./index-
|
|
10
|
+
import "./index-Bm70BpWE.js";
|
|
11
11
|
/* empty css */
|
|
12
12
|
import { U as he, J as ze } from "./urdfTree-Bjn6BxrP.js";
|
|
13
13
|
import { _ as Ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./STLLoader-Ck442nWz.cjs"),pe=require("./OrbitControls-EmwEZkFU.cjs"),me=require("./index-BfLjlx67.cjs"),fe=require("./index.vue_vue_type_style_index_1_lang-X-7YscJh.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./index-1z9RrjZc.cjs");function ve(z){let g=null,u=null,d=null,h=null,x=null,P=null,c=null,E=null;const D=1e3/30;let N=0;const b=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;g=new n.Scene,g.background=new n.Color(15790320);const m=z.value;u=new n.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),u.position.set(8,-8,6),u.up.set(0,0,1),u.lookAt(0,0,0),d=new n.WebGLRenderer({antialias:!0,alpha:!0}),d.setSize(m.clientWidth,m.clientHeight),d.localClippingEnabled=!0,d.shadowMap.enabled=!0,d.shadowMap.type=n.PCFSoftShadowMap,d.toneMapping=n.ACESFilmicToneMapping,d.toneMappingExposure=1,d.outputColorSpace=n.SRGBColorSpace,m.appendChild(d.domElement),h=new pe.OrbitControls(u,d.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},h.panSpeed=.7,x=new n.Xe(u,d,{container:m,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),x.attachControls(h),f(),C()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),E&&(g.remove(E),E.geometry.dispose(),E.material.dispose());const _=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,_,13421772,14540253),c.rotateX(Math.PI/2),c.position.copy(l),g.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});E=new n.Mesh(B,O),E.position.copy(l),E.position.z-=.01,E.receiveShadow=!0,g.add(E)},p=()=>{if(b.value.length===0)return;const m=new n.Box3;let l=!1;if(b.value.forEach(X=>{if(X.userData.boundingBox)m.union(X.userData.boundingBox),l=!0;else if(X.userData.modelId&&modelBoundingBoxes.has(X.userData.modelId)){const Z=modelBoundingBoxes.get(X.userData.modelId);m.union(Z.box),l=!0}else m.expandByObject(X),l=!0}),!l){console.warn("无法计算包围盒,网格更新失败");return}const _=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(_.x,_.y,_.z),j=Math.max(O*8,50),q=new n.Vector3(B.x,B.y,m.min.z);t(j,q)},f=()=>{const m=new n.AmbientLight(4210752,.6);g.add(m);const l=new n.DirectionalLight(16777215,2);l.position.set(10,10,8),l.castShadow=!0,l.shadow.mapSize.width=4096,l.shadow.mapSize.height=4096,l.shadow.camera.near=.5,l.shadow.camera.far=50,l.shadow.camera.left=-50,l.shadow.camera.right=50,l.shadow.camera.top=50,l.shadow.camera.bottom=-50,g.add(l);const _=new n.DirectionalLight(16777215,.8);_.position.set(-8,-8,6),g.add(_);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),g.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);g.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),g.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),g.add(q)},C=()=>{P=requestAnimationFrame(C),h&&h.update();const m=performance.now(),l=m-N;l<D||(N=m-l%D,d&&g&&u&&d.render(g,u),x&&x.render())},I=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(_=>{m[_]&&m[_].dispose&&m[_].dispose()}),m.dispose&&m.dispose()},A=m=>{m==null||m.traverse(l=>{l.geometry&&l.geometry.dispose(),l.material&&(Array.isArray(l.material)?l.material.forEach(_=>{I(_)}):I(l.material))})};return{currentModels:b,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,_=m.clientHeight;u.aspect=l/_,u.updateProjectionMatrix(),d.setSize(l,_),x.update()},fitCameraToAllModels:m=>{if(!u||!h||b.value.length===0)return;const l=new n.Box3;let _=!1;if(b.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),_=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),_=!0}else l.expandByObject(Z),_=!0}),!_){console.warn("无法计算包围盒");return}const B=l.getSize(new n.Vector3),O=l.getCenter(new n.Vector3),q=Math.max(B.x,B.y,B.z)*.8,X=new n.Vector3(O.x+q,O.y-q,O.z+q);u.position.copy(X),u.lookAt(O),h.target.copy(O),h.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:g,camera:u,renderer:d,controls:h,gizmo:x}),clearAllModels:()=>{if(!g)return;b.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==E&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),b.value=[],p()},cleanup:()=>{P&&cancelAnimationFrame(P),c&&c.dispose(),E&&(E.geometry.dispose(),E.material.dispose()),d&&d.dispose(),h&&h.dispose(),x&&x.dispose()},updateGridForModels:p}}function ge(z,g){const u=e.ref(!1);let d=null,h=12700,x=new n.Vector3,P=new n.Vector3,c=new n.Vector3,E=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,N=t=>{const p=new n.Vector3,f=E*1.2,C=new n.Vector3(c.x+f,c.y,c.z),I=new n.Vector3(c.x,c.y+f,c.z),A=new n.Vector3(c.x,c.y-f,c.z);if(t<=.567){const $=t/.567*Math.PI*2;p.x=c.x+Math.cos($)*f,p.z=c.z+Math.sin($)*f,p.y=c.y}else if(t<=.724){const L=(t-.567)/.157,$=D(L);p.lerpVectors(C,I,$)}else if(t<=.881){const L=(t-.724)/.157,J=D(L)*Math.PI;p.x=c.x+Math.sin(J)*f,p.y=c.y+Math.cos(J)*f,p.z=c.z}else{const L=(t-.881)/.119,$=D(L);p.lerpVectors(A,x,$)}return p},b=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,C=Math.min(f/h,1);if(C>=1){k();return}const I=N(C);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(b)},r=()=>{if(g.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),P.copy(p.target);const f=new n.Box3;g.value.forEach(G=>{f.expandByObject(G)});const C=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),E=Math.max(C.x,C.y,C.z)*1.2;const I=new n.Vector3(c.x+E*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const G=Date.now()-$,Y=Math.min(G/L,1),m=D(Y);t.position.lerpVectors(A,I,m),t.lookAt(c),p.target.copy(c),Y<1?requestAnimationFrame(J):(u.value=!0,d=null,b())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(P))};return{isAnimating:u,toggleAnimation:()=>{if(u.value){u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{camera:t,controls:p}=z();if(!t||!p)return;p.enabled=!0;const f=t.position.clone(),C=p.target.clone(),I=1500,A=Date.now(),L=()=>{const $=Date.now()-A,J=Math.min($/I,1),G=D(J);t.position.lerpVectors(f,x,G),p.target.lerpVectors(C,P,G),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function he(z,g){const u=e.ref(!1),d=e.ref("none");let h=[],x=[],P=new n.Box3,c=new n.Vector3;const E=()=>{h=[new n.Plane(new n.Vector3(1,0,0),0),new n.Plane(new n.Vector3(0,1,0),0),new n.Plane(new n.Vector3(0,0,1),0)]},F=()=>{P.makeEmpty(),g.value.forEach(y=>{P.expandByObject(y)}),c=P.getCenter(new n.Vector3)},D=y=>{const t=P.getSize(new n.Vector3);let p,f,C;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,Math.PI/2,0)):y==="y"?(p=new n.PlaneGeometry(t.x*1.2,t.z*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(Math.PI/2,0,0)):y==="z"&&(p=new n.PlaneGeometry(t.x*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,0,0));const I=new n.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:n.DoubleSide,depthWrite:!1}),A=new n.Mesh(p,I);return A.position.copy(f),A.rotation.copy(C),A},N=()=>{if(b(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(h[0].constant=-c.x,y=h[0]):d.value==="y"?(h[1].constant=-c.y,y=h[1]):d.value==="z"&&(h[2].constant=-c.z,y=h[2]),y){g.value.forEach(p=>{p.traverse(f=>{f.isMesh&&f.material&&(Array.isArray(f.material)?f.material.forEach(C=>{C.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},b=()=>{g.value.forEach(y=>{y.traverse(t=>{t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(p=>{p.clippingPlanes=[]}):t.material.clippingPlanes=[])})})},r=()=>{const{scene:y}=z();y&&x.forEach(t=>{y.remove(t),t.geometry.dispose(),t.material.dispose()}),x=[]};return{isClipping:u,activeClippingAxis:d,toggleClipping:()=>{u.value=!u.value,u.value?(E(),g.value.length>0&&F()):(d.value="none",b(),r())},updateClippingPlanes:N,clearClippingPlanes:b,clearClippingMeshes:r}}const ye={class:"panel-content"},we={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const g=z;e.ref();const u=e.ref();return e.watch(()=>[g==null?void 0:g.animationData],()=>{var h;let d=((h=re.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,P,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(me.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(P=u.value)==null?void 0:P.id,index:(c=u.value)==null?void 0:c.id,showHeader:!1},null,8,["itemData","index"]))])}}},xe=oe._export_sfc(we,[["__scopeId","data-v-2387536e"]]),Ve={class:"panel-content"},Me={key:0,class:"joints-list"},ke={class:"joint-info-row"},Pe={class:"joint-left"},Ce={class:"joint-name"},Ee={class:"joint-range"},be={class:"joint-type"},_e={key:0,class:"joint-control-row"},ze={class:"slider-container"},De=["min","max","value","onInput","disabled"],Se={class:"value-display"},Ne={class:"joint-value"},Be={class:"unit"},Ae={key:1,class:"empty-state"},ae=.001,Re=1e3,ue=60,Fe={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:g}){const u=z;e.ref(!0);const d=e.ref([]),h=e.ref(null),x=e.ref(null),P=e.ref(12.5),c=e.ref(),E=e.ref(1302),F=e.ref(30),D=e.ref(!1),N=e.ref(!1),b=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ue/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;E.value=o.extra.管长,P.value=o.extra.外径/2;let v=((i=re.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const C=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!h.value)return re.ElMessage.error("未加载 URDF"),!1;let o=null;return h.value.traverse(v=>{o||v.name==="Pipe_Link"&&v.traverse(i=>{i instanceof n.Mesh&&!o&&(o=i)})}),o?(o.position.y-=F.value*ae,c.value=o,o.material=new n.MeshPhongMaterial({color:11184810,shininess:80,side:n.DoubleSide}),!0):(re.ElMessage.error('在 "Pipe_Link" 内未找到任何 Mesh'),!1)},A=o=>{if(!o||!o.joints)return console.warn("URDF模型没有关节信息"),[];let v=null;if(o.traverse(V=>{V.name==="Pipe_Link"&&!v&&(v=V)}),v)c.value=v;else return console.warn("未找到管子模型"),[];const i=[];return Object.keys(o.joints).forEach(V=>{const s=o.joints[V];if(s._jointType==="fixed")return;const a=s.limit?{lower:s.limit.lower??C(s._jointType,!1),upper:s.limit.upper??C(s._jointType,!0)}:{lower:C(s._jointType,!1),upper:C(s._jointType,!0)};i.push({name:V,type:s._jointType||"unknown",limit:a,currentValue:s.angle||0,urdfJoint:s})}),i.sort((V,s)=>V.name.localeCompare(s.name))},L=(o,v)=>{const i=d.value.find(s=>s.name===o);if(!i)return;const V=parseFloat(v);if(i.limit){const s=Math.max(i.limit.lower,Math.min(i.limit.upper,V));i.currentValue=s}else i.currentValue=V;u.model&&u.model.setJointValue?u.model.setJointValue(o,i.currentValue):i.urdfJoint&&i.urdfJoint.setJointValue(i.currentValue)},$=o=>o.reduce((v,i)=>{let V=0;const s=i.Y??0,a=i.C??0,w=i.R??0;return s>0&&(V+=s),a>0&&w>0&&(V+=w*y(a)),v+V},0),J=o=>{const v=[],i=o.Y??0,V=o.B??0,s=o.C??0,a=o.R??0,w={pos:new n.Vector3(0,0,0),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};if(!i&&!s)return v;if(v.push(w.pos.clone()),V!==0){const U=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(U),w.localZ.applyMatrix4(U)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const U=y(s),T=a*ae,W=w.pos.clone().add(w.localX.clone().multiplyScalar(-T)),R=Math.max(16,Math.ceil(s/5));for(let M=1;M<=R;M++){const H=U*M/R,K=new n.Matrix4().makeRotationAxis(w.localZ,H),se=w.localX.clone().multiplyScalar(T).applyMatrix4(K),ie=W.clone().add(se);v.push(ie)}}return v},G=(o,v=0)=>{let i=f.slice(0,o+1);const V=f[o+1];if(V&&v>0){const R={...V,B:(V.B??0)*v,C:(V.C??0)*v};i.push(R)}const s=$(i),a=Math.max(0,E.value-s),w=[];w.push(new n.Vector3(0,0,0));const U=new n.Vector3(0,a*ae,0);a>0&&w.push(U);let T={pos:U.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const W=[];for(let R=i.length-1;R>=0;R--){const M=i[R],H=J(M);if(H.length>0){const K=H.map(Q=>{const ne=Q.clone(),de=new n.Matrix4;return de.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(de),ne.add(T.pos)});W.push(K);const te=K[K.length-1];T.pos=te.clone();const se=M.B??0,ie=M.C??0;if(se!==0){const Q=new n.Matrix4().makeRotationAxis(T.localY,y(se));T.localX.applyMatrix4(Q),T.localZ.applyMatrix4(Q)}if(ie>0){const Q=y(ie),ne=new n.Matrix4().makeRotationAxis(T.localZ,Q);T.localY.applyMatrix4(ne),T.localX.applyMatrix4(ne)}}}for(const R of W)R.length>1&&w.push(...R.slice(1));w.length<2&&w.push(new n.Vector3(0,.001,0));try{const R=new n.CatmullRomCurve3(w,!1,"catmullrom",.01),M=new n.TubeGeometry(R,Math.max(2,w.length*4),P.value*ae,18,!1);c.value.geometry.dispose(),c.value.geometry=M}catch(R){console.error("管件更新失败",R)}},Y=(o,v,i=1)=>{o&&(Object.keys(o).forEach(V=>{const s=o[V],a=d.value.find(w=>w.name===V);a&&(a.currentValue=s,u.model&&u.model.setJointValue?u.model.setJointValue(V,s):a.urdfJoint&&a.urdfJoint.setJointValue(s))}),G(v,i))},m=(o,v,i)=>o+(v-o)*i,l=(o,v,i)=>{if(!o||!v)return o||v;const V={};return Object.keys(o).forEach(s=>{const a=o[s],w=v[s];V[s]=m(a,w||a,i)}),V},_=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,N.value=!1,b.value=0,r.value=0,B()},B=()=>{if(!D.value||N.value)return;const o=b.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ue,i=f[o],V=f[o+1];if(V){const s=l(i,V,v);Y(s,o,v)}else Y(i,o);r.value++,r.value>ue&&(r.value=0,b.value++),k.value=setTimeout(B,p())},O=()=>{N.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,N.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};g({startAnimation:_,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),b.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),G(-1,0)},fastForward:()=>{t.value<4&&(t.value=Math.min(4,t.value*2))},fastBackward:()=>{t.value>.25&&(t.value=Math.max(.25,t.value/2))}}),e.watch(()=>u.model,o=>{o?(h.value=o,d.value=A(o)):d.value=[]},{immediate:!0});const ee=()=>{!u.model||D.value&&!N.value||d.value.forEach(o=>{o.urdfJoint&&o.urdfJoint.angle!==void 0&&(o.currentValue=o.urdfJoint.angle)})},le=()=>{const o=()=>{ee(),x.value=requestAnimationFrame(o)};o()},ce=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{ce(),j()}),(o,v)=>(e.openBlock(),e.createElementBlock("div",Ve,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var V,s,a,w;return e.openBlock(),e.createElementBlock("div",{key:i.name,class:"joint-item"},[e.createElementVNode("div",ke,[e.createElementVNode("div",Pe,[e.createElementVNode("span",Ce,e.toDisplayString(i.name),1),e.createElementVNode("span",Ee," ["+e.toDisplayString(((V=i.limit)==null?void 0:V.lower.toFixed(2))??(i.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((s=i.limit)==null?void 0:s.upper.toFixed(2))??(i.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",be,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",ze,[e.createElementVNode("input",{type:"range",min:((a=i.limit)==null?void 0:a.lower)??(i.type==="revolute"?-Math.PI:-1),max:((w=i.limit)==null?void 0:w.upper)??(i.type==="revolute"?Math.PI:1),step:.01,value:i.currentValue,onInput:U=>L(i.name,U.target.value),class:"joint-slider",disabled:D.value&&!N.value},null,40,De)]),e.createElementVNode("div",Se,[e.createElementVNode("span",Ne,e.toDisplayString(i.currentValue?Number(i.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Be,e.toDisplayString(i.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Ae,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},Te=oe._export_sfc(Fe,[["__scopeId","data-v-035ae936"]]),Le={class:"panel-content"},Ie="id",$e={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:z=>["breadth","firstLevel"].includes(z)}},emits:["nodeClick"],setup(z,{emit:g}){const u=z,d=g,h=e.ref([]),x={children:"children",label:"label"},P=r=>{d("nodeClick",r)},c=(r,k=0)=>{const y=[];return Array.isArray(r)&&(r==null?void 0:r.length)>0&&r.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const p={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:k+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:c(t==null?void 0:t.children,k+1),path:t==null?void 0:t.name};y.push(p)}}),y},E=r=>r?[{name:r==null?void 0:r.name,label:r==null?void 0:r.name,show:!0,level:1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:c(r==null?void 0:r.children,1),path:r==null?void 0:r.name}]:[],F=(r,k)=>{const y=[],t=[...r];for(;t.length>0&&y.length<k;){const p=t.shift();p.children&&p.children.length>0&&(y.push(p.id),t.push(...p.children))}return y},D=(r,k)=>{const y=[];return r.forEach(t=>{if(t.children&&t.children.length>0){y.push(t.id);const p=t.children.filter(f=>f.children&&f.children.length>0).slice(0,k).map(f=>f.id);y.push(...p)}}),y.slice(0,k+1)},N=e.computed(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),b=e.computed(()=>u!=null&&u.model?E(u.model):[]);return e.watch(b,r=>{h.value=JSON.parse(JSON.stringify(r))},{immediate:!0}),(r,k)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(y,{data:h.value,props:x,"default-expanded-keys":N.value,"node-key":Ie,onNodeClick:P},null,8,["data","default-expanded-keys"])])}}},Je=oe._export_sfc($e,[["__scopeId","data-v-290ff4e1"]]),Oe=["xlink:href"],Ue=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(z){const g=z,u=e.computed(()=>({backgroundColor:g.backgroundColor})),d=e.computed(()=>`#${g.prefix}-${g.name}`),h=e.computed(()=>{const{size:x}=g;let P=`${x}`;return P=`${P.replace("px","")}px`,{width:P,height:P}});return(x,P)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:x.active}]),style:e.normalizeStyle(u.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[x.$attrs.class,x.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(h.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Oe)],6))],6))}}),S=oe._export_sfc(Ue,[["__scopeId","data-v-3150a90b"]]),Ge={class:"obj-viewer-container"},je={class:"buttonGroup-top"},qe={class:"buttonGroup-topLeft"},Xe={class:"buttonGroup-left"},He={class:"buttonGroup-right"},Ye={class:"buttonGroup-bottom"},Ze={class:"left-panel"},We={class:"panel-header"},Ke={key:1,class:"clipping-content"},Qe={class:"radio-group"},et={class:"radio-label"},tt={class:"radio-label"},nt={class:"radio-label"},at={class:"radio-label"},ot={class:"right-panel"},lt={class:"panel-header"},st={key:0,class:"loading-overlay"},it={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(z,{expose:g,emit:u}){const d=u;let h=null,x=!1;const P=e.ref(null),c=e.ref(!1),E=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),N=e.ref(""),b=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:C,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ve(P),{isAnimating:J,toggleAnimation:G,stopAnimation:Y}=ge(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:_,updateClippingPlanes:B}=he(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=fe.useModelLoader(A,y,c,E,L),Z=()=>{if(F.value||y.value.length===0)return;F.value=!0,J.value&&Y();const{camera:s,controls:a}=A();if(!s||!a)return;a.enabled=!0;const w=H=>H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2,U=s.position.clone(),T=a.target.clone(),W=1500,R=Date.now(),M=()=>{const H=Date.now()-R,K=Math.min(H/W,1),te=w(K);s.position.lerpVectors(U,t.value,te),a.target.lerpVectors(T,p.value,te),K<1?requestAnimationFrame(M):F.value=!1};M()},ee=async()=>x?Promise.resolve():new Promise(s=>{const a=()=>{x?s():requestAnimationFrame(a)};a()}),le=async(s,a)=>{try{await ee(),J.value&&Y(),m.value&&_();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},ce=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,N.value=s,s==="剖面视图"&&!m.value&&_()},i=s=>{b.value=!0,r.value=s,s==="动画仿真"&&d("getAnimationData")},V=()=>{e.nextTick(()=>{var s;(s=k.value)==null||s.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{f(),h=A().scene,x=!0,window.addEventListener("resize",C)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,N.value="",r.value="",window.removeEventListener("resize",C),J.value&&Y(),$()}),g({addModelsFromUrls:ce,loadModelByDefaultPath:o}),(s,a)=>{var U,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Ge,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:P,class:"threejs-container"},null,512),e.createElementVNode("div",je,[e.createVNode(S,{name:"guanjianjiexi",size:"34"}),e.createVNode(S,{name:"guanjiekongzhi",size:"34"}),e.createVNode(S,{name:"gongyishengcheng",size:"34"}),e.createVNode(S,{name:"buchangshezhi",size:"34"}),e.createVNode(S,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",qe,[e.createVNode(S,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(S,{name:"fangda",size:"24",title:"放大"}),e.createVNode(S,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(S,{name:"lookAround",size:"24",onClick:e.unref(G),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Xe,[e.createVNode(S,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&N.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(S,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&N.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(S,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",He,[e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:b.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:b.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ye,[e.createVNode(S,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(U=k.value)==null?void 0:U.fastBackward},null,8,["onClick"]),e.createVNode(S,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(S,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(S,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(S,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(R=k.value)==null?void 0:R.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",Ze,[e.createElementVNode("div",We,[e.createElementVNode("span",null,e.toDisplayString(N.value),1),e.createElementVNode("span",{class:"close",onClick:a[6]||(a[6]=M=>D.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[N.value==="场景树"?(e.openBlock(),e.createBlock(Je,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),N.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("div",Qe,[e.createElementVNode("label",et,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":a[7]||(a[7]=M=>e.isRef(l)?l.value=M:null),onChange:a[8]||(a[8]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[16]||(a[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",tt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":a[9]||(a[9]=M=>e.isRef(l)?l.value=M:null),onChange:a[10]||(a[10]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[17]||(a[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":a[11]||(a[11]=M=>e.isRef(l)?l.value=M:null),onChange:a[12]||(a[12]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[18]||(a[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",at,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":a[13]||(a[13]=M=>e.isRef(l)?l.value=M:null),onChange:a[14]||(a[14]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[19]||(a[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,D.value]]),e.withDirectives(e.createElementVNode("div",ot,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(r.value),1),e.createElementVNode("span",{class:"close",onClick:a[15]||(a[15]=M=>b.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Te,{ref_key:"jointRef",ref:k,model:e.unref(q),scene:e.unref(h),animationData:z.animationData},null,8,["model","scene","animationData"]),[[e.vShow,r.value==="关节控制"]]),e.withDirectives(e.createVNode(xe,{animationData:z.animationData},null,8,["animationData"]),[[e.vShow,r.value==="动画仿真"]])]),_:1})],512),[[e.vShow,b.value]]),c.value?(e.openBlock(),e.createElementBlock("div",st,[a[20]||(a[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(E.value),1)])):e.createCommentVNode("",!0)])}}},rt=oe._export_sfc(it,[["__scopeId","data-v-7bc47bb3"]]);exports.default=rt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./STLLoader-Ck442nWz.cjs"),pe=require("./OrbitControls-EmwEZkFU.cjs"),me=require("./index-B0OjCXz7.cjs"),fe=require("./index.vue_vue_type_style_index_1_lang-CDMiAXNP.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./index-1z9RrjZc.cjs");function ve(z){let g=null,u=null,d=null,h=null,x=null,P=null,c=null,E=null;const D=1e3/30;let N=0;const b=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;g=new n.Scene,g.background=new n.Color(15790320);const m=z.value;u=new n.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),u.position.set(8,-8,6),u.up.set(0,0,1),u.lookAt(0,0,0),d=new n.WebGLRenderer({antialias:!0,alpha:!0}),d.setSize(m.clientWidth,m.clientHeight),d.localClippingEnabled=!0,d.shadowMap.enabled=!0,d.shadowMap.type=n.PCFSoftShadowMap,d.toneMapping=n.ACESFilmicToneMapping,d.toneMappingExposure=1,d.outputColorSpace=n.SRGBColorSpace,m.appendChild(d.domElement),h=new pe.OrbitControls(u,d.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},h.panSpeed=.7,x=new n.Xe(u,d,{container:m,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),x.attachControls(h),f(),C()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),E&&(g.remove(E),E.geometry.dispose(),E.material.dispose());const _=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,_,13421772,14540253),c.rotateX(Math.PI/2),c.position.copy(l),g.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});E=new n.Mesh(B,O),E.position.copy(l),E.position.z-=.01,E.receiveShadow=!0,g.add(E)},p=()=>{if(b.value.length===0)return;const m=new n.Box3;let l=!1;if(b.value.forEach(X=>{if(X.userData.boundingBox)m.union(X.userData.boundingBox),l=!0;else if(X.userData.modelId&&modelBoundingBoxes.has(X.userData.modelId)){const Z=modelBoundingBoxes.get(X.userData.modelId);m.union(Z.box),l=!0}else m.expandByObject(X),l=!0}),!l){console.warn("无法计算包围盒,网格更新失败");return}const _=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(_.x,_.y,_.z),j=Math.max(O*8,50),q=new n.Vector3(B.x,B.y,m.min.z);t(j,q)},f=()=>{const m=new n.AmbientLight(4210752,.6);g.add(m);const l=new n.DirectionalLight(16777215,2);l.position.set(10,10,8),l.castShadow=!0,l.shadow.mapSize.width=4096,l.shadow.mapSize.height=4096,l.shadow.camera.near=.5,l.shadow.camera.far=50,l.shadow.camera.left=-50,l.shadow.camera.right=50,l.shadow.camera.top=50,l.shadow.camera.bottom=-50,g.add(l);const _=new n.DirectionalLight(16777215,.8);_.position.set(-8,-8,6),g.add(_);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),g.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);g.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),g.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),g.add(q)},C=()=>{P=requestAnimationFrame(C),h&&h.update();const m=performance.now(),l=m-N;l<D||(N=m-l%D,d&&g&&u&&d.render(g,u),x&&x.render())},I=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(_=>{m[_]&&m[_].dispose&&m[_].dispose()}),m.dispose&&m.dispose()},A=m=>{m==null||m.traverse(l=>{l.geometry&&l.geometry.dispose(),l.material&&(Array.isArray(l.material)?l.material.forEach(_=>{I(_)}):I(l.material))})};return{currentModels:b,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,_=m.clientHeight;u.aspect=l/_,u.updateProjectionMatrix(),d.setSize(l,_),x.update()},fitCameraToAllModels:m=>{if(!u||!h||b.value.length===0)return;const l=new n.Box3;let _=!1;if(b.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),_=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),_=!0}else l.expandByObject(Z),_=!0}),!_){console.warn("无法计算包围盒");return}const B=l.getSize(new n.Vector3),O=l.getCenter(new n.Vector3),q=Math.max(B.x,B.y,B.z)*.8,X=new n.Vector3(O.x+q,O.y-q,O.z+q);u.position.copy(X),u.lookAt(O),h.target.copy(O),h.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:g,camera:u,renderer:d,controls:h,gizmo:x}),clearAllModels:()=>{if(!g)return;b.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==E&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),b.value=[],p()},cleanup:()=>{P&&cancelAnimationFrame(P),c&&c.dispose(),E&&(E.geometry.dispose(),E.material.dispose()),d&&d.dispose(),h&&h.dispose(),x&&x.dispose()},updateGridForModels:p}}function ge(z,g){const u=e.ref(!1);let d=null,h=12700,x=new n.Vector3,P=new n.Vector3,c=new n.Vector3,E=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,N=t=>{const p=new n.Vector3,f=E*1.2,C=new n.Vector3(c.x+f,c.y,c.z),I=new n.Vector3(c.x,c.y+f,c.z),A=new n.Vector3(c.x,c.y-f,c.z);if(t<=.567){const $=t/.567*Math.PI*2;p.x=c.x+Math.cos($)*f,p.z=c.z+Math.sin($)*f,p.y=c.y}else if(t<=.724){const L=(t-.567)/.157,$=D(L);p.lerpVectors(C,I,$)}else if(t<=.881){const L=(t-.724)/.157,J=D(L)*Math.PI;p.x=c.x+Math.sin(J)*f,p.y=c.y+Math.cos(J)*f,p.z=c.z}else{const L=(t-.881)/.119,$=D(L);p.lerpVectors(A,x,$)}return p},b=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,C=Math.min(f/h,1);if(C>=1){k();return}const I=N(C);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(b)},r=()=>{if(g.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),P.copy(p.target);const f=new n.Box3;g.value.forEach(G=>{f.expandByObject(G)});const C=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),E=Math.max(C.x,C.y,C.z)*1.2;const I=new n.Vector3(c.x+E*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const G=Date.now()-$,Y=Math.min(G/L,1),m=D(Y);t.position.lerpVectors(A,I,m),t.lookAt(c),p.target.copy(c),Y<1?requestAnimationFrame(J):(u.value=!0,d=null,b())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(P))};return{isAnimating:u,toggleAnimation:()=>{if(u.value){u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{camera:t,controls:p}=z();if(!t||!p)return;p.enabled=!0;const f=t.position.clone(),C=p.target.clone(),I=1500,A=Date.now(),L=()=>{const $=Date.now()-A,J=Math.min($/I,1),G=D(J);t.position.lerpVectors(f,x,G),p.target.lerpVectors(C,P,G),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function he(z,g){const u=e.ref(!1),d=e.ref("none");let h=[],x=[],P=new n.Box3,c=new n.Vector3;const E=()=>{h=[new n.Plane(new n.Vector3(1,0,0),0),new n.Plane(new n.Vector3(0,1,0),0),new n.Plane(new n.Vector3(0,0,1),0)]},F=()=>{P.makeEmpty(),g.value.forEach(y=>{P.expandByObject(y)}),c=P.getCenter(new n.Vector3)},D=y=>{const t=P.getSize(new n.Vector3);let p,f,C;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,Math.PI/2,0)):y==="y"?(p=new n.PlaneGeometry(t.x*1.2,t.z*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(Math.PI/2,0,0)):y==="z"&&(p=new n.PlaneGeometry(t.x*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,0,0));const I=new n.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:n.DoubleSide,depthWrite:!1}),A=new n.Mesh(p,I);return A.position.copy(f),A.rotation.copy(C),A},N=()=>{if(b(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(h[0].constant=-c.x,y=h[0]):d.value==="y"?(h[1].constant=-c.y,y=h[1]):d.value==="z"&&(h[2].constant=-c.z,y=h[2]),y){g.value.forEach(p=>{p.traverse(f=>{f.isMesh&&f.material&&(Array.isArray(f.material)?f.material.forEach(C=>{C.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},b=()=>{g.value.forEach(y=>{y.traverse(t=>{t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(p=>{p.clippingPlanes=[]}):t.material.clippingPlanes=[])})})},r=()=>{const{scene:y}=z();y&&x.forEach(t=>{y.remove(t),t.geometry.dispose(),t.material.dispose()}),x=[]};return{isClipping:u,activeClippingAxis:d,toggleClipping:()=>{u.value=!u.value,u.value?(E(),g.value.length>0&&F()):(d.value="none",b(),r())},updateClippingPlanes:N,clearClippingPlanes:b,clearClippingMeshes:r}}const ye={class:"panel-content"},we={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const g=z;e.ref();const u=e.ref();return e.watch(()=>[g==null?void 0:g.animationData],()=>{var h;let d=((h=re.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,P,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(me.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(P=u.value)==null?void 0:P.id,index:(c=u.value)==null?void 0:c.id,showHeader:!1},null,8,["itemData","index"]))])}}},xe=oe._export_sfc(we,[["__scopeId","data-v-2387536e"]]),Ve={class:"panel-content"},Me={key:0,class:"joints-list"},ke={class:"joint-info-row"},Pe={class:"joint-left"},Ce={class:"joint-name"},Ee={class:"joint-range"},be={class:"joint-type"},_e={key:0,class:"joint-control-row"},ze={class:"slider-container"},De=["min","max","value","onInput","disabled"],Se={class:"value-display"},Ne={class:"joint-value"},Be={class:"unit"},Ae={key:1,class:"empty-state"},ae=.001,Re=1e3,ue=60,Fe={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:g}){const u=z;e.ref(!0);const d=e.ref([]),h=e.ref(null),x=e.ref(null),P=e.ref(12.5),c=e.ref(),E=e.ref(1302),F=e.ref(30),D=e.ref(!1),N=e.ref(!1),b=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ue/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;E.value=o.extra.管长,P.value=o.extra.外径/2;let v=((i=re.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const C=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!h.value)return re.ElMessage.error("未加载 URDF"),!1;let o=null;return h.value.traverse(v=>{o||v.name==="Pipe_Link"&&v.traverse(i=>{i instanceof n.Mesh&&!o&&(o=i)})}),o?(o.position.y-=F.value*ae,c.value=o,o.material=new n.MeshPhongMaterial({color:11184810,shininess:80,side:n.DoubleSide}),!0):(re.ElMessage.error('在 "Pipe_Link" 内未找到任何 Mesh'),!1)},A=o=>{if(!o||!o.joints)return console.warn("URDF模型没有关节信息"),[];let v=null;if(o.traverse(V=>{V.name==="Pipe_Link"&&!v&&(v=V)}),v)c.value=v;else return console.warn("未找到管子模型"),[];const i=[];return Object.keys(o.joints).forEach(V=>{const s=o.joints[V];if(s._jointType==="fixed")return;const a=s.limit?{lower:s.limit.lower??C(s._jointType,!1),upper:s.limit.upper??C(s._jointType,!0)}:{lower:C(s._jointType,!1),upper:C(s._jointType,!0)};i.push({name:V,type:s._jointType||"unknown",limit:a,currentValue:s.angle||0,urdfJoint:s})}),i.sort((V,s)=>V.name.localeCompare(s.name))},L=(o,v)=>{const i=d.value.find(s=>s.name===o);if(!i)return;const V=parseFloat(v);if(i.limit){const s=Math.max(i.limit.lower,Math.min(i.limit.upper,V));i.currentValue=s}else i.currentValue=V;u.model&&u.model.setJointValue?u.model.setJointValue(o,i.currentValue):i.urdfJoint&&i.urdfJoint.setJointValue(i.currentValue)},$=o=>o.reduce((v,i)=>{let V=0;const s=i.Y??0,a=i.C??0,w=i.R??0;return s>0&&(V+=s),a>0&&w>0&&(V+=w*y(a)),v+V},0),J=o=>{const v=[],i=o.Y??0,V=o.B??0,s=o.C??0,a=o.R??0,w={pos:new n.Vector3(0,0,0),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};if(!i&&!s)return v;if(v.push(w.pos.clone()),V!==0){const U=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(U),w.localZ.applyMatrix4(U)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const U=y(s),T=a*ae,W=w.pos.clone().add(w.localX.clone().multiplyScalar(-T)),R=Math.max(16,Math.ceil(s/5));for(let M=1;M<=R;M++){const H=U*M/R,K=new n.Matrix4().makeRotationAxis(w.localZ,H),se=w.localX.clone().multiplyScalar(T).applyMatrix4(K),ie=W.clone().add(se);v.push(ie)}}return v},G=(o,v=0)=>{let i=f.slice(0,o+1);const V=f[o+1];if(V&&v>0){const R={...V,B:(V.B??0)*v,C:(V.C??0)*v};i.push(R)}const s=$(i),a=Math.max(0,E.value-s),w=[];w.push(new n.Vector3(0,0,0));const U=new n.Vector3(0,a*ae,0);a>0&&w.push(U);let T={pos:U.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const W=[];for(let R=i.length-1;R>=0;R--){const M=i[R],H=J(M);if(H.length>0){const K=H.map(Q=>{const ne=Q.clone(),de=new n.Matrix4;return de.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(de),ne.add(T.pos)});W.push(K);const te=K[K.length-1];T.pos=te.clone();const se=M.B??0,ie=M.C??0;if(se!==0){const Q=new n.Matrix4().makeRotationAxis(T.localY,y(se));T.localX.applyMatrix4(Q),T.localZ.applyMatrix4(Q)}if(ie>0){const Q=y(ie),ne=new n.Matrix4().makeRotationAxis(T.localZ,Q);T.localY.applyMatrix4(ne),T.localX.applyMatrix4(ne)}}}for(const R of W)R.length>1&&w.push(...R.slice(1));w.length<2&&w.push(new n.Vector3(0,.001,0));try{const R=new n.CatmullRomCurve3(w,!1,"catmullrom",.01),M=new n.TubeGeometry(R,Math.max(2,w.length*4),P.value*ae,18,!1);c.value.geometry.dispose(),c.value.geometry=M}catch(R){console.error("管件更新失败",R)}},Y=(o,v,i=1)=>{o&&(Object.keys(o).forEach(V=>{const s=o[V],a=d.value.find(w=>w.name===V);a&&(a.currentValue=s,u.model&&u.model.setJointValue?u.model.setJointValue(V,s):a.urdfJoint&&a.urdfJoint.setJointValue(s))}),G(v,i))},m=(o,v,i)=>o+(v-o)*i,l=(o,v,i)=>{if(!o||!v)return o||v;const V={};return Object.keys(o).forEach(s=>{const a=o[s],w=v[s];V[s]=m(a,w||a,i)}),V},_=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,N.value=!1,b.value=0,r.value=0,B()},B=()=>{if(!D.value||N.value)return;const o=b.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ue,i=f[o],V=f[o+1];if(V){const s=l(i,V,v);Y(s,o,v)}else Y(i,o);r.value++,r.value>ue&&(r.value=0,b.value++),k.value=setTimeout(B,p())},O=()=>{N.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,N.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};g({startAnimation:_,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),b.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),G(-1,0)},fastForward:()=>{t.value<4&&(t.value=Math.min(4,t.value*2))},fastBackward:()=>{t.value>.25&&(t.value=Math.max(.25,t.value/2))}}),e.watch(()=>u.model,o=>{o?(h.value=o,d.value=A(o)):d.value=[]},{immediate:!0});const ee=()=>{!u.model||D.value&&!N.value||d.value.forEach(o=>{o.urdfJoint&&o.urdfJoint.angle!==void 0&&(o.currentValue=o.urdfJoint.angle)})},le=()=>{const o=()=>{ee(),x.value=requestAnimationFrame(o)};o()},ce=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{ce(),j()}),(o,v)=>(e.openBlock(),e.createElementBlock("div",Ve,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var V,s,a,w;return e.openBlock(),e.createElementBlock("div",{key:i.name,class:"joint-item"},[e.createElementVNode("div",ke,[e.createElementVNode("div",Pe,[e.createElementVNode("span",Ce,e.toDisplayString(i.name),1),e.createElementVNode("span",Ee," ["+e.toDisplayString(((V=i.limit)==null?void 0:V.lower.toFixed(2))??(i.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((s=i.limit)==null?void 0:s.upper.toFixed(2))??(i.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",be,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",ze,[e.createElementVNode("input",{type:"range",min:((a=i.limit)==null?void 0:a.lower)??(i.type==="revolute"?-Math.PI:-1),max:((w=i.limit)==null?void 0:w.upper)??(i.type==="revolute"?Math.PI:1),step:.01,value:i.currentValue,onInput:U=>L(i.name,U.target.value),class:"joint-slider",disabled:D.value&&!N.value},null,40,De)]),e.createElementVNode("div",Se,[e.createElementVNode("span",Ne,e.toDisplayString(i.currentValue?Number(i.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Be,e.toDisplayString(i.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Ae,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},Te=oe._export_sfc(Fe,[["__scopeId","data-v-035ae936"]]),Le={class:"panel-content"},Ie="id",$e={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:z=>["breadth","firstLevel"].includes(z)}},emits:["nodeClick"],setup(z,{emit:g}){const u=z,d=g,h=e.ref([]),x={children:"children",label:"label"},P=r=>{d("nodeClick",r)},c=(r,k=0)=>{const y=[];return Array.isArray(r)&&(r==null?void 0:r.length)>0&&r.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const p={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:k+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:c(t==null?void 0:t.children,k+1),path:t==null?void 0:t.name};y.push(p)}}),y},E=r=>r?[{name:r==null?void 0:r.name,label:r==null?void 0:r.name,show:!0,level:1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:c(r==null?void 0:r.children,1),path:r==null?void 0:r.name}]:[],F=(r,k)=>{const y=[],t=[...r];for(;t.length>0&&y.length<k;){const p=t.shift();p.children&&p.children.length>0&&(y.push(p.id),t.push(...p.children))}return y},D=(r,k)=>{const y=[];return r.forEach(t=>{if(t.children&&t.children.length>0){y.push(t.id);const p=t.children.filter(f=>f.children&&f.children.length>0).slice(0,k).map(f=>f.id);y.push(...p)}}),y.slice(0,k+1)},N=e.computed(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),b=e.computed(()=>u!=null&&u.model?E(u.model):[]);return e.watch(b,r=>{h.value=JSON.parse(JSON.stringify(r))},{immediate:!0}),(r,k)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(y,{data:h.value,props:x,"default-expanded-keys":N.value,"node-key":Ie,onNodeClick:P},null,8,["data","default-expanded-keys"])])}}},Je=oe._export_sfc($e,[["__scopeId","data-v-290ff4e1"]]),Oe=["xlink:href"],Ue=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(z){const g=z,u=e.computed(()=>({backgroundColor:g.backgroundColor})),d=e.computed(()=>`#${g.prefix}-${g.name}`),h=e.computed(()=>{const{size:x}=g;let P=`${x}`;return P=`${P.replace("px","")}px`,{width:P,height:P}});return(x,P)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:x.active}]),style:e.normalizeStyle(u.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[x.$attrs.class,x.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(h.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Oe)],6))],6))}}),S=oe._export_sfc(Ue,[["__scopeId","data-v-3150a90b"]]),Ge={class:"obj-viewer-container"},je={class:"buttonGroup-top"},qe={class:"buttonGroup-topLeft"},Xe={class:"buttonGroup-left"},He={class:"buttonGroup-right"},Ye={class:"buttonGroup-bottom"},Ze={class:"left-panel"},We={class:"panel-header"},Ke={key:1,class:"clipping-content"},Qe={class:"radio-group"},et={class:"radio-label"},tt={class:"radio-label"},nt={class:"radio-label"},at={class:"radio-label"},ot={class:"right-panel"},lt={class:"panel-header"},st={key:0,class:"loading-overlay"},it={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(z,{expose:g,emit:u}){const d=u;let h=null,x=!1;const P=e.ref(null),c=e.ref(!1),E=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),N=e.ref(""),b=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:C,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ve(P),{isAnimating:J,toggleAnimation:G,stopAnimation:Y}=ge(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:_,updateClippingPlanes:B}=he(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=fe.useModelLoader(A,y,c,E,L),Z=()=>{if(F.value||y.value.length===0)return;F.value=!0,J.value&&Y();const{camera:s,controls:a}=A();if(!s||!a)return;a.enabled=!0;const w=H=>H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2,U=s.position.clone(),T=a.target.clone(),W=1500,R=Date.now(),M=()=>{const H=Date.now()-R,K=Math.min(H/W,1),te=w(K);s.position.lerpVectors(U,t.value,te),a.target.lerpVectors(T,p.value,te),K<1?requestAnimationFrame(M):F.value=!1};M()},ee=async()=>x?Promise.resolve():new Promise(s=>{const a=()=>{x?s():requestAnimationFrame(a)};a()}),le=async(s,a)=>{try{await ee(),J.value&&Y(),m.value&&_();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},ce=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,N.value=s,s==="剖面视图"&&!m.value&&_()},i=s=>{b.value=!0,r.value=s,s==="动画仿真"&&d("getAnimationData")},V=()=>{e.nextTick(()=>{var s;(s=k.value)==null||s.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{f(),h=A().scene,x=!0,window.addEventListener("resize",C)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,N.value="",r.value="",window.removeEventListener("resize",C),J.value&&Y(),$()}),g({addModelsFromUrls:ce,loadModelByDefaultPath:o}),(s,a)=>{var U,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Ge,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:P,class:"threejs-container"},null,512),e.createElementVNode("div",je,[e.createVNode(S,{name:"guanjianjiexi",size:"34"}),e.createVNode(S,{name:"guanjiekongzhi",size:"34"}),e.createVNode(S,{name:"gongyishengcheng",size:"34"}),e.createVNode(S,{name:"buchangshezhi",size:"34"}),e.createVNode(S,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",qe,[e.createVNode(S,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(S,{name:"fangda",size:"24",title:"放大"}),e.createVNode(S,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(S,{name:"lookAround",size:"24",onClick:e.unref(G),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Xe,[e.createVNode(S,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&N.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(S,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&N.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(S,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",He,[e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:b.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:b.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ye,[e.createVNode(S,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(U=k.value)==null?void 0:U.fastBackward},null,8,["onClick"]),e.createVNode(S,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(S,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(S,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(S,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(R=k.value)==null?void 0:R.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",Ze,[e.createElementVNode("div",We,[e.createElementVNode("span",null,e.toDisplayString(N.value),1),e.createElementVNode("span",{class:"close",onClick:a[6]||(a[6]=M=>D.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[N.value==="场景树"?(e.openBlock(),e.createBlock(Je,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),N.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("div",Qe,[e.createElementVNode("label",et,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":a[7]||(a[7]=M=>e.isRef(l)?l.value=M:null),onChange:a[8]||(a[8]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[16]||(a[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",tt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":a[9]||(a[9]=M=>e.isRef(l)?l.value=M:null),onChange:a[10]||(a[10]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[17]||(a[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":a[11]||(a[11]=M=>e.isRef(l)?l.value=M:null),onChange:a[12]||(a[12]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[18]||(a[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",at,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":a[13]||(a[13]=M=>e.isRef(l)?l.value=M:null),onChange:a[14]||(a[14]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[19]||(a[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,D.value]]),e.withDirectives(e.createElementVNode("div",ot,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(r.value),1),e.createElementVNode("span",{class:"close",onClick:a[15]||(a[15]=M=>b.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Te,{ref_key:"jointRef",ref:k,model:e.unref(q),scene:e.unref(h),animationData:z.animationData},null,8,["model","scene","animationData"]),[[e.vShow,r.value==="关节控制"]]),e.withDirectives(e.createVNode(xe,{animationData:z.animationData},null,8,["animationData"]),[[e.vShow,r.value==="动画仿真"]])]),_:1})],512),[[e.vShow,b.value]]),c.value?(e.openBlock(),e.createElementBlock("div",st,[a[20]||(a[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(E.value),1)])):e.createCommentVNode("",!0)])}}},rt=oe._export_sfc(it,[["__scopeId","data-v-7bc47bb3"]]);exports.default=rt;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ref as b, watch as Pe, createElementBlock as q, openBlock as H, createBlock as Le, computed as ie, onMounted as $e, onUnmounted as je, Fragment as Xe, renderList as He, createElementVNode as h, createCommentVNode as xe, toDisplayString as ae, resolveComponent as Je, createVNode as z, defineComponent as Ye, normalizeStyle as Ee, normalizeClass as Fe, nextTick as Be, onBeforeUnmount as qe, withDirectives as se, unref as O, withCtx as Te, isRef as he, vModelRadio as ye, vShow as we } from "vue";
|
|
2
2
|
import { V as M, B as be, S as Ze, C as We, P as Ke, W as Ne, a as Qe, A as et, b as tt, M as Re, X as nt, G as at, c as Me, d as ot, e as De, f as st, D as ke, H as lt, g as Ve, h as Oe, i as Ue, j as ze, E as _e, k as de, l as it, m as rt, T as ct } from "./STLLoader-CXf8uOlr.js";
|
|
3
3
|
import { O as ut } from "./OrbitControls-CYDbngZC.js";
|
|
4
|
-
import { s as dt } from "./index-
|
|
5
|
-
import { u as pt } from "./index.vue_vue_type_style_index_1_lang-
|
|
4
|
+
import { s as dt } from "./index-B4VYJrHF.js";
|
|
5
|
+
import { u as pt } from "./index.vue_vue_type_style_index_1_lang-DXdi5Q8-.js";
|
|
6
6
|
import { _ as me } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
7
|
import { c as Ge, E as Ie } from "./index-BQYjK74w.js";
|
|
8
8
|
function mt(E) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { defineComponent as Se, ref as f, watch as ae, shallowRef as re, computed as we, onUnmounted as Xe, resolveComponent as H, createElementBlock as oe, openBlock as W, createElementVNode as a, createCommentVNode as ne, createBlock as ie, createVNode as n, withCtx as B, unref as M, Fragment as Ge, renderList as Ze, toDisplayString as me, onBeforeUnmount as Ee, onMounted as Je, nextTick as Le, withDirectives as le, vShow as de, isRef as _e, vModelRadio as Ce } from "vue";
|
|
2
2
|
import { r as ve, U as Ie, s as Me, u as We, a as Ne, W as He } from "./useRayCaster-Cay06Pnc.js";
|
|
3
3
|
import { u as Be, a as qe, b as Ke, S as $ } from "./iconfont-BUMO0kCy.js";
|
|
4
|
-
import { s as Qe } from "./index-
|
|
4
|
+
import { s as Qe } from "./index-B4VYJrHF.js";
|
|
5
5
|
import { _ as te } from "./index.vue_vue_type_script_setup_true_lang-DRzriV-s.js";
|
|
6
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
6
|
+
import "./index.vue_vue_type_style_index_1_lang-BxhwL7ff.js";
|
|
7
7
|
import { c as ze, E as Z, R as Ye, a as el, aC as ll, ak as tl } from "./index-BQYjK74w.js";
|
|
8
8
|
import { m as $e, T as Ae, n as nl, i as al, V as J, e as ke, k as se, l as ol } from "./STLLoader-CXf8uOlr.js";
|
|
9
|
-
import { f as sl, a as il } from "./animationData-
|
|
10
|
-
import { o as rl, p as ul } from "./index-
|
|
9
|
+
import { f as sl, a as il } from "./animationData-CTpjCYhK.js";
|
|
10
|
+
import { o as rl, p as ul } from "./index-BJYEogKi.js";
|
|
11
11
|
/* empty css */
|
|
12
12
|
import { _ as Fe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
13
13
|
import "./URDFLoader-BbJ84yMW.js";
|
|
14
14
|
import { U as cl, J as pl } from "./urdfTree-Bjn6BxrP.js";
|
|
15
|
-
import { s as dl } from "./index-
|
|
15
|
+
import { s as dl } from "./index-BVbjjK1V.js";
|
|
16
16
|
const ue = 1e-3, ce = ol.degToRad, Oe = (A) => A.reduce((z, C) => {
|
|
17
17
|
let D = 0;
|
|
18
18
|
const y = C.Y ?? 0, h = C.C ?? 0, d = C.R ?? 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),q=require("./useRayCaster-G6jTQHIt.cjs"),_=require("./iconfont-BRr5XwJN.cjs"),Ve=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),q=require("./useRayCaster-G6jTQHIt.cjs"),_=require("./iconfont-BRr5XwJN.cjs"),Ve=require("./index-B0OjCXz7.cjs"),W=require("./index.vue_vue_type_script_setup_true_lang-BKTJR2th.cjs");require("./index.vue_vue_type_style_index_1_lang-CWXvUeB2.cjs");const R=require("./index-1z9RrjZc.cjs"),u=require("./STLLoader-Ck442nWz.cjs"),pe=require("./animationData-DLXZgNpV.cjs"),me=require("./index-DZHemv39.cjs");;/* empty css */const de=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");require("./URDFLoader-DUt8-G_J.cjs");const ve=require("./urdfTree-hY-C0CsG.cjs"),be=require("./index-CWaNzrIi.cjs"),H=.001,K=u.MathUtils.degToRad,ge=T=>T.reduce((D,w)=>{let x=0;const V=w.Y??0,g=w.C??0,p=w.R??0;return V>0&&(x+=V),g>0&&p>0&&(x+=p*K(g)),D+x},0),he=T=>{const D=[],w=T.Y??0,x=T.B??0,V=T.C??0,g=T.R??0,p={pos:new u.Vector3(0,0,0),localY:new u.Vector3(0,1,0),localX:new u.Vector3(1,0,0),localZ:new u.Vector3(0,0,1)};if(!w&&!V)return D;if(D.push(p.pos.clone()),x!==0){const $=new u.Matrix4().makeRotationAxis(p.localY,K(x));p.localX.applyMatrix4($),p.localZ.applyMatrix4($)}if(w>0&&(p.pos.add(p.localY.clone().multiplyScalar(w*H)),D.push(p.pos.clone())),V>0&&g>0){const $=K(V),r=g*H,A=p.pos.clone().add(p.localX.clone().multiplyScalar(-r)),i=Math.max(16,Math.ceil(V/5));for(let E=1;E<=i;E++){const s=$*E/i,M=new u.Matrix4().makeRotationAxis(p.localZ,s),k=p.localX.clone().multiplyScalar(r).applyMatrix4(M),f=A.clone().add(k);D.push(f)}}return D};function ne(T,D,w,x,V,g=0){let p=D.slice(0,V+1);const $=D[V+1];if($&&g>0){const c={...$,B:($.B??0)*g,C:($.C??0)*g};p.push(c)}const r=ge(p),A=Math.max(0,w-r),i=[];i.push(new u.Vector3(0,0,0));const E=new u.Vector3(0,A*H,0);A>0&&i.push(E);let s={pos:E.clone(),localY:new u.Vector3(0,1,0),localX:new u.Vector3(1,0,0),localZ:new u.Vector3(0,0,1)};const M=[];for(let c=p.length-1;c>=0;c--){const k=p[c],f=he(k);if(f.length>0){const d=f.map(C=>{const Y=C.clone(),G=new u.Matrix4;return G.makeBasis(s.localX,s.localY,s.localZ),Y.applyMatrix4(G),Y.add(s.pos)});M.push(d);const F=d[d.length-1];s.pos=F.clone();const j=k.B??0,N=k.C??0;if(j!==0){const C=new u.Matrix4().makeRotationAxis(s.localY,K(j));s.localX.applyMatrix4(C),s.localZ.applyMatrix4(C)}if(N>0){const C=K(N),Y=new u.Matrix4().makeRotationAxis(s.localZ,C);s.localY.applyMatrix4(Y),s.localX.applyMatrix4(Y)}}}for(const c of M)c.length>1&&i.push(...c.slice(1));i.length<2&&i.push(new u.Vector3(0,.001,0));try{const c=new u.CatmullRomCurve3(i,!1,"catmullrom",.01),k=new u.TubeGeometry(c,Math.max(2,i.length*4),x*H,18,!1);T.geometry.dispose(),T.geometry=k}catch(c){console.error("管件更新失败",c)}}function fe(T,D,w,x=0){let V=T.slice(0,w+1);const g=T[w+1];if(g&&x>0){const s={...g,B:(g.B??0)*x,C:(g.C??0)*x};V.push(s)}const p=ge(V),$=Math.max(0,D-p),r=[];r.push(new u.Vector3(0,0,0));const A=new u.Vector3(0,$*H,0);$>0&&r.push(A);let i={pos:A.clone(),localY:new u.Vector3(0,1,0),localX:new u.Vector3(1,0,0),localZ:new u.Vector3(0,0,1)};const E=[];for(let s=V.length-1;s>=0;s--){const M=V[s],c=he(M);if(c.length>0){const k=c.map(j=>{const N=j.clone(),C=new u.Matrix4;return C.makeBasis(i.localX,i.localY,i.localZ),N.applyMatrix4(C),N.add(i.pos)});E.push(k);const f=k[k.length-1];i.pos=f.clone();const d=M.B??0,F=M.C??0;if(d!==0){const j=new u.Matrix4().makeRotationAxis(i.localY,K(d));i.localX.applyMatrix4(j),i.localZ.applyMatrix4(j)}if(F>0){const j=K(F),N=new u.Matrix4().makeRotationAxis(i.localZ,j);i.localY.applyMatrix4(N),i.localX.applyMatrix4(N)}}}for(const s of E)s.length>1&&r.push(...s.slice(1));return r.length<2&&r.push(new u.Vector3(0,.001,0)),r}function le(T,D,w,x,V,g,p,$=0,r=0){const A=V-r,i=fe(x,A,p,$);let s=fe(w,r,p,$);s.forEach(c=>c.y=-c.y),s.reverse();const M=[...s,...i];try{const c=new u.CatmullRomCurve3(M,!1,"catmullrom",.01),k=new u.TubeGeometry(c,Math.max(2,M.length*4),g*H,18,!1);D.geometry.dispose(),T.geometry.dispose(),D.parent&&D.parent.remove(D),T.geometry=k}catch(c){console.error("管件更新失败",c)}}function ye(T=3e3){const D=new u.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:u.DoubleSide}),w=new u.CatmullRomCurve3([new u.Vector3(0,0,0),new u.Vector3(0,T*H,0)]),x=new u.TubeGeometry(w,64,.2,16,!1);return new u.Mesh(x,D)}const we={class:"panel-content"},Ne={class:"action-bar"},Ce={key:0,class:"animation-controls"},_e={class:"control-row"},Ee={class:"control-row"},ke={class:"control-row"},xe={class:"frame-info"},Me={class:"control-row"},Se={class:"progress-bar"},Re={key:1,class:"table-footer"},De={class:"dialog-footer"},Pe=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{},isSelfWindow:{type:Boolean}},emits:["getThreeData"],setup(T,{emit:D}){const w=T,x=D,V=e.ref(),g=e.ref(),p=e.ref("单机器人弯管");e.watch(()=>w.threeData,()=>{const l=R.cloneDeep(w.threeData),o=l==null?void 0:l.data;if(p.value=o==null?void 0:o.任务类型,!w.isSelfWindow&&w.threeData){let a={};p.value===q.robotMode.SINGLE&&(a=l==null?void 0:l.singleRobotData),p.value===q.robotMode.DOUBLE&&(a=l==null?void 0:l.doubleRobotData);const{initialPipeLength:v=0,pipeRadius:n=0,clampLength:t=0,animationData:b}=a;N.value=v,C.value=n,Y.value=t,V.value=b;const m=R.cloneDeep(V.value);r.value=(m==null?void 0:m["输出(动画数据)"])||[];let y=(m==null?void 0:m["输出(动画数据)Content"])??[];y&&(g.value=y)}},{immediate:!0});const $=async()=>{if(!sessionStorage.getItem("systemKey")){x("getThreeData");return}let o={};p.value===q.robotMode.SINGLE&&(o=await pe.fetchSingleRobotAnimationData()),p.value===q.robotMode.DOUBLE&&(o=await pe.fetchDoubleRobotAnimationData());const{initialPipeLength:a=0,pipeRadius:v=0,clampLength:n=0,animationData:t}=o;N.value=a,C.value=v,Y.value=n,V.value=t;const b=R.cloneDeep(V.value);r.value=(b==null?void 0:b["输出(动画数据)"])||[];let m=(b==null?void 0:b["输出(动画数据)Content"])??[];m&&(g.value=m)},r=e.ref([]),A=e.ref(!1),i=e.ref(""),E=e.ref(!1),s=e.ref(0),M=e.ref(0),c=e.ref(1e3),k=e.ref(null);let f=!1;const d=e.shallowRef(null),F=e.shallowRef(null),j=e.shallowRef(null),N=e.ref(1302),C=e.ref(12.5),Y=e.ref(30),G=e.ref([]),B=e.ref(null),h=e.computed(()=>w.model?Object.values(w.model.joints).filter(l=>l.jointType!=="fixed").map(l=>l.name):[]),I=e.ref(["Y","B","C","R"]),P=e.computed(()=>[...h.value,...I.value]),X=e.computed(()=>P.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${P.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),U=(l,o)=>{if(!o)return null;const a=l.links[o];if(!a)return console.warn(`在模型中未找到名为 '${o}' 的 link`),console.log("可用的链接:",Object.keys(l.links)),null;let v=null;return a.traverse(n=>{n instanceof u.Mesh&&!v&&(v=n)}),v||console.warn(`在 link '${o}' 中未找到可用的 Mesh 对象`),v},z=()=>{j.value&&(j.value.visible=!0),d.value&&d.value.parent&&d.value.parent.remove(d.value),j.value=null,d.value=null,F.value=null};e.watch(P,(l,o)=>{if(JSON.stringify(l)!==JSON.stringify(o))if(l.length>0){const a=l.reduce((v,n)=>(v[n]="0",v),{});r.value=[a]}else r.value=[]},{immediate:!0}),e.watch(()=>w.model,l=>{z(),l?(k.value=new q.URDFRobotController(l),G.value=Object.keys(l.links),G.value.includes("Pipe_Link")?B.value="Pipe_Link":B.value=null):(k.value=null,G.value=[],B.value=null)},{immediate:!0}),e.watch([B,Y],([l,o])=>{if(z(),w.model&&l){const a=U(w.model,l);if(console.log(a,"meshToReplace"),a&&a.parent){j.value=a;const v=new u.Mesh(a.geometry.clone(),a.material);if(v.name="managed_pipe_clone",a.parent.add(v),v.position.copy(a.position),v.rotation.copy(a.rotation),v.scale.copy(a.scale),a.visible=!1,p.value===q.robotMode.SINGLE&&(v.position.y-=o*.001),d.value=v,p.value===q.robotMode.DOUBLE){const n=new u.Mesh(a.geometry.clone(),a.material);n.name="managed_oppsite_pipe_clone",n.position.copy(a.position),n.rotation.copy(a.rotation),n.scale.copy(a.scale),a.parent.add(n),F.value=n}d.value&&F.value&&le(d.value,F.value,[],[],N.value,C.value,0,0,Y.value),R.ElMessage.success(`已将 Link: "${l}" 设置为当前管件`)}else l&&console.warn(`在 link '${l}' 中未找到可替换的网格或其没有父级。`)}});const Z=()=>r.value.map(l=>({Y:parseFloat(l.Y)||0,B:parseFloat(l.B)||0,C:parseFloat(l.C)||0,R:parseFloat(l.R)||0})),S=()=>{const l=[],o=[];return r.value.forEach(a=>{const{Y1:v,B1:n,C1:t,R1:b,Y2:m,B2:y,C2:J,R2:O}=a;l.push({Y:parseFloat(v)||0,B:parseFloat(n)||0,C:parseFloat(t)||0,R:parseFloat(b)||0}),o.push({Y:parseFloat(m)||0,B:parseFloat(y)||0,C:parseFloat(J)||0,R:parseFloat(O)||0})}),{posPipeYbcr:l,negPipeYbcr:o}},ee=l=>{if(l<0||l>=r.value.length){console.error(`帧索引 ${l} 超出范围`);return}const o=r.value[l];if(console.log(`应用第 ${l} 帧数据 ${o.value}`),k.value){const a={};h.value.forEach(v=>{const n=parseFloat(o[v]);isNaN(n)||(a[v]=n)}),k.value.setJointAngles(a)}if(d.value&&F.value){const a=S();console.log("ybcr数据:",a),le(d.value,F.value,a.posPipeYbcr,a.negPipeYbcr,N.value,C.value,l,0,Y.value);return}if(d.value){const a=Z();console.log("ybcr数据:",a),ne(d.value,a,N.value,C.value,l,0);return}s.value=l},te=async()=>{if(r.value.length===0){R.ElMessage.error("无法播放动画:无数据");return}E.value=!0,f=!1,s.value=0;const l=d.value?Z():[];try{for(let o=0;o<r.value.length&&!f;o++){s.value=o;const a=r.value[o],v={};k.value&&h.value.forEach(n=>{const t=parseFloat(a[n]);isNaN(t)||(v[n]=t)}),k.value?await k.value.animateToState(v,c.value,n=>{if(M.value=(o+n)/r.value.length*100,d.value&&F.value){const t=S();console.log("ybcr数据:",l),le(d.value,F.value,t.posPipeYbcr,t.negPipeYbcr,N.value,C.value,o-1,n,Y.value)}else d.value&&ne(d.value,l,N.value,C.value,o-1,n)}):d.value&&F.value?await new Promise(n=>{const t=performance.now();let b;const m=y=>{if(f){cancelAnimationFrame(b),n();return}const J=y-t,O=Math.min(J/c.value,1);M.value=(o+O)/r.value.length*100;const L=S();le(d.value,F.value,L.posPipeYbcr,L.negPipeYbcr,N.value,C.value,o-1,O,Y.value),O<1?b=requestAnimationFrame(m):n()};b=requestAnimationFrame(m)}):d.value?await new Promise(n=>{const t=performance.now();let b;const m=y=>{if(f){cancelAnimationFrame(b),n();return}const J=y-t,O=Math.min(J/c.value,1);M.value=(o+O)/r.value.length*100,ne(d.value,l,N.value,C.value,o-1,O),O<1?b=requestAnimationFrame(m):n()};b=requestAnimationFrame(m)}):(await new Promise(n=>setTimeout(n,c.value)),M.value=(o+1)/r.value.length*100)}f||R.ElMessage.success("动画播放完成")}catch(o){console.error("动画播放出错:",o),R.ElMessage.error("动画播放出错")}finally{E.value=!1,M.value=0}},Q=()=>{f=!0,E.value=!1,M.value=0,R.ElMessage.info("动画已停止")},oe=()=>{if(k.value&&k.value.resetToZero(),console.log("pipeMesh.value",d.value),d.value&&F.value){const l=S();le(d.value,F.value,l.posPipeYbcr,l.negPipeYbcr,N.value,C.value,-1,0,Y.value)}else if(d.value){const l=Z();ne(d.value,l,N.value,C.value,-1,0)}s.value=0,R.ElMessage.success("机器人和管件已重置")},ae=()=>{console.log("当前管件Mesh:",d.value)},se=l=>{E.value&&Q(),ee(l)},re=async()=>{if(P.value.length===0){R.ElMessage.warning("没有可导出的表头");return}const l=P.value.join(" ");try{await navigator.clipboard.writeText(l),R.ElMessage.success("表头已成功复制到剪贴板!")}catch(o){console.error("复制失败:",o),R.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},ie=()=>{if(!i.value.trim()){R.ElMessage.warning("导入内容不能为空");return}const l=i.value.trim().split(`
|
|
@@ -6,7 +6,7 @@ import "./URDFLoader-BbJ84yMW.js";
|
|
|
6
6
|
import { c as Ie, E as f } from "./index-BQYjK74w.js";
|
|
7
7
|
import { _ as ge } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
8
|
import { U as Ge, J as He } from "./urdfTree-Bjn6BxrP.js";
|
|
9
|
-
import { i as We } from "./animationData-
|
|
9
|
+
import { i as We } from "./animationData-CTpjCYhK.js";
|
|
10
10
|
import { at as Xe, e as Ye } from "./STLLoader-CXf8uOlr.js";
|
|
11
11
|
const Ze = { class: "panel-content" }, qe = { class: "action-bar" }, Ke = {
|
|
12
12
|
key: 0,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),R=require("./useRayCaster-G6jTQHIt.cjs"),c=require("./iconfont-BRr5XwJN.cjs"),W=require("./index.vue_vue_type_script_setup_true_lang-BKTJR2th.cjs");require("./URDFLoader-DUt8-G_J.cjs");const v=require("./index-1z9RrjZc.cjs"),Q=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Z=require("./urdfTree-hY-C0CsG.cjs"),fe=require("./animationData-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),R=require("./useRayCaster-G6jTQHIt.cjs"),c=require("./iconfont-BRr5XwJN.cjs"),W=require("./index.vue_vue_type_script_setup_true_lang-BKTJR2th.cjs");require("./URDFLoader-DUt8-G_J.cjs");const v=require("./index-1z9RrjZc.cjs"),Q=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Z=require("./urdfTree-hY-C0CsG.cjs"),fe=require("./animationData-DLXZgNpV.cjs"),ee=require("./STLLoader-Ck442nWz.cjs"),ge={class:"panel-content"},Ve={class:"action-bar"},be={key:0,class:"animation-controls"},he={class:"control-row"},Ne={class:"control-row"},ye={class:"frame-info"},Ee={class:"control-row"},ke={key:1,class:"empty-state"},Ce={class:"dialog-footer"},we=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(U,{expose:F}){const k=U,o=e.ref([]),P=e.ref(!1),y=e.ref(""),m=e.ref("stopped"),g=e.ref(0),C=e.ref(0),z=e.ref(10),w=e.ref(null);let i=0;const b=e.ref([]),_=e.computed(()=>k.model?Object.values(k.model.joints).filter(a=>a.jointType!=="fixed").map(a=>a.name):[]),V=e.computed(()=>[..._.value]),S=e.computed(()=>V.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${V.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),B=e.computed(()=>o.value[g.value]||{});e.watch(()=>k.model,a=>{a?(w.value=new R.URDFRobotController(a),b.value=Object.keys(a.links),o.value=[],g.value=0):(w.value=null,b.value=[])},{immediate:!0});const $=a=>{if(a<0||a>=o.value.length){console.error(`帧索引 ${a} 超出范围`);return}const l=o.value[a];if(w.value){const h={};_.value.forEach(E=>{const r=parseFloat(l[E]);isNaN(r)||(h[E]=r)}),w.value.setJointAngles(h)}g.value=a,C.value=o.value.length>1?a/(o.value.length-1)*100:100},J=async a=>{try{for(let l=g.value;l<o.value.length;l++){if(a!==i)return;const h=o.value[l],E={};if(w.value)_.value.forEach(r=>{const d=parseFloat(h[r]);isNaN(d)||(E[r]=d)}),await w.value.animateToState(E,z.value,r=>{a===i&&(C.value=(l+r)/o.value.length*100)});else{if(await new Promise(r=>setTimeout(r,z.value)),a!==i)return;C.value=(l+1)/o.value.length*100}g.value=l}a===i&&(v.ElMessage.success("动画播放完成"),m.value="stopped",C.value=100)}catch(l){console.error("动画播放出错:",l),v.ElMessage.error("动画播放出错"),m.value="stopped"}},A=()=>{if(o.value.length===0){v.ElMessage.error("无动画数据");return}m.value==="stopped"&&(g.value=0,$(0)),m.value="playing",i++,J(i),v.ElMessage.info("动画播放中")},T=()=>{m.value==="playing"&&(i++,m.value="paused",v.ElMessage.info("动画已暂停"))},j=()=>{i++,m.value="stopped",g.value=0,C.value=0,$(0),v.ElMessage.info("动画已停止并重置")},H=()=>{m.value==="playing"?T():A()},G=a=>{i++,m.value="paused",$(a)},q=()=>{if(!y.value.trim()){v.ElMessage.warning("导入内容不能为空");return}const a=y.value.trim().split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),m=require("./index-1z9RrjZc.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bdvwk9N0.cjs");const F=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function B(s){const c=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/uploadFile",method:"post",data:s,headers:{Authorization:c,"Content-Type":"multipart/form-data"}})}function d(s){const c=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/downloadFile",method:"post",data:s,headers:{Authorization:c,Accept:"application/octet-stream"},responseType:"blob"})}const D={key:4,class:"loading"},N=e.defineComponent({__name:"threeViewerHost",props:{fileUrls:{default:()=>[]},isThreeScene:{type:Boolean,default:!1},isTrackPath:{type:Boolean},trackFileType:{},host:{default:"inline"},animationData:{default:()=>({})},width:{default:"100%"},height:{default:"100%"},autoSize:{type:Boolean,default:void 0},threeData:{},isSelfWindow:{type:Boolean},componentType:{}},emits:["getThreeData"],setup(s,{emit:c}){const E=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-
|
|
1
|
+
"use strict";const e=require("vue"),m=require("./index-1z9RrjZc.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bdvwk9N0.cjs");const F=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function B(s){const c=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/uploadFile",method:"post",data:s,headers:{Authorization:c,"Content-Type":"multipart/form-data"}})}function d(s){const c=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/downloadFile",method:"post",data:s,headers:{Authorization:c,Accept:"application/octet-stream"},responseType:"blob"})}const D={key:4,class:"loading"},N=e.defineComponent({__name:"threeViewerHost",props:{fileUrls:{default:()=>[]},isThreeScene:{type:Boolean,default:!1},isTrackPath:{type:Boolean},trackFileType:{},host:{default:"inline"},animationData:{default:()=>({})},width:{default:"100%"},height:{default:"100%"},autoSize:{type:Boolean,default:void 0},threeData:{},isSelfWindow:{type:Boolean},componentType:{}},emits:["getThreeData"],setup(s,{emit:c}){const E=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-BpOW9IUT.cjs"))),T=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-Cet-KN8z.cjs"))),v=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeLatheView-BoPqISuU.cjs"))),w=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-D6gUCU6_.cjs"))),a={ROBOT_SCENE:"robot",LATHE_SCENE:"latheScene",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},r=s,u=e.computed(()=>{if(h.value)return null;if(r.componentType)switch(r.componentType){case"robot":return a.ROBOT_SCENE;case"latheScene":return a.LATHE_SCENE;case"cpmpip":return console.log("props.componentType",r.componentType),console.log("props.componentTypasade",a.CPMPIP_SCENE),a.CPMPIP_SCENE;case"preview":return a.PREVIEW}return r.isThreeScene&&!r.isTrackPath&&l.value.length>0?a.ROBOT_SCENE:r.isTrackPath&&r.trackFileType?a.LATHE_SCENE:l.value.length>0?a.PREVIEW:(console.error("未匹配到合适的组件类型,检查传入参数"),null)}),P=c,l=e.ref([]);e.ref(null);const h=e.ref(!1);function C(t){try{const n=new URL(t).pathname,i=n.substring(n.lastIndexOf("/")+1);return decodeURIComponent(i)}catch(n){return console.error("无法解析URL以提取文件名:",t,n),"未知文件名"}}async function _(t){let n,i;if(/^https?:\/\//.test(t))try{const o=await fetch(t);if(!o.ok)throw new Error(`下载文件失败: ${o.statusText} (URL: ${t})`);n=await o.blob(),i=C(t)}catch(o){throw console.error("使用 fetch 下载文件时出错:",o),o}else try{const o=await d({url:t});if(o.status!==200)throw new Error(`下载失败: ${o.status}`);const p=o.headers["content-disposition"];i=k(p)||"无文件名",n=o.data}catch(o){throw console.error("通过 API 下载文件时出错:",o),o}return new File([n],i,{type:n.type})}function k(t){if(!t)return;const n=t.match(/filename\*\s*=\s*([^;]+)/i);if(n){let o=n[1].trim();o=o.replace(/^"(.*)"$/,"$1");const p=o.split("''");if(p.length===2){const g=p[0].toUpperCase(),f=p[1];try{if(g==="UTF-8")return decodeURIComponent(f)}catch{}return f}try{return decodeURIComponent(o)}catch{return o}}const i=t.match(/filename\s*=\s*("?)([^";]+)\1/i);if(i)return i[2].trim()}async function S(t){if(!t||!t.length){l.value=[];return}h.value=!0;try{const n=await Promise.all(t.map(i=>_(i)));l.value=n}catch(n){console.error("文件下载时发生错误:",n),l.value=[]}finally{h.value=!1}}const b=()=>{P("getThreeData")};return e.watch(()=>r.fileUrls,async t=>{await S(t??[])},{immediate:!0,deep:!0}),(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(r.host==="electron"?"mv-electron":"mv-inline")},[u.value===a.ROBOT_SCENE?(e.openBlock(),e.createBlock(e.unref(E),{key:0,"file-blobs":l.value,"animation-data":t.animationData,onGetThreeData:b,threeData:r.threeData,isSelfWindow:r.isSelfWindow},null,8,["file-blobs","animation-data","threeData","isSelfWindow"])):u.value===a.LATHE_SCENE?(e.openBlock(),e.createBlock(e.unref(v),{key:1,threeData:r.threeData,trackFileType:r.trackFileType},null,8,["threeData","trackFileType"])):u.value===a.CPMPIP_SCENE?(e.openBlock(),e.createBlock(e.unref(w),{key:2,"file-blobs":l.value,threeData:r.threeData},null,8,["file-blobs","threeData"])):u.value===a.PREVIEW?(e.openBlock(),e.createBlock(e.unref(T),{key:3,"file-blobs":l.value,"animation-data":t.animationData},null,8,["file-blobs","animation-data"])):h.value?(e.openBlock(),e.createElementBlock("div",D," 文件下载中,请稍候... ")):e.createCommentVNode("",!0)],2))}}),y=F._export_sfc(N,[["__scopeId","data-v-18490850"]]),A=Object.freeze(Object.defineProperty({__proto__:null,default:y},Symbol.toStringTag,{value:"Module"}));exports.downloadAvatarApi=d;exports.threeViewerHost=y;exports.threeViewerHost$1=A;exports.uploadFile=B;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as R, defineAsyncComponent as h, computed as I, ref as E, watch as U, createElementBlock as T, openBlock as s, normalizeClass as A, createBlock as f, createCommentVNode as B, unref as d } from "vue";
|
|
2
2
|
import { a as w } from "./index-BQYjK74w.js";
|
|
3
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
3
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C0FUSSZR.js";
|
|
4
4
|
import { _ as V } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
5
|
function j(l) {
|
|
6
6
|
const c = sessionStorage.getItem("loginToken") ?? "123456";
|
|
@@ -49,7 +49,7 @@ const M = {
|
|
|
49
49
|
},
|
|
50
50
|
emits: ["getThreeData"],
|
|
51
51
|
setup(l, { emit: c }) {
|
|
52
|
-
const v = h(() => import("./threeSceneView-
|
|
52
|
+
const v = h(() => import("./threeSceneView-BOr_zjMB.js")), C = h(() => import("./threePreview-BZxc_xoq.js")), P = h(() => import("./threeLatheView-CdkQ2EqM.js")), S = h(() => import("./threeSceneViewForCPMPIP-BA9YBmBn.js")), n = {
|
|
53
53
|
ROBOT_SCENE: "robot",
|
|
54
54
|
// 机器人场景
|
|
55
55
|
LATHE_SCENE: "latheScene",
|