修改三维驾驶紧急停车

This commit is contained in:
sunzhenyu 2020-08-14 16:58:50 +08:00
parent 02ba2797cd
commit 9258d5ab3b
14 changed files with 230 additions and 42 deletions

View File

@ -12,10 +12,10 @@ if(BASE_API == "https://test.joylink.club/jlcloud"){
uploadurl = "https://joylink.club/jlfile";
asseturl = "https://joylink.club/oss/joylink"
}else{
// uploadurl = "https://test.joylink.club/jlfile";
// asseturl = "https://test.joylink.club/oss/joylink"
uploadurl = "../static";
asseturl = "../static"
uploadurl = "https://test.joylink.club/jlfile";
asseturl = "https://test.joylink.club/oss/joylink"
// uploadurl = "../static";
// asseturl = "../static"
}
const BASE_UPLOAD_API = uploadurl;
export const BASE_ASSET_API = asseturl;

View File

@ -103,6 +103,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
return;
}
if(data.type == "Train_Hmi_3D"){
// console.log(data.body);
updatestatus(data.body);
// if(data.body.trust){

View File

@ -8,6 +8,8 @@ import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { ModelManagerVR } from '@/jlmap3d/jl3dmaintainer/utils/vrloader.js';
import { VRButton } from '@/jlmap3d/jl3dmaintainer/utils/VRButton.js';
import { VrGui } from '@/jlmap3d/jl3dmaintainer/utils/vrgui.js';
import { TrainControl } from '@/jlmap3d/jl3dmaintainer/utils/trainControl.js';
import { MoveanimateVr } from '@/jlmap3d/jl3dmaintainer/utils/moveanimatevr.js';
import { Textconfig } from '@/jlmap3d/jl3ddevice/component/textconfig.js';
@ -37,6 +39,8 @@ let lableCodeMap = {
};
let faultList = [];
let stationList = [];
let trainControl = new TrainControl();
export function Jl3dfaultdeviceVR(dom,group,token,skinCode) {
var scope = this;
@ -68,7 +72,7 @@ export function Jl3dfaultdeviceVR(dom,group,token,skinCode) {
this.dom = dom;
this.nowcode = null;
this.animateswitch = false;
this.mixers = [];
let mixers = [];
this.showmodel = null;
let helpbox,textplane;
let daochamodel;
@ -380,7 +384,7 @@ export function Jl3dfaultdeviceVR(dom,group,token,skinCode) {
Materialload(scope,JSON.parse(netdata3d.data.assets).stationTextureList[0]);
// let netDataAssets = JSON.parse(netdata.data.assets);
// setpsdstationmap(JSON.parse(netdata.data.stands));
scope.modelmanager.loadpromise(scope.mixers).then(function (data) {
scope.modelmanager.loadpromise(mixers).then(function (data) {
switchModel = scope.modelmanager.otherDevice.mesh.getObjectByName("SWITCH");
moveanima.initlistnew(switchModel);
@ -402,8 +406,7 @@ export function Jl3dfaultdeviceVR(dom,group,token,skinCode) {
scope.nowStationModel = scope.modelmanager.stationIn.mesh;
scope.scene.add(scope.nowStationModel);
}
console.log(scope.nowstation);
console.log(scope.nowStationModel);
if(scope.stationtexture["stationlist"]){
vrPlane.setStationPlane(stationList,scope.stationtexture);
console.log(scope.nowStationModel.getObjectByName("zhantailiebiao"));
@ -417,7 +420,7 @@ export function Jl3dfaultdeviceVR(dom,group,token,skinCode) {
scope.nowStationModel.getObjectByName("zhantaiming").material.map.needsUpdate = true;
}
trainControl.inittrain(scope.scene,scope.modelmanager.train.mesh,mixers);
scope.scene.add(scope.modelmanager.otherDevice.mesh);
scope.scene.add( vrPlane.group );
vrwebworker.postMessage("connect");
@ -920,10 +923,10 @@ export function Jl3dfaultdeviceVR(dom,group,token,skinCode) {
intersectObjects( controller1 );
moveanima.animateupdate();
let delta = clock.getDelta();
if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) {
if (scope.mixers[i]) {
scope.mixers[i].update(delta);
if (mixers) {
for (let i = 0; i < mixers.length; i++) {
if (mixers[i]) {
mixers[i].update(delta);
}
}
}

View File

@ -0,0 +1,112 @@
export function TrainControl(){
let scope = this;
this.toptrain = null;
this.downtrain = null;
this.inittrain = function(scene,object,mixers){
let ntracks1,ntracks2,tclip,fclip;
console.log(object);
ntracks1 = object.animations.slice(16,27);
tclip = new THREE.AnimationClip("three",2,ntracks1);
ntracks2 = object.animations.slice(0,15);
fclip = new THREE.AnimationClip("four",2,ntracks2);
scope.toptrain = object.clone(true);
scope.toptrain.nowcode = null;
scope.toptrain.action = {
top:[],
down:[]
};
let points1 = [];
points1.push(new THREE.Vector3(-71,0.06,-6.3));
points1.push(new THREE.Vector3(60.73,0.06,-6.3));
scope.toptrain.curve = new THREE.CatmullRomCurve3(points1);
scope.downtrain = object.clone(true);
scope.downtrain.nowcode = null;
scope.downtrain.action = {
top:[],
down:[]
};
let points2 = [];
points2.push(new THREE.Vector3(-71,0.06,28.68));
points2.push(new THREE.Vector3(60.73,0.06,28.68));
scope.downtrain.curve = new THREE.CatmullRomCurve3(points2);
inittrainanimation(scope.toptrain,tclip,fclip,mixers);
inittrainanimation(scope.downtrain,tclip,fclip,mixers);
scope.toptrain.position.z = -20;
scope.toptrain.position.y = -20000;
scope.toptrain.rotation.y = Math.PI;
scope.downtrain.position.z = 40;
scope.downtrain.position.y = -20000;
scene.add(scope.toptrain);
scene.add(scope.downtrain);
}
function inittrainanimation(train,tclip,fclip,mixers){
for(let j=0;j<train.children.length;j++){
if(train.children[j].name == "c1" || train.children[j].name == "c6"){
for(let n=0,lenn = train.children[j].children.length;n<lenn;n++){
if(train.children[j].children[n].name == "top"){
train.children[j].children[n].animations = [];
train.children[j].children[n].animations.push(tclip.clone());
let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
mixers.push(mixer);
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
train.action.top.push(action);
mixers.push(mixer);
}
if(train.children[j].children[n].name == "down"){
train.children[j].children[n].animations = [];
train.children[j].children[n].animations.push(tclip.clone());
let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
mixers.push(mixer);
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
train.action.down.push(action);
mixers.push(mixer);
}
}
}else{
for(let n=0,lenn = train.children[j].children.length;n<lenn;n++){
if(train.children[j].children[n].name == "top"){
train.children[j].children[n].animations = [];
train.children[j].children[n].animations.push(fclip.clone());
let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
mixers.push(mixer);
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
train.action.top.push(action);
mixers.push(mixer);
}
if(train.children[j].children[n].name == "down"){
train.children[j].children[n].animations = [];
train.children[j].children[n].animations.push(fclip.clone());
let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
mixers.push(mixer);
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
train.action.down.push(action);
mixers.push(mixer);
}
}
}
}
}
}

View File

@ -30,6 +30,13 @@ export function ModelManagerVR(){
url:"../../static/vrtest/otherDevice.FBX"
};
this.train = {
code:"train",
locateType:"4",
mesh:null,
url:"../../static/vrtest/vrTrain.FBX"
};
this.loadpromise = function (mixers){
let initlist = [];
@ -37,6 +44,7 @@ export function ModelManagerVR(){
initlist.push(fbxpromise(mixers,scope.stationIn));
initlist.push(fbxpromise(mixers,scope.stationOut));
initlist.push(fbxpromise(mixers,scope.otherDevice));
initlist.push(fbxpromise(mixers,scope.train));
// initlist.push(fbxpromise(data.Switch,mixers,scope.switchmodel));
// initlist.push(fbxpromise(data.Signal,mixers,scope.signalmodel));
// initlist.push(fbxpromise(data.stationstand,mixers,scope.standmodel));
@ -64,7 +72,7 @@ function fbxpromise(mixers,model){
object.animacode = model.code;
model.mesh = object;
if(object.animations.length>0){
if(object.animations.length>0 && model.code != "train"){
model.action = mixer.clipAction( object.animations[ 0 ] );
model.action.setLoop(THREE.LoopOnce);

View File

@ -2,10 +2,10 @@ 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 = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -120,7 +120,7 @@
<div class="buttontext">{{ $t('jlmap3d.closeRightDoor') }}</div>
</div>
<div id="urgestop" class="panebutton" style="bottom:6%;left:73%;" @click="ebstop">
<img class="buttonimg" :src="urgestopimg" />
<img class="buttonimg" :style="urgestopStyle" :src="urgestopimg" />
<div class="buttontext">{{ $t('jlmap3d.emergencyBraking') }}</div>
</div>
<div id="doorpick" class="panebutton2" style="bottom:6%;left:85%;">
@ -163,6 +163,7 @@
redlimg:"/static/jl3d/control/redl.png",
greenimg:"/static/jl3d/control/green.png",
urgestopimg:"/static/jl3d/control/urgestop.png",
iconrotate:0,
doordirecttou:"rotate(0deg)",
doormodetou:"rotate(0deg)",
watertou:"rotate(0deg)",
@ -205,7 +206,12 @@
group() {
return this.$route.query.group;
},
urgestopStyle:function(){
let arr = new Array();
arr.push('transform:');
arr.push('rotate('+this.iconrotate+'deg) ');
return arr.join("");
}
},
mounted() {
window.updatabuttonlight = this.updatabuttonlight;
@ -490,7 +496,8 @@
this.rmbuttonimg = this.greenimg;
}
}
if(data.atoOn){
if(typeof(data.atoOn) != "undefined"){
// console.log(data.atoOn);
// this.atoOn = data.atoOn;
if(data.atoOn){
this.atobuttonimg = this.greenlimg;
@ -499,10 +506,25 @@
}
}
if(typeof(data.circuitEB) != "undefined"){
if(data.circuitEB){
this.iconrotate = 0;
}else{
this.iconrotate = 160;
}
}
}
},
}
</script>
<style>
.aa{
transition: all 2s;
}
.go{
transform:rotate(-180deg);
transition: all 2s;
}
</style>

View File

@ -152,6 +152,7 @@ export default {
images:null,
newa1state:"black",
a1state:"black",
ebStatus:false,
}
},
mounted() {
@ -187,7 +188,7 @@ export default {
this.m5image = this.images.m5['noalloffdoor'];
this.m6image = this.images.m6['fache'];
this.m7image = this.images.m7['aoac'];
this.m8image = this.images.m8['jinjizhidong'];
this.m8image = this.images.m8['none'];
this.m9image = this.images.m9['ato'];
this.m10image = this.images.m10['jinduan'];
this.c1image = this.images.c1['none'];
@ -210,6 +211,12 @@ export default {
},
updatetrainstatus(newdata){
if(typeof(newdata.eb) != "undefined"){
this.updateEbStatus(newdata.eb);
}
//
this.updateMmiSpeedView(newdata.v,newdata.pv,newdata.tv);
@ -218,6 +225,7 @@ export default {
}
this.updatemmidrivemodelevel(newdata.runLevel,newdata.driveMode,newdata.atoOn,newdata.atpOn);
// this.updatammirunlevel(newdata.runLevel);
//
@ -236,35 +244,69 @@ export default {
},
updatemmistate(aaa){
},
updateEbStatus(ebData){
this.ebStatus = ebData;
if(this.ebStatus){
this.m8image = this.images.m8["jinjizhidong"];
}else{
this.m8image = this.images.m8["none"];
}
},
updateMmiSpeedView(speed,atpspeed,atospeed) {
this.nowspeed = parseInt(speed);
if(this.mmimodel.updatezz){
this.mmimodel.updatezz(speed);
}
this.nowatpspeed = parseInt(atpspeed);
if(this.mmimodel.updateatp){
this.mmimodel.updateatp(atpspeed);
}
this.nowatospeed = parseInt(atospeed);
if(this.mmimodel.updateato){
this.mmimodel.updateato(atospeed);
}
if(this.m9state1 == false){
if(this.nowspeed>this.nowatospeed){
this.newa1state = "yellow";
// if(this.m9state1 == false){
// console.log(this.nowspeed);
// console.log(this.nowatospeed);
if(this.ebStatus){
this.newa1state = "red";
this.nowspeed = 0;
if(this.mmimodel.updatezz){
this.mmimodel.updatezz(speed);
}
this.nowatpspeed = 0;
if(this.mmimodel.updateatp){
this.mmimodel.updateatp(atpspeed);
}
this.nowatospeed = 0;
if(this.mmimodel.updateato){
this.mmimodel.updateato(atospeed);
}
if(this.newa1state != this.a1state){
this.a1state = this.newa1state;
}
}else{
this.newa1state = "black";
}
if(this.newa1state != this.a1state){
this.a1state = this.newa1state;
this.nowspeed = parseInt(speed);
if(this.mmimodel.updatezz){
this.mmimodel.updatezz(speed);
}
this.nowatpspeed = parseInt(atpspeed);
if(this.mmimodel.updateatp){
this.mmimodel.updateatp(atpspeed);
}
this.nowatospeed = parseInt(atospeed);
if(this.mmimodel.updateato){
this.mmimodel.updateato(atospeed);
}
if(this.nowspeed>this.nowatospeed){
this.newa1state = "yellow";
}else{
this.newa1state = "black";
}
if(this.newa1state != this.a1state){
this.a1state = this.newa1state;
}
}
}
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

BIN
static/jl3d/ebbiao.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
static/vrtest/vrTrain.FBX Normal file

Binary file not shown.

BIN
static/vrtest/zhankong.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB