修复三维通号图片资源bug,剔除旧仿真相关三维内容,剔除无用三维资源
@ -1,85 +0,0 @@
|
||||
import Stomp from 'stompjs';
|
||||
import { getBaseUrl } from '@/utils/baseUrl';
|
||||
|
||||
const BASE_API = getBaseUrl();
|
||||
let baseUrl = 'http://192.168.3.6:9600';// 本地旭强
|
||||
if (BASE_API == 'https://joylink.club/jlcloud') {
|
||||
baseUrl = 'https://joylink.club/relay';
|
||||
} else if (BASE_API == 'https://test.joylink.club/jlcloud') {
|
||||
baseUrl = 'https://test.joylink.club/relay';
|
||||
}
|
||||
|
||||
class StompClient {
|
||||
constructor() {
|
||||
const ws = new WebSocket(`${baseUrl}/ws-relay`.replace(/https/, 'wss').replace(/http/, 'ws'));
|
||||
this.client = Stomp.over(ws);
|
||||
this.client.debug = function (message) {
|
||||
console.debug(message);
|
||||
};
|
||||
this.subscribeMap = new Map(); // 已订阅,对象{dest:'', handler:function, sub: Object}
|
||||
this.connected = false;
|
||||
this.onUsed = false;
|
||||
}
|
||||
|
||||
connect() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.onUsed = true;
|
||||
const that = this;
|
||||
const header = {
|
||||
login: 'relay',
|
||||
passcode: 'relay'
|
||||
};
|
||||
this.client.connect(header,
|
||||
()=>{
|
||||
that.connected = true;
|
||||
// 重连时需要重新订阅
|
||||
that.subscribeMap.forEach((subscribe, dest) => {
|
||||
that.subscribe(subscribe.dest, subscribe.handler);
|
||||
});
|
||||
resolve();
|
||||
},
|
||||
(error)=>{
|
||||
console.error(error);
|
||||
this.connected = false;
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.onUsed = false;
|
||||
this.client.disconnect();
|
||||
}
|
||||
|
||||
subscribe(destination, handler) {
|
||||
if (!this.connected) {
|
||||
const that = this;
|
||||
this.connect().then(() => {
|
||||
that.subscribe(destination, handler);
|
||||
});
|
||||
} else {
|
||||
const sub = this.client.subscribe(destination, handler);
|
||||
this.subscribeMap.set(destination, {dest: destination, handler: handler, sub: sub});
|
||||
}
|
||||
}
|
||||
|
||||
unsubscribe(destination) {
|
||||
const subscribe = this.subscribeMap.get(destination);
|
||||
if (subscribe && subscribe.sub) {
|
||||
subscribe.sub.unsubscribe();
|
||||
} else if (subscribe) {
|
||||
this.subscribeMap.delete(destination);
|
||||
}
|
||||
}
|
||||
|
||||
send(destination, body) {
|
||||
if (body) {
|
||||
body = JSON.stringify(body);
|
||||
this.client.send(destination, {}, body);
|
||||
} else {
|
||||
console.error('stomp send body required');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default StompClient;
|
@ -1,43 +0,0 @@
|
||||
import StompClient from '@/utils/sock';
|
||||
|
||||
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
||||
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
|
||||
import { getBaseUrl } from '@/utils/baseUrl'
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
// 定于仿真socket接口
|
||||
export function DeviceSubscribe(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
const scope = this;
|
||||
this.map = null;
|
||||
|
||||
this.teststomp = new StompClient();
|
||||
this.topic = '/user/queue/simulation/jl3d/'+routegroup;
|
||||
let header = {'X-Token': getToken() };
|
||||
|
||||
|
||||
this.updatamap = function() {
|
||||
|
||||
};
|
||||
|
||||
this.socketon = function(topic) {
|
||||
try {
|
||||
// console.log("teststomp");
|
||||
scope.teststomp.subscribe(topic, callback, header);
|
||||
} catch (error) {
|
||||
console.error('websocket订阅失败');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.socketoff = function(topic) {
|
||||
scope.teststomp.unsubscribe(topic);
|
||||
};
|
||||
|
||||
// 仿真socket接口回调函数
|
||||
function callback(Response) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,147 +0,0 @@
|
||||
|
||||
export function Jdqcontrol(){
|
||||
let scope = this;
|
||||
|
||||
this.devicelist = [];
|
||||
|
||||
this.jdqinit = function(){
|
||||
|
||||
}
|
||||
|
||||
this.jdqraycast = function(){
|
||||
|
||||
}
|
||||
|
||||
//配置继电器文字信息
|
||||
this.jdqdevicelist = function(selectmodel){
|
||||
if(scope.devicelist.length>0){
|
||||
scope.devicelist = [];
|
||||
}
|
||||
for(let i=0,leni=selectmodel.children.length;i<leni;i++){
|
||||
let part= {
|
||||
name:selectmodel.children[i].name,
|
||||
text:null,
|
||||
mesh:selectmodel.children[i],
|
||||
index:i,
|
||||
show:true,
|
||||
msg:null,
|
||||
};
|
||||
if(selectmodel.children[i].name == "dizuo"){
|
||||
part.text = "底座";
|
||||
part.msg = "安防继电器部件。";
|
||||
selectmodel.children[i].text = "底座";
|
||||
}
|
||||
if(selectmodel.children[i].name == "cigang"){
|
||||
part.text = "磁钢";
|
||||
part.msg = "使继电器由于线圈中电流极性不同而具有定位和范围两种稳定状态,这两种稳定状态在线圈中电流小时候,仍能继续保持。";
|
||||
selectmodel.children[i].text = "磁钢";
|
||||
}
|
||||
if(selectmodel.children[i].name == "Lxing"){
|
||||
part.text = "L型轭铁";
|
||||
part.msg = "扼铁呈L洲形,由电工纯铁板冲压成型,外表镀多层铬防护。";
|
||||
selectmodel.children[i].text = "L型轭铁";
|
||||
}
|
||||
if(selectmodel.children[i].name == "jiaoxingxiantie"){
|
||||
part.text = "角型衔铁";
|
||||
part.msg = "衔铁为角型,靠蝶形钢丝卡固定在轭铁的刀刃上,动作灵活。衔铁由电工纯铁冲压成型,衔铁上铆有重锤片,以保证衔铁靠重力返回";
|
||||
selectmodel.children[i].text = "角型衔铁";
|
||||
}
|
||||
if(selectmodel.children[i].name == "xianquan"){
|
||||
part.text = "线圈";
|
||||
part.msg = "线圈水平安装在铁芯上,分为前圈和后圈,之所以采用双线圈,主要是为了增强控制电路的适应性和灵活性,可根据电路需要单线圈控"+
|
||||
"制、双线圈串联控制或双线圈并联控制。";
|
||||
selectmodel.children[i].text = "线圈";
|
||||
}
|
||||
if(selectmodel.children[i].name == "zhongchuipian"){
|
||||
part.text = "重锤片";
|
||||
part.msg = "重锤片由薄钢板制成,其片数由接点组的多少决定,使衔铁的重量基本上满足后接点压力的需要。";
|
||||
selectmodel.children[i].text = "重锤片";
|
||||
}
|
||||
if(selectmodel.children[i].name == "lagan"){
|
||||
part.text = "拉杆";
|
||||
part.msg = "拉杆有铁制的和塑料制的,衔铁通过拉杆带动接点组。";
|
||||
selectmodel.children[i].text = "拉杆";
|
||||
}
|
||||
if(selectmodel.children[i].name == "dongjiedianzhou"){
|
||||
part.text = "动接点轴";
|
||||
part.msg = "动接点轴由锡磷青铜线制成。";
|
||||
selectmodel.children[i].text = "动接点轴";
|
||||
}
|
||||
// if(selectmodel.children[i].name == "neibu"){
|
||||
// part.text = "内部";
|
||||
// part.msg = "";
|
||||
// selectmodel.children[i].text = "内部";
|
||||
// }
|
||||
if(selectmodel.children[i].name == "jiedian"){
|
||||
part.text = "接点";
|
||||
part.msg = "具有开端功率娇小的接点能力。";
|
||||
selectmodel.children[i].text = "接点";
|
||||
}
|
||||
if(selectmodel.children[i].name == "yapian"){
|
||||
part.text = "压片";
|
||||
part.msg = "压片由弹簧钢板冲压成弓形,分上、下两篇,其作用是保证接点组的稳固性。";
|
||||
selectmodel.children[i].text = "压片";
|
||||
}
|
||||
if(selectmodel.children[i].name == "fanghuozhao"){
|
||||
part.text = "防火罩";
|
||||
part.msg = "保护继电器内设备运行。";
|
||||
selectmodel.children[i].text = "防火罩";
|
||||
}
|
||||
if(selectmodel.children[i].name == "dianyuanpian"){
|
||||
part.text = "电源片";
|
||||
part.msg = "电源片单元由黄铜制成的电源片压在胶木内。";
|
||||
selectmodel.children[i].text = "电源片";
|
||||
}
|
||||
if(selectmodel.children[i].name == "xinpian"){
|
||||
part.text = "电路板";
|
||||
part.msg = "故在电路中起着自动调节、安全保护、转换电路等作用。";
|
||||
selectmodel.children[i].text = "电路板";
|
||||
}
|
||||
if(selectmodel.children[i].name =="jueyuanzhou"){
|
||||
part.text = "绝缘轴";
|
||||
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);
|
||||
// }
|
||||
if(part.text){
|
||||
scope.devicelist.push(part);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,672 +0,0 @@
|
||||
|
||||
export function Moveanimate(main){
|
||||
let scope = this;
|
||||
|
||||
this.helpbox = null;
|
||||
this.textplane = null;
|
||||
//动画列表
|
||||
this.animatelist = [];
|
||||
this.playlist = null;
|
||||
this.playorder = 0;
|
||||
//动画播放器开关
|
||||
this.enable = true;
|
||||
//动画开关状态
|
||||
this.status = true;
|
||||
//当前动画模型
|
||||
this.nowmodelname = undefined;
|
||||
//定义所有继电器部件动画
|
||||
// this.initlist = function(modellist){
|
||||
//
|
||||
// for(let j=0,lenj=modellist.length;j<lenj;j++){
|
||||
//
|
||||
// for(let i=0,leni=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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"cigangoff",points2,0.5,true,0);
|
||||
}
|
||||
|
||||
if(modellist[j].children[i].name =="ccichuihuqi"){
|
||||
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+100));
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"ccichuihuqion",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+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(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"ccichuihuqioff",points2,0.5,true,0);
|
||||
}
|
||||
|
||||
if(modellist[j].children[i].name =="cichuihuqi"){
|
||||
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+100));
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"cichuihuqion",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+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(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"cichuihuqioff",points2,0.5,true,0);
|
||||
}
|
||||
|
||||
if(modellist[j].children[i].name =="jiaqiangdongjiediandanyuan"){
|
||||
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+100));
|
||||
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"jiaqiangdongjiediandanyuanon",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+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(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"jiaqiangdongjiediandanyuanoff",points2,0.5,true,0);
|
||||
}
|
||||
|
||||
if(modellist[j].children[i].name =="yunmugehupian"){
|
||||
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(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"yunmugehupianon",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(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"yunmugehupianoff",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:"zhongchuipian",pos:[0,-100,-50]},
|
||||
{name:"jiaoxingxiantie",pos:[0,-100,50]},
|
||||
{name:"jiedian",pos:[0,150,100]},
|
||||
{name:"dongjiedianzhou",pos:[0,150,75]},
|
||||
{name:"jueyuanzhou",pos:[0,150,50]},
|
||||
{name:"yunmugehupian",pos:[0,100,100]},
|
||||
|
||||
{name:"jiaqiangdongjiediandanyuan",pos:[0,75,75]},
|
||||
{name:"cichuihuqi",pos:[0,75,25]},
|
||||
{name:"lagan",pos:[0,150,0]},
|
||||
{name:"yapian1",pos:[0,0,100]},
|
||||
|
||||
{name:"yapian",pos:[0,0,10]}
|
||||
];
|
||||
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:"cigang",pos:[0,-200,50]},
|
||||
{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:"ccichuihuqi",pos:[0,-50,75]},
|
||||
{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(list,modelobject,name,points,speed,type,nextname){
|
||||
|
||||
let curve = new THREE.CatmullRomCurve3(points);
|
||||
|
||||
// curve动画轨迹
|
||||
// progress动画进度
|
||||
// enable当前动画开关
|
||||
// speed动画速度
|
||||
let animate = {
|
||||
name:name,
|
||||
curve:curve,
|
||||
progress:0,
|
||||
directchange:false,
|
||||
connectmodel:modelobject,
|
||||
enable:false,
|
||||
status:"start",
|
||||
speed:speed,
|
||||
next:null
|
||||
};
|
||||
// list[nextname] = [];
|
||||
if(list[nextname] == undefined){
|
||||
list[nextname] = [];
|
||||
}
|
||||
list[nextname].push(animate);
|
||||
|
||||
if(nextname){
|
||||
// list[nextname] = animate;
|
||||
// animate.next = nextname;
|
||||
}else{
|
||||
// list.push(animate);
|
||||
}
|
||||
|
||||
}
|
||||
this.setplaylist = function(nowlist,enable){
|
||||
|
||||
scope.playlist = nowlist;
|
||||
scope.enable = enable;
|
||||
scope.playorder = 0;
|
||||
for(let i=0;i<scope.playlist[scope.playorder].length;i++){
|
||||
scope.playlist[scope.playorder][i].status = "start";
|
||||
}
|
||||
}
|
||||
this.updatehelpbox = function(nowhelpbox,nowtextplane){
|
||||
scope.textplane = nowtextplane;
|
||||
scope.helpbox = nowhelpbox;
|
||||
}
|
||||
|
||||
this.startstop = function(){
|
||||
|
||||
}
|
||||
this.next = function(){
|
||||
|
||||
}
|
||||
this.before = function(){
|
||||
|
||||
}
|
||||
//动画播放器
|
||||
this.animateupdate = function(){
|
||||
// console.log(scope.animatelist);
|
||||
|
||||
if(scope.enable){
|
||||
if(scope.playlist){
|
||||
|
||||
for(let i=0;i<scope.playlist[scope.playorder].length;i++){
|
||||
if(scope.playlist[scope.playorder][i].status == "start"){
|
||||
|
||||
}
|
||||
if(scope.playlist[scope.playorder][i].progress>=1){
|
||||
let point = scope.playlist[scope.playorder][i].curve.getPointAt(1);
|
||||
//更新模型坐标
|
||||
scope.playlist[scope.playorder][i].connectmodel.position.x = point.x;
|
||||
scope.playlist[scope.playorder][i].connectmodel.position.y = point.y;
|
||||
scope.playlist[scope.playorder][i].connectmodel.position.z = point.z;
|
||||
scope.playlist[scope.playorder][i].enable = false;
|
||||
scope.playlist[scope.playorder][i].status = "end";
|
||||
scope.playlist[scope.playorder][i].progress = 0;
|
||||
|
||||
|
||||
if(i >= scope.playlist[scope.playorder].length-1){
|
||||
if(scope.playorder >= scope.playlist.length-1 ){
|
||||
scope.playlist = null;
|
||||
scope.status = true;
|
||||
scope.enable = false;
|
||||
main.animationmsgshowoff();
|
||||
scope.nowmodelname = undefined;
|
||||
scope.playorder = null;
|
||||
break;
|
||||
}else{
|
||||
scope.playorder += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
// console.log(scope.animatelist[k].connectmodel);
|
||||
if(scope.nowmodelname != scope.playlist[scope.playorder][i].connectmodel.name){
|
||||
scope.nowmodelname = scope.playlist[scope.playorder][i].connectmodel.name;
|
||||
main.animationmsgshowon(scope.playlist[scope.playorder][i].connectmodel);
|
||||
}
|
||||
//根据动画进度获取动画轨迹上点
|
||||
scope.status = false;
|
||||
let point = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress);
|
||||
|
||||
//更新模型坐标
|
||||
scope.playlist[scope.playorder][i].connectmodel.position.x = point.x;
|
||||
scope.playlist[scope.playorder][i].connectmodel.position.y = point.y;
|
||||
scope.playlist[scope.playorder][i].connectmodel.position.z = point.z;
|
||||
|
||||
if(scope.helpbox){
|
||||
scope.helpbox.update();
|
||||
}
|
||||
if(scope.textplane){
|
||||
|
||||
scope.textplane.position.x = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[12];
|
||||
scope.textplane.position.y = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[13]+100;
|
||||
scope.textplane.position.z = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[14];
|
||||
}
|
||||
//判断模型转向
|
||||
if(scope.playlist[scope.playorder][i].directchange){
|
||||
let tangent = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress+0.001);
|
||||
// scope.animatelist[k]
|
||||
tangent = null;
|
||||
}
|
||||
//增加动画进度,释放点变量
|
||||
scope.playlist[scope.playorder][i].progress += scope.playlist[scope.playorder][i].speed;
|
||||
point = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
import { getBaseUrl } from '@/utils/baseUrl';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
|
||||
const BASE_API = getBaseUrl();
|
||||
let modelurl = JL3D_LOCAL_STATIC+"/MODEL/jdq/";
|
||||
// if(BASE_API == 'https://joylink.club/jlcloud'){
|
||||
// modelurl = "https://joylink.club/oss/jdq/";
|
||||
// }else if(BASE_API == 'https://test.joylink.club/jlcloud'){
|
||||
// modelurl = "https://test.joylink.club/oss/jdq/";
|
||||
// }
|
||||
|
||||
var Staticmodel = {
|
||||
Jdq1: {
|
||||
id: "1",
|
||||
name: "继电器a1700",
|
||||
deviceType: "jdq1700",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: modelurl + "jdq1700.FBX"
|
||||
},
|
||||
Jdq2: {
|
||||
id: "1",
|
||||
name: "继电器b1700",
|
||||
deviceType: "jdq1700",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: modelurl + "jdq1700.FBX"
|
||||
},
|
||||
Jdq3: {
|
||||
id: "1",
|
||||
name: "继电器c1700",
|
||||
deviceType: "jdq1700",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: modelurl + "jdq1700.FBX"
|
||||
},
|
||||
Jdq4: {
|
||||
id: "1",
|
||||
name: "继电器h18",
|
||||
deviceType: "jdq",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: modelurl + "jdqh18.FBX"
|
||||
},
|
||||
Jdq5: {
|
||||
id: "1",
|
||||
name: "继电器H125",
|
||||
deviceType: "jdq",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: modelurl + "jdqH125.FBX"
|
||||
},
|
||||
|
||||
Jdq6: {
|
||||
id: "1",
|
||||
name: "继电器135",
|
||||
deviceType: "jdq",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: modelurl + "jdq135.FBX"
|
||||
},
|
||||
Jdqg:{
|
||||
id: "0",
|
||||
name: "继电器柜",
|
||||
deviceType: "jdqg",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: modelurl + "jdqg.FBX"
|
||||
}
|
||||
}
|
||||
|
||||
export { Staticmodel }
|
@ -1,576 +0,0 @@
|
||||
import { Staticmodel } from '@/jlmap3d/jl3ddevicetrain/config.js';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.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 { DragControls } from '@/jlmap3d/main/control/DragControls.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;
|
||||
//当前动画播放模型
|
||||
this.animationmodel = 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, 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();
|
||||
var bgTexture = new THREE.TextureLoader().load(JL3D_LOCAL_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 );
|
||||
let objects = [];
|
||||
let dragcontrol = new THREE.DragControls( objects, camera, scope.dom );
|
||||
dragcontrol.enabled = false;
|
||||
|
||||
//菜单选中设备更新设备较少
|
||||
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);
|
||||
scene.add( helpbox );
|
||||
}
|
||||
|
||||
//返回设备选择
|
||||
this.backselect = function(){
|
||||
move3();
|
||||
updatemenulist(scope.jdqcontrol.devicelist,"all");
|
||||
|
||||
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.disperdevice1 = 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
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(textplane){
|
||||
textplane.lookAt(camera.position);
|
||||
}
|
||||
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(){
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"on"],true);
|
||||
}
|
||||
|
||||
function move2(){
|
||||
if(scope.selectmodel){
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"off"],true);
|
||||
}
|
||||
}
|
||||
|
||||
function move3(){
|
||||
if(scope.selectmodel){
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],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.modelmanager.controllist[i].code);
|
||||
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.modelmanager.controllist[i].code);
|
||||
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]){
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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);
|
||||
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(scope.status == '1'){
|
||||
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 = JL3D_LOCAL_STATIC+"/texture/guide.png";
|
||||
//canvas文字贴图方法
|
||||
//PS:待提炼 增强功能
|
||||
function getTextCanvas(text){
|
||||
if(scope.status == '1'){
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,571 +0,0 @@
|
||||
import { Staticmodel } from '@/jlmap3d/jl3ddevicetrain/config.js';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.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(JL3D_LOCAL_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 = JL3D_LOCAL_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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,184 +0,0 @@
|
||||
|
||||
|
||||
export function ModelManager(){
|
||||
let scope = this;
|
||||
|
||||
this.controllist = [];
|
||||
this.actionlist = [];
|
||||
let jdq1 = {
|
||||
code:"jdq1",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq2 = {
|
||||
code:"jdq2",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq3 = {
|
||||
code:"jdq3",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq4 = {
|
||||
code:"jdq4",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq5 = {
|
||||
code:"jdq5",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq6 = {
|
||||
code:"jdq6",
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
this.jdqg = {
|
||||
code:null,
|
||||
locateType:"00",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
this.loadpromise = function (data,mixers,scene){
|
||||
let initlist = [];
|
||||
initlist.push(fbxpromise(data.Jdq1,mixers,jdq1));
|
||||
initlist.push(fbxpromise(data.Jdq2,mixers,jdq2));
|
||||
initlist.push(fbxpromise(data.Jdq3,mixers,jdq3));
|
||||
initlist.push(fbxpromise(data.Jdq4,mixers,jdq4));
|
||||
initlist.push(fbxpromise(data.Jdq5,mixers,jdq5));
|
||||
initlist.push(fbxpromise(data.Jdq6,mixers,jdq6));
|
||||
initlist.push(fbxpromise(data.Jdqg,mixers,scope.jdqg));
|
||||
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
Promise.all(initlist).then((result) => {
|
||||
jdq1.mesh.stats = "0";
|
||||
jdq1.mesh.position.x = 19;
|
||||
jdq1.mesh.position.z = -275;
|
||||
jdq1.mesh.position.y = 1270;
|
||||
jdq1.mesh.rotation.y = -Math.PI/2;
|
||||
jdq1.mesh.rotation.z = -Math.PI/2;
|
||||
|
||||
jdq2.mesh.stats = "0";
|
||||
jdq2.mesh.position.x = 19;
|
||||
jdq2.mesh.position.z = -165;
|
||||
jdq2.mesh.position.y = 1270;
|
||||
jdq2.mesh.rotation.y = -Math.PI/2;
|
||||
jdq2.mesh.rotation.z = -Math.PI/2;
|
||||
|
||||
jdq3.mesh.stats = "0";
|
||||
jdq3.mesh.position.x = 19;
|
||||
jdq3.mesh.position.z = -55;
|
||||
jdq3.mesh.position.y = 1270;
|
||||
jdq3.mesh.rotation.y = -Math.PI/2;
|
||||
jdq3.mesh.rotation.z = -Math.PI/2;
|
||||
|
||||
jdq4.mesh.stats = "0";
|
||||
jdq4.mesh.position.x = 19;
|
||||
jdq4.mesh.position.z = 65;
|
||||
jdq4.mesh.position.y = 1270;
|
||||
jdq4.mesh.rotation.y = -Math.PI/2;
|
||||
jdq4.mesh.rotation.z = -Math.PI/2;
|
||||
|
||||
jdq5.mesh.stats = "0";
|
||||
jdq5.mesh.position.x = 19;
|
||||
jdq5.mesh.position.z = 170;
|
||||
jdq5.mesh.position.y = 1270;
|
||||
jdq5.mesh.rotation.y = -Math.PI/2;
|
||||
jdq5.mesh.rotation.z = -Math.PI/2;
|
||||
|
||||
jdq6.mesh.stats = "0";
|
||||
jdq6.mesh.position.x = 19;
|
||||
jdq6.mesh.position.z = 280;
|
||||
jdq6.mesh.position.y = 1270;
|
||||
jdq6.mesh.rotation.y = -Math.PI/2;
|
||||
jdq6.mesh.rotation.z = -Math.PI/2;
|
||||
|
||||
scope.controllist.push(jdq1.mesh);
|
||||
scope.controllist.push(jdq2.mesh);
|
||||
scope.controllist.push(jdq3.mesh);
|
||||
scope.controllist.push(jdq4.mesh);
|
||||
scope.controllist.push(jdq5.mesh);
|
||||
scope.controllist.push(jdq6.mesh);
|
||||
// console.log(jdq1);
|
||||
scope.actionlist.push(jdq1.action);
|
||||
scope.actionlist.push(jdq2.action);
|
||||
scope.actionlist.push(jdq3.action);
|
||||
scope.actionlist.push(jdq4.action);
|
||||
scope.actionlist.push(jdq5.action);
|
||||
scope.actionlist.push(jdq6.action);
|
||||
|
||||
scene.add(jdq1.mesh);
|
||||
scene.add(jdq2.mesh);
|
||||
scene.add(jdq3.mesh);
|
||||
scene.add(jdq4.mesh);
|
||||
scene.add(jdq5.mesh);
|
||||
scene.add(jdq6.mesh);
|
||||
scene.add(scope.jdqg.mesh);
|
||||
resolve("success"); //['成功了', 'success']
|
||||
}).catch((error) => {
|
||||
//console.log(error);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fbxpromise(asset,mixers,model){
|
||||
return new Promise(function(resolve, reject){
|
||||
var loader = new THREE.FBXLoader();
|
||||
|
||||
loader.load( asset.assetUrl, function ( object ) {
|
||||
let mixer = new THREE.AnimationMixer( object );
|
||||
// object.traverse( function ( child ) {
|
||||
// if ( child.isMesh ) {
|
||||
// child.castShadow = true;
|
||||
// child.receiveShadow = true;
|
||||
// }
|
||||
// } );
|
||||
|
||||
//设置透明贴图的材质属性
|
||||
for(let i=0,leni=object.children.length;i<leni;i++){
|
||||
if(object.children[i].name == "fanghuozhao"){
|
||||
for(let j=0,lenj=object.children[i].children.length;j<lenj;j++){
|
||||
object.children[i].children[j].raycastoff = true;
|
||||
if(object.children[i].children[j].name == "waizhao"){
|
||||
object.children[i].children[j].material.depthTest = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
object.name = asset.name;
|
||||
object.code = model.code;
|
||||
model.mesh = object;
|
||||
|
||||
if(object.animations.length>0){
|
||||
|
||||
model.action = mixer.clipAction( object.animations[ 0 ] );
|
||||
model.action.setLoop(THREE.LoopOnce);
|
||||
model.action.clampWhenFinished = true;
|
||||
// model.action.play();
|
||||
// scope.actionlist.push("1");
|
||||
mixers.push(mixer);
|
||||
}
|
||||
resolve(asset.deviceType);
|
||||
} );
|
||||
|
||||
});
|
||||
}
|
@ -8,7 +8,7 @@ import {MTLLoader} from '@/jlmap3d/main/loaders/MTLLoader.js';
|
||||
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader.js';
|
||||
|
||||
// data
|
||||
import { Jl3ddata } from '@/jlmap3d/main/model/jl3ddata';
|
||||
import { Jl3ddata } from '@/jlmap3d/main/newmodel/jl3ddata';
|
||||
|
||||
// setconfig
|
||||
import { SetCamera } from '@/jlmap3d/config/SetCamera';
|
||||
@ -21,10 +21,8 @@ import {OrbitControls} from '@/jlmap3d/main/control/OrbitControls.js';
|
||||
import { DragControls } from '@/jlmap3d/main/control/DragControls.js';
|
||||
|
||||
// 加载器
|
||||
import { DriverLoad } from '@/jlmap3d/main/loaders/DriverLoad';
|
||||
import { DriverLoadNew } from '@/jlmap3d/main/loaders/DriverLoadNew';
|
||||
// connect
|
||||
import {Jl3dDriving} from '@/jlmap3d/jl3ddrive/moveupdate/DrivingConnect';
|
||||
import {Jl3dDrivingNew} from '@/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew';
|
||||
|
||||
import { getPublishMapVersion, getPublishMapDetail, getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
|
||||
@ -158,57 +156,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
|
||||
getPublish3dMapDetail(mapId).then(netdata => {
|
||||
// console.log(netdata);
|
||||
let assetsdata = JSON.parse(netdata.data.sections);
|
||||
if(assetsdata.link){
|
||||
scope.datatype = "old";
|
||||
// datanew();
|
||||
// scope.jsonwebwork = new Worker(JL3D_LOCAL_STATIC+"/workertest/jsonworker.js");
|
||||
// scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
|
||||
// scope.Subscribe.socketon(scope.Subscribe.topic);
|
||||
|
||||
scope.Subscribe = new Jl3dDriving(mixers,updatemmi,sound,translation,routegroup);
|
||||
|
||||
scope.Subscribe.socketon(scope.Subscribe.topic);
|
||||
DriverLoad(data,scope,netdata.data,sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails, camera, controls3, scene,mixers,storemod);
|
||||
var timer = setInterval(function() {
|
||||
if(trainlisttest){
|
||||
if(trainlisttest.group){
|
||||
if(trainlisttest.group.children[0]){
|
||||
// console.log(trainlisttest.group.children[0].name);
|
||||
updatemmi.updatedrivingcode(trainlisttest.group.children[0].name);
|
||||
scope.Subscribe.initdrivercode(trainlisttest.group.children[0].name);
|
||||
for(let k in rails.switchrail){
|
||||
const ddd = storemod.getters['map/getDeviceByCode'](k);
|
||||
let switchdata = rails.switchrail[k];
|
||||
rails.switchrail[k].locateType = ddd.locateType;
|
||||
|
||||
if(ddd.locateType == "01"){
|
||||
//1--向左 2--向右
|
||||
//__\__ __/__
|
||||
if(rails.switchrail[k].directtype == "1"){
|
||||
rails.linkrail[switchdata.alink].lconnect = switchdata.blink;
|
||||
rails.linkrail[switchdata.blink].rconnect = switchdata.alink;
|
||||
}else if(rails.switchrail[k].directtype == "2"){
|
||||
rails.linkrail[switchdata.alink].rconnect = switchdata.blink;
|
||||
rails.linkrail[switchdata.blink].lconnect = switchdata.alink;
|
||||
}
|
||||
|
||||
}else if(ddd.locateType == "02"){
|
||||
if(rails.switchrail[k].directtype == "1"){
|
||||
rails.linkrail[switchdata.alink].lconnect = switchdata.clink;
|
||||
rails.linkrail[switchdata.clink].rconnect = switchdata.alink;
|
||||
}else if(rails.switchrail[k].directtype == "2"){
|
||||
rails.linkrail[switchdata.alink].rconnect = switchdata.clink;
|
||||
rails.linkrail[switchdata.clink].lconnect = switchdata.alink;
|
||||
}
|
||||
}
|
||||
}
|
||||
clearInterval(timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, 2000);
|
||||
}else{
|
||||
scope.datatype = "new";
|
||||
driverWebWorker = new Worker(JL3D_LOCAL_STATIC+"/workertest/driverWebWorker.js");
|
||||
scope.Subscribe = new Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,driverWebWorker,stats);
|
||||
@ -230,7 +178,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
|
||||
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -1,886 +0,0 @@
|
||||
import StompClient from '@/utils/sock';
|
||||
|
||||
import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
||||
|
||||
import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import router from '@/router/index_APP_TARGET';
|
||||
|
||||
// 定于仿真socket接口
|
||||
export function Jl3dDriving(mixers, updatemmi, sound, translation, routegroup) {
|
||||
|
||||
const scope = this;
|
||||
this.map = null;
|
||||
const toppic = '/app/topic/simulation/client/' + routegroup + '/drive';
|
||||
var trainlisttest = null;
|
||||
var sectionlist = null;
|
||||
var signallist = null;
|
||||
var stationstandlist = null;
|
||||
var sectionlist = null;
|
||||
var materials = null;
|
||||
var actions = null;
|
||||
var rails = null;
|
||||
var links = null;
|
||||
|
||||
var scenes = null;
|
||||
|
||||
var code = null;
|
||||
|
||||
var drivingcode = null;
|
||||
var drivingspeed = null;
|
||||
var drivingaptspeed = null;
|
||||
|
||||
let driverswitch = false;
|
||||
|
||||
const stoptimer = null;
|
||||
const num = 30;
|
||||
const pointstand = null;
|
||||
// run as plane = 01;
|
||||
// reset = 02;
|
||||
var datatype = '00';
|
||||
this.teststomp = new StompClient();
|
||||
this.topic = '/user/queue/simulation/jl3d/' + routegroup;
|
||||
const header = {'X-Token': getToken() };
|
||||
|
||||
this.updatamap = function(newsectionlist, newlinklist, newsignallist, newstationstandlist, newtrainlisttest, newrealsectionlist, newrails, materiallist, nowaction, scene) {
|
||||
// console.log(mapdata);
|
||||
// console.log(newtrainlisttest);
|
||||
trainlisttest = newtrainlisttest;
|
||||
sectionlist = newsectionlist;
|
||||
signallist = newsignallist;
|
||||
stationstandlist = newstationstandlist;
|
||||
materials = materiallist;
|
||||
scenes = scene;
|
||||
actions = nowaction;
|
||||
links = newlinklist;
|
||||
rails = newrails;
|
||||
};
|
||||
|
||||
this.initdrivercode = function(code) {
|
||||
drivingcode = code;
|
||||
};
|
||||
|
||||
this.socketon = function(topic) {
|
||||
try {
|
||||
// console.log("teststomp");
|
||||
scope.teststomp.subscribe(topic, callback, header);
|
||||
} catch (error) {
|
||||
console.error('websocket订阅失败');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.socketoff = function(topic) {
|
||||
scope.teststomp.unsubscribe(topic);
|
||||
for (let i = 0; i < trainlisttest.group.children.length; i++) {
|
||||
if (trainlisttest.group.children[i].dispose == false) {
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.group.children[i].dispose = true;
|
||||
trainlisttest.group.children[i].position.x = -50000;
|
||||
trainlisttest.group.children[i].position.y = -50000;
|
||||
trainlisttest.group.remove(trainlisttest.group.children[i]);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 仿真socket接口回调函数
|
||||
function callback(Response) {
|
||||
// console.log(Response);
|
||||
// 对象化数据
|
||||
const data = JSON.parse(Response.body);
|
||||
// 遍历后台数据
|
||||
|
||||
// 判断消息类型
|
||||
// if(data.type == "Simulation_TrainPosition"){
|
||||
//
|
||||
//
|
||||
// }
|
||||
// console.log(data);
|
||||
// console.log(data);
|
||||
switch (data.type) {
|
||||
case 'Simulation_Driver_Change':
|
||||
|
||||
trainlisttest.group.remove(trainlisttest.list[drivingcode]);
|
||||
trainlisttest.list[data.body.code].dispose = true;
|
||||
trainlisttest.list[drivingcode].dispose = true;
|
||||
drivingcode = data.body.code;
|
||||
trainlisttest.group.add(trainlisttest.list[drivingcode]);
|
||||
|
||||
// sound.volswitch = true;
|
||||
updatemmi.updatedrivingcode( data.body.code);
|
||||
break;
|
||||
case 'Simulation_TrainSpeed':
|
||||
|
||||
trainspeed(data);
|
||||
break;
|
||||
case 'SJL3D_TrainStatus':
|
||||
trainstatus(data);
|
||||
break;
|
||||
case 'Simulation_DeviceStatus':
|
||||
devicestatus(data);
|
||||
break;
|
||||
case 'Simulation_Drive_Data_Routing':
|
||||
updatemmi.updatedrivedata(data.body);
|
||||
break;
|
||||
case 'Simulation_Reset':
|
||||
simulationreset(data);
|
||||
default :
|
||||
// TODO
|
||||
}
|
||||
|
||||
// if(data.type == 'Simulation_Drive_Data_Routing'){
|
||||
// updatemmi.updatedrivedata(data.body);
|
||||
// }
|
||||
//
|
||||
// if (data.type == 'Simulation_Driver_Change') {
|
||||
// drivingcode = data.body.code;
|
||||
// updatemmi.updatedrivingcode( data.body.code);
|
||||
// }
|
||||
//
|
||||
// if (data.type == 'Simulation_TrainSpeed') {
|
||||
// trainspeed(data);
|
||||
// }
|
||||
//
|
||||
// if (data.type == 'SJL3D_TrainStatus') {
|
||||
// trainstatus(data);
|
||||
// }
|
||||
//
|
||||
// if (data.type == 'Simulation_DeviceStatus') {
|
||||
// devicestatus(data);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
function trainspeed(data) {
|
||||
// console.log(data);
|
||||
if (trainlisttest) {
|
||||
for (let tl = 0; tl < data.body.length; tl++) {
|
||||
code = data.body[tl].id;
|
||||
if (trainlisttest.list[code].speed != data.body[tl].v) {
|
||||
trainlisttest.list[code].speed = data.body[tl].v;
|
||||
|
||||
if (trainlisttest.list[code].runMode == '02') {
|
||||
|
||||
if (trainlisttest.list[code].isStandTrack == true) {
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v * 10 / 36 / 25 / trainlisttest.list[code].len);
|
||||
} else {
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v * 10 / 36 / 25 / trainlisttest.list[code].len);
|
||||
}
|
||||
} else {
|
||||
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v * 10 / 36 / 25 / trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
if (code == drivingcode) {
|
||||
// if (data.body[tl].v >0) {
|
||||
// updatemmi.updatenowspeed(data.body[tl].v);
|
||||
// } else {
|
||||
|
||||
updatemmi.updatenowspeed(Math.abs(data.body[tl].v));
|
||||
// console.log(data.body[i]);
|
||||
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if (code == drivingcode) {
|
||||
// if(sound.volswitch == true){
|
||||
// sound.setVolume( data.body[tl].v/100 );
|
||||
// }
|
||||
if (data.body[tl].atpv) {
|
||||
updatemmi.updateatpspeed(data.body[tl].atpv);
|
||||
} else {
|
||||
updatemmi.updateatpspeed(-1);
|
||||
}
|
||||
if (data.body[tl].atov) {
|
||||
updatemmi.updateatospeed(data.body[tl].atov);
|
||||
} else {
|
||||
updatemmi.updateatospeed(-1);
|
||||
}
|
||||
if (trainlisttest.list[code].progress < 1) {
|
||||
const syncdata = {
|
||||
type: 'Train',
|
||||
code: code,
|
||||
linkCode: trainlisttest.list[code].nowcode,
|
||||
percent: 0
|
||||
};
|
||||
if (trainlisttest.list[code].status == '02') {
|
||||
if (trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode) {
|
||||
if ((trainlisttest.list[code].linkOffsetPercent / trainlisttest.list[code].pc) >= trainlisttest.list[code].targetpercent) {
|
||||
syncdata.percent = trainlisttest.list[code].progress;
|
||||
} else {
|
||||
syncdata.percent = trainlisttest.list[code].progress * trainlisttest.list[code].pc;
|
||||
}
|
||||
} else {
|
||||
syncdata.percent = trainlisttest.list[code].progress;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode) {
|
||||
if ((trainlisttest.list[code].linkOffsetPercent / trainlisttest.list[code].pc) <= trainlisttest.list[code].targetpercent) {
|
||||
syncdata.percent = (1 - trainlisttest.list[code].progress);
|
||||
} else {
|
||||
syncdata.percent = (1 - trainlisttest.list[code].progress) * trainlisttest.list[code].pc;
|
||||
}
|
||||
} else {
|
||||
syncdata.percent = (1 - trainlisttest.list[code].progress);
|
||||
}
|
||||
}
|
||||
// console.log("send");
|
||||
// console.log(trainlisttest.list[code]);
|
||||
//
|
||||
// console.log(syncdata);
|
||||
// console.log("=============");
|
||||
scope.teststomp.send(toppic, syncdata);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function trainstatus(data) {
|
||||
// console.log(data.body);
|
||||
for (let i = data.body.length - 1; i >= 0; i--) {
|
||||
// 遍历列车对象组
|
||||
// console.log(trainlisttest);
|
||||
if (trainlisttest) {
|
||||
|
||||
code = data.body[i].code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
|
||||
if (code == drivingcode) {
|
||||
|
||||
driverswitch = data.body[i].runMode;
|
||||
// 更新车组号
|
||||
updatemmi.updatetrainnum(data.body[i].groupNumber);
|
||||
// 更新列车
|
||||
if (data.body[i].parkRemainTime > 0) {
|
||||
updatemmi.updatestoptime(translation.stopTime + parseInt(data.body[i].parkRemainTime));
|
||||
} else {
|
||||
if (data.body[i].runMode == '02') {
|
||||
updatemmi.updatestoptime(translation.trainAtoOn);
|
||||
} else {
|
||||
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress > 0.95 && trainlisttest.list[code].speed <= 0) {
|
||||
// if(stoptimer){
|
||||
//
|
||||
// }else{
|
||||
// stoptimer = setInterval(function(){
|
||||
// if(num >=0){
|
||||
// updatemmi.updatestoptime("停站时间:"+num);
|
||||
// num --;
|
||||
// }
|
||||
// },1000);
|
||||
// }
|
||||
|
||||
} else {
|
||||
updatemmi.updatestoptime(translation.trainAtoOff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].runMode = data.body[i].runMode;
|
||||
|
||||
// 车门开关验证
|
||||
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
|
||||
// console.log("close");
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
for (let an = actions[code].top.length - 1; an >= 0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = -1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
|
||||
// console.log("open");
|
||||
trainlisttest.list[code].doorStatus = '02';
|
||||
for (let an = actions[code].top.length - 1; an >= 0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
// if (data.body[i].directionType == '02') {
|
||||
//
|
||||
// } else {
|
||||
// if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
|
||||
// // console.log("close");
|
||||
// trainlisttest.list[code].doorStatus = '01';
|
||||
// for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
|
||||
// actions[code].down[an].timeScale = -1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// } else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
|
||||
// // console.log("open");
|
||||
// trainlisttest.list[code].doorStatus = '02';
|
||||
// for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = 0;
|
||||
// actions[code].down[an].timeScale = 1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 遍历获取所在轨道
|
||||
|
||||
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
|
||||
|
||||
if (rails.linkrail[data.body[i].linkCode]) {
|
||||
// console.log(trainlisttest.group);
|
||||
if (trainlisttest.group.children.length < 1) {
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
drivingcode = code;
|
||||
updatemmi.updatedrivingcode(drivingcode);
|
||||
}
|
||||
if (trainlisttest.list[code].mixerpush == false) {
|
||||
for (let mi = 0, lenmi = trainlisttest.list[code].mixer.length; mi < lenmi; mi++) {
|
||||
mixers.push(trainlisttest.list[code].mixer[mi]);
|
||||
}
|
||||
trainlisttest.list[code].mixerpush = true;
|
||||
}
|
||||
// trainlisttest.group.add(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
// trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
|
||||
trainlisttest.list[code].dispose = false;
|
||||
trainlisttest.list[code].nowcode = data.body[i].linkCode;
|
||||
|
||||
trainlisttest.list[code].pc = 1;
|
||||
// console.log(data.body[i]);
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
|
||||
if (data.body[i].targetStation) {
|
||||
|
||||
trainlisttest.list[code].stopstation = data.body[i].targetStation;
|
||||
// console.log(rails.stops[data.body[i].targetStation].direct2.percent);
|
||||
trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent / trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.body[i].targetLink;
|
||||
} else {
|
||||
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
}
|
||||
|
||||
trainlisttest.list[code].status = '02';
|
||||
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
|
||||
const point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl = 0; tl < 6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
|
||||
// if(trainlisttest.list[code].rname == "006"){
|
||||
// console.log("0000000000000000");
|
||||
// console.log(data.body[i].linkOffsetPercent);
|
||||
// }
|
||||
if (data.body[i].targetStation) {
|
||||
|
||||
trainlisttest.list[code].stopstation = data.body[i].targetStation;
|
||||
trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct1.percent;
|
||||
// console.log(data.body[i].targetLinkPercent);
|
||||
// console.log(rails.stops[data.body[i].targetStation].direct1.percent);
|
||||
// console.log(trainlisttest.list[code].pc);
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent;
|
||||
trainlisttest.list[code].progress = 1 - data.body[i].linkOffsetPercent / trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.body[i].targetLink;
|
||||
} else {
|
||||
trainlisttest.list[code].progress = 1 - data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
}
|
||||
// console.log("progress:"+trainlisttest.list[code].progress);
|
||||
// console.log("linkOffsetPercent:"+trainlisttest.list[code].linkOffsetPercent);
|
||||
// console.log("datatarget:"+ data.body[i].targetLinkPercent);
|
||||
// console.log("directpercent:"+trainlisttest.list[code].targetpercent);
|
||||
// console.log("====================");
|
||||
trainlisttest.list[code].status = '03';
|
||||
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
|
||||
const point = rails.linkrail[data.body[i].linkCode].lineright.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl = 0; tl < 6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -point.z;
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
// trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
|
||||
|
||||
// trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
|
||||
if (data.body[i].speed == 0) {
|
||||
trainlisttest.list[code].speeds = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = 0;
|
||||
// trainlisttest.list[code].startmark = 1;
|
||||
} else {
|
||||
trainlisttest.list[code].speeds = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed * 10 / 36 / 25 / trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = true;
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.list[code].position.x = -50000;
|
||||
trainlisttest.list[code].position.y = -50000;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
|
||||
|
||||
if (rails.linkrail[data.body[i].linkCode]) {
|
||||
if (driverswitch == '02' && code == drivingcode) {
|
||||
updatemmi.updatenowspeed(data.body[i].speed);
|
||||
if (data.body[i].atpSpeed) {
|
||||
updatemmi.updateatpspeed(data.body[i].atpSpeed);
|
||||
} else {
|
||||
updatemmi.updateatpspeed(-1);
|
||||
}
|
||||
if (data.body[i].targetSpeed) {
|
||||
updatemmi.updateatospeed(data.body[i].targetSpeed);
|
||||
} else {
|
||||
updatemmi.updateatospeed(-1);
|
||||
}
|
||||
if (data.body[i].maLen) {
|
||||
updatemmi.updatenowlen(data.body[i].maLen);
|
||||
} else {
|
||||
updatemmi.updatenowlen(0);
|
||||
}
|
||||
// if(trainlisttest.list[code].isStandTrack == true){
|
||||
// pointstand = null;
|
||||
// if(data.body[i].directionType == "02"){
|
||||
// pointstand = trainlisttest.list[code].curve.getPointAt(data.body[i].sectionOffsetPercent);
|
||||
// }else{
|
||||
// pointstand = trainlisttest.list[code].curve.getPointAt(1-data.body[i].sectionOffsetPercent);
|
||||
// }
|
||||
// console.log(data.body[i].sectionOffsetPercent)
|
||||
// console.log(pointstand.x);
|
||||
//
|
||||
// trainlisttest.list[code].position.x = pointstand.x;
|
||||
// }
|
||||
}
|
||||
if (driverswitch == '05' && code == drivingcode) {
|
||||
if (data.body[i].maLen) {
|
||||
updatemmi.updatenowlen(data.body[i].maLen);
|
||||
} else {
|
||||
updatemmi.updatenowlen(0);
|
||||
}
|
||||
}
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
|
||||
trainlisttest.list[code].progress = 0;
|
||||
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl = 0; tl < 6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
|
||||
trainlisttest.list[code].progress = (rotaposx - rails.linkrail[data.body[i].linkCode].lp.x) / rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
trainlisttest.list[code].progress = 0;
|
||||
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl = 0; tl < 6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -rotaposz;
|
||||
}
|
||||
trainlisttest.list[code].progress = 1 - (rotaposx - rails.linkrail[data.body[i].linkCode].lp.x) / rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
|
||||
}
|
||||
}
|
||||
let nextcode;
|
||||
|
||||
if (code == drivingcode) {
|
||||
// console.log(data.body[i].targetStation);
|
||||
// console.log("netpercent");
|
||||
// console.log(data.body[i].targetLinkPercent);
|
||||
// console.log(data.body[i].linkOffsetPercent);
|
||||
// console.log("3dpercent");
|
||||
// if(rails.stops[data.body[i].targetStation]){
|
||||
// console.log(rails.stops[data.body[i].targetStation].direct2.percent);
|
||||
// }
|
||||
//
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
// console.log(trainlisttest.list[code].pc);
|
||||
// console.log("===============");
|
||||
// console.log(data.body[i]);
|
||||
if (data.body[i].directionType == '02') {
|
||||
if (trainlisttest.list[code].stopstation != data.body[i].targetStation) {
|
||||
trainlisttest.list[code].stopstation = data.body[i].targetStation;
|
||||
if (data.body[i].targetStation) {
|
||||
trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.body[i].targetLink;
|
||||
|
||||
// trainlisttest.list[code].progress = trainlisttest.list[code].linkOffsetPercent*trainlisttest.list[code].pc;
|
||||
}
|
||||
}
|
||||
|
||||
trainlisttest.list[code].status = '02';
|
||||
nextcode = rails.linkrail[data.body[i].linkCode].rconnect;
|
||||
if (nextcode) {
|
||||
// console.log(rails.linkrail[nextcode].lineleft.points);
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
} else {
|
||||
|
||||
trainlisttest.list[code].nextlen = 0;
|
||||
}
|
||||
} else if (data.body[i].directionType == '03') {
|
||||
if (trainlisttest.list[code].stopstation != data.body[i].targetStation) {
|
||||
trainlisttest.list[code].stopstation = data.body[i].targetStation;
|
||||
if (data.body[i].targetStation) {
|
||||
trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct1.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.body[i].targetLink;
|
||||
// trainlisttest.list[code].progress = (1-trainlisttest.list[code].linkOffsetPercent)*trainlisttest.list[code].pc;
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].status = '03';
|
||||
nextcode = rails.linkrail[data.body[i].linkCode].lconnect;
|
||||
if (nextcode) {
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
} else {
|
||||
|
||||
trainlisttest.list[code].nextlen = 0;
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].nextcode = nextcode;
|
||||
|
||||
// console.log(trainlisttest.list[code].nowcode);
|
||||
// console.log(trainlisttest.list[code].nextcode);
|
||||
// console.log(trainlisttest.list[code].curve.points);
|
||||
// console.log(trainlisttest.list[code].nextcurve.points);
|
||||
// console.log("=========================");
|
||||
|
||||
} else {
|
||||
|
||||
// trainlisttest.list[code].stopstation = data.body[i].targetStation;
|
||||
// // console.log(rails.stops[data.body[i].targetStation].direct2.percent);
|
||||
// trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
// trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
// trainlisttest.list[code].progress = data.body[i].linkOffsetPercent*trainlisttest.list[code].pc;
|
||||
// trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
// trainlisttest.list[code].targetLink = data.body[i].targetLink;
|
||||
|
||||
let nextcode;
|
||||
if (data.body[i].directionType == '02') {
|
||||
if (rails.linkrail[data.body[i].linkCode].lineleft) {
|
||||
nextcode = rails.linkrail[data.body[i].linkCode].rconnect;
|
||||
trainlisttest.list[code].status = '02';
|
||||
if (nextcode) {
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}
|
||||
trainlisttest.list[code].nowcode = data.body[i].linkCode;
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
|
||||
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
if (data.body[i].targetStation) {
|
||||
trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetLink = data.body[i].targetLink;
|
||||
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent / trainlisttest.list[code].pc;
|
||||
}
|
||||
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed * 10 / 36 / 25 / trainlisttest.list[code].len);
|
||||
}
|
||||
} else if (data.body[i].directionType == '03') {
|
||||
if (rails.linkrail[data.body[i].linkCode].lineright) {
|
||||
nextcode = rails.linkrail[data.body[i].linkCode].lconnect;
|
||||
trainlisttest.list[code].status = '03';
|
||||
|
||||
if (nextcode) {
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}
|
||||
trainlisttest.list[code].nowcode = data.body[i].linkCode;
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
|
||||
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
trainlisttest.list[code].progress = 1 - data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
if (data.body[i].targetStation) {
|
||||
trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct1.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent;
|
||||
trainlisttest.list[code].targetLink = data.body[i].targetLink;
|
||||
trainlisttest.list[code].progress = (1 - data.body[i].linkOffsetPercent) / trainlisttest.list[code].pc;
|
||||
}
|
||||
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed * 10 / 36 / 25 / trainlisttest.list[code].len);
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].nextcode = nextcode;
|
||||
}
|
||||
|
||||
// console.log(data.body[i].linkOffsetPercent);
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
// console.log(trainlisttest.list[code].curve.points);
|
||||
// console.log(trainlisttest.list[code].nextcurve.points);
|
||||
// console.log(trainlisttest.list[code].len);
|
||||
// console.log(trainlisttest.list[code].nextlen);
|
||||
// console.log("==========================================");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function simulationreset(data) {
|
||||
// console.log(data);
|
||||
for (const k in trainlisttest.list) {
|
||||
trainlisttest.list[k].dispose = true;
|
||||
trainlisttest.group.remove(trainlisttest.list[k]);
|
||||
trainlisttest.list[k].stopstation = null;
|
||||
trainlisttest.list[k].pc = null;
|
||||
trainlisttest.list[k].targetpercent = null;
|
||||
trainlisttest.list[k].progress = null;
|
||||
trainlisttest.list[k].linkOffsetPercent = null;
|
||||
trainlisttest.list[k].targetLink = null;
|
||||
drivingcode = null;
|
||||
}
|
||||
}
|
||||
|
||||
function devicestatus(data) {
|
||||
for (let i = data.body.length - 1; i >= 0; i--) {
|
||||
// 0xFFFFFF
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
if (data.body[i]._type == 'Signal') {
|
||||
if (signallist) {
|
||||
signalupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'StationStand' ) {
|
||||
if (actions) {
|
||||
standupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'Switch') {
|
||||
if (sectionlist) {
|
||||
switchupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function standupdate(data) {
|
||||
code = data.code;
|
||||
if ( actions[code]) {
|
||||
if (data.screenDoorOpenStatus == '02' && actions[code].status == '01') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.screenDoorOpenStatus == '02' && actions[code].status == '00') {
|
||||
actions[code].status = '02';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
|
||||
if (data.screenDoorOpenStatus == '01' && actions[code].status == '02') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.screenDoorOpenStatus == '01' && actions[code].status == '00') {
|
||||
actions[code].status = '01';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
if (data.lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.status = data.status;
|
||||
|
||||
// 55
|
||||
// 33
|
||||
// 77
|
||||
// 关闭
|
||||
if (data.status == '01') {
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map = materials[0];
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 开放
|
||||
if (data.status == '02') {
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map = materials[2];
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true;
|
||||
}
|
||||
if (data.status == '03') {
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[1];
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 引导
|
||||
if (data.status == '03') {
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map = materials[0];
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[1];
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 封锁
|
||||
if (data.status == '04') {
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 故障
|
||||
if (data.status == '05') {
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (data.lightType == '02') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
for (let j = sectionlist.switchs.modellist.length - 1; j >= 0; j--) {
|
||||
if (rails.switchrail[code]) {
|
||||
if (rails.switchrail[code].locateType != data.locateType) {
|
||||
// console.log("道岔变化:"+code);
|
||||
if (data.locateType == '02') {
|
||||
// console.log("02 反位");
|
||||
if (actions[sectionlist.switchs.modellist[j].code]) {
|
||||
sectionlist.switchs.modellist[j].locateType = data.locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = 0;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
}
|
||||
|
||||
rails.switchrail[code].locateType = '02';
|
||||
|
||||
const testswitch = rails.switchrail[code];
|
||||
if (rails.switchrail[code].directtype == '1') {
|
||||
// console.log("道岔朝向1向左");
|
||||
// console.log("aleft:"+testswitch.clink);
|
||||
// console.log("cright:"+testswitch.alink);
|
||||
rails.linkrail[testswitch.alink].lconnect = testswitch.clink;
|
||||
rails.linkrail[testswitch.clink].rconnect = testswitch.alink;
|
||||
} else if (rails.switchrail[code].directtype == '2') {
|
||||
// console.log("道岔朝向2向右");
|
||||
// console.log("aright:"+testswitch.clink);
|
||||
// console.log("cleft:"+testswitch.alink);
|
||||
rails.linkrail[testswitch.alink].rconnect = testswitch.clink;
|
||||
rails.linkrail[testswitch.clink].lconnect = testswitch.alink;
|
||||
}
|
||||
|
||||
} else if (data.locateType == '01') {
|
||||
// console.log("01 定位");
|
||||
if (actions[sectionlist.switchs.modellist[j].code]) {
|
||||
sectionlist.switchs.modellist[j].locateType = data.locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
}
|
||||
|
||||
rails.switchrail[code].locateType = '01';
|
||||
const testswitch = rails.switchrail[code];
|
||||
if (rails.switchrail[code].directtype == '1') {
|
||||
// console.log("道岔朝向1向左");
|
||||
// console.log("aleft"+testswitch.blink);
|
||||
// console.log("cright:"+testswitch.alink);
|
||||
rails.linkrail[testswitch.alink].lconnect = testswitch.blink;
|
||||
rails.linkrail[testswitch.blink].rconnect = testswitch.alink;
|
||||
} else if (rails.switchrail[code].directtype == '2') {
|
||||
// console.log("道岔朝向2向右");
|
||||
// console.log("aright:"+testswitch.blink);
|
||||
// console.log("cleft:"+testswitch.alink);
|
||||
rails.linkrail[testswitch.alink].rconnect = testswitch.blink;
|
||||
rails.linkrail[testswitch.blink].lconnect = testswitch.alink;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -7,7 +7,7 @@ import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
//data
|
||||
import { Jl3ddata } from '@/jlmap3d/main/model/jl3ddata';
|
||||
import { Jl3ddata } from '@/jlmap3d/main/newmodel/jl3ddata';
|
||||
|
||||
//setconfig
|
||||
import { SetCamera } from '@/jlmap3d/config/SetCamera';
|
||||
@ -30,7 +30,6 @@ import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '
|
||||
//utils
|
||||
// import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrain';
|
||||
import { UpdateTrain } from '@/jlmap3d/jl3dsimulation/connect/UpdateTrainTest';
|
||||
import { UpdateTrainNew } from '@/jlmap3d/jl3dsimulation/connect/UpdateTrainNew';
|
||||
// import { ReStart } from '@/jlmap3d/main/utils/ReStart';
|
||||
|
||||
import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
|
||||
@ -198,12 +197,7 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
|
||||
|
||||
scope.webwork.onmessage = function (event) {
|
||||
//更新列车位置
|
||||
// if(scope.datatype == "new"){
|
||||
//
|
||||
// UpdateTrainNew(camera,trainlisttest);
|
||||
// }else{
|
||||
// UpdateTrain(camera,trainlisttest);
|
||||
// }
|
||||
|
||||
|
||||
if(camerarail.moveswitch == true){
|
||||
// console.log(camerarail.progress);
|
||||
|
@ -1,11 +1,4 @@
|
||||
//componnent
|
||||
import {SectionList} from '@/jlmap3d/main/model/SectionList.js';
|
||||
import {SignalList} from '@/jlmap3d/main/model/SignalList.js';
|
||||
import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js';
|
||||
import {TrainList} from '@/jlmap3d/main/model/TrainList.js';
|
||||
import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js';
|
||||
import {LinkList} from '@/jlmap3d/main/model/LinkList.js';
|
||||
import {RailList} from '@/jlmap3d/main/model/RailList.js';
|
||||
|
||||
import {TrainListN} from '@/jlmap3d/main/newmodel/TrainListN.js';
|
||||
import {SectionListN} from '@/jlmap3d/main/newmodel/SectionListN';
|
||||
@ -52,8 +45,6 @@ export function MaintainerLoad(data,scope,netdata,mapdata,camera,controls,scene)
|
||||
|
||||
let mapdata = data;
|
||||
//初始化轨道和道岔
|
||||
// lengthfact(data);
|
||||
|
||||
// linklist = new LinkList();
|
||||
sectionlist = new SectionListN();
|
||||
signallist = new SignalListN();
|
||||
@ -177,39 +168,3 @@ export function MaintainerLoad(data,scope,netdata,mapdata,camera,controls,scene)
|
||||
|
||||
|
||||
}
|
||||
|
||||
function lengthfact(data){
|
||||
let linklist = [];
|
||||
//console.log(data);
|
||||
for(let i=0;i<data.linkList.length;i++){
|
||||
|
||||
let dx = Math.abs(data.linkList[i].lp.x - data.linkList[i].rp.x);
|
||||
let dy = Math.abs(data.linkList[i].lp.y - data.linkList[i].rp.y);
|
||||
let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
|
||||
|
||||
let link = {
|
||||
code:data.linkList[i].code,
|
||||
lengthfact:data.linkList[i].lengthFact,
|
||||
distance:distance
|
||||
};
|
||||
linklist.push(link);
|
||||
}
|
||||
|
||||
let sectionlist = [];
|
||||
for(let i=0;i<data.sectionList.length;i++){
|
||||
for(let j=0;j<linklist.length;j++){
|
||||
if(linklist[j].code == data.sectionList[i].linkCode){
|
||||
let sectionoffset = data.sectionList[i].offsetRight - data.sectionList[i].offsetLeft;
|
||||
let sectionlengthfact = sectionoffset/linklist[j].distance*linklist[j].lengthfact
|
||||
let section = {
|
||||
code:data.sectionList[i].code,
|
||||
lengthfact:sectionoffset
|
||||
};
|
||||
sectionlist.push(section);
|
||||
j = linklist.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(sectionlist);
|
||||
}
|
||||
|
@ -1,854 +0,0 @@
|
||||
import { Staticmodel } from '@/jlmap3d/jl3dpassflow/config.js';
|
||||
//loader
|
||||
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
||||
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
|
||||
import { ModelManager } from '@/jlmap3d/jl3dpassflow/loader.js';
|
||||
import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js';
|
||||
import StompClient from '@/utils/sock';
|
||||
import { Loading } from 'element-ui';
|
||||
var clock = new THREE.Clock();
|
||||
let scene,camerass,renderer;
|
||||
let rendermode = 0;
|
||||
|
||||
var mixers = [];
|
||||
var testmesh1,testmesh2;
|
||||
var humans = [];
|
||||
var checkdoor1 = [];
|
||||
var checkdoor2 = [];
|
||||
var station;
|
||||
var zhajiinmodel;
|
||||
var zhajioutmodel;
|
||||
var monitor;
|
||||
let ids = 0;
|
||||
var rungroup = new THREE.Group();
|
||||
let originhuman1 = null;
|
||||
let originhuman2 = null;
|
||||
let originanima1 = null;
|
||||
let originanima2 = null;
|
||||
let lefttrain = null;
|
||||
let righttrain = null;
|
||||
let moveanimatelist = [];
|
||||
|
||||
let zhajiin = [];
|
||||
let zhajiout = [];
|
||||
|
||||
let deviceaction = [];
|
||||
|
||||
for(let i=0;i<5;i++){
|
||||
checkdoor1[i]={
|
||||
id:"c1"+i,
|
||||
status:0,
|
||||
pos:[],
|
||||
max:10
|
||||
};
|
||||
}
|
||||
|
||||
for(let i=0;i<5;i++){
|
||||
let zhaji = {
|
||||
id:"in0"+(i+1),
|
||||
status:0,
|
||||
waiting:0
|
||||
}
|
||||
zhajiin.push(zhaji);
|
||||
}
|
||||
|
||||
for(let i=0;i<5;i++){
|
||||
let zhaji = {
|
||||
id:"out0"+(i+1),
|
||||
status:0,
|
||||
waiting:0
|
||||
}
|
||||
zhajiout.push(zhaji);
|
||||
}
|
||||
|
||||
let stationleft = [];
|
||||
let stationright = [];
|
||||
|
||||
for(let i=0;i<22;i++){
|
||||
let sl = {
|
||||
id:"left"+i,
|
||||
status:0,
|
||||
waiting:0
|
||||
}
|
||||
stationleft.push(sl);
|
||||
}
|
||||
|
||||
for(let i=0;i<22;i++){
|
||||
let sr = {
|
||||
id:"right"+i,
|
||||
status:0,
|
||||
waiting:0
|
||||
}
|
||||
stationright.push(sr);
|
||||
}
|
||||
|
||||
var windowWidth = window.innerWidth ;
|
||||
var windowHeight = window.innerHeight;
|
||||
var views = [
|
||||
{
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
width: 0.5,
|
||||
height: 0.5,
|
||||
background: new THREE.Color( 0.5, 0.5, 0.7 ),
|
||||
eye: [ 3.7, 16, 26 ],
|
||||
up: [3.7, 10 ,16 ],
|
||||
fov: 30
|
||||
},
|
||||
{
|
||||
left: 0,
|
||||
bottom: 0.5,
|
||||
width: 0.5,
|
||||
height: 0.5,
|
||||
background: new THREE.Color( 0.5, 0.5, 0.7 ),
|
||||
eye: [ 3.7,17,-4 ],
|
||||
up: [ 3.7, 10 ,16],
|
||||
fov: 30
|
||||
},
|
||||
{
|
||||
left: 0.5,
|
||||
bottom: 0,
|
||||
width: 0.5,
|
||||
height: 0.5,
|
||||
background: new THREE.Color( 0.7, 0.5, 0.5 ),
|
||||
eye: [ -60, 6,11],
|
||||
up: [ -59, 5.9,11 ],
|
||||
fov: 45
|
||||
},
|
||||
{
|
||||
left: 0.5,
|
||||
bottom: 0.5,
|
||||
width: 0.5,
|
||||
height: 0.5,
|
||||
background: new THREE.Color( 0.5, 0.7, 0.7 ),
|
||||
eye: [ -7,17,2],
|
||||
up: [-7, 10, 8],
|
||||
fov: 60
|
||||
}
|
||||
];
|
||||
|
||||
export function Jl3dpassflow(dom) {
|
||||
var scope = this;
|
||||
|
||||
this.dom = dom;
|
||||
this.nowcode = null;
|
||||
this.animateswitch = false;
|
||||
this.signallights = [];
|
||||
this.mixers = [];
|
||||
this.showmodel = null;
|
||||
//初始化webgl渲染
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
|
||||
renderer.setClearColor(new THREE.Color(0x000000));
|
||||
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
|
||||
|
||||
this.dom.appendChild(renderer.domElement);
|
||||
|
||||
//定义相机
|
||||
|
||||
camerass = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000);
|
||||
camerass.position.set(0, 80, 40);
|
||||
camerass.aspect = dom.offsetWidth / dom.offsetHeight;
|
||||
camerass.updateProjectionMatrix();
|
||||
|
||||
for ( var ii = 0; ii < views.length; ++ ii ) {
|
||||
|
||||
var view = views[ ii ];
|
||||
var camera = new THREE.PerspectiveCamera( view.fov, window.innerWidth / window.innerHeight, 1, 200 );
|
||||
camera.position.fromArray( view.eye );
|
||||
camera.lookAt( view.up[0],view.up[1],view.up[2] );
|
||||
view.camera = camera;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//定义场景(渲染容器)
|
||||
scene = new THREE.Scene();
|
||||
scene.background = new THREE.Color(0xa0a0a0);
|
||||
|
||||
var mesh = new THREE.Mesh(new THREE.PlaneBufferGeometry(200, 200), new THREE.MeshPhongMaterial({ color: 0x999999, depthWrite: false }));
|
||||
mesh.rotation.x = - Math.PI / 2;
|
||||
mesh.receiveShadow = true;
|
||||
scene.add(mesh);
|
||||
|
||||
var grid = new THREE.GridHelper(200, 20, 0x000000, 0x000000);
|
||||
grid.material.opacity = 0.2;
|
||||
grid.material.transparent = true;
|
||||
scene.add(grid);
|
||||
|
||||
|
||||
//定义全局光
|
||||
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
|
||||
scene.add(ambientLight);
|
||||
|
||||
//
|
||||
// var spotLight = new THREE.SpotLight(0xffffff);
|
||||
// spotLight.position.set(-50, 60, 15);
|
||||
// spotLight.castShadow = true;
|
||||
// spotLight.shadow.mapSize.width = 1024;
|
||||
// spotLight.shadow.mapSize.height = 1024;
|
||||
// scene.add(spotLight);
|
||||
|
||||
|
||||
|
||||
this.controls = new THREE.OrbitControls(camerass, dom);
|
||||
this.controls.maxPolarAngle = Math.PI / 2;
|
||||
this.controls.minPolarangle = Math.PI / 5;
|
||||
this.controls.maxDistance = 800;
|
||||
this.controls.screenSpacePanning = true;
|
||||
this.controls.update();
|
||||
this.selectmodel = null;
|
||||
|
||||
window.onresize = function () {
|
||||
|
||||
renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
|
||||
windowWidth = scope.dom.offsetWidth ;
|
||||
windowHeight = scope.dom.offsetHeight;
|
||||
|
||||
camerass.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
|
||||
camerass.updateProjectionMatrix();
|
||||
}
|
||||
|
||||
this.anime = null;
|
||||
|
||||
this.modelmanager = new ModelManager();
|
||||
let loadingInstance = Loading.service({ fullscreen: true });
|
||||
this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
|
||||
// console.log(scope.modelmanager);
|
||||
initstationanimation(scope.modelmanager.station.mesh);
|
||||
initzhajiinaimation(scope.modelmanager.zhajiin.mesh);
|
||||
initzhajioutanimation(scope.modelmanager.zhajiout.mesh);
|
||||
monitor = scope.modelmanager.monitor.mesh;
|
||||
scene.add(monitor);
|
||||
originhuman1 = scope.modelmanager.man1.mesh;
|
||||
originhuman2 = scope.modelmanager.man2.mesh;
|
||||
let mixer1 = new THREE.AnimationMixer( originhuman1 );
|
||||
let mixer2 = new THREE.AnimationMixer( originhuman2 );
|
||||
originanima1 = originhuman1.animations[ 0 ];
|
||||
originanima2 = originhuman2.animations[ 0 ];
|
||||
originhuman1.remove(originhuman1.children[2]);
|
||||
scene.add(rungroup);
|
||||
loadingInstance.close();
|
||||
|
||||
scope.switchrender(false);
|
||||
|
||||
animate();
|
||||
})
|
||||
|
||||
let checkobject = setInterval(function(){
|
||||
// console.log(originhuman1);
|
||||
if(originhuman1){
|
||||
console.log("start");
|
||||
clearInterval(checkobject);
|
||||
//进站控制
|
||||
setInterval(function(){
|
||||
// console.log("ww");
|
||||
// console.log(humans.length);
|
||||
if(humans){
|
||||
// console.log(humans.length);
|
||||
if(humans.length<500){
|
||||
newhumancreate();
|
||||
}
|
||||
// console.log(humans.length);
|
||||
for(let i=0;i<humans.length;i++){
|
||||
// console.log(humans[i]);
|
||||
|
||||
if(humans[i].status == 0){
|
||||
|
||||
if(humans[i].stage == 1){
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
|
||||
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z-5));
|
||||
zhajicontrol("in",humans[i].doors);
|
||||
moveanimateinit(humans[i],i,points,i,0.02);
|
||||
}
|
||||
if(humans[i].stage == 2){
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
|
||||
points.push(new THREE.Vector3(12,10,12.9));
|
||||
points.push(new THREE.Vector3(28,1.7,12.9));
|
||||
points.push(new THREE.Vector3(34,1.7,12.9));
|
||||
|
||||
//1--left
|
||||
//2-- right
|
||||
if(humans[i].direct == 1){
|
||||
points.push(new THREE.Vector3(34,1.7,16));
|
||||
for(let j =0;j<22;j++){
|
||||
if(stationleft[j].waiting == 0){
|
||||
|
||||
points.push(new THREE.Vector3(51-j*5,1.7,22));
|
||||
|
||||
points.push(new THREE.Vector3(51-j*5,1.7,23));
|
||||
|
||||
humans[i].doors = j;
|
||||
stationright[j].waiting = 1;
|
||||
moveanimateinit(humans[i],i,points,i,0.002);
|
||||
j =22;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
points.push(new THREE.Vector3(34,1.7,16));
|
||||
points.push(new THREE.Vector3(14,1.7,17));
|
||||
points.push(new THREE.Vector3(14,1.7,3));
|
||||
for(let j =0;j<22;j++){
|
||||
if(stationright[j].waiting == 0){
|
||||
|
||||
points.push(new THREE.Vector3(51-j*5,1.7,3));
|
||||
|
||||
points.push(new THREE.Vector3(51-j*5,1.7,2));
|
||||
humans[i].doors = j;
|
||||
stationright[j].waiting = 1;
|
||||
moveanimateinit(humans[i],i,points,i,0.002);
|
||||
j =22;
|
||||
}
|
||||
}
|
||||
}
|
||||
moveanimateinit(humans[i],i,points,i,0.002);
|
||||
}
|
||||
//出站
|
||||
if(humans[i].stage == 3){
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
|
||||
if(humans[i].doors<11){
|
||||
if(humans[i].direct == 1){
|
||||
points.push(new THREE.Vector3(10,1.7,17));
|
||||
}else{
|
||||
points.push(new THREE.Vector3(8,1.7,5));
|
||||
}
|
||||
points.push(new THREE.Vector3(8,1.7,13));
|
||||
points.push(new THREE.Vector3(5,1.7,13));
|
||||
points.push(new THREE.Vector3(-4,6,13));
|
||||
}else{
|
||||
if(humans[i].direct == 1){
|
||||
points.push(new THREE.Vector3(-19,1.7,17));
|
||||
}else{
|
||||
points.push(new THREE.Vector3(-18,1.7,6.4));
|
||||
}
|
||||
points.push(new THREE.Vector3(-18,1.7,13));
|
||||
points.push(new THREE.Vector3(-12,1.7,13));
|
||||
points.push(new THREE.Vector3(-7,6.8,12));
|
||||
}
|
||||
points.push(new THREE.Vector3(-5,10,4));
|
||||
points.push(new THREE.Vector3(14,10,3));
|
||||
var j = Math.floor(Math.random()*(4-1+1))+1;
|
||||
points.push(new THREE.Vector3(19,10,-2+j*1.4));
|
||||
|
||||
humans[i].doors = j;
|
||||
moveanimateinit(humans[i],i,points,i,0.002);
|
||||
}
|
||||
if(humans[i].stage == 4){
|
||||
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
|
||||
|
||||
points.push(new THREE.Vector3(humans[i].mesh.position.x+4,humans[i].mesh.position.y,humans[i].mesh.position.z));
|
||||
|
||||
if(humans[i].direct == 1){
|
||||
points.push(new THREE.Vector3(33,10,25));
|
||||
}else{
|
||||
points.push(new THREE.Vector3(33.5,10,-5));
|
||||
}
|
||||
zhajicontrol("out",humans[i].doors);
|
||||
moveanimateinit(humans[i],i,points,i,0.002);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},1000);
|
||||
};
|
||||
},1000);
|
||||
|
||||
this.switchrender = function(mode){
|
||||
if(mode){
|
||||
rendermode = 0;
|
||||
renderer.setViewport( 0, 0, scope.dom.offsetWidth, scope.dom.offsetHeight );
|
||||
renderer.setScissor( 0, 0, scope.dom.offsetWidth, scope.dom.offsetHeight );
|
||||
renderer.setScissorTest( false );
|
||||
renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
|
||||
camerass.aspect = dom.offsetWidth / dom.offsetHeight;
|
||||
camerass.updateProjectionMatrix();
|
||||
}else{
|
||||
rendermode = 1;
|
||||
}
|
||||
}
|
||||
//循环渲染函数
|
||||
function animate() {
|
||||
// console.log(rendermode);
|
||||
if(rendermode == 0){
|
||||
renderer.render(scene, camerass);
|
||||
scope.controls.update();
|
||||
}else{
|
||||
monitorrender();
|
||||
}
|
||||
|
||||
let delta = clock.getDelta();
|
||||
|
||||
for(let i=mixers.length-1;i>=0;i--){
|
||||
if ( mixers[i] && mixers[i].runplay == true){
|
||||
mixers[i].update( delta );
|
||||
}
|
||||
}
|
||||
moveanimateupdate();
|
||||
|
||||
requestAnimationFrame(animate);
|
||||
|
||||
}
|
||||
|
||||
function moveanimateinit(model,name,points,index,speed){
|
||||
|
||||
let curve = new THREE.CatmullRomCurve3(points);
|
||||
curve.curvrtype = "chordal";
|
||||
// curve动画轨迹
|
||||
// progress动画进度
|
||||
// enable当前动画开关
|
||||
// speed动画速度
|
||||
|
||||
let animate = {
|
||||
name:index,
|
||||
index:index,
|
||||
curve:curve,
|
||||
progress:0,
|
||||
directchange:false,
|
||||
enable:true,
|
||||
status:"start",
|
||||
speed:speed,
|
||||
};
|
||||
humans[index].runrail = animate;
|
||||
humans[index].status = 1;
|
||||
humans[index].action.play();
|
||||
humans[index].mixer.runplay = true;
|
||||
moveanimatelist.push(animate);
|
||||
}
|
||||
|
||||
function moveanimateupdate(){
|
||||
if(humans.length>0){
|
||||
for(let i=0;i<humans.length;i++){
|
||||
if(humans[i].runrail.enable){
|
||||
// 动画播放结束
|
||||
if(humans[i].runrail.progress>=1){
|
||||
// let point = humans[i].runrail.curve.getPointAt(1);
|
||||
//更新模型坐标
|
||||
// console.log(moveanimatelist);
|
||||
if(humans[i].status == 1){
|
||||
humans[i].runrail.enable = false;
|
||||
humans[i].runrail.progress = 1;
|
||||
humans[i].mixer.runplay = false;
|
||||
humans[i].action.stop();
|
||||
humans[i].status = 0;
|
||||
|
||||
if(humans[i].stage == 4){
|
||||
|
||||
rungroup.remove(humans[i].mesh);
|
||||
// humans.splice(i,1);
|
||||
}
|
||||
|
||||
if(humans[i].stage == 3){
|
||||
|
||||
if(humans[i].direct == 1){
|
||||
|
||||
stationleft[humans[i].doors].waiting = 0;
|
||||
}else{
|
||||
|
||||
stationright[humans[i].doors].waiting = 0;
|
||||
}
|
||||
humans[i].stage = 4;
|
||||
|
||||
}
|
||||
|
||||
if(humans[i].stage == 2){
|
||||
humans[i].stage = 3;
|
||||
|
||||
}
|
||||
|
||||
if(humans[i].stage == 1){
|
||||
|
||||
|
||||
humans[i].stage = 2;
|
||||
|
||||
}
|
||||
|
||||
if(humans[i].stage == 0){
|
||||
// console.log(humans[i].doors);
|
||||
zhajiin[humans[i].doors].waiting = 0;
|
||||
humans[i].stage = 1;
|
||||
}
|
||||
|
||||
moveanimatelist.splice(i,1);
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
//根据动画进度获取动画轨迹上点
|
||||
|
||||
let point = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress);
|
||||
|
||||
//更新模型坐标
|
||||
humans[i].mesh.position.x = point.x;
|
||||
humans[i].mesh.position.y = point.y;
|
||||
humans[i].mesh.position.z = point.z;
|
||||
if((humans[i].runrail.progress+0.001)<1){
|
||||
let tangent = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress+0.001);
|
||||
humans[i].mesh.lookAt(new THREE.Vector3(tangent.x,humans[i].mesh.position.y,tangent.z));
|
||||
}
|
||||
|
||||
humans[i].runrail.progress += humans[i].runrail.speed;
|
||||
point = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function newhumancreate(){
|
||||
var direct = Math.floor(Math.random()*(3-1+1))+1;
|
||||
var mantype = Math.floor(Math.random()*(3-1+1))+1;
|
||||
// console.log(direct);
|
||||
let points = [];
|
||||
let newhuman;
|
||||
if(mantype == 1){
|
||||
newhuman = THREE.SkeletonUtils.clone( originhuman1 );
|
||||
newhuman.animations = [];
|
||||
newhuman.animations.push(originanima1.clone());
|
||||
}else{
|
||||
newhuman = THREE.SkeletonUtils.clone( originhuman2 );
|
||||
newhuman.animations = [];
|
||||
newhuman.animations.push(originanima2.clone());
|
||||
}
|
||||
if(direct == 1|| direct == 2){
|
||||
newhuman.position.set(32,10,25);
|
||||
points.push(new THREE.Vector3(32,10,25));
|
||||
points.push(new THREE.Vector3(26,10,21));
|
||||
points.push(new THREE.Vector3(18,10,18));
|
||||
}else{
|
||||
newhuman.position.set(32,10,-5);
|
||||
points.push(new THREE.Vector3(32,10,-5));
|
||||
points.push(new THREE.Vector3(26,10,12));
|
||||
points.push(new THREE.Vector3(24,10,17));
|
||||
points.push(new THREE.Vector3(18,10,18));
|
||||
}
|
||||
|
||||
let j = Math.floor(Math.random()*(4-1+1))+1;
|
||||
points.push(new THREE.Vector3(-0.5+j*1.4,10,18.5));
|
||||
// zhajiin[j].waiting = 1;
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newhuman );
|
||||
mixer.runplay = false;
|
||||
let action = mixer.clipAction( newhuman.animations[ 0 ] );
|
||||
|
||||
var stationdirection = Math.floor(Math.random()*(2-1+1))+1;
|
||||
let newone = {
|
||||
id:humans.length,
|
||||
mesh:newhuman,
|
||||
status:1,
|
||||
stage:0,
|
||||
direct:stationdirection,
|
||||
doorstatus:null,
|
||||
doors:j,
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
runrail:null
|
||||
};
|
||||
|
||||
humans.push(newone);
|
||||
mixers.push(mixer);
|
||||
rungroup.add(newhuman);
|
||||
|
||||
|
||||
moveanimateinit(newone,humans.length,points,newone.id,0.002);
|
||||
|
||||
// return newone;
|
||||
}
|
||||
|
||||
function initstationanimation(object){
|
||||
let mixer = new THREE.AnimationMixer( object );
|
||||
|
||||
let newclip = object.animations[ 0 ];
|
||||
for(let j=0;j<object.children.length;j++){
|
||||
|
||||
if(object.children[j].name == "top"){
|
||||
object.children[j].animations = [];
|
||||
object.children[j].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( object.children[j] );
|
||||
|
||||
let action =mixer.clipAction( object.children[j].animations[0])
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
// action.play();
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[j].name] = device;
|
||||
}
|
||||
if(object.children[j].name == "down"){
|
||||
object.children[j].animations = [];
|
||||
object.children[j].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( object.children[j] );
|
||||
|
||||
|
||||
let action =mixer.clipAction( object.children[j].animations[0])
|
||||
// action.play();
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[j].name] = device;
|
||||
}
|
||||
}
|
||||
station = object;
|
||||
scene.add(object);
|
||||
|
||||
}
|
||||
|
||||
function initzhajiinaimation(object){
|
||||
let mixer = new THREE.AnimationMixer( object );
|
||||
let newclip = object.animations[ 0 ];
|
||||
let newzhaji = object;
|
||||
for(let i=0;i<newzhaji.children.length;i++){
|
||||
if(newzhaji.children[i].name == "in01"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "in02"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "in03"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "in04"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "in05"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
|
||||
}
|
||||
zhajiinmodel = newzhaji;
|
||||
scene.add(newzhaji);
|
||||
|
||||
}
|
||||
|
||||
function initzhajioutanimation(object){
|
||||
let mixer = new THREE.AnimationMixer( object );
|
||||
let newclip = object.animations[ 0 ];
|
||||
let newzhaji = object;
|
||||
for(let i=0;i<newzhaji.children.length;i++){
|
||||
|
||||
if(newzhaji.children[i].name == "out01"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "out02"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "out03"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "out04"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "out05"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixer.runplay = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
|
||||
}
|
||||
zhajioutmodel = newzhaji
|
||||
scene.add(newzhaji);
|
||||
}
|
||||
|
||||
function zhajicontrol(type,door){
|
||||
|
||||
let devicenum = door-1;
|
||||
if(type == "in"){
|
||||
deviceaction[zhajiin[devicenum].id].action.reset();
|
||||
deviceaction[zhajiin[devicenum].id].action.time = 0;
|
||||
deviceaction[zhajiin[devicenum].id].action.timeScale = 1;
|
||||
deviceaction[zhajiin[devicenum].id].action.play();
|
||||
}else if(type == "out"){
|
||||
deviceaction[zhajiout[devicenum].id].action.reset();
|
||||
deviceaction[zhajiout[devicenum].id].action.time = 0;
|
||||
deviceaction[zhajiout[devicenum].id].action.timeScale = 1;
|
||||
deviceaction[zhajiout[devicenum].id].action.play();
|
||||
}
|
||||
|
||||
}
|
||||
function monitorrender() {
|
||||
|
||||
// updateSize();
|
||||
|
||||
for ( var ii = 0; ii < views.length; ++ ii ) {
|
||||
|
||||
var view = views[ ii ];
|
||||
var camera = view.camera;
|
||||
|
||||
// view.updateCamera( camera, scene, mouseX, mouseY );
|
||||
|
||||
var left = Math.floor( windowWidth * view.left );
|
||||
var bottom = Math.floor( windowHeight * view.bottom );
|
||||
var width = Math.floor( windowWidth * view.width );
|
||||
var height = Math.floor( windowHeight * view.height );
|
||||
|
||||
renderer.setViewport( left, bottom, width, height );
|
||||
renderer.setScissor( left, bottom, width, height );
|
||||
renderer.setScissorTest( true );
|
||||
|
||||
camera.aspect = width / height;
|
||||
camera.updateProjectionMatrix();
|
||||
|
||||
renderer.render( scene, camera );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,744 +0,0 @@
|
||||
import StompClient from '@/utils/sock';
|
||||
|
||||
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
||||
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
|
||||
import { getBaseUrl } from '@/utils/baseUrl'
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
// 定于仿真socket接口
|
||||
export function Jlmap3dSubscribe(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
const scope = this;
|
||||
this.map = null;
|
||||
|
||||
var trainlisttest = null;
|
||||
var sectionlist = null;
|
||||
var signallist = null;
|
||||
var stationstandlist = null;
|
||||
var sectionlist = null;
|
||||
var materials = null;
|
||||
var actions = null;
|
||||
var rails = null;
|
||||
var links = null;
|
||||
|
||||
var scenes = null;
|
||||
|
||||
var code = null;
|
||||
|
||||
var drivingcode = null;
|
||||
var drivingspeed = null;
|
||||
var drivingaptspeed = null;
|
||||
|
||||
let driverswitch = false;
|
||||
|
||||
let stoptimer = null;
|
||||
let num = 30;
|
||||
let pointstand = null;
|
||||
|
||||
let data = null;
|
||||
// run as plane = 01;
|
||||
// reset = 02;
|
||||
|
||||
var datatype = '00';
|
||||
this.teststomp = new StompClient();
|
||||
this.topic = '/user/queue/simulation/jl3d/'+routegroup;
|
||||
let header = {'X-Token': getToken() };
|
||||
let connectmsg = {
|
||||
type:'init',
|
||||
baseurl:getBaseUrl(),
|
||||
topic:this.topic,
|
||||
token:getToken(),
|
||||
};
|
||||
jsonwebwork.postMessage(connectmsg);
|
||||
jsonwebwork.onmessage = function (event) {
|
||||
// console.log(event.data);
|
||||
// if(event.data.type == 'Simulation_Driver_Change'){
|
||||
// drivingcode = event.data.body.code;
|
||||
// jlmap3d.updatedrivingcode( event.data.body.code);
|
||||
// }
|
||||
// if(data.type == 'Simulation_TrainSpeed'){
|
||||
// trainspeed(data);
|
||||
// }
|
||||
// console.log(event);
|
||||
// if(event.data.type == 'SJL3D_TrainStatus'){
|
||||
// trainstatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_DeviceStatus'){
|
||||
// devicestatus(event.data);
|
||||
// }
|
||||
// console.log(data);
|
||||
if(event.data._type == 'Simulation_Driver_Change'){
|
||||
drivingcode = event.data.body.code;
|
||||
jlmap3d.updatedrivingcode( event.data.body.code);
|
||||
}
|
||||
if(event.data._type == 'Train'){
|
||||
trainstatus(event.data);
|
||||
}
|
||||
if (event.data._type== 'Signal' && signallist) {
|
||||
// console.log(event.data);
|
||||
signalupdate(event.data);
|
||||
}
|
||||
|
||||
if (event.data._type== 'StationStand' && actions) {
|
||||
// console.log(event.data);
|
||||
standupdate(event.data);
|
||||
}
|
||||
|
||||
if (event.data._type == 'Switch' && sectionlist) {
|
||||
// console.log(event.data);
|
||||
switchupdate(event.data);
|
||||
}
|
||||
// if(event.data._type = ''){
|
||||
// trainstatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_DeviceStatus'){
|
||||
// devicestatus(event.data);
|
||||
// }
|
||||
if(event.data.type == 'Simulation_Reset'){
|
||||
simulationreset(event.data);
|
||||
}
|
||||
};
|
||||
|
||||
// jsonwebwork.onmessage = function (event) {
|
||||
// console.log(event.data);
|
||||
// if(event.data.type == 'Simulation_Driver_Change'){
|
||||
// drivingcode = event.data.body.code;
|
||||
// jlmap3d.updatedrivingcode( event.data.body.code);
|
||||
// }
|
||||
// // if(event.data.type == 'Simulation_TrainSpeed'){
|
||||
// // trainspeed(event.data);
|
||||
// // }
|
||||
// if(event.data.type == 'SJL3D_TrainStatus'){
|
||||
// trainstatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_DeviceStatus'){
|
||||
// devicestatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_Reset'){
|
||||
// simulationreset(event.data);
|
||||
// }
|
||||
// };
|
||||
|
||||
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails, materiallist, nowaction, scene) {
|
||||
// console.log(mapdata);
|
||||
|
||||
trainlisttest = newtrainlisttest;
|
||||
sectionlist = newsectionlist;
|
||||
signallist = newsignallist;
|
||||
stationstandlist = newstationstandlist;
|
||||
materials = materiallist;
|
||||
scenes = scene;
|
||||
actions = nowaction;
|
||||
links = newlinklist;
|
||||
rails = newrails;
|
||||
|
||||
};
|
||||
|
||||
this.socketon = function(topic) {
|
||||
try {
|
||||
// console.log("teststomp");
|
||||
// scope.teststomp.subscribe(topic, callback, header);
|
||||
} catch (error) {
|
||||
console.error('websocket订阅失败');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.socketoff = function(topic) {
|
||||
scope.teststomp.unsubscribe(topic);
|
||||
for (let i=0; i<trainlisttest.group.children.length; i++) {
|
||||
if (trainlisttest.group.children[i].dispose == false) {
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.group.children[i].dispose = true;
|
||||
trainlisttest.group.children[i].position.x = -50000;
|
||||
trainlisttest.group.children[i].position.y = -50000;
|
||||
|
||||
trainlisttest.group.remove(trainlisttest.group.children[i]);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 仿真socket接口回调函数
|
||||
function callback(Response) {
|
||||
|
||||
}
|
||||
|
||||
function trainspeed(data){
|
||||
if (trainlisttest) {
|
||||
|
||||
for (let tl = 0; tl<data.body.length; tl++) {
|
||||
code = data.body[tl].id;
|
||||
if(trainlisttest.list[code].speed != data.body[tl].v){
|
||||
trainlisttest.list[code].speed = data.body[tl].v;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/18/trainlisttest.list[code].len);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function trainstatus(data){
|
||||
// for (let i=data.body.length-1; i>=0; i--) {
|
||||
// console.log(data.body[i]);
|
||||
|
||||
// console.log(data);
|
||||
// 遍历列车对象组
|
||||
if (trainlisttest) {
|
||||
code = data.code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
|
||||
|
||||
if ( trainlisttest.list[code]) {
|
||||
|
||||
trainlisttest.list[code].runMode = data.runMode;
|
||||
// 车门开关验证
|
||||
// if(data.directionType == "02"){
|
||||
if (trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == '01') {
|
||||
// console.log("close");
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
for (let an=actions[code].top.length-1; an>=0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = -1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == '02') {
|
||||
// console.log("open");
|
||||
trainlisttest.list[code].doorStatus = '02';
|
||||
for (let an=actions[code].top.length-1; an>=0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
// if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "01"){
|
||||
// //console.log("close");
|
||||
// trainlisttest.list[code].doorStatus = "01";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
|
||||
// actions[code].down[an].timeScale = -1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }else if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "02"){
|
||||
// //console.log("open");
|
||||
// trainlisttest.list[code].doorStatus = "02";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = 0;
|
||||
// actions[code].down[an].timeScale = 1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 遍历获取所在轨道
|
||||
if (trainlisttest.list[code].dispose != data.dispose && data.dispose == false) {
|
||||
|
||||
if (rails.linkrail[data.linkCode]) {
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
// trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].dispose = false;
|
||||
trainlisttest.list[code].nowcode = data.linkCode;
|
||||
trainlisttest.list[code].nextcode = null;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
|
||||
if(trainlisttest.list[code].mixerpush == false){
|
||||
for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi<lenmi;mi++){
|
||||
jlmap3d.mixers.push(trainlisttest.list[code].mixer[mi]);
|
||||
}
|
||||
trainlisttest.list[code].mixerpush = true;
|
||||
// console.log(trainlisttest.list[code].mixerpush);
|
||||
}
|
||||
|
||||
if (data.directionType == '02') { // 向右
|
||||
|
||||
|
||||
if(data.targetStation){
|
||||
trainlisttest.list[code].stopstation = data.targetStation;
|
||||
// console.log(rails.stops[data.targetStation].direct2.percent);
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct2.percent;
|
||||
trainlisttest.list[code].progress = data.linkOffsetPercent/trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.targetLink;
|
||||
// console.log(data.targetLinkPercent);
|
||||
// console.log(rails.stops[data.targetStation].direct2.percent);
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
// console.log("===================");
|
||||
let point = rails.linkrail[data.linkCode].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
|
||||
}else{
|
||||
trainlisttest.list[code].progress = data.linkOffsetPercent/trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
let point = rails.linkrail[data.linkCode].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineleft;
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '02';
|
||||
} else if (data.directionType == '03') { // 向左
|
||||
|
||||
// if(trainlisttest.list[code].rname == "006"){
|
||||
// console.log("0000000000000000");
|
||||
// console.log(data.linkOffsetPercent);
|
||||
// }
|
||||
if(data.targetStation){
|
||||
|
||||
trainlisttest.list[code].stopstation = data.targetStation;
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct1.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct1.percent;
|
||||
trainlisttest.list[code].progress = 1-(data.linkOffsetPercent/trainlisttest.list[code].pc);
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.targetLink;
|
||||
// console.log(data.targetLinkPercent);
|
||||
// console.log(rails.stops[data.targetStation].direct1.percent);
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
// console.log("===================");
|
||||
let point = rails.linkrail[data.linkCode].lineright.getPointAt(trainlisttest.list[code].progress);
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -point.z;
|
||||
}
|
||||
}else{
|
||||
trainlisttest.list[code].progress = data.linkOffsetPercent/trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
let point = rails.linkrail[data.linkCode].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineright;
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '03';
|
||||
|
||||
// trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineright;
|
||||
}
|
||||
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
// trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.sectionCode].isStandTrack;
|
||||
|
||||
// trainlisttest.list[code].len = sectionlist.sections.datalist[data.sectionCode].distance;
|
||||
|
||||
if(trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode){
|
||||
trainlisttest.list[code].statsstop = 0;
|
||||
}else{
|
||||
trainlisttest.list[code].statsstop = 1;
|
||||
}
|
||||
if(data.speed == 0){
|
||||
trainlisttest.list[code].speeds = data.speed;
|
||||
trainlisttest.list[code].speeds = 0;
|
||||
// trainlisttest.list[code].startmark = 1;
|
||||
}else{
|
||||
trainlisttest.list[code].speeds = data.speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.speed*10/36/18/trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (trainlisttest.list[code].dispose != data.dispose && data.dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = true;
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.list[code].position.x = -50000;
|
||||
trainlisttest.list[code].position.y = -50000;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
|
||||
} else if (trainlisttest.list[code].dispose == data.dispose && data.dispose == false) {
|
||||
|
||||
// if(data.){
|
||||
//
|
||||
// }
|
||||
if (data.directionType == '02' && trainlisttest.list[code].status != data.directionType) { // 向右
|
||||
|
||||
|
||||
let rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
let rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
|
||||
trainlisttest.list[code].progress = (rotaposx-rails.linkrail[data.linkCode].lp.x)/rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineleft;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
|
||||
} else if (data.directionType == '03'&& trainlisttest.list[code].status != data.directionType) { // 向左
|
||||
|
||||
let rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
let rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -rotaposz;
|
||||
}
|
||||
trainlisttest.list[code].progress = 1-(rotaposx-rails.linkrail[data.linkCode].lp.x)/rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineright;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(trainlisttest.list[code].nextcode == null ){//&& trainlisttest.list[code].stopstation == data.targetStation
|
||||
// if(data.groupNumber == "016"){
|
||||
// console.log(trainlisttest.list[code].nextcode);
|
||||
// console.log(trainlisttest.list[code].stopstation);
|
||||
// console.log(data.targetStation);
|
||||
// console.log(data.body[i]);
|
||||
// console.log(trainlisttest.list[code]);
|
||||
// }
|
||||
// if(trainlisttest.list[code].targetLink != trainlisttest.list[code].nowcode){
|
||||
let nextcode;
|
||||
if(data.directionType == '02'){
|
||||
|
||||
trainlisttest.list[code].status = '02';
|
||||
// console.log(rails.linkrail[trainlisttest.list[code].nowcode]);
|
||||
|
||||
if(rails.linkrail[trainlisttest.list[code].nowcode]){
|
||||
nextcode = rails.linkrail[trainlisttest.list[code].nowcode].rconnect;
|
||||
}
|
||||
|
||||
if(nextcode){
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}else{
|
||||
|
||||
trainlisttest.list[code].nextlen = 0;
|
||||
}
|
||||
}else if(data.directionType == '03'){
|
||||
|
||||
trainlisttest.list[code].status = '03';
|
||||
if(rails.linkrail[trainlisttest.list[code].nowcode]){
|
||||
nextcode = rails.linkrail[trainlisttest.list[code].nowcode].lconnect;
|
||||
}
|
||||
if(nextcode){
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}else{
|
||||
|
||||
trainlisttest.list[code].nextlen = 0;
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].nextcode = nextcode;
|
||||
|
||||
// }
|
||||
|
||||
if(trainlisttest.list[code].curve == null){
|
||||
trainlisttest.list[code].len = trainlisttest.list[code].nextlen;
|
||||
trainlisttest.list[code].nowcode = trainlisttest.list[code].nextcode;
|
||||
trainlisttest.list[code].curve = trainlisttest.list[code].nextcurve;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
trainlisttest.list[code].nextlen = null;
|
||||
trainlisttest.list[code].nextcode = null;
|
||||
}
|
||||
}
|
||||
if(data.groupNumber == "016"){
|
||||
// console.log(data.targetLink);
|
||||
// console.log(trainlisttest.list[code].nowcode);
|
||||
//
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
// console.log("==============");
|
||||
}
|
||||
trainlisttest.list[code].targetLink = data.targetLink;
|
||||
if(trainlisttest.list[code].stopstation != data.targetStation){
|
||||
|
||||
if(data.directionType == '02'){
|
||||
if(data.targetStation){
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct2.percent;
|
||||
// trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
// trainlisttest.list[code].targetLink = data.targetLink;
|
||||
}
|
||||
|
||||
|
||||
trainlisttest.list[code].status = '02';
|
||||
}else if(data.directionType == '03'){
|
||||
if(data.targetStation){
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct1.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct1.percent;
|
||||
// trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
// trainlisttest.list[code].targetLink = data.targetLink;
|
||||
}
|
||||
|
||||
trainlisttest.list[code].status = '03';
|
||||
|
||||
}
|
||||
trainlisttest.list[code].stopstation = data.targetStation;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode){
|
||||
trainlisttest.list[code].statsstop = 0;
|
||||
}else{
|
||||
trainlisttest.list[code].statsstop = 1;
|
||||
}
|
||||
// console.log(data.body[i]);
|
||||
|
||||
if(trainlisttest.list[code].speed != data.speed){
|
||||
trainlisttest.list[code].speed = data.speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.speed*10/36/18/trainlisttest.list[code].len);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
function standupdate(data) {
|
||||
code = data.code;
|
||||
if ( actions[code]) {
|
||||
if (data.screenDoorOpenStatus == '02' && actions[code].status == '01') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.screenDoorOpenStatus == '02' && actions[code].status == '00') {
|
||||
actions[code].status = '02';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
|
||||
if (data.screenDoorOpenStatus == '01' && actions[code].status == '02') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.screenDoorOpenStatus == '01' && actions[code].status == '00') {
|
||||
actions[code].status = '01';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
function devicestatus(data){
|
||||
for (let i= 0,leni = data.body.length; i<leni; i++) {
|
||||
// 0xFFFFFF
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
|
||||
if (data._type == 'Signal' && signallist) {
|
||||
if (signallist) {
|
||||
// console.log(data.body[i]);
|
||||
signalupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data._type == 'StationStand' && actions) {
|
||||
if (actions) {
|
||||
standupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data._type == 'Switch' && sectionlist) {
|
||||
if (sectionlist) {
|
||||
switchupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
// console.log(data);
|
||||
if (data.lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.status = data.status;
|
||||
|
||||
// 55
|
||||
// 33
|
||||
// 77
|
||||
// 关闭
|
||||
if (data.status == '01') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[0];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 开放
|
||||
if (data.status == '02') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if (data.status == '03') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
// 引导
|
||||
if (data.status == '03') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[0];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 封锁
|
||||
if (data.status == '04') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 故障
|
||||
if (data.status == '05') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
if (data.status == '06') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (data.lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
for (let j=sectionlist.switchs.modellist.length-1; j>=0; j--) {
|
||||
if (rails.switchrail[code]) {
|
||||
if (rails.switchrail[code].locateType != data.locateType) {
|
||||
if (data.locateType == '02') {
|
||||
if (actions[sectionlist.switchs.modellist[j].code]) {
|
||||
sectionlist.switchs.modellist[j].locateType = data.locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = 0;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
}
|
||||
|
||||
rails.switchrail[code].locateType = "02";
|
||||
|
||||
let testswitch = rails.switchrail[code];
|
||||
// console.log(testswitch);
|
||||
// console.log(rails.linkrail[testswitch.alink]);
|
||||
// console.log(rails.linkrail[testswitch.clink]);
|
||||
if(rails.switchrail[code].directtype == "1"){
|
||||
rails.linkrail[testswitch.alink].lconnect = testswitch.clink;
|
||||
rails.linkrail[testswitch.clink].rconnect = testswitch.alink;
|
||||
}else if(rails.switchrail[code].directtype == "2"){
|
||||
rails.linkrail[testswitch.alink].rconnect = testswitch.clink;
|
||||
rails.linkrail[testswitch.clink].lconnect = testswitch.alink;
|
||||
}
|
||||
|
||||
} else if (data.locateType == '01') {
|
||||
if (actions[sectionlist.switchs.modellist[j].code]) {
|
||||
sectionlist.switchs.modellist[j].locateType = data.locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
}
|
||||
|
||||
rails.switchrail[code].locateType = "01";
|
||||
let testswitch = rails.switchrail[code];
|
||||
// console.log(testswitch);
|
||||
// console.log(rails.linkrail[testswitch.alink]);
|
||||
// console.log(rails.linkrail[testswitch.clink]);
|
||||
if(rails.switchrail[code].directtype == "1"){
|
||||
rails.linkrail[testswitch.alink].lconnect = testswitch.blink;
|
||||
rails.linkrail[testswitch.blink].rconnect = testswitch.alink;
|
||||
}else if(rails.switchrail[code].directtype == "2"){
|
||||
rails.linkrail[testswitch.alink].rconnect = testswitch.blink;
|
||||
rails.linkrail[testswitch.blink].lconnect = testswitch.alink;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
function simulationreset(data){
|
||||
for(let i=0;i<trainlisttest.group.children.length;i++){
|
||||
trainlisttest.group.children[i].dispose = true;
|
||||
trainlisttest.group.children[i].stopstation = null;
|
||||
trainlisttest.group.children[i].pc = null;
|
||||
trainlisttest.group.children[i].targetpercent = null;
|
||||
trainlisttest.group.children[i].progress = null;
|
||||
trainlisttest.group.children[i].linkOffsetPercent = null;
|
||||
trainlisttest.group.children[i].targetLink = null;
|
||||
trainlisttest.group.remove(trainlisttest.group.children[i]);
|
||||
i--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,744 +0,0 @@
|
||||
import StompClient from '@/utils/sock';
|
||||
|
||||
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
||||
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
|
||||
import { getBaseUrl } from '@/utils/baseUrl'
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
// 定于仿真socket接口
|
||||
export function Jlmap3dSubscribe(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
const scope = this;
|
||||
this.map = null;
|
||||
|
||||
var trainlisttest = null;
|
||||
var sectionlist = null;
|
||||
var signallist = null;
|
||||
var stationstandlist = null;
|
||||
var sectionlist = null;
|
||||
var materials = null;
|
||||
var actions = null;
|
||||
var rails = null;
|
||||
var links = null;
|
||||
|
||||
var scenes = null;
|
||||
|
||||
var code = null;
|
||||
|
||||
var drivingcode = null;
|
||||
var drivingspeed = null;
|
||||
var drivingaptspeed = null;
|
||||
|
||||
let driverswitch = false;
|
||||
|
||||
let stoptimer = null;
|
||||
let num = 30;
|
||||
let pointstand = null;
|
||||
|
||||
let data = null;
|
||||
// run as plane = 01;
|
||||
// reset = 02;
|
||||
|
||||
var datatype = '00';
|
||||
this.teststomp = new StompClient();
|
||||
this.topic = '/user/queue/simulation/jl3d/'+routegroup;
|
||||
let header = {'X-Token': getToken() };
|
||||
let connectmsg = {
|
||||
type:'init',
|
||||
baseurl:getBaseUrl(),
|
||||
topic:this.topic,
|
||||
token:getToken(),
|
||||
};
|
||||
jsonwebwork.postMessage(connectmsg);
|
||||
jsonwebwork.onmessage = function (event) {
|
||||
|
||||
// if(event.data.type == 'Simulation_Driver_Change'){
|
||||
// drivingcode = event.data.body.code;
|
||||
// jlmap3d.updatedrivingcode( event.data.body.code);
|
||||
// }
|
||||
// if(data.type == 'Simulation_TrainSpeed'){
|
||||
// trainspeed(data);
|
||||
// }
|
||||
// console.log(event);
|
||||
// if(event.data.type == 'SJL3D_TrainStatus'){
|
||||
// trainstatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_DeviceStatus'){
|
||||
// devicestatus(event.data);
|
||||
// }
|
||||
if(event.data._type == 'Simulation_Driver_Change'){
|
||||
drivingcode = event.data.body.code;
|
||||
jlmap3d.updatedrivingcode( event.data.body.code);
|
||||
}
|
||||
if(event.data._type == 'Train'){
|
||||
// console.log(event.data);
|
||||
trainstatus(event.data);
|
||||
}
|
||||
if (event.data._type== 'Signal' && signallist) {
|
||||
// console.log(event.data);
|
||||
signalupdate(event.data);
|
||||
}
|
||||
|
||||
if (event.data._type== 'StationStand' && actions) {
|
||||
// console.log(event.data);
|
||||
standupdate(event.data);
|
||||
}
|
||||
|
||||
if (event.data._type == 'Switch' && sectionlist) {
|
||||
// console.log(event.data);
|
||||
switchupdate(event.data);
|
||||
}
|
||||
// if(event.data._type = ''){
|
||||
// trainstatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_DeviceStatus'){
|
||||
// devicestatus(event.data);
|
||||
// }
|
||||
if(event.data.type == 'Simulation_Reset'){
|
||||
simulationreset(event.data);
|
||||
}
|
||||
};
|
||||
|
||||
// jsonwebwork.onmessage = function (event) {
|
||||
// console.log(event.data);
|
||||
// if(event.data.type == 'Simulation_Driver_Change'){
|
||||
// drivingcode = event.data.body.code;
|
||||
// jlmap3d.updatedrivingcode( event.data.body.code);
|
||||
// }
|
||||
// // if(event.data.type == 'Simulation_TrainSpeed'){
|
||||
// // trainspeed(event.data);
|
||||
// // }
|
||||
// if(event.data.type == 'SJL3D_TrainStatus'){
|
||||
// trainstatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_DeviceStatus'){
|
||||
// devicestatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_Reset'){
|
||||
// simulationreset(event.data);
|
||||
// }
|
||||
// };
|
||||
|
||||
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails, materiallist, nowaction, scene) {
|
||||
// console.log(mapdata);
|
||||
|
||||
trainlisttest = newtrainlisttest;
|
||||
sectionlist = newsectionlist;
|
||||
signallist = newsignallist;
|
||||
stationstandlist = newstationstandlist;
|
||||
materials = materiallist;
|
||||
scenes = scene;
|
||||
actions = nowaction;
|
||||
links = newlinklist;
|
||||
rails = newrails;
|
||||
|
||||
};
|
||||
|
||||
this.socketon = function(topic) {
|
||||
try {
|
||||
// console.log("teststomp");
|
||||
// scope.teststomp.subscribe(topic, callback, header);
|
||||
} catch (error) {
|
||||
console.error('websocket订阅失败');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.socketoff = function(topic) {
|
||||
scope.teststomp.unsubscribe(topic);
|
||||
for (let i=0; i<trainlisttest.group.children.length; i++) {
|
||||
if (trainlisttest.group.children[i].dispose == false) {
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.group.children[i].dispose = true;
|
||||
trainlisttest.group.children[i].position.x = -50000;
|
||||
trainlisttest.group.children[i].position.y = -50000;
|
||||
|
||||
trainlisttest.group.remove(trainlisttest.group.children[i]);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 仿真socket接口回调函数
|
||||
function callback(Response) {
|
||||
|
||||
}
|
||||
|
||||
function trainspeed(data){
|
||||
if (trainlisttest) {
|
||||
|
||||
for (let tl = 0; tl<data.body.length; tl++) {
|
||||
code = data.body[tl].id;
|
||||
if(trainlisttest.list[code].speed != data.body[tl].v){
|
||||
trainlisttest.list[code].speed = data.body[tl].v;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/18/trainlisttest.list[code].len);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function trainstatus(data){
|
||||
// for (let i=data.body.length-1; i>=0; i--) {
|
||||
// console.log(data.body[i]);
|
||||
|
||||
// console.log(data);
|
||||
// 遍历列车对象组
|
||||
if (trainlisttest) {
|
||||
code = data.code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
|
||||
|
||||
if ( trainlisttest.list[code]) {
|
||||
|
||||
trainlisttest.list[code].runMode = data.runMode;
|
||||
// 车门开关验证
|
||||
// if(data.directionType == "02"){
|
||||
if (trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == '01') {
|
||||
// console.log("close");
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
for (let an=actions[code].top.length-1; an>=0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = -1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == '02') {
|
||||
// console.log("open");
|
||||
trainlisttest.list[code].doorStatus = '02';
|
||||
for (let an=actions[code].top.length-1; an>=0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
// if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "01"){
|
||||
// //console.log("close");
|
||||
// trainlisttest.list[code].doorStatus = "01";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
|
||||
// actions[code].down[an].timeScale = -1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }else if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "02"){
|
||||
// //console.log("open");
|
||||
// trainlisttest.list[code].doorStatus = "02";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = 0;
|
||||
// actions[code].down[an].timeScale = 1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 遍历获取所在轨道
|
||||
if (trainlisttest.list[code].dispose != data.dispose && data.dispose == false) {
|
||||
|
||||
if (rails.linkrail[data.linkCode]) {
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
// trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].dispose = false;
|
||||
trainlisttest.list[code].nowcode = data.linkCode;
|
||||
trainlisttest.list[code].nextcode = null;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
|
||||
if(trainlisttest.list[code].mixerpush == false){
|
||||
for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi<lenmi;mi++){
|
||||
jlmap3d.mixers.push(trainlisttest.list[code].mixer[mi]);
|
||||
}
|
||||
trainlisttest.list[code].mixerpush = true;
|
||||
// console.log(trainlisttest.list[code].mixerpush);
|
||||
}
|
||||
|
||||
if (data.directionType == '02') { // 向右
|
||||
|
||||
|
||||
if(data.targetStation){
|
||||
trainlisttest.list[code].stopstation = data.targetStation;
|
||||
// console.log(rails.stops[data.targetStation].direct2.percent);
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct2.percent;
|
||||
trainlisttest.list[code].progress = data.linkOffsetPercent/trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.targetLink;
|
||||
// console.log(data.targetLinkPercent);
|
||||
// console.log(rails.stops[data.targetStation].direct2.percent);
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
// console.log("===================");
|
||||
let point = rails.linkrail[data.linkCode].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
|
||||
}else{
|
||||
trainlisttest.list[code].progress = data.linkOffsetPercent/trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
let point = rails.linkrail[data.linkCode].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineleft;
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '02';
|
||||
} else if (data.directionType == '03') { // 向左
|
||||
|
||||
// if(trainlisttest.list[code].rname == "006"){
|
||||
// console.log("0000000000000000");
|
||||
// console.log(data.linkOffsetPercent);
|
||||
// }
|
||||
if(data.targetStation){
|
||||
|
||||
trainlisttest.list[code].stopstation = data.targetStation;
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct1.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct1.percent;
|
||||
trainlisttest.list[code].progress = 1-(data.linkOffsetPercent/trainlisttest.list[code].pc);
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.targetLink;
|
||||
// console.log(data.targetLinkPercent);
|
||||
// console.log(rails.stops[data.targetStation].direct1.percent);
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
// console.log("===================");
|
||||
let point = rails.linkrail[data.linkCode].lineright.getPointAt(trainlisttest.list[code].progress);
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -point.z;
|
||||
}
|
||||
}else{
|
||||
trainlisttest.list[code].progress = data.linkOffsetPercent/trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
let point = rails.linkrail[data.linkCode].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineright;
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '03';
|
||||
|
||||
// trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineright;
|
||||
}
|
||||
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
// trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.sectionCode].isStandTrack;
|
||||
|
||||
// trainlisttest.list[code].len = sectionlist.sections.datalist[data.sectionCode].distance;
|
||||
|
||||
if(trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode){
|
||||
trainlisttest.list[code].statsstop = 0;
|
||||
}else{
|
||||
trainlisttest.list[code].statsstop = 1;
|
||||
}
|
||||
if(data.speed == 0){
|
||||
trainlisttest.list[code].speeds = data.speed;
|
||||
trainlisttest.list[code].speeds = 0;
|
||||
// trainlisttest.list[code].startmark = 1;
|
||||
}else{
|
||||
trainlisttest.list[code].speeds = data.speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.speed*10/36/18/trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (trainlisttest.list[code].dispose != data.dispose && data.dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = true;
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.list[code].position.x = -50000;
|
||||
trainlisttest.list[code].position.y = -50000;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
|
||||
} else if (trainlisttest.list[code].dispose == data.dispose && data.dispose == false) {
|
||||
|
||||
// if(data.){
|
||||
//
|
||||
// }
|
||||
if (data.directionType == '02' && trainlisttest.list[code].status != data.directionType) { // 向右
|
||||
|
||||
|
||||
let rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
let rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
|
||||
trainlisttest.list[code].progress = (rotaposx-rails.linkrail[data.linkCode].lp.x)/rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineleft;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
|
||||
} else if (data.directionType == '03'&& trainlisttest.list[code].status != data.directionType) { // 向左
|
||||
|
||||
let rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
let rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -rotaposz;
|
||||
}
|
||||
trainlisttest.list[code].progress = 1-(rotaposx-rails.linkrail[data.linkCode].lp.x)/rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineright;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(trainlisttest.list[code].nextcode == null ){//&& trainlisttest.list[code].stopstation == data.targetStation
|
||||
// if(data.groupNumber == "016"){
|
||||
// console.log(trainlisttest.list[code].nextcode);
|
||||
// console.log(trainlisttest.list[code].stopstation);
|
||||
// console.log(data.targetStation);
|
||||
// console.log(data.body[i]);
|
||||
// console.log(trainlisttest.list[code]);
|
||||
// }
|
||||
// if(trainlisttest.list[code].targetLink != trainlisttest.list[code].nowcode){
|
||||
let nextcode;
|
||||
if(data.directionType == '02'){
|
||||
|
||||
trainlisttest.list[code].status = '02';
|
||||
// console.log(rails.linkrail[trainlisttest.list[code].nowcode]);
|
||||
|
||||
if(rails.linkrail[trainlisttest.list[code].nowcode]){
|
||||
nextcode = rails.linkrail[trainlisttest.list[code].nowcode].rconnect;
|
||||
}
|
||||
|
||||
if(nextcode){
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}else{
|
||||
|
||||
trainlisttest.list[code].nextlen = 0;
|
||||
}
|
||||
}else if(data.directionType == '03'){
|
||||
|
||||
trainlisttest.list[code].status = '03';
|
||||
if(rails.linkrail[trainlisttest.list[code].nowcode]){
|
||||
nextcode = rails.linkrail[trainlisttest.list[code].nowcode].lconnect;
|
||||
}
|
||||
if(nextcode){
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}else{
|
||||
|
||||
trainlisttest.list[code].nextlen = 0;
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].nextcode = nextcode;
|
||||
|
||||
// }
|
||||
|
||||
if(trainlisttest.list[code].curve == null){
|
||||
trainlisttest.list[code].len = trainlisttest.list[code].nextlen;
|
||||
trainlisttest.list[code].nowcode = trainlisttest.list[code].nextcode;
|
||||
trainlisttest.list[code].curve = trainlisttest.list[code].nextcurve;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
trainlisttest.list[code].nextlen = null;
|
||||
trainlisttest.list[code].nextcode = null;
|
||||
}
|
||||
}
|
||||
if(data.groupNumber == "016"){
|
||||
// console.log(data.targetLink);
|
||||
// console.log(trainlisttest.list[code].nowcode);
|
||||
//
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
// console.log("==============");
|
||||
}
|
||||
trainlisttest.list[code].targetLink = data.targetLink;
|
||||
if(trainlisttest.list[code].stopstation != data.targetStation){
|
||||
|
||||
if(data.directionType == '02'){
|
||||
if(data.targetStation){
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct2.percent;
|
||||
// trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
// trainlisttest.list[code].targetLink = data.targetLink;
|
||||
}
|
||||
|
||||
|
||||
trainlisttest.list[code].status = '02';
|
||||
}else if(data.directionType == '03'){
|
||||
if(data.targetStation){
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct1.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct1.percent;
|
||||
// trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
// trainlisttest.list[code].targetLink = data.targetLink;
|
||||
}
|
||||
|
||||
trainlisttest.list[code].status = '03';
|
||||
|
||||
}
|
||||
trainlisttest.list[code].stopstation = data.targetStation;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode){
|
||||
trainlisttest.list[code].statsstop = 0;
|
||||
}else{
|
||||
trainlisttest.list[code].statsstop = 1;
|
||||
}
|
||||
// console.log(data.body[i]);
|
||||
|
||||
if(trainlisttest.list[code].speed != data.speed){
|
||||
trainlisttest.list[code].speed = data.speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.speed*10/36/18/trainlisttest.list[code].len);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
function standupdate(data) {
|
||||
code = data.code;
|
||||
if ( actions[code]) {
|
||||
if (data.screenDoorOpenStatus == '02' && actions[code].status == '01') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.screenDoorOpenStatus == '02' && actions[code].status == '00') {
|
||||
actions[code].status = '02';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
|
||||
if (data.screenDoorOpenStatus == '01' && actions[code].status == '02') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.screenDoorOpenStatus == '01' && actions[code].status == '00') {
|
||||
actions[code].status = '01';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
function devicestatus(data){
|
||||
for (let i= 0,leni = data.body.length; i<leni; i++) {
|
||||
// 0xFFFFFF
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
|
||||
if (data._type == 'Signal' && signallist) {
|
||||
if (signallist) {
|
||||
// console.log(data.body[i]);
|
||||
signalupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data._type == 'StationStand' && actions) {
|
||||
if (actions) {
|
||||
standupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data._type == 'Switch' && sectionlist) {
|
||||
if (sectionlist) {
|
||||
switchupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
// console.log(data);
|
||||
if (data.lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.status = data.status;
|
||||
|
||||
// 55
|
||||
// 33
|
||||
// 77
|
||||
// 关闭
|
||||
if (data.status == '01') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[0];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 开放
|
||||
if (data.status == '02') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if (data.status == '03') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
// 引导
|
||||
if (data.status == '03') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[0];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 封锁
|
||||
if (data.status == '04') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 故障
|
||||
if (data.status == '05') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
if (data.status == '06') {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (data.lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
for (let j=sectionlist.switchs.modellist.length-1; j>=0; j--) {
|
||||
if (rails.switchrail[code]) {
|
||||
if (rails.switchrail[code].locateType != data.locateType) {
|
||||
if (data.locateType == '02') {
|
||||
if (actions[sectionlist.switchs.modellist[j].code]) {
|
||||
sectionlist.switchs.modellist[j].locateType = data.locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = 0;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
}
|
||||
|
||||
rails.switchrail[code].locateType = "02";
|
||||
|
||||
let testswitch = rails.switchrail[code];
|
||||
// console.log(testswitch);
|
||||
// console.log(rails.linkrail[testswitch.alink]);
|
||||
// console.log(rails.linkrail[testswitch.clink]);
|
||||
if(rails.switchrail[code].directtype == "1"){
|
||||
rails.linkrail[testswitch.alink].lconnect = testswitch.clink;
|
||||
rails.linkrail[testswitch.clink].rconnect = testswitch.alink;
|
||||
}else if(rails.switchrail[code].directtype == "2"){
|
||||
rails.linkrail[testswitch.alink].rconnect = testswitch.clink;
|
||||
rails.linkrail[testswitch.clink].lconnect = testswitch.alink;
|
||||
}
|
||||
|
||||
} else if (data.locateType == '01') {
|
||||
if (actions[sectionlist.switchs.modellist[j].code]) {
|
||||
sectionlist.switchs.modellist[j].locateType = data.locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
}
|
||||
|
||||
rails.switchrail[code].locateType = "01";
|
||||
let testswitch = rails.switchrail[code];
|
||||
// console.log(testswitch);
|
||||
// console.log(rails.linkrail[testswitch.alink]);
|
||||
// console.log(rails.linkrail[testswitch.clink]);
|
||||
if(rails.switchrail[code].directtype == "1"){
|
||||
rails.linkrail[testswitch.alink].lconnect = testswitch.blink;
|
||||
rails.linkrail[testswitch.blink].rconnect = testswitch.alink;
|
||||
}else if(rails.switchrail[code].directtype == "2"){
|
||||
rails.linkrail[testswitch.alink].rconnect = testswitch.blink;
|
||||
rails.linkrail[testswitch.blink].lconnect = testswitch.alink;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
function simulationreset(data){
|
||||
for(let i=0;i<trainlisttest.group.children.length;i++){
|
||||
trainlisttest.group.children[i].dispose = true;
|
||||
trainlisttest.group.children[i].stopstation = null;
|
||||
trainlisttest.group.children[i].pc = null;
|
||||
trainlisttest.group.children[i].targetpercent = null;
|
||||
trainlisttest.group.children[i].progress = null;
|
||||
trainlisttest.group.children[i].linkOffsetPercent = null;
|
||||
trainlisttest.group.children[i].targetLink = null;
|
||||
trainlisttest.group.remove(trainlisttest.group.children[i]);
|
||||
i--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,445 +0,0 @@
|
||||
import StompClient from '@/utils/sock';
|
||||
import { displayTopic } from '@/utils/stomp';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import router from '@/router/index_APP_TARGET';
|
||||
|
||||
// 定于仿真socket接口
|
||||
export function Jlmap3dSubscribe(worker,routegroup) {
|
||||
|
||||
const scope = this;
|
||||
this.map = null;
|
||||
|
||||
const webworker = worker;
|
||||
var trainlisttest = null;
|
||||
var sectionlist = null;
|
||||
var signallist = null;
|
||||
var stationstandlist = null;
|
||||
var sectionlist = null;
|
||||
var materials = null;
|
||||
var actions = null;
|
||||
var scenes = null;
|
||||
|
||||
var code = null;
|
||||
|
||||
this.teststomp = new StompClient();
|
||||
this.topic = displayTopic;
|
||||
const header = { group: router.currentRoute.query.group, 'X-Token': getToken() };
|
||||
console.log( router.currentRoute.query.group);
|
||||
this.updatamap = function (mapdata, materiallist, nowaction, scene) {
|
||||
// console.log(mapdata);
|
||||
scope.map = mapdata;
|
||||
trainlisttest = this.map.trainlisttest;
|
||||
sectionlist = this.map.sectionlist;
|
||||
signallist = this.map.signallist;
|
||||
stationstandlist = this.map.stationstandlist;
|
||||
sectionlist = this.map.sectionlist;
|
||||
materials = materiallist;
|
||||
scenes = scene;
|
||||
actions = nowaction;
|
||||
};
|
||||
|
||||
this.socketon = function (topic) {
|
||||
try {
|
||||
// console.log("teststomp");
|
||||
scope.teststomp.subscribe(topic, callback, header);
|
||||
} catch (error) {
|
||||
console.error('websocket订阅失败');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.socketoff = function (topic) {
|
||||
scope.teststomp.unsubscribe(topic);
|
||||
};
|
||||
|
||||
// 仿真socket接口回调函数
|
||||
function callback(Response) {
|
||||
// 对象化数据
|
||||
const data = JSON.parse(Response.body);
|
||||
// 遍历后台数据
|
||||
|
||||
// 判断消息类型
|
||||
// if(data.type == "Simulation_TrainPosition"){
|
||||
//
|
||||
//
|
||||
// }
|
||||
if (data.type == 'Simulation_DeviceStatus') {
|
||||
|
||||
if (data.body.length < 200) {
|
||||
|
||||
for (let i = data.body.length - 1; i >= 0; i--) {
|
||||
|
||||
if (data.body[i]._type == 'Train') {
|
||||
|
||||
// console.log(data.body[i]);
|
||||
// 遍历列车对象组
|
||||
// console.log(data.body[i]);
|
||||
if (trainlisttest) {
|
||||
code = data.body[i].code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
|
||||
if (trainlisttest.list[code]) {
|
||||
// 车门开关验证
|
||||
// if(data.body[i].directionType == "02"){
|
||||
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
|
||||
// console.log("close");
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
for (let an = actions[code].top.length - 1; an >= 0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = -1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
|
||||
// console.log("open");
|
||||
trainlisttest.list[code].doorStatus = '02';
|
||||
for (let an = actions[code].top.length - 1; an >= 0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
// }else{
|
||||
// if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "01"){
|
||||
// //console.log("close");
|
||||
// trainlisttest.list[code].doorStatus = "01";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
|
||||
// actions[code].down[an].timeScale = -1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }else if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "02"){
|
||||
// //console.log("open");
|
||||
// trainlisttest.list[code].doorStatus = "02";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = 0;
|
||||
// actions[code].down[an].timeScale = 1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 遍历获取所在轨道
|
||||
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
|
||||
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
|
||||
trainlisttest.list[code].dispose = false;
|
||||
|
||||
if (data.body[i].directionType == '02') {
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
} else if (data.body[i].directionType == '03') {
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = true;
|
||||
|
||||
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
|
||||
if (trainlisttest.list[code].nowcode != data.body[i].sectionCode || trainlisttest.list[code].nextcode != data.body[i].nextSectionCode) {
|
||||
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
|
||||
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
|
||||
const vexlist = [];
|
||||
const endrotation = null;
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
console.log(trainlisttest.list[code].position);
|
||||
console.log(trainlisttest.list[code].children[5].matrixWorld);
|
||||
trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14];
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
} else {
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14];
|
||||
//
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
|
||||
// console.log(trainlisttest.list[code].curve.points);
|
||||
// console.log(data.body[i].speed)
|
||||
// console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance);
|
||||
trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
|
||||
trainlisttest.list[code].progress = 0;
|
||||
}
|
||||
// console.log("speed");
|
||||
// console.log(data.body[i].speed);
|
||||
// console.log(trainlisttest.list[code].speed);
|
||||
if (data.body[i].speed != trainlisttest.list[code].speed) {
|
||||
trainlisttest.list[code].speed = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
// if(trainlisttest.list[code].speeds > 0.1){
|
||||
// console.log(data.body[i]);
|
||||
// console.log(data.body[i].speed)
|
||||
// console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance);
|
||||
// console.log(trainlisttest.list[code].speeds);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 0xFFFFFF
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
if (data.body[i]._type == 'Signal') {
|
||||
|
||||
if (signallist) {
|
||||
code = data.body[i].code;
|
||||
if (data.body[i].lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.status = data.body[i].status;
|
||||
|
||||
// 55
|
||||
// 33
|
||||
// 77
|
||||
// 关闭
|
||||
if (data.body[i].status == '01') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 开放
|
||||
if (data.body[i].status == '02') {
|
||||
|
||||
if (data.body[i].switchLocateType == '01') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[2];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
if (data.body[i].switchLocateType == '02') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[1];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 引导
|
||||
if (data.body[i].status == '03') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[1];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 封锁
|
||||
if (data.body[i].status == '04') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 故障
|
||||
if (data.body[i].status == '05') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (data.body[i].lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'StationStand') {
|
||||
if (actions) {
|
||||
code = data.body[i].code;
|
||||
if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '01') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '00') {
|
||||
actions[code].status = '02';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
|
||||
if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '02') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '00') {
|
||||
actions[code].status = '01';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'Switch') {
|
||||
|
||||
if (sectionlist) {
|
||||
code = data.body[i].code;
|
||||
for (let j = sectionlist.switchs.modellist.length - 1; j >= 0; j--) {
|
||||
if (sectionlist.switchs.modellist[j].code == code) {
|
||||
if (sectionlist.switchs.modellist[j].locateType != data.body[i].locateType) {
|
||||
if (data.body[i].locateType == '02') {
|
||||
sectionlist.switchs.modellist[j].locateType = data.body[i].locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = 0;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
|
||||
} else if (data.body[i].locateType == '01') {
|
||||
sectionlist.switchs.modellist[j].locateType = data.body[i].locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(sectionlist.group[j].name);
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else if (data.body.length > 200) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,174 +0,0 @@
|
||||
|
||||
export function UpdateTrainNew(camera,traindata){
|
||||
if(traindata != undefined ){
|
||||
for(let j=traindata.group.children.length-1;j>=0;j--){
|
||||
//判断是否有移动事件
|
||||
|
||||
let trainmodel = traindata.group.children[j];
|
||||
|
||||
if(trainmodel.speeds > 0 && trainmodel.speeds){
|
||||
let speed = null;
|
||||
if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){
|
||||
|
||||
let movecurve = trainmodel.curve;
|
||||
if(trainmodel.status == "1"){
|
||||
|
||||
let point = movecurve.getPointAt(trainmodel.progress);
|
||||
let worldpositionz = trainmodel.children[0].position.z;
|
||||
|
||||
|
||||
trainmodel.position.x = point.x;
|
||||
trainmodel.position.y = 0;
|
||||
let offset = Math.abs( point.z -parseFloat(worldpositionz));
|
||||
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){
|
||||
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
|
||||
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
|
||||
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
|
||||
trainmodel.children[0].rotation.x = -Math.PI/2;
|
||||
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
|
||||
trainmodel.children[0].rotation.y = 0;
|
||||
let rotas = {
|
||||
posr:point,
|
||||
rota:trainmodel.children[0].rotation.z
|
||||
}
|
||||
trainmodel.children[1].rotalist.push(rotas);
|
||||
let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]);
|
||||
trainmodel.children[0].position.z += offsetz;
|
||||
}
|
||||
|
||||
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
|
||||
|
||||
for(let rs = 1;rs<6;rs++){
|
||||
if(trainmodel.children[rs].rotalist[0]){
|
||||
|
||||
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
|
||||
trainmodel.children[rs].position.z += offsetz;
|
||||
|
||||
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
|
||||
if((trainmodel.children[rs].matrixWorld.elements[12]+8)>=trainmodel.children[rs].rotalist[0].posr.x){
|
||||
|
||||
if(rs != 5){
|
||||
let asd = trainmodel.children[rs].rotalist[0];
|
||||
trainmodel.children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
|
||||
trainmodel.children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainmodel.children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
trainmodel.progress += trainmodel.speeds;
|
||||
// if(trainmodel.statsstop == 0){
|
||||
// if((1-trainmodel.progress) > 0.95){
|
||||
//
|
||||
// trainmodel.progress += trainmodel.speeds;
|
||||
// }
|
||||
//
|
||||
// }else{
|
||||
// trainmodel.progress += trainmodel.speeds;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
if(trainmodel.status == "0"){
|
||||
let point = movecurve.getPointAt(trainmodel.progress);
|
||||
let worldpositionz = trainmodel.children[0].position.z;
|
||||
|
||||
trainmodel.position.x = point.x;
|
||||
trainmodel.position.y = 0;
|
||||
|
||||
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){
|
||||
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
|
||||
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
|
||||
|
||||
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
|
||||
trainmodel.children[0].rotation.x = -Math.PI/2;
|
||||
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
|
||||
trainmodel.children[0].rotation.y = 0;
|
||||
|
||||
let rotas = {
|
||||
posr:point,
|
||||
rota:trainmodel.children[0].rotation.z
|
||||
}
|
||||
trainmodel.children[1].rotalist.push(rotas);
|
||||
|
||||
let offsetz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]) - parseFloat(point.z);
|
||||
trainmodel.children[0].position.z += offsetz;
|
||||
|
||||
}
|
||||
|
||||
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
|
||||
for(let rs = 1;rs<6;rs++){
|
||||
if(trainmodel.children[rs].rotalist[0]){
|
||||
let offsetz = parseFloat(trainmodel.children[rs].matrixWorld.elements[14]) - parseFloat(trainmodel.children[rs].rotalist[0].posr.z);
|
||||
|
||||
trainmodel.children[rs].position.z += offsetz;
|
||||
|
||||
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
|
||||
if((trainmodel.children[rs].matrixWorld.elements[12]-8)<=trainmodel.children[rs].rotalist[0].posr.x){
|
||||
|
||||
if(rs != 5){
|
||||
let asd = trainmodel.children[rs].rotalist[0];
|
||||
trainmodel.children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
|
||||
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
|
||||
trainmodel.children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainmodel.children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
trainmodel.progress += trainmodel.speeds;
|
||||
// if(trainmodel.statsstop == 0){
|
||||
// if(trainmodel.progress < 0.95){
|
||||
// trainmodel.progress += trainmodel.speeds;
|
||||
// }
|
||||
// }else{
|
||||
// trainmodel.progress += trainmodel.speeds;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
if(trainmodel.nextcurve){
|
||||
trainmodel.progress = 0;
|
||||
trainmodel.len = trainmodel.nextlen;
|
||||
if(trainmodel.nextcode){
|
||||
trainmodel.nowcode = trainmodel.nextcode;
|
||||
trainmodel.isstandsection = trainmodel.nextissection;
|
||||
if(trainmodel.isstandsection){
|
||||
trainmodel.statsstop = 0;
|
||||
}else{
|
||||
trainmodel.statsstop = 1;
|
||||
}
|
||||
}
|
||||
|
||||
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/25/trainmodel.len);
|
||||
trainmodel.curve = trainmodel.nextcurve;
|
||||
trainmodel.nextcurve = null;
|
||||
trainmodel.nextlen = null;
|
||||
trainmodel.nextcode = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,7 @@ import { AssetLoader } from '@/jlmap3d/main/loaders/AssetLoader';
|
||||
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
//data
|
||||
import { Jl3ddata } from '@/jlmap3d/main/model/jl3ddata';
|
||||
import { Jl3ddata } from '@/jlmap3d/main/newmodel/jl3ddata';
|
||||
|
||||
//setconfig
|
||||
import { SetCamera } from '@/jlmap3d/config/SetCamera';
|
||||
@ -19,11 +19,9 @@ import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
// import { DragControls } from '@/jlmap3d/main/control/DragControls';
|
||||
|
||||
//加载器
|
||||
import { SimulationLoad } from '@/jlmap3d/main/loaders/SimulationLoad';
|
||||
import { SimulationLoadNew } from '@/jlmap3d/main/loaders/SimulationLoadNew';
|
||||
|
||||
//connect
|
||||
import {Jlmap3dSubscribe } from '@/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribe';
|
||||
import {Jlmap3dSubscribeNew } from '@/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribeNew';
|
||||
|
||||
import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
|
||||
@ -31,7 +29,6 @@ import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '
|
||||
//utils
|
||||
// import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrain';
|
||||
import { UpdateTrain } from '@/jlmap3d/jl3dsimulation/connect/UpdateTrainTest';
|
||||
import { UpdateTrainNew } from '@/jlmap3d/jl3dsimulation/connect/UpdateTrainNew';
|
||||
// import { ReStart } from '@/jlmap3d/main/utils/ReStart';
|
||||
|
||||
import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
|
||||
@ -98,10 +95,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
|
||||
//地图模型数据
|
||||
let mapdata = new Jl3ddata();
|
||||
//订阅仿真socket
|
||||
// console.log(routegroup);
|
||||
// this.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
|
||||
//连接到通信
|
||||
//console.log(this.Subscribe.config);
|
||||
|
||||
|
||||
this.webwork = new Worker(JL3D_LOCAL_STATIC+"/workertest/trainworker.js");
|
||||
//初始化加载数据和模型getPublishMapDetail
|
||||
@ -109,21 +103,11 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
|
||||
let mapnetdata = data.data;
|
||||
getPublish3dMapDetail(skinCode).then(netdata => {
|
||||
let assetsdata = JSON.parse(netdata.data.sections);
|
||||
if(assetsdata.link){
|
||||
scope.datatype = "old";
|
||||
scope.jsonwebwork = new Worker(JL3D_LOCAL_STATIC+"/workertest/jsonworker.js");
|
||||
scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
|
||||
scope.Subscribe.socketon(scope.Subscribe.topic);
|
||||
SimulationLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
|
||||
|
||||
}else{
|
||||
scope.datatype = "new";
|
||||
scope.jsonwebworknew = new Worker(JL3D_LOCAL_STATIC+"/workertest/jsonworkernew.js");
|
||||
scope.Subscribe = new Jlmap3dSubscribeNew(scope,routegroup,scope.jsonwebworknew);
|
||||
scope.Subscribe.socketon(scope.Subscribe.topic);
|
||||
SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
|
||||
}
|
||||
|
||||
scope.datatype = "new";
|
||||
scope.jsonwebworknew = new Worker(JL3D_LOCAL_STATIC+"/workertest/jsonworkernew.js");
|
||||
scope.Subscribe = new Jlmap3dSubscribeNew(scope,routegroup,scope.jsonwebworknew);
|
||||
scope.Subscribe.socketon(scope.Subscribe.topic);
|
||||
SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
|
||||
});
|
||||
});
|
||||
//
|
||||
@ -193,7 +177,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
|
||||
//更新列车位置
|
||||
if(scope.datatype == "new"){
|
||||
|
||||
// UpdateTrainNew(camera,trainlisttest);
|
||||
}else{
|
||||
UpdateTrain(camera,trainlisttest);
|
||||
}
|
||||
|
@ -1,187 +0,0 @@
|
||||
//componnent
|
||||
import {SectionList} from '@/jlmap3d/main/model/SectionList.js';
|
||||
import {SignalList} from '@/jlmap3d/main/model/SignalList.js';
|
||||
import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js';
|
||||
import {TrainList} from '@/jlmap3d/main/model/TrainList.js';
|
||||
import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js';
|
||||
import {LinkList} from '@/jlmap3d/main/model/LinkList.js';
|
||||
import {RailList} from '@/jlmap3d/main/model/RailList.js';
|
||||
|
||||
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
||||
|
||||
import {SectionListN} from '@/jlmap3d/main/newmodel/SectionListN';
|
||||
import {SignalListN} from '@/jlmap3d/main/newmodel/SignalListN';
|
||||
import {StationStandListN} from '@/jlmap3d/main/newmodel/StationStandListN';
|
||||
import {SwitchListN} from '@/jlmap3d/main/newmodel/SwitchListN';
|
||||
import {RailListN} from '@/jlmap3d/main/newmodel/RailListN.js';
|
||||
|
||||
import { Loading } from 'element-ui';
|
||||
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
|
||||
|
||||
export function DriverLoad(data,scope,netdata,sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,camera,controls,scene,mixerss,storemod){
|
||||
//console.log(mapdata);
|
||||
Materialload(scope);
|
||||
//console.log(data);
|
||||
//console.log(scope);
|
||||
let sceneload = scene;
|
||||
let backdata = scope;
|
||||
let assetloader = scope.assetloader;
|
||||
let animateswitch = scope.animateswitch;
|
||||
|
||||
let mixers = mixerss;
|
||||
let actions = scope.actions;
|
||||
|
||||
let loadingInstance = Loading.service({ fullscreen: true });
|
||||
|
||||
let switchlist;
|
||||
|
||||
let isSection = false;
|
||||
let isNewdata = false;
|
||||
if(netdata.assets){
|
||||
let assetsdata = JSON.parse(netdata.sections);
|
||||
// console.log(assetsdata.link);
|
||||
if(assetsdata.link){
|
||||
isSection = true;
|
||||
}else{
|
||||
isNewdata = true;
|
||||
}
|
||||
}
|
||||
// console.log(isNewdata);
|
||||
// console.log(netdata);
|
||||
if(isSection == true){
|
||||
init3d(data,netdata);
|
||||
}else{
|
||||
loadingInstance.close();
|
||||
alert("没有三维数据");
|
||||
}
|
||||
function init3d(data,netdata){
|
||||
let mapdata = data.data;
|
||||
// console.log(data);
|
||||
//初始化轨道和道岔 暂时
|
||||
lengthfact(data.data);
|
||||
|
||||
linklist = new LinkList();
|
||||
sectionlist = new SectionList();
|
||||
signallist = new SignalList();
|
||||
//初始化站台
|
||||
stationstandlist = new StationStandList();
|
||||
//初始化测试列车
|
||||
trainlisttest = new TrainList();
|
||||
realsectionlist = new RealSectionList();
|
||||
|
||||
rails = new RailList();
|
||||
|
||||
let loaderdata = JSON.parse(netdata.sections);
|
||||
let switchdata = JSON.parse(netdata.switchs);
|
||||
let signaldata = JSON.parse(netdata.signals);
|
||||
let standsdata = JSON.parse(netdata.stands);
|
||||
|
||||
assetloader.setmodellist(netdata.assets);
|
||||
|
||||
assetloader.assetpromise(sceneload)
|
||||
.then(function(data){
|
||||
return linklist.loadpromise(loaderdata.link,sceneload,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"0");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
//console.log(assetloader);
|
||||
return trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"0");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return sectionlist.loadpromise(linklist,assetloader,loaderdata.section,switchdata,sceneload);
|
||||
})
|
||||
// .then(function(data){
|
||||
// //console.log(data);
|
||||
// return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
|
||||
// })
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
|
||||
})
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
let stopoffset = 64;
|
||||
rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,
|
||||
stationstandlist.list,sceneload,storemod,stopoffset);
|
||||
resolve("loadrail");
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
.then(function(data){
|
||||
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
|
||||
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
|
||||
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
|
||||
// scope.assetloader.modellist[mn].mesh.position.y -=0.1;
|
||||
// console.log(scope.assetloader.modellist[mn].mesh);
|
||||
scene.add(scope.assetloader.modellist[mn].mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scope.animateswitch = true;
|
||||
|
||||
// mapdata = jlmap3ddata;
|
||||
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
|
||||
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload);
|
||||
scope.webwork.postMessage("on");
|
||||
loadingInstance.close();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function onProgress( xhr ) {
|
||||
|
||||
if ( xhr.lengthComputable ) {
|
||||
|
||||
let percentComplete = xhr.loaded / xhr.total * 100;
|
||||
//console.log( 'model ' + Math.round( percentComplete, 2 ) + '% downloaded' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onError() {}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function lengthfact(data){
|
||||
let linklist = [];
|
||||
for(let i=0;i<data.linkList.length;i++){
|
||||
|
||||
let dx = Math.abs(data.linkList[i].lp.x - data.linkList[i].rp.x);
|
||||
let dy = Math.abs(data.linkList[i].lp.y - data.linkList[i].rp.y);
|
||||
let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
|
||||
|
||||
let link = {
|
||||
code:data.linkList[i].code,
|
||||
lengthfact:data.linkList[i].lengthFact,
|
||||
distance:distance
|
||||
};
|
||||
linklist.push(link);
|
||||
}
|
||||
|
||||
let sectionlist = [];
|
||||
for(let i=0;i<data.sectionList.length;i++){
|
||||
for(let j=0;j<linklist.length;j++){
|
||||
if(linklist[j].code == data.sectionList[i].linkCode){
|
||||
let sectionoffset = data.sectionList[i].offsetRight - data.sectionList[i].offsetLeft;
|
||||
let sectionlengthfact = sectionoffset/linklist[j].distance*linklist[j].lengthfact
|
||||
let section = {
|
||||
code:data.sectionList[i].code,
|
||||
lengthfact:sectionoffset
|
||||
};
|
||||
sectionlist.push(section);
|
||||
j = linklist.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(sectionlist);
|
||||
}
|
@ -52,7 +52,6 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
|
||||
Materialload(scope,JSON.parse(netdata.assets).stationTextureList[0]);
|
||||
let mapdata = data;
|
||||
//初始化轨道和道岔
|
||||
// linklist = new LinkList();
|
||||
sectionlist = new SectionListN();
|
||||
signallist = new SignalListN();
|
||||
switchlist = new SwitchListN();
|
||||
@ -154,37 +153,3 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
|
||||
|
||||
|
||||
}
|
||||
//旧link相关停操作待删除
|
||||
function lengthfact(data){
|
||||
let linklist = [];
|
||||
for(let i=0;i<data.linkList.length;i++){
|
||||
|
||||
let dx = Math.abs(data.linkList[i].lp.x - data.linkList[i].rp.x);
|
||||
let dy = Math.abs(data.linkList[i].lp.y - data.linkList[i].rp.y);
|
||||
let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
|
||||
|
||||
let link = {
|
||||
code:data.linkList[i].code,
|
||||
lengthfact:data.linkList[i].lengthFact,
|
||||
distance:distance
|
||||
};
|
||||
linklist.push(link);
|
||||
}
|
||||
|
||||
let sectionlist = [];
|
||||
for(let i=0;i<data.sectionList.length;i++){
|
||||
for(let j=0;j<linklist.length;j++){
|
||||
if(linklist[j].code == data.sectionList[i].linkCode){
|
||||
let sectionoffset = data.sectionList[i].offsetRight - data.sectionList[i].offsetLeft;
|
||||
let sectionlengthfact = sectionoffset/linklist[j].distance*linklist[j].lengthfact
|
||||
let section = {
|
||||
code:data.sectionList[i].code,
|
||||
lengthfact:sectionoffset
|
||||
};
|
||||
sectionlist.push(section);
|
||||
j = linklist.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,211 +0,0 @@
|
||||
//componnent
|
||||
import {SectionList} from '@/jlmap3d/main/model/SectionList.js';
|
||||
import {SignalList} from '@/jlmap3d/main/model/SignalList.js';
|
||||
import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js';
|
||||
import {TrainList} from '@/jlmap3d/main/model/TrainList.js';
|
||||
import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js';
|
||||
import {LinkList} from '@/jlmap3d/main/model/LinkList.js';
|
||||
import {RailList} from '@/jlmap3d/main/model/RailList.js';
|
||||
|
||||
import {SectionListN} from '@/jlmap3d/main/newmodel/SectionListN';
|
||||
import {SignalListN} from '@/jlmap3d/main/newmodel/SignalListN';
|
||||
import {StationStandListN} from '@/jlmap3d/main/newmodel/StationStandListN';
|
||||
import {SwitchListN} from '@/jlmap3d/main/newmodel/SwitchListN';
|
||||
import {RailListN} from '@/jlmap3d/main/newmodel/RailListN.js';
|
||||
|
||||
|
||||
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
||||
|
||||
import { Loading } from 'element-ui';
|
||||
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
|
||||
|
||||
export function SimulationLoad(data,scope,netdata,mapdata,camera,controls,scene,storemod){
|
||||
//console.log(mapdata);
|
||||
Materialload(scope);
|
||||
//console.log(data);
|
||||
//console.log(scope);
|
||||
let sceneload = scene;
|
||||
let backdata = scope;
|
||||
let jlmap3ddata = mapdata;
|
||||
let assetloader = scope.assetloader;
|
||||
let animateswitch = scope.animateswitch;
|
||||
|
||||
let mixers = scope.mixers;
|
||||
let actions = scope.actions;
|
||||
|
||||
let linklist,sectionlist,signallist,stationstandlist,trainlisttest,switchlist,realsectionlist,rails;
|
||||
|
||||
let loadingInstance = Loading.service({ fullscreen: true });
|
||||
|
||||
let isSection = false;
|
||||
let isNewdata = false;
|
||||
if(netdata.assets){
|
||||
init3d(data,netdata);
|
||||
}else{
|
||||
loadingInstance.close();
|
||||
alert("没有三维数据");
|
||||
}
|
||||
|
||||
function init3d(data,netdata){
|
||||
let mapdata = data;
|
||||
// console.log(data);
|
||||
//初始化轨道和道岔 暂时
|
||||
lengthfact(data);
|
||||
linklist = new LinkList();
|
||||
sectionlist = new SectionList();
|
||||
//初始化信号机
|
||||
signallist = new SignalList();
|
||||
//初始化站台
|
||||
stationstandlist = new StationStandList();
|
||||
//初始化测试列车
|
||||
trainlisttest = new TrainList();
|
||||
|
||||
realsectionlist = new RealSectionList();
|
||||
rails = new RailList();
|
||||
let loaderdata = JSON.parse(netdata.sections);
|
||||
let switchdata = JSON.parse(netdata.switchs);
|
||||
let signaldata = JSON.parse(netdata.signals);
|
||||
let standsdata = JSON.parse(netdata.stands);
|
||||
|
||||
// console.log(netdata.assets);
|
||||
assetloader.setmodellist(netdata.assets,1);
|
||||
|
||||
assetloader.assetpromise(sceneload)
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return linklist.loadpromise(loaderdata.link,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"02");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
//console.log(assetloader);
|
||||
return trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"02");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return sectionlist.loadpromise(linklist,assetloader,loaderdata.section,switchdata,sceneload);
|
||||
})
|
||||
// // .then(function(data){
|
||||
// // //console.log(data);
|
||||
// // return realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
|
||||
// // })
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
|
||||
})
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
let stopoffset = 61.92;
|
||||
rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata, stationstandlist.list,sceneload,storemod,stopoffset);
|
||||
resolve("loadrail");
|
||||
|
||||
});
|
||||
})
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
let mergegeometry
|
||||
let mergeindex = 0;
|
||||
let materialarr = [];
|
||||
|
||||
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
|
||||
|
||||
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
|
||||
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
|
||||
// console.log(scope.assetloader.modellist[mn].mesh.position);
|
||||
scope.assetloader.modellist[mn].mesh.name = "suidao";
|
||||
// console.log(scope.assetloader.modellist[mn].mesh);
|
||||
scene.add(scope.assetloader.modellist[mn].mesh);
|
||||
}
|
||||
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "background"){
|
||||
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
|
||||
// console.log(scope.assetloader.modellist[mn].mesh.position);
|
||||
scope.assetloader.modellist[mn].mesh.name = "background";
|
||||
// console.log(scope.assetloader.modellist[mn].mesh);
|
||||
scene.add(scope.assetloader.modellist[mn].mesh);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let mergemesh = new THREE.Mesh( mergegeometry, materialarr );
|
||||
scene.add(mergemesh);
|
||||
resolve("mergemodel");
|
||||
});
|
||||
})
|
||||
.then(function(data){
|
||||
|
||||
|
||||
// scope.animateswitch = true;
|
||||
|
||||
//console.log(scope);
|
||||
|
||||
//更新相机方向
|
||||
|
||||
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
|
||||
scope.updatecamera(stationstandlist.group.children[0],"station");
|
||||
//
|
||||
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload);
|
||||
//
|
||||
updatemenulist(stationstandlist.list,trainlisttest.list);
|
||||
scope.webwork.postMessage("on");
|
||||
scope.jsonwebwork.postMessage("connect");
|
||||
// console.log(sceneload);
|
||||
loadingInstance.close();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function onProgress( xhr ) {
|
||||
|
||||
if ( xhr.lengthComputable ) {
|
||||
|
||||
let percentComplete = xhr.loaded / xhr.total * 100;
|
||||
//console.log( 'model ' + Math.round( percentComplete, 2 ) + '% downloaded' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onError() {}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function lengthfact(data){
|
||||
let linklist = [];
|
||||
//console.log(data);
|
||||
for(let i=0;i<data.linkList.length;i++){
|
||||
|
||||
let dx = Math.abs(data.linkList[i].lp.x - data.linkList[i].rp.x);
|
||||
let dy = Math.abs(data.linkList[i].lp.y - data.linkList[i].rp.y);
|
||||
let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
|
||||
|
||||
let link = {
|
||||
code:data.linkList[i].code,
|
||||
lengthfact:data.linkList[i].lengthFact,
|
||||
distance:distance
|
||||
};
|
||||
linklist.push(link);
|
||||
}
|
||||
|
||||
let sectionlist = [];
|
||||
for(let i=0;i<data.sectionList.length;i++){
|
||||
for(let j=0;j<linklist.length;j++){
|
||||
if(linklist[j].code == data.sectionList[i].linkCode){
|
||||
let sectionoffset = data.sectionList[i].offsetRight - data.sectionList[i].offsetLeft;
|
||||
let sectionlengthfact = sectionoffset/linklist[j].distance*linklist[j].lengthfact
|
||||
let section = {
|
||||
code:data.sectionList[i].code,
|
||||
lengthfact:sectionoffset
|
||||
};
|
||||
sectionlist.push(section);
|
||||
j = linklist.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(sectionlist);
|
||||
}
|
@ -1,11 +1,4 @@
|
||||
//componnent
|
||||
import {SectionList} from '@/jlmap3d/main/model/SectionList.js';
|
||||
import {SignalList} from '@/jlmap3d/main/model/SignalList.js';
|
||||
import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js';
|
||||
import {TrainList} from '@/jlmap3d/main/model/TrainList.js';
|
||||
import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js';
|
||||
import {LinkList} from '@/jlmap3d/main/model/LinkList.js';
|
||||
import {RailList} from '@/jlmap3d/main/model/RailList.js';
|
||||
|
||||
import {TrainListN} from '@/jlmap3d/main/newmodel/TrainListN.js';
|
||||
import {SectionListN} from '@/jlmap3d/main/newmodel/SectionListN';
|
||||
@ -55,7 +48,6 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
|
||||
//初始化轨道和道岔
|
||||
// lengthfact(data);
|
||||
|
||||
// linklist = new LinkList();
|
||||
sectionlist = new SectionListN();
|
||||
signallist = new SignalListN();
|
||||
switchlist = new SwitchListN();
|
||||
@ -63,7 +55,6 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
|
||||
stationstandlist = new StationStandListN();
|
||||
//初始化测试列车
|
||||
trainlisttest = new TrainListN();
|
||||
// realsectionlist = new RealSectionList();
|
||||
|
||||
rails = new RailListN();
|
||||
|
||||
|
@ -1,327 +0,0 @@
|
||||
|
||||
export function LinkList(data){
|
||||
|
||||
let scope = this;
|
||||
|
||||
this.type = "linklist";
|
||||
|
||||
this.linkdata = [];
|
||||
|
||||
this.linksgroup = new THREE.Group();
|
||||
this.linksgroup.name = "link";
|
||||
|
||||
this.initpromise = function(linkdata,scene,assetloader){
|
||||
// console.log("init");
|
||||
return new Promise(function(resolve, reject){
|
||||
linkhelp(linkdata,scene);
|
||||
|
||||
scene.add(scope.linksgroup);
|
||||
linktest(linkdata,scene,assetloader);
|
||||
resolve("loadedrealsection");
|
||||
});
|
||||
};
|
||||
|
||||
this.loadpromise = function(linkdata,scene,assetloader){
|
||||
// console.log(linkdata);
|
||||
console.log("load");
|
||||
return new Promise(function(resolve, reject){
|
||||
scene.add(scope.linksgroup);
|
||||
loadlink(linkdata,scene,assetloader);
|
||||
resolve("loadedrealsection");
|
||||
});
|
||||
};
|
||||
|
||||
function linkhelp(data,scene){
|
||||
let groups = new THREE.Group();
|
||||
for(let i=0;i<data.length;i++){
|
||||
let lineGeometry = new THREE.Geometry();//生成几何体
|
||||
|
||||
lineGeometry.vertices.push(new THREE.Vector3(data[i].lp.x, 1, data[i].lp.y));//线段的两个顶点
|
||||
lineGeometry.vertices.push(new THREE.Vector3(data[i].rp.x, 1, data[i].rp.y));
|
||||
|
||||
let line = new THREE.Line(lineGeometry, new THREE.LineDashedMaterial({
|
||||
color: 0xffffff,//线段的颜色
|
||||
dashSize: 1,//短划线的大小
|
||||
gapSize: 3//短划线之间的距离
|
||||
}));
|
||||
line.name = data[i].code;
|
||||
line.lengthFact = data[i].lengthFact;
|
||||
line.lp = data[i].lp;
|
||||
line.rp = data[i].rp;
|
||||
line.distancex = data[i].rp.x-data[i].lp.x;
|
||||
line.distancey = data[i].rp.y-data[i].lp.y;
|
||||
line.computeLineDistances();//不可或缺的,若无,则线段不能显示为虚线
|
||||
groups.add(line);
|
||||
|
||||
}
|
||||
groups.position.z = 2000;
|
||||
scene.add(groups);
|
||||
}
|
||||
|
||||
|
||||
let mergegeometry = new THREE.Geometry();
|
||||
|
||||
function loadlink(data,scene,assetloader){
|
||||
let autorail;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
if(assetloader.modellist[i].deviceType == "autorail"){
|
||||
autorail = assetloader.modellist[i].mesh.children[0];
|
||||
}
|
||||
}
|
||||
let count = autorail.geometry.attributes.position.count;
|
||||
let rightlist = [];
|
||||
let leftlist = [];
|
||||
for(let i=0;i<count;i++){
|
||||
if(autorail.geometry.attributes.position.array[i*3] >0.49){
|
||||
rightlist.push(i);
|
||||
}
|
||||
if(autorail.geometry.attributes.position.array[i*3] <-0.49){
|
||||
leftlist.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for(let i=0;i<data.length;i++){
|
||||
// console.log("link");
|
||||
// console.log(data[i]);
|
||||
let testmesh2 = autorail.clone(true);
|
||||
testmesh2.code = data[i].code;
|
||||
testmesh2.name = data[i].name;
|
||||
testmesh2.rightlist = rightlist;
|
||||
testmesh2.leftlist = leftlist;
|
||||
testmesh2.rp = data[i].rp;
|
||||
testmesh2.lp = data[i].lp;
|
||||
testmesh2.lengthfact = data[i].lengthfact;
|
||||
|
||||
for(let i=0;i<testmesh2.rightlist.length;i++){
|
||||
testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-25;
|
||||
testmesh2.geometry.attributes.uv.array[testmesh2.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
|
||||
}
|
||||
let newrail = new THREE.BufferGeometry();
|
||||
newrail.copy(testmesh2.geometry);
|
||||
testmesh2.geometry = newrail;
|
||||
testmesh2.geometry.attributes.position.needsUpdate = true;
|
||||
testmesh2.geometry.attributes.uv.needsUpdate = true;
|
||||
testmesh2.geometry.computeBoundingSphere();
|
||||
testmesh2.geometry.center();
|
||||
|
||||
testmesh2.position.x = data[i].position.x;
|
||||
testmesh2.position.y = data[i].position.y;
|
||||
testmesh2.position.z = data[i].position.z;
|
||||
// testmesh2.rotation.x = data[i].rotation._x;
|
||||
// testmesh2.rotation.y = data[i].rotation._y;
|
||||
testmesh2.rotation.z = data[i].rotation._z;
|
||||
testmesh2.updateMatrix();
|
||||
mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(testmesh2.geometry),testmesh2.matrix);
|
||||
// console.log(testmesh2);
|
||||
testmesh2.geometry.dispose();
|
||||
for(let j in testmesh2.material){
|
||||
testmesh2.material[j].map.dispose();
|
||||
testmesh2.material[j].dispose();
|
||||
}
|
||||
|
||||
// scope.linkdata.push(testmesh2);
|
||||
// scope.linksgroup.add(testmesh2);
|
||||
}
|
||||
let mergemesh = new THREE.Mesh( mergegeometry, autorail.material );
|
||||
scope.linksgroup.add( mergemesh );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// return linklist;
|
||||
|
||||
function linktest(data,scene,assetloader){
|
||||
let autorail = null;
|
||||
let autosuidao = null;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
if(assetloader.modellist[i].deviceType == "autorail"){
|
||||
autorail = assetloader.modellist[i].mesh.children[0];
|
||||
}
|
||||
}
|
||||
|
||||
let rightlist = [];
|
||||
let leftlist = [];
|
||||
let count = autorail.geometry.attributes.position.count;
|
||||
for(let i=0;i<count;i++){
|
||||
if(autorail.geometry.attributes.position.array[i*3] >0.49){
|
||||
rightlist.push(i);
|
||||
}
|
||||
if(autorail.geometry.attributes.position.array[i*3] <-0.49){
|
||||
leftlist.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
autorail.rightlist = rightlist;
|
||||
autorail.leftlist = leftlist;
|
||||
|
||||
|
||||
let reallinks = [];
|
||||
let testlink;
|
||||
testlink = data;
|
||||
if(data){
|
||||
let index,startdata;
|
||||
for(let n=0;n<data.length;n++){
|
||||
if(data[n].leftFdCode == undefined && data[n].leftSdCode == undefined && data[n].rightFdCode ){
|
||||
if(startdata){
|
||||
if(data[n].lp.x<startdata.lp.x){
|
||||
startdata = data[n];
|
||||
index = n;
|
||||
}
|
||||
}else{
|
||||
startdata = data[n];
|
||||
index = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
buildmodel(startdata);
|
||||
reallinks.push(startdata);
|
||||
data.splice(index,1);
|
||||
for(let i=0;i<reallinks.length;i++){
|
||||
for(let j=0;j<data.length;j++){
|
||||
if(reallinks[i].leftFdCode && j>=0){
|
||||
if(reallinks[i].leftFdCode == data[j].code){
|
||||
buildmodel(data[j],reallinks[i],j,"left");
|
||||
reallinks.push(data[j]);
|
||||
data.splice(j,1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
if(reallinks[i].leftSdCode && j>=0){
|
||||
|
||||
if(reallinks[i].leftSdCode == data[j].code){
|
||||
buildmodel(data[j],reallinks[i],j,"left");
|
||||
reallinks.push(data[j]);
|
||||
data.splice(j,1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
|
||||
if(reallinks[i].rightFdCode && j>=0){
|
||||
if(reallinks[i].rightFdCode == data[j].code){
|
||||
|
||||
buildmodel(data[j],reallinks[i],j,"right");
|
||||
reallinks.push(data[j]);
|
||||
data.splice(j,1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
|
||||
if(reallinks[i].rightSdCode && j>=0){
|
||||
if(reallinks[i].rightSdCode == data[j].code){
|
||||
buildmodel(data[j],reallinks[i],j,"right");
|
||||
reallinks.push(data[j]);
|
||||
data.splice(j,1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function buildmodel(data,mdata,sx,direct){
|
||||
let len = data.lengthFact;
|
||||
|
||||
let testmesh2 = autorail.clone(true);
|
||||
for(let i=0;i<autorail.rightlist.length;i++){
|
||||
testmesh2.geometry.attributes.position.array[autorail.rightlist[i]*3] = len-25;
|
||||
testmesh2.geometry.attributes.uv.array[autorail.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
|
||||
}
|
||||
let newrail = new THREE.BufferGeometry();
|
||||
newrail.copy(testmesh2.geometry);
|
||||
testmesh2.geometry = newrail;
|
||||
testmesh2.geometry.attributes.position.needsUpdate = true;
|
||||
testmesh2.geometry.attributes.uv.needsUpdate = true;
|
||||
testmesh2.geometry.computeBoundingSphere();
|
||||
testmesh2.geometry.center();
|
||||
// data.lp.y *= 10;
|
||||
// data.rp.y *= 10;
|
||||
|
||||
if(mdata){
|
||||
|
||||
if(direct == "left"){
|
||||
let dx = Math.abs(data.lp.x - data.rp.x);
|
||||
let dy = Math.abs(data.lp.y - data.rp.y);
|
||||
let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
|
||||
|
||||
data.lp.x = (data.lp.x-data.rp.x)*data.lengthFact/distance+mdata.lp.x;
|
||||
data.lp.y = (data.lp.y-data.rp.y)*data.lengthFact/distance+mdata.lp.y;
|
||||
|
||||
data.rp.x = mdata.lp.x;
|
||||
data.rp.y = mdata.lp.y;
|
||||
|
||||
|
||||
let axix = new THREE.Vector3(1,0,0);
|
||||
let axixnow = new THREE.Vector3(data.rp.x-data.lp.x,0,data.rp.y-data.lp.y);
|
||||
let rotenum = axixnow.angleTo(axix);
|
||||
//不同坐标系方向值不同
|
||||
if(data.lp.y>data.rp.y){
|
||||
testmesh2.rotation.z = 0.218;
|
||||
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
|
||||
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
|
||||
}else if(data.lp.y<data.rp.y){
|
||||
testmesh2.rotation.z = -0.218;
|
||||
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
|
||||
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
|
||||
}else{
|
||||
testmesh2.rotation.z = rotenum;
|
||||
}
|
||||
testmesh2.position.x = (data.rp.x + data.lp.x)/2;
|
||||
testmesh2.position.z = (data.rp.y + data.lp.y)/2;
|
||||
|
||||
}
|
||||
|
||||
if(direct == "right"){
|
||||
|
||||
let dx = Math.abs(data.lp.x - data.rp.x);
|
||||
let dy = Math.abs(data.lp.y - data.rp.y);
|
||||
let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
|
||||
|
||||
|
||||
data.rp.x = (data.rp.x-data.lp.x)*data.lengthFact/distance+mdata.rp.x;
|
||||
data.rp.y = (data.rp.y-data.lp.y)*data.lengthFact/distance+mdata.rp.y;
|
||||
|
||||
data.lp.x = mdata.rp.x;
|
||||
data.lp.y = mdata.rp.y;
|
||||
let axix = new THREE.Vector3(1,0,0);
|
||||
let axixnow = new THREE.Vector3(data.rp.x-data.lp.x,0,data.rp.y-data.lp.y);
|
||||
let rotenum = axixnow.angleTo(axix);
|
||||
//不同坐标系方向值不同
|
||||
if(data.lp.y>data.rp.y){
|
||||
testmesh2.rotation.z = 0.218;
|
||||
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
|
||||
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
|
||||
}else if(data.lp.y<data.rp.y){
|
||||
testmesh2.rotation.z = -0.218;
|
||||
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
|
||||
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
|
||||
}
|
||||
|
||||
testmesh2.position.x = (data.lp.x + data.rp.x)/2;
|
||||
testmesh2.position.z = (data.lp.y + data.rp.y)/2;
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
data.lp.x = data.lp.x;
|
||||
data.rp.x = data.lp.x + data.lengthFact;
|
||||
testmesh2.position.x = (data.lp.x + data.rp.x)/2;
|
||||
testmesh2.position.z = (data.lp.y + data.rp.y)/2;
|
||||
}
|
||||
// testmesh2.position.y = 10;
|
||||
testmesh2.code = data.code;
|
||||
testmesh2.name = data.name;
|
||||
testmesh2.meshtype = "link";
|
||||
testmesh2.lp = data.lp;
|
||||
testmesh2.rp = data.rp;
|
||||
testmesh2.rightlist = autorail.rightlist;
|
||||
testmesh2.leftlist = autorail.leftlist;
|
||||
testmesh2.lengthfact = data.lengthFact;
|
||||
|
||||
scope.linksgroup.add( testmesh2 );
|
||||
scope.linkdata.push(testmesh2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,331 +0,0 @@
|
||||
export function RailList(){
|
||||
let scope = this;
|
||||
|
||||
this.linkrail = [];
|
||||
|
||||
this.switchrail = [];
|
||||
|
||||
this.stops = [];
|
||||
|
||||
this.setrail = function(){
|
||||
|
||||
};
|
||||
this.init = function(linkdata,linklist,sectiondata,switchdata,standsdata,scene,storemod,stopoffset){
|
||||
for(let i=0;i<linkdata.length;i++){
|
||||
scope.linkrail[linkdata[i].code] = {
|
||||
lp:linkdata[i].rail[0],
|
||||
rp:linkdata[i].rail[1],
|
||||
lconnect:null,
|
||||
rconnect:null,
|
||||
lengthfact:linkdata[i].lengthfact,
|
||||
lineleft:null,
|
||||
lineright:null,
|
||||
points:[],
|
||||
type:null
|
||||
};
|
||||
}
|
||||
|
||||
for(let i=0;i<switchdata.length;i++){
|
||||
scope.switchrail[switchdata[i].code] = {
|
||||
alink:switchdata[i].alink,
|
||||
blink:switchdata[i].blink,
|
||||
clink:switchdata[i].clink,
|
||||
position:switchdata[i].position,
|
||||
directtype:null,
|
||||
locateType:0
|
||||
};
|
||||
|
||||
if(scope.linkrail[switchdata[i].blink].lp.x < switchdata[i].position.x){
|
||||
scope.linkrail[switchdata[i].alink].lswitch = switchdata[i].code;
|
||||
scope.linkrail[switchdata[i].blink].rswitch = switchdata[i].code;
|
||||
|
||||
}else{
|
||||
scope.linkrail[switchdata[i].alink].rswitch = switchdata[i].code;
|
||||
scope.linkrail[switchdata[i].blink].lswitch = switchdata[i].code;
|
||||
}
|
||||
//
|
||||
if(scope.linkrail[switchdata[i].clink].lp.x < switchdata[i].position.x){
|
||||
scope.linkrail[switchdata[i].alink].lswitch = switchdata[i].code;
|
||||
scope.linkrail[switchdata[i].clink].rswitch = switchdata[i].code;
|
||||
}else{
|
||||
scope.linkrail[switchdata[i].alink].rswitch = switchdata[i].code;
|
||||
scope.linkrail[switchdata[i].clink].lswitch = switchdata[i].code;
|
||||
}
|
||||
}
|
||||
|
||||
for(let i=0;i<linkdata.length;i++){
|
||||
if(linkdata[i].rotation._z == 0){
|
||||
scope.linkrail[linkdata[i].code].type = 0;
|
||||
if(scope.linkrail[linkdata[i].code].lswitch){
|
||||
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
|
||||
}
|
||||
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z));
|
||||
|
||||
if(scope.linkrail[linkdata[i].code].rswitch){
|
||||
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if(linkdata[i].rotation._z>0){
|
||||
let testline = new THREE.CatmullRomCurve3([
|
||||
new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z),
|
||||
new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z)
|
||||
]);
|
||||
|
||||
scope.linkrail[linkdata[i].code].type = 1;
|
||||
if(scope.linkrail[linkdata[i].code].lswitch){
|
||||
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+4.5,0,switchpoint.z-0.05));
|
||||
}
|
||||
|
||||
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
|
||||
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22));
|
||||
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82));
|
||||
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92));
|
||||
|
||||
if(scope.linkrail[linkdata[i].code].rswitch){
|
||||
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-4.5,0,switchpoint.z+0.05));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
|
||||
}
|
||||
|
||||
}else{
|
||||
let testline = new THREE.CatmullRomCurve3([
|
||||
new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z),
|
||||
new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z)
|
||||
]);
|
||||
scope.linkrail[linkdata[i].code].type = 2;
|
||||
if(scope.linkrail[linkdata[i].code].lswitch){
|
||||
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+4.5,0,switchpoint.z+0.05));
|
||||
}
|
||||
|
||||
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
|
||||
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22));
|
||||
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82));
|
||||
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92));
|
||||
|
||||
if(scope.linkrail[linkdata[i].code].rswitch){
|
||||
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-4.5,0,switchpoint.z-0.05));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
|
||||
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for(let i=0;i<switchdata.length;i++){
|
||||
|
||||
// const ddd = storemod.getters['map/getDeviceByCode'](switchdata[i].code);
|
||||
// scope.switchrail[switchdata[i].code].locateType = ddd.locateType;
|
||||
// if(ddd.locateType == "01"){
|
||||
// //1--向左 2--向右
|
||||
// //__\__ __/__
|
||||
// if(scope.switchrail[switchdata[i].code].directtype == "1"){
|
||||
// scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].blink;
|
||||
// scope.linkrail[switchdata[i].blink].rconnect = switchdata[i].alink;
|
||||
// }else if(scope.switchrail[switchdata[i].code].directtype == "2"){
|
||||
// scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].blink;
|
||||
// scope.linkrail[switchdata[i].blink].lconnect = switchdata[i].alink;
|
||||
// }
|
||||
// }else if(ddd.locateType == "02"){
|
||||
// if(switchdata[i].directtype == "1"){
|
||||
// scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].clink;
|
||||
// scope.linkrail[switchdata[i].clink].rconnect = switchdata[i].alink;
|
||||
// }else if(switchdata[i].directtype == "2"){
|
||||
// scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].clink;
|
||||
// scope.linkrail[switchdata[i].clink].lconnect = switchdata[i].alink;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(scope.linkrail[switchdata[i].blink].lp.x < switchdata[i].position.x){
|
||||
|
||||
scope.switchrail[switchdata[i].code].directtype = "1";
|
||||
}else{
|
||||
|
||||
scope.switchrail[switchdata[i].code].directtype = "2";
|
||||
}
|
||||
|
||||
if(scope.linkrail[switchdata[i].clink].lp.x < switchdata[i].position.x){
|
||||
|
||||
scope.switchrail[switchdata[i].code].directtype = "1";
|
||||
}else{
|
||||
|
||||
scope.switchrail[switchdata[i].code].directtype = "2";
|
||||
}
|
||||
}
|
||||
for(let i=0;i<linkdata.length;i++){
|
||||
scope.linkrail[linkdata[i].code].lineleft = new THREE.CatmullRomCurve3(scope.linkrail[linkdata[i].code].points);
|
||||
scope.linkrail[linkdata[i].code].lineleft.curveType = "centripetal";
|
||||
// scope.linkrail[linkdata[i].code].lineleft.tension = 0.2;
|
||||
let rightpoints = [];
|
||||
scope.linkrail[linkdata[i].code].points.forEach(item=>{
|
||||
rightpoints.push(item);
|
||||
}
|
||||
);
|
||||
rightpoints.reverse();
|
||||
scope.linkrail[linkdata[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
|
||||
scope.linkrail[linkdata[i].code].lineright.curveType = "centripetal";
|
||||
//
|
||||
// for(let n=0,nm=scope.linkrail[linkdata[i].code].lineleft.points.length;n<nm;n++){
|
||||
// var geometry = new THREE.CircleGeometry( 0.05, 16 );
|
||||
// var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
|
||||
// var circle = new THREE.Mesh( geometry, material );
|
||||
// console.log(n);
|
||||
// console.log(scope.linkrail[linkdata[i].code].lineleft.points[n]);
|
||||
// circle.position.x = scope.linkrail[linkdata[i].code].lineleft.points[n].x;
|
||||
// circle.position.y = scope.linkrail[linkdata[i].code].lineleft.points[n].y;
|
||||
// circle.position.z = scope.linkrail[linkdata[i].code].lineleft.points[n].z;
|
||||
// circle.rotation.x = -Math.PI/2;
|
||||
// scene.add( circle );
|
||||
// }
|
||||
// // scope.linkrail[linkdata[i].code].lineright.tension = 0.11;
|
||||
// var points = scope.linkrail[linkdata[i].code].lineleft.getPoints( 50 );
|
||||
// var geometry = new THREE.BufferGeometry().setFromPoints( points );
|
||||
// var material;
|
||||
// if(scope.linkrail[linkdata[i].code].type == 0){
|
||||
// material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
|
||||
// }
|
||||
// if(scope.linkrail[linkdata[i].code].type == 1){
|
||||
// material = new THREE.LineBasicMaterial( { color : 0x00ff00 } );
|
||||
// }
|
||||
// if(scope.linkrail[linkdata[i].code].type == 2){
|
||||
// material = new THREE.LineBasicMaterial( { color : 0x0000ff } );
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Create the final object to add to the scene
|
||||
// var curveObject = new THREE.Line( geometry, material );
|
||||
//
|
||||
// curveObject.position.y = Math.random();
|
||||
// scene.add(curveObject);
|
||||
}
|
||||
let standsections = [];
|
||||
for(let i=0,len=sectiondata.length;i<len;i++){
|
||||
if(sectiondata[i].isStandTrack == true){
|
||||
standsections.push(sectiondata[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(let k in standsdata){
|
||||
let stop = {
|
||||
code:null,
|
||||
direct1:{
|
||||
percent:null,
|
||||
},
|
||||
direct2:{
|
||||
percent:null,
|
||||
}
|
||||
};
|
||||
for(let i=0,leni=standsections.length;i<leni;i++){
|
||||
for(let j=0,lenj=linklist.length;j<lenj;j++){
|
||||
if(standsections[i].linkCode == linklist[j].code){
|
||||
|
||||
// let geometry = new THREE.CircleGeometry( 2, 16 );
|
||||
// let material = new THREE.MeshBasicMaterial( { color: 0x00ffff } );
|
||||
|
||||
if(standsdata[k].direction1.code == standsections[i].relStandCode){
|
||||
stop.code = standsdata[k].code;
|
||||
// let circle1 = new THREE.Mesh( geometry, material );
|
||||
// let circle2 = new THREE.Mesh( geometry, material );
|
||||
let num = scope.linkrail[linklist[j].code].lineleft.points.length-1;
|
||||
let lengthfacts = scope.linkrail[linklist[j].code].lineleft.points[num].x - scope.linkrail[linklist[j].code].lineleft.points[0].x;
|
||||
let directoffset1 = standsdata[k].position.x-stopoffset-scope.linkrail[linklist[j].code].lineleft.points[0].x;
|
||||
stop.direct1.percent = directoffset1/lengthfacts;
|
||||
|
||||
// circle1.position.x = standsdata[k].position.x+stopoffset;
|
||||
// circle1.position.y = 5;
|
||||
// circle1.position.z = scope.linkrail[linklist[j].code].points[0].z;
|
||||
// circle1.rotation.x = -Math.PI/2;
|
||||
//
|
||||
// circle2.position.x = standsdata[k].position.x-stopoffset;
|
||||
// circle2.position.y = 5;
|
||||
// circle2.position.z = scope.linkrail[linklist[j].code].points[0].z;
|
||||
// circle2.rotation.x = -Math.PI/2;
|
||||
// scene.add( circle1 );
|
||||
// scene.add( circle2 );
|
||||
// console.log(stop);
|
||||
}
|
||||
if(standsdata[k].direction2.code == standsections[i].relStandCode){
|
||||
stop.code = standsdata[k].code;
|
||||
// let circle1 = new THREE.Mesh( geometry, material );
|
||||
// let circle2 = new THREE.Mesh( geometry, material );
|
||||
let num = scope.linkrail[linklist[j].code].lineleft.points.length-1;
|
||||
let lengthfacts = scope.linkrail[linklist[j].code].lineleft.points[num].x - scope.linkrail[linklist[j].code].lineleft.points[0].x;
|
||||
|
||||
let directoffset2 = parseInt(standsdata[k].position.x+stopoffset-scope.linkrail[linklist[j].code].lineleft.points[0].x);
|
||||
// console.log(directoffset2);
|
||||
stop.direct2.percent = directoffset2/lengthfacts;
|
||||
// console.log("test");
|
||||
// console.log(directoffset1);
|
||||
// console.log(directoffset2);
|
||||
// console.log("sectoffsetleft");
|
||||
// console.log(stop.direct1.percent);
|
||||
// console.log(scope.linkrail[linklist[j].code].lengthfact);
|
||||
// console.log(lengthfacts);
|
||||
// console.log("........................");
|
||||
// console.log(standsections[i].leftStopPointOffset);
|
||||
// console.log(standsdata[n].position.x-stopoffset-scope.linkrail[linklist[j].code].lineleft.points[0].x);
|
||||
// console.log("........................");
|
||||
// console.log(standsdata[n].position.x+stopoffset);
|
||||
// console.log(scope.linkrail[linklist[j].code].lineleft.getPointAt(stop.direct1.percent).x);
|
||||
// console.log("sectoffsetright");
|
||||
// console.log(scope.linkrail[linklist[j].code]);
|
||||
// console.log(stop.direct2.percent);
|
||||
// console.log(scope.linkrail[linklist[j].code].lengthfact);
|
||||
// console.log(lengthfacts);
|
||||
// console.log("........................");
|
||||
// console.log(standsections[i].rightStopPointOffset);
|
||||
// console.log(standsdata[k].position.x+stopoffset-scope.linkrail[linklist[j].code].lineleft.points[0].x);
|
||||
// console.log("........................");
|
||||
// console.log(standsdata[k].position.x+stopoffset);
|
||||
// console.log(scope.linkrail[linklist[j].code].lineleft.getPointAt(stop.direct2.percent).x);
|
||||
// circle1.position.x = standsdata[k].position.x+stopoffset;
|
||||
// circle1.position.y = 5;
|
||||
// circle1.position.z = scope.linkrail[linklist[j].code].points[0].z;
|
||||
// circle1.rotation.x = -Math.PI/2;
|
||||
// //
|
||||
// circle2.position.x = standsdata[k].position.x-stopoffset;
|
||||
// circle2.position.y = 5;
|
||||
// circle2.position.z = scope.linkrail[linklist[j].code].points[0].z;
|
||||
// circle2.rotation.x = -Math.PI/2;
|
||||
//
|
||||
// scene.add( circle1 );
|
||||
// scene.add( circle2 );
|
||||
// console.log(stop);
|
||||
}
|
||||
if(stop.direct1.percent != null && stop.direct2.percent != null){
|
||||
// console.log(stop)
|
||||
scope.stops[standsdata[k].code] = stop;
|
||||
}
|
||||
|
||||
j = lenj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(scope.stops);
|
||||
}
|
||||
|
||||
this.getrail = function(){
|
||||
|
||||
};
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
import {RealSectionModel} from '@/jlmap3d/edit/editmodel/RealSectionModel.js';
|
||||
|
||||
export function RealSectionList(data) {
|
||||
|
||||
let scope = this;
|
||||
|
||||
this.type = "sectionlist";
|
||||
|
||||
this.list = [];
|
||||
|
||||
this.group = [];
|
||||
|
||||
this.switch = [];
|
||||
|
||||
this.initpromise = function(jlmap3ddata,scene,assetloader,mixers,actions){
|
||||
return new Promise(function(resolve, reject){
|
||||
let modelnum = null;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
if(assetloader.modellist[i].deviceType == "mapSection"){
|
||||
modelnum = i;
|
||||
}
|
||||
}
|
||||
|
||||
let newmesh = assetloader.modellist[modelnum].mesh;
|
||||
let mixer = new THREE.AnimationMixer( newmesh );
|
||||
for(let i=0;i<newmesh.children.length;i++){
|
||||
|
||||
let name = newmesh.children[i].name.split("_");
|
||||
let newmeshname = name[0]+"_"+name[1]+"_"+name[2]+"."+name[3];
|
||||
//console.log(newmeshname);
|
||||
if(name[0] == "Switch"){
|
||||
|
||||
for(let j=0;j<jlmap3ddata.sectionlist.switchs.datalist.length;j++){
|
||||
if(jlmap3ddata.sectionlist.switchs.datalist[j].name == newmeshname){
|
||||
|
||||
//绿色道岔
|
||||
let nowname = jlmap3ddata.sectionlist.switchs.datalist[j].name;
|
||||
let nowcode = jlmap3ddata.sectionlist.switchs.datalist[j].code;
|
||||
newmesh.children[i].name = nowname;
|
||||
newmesh.children[i].code = nowcode;
|
||||
for(let n=0;n<newmesh.children[i].children.length;n++){
|
||||
newmesh.children[i].children[n].code = nowcode;
|
||||
}
|
||||
|
||||
jlmap3ddata.sectionlist.switchs.modellist[j] = newmesh.children[i];
|
||||
for(let m=0;m<newmesh.animations[0].tracks.length;m++){
|
||||
let animatename = newmesh.animations[0].tracks[m].name.split(".");
|
||||
for(let nm=0;nm<jlmap3ddata.sectionlist.switchs.modellist[j].children.length;nm++){
|
||||
if(animatename[0] == jlmap3ddata.sectionlist.switchs.modellist[j].children[nm].name && animatename[1] == "position"){
|
||||
|
||||
let newtracks = newmesh.animations[0].tracks.slice(m,m+6);
|
||||
|
||||
let newclip = new THREE.AnimationClip(jlmap3ddata.sectionlist.switchs.modellist[j].name,2,newtracks);
|
||||
jlmap3ddata.sectionlist.switchs.modellist[j].locateType = null;
|
||||
jlmap3ddata.sectionlist.switchs.modellist[j].animations = [];
|
||||
jlmap3ddata.sectionlist.switchs.modellist[j].animations.push(newclip);
|
||||
let mixer = new THREE.AnimationMixer( jlmap3ddata.sectionlist.switchs.modellist[j] );
|
||||
actions[jlmap3ddata.sectionlist.switchs.modellist[j].name] = mixer.clipAction( jlmap3ddata.sectionlist.switchs.modellist[j].animations[ 0 ] );
|
||||
actions[jlmap3ddata.sectionlist.switchs.modellist[j].name].setLoop(THREE.LoopOnce);
|
||||
actions[jlmap3ddata.sectionlist.switchs.modellist[j].name].clampWhenFinished = true;
|
||||
actions[jlmap3ddata.sectionlist.switchs.modellist[j].name].play();
|
||||
mixers.push(mixer);
|
||||
|
||||
m = newmesh.animations[0].tracks.length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
j = jlmap3ddata.sectionlist.switchs.datalist.length;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(name[0] == "Section"){
|
||||
|
||||
//物理区段
|
||||
if(jlmap3ddata.sectionlist.sections.datalist[newmeshname]){
|
||||
if(jlmap3ddata.sectionlist.sections.datalist[newmeshname].isStandTrack == true){
|
||||
//红色站台区段
|
||||
}else{
|
||||
//蓝色其他区段
|
||||
}
|
||||
let nowname = jlmap3ddata.sectionlist.sections.datalist[newmeshname].name;
|
||||
let nowcode = jlmap3ddata.sectionlist.sections.datalist[newmeshname].code;
|
||||
newmesh.children[i].name = nowname;
|
||||
newmesh.children[i].code = nowcode;
|
||||
let j = jlmap3ddata.sectionlist.sections.datalist[newmeshname].index;
|
||||
jlmap3ddata.sectionlist.sections.modellist.push(newmesh.children[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(name[0] == "Singal"){
|
||||
console.log();
|
||||
newmesh.remove(newmesh.children[i]);
|
||||
i = i-1;
|
||||
}
|
||||
if(name[0] == "Station"){
|
||||
newmesh.remove(newmesh.children[i]);
|
||||
i = i-1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
scene.add(newmesh);
|
||||
|
||||
resolve("loadedrealsection");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
export function RealSectionModel(data) {
|
||||
var scope = this;
|
||||
|
||||
this.mesh = null;
|
||||
this.meshurl = null;
|
||||
this.picurl = null;
|
||||
|
||||
}
|
@ -1,390 +0,0 @@
|
||||
import {SectionModel} from '@/jlmap3d/edit/editmodel/SectionModel.js';
|
||||
import {SwitchModel} from '@/jlmap3d/edit/editmodel/SwitchModel.js';
|
||||
export function SectionList() {
|
||||
|
||||
let scope = this;
|
||||
|
||||
this.type = 'sectionlist';
|
||||
|
||||
let sectiongroup = new THREE.Group();
|
||||
sectiongroup.name = "section";
|
||||
|
||||
let switchgroup = new THREE.Group();
|
||||
switchgroup.name = "switch";
|
||||
|
||||
this.sections = {
|
||||
datalist: [],
|
||||
modellist: []
|
||||
};
|
||||
|
||||
this.switchs = {
|
||||
datalist: [],
|
||||
modellist: []
|
||||
};
|
||||
this.standtrack = [];
|
||||
|
||||
this.initpromise = function (sectiondata, switchdata, scene) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
// 遍历区段
|
||||
|
||||
for (let i=0; i<sectiondata.length; i++) {
|
||||
if (sectiondata[i].type == '01') {
|
||||
// 初始化区段对象数据
|
||||
let newsection = new SectionModel(sectiondata);
|
||||
newsection.name = sectiondata[i].code;
|
||||
newsection.code = sectiondata[i].code;
|
||||
newsection.index = i;
|
||||
newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
if (sectiondata[i].isStandTrack == true) {
|
||||
newsection.rstop = sectiondata[i].offsetRight - sectiondata[i].rightStopPointOffset;
|
||||
newsection.lstop = sectiondata[i].leftStopPointOffset - sectiondata[i].offsetLeft;
|
||||
}
|
||||
newsection.type = sectiondata[i].type;
|
||||
newsection.distance = sectiondata[i].offsetRight - sectiondata[i].offsetLeft;
|
||||
newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
scope.sections.datalist[sectiondata[i].code] = newsection;
|
||||
|
||||
// scope.sections.modellist.push("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 定义区分道岔组
|
||||
let switchlist = [];
|
||||
// 遍历道岔数据
|
||||
for (let i=0; i<switchdata.length; i++) {
|
||||
// 道岔信息
|
||||
let newswitch = {
|
||||
code: null,
|
||||
pa: null,
|
||||
pb: null,
|
||||
pc: null,
|
||||
paname: null,
|
||||
pbname: null,
|
||||
pcname: null
|
||||
};
|
||||
// 获取道岔分辨的点 PS:可能修改动态判断
|
||||
for (let j=0; j<sectiondata.length; j++) {
|
||||
if (switchdata[i].sectionACode == sectiondata[j].code) {
|
||||
newswitch.pa = sectiondata[j].points;
|
||||
newswitch.paname = switchdata[i].sectionACode;
|
||||
}
|
||||
if (switchdata[i].sectionBCode == sectiondata[j].code) {
|
||||
newswitch.pb = sectiondata[j].points;
|
||||
newswitch.pbname = switchdata[i].sectionBCode;
|
||||
}
|
||||
if (switchdata[i].sectionCCode == sectiondata[j].code) {
|
||||
newswitch.pc = sectiondata[j].points;
|
||||
newswitch.pcname = switchdata[i].sectionCCode;
|
||||
}
|
||||
if (newswitch.pa != null && newswitch.pb!= null && newswitch.pc != null) {
|
||||
newswitch.code = switchdata[i].code;
|
||||
switchlist.push(newswitch);
|
||||
j = sectiondata.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 道岔贴图
|
||||
// 遍历道岔信息组合轨道
|
||||
for (let i=0; i<switchlist.length; i++) {
|
||||
// 道岔对象组
|
||||
let newswitch = new SwitchModel();
|
||||
|
||||
newswitch.name = switchlist[i].code;
|
||||
newswitch.code = switchlist[i].code;
|
||||
|
||||
newswitch.index = i;
|
||||
|
||||
scope.switchs.datalist.push(newswitch);
|
||||
scope.switchs.modellist.push('');
|
||||
}
|
||||
|
||||
resolve('loadersection');
|
||||
});
|
||||
|
||||
};
|
||||
this.loadpromise = function(linklist,assetloader,sectiondata,switchdata,scene){
|
||||
return new Promise(function(resolve, reject){
|
||||
// scene.add(sectiongroup);
|
||||
scene.add(switchgroup);
|
||||
let linkdata = linklist;
|
||||
|
||||
// for(let i=0;i<sectiondata.length;i++){
|
||||
// if(sectiondata[i].type == "01"){
|
||||
// //初始化区段对象数据
|
||||
// let newsection = new SectionModel(sectiondata);
|
||||
//
|
||||
// newsection.name = sectiondata[i].code;
|
||||
// newsection.code = sectiondata[i].code;
|
||||
// newsection.index = i;
|
||||
// newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
// newsection.relStandCode = sectiondata[i].relStandCode;
|
||||
// newsection.type = sectiondata[i].type;
|
||||
// newsection.offsetRight = sectiondata[i].offsetRight;
|
||||
// newsection.offsetLeft = sectiondata[i].offsetLeft;
|
||||
// newsection.linkCode = sectiondata[i].linkCode;
|
||||
//
|
||||
// scope.sections.datalist.push(newsection);
|
||||
// // scope.sections.modellist.push("");
|
||||
// }
|
||||
// }
|
||||
|
||||
let autosuidao;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
if(assetloader.modellist[i].deviceType == "autosuidao"){
|
||||
autosuidao = assetloader.modellist[i].mesh.children[0];
|
||||
}
|
||||
}
|
||||
|
||||
for(let i = 0;i < sectiondata.length;i++){
|
||||
|
||||
// let testmesh1 = autosuidao.clone(true);
|
||||
let testmesh1 = {};
|
||||
testmesh1.code = sectiondata[i].code;
|
||||
testmesh1.name = sectiondata[i].code;
|
||||
if(sectiondata[i].relStandCode){
|
||||
testmesh1.relStandCode = sectiondata[i].relStandCode;
|
||||
}else{
|
||||
testmesh1.relStandCode = "";
|
||||
}
|
||||
testmesh1.rightlist = sectiondata[i].rightlist;
|
||||
testmesh1.leftlist = sectiondata[i].leftlist;
|
||||
testmesh1.rightpoint = sectiondata[i].rightpoint;
|
||||
testmesh1.leftpoint = sectiondata[i].leftpoint;
|
||||
testmesh1.isStandTrack = sectiondata[i].isStandTrack;
|
||||
testmesh1.lengthfact = sectiondata[i].lengthfact;
|
||||
// for(let i=0;i<testmesh1.rightlist.length;i++){
|
||||
// testmesh1.geometry.attributes.position.array[testmesh1.rightlist[i]*3] = testmesh1.lengthfact;
|
||||
// testmesh1.geometry.attributes.uv.array[testmesh1.rightlist[i]*2] = (testmesh1.geometry.attributes.position.array[3]-testmesh1.geometry.attributes.position.array[0])/15.3;
|
||||
// }
|
||||
// let newsuidao = new THREE.BufferGeometry();
|
||||
// newsuidao.copy(testmesh1.geometry);
|
||||
// testmesh1.geometry = newsuidao;
|
||||
// testmesh1.geometry.attributes.position.needsUpdate = true;
|
||||
// testmesh1.geometry.attributes.uv.needsUpdate = true;
|
||||
// testmesh1.geometry.computeBoundingSphere();
|
||||
// testmesh1.geometry.center();
|
||||
// testmesh1.position.x = sectiondata[i].position.x;
|
||||
// testmesh1.position.y = sectiondata[i].position.y;
|
||||
// testmesh1.position.z = sectiondata[i].position.z;
|
||||
// testmesh1.rotation.x = -Math.PI/2;
|
||||
// testmesh1.rotation.z = sectiondata[i].rotation._z;
|
||||
//
|
||||
// let newsection = new SectionModel(sectiondata);
|
||||
//
|
||||
// newsection.name = sectiondata[i].code;
|
||||
// newsection.code = sectiondata[i].code;
|
||||
// newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
// newsection.relStandCode = sectiondata[i].relStandCode;
|
||||
// newsection.linkCode = sectiondata[i].linkCode;
|
||||
|
||||
// scope.sections.datalist.push(newsection);
|
||||
|
||||
//
|
||||
// if(testmesh1.isStandTrack == false){
|
||||
// sectiongroup.add(testmesh1);
|
||||
//
|
||||
// }else{
|
||||
// scope.standtrack.push(testmesh1);
|
||||
// var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
|
||||
// sectiongroup.add( box );
|
||||
// }
|
||||
scope.sections.modellist.push(testmesh1);
|
||||
}
|
||||
|
||||
let switchmesh1;
|
||||
let switchmesh2;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
if(assetloader.modellist[i].deviceType == "autoswitch1"){
|
||||
switchmesh1 = assetloader.modellist[i].mesh;
|
||||
}
|
||||
if(assetloader.modellist[i].deviceType == "autoswitch2"){
|
||||
switchmesh2 = assetloader.modellist[i].mesh;
|
||||
}
|
||||
}
|
||||
|
||||
for(let i=0;i<switchdata.length;i++){
|
||||
let newswitch = {
|
||||
code:switchdata[i].code,
|
||||
pa:switchdata[i].pa,
|
||||
pb:switchdata[i].pb,
|
||||
pc:switchdata[i].pc,
|
||||
paname:switchdata[i].paname,
|
||||
pbname:switchdata[i].pbname,
|
||||
pcname:switchdata[i].pcname,
|
||||
alink:switchdata[i].alink,
|
||||
blink:switchdata[i].blink,
|
||||
clink:switchdata[i].clink
|
||||
};
|
||||
let sectionA,sectionB,sectionC;
|
||||
for(let j=0;j<scope.sections.modellist.length;j++){
|
||||
if(newswitch.paname == scope.sections.modellist[j].code){
|
||||
sectionA = scope.sections.modellist[j];
|
||||
}else if(newswitch.pbname == scope.sections.modellist[j].code){
|
||||
sectionB = scope.sections.modellist[j];
|
||||
}else if(newswitch.pcname == scope.sections.modellist[j].code){
|
||||
sectionC = scope.sections.modellist[j];
|
||||
}
|
||||
}
|
||||
let testswitch;
|
||||
|
||||
if(switchdata[i].pa[0].x>switchdata[i].pb[0].x){
|
||||
if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[0].y){
|
||||
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){
|
||||
testswitch = switchmesh1.clone(true);
|
||||
}else{
|
||||
testswitch = switchmesh2.clone(true);
|
||||
}
|
||||
}else{
|
||||
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){
|
||||
testswitch = switchmesh2.clone(true);
|
||||
}else{
|
||||
testswitch = switchmesh1.clone(true);
|
||||
}
|
||||
testswitch.rotation.z = Math.PI;
|
||||
}
|
||||
}else{
|
||||
if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[1].y){
|
||||
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){
|
||||
testswitch = switchmesh1.clone(true);
|
||||
}else{
|
||||
testswitch = switchmesh2.clone(true);
|
||||
}
|
||||
}else{
|
||||
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){
|
||||
testswitch = switchmesh2.clone(true);
|
||||
}else{
|
||||
testswitch = switchmesh1.clone(true);
|
||||
}
|
||||
testswitch.rotation.z = Math.PI;
|
||||
}
|
||||
}
|
||||
|
||||
testswitch.position.x = switchdata[i].position.x;
|
||||
testswitch.position.y = switchdata[i].position.y;
|
||||
testswitch.position.z = switchdata[i].position.z;
|
||||
// testswitch.rotation.x = switchdata[i].rotation._x;
|
||||
// testswitch.rotation.y = switchdata[i].rotation._y;
|
||||
// testswitch.rotation.z = switchdata[i].rotation._z;
|
||||
|
||||
scope.switchs.datalist.push(newswitch);
|
||||
scope.switchs.modellist.push(testswitch);
|
||||
switchgroup.add(testswitch);
|
||||
}
|
||||
|
||||
resolve("loadersection");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function buildsuidao(linkdata,suidaodata,assetloader,scene){
|
||||
let autosuidao;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
if(assetloader.modellist[i].deviceType == "autosuidao"){
|
||||
autosuidao = assetloader.modellist[i].mesh.children[0];
|
||||
}
|
||||
}
|
||||
let rightlist = [];
|
||||
let leftlist = [];
|
||||
let rightpoint = 0;
|
||||
let leftpoint = 0;
|
||||
let count = autosuidao.geometry.attributes.position.count;
|
||||
|
||||
for(let i=0;i<count;i++){
|
||||
if(autosuidao.geometry.attributes.position.array[i*3] >7){
|
||||
rightlist.push(i);
|
||||
if(autosuidao.geometry.attributes.position.array[i*3] > rightpoint){
|
||||
rightpoint = i;
|
||||
}
|
||||
}
|
||||
if(autosuidao.geometry.attributes.position.array[i*3] <-7){
|
||||
leftlist.push(i);
|
||||
if(autosuidao.geometry.attributes.position.array[i*3] < rightpoint){
|
||||
leftpoint = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
autosuidao.rightlist = rightlist;
|
||||
autosuidao.leftlist = leftlist;
|
||||
autosuidao.rightpoint = rightpoint;
|
||||
autosuidao.leftpoint = leftpoint;
|
||||
// console.log(autosuidao);
|
||||
// console.log(linkdata.linksgroup.children);
|
||||
// console.log(suidaodata.datalist);
|
||||
for(let i = 0;i < suidaodata.datalist.length;i++){
|
||||
let link = linkdata.linksgroup.getObjectByProperty("code",suidaodata.datalist[i].linkCode);
|
||||
let suidao = suidaodata.datalist[i];
|
||||
let len = suidao.offsetRight-suidao.offsetLeft;
|
||||
// console.log("-------------------------------------");
|
||||
// console.log("name:"+link.name);
|
||||
// console.log(link.lengthfact);
|
||||
// console.log(len);
|
||||
// console.log("ofl:"+suidao.offsetLeft+" "+"ofr:"+suidao.offsetRight);
|
||||
// console.log("-------------------------------------");
|
||||
|
||||
let testmesh1 = autosuidao.clone(true);
|
||||
for(let i=0;i<autosuidao.rightlist.length;i++){
|
||||
testmesh1.geometry.attributes.position.array[autosuidao.rightlist[i]*3] = len-7.5;
|
||||
testmesh1.geometry.attributes.uv.array[autosuidao.rightlist[i]*2] = (testmesh1.geometry.attributes.position.array[3]-testmesh1.geometry.attributes.position.array[0])/15.3;
|
||||
}
|
||||
let newsuidao = new THREE.BufferGeometry();
|
||||
newsuidao.copy(testmesh1.geometry);
|
||||
testmesh1.geometry = newsuidao;
|
||||
testmesh1.geometry.attributes.position.needsUpdate = true;
|
||||
testmesh1.geometry.attributes.uv.needsUpdate = true;
|
||||
testmesh1.geometry.computeBoundingSphere();
|
||||
testmesh1.geometry.center();
|
||||
let lenfact = link.lengthfact;
|
||||
|
||||
testmesh1.rotation.x = -Math.PI/2;
|
||||
testmesh1.rotation.z = link.rotation.z;
|
||||
//
|
||||
// console.log(link.lp.x);
|
||||
// console.log(link.rp.x);
|
||||
// console.log(suidao.offsetLeft*(len/lenfact));
|
||||
// console.log((link.rp.x-link.lp.x)*(len/lenfact)/2);
|
||||
// console.log("==============");
|
||||
//
|
||||
|
||||
if(testmesh1.rotation.z != 0){
|
||||
|
||||
testmesh1.position.x = link.lp.x+suidao.offsetLeft*(len/lenfact)+ (link.rp.x-link.lp.x)*(len/lenfact)/2;
|
||||
if(link.lp.y > link.rp.y){
|
||||
testmesh1.position.z = link.lp.y-suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2;
|
||||
}else{
|
||||
testmesh1.position.z = link.lp.y+suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2;
|
||||
}
|
||||
}else{
|
||||
testmesh1.position.x = link.lp.x+suidao.offsetLeft+len/2;
|
||||
testmesh1.position.z = link.position.z;
|
||||
}
|
||||
testmesh1.position.y = 3.5;
|
||||
// testmesh1.rotation.x = Math.PI/4;
|
||||
testmesh1.code = suidaodata.datalist[i].code;
|
||||
testmesh1.name = suidaodata.datalist[i].code;
|
||||
// testmesh1.position.z = link.position.z;
|
||||
testmesh1.relStandCode = suidaodata.datalist[i].relStandCode;
|
||||
// testmesh1.stationCode = suidaodata.datalist[i].stationCode;
|
||||
|
||||
testmesh1.rightlist = autosuidao.rightlist;
|
||||
testmesh1.leftlist = autosuidao.leftlist;
|
||||
testmesh1.rightpoint = autosuidao.rightpoint;
|
||||
testmesh1.leftpoint = autosuidao.leftpoint;
|
||||
testmesh1.isStandTrack = suidaodata.datalist[i].isStandTrack;
|
||||
testmesh1.lengthfact = len;
|
||||
testmesh1.linkCode = suidao.linkCode;
|
||||
if(suidaodata.datalist[i].isStandTrack == false){
|
||||
sectiongroup.add(testmesh1);
|
||||
|
||||
}else{
|
||||
scope.standtrack.push(testmesh1);
|
||||
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
|
||||
sectiongroup.add( box );
|
||||
}
|
||||
scope.sections.modellist.push(testmesh1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
export function SectionModel(data) {
|
||||
var scope = this;
|
||||
//命名
|
||||
this.name = null;
|
||||
//code
|
||||
this.code = null;
|
||||
//索引位置
|
||||
this.index = null;
|
||||
//轨迹点
|
||||
this.rail = [];
|
||||
|
||||
this.railline = null;
|
||||
//长度
|
||||
this.distance = [];
|
||||
|
||||
this.isStandTrack = null;
|
||||
|
||||
this.type = null;
|
||||
//指向模型
|
||||
this.mesh = null;
|
||||
// //模型地址
|
||||
// this.meshurl = null;
|
||||
// //贴图地址
|
||||
// this.picurl = null;
|
||||
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
import {SignalModel} from '@/jlmap3d/main/model/SignalModel.js';
|
||||
|
||||
export function SignalList() {
|
||||
|
||||
let scope = this;
|
||||
|
||||
this.type = "signallist";
|
||||
|
||||
this.list = {};
|
||||
|
||||
this.group = new THREE.Group();
|
||||
|
||||
this.initpromise = function(data,scene,assetloader,netdata){
|
||||
return new Promise(function(resolve, reject){
|
||||
scope.group.name = "signal";
|
||||
//遍历信号数据
|
||||
let netsignal = null;
|
||||
let haddata = false;
|
||||
if(netdata){
|
||||
netsignal = JSON.parse(netdata);
|
||||
haddata = true;
|
||||
}
|
||||
let selectmesh = null;
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].deviceType == "signal"){
|
||||
selectmesh = assetloader.modellist[j].mesh;
|
||||
}
|
||||
}
|
||||
for(let i=0;i<data.length;i++){
|
||||
|
||||
let newsignal = new SignalModel(data[i]);
|
||||
let num;
|
||||
if(haddata == false){
|
||||
|
||||
|
||||
let newmesh = selectmesh.clone(true);
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
newmesh.children[j].material.map.uuid = data[i].code+j;
|
||||
console.log(newmesh.children[j].material.map.uuid);
|
||||
}
|
||||
|
||||
newmesh.name = assetloader.modellist[num].id;
|
||||
newmesh.code = data[i].code;
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
newmesh.children[j].code = data[i].code;
|
||||
}
|
||||
|
||||
//根据线路方向修改信号灯位置
|
||||
if(data[i].directionType == "01"){
|
||||
newmesh.position.set(data[i].position.x,1,data[i].position.y-10);
|
||||
newmesh.rotation.z = ( Math.PI / 2 );
|
||||
}else if(data[i].directionType == "02"){
|
||||
newmesh.position.set(data[i].position.x,1,data[i].position.y+10);
|
||||
newmesh.rotation.z = ( - Math.PI / 2 );
|
||||
}
|
||||
|
||||
newsignal.mesh = newmesh;
|
||||
newsignal.mesh.status = "01";
|
||||
scope.group.add(newsignal.mesh);
|
||||
scope.list.push(newsignal);
|
||||
|
||||
}else{
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].id == netsignal[i].modelid){
|
||||
num = j;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
let newmesh = assetloader.modellist[num].mesh.clone(true);
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
let newmaterial = new THREE.MeshPhongMaterial();
|
||||
newmaterial.copy(newmesh.children[j].material);
|
||||
|
||||
newmesh.children[j].material = newmaterial;
|
||||
newmesh.children[j].material.needsUpdate = true;
|
||||
newmaterial.dispose();
|
||||
// newmesh.children[j].material.map
|
||||
}
|
||||
|
||||
newmesh.name = netsignal[i].id;
|
||||
newmesh.code = netsignal[i].code;
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
newmesh.children[j].code = netsignal[i].code;
|
||||
|
||||
}
|
||||
newmesh.position.x = netsignal[i].position.x;
|
||||
newmesh.position.y = netsignal[i].position.y;
|
||||
newmesh.position.z = netsignal[i].position.z;
|
||||
newmesh.rotation.x = netsignal[i].rotation._x;
|
||||
newmesh.rotation.y = netsignal[i].rotation._y;
|
||||
newmesh.rotation.z = netsignal[i].rotation._z;
|
||||
newmesh.scale.x = netsignal[i].scale.x;
|
||||
newmesh.scale.y = netsignal[i].scale.y;
|
||||
newmesh.scale.z = netsignal[i].scale.z;
|
||||
|
||||
newsignal.mesh = newmesh;
|
||||
newsignal.mesh.status = "01";
|
||||
scope.group.add(newsignal.mesh);
|
||||
scope.list[netsignal[i].code] = newsignal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
scene.add(scope.group);
|
||||
|
||||
resolve("loadedsignal");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
export function SignalModel(data) {
|
||||
|
||||
this.uuid = null;
|
||||
this.type = null;
|
||||
this.ismodel = false;
|
||||
this.istexture = false;
|
||||
this.modelurl = null;
|
||||
this.mesh = null;
|
||||
this.meshurl = null;
|
||||
this.textureurl = null;
|
||||
}
|
@ -1,263 +0,0 @@
|
||||
import {StationStandModel} from '@/jlmap3d/main/model/StationStandModel.js';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
export function StationStandList() {
|
||||
|
||||
let scope = this;
|
||||
|
||||
this.type = "stationstandlist";
|
||||
|
||||
this.list = {};
|
||||
|
||||
this.group = new THREE.Group();
|
||||
|
||||
this.textlist = [];
|
||||
|
||||
this.initpromise = function(stationdata,stationstanddata,scene,assetloader,netdata,mixers,actionss,mode){
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
let netstand = null;
|
||||
let haddata = false;
|
||||
if(netdata){
|
||||
netstand = JSON.parse(netdata);
|
||||
haddata = true;
|
||||
}
|
||||
|
||||
scope.group.name = "station";
|
||||
scene.add(scope.group);
|
||||
|
||||
let selectmesh = null;
|
||||
// let topstationmesh = null;
|
||||
let num = null;
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].deviceType == "stand"){
|
||||
num = j;
|
||||
selectmesh = assetloader.modellist[num].mesh;
|
||||
}
|
||||
// if(assetloader.modellist[j].deviceType == "topstand"){
|
||||
// topstationmesh = assetloader.modellist[j].mesh;
|
||||
// }
|
||||
}
|
||||
// console.log(haddata);
|
||||
//遍历车站数据
|
||||
for(let i=0;i<stationdata.length;i++){
|
||||
|
||||
let newstationstand = new StationStandModel(stationdata);
|
||||
//判断站台是否显示
|
||||
if(stationdata[i].visible == true){
|
||||
|
||||
//遍历车站站台数据
|
||||
for(let j=0;j<stationstanddata.length;j++){
|
||||
//收集有效车站数据
|
||||
if(stationstanddata[j].stationCode == stationdata[i].code){
|
||||
|
||||
newstationstand.name = stationdata[i].name;
|
||||
newstationstand.code = stationdata[i].code;
|
||||
|
||||
if(stationstanddata[j].direction == "01"){
|
||||
newstationstand.direction1.position = stationstanddata[j].position;
|
||||
newstationstand.direction1.name = stationstanddata[j].code;
|
||||
newstationstand.direction1.code = stationstanddata[j].code;
|
||||
newstationstand.direction1.screenDoorOpenStatus = "01";
|
||||
}
|
||||
if(stationstanddata[j].direction == "02"){
|
||||
newstationstand.direction2.position = stationstanddata[j].position;
|
||||
newstationstand.direction2.name = stationstanddata[j].code;
|
||||
newstationstand.direction2.code = stationstanddata[j].code;
|
||||
newstationstand.direction2.screenDoorOpenStatus = "01";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scope.list[stationdata[i].code] = newstationstand;
|
||||
newstationstand.num = i;
|
||||
}
|
||||
|
||||
}
|
||||
let map = scope.list;
|
||||
for(let k in map){
|
||||
|
||||
let num;
|
||||
if(haddata == false){
|
||||
|
||||
map[k].mesh = assetloader.modellist[num].mesh.clone(true);
|
||||
map[k].id = assetloader.modellist[num].id;
|
||||
map[k].mesh.code = map[k].code;
|
||||
|
||||
for(let j=0;j<map[k].mesh.children.length;j++){
|
||||
map[k].mesh.children[j].code = map[k].code;
|
||||
}
|
||||
|
||||
map[k].mesh.position.set(map[k].direction1.position.x,-20000,( map[k].direction2.position.y + map[k].direction1.position.y)/2+map[k].height/2 );
|
||||
map[k].type = "station";
|
||||
map[k].rname = stationdata[map[k].index].runPlanName;
|
||||
map[k].kmmark = stationdata[map[k].index].kmPost;
|
||||
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 271, 374, 1 );
|
||||
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[map[k].index]));
|
||||
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
|
||||
let textplane = new THREE.Mesh( textgeometry, textmaterial );
|
||||
textplane.name = stationdata[map[k].index].code;
|
||||
textplane.position.x = 250;
|
||||
textplane.rotation.x = Math.PI;
|
||||
//textplane.position.x = -30;
|
||||
map[k].mesh.add(textplane);
|
||||
|
||||
scope.group.add(map[k].mesh);
|
||||
|
||||
textgeometry.dispose();
|
||||
textmaterial.dispose();
|
||||
textt.dispose();
|
||||
}else{
|
||||
|
||||
for(let netnum =0;netnum <netstand.length;netnum++){
|
||||
if(netstand[netnum].code == k ){
|
||||
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].id == netstand[netnum].modelid){
|
||||
num = j;
|
||||
map[k].index = netnum;
|
||||
// j = assetloader.modellist.length;
|
||||
}
|
||||
}
|
||||
|
||||
map[k].position = netstand[netnum].position;
|
||||
netnum = netstand.length;
|
||||
}
|
||||
|
||||
}
|
||||
map[k].mesh = selectmesh.clone(true);
|
||||
let newclip = selectmesh.animations[ 0 ];
|
||||
|
||||
for(let j=0;j<map[k].mesh.children.length;j++){
|
||||
|
||||
if(map[k].mesh.children[j].name == "top"){
|
||||
map[k].mesh.children[j].animations = [];
|
||||
map[k].mesh.children[j].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( map[k].mesh.children[j] );
|
||||
|
||||
let key = map[k].direction1.name;
|
||||
actionss[key] = {
|
||||
status:"01",
|
||||
action:mixer.clipAction( map[k].mesh.children[j].animations[0])
|
||||
};
|
||||
actionss[key].action.setLoop(THREE.LoopOnce);
|
||||
actionss[key].action.clampWhenFinished = true;
|
||||
//actionss[key].play();
|
||||
mixers.push(mixer);
|
||||
}
|
||||
if(map[k].mesh.children[j].name == "down"){
|
||||
map[k].mesh.children[j].animations = [];
|
||||
map[k].mesh.children[j].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( map[k].mesh.children[j] );
|
||||
|
||||
let key = map[k].direction2.name;
|
||||
actionss[key] = {
|
||||
status:"01",
|
||||
action:mixer.clipAction( map[k].mesh.children[j].animations[0])
|
||||
};
|
||||
actionss[key].action.setLoop(THREE.LoopOnce);
|
||||
actionss[key].action.clampWhenFinished = true;
|
||||
//actionss[key].play();
|
||||
mixers.push(mixer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
map[k].mesh.name = netstand[map[k].index].name;
|
||||
map[k].mesh.code = netstand[map[k].index].code;
|
||||
for(let j=0;j<map[k].mesh.children.length;j++){
|
||||
map[k].mesh.children[j].code = netstand[map[k].index].code;
|
||||
}
|
||||
map[k].mesh.position.x = netstand[map[k].index].position.x-2.34;
|
||||
map[k].mesh.position.y = netstand[map[k].index].position.y;
|
||||
map[k].mesh.position.z = netstand[map[k].index].position.z-0.375;
|
||||
|
||||
|
||||
|
||||
// map[k].mesh.rotation.x = netstand[map[k].index].rotation._x;
|
||||
// map[k].mesh.rotation.y = netstand[map[k].index].rotation._y;
|
||||
// map[k].mesh.rotation.z = netstand[map[k].index].rotation._z;
|
||||
map[k].mesh.scale.x = netstand[map[k].index].scale.x;
|
||||
map[k].mesh.scale.y = netstand[map[k].index].scale.y;
|
||||
map[k].mesh.scale.z = netstand[map[k].index].scale.z;
|
||||
|
||||
if(mode){
|
||||
if(mode == "02"){
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 271, 374, 1 );
|
||||
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[map[k].num]));
|
||||
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
|
||||
let textplane = new THREE.Mesh( textgeometry, textmaterial );
|
||||
textplane.name = stationdata[map[k].num].code;
|
||||
textplane.position.y = 50;
|
||||
textplane.position.z = 250;
|
||||
textplane.rotation.x = Math.PI/2;
|
||||
//textplane.position.x = -30;
|
||||
scope.textlist.push(textplane);
|
||||
map[k].mesh.add(textplane);
|
||||
textgeometry.dispose();
|
||||
textmaterial.dispose();
|
||||
textt.dispose();
|
||||
// let newtopstation = topstationmesh.clone(true);
|
||||
// newtopstation.position.x = map[k].mesh.position.x;
|
||||
// newtopstation.position.z = map[k].mesh.position.z;
|
||||
// scene.add(newtopstation);
|
||||
}
|
||||
}
|
||||
|
||||
map[k].type = "station";
|
||||
map[k].rname = stationdata[map[k].num].runPlanName;
|
||||
map[k].kmmark = stationdata[map[k].num].kmPost;
|
||||
|
||||
scope.group.add(map[k].mesh);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
resolve("loadedstation");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
//canvas文字贴图方法
|
||||
//PS:待提炼 增强功能
|
||||
var stationcanvas = new Image();
|
||||
stationcanvas.src = JL3D_LOCAL_STATIC+"/texture/msgt.png";
|
||||
function getTextCanvas(text){
|
||||
let canvas = document.getElementById('canvastexture');
|
||||
|
||||
canvas.width = 256;
|
||||
canvas.height = 512;
|
||||
// canvas.style.width = width;
|
||||
// canvas.style.height = height;
|
||||
|
||||
let ctx = canvas.getContext('2d');
|
||||
//ctx.fillStyle = '#FFFFFF';
|
||||
ctx.fillRect(0, 0,256,512);
|
||||
|
||||
ctx.fillStyle = '#FFFFFF';
|
||||
// ctx.textAlign = 'center';
|
||||
// ctx.textBaseline = 'middle';
|
||||
ctx.clearRect(0,0,256,512);
|
||||
|
||||
ctx.drawImage(stationcanvas,0,0,256,512);
|
||||
|
||||
ctx.font = "20px Verdana";
|
||||
ctx.fillText("车站名称: "+text.name, 20,58);
|
||||
|
||||
ctx.fillText("漫游", 30,100);
|
||||
ctx.fillText("信息", 114,100);
|
||||
ctx.fillText("备忘", 190,100);
|
||||
|
||||
ctx.fillText("车站序号: "+text.name, 10,155);
|
||||
|
||||
ctx.fillText("公里标记:"+text.kmPost,10 ,256*3/4);
|
||||
|
||||
let data = ctx.getImageData(0, 0,256,512);
|
||||
return data;
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
export function StationStandModel(opts) {
|
||||
|
||||
var scope = this;
|
||||
|
||||
this.uuid = null;
|
||||
this.code = null;
|
||||
this.name = null;
|
||||
this.type = null;
|
||||
|
||||
this.ismodel = false;
|
||||
this.istexture = false;
|
||||
this.modelurl = null;
|
||||
this.index = null;
|
||||
this.direction1= {
|
||||
position:null,
|
||||
name:null,
|
||||
screenDoorOpenStatus:null,
|
||||
mesh:null,
|
||||
openpos:[],
|
||||
closepos:[]
|
||||
}
|
||||
this.direction2= {
|
||||
position:null,
|
||||
name:null,
|
||||
screenDoorOpenStatus:null,
|
||||
mesh:null,
|
||||
openpos:[],
|
||||
closepos:[]
|
||||
}
|
||||
|
||||
this.mesh = null;
|
||||
this.meshurl = null;
|
||||
this.picurl = null;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
|
||||
|
||||
export function SwitchList() {
|
||||
|
||||
this.type = "switchlist";
|
||||
|
||||
this.list = null;
|
||||
|
||||
this.init = function(){
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
export function SwitchModel() {
|
||||
|
||||
var scope = this;
|
||||
//命名
|
||||
this.name = null;
|
||||
//code
|
||||
this.code = null;
|
||||
//索引位置
|
||||
this.index = null;
|
||||
|
||||
this.locateType = null;
|
||||
//轨迹点
|
||||
this.rail = [];
|
||||
//长度
|
||||
this.distance = null;
|
||||
|
||||
this.action = null;
|
||||
//指向模型
|
||||
this.mesh = null;
|
||||
// //模型地址
|
||||
// this.meshurl = null;
|
||||
// //贴图地址
|
||||
// this.picurl = null;
|
||||
}
|
@ -1,243 +0,0 @@
|
||||
import {TrainModel} from '@/jlmap3d/edit/editmodel/TrainModel.js';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
export function TrainList() {
|
||||
|
||||
let scope = this;
|
||||
|
||||
this.type = "trainlist";
|
||||
|
||||
this.list = {};
|
||||
|
||||
this.group = new THREE.Group();
|
||||
this.group.name = "train";
|
||||
this.textlist = [];
|
||||
|
||||
this.initpromise = function(data,scene,assetloader,mixers,actionss,mode){
|
||||
return new Promise(function(resolve, reject){
|
||||
let selectmesh,ntracks1,ntracks2,tclip,fclip;
|
||||
for(let n=assetloader.modellist.length-1;n>=0;n--){
|
||||
if(assetloader.modellist[n].deviceType == "train"){
|
||||
|
||||
selectmesh = assetloader.modellist[n].mesh
|
||||
|
||||
ntracks1 = assetloader.modellist[n].animations.slice(16,27);
|
||||
|
||||
tclip = new THREE.AnimationClip("three",2,ntracks1);
|
||||
|
||||
ntracks2 = assetloader.modellist[n].animations.slice(0,15);
|
||||
|
||||
fclip = new THREE.AnimationClip("four",2,ntracks2);
|
||||
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
//遍历列车数据
|
||||
// console.log(data.length);
|
||||
for(let i=0;i<data.length;i++){
|
||||
|
||||
|
||||
actionss[data[i].code] = {
|
||||
top:[],
|
||||
down:[]
|
||||
};
|
||||
let newmesh = selectmesh.clone(true);
|
||||
newmesh.mixer = [];
|
||||
// console.log("-------------------------");
|
||||
// console.log(data[i]);
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
|
||||
if(newmesh.children[j].name == "c1" || newmesh.children[j].name == "c6"){
|
||||
// console.log("===================");
|
||||
for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){
|
||||
|
||||
if(newmesh.children[j].children[n].name == "top"){
|
||||
newmesh.children[j].children[n].animations = [];
|
||||
newmesh.children[j].children[n].animations.push(tclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
|
||||
// console.log(n);
|
||||
// console.log(newmesh.children[j].children[n]);
|
||||
newmesh.mixer.push(mixer);
|
||||
newmesh.mixerpush = false;
|
||||
// mixers.push(mixer);
|
||||
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
|
||||
//action.play();
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
actionss[data[i].code].top.push(action);
|
||||
|
||||
}
|
||||
|
||||
if(newmesh.children[j].children[n].name == "down"){
|
||||
newmesh.children[j].children[n].animations = [];
|
||||
newmesh.children[j].children[n].animations.push(tclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
|
||||
|
||||
newmesh.mixer.push(mixer);
|
||||
newmesh.mixerpush = false;
|
||||
// mixers.push(mixer);
|
||||
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
|
||||
//action.play();
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
actionss[data[i].code].down.push(action);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){
|
||||
if(newmesh.children[j].children[n].name == "top"){
|
||||
newmesh.children[j].children[n].animations = [];
|
||||
newmesh.children[j].children[n].animations.push(fclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
|
||||
newmesh.mixer.push(mixer);
|
||||
newmesh.mixerpush = false;
|
||||
// mixers.push(mixer);
|
||||
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
|
||||
//action.play();
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
actionss[data[i].code].top.push(action);
|
||||
}
|
||||
|
||||
if(newmesh.children[j].children[n].name == "down"){
|
||||
newmesh.children[j].children[n].animations = [];
|
||||
newmesh.children[j].children[n].animations.push(fclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
|
||||
newmesh.mixer.push(mixer);
|
||||
newmesh.mixerpush = false;
|
||||
// mixers.push(mixer);
|
||||
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
|
||||
//action.play();
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
actionss[data[i].code].down.push(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
//newmesh.children[j].name = data[i].code;
|
||||
newmesh.children[j].code = data[i].code;
|
||||
newmesh.children[j].axis = new THREE.Vector3();
|
||||
newmesh.children[j].up = new THREE.Vector3(1, 0, 0);
|
||||
// newmesh.axis = new THREE.Vector3();
|
||||
// newmesh.up = new THREE.Vector3(1, 0, 0);
|
||||
// var pos = new THREE.Mesh( geometryp, materialp);
|
||||
// pos.position.x = -73.5;
|
||||
// newmesh.children[j].add( pos );
|
||||
newmesh.children[j].rotalist = [];
|
||||
// console.log(newmesh);
|
||||
}
|
||||
//
|
||||
// // newmesh.children[4].add(newmesh.children[5]);
|
||||
// // newmesh.children[3].add(newmesh.children[4]);
|
||||
// // newmesh.children[2].add(newmesh.children[3]);
|
||||
// // newmesh.children[1].add(newmesh.children[2]);
|
||||
// // newmesh.children[0].add(newmesh.children[1]);
|
||||
// for(let n=newmesh.children.length-1;n>=1;n--){
|
||||
// newmesh.children[n].position.x = -76;
|
||||
// newmesh.children[n-1].add(newmesh.children[n]);
|
||||
// }
|
||||
//创建列车字牌
|
||||
if(mode){
|
||||
if(mode == "02"){
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 150, 100, 1 );
|
||||
let textt = new THREE.CanvasTexture(getTextCanvas(data[i]));
|
||||
let textmaterial = new THREE.MeshBasicMaterial( {
|
||||
side: THREE.DoubleSide,
|
||||
map:textt ,transparent: true,
|
||||
alphaTest:0.1
|
||||
} );
|
||||
let textplane = new THREE.Mesh( textgeometry, textmaterial );
|
||||
textplane.name = data[i].code;
|
||||
textplane.position.x = 0;
|
||||
textplane.position.y = 0;
|
||||
textplane.position.z = 60;
|
||||
textplane.tcode = data[i].code;
|
||||
//textplane.rotation.x = Math.PI;
|
||||
scope.textlist.push(textplane);
|
||||
newmesh.children[0].add(textplane);
|
||||
textgeometry.dispose();
|
||||
textmaterial.dispose();
|
||||
textt.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//group.add(textplane);
|
||||
newmesh.first = false;
|
||||
newmesh.name = data[i].code;
|
||||
newmesh.rname = data[i].groupNumber;
|
||||
newmesh.groupNumber = data[i].groupNumber;
|
||||
|
||||
newmesh.position.set(0,-50000,0);
|
||||
// newmesh.children[0].position.y = 0;
|
||||
//newmesh.rotation.y = Math.PI/2;
|
||||
newmesh.status = "00";
|
||||
newmesh.nowcode = null;
|
||||
newmesh.curve = null;
|
||||
newmesh.doorStatus = "01";
|
||||
newmesh.dispose = true;
|
||||
newmesh.nowsection = null;
|
||||
newmesh.nextsection = null;
|
||||
newmesh.speed = 0;
|
||||
newmesh.speeds = 0;
|
||||
newmesh.progress = null;
|
||||
newmesh.startmark = 0;
|
||||
|
||||
|
||||
scope.list[data[i].code] = newmesh;
|
||||
//scene.add(newmesh);
|
||||
}
|
||||
// console.log(selectmesh);
|
||||
// for(let i=0,leni=selectmesh.children.length;i<leni;i++){
|
||||
// selectmesh.children[i].geometry.dispose();
|
||||
// selectmesh.children[i].material.dispose();
|
||||
// }
|
||||
scene.add(scope.group);
|
||||
resolve("loadedtrain");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let onProgress = function ( xhr ) {
|
||||
|
||||
if ( xhr.lengthComputable ) {
|
||||
|
||||
let percentComplete = xhr.loaded / xhr.total * 100;
|
||||
console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
let onError = function () { };
|
||||
|
||||
var beauty = new Image();
|
||||
beauty.src = JL3D_LOCAL_STATIC+"/texture/guide.png";
|
||||
//canvas文字贴图方法
|
||||
//PS:待提炼 增强功能
|
||||
function getTextCanvas(text){
|
||||
var canvas = document.getElementById('canvastexture');
|
||||
|
||||
canvas.width = 128;
|
||||
canvas.height = 64;
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
//var bg = canvas.createPattern(img, "no-repeat");
|
||||
//ctx.fillStyle = bg;
|
||||
ctx.fillRect(0, 0,128,64);
|
||||
ctx.font = "8px Verdana";
|
||||
ctx.fillStyle = '#000000';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.clearRect(0,0,128,64);
|
||||
//console.log(text.groupNumber);
|
||||
ctx.drawImage(beauty,0,0,128, 64);
|
||||
ctx.fillText("车组号:"+text.groupNumber, 40,10);
|
||||
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,128,64);
|
||||
return data;
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
export function TrainModel(opts) {
|
||||
|
||||
var scope = this;
|
||||
|
||||
this.mesh = null;
|
||||
this.meshurl = null;
|
||||
this.picurl = null;
|
||||
}
|
@ -17,7 +17,6 @@ const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive');
|
||||
const Jlmap3dSandbox = () => import('@/views/jlmap3d/simulation/jl3dsimulation');
|
||||
const Jlmap3dPassFlow = () => import('@/views/jlmap3d/passflow/jl3dpassflow');
|
||||
const Jlmap3dModel = () => import('@/views/jlmap3d/device/jl3ddevice');
|
||||
const Jlmap3dTrain = () => import('@/views/jlmap3d/devicetrain/jl3ddevicetrain');
|
||||
const Jlmap3dMaintainer = () => import('@/views/jlmap3d/maintainer/jl3dmaintainer');
|
||||
const Jlmap3dMaintainerVr = () => import('@/views/jlmap3d/maintainer/jl3dmaintainervr');
|
||||
const Jl3dTrainRescueVr = () => import('@/views/jlmap3d/maintainer/jl3dTrainRescueVr');
|
||||
@ -244,11 +243,6 @@ export const constantRoutes = [
|
||||
component: Jlmap3dModel,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/gzzbxy/relay/:deviceid', // 贵阳 继电器
|
||||
component: Jlmap3dTrain,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/jlmap3d/maintainer',
|
||||
component: Jlmap3dMaintainer,
|
||||
|
@ -14,7 +14,6 @@ const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive');
|
||||
const Jlmap3dSandbox = () => import('@/views/jlmap3d/simulation/jl3dsimulation');
|
||||
const Jlmap3dModel = () => import('@/views/jlmap3d/device/jl3ddevice');
|
||||
const Jlmap3dPassFlow = () => import('@/views/jlmap3d/passflow/jl3dpassflow');
|
||||
const Jlmap3dTrain = () => import('@/views/jlmap3d/devicetrain/jl3ddevicetrain');
|
||||
const DisplayNew = () => import('@/views/newMap/displayNew/index');
|
||||
|
||||
const TrainRoom = () => import('@/views/trainRoom/index');
|
||||
@ -185,11 +184,6 @@ export const constantRoutes = [
|
||||
component: Jlmap3dPassFlow,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/jlmap3d/devicetrain',
|
||||
component: Jlmap3dTrain,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/404',
|
||||
component: Errpr404,
|
||||
|
@ -2,8 +2,8 @@ export function getBaseUrl() {
|
||||
let BASE_API;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.3.169:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.175:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||
|
@ -1,149 +0,0 @@
|
||||
<template>
|
||||
<div class="editassets">
|
||||
<div class="asset-list">
|
||||
<el-tabs style="margin:5px" v-model="activeName">
|
||||
|
||||
<el-tab-pane class="displayscrol" label="设备部件" name="train">
|
||||
<el-scrollbar ref="devicescrol" style="height:100%;margin-bottom:1px">
|
||||
<el-form ref="form" label-width="120px" size="mini">
|
||||
<div class="displaylist" v-for="(part,index) in devicelist" @click="deviceselect(index,part)" v-show="true" >
|
||||
<div >
|
||||
<p style="border:1px solid #000;">设备名称:{{part.text}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
</el-tab-pane>
|
||||
|
||||
|
||||
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
export default {
|
||||
name: 'Jl3ddevicetrainMenu',
|
||||
components: {
|
||||
|
||||
},
|
||||
props: ['devicelist'],
|
||||
data() {
|
||||
return {
|
||||
activeName: 'train',
|
||||
filterText: '',
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'label'
|
||||
},
|
||||
devicetype:true,
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.tree2.filter(val);
|
||||
},
|
||||
|
||||
'devicelist.length':function(newVal){
|
||||
this.$refs.devicescrol.update()
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
deviceselect(index,train){
|
||||
this.$emit('sdevice',train);
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
},
|
||||
init: function() {
|
||||
|
||||
},
|
||||
back() {
|
||||
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
.editassets {
|
||||
position: absolute;
|
||||
float:right;
|
||||
right:0;
|
||||
top:0;
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
background-color: #FFFFFF;
|
||||
// background-repeat: no-repeat;
|
||||
// background-size: 100%;
|
||||
// border-radius:5px;
|
||||
}
|
||||
|
||||
.asset-list{
|
||||
position:absolute;
|
||||
left:0;
|
||||
width: 90%;
|
||||
height: 100%;
|
||||
left: 5px;
|
||||
top: 15px;
|
||||
|
||||
|
||||
}
|
||||
.default-scrollbar {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.el-scrollbar__wrap.default-scrollbar__wrap {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.el-scrollbar__view.default-scrollbar__view {}
|
||||
.displayscrol{
|
||||
|
||||
height: 100%;
|
||||
}
|
||||
.displaylist {
|
||||
float:left;
|
||||
position: relative;
|
||||
width:80%;
|
||||
height:20px;
|
||||
margin:0px 0px 20px 0px;
|
||||
|
||||
}
|
||||
.modelpic{
|
||||
left:0;
|
||||
position: absolute;
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.modeltop{
|
||||
bottom:0;
|
||||
z-index:0;
|
||||
}
|
||||
.modeldown{
|
||||
top:0;
|
||||
z-index:0;
|
||||
}
|
||||
|
||||
</style>
|
@ -1,559 +0,0 @@
|
||||
<template>
|
||||
<div class="jl3ddevice">
|
||||
<div id="jl3d" class="jl3ddraw">
|
||||
|
||||
</div>
|
||||
<Jl3ddevicetrain-Menu :devicelist="devicelist" @sdevice="sdevice" >
|
||||
</Jl3ddevicetrain-Menu>
|
||||
<div class="menutop">
|
||||
<el-button-group>
|
||||
|
||||
|
||||
</el-button-group>
|
||||
</div>
|
||||
<div class="menudown" v-show = "modelcontrolview">
|
||||
<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="dispersed">{{devicestats}}</el-button>
|
||||
<el-button type="primary" @click="selectdevice">返回继电器柜</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
|
||||
<div id="testjlmap3d" class="jlmap3ddraw">
|
||||
<canvas id="canvastexture" />
|
||||
</div>
|
||||
<div class="showmsg" :style="{'background-image': 'url('+localStatic+'/texture/showmsg.png)'}" v-show="msgshow">
|
||||
<div class="msgtop">
|
||||
{{devicename}}
|
||||
</div>
|
||||
<div class="msgdown">
|
||||
{{devicemsg}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="jlmap3dstats" >
|
||||
<div class="modeldiv" v-show="showa1700">
|
||||
<div class="statusdiv">JWJXC-1700</div>
|
||||
<div class="statusdiv">状态:{{statsa1700}}</div>
|
||||
<div class="statusdiv" @click="switcha1700">{{texta1700}}</div>
|
||||
</div>
|
||||
|
||||
<div class="modeldiv" v-show="showb1700">
|
||||
<div class="statusdiv">JWJXC-1700</div>
|
||||
<div class="statusdiv">状态:{{statsb1700}}</div>
|
||||
<div class="statusdiv" @click="switchb1700">{{textb1700}}</div>
|
||||
</div>
|
||||
|
||||
<div class="modeldiv" v-show="showc1700">
|
||||
<div class="statusdiv">JWJXC-1700</div>
|
||||
<div class="statusdiv">状态:{{statsc1700}}</div>
|
||||
<div class="statusdiv" @click="switchc1700">{{textc1700}}</div>
|
||||
</div >
|
||||
|
||||
<div class="modeldiv" v-show="showh125">
|
||||
<div class="statusdiv">JZJXC-H18</div>
|
||||
<div class="statusdiv">状态:{{statsh18}}</div>
|
||||
<div class="statusdiv" @click="switchh18">{{texth18}}</div>
|
||||
</div>
|
||||
|
||||
<div class="modeldiv" v-show="showh18">
|
||||
<div class="statusdiv">JWJXC-H125</div>
|
||||
<div class="statusdiv">状态:{{statsh125}}</div>
|
||||
<div class="statusdiv" @click="switch1000">{{texth125}}</div>
|
||||
</div>
|
||||
|
||||
<div class="modeldiv" v-show="show135">
|
||||
<div class="statusdiv">JYJXC-135</div>
|
||||
<div class="statusdiv">状态:{{stats135}}</div>
|
||||
<div class="statusdiv" @click="switch480">{{text135}}</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
import { Jl3ddevice } from '@/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js';
|
||||
import Jl3ddevicetrainMenu from '@/views/jlmap3d/devicetrain/component/devicetrainmenu';
|
||||
export default {
|
||||
name: 'devicetrain',
|
||||
components: {
|
||||
Jl3ddevicetrainMenu
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
localStatic:JL3D_LOCAL_STATIC,
|
||||
device: this.$route.params.deviceid,
|
||||
jl3d: null,
|
||||
devicelist:[],
|
||||
msgshow:false,
|
||||
devicename:"",
|
||||
devicemsg:"",
|
||||
devicestats:"分步拆解",
|
||||
disperreset:"整体拆解",
|
||||
statsa1700:"off",
|
||||
statsb1700:"off",
|
||||
statsc1700:"off",
|
||||
statsh125:"off",
|
||||
statsh18:"off",
|
||||
stats135:"off",
|
||||
|
||||
texta1700:"关",
|
||||
textb1700:"关",
|
||||
textc1700:"关",
|
||||
texth125:"关",
|
||||
texth18:"关",
|
||||
text135:"关",
|
||||
|
||||
ona1700:false,
|
||||
onb1700:false,
|
||||
onc1700:false,
|
||||
onh125:false,
|
||||
onh18:false,
|
||||
on135:false,
|
||||
|
||||
showa1700:true,
|
||||
showb1700:true,
|
||||
showc1700:true,
|
||||
showh125:true,
|
||||
showh18:true,
|
||||
show135:true,
|
||||
|
||||
modelcontrolview:false,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// '$store.state.socket.device.code': {
|
||||
// handler: function (newVal, oldVal) {
|
||||
// if (newVal != oldVal) {
|
||||
// this.jl3d.selectmodel(this.$store.state.socket.device);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// '$store.state.socket.device': {
|
||||
// deep: true,
|
||||
// handler: function (newVal, oldVal) {
|
||||
// if (newVal.code == oldVal.code) {
|
||||
// this.jl3d.updateaction(newVal);
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// },
|
||||
'jl3d.animastats': {
|
||||
handler: function (newVal, oldVal) {
|
||||
if (newVal != oldVal) {
|
||||
if(newVal == false){
|
||||
this.devicestats = "分步拆解";
|
||||
|
||||
this.disperreset = "整体拆解";
|
||||
}
|
||||
if(newVal == true){
|
||||
this.devicestats = "分步复位";
|
||||
|
||||
this.disperreset = "整体复位";
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
code() {
|
||||
return this.$route.query.code;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.updatemenulist = this.updatemenulist;
|
||||
window.updatemsg = this.updatemsg;
|
||||
window.upjdqstats = this.upjdqstats;
|
||||
this.init();
|
||||
},
|
||||
beforeDestroy() {
|
||||
},
|
||||
methods: {
|
||||
init: function () {
|
||||
// let mapdata = this.$store.state.socket.device;
|
||||
let dom = document.getElementById('jl3d');
|
||||
this.jl3d = new Jl3ddevice(dom,this.device);
|
||||
},
|
||||
sdevice(changedata) {
|
||||
|
||||
this.jl3d.updateselect(changedata);
|
||||
|
||||
},
|
||||
selectdevice(device) {
|
||||
this.jl3d.backselect();
|
||||
},
|
||||
dispersed(device) {
|
||||
this.jl3d.disperdevice1();
|
||||
},
|
||||
updatemenulist(devicelist,modelcode) {
|
||||
this.devicelist = devicelist;
|
||||
|
||||
if(modelcode){
|
||||
if(modelcode == "all"){
|
||||
this.showa1700 = true;
|
||||
this.showb1700 = true;
|
||||
this.showc1700 = true;
|
||||
this.showh125 = true;
|
||||
this.showh18 = true;
|
||||
this.show135 = true;
|
||||
this.modelcontrolview = false;
|
||||
}
|
||||
|
||||
if(modelcode == "jdq1"){
|
||||
this.showa1700 = true;
|
||||
this.showb1700 = false;
|
||||
this.showc1700 = false;
|
||||
this.showh125 = false;
|
||||
this.showh18 = false;
|
||||
this.show135 = false;
|
||||
this.modelcontrolview = true;
|
||||
}
|
||||
console.log(modelcode);
|
||||
if(modelcode == "jdq2"){
|
||||
this.showa1700 = false;
|
||||
this.showb1700 = true;
|
||||
this.showc1700 = false;
|
||||
this.showh125 = false;
|
||||
this.showh18 = false;
|
||||
this.show135 = false;
|
||||
this.modelcontrolview = true;
|
||||
}
|
||||
|
||||
if(modelcode == "jdq3"){
|
||||
this.showa1700 = false;
|
||||
this.showb1700 = false;
|
||||
this.showc1700 = true;
|
||||
this.showh125 = false;
|
||||
this.showh18 = false;
|
||||
this.show135 = false;
|
||||
this.modelcontrolview = true;
|
||||
}
|
||||
if(modelcode == "jdq4"){
|
||||
this.showa1700 = false;
|
||||
this.showb1700 = false;
|
||||
this.showc1700 = false;
|
||||
this.showh125 = true;
|
||||
this.showh18 = false;
|
||||
this.show135 = false;
|
||||
this.modelcontrolview = true;
|
||||
}
|
||||
if(modelcode == "jdq5"){
|
||||
this.showa1700 = false;
|
||||
this.showb1700 = false;
|
||||
this.showc1700 = false;
|
||||
this.showh125 = false;
|
||||
this.showh18 = true;
|
||||
this.show135 = false;
|
||||
this.modelcontrolview = true;
|
||||
}
|
||||
if(modelcode == "jdq6"){
|
||||
this.showa1700 = false;
|
||||
this.showb1700 = false;
|
||||
this.showc1700 = false;
|
||||
this.showh125 = false;
|
||||
this.showh18 = false;
|
||||
this.show135 = true;
|
||||
this.modelcontrolview = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
updatemsg(name,text) {
|
||||
// console.log(name);
|
||||
// console.log(text);
|
||||
if(name){
|
||||
this.msgshow = true;
|
||||
this.devicename = name;
|
||||
this.devicemsg = text;
|
||||
}else{
|
||||
this.msgshow = false;
|
||||
}
|
||||
},
|
||||
upjdqstats(data){
|
||||
// console.log(data[0].on);
|
||||
if(data[0].on != this.ona1700){
|
||||
if(data[0].on == true){
|
||||
this.texta1700 = "开";
|
||||
this.statsa1700 = "on";
|
||||
this.ona1700 = true;
|
||||
this.jl3d.upmodelaction(0,0);
|
||||
}
|
||||
if(data[0].on == false){
|
||||
this.texta1700 = "关";
|
||||
this.statsa1700 = "off";
|
||||
this.ona1700 = false;
|
||||
this.jl3d.upmodelaction(1,0);
|
||||
}
|
||||
}
|
||||
|
||||
if(data[1].on != this.onb1700){
|
||||
if(data[1].on == true){
|
||||
this.textb1700 = "开";
|
||||
this.statsb1700 = "on";
|
||||
this.onb1700 = true;
|
||||
this.jl3d.upmodelaction(0,1);
|
||||
}
|
||||
if(data[1].on == false){
|
||||
this.textb1700 = "关";
|
||||
this.statsb1700 = "off";
|
||||
this.onb1700 = false;
|
||||
this.jl3d.upmodelaction(1,1);
|
||||
}
|
||||
}
|
||||
|
||||
if(data[2].on != this.onc1700){
|
||||
if(data[2].on == true){
|
||||
this.textc1700 = "开";
|
||||
this.statsc1700 = "on";
|
||||
this.onc1700 = true;
|
||||
this.jl3d.upmodelaction(0,2);
|
||||
}
|
||||
if(data[2].on == false){
|
||||
this.textc1700 = "关";
|
||||
this.statsc1700 = "off";
|
||||
this.onc1700 = false;
|
||||
this.jl3d.upmodelaction(1,2);
|
||||
}
|
||||
}
|
||||
if(data[3].on != this.onh18){
|
||||
if(data[3].on == true){
|
||||
this.texth18 = "开";
|
||||
this.statsh18 = "on";
|
||||
this.onh18 = true;
|
||||
this.jl3d.upmodelaction(0,3);
|
||||
}
|
||||
if(data[3].on == false){
|
||||
this.texth18 = "关";
|
||||
this.statsh18 = "off";
|
||||
this.onh18 = false;
|
||||
this.jl3d.upmodelaction(1,3);
|
||||
}
|
||||
}
|
||||
|
||||
if(data[4].on != this.onh125){
|
||||
if(data[4].on == true){
|
||||
this.texth125 = "开";
|
||||
this.statsh125 = "on";
|
||||
this.onh125 = true;
|
||||
this.jl3d.upmodelaction(0,4);
|
||||
}
|
||||
if(data[4].on == false){
|
||||
this.texth125 = "关";
|
||||
this.statsh125 = "off";
|
||||
this.onh125 = false;
|
||||
this.jl3d.upmodelaction(1,4);
|
||||
}
|
||||
}
|
||||
if(data[5].on != this.on135){
|
||||
if(data[5].on == true){
|
||||
this.text135 = "开";
|
||||
this.stats135 = "on";
|
||||
this.on135 = true;
|
||||
this.jl3d.upmodelaction(0,5);
|
||||
}
|
||||
if(data[5].on == false){
|
||||
this.text135 = "关";
|
||||
this.stats135 = "off";
|
||||
this.on135 = false;
|
||||
this.jl3d.upmodelaction(1,5);
|
||||
}
|
||||
}
|
||||
},
|
||||
switcha1700(){
|
||||
if(this.statsa1700 == "off"){
|
||||
|
||||
this.jl3d.sendmsg(0,0);
|
||||
}else if(this.statsa1700 == "on"){
|
||||
|
||||
this.jl3d.sendmsg(1,0);
|
||||
}
|
||||
},
|
||||
switchb1700(){
|
||||
if(this.statsb1700 == "off"){
|
||||
|
||||
this.jl3d.sendmsg(0,1);
|
||||
}else if(this.statsb1700 == "on"){
|
||||
|
||||
this.jl3d.sendmsg(1,1);
|
||||
}
|
||||
},
|
||||
switchc1700(){
|
||||
if(this.statsc1700 == "off"){
|
||||
|
||||
this.jl3d.sendmsg(0,2);
|
||||
}else if(this.statsc1700 == "on"){
|
||||
|
||||
this.jl3d.sendmsg(1,2);
|
||||
}
|
||||
},
|
||||
switchh18(){
|
||||
if(this.statsh18 == "off"){
|
||||
|
||||
this.jl3d.sendmsg(0,3);
|
||||
}else if(this.statsh18 == "on"){
|
||||
|
||||
this.jl3d.sendmsg(1,3);
|
||||
}
|
||||
},
|
||||
switch1000(){
|
||||
if(this.statsh125 == "off"){
|
||||
|
||||
this.jl3d.sendmsg(0,4);
|
||||
}else if(this.statsh125 == "on"){
|
||||
|
||||
this.jl3d.sendmsg(1,4);
|
||||
}
|
||||
},
|
||||
switch480(){
|
||||
if(this.stats135 == "off"){
|
||||
|
||||
this.jl3d.sendmsg(0,5);
|
||||
}else if(this.stats135 == "on"){
|
||||
|
||||
this.jl3d.sendmsg(1,5);
|
||||
}
|
||||
},
|
||||
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();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
/* #jl3d {
|
||||
width: 937px;
|
||||
height: 937px;
|
||||
} */
|
||||
|
||||
.jl3ddraw {
|
||||
position: absolute;
|
||||
float: left;
|
||||
top:0;
|
||||
/* left: 0; */
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
/* z-index: 1500; */
|
||||
}
|
||||
.showmsg{
|
||||
position: absolute;
|
||||
float:left;
|
||||
left:0;
|
||||
bottom:0;
|
||||
width: 20%;
|
||||
height: 40%;
|
||||
z-index: 10;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100%;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.jlmap3dstats{
|
||||
position: absolute;
|
||||
float:left;
|
||||
/* left:10px; */
|
||||
/* top:20px; */
|
||||
/* width: 60%; */
|
||||
height: 10%;
|
||||
z-index: 10;
|
||||
background-color: #409EFF;
|
||||
border-radius: 4px;
|
||||
color: #FFFFFF
|
||||
/* background-repeat: no-repeat; */
|
||||
/* background-size: 100%; */
|
||||
}
|
||||
|
||||
.modeldiv{
|
||||
float:left;
|
||||
/* width:16.66%; */
|
||||
height:100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.statusdiv{
|
||||
/* float:left; */
|
||||
/* top:50%; */
|
||||
width:150px;
|
||||
height:33%;
|
||||
font-size: 20px;
|
||||
border: 1px solid white;
|
||||
text-align: center;
|
||||
cursor:pointer;
|
||||
}
|
||||
.msgtop{
|
||||
text-align: center;
|
||||
width: 90%;
|
||||
height:10%;
|
||||
position: absolute;
|
||||
top:10%;
|
||||
font-size:30px;
|
||||
color:#FFFFFF;
|
||||
}
|
||||
|
||||
.msgdown{
|
||||
position: absolute;
|
||||
top:20%;
|
||||
left:5%;
|
||||
width: 90%;
|
||||
height:80%;
|
||||
font-size:20px;
|
||||
color:#FFFFFF;
|
||||
word-wrap:break-word;
|
||||
letter-spacing:2px;
|
||||
}
|
||||
|
||||
#testjlmap3d {
|
||||
}
|
||||
|
||||
.jlmap3ddraw {
|
||||
float: left;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position:absolute;
|
||||
z-index: -1;
|
||||
}
|
||||
.menutop{
|
||||
top:0;
|
||||
right:20%;
|
||||
position:absolute;
|
||||
}
|
||||
.menudown{
|
||||
bottom:0;
|
||||
right:20%;
|
||||
position:absolute;
|
||||
}
|
||||
#canvastexture {
|
||||
position: absolute;
|
||||
float: left;
|
||||
left: 0;
|
||||
z-index: -12;
|
||||
}
|
||||
</style>
|
@ -9,11 +9,19 @@
|
||||
<el-button type="primary" @click="switchhide">{{switchshow}}</el-button>
|
||||
</el-button-group>
|
||||
</div> -->
|
||||
<div id="jl3ddevicerepir" class="repirbutton" v-show="repirShow" @click="devicerepir"></div>
|
||||
<div id="jl3ddevicerepir" class="gousuobutton1" v-show="gousuoShow" @click="gousuoDingWei"></div>
|
||||
<div id="jl3ddevicerepir" class="gousuobutton2" v-show="gousuoShow" @click="gousuoFanWei"></div>
|
||||
<div id="jl3ddevicerepir" class="repirbutton"
|
||||
:style="{'background-image': 'url('+localStatic+'/texture/xiuli.png)'}"
|
||||
v-show="repirShow" @click="devicerepir"></div>
|
||||
<div id="jl3ddevicerepir" class="gousuobutton1"
|
||||
:style="{'background-image': 'url('+localStatic+'/texture/gousuodingwei.png)'}"
|
||||
v-show="gousuoShow" @click="gousuoDingWei"></div>
|
||||
<div id="jl3ddevicerepir" class="gousuobutton2"
|
||||
:style="{'background-image': 'url('+localStatic+'/texture/gousuofanwei.png)'}"
|
||||
v-show="gousuoShow" @click="gousuoFanWei"></div>
|
||||
|
||||
<div id="jl3dclose" class="backbutton" @click="close3ddeviceview"></div>
|
||||
<div id="jl3dclose" class="backbutton"
|
||||
:style="{'background-image': 'url('+localStatic+'/texture/xx.png)'}"
|
||||
@click="close3ddeviceview"></div>
|
||||
<Jl3ddevice-Msg v-show="isswitch">
|
||||
</Jl3ddevice-Msg>
|
||||
<Jl3ddevice-List v-show="isswitch" :devicelist="equiplist" @sdevice="sdevice">
|
||||
@ -53,6 +61,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
localStatic:JL3D_LOCAL_STATIC,
|
||||
datastatus:"",
|
||||
jl3d: null,
|
||||
windowstatus:false,
|
||||
@ -344,7 +353,6 @@
|
||||
position: absolute;
|
||||
right:15px;
|
||||
bottom:5px;
|
||||
background-image:url(JL3D_LOCAL_STATIC+"/texture/xiuli.png");
|
||||
background-repeat:no-repeat;
|
||||
background-size:100%;
|
||||
}
|
||||
@ -355,7 +363,6 @@
|
||||
position: absolute;
|
||||
right:345px;
|
||||
bottom:5px;
|
||||
background-image:url(JL3D_LOCAL_STATIC+"/texture/gousuodingwei.png");
|
||||
background-repeat:no-repeat;
|
||||
background-size:100%;
|
||||
}
|
||||
@ -366,7 +373,6 @@
|
||||
position: absolute;
|
||||
right:180px;
|
||||
bottom:5px;
|
||||
background-image:url(JL3D_LOCAL_STATIC+"/texture/gousuofanwei.png");
|
||||
background-repeat:no-repeat;
|
||||
background-size:100%;
|
||||
}
|
||||
@ -376,7 +382,6 @@
|
||||
position: absolute;
|
||||
right:125px;
|
||||
top:5px;
|
||||
background-image:url(JL3D_LOCAL_STATIC+"/texture/xx.png");
|
||||
background-repeat:no-repeat;
|
||||
background-size:100%;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 394 KiB |
Before Width: | Height: | Size: 254 KiB |
Before Width: | Height: | Size: 117 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 612 KiB |
Before Width: | Height: | Size: 394 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 299 KiB |
Before Width: | Height: | Size: 416 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 134 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 41 KiB |