This commit is contained in:
joylink_cuiweidong 2020-05-12 19:03:19 +08:00
commit 6fe3fe6ecb
23 changed files with 1388 additions and 43 deletions

View File

@ -0,0 +1,557 @@
export function Moveanimate(main){
let scope = this;
this.helpbox = null;
this.textplane = null;
//动画列表
this.animatelist = [];
this.playlist = null;
this.playorder = 0;
//动画播放器开关
this.enable = true;
//动画开关状态
this.status = true;
//当前动画模型
this.nowmodelname = undefined;
//定义所有继电器部件动画
// this.initlist = function(modellist){
//
// for(let j=0,lenj=modellist.length;j<lenj;j++){
//
// for(let i=0,leni=switchmodel.children.length;i<leni;i++){
//
// if(switchmodel.children[i].name == "dizuo"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z-150));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"dizuoon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z-150));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"dizuooff",points2,0.5,true,0);
//
//
// }
// if(switchmodel.children[i].name == "Lxing"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y-50,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"Lxingon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y-50,switchmodel.children[i].position.z));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"Lxingoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name == "jiaoxingxiantie"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z+25));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"jiaoxingxiantieon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z+25));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"jiaoxingxiantieoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name == "xianquan"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y-100,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"xianquanon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y-100,switchmodel.children[i].position.z));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"xianquanoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name == "zhongchuipian"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y-25,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"zhongchuipianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+25,switchmodel.children[i].position.z));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"zhongchuipianoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name == "lagan"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+100,switchmodel.children[i].position.z+50));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"laganon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+100,switchmodel.children[i].position.z+50));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"laganoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name == "dongjiedianzhou"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+100,switchmodel.children[i].position.z+25));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"dongjiedianzhouon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+100,switchmodel.children[i].position.z+25));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"dongjiedianzhouoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name == "neibu"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z-50));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"neibuon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z-50));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"neibuoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name == "jiedian"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+100,switchmodel.children[i].position.z-15));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"jiedianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+100,switchmodel.children[i].position.z-15));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"jiedianoff",points2,0.5,true,0);
//
// }
// if(switchmodel.children[i].name == "yapian"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+100,switchmodel.children[i].position.z-25));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"yapianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+100,switchmodel.children[i].position.z-25));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"yapianoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name == "fanghuozhao"){
// let points1 = [];
//
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z+200));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"fanghuozhaoon",points1,0.5,true,0);
//
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z+200));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"fanghuozhaooff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name == "dianyuanpian"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z-50));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"dianyuanpianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z-50));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"dianyuanpianoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name == "xinpian"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+150,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"xinpianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+150,switchmodel.children[i].position.z));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"xinpianoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name =="jueyuanzhou"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+100,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"jueyuanzhouon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+100,switchmodel.children[i].position.z));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"jueyuanzhouoff",points2,0.5,true,0);
// }
// if(switchmodel.children[i].name =="cigang"){
// let points1 = [];
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y-100,switchmodel.children[i].position.z+100));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"cigangon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y-100,switchmodel.children[i].position.z+100));
// points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"cigangoff",points2,0.5,true,0);
// }
// }
//
// }
// //
//
//
//
// }
this.initlistnew = function(switchmodel){
scope.animatelist[switchmodel.animacode+"chaijie"] = [];
scope.animatelist[switchmodel.animacode+"fuwei"] = [];
for(let i=0,leni=switchmodel.children.length;i<leni;i++){
if(switchmodel.children[i].name == "DDJ"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x-1.5,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"dizuoon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x-1.5,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"dizuooff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "DJZ"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x-3,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"Lxingon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x-3,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"Lxingoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "DINGK"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+9,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"jiaoxingxiantieon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+9,switchmodel.children[i].position.z));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"jiaoxingxiantieoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "SZ"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x-1.5,switchmodel.children[i].position.y,switchmodel.children[i].position.z-1));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"zhongchuipianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.xx-1.5,switchmodel.children[i].position.y,switchmodel.children[i].position.z-1));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"zhongchuipianoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "JSQ"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x-3,switchmodel.children[i].position.y+3,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"laganon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x-3,switchmodel.children[i].position.y+3,switchmodel.children[i].position.z));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"laganoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "YWJCQ"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z+3));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"dongjiedianzhouon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z+3));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"dongjiedianzhouoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "ESWCJJ"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"neibuon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"neibuoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "AQJD"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z-2));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"jiedianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z-2));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"jiedianoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "QDP"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z-3));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"yapianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z-3));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"yapianoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "SDP"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z-4));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"fanghuozhaoon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z-4));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"fanghuozhaooff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "ZDKBQ"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+3,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"dianyuanpianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+3,switchmodel.children[i].position.z));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"dianyuanpianoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name == "ZZ"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x+3,switchmodel.children[i].position.y+3,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"xinpianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x+3,switchmodel.children[i].position.y+3,switchmodel.children[i].position.z));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"xinpianoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name =="BSG"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x+1,switchmodel.children[i].position.y,switchmodel.children[i].position.z-5));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"jueyuanzhouon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x+1,switchmodel.children[i].position.y,switchmodel.children[i].position.z-5));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"jueyuanzhouoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name =="DZG"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x-1,switchmodel.children[i].position.y,switchmodel.children[i].position.z-5));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"cigangon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x-1,switchmodel.children[i].position.y,switchmodel.children[i].position.z-5));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"cigangoff",points2,0.5,true,0);
}
if(switchmodel.children[i].name =="CTK"){
let points1 = [];
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
points1.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"chaijie"],switchmodel.children[i],switchmodel.name+"ccichuihuqion",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y+6,switchmodel.children[i].position.z));
points2.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
scope.initanimate(scope.animatelist[switchmodel.animacode+"fuwei"],switchmodel.children[i],switchmodel.name+"ccichuihuqioff",points2,0.5,true,0);
}
}
// let points = [];
// points.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// points.push(new THREE.Vector3(switchmodel.children[i].position.x,switchmodel.children[i].position.y,switchmodel.children[i].position.z));
// scope.initanimate(switchmodel.children[i],switchmodel.name+"select1",points,true);
let modelorderlist = [];
modelorderlist[switchmodel.animacode] = [
{name:"SZ",pos:[-1.5,0,-1]},
{name:"DINGK",pos:[0,9,0]},
{name:"DJZ",pos:[-3,0,0]},
{name:"DDJ",pos:[-1.5,0,0]},
{name:"JSQ",pos:[-3,3,0]},
{name:"ZDKBQ",pos:[0,3,0]},
{name:"ZZ",pos:[3,3,0]},
{name:"ESWCJJ",pos:[0,6,0]},
{name:"CTK",pos:[0,6,0]},
{name:"YWJCQ",pos:[0,6,3]},
{name:"AQJD",pos:[0,6,-2]},
{name:"QDP",pos:[0,6,-3]},
{name:"SDP",pos:[0,6,-4]},
{name:"BSG",pos:[1,0,-5]},
{name:"DZG",pos:[-1,0,-5]}
];
scope.animatelist[switchmodel.animacode+"on"] = [];
scope.animatelist[switchmodel.animacode+"off"] = [];
for(let i=0,leni=modelorderlist[switchmodel.animacode].length;i<leni;i++){
let orderdata = modelorderlist[switchmodel.animacode];
let modelon = switchmodel.getObjectByName(orderdata[i].name);
// modelon.helpbox = undefined;
let pointson = [];
pointson.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
pointson.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
let pointsoff = [];
pointsoff.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
pointsoff.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
// if(i == 0){
scope.initanimate(scope.animatelist[switchmodel.animacode+"on"],modelon,switchmodel.animacode+modelon.name+"on",pointson,0.01,true,i);
scope.initanimate(scope.animatelist[switchmodel.animacode+"off"],modelon,switchmodel.animacode+modelon.name+"off",pointsoff,0.01,true,leni-i-1);
// }else if((i+1)<leni){
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"on",pointson,0.01,true,switchmodel.animacode+orderdata[i+1].name+"on");
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"off",pointsoff,0.01,true,switchmodel.animacode+orderdata[i-1].name+"off");
// }else{
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"on",pointson,0.01,true);
// scope.initanimate(modelon,switchmodel.animacode+modelon.name+"off",pointsoff,0.01,true,switchmodel.animacode+orderdata[i-1].name+"off");
// }
// if(switchmodel.children[i].name == "xinpian"){
// }
// if(switchmodel.children[i].name =="cigang"){
// }
}
}
//动画对象定义
this.initanimate = function(list,modelobject,name,points,speed,type,nextname){
let curve = new THREE.CatmullRomCurve3(points);
// curve动画轨迹
// progress动画进度
// enable当前动画开关
// speed动画速度
let animate = {
name:name,
curve:curve,
progress:0,
directchange:false,
connectmodel:modelobject,
enable:false,
status:"start",
speed:speed,
next:null
};
// list[nextname] = [];
if(list[nextname] == undefined){
list[nextname] = [];
}
list[nextname].push(animate);
if(nextname){
// list[nextname] = animate;
// animate.next = nextname;
}else{
// list.push(animate);
}
}
this.setplaylist = function(nowlist,enable){
scope.playlist = nowlist;
scope.enable = enable;
scope.playorder = 0;
for(let i=0;i<scope.playlist[scope.playorder].length;i++){
scope.playlist[scope.playorder][i].status = "start";
}
}
this.updatehelpbox = function(nowhelpbox,nowtextplane){
scope.textplane = nowtextplane;
scope.helpbox = nowhelpbox;
}
this.startstop = function(){
}
this.next = function(){
}
this.before = function(){
}
//动画播放器
this.animateupdate = function(){
// console.log(scope.animatelist);
if(scope.enable){
if(scope.playlist){
for(let i=0;i<scope.playlist[scope.playorder].length;i++){
if(scope.playlist[scope.playorder][i].status == "start"){
}
if(scope.playlist[scope.playorder][i].progress>=1){
let point = scope.playlist[scope.playorder][i].curve.getPointAt(1);
//更新模型坐标
scope.playlist[scope.playorder][i].connectmodel.position.x = point.x;
scope.playlist[scope.playorder][i].connectmodel.position.y = point.y;
scope.playlist[scope.playorder][i].connectmodel.position.z = point.z;
scope.playlist[scope.playorder][i].enable = false;
scope.playlist[scope.playorder][i].status = "end";
scope.playlist[scope.playorder][i].progress = 0;
if(i >= scope.playlist[scope.playorder].length-1){
if(scope.playorder >= scope.playlist.length-1 ){
scope.playlist = null;
scope.status = true;
scope.enable = false;
main.animationmsgshowoff();
scope.nowmodelname = undefined;
scope.playorder = null;
break;
}else{
scope.playorder += 1;
}
}
}else{
// console.log(scope.animatelist[k].connectmodel);
if(scope.nowmodelname != scope.playlist[scope.playorder][i].connectmodel.name){
scope.nowmodelname = scope.playlist[scope.playorder][i].connectmodel.name;
main.animationmsgshowon(scope.playlist[scope.playorder][i].connectmodel);
}
//根据动画进度获取动画轨迹上点
scope.status = false;
let point = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress);
//更新模型坐标
scope.playlist[scope.playorder][i].connectmodel.position.x = point.x;
scope.playlist[scope.playorder][i].connectmodel.position.y = point.y;
scope.playlist[scope.playorder][i].connectmodel.position.z = point.z;
if(scope.helpbox){
scope.helpbox.update();
}
if(scope.textplane){
scope.textplane.position.x = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[12];
scope.textplane.position.y = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[13]+100;
scope.textplane.position.z = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[14];
}
//判断模型转向
if(scope.playlist[scope.playorder][i].directchange){
let tangent = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress+0.001);
// scope.animatelist[k]
tangent = null;
}
//增加动画进度,释放点变量
scope.playlist[scope.playorder][i].progress += scope.playlist[scope.playorder][i].speed;
point = null;
}
}
}
}
}
}

View File

@ -0,0 +1,120 @@
export function Textconfig(){
let scope = this;
this.devicelist = [];
this.jdqinit = function(){
}
this.jdqraycast = function(){
}
//配置继电器文字信息
this.initdevicetext = function(selectmodel){
if(scope.devicelist.length>0){
scope.devicelist = [];
}
for(let i=0,leni=selectmodel.children.length;i<leni;i++){
let part= {
name:selectmodel.children[i].name,
text:null,
mesh:selectmodel.children[i],
index:i,
show:true,
msg:null,
};
if(selectmodel.children[i].name == "AQJD"){
part.text = "安全接点";
part.msg = "安全接点应接触良好。在插入手摇把或钥匙时,安全接点应可靠断开,非经人工恢复不得接通电路。";
selectmodel.children[i].text = "安全接点";
}
if(selectmodel.children[i].name == "DDJ"){
part.text = "电动机";
part.msg = "电动转辙机的电动机在转辙机转换时起机械传动动作源的作用。";
selectmodel.children[i].text = "电动机";
}
if(selectmodel.children[i].name == "DINGK"){
part.text = "顶盖";
part.msg = "保护设备中部件。";
selectmodel.children[i].text = "顶盖";
}
if(selectmodel.children[i].name == "SZ"){
part.text = "锁子";
part.msg = "锁子";
selectmodel.children[i].text = "锁子";
}
if(selectmodel.children[i].name == "YWJCQ"){
part.text = "移位接触器";
part.msg = "移位接触器是一只非复式辙动开关,它有一组常闭接点,在转辙机中位于机壳侧壁齿条块顶杆的上方。它的作用是用它的常闭接点窜联在道岔表示电路中,监督主挤切削的状态是否完好,在道岔被挤时,如果表示杆被推或拉的动慢不足,检查柱未被顶起,而主副挤切销被挤断,动作杆在齿条块内位移,导致顶杆上升,使位移接点断开,切断转辙机表示电路,向行车值班员报警";
selectmodel.children[i].text = "移位接触器";
}
if(selectmodel.children[i].name == "ZDKBQ"){
part.text = "自动开闭器";
part.msg = "1.构成转辙机启动电路后在转换过程中以其机械动作构成两次接点变位监督转辙机转换全过程动作是否按要求完成。2.道岔被挤时,表示杆移动将检查柱顶起,使自动开闭器一排动接点离开静接点,从而切断道岔表示电路。";
selectmodel.children[i].text = "自动开闭器";
}
if(selectmodel.children[i].name == "SDP"){
part.text = "速动片";
part.msg = "速动片";
selectmodel.children[i].text = "速动片";
}
if(selectmodel.children[i].name == "JSQ"){
part.text = "减速器";
part.msg = "将电动机输出的高转速、低转距的机械能,转变成低转速、大转距的机械能,防止非正常情况下损坏机件或烧毁电动机。";
selectmodel.children[i].text = "减速器";
}
if(selectmodel.children[i].name == "BSG"){
part.text = "表示杆";
part.msg = "检查道岔尖轨的开通方向,监督道岔的状态,给自动开闭器的准确动作提供充分条件。";
selectmodel.children[i].text = "表示杆";
}
if(selectmodel.children[i].name == "DZG"){
part.text = "动作杆";
part.msg = "齿条块和动作杆是转辙机转换道岔最后的执行部件。它们不仅要有足够的机械强度,还要在每次转换结束将道岔锁住。此外,当发生挤岔事故时,尽可能保证转辙机内部机件不受损坏。";
selectmodel.children[i].text = "动作杆";
}
if(selectmodel.children[i].name == "CTK"){
part.text = "齿条块";
part.msg = "齿条块和动作杆是转辙机转换道岔最后的执行部件。它们不仅要有足够的机械强度,还要在每次转换结束将道岔锁住。此外,当发生挤岔事故时,尽可能保证转辙机内部机件不受损坏。";
selectmodel.children[i].text = "齿条块";
}
if(selectmodel.children[i].name == "ZZ"){
part.text = "主轴";
part.msg = "主轴主要由主轴套、承轴、止挡栓和锁闭齿轮等附件与主轴组成。主轴的作用是推动大齿块以转换道岔并和削尖齿相配合完成对道岔的机械锁闭。";
selectmodel.children[i].text = "主轴";
}
if(selectmodel.children[i].name == "DJZ"){
part.text = "电机罩";
part.msg = "电机罩";
selectmodel.children[i].text = "电机罩";
}
if(selectmodel.children[i].name == "DK"){
part.text = "底壳";
part.msg = "固定转辙机的各部件,确保相关部件的轴向或径向通信。";
selectmodel.children[i].text = "底壳";
}
if(selectmodel.children[i].name =="QDP"){
part.text = "启动片";
part.msg = "启动片";
selectmodel.children[i].text = "启动片";
}
if(selectmodel.children[i].name =="ESWCJJ"){
part.text = "二十位插接件";
part.msg = "二十位插接件";
selectmodel.children[i].text = "二十位插接件";
}
// if(part.text == null){
// console.log(selectmodel.children[i].name);
// }
if(part.text){
scope.devicelist.push(part);
}
}
}
}

View File

@ -5,7 +5,7 @@ var Staticmodel = {
deviceType: "Switch",
type: "fuzhou",
picUrl: "",
assetUrl: "./../static/model/device/switch/switch.FBX"
assetUrl: "./../static/model/device/switch/ZD6D.FBX"
},//"https://joylink.club/oss/wx/switch/switch.FBX"
//../../static/model/device/switch.FBX
Signal: {

View File

@ -5,6 +5,8 @@ import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { ModelManager } from '@/jlmap3d/jl3ddevice/loader.js';
import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
import { Moveanimate } from '@/jlmap3d/jl3ddevice/component/moveanimate.js';
import { Textconfig } from '@/jlmap3d/jl3ddevice/component/textconfig.js';
import StompClient from '@/utils/sock';
@ -19,6 +21,22 @@ export function Jl3ddeviceNew(dom,group,token) {
Signallightload(this.signallights);
this.mixers = [];
this.showmodel = null;
let helpbox,textplane;
let daochamodel;
//点击事件状态
this.raycasterstatus = false;
//动画状态
this.animastats = false;
//当前选中模型
this.nowobject = null;
//当前动画播放模型
this.animationmodel = null;
this.devicetext = new Textconfig();
this.windowstatus = '0';
//初始化webgl渲染
this.renderer = new THREE.WebGLRenderer({ antialias: true });
@ -30,7 +48,7 @@ export function Jl3ddeviceNew(dom,group,token) {
//定义相机
this.camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 120);
this.camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 200);
this.camera.position.set(0, 20, 30);
this.camera.aspect = dom.offsetWidth / dom.offsetHeight;
this.camera.updateProjectionMatrix();
@ -48,17 +66,18 @@ export function Jl3ddeviceNew(dom,group,token) {
grid.material.transparent = true;
this.scene.add(grid);
let moveanima = new Moveanimate(scope);
//定义全局光
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
this.scene.add(ambientLight);
var spotLight = new THREE.SpotLight(0xffffff);
spotLight.position.set(-50, 60, 15);
var spotLight = new THREE.SpotLight(0xececff);
spotLight.position.set(-50, 80, 0);
spotLight.castShadow = true;
spotLight.shadow.mapSize.width = 1024;
spotLight.shadow.mapSize.height = 1024;
spotLight.shadow.mapSize.width = 2048;
spotLight.shadow.mapSize.height = 2048;
this.scene.add(spotLight);
@ -67,8 +86,11 @@ export function Jl3ddeviceNew(dom,group,token) {
this.controls.maxPolarAngle = Math.PI / 2;
this.controls.minPolarangle = Math.PI / 5;
this.controls.maxDistance = 80;
this.controls.screenSpacePanning = true;
this.controls.update();
this.selectmodel = null;
document.addEventListener( "mousedown", onselect, false );
let teststomp = new StompClient();
// let topic = '/user/topic/simulation/assistant/'+group;
@ -104,12 +126,17 @@ export function Jl3ddeviceNew(dom,group,token) {
scope.camera.updateProjectionMatrix();
scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
}
this.domresize = function(){
scope.camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
scope.camera.updateProjectionMatrix();
scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
}
this.anime = null;
this.modelmanager = new ModelManager();
this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
console.log(scope.modelmanager);
moveanima.initlistnew(scope.modelmanager.switchmodel.mesh);
daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA");
animate();
})
@ -121,6 +148,7 @@ export function Jl3ddeviceNew(dom,group,token) {
scope.controls.update();
//scope.camera.lookAt(plane);
//
moveanima.animateupdate();
let delta = clock.getDelta();
if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) {
@ -131,6 +159,14 @@ export function Jl3ddeviceNew(dom,group,token) {
}
}
this.hideswitch = function (nowswitchstatus){
if(nowswitchstatus){
scope.modelmanager.switchmodel.mesh.add(daochamodel);
}else{
scope.modelmanager.switchmodel.mesh.remove(daochamodel);
}
}
this.selectmodel = function (data) {
@ -140,16 +176,26 @@ export function Jl3ddeviceNew(dom,group,token) {
scope.scene.remove(scope.showmodel);
scope.showmodel = null
scope.nowcode = data.code;
if (data._type == "Switch") {
// scope.modelmanager.switchmodel.locateType = data.body.locateType;
scope.modelmanager.switchmodel.code = data.code;
scope.showmodel = scope.modelmanager.switchmodel.mesh;
scope.scene.add(scope.showmodel);
scope.devicetext.initdevicetext(scope.modelmanager.switchmodel.mesh);
scope.nowobject = scope.modelmanager.switchmodel.mesh;
updatemenulist(scope.devicetext.devicelist);
scope.raycasterstatus = true;
}else{
scope.raycasterstatus = false;
scope.nowobject = "";
updatemenulist();
}
if (data._type == "Signal") {
scope.modelmanager.signalmodel.code = data.code;
scope.showmodel = scope.modelmanager.signalmodel.mesh;
scope.scene.add(scope.showmodel);
}
if (data._type == "Psd") {
@ -159,6 +205,7 @@ export function Jl3ddeviceNew(dom,group,token) {
scope.scene.add(scope.showmodel);
}
if(scope.showmodel){
scope.resetmodel();
scope.showmodel.code = data.code;
initstatus(data);
}
@ -205,6 +252,78 @@ export function Jl3ddeviceNew(dom,group,token) {
}
//设备分解、归位动画按钮
this.disperdevice1 = function(){
if(scope.nowobject.animacode){
if(moveanima.status == true){
if(scope.animastats == false){
scope.animastats = true;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"on"],true)
} else if(scope.animastats == true){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"off"],true);
}
}
}
};
this.disperdevice2 = function(){
if(scope.nowobject.animacode){
if(moveanima.status == true){
if(scope.animastats == false){
scope.animastats = true;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"chaijie"],true);
} else if(scope.animastats == true){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"fuwei"],true);
}
}
}
};
this.resetmodel = function(){
if(scope.nowobject.animacode){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"fuwei"],true);
}
};
this.animationmsgshowon = function(nowobject){
scope.animationmodel = nowobject;
if(helpbox){
scope.animationmodel.helpbox = null;
scope.scene.remove( helpbox );
helpbox = undefined;
}
settext(scope.animationmodel,scope.animationmodel.position);
// console.log(scope.animationmodel);
helpbox = new THREE.BoxHelper( scope.animationmodel, 0xff0000 );
moveanima.updatehelpbox(helpbox,textplane);
// settext(intersects[0].object,intersects[0].point);
// getdevicemsg(intersects[0].object.name);
scope.scene.add( helpbox );
getdevicemsg(nowobject.name);
}
this.animationmsgshowoff = function(nowobject){
if(helpbox){
scope.animationmodel.helpbox = null;
scope.scene.remove( helpbox );
helpbox = undefined;
}
if(textplane){
scope.scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
scope.animationmodel = null;
}
this.updateaction = function (data) {
if (data.type == "SWITCH") {
if (data.normal == "0") {
@ -272,6 +391,35 @@ export function Jl3ddeviceNew(dom,group,token) {
// scope.showmodel.
}
this.updateselect = function(updata){
// console.log(updata);
if(helpbox){
scope.scene.remove( helpbox );
helpbox = null;
}
helpbox = new THREE.BoxHelper( updata.mesh, 0xff0000 );
// console.log(updata.mesh);
let point = {
x:updata.mesh.matrixWorld.elements[12],
y:updata.mesh.matrixWorld.elements[13],
z:updata.mesh.matrixWorld.elements[14]
};
settext(updata.mesh,point)
getdevicemsg(updata.mesh.name);
scope.scene.add( helpbox );
}
function getdevicemsg(selectname){
// console.log(selectname);
for(let i=0,leni=scope.devicetext.devicelist.length;i<leni;i++){
if(selectname == scope.devicetext.devicelist[i].name){
updatemsg(scope.devicetext.devicelist[i].text,scope.devicetext.devicelist[i].msg);
i=leni;
}
}
}
function initstatus(data) {
if (data._type == "Switch") {
if (data.normalPosition == "0") {
@ -350,4 +498,125 @@ export function Jl3ddeviceNew(dom,group,token) {
}
}
this.updatewindowstatus = function(nowwindowstatus){
scope.windowstatus == nowwindowstatus;
}
function onselect(event){
if(event.button == '0'){
if(scope.raycasterstatus){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
let getBoundingClientRect = scope.dom.getBoundingClientRect()
if(scope.windowstatus == '0'){
mouse.x = ( (event.clientX - getBoundingClientRect .left) /scope.dom.offsetWidth) * 2-1;
mouse.y = -( (event.clientY - getBoundingClientRect .top) / scope.dom.offsetHeight) * 2 + 1;
}else{
mouse.x = (event.clientX / scope.dom.offsetWidth) * 2 - 1;
mouse.y = -(event.clientY / scope.dom.offsetHeight) * 2 + 1;
}
raycaster.setFromCamera( mouse, scope.camera );
let intersects = raycaster.intersectObjects( scope.modelmanager.switchmodel.mesh.children,true);
if(helpbox){
scope.scene.remove( helpbox );
helpbox = null;
}
if(textplane){
scope.scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
if(intersects[0]){
if(intersects[0].object.raycastoff){
helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 );
settext(intersects[0].object.parent,intersects[0].point);
getdevicemsg(intersects[0].object.parent.name);
}else{
helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
settext(intersects[0].object,intersects[0].point);
getdevicemsg(intersects[0].object.name);
}
scope.scene.add( helpbox );
}
}
}
}
function settext(intersects,point){
if(intersects.text){
let textgeometry = new THREE.PlaneBufferGeometry( 18, 12, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(intersects.text));
let textmaterial = new THREE.MeshBasicMaterial( {
side: THREE.DoubleSide,
map:textt ,transparent: true,
alphaTest:0.1
} );
if(textplane){
scope.scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
textplane= new THREE.Mesh( textgeometry, textmaterial );
// textplane.name = data[i].code;
textplane.position.x = point.x;
textplane.position.y = point.y+6;
textplane.position.z = point.z;
// console.log(textplane.position);
// textplane.tcode = data[i].code;
textplane.rotation.y = -Math.PI/2;
textplane.lookAt(scope.camera.position);
// scope.textlist.push(textplane);
// newmesh.children[0].add(textplane);
scope.scene.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
var beauty = new Image();
beauty.src = "../../static/texture/guide.png";
//canvas文字贴图方法
//PS:待提炼 增强功能
function getTextCanvas(text){
var canvas = document.getElementById('canvastexture');
canvas.width = 256;
canvas.height = 128;
var ctx = canvas.getContext('2d');
//var bg = canvas.createPattern(img, "no-repeat");
//ctx.fillStyle = bg;
ctx.fillRect(0, 0,256,128);
ctx.font = "20px Verdana";
ctx.fillStyle = '#FFFFFF';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,256,128);
//console.log(text.groupNumber);
ctx.drawImage(beauty,0,0,256, 128);
ctx.fillText("设备部件:"+text, 90,30);
// ctx.fillText("车组人员:XXX", 40,20);
// ctx.fillText("速度:XXX.XXX", 40,30);
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
let data = ctx.getImageData(0, 0,256, 128);
return data;
}
}

View File

@ -4,14 +4,14 @@ export function ModelManager(){
let scope = this;
this.switchmodel = {
code:null,
code:"switch",
locateType:"01",
mesh:null,
action:null
};
this.signalmodel = {
code:null,
code:"signal",
lightType:"01",
status:"01",
switchLocateType:"01",
@ -20,7 +20,7 @@ export function ModelManager(){
};
this.standmodel = {
code:null,
code:"stand",
screenDoorOpenStatus:"01",
mesh:null,
action:null
@ -56,7 +56,7 @@ function fbxpromise(asset,mixers,model){
child.receiveShadow = true;
}
} );
object.animacode = model.code;
model.mesh = object;
if(object.animations.length>0){

View File

@ -125,7 +125,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Signal] = {
distance: 10, // 设备距离区段的距离
distance: 3, // 设备距离区段的距离
post: {
standardColor: '#3149C3', // 灯珠颜色
standardWidth: 2 // 灯珠宽度

View File

@ -119,7 +119,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Signal] = {
distance: 10, // 设备距离区段的距离
distance: 3, // 设备距离区段的距离
post: {
standardLength: 6, // 高柱长度
standardHeight: 6, // 灯柱高度

View File

@ -27,6 +27,9 @@ class Jlmap {
// 线路参数
this.lineCode = '';
// 大屏系统
this.screenFlag = false;
// 皮肤风格
this.style = {};
@ -202,7 +205,8 @@ class Jlmap {
rectList.push(rect);
}
this.$painter.updateTransform1(arr, rectList);
}w
this.screenFlag = true;
}
setLevelVisible(list) {
this.$painter.setLevelVisible(list);

View File

@ -16,6 +16,8 @@ class Painter {
// 图层数据
this.mapInstanceLevel = {};
this.screenFlag = false;
// 初始图层
this.initLevels();
@ -139,6 +141,10 @@ class Painter {
instance && this.mapInstanceLevel[deviceType.Train].remove(instance);
this.add(device);
if (this.screenFlag) {
this.$transformHandleScreen.transformView(device.instance);
}
}
/**
@ -193,8 +199,13 @@ class Painter {
}
updateTransform1(list, opts) {
this.screenFlag = true;
this.$transformHandleScreen.updateTransform(list, opts);
}
// trainScreen() {
// this.$transformHandleScreen.updateTransform(list, opts);
// }
/**
* 更新zrender尺寸
* @param {*} opt

View File

@ -18,9 +18,6 @@ class TransformHandle {
// return createBoundingRect(view).intersect(this.rect); // 判断是否相交
// return createBoundingRect(view).intersect(rect); // 判断是否相交
const rectCopy = createBoundingRect(view);
if (view.model.code == 'T389') {
console.log(rectCopy);
}
const x = rectCopy.x + rectCopy.width;
if (x <= rect.width) {
return true;

View File

@ -143,13 +143,13 @@ export default {
};
this.$jlmap.setUpdateScreen(size);
}
this.$refs.jlmapVisual.handleStateLoaded();
},
back() {
this.$store.dispatch('training/over').then(() => {
EventBus.$emit('runPlanStop');
EventBus.$emit('chatSubscribeStop');
history.go(-1);
Notification.closeAll();
});
},
async subscribe() {

View File

@ -0,0 +1,153 @@
<template>
<div class="editassets">
<div class="asset-list">
<!-- <el-tabs v-model="activeName"> -->
<div class="devicelisttop">
<p style="font-size:20px;color:#FFFFFF;">设备部件</p>
</div>
<div class="devicelistbottom">
<div class="displaylist " v-for="(part,index) in devicelist" @click="deviceselect(index,part)" v-show="true" >
<div >
<p style="border:1px solid #FFFFFF;">{{part.text}}</p>
</div>
</div>
</div>
<!-- </el-tabs> -->
</div>
</div>
</template>
<script>
export default {
name: 'Jl3ddeviceList',
components: {
},
props: ['devicelist'],
data() {
return {
activeName: 'train',
filterText: '',
defaultProps: {
children: 'children',
label: 'label'
},
devicetype:true,
}
},
beforeDestroy() {
},
watch: {
filterText(val) {
this.$refs.tree2.filter(val);
},
},
methods: {
deviceselect(index,train){
this.$emit('sdevice',train);
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
init: function() {
},
back() {
},
},
mounted() {
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.editassets {
position: absolute;
float:right;
right:2%;
top:10%;
width: 20%;
height: 80%;
// background-color: #FFFFFF;
// border-radius:5px;
background-image:url("/static/texture/devicelistpane.png");
background-repeat: no-repeat;
overflow: hidden;
background-size:90% 100%;
text-align: center;
}
.asset-list{
// position:absolute;
width: 85%;
height: 100%;
}
.el-tabs{
height:100%;
}
.el-scrollbar__wrap.default-scrollbar__wrap {
overflow-x: hidden;
overflow-y: auto;
}
.devicelisttop{
height:10%;
width:100%;
top:0;
}
.devicelistbottom{
height:85%;
width:100%;
top:10%;
overflow-y: auto;
}
.displaylist {
float:left;
position: relative;
width:90px;
// height:20px;
font-size:19px;
color:#FFFFFF;
margin:0px 5px 0px 5px;
}
.modelpic{
left:0;
position: absolute;
width:100%;
height:100%;
}
.modeltop{
bottom:0;
z-index:0;
}
.modeldown{
top:0;
z-index:0;
}
</style>

View File

@ -0,0 +1,96 @@
<template>
<div class="showmsg" v-show="msgshow">
<div class="msgtop">
{{devicename}}
</div>
<div class="msgdown">
{{devicemsg}}
</div>
</div>
</template>
<script>
export default {
name: 'Jl3ddeviceMsg',
components: {
},
data() {
return {
msgshow:false,
devicename:"",
devicemsg:"",
}
},
beforeDestroy() {
},
watch: {
},
methods: {
updatemsg(name,text) {
// console.log(name);
// console.log(text);
if(name){
this.msgshow = true;
this.devicename = name;
this.devicemsg = text;
}else{
this.msgshow = false;
}
},
},
mounted() {
window.updatemsg = this.updatemsg;
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.showmsg{
position: absolute;
float:left;
left:2%;
bottom:15%;
width: 20%;
height: 70%;
z-index: 10;
background-image:url("/static/texture/devicemsgpane.png");
background-repeat:no-repeat;
background-size: 90% 100%;
}
.msgtop{
text-align: center;
width: 80%;
height:10%;
float: left;
position: absolute;
top:10%;
font-size:20px;
color:#FFFFFF;
}
.msgdown{
position: absolute;
top:20%;
left:5%;
width: 80%;
height:75%;
float: left;
font-size:19px;
color:#FFFFFF;
word-wrap:break-word;
letter-spacing:2px;
overflow-y:scroll;
}
</style>

View File

@ -1,6 +1,20 @@
<template>
<div id="jl3d" class="jl3ddraw">
<Jl3ddevice-Msg v-show="isswitch">
</Jl3ddevice-Msg>
<Jl3ddevice-List v-show="isswitch" :devicelist="devicelist" @sdevice="sdevice">
</Jl3ddevice-List>
<canvas id="canvastexture" />
<div class="jl3dcontrolpane" v-show="isswitch">
<el-button-group>
<el-button type="primary" @click="back">初始化</el-button>
<el-button type="primary" @click="alldisper">{{disperreset}}</el-button>
<el-button type="primary" @click="dispersed">{{devicestats}}</el-button>
<el-button type="primary" @click="switchhide">{{switchshow}}</el-button>
</el-button-group>
</div>
<div id="jl3dwindow" class="windowbutton" @click="windowchange"></div>
<div id="jl3dclose" class="backbutton" @click="close3ddeviceview"></div>
</div>
</template>
<script>
@ -8,18 +22,45 @@
import { Jl3ddevice } from '@/jlmap3d/jl3ddevice/jl3ddevice.js';
import { Jl3ddeviceNew } from '@/jlmap3d/jl3ddevice/jl3ddeviceNew.js';
export default {
name: 'devicemodel',
components: {
import Jl3ddeviceMsg from '@/views/jlmap3d/device/component/devicemsg';
import Jl3ddeviceList from '@/views/jlmap3d/device/component/devicelist';
export default {
name: 'devicehelp',
components: {
Jl3ddeviceMsg,
Jl3ddeviceList
},
data() {
return {
jl3d: null,
psdlist:this.$store.state.map.map.psdList,
windowstatus:false,
devicelist:[],
devicestats:"分步拆解",
disperreset:"整体拆解",
switchshow:"隐藏轨道",
switchstatus:true,
isswitch:false,
}
},
watch: {
'jl3d.animastats': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if(newVal == false){
this.devicestats = "分步拆解";
this.disperreset = "整体拆解";
}
if(newVal == true){
this.devicestats = "分步复位";
this.disperreset = "整体复位";
}
}
}
},
'$store.state.menuOperation.selectedCount': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
@ -63,11 +104,13 @@
}
},
mounted() {
window.updatemenulist = this.updatemenulist;
let code = this.$route.query.code;
let group = this.$route.query.group;
let header = this.$route.query.token;
console.log(this.$store.state.menuOperation);
console.log(this.$store.state.map.map.linkList);
// console.log(this.$store.state.menuOperation);
// console.log(this.$store.state.map.map.linkList);
if(this.$store.state.map.map.linkList){
this.initolddata(group,header);
}else{
@ -89,7 +132,62 @@
initnewdata: function (group,header){
let dom = document.getElementById('jl3d');
this.jl3d = new Jl3ddeviceNew(dom,group,header);
}
},
close3ddeviceview: function(){
this.$emit('closedevice3dview');
},
windowchange: function(){
let changeelement = document.getElementById('jl3d');
if(this.windowstatus){
changeelement.style.width = '50%';
changeelement.style.height = '50%';
changeelement.style.top = '25%';
this.windowstatus = false;
this.jl3d.updatewindowstatus('0');
}else{
changeelement.style.width = '100%';
changeelement.style.height = '100%';
changeelement.style.top = '0';
this.windowstatus = true;
this.jl3d.updatewindowstatus('1');
}
if(this.jl3d.domresize){
this.jl3d.domresize();
}
},
updatemenulist(devicelist) {
if(devicelist){
this.devicelist = devicelist;
this.isswitch = true;
}else{
this.devicelist = [];
this.isswitch = false;
}
},
sdevice(changedata) {
this.jl3d.updateselect(changedata);
},
dispersed(){
this.jl3d.disperdevice1();
},
alldisper(){
this.jl3d.disperdevice2();
},
back(){
this.jl3d.resetmodel();
},
switchhide(){
if(this.switchstatus){
this.switchstatus = false;
this.switchshow = "显示轨道";
this.jl3d.hideswitch(this.switchstatus);
}else{
this.switchstatus = true;
this.switchshow = "隐藏轨道";
this.jl3d.hideswitch(this.switchstatus);
}
},
}
}
</script>
@ -102,10 +200,10 @@
.jl3ddraw {
position: absolute;
float: right;
top:20%;
top:25%;
/* left: 0; */
width: 40%;
height: 60%;
width: 50%;
height: 50%;
z-index: 1500;
}
@ -115,4 +213,38 @@
left: 0;
z-index: -12;
}
.windowbutton{
width:25px;
height:25px;
position: absolute;
right:60px;
top:5px;
background-image:url("/static/texture/fk.png");
background-repeat:no-repeat;
background-size:100%;
}
.backbutton{
width:25px;
height:25px;
position: absolute;
right:15px;
top:5px;
background-image:url("/static/texture/xx.png");
background-repeat:no-repeat;
background-size:100%;
}
#canvastexture {
position: absolute;
float: left;
left: 0;
z-index: -12;
}
.jl3dcontrolpane{
position: absolute;
top:0;
left:0;
}
</style>

View File

@ -528,12 +528,6 @@
word-wrap:break-word;
letter-spacing:2px;
}
#canvastexture {
position: absolute;
float: left;
left: 0;
z-index: -12;
}
#testjlmap3d {
}

View File

@ -73,7 +73,14 @@
<!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> -->
<left-slider v-if="isShowLeftSlider" :offset-bottom="offsetBottom" @overallTranslation="overallTranslation" />
<Jl3d-Device v-if="deviceShow" ref="Jl3dDevice" :panel-show="deviceShow" />
<Jl3d-Device
v-if="deviceShow"
ref="Jl3dDevice"
:panel-show="deviceShow"
@closedevice3dview="devicemodel"
/>
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
<scheduling v-if="isShowScheduling" ref="scheduling" :group="group" />
@ -580,12 +587,11 @@ export default {
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
devicemodel() {
if (this.deviceShow == false) {
this.deviceShow = true;
} else {
this.deviceShow = false;
}
if (this.deviceShow == false) {
this.deviceShow = true;
} else {
this.deviceShow = false;
}
},
showScheduling() {
this.$refs.scheduling.doShow();

View File

@ -53,6 +53,7 @@
</el-card>
<div style="display: table; margin-left: 90px; margin-top: 12px; margin-bottom: 10px;">
<el-button type="primary" @click="save">保存</el-button>
<!-- <el-button type="primary" @click="preview">预览</el-button> -->
</div>
</el-scrollbar>
</div>
@ -60,7 +61,10 @@
<script>
import { mapGetters } from 'vuex';
export default {
components: {
},
props: {
selected: {
type: Object,
@ -150,6 +154,8 @@ export default {
save() {
console.log(this.tableData); //
},
preview() { //
},
clear() {
this.$refs.hostileForm.resetFields();
this.addModel.section = '';

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
static/texture/fk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
static/texture/xx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB