This commit is contained in:
joylink_cuiweidong 2020-04-30 18:48:27 +08:00
commit b15bae51cf
18 changed files with 1332 additions and 295 deletions

View File

@ -102,6 +102,41 @@ export function Jdqcontrol(){
part.msg = "绝缘轴用冻石瓷料制成,抗冲击强度足够。"; part.msg = "绝缘轴用冻石瓷料制成,抗冲击强度足够。";
selectmodel.children[i].text = "绝缘轴"; selectmodel.children[i].text = "绝缘轴";
} }
if(selectmodel.children[i].name =="cichuihuqi"){
part.text = "磁吹弧器";
part.msg = "磁吹弧器。";
selectmodel.children[i].text = "磁吹弧器";
}
if(selectmodel.children[i].name =="jiaqiangdongjiediandanyuan"){
part.text = "加强接点单元";
part.msg = "加强接点单元。";
selectmodel.children[i].text = "加强接点单元";
}
if(selectmodel.children[i].name =="yunmugehupian"){
part.text = "云母隔弧片";
part.msg = "云母隔弧片。";
selectmodel.children[i].text = "云母隔弧片";
}
if(selectmodel.children[i].name =="yapian1"){
part.text = "压片";
part.msg = "压片。";
selectmodel.children[i].text = "压片";
}
if(selectmodel.children[i].name =="jiedian1"){
part.text = "接点";
part.msg = "接点。";
selectmodel.children[i].text = "接点";
}
if(selectmodel.children[i].name =="ccichuihuqi"){
part.text = "磁吹弧器";
part.msg = "磁吹弧器。";
selectmodel.children[i].text = "磁吹弧器";
}
// if(part.text == null){
// console.log(selectmodel.children[i].name);
// }
scope.devicelist.push(part); scope.devicelist.push(part);
} }

View File

@ -1,185 +1,487 @@
export function Moveanimate(){ export function Moveanimate(main){
let scope = this; let scope = this;
this.helpbox = null;
this.textplane = null;
//动画列表 //动画列表
this.animatelist = []; this.animatelist = [];
this.playlist = null;
this.playorder = 0;
//动画播放器开关 //动画播放器开关
this.enable = true; this.enable = true;
//动画开关状态
this.status = true;
//当前动画模型
this.nowmodelname = undefined;
//定义所有继电器部件动画 //定义所有继电器部件动画
this.initlist = function(modellist){ // this.initlist = function(modellist){
// let points = []; //
// points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); // for(let j=0,lenj=modellist.length;j<lenj;j++){
// points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); //
// scope.initanimate(modellist[j].children[i],modellist[j].name+"select1",points,true); // for(let i=0,leni=modellist[j].children.length;i<leni;i++){
//
// if(modellist[j].children[i].name == "dizuo"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dizuoon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dizuooff",points2,0.5,true,0);
//
//
// }
// if(modellist[j].children[i].name == "Lxing"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"Lxingon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"Lxingoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "jiaoxingxiantie"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jiaoxingxiantieon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jiaoxingxiantieoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "xianquan"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"xianquanon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"xianquanoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "zhongchuipian"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-25,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"zhongchuipianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+25,modellist[j].children[i].position.z));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"zhongchuipianoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "lagan"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"laganon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"laganoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "dongjiedianzhou"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dongjiedianzhouon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dongjiedianzhouoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "neibu"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"neibuon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"neibuoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "jiedian"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jiedianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jiedianoff",points2,0.5,true,0);
//
// }
// if(modellist[j].children[i].name == "yapian"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"yapianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"yapianoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "fanghuozhao"){
// let points1 = [];
//
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"fanghuozhaoon",points1,0.5,true,0);
//
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"fanghuozhaooff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "dianyuanpian"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dianyuanpianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dianyuanpianoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "xinpian"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"xinpianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"xinpianoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name =="jueyuanzhou"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jueyuanzhouon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jueyuanzhouoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name =="cigang"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"cigangon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"cigangoff",points2,0.5,true,0);
// }
// }
//
// }
// //
//
//
//
// }
this.initlistnew = function(modellist){
for(let j=0,lenj=modellist.length;j<lenj;j++){ for(let j=0,lenj=modellist.length;j<lenj;j++){
scope.animatelist[modellist[j].code+"chaijie"] = [];
scope.animatelist[modellist[j].code+"fuwei"] = [];
for(let i=0,leni=modellist[j].children.length;i<leni;i++){ for(let i=0,leni=modellist[j].children.length;i<leni;i++){
if(modellist[j].children[i].name == "dizuo"){ if(modellist[j].children[i].name == "dizuo"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dizuoon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"dizuoon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dizuooff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"dizuooff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "Lxing"){ if(modellist[j].children[i].name == "Lxing"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"Lxingon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"Lxingon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"Lxingoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"Lxingoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "jiaoxingxiantie"){ if(modellist[j].children[i].name == "jiaoxingxiantie"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiaoxingxiantieon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"jiaoxingxiantieon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiaoxingxiantieoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"jiaoxingxiantieoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "xianquan"){ if(modellist[j].children[i].name == "xianquan"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"xianquanon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"xianquanon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"xianquanoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"xianquanoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "zhongchuipian"){ if(modellist[j].children[i].name == "zhongchuipian"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-25,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-25,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"zhongchuipianon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"zhongchuipianon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+25,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+25,modellist[j].children[i].position.z));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"zhongchuipianoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"zhongchuipianoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "lagan"){ if(modellist[j].children[i].name == "lagan"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50));
scope.initanimate(modellist[j].children[i],modellist[j].name+"laganon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"laganon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"laganoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"laganoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "dongjiedianzhou"){ if(modellist[j].children[i].name == "dongjiedianzhou"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dongjiedianzhouon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"dongjiedianzhouon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dongjiedianzhouoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"dongjiedianzhouoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "neibu"){ if(modellist[j].children[i].name == "neibu"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
scope.initanimate(modellist[j].children[i],modellist[j].name+"neibuon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"neibuon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"neibuoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"neibuoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "jiedian"){ if(modellist[j].children[i].name == "jiedian"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiedianon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"jiedianon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiedianoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"jiedianoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "yapian"){ if(modellist[j].children[i].name == "yapian"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25));
scope.initanimate(modellist[j].children[i],modellist[j].name+"yapianon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"yapianon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"yapianoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"yapianoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "fanghuozhao"){ if(modellist[j].children[i].name == "fanghuozhao"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200));
scope.initanimate(modellist[j].children[i],modellist[j].name+"fanghuozhaoon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"fanghuozhaoon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"fanghuozhaooff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"fanghuozhaooff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "dianyuanpian"){ if(modellist[j].children[i].name == "dianyuanpian"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dianyuanpianon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"dianyuanpianon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dianyuanpianoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"dianyuanpianoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "xinpian"){ if(modellist[j].children[i].name == "xinpian"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"xinpianon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"xinpianon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"xinpianoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"xinpianoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name =="jueyuanzhou"){ if(modellist[j].children[i].name =="jueyuanzhou"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jueyuanzhouon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"jueyuanzhouon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jueyuanzhouoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"jueyuanzhouoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name =="cigang"){ if(modellist[j].children[i].name =="cigang"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100));
scope.initanimate(modellist[j].children[i],modellist[j].name+"cigangon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"cigangon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"cigangoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"cigangoff",points2,0.5,true,0);
} }
} }
} }
// let points = [];
// points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"select1",points,true);
let modelorderlist = [];
modelorderlist[modellist[0].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
modelorderlist[modellist[1].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
modelorderlist[modellist[2].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
modelorderlist[modellist[3].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
modelorderlist[modellist[4].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
modelorderlist[modellist[5].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
for(let j=0,lenj=modellist.length;j<lenj;j++){
scope.animatelist[modellist[j].code+"on"] = [];
scope.animatelist[modellist[j].code+"off"] = [];
for(let i=0,leni=modelorderlist[modellist[j].code].length;i<leni;i++){
let orderdata = modelorderlist[modellist[j].code];
let modelon = modellist[j].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[modellist[j].code+"on"],modelon,modellist[j].code+modelon.name+"on",pointson,0.01,true,i);
scope.initanimate(scope.animatelist[modellist[j].code+"off"],modelon,modellist[j].code+modelon.name+"off",pointsoff,0.01,true,leni-i-1);
// }else if((i+1)<leni){
// scope.initanimate(modelon,modellist[j].code+modelon.name+"on",pointson,0.01,true,modellist[j].code+orderdata[i+1].name+"on");
// scope.initanimate(modelon,modellist[j].code+modelon.name+"off",pointsoff,0.01,true,modellist[j].code+orderdata[i-1].name+"off");
// }else{
// scope.initanimate(modelon,modellist[j].code+modelon.name+"on",pointson,0.01,true);
// scope.initanimate(modelon,modellist[j].code+modelon.name+"off",pointsoff,0.01,true,modellist[j].code+orderdata[i-1].name+"off");
// }
// if(modellist[j].children[i].name == "xinpian"){
// }
// if(modellist[j].children[i].name =="cigang"){
// }
}
}
} }
//动画对象定义 //动画对象定义
this.initanimate = function(modelobject,name,points,type){ this.initanimate = function(list,modelobject,name,points,speed,type,nextname){
let curve = new THREE.CatmullRomCurve3(points); let curve = new THREE.CatmullRomCurve3(points);
@ -195,51 +497,122 @@ export function Moveanimate(){
connectmodel:modelobject, connectmodel:modelobject,
enable:false, enable:false,
status:"start", status:"start",
speed:0.05, speed:speed,
next:null
}; };
scope.animatelist[name] = animate; // 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(){ this.animateupdate = function(){
// console.log(scope.animatelist);
if(scope.enable){ if(scope.enable){
//遍历动画列表将启动的动画位置更新 if(scope.playlist){
for(let k in scope.animatelist){
if(scope.animatelist[k].enable){
// 动画播放结束
if(scope.animatelist[k].progress>=1){
let point = scope.animatelist[k].curve.getPointAt(1);
//更新模型坐标
scope.animatelist[k].connectmodel.position.x = point.x;
scope.animatelist[k].connectmodel.position.y = point.y;
scope.animatelist[k].connectmodel.position.z = point.z;
scope.animatelist[k].enable = false;
scope.animatelist[k].status = "end";
scope.animatelist[k].progress = 0;
}else{
//根据动画进度获取动画轨迹上点
let point = scope.animatelist[k].curve.getPointAt(scope.animatelist[k].progress); for(let i=0;i<scope.playlist[scope.playorder].length;i++){
if(scope.playlist[scope.playorder][i].status == "start"){
//更新模型坐标 }
scope.animatelist[k].connectmodel.position.x = point.x; if(scope.playlist[scope.playorder][i].progress>=1){
scope.animatelist[k].connectmodel.position.y = point.y; let point = scope.playlist[scope.playorder][i].curve.getPointAt(1);
scope.animatelist[k].connectmodel.position.z = point.z; //更新模型坐标
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(scope.animatelist[k].directchange){ console.log(scope.playorder);
let tangent = scope.animatelist[k].curve.getPointAt(scope.animatelist[k].progress+0.001); if(i >= scope.playlist[scope.playorder].length-1){
// scope.animatelist[k] if(scope.playorder >= scope.playlist.length-1 ){
tangent = null; scope.playlist = null;
scope.status = true;
scope.enable = false;
main.animationmsgshowoff();
scope.nowmodelname = undefined;
scope.playorder = null;
break;
}else{
scope.playorder += 1;
} }
//增加动画进度,释放点变量
scope.animatelist[k].progress += scope.animatelist[k].speed;
point = null;
} }
}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

@ -7,6 +7,8 @@ import { ModelManager } from '@/jlmap3d/jl3ddevicetrain/loader.js';
import { Moveanimate } from '@/jlmap3d/jl3ddevicetrain/component/moveanimate.js'; import { Moveanimate } from '@/jlmap3d/jl3ddevicetrain/component/moveanimate.js';
import { Jdqcontrol } from '@/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js'; import { Jdqcontrol } from '@/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js';
import { DragControls } from '@/jlmap3d/main/control/DragControls.js';
import StompClient from '@/jlmap3d/jl3ddevicetrain/component/StompClient.js'; import StompClient from '@/jlmap3d/jl3ddevicetrain/component/StompClient.js';
// import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js'; // import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
@ -31,27 +33,31 @@ export function Jl3ddevice(dom,serviceid) {
this.animastats = false; this.animastats = false;
//当前选中模型 //当前选中模型
this.selectmodel = null; this.selectmodel = null;
//当前动画播放模型
this.animationmodel = null;
//初始化webgl渲染 //初始化webgl渲染
let renderer = new THREE.WebGLRenderer({ antialias: true,alpha: true }); let renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio( window.devicePixelRatio ); renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize(dom.offsetWidth, dom.offsetHeight); renderer.setSize(dom.offsetWidth, dom.offsetHeight);
// renderer.shadowMap.enabled = true; // renderer.shadowMap.enabled = true;
// renderer.shadowMap.type = THREE.PCFSoftShadowMap; // renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.setClearColor( 0x000000, 0 ); renderer.setClearColor( 0x000000, 0 );
this.dom.appendChild(renderer.domElement); this.dom.appendChild(renderer.domElement);
//定义相机 //定义相机
let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 5000); let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 4000);
camera.position.set(-1000, 1500, 0); camera.position.set(-1000, 1500, 0);
camera.aspect = dom.offsetWidth / dom.offsetHeight; camera.aspect = dom.offsetWidth / dom.offsetHeight;
camera.updateProjectionMatrix(); camera.updateProjectionMatrix();
//视角轨迹控制器 //视角轨迹控制器
this.controls = new THREE.OrbitControls(camera, dom); this.controls = new THREE.OrbitControls(camera, dom);
this.controls.enabled = true;
this.controls.target = new THREE.Vector3(500,1000,0); this.controls.target = new THREE.Vector3(500,1000,0);
this.controls.screenSpacePanning = true; this.controls.screenSpacePanning = true;
this.controls.update(); this.controls.update();
this.controls.maxDistance = 3000;
//定义场景(渲染容器) //定义场景(渲染容器)
let scene = new THREE.Scene(); let scene = new THREE.Scene();
@ -72,8 +78,9 @@ export function Jl3ddevice(dom,serviceid) {
// grid.material.transparent = true; // grid.material.transparent = true;
// grid.position.x = 10000; // grid.position.x = 10000;
// scene.add( grid ); // scene.add( grid );
let objects = [];
let dragcontrol = new THREE.DragControls( objects, camera, scope.dom );
dragcontrol.enabled = false;
//菜单选中设备更新设备较少 //菜单选中设备更新设备较少
this.updateselect = function(updata){ this.updateselect = function(updata){
@ -91,14 +98,12 @@ export function Jl3ddevice(dom,serviceid) {
}; };
settext(updata.mesh,point) settext(updata.mesh,point)
getdevicemsg(updata.mesh.name); getdevicemsg(updata.mesh.name);
// moveanima.animatelist[scope.selectmodel.name+"select1"].enable = true;
// console.log(intersects[0].object);
scene.add( helpbox ); scene.add( helpbox );
} }
//返回设备选择 //返回设备选择
this.backselect = function(){ this.backselect = function(){
move2(); move3();
updatemenulist(scope.jdqcontrol.devicelist); updatemenulist(scope.jdqcontrol.devicelist);
scope.modelmanager.controllist[0].position.set(19,1270,-275); scope.modelmanager.controllist[0].position.set(19,1270,-275);
@ -141,23 +146,47 @@ export function Jl3ddevice(dom,serviceid) {
}; };
//设备分解、归位动画按钮 //设备分解、归位动画按钮
this.disperdevice = function(){ this.disperdevice1 = function(){
if(scope.status == '1'){ if(scope.status == '1'){
if(scope.animastats == false){ if(moveanima.status == true){
scope.animastats = true; if(scope.animastats == false){
move1(); scope.animastats = true;
} else if(scope.animastats == true){ move1();
scope.animastats = false; } else if(scope.animastats == true){
move2(); scope.animastats = false;
move2();
}
} }
} }
}; };
this.disperdevice2 = function(){
if(scope.status == '1'){
if(moveanima.status == true){
if(scope.animastats == false){
scope.animastats = true;
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"chaijie"],true);
} else if(scope.animastats == true){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true);
}
}
}
};
// let stats = new Stats(); // let stats = new Stats();
// dom.appendChild( stats.dom ); // dom.appendChild( stats.dom );
document.addEventListener( "mousedown", onselect, false ); document.addEventListener( "mousedown", onselect, false );
document.addEventListener( "mouseup", onmouseup, false );
document.addEventListener( "touchstart", ontouch, false ); document.addEventListener( "touchstart", ontouch, false );
window.onresize = function () { window.onresize = function () {
camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight; camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
@ -167,12 +196,12 @@ export function Jl3ddevice(dom,serviceid) {
this.jdqcontrol = new Jdqcontrol(); this.jdqcontrol = new Jdqcontrol();
let moveanima = new Moveanimate(); let moveanima = new Moveanimate(scope);
this.anime = null; this.anime = null;
this.modelmanager = new ModelManager(); this.modelmanager = new ModelManager();
this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) { this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) {
moveanima.initlist( scope.modelmanager.controllist); moveanima.initlistnew( scope.modelmanager.controllist);
connect = new StompClient(); connect = new StompClient();
// debugger // debugger
connect.subscribe("/queue/simulation/"+serviceid,callback); connect.subscribe("/queue/simulation/"+serviceid,callback);
@ -195,6 +224,7 @@ export function Jl3ddevice(dom,serviceid) {
connect.send("/app/topic/simulation/"+serviceid+"/relay/"+msg.id+"/control/"+msg.on,{}); connect.send("/app/topic/simulation/"+serviceid+"/relay/"+msg.id+"/control/"+msg.on,{});
} }
this.upmodelaction = function(type,index){ this.upmodelaction = function(type,index){
if(type == "0"){ if(type == "0"){
@ -210,6 +240,23 @@ export function Jl3ddevice(dom,serviceid) {
scope.modelmanager.actionlist[index].play(); scope.modelmanager.actionlist[index].play();
} }
}; };
this.buttoncontrol = function(action){
if("startstop"){
moveanima.startstop();
}
if("next"){
moveanima.next();
}
if("before"){
moveanima.before();
}
};
this.resetmodel = function(){
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true);
};
//循环渲染函数 //循环渲染函数
let delta; let delta;
let data; let data;
@ -227,9 +274,12 @@ export function Jl3ddevice(dom,serviceid) {
// scope.controls.update(); // scope.controls.update();
// stats.update(); // stats.update();
delta = clock.getDelta(); delta = clock.getDelta();
if(textplane){
textplane.lookAt(camera.position);
}
if (scope.mixers) { if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) { for (let i = 0; i < scope.mixers.length; i++) {
if (scope.mixers[i]) { if (scope.mixers[i]._actions[0].isRunning()) {
scope.mixers[i].update(delta); scope.mixers[i].update(delta);
} }
} }
@ -239,109 +289,17 @@ export function Jl3ddevice(dom,serviceid) {
function move1(){ function move1(){
for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){ moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"on"],true);
if(scope.selectmodel.children[i].name == "dizuo"){
moveanima.animatelist[scope.selectmodel.name+"dizuoon"].enable = true;
}
if(scope.selectmodel.children[i].name == "Lxing"){
moveanima.animatelist[scope.selectmodel.name+"Lxingon"].enable = true;
}
if(scope.selectmodel.children[i].name == "jiaoxingxiantie"){
moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieon"].enable = true;
}
if(scope.selectmodel.children[i].name == "xianquan"){
moveanima.animatelist[scope.selectmodel.name+"xianquanon"].enable = true;
}
if(scope.selectmodel.children[i].name == "zhongchuipian"){
moveanima.animatelist[scope.selectmodel.name+"zhongchuipianon"].enable = true;
}
if(scope.selectmodel.children[i].name == "lagan"){
moveanima.animatelist[scope.selectmodel.name+"laganon"].enable = true;
}
if(scope.selectmodel.children[i].name == "dongjiedianzhou"){
moveanima.animatelist[scope.selectmodel.name+"dongjiedianzhouon"].enable = true;
}
if(scope.selectmodel.children[i].name == "neibu"){
moveanima.animatelist[scope.selectmodel.name+"neibuon"].enable = true;
}
if(scope.selectmodel.children[i].name == "jiedian"){
moveanima.animatelist[scope.selectmodel.name+"jiedianon"].enable = true;
}
if(scope.selectmodel.children[i].name == "yapian"){
moveanima.animatelist[scope.selectmodel.name+"yapianon"].enable = true;
}
if(scope.selectmodel.children[i].name == "fanghuozhao"){
moveanima.animatelist[scope.selectmodel.name+"fanghuozhaoon"].enable = true;
}
if(scope.selectmodel.children[i].name == "dianyuanpian"){
moveanima.animatelist[scope.selectmodel.name+"dianyuanpianon"].enable = true;
}
if(scope.selectmodel.children[i].name == "xinpian"){
moveanima.animatelist[scope.selectmodel.name+"xinpianon"].enable = true;
}
if(scope.selectmodel.children[i].name =="jueyuanzhou"){
moveanima.animatelist[scope.selectmodel.name+"jueyuanzhouon"].enable = true;
}
if(scope.selectmodel.children[i].name =="cigang"){
moveanima.animatelist[scope.selectmodel.name+"cigangon"].enable = true;
}
}
} }
function move2(){ function move2(){
if(scope.selectmodel){ if(scope.selectmodel){
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"off"],true);
for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){
if(scope.selectmodel.children[i].name == "dizuo"){
moveanima.animatelist[scope.selectmodel.name+"dizuooff"].enable = true;
}
if(scope.selectmodel.children[i].name == "Lxing"){
moveanima.animatelist[scope.selectmodel.name+"Lxingoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "jiaoxingxiantie"){
moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "xianquan"){
moveanima.animatelist[scope.selectmodel.name+"xianquanoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "zhongchuipian"){
moveanima.animatelist[scope.selectmodel.name+"zhongchuipianoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "lagan"){
moveanima.animatelist[scope.selectmodel.name+"laganoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "dongjiedianzhou"){
moveanima.animatelist[scope.selectmodel.name+"dongjiedianzhouoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "neibu"){
moveanima.animatelist[scope.selectmodel.name+"neibuoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "jiedian"){
moveanima.animatelist[scope.selectmodel.name+"jiedianoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "yapian"){
moveanima.animatelist[scope.selectmodel.name+"yapianoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "fanghuozhao"){
moveanima.animatelist[scope.selectmodel.name+"fanghuozhaooff"].enable = true;
}
if(scope.selectmodel.children[i].name == "dianyuanpian"){
moveanima.animatelist[scope.selectmodel.name+"dianyuanpianoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "xinpian"){
moveanima.animatelist[scope.selectmodel.name+"xinpianoff"].enable = true;
}
if(scope.selectmodel.children[i].name =="jueyuanzhou"){
moveanima.animatelist[scope.selectmodel.name+"jueyuanzhouoff"].enable = true;
}
if(scope.selectmodel.children[i].name =="cigang"){
moveanima.animatelist[scope.selectmodel.name+"cigangoff"].enable = true;
}
}
} }
}
function move3(){
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true);
} }
function ontouch(event){ function ontouch(event){
if(scope.status == '0'){ if(scope.status == '0'){
@ -464,16 +422,23 @@ export function Jl3ddevice(dom,serviceid) {
textplane.material.dispose(); textplane.material.dispose();
} }
if(intersects[0]){ if(intersects[0]){
dragcontrol.setObjects(intersects[0].object);
if(intersects[0].object.raycastoff){ if(intersects[0].object.raycastoff){
helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 ); helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 );
settext(intersects[0].object.parent,intersects[0].point); settext(intersects[0].object.parent,intersects[0].point);
getdevicemsg(intersects[0].object.parent.name); getdevicemsg(intersects[0].object.parent.name);
}else{ }else{
helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 ); helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
settext(intersects[0].object,intersects[0].point); settext(intersects[0].object,intersects[0].point);
getdevicemsg(intersects[0].object.name); getdevicemsg(intersects[0].object.name);
} }
scope.controls.enabled = false;
dragcontrol.enabled = true;
scene.add( helpbox ); scene.add( helpbox );
} }
} }
@ -481,6 +446,47 @@ export function Jl3ddevice(dom,serviceid) {
} }
} }
function onmouseup(event){
// event.preventDefault();
scope.controls.enabled = true;
dragcontrol.enabled = false;
//
// dragcontrol.setObjects(null);
// document.removeEventListener("mouseup", onmouseup, false );
}
this.animationmsgshowon = function(nowobject){
scope.animationmodel = nowobject;
if(helpbox){
scope.animationmodel.helpbox = null;
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);
scene.add( helpbox );
getdevicemsg(nowobject.name);
}
this.animationmsgshowoff = function(nowobject){
if(helpbox){
scope.animationmodel.helpbox = null;
scene.remove( helpbox );
helpbox = undefined;
}
if(textplane){
scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
scope.animationmodel = null;
}
function getdevicemsg(selectname){ function getdevicemsg(selectname){
// console.log(selectname); // console.log(selectname);
@ -493,34 +499,39 @@ export function Jl3ddevice(dom,serviceid) {
} }
} }
function settext(intersects,point){ function settext(intersects,point){
if(intersects.text){ if(scope.status == '1'){
let textgeometry = new THREE.PlaneBufferGeometry( 300, 200, 1 ); if(intersects.text){
let textt = new THREE.CanvasTexture(getTextCanvas(intersects.text)); let textgeometry = new THREE.PlaneBufferGeometry( 300, 200, 1 );
let textmaterial = new THREE.MeshBasicMaterial( { let textt = new THREE.CanvasTexture(getTextCanvas(intersects.text));
side: THREE.DoubleSide, let textmaterial = new THREE.MeshBasicMaterial( {
map:textt ,transparent: true, side: THREE.DoubleSide,
alphaTest:0.1 map:textt ,transparent: true,
} ); alphaTest:0.1
if(textplane){ } );
scene.remove(textplane); if(textplane){
textplane.geometry.dispose(); scene.remove(textplane);
textplane.material.dispose(); 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+100;
textplane.position.z = point.z;
// console.log(textplane.position);
// textplane.tcode = data[i].code;
textplane.rotation.y = -Math.PI/2;
textplane.lookAt(camera.position);
// scope.textlist.push(textplane);
// newmesh.children[0].add(textplane);
scene.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
} }
textplane= new THREE.Mesh( textgeometry, textmaterial );
// textplane.name = data[i].code;
textplane.position.x = point.x;
textplane.position.y = point.y+100;
textplane.position.z = point.z;
// console.log(textplane.position);
// textplane.tcode = data[i].code;
textplane.rotation.y = -Math.PI/2;
textplane.lookAt(camera.position);
// scope.textlist.push(textplane);
// newmesh.children[0].add(textplane);
scene.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
} }
@ -530,30 +541,32 @@ export function Jl3ddevice(dom,serviceid) {
//canvas文字贴图方法 //canvas文字贴图方法
//PS:待提炼 增强功能 //PS:待提炼 增强功能
function getTextCanvas(text){ function getTextCanvas(text){
var canvas = document.getElementById('canvastexture'); if(scope.status == '1'){
var canvas = document.getElementById('canvastexture');
canvas.width = 256; canvas.width = 256;
canvas.height = 128; canvas.height = 128;
var ctx = canvas.getContext('2d'); 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;
}
//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

@ -0,0 +1,570 @@
import { Staticmodel } from '@/jlmap3d/jl3ddevicetrain/config.js';
//loader
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { ModelManager } from '@/jlmap3d/jl3ddevicetrain/loader.js';
import { Moveanimate } from '@/jlmap3d/jl3ddevicetrain/component/moveanimate.js';
import { Jdqcontrol } from '@/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js';
import StompClient from '@/jlmap3d/jl3ddevicetrain/component/StompClient.js';
// import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
// import StompClient from '@/utils/sock';
import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
var clock = new THREE.Clock();
export function Jl3ddevice(dom,serviceid) {
let scope = this;
//helpbox选中包围框
//textplane三维介绍标牌
let helpbox,textplane;
let connect = null;
this.dom = dom;
this.nowcode = null;
this.animateswitch = false;
this.mixers = [];
this.showmodel = null;
//场景状态
this.status = 0;
//动画状态
this.animastats = false;
//当前选中模型
this.selectmodel = null;
//初始化webgl渲染
let renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
// renderer.shadowMap.enabled = true;
// renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.setClearColor( 0x000000, 0 );
this.dom.appendChild(renderer.domElement);
//定义相机
let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 5000);
camera.position.set(-1000, 1500, 0);
camera.aspect = dom.offsetWidth / dom.offsetHeight;
camera.updateProjectionMatrix();
//视角轨迹控制器
this.controls = new THREE.OrbitControls(camera, dom);
this.controls.target = new THREE.Vector3(500,1000,0);
this.controls.screenSpacePanning = true;
this.controls.update();
//定义场景(渲染容器)
let scene = new THREE.Scene();
var bgTexture = new THREE.TextureLoader().load("../../static/background/other.jpg");
scene.background = bgTexture;
//定义全局光
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
scene.add(ambientLight);
var light = new THREE.HemisphereLight( 0xffffff, 0x444444 );
light.position.set( 0, 200, 0 );
scene.add( light );
//网格地面
// var grid = new THREE.GridHelper( 1000, 20, 0x000000, 0x000000 );
// grid.material.opacity = 0.2;
// grid.material.transparent = true;
// grid.position.x = 10000;
// scene.add( grid );
//菜单选中设备更新设备较少
this.updateselect = function(updata){
// console.log(updata);
if(helpbox){
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);
// moveanima.animatelist[scope.selectmodel.name+"select1"].enable = true;
// console.log(intersects[0].object);
scene.add( helpbox );
}
//返回设备选择
this.backselect = function(){
move2();
updatemenulist(scope.jdqcontrol.devicelist);
scope.modelmanager.controllist[0].position.set(19,1270,-275);
scope.modelmanager.controllist[0].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[0].rotation.z = -Math.PI/2;
scope.modelmanager.controllist[1].position.set(19,1270,-165);
scope.modelmanager.controllist[1].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[1].rotation.z = -Math.PI/2;
scope.modelmanager.controllist[2].position.set(19,1270,-55);
scope.modelmanager.controllist[2].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[2].rotation.z = -Math.PI/2;
scope.modelmanager.controllist[3].position.set(19,1270,65);
scope.modelmanager.controllist[3].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[3].rotation.z = -Math.PI/2;
scope.modelmanager.controllist[4].position.set(19,1270,170);
scope.modelmanager.controllist[4].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[4].rotation.z = -Math.PI/2;
scope.modelmanager.controllist[5].position.set(19,1270,280);
scope.modelmanager.controllist[5].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[5].rotation.z = -Math.PI/2;
camera.position.set(-1000, 1500, 0);
scope.controls.target = new THREE.Vector3(500,1000,0);
scope.controls.update();
scope.status = '0';
if(textplane){
scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
scope.selectmodel = null;
scope.jdqcontrol.devicelist = [];
scope.animastats = false;
updatemsg();
};
//设备分解、归位动画按钮
this.disperdevice = function(){
if(scope.status == '1'){
if(moveanima.status == true){
if(scope.animastats == false){
scope.animastats = true;
move1();
} else if(scope.animastats == true){
scope.animastats = false;
move2();
}
}
}
};
// let stats = new Stats();
// dom.appendChild( stats.dom );
document.addEventListener( "mousedown", onselect, false );
document.addEventListener( "touchstart", ontouch, false );
window.onresize = function () {
camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
camera.updateProjectionMatrix();
renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
}
this.jdqcontrol = new Jdqcontrol();
let moveanima = new Moveanimate(scope);
this.anime = null;
this.modelmanager = new ModelManager();
this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) {
moveanima.initlistnew( scope.modelmanager.controllist);
connect = new StompClient();
// debugger
connect.subscribe("/queue/simulation/"+serviceid,callback);
animate();
});
this.sendmsg = function (type,index){
// console.log(index);
let msg = {
// deskId:serviceid,
id:index+1,
on:null
};
if(type == "0"){
msg.on = true;
}
if(type == "1"){
msg.on = false;
}
//"/app/topic/relay/"+msg.id+"/control/"+msg.on
connect.send("/app/topic/simulation/"+serviceid+"/relay/"+msg.id+"/control/"+msg.on,{});
}
this.upmodelaction = function(type,index){
if(type == "0"){
scope.modelmanager.actionlist[index].reset();
scope.modelmanager.actionlist[index].time = 0;
scope.modelmanager.actionlist[index].timeScale = 1;
scope.modelmanager.actionlist[index].play();
}
if(type == "1"){
scope.modelmanager.actionlist[index].reset();
scope.modelmanager.actionlist[index].time = scope.modelmanager.actionlist[index]._clip.duration;
scope.modelmanager.actionlist[index].timeScale = -1;
scope.modelmanager.actionlist[index].play();
}
};
//循环渲染函数
let delta;
let data;
function callback(Response){
// console.log(Response);
data = JSON.parse(Response.body);
// console.log(data);
upjdqstats(data);
}
function animate() {
scope.anime = requestAnimationFrame(animate);
renderer.render(scene, camera);
moveanima.animateupdate();
// scope.controls.update();
// stats.update();
delta = clock.getDelta();
if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) {
if (scope.mixers[i]._actions[0].isRunning()) {
scope.mixers[i].update(delta);
}
}
}
}
function move1(){
console.log(scope.selectmodel);
moveanima.animatelist[scope.selectmodel.code+"fanghuozhao"+"on"].enable = true;
// for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){
//
// if(scope.selectmodel.children[i].name == "dizuo"){
// moveanima.animatelist[scope.selectmodel.name+"dizuoon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "Lxing"){
// moveanima.animatelist[scope.selectmodel.name+"Lxingon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "jiaoxingxiantie"){
// moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "xianquan"){
// moveanima.animatelist[scope.selectmodel.name+"xianquanon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "zhongchuipian"){
// moveanima.animatelist[scope.selectmodel.name+"zhongchuipianon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "lagan"){
// moveanima.animatelist[scope.selectmodel.name+"laganon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "dongjiedianzhou"){
// moveanima.animatelist[scope.selectmodel.name+"dongjiedianzhouon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "neibu"){
// moveanima.animatelist[scope.selectmodel.name+"neibuon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "jiedian"){
// moveanima.animatelist[scope.selectmodel.name+"jiedianon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "yapian"){
// moveanima.animatelist[scope.selectmodel.name+"yapianon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "fanghuozhao"){
// moveanima.animatelist[scope.selectmodel.name+"fanghuozhaoon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "dianyuanpian"){
// moveanima.animatelist[scope.selectmodel.name+"dianyuanpianon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "xinpian"){
// moveanima.animatelist[scope.selectmodel.name+"xinpianon"].enable = true;
// }
// if(scope.selectmodel.children[i].name =="jueyuanzhou"){
// moveanima.animatelist[scope.selectmodel.name+"jueyuanzhouon"].enable = true;
// }
// if(scope.selectmodel.children[i].name =="cigang"){
// moveanima.animatelist[scope.selectmodel.name+"cigangon"].enable = true;
// }
// }
}
function move2(){
if(scope.selectmodel){
moveanima.animatelist[scope.selectmodel.code+"yapian"+"off"].enable = true;
// for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){
//
// if(scope.selectmodel.children[i].name == "dizuo"){
// moveanima.animatelist[scope.selectmodel.name+"dizuooff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "Lxing"){
// moveanima.animatelist[scope.selectmodel.name+"Lxingoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "jiaoxingxiantie"){
// moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "xianquan"){
// moveanima.animatelist[scope.selectmodel.name+"xianquanoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "zhongchuipian"){
// moveanima.animatelist[scope.selectmodel.name+"zhongchuipianoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "lagan"){
// moveanima.animatelist[scope.selectmodel.name+"laganoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "dongjiedianzhou"){
// moveanima.animatelist[scope.selectmodel.name+"dongjiedianzhouoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "neibu"){
// moveanima.animatelist[scope.selectmodel.name+"neibuoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "jiedian"){
// moveanima.animatelist[scope.selectmodel.name+"jiedianoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "yapian"){
// moveanima.animatelist[scope.selectmodel.name+"yapianoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "fanghuozhao"){
// moveanima.animatelist[scope.selectmodel.name+"fanghuozhaooff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "dianyuanpian"){
// moveanima.animatelist[scope.selectmodel.name+"dianyuanpianoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "xinpian"){
// moveanima.animatelist[scope.selectmodel.name+"xinpianoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name =="jueyuanzhou"){
// moveanima.animatelist[scope.selectmodel.name+"jueyuanzhouoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name =="cigang"){
// moveanima.animatelist[scope.selectmodel.name+"cigangoff"].enable = true;
// }
// }
}
}
function ontouch(event){
if(scope.status == '0'){
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.touches[0].pageX / dom.offsetWidth) * 2 - 1;
mouse.y = -(event.touches[0].pageY / dom.offsetHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
for(let i=0,leni=scope.modelmanager.controllist.length;i<leni;i++){
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist[i].children,true);
if(intersects[0]){
scope.modelmanager.controllist[i].position.set(10000,0,0);
scope.modelmanager.controllist[i].rotation.y = 0;
scope.modelmanager.controllist[i].rotation.z = 0;
camera.position.set(10800, 500, 0);
scope.controls.target = new THREE.Vector3(10000,0,0);
scope.jdqcontrol.jdqdevicelist(scope.modelmanager.controllist[i]);
updatemenulist(scope.jdqcontrol.devicelist);
scope.controls.update();
scope.selectmodel = scope.modelmanager.controllist[i];
scope.status = '1';
}
}
}
if(scope.status == '1'){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.touches[0].pageX / dom.offsetWidth) * 2 - 1;
mouse.y = -(event.touches[0].pageY / dom.offsetHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist,true);
if(helpbox){
scene.remove( helpbox );
helpbox = null;
}
if(textplane){
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);
}
scene.add( helpbox );
}
}
}
function onselect(event){
if(event.button == '0'){
if(scope.status == '0'){
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.clientX / dom.offsetWidth) * 2 - 1;
mouse.y = -(event.clientY / dom.offsetHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
for(let i=0,leni=scope.modelmanager.controllist.length;i<leni;i++){
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist[i].children,true);
if(intersects[0]){
scope.modelmanager.controllist[i].position.set(10000,0,0);
scope.modelmanager.controllist[i].rotation.y = 0;
scope.modelmanager.controllist[i].rotation.z = 0;
camera.position.set(10800, 500, 0);
scope.controls.target = new THREE.Vector3(10000,0,0);
scope.jdqcontrol.jdqdevicelist(scope.modelmanager.controllist[i]);
updatemenulist(scope.jdqcontrol.devicelist);
scope.controls.update();
scope.selectmodel = scope.modelmanager.controllist[i];
scope.status = '1';
i = scope.modelmanager.controllist.length;
}
}
}
if(scope.status == '1'){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.clientX / dom.offsetWidth) * 2 - 1;
mouse.y = -(event.clientY / dom.offsetHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist,true);
if(helpbox){
scene.remove( helpbox );
helpbox = null;
}
if(textplane){
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);
}
scene.add( helpbox );
}
}
}
}
this.animationmsgshow = function(nowobject){
getdevicemsg(nowobject.name);
}
function getdevicemsg(selectname){
// console.log(selectname);
for(let i=0,leni=scope.jdqcontrol.devicelist.length;i<leni;i++){
if(selectname == scope.jdqcontrol.devicelist[i].name){
updatemsg(scope.jdqcontrol.devicelist[i].text,scope.jdqcontrol.devicelist[i].msg);
i=leni;
}
}
}
function settext(intersects,point){
if(intersects.text){
let textgeometry = new THREE.PlaneBufferGeometry( 300, 200, 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){
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+100;
textplane.position.z = point.z;
// console.log(textplane.position);
// textplane.tcode = data[i].code;
textplane.rotation.y = -Math.PI/2;
textplane.lookAt(camera.position);
// scope.textlist.push(textplane);
// newmesh.children[0].add(textplane);
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

@ -6,43 +6,42 @@ export function ModelManager(){
this.controllist = []; this.controllist = [];
this.actionlist = []; this.actionlist = [];
let jdq1 = { let jdq1 = {
code:jdq1, code:"jdq1",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
let jdq2 = { let jdq2 = {
code:jdq2, code:"jdq2",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
let jdq3 = { let jdq3 = {
code:jdq3, code:"jdq3",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
let jdq4 = { let jdq4 = {
code:jdq4, code:"jdq4",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
let jdq5 = { let jdq5 = {
code:jdq5, code:"jdq5",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
let jdq6 = { let jdq6 = {
code:jdq6, code:"jdq6",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
this.jdqg = { this.jdqg = {
code:null, code:null,
locateType:"00", locateType:"00",
@ -164,7 +163,9 @@ function fbxpromise(asset,mixers,model){
} }
} }
object.name = asset.name; object.name = asset.name;
object.code = model.code;
model.mesh = object; model.mesh = object;
if(object.animations.length>0){ if(object.animations.length>0){

View File

@ -6,6 +6,7 @@
THREE.DragControls = function ( _objects, _camera, _domElement ) { THREE.DragControls = function ( _objects, _camera, _domElement ) {
if ( _objects instanceof THREE.Camera ) { if ( _objects instanceof THREE.Camera ) {
console.warn( 'THREE.DragControls: Constructor now expects ( objects, camera, domElement )' ); console.warn( 'THREE.DragControls: Constructor now expects ( objects, camera, domElement )' );
@ -27,7 +28,7 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
// //
var scope = this; var scope = this;
this.nowobject = _objects;
function activate() { function activate() {
_domElement.addEventListener( 'mousemove', onDocumentMouseMove, false ); _domElement.addEventListener( 'mousemove', onDocumentMouseMove, false );
@ -84,32 +85,36 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
} }
_raycaster.setFromCamera( _mouse, _camera ); _raycaster.setFromCamera( _mouse, _camera );
if( scope.nowobject.parent){
var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children );
var intersects = _raycaster.intersectObjects( _objects ); if ( intersects.length > 0 ) {
if ( intersects.length > 0 ) { var object = intersects[ 0 ].object;
if(scope.nowobject.raycastoff){
object = intersects[ 0 ].object.parent;
}
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) );
var object = intersects[ 0 ].object; if ( _hovered !== object ) {
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) ); scope.dispatchEvent( { type: 'hoveron', object: object } );
if ( _hovered !== object ) { _domElement.style.cursor = 'pointer';
_hovered = object;
scope.dispatchEvent( { type: 'hoveron', object: object } ); }
_domElement.style.cursor = 'pointer'; } else {
_hovered = object;
} if ( _hovered !== null ) {
} else { scope.dispatchEvent( { type: 'hoveroff', object: _hovered } );
if ( _hovered !== null ) { _domElement.style.cursor = 'auto';
_hovered = null;
scope.dispatchEvent( { type: 'hoveroff', object: _hovered } ); }
_domElement.style.cursor = 'auto';
_hovered = null;
} }
@ -122,24 +127,29 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
event.preventDefault(); event.preventDefault();
_raycaster.setFromCamera( _mouse, _camera ); _raycaster.setFromCamera( _mouse, _camera );
if( scope.nowobject.parent){
var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children );
var intersects = _raycaster.intersectObjects( _objects ); if ( intersects.length > 0 ) {
_selected = intersects[ 0 ].object;
if(scope.nowobject.raycastoff){
_selected = intersects[ 0 ].object.parent;
}
if ( intersects.length > 0 ) {
_selected = intersects[ 0 ].object; if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) { _inverseMatrix.getInverse( _selected.parent.matrixWorld );
_offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
_inverseMatrix.getInverse( _selected.parent.matrixWorld ); }
_offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
_domElement.style.cursor = 'move';
scope.dispatchEvent( { type: 'dragstart', object: _selected } );
} }
_domElement.style.cursor = 'move';
scope.dispatchEvent( { type: 'dragstart', object: _selected } );
} }
@ -200,26 +210,31 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
_mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1; _mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1;
_raycaster.setFromCamera( _mouse, _camera ); _raycaster.setFromCamera( _mouse, _camera );
if( scope.nowobject.parent){
var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children );
var intersects = _raycaster.intersectObjects( _objects ); if ( intersects.length > 0 ) {
_selected = intersects[ 0 ].object;
if(scope.nowobject.raycastoff){
_selected = intersects[ 0 ].object.parent;
}
if ( intersects.length > 0 ) {
_selected = intersects[ 0 ].object; _plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) ); if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) { _inverseMatrix.getInverse( _selected.parent.matrixWorld );
_offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
_inverseMatrix.getInverse( _selected.parent.matrixWorld ); }
_offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
_domElement.style.cursor = 'move';
scope.dispatchEvent( { type: 'dragstart', object: _selected } );
} }
_domElement.style.cursor = 'move';
scope.dispatchEvent( { type: 'dragstart', object: _selected } );
} }
@ -253,9 +268,9 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
// Backward compatibility // Backward compatibility
this.setObjects = function () { this.setObjects = function (array) {
scope.nowobject = array;
console.error( 'THREE.DragControls: setObjects() has been removed.' ); // console.error( 'THREE.DragControls: setObjects() has been removed.' );
}; };

View File

@ -576,9 +576,6 @@ class Signal extends Group {
if (this.insideTriangle) { if (this.insideTriangle) {
rect.union(this.insideTriangle.getBoundingRect()); rect.union(this.insideTriangle.getBoundingRect());
} }
if (this.ciConfirm) {
rect.union(this.ciConfirm.getBoundingRect());
}
return rect; return rect;
} }

View File

@ -216,7 +216,12 @@ export default {
operation: eachCmd.operation.code, operation: eachCmd.operation.code,
param: eachCmd.param // param: eachCmd.param //
}; };
this.$store.dispatch('training/updateMapState', [{code: eachCmd.device.code, _type: eachCmd.device._type, isCiConfirm: 1}]); const deviceStatus = {code: eachCmd.device.code, _type: eachCmd.device._type, isCiConfirm: 1};
if (eachCmd.device._type === deviceType.Signal) {
deviceStatus.isRequestLock = 0;
deviceStatus.isRequestGuide = 0;
}
this.$store.dispatch('training/updateMapState', [deviceStatus]);
} else { } else {
operate = { operate = {
send: true, send: true,

View File

@ -116,7 +116,12 @@ export default {
operation: eachCmd.operation.code, operation: eachCmd.operation.code,
param: eachCmd.param // param: eachCmd.param //
}; };
this.$store.dispatch('training/updateMapState', [{code: eachCmd.device.code, _type: eachCmd.device._type, isCiConfirm: 1}]); const deviceStatus = {code: eachCmd.device.code, _type: eachCmd.device._type, isCiConfirm: 1};
if (eachCmd.device._type === deviceType.Signal) {
deviceStatus.isRequestLock = 0;
deviceStatus.isRequestGuide = 0;
}
this.$store.dispatch('training/updateMapState', [deviceStatus]);
} else { } else {
operate = { operate = {
send: true, send: true,

View File

@ -13,7 +13,11 @@
</div> </div>
<div class="menudown"> <div class="menudown">
<el-button-group> <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="beforeclick">上一个</el-button>
<el-button type="primary" @click="startstop">暂停</el-button>
<el-button type="primary" @click="nextclick">下一个</el-button> -->
<el-button type="primary" @click="back">复位</el-button>
</el-button-group> </el-button-group>
</div> </div>
@ -91,7 +95,8 @@
msgshow:false, msgshow:false,
devicename:"", devicename:"",
devicemsg:"", devicemsg:"",
devicestats:"设备分解", devicestats:"分布拆解",
disperreset:"整体拆解",
statsa1700:"off", statsa1700:"off",
statsb1700:"off", statsb1700:"off",
statsc1700:"off", statsc1700:"off",
@ -138,10 +143,14 @@
handler: function (newVal, oldVal) { handler: function (newVal, oldVal) {
if (newVal != oldVal) { if (newVal != oldVal) {
if(newVal == false){ if(newVal == false){
this.devicestats = "设备分解"; this.devicestats = "分布拆解";
this.disperreset = "整体拆解";
} }
if(newVal == true){ if(newVal == true){
this.devicestats = "设备归位"; this.devicestats = "分布复位";
this.disperreset = "整体复位";
} }
} }
} }
@ -175,7 +184,7 @@
this.jl3d.backselect(); this.jl3d.backselect();
}, },
dispersed(device) { dispersed(device) {
this.jl3d.disperdevice(); this.jl3d.disperdevice1();
}, },
updatemenulist(devicelist) { updatemenulist(devicelist) {
this.devicelist = devicelist; this.devicelist = devicelist;
@ -335,8 +344,22 @@
this.jl3d.sendmsg(1,5); this.jl3d.sendmsg(1,5);
} }
}, },
back(changedata) { alldisper(){
window.close(); this.jl3d.disperdevice2();
},
// startstop(changedata) {
// this.jl3d.buttoncontrol("startstop");
// },
// nextclick(changedata) {
// this.jl3d.buttoncontrol("next");
// },
// beforeclick(changedata) {
// this.jl3d.buttoncontrol("before");
// },
back() {
this.jl3d.resetmodel();
// move3();
// window.close();
}, },
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.