Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
b15bae51cf
@ -102,6 +102,41 @@ export function Jdqcontrol(){
|
||||
part.msg = "绝缘轴用冻石瓷料制成,抗冲击强度足够。";
|
||||
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);
|
||||
}
|
||||
|
@ -1,185 +1,487 @@
|
||||
|
||||
export function Moveanimate(){
|
||||
export function Moveanimate(main){
|
||||
let scope = this;
|
||||
|
||||
this.helpbox = null;
|
||||
this.textplane = null;
|
||||
//动画列表
|
||||
this.animatelist = [];
|
||||
|
||||
this.playlist = null;
|
||||
this.playorder = 0;
|
||||
//动画播放器开关
|
||||
this.enable = true;
|
||||
|
||||
//动画开关状态
|
||||
this.status = true;
|
||||
//当前动画模型
|
||||
this.nowmodelname = undefined;
|
||||
//定义所有继电器部件动画
|
||||
this.initlist = function(modellist){
|
||||
// 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);
|
||||
// this.initlist = function(modellist){
|
||||
//
|
||||
// for(let j=0,lenj=modellist.length;j<lenj;j++){
|
||||
//
|
||||
// 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++){
|
||||
scope.animatelist[modellist[j].code+"chaijie"] = [];
|
||||
scope.animatelist[modellist[j].code+"fuwei"] = [];
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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"){
|
||||
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,true);
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],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,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);
|
||||
|
||||
@ -195,51 +497,122 @@ export function Moveanimate(){
|
||||
connectmodel:modelobject,
|
||||
enable:false,
|
||||
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(){
|
||||
// console.log(scope.animatelist);
|
||||
|
||||
if(scope.enable){
|
||||
//遍历动画列表将启动的动画位置更新
|
||||
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);
|
||||
if(scope.playlist){
|
||||
|
||||
for(let i=0;i<scope.playlist[scope.playorder].length;i++){
|
||||
if(scope.playlist[scope.playorder][i].status == "start"){
|
||||
|
||||
}
|
||||
if(scope.playlist[scope.playorder][i].progress>=1){
|
||||
let point = scope.playlist[scope.playorder][i].curve.getPointAt(1);
|
||||
//更新模型坐标
|
||||
scope.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;
|
||||
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;
|
||||
|
||||
|
||||
console.log(scope.playorder);
|
||||
if(i >= scope.playlist[scope.playorder].length-1){
|
||||
if(scope.playorder >= scope.playlist.length-1 ){
|
||||
scope.playlist = null;
|
||||
scope.status = true;
|
||||
scope.enable = false;
|
||||
main.animationmsgshowoff();
|
||||
scope.nowmodelname = undefined;
|
||||
scope.playorder = null;
|
||||
break;
|
||||
}else{
|
||||
//根据动画进度获取动画轨迹上点
|
||||
scope.playorder += 1;
|
||||
}
|
||||
}
|
||||
|
||||
let point = scope.animatelist[k].curve.getPointAt(scope.animatelist[k].progress);
|
||||
|
||||
}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.animatelist[k].connectmodel.position.x = point.x;
|
||||
scope.animatelist[k].connectmodel.position.y = point.y;
|
||||
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;
|
||||
|
||||
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.animatelist[k].directchange){
|
||||
let tangent = scope.animatelist[k].curve.getPointAt(scope.animatelist[k].progress+0.001);
|
||||
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.animatelist[k].progress += scope.animatelist[k].speed;
|
||||
scope.playlist[scope.playorder][i].progress += scope.playlist[scope.playorder][i].speed;
|
||||
point = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import { ModelManager } from '@/jlmap3d/jl3ddevicetrain/loader.js';
|
||||
import { Moveanimate } from '@/jlmap3d/jl3ddevicetrain/component/moveanimate.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 { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
|
||||
|
||||
@ -31,27 +33,31 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
this.animastats = false;
|
||||
//当前选中模型
|
||||
this.selectmodel = null;
|
||||
|
||||
//当前动画播放模型
|
||||
this.animationmodel = null;
|
||||
//初始化webgl渲染
|
||||
let renderer = new THREE.WebGLRenderer({ antialias: true,alpha: true });
|
||||
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);
|
||||
let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 4000);
|
||||
camera.position.set(-1000, 1500, 0);
|
||||
camera.aspect = dom.offsetWidth / dom.offsetHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
|
||||
//视角轨迹控制器
|
||||
this.controls = new THREE.OrbitControls(camera, dom);
|
||||
this.controls.enabled = true;
|
||||
this.controls.target = new THREE.Vector3(500,1000,0);
|
||||
this.controls.screenSpacePanning = true;
|
||||
this.controls.update();
|
||||
this.controls.maxDistance = 3000;
|
||||
|
||||
//定义场景(渲染容器)
|
||||
let scene = new THREE.Scene();
|
||||
@ -72,8 +78,9 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
// grid.material.transparent = true;
|
||||
// grid.position.x = 10000;
|
||||
// scene.add( grid );
|
||||
|
||||
|
||||
let objects = [];
|
||||
let dragcontrol = new THREE.DragControls( objects, camera, scope.dom );
|
||||
dragcontrol.enabled = false;
|
||||
|
||||
//菜单选中设备更新设备较少
|
||||
this.updateselect = function(updata){
|
||||
@ -91,14 +98,12 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
};
|
||||
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();
|
||||
move3();
|
||||
updatemenulist(scope.jdqcontrol.devicelist);
|
||||
|
||||
scope.modelmanager.controllist[0].position.set(19,1270,-275);
|
||||
@ -141,8 +146,10 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
};
|
||||
|
||||
//设备分解、归位动画按钮
|
||||
this.disperdevice = function(){
|
||||
this.disperdevice1 = function(){
|
||||
|
||||
if(scope.status == '1'){
|
||||
if(moveanima.status == true){
|
||||
if(scope.animastats == false){
|
||||
scope.animastats = true;
|
||||
move1();
|
||||
@ -150,14 +157,36 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
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();
|
||||
// dom.appendChild( stats.dom );
|
||||
|
||||
document.addEventListener( "mousedown", onselect, false );
|
||||
document.addEventListener( "mouseup", onmouseup, false );
|
||||
document.addEventListener( "touchstart", ontouch, false );
|
||||
window.onresize = function () {
|
||||
camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
|
||||
@ -167,12 +196,12 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
|
||||
this.jdqcontrol = new Jdqcontrol();
|
||||
|
||||
let moveanima = new Moveanimate();
|
||||
let moveanima = new Moveanimate(scope);
|
||||
|
||||
this.anime = null;
|
||||
this.modelmanager = new ModelManager();
|
||||
this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) {
|
||||
moveanima.initlist( scope.modelmanager.controllist);
|
||||
moveanima.initlistnew( scope.modelmanager.controllist);
|
||||
connect = new StompClient();
|
||||
// debugger
|
||||
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,{});
|
||||
}
|
||||
|
||||
this.upmodelaction = function(type,index){
|
||||
|
||||
if(type == "0"){
|
||||
@ -210,6 +240,23 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
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 data;
|
||||
@ -227,9 +274,12 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
// scope.controls.update();
|
||||
// stats.update();
|
||||
delta = clock.getDelta();
|
||||
if(textplane){
|
||||
textplane.lookAt(camera.position);
|
||||
}
|
||||
if (scope.mixers) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -239,109 +289,17 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
|
||||
|
||||
function move1(){
|
||||
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;
|
||||
}
|
||||
}
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"on"],true);
|
||||
}
|
||||
|
||||
function move2(){
|
||||
if(scope.selectmodel){
|
||||
|
||||
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;
|
||||
}
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"off"],true);
|
||||
}
|
||||
}
|
||||
|
||||
function move3(){
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true);
|
||||
}
|
||||
function ontouch(event){
|
||||
if(scope.status == '0'){
|
||||
@ -464,16 +422,23 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
textplane.material.dispose();
|
||||
}
|
||||
if(intersects[0]){
|
||||
dragcontrol.setObjects(intersects[0].object);
|
||||
|
||||
|
||||
if(intersects[0].object.raycastoff){
|
||||
helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 );
|
||||
settext(intersects[0].object.parent,intersects[0].point);
|
||||
getdevicemsg(intersects[0].object.parent.name);
|
||||
|
||||
}else{
|
||||
helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
|
||||
settext(intersects[0].object,intersects[0].point);
|
||||
getdevicemsg(intersects[0].object.name);
|
||||
|
||||
}
|
||||
|
||||
scope.controls.enabled = false;
|
||||
dragcontrol.enabled = true;
|
||||
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){
|
||||
// console.log(selectname);
|
||||
@ -493,6 +499,7 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
}
|
||||
}
|
||||
function settext(intersects,point){
|
||||
if(scope.status == '1'){
|
||||
if(intersects.text){
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 300, 200, 1 );
|
||||
let textt = new THREE.CanvasTexture(getTextCanvas(intersects.text));
|
||||
@ -517,12 +524,16 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
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();
|
||||
@ -530,6 +541,7 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
//canvas文字贴图方法
|
||||
//PS:待提炼 增强功能
|
||||
function getTextCanvas(text){
|
||||
if(scope.status == '1'){
|
||||
var canvas = document.getElementById('canvastexture');
|
||||
|
||||
canvas.width = 256;
|
||||
@ -555,5 +567,6 @@ export function Jl3ddevice(dom,serviceid) {
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
570
src/jlmap3d/jl3ddevicetrain/jl3ddevicetrainold.js
Normal file
570
src/jlmap3d/jl3ddevicetrain/jl3ddevicetrainold.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -6,43 +6,42 @@ export function ModelManager(){
|
||||
this.controllist = [];
|
||||
this.actionlist = [];
|
||||
let jdq1 = {
|
||||
code:jdq1,
|
||||
code:"jdq1",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq2 = {
|
||||
code:jdq2,
|
||||
code:"jdq2",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq3 = {
|
||||
code:jdq3,
|
||||
code:"jdq3",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq4 = {
|
||||
code:jdq4,
|
||||
code:"jdq4",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq5 = {
|
||||
code:jdq5,
|
||||
code:"jdq5",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq6 = {
|
||||
code:jdq6,
|
||||
code:"jdq6",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
|
||||
this.jdqg = {
|
||||
code:null,
|
||||
locateType:"00",
|
||||
@ -164,7 +163,9 @@ function fbxpromise(asset,mixers,model){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
object.name = asset.name;
|
||||
object.code = model.code;
|
||||
model.mesh = object;
|
||||
|
||||
if(object.animations.length>0){
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
THREE.DragControls = function ( _objects, _camera, _domElement ) {
|
||||
|
||||
|
||||
if ( _objects instanceof THREE.Camera ) {
|
||||
|
||||
console.warn( 'THREE.DragControls: Constructor now expects ( objects, camera, domElement )' );
|
||||
@ -27,7 +28,7 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
|
||||
//
|
||||
|
||||
var scope = this;
|
||||
|
||||
this.nowobject = _objects;
|
||||
function activate() {
|
||||
|
||||
_domElement.addEventListener( 'mousemove', onDocumentMouseMove, false );
|
||||
@ -84,13 +85,15 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
|
||||
}
|
||||
|
||||
_raycaster.setFromCamera( _mouse, _camera );
|
||||
|
||||
var intersects = _raycaster.intersectObjects( _objects );
|
||||
if( scope.nowobject.parent){
|
||||
var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children );
|
||||
|
||||
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 ) );
|
||||
|
||||
if ( _hovered !== object ) {
|
||||
@ -117,17 +120,22 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseDown( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
_raycaster.setFromCamera( _mouse, _camera );
|
||||
|
||||
var intersects = _raycaster.intersectObjects( _objects );
|
||||
if( scope.nowobject.parent){
|
||||
var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children );
|
||||
|
||||
if ( intersects.length > 0 ) {
|
||||
|
||||
_selected = intersects[ 0 ].object;
|
||||
if(scope.nowobject.raycastoff){
|
||||
_selected = intersects[ 0 ].object.parent;
|
||||
}
|
||||
|
||||
|
||||
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
|
||||
|
||||
@ -142,6 +150,8 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -200,12 +210,15 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
|
||||
_mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1;
|
||||
|
||||
_raycaster.setFromCamera( _mouse, _camera );
|
||||
|
||||
var intersects = _raycaster.intersectObjects( _objects );
|
||||
if( scope.nowobject.parent){
|
||||
var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children );
|
||||
|
||||
if ( intersects.length > 0 ) {
|
||||
|
||||
_selected = intersects[ 0 ].object;
|
||||
if(scope.nowobject.raycastoff){
|
||||
_selected = intersects[ 0 ].object.parent;
|
||||
}
|
||||
|
||||
|
||||
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
|
||||
|
||||
@ -222,6 +235,8 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -253,9 +268,9 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
|
||||
|
||||
// Backward compatibility
|
||||
|
||||
this.setObjects = function () {
|
||||
|
||||
console.error( 'THREE.DragControls: setObjects() has been removed.' );
|
||||
this.setObjects = function (array) {
|
||||
scope.nowobject = array;
|
||||
// console.error( 'THREE.DragControls: setObjects() has been removed.' );
|
||||
|
||||
};
|
||||
|
||||
|
@ -576,9 +576,6 @@ class Signal extends Group {
|
||||
if (this.insideTriangle) {
|
||||
rect.union(this.insideTriangle.getBoundingRect());
|
||||
}
|
||||
if (this.ciConfirm) {
|
||||
rect.union(this.ciConfirm.getBoundingRect());
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,12 @@ export default {
|
||||
operation: eachCmd.operation.code,
|
||||
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 {
|
||||
operate = {
|
||||
send: true,
|
||||
|
@ -116,7 +116,12 @@ export default {
|
||||
operation: eachCmd.operation.code,
|
||||
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 {
|
||||
operate = {
|
||||
send: true,
|
||||
|
@ -13,7 +13,11 @@
|
||||
</div>
|
||||
<div class="menudown">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@ -91,7 +95,8 @@
|
||||
msgshow:false,
|
||||
devicename:"",
|
||||
devicemsg:"",
|
||||
devicestats:"设备分解",
|
||||
devicestats:"分布拆解",
|
||||
disperreset:"整体拆解",
|
||||
statsa1700:"off",
|
||||
statsb1700:"off",
|
||||
statsc1700:"off",
|
||||
@ -138,10 +143,14 @@
|
||||
handler: function (newVal, oldVal) {
|
||||
if (newVal != oldVal) {
|
||||
if(newVal == false){
|
||||
this.devicestats = "设备分解";
|
||||
this.devicestats = "分布拆解";
|
||||
|
||||
this.disperreset = "整体拆解";
|
||||
}
|
||||
if(newVal == true){
|
||||
this.devicestats = "设备归位";
|
||||
this.devicestats = "分布复位";
|
||||
|
||||
this.disperreset = "整体复位";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -175,7 +184,7 @@
|
||||
this.jl3d.backselect();
|
||||
},
|
||||
dispersed(device) {
|
||||
this.jl3d.disperdevice();
|
||||
this.jl3d.disperdevice1();
|
||||
},
|
||||
updatemenulist(devicelist) {
|
||||
this.devicelist = devicelist;
|
||||
@ -335,8 +344,22 @@
|
||||
this.jl3d.sendmsg(1,5);
|
||||
}
|
||||
},
|
||||
back(changedata) {
|
||||
window.close();
|
||||
alldisper(){
|
||||
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.
Loading…
Reference in New Issue
Block a user