This commit is contained in:
joylink_cuiweidong 2020-08-14 17:52:37 +08:00
commit c10588289a
15 changed files with 289 additions and 60 deletions

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

@ -80,30 +80,20 @@ export default {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdChoose() {
if (this.dialogShow) {
if (this.operation == OperationEvent.StationControl.requestCentralControl.menu.operation) {
return OperationEvent.StationControl.requestCentralControl.choose.domId;
} else if (this.operation == OperationEvent.StationControl.requestStationControl.menu.operation) {
return OperationEvent.StationControl.requestStationControl.choose.domId;
} else {
return '';
}
} else {
return '';
if (this.operation == OperationEvent.StationControl.requestCentralControl.menu.operation) {
return OperationEvent.StationControl.requestCentralControl.choose.domId;
} else if (this.operation == OperationEvent.StationControl.requestStationControl.menu.operation) {
return OperationEvent.StationControl.requestStationControl.choose.domId;
}
return '';
},
domIdConfirm() {
if (this.dialogShow) {
if (this.operation == OperationEvent.StationControl.requestCentralControl.menu.operation) {
return OperationEvent.StationControl.requestCentralControl.confirm.domId;
} else if (this.operation == OperationEvent.StationControl.requestStationControl.menu.operation) {
return OperationEvent.StationControl.requestStationControl.confirm.domId;
} else {
return '';
}
} else {
return '';
if (this.operation == OperationEvent.StationControl.requestCentralControl.menu.operation) {
return OperationEvent.StationControl.requestCentralControl.confirm.domId;
} else if (this.operation == OperationEvent.StationControl.requestStationControl.menu.operation) {
return OperationEvent.StationControl.requestStationControl.confirm.domId;
}
return '';
},
title() {
return '站遥控转换';
@ -298,10 +288,10 @@ export default {
if (valid) {
this.doClose();
}
}).catch((error) => {
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(error.message);
this.$refs.noticeInfo.doShow();
});
}
},

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,14 +211,22 @@ export default {
},
updatetrainstatus(newdata){
if(typeof(newdata.eb) != "undefined"){
this.updateEbStatus(newdata.eb);
}
//
this.updateMmiSpeedView(newdata.v,newdata.pv,newdata.tv);
console.log(newdata);
if(newdata.maLen){
this.updateMmiLen(newdata.maLen);
}
this.updatemmidrivemodelevel(newdata.runLevel,newdata.driveMode,newdata.atoOn,newdata.atpOn);
// this.updatammirunlevel(newdata.runLevel);
//
@ -236,35 +245,68 @@ 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);
}
// if(this.m9state1 == false){
// console.log(this.nowspeed);
// console.log(this.nowatospeed);
this.nowatospeed = parseInt(atospeed);
if(this.mmimodel.updateato){
this.mmimodel.updateato(atospeed);
}
if(this.ebStatus){
this.newa1state = "red";
this.nowspeed = 0;
if(this.mmimodel.updatezz){
this.mmimodel.updatezz(0);
}
this.nowatpspeed = 0;
if(this.mmimodel.updateatp){
this.mmimodel.updateatp(0);
}
if(this.m9state1 == false){
if(this.nowspeed>this.nowatospeed){
this.newa1state = "yellow";
this.nowatospeed = 0;
if(this.mmimodel.updateato){
this.mmimodel.updateato(0);
}
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;
}
}
}
},

View File

@ -66,6 +66,25 @@
<div class="flex_box">
<el-button type="primary" style="margin-right: 10px;" size="small" @click="setCiStationSignal">设置</el-button>
</div>
<el-form ref="signalCiStation1" label-width="130px" :model="ciModelForm" size="mini" :rules="ciModelFormRules" style="margin-top: 15px;">
<el-form-item label="信号机选择:" prop="signalList">
<el-select v-model="ciModelForm.signalList" multiple placeholder="请选择">
<el-option v-for="item in signalList" :key="item.code" :label="item.name" :value="item.code" />
</el-select>
<el-button
:type="field == 'signalCodes' ? 'danger' : 'primary'"
@click="hover('signalCodes')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="归属连锁站:" prop="ciStation">
<el-select v-model="ciModelForm.ciStation" placeholder="请选择">
<el-option v-for="item in ciStationList" :key="item.code" :label="item.name" :value="item.code" />
</el-select>
</el-form-item>
</el-form>
<div class="flex_box">
<el-button type="primary" style="margin-right: 10px;" size="small" @click="setCiStationSignalLists">设置</el-button>
</div>
</el-collapse-item>
<el-collapse-item title="设置引导信号" name="4">
<el-form ref="setGuideSignal" label-width="130px" :model="guideModel" size="mini">
@ -211,6 +230,10 @@ export default {
stationList: [],
ciStation: []
},
ciModelForm: {
signalList: [],
ciStation: ''
},
ctcModel: {
ctc: true
},
@ -229,6 +252,14 @@ export default {
{ required: true, message: '请选择信号机', trigger: 'change' }
]
},
ciModelFormRules: {
signalList: [
{ required: true, message: '请选择信号机', trigger: 'change' }
],
ciStation: [
{ required: true, message: '请选择连锁站', trigger: 'change' }
]
},
guideModel: {
scope: 'All',
callOn: true
@ -404,7 +435,7 @@ export default {
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
deviceSelect(selected) {
if (selected && selected._type.toUpperCase() == 'Signal'.toUpperCase() && (this.field != 'selectSingalCode' && this.field != 'signalCodesType' && this.field != 'signalIgnoreRouteEnd')) {
if (selected && selected._type.toUpperCase() == 'Signal'.toUpperCase() && (this.field != 'selectSingalCode' && this.field != 'signalCodesType' && this.field != 'signalIgnoreRouteEnd' && this.field != 'signalCodes')) {
this.editModel = getModel('Signal');
this.$refs.dataform && this.$refs.dataform.resetFields();
this.activeName = 'first';
@ -438,6 +469,11 @@ export default {
this.editModel.ignoreRouteEnd.push(selected.code);
}
this.activeName = 'first';
} else if (selected && selected._type === 'Signal' && this.field == 'signalCodes') {
if (!this.ciModelForm.signalList.includes(selected.code)) {
this.ciModelForm.signalList.push(selected.code);
}
this.activeName = 'three';
}
},
updateMapModel(data) {
@ -516,6 +552,21 @@ export default {
this.$emit('updateMapModel', models);
this.$message.success('数据构建成功!');
},
setCiStationSignalLists() {
this.$refs['signalCiStation1'].validate(valid => {
if (valid) {
const models = [];
this.ciModelForm.signalList.forEach(code => {
const signalModel = deepAssign({}, this.$store.getters['map/getDeviceByCode'](code)); //
signalModel.interlockStationCode = this.ciModelForm.ciStation;
models.push(signalModel);
});
this.$emit('updateMapModel', models);
this.$message.success('数据构建成功!');
this.ciModelForm.signalList = [];
}
});
},
setSignalCallOn() {
const models = [];
this.signalList.forEach(item => {

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