修改三维行车门开关

This commit is contained in:
sunzhenyu 2021-09-07 13:22:23 +08:00
parent 117487be56
commit 6e3ef32360
3 changed files with 71 additions and 77 deletions

View File

@ -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);
}
@ -988,7 +989,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
}
function standupdate(data) {
code = data.code;
if ( actions[code]) {
if (data.open == '1') {
actions[code].status = '1';

View File

@ -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){

View File

@ -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){
}
});
}
}
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)";
}
}
}
},
}