三维编辑器修改,三维cctv仿真结束登出

This commit is contained in:
sunzhenyu 2020-07-08 10:21:14 +08:00
parent 2a0a45ccef
commit 9c0df60188
5 changed files with 649 additions and 131 deletions

View File

@ -0,0 +1,259 @@
export let driverListConfig = [
{
assetname:"列车模型",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"信号机模型",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"道岔模型",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"内侧车站",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"外侧车站",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"三站台",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"隧道背景",
id:'',
packageName:'',
type:'',
url:''
}
];
export let sceneListConfig = [
{
assetname:"列车模型",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"信号机模型",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"道岔模型",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"内侧车站",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"外侧车站",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"三站台",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"隧道背景",
id:'',
packageName:'',
type:'',
url:''
}
];
export let deviceListConfig = [
{
assetname:"信号机模型",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"道岔模型",
id:'',
name:'',
type:'',
url:''
},
{
assetname:"屏蔽门",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"区段铁轨",
id:'',
packageName:'',
type:'',
url:''
},
];
export let maintainerListConfig = [
{
assetname:"信号机模型",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"道岔模型",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"屏蔽门",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"区段铁轨",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"设备间",
id:'',
packageName:'',
type:'',
url:''
},
];
export let cctvListConfig = [
{
assetname:"人物1",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"人物2",
id:'',
packageName:'',
url:''
},
{
assetname:"cctv车站",
id:'',
packageName:'',
url:''
},
{
assetname:"进站闸机",
id:'',
packageName:'',
url:''
},
{
assetname:"出站闸机",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"监控设备",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"列车",
id:'',
packageName:'',
type:'',
url:''
},
{
assetname:"站台轨",
id:'',
packageName:'',
type:'',
url:''
}
];
export let stationTextureListConfig = [
{
assetname:"车站站台贴图包",
id:'',
packageName:'',
type:'',
name:[],
urls:[],
}
];
export let deviceTextureListConfig = [
{
assetname:"设备贴图列表包",
id:'',
packageName:'',
type:'',
name:[],
urls:[],
}
];
export let signalTextureListConfig = [
{
assetname:"信号机灯光贴图包",
id:'',
packageName:'',
type:'',
name:[],
urls:[],
}
];

View File

@ -1,6 +1,7 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import { logout } from '@/api/login';
// 定于仿真socket接口
export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegroup) {
@ -28,6 +29,7 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
// 仿真socket接口回调函数
function callback(Response) {
const data = JSON.parse(Response.body);
if(data.type == "DeviceCtrl_3D"){
if(data.body.type == "PSD"){
if(data.body.code == jl3dpass.nowstation.toppsd){
@ -120,7 +122,13 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
}
}
}
// console.log(data);
if(data.type == 'Simulation_Over'){
logout(getToken()).then(() => {
window.location.reload();
}).catch(error => {
});;
}
}
let actions;

View File

@ -1,8 +1,7 @@
<template>
<div class="mapControl">
<el-tabs :tab-position="tabPosition" v-model="activeName" type="card" @tab-click="handleClick">
<el-tabs class="mapControl" :tab-position="tabPosition" v-model="activeName" type="card" @tab-click="handleClick" >
<!-- <el-tab-pane label="路径绘制" name="pathedit" >
<el-row>
@ -49,7 +48,7 @@
</el-tab-pane>
<el-tab-pane label="列车模型配置" name="trainedit">
<!-- <el-tab-pane label="列车模型配置" name="trainedit">
<div >
<div>当前线路列车模型</div>
<div>
@ -57,51 +56,158 @@
</div>
<div style="width:128px;height:128px;background-image: url('/static/texture/add.png');background-size: 100% 100%;"></div>
</div>
</el-tab-pane> -->
<el-tab-pane label="驾驶场景配置" name="driveEdit">
<div class= "editmodelconfig" :class="{active:index==isActive}" v-for="(asset,index) in driverAssetList" @click="assetSelect(driverAssetList[index],index)">
<div>{{asset.assetname}}</div>
<div>
资源id:
<el-input v-model="asset.id"></el-input>
</div>
<div>
资源名称:
<el-input v-model="asset.packageName"></el-input>
</div>
<div>
资源地址:
<el-input v-model="asset.url"></el-input>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="沙盘场景配置" name="sceneEdit">
<div class= "editmodelconfig" :class="{active:index==isActive}" v-for="(asset,index) in sceneAssetList" @click="assetSelect(sceneAssetList[index],index)">
<div>{{asset.assetname}}</div>
<div>
资源id:
<el-input v-model="asset.id"></el-input>
</div>
<div>
资源名称:
<el-input v-model="asset.packageName"></el-input>
</div>
<div>
资源地址:
<el-input v-model="asset.url"></el-input>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="背景模型配置" name="sceneedit">
<el-tab-pane label="设备展示模型配置" name="deviceEdit">
<div class= "editmodelconfig" :class="{active:index==isActive}" v-for="(asset,index) in deviceAssetList" @click="assetSelect(deviceAssetList[index],index)">
<div>{{asset.assetname}}</div>
<div>
资源id:
<el-input v-model="asset.id"></el-input>
</div>
<div>
资源名称:
<el-input v-model="asset.packageName"></el-input>
</div>
<div>
资源地址:
<el-input v-model="asset.url"></el-input>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="设备展示模型配置" name="deviceedit">
<el-tab-pane label="cctv模型配置" name="cctvEdit">
<div class= "editmodelconfig" :class="{active:index==isActive}" v-for="(asset,index) in cctvAssetList" @click="assetSelect(cctvAssetList[index],index)">
<div>{{asset.assetname}}</div>
<div>
资源id:
<el-input v-model="asset.id"></el-input>
</div>
<div>
资源名称:
<el-input v-model="asset.packageName"></el-input>
</div>
<div>
资源地址:
<el-input v-model="asset.url"></el-input>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="cctv模型配置" name="cctvedit">
</el-tab-pane>
<el-tab-pane label="通号模型配置" name="maintaineredit">
<el-tab-pane label="通号模型配置" name="maintainerEdit">
<div class= "editmodelconfig" :class="{active:index==isActive}" v-for="(asset,index) in maintainerAssetList" @click="assetSelect(maintainerAssetList[index],index)">
<div>{{asset.assetname}}</div>
<div>
资源id:
<el-input v-model="asset.id"></el-input>
</div>
<div>
资源名称:
<el-input v-model="asset.packageName"></el-input>
</div>
<div>
资源地址:
<el-input v-model="asset.url"></el-input>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="车站名称列表贴图" name="stationTextures">
<div class= "editmodelconfig" :class="{active:index==isActive}" v-for="(asset,index) in stationTextureList" @click="assetSelect(stationTextureList[index],index)">
<div>{{asset.assetname}}</div>
<div>
资源id:
<el-input v-model="asset.id"></el-input>
</div>
<div>
资源名称:
<el-input v-model="asset.packageName"></el-input>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="单体设备展示贴图" name="deviceTextures">
<div class= "editmodelconfig" :class="{active:index==isActive}" v-for="(asset,index) in deviceTextureList" @click="assetSelect(deviceTextureList[index],index)">
<div>{{asset.assetname}}</div>
<div>
资源id:
<el-input v-model="asset.id"></el-input>
</div>
<div>
资源名称:
<el-input v-model="asset.packageName"></el-input>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="信号机灯光贴图" name="signalLightTextures">
<div class= "editmodelconfig" :class="{active:index==isActive}" v-for="(asset,index) in signalTextureAssetList" @click="assetSelect(signalTextureAssetList[index],index)">
<div>{{asset.assetname}}</div>
<div>
资源id:
<el-input v-model="asset.id"></el-input>
</div>
<div>
资源名称:
<el-input v-model="asset.packageName"></el-input>
</div>
</div>
</el-tab-pane>
</el-tabs>
<!-- <div class="mapControl">
</div>
</div> -->
</template>
<script>
import { getMap3dModelDataAll,getMap3dModelData } from '@/api/jlmap3d/assets3d.js'
import {driverListConfig,sceneListConfig,deviceListConfig,maintainerListConfig,cctvListConfig,stationTextureListConfig,deviceTextureListConfig,signalTextureListConfig} from '@/jlmap3d/edit/config/editassetconfig.js'
export default {
name: 'EditAction',
@ -112,7 +218,18 @@ export default {
return {
activeName: '',
tabPosition:'left',
size:'medium'
size:'medium',
isActive:-1,
nowSelect:null,
driverAssetList:driverListConfig,
sceneAssetList:sceneListConfig,
deviceAssetList:deviceListConfig,
cctvAssetList:maintainerListConfig,
maintainerAssetList:cctvListConfig,
stationTextureList:stationTextureListConfig,
deviceTextureList:deviceTextureListConfig,
signalTextureAssetList:signalTextureListConfig,
}
},
beforeDestroy() {
@ -120,13 +237,7 @@ export default {
},
mounted() {
getMap3dModelDataAll().then(netdata => {
console.log(netdata);
}).catch(error => {
console.log(error);
});
window.updateSelectAsset = this.updateSelectAsset;
},
methods: {
@ -137,39 +248,114 @@ export default {
},
handleClick(tab, event) {
console.log(tab);
if(tab.name == "pathedit"){
// console.log(tab);
// if(tab.name == "pathedit"){
// this.$emit('saction',this.activeName);
// }
this.isActive = -1;
this.nowSelect = null;
if(tab.name == "trackedit"){
this.$emit('saction',this.activeName);
this.$emit('actionevent',"trackreplace");
}
if(tab.name == "switchedit"){
this.$emit('saction',this.activeName);
this.$emit('actionevent',"switchreplace");
}
if(tab.name == "trackedit"){
this.$emit('saction',this.activeName);
this.$emit('actionevent',"trackreplace");
}
if(tab.name == "signaledit"){
this.$emit('saction',this.activeName);
}
if(tab.name == "stationedit"){
this.$emit('saction',this.activeName);
this.$emit('actionevent',"stationreplace");
}
if(tab.name == "trainedit"){
this.$emit('saction',this.activeName);
if(tab.name == "sceneEdit" ||tab.name == "driveEdit"||tab.name == "deviceEdit"||tab.name == "maintainerEdit"||tab.name == "cctvEdit" ){
updateAssetList(this.activeName,"model");
}
if(tab.name == "sceneedit"){
this.$emit('saction',this.activeName);
if(tab.name == "stationTextures" ||tab.name == "deviceTextures"||tab.name == "signalLightTextures"){
updateAssetList(this.activeName,"texture");
}
},
//
assetSelect(assetData,index){
this.isActive=index;
console.log(index);
this.nowSelect = index;
},
//
updateSelectAsset(selectData){
if(this.nowSelect != null){
if(selectData.fileType == "model"){
if(selectData.resourceType == "SandboxScene"){
this.sceneAssetList[this.nowSelect].id = selectData.id;
this.sceneAssetList[this.nowSelect].packageName = selectData.packageName;
this.sceneAssetList[this.nowSelect].type = selectData.deviceType;
this.sceneAssetList[this.nowSelect].url = selectData.url;
console.log(this.sceneAssetList);
}
if(selectData.resourceType == "DriveScene"){
this.driverAssetList[this.nowSelect].id = selectData.id;
this.driverAssetList[this.nowSelect].packageName = selectData.packageName;
this.driverAssetList[this.nowSelect].type = selectData.deviceType;
this.driverAssetList[this.nowSelect].url = selectData.url;
console.log(this.driverAssetList);
}
if(selectData.resourceType == "DeviceScene"){
this.deviceAssetList[this.nowSelect].id = selectData.id;
this.deviceAssetList[this.nowSelect].packageName = selectData.packageName;
this.deviceAssetList[this.nowSelect].type = selectData.deviceType;
this.deviceAssetList[this.nowSelect].url = selectData.url;
console.log(this.deviceAssetList);
}
if(selectData.resourceType == "CctvScene"){
this.cctvAssetList[this.nowSelect].id = selectData.id;
this.cctvAssetList[this.nowSelect].packageName = selectData.packageName;
this.cctvAssetList[this.nowSelect].type = selectData.deviceType;
this.cctvAssetList[this.nowSelect].url = selectData.url;
console.log(this.cctvAssetList);
}
if(selectData.resourceType == "MaintainerScene"){
this.maintainerAssetList[this.nowSelect].id = selectData.id;
this.maintainerAssetList[this.nowSelect].packageName = selectData.packageName;
this.maintainerAssetList[this.nowSelect].type = selectData.deviceType;
this.maintainerAssetList[this.nowSelect].url = selectData.url;
console.log(this.maintainerAssetList);
}
}
if(selectData.fileType == "texture"){
if(selectData.resourceType == "textureStation"){
this.stationTextureList[this.nowSelect].id = selectData.id;
this.stationTextureList[this.nowSelect].packageName = selectData.packageName;
this.stationTextureList[this.nowSelect].type = selectData.deviceType;
console.log(this.stationTextureList);
}
if(selectData.resourceType == "textureSignal"){
this.signalTextureAssetList[this.nowSelect].id = selectData.id;
this.signalTextureAssetList[this.nowSelect].packageName = selectData.packageName;
this.signalTextureAssetList[this.nowSelect].type = selectData.deviceType;
console.log(this.signalTextureAssetList);
}
if(selectData.resourceType == "textureDevice"){
this.deviceTextureList[this.nowSelect].id = selectData.id;
this.deviceTextureList[this.nowSelect].packageName = selectData.packageName;
this.deviceTextureList[this.nowSelect].type = selectData.deviceType;
console.log(this.deviceTextureList);
}
}
}
},
actionevent(event){
console.log(event.currentTarget.id);
this.$emit('actionevent',event.currentTarget.id);
//console.log();
}
}
@ -187,10 +373,20 @@ export default {
width: 20%;
height:100%;
background:#fff;
border-radius:5px;
text-align: center;
overflow-y:auto
// border-radius:5px;
// text-align: center;
}
.editmodelconfig{
left:0;
margin-top:5px;
width:98%;
border-radius:5px;
border:solid 2px #000
}
.active{
background-color:blue;
}
.editbutton{
padding: 1cm
}

View File

@ -3,32 +3,20 @@
<div class="asset-list">
<el-tabs v-model="activeName">
<el-tab-pane label="模型" name="models">
<el-tab-pane label="资源" name="models">
<el-scrollbar style="margin-bottom:1px">
<el-form ref="form" label-width="130px" size="mini">
<div class="modellist" v-for="(asset,index) in modellist" @click="modelselect(index)">
<div class="modellist" v-for="(asset,index) in nowassetlist" @click="modelSelect(index)">
<div >
<img class="modelpic" draggable="true" >
<p class="modelp">{{asset.name }}</p>
<div class="modelid">资源ID:{{asset.id }}</div>
<div class="modelname">{{asset.packageName }}</div>
</div>
</div>
</el-form>
</el-scrollbar>
</el-tab-pane>
<el-tab-pane label="贴图" name="textures">
<el-scrollbar wrapClass="scrollbar-wrapper">
<el-form ref="form" label-width="130px" size="mini" >
<div class="modellist" v-for="(texture,index) in texturelist" @click="textureselect(index)" v-show="texture.classtype==modelcalsstype" >
<div >
<img class="modelpic" :src="texture.asseturl">
<p class="modelp">{{texture.name }}</p>
</div>
</div>
</el-form>
</el-scrollbar>
</el-tab-pane>
</el-tabs>
</div>
@ -43,7 +31,7 @@
import axios from 'axios';
import {loadmap3dModel} from '@/api/jlmap3d/load3ddata';
import { getMap3dModelDataAll,getMap3dModelData } from '@/api/jlmap3d/assets3d.js'
export default {
name: 'EditAssets',
@ -53,27 +41,21 @@ export default {
data() {
return {
activeName: 'models',
nowassetlist: '',
filterText: '',
defaultProps: {
children: 'children',
label: 'label'
},
modellist:[
{
name:1,
},
{
name:1,
},
{
name:1,
},
{
name:1,
},
modelList:[],
textureList:[],
assetList:{
model:[
],
texturelist:[],
modelcalsstype:"signal"
texture:[
]
},
modelClassType:"signal"
}
},
beforeDestroy() {
@ -84,27 +66,112 @@ export default {
filterText(val) {
this.$refs.tree2.filter(val);
},
modellist: function() {
modelList: function() {
this.$nextTick(function(){
////console.log("nextTick");
})
},
texturelist: function() {
textureList: function() {
this.$nextTick(function(){
////console.log("nextTick");
})
}
},
methods: {
modelselect(index){
// //console.log(this.modellist);
// //console.log(index);
this.$emit('smodel',this.modellist[index]);
mounted() {
window.updateAssetList = this.updateAssetList;
this.assetList.model["sceneEdit"] = [];
this.assetList.model["driveEdit"] = [];
this.assetList.model["deviceEdit"] = [];
this.assetList.model["maintainerEdit"] = [];
this.assetList.model["cctvEdit"] = [];
this.assetList.texture["stationTextures"] = [];
this.assetList.texture["signalLightTextures"] = [];
this.assetList.texture["deviceTextures"] = [];
getMap3dModelDataAll().then(netdata => {
console.log(netdata);
let assetdata = netdata.data;
let newtexturesdata = [];
for(let i=0,leni=assetdata.length;i<leni;i++){
if(assetdata[i].fileType == "model"){
if(assetdata[i].resourceType == "SandboxScene"){
this.assetList.model["sceneEdit"].push(assetdata[i]);
}
if(assetdata[i].resourceType == "DriveScene"){
this.assetList.model["driveEdit"].push(assetdata[i]);
}
if(assetdata[i].resourceType == "DeviceScene"){
this.assetList.model["deviceEdit"].push(assetdata[i]);
}
if(assetdata[i].resourceType == "MaintainerScene"){
this.assetList.model["maintainerEdit"].push(assetdata[i]);
}
if(assetdata[i].resourceType == "CctvScene"){
this.assetList.model["cctvEdit"].push(assetdata[i]);
}
}
if(assetdata[i].fileType == "texture"){
let newtexture = {
id:"图包",
packageName:assetdata[i].packageName,
fileType:assetdata[i].fileType,
resourceType:assetdata[i].resourceType,
data:[]
}
let index = null;
for(let j=0,lenj=newtexturesdata.length;j<lenj;j++){
if(newtexture.packageName == newtexturesdata[j].packageName){
index = j;
j = lenj;
}
}
if(index != null){
newtexturesdata[index].data[assetdata[i].name.split(".")[0]] = assetdata[i].url;
}else{
newtexture.data[assetdata[i].name.split(".")[0]] = assetdata[i].url;
newtexturesdata.push(newtexture)
}
}
}
for(let i=0,leni=newtexturesdata.length;i<leni;i++){
if(newtexturesdata[i].resourceType == "textureStation"){
this.assetList.texture["stationTextures"].push(newtexturesdata[i]);
}
if(newtexturesdata[i].resourceType == "textureSignal"){
this.assetList.texture["signalLightTextures"].push(newtexturesdata[i]);
}
if(newtexturesdata[i].resourceType == "textureDevice"){
this.assetList.texture["deviceTextures"].push(newtexturesdata[i]);
}
}
console.log( this.assetList.texture);
}).catch(error => {
console.log(error);
});
},
textureselect(index){
// //console.log(this.texturelist);
// //console.log(index);
this.$emit('stexture',this.texturelist[index]);
methods: {
modelSelect(index){
// //console.log(this.modelList);
console.log(this.nowassetlist[index]);
// this.$emit('smodel',this.modelList[index]);
updateSelectAsset(this.nowassetlist[index]);
},
//
updateAssetList(newdata,newtype){
if(newtype == "model"){
this.nowassetlist = this.assetList.model[newdata];
}
if(newtype == "texture"){
this.nowassetlist = this.assetList.texture[newdata];
}
console.log(this.nowassetlist);
},
filterNode(value, data) {
if (!value) return true;
@ -116,7 +183,7 @@ export default {
back() {
},
togglelist(actionname){
toggleList(actionname){
//console.log(actionname);
let nowasset = null;
if(actionname == "pathedit"){
@ -140,32 +207,10 @@ export default {
if(actionname == "sceneedit"){
nowasset = "scene";
}
this.modelcalsstype = nowasset;
this.modelClassType = nowasset;
},
},
mounted() {
var modellist = this.modellist;
// let url1 = "http://localhost:1337/model_load";
// // let url2 = "http://localhost:1337/texture_load";
//
// axios.get(url1).then( (result)=> {
// this.modellist = result.data;
// ////console.log(this.modellist);
// });
// loadmap3dModel().then(data => {
// if(data.code == "200"){
// //console.log(data);
// this.modellist = data.data;
// //console.log(this.modellist);
// }
// }).catch(error => {
// //console.log(error);
// });
}
}
</script>
@ -200,22 +245,32 @@ export default {
.modellist {
float:left;
position: relative;
width:120px;
height:120px;
width:100px;
height:100px;
text-align:center;
border-radius:5px;
border:solid 2px #000;
}
.modelpic{
left:0;
left:20%;
position: absolute;
top:0;
width:60%;
height:60%;
text-align:center;
background-image: url('/static/texture/modelfile.png');
background-size: 100% 100%;
}
.modelp{
.modelid{
position: absolute;
bottom:0;
top:60%;
height:20%;
z-index:0;
}
.modelname{
position: absolute;
top:80%;
height:20%;
z-index:0;
}
.map-draft {

View File

@ -134,7 +134,7 @@
this.jlmap3dedit.editmode = editmode;
this.jlmap3dedit.actionmode = editmode;
//this.jlmap3dedit.actionmode();
this.$refs.assets.togglelist(editmode);
this.$refs.assets.toggleList(editmode);
},
actionevent(eventname) {
//console.log(eventname);