This commit is contained in:
ival 2019-08-20 18:35:59 +08:00
commit 0191158f87
17 changed files with 203 additions and 38 deletions

View File

@ -420,10 +420,11 @@ export function getSimulationInfo(group) {
}
/** 获取可用的设备指令*/
export function getAvailableDeviceCommand() {
export function getAvailableDeviceCommand(params) {
return request({
url: `/api/simulation/deviceCommand/available`,
method: 'get'
method: 'get',
params
});
}

View File

@ -48,12 +48,20 @@ export function JLmapDriving(dom, data, skinCode) {
const renderer = SetRender(dom);
renderer.domElement.style.position = 'absolute';
renderer.domElement.style.top = '0';
var renderercctv = new THREE.WebGLRenderer();
renderercctv.setSize(dom.offsetWidth*0.2, dom.offsetHeight*0.2);
renderercctv.domElement.style.position = 'absolute';
renderercctv.domElement.style.top = '0';
document.getElementById('jlsimulation').appendChild(renderer.domElement);
document.getElementById('jlcctv').appendChild(renderercctv.domElement);
// 定义相机
let camera = SetCamera(dom);
// 定义场景(渲染容器)
const scene = SetScene();
const speed = 0;
let drivingcode = null;
@ -80,6 +88,8 @@ export function JLmapDriving(dom, data, skinCode) {
this.atospeed = null;
this.trainnum = null;
this.stime = null;
this.drivecount = 0;
this.drivedata = null;
this.webwork=new Worker('../../static/workertest/trainworker.js');
// 地图模型数据
@ -91,6 +101,12 @@ export function JLmapDriving(dom, data, skinCode) {
const controls3 = new MouseControls(camera2, 1.6);
controls3.enabled = true;
scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 20);
cameracctv.position.set( 5, 1,27 );
cameracctv.rotation.y = Math.PI/5*3;
camera2.add(cameracctv);
// 订阅仿真socket
this.Subscribe = new Jl3dDriving(scope);
// 连接到通信
@ -122,7 +138,9 @@ export function JLmapDriving(dom, data, skinCode) {
if (scope.animateswitch == true) {
// 根据相机渲染场景
renderer.render(scene, camera2);
renderercctv.render(scene,cameracctv);
// updatcontrols();
// renderercctv
controls3.update();
// 检测动画构造器播放动画
@ -176,6 +194,10 @@ export function JLmapDriving(dom, data, skinCode) {
this.updatestoptime = function(stime) {
scope.stime = stime;
};
this.updatedrivedata = function(drivedata){
scope.drivecount += 1;
scope.drivedata = drivedata;
};
this.updatedrivingcode = function(code) {
drivingcode = code;

View File

@ -93,12 +93,13 @@ export function Jl3dDriving(jlmap3d) {
//
//
// }
if (data.type == 'Simulation_Driver_Change') {
drivingcode = data.body.code;
jlmap3d.updatedrivingcode( data.body.code);
}
if(data.type == 'Simulation_Drive_Data_Routing'){
jlmap3d.updatedrivedata(data.body);
}
if (data.type == 'Simulation_TrainSpeed') {
if (trainlisttest) {
@ -167,14 +168,14 @@ export function Jl3dDriving(jlmap3d) {
} else {
syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len;
}
scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata);
//scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata);
} else {
if (data.body[i].directionType == '02') {
syncdata.percent = trainlisttest.list[code].progress;
} else {
syncdata.percent = 1 - trainlisttest.list[code].progress;
}
scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata);
//scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata);
}
if (data.body[i].parkRemainTime>0) {

View File

@ -564,6 +564,7 @@ THREE.FBXLoader = ( function () {
if ( parameters.opacity < 1.0 ) {
parameters.transparent = true;
parameters.alphaTest = 0.1;
}
if ( materialNode.ReflectionFactor ) {
@ -634,6 +635,7 @@ THREE.FBXLoader = ( function () {
case 'TransparentColor':
parameters.alphaMap = self.getTexture( textureMap, child.ID );
parameters.transparent = true;
parameters.alphaTest = 0.1;
break;
case 'AmbientColor':

View File

@ -6,6 +6,8 @@ const scriptRecord = {
state: {
mapLocation: {}, //地图定位,
simulationPause: true ,
scriptId:"",
},
getters: {
mapLocation: (state)=>{
@ -14,6 +16,9 @@ const scriptRecord = {
simulationPause:(state)=>{
return state.simulationPause;
},
scriptId: (state)=>{
return state.scriptId;
},
},
mutations: {
setMapLocation: (state, mapLocation) => {
@ -22,6 +27,9 @@ const scriptRecord = {
setSimulationPause: (state, simulationPause) => {
state.simulationPause = simulationPause;
},
setscriptId: (state, scriptId) => {
state.scriptId = scriptId;
},
},
actions: {
/**
@ -33,6 +41,9 @@ const scriptRecord = {
updateSimulationPause: ({ commit }, simulationPause) => {
commit('setSimulationPause', simulationPause);
},
updateScriptId: ({ commit }, scriptId) => {
commit('setscriptId', scriptId);
},
}
};
export default scriptRecord;

View File

@ -19,6 +19,8 @@
<div id="jlsimulation" class="jlmap3ddraw">
<canvas id="canvastexture" />
</div>
<div id="jlcctv" class="jlmap3cctv">
</div>
<Drive-Mmi v-if="mmishow" ref="mmiui" />
@ -124,6 +126,13 @@ export default {
this.stoptimes = newVal;
}
}
},
'jlmap3d.drivecount': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.$refs.mmiui.updatedrivedata(this.jlmap3d.drivedata);
}
}
}
},
beforeDestroy() {
@ -287,6 +296,17 @@ export default {
z-index: -1;
}
.jlmap3cctv{
float: left;
left: 0;
top:0;
//left:20%;
width: 20%;
height: 20%;
position:absolute;
z-index: -1;
}
#canvastexture {
position: absolute;
float: left;

View File

@ -112,21 +112,37 @@ export default {
nowatpspeed:0,
nowatospeed:0,
mmimodel:null,
nstate:"tiaoting",
nimage:null,
dstate:"info",
dimage:null,
m1state:"rm",
m1image:null,
m2state:"cbtc",
m2image:null,
m3state:"zhefan",
m3image:null,
m4state:"out",
m4image:null,
m5state:"state15",
m5image:null,
m6state:"fache",
m6image:null,
m7state:"aoac",
m7image:null,
m8state:"jinjizhidong",
m8image:null,
m9state:"ato",
m9image:null,
m10state:"jinduan",
m10image:null,
c1state:"qianyin",
c1image:null,
c2state:"rm",
c2image:null,
c3state:"normal",
c3image:null,
c5state:"normal",
c5image:null,
images:null,
}
@ -204,6 +220,75 @@ export default {
this.mmimodel.updateato(atospeed);
}
},
updatedrivedata(drivedata){
console.log(drivedata);
if(drivedata == "breaker"){
}
if(drivedata == "carwash"){
}
if(drivedata == "aircom"){
}
if(drivedata == "atb"){
}
if(drivedata == "bm"){
}
if(drivedata == "rm"){
if(this.m1state == "start"){
this.m1state = 'rm';
this.m1image = this.images.m1[this.m1state];
}else if(this.m1state == "rm"){
this.m1state = 'am';
this.m1image = this.images.m1[this.m1state];
}else if(this.m1state == "am"){
this.m1state = 'cm';
this.m1image = this.images.m1[this.m1state];
}else if(this.m1state == "cm"){
this.m1state = 'start';
this.m1image = this.images.m1[this.m1state];
}
}
if(drivedata == "cbtc"){
if(this.m2state == "start"){
this.m2state = 'il';
this.m2image = this.images.m2[this.m2state];
}else if(this.m2state == "il"){
this.m2state = 'itc';
this.m2image = this.images.m2[this.m2state];
}else if(this.m2state == "itc"){
this.m2state = 'cbtc';
this.m2image = this.images.m2[this.m2state];
}else if(this.m2state == "cbtc"){
this.m2state = 'start';
this.m2image = this.images.m2[this.m2state];
}
}
//doormode
if(drivedata == "AA"){
this.m7state = 'aoac';
this.m7image = this.images.m7[this.m7state];
}
if(drivedata == "AM"){
this.m7state = 'aomc';
this.m7image = this.images.m7[this.m7state];
}
if(drivedata == "MM"){
this.m7state = 'momc';
this.m7image = this.images.m7[this.m7state];
}
if(drivedata == "elflute"){
}
if(drivedata == "relieve"){
}
},
updatelen(len) {
//this.malen = 150+"px";
if(len>=750){

View File

@ -82,6 +82,7 @@ export default {
// debugger;
// this.$store
localStore.set("script_mapId", id);
this.$store.dispatch('scriptRecord/updateScriptId',id);
this.getQuestPageList(id);
},
async getQuestPageList(id){

View File

@ -18,6 +18,7 @@
</template>
<script>
// import localStore from 'storejs';
import { UrlConfig } from '@/router/index';
import {listPublishMap} from '@/api/jmap/map';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
@ -31,7 +32,7 @@
loading:false,
mapList: [],
taskStatusList: [],
disabled:null,
disabled:true,
formModel: {
name: '',
mapId: '',
@ -77,6 +78,11 @@
// return ''
// }
},
watch:{
'$store.state.scriptRecord.scriptId': function (val) {
this.formModel.mapId=val;
}
},
mounted() {
this.loadInitData();
},
@ -88,6 +94,7 @@
this.mapList = [];
listPublishMap().then(response => {
this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name } });
this.formModel.mapId=this.$store.state.scriptRecord.scriptId|| this.mapList[0].value;
})
},
doCreate() {

View File

@ -30,12 +30,12 @@
<div class="addCommand">添加指令</div>
<el-form :model="commandData" ref="commandData" :rules="commandRules" label-width="100px" class="actionInfo" label-position="right">
<el-form-item label="执行者" class="conditionVO" prop="action.memberId">
<el-select v-model="commandData.action.memberId" placeholder="请选择执行者" :disabled="isPause">
<el-select v-model="commandData.action.memberId" placeholder="请选择执行者" :disabled="isPause" @change="changeRole">
<el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备指令" class="conditionVO" prop="action.deviceCommand">
<el-select v-model="commandData.action.deviceCommand " placeholder="请选择设备指令" @change="changeCommand" class="inputStyle" :disabled="isPause">
<el-form-item label="执行指令" class="conditionVO" prop="action.deviceCommand">
<el-select v-model="commandData.action.deviceCommand " placeholder="请选择执行指令" @change="changeCommand" class="inputStyle" :disabled="isPause">
<el-option v-for="deviceCommand in deviceCommandList" :key="deviceCommand.deviceCommand" :label="deviceCommand.label" :value="deviceCommand.deviceCommand"></el-option>
</el-select>
</el-form-item>
@ -50,7 +50,7 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addCommandAction('commandData')" :disabled="isPause" :loading="adding">添加动作</el-button>
<el-button type="primary" @click="addCommandAction('commandData')" :disabled="isPause" :loading="adding">添加指令</el-button>
</el-form-item>
</el-form>
</el-card>
@ -132,6 +132,7 @@
stationList:[],
memberList:[],
deviceCommandList:[],
orginMemberList:[],
rules:{
actionVO:{
memberId:[
@ -151,7 +152,7 @@
{ required: true, message: '请选择主体角色', trigger: 'change' }
],
deviceCommand:[
{ required: true, message: '请选择设备指令', trigger: 'change' }
{ required: true, message: '请选择执行指令', trigger: 'change' }
]
},
param:{
@ -172,6 +173,7 @@
initData(){
getScriptMemberData(this.group).then(resp => {
let roleTypeList=ConstConfig.ConstSelect.roleType;
this.orginMemberList=resp.data;
let lastData=JSON.stringify(resp.data);
roleTypeList.forEach(function(element){
let rolename=element.value;
@ -179,12 +181,21 @@
});
lastData=JSON.parse(lastData);
this.memberList=lastData;
getAvailableDeviceCommand().then(response=>{
this.deviceCommandList=response.data;
this.getDeviceCode();
});
this.getDeviceCode();
}).catch(error => {})
},
changeRole(index){
let role=this.orginMemberList.find(elem=>{return elem.id==index}).role;
let data={role:role};
getAvailableDeviceCommand(data).then(response=>{
this.deviceCommandList=response.data;
if(response.data.length<=0)
{
this.commandData.action.deviceCommand="";
this.isJinLu=false;
}
});
},
getDeviceCode(){
let params = {deviceType:"StationStand"};
let group=this.group;
@ -206,12 +217,12 @@
this.adding=true;
addScriptAction(group,data).then(response=>{
this.adding=false;
this.$message.success('添加动作成功');
this.$emit('create');
this.$message.success('添加指令成功');
this.$emit('create',true);
this.initCommandActionData();
}).catch(error => {
this.adding=false;
this.$messageBox(`添加动作失败: ${error.message}`);
this.$messageBox(`添加指令失败: ${error.message}`);
});
}
else {
@ -232,12 +243,12 @@
{
addScriptAction(group,data).then(response=>{
this.modifying=false;
this.$message.success('添加动作成功');
this.$emit('create');
this.$message.success('添加对话成功');
this.$emit('create',true);
this.initActionData();
}).catch(error => {
this.modifying=false;
this.$messageBox(`添加动作失败: ${error.message}`);
this.$messageBox(`添加对话失败: ${error.message}`);
});
}
else
@ -246,14 +257,14 @@
modifyScriptAction(group,actionId,data).then(response=>{
this.modifying=false;
this.isNotModify=true;
this.$parent.$parent.setDisabled(this.isNotModify);
this.$parent.$parent.$parent.setDisabled(this.isNotModify);
this.$emit('modifyButtonName');
this.$message.success('修改动作成功');
this.$emit('create');
this.$message.success('修改对话成功');
this.$emit('create',false);
this.initActionData();
}).catch(error => {
this.modifying=false;
this.$messageBox(`修改动作失败: ${error.message}`);
this.$messageBox(`修改对话失败: ${error.message}`);
});
}
}
@ -314,7 +325,7 @@
{
this.clearValidate();
this.isNotModify=false;
this.$parent.$parent.setDisabled(this.isNotModify);
this.$parent.$parent.$parent.setDisabled(this.isNotModify);
this.initData();
this.modalData.actionVO.id=data.id;
this.modalData.actionVO.memberId=data.memberId;

View File

@ -1,7 +1,7 @@
<template>
<div class="actionPaneInner">
<div class="actionList">
<span class="titleStyle">剧本动作</span>
<span class="titleStyle">剧本编制</span>
</div>
<div class="tab-pane-big">
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elScrollbar" class="elScrollbar">
@ -53,7 +53,7 @@
behaviorName:"",
memberName:"",
operateType:"add",
buttonName:"添加动作",
buttonName:"添加对话",
}
},
components: {
@ -62,10 +62,19 @@
mounted(){
this.loadInitData();
},
watch:{
actionInfoList: function(val){
this.$nextTick(function(){
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
});
}
},
methods:{
loadInitData() {
let group=this.$route.query.group;
getAvailableDeviceCommand().then(response=>{
let data={role:"Driver"};
getAvailableDeviceCommand(data).then(response=>{
this.deviceCommandList=response.data;
this.loadOtherData(this.$route.query);
});
@ -137,21 +146,16 @@
reloadTable(){
this.loadInitData();
},
create(){
create(data){
this.reloadTable();
this.$nextTick(function(){
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
});
},
modifyAction(row){
this.operateType="modify";
this.buttonName="修改动作"
this.buttonName="修改对话"
this.$refs.addBehavior.doShow(row);
},
modifyButtonName(){
this.buttonName="添加动作",
this.buttonName="添加对话",
this.operateType="add"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

View File

Before

Width:  |  Height:  |  Size: 394 KiB

After

Width:  |  Height:  |  Size: 394 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB