修改三维行车门开关
This commit is contained in:
parent
117487be56
commit
6e3ef32360
@ -73,6 +73,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
//改变当前列车code
|
||||
|
||||
if(data.body.groupNumber){
|
||||
console.log(data.body);
|
||||
changeNowTrain(data.body);
|
||||
updateDriveValue(data.body.groupNumber);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
//console.log(assetloader);
|
||||
console.log(stationstandlist);
|
||||
// console.log(stationstandlist);
|
||||
return tdt.initTdt(stationstandlist.list,mapdata.sectionList,rails.sectionrail,sceneload);
|
||||
})
|
||||
.then(function(data){
|
||||
|
@ -116,7 +116,7 @@
|
||||
<div class="buttontext">{{ $t('jlmap3d.emergencyBraking') }}</div>
|
||||
</div>
|
||||
<div id="doorpick" class="panebutton2" style="top:6%;left:85%;">
|
||||
<img class="buttonimg2" :src="zuoimg" />
|
||||
<img class="buttonimg2" :src="zuoimg" @mouseout='doorModeOut'/>
|
||||
<img id="doormodeniu" class="buttonimg2" :src="niuimg" :style="{transform:doormodetou}" @mousedown='doormodetouchstart'/>
|
||||
<div class="tfbutton" style="font-size:8px;top:11px;left:18px;">AA</div>
|
||||
<div class="tfbutton" style="font-size:8px;top:8px;left:33px;">AM</div>
|
||||
@ -125,7 +125,7 @@
|
||||
</div>
|
||||
|
||||
<div id="doorpick" class="panebutton2" style="bottom:6%;left:85%;">
|
||||
<img class="buttonimg2" :src="zuoimg" />
|
||||
<img class="buttonimg2" :src="zuoimg" @mouseout='doorSelectionOut'/>
|
||||
<img id="doorpickniu" class="buttonimg2" :src="niuimg" :style="{transform:doordirecttou}" @mousedown='doordirecttouchstart'/>
|
||||
<div class="tfbutton" style="font-size:8px;top:11px;left:18px;">{{ $t('jlmap3d.leftSide') }}</div>
|
||||
<div class="tfbutton" style="font-size:8px;top:8px;left:33px;">{{ $t('jlmap3d.location0') }}</div>
|
||||
@ -177,7 +177,7 @@
|
||||
greenimg:JL3D_LOCAL_STATIC+"/jl3d/control/green.png",
|
||||
urgestopimg:JL3D_LOCAL_STATIC+"/jl3d/control/urgestop.png",
|
||||
iconrotate:0,
|
||||
doordirecttou:"rotate(0deg)",
|
||||
doordirecttou:"rotate(415deg)",
|
||||
doormodetou:"rotate(0deg)",
|
||||
watertou:"rotate(0deg)",
|
||||
washtou:"rotate(0deg)",
|
||||
@ -213,6 +213,8 @@
|
||||
x: null,
|
||||
y: null
|
||||
},
|
||||
oldDoorMode:"",
|
||||
oldDoorSelection:"",
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -268,53 +270,6 @@
|
||||
};
|
||||
setTimeout( callback.bind(this),2000);
|
||||
},
|
||||
getAngle:function(mx,my){
|
||||
//圆心坐标
|
||||
let px=140;
|
||||
let py=510;
|
||||
let x = Math.abs(px-mx);
|
||||
let y = Math.abs(py-my);
|
||||
let z = Math.sqrt(Math.pow(x,2)+Math.pow(y,2));
|
||||
let cos = y/z;
|
||||
let radina = Math.acos(cos);//用反三角函数求弧度
|
||||
let angle = Math.floor(180/(Math.PI/radina));//将弧度转换成角度
|
||||
|
||||
if(mx>px&&my>py){//鼠标在第四象限
|
||||
angle = 180 - angle;
|
||||
}
|
||||
|
||||
if(mx==px&&my>py){//鼠标在y轴负方向上
|
||||
angle = 180;
|
||||
}
|
||||
|
||||
if(mx>px&&my==py){//鼠标在x轴正方向上
|
||||
angle = 90;
|
||||
}
|
||||
|
||||
if(mx<px&&my>py){//鼠标在第三象限
|
||||
angle = 180+angle;
|
||||
}
|
||||
|
||||
if(mx<px&&my==py){//鼠标在x轴负方向
|
||||
angle = 270;
|
||||
}
|
||||
|
||||
if(mx<px&&my<py){//鼠标在第二象限
|
||||
angle = 360 - angle;
|
||||
}
|
||||
if(angle<338 && angle>219){
|
||||
|
||||
if(angle<245 && angle>219){
|
||||
this.toutransform = "rotate(305deg)";
|
||||
}else if(angle<295 && angle>245){
|
||||
this.toutransform = "rotate(359deg)";
|
||||
}else if(angle<338 && angle>295){
|
||||
this.toutransform = "rotate(412deg)";
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
doormodetouchstart:function(e){
|
||||
|
||||
|
||||
@ -365,30 +320,28 @@
|
||||
let px=30;
|
||||
let py=30;
|
||||
let command ={
|
||||
groupNumber:this.groupNum,
|
||||
doorMode:""
|
||||
};
|
||||
let angle = this.transAngle(px,py,mx,my);
|
||||
if(angle<250 && angle>140){
|
||||
if(angle<250 && angle>122){
|
||||
if(angle<160 && angle>122){
|
||||
console.log("aa");
|
||||
command.doorMode = "AA";
|
||||
this.doormodetou = "rotate(305deg)";
|
||||
}else if(angle<210 && angle>160){
|
||||
console.log("am");
|
||||
}else if(angle<210 && angle>=160){
|
||||
command.doorMode = "AM";
|
||||
this.doormodetou = "rotate(359deg)";
|
||||
}else if(angle<250 && angle>210){
|
||||
console.log("mm");
|
||||
}else if(angle<250 && angle>=210){
|
||||
command.doorMode = "MM";
|
||||
this.doormodetou = "rotate(50deg)";
|
||||
}
|
||||
if(command.doorMode != this.oldDoorMode ){
|
||||
this.oldDoorMode = command.doorMode;
|
||||
trainSimulationDoorMode(this.group,command).then(netdata => {
|
||||
if(netdata.data == true){
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
trainSimulationDoorMode(this.group,command).then(netdata => {
|
||||
if(netdata.data == true){
|
||||
console.log(netdata.data);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
getDirectAngle:function(mx,my){
|
||||
//圆心坐标
|
||||
@ -398,27 +351,39 @@
|
||||
let py=30;
|
||||
let angle = this.transAngle(px,py,mx,my);
|
||||
let command ={
|
||||
groupNumber:this.groupNum,
|
||||
doorSelection:""
|
||||
};
|
||||
if(angle<250 && angle>140){
|
||||
if(angle<250 && angle>122){
|
||||
if(angle<160 && angle>122){
|
||||
command.doorSelection = "R";
|
||||
this.doordirecttou = "rotate(305deg)";
|
||||
}else if(angle<210 && angle>160){
|
||||
}else if(angle<210 && angle>=160){
|
||||
command.doorSelection = "Z";
|
||||
this.doordirecttou = "rotate(359deg)";
|
||||
}else if(angle<250 && angle>210){
|
||||
}else if(angle<250 && angle>=210){
|
||||
command.doorSelection = "L";
|
||||
this.doordirecttou = "rotate(412deg)";
|
||||
}
|
||||
}
|
||||
// console.log(angle);
|
||||
// console.log(command.doorSelection);
|
||||
// console.log(this.oldDoorSelection);
|
||||
if(command.doordirecttou != this.oldDoorSelection){
|
||||
// console.log(command.doorSelection);
|
||||
this.oldDoorSelection = command.doorSelection;
|
||||
trainSimulationDoorSelection(this.group,command).then(netdata => {
|
||||
if(netdata.data == true){
|
||||
console.log(netdata.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
doorSelectionOut: function(event){
|
||||
document.getElementById("doorpickniu").onmousemove = null;
|
||||
document.getElementById("doorpickniu").onmouseup = null;
|
||||
},
|
||||
doorModeOut: function(event){
|
||||
document.getElementById("doormodeniu").onmousemove = null;
|
||||
document.getElementById("doormodeniu").onmouseup = null;
|
||||
},
|
||||
transAngle: function(px,py,mx,my){
|
||||
let x = Math.abs(px-mx);
|
||||
let y = Math.abs(py-my);
|
||||
@ -583,6 +548,7 @@
|
||||
// console.log(netdata);
|
||||
});
|
||||
},
|
||||
|
||||
updatabuttonlight: function (data){
|
||||
// console.log(data);
|
||||
// if(data.runLevel){
|
||||
@ -593,6 +559,7 @@
|
||||
// this.cbtcbuttonimg = this.greenimg;
|
||||
// }
|
||||
// }
|
||||
// console.log(data);
|
||||
if(data.driveMode){
|
||||
|
||||
// this.driveMode = data.driveMode;
|
||||
@ -622,6 +589,32 @@
|
||||
}
|
||||
}
|
||||
|
||||
if(data.doorMode){
|
||||
this.oldDoorMode = data.doorMode;
|
||||
if(data.doorMode == "AA"){
|
||||
this.doormodetou = "rotate(305deg)";
|
||||
}
|
||||
if(data.doorMode == "AM"){
|
||||
this.doormodetou = "rotate(359deg)";
|
||||
}
|
||||
if(data.doorMode == "MM"){
|
||||
this.doormodetou = "rotate(50deg)";
|
||||
}
|
||||
}
|
||||
|
||||
if(data.doorSelection){
|
||||
this.oldDoorSelection = data.doorSelection;
|
||||
if(data.doorSelection == "R"){
|
||||
this.doordirecttou = "rotate(305deg)";
|
||||
}
|
||||
if(data.doorSelection == "Z"){
|
||||
this.doordirecttou = "rotate(359deg)";
|
||||
}
|
||||
if(data.doorSelection == "L"){
|
||||
this.doordirecttou = "rotate(412deg)";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user