This commit is contained in:
joylink_cuiweidong 2019-11-19 13:04:25 +08:00
commit 1877931ebb
74 changed files with 5352 additions and 3568 deletions

View File

@ -7,7 +7,6 @@
<script>
import { getToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import { getSessionStorage } from '@/utils/auth';
import { ProjectIcon, loginInfo } from '@/scripts/ConstDic';
import DeomonTopic from '@/views/demonstration/deomonTopic';
@ -21,6 +20,11 @@ export default {
mixins: [
WindowResizeHandler
],
computed: {
path() {
return window.location.pathname;
}
},
watch: {
'$store.state.socket.roomInvite': function (val) {
if (val.creatorId) {
@ -59,7 +63,7 @@ export default {
}
});
this.subscribe();
this.$nextTick(() => { this.subscribe(); });
},
methods: {
resizeHandler() {
@ -77,14 +81,11 @@ export default {
}
},
subscribe() {
this.$nextTick(() => {
const token = getToken();
if (token && this.$route.path != '/404') {
const header = { group: '', 'X-Token': token };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
}
});
const token = getToken();
if (token && this.$route.path != '/404' && !this.path.endsWith('login')) {
const header = { group: '', 'X-Token': token };
this.$store.dispatch('subscribe', {header, type: getSessionStorage('project')});
}
}
}
};

View File

@ -1,75 +1,75 @@
import request from '@/utils/request';
/** 根据皮肤获取地图版本信息*/
export function getPublishMapVersion(skinCode) {
return request({
url: `/api/map/skin/${skinCode}/version`,
method: 'get'
});
export function getPublishMapVersion(id) {
return request({
url: `/api/map/${id}/version`,
method: 'get'
});
}
/** 根据皮肤获取发布地图详细内容*/
export function getPublishMapDetail(skinCode) {
const datad = request({
url: `/api/map/skin/${skinCode}/details`,
method: 'get'
});
return datad.then();
export function getPublishMapDetail(id) {
const datad = request({
url: `/api/map/${id}/details`,
method: 'get'
});
return datad.then();
}
/** 根据地图id获取地图信息*/
export function getPublishMapInfo(mapId) {
return request({
url: `/api/map/${mapId}`,
method: 'get'
});
return request({
url: `/api/map/${mapId}`,
method: 'get'
});
}
/** 获取草稿地图详细内容*/
export function getMapDetail(id) {
return request({
url: `/api/mapBuild/${id}/mapDataDetail`,
method: 'get'
});
return request({
url: `/api/mapBuild/${id}/mapDataDetail`,
method: 'get'
});
}
/** 创建地图3d数据*/
export function set3dMapData(data) {
return request({
url: `/api/mapBuild/3dMapData`,
method: 'post',
data: data
});
return request({
url: `/api/mapBuild/3dMapData`,
method: 'post',
data: data
});
}
/** 通过地图id获取地图3d数据*/
export function get3dMapData(mapId) {
return request({
url: `/api/mapBuild/3dMapData/${mapId}`,
method: 'get'
});
return request({
url: `/api/mapBuild/3dMapData/${mapId}`,
method: 'get'
});
}
/** 更新地图3d数据*/
export function update3dMapData(data) {
return request({
url: `/api/mapBuild/3dMapData/${data.id}`,
method: 'put',
data: data
});
return request({
url: `/api/mapBuild/3dMapData/${data.id}`,
method: 'put',
data: data
});
}
/** 获取模型资源列表*/
export function loadmap3dModel() {
return request({
url: `/api/map3dModel/all`,
method: 'get'
});
return request({
url: `/api/map3dModel/all`,
method: 'get'
});
}
export function getPublish3dMapDetail(skinCode) {
const datad = request({
url: `/api/map/${skinCode}/3dMapData`,
method: 'get'
});
return datad.then();
export function getPublish3dMapDetail(id) {
const datad = request({
url: `/api/map/${id}/3dMapData`,
method: 'get'
});
return datad.then();
}

View File

@ -1,5 +1,8 @@
export default {
trainGroupNumber: 'Train group number:',
trainAtoOn: 'Ato:On',
trainAtoOff: 'Ato:Off',
stopTime:'Stop time:',
surveillanceHidden: 'In-vehicle surveillance - hidden',
surveillanceDisplay: 'In-vehicle surveillance - display',
trainInstrumentationDisplay: 'Train instrumentation - display',

View File

@ -1,5 +1,8 @@
export default {
trainGroupNumber: '车组号:',
trainAtoOn: '列车自动驾驶中',
trainAtoOff: '列车人工驾驶中',
stopTime:'停站时间:',
surveillanceHidden: '车内监控——隐藏',
surveillanceDisplay: '车内监控——显示',
trainInstrumentationDisplay: '列车仪表——显示',

View File

@ -70,5 +70,5 @@ export default {
runGraphReleaseApplication: '运行图发布申请',
subsystemGeneration: '子系统生成',
newsBulletin: '消息公告',
commandDictionary: '令字典'
commandDictionary: '令字典'
};

View File

@ -55,7 +55,7 @@ export default {
whetherTheNewsCanBeClosed: '消息是否可关闭:',
push: '推送',
controlMode: '控制模式',
deviceType: '设备类型',
deviceType: '操作对象',
lineCode: '线路编号',
simulationRole: '仿真角色',
instructionType: '指令类型',

View File

@ -1,5 +1,5 @@
export function SetCamera(dom) {
var camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 2000);
var camera = new THREE.PerspectiveCamera(60, dom.clientWidth/dom.clientHeight, 1, 1500);
camera.position.set( 0, 0, 0 );
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();

View File

@ -12,12 +12,12 @@ export function SetLights(scene){
// planeGeometry.dispose();
// planeMaterial.dispose();
//定义全局光
let ambientLight = new THREE.AmbientLight( 0xC5C1AA, 1.3);
let ambientLight = new THREE.AmbientLight( 0xffffff,1.3 );//1b1515
scene.add( ambientLight );
let light = new THREE.HemisphereLight( 0xffffff, 0x444444 );
light.position.set( 0, 200, 0 );
scene.add( light );
// let light = new THREE.HemisphereLight( 0xffffff, 0x444444 );
// light.position.set( 0, 200, 0 );
// scene.add( light );
// //辅助网格
// let helper = new THREE.GridHelper( 20000, 10 );

View File

@ -1,6 +1,9 @@
export function SetRender(dom) {
var renderer = new THREE.WebGLRenderer({antialias: true});
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
// renderer.gammaInput = true;
// renderer.gammaOutput = true;
// renderer.setPixelRatio( window.devicePixelRatio );
//renderer.setSize( window.innerWidth, window.innerHeight );
return renderer;
}

View File

@ -1,16 +1,17 @@
export function SetScene() {
var scene = new THREE.Scene();
var cubeTextureLoader = new THREE.CubeTextureLoader();
cubeTextureLoader.setPath( '../../static/skybox/star/' );
var cubeTexture = cubeTextureLoader.load( [
'px.png', 'nx.png',
'py.png', 'ny.png',
'pz.png', 'nz.png',
] );
scene.background = cubeTexture;
cubeTexture.dispose();
// var cubeTextureLoader = new THREE.CubeTextureLoader();
//
// cubeTextureLoader.setPath( '../../static/skybox/star/' );
//
// var cubeTexture = cubeTextureLoader.load( [
// 'px.png', 'nx.png',
// 'py.png', 'ny.png',
// 'pz.png', 'nz.png',
// ] );
//
var bgTexture = new THREE.TextureLoader().load("../../static/background/background.jpg");
scene.background = bgTexture;
// cubeTexture.dispose();
return scene;
}

View File

@ -120,7 +120,7 @@ export function Jlmap3ddata(mapid,scope){
}
function init3d(mapid,netdata){
console.log(netdata)
// console.log(netdata)
getMapDetail(mapid).then(data => {
jlmap3ddata.id = netdata.id;
jlmap3ddata.mapId = mapid;
@ -141,28 +141,31 @@ export function Jlmap3ddata(mapid,scope){
let switchdata = JSON.parse(netdata.switchs);
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
assetloader.setmodellist(netdata.assets);
console.log(mapdata);
assetloader.setmodellist(netdata.assets,5);
assetloader.assetpromise(scene)
.then(function(data){
//console.log(data);
return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader);
return jlmap3ddata.linklist.loadpromise(loaderdata.link,mapdata.linkList,scene,assetloader);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,scene);
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,scene);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.signallist.loadpromise(signaldata,scene,assetloader,mapdata.signalList);
return jlmap3ddata.signallist.loadpromise(signaldata,scene,assetloader,mapdata.signalList);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.stationstandlist.initpromise(jlmap3ddata,mapdata.stationList,mapdata.stationStandList,scene,assetloader,standsdata);
return jlmap3ddata.stationstandlist.initpromise(jlmap3ddata,mapdata.stationList,mapdata.stationStandList,scene,assetloader,standsdata);
})
.then(function(data){
return jlmap3ddata.sectionlist.sectionpromise(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,standsdata,scene);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,scene,assetloader);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,scene,assetloader,"0");
})
// .then(function(data){
// //console.log(data);

View File

@ -50,7 +50,8 @@ export function Signalaction(){
for(let i=0;i<data.mapdata.signallist.list.length;i++){
intersects1 = raycaster.intersectObjects( data.mapdata.signallist.list[i].mesh.children);
if(intersects1[0]){
if(intersects1[0].object.code == data.mapdata.signallist.list[i].mesh.code){
console.log(intersects1[0].object);
if(intersects1[0].object.parent.code == data.mapdata.signallist.list[i].mesh.code){
return data.mapdata.signallist.list[i].mesh;
}
}

View File

@ -147,7 +147,7 @@ export function getmodels(data) {
code:null
},
direction2:{
name:data.mapdata.stationstandlist.list[i].direction1.name,
name:data.mapdata.stationstandlist.list[i].direction2.name,
code:null
}
}

View File

@ -20,10 +20,10 @@ export function LinkList(data){
});
};
this.loadpromise = function(linkdata,scene,assetloader){
this.loadpromise = function(linkdata,netlink,scene,assetloader){
return new Promise(function(resolve, reject){
scene.add(scope.linksgroup);
loadlink(linkdata,scene,assetloader);
loadlink(linkdata,netlink,scene,assetloader);
resolve("loadedrealsection");
});
};
@ -57,7 +57,7 @@ function linkhelp(data,scene){
function loadlink(data,scene,assetloader){
function loadlink(data,netlink,scene,assetloader){
let autorail;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autorail"){
@ -87,6 +87,12 @@ function linkhelp(data,scene){
testmesh2.rp = data[i].rp;
testmesh2.lp = data[i].lp;
testmesh2.lengthfact = data[i].lengthfact;
for(let num=0,lennum=netlink.length;num<lennum;num++){
if(netlink[num].code == data[i].code){
testmesh2.oldlength = netlink[num].lengthFact;
num = lennum;
}
}
for(let i=0;i<testmesh2.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-25;

View File

@ -23,6 +23,7 @@ export function SectionList() {
this.standtrack = [];
this.initpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
// console.log(sectiondata);
return new Promise(function(resolve, reject){
scene.add(scope.sectiongroup);
scene.add(scope.switchgroup);
@ -44,11 +45,11 @@ export function SectionList() {
newsection.linkCode = sectiondata[i].linkCode;
scope.sections.datalist.push(newsection);
// scope.sections.modellist.push("");
// sections.modellist.push("");
}
}
buildsuidao(linkdata,scope.sections,assetloader,scene);
console.log(scope.sections.datalist);
// buildsuidao(linkdata,sections,assetloader,scene);
// console.log(sections.datalist);
//定义区分道岔组
let switchlist = [];
//遍历道岔数据
@ -105,7 +106,7 @@ export function SectionList() {
}
}
scope.switchs.datalist = switchlist;
console.log(switchlist);
// console.log(switchlist);
//道岔贴图
let switchmesh1;
let switchmesh2;
@ -142,9 +143,9 @@ export function SectionList() {
let switchposz = sectionA.position.z;
let switchposx;
if(switchlist[i].code == "Switch_135_0.16369"){
console.log(switchlist[i]);
}
// if(switchlist[i].code == "Switch_135_0.16369"){
// console.log(switchlist[i]);
// }
if(switchlist[i].pa[0].x>switchlist[i].pb[0].x){
if(((switchlist[i].pc[0].y+switchlist[i].pc[1].y)/2) < switchlist[i].pa[0].y){
if(((switchlist[i].pc[0].x+switchlist[i].pc[1].x)/2)>switchlist[i].pa[0].x){
@ -193,6 +194,267 @@ export function SectionList() {
resolve("loadersection");
});
}
this.sectionpromise = function(linkdata,linklist,sectiondata,switchdata,standsdata,scene){
// console.log(linkdata);
// console.log(linklist);
// console.log(sectiondata);
console.log(standsdata);
return new Promise(function(resolve, reject){
let linkrail = [];
let switchrail = [];
for(let i=0;i<linkdata.length;i++){
linkrail[linkdata[i].code] = {
lp:linkdata[i].rail[0],
rp:linkdata[i].rail[1],
lconnect:null,
rconnect:null,
lengthfact:linkdata[i].lengthfact,
lineleft:null,
lineright:null,
points:[],
type:null
};
}
for(let i=0;i<switchdata.length;i++){
switchrail[switchdata[i].code] = {
alink:switchdata[i].alink,
blink:switchdata[i].blink,
clink:switchdata[i].clink,
position:switchdata[i].position,
directtype:null,
locateType:0
};
if(linkrail[switchdata[i].blink].lp.x < switchdata[i].position.x){
linkrail[switchdata[i].alink].lswitch = switchdata[i].code;
linkrail[switchdata[i].blink].rswitch = switchdata[i].code;
}else{
linkrail[switchdata[i].alink].rswitch = switchdata[i].code;
linkrail[switchdata[i].blink].lswitch = switchdata[i].code;
}
//
if(linkrail[switchdata[i].clink].lp.x < switchdata[i].position.x){
linkrail[switchdata[i].alink].lswitch = switchdata[i].code;
linkrail[switchdata[i].clink].rswitch = switchdata[i].code;
}else{
linkrail[switchdata[i].alink].rswitch = switchdata[i].code;
linkrail[switchdata[i].clink].lswitch = switchdata[i].code;
}
}
for(let i=0;i<linkdata.length;i++){
if(linkdata[i].rotation._z == 0){
linkrail[linkdata[i].code].type = 0;
if(linkrail[linkdata[i].code].lswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].lswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
linkrail[linkdata[i].code].points.push(new THREE.Vector3(linkrail[linkdata[i].code].lp.x,0,linkrail[linkdata[i].code].lp.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(linkrail[linkdata[i].code].rp.x,0,linkrail[linkdata[i].code].rp.z));
if(linkrail[linkdata[i].code].rswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].rswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}else{
if(linkdata[i].rotation._z>0){
let testline = new THREE.CatmullRomCurve3([
new THREE.Vector3(linkrail[linkdata[i].code].lp.x,0,linkrail[linkdata[i].code].lp.z),
new THREE.Vector3(linkrail[linkdata[i].code].rp.x,0,linkrail[linkdata[i].code].rp.z)
]);
linkrail[linkdata[i].code].type = 1;
if(linkrail[linkdata[i].code].lswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].lswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z-0.01));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+3.5,0,switchpoint.z-0.05));
}
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92));
if(linkrail[linkdata[i].code].rswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].rswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-3.5,0,switchpoint.z+0.05));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z+0.01));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}else{
let testline = new THREE.CatmullRomCurve3([
new THREE.Vector3(linkrail[linkdata[i].code].lp.x,0,linkrail[linkdata[i].code].lp.z),
new THREE.Vector3(linkrail[linkdata[i].code].rp.x,0,linkrail[linkdata[i].code].rp.z)
]);
linkrail[linkdata[i].code].type = 2;
if(linkrail[linkdata[i].code].lswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].lswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z+0.01));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+3.5,0,switchpoint.z+0.05));
}
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92));
if(linkrail[linkdata[i].code].rswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].rswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-3.5,0,switchpoint.z-0.05));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z-0.01));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}
}
}
for(let i=0;i<linkdata.length;i++){
linkrail[linkdata[i].code].lineleft = new THREE.CatmullRomCurve3(linkrail[linkdata[i].code].points);
linkrail[linkdata[i].code].lineleft.curveType = "centripetal";
// linkrail[linkdata[i].code].lineleft.tension = 0.2;
let rightpoints = [];
linkrail[linkdata[i].code].points.forEach(item=>{
rightpoints.push(item);
}
);
rightpoints.reverse();
linkrail[linkdata[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
linkrail[linkdata[i].code].lineright.curveType = "centripetal";
// scope.linkrail[linkdata[i].code].lineright.tension = 0.11;
var points = linkrail[linkdata[i].code].lineleft.getPoints( 50 );
var geometry = new THREE.BufferGeometry().setFromPoints( points );
var material;
if(linkrail[linkdata[i].code].type == 0){
material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
}
if(linkrail[linkdata[i].code].type == 1){
material = new THREE.LineBasicMaterial( { color : 0x00ff00 } );
}
if(linkrail[linkdata[i].code].type == 2){
material = new THREE.LineBasicMaterial( { color : 0x0000ff } );
}
// Create the final object to add to the scene
var curveObject = new THREE.Line( geometry, material );
curveObject.position.y = Math.random();
scene.add(curveObject);
}
let standsections = [];
for(let i=0,len=sectiondata.length;i<len;i++){
if(sectiondata[i].isStandTrack == true){
standsections.push(sectiondata[i]);
}
}
// console.log(standsections);
for(let i=0,leni=standsections.length;i<leni;i++){
for(let j=0,lenj=linklist.length;j<lenj;j++){
if(standsections[i].linkCode == linklist[j].code){
for(let n=0,lenn=standsdata.length;n<lenn;n++){
if(standsections[i].relStandCode == standsdata[n].direction1.name){
let geometry = new THREE.CircleGeometry( 2, 16 );
let material = new THREE.MeshBasicMaterial( { color: 0x00ffff } );
// console.log(standsections[i].stationCode);
// console.log(standsdata[n].code);
// console.log(standsdata[n].position.x);
// console.log("position.z");
// console.log(linkrail[linklist[j].code].points[0].z);
// console.log(standsdata[n].position.z);
// console.log("........................................");
let circle1 = new THREE.Mesh( geometry, material );
let circle2 = new THREE.Mesh( geometry, material );
if(linkrail[linklist[j].code].points[0].z>standsdata[n].position.z){
circle1.position.x = standsdata[n].position.x-64;
circle1.position.y = 5;
circle1.position.z = linkrail[linklist[j].code].points[0].z;
circle1.rotation.x = -Math.PI/2;
circle2.position.x = standsdata[n].position.x+64;
circle2.position.y = 5;
circle2.position.z = linkrail[linklist[j].code].points[0].z-(linkrail[linklist[j].code].points[0].z-standsdata[n].position.z)*2;
circle2.rotation.x = -Math.PI/2;
}else{
circle1.position.x = standsdata[n].position.x+64;
circle1.position.y = 5;
circle1.position.z = linkrail[linklist[j].code].points[0].z+(standsdata[n].position.z-linkrail[linklist[j].code].points[0].z)*2;
circle1.rotation.x = -Math.PI/2;
circle2.position.x = standsdata[n].position.x-64;
circle2.position.y = 5;
circle2.position.z = linkrail[linklist[j].code].points[0].z;
circle2.rotation.x = -Math.PI/2;
}
scene.add( circle1 );
scene.add( circle2 );
n = lenn;
}
}
// console.log(standsections[i]);
// console.log(linklist[j]);
// console.log("====================================");
let progress1 = standsections[i].leftStopPointOffset/linklist[j].lengthFact;
let progress2 = standsections[i].rightStopPointOffset/linklist[j].lengthFact;
let point1 = linkrail[linklist[j].code].lineleft.getPointAt(progress1);
var geometry = new THREE.CircleGeometry( 2, 16 );
var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
let circle1 = new THREE.Mesh( geometry, material );
circle1.position.x = point1.x;
circle1.position.y = point1.y;
circle1.position.z = point1.z;
circle1.rotation.x = -Math.PI/2;
scene.add( circle1 );
let point2 = linkrail[linklist[j].code].lineleft.getPointAt(progress2);
let circle2 = new THREE.Mesh( geometry, material );
circle2.position.x = point2.x;
circle2.position.y = point2.y;
circle2.position.z = point2.z;
circle2.rotation.x = -Math.PI/2;
scene.add( circle2 );
// console.log(progress1);
// console.log(progress2);
// console.log(standsections[i].leftStopPointOffset);
// console.log(standsections[i].rightStopPointOffset);
// console.log(linklist[j].lengthFact);
// console.log(linkrail[linklist[j].code].lineleft.points);
// console.log(point1);
// console.log(point2);
// console.log("====================================");
j = lenj;
}
}
}
resolve("loadersection");
});
}
//
// this.init = function(sectiondata,switchdata,scene){
@ -209,8 +471,8 @@ export function SectionList() {
// newsection.isStandTrack = sectiondata[i].isStandTrack;
// newsection.type = sectiondata[i].type;
//
// scope.sections.datalist.push(newsection);
// // scope.sections.modellist.push("");
// sections.datalist.push(newsection);
// // sections.modellist.push("");
// }
//
// }
@ -263,14 +525,14 @@ export function SectionList() {
//
// newswitch.index = i;
//
// scope.switchs.datalist.push(newswitch);
// scope.switchs.modellist.push("");
// switchs.datalist.push(newswitch);
// switchs.modellist.push("");
// }
// }
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){
console.log(sectiondata);
// console.log(sectiondata);
scene.add(scope.sectiongroup);
scene.add(scope.switchgroup);
let linkdata = jlmap3ddata.linklist;
@ -291,7 +553,7 @@ export function SectionList() {
newsection.linkCode = sectiondata[i].linkCode;
scope.sections.datalist.push(newsection);
// scope.sections.modellist.push("");
// sections.modellist.push("");
}
}
@ -450,7 +712,7 @@ export function SectionList() {
autosuidao = assetloader.modellist[i].mesh.children[0];
}
}
console.log(suidaodata);
// console.log(suidaodata);
let rightlist = [];
let leftlist = [];
let rightpoint = 0;

View File

@ -140,27 +140,30 @@ export function SignalList() {
});
};
this.resetsignal = function(jlmap3ddata){
console.log(jlmap3ddata.linksgroup);
console.log(scope);
let linkdata = jlmap3ddata.linksgroup;
// console.log(jlmap3ddata.linksgroup);
// console.log(jlmap3ddata);
let linkdata = jlmap3ddata.linkdata;
for(let i=0;i<scope.group.children.length;i++){
let signaldata = scope.group.children[i];
let link = linkdata.getObjectByProperty("code",signaldata.linkCode);
let posx = null;
for(let j=0,lenj=linkdata.length;j<lenj;j++){
if(linkdata[j].code == signaldata.linkCode){
let posx = linkdata[j].lp.x + (signaldata.offset/linkdata[j].oldlength)*linkdata[j].lengthfact;
if(signaldata.offset > link.lengthfact/2){
posx = link.position.x + signaldata.offset - link.lengthfact/2-10;
}else{
posx = link.position.x - (link.lengthfact/2 - signaldata.offset)+10;
}
//根据线路方向修改信号灯位置
if(signaldata.directionType == "01"){
signaldata.position.set(posx,0,link.position.z-3);
signaldata.rotation.z = ( Math.PI / 2 );
}else if(signaldata.directionType == "02"){
signaldata.position.set(posx,0,link.position.z+3);
signaldata.rotation.z = ( - Math.PI / 2 );
//根据线路方向修改信号灯位置
// console.log(posx);
if(signaldata.directionType == "01"){
signaldata.position.set(posx,0,linkdata[j].position.z-2.4);
signaldata.rotation.z = ( Math.PI / 2 );
// signaldata.scale.set(1,1,1);
}else if(signaldata.directionType == "02"){
signaldata.position.set(posx,0,linkdata[j].position.z+2.4);
signaldata.rotation.z = ( - Math.PI / 2 );
// signaldata.scale.set(1,1,1);
}
j = lenj;
}
}
}
};
this.init = function(data,realsectionlist,scene,assetloader){

View File

@ -161,8 +161,8 @@ export function JLmap3dEdit(dom, data, mapid) {
let exporter = new THREE.OBJExporter();
console.log(scope.mapdata);
// let exportmodels = scope.mapdata.linklist.linksgroup;
// let exportmodels = scope.mapdata.sectionlist.switchgroup;
let exportmodels = scope.mapdata.stationstandlist.group;
let exportmodels = scope.mapdata.sectionlist.switchgroup;
// let exportmodels = scope.mapdata.stationstandlist.group;
let result = exporter.parse( exportmodels );
console.log(result);
@ -187,13 +187,19 @@ export function JLmap3dEdit(dom, data, mapid) {
scope.eventon();
}
if(changedata == "signalreplace"){
scope.editmode = "signaledit";
scope.eventon();
}
// if(scope.editmode == "trackedit"){
// scope.selectmodel = scope.action.sectionaction.changemodel(scope,changedata);
// }
if(scope.actionmode == "signaledit"){
scope.selectmodel = scope.action.signalaction.changemodel(scope,changedata);
// scope.editmode == "signaledit";
// scope.eventon();
// scope.selectmodel = scope.action.signalaction.changemodel(scope,changedata);
}
@ -279,7 +285,8 @@ export function JLmap3dEdit(dom, data, mapid) {
}
if(scope.editmode == "signaledit"){
scope.selectmodel = scope.action.signalaction.raycaster(scope);
console.log("==========signal=========");
scope.selectmodel = scope.action.signalaction.raycaster(scope,"signal");
}
if(scope.editmode == "stationedit"){

View File

@ -36,7 +36,7 @@ import {MouseControls} from '@/jlmap3d/main/control/FirstControls';
var clock = new THREE.Clock();
export function JLmapDriving(dom, data, skinCode,storemod) {
export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup) {
let scope = this;
@ -92,11 +92,20 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
this.drivecount = 0;
this.drivedata = null;
var sectionlist = null;
var linklist = null;
var signallist = null;
var stationstandlist = null;
var trainlisttest = null;
var realsectionlist = null;
var rails = null;
this.webwork=new Worker('../../static/workertest/trainworker.js');
// 地图模型数据
let mapdata = new Jl3ddata();
let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 1000);
let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 400);
camera.position.set( 0, 0, 0 );
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
@ -105,61 +114,81 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
listener.position.y = -2;
camera.add( listener );
let sound = new THREE.Audio( listener );
// load a sound and set it as the Audio object's buffer
let audioLoader = new THREE.AudioLoader();
audioLoader.load( '../../static/audio/trainmove.ogg', function( buffer ) {
sound.setBuffer( buffer );
sound.setLoop( true );
sound.setVolume( 0 );
sound.volswitch = false;
sound.play();
});
// let audioLoader = new THREE.AudioLoader();
// audioLoader.load( '../../static/audio/trainmove.ogg', function( buffer ) {
// sound.setBuffer( buffer );
// sound.setLoop( true );
// sound.setVolume( 0 );
// sound.volswitch = false;
// sound.play();
// });
let controls3 = new MouseControls(camera, 1.6);
controls3.enabled = true;
// controls3.getObject().rotation.x = Math.PI/2;
scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 120);
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 50);
cameracctv.position.set( 2, -1,27 );
cameracctv.rotation.y = Math.PI/5*3;
camera.add(cameracctv);
// let spotLight = new THREE.SpotLight( 0xffffff, 1 );
// // spotLight.position.set( 15, 40, 35 );
// spotLight.angle = Math.PI / 5;
// spotLight.penumbra = 0.05;
// spotLight.decay = 1;
// spotLight.distance = 30;
//
// spotLight.castShadow = true;
// spotLight.shadow.mapSize.width = 1024;
// spotLight.shadow.mapSize.height = 1024;
// spotLight.shadow.camera.near = 10;
// spotLight.shadow.camera.far = 50;
// spotLight.rotation.y = Math.PI;
// spotLight.position.y = -1;
// console.log(spotLight);
// controls3.getObject().add( spotLight );
// 订阅仿真socket
this.Subscribe = new Jl3dDriving(updatemmi,sound);
this.Subscribe = new Jl3dDriving(updatemmi,sound,translation,routegroup);
this.Subscribe.socketon(scope.Subscribe.topic);
var timer = setInterval(function() {
if(mapdata.trainlisttest){
if(mapdata.trainlisttest.group){
if(mapdata.trainlisttest.group.children[0]){
updatemmi.updatedrivingcode(mapdata.trainlisttest.group.children[0].name);
scope.Subscribe.initdrivercode(mapdata.trainlisttest.group.children[0].name);
for(let k in mapdata.rails.switchrail){
if(trainlisttest){
if(trainlisttest.group){
if(trainlisttest.group.children[0]){
// updatemmi.updatedrivingcode(trainlisttest.group.children[0].name);
scope.Subscribe.initdrivercode(trainlisttest.group.children[0].name);
for(let k in rails.switchrail){
const ddd = storemod.getters['map/getDeviceByCode'](k);
let switchdata = mapdata.rails.switchrail[k];
mapdata.rails.switchrail[k].locateType = ddd.locateType;
let switchdata = rails.switchrail[k];
rails.switchrail[k].locateType = ddd.locateType;
if(ddd.locateType == "01"){
//1--向左 2--向右
//__\__ __/__
if(mapdata.rails.switchrail[k].directtype == "1"){
mapdata.rails.linkrail[switchdata.alink].lconnect = switchdata.blink;
mapdata.rails.linkrail[switchdata.blink].rconnect = switchdata.alink;
}else if(mapdata.rails.switchrail[k].directtype == "2"){
mapdata.rails.linkrail[switchdata.alink].rconnect = switchdata.blink;
mapdata.rails.linkrail[switchdata.blink].lconnect = switchdata.alink;
if(rails.switchrail[k].directtype == "1"){
rails.linkrail[switchdata.alink].lconnect = switchdata.blink;
rails.linkrail[switchdata.blink].rconnect = switchdata.alink;
}else if(rails.switchrail[k].directtype == "2"){
rails.linkrail[switchdata.alink].rconnect = switchdata.blink;
rails.linkrail[switchdata.blink].lconnect = switchdata.alink;
}
}else if(ddd.locateType == "02"){
if(mapdata.rails.switchrail[k].directtype == "1"){
mapdata.rails.linkrail[switchdata.alink].lconnect = switchdata.clink;
mapdata.rails.linkrail[switchdata.clink].rconnect = switchdata.alink;
}else if(mapdata.rails.switchrail[k].directtype == "2"){
mapdata.rails.linkrail[switchdata.alink].rconnect = switchdata.clink;
mapdata.rails.linkrail[switchdata.clink].lconnect = switchdata.alink;
if(rails.switchrail[k].directtype == "1"){
rails.linkrail[switchdata.alink].lconnect = switchdata.clink;
rails.linkrail[switchdata.clink].rconnect = switchdata.alink;
}else if(rails.switchrail[k].directtype == "2"){
rails.linkrail[switchdata.alink].rconnect = switchdata.clink;
rails.linkrail[switchdata.clink].lconnect = switchdata.alink;
}
}
}
@ -170,8 +199,8 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
}, 2000);
// 初始化加载数据和模型
getPublish3dMapDetail(skinCode).then(netdata => {
ModelLoad(data, scope, netdata.data, mapdata, camera, controls3, scene,mixers,storemod);
getPublish3dMapDetail(mapId).then(netdata => {
ModelLoad(data, scope, netdata.data, sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails, camera, controls3, scene,mixers,storemod);
});
// let stats = new Stats();
// dom.appendChild( stats.dom );
@ -209,11 +238,11 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
function updatcontrols() {
if (drivingcode) {
controls3.getObject().position.x = mapdata.trainlisttest.list[drivingcode].matrixWorld.elements[12]-27;
controls3.getObject().position.y=10;
controls3.getObject().position.z = mapdata.trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14];
controls3.getObject().position.x = trainlisttest.list[drivingcode].matrixWorld.elements[12]-27;
controls3.getObject().position.y=5;
controls3.getObject().position.z = trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14];
console.log(controls3);
// console.log(controls3);
}
}
@ -224,7 +253,7 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
scope.webwork.onmessage = function (event) {
// 更新列车位置
UpdateTrain(camera, mapdata.trainlisttest);
UpdateTrain(camera, trainlisttest);
};
}
@ -254,11 +283,12 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
};
updatemmi.updatedrivingcode = function(code) {
// console.log(trainlisttest);
drivingcode = code;
mapdata.trainlisttest.list[drivingcode].children[0].add(controls3.getObject());
trainlisttest.list[drivingcode].children[0].add(controls3.getObject());
controls3.getObject().position.x = 10;
controls3.getObject().position.y = 0;
controls3.getObject().position.z = 2.5;
controls3.getObject().position.z = 1.5;
controls3.getObject().rotation.x = Math.PI/2;
controls3.getObject().rotation.y = -Math.PI/2;
};
@ -280,7 +310,7 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
mixers = null;
scope.actions = null;
scope.Subscribe = null;
sound.stop();
// sound.stop();
scope.webwork.terminate();
// console.log(scope);
// scope = null;
@ -296,24 +326,24 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
this.showstationmsg = function(showtype) {
if (showtype == 'show') {
for (let st=0; st<mapdata.stationstandlist.group.children.length; st++) {
mapdata.stationstandlist.group.children[st].add(mapdata.stationstandlist.textlist[st]);
for (let st=0; st<stationstandlist.group.children.length; st++) {
stationstandlist.group.children[st].add(stationstandlist.textlist[st]);
}
} else {
for (let st=0; st<mapdata.stationstandlist.group.children.length; st++) {
mapdata.stationstandlist.group.children[st].remove(mapdata.stationstandlist.textlist[st]);
for (let st=0; st<stationstandlist.group.children.length; st++) {
stationstandlist.group.children[st].remove(stationstandlist.textlist[st]);
}
}
};
this.showtrainmsg = function(showtype) {
if (showtype == 'show') {
for (let st=0; st<mapdata.trainlisttest.textlist.length; st++) {
mapdata.trainlisttest.list[mapdata.trainlisttest.textlist[st].tcode].children[0].add(mapdata.trainlisttest.textlist[st]);
for (let st=0; st<trainlisttest.textlist.length; st++) {
trainlisttest.list[trainlisttest.textlist[st].tcode].children[0].add(trainlisttest.textlist[st]);
}
} else {
for (let st=0; st<mapdata.trainlisttest.textlist.length; st++) {
mapdata.trainlisttest.list[mapdata.trainlisttest.textlist[st].tcode].children[0].remove(mapdata.trainlisttest.textlist[st]);
for (let st=0; st<trainlisttest.textlist.length; st++) {
trainlisttest.list[trainlisttest.textlist[st].tcode].children[0].remove(trainlisttest.textlist[st]);
}
}
};
@ -344,13 +374,24 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
scope.Subscribe.socketoff(scope.Subscribe.topic);
};
this.loaderdata = function(loadsectionlist,loadlinklist,loadsignallist,loadstationstandlist,loadtrainlisttest,loadrealsectionlist,loadrails){
sectionlist = loadsectionlist;
linklist = loadlinklist;
signallist = loadsignallist;
stationstandlist = loadstationstandlist;
trainlisttest = loadtrainlisttest;
realsectionlist = loadrealsectionlist;
rails = loadrails;
}
this.eventon = function() {
// raycaster交互模型点击事件
document.getElementById('jlsimulation').addEventListener( 'mousedown', onselect, false );
// 窗口自适应
window.addEventListener( 'resize', onWindowResized, false );
sound.volswitch = true;
// sound.volswitch = true;
// controls.update();
};
@ -361,8 +402,8 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
// 窗口自适应
window.removeEventListener( 'resize', onWindowResized, false );
sound.volswitch = false;
sound.setVolume( 0 );
// sound.volswitch = false;
// sound.setVolume( 0 );
};
this.updatecamera = function(mesh, type) {
@ -416,17 +457,17 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
if (scope.raycasterswitch == 'stand') {
// 从站台对象组获取点击目标
let intersects1 = raycaster.intersectObjects( mapdata.stationstandlist.textlist);
let intersects1 = raycaster.intersectObjects( stationstandlist.textlist);
// 获取最近处点击到的模型对象
if (intersects1[0]) {
// 遍历对象组获取对象坐标更新相机数据
for (let j=0; j<mapdata.stationstandlist.list.length; j++) {
if (intersects1[0].object.name == mapdata.stationstandlist.list[j].mesh.code) {
camera.position.x = mapdata.stationstandlist.list[j].mesh.position.x;
camera.position.y = mapdata.stationstandlist.list[j].mesh.position.y+200;
camera.position.z = mapdata.stationstandlist.list[j].mesh.position.z+300;
for (let j=0; j<stationstandlist.list.length; j++) {
if (intersects1[0].object.name == stationstandlist.list[j].mesh.code) {
camera.position.x = stationstandlist.list[j].mesh.position.x;
camera.position.y = stationstandlist.list[j].mesh.position.y+200;
camera.position.z = stationstandlist.list[j].mesh.position.z+300;
// 更新相机方向
// controls.target = new THREE.Vector3(mapdata.stationstandlist.list[j].mesh.position.x,mapdata.stationstandlist.list[j].mesh.position.y,mapdata.stationstandlist.list[j].mesh.position.z);
// controls.target = new THREE.Vector3(stationstandlist.list[j].mesh.position.x,stationstandlist.list[j].mesh.position.y,stationstandlist.list[j].mesh.position.z);
// controls.update();
}
}
@ -434,21 +475,21 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
}
if (scope.raycasterswitch == 'train') {
let intersects = raycaster.intersectObjects( mapdata.trainlisttest.textlist);
let intersects = raycaster.intersectObjects( trainlisttest.textlist);
if (intersects[0]) {
for (let j=0; j<mapdata.trainlisttest.list.length; j++) {
if (intersects[0].object.name == mapdata.trainlisttest.list[j].name) {
camera.position.x = mapdata.trainlisttest.list[j].position.x;
for (let j=0; j<trainlisttest.list.length; j++) {
if (intersects[0].object.name == trainlisttest.list[j].name) {
camera.position.x = trainlisttest.list[j].position.x;
camera.position.y = 200;
camera.position.z = mapdata.trainlisttest.list[j].children[2].matrixWorld.elements[14]+300;
camera.position.z = trainlisttest.list[j].children[2].matrixWorld.elements[14]+300;
}
}
}
}
if (scope.raycasterswitch == 'section') {
// console.log(mapdata.sectionlist.sections.modellist);
let intersects = raycaster.intersectObjects( mapdata.sectionlist.sections.modellist, true);
// console.log(sectionlist.sections.modellist);
let intersects = raycaster.intersectObjects( sectionlist.sections.modellist, true);
if (intersects[0]) {
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
@ -458,7 +499,7 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
if (scope.raycasterswitch == 'signal') {
let intersects = raycaster.intersectObjects( mapdata.signallist.group.children, true);
let intersects = raycaster.intersectObjects( signallist.group.children, true);
if (intersects[0]) {
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
@ -467,7 +508,7 @@ export function JLmapDriving(dom, data, skinCode,storemod) {
}
if (scope.raycasterswitch == 'switch') {
let intersects = raycaster.intersectObjects( mapdata.sectionlist.switchs.modellist, true);
let intersects = raycaster.intersectObjects( sectionlist.switchs.modellist, true);
if (intersects[0]) {
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,26 @@
export function UpdateTrain(camera,traindata,control){
if(traindata != undefined ){
for(let j=traindata.group.children.length-1;j>=0;j--){
//判断是否有移动事件
if(traindata.group.children[j].dispose == false){
if(traindata != undefined && traindata.group.children[0]){//traindata.group.children[0].dispose == false
if(traindata.group.children[j].progress != null){
let trainmodel = traindata.group.children[j];
if(traindata.group.children[0].progress != null){
let trainmodel = traindata.group.children[0];
if(trainmodel.speeds > 0 && trainmodel.speeds){
let speed = null;
if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){
// console.log(traindata.group.children[0].progress);
if(traindata.group.children[0].progress >=0&&traindata.group.children[0].progress<=1){
let movecurve = trainmodel.curve;
if(trainmodel.status == "03"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[j].progress);
if(trainmodel.status == "03" && movecurve.points.length>1){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.001){
let point = movecurve.getPointAt(traindata.group.children[0].progress);
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
let tangent = movecurve.getTangentAt(traindata.group.children[0].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
@ -37,7 +35,8 @@ export function UpdateTrain(camera,traindata,control){
let offsetz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]) - parseFloat(point.z);
trainmodel.children[0].position.z += offsetz;
//trainmodel.position.z = point.z;
// trainmodel.position.z = point.z;
}
trainmodel.position.x = point.x;
@ -52,7 +51,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-6)<=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]-10)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
@ -72,16 +71,16 @@ export function UpdateTrain(camera,traindata,control){
}
}
trainmodel.progress += trainmodel.speeds;
}
}
if(trainmodel.status == "02"){
if(movecurve.points.length>1){
if(trainmodel.status == "02" && movecurve.points.length>1){
let point = movecurve.getPointAt(trainmodel.progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.001){
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
let tangent = movecurve.getTangentAt(traindata.group.children[0].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
@ -94,12 +93,13 @@ export function UpdateTrain(camera,traindata,control){
}
trainmodel.children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]);
trainmodel.children[0].position.z += offsetz;
//trainmodel.position.z = point.z;
}
trainmodel.children[0].position.z += offsetz;
// trainmodel.position.z = point.z;
}
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
@ -110,7 +110,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+6)>=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]+10)>=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
@ -136,25 +136,20 @@ export function UpdateTrain(camera,traindata,control){
}
trainmodel.progress += trainmodel.speeds;
}
}
}else{
if(trainmodel.nextcurve){
// if(trainmodel.status == '02'){
// }else if(trainmodel.status == '03'){
// }
trainmodel.progress = 0;
trainmodel.len = trainmodel.nextlen;
trainmodel.nowcode = trainmodel.nextcode;
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/24/trainmodel.len);
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/25/trainmodel.len);
trainmodel.curve = trainmodel.nextcurve;
trainmodel.nextcurve = null;
trainmodel.nextlen = null;
trainmodel.nextcode = null;
}
// console.log(trainmodel.name);
@ -171,16 +166,15 @@ export function UpdateTrain(camera,traindata,control){
}else if(trainmodel.speeds < 0 && trainmodel.speeds){
let speed = null;
if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){
if(traindata.group.children[0].progress >=0&&traindata.group.children[0].progress<=1){
let movecurve = trainmodel.curve;
if(trainmodel.status == "03" && trainmodel.progress>0){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[j].progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.01){
if(trainmodel.status == "03" && trainmodel.progress>0 && movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[0].progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
let tangent = movecurve.getTangentAt(traindata.group.children[0].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
@ -210,7 +204,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-6)<=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]-9)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
@ -234,15 +228,13 @@ export function UpdateTrain(camera,traindata,control){
}
}
}
if(trainmodel.status == "02"){
if(movecurve.points.length>1 && trainmodel.progress>0){
if(trainmodel.status == "02" && movecurve.points.length>1 && trainmodel.progress>0){
let point = movecurve.getPointAt(trainmodel.progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.01){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
let tangent = movecurve.getTangentAt(traindata.group.children[0].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
@ -301,7 +293,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.progress += trainmodel.speeds;
}
}
}
}
}
@ -310,8 +302,6 @@ export function UpdateTrain(camera,traindata,control){
}
}
}
}
// }
}

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ import { getToken } from '@/utils/auth';
import router from '@/router';
// 定于仿真socket接口
export function Jlmap3dSubscribe(worker) {
export function Jlmap3dSubscribe(worker,routegroup) {
const scope = this;
this.map = null;

View File

@ -36,7 +36,7 @@ import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
var clock = new THREE.Clock();
export function JLmap3d(dom, data,skinCode,storemod) {
export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
let scope = this;
@ -53,6 +53,7 @@ export function JLmap3d(dom, data,skinCode,storemod) {
let camera = SetCamera(dom);
//定义场景(渲染容器)
let scene = SetScene();
//定义镜头操作
let controls = new THREE.OrbitControls(camera);
controls.maxPolarAngle = Math.PI/2;
@ -78,7 +79,8 @@ export function JLmap3d(dom, data,skinCode,storemod) {
//地图模型数据
let mapdata = new Jl3ddata();
//订阅仿真socket
this.Subscribe = new Jlmap3dSubscribe(this.webwork);
console.log(routegroup);
this.Subscribe = new Jlmap3dSubscribe(this.webwork,routegroup);
//连接到通信
//console.log(this.Subscribe.config);
//this.webwork.postMessage(this.Subscribe.teststomp);
@ -108,7 +110,7 @@ export function JLmap3d(dom, data,skinCode,storemod) {
//根据相机渲染场景
renderer.render(scene,camera);
//检测动画构造器播放动画
//stats.update();
// stats.update();
}
}

View File

@ -1,15 +1,21 @@
import { AssetModel } from '@/jlmap3d/main/loaders/model/Assetmodel';
import { Assetmaterial } from '@/jlmap3d/main/loaders/model/Assetmaterial';
import { getBaseUrl } from '@/utils/baseUrl';
import { Loading } from 'element-ui';
const BASE_API = getBaseUrl();
let modelurl = "../../static/model";
if(BASE_API == 'https://joylink.club/jlcloud'){
modelurl = "https://joylink.club/oss";
}else if(BASE_API == 'https://test.joylink.club/jlcloud'){
modelurl = "https://test.joylink.club/oss";
}
let defaultsignal = {
id:"3",
name:"低位三灯",
deviceType:"signal",
type:"low",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/signal/d3d.FBX"
assetUrl:"../../static/model/signal/d3d.FBX"
}
let defaulttrain = {
@ -18,7 +24,7 @@ let defaulttrain = {
deviceType:"train",
type:"num4",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/train/train.FBX"
assetUrl:modelurl+"/models/train/train.FBX"
}
@ -28,8 +34,9 @@ let defaultstation = {
deviceType:"stand",
type:"num4",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/station/fuzhou/fuzhou.FBX"
assetUrl:modelurl+"/models/station/fuzhou/fuzhou.FBX"
}
//modelurl+"/models/station/fuzhou/fuzhou.FBX"
//https://test.joylink.club/oss/models/station/fuzhou/fuzhou.FBX
//https://joylink.club/oss/models/station/fuzhou/fuzhou.FBX
//../../static/model/station/zhantai715(2).FBX
@ -40,7 +47,7 @@ let defaultswitch = {
deviceType:"switch",
type:"fuzhou",
picUrl:"",
assetUrl:"https://test.joylink.club/oss/models/daocha/daocha.FBX"
assetUrl:modelurl+"/models/daocha/daocha.FBX"
}
let defaultdriver = {
@ -49,7 +56,7 @@ let defaultdriver = {
deviceType:"driver",
type:"driver",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/driver/driver.FBX"
assetUrl:modelurl+"/models/driver/driver.FBX"
}
let defaultsuidao = {
@ -58,11 +65,12 @@ let defaultsuidao = {
deviceType:"suidao",
type:"suidao",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/suidao/suidao.FBX"
assetUrl:"../../static/model/suidao/suidao.FBX"
}
//modelurl+"/models/suidao/suidao.FBX"
//https://test.joylink.club/oss/models/suidao/suidao.FBX
//https://joylink.club/oss/models/suidao/suidao.FBX
//../../static/model/
//../../static/model/suidao/suidao.FBX
let defaultautorail = {
id:"100",
@ -70,7 +78,7 @@ let defaultautorail = {
deviceType:"autorail",
type:"autorail",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/auto/rail.FBX"
assetUrl:"../../static/model/auto/rail.FBX"
}
let defaultautosuidao = {
@ -79,7 +87,7 @@ let defaultautosuidao = {
deviceType:"autosuidao",
type:"autosuidao",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/auto/suidao.FBX"
assetUrl:"../../static/model/auto/suidao.FBX"
}
let autoswitch1 = {
@ -88,7 +96,7 @@ let autoswitch1 = {
deviceType:"autoswitch1",
type:"fuzhou",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/auto/switch1.FBX"
assetUrl:modelurl+"/models/auto/switch1.FBX"
}
let autoswitch2 = {
@ -97,7 +105,7 @@ let autoswitch2 = {
deviceType:"autoswitch2",
type:"fuzhou",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/auto/switch2.FBX"
assetUrl:modelurl+"/models/auto/switch2.FBX"
}
export function AssetLoader(){
@ -106,11 +114,16 @@ export function AssetLoader(){
this.name = null;
this.trainoffset = 0;
this.modellist = [];
this.materiallist = [];
//初始化资源加载器
this.setmodellist = function (data){
this.setmodellist = function (data,trainoffset){
if(trainoffset){
scope.trainoffset = trainoffset;
}
// console.log("setmodellist");
let defaultmodel1 = new AssetModel(defaultsignal);
scope.modellist.push(defaultmodel1);
@ -458,7 +471,8 @@ export function AssetLoader(){
let name = "c"+j;
for(let i=0;i<object.children.length;i++){
if(object.children[i].name == name){
object.children[i].position.x = object.children[i].position.x;
object.children[i].position.x = object.children[i].position.x+scope.trainoffset;
//object.children[i].position.y = j*10;
realtrain.add(object.children[i]);
i--;

View File

@ -554,7 +554,7 @@ THREE.FBXLoader = ( function () {
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
parameters.side = THREE.DoubleSide;
parameters.transparent = true;
parameters.alphaTest = 0.7;
// parameters.alphaTest = 0.7;
parameters.opacity = 1;
}else{
@ -567,7 +567,7 @@ THREE.FBXLoader = ( function () {
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
parameters.side = THREE.DoubleSide;
parameters.transparent = true;
parameters.alphaTest = 0.7;
// parameters.alphaTest = 0.7;
parameters.opacity = 1;
}else{
parameters.opacity = parseFloat( materialNode.Opacity.value );
@ -577,7 +577,7 @@ THREE.FBXLoader = ( function () {
if ( parameters.opacity < 1.0 ) {
parameters.transparent = true;
parameters.alphaTest = 0.1;
// parameters.alphaTest = 0.1;
}
if ( materialNode.ReflectionFactor ) {

View File

@ -66,7 +66,7 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
// console.log(netdata.assets);
assetloader.setmodellist(netdata.assets);
assetloader.setmodellist(netdata.assets,5);
assetloader.assetpromise(sceneload)
.then(function(data){
@ -75,12 +75,12 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
})
.then(function(data){
//console.log(data);
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions);
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"02");
})
.then(function(data){
//console.log(data);
//console.log(assetloader);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"02");
})
.then(function(data){
//console.log(data);
@ -96,19 +96,19 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
})
.then(function(data){
return new Promise(function(resolve, reject){
jlmap3ddata.rails.init(loaderdata.link,switchdata,sceneload,storemod);
jlmap3ddata.rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,standsdata,sceneload,storemod);
resolve("loadrail");
});
})
.then(function(data){
// for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
// if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
// // scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
// console.log(scope.assetloader.modellist[mn].mesh.position);
// scene.add(scope.assetloader.modellist[mn].mesh);
// }
// }
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
// console.log(scope.assetloader.modellist[mn].mesh.position);
scene.add(scope.assetloader.modellist[mn].mesh);
}
}
scope.animateswitch = true;

View File

@ -12,13 +12,14 @@ import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixerss,storemod){
export function ModelLoad(data,scope,netdata,sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,camera,controls,scene,mixerss,storemod){
//console.log(mapdata);
Materialload(scope);
//console.log(data);
//console.log(scope);
let sceneload = scene;
let jlmap3ddata = mapdata;
// let jlmap3ddata = mapdata;
let backdata = scope;
let assetloader = scope.assetloader;
let animateswitch = scope.animateswitch;
@ -50,39 +51,41 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
// console.log(data);
//初始化轨道和道岔 暂时
lengthfact(data);
jlmap3ddata.linklist = new LinkList();
jlmap3ddata.sectionlist = new SectionList();
jlmap3ddata.signallist = new SignalList();
//初始化站台
jlmap3ddata.stationstandlist = new StationStandList();
//初始化测试列车
jlmap3ddata.trainlisttest = new TrainList();
jlmap3ddata.realsectionlist = new RealSectionList();
jlmap3ddata.rails = new RailList();
linklist = new LinkList();
sectionlist = new SectionList();
signallist = new SignalList();
//初始化站台
stationstandlist = new StationStandList();
//初始化测试列车
trainlisttest = new TrainList();
realsectionlist = new RealSectionList();
rails = new RailList();
let loaderdata = JSON.parse(netdata.sections);
let switchdata = JSON.parse(netdata.switchs);
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
assetloader.setmodellist(netdata.assets);
assetloader.assetpromise(sceneload)
.then(function(data){
//console.log(data);
return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader);
return linklist.loadpromise(loaderdata.link,sceneload,assetloader);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions);
return stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"0");
})
.then(function(data){
//console.log(data);
//console.log(assetloader);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions);
return trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"0");
})
.then(function(data){
//console.log(data);
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,sceneload);
return sectionlist.loadpromise(linklist,assetloader,loaderdata.section,switchdata,sceneload);
})
// .then(function(data){
// //console.log(data);
@ -90,11 +93,12 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
// })
.then(function(data){
//console.log(data);
return jlmap3ddata.signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
return signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
})
.then(function(data){
return new Promise(function(resolve, reject){
jlmap3ddata.rails.init(loaderdata.link,switchdata,sceneload,storemod);
rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,
stationstandlist.list,sceneload,storemod);
resolve("loadrail");
});
@ -104,7 +108,8 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
scope.assetloader.modellist[mn].mesh.position.y -=0.1;
// scope.assetloader.modellist[mn].mesh.position.y -=0.1;
// console.log(scope.assetloader.modellist[mn].mesh);
scene.add(scope.assetloader.modellist[mn].mesh);
}
}
@ -112,9 +117,9 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
scope.animateswitch = true;
mapdata = jlmap3ddata;
scope.Subscribe.updatamap(mapdata,scope.materiallist,scope.actions,scope.sceneload);
// mapdata = jlmap3ddata;
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload);
scope.webwork.postMessage("on");
loadingInstance.close();
});

View File

@ -21,6 +21,7 @@ export function LinkList(data){
};
this.loadpromise = function(linkdata,scene,assetloader){
// console.log(linkdata);
return new Promise(function(resolve, reject){
scene.add(scope.linksgroup);
loadlink(linkdata,scene,assetloader);

View File

@ -5,12 +5,12 @@ export function RailList(){
this.switchrail = [];
this.stops = [];
this.setrail = function(){
};
this.init = function(linkdata,switchdata,scene,storemod){
this.init = function(linkdata,linklist,sectiondata,switchdata,standsdata,scene,storemod){
for(let i=0;i<linkdata.length;i++){
scope.linkrail[linkdata[i].code] = {
lp:linkdata[i].rail[0],
@ -23,24 +23,8 @@ export function RailList(){
points:[],
type:null
};
if(linkdata[i].rotation._z == 0){
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x+2,0,scope.linkrail[linkdata[i].code].lp.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x-2,0,scope.linkrail[linkdata[i].code].rp.z));
scope.linkrail[linkdata[i].code].type = 0;
}else{
if(linkdata[i].rotation._z>0){
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x+2.1,0,scope.linkrail[linkdata[i].code].lp.z-0.6));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x-2.1,0,scope.linkrail[linkdata[i].code].rp.z+0.6));
scope.linkrail[linkdata[i].code].type = 1;
}else{
scope.linkrail[linkdata[i].code].type = 2;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x+2.1,0,scope.linkrail[linkdata[i].code].lp.z+0.6));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x-2.1,0,scope.linkrail[linkdata[i].code].rp.z-0.6));
}
}
}
for(let i=0;i<switchdata.length;i++){
scope.switchrail[switchdata[i].code] = {
alink:switchdata[i].alink,
@ -52,48 +36,101 @@ export function RailList(){
};
if(scope.linkrail[switchdata[i].blink].lp.x < switchdata[i].position.x){
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.1,0,scope.linkrail[switchdata[i].alink].lp.z-0.6));
}else if(scope.linkrail[switchdata[i].alink].type == 2){
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.1,0,scope.linkrail[switchdata[i].alink].lp.z+0.6));
}else{
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2,0,scope.linkrail[switchdata[i].alink].lp.z));
}
scope.switchrail[switchdata[i].code].directtype = "1";
scope.linkrail[switchdata[i].alink].lswitch = switchdata[i].code;
scope.linkrail[switchdata[i].blink].rswitch = switchdata[i].code;
}else{
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.1,0,scope.linkrail[switchdata[i].alink].rp.z+0.6));
}else if(scope.linkrail[switchdata[i].alink].type == 2){
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.1,0,scope.linkrail[switchdata[i].alink].rp.z-0.6));
}else{
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2,0,scope.linkrail[switchdata[i].alink].rp.z));
}
scope.switchrail[switchdata[i].code].directtype = "2";
scope.linkrail[switchdata[i].alink].rswitch = switchdata[i].code;
scope.linkrail[switchdata[i].blink].lswitch = switchdata[i].code;
}
//
if(scope.linkrail[switchdata[i].clink].lp.x < switchdata[i].position.x){
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.1,0,scope.linkrail[switchdata[i].alink].lp.z-0.6));
}else if(scope.linkrail[switchdata[i].alink].type == 2){
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.1,0,scope.linkrail[switchdata[i].alink].lp.z+0.6));
}else{
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2,0,scope.linkrail[switchdata[i].alink].lp.z));
}
scope.switchrail[switchdata[i].code].directtype = "1";
scope.linkrail[switchdata[i].alink].lswitch = switchdata[i].code;
scope.linkrail[switchdata[i].clink].rswitch = switchdata[i].code;
}else{
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.1,0,scope.linkrail[switchdata[i].alink].rp.z+0.6));
}else if(scope.linkrail[switchdata[i].alink].type == 2){
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.1,0,scope.linkrail[switchdata[i].alink].rp.z-0.6));
}else{
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2,0,scope.linkrail[switchdata[i].alink].rp.z));
}
scope.switchrail[switchdata[i].code].directtype = "2";
scope.linkrail[switchdata[i].alink].rswitch = switchdata[i].code;
scope.linkrail[switchdata[i].clink].lswitch = switchdata[i].code;
}
}
for(let i=0;i<linkdata.length;i++){
if(linkdata[i].rotation._z == 0){
scope.linkrail[linkdata[i].code].type = 0;
if(scope.linkrail[linkdata[i].code].lswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z));
if(scope.linkrail[linkdata[i].code].rswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}else{
if(linkdata[i].rotation._z>0){
let testline = new THREE.CatmullRomCurve3([
new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z),
new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z)
]);
scope.linkrail[linkdata[i].code].type = 1;
if(scope.linkrail[linkdata[i].code].lswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+4.5,0,switchpoint.z-0.05));
}
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92));
if(scope.linkrail[linkdata[i].code].rswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-4.5,0,switchpoint.z+0.05));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}else{
let testline = new THREE.CatmullRomCurve3([
new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z),
new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z)
]);
scope.linkrail[linkdata[i].code].type = 2;
if(scope.linkrail[linkdata[i].code].lswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+4.5,0,switchpoint.z+0.05));
}
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92));
if(scope.linkrail[linkdata[i].code].rswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-4.5,0,switchpoint.z-0.05));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}
}
}
for(let i=0;i<switchdata.length;i++){
const ddd = storemod.getters['map/getDeviceByCode'](switchdata[i].code);
scope.switchrail[switchdata[i].code].locateType = ddd.locateType;
@ -107,7 +144,6 @@ export function RailList(){
scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].blink;
scope.linkrail[switchdata[i].blink].lconnect = switchdata[i].alink;
}
}else if(ddd.locateType == "02"){
if(switchdata[i].directtype == "1"){
scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].clink;
@ -117,10 +153,38 @@ export function RailList(){
scope.linkrail[switchdata[i].clink].lconnect = switchdata[i].alink;
}
}
if(scope.linkrail[switchdata[i].blink].lp.x < switchdata[i].position.x){
// scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x-2,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x+1.5,switchdata[i].position.y,switchdata[i].position.z));
//
scope.switchrail[switchdata[i].code].directtype = "1";
}else{
// scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x+2,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1.5,switchdata[i].position.y,switchdata[i].position.z));
//
scope.switchrail[switchdata[i].code].directtype = "2";
}
if(scope.linkrail[switchdata[i].clink].lp.x < switchdata[i].position.x){
// // scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x-3.5,switchdata[i].position.y,switchdata[i].position.z+0.02));
// scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x+1.5,switchdata[i].position.y,switchdata[i].position.z));
//
scope.switchrail[switchdata[i].code].directtype = "1";
}else{
// // scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x+3.5,switchdata[i].position.y,switchdata[i].position.z-0.02));
// scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1.5,switchdata[i].position.y,switchdata[i].position.z));
//
scope.switchrail[switchdata[i].code].directtype = "2";
}
}
for(let i=0;i<linkdata.length;i++){
scope.linkrail[linkdata[i].code].lineleft = new THREE.CatmullRomCurve3(scope.linkrail[linkdata[i].code].points);
// scope.linkrail[linkdata[i].code].lineleft.curveType = "catmullrom";
scope.linkrail[linkdata[i].code].lineleft.curveType = "centripetal";
// scope.linkrail[linkdata[i].code].lineleft.tension = 0.2;
let rightpoints = [];
scope.linkrail[linkdata[i].code].points.forEach(item=>{
@ -129,18 +193,148 @@ export function RailList(){
);
rightpoints.reverse();
scope.linkrail[linkdata[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
// scope.linkrail[linkdata[i].code].lineright.curveType = "catmullrom";
// scope.linkrail[linkdata[i].code].lineright.tension = 0.1;
var points = scope.linkrail[linkdata[i].code].lineleft.getPoints( 50 );
var geometry = new THREE.BufferGeometry().setFromPoints( points );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// Create the final object to add to the scene
var curveObject = new THREE.Line( geometry, material );
scope.linkrail[linkdata[i].code].lineright.curveType = "centripetal";
//
// for(let n=0,nm=scope.linkrail[linkdata[i].code].lineleft.points.length;n<nm;n++){
// var geometry = new THREE.CircleGeometry( 0.05, 16 );
// var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
// var circle = new THREE.Mesh( geometry, material );
// console.log(n);
// console.log(scope.linkrail[linkdata[i].code].lineleft.points[n]);
// circle.position.x = scope.linkrail[linkdata[i].code].lineleft.points[n].x;
// circle.position.y = scope.linkrail[linkdata[i].code].lineleft.points[n].y;
// circle.position.z = scope.linkrail[linkdata[i].code].lineleft.points[n].z;
// circle.rotation.x = -Math.PI/2;
// scene.add( circle );
// }
// // scope.linkrail[linkdata[i].code].lineright.tension = 0.11;
// var points = scope.linkrail[linkdata[i].code].lineleft.getPoints( 50 );
// var geometry = new THREE.BufferGeometry().setFromPoints( points );
// var material;
// if(scope.linkrail[linkdata[i].code].type == 0){
// material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// }
// if(scope.linkrail[linkdata[i].code].type == 1){
// material = new THREE.LineBasicMaterial( { color : 0x00ff00 } );
// }
// if(scope.linkrail[linkdata[i].code].type == 2){
// material = new THREE.LineBasicMaterial( { color : 0x0000ff } );
// }
//
//
// // Create the final object to add to the scene
// var curveObject = new THREE.Line( geometry, material );
//
// curveObject.position.y = Math.random();
// scene.add(curveObject);
}
let standsections = [];
for(let i=0,len=sectiondata.length;i<len;i++){
if(sectiondata[i].isStandTrack == true){
standsections.push(sectiondata[i]);
}
}
for(let k in standsdata){
let stop = {
code:null,
direct1:{
percent:null,
},
direct2:{
percent:null,
}
};
for(let i=0,leni=standsections.length;i<leni;i++){
for(let j=0,lenj=linklist.length;j<lenj;j++){
if(standsections[i].linkCode == linklist[j].code){
// let geometry = new THREE.CircleGeometry( 2, 16 );
// let material = new THREE.MeshBasicMaterial( { color: 0x00ffff } );
if(standsdata[k].direction1.code == standsections[i].relStandCode){
stop.code = standsdata[k].code;
// let circle1 = new THREE.Mesh( geometry, material );
// let circle2 = new THREE.Mesh( geometry, material );
let num = scope.linkrail[linklist[j].code].lineleft.points.length-1;
let lengthfacts = scope.linkrail[linklist[j].code].lineleft.points[num].x - scope.linkrail[linklist[j].code].lineleft.points[0].x;
let directoffset1 = standsdata[k].position.x-64-scope.linkrail[linklist[j].code].lineleft.points[0].x;
stop.direct1.percent = directoffset1/lengthfacts;
// circle1.position.x = standsdata[k].position.x+64;
// circle1.position.y = 5;
// circle1.position.z = scope.linkrail[linklist[j].code].points[0].z;
// circle1.rotation.x = -Math.PI/2;
//
// circle2.position.x = standsdata[k].position.x-64;
// circle2.position.y = 5;
// circle2.position.z = scope.linkrail[linklist[j].code].points[0].z;
// circle2.rotation.x = -Math.PI/2;
// scene.add( circle1 );
// scene.add( circle2 );
// console.log(stop);
}
if(standsdata[k].direction2.code == standsections[i].relStandCode){
stop.code = standsdata[k].code;
// let circle1 = new THREE.Mesh( geometry, material );
// let circle2 = new THREE.Mesh( geometry, material );
let num = scope.linkrail[linklist[j].code].lineleft.points.length-1;
let lengthfacts = scope.linkrail[linklist[j].code].lineleft.points[num].x - scope.linkrail[linklist[j].code].lineleft.points[0].x;
let directoffset2 = parseInt(standsdata[k].position.x+64-scope.linkrail[linklist[j].code].lineleft.points[0].x);
// console.log(directoffset2);
stop.direct2.percent = directoffset2/lengthfacts;
// console.log("test");
// console.log(directoffset1);
// console.log(directoffset2);
// console.log("sectoffsetleft");
// console.log(stop.direct1.percent);
// console.log(scope.linkrail[linklist[j].code].lengthfact);
// console.log(lengthfacts);
// console.log("........................");
// console.log(standsections[i].leftStopPointOffset);
// console.log(standsdata[n].position.x-64-scope.linkrail[linklist[j].code].lineleft.points[0].x);
// console.log("........................");
// console.log(standsdata[n].position.x+64);
// console.log(scope.linkrail[linklist[j].code].lineleft.getPointAt(stop.direct1.percent).x);
// console.log("sectoffsetright");
// console.log(scope.linkrail[linklist[j].code]);
// console.log(stop.direct2.percent);
// console.log(scope.linkrail[linklist[j].code].lengthfact);
// console.log(lengthfacts);
// console.log("........................");
// console.log(standsections[i].rightStopPointOffset);
// console.log(standsdata[k].position.x+64-scope.linkrail[linklist[j].code].lineleft.points[0].x);
// console.log("........................");
// console.log(standsdata[k].position.x+64);
// console.log(scope.linkrail[linklist[j].code].lineleft.getPointAt(stop.direct2.percent).x);
// circle1.position.x = standsdata[k].position.x+64;
// circle1.position.y = 5;
// circle1.position.z = scope.linkrail[linklist[j].code].points[0].z;
// circle1.rotation.x = -Math.PI/2;
// //
// circle2.position.x = standsdata[k].position.x-64;
// circle2.position.y = 5;
// circle2.position.z = scope.linkrail[linklist[j].code].points[0].z;
// circle2.rotation.x = -Math.PI/2;
//
// scene.add( circle1 );
// scene.add( circle2 );
// console.log(stop);
}
if(stop.direct1.percent != null && stop.direct2.percent != null){
// console.log(stop)
scope.stops[standsdata[k].code] = stop;
}
j = lenj;
}
}
}
}
// console.log(scope.stops);
}
this.getrail = function(){

View File

@ -104,11 +104,11 @@ export function SectionList() {
});
};
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
this.loadpromise = function(linklist,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){
// scene.add(sectiongroup);
scene.add(switchgroup);
let linkdata = jlmap3ddata.linklist;
let linkdata = linklist;
for(let i=0;i<sectiondata.length;i++){
if(sectiondata[i].type == "01"){

View File

@ -67,10 +67,10 @@ export function SignalList() {
}
let newmesh = assetloader.modellist[num].mesh.clone(true);
for(let j=0;j<newmesh.children.length;j++){
let newmaterial = new THREE.MeshPhongMaterial();
newmaterial.copy(newmesh.children[j].material);
newmesh.children[j].material = newmaterial;
newmesh.children[j].material.needsUpdate = true;
newmaterial.dispose();

View File

@ -12,7 +12,7 @@ export function StationStandList() {
this.textlist = [];
this.initpromise = function(stationdata,stationstanddata,scene,assetloader,netdata,mixers,actionss){
this.initpromise = function(stationdata,stationstanddata,scene,assetloader,netdata,mixers,actionss,mode){
return new Promise(function(resolve, reject){
let netstand = null;
@ -30,6 +30,7 @@ export function StationStandList() {
let newstationstand = new StationStandModel(stationdata);
//判断站台是否显示
if(stationdata[i].visible == true){
//遍历车站站台数据
for(let j=0;j<stationstanddata.length;j++){
//收集有效车站数据
@ -41,22 +42,24 @@ export function StationStandList() {
if(stationstanddata[j].direction == "01"){
newstationstand.direction1.position = stationstanddata[j].position;
newstationstand.direction1.name = stationstanddata[j].code;
newstationstand.direction1.code = stationstanddata[j].code;
newstationstand.direction1.screenDoorOpenStatus = "01";
}
if(stationstanddata[j].direction == "02"){
newstationstand.direction2.position = stationstanddata[j].position;
newstationstand.direction2.name = stationstanddata[j].code;
newstationstand.direction2.code = stationstanddata[j].code;
newstationstand.direction2.screenDoorOpenStatus = "01";
}
}
}
newstationstand.num = i;
scope.list[stationdata[i].code] = newstationstand;
newstationstand.num = i;
}
}
let map = scope.list;
for(let k in map){
@ -96,6 +99,7 @@ export function StationStandList() {
textmaterial.dispose();
textt.dispose();
}else{
for(let netnum =0;netnum <netstand.length;netnum++){
if(netstand[netnum].code == k ){
@ -106,12 +110,17 @@ export function StationStandList() {
j = assetloader.modellist.length;
}
}
map[k].position = netstand[netnum].position;
netnum = netstand.length;
}
}
map[k].mesh = assetloader.modellist[num].mesh.clone(true);
let newclip = assetloader.modellist[num].mesh.animations[ 0 ];
for(let j=0;j<map[k].mesh.children.length;j++){
if(map[k].mesh.children[j].name == "top"){
@ -164,159 +173,38 @@ export function StationStandList() {
map[k].mesh.scale.x = netstand[map[k].index].scale.x;
map[k].mesh.scale.y = netstand[map[k].index].scale.y;
map[k].mesh.scale.z = netstand[map[k].index].scale.z;
let textgeometry = new THREE.PlaneBufferGeometry( 271, 374, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[map[k].num]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = stationdata[map[k].num].code;
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 271, 374, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[map[k].num]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = stationdata[map[k].num].code;
textplane.position.y = 300;
textplane.rotation.x = Math.PI/2;
//textplane.position.x = -30;
scope.textlist.push(textplane);
map[k].mesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
map[k].type = "station";
map[k].rname = stationdata[map[k].num].runPlanName;
map[k].kmmark = stationdata[map[k].num].kmPost;
textplane.position.y = 300;
textplane.rotation.x = Math.PI/2;
//textplane.position.x = -30;
scope.textlist.push(textplane);
map[k].mesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
scope.group.add(map[k].mesh);
}
}
//建立需要显示车的车站模型对象
//
// for(let i=0;i<scope.list.length;i++){
// let num;
// if(haddata == false){
// for(let j=0;j<assetloader.modellist.length;j++){
// if(assetloader.modellist[j].deviceType == "stand"){
// num = j;
// }
// }
//
//
//
//
// scope.list[i].mesh = assetloader.modellist[num].mesh.clone(true);
// scope.list[i].id = assetloader.modellist[num].id;
// scope.list[i].mesh.code = scope.list[i].code;
//
// for(let j=0;j<scope.list[i].mesh.children.length;j++){
// scope.list[i].mesh.children[j].code = scope.list[i].code;
// }
//
// scope.list[i].mesh.position.set(scope.list[i].direction1.position.x,-20000,( scope.list[i].direction2.position.y + scope.list[i].direction1.position.y)/2+scope.list[i].height/2 );
// console.log(stationdata[i]);
// scope.list[i].type = "station";
// scope.list[i].rname = stationdata[i].runPlanName;
// scope.list[i].kmmark = stationdata[i].kmPost;
//
// let textgeometry = new THREE.PlaneBufferGeometry( 271, 374, 1 );
// let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[i]));
// let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
// let textplane = new THREE.Mesh( textgeometry, textmaterial );
// textplane.name = stationdata[i].code;
// textplane.position.x = 250;
// textplane.rotation.x = Math.PI;
// //textplane.position.x = -30;
// scope.list[i].mesh.add(textplane);
//
// scope.group.add(scope.list[i].mesh);
//
// textgeometry.dispose();
// textmaterial.dispose();
// textt.dispose();
// }else{
// for(let j=0;j<assetloader.modellist.length;j++){
// if(assetloader.modellist[j].id == netstand[i].modelid){
// num = j;
// }
// }
//
// scope.list[i].mesh = assetloader.modellist[num].mesh.clone(true);
// let newclip = assetloader.modellist[num].mesh.animations[ 0 ];
//
// for(let j=0;j<scope.list[i].mesh.children.length;j++){
//
// if(scope.list[i].mesh.children[j].name == "top"){
// scope.list[i].mesh.children[j].animations = [];
// scope.list[i].mesh.children[j].animations.push(newclip.clone());
//
// let mixer = new THREE.AnimationMixer( scope.list[i].mesh.children[j] );
//
// let key = scope.list[i].direction1.name;
// actionss[key] = mixer.clipAction( scope.list[i].mesh.children[j].animations[0]);
// actionss[key].setLoop(THREE.LoopOnce);
// actionss[key].clampWhenFinished = true;
// //actionss[key].play();
// mixers.push(mixer);
// }
// if(scope.list[i].mesh.children[j].name == "down"){
// let newclip = assetloader.modellist[num].mesh.animations[ 0 ];
// scope.list[i].mesh.children[j].animations = [];
// scope.list[i].mesh.children[j].animations.push(newclip.clone());
//
// let mixer = new THREE.AnimationMixer( scope.list[i].mesh.children[j] );
//
// let key = scope.list[i].direction2.name;
// actionss[key] = {
// status:"01",
// action:mixer.clipAction( scope.list[i].mesh.children[j].animations[0])
// };
// actionss[key].action.setLoop(THREE.LoopOnce);
// actionss[key].action.clampWhenFinished = true;
// //actionss[key].play();
// mixers.push(mixer);
// }
//
// }
//
// scope.list[i].mesh.name = netstand[i].name;
// scope.list[i].mesh.code = netstand[i].code;
// for(let j=0;j<scope.list[i].mesh.children.length;j++){
// scope.list[i].mesh.children[j].code = netstand[i].code;
// }
// scope.list[i].mesh.position.x = netstand[i].position.x;
// scope.list[i].mesh.position.y = netstand[i].position.y;
// scope.list[i].mesh.position.z = netstand[i].position.z;
// // scope.list[i].mesh.rotation.x = netstand[i].rotation._x;
// // scope.list[i].mesh.rotation.y = netstand[i].rotation._y;
// // scope.list[i].mesh.rotation.z = netstand[i].rotation._z;
// scope.list[i].mesh.scale.x = netstand[i].scale.x;
// scope.list[i].mesh.scale.y = netstand[i].scale.y;
// scope.list[i].mesh.scale.z = netstand[i].scale.z;
//
// let textgeometry = new THREE.PlaneBufferGeometry( 271, 374, 1 );
// let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[i]));
// let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
// let textplane = new THREE.Mesh( textgeometry, textmaterial );
// textplane.name = stationdata[i].code;
//
// scope.list[i].type = "station";
// scope.list[i].rname = stationdata[i].runPlanName;
// scope.list[i].kmmark = stationdata[i].kmPost;
//
// textplane.position.y = 300;
// textplane.rotation.x = Math.PI/2;
// //textplane.position.x = -30;
// scope.textlist.push(textplane);
// scope.list[i].mesh.add(textplane);
//
// textgeometry.dispose();
// textmaterial.dispose();
// textt.dispose();
//
// scope.group.add(scope.list[i].mesh);
// }
//
// // scene.add(plane);
// }
resolve("loadedstation");
});
}
@ -354,9 +242,9 @@ function getTextCanvas(text){
ctx.fillText("信息", 114,100);
ctx.fillText("备忘", 190,100);
ctx.fillText("车站序号: "+text.name, 40,155);
ctx.fillText("车站序号: "+text.name, 10,155);
ctx.fillText("公里标记:"+text.kmPost,40 ,256*3/4);
ctx.fillText("公里标记:"+text.kmPost,10 ,256*3/4);
let data = ctx.getImageData(0, 0,256,512);
return data;

View File

@ -12,7 +12,7 @@ export function TrainList() {
this.textlist = [];
this.initpromise = function(data,scene,assetloader,mixers,actionss){
this.initpromise = function(data,scene,assetloader,mixers,actionss,mode){
return new Promise(function(resolve, reject){
//遍历列车数据
for(let i=0;i<data.length;i++){
@ -118,22 +118,28 @@ export function TrainList() {
// newmesh.children[n-1].add(newmesh.children[n]);
// }
//创建列车字牌
let textgeometry = new THREE.PlaneBufferGeometry( 150, 100, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(data[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = data[i].code;
textplane.position.x = 0;
textplane.position.y = 0;
textplane.position.z = 60;
textplane.tcode = data[i].code;
//textplane.rotation.x = Math.PI;
scope.textlist.push(textplane);
newmesh.children[0].add(textplane);
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 150, 100, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(data[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = data[i].code;
textplane.position.x = 0;
textplane.position.y = 0;
textplane.position.z = 60;
textplane.tcode = data[i].code;
//textplane.rotation.x = Math.PI;
scope.textlist.push(textplane);
newmesh.children[0].add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
//group.add(textplane);
newmesh.first = false;
newmesh.name = data[i].code;
@ -187,24 +193,24 @@ function getTextCanvas(text){
var canvas = document.getElementById('canvastexture');
canvas.width = 128;
canvas.height = 96;
canvas.height = 64;
var ctx = canvas.getContext('2d');
//var bg = canvas.createPattern(img, "no-repeat");
//ctx.fillStyle = bg;
ctx.fillRect(0, 0,128,96);
ctx.font = "10px Verdana";
ctx.fillRect(0, 0,128,64);
ctx.font = "8px Verdana";
ctx.fillStyle = '#000000';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,128,96);
ctx.clearRect(0,0,128,64);
//console.log(text.groupNumber);
ctx.drawImage(beauty,0,0,128, 96);
ctx.fillText("车组号:"+text.groupNumber, 60,15);
ctx.fillText("车组人员:XXX", 60,31);
ctx.fillText("速度:XXX.XXX", 60,43);
ctx.drawImage(beauty,0,0,128, 64);
ctx.fillText("车组号:"+text.groupNumber, 40,10);
ctx.fillText("车组人员:XXX", 40,20);
// ctx.fillText("速度:XXX.XXX", 40,30);
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
let data = ctx.getImageData(0, 0,128,96);
let data = ctx.getImageData(0, 0,128,64);
return data;
}

View File

@ -9,6 +9,5 @@ export function Jl3ddata() {
this.stationstandlist = null;
this.trainlisttest = null;
this.realsectionlist = null;
this.path = [];
}

View File

@ -20,7 +20,8 @@ export function UpdateTrain(camera,traindata){
if(trainmodel.status == "03"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[j].progress);
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
@ -46,8 +47,7 @@ export function UpdateTrain(camera,traindata){
//trainmodel.position.z = point.z;
}
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
@ -84,6 +84,8 @@ export function UpdateTrain(camera,traindata){
if(trainmodel.status == "02"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(trainmodel.progress);
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
@ -103,8 +105,7 @@ export function UpdateTrain(camera,traindata){
//trainmodel.position.z = point.z;
}
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){

View File

@ -11,407 +11,407 @@ import EMouse from './EMouse';
import EJump from './EJump';
class StationStand extends Group {
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.model = model;
this.style = style;
this.zlevel = model.zlevel;
this.z = 1;
this.doors = new Group();
this.create();
this.createMouseEvent();
this.setVisible(model.visible);
this.setState(model);
}
create() {
const model = this.model;
const style = this.style;
const drict = model.doorLocationType == '01' ? 1 : -1;
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.model = model;
this.style = style;
this.zlevel = model.zlevel;
this.z = 1;
this.doors = new Group();
this.create();
this.createMouseEvent();
this.setVisible(model.visible);
this.setState(model);
}
create() {
const model = this.model;
const style = this.style;
const drict = model.doorLocationType == '01' ? 1 : -1;
/** 列车站台*/
const standH = drict > 0 ? style.StationStand.safetyDoor.height : model.height;
const standX = model.position.x - model.width / 2;
const standY = model.position.y + drict * (style.StationStand.safetyDoor.distance + standH);
this.safeStand = new ESafeStand({
zlevel: this.zlevel,
z: this.z,
style: style,
x: standX,
y: standY,
width: model.width,
height: model.height
});
this.add(this.safeStand);
/** 列车站台*/
const standH = drict > 0 ? style.StationStand.safetyDoor.height : model.height;
const standX = model.position.x - model.width / 2;
const standY = model.position.y + drict * (style.StationStand.safetyDoor.distance + standH);
this.safeStand = new ESafeStand({
zlevel: this.zlevel,
z: this.z,
style: style,
x: standX,
y: standY,
width: model.width,
height: model.height
});
this.add(this.safeStand);
if (model.direction != '03') {
/** 屏蔽门*/
this.safeDoor = new ESafeDoor({
zlevel: this.zlevel,
z: this.z,
style: style,
x: model.position.x,
y: model.position.y,
width: model.width,
height: style.StationStand.safetyDoor.height,
show: model.hasDoor
});
if (model.direction != '03') {
/** 屏蔽门*/
this.safeDoor = new ESafeDoor({
zlevel: this.zlevel,
z: this.z,
style: style,
x: model.position.x,
y: model.position.y,
width: model.width,
height: style.StationStand.safetyDoor.height,
show: model.hasDoor
});
/** 站台紧急关闭*/
const emergentH = drict > 0 ? style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.height: style.StationStand.standEmergent.mergentR;
const emergentX = model.position.x + drict * (style.StationStand.standEmergent.offset.x);
const emergentY = model.position.y + drict * (style.StationStand.standEmergent.offset.y + emergentH);
this.emergent = new ESafeEmergent({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
x: emergentX,
y: emergentY,
r: style.StationStand.standEmergent.mergentR,
n: 4
});
/** 站台紧急关闭*/
const emergentH = drict > 0 ? style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.height : style.StationStand.standEmergent.mergentR;
const emergentX = model.position.x + drict * (style.StationStand.standEmergent.offset.x);
const emergentY = model.position.y + drict * (style.StationStand.standEmergent.offset.y + emergentH);
this.emergent = new ESafeEmergent({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
x: emergentX,
y: emergentY,
r: style.StationStand.standEmergent.mergentR,
n: 4
});
/** 站台折返策略*/
const reentryD = style.StationStand.reentry.position ? model.height + 6: -style.StationStand.safetyDoor.distance - style.StationStand.safetyDoor.height;
const reentryH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + reentryD;
const reentryX = model.position.x - (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.x - model.width / 2);
const reentryY = model.position.y + (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.y) + drict * reentryH;
this.reentry = new EReentry({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
drict: drict,
x: reentryX,
y: reentryY,
lineWidth: 0,
fill: style.StationStand.reentry.noHumanColor
});
/** 站台折返策略*/
const reentryD = style.StationStand.reentry.position ? model.height + 6 : -style.StationStand.safetyDoor.distance - style.StationStand.safetyDoor.height;
const reentryH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + reentryD;
const reentryX = model.position.x - (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.x - model.width / 2);
const reentryY = model.position.y + (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.y) + drict * reentryH;
this.reentry = new EReentry({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
drict: drict,
x: reentryX,
y: reentryY,
lineWidth: 0,
fill: style.StationStand.reentry.noHumanColor
});
const distance = style.StationStand.safetyDoor.height*2 - style.StationStand.stand.headFontSize/2 - 2;
const distance = style.StationStand.safetyDoor.height * 2 - style.StationStand.stand.headFontSize / 2 - 2;
/** 站台扣车*/
const detainD = style.StationStand.detainCar.position ? model.height - distance: -style.StationStand.safetyDoor.height;
const detainH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + detainD;
const detainX = model.position.x - (style.StationStand.detainCar.position || drict) * (style.StationStand.detainCar.offset.x - model.width / 2);
const detainY = model.position.y + (style.StationStand.detainCar.position || drict) * (style.StationStand.detainCar.offset.y) + drict * detainH;
this.detain = new EDetain({
zlevel: this.zlevel,
z: this.z,
style: style,
x: detainX,
y: detainY,
textAlign: 'middle',
textVerticalAlign: 'top'
});
/** 站台扣车*/
const detainD = style.StationStand.detainCar.position ? model.height - distance : -style.StationStand.safetyDoor.height;
const detainH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + detainD;
const detainX = model.position.x - (style.StationStand.detainCar.position || drict) * (style.StationStand.detainCar.offset.x - model.width / 2);
const detainY = model.position.y + (style.StationStand.detainCar.position || drict) * (style.StationStand.detainCar.offset.y) + drict * detainH;
this.detain = new EDetain({
zlevel: this.zlevel,
z: this.z,
style: style,
x: detainX,
y: detainY,
textAlign: 'middle',
textVerticalAlign: 'top'
});
/** 停站时间*/
const timeD = style.StationStand.stopTime.position ? model.height - distance: -style.StationStand.safetyDoor.height;
const timeH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + timeD;
const timeX = model.position.x - (style.StationStand.stopTime.position || drict) * (style.StationStand.stopTime.offset.x - model.width / 2);
const timeY = model.position.y + (style.StationStand.stopTime.position || drict) * (style.StationStand.stopTime.offset.y) + drict * timeH;
this.time = new ETime({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
x: timeX,
y: timeY,
name: model.parkingTime || '30'
});
/** 停站时间*/
const timeD = style.StationStand.stopTime.position ? model.height - distance : -style.StationStand.safetyDoor.height;
const timeH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + timeD;
const timeX = model.position.x - (style.StationStand.stopTime.position || drict) * (style.StationStand.stopTime.offset.x - model.width / 2);
const timeY = model.position.y + (style.StationStand.stopTime.position || drict) * (style.StationStand.stopTime.offset.y) + drict * timeH;
this.time = new ETime({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
x: timeX,
y: timeY,
name: model.parkingTime || '30'
});
/** 运行等级*/
const levelD = style.StationStand.level.position ? model.height - distance: -style.StationStand.safetyDoor.height;
const levelH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + levelD;
const levelX = model.position.x - (style.StationStand.level.position || drict) * (style.StationStand.level.offset.x - model.width / 2);
const levelY = model.position.y + (style.StationStand.level.position || drict) * (style.StationStand.level.offset.y) + drict * levelH;
this.level = new ELevel({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
x: levelX,
y: levelY,
name: model.intervalRunTime || '5'
});
/** 运行等级*/
const levelD = style.StationStand.level.position ? model.height - distance : -style.StationStand.safetyDoor.height;
const levelH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + levelD;
const levelX = model.position.x - (style.StationStand.level.position || drict) * (style.StationStand.level.offset.x - model.width / 2);
const levelY = model.position.y + (style.StationStand.level.position || drict) * (style.StationStand.level.offset.y) + drict * levelH;
this.level = new ELevel({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
x: levelX,
y: levelY,
name: model.intervalRunTime || '5'
});
/** 列车停跳 */
if (style.StationStand.common.haveJumpShow) {
const jumpD = style.StationStand.jump.position ? model.height - distance: -style.StationStand.safetyDoor.height;
const jumpH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + jumpD;
const jumpX = model.position.x - (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.x - model.width / 2);
const jumpY = model.position.y + (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.y) + drict * jumpH;
const jumpCX = model.position.x - (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.x - model.width / 2);
const jumpCY = model.position.y + (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.y - style.StationStand.common.textFontSize / 2) + drict * jumpH;
this.jump = new EJump({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
x: jumpX,
y: jumpY,
cx: jumpCX,
cy: jumpCY,
textAlign: 'middle',
textVerticalAlign: 'top',
jumpStopStatus: model.jumpStopStatus
});
this.add(this.jump);
}
/** 列车停跳 */
if (style.StationStand.common.haveJumpShow) {
const jumpD = style.StationStand.jump.position ? model.height - distance : -style.StationStand.safetyDoor.height;
const jumpH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + jumpD;
const jumpX = model.position.x - (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.x - model.width / 2);
const jumpY = model.position.y + (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.y) + drict * jumpH;
const jumpCX = model.position.x - (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.x - model.width / 2);
const jumpCY = model.position.y + (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.y - style.StationStand.common.textFontSize / 2) + drict * jumpH;
this.jump = new EJump({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
x: jumpX,
y: jumpY,
cx: jumpCX,
cy: jumpCY,
textAlign: 'middle',
textVerticalAlign: 'top',
jumpStopStatus: model.jumpStopStatus
});
this.add(this.jump);
}
this.add(this.safeDoor);
this.add(this.emergent);
this.add(this.detain);
this.add(this.reentry);
this.add(this.time);
this.add(this.level);
}
}
this.add(this.safeDoor);
this.add(this.emergent);
this.add(this.detain);
this.add(this.reentry);
this.add(this.time);
this.add(this.level);
}
}
createMouseEvent() {
if (this.style.StationStand.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}
createMouseEvent() {
if (this.style.StationStand.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}
setVisible(visible) {
if (visible) {
this.eachChild(elem => { elem.show(); });
} else {
this.eachChild(elem => { elem.hide(); });
}
}
setVisible(visible) {
if (visible) {
this.eachChild(elem => { elem.show(); });
} else {
this.eachChild(elem => { elem.hide(); });
}
}
/** 恢复初始状态*/
recover() {
this.time && this.time.hide();
this.level && this.level.hide();
this.detain && this.detain.hide();
this.reentry && this.reentry.hide();
this.emergent && this.emergent.hide();
this.jump && this.jump.hide();
if (this.model.visible) { this.safeDoor && this.safeDoor.hasDoor(false); }
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor);
}
/** 恢复初始状态*/
recover() {
this.time && this.time.hide();
this.level && this.level.hide();
this.detain && this.detain.hide();
this.reentry && this.reentry.hide();
this.emergent && this.emergent.hide();
this.jump && this.jump.hide();
if (this.model.visible) { this.safeDoor && this.safeDoor.hasDoor(false); }
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor);
}
/** 空闲*/
spare() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor);
}
/** 空闲*/
spare() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor);
}
/** 列车停站*/
stop() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.stopColor);
}
/** 列车停站*/
stop() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.stopColor);
}
/** 指定列车跳站*/
designatedJumpStop() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor);
this.jump && this.jump.show();
this.jump && this.jump.setStatus(this.model.jumpStopStatus);
}
/** 指定列车跳站*/
designatedJumpStop() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor);
this.jump && this.jump.show();
this.jump && this.jump.setStatus(this.model.jumpStopStatus);
}
/** 站台紧急关闭*/
emergentClose() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor);
this.emergent && this.emergent.show();
}
/** 站台紧急关闭*/
emergentClose() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor);
this.emergent && this.emergent.show();
}
/** 未设置跳停*/
unJumpStop() {
this.jump && this.jump.hide();
this.jump && this.jump.setStatus(this.model.jumpStopStatus);
}
/** 未设置跳停*/
unJumpStop() {
this.jump && this.jump.hide();
this.jump && this.jump.setStatus(this.model.jumpStopStatus);
}
/** 站台跳停*/
jumpStop() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor);
this.jump && this.jump.show();
this.jump && this.jump.setStatus(this.model.jumpStopStatus);
}
/** 站台跳停*/
jumpStop() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor);
this.jump && this.jump.show();
this.jump && this.jump.setStatus(this.model.jumpStopStatus);
}
/** 未设置扣车*/
unDetainTrain() {
this.detain && this.detain.hide();
}
/** 未设置扣车*/
unDetainTrain() {
this.detain && this.detain.hide();
}
/** 车站扣车*/
standDetainTrain() {
this.detain && this.detain.show();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.detainTrainTextColor);
}
/** 车站扣车*/
standDetainTrain() {
this.detain && this.detain.show();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.detainTrainTextColor);
}
/** 中心扣车*/
centerDetainTrain() {
this.detain && this.detain.show();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.centerTrainColor);
}
/** 中心扣车*/
centerDetainTrain() {
this.detain && this.detain.show();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.centerTrainColor);
}
/** 中心+车站扣车*/
standAndCenterDetainTrain() {
this.detain && this.detain.show();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.andCenterTrainColor);
}
/** 中心+车站扣车*/
standAndCenterDetainTrain() {
this.detain && this.detain.show();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.andCenterTrainColor);
}
/** 人工设置停战时间*/
setManuallyArmisticeTime(val) {
this.time && this.time.show();
this.time && this.time.setName(val);
}
/** 人工设置停战时间*/
setManuallyArmisticeTime(val) {
this.time && this.time.show();
this.time && this.time.setName(val);
}
/** 人工设置运行等级*/
setManuallyOperationLevel(val) {
this.level && this.level.show();
this.level && this.level.setName(val);
}
/** 人工设置运行等级*/
setManuallyOperationLevel(val) {
this.level && this.level.show();
this.level && this.level.setName(val);
}
/** 开门*/
openDoor() {
this.safeDoor && this.safeDoor.hasDoor(true);
}
/** 开门*/
openDoor() {
this.safeDoor && this.safeDoor.hasDoor(true);
}
/** 关门*/
closeDoor() {
this.safeDoor && this.safeDoor.hasDoor(false);
}
/** 关门*/
closeDoor() {
this.safeDoor && this.safeDoor.hasDoor(false);
}
/** 屏蔽门正常*/
doorNormal() {
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor);
}
/** 屏蔽门正常*/
doorNormal() {
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor);
}
/** 屏蔽门故障*/
doorFault() {
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.splitDoorColor);
}
/** 屏蔽门故障*/
doorFault() {
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.splitDoorColor);
}
/** 屏蔽门切除*/
doorSplit() {
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.splitDoorColor);
}
/** 屏蔽门切除*/
doorSplit() {
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.splitDoorColor);
}
/** 无折返(默认)*/
noReentry() {
this.reentry && this.reentry.hide();
}
/** 无折返(默认)*/
noReentry() {
this.reentry && this.reentry.hide();
}
/** 无人折返*/
noHumanReentry() {
this.reentry && this.reentry.show();
this.reentry && this.reentry.setColor(this.style.StationStand.reentry.noHumanColor);
}
/** 自动换端*/
autoChangeEnds() {
this.reentry && this.reentry.show();
this.reentry && this.reentry.setColor(this.style.StationStand.reentry.autoChangeEndsColor);
}
/** 无人折返*/
noHumanReentry() {
this.reentry && this.reentry.show();
this.reentry && this.reentry.setColor(this.style.StationStand.reentry.noHumanColor);
}
/** 自动换端*/
autoChangeEnds() {
this.reentry && this.reentry.show();
this.reentry && this.reentry.setColor(this.style.StationStand.reentry.autoChangeEndsColor);
}
setState(model) {
this.recover();
switch (model.status) {
case '01': /** 空闲*/
this.spare();
break;
case '02': /** 列车停站*/
this.stop();
break;
case '03': /** 站台紧急关闭*/
this.emergentClose();
break;
}
setState(model) {
this.recover();
switch (model.status) {
case '01': /** 空闲*/
this.spare();
break;
case '02': /** 列车停站*/
this.stop();
break;
case '03': /** 站台紧急关闭*/
this.emergentClose();
break;
}
if (Number(model.parkingTime) >= 0) {
this.setManuallyArmisticeTime(model.parkingTime);
}
if (Number(model.parkingTime) >= 0) {
this.setManuallyArmisticeTime(model.parkingTime);
}
if (Number(model.intervalRunTime) > 0) {
this.setManuallyOperationLevel(model.intervalRunTime);
}
if (Number(model.intervalRunTime) > 0) {
this.setManuallyOperationLevel(model.intervalRunTime);
}
/** 设置跳停*/
if (model.status == '01') {
switch (model.jumpStopStatus) {
case '01': /** 未设置跳停*/
this.unJumpStop();
break;
case '02': /** 指定站台跳停*/
this.designatedJumpStop();
break;
case '03': /** 站台全部跳停*/
this.jumpStop();
break;
}
}
/** 设置跳停*/
if (model.status == '01') {
switch (model.jumpStopStatus) {
case '01': /** 未设置跳停*/
this.unJumpStop();
break;
case '02': /** 指定站台跳停*/
this.designatedJumpStop();
break;
case '03': /** 站台全部跳停*/
this.jumpStop();
break;
}
}
/** 设置扣车*/
switch (model.holdStatus) {
case '01': /** 未设置扣车*/
this.unDetainTrain();
break;
case '02': /** 车站扣车*/
this.standDetainTrain();
break;
case '03': /** 中心扣车*/
this.centerDetainTrain();
break;
case '04': /** 中心+车站扣车*/
this.standAndCenterDetainTrain();
break;
}
/** 设置扣车*/
switch (model.holdStatus) {
case '01': /** 未设置扣车*/
this.unDetainTrain();
break;
case '02': /** 车站扣车*/
this.standDetainTrain();
break;
case '03': /** 中心扣车*/
this.centerDetainTrain();
break;
case '04': /** 中心+车站扣车*/
this.standAndCenterDetainTrain();
break;
}
/** 设置屏蔽门开关*/
switch (model.screenDoorOpenStatus) {
case '01':
this.closeDoor(); /** 关门*/
break;
case '02':
this.openDoor(); /** 开门*/
break;
}
/** 设置屏蔽门开关*/
switch (model.screenDoorOpenStatus) {
case '01':
this.closeDoor(); /** 关门*/
break;
case '02':
this.openDoor(); /** 开门*/
break;
}
/** 设置屏蔽门状态*/
switch (model.screenDoorStatus) {
case '01':
this.doorNormal(); /** 正常*/
break;
case '02':
this.doorFault(); /** 故障*/
break;
case '03':
this.doorSplit(); /** 切除*/
}
/** 设置屏蔽门状态*/
switch (model.screenDoorStatus) {
case '01':
this.doorNormal(); /** 正常*/
break;
case '02':
this.doorFault(); /** 故障*/
break;
case '03':
this.doorSplit(); /** 切除*/
}
/** 设置折返策略*/
switch (model.reentryStrategy) {
case '04': /** 默认*/
case '01':
this.noReentry(); /** 无折返策略*/
break;
case '02':
this.noHumanReentry(); /** 无人折返*/
break;
case '03':
this.autoChangeEnds(); /** 自动换端*/
break;
}
}
/** 设置折返策略*/
switch (model.reentryStrategy) {
case '04': /** 默认*/
case '01':
this.noReentry(); /** 无折返策略*/
break;
case '02':
this.noHumanReentry(); /** 无人折返*/
break;
case '03':
this.autoChangeEnds(); /** 自动换端*/
break;
}
}
getBoundingRect() {
const rect = this.safeStand.getBoundingRect();
this.safeDoor && rect.union(this.safeDoor.getBoundingRect());
getBoundingRect() {
const rect = this.safeStand.getBoundingRect();
this.safeDoor && rect.union(this.safeDoor.getBoundingRect());
return rect;
}
return rect;
}
getShapeTipPoint() {
const rect = this.getBoundingRect();
if (rect) {
return {
x: rect.x + rect.width / 2,
y: rect.y
};
}
return null;
}
getShapeTipPoint() {
const rect = this.getBoundingRect();
if (rect) {
return {
x: rect.x + rect.width / 2,
y: rect.y
};
}
return null;
}
}
export default StationStand;

View File

@ -120,13 +120,24 @@ export default {
],
controlMode: [
{ label: '中控', value: '01' },
{ label: '站控', value: '02' }
{ label: '中控', value: 'OperateCenterControl' },
{ label: '站控', value: 'LocalStationControl' },
{ label: '紧急站控', value: 'EmergencyStationControl' }
],
simulationRole: [
{ label: '行调操作', value: '01' },
{ label: '现地操作', value: '02' }
],
deviceTypeList: [
{ label: '区段', value: 'Section' },
{ label: '道岔', value: 'Switch' },
{ label: '信号机', value: 'Signal' },
{ label: '站台', value: 'StationStand' },
{ label: '控制模式', value: 'ControlConvertMenu' },
{ label: '车次窗', value: 'TrainWindow' }
]
}
};

View File

@ -1,243 +1,136 @@
export default {
Switch: {
// 取消故障
cancelStoppage: 999,
// 道岔故障
stoppage: 0,
// 道岔总定/定位操作
locate: 1,
// 道岔总反/反位操作
reverse: 2,
// 道岔单锁
lock: 3,
// 道岔解锁
unlock: 4,
// 道岔封闭
block: 5,
// 道岔解封
unblock: 6,
// 转动
turnout: 7,
// 强制扳动
turnoutForce: 8,
// 道岔故障解锁
fault: 9,
// 计轴预复位
axlePreReset: 10,
// 切除
split: 11,
// 激活
active: 12,
// 设置速度
setSpeed: 13,
// 取消速度
cancelSpeed: 14,
// 查询区段详情
query: 15,
// 设置限速
setLimitSpeed: 16,
// 确认计轴有效
alxeEffective: 17,
// 引导总锁
guideLock: 18
cancelStoppage: {value: 999, label: '取消故障'},
stoppage: {value: 0, label: '道岔故障'},
locate: {value: 1, label: '道岔总定/定位操作'},
reverse: {value: 2, label: '道岔总反/反位操作'},
lock: {value: 3, label: '道岔单锁'},
unlock: {value: 4, label: '道岔解锁'},
block: {value: 5, label: '道岔封闭'},
unblock: {value: 6, label: '道岔解封'},
turnout: {value: 7, label: '转动'},
turnoutForce: {value: 8, label: '强制扳动'},
fault: {value: 9, label: '道岔故障解锁'},
axlePreReset: {value: 10, label: '计轴预复位'},
split: {value: 11, label: '切除'},
active: {value: 12, label: '激活'},
setSpeed: {value: 13, label: '设置速度'},
cancelSpeed: {value: 14, label: '取消速度'},
query: {value: 15, label: '查询区段详情'},
setLimitSpeed: {value: 16, label: '设置限速'},
alxeEffective: {value: 17, label: '确认计轴有效'},
guideLock: {value: 18, label: '引导总锁'}
},
// 控制模式操作
StationControl: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 紧急站控
emergencyStationControl: 1,
// 请求站控
requestStationControl: 2,
// 强行站控
forcedStationControl: 3,
// 请求中控
requestCentralControl: 4,
// 中心控同意
centralAgree: 5,
// 中心控拒绝
centralRefuse: 6,
// 车站控同意
stationAgree: 7,
// 车站控拒绝
stationRefuse: 8
cancelStoppage: {value: 999, label: '取消故障'},
stoppage: {value: 0, label: '故障'},
emergencyStationControl: {value: 1, label: '紧急站控'},
requestStationControl: {value: 2, label: '请求站控'},
forcedStationControl: {value: 3, label: '强行站控'},
requestCentralControl: {value: 4, label: '请求中控'},
centralAgree: {value: 5, label: '中心控同意'},
centralRefuse: {value: 6, label: '中心控拒绝'},
stationAgree: {value: 7, label: '车站控同意'},
stationRefuse: {value: 8, label: '车站控拒绝'}
},
// 信号机操作
Signal: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 查询进路
query: 1,
// 排列进路
arrangementRoute: 2,
// 取消进路
cancelTrainRoute: 3,
// 信号重开
reopenSignal: 4,
// 人解列车进路 (总人解)
humanTrainRoute: 5,
// 封锁
lock: 6,
// 解锁
unlock: 7,
// 引导
guide: 8,
// 设置联锁自动进路
setAutoInterlock: 9,
// 取消联锁自动进路
cancelAutoInterlock: 10,
// 设置联锁自动触发
setAutoTrigger: 11,
// 取消联锁自动触发
cancelAutoTrigger: 12,
// 信号关灯
signalClose: 13,
// 进路交人工控
humanControl: 14,
// 进路交自动控
atsAutoControl: 15,
// 查询进路状态
detail: 16
cancelStoppage: {value: 999, label: '取消故障'},
stoppage: {value: 0, label: '故障'},
query: {value: 1, label: '查询进路'},
arrangementRoute: {value: 2, label: '排列进路'},
cancelTrainRoute: {value: 3, label: '取消进路'},
reopenSignal: {value: 4, label: '信号重开'},
humanTrainRoute: {value: 5, label: '人解列车进路 (总人解)'},
lock: {value: 6, label: '封锁'},
unlock: {value: 7, label: '解锁'},
guide: {value: 8, label: '引导'},
setAutoInterlock: {value: 9, label: '设置联锁自动进路'},
cancelAutoInterlock: {value: 10, label: '取消联锁自动进路'},
setAutoTrigger: {value: 11, label: '设置联锁自动触发'},
cancelAutoTrigger: {value: 12, label: '取消联锁自动触发'},
signalClose: {value: 13, label: '信号关灯'},
humanControl: {value: 14, label: '进路交人工控'},
atsAutoControl: {value: 15, label: '进路交自动控'},
detail: {value: 16, label: '查询进路状态'}
},
// 物理区段操作
Section: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 设置计轴失效
alxeFailure: 1,
// 查询区段详情
query: 1,
// 区故解
fault: 2,
// 封锁
lock: 3,
// 解锁
unlock: 4,
// 切除
split: 5,
// 激活
active: 6,
// 设置速度
setSpeed: 7,
// 取消速度
cancelSpeed: 8,
// 计轴预复位
axlePreReset: 9,
// 设备状态
detail: 10,
// 新建列车
newtrain: 11,
// 确认计轴有效
alxeEffective: 12,
// 设置临时限速
setLimitSpeed: 13,
// 确认临时限速
confirmLimit: 14
// 区段详情
// detail: 15
cancelStoppage: {value: 999, label: '取消故障'},
stoppage: {value: 0, label: '故障'},
alxeFailure: {value: 1, label: '设置计轴失效'},
query: {value: 1, label: '查询区段详情'},
fault: {value: 2, label: '区故解'},
lock: {value: 3, label: '封锁'},
unlock: {value: 4, label: '解锁'},
split: {value: 5, label: '切除'},
active: {value: 6, label: '激活'},
setSpeed: {value: 7, label: '设置速度'},
cancelSpeed: {value: 8, label: '取消速度'},
axlePreReset: {value: 9, label: '计轴预复位'},
detail: {value: 10, label: '设备状态'},
newtrain: {value: 11, label: '新建列车'},
alxeEffective: {value: 12, label: '确认计轴有效'},
setLimitSpeed: {value: 13, label: '设置临时限速'},
confirmLimit: {value: 14, label: '确认临时限速'}
},
// 站台
StationStand: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 提前发车
earlyDeparture: 1,
// 设置跳停
setJumpStop: 2,
// 取消跳停
cancelJumpStop: 3,
// 设置扣车
setDetainTrain: 4,
// 取消扣车
cancelDetainTrain: 5,
// 强制取消扣车
cancelDetainTrainForce: 6,
// 站台详细信息
detail: 7,
// 全线取消扣车
cancelDetainTrainAll: 8,
// 设置停站时间
setStopTime: 9,
// 设置运行等级
setRunLevel: 10,
// 设置折返策略
setBackStrategy: 11,
// 设置全线扣车
setDetainTrainAll: 12,
cancelUpDetainTrainAll: 13,
cancelDownDetainTrainAll: 14
cancelStoppage: {value: 999, label: '取消故障'},
stoppage: {value: 0, label: '故障'},
earlyDeparture: {value: 1, label: '提前发车'},
setJumpStop: {value: 2, label: '设置跳停'},
cancelJumpStop: {value: 3, label: '取消跳停'},
setDetainTrain: {value: 4, label: '设置扣车'},
cancelDetainTrain: {value: 5, label: '取消扣车'},
cancelDetainTrainForce: {value: 6, label: '强制取消扣车'},
detail: {value: 7, label: '站台详细信息'},
cancelDetainTrainAll: {value: 8, label: '全线取消扣车'},
setStopTime: {value: 9, label: '设置停站时间'},
setRunLevel: {value: 10, label: '设置运行等级'},
setBackStrategy: {value: 11, label: '设置折返策略'},
setDetainTrainAll: {value: 12, label: '设置全线扣车'}
},
Station: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 全站设置联锁自动触发
setAutoTrigger: 1,
// 全站取消联锁自动触发
cancelAutoTrigger: 2,
// 上电解锁
powerUnLock: 3,
// 执行关键操作测试
execKeyOperationTest: 4,
// 所有进路自排关
humanControlALL: 5,
// 所有进路自排开
atsAutoControlALL: 6,
split: 7,
active: 8
cancelStoppage: {value: 999, label: '取消故障'},
stoppage: {value: 0, label: '故障'},
setAutoTrigger: {value: 1, label: '全站设置联锁自动触发'},
cancelAutoTrigger: {value: 2, label: '全站取消联锁自动触发'},
powerUnLock: {value: 3, label: '上电解锁'},
execKeyOperationTest: {value: 4, label: '执行关键操作测试'},
humanControlALL: {value: 5, label: '所有进路自排关'},
atsAutoControlALL: {value: 6, label: '所有进路自排开'},
split: {value: 7, label: '区段切除'},
active: {value: 8, label: '区段激活'}
},
// 列车
Train: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 添加列车识别号
addTrainId: 1,
// 修改列车识别号
editTrainId: 2,
// 删除列车识别号
delTrainId: 3,
// 移动列车识别号
moveTrainId: 4,
cancelStoppage: {value: 999, label: '取消故障'},
stoppage: {value: 0, label: '故障'},
addTrainId: {value: 1, label: '添加列车识别号'},
editTrainId: {value: 2, label: '修改列车识别号'},
delTrainId: {value: 3, label: '删除列车识别号'},
moveTrainId: {value: 4, label: '移动列车识别号'},
// 交换列车识别号
switchTrainId: 5,
// 修改车组号
editTrainNo: 6,
// 限速行驶
limitSpeed: 7,
// 设置计划车
setPlanTrainId: 8,
// 添加计划车
addPlanTrainId: 9,
// 平移计划车
movetypelyTrainId: 10,
// 删除计划车
deletePlanTrainId: 11,
// 设目的地车
destinationTrainId: 12,
// 设人工车
artificialTrainId: 13
switchTrainId: {value: 5, label: '交换列车识别号'},
editTrainNo: {value: 6, label: '修改车组号'},
limitSpeed: {value: 7, label: '限速行驶'},
setPlanTrainId: {value: 8, label: '设置计划车'},
addPlanTrainId: {value: 9, label: '添加计划车'},
movetypelyTrainId: {value: 10, label: '平移计划车'},
deletePlanTrainId: {value: 11, label: '删除计划车'},
destinationTrainId: {value: 12, label: '设目的地车'},
artificialTrainId: {value: 13, label: '设人工车'}
},
// 取消全线临时限速
LimitControl: {
CancelAllLimit: 1
CancelAllLimit: {value: 1, label: '取消全线临时限速'}
}
};

View File

@ -167,6 +167,12 @@ const user = {
SetAccount({ commit }, account) {
commit('SET_ACCOUNT', account);
},
subscribe({commit}, params) {
commit('SUBSCRIBE', params);
},
subscribe_un({commit}, params) {
commit('SUBSCRIBE_UN', params);
}
}
};

View File

@ -59,10 +59,6 @@ div:focus {
}
}
//main-container全局样式
.app-main{
min-height: 100%
}
// main-container global css
.app-container {
padding: 20px;

View File

@ -3,11 +3,11 @@ 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.82:9000'; // 杜康
BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -179,6 +179,12 @@ export default {
// return this.$route.query.prdType;
return this.$store.state.training.prdType;
},
skinCode() {
return this.$route.query.skinCode;
},
mapId() {
return this.$route.query.mapId;
},
isLesson() {
return this.mode === 'teach' || this.mode === 'record' || this.mode === 'manage';
},
@ -579,11 +585,11 @@ export default {
if (this.isDrive) {
this.panelShow = false;
this.drivingShow = true;
this.$refs.Jl3dDrive.show(this.mapId);
this.$refs.Jl3dDrive.show(this.mapId,this.group);
} else {
this.panelShow = false;
this.simulationShow = true;
this.$refs.Jl3dSimulation.show(this.mapId);
this.$refs.Jl3dSimulation.show(this.mapId,this.group);
}
},
showScheduling() {

View File

@ -156,6 +156,12 @@ export default {
prdType() {
return this.$route.query.prdType;
},
skinCode() {
return this.$route.query.skinCode;
},
mapId() {
return this.$route.query.mapId;
},
isLesson() {
return this.mode === 'teach' || this.mode === 'record' || this.mode === 'manage';
},
@ -521,11 +527,11 @@ export default {
if (this.isDrive) {
this.panelShow = false;
this.drivingShow = true;
this.$refs.Jl3dDrive.show(this.mapId);
this.$refs.Jl3dDrive.show(this.mapId,this.group);
} else {
this.panelShow = false;
this.simulationShow = true;
this.$refs.Jl3dSimulation.show(this.mapId);
this.$refs.Jl3dSimulation.show(this.mapId,this.group);
}
},
showScheduling() {

View File

@ -3,14 +3,15 @@
<div class="jalmap3ddiv">
<div class="trainstatus">
{{ $t('jlmap3d.trainGroupNumber') }}{{ trainnum }} {{ stoptimes }}
{{$t('jlmap3d.trainGroupNumber')}}{{ trainnum }}</br>
{{ stoptimes }}
</div>
<div class="display-draft">
<el-button-group>
<!-- <el-button type="primary" @click="raystand">站台选择</el-button> -->
<el-button type="primary" @click="cctvplane">{{ cctvbuttonmsg }}</el-button>
<el-button type="primary" @click="showplane">{{ showbuttonmsg }}</el-button>
<el-button type="primary" @click="back">{{ $t('global.back') }}</el-button>
<el-button type="primary" @click="back">{{$t('global.back')}}</el-button>
</el-button-group>
</div>
@ -20,7 +21,8 @@
<div id="jlsimulation" class="jlmap3ddraw">
<canvas id="canvastexture" />
</div>
<div v-show="cctvshow" id="jlcctv" class="jlmap3cctv"/>
<div id="jlcctv" v-show="cctvshow" class="jlmap3cctv">
</div>
<Drive-Mmi v-if="mmishow" ref="mmiui" />
@ -52,185 +54,192 @@ import DriveTms from '@/views/jlmap3d/drive/sceneview/tmsview';
var train;
export default {
name: 'Jl3dDrive',
components: {
DriveMmi,
DriveTms
},
data() {
return {
trainlist: null,
stationlist: null,
msgdata: null,
training: {
id: '',
name: '',
remarks: ''
},
mapdata: null,
jlmap3d: null,
selectmodel: null,
cctvshow:true,
cctvbuttonmsg: this.$t('jlmap3d.surveillanceHidden'),
mmishow: false,
showbuttonmsg: this.$t('jlmap3d.trainInstrumentationDisplay'),
trainnum: '',
stoptimes: ''
};
},
watch: {
'jlmap3d.nowspeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updatespeed(newVal);
}
}
}
},
'jlmap3d.nowmxlen': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updatelen(newVal);
}
}
}
},
'jlmap3d.atpspeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updateatpspeed(newVal);
}
}
}
},
'jlmap3d.atospeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updateatospeed(newVal);
}
}
}
},
'jlmap3d.trainnum': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.trainnum = newVal;
}
}
},
'jlmap3d.stime': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.stoptimes = newVal;
}
}
},
'jlmap3d.drivecount': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.$refs.mmiui.updatedrivedata(this.jlmap3d.drivedata);
}
}
}
},
beforeDestroy() {
if (this.jlmap3d) {
this.jlmap3d.webwork.postMessage('off');
this.jlmap3d.endsocket();
this.jlmap3d.dispose();
this.jlmap3d = null;
name: 'Jl3dDrive',
components: {
DriveMmi,
DriveTms
},
data() {
return {
trainlist: null,
stationlist: null,
msgdata: null,
training: {
id: '',
name: '',
remarks: ''
},
mapdata: null,
jlmap3d: null,
selectmodel: null,
cctvshow:true,
cctvbuttonmsg: this.$t('jlmap3d.surveillanceHidden'),
mmishow: false,
showbuttonmsg: this.$t('jlmap3d.trainInstrumentationDisplay'),
trainnum: '',
stoptimes: ''
};
},
watch: {
'jlmap3d.nowspeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updatespeed(newVal);
}
}
}
},
'jlmap3d.nowmxlen': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updatelen(newVal);
}
}
}
},
'jlmap3d.atpspeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updateatpspeed(newVal);
}
}
}
},
'jlmap3d.atospeed': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if (this.mmishow == true) {
this.$refs.mmiui.updateatospeed(newVal);
}
}
}
},
'jlmap3d.trainnum': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.trainnum = newVal;
}
}
},
'jlmap3d.stime': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.stoptimes = newVal;
}
}
},
'jlmap3d.drivecount': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
this.$refs.mmiui.updatedrivedata(this.jlmap3d.drivedata);
}
}
},
// this.$destroy();
}
},
},
beforeDestroy() {
if (this.jlmap3d) {
this.jlmap3d.webwork.postMessage('off');
this.jlmap3d.endsocket();
this.jlmap3d.dispose();
this.jlmap3d = null;
mounted() {
this.mmishow = true;
// this.$destroy();
}
},
// this.$refs.mmiui.init();
},
methods: {
show: function (skinCode) {
// console.log("show");
// console.log(skinCode);
// console.log(this.jlmap3d);
mounted() {
this.mmishow = true;
if (this.jlmap3d == null) {
this.init(skinCode);
} else {
// this.jlmap3d.restart();
this.jlmap3d.eventon();
this.jlmap3d.animateon();
// this.$refs.mmiui.init();
},
methods: {
show: function (skinCode,group) {
// console.log("show");
// console.log(skinCode);
// console.log(this.jlmap3d);
}
},
init: function (skinCode) {
const mapdata = this.$store.getters['map/map'];
const dom = document.getElementById('app');
this.jlmap3d = new JLmapDriving(dom, mapdata, skinCode, this.$store);
this.jlmap3d.eventon();
this.cctvshow = false;
if (this.jlmap3d == null) {
this.init(skinCode,group);
} else {
// this.jlmap3d.restart();
this.jlmap3d.eventon();
this.jlmap3d.animateon();
},
raystand() {
this.jlmap3d.rayswitch('stand');
},
raytrain() {
this.jlmap3d.rayswitch('train');
},
raysection() {
this.jlmap3d.rayswitch('section');
},
raysignal() {
this.jlmap3d.rayswitch('signal');
},
rayswitch() {
this.jlmap3d.rayswitch('switch');
},
sstation(changedata) {
this.jlmap3d.updatecamera(changedata.mesh, 'station');
},
strain(changedata) {
if (changedata.dispose == false) {
this.jlmap3d.updatecamera(changedata, 'train');
}
}
},
init: function (skinCode,group) {
const mapdata = this.$store.getters['map/map'];
const dom = document.getElementById('app');
let translation = {
trainAtoOn: this.$t('jlmap3d.trainAtoOn'),
trainAtoOff: this.$t('jlmap3d.trainAtoOff'),
stopTime: this.$t('jlmap3d.stopTime')
};
// console.log(translation);
this.jlmap3d = new JLmapDriving(dom, mapdata, skinCode,this.$store,translation,group);
this.jlmap3d.eventon();
this.cctvshow = false;
},
},
raystand() {
this.jlmap3d.rayswitch('stand');
},
raytrain() {
this.jlmap3d.rayswitch('train');
},
raysection() {
this.jlmap3d.rayswitch('section');
},
raysignal() {
this.jlmap3d.rayswitch('signal');
},
rayswitch() {
this.jlmap3d.rayswitch('switch');
},
sstation(changedata) {
this.jlmap3d.updatecamera(changedata.mesh, 'station');
},
strain(changedata) {
if (changedata.dispose == false) {
this.jlmap3d.updatecamera(changedata, 'train');
}
back() {
this.$emit('showdriving');
this.jlmap3d.eventoff();
this.jlmap3d.animateoff();
// this.jlmap3d = null;
},
showplane() {
if (this.mmishow == true) {
this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationHidden');
this.mmishow = false;
} else {
this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationDisplay');
this.mmishow = true;
}
},
},
cctvplane() {
if (this.cctvshow == true) {
this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceHidden');
this.cctvshow = false;
this.jlmap3d.cctvoff();
} else {
this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceDisplay');
this.cctvshow = true;
this.jlmap3d.cctvon();
}
back() {
this.$emit('showdriving');
this.jlmap3d.eventoff();
this.jlmap3d.animateoff();
// this.jlmap3d = null;
},
showplane() {
if (this.mmishow == true) {
this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationHidden');
this.mmishow = false;
} else {
this.showbuttonmsg = this.$t('jlmap3d.trainInstrumentationDisplay');
this.mmishow = true;
}
}
},
cctvplane() {
if (this.cctvshow == true) {
this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceHidden');
this.cctvshow = false;
this.jlmap3d.cctvoff();
} else {
this.cctvbuttonmsg = this.$t('jlmap3d.surveillanceDisplay');
this.cctvshow = true;
this.jlmap3d.cctvon();
}
}
}
}
};
</script>
@ -287,10 +296,10 @@ export default {
width:fit-content;
width:-webkit-fit-content;
width:-moz-fit-content;
height:30px;
height:60px;
background: #000000;
position:absolute;
text-align: center;
text-align: left;
color:white;
font-size:25px;
}

View File

@ -195,7 +195,7 @@ export default {
let minutes = date.getMinutes();
let seconds = date.getSeconds();
vWeek_s = date.getDay();
document.getElementById("time").innerHTML = year + "年" + month + "月" + day + "日" + "\t" + vWeek[vWeek_s];
document.getElementById("time").innerHTML = year + "/" + month + "/" + day + "/" + "\t" + vWeek[vWeek_s];
},
updatemmistate(aaa){

View File

@ -33,11 +33,11 @@
<el-tab-pane label="信号灯编辑" name="signaledit">
<el-row>
<el-button id="trackreplace" class="editbutton" @click="actionevent">信号灯模型设置</el-button>
<el-button id="signalreplace" class="editbutton" @click="actionevent">信号灯模型设置</el-button>
</el-row>
<el-row>
<el-button id="tracktexture" class="editbutton" @click="actionevent">信号灯模型调整</el-button>
<el-button id="signaltexture" class="editbutton" @click="actionevent">信号灯模型调整</el-button>
</el-row>
</el-tab-pane>

View File

@ -87,7 +87,8 @@ export default {
// console.log(this.jlmap3dedit.selectmodel);
}
}
}
},
},
beforeDestroy() {
// console.log("destroy");
@ -104,11 +105,11 @@ export default {
// this.init();
},
methods: {
show: function (skinCode) {
show: function (skinCode,group) {
// console.log(skinCode);
// console.log(this.jlmap3d);
if (this.jlmap3d == null) {
this.init(skinCode);
this.init(skinCode,group);
} else {
// this.jlmap3d.restart();
this.jlmap3d.eventon();
@ -116,10 +117,10 @@ export default {
}
},
init: function (skinCode) {
init: function (skinCode,group) {
const mapdata = this.$store.getters['map/map'];
const dom = document.getElementById('app');
this.jlmap3d = new JLmap3d(dom, mapdata, skinCode,this.$store);
this.jlmap3d = new JLmap3d(dom, mapdata, skinCode,this.$store,group);
this.jlmap3d.eventon();
},
raystand() {

View File

@ -369,7 +369,7 @@ export default {
this.panelShow = false;
this.drivingShow = true;
this.ibpShow = false;
this.$refs.Jl3dDrive.show(this.mapId);
this.$refs.Jl3dDrive.show(this.mapId,this.group);
},
hideIbp() {
Message.closeAll();

View File

@ -166,10 +166,6 @@ export default {
return loginInfo[this.$route.path.split('/')[1]].title;
}
},
mounted() {
document.title = loginInfo[this.project].title;
this.loginRefresh();
},
created() {
this.computedAttribute();
if (Cookies.get(this.cookiesName) && Cookies.get(this.cookiesToken)) {
@ -189,6 +185,10 @@ export default {
});
}
},
mounted() {
document.title = loginInfo[this.project].title;
this.loginRefresh();
},
methods: {
computedAttribute() {
if (this.project.startsWith('design')) {
@ -198,12 +198,13 @@ export default {
this.loginClient = 'Design';
this.path = UrlConfig.design.prefix;
}
const nowLang = LangStorage.getLang('zh');
if (nowLang === 'zh') {
this.lang = 'en';
this.language = 'English';
}
removeToken();
removeToken();
setSessionStorage('project', this.project);
},

View File

@ -13,6 +13,20 @@
<el-button type="text" class="mapEdit_box" @click="showMap">{{ $t('map.viewLayer') }}</el-button>
</div>
<el-tabs v-model="enabledTab" type="card" class="map_card" @tab-click="changePane">
<el-tab-pane label="站台屏蔽门" class="tab_pane_box" name="safetyDoor">
<safety-door-operate
ref="routeOperate"
:map-info="mapInfo"
:selected="selected"
/>
</el-tab-pane>
<el-tab-pane label="站台紧急停车按钮" class="tab_pane_box" name="park">
<park-operate
ref="routeOperate"
:map-info="mapInfo"
:selected="selected"
/>
</el-tab-pane>
<el-tab-pane :label="$t('map.routeID')" class="tab_pane_box" name="route">
<route-operate
ref="routeOperate"
@ -65,6 +79,8 @@ import RoutingOperate from './routingoperate/index';
import AutomaticOperate from './automaticoperate/index';
import SwitchOperate from './switchoperate/index';
import PathOperate from './pathoperate/index';
import safetyDoorOperate from './safetyDoorOperate/index';
import parkOperate from './parkOperate/index';
export default {
name: 'DataRelation',
@ -73,7 +89,9 @@ export default {
RoutingOperate,
AutomaticOperate,
SwitchOperate,
PathOperate
PathOperate,
safetyDoorOperate,
parkOperate
},
props: {
selected: {

View File

@ -0,0 +1,33 @@
<template>
<div style="height: 100%;">
22222
</div>
</template>
<script>
export default {
components: {
},
props: {
mapInfo: {
type: Object,
default() {
return null;
}
},
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
};
},
methods: {
}
};
</script>

View File

@ -0,0 +1,51 @@
<template>
<div style="height: 100%;">
11111
</div>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
components: {
},
props: {
mapInfo: {
type: Object,
default() {
return null;
}
},
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
display: true
};
},
computed: {
...mapGetters('map', [
'map'
])
},
mounted () {
this.init();
},
methods: {
init() {
this.display = true;
console.log(this.map);
if (this.$store.state.map.map.safetyDoorList && this.$store.state.map.map.safetyDoorList.length) {
this.display = false;
}
console.log(this.$store.state.map.map);
}
}
};
</script>

View File

@ -270,10 +270,15 @@ export default {
const createArr = [];
models.forEach((item) => {
const sectionA = this.$store.getters['map/getDeviceByCode'](item.sectionACode);
const sectionB = this.$store.getters['map/getDeviceByCode'](item.sectionBCode);
// const sectionB = this.$store.getters['map/getDeviceByCode'](item.sectionBCode);
const sectionC = this.$store.getters['map/getDeviceByCode'](item.sectionCCode);
if (linkObj[sectionA.linkCode].num != 1 && linkObj[sectionB.linkCode].num != 1 && linkObj[sectionC.linkCode].num != 1 ) {
createArr.push(item);
if (linkObj[sectionA.linkCode] && linkObj[sectionC.linkCode]) {
if (linkObj[sectionA.linkCode].num > 1 && linkObj[sectionC.linkCode].num > 1 ) {
createArr.push(item);
}
} else {
this.questionList.push(`${this.$t('map.section')}${linkObj[sectionA.linkCode].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
this.questionList.push(`${this.$t('map.section')}${linkObj[sectionC.linkCode].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
}
});
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), {

View File

@ -2,6 +2,22 @@
<div class="dictionary_box">
<div class="joylink-card">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<div style="overflow: hidden; margin-bottom: 20px;">
<div class="param-title">条件参数:</div>
<el-table :data="formModel.conditionList" border class="param-table">
<el-table-column prop="name" label="参数名" />
<el-table-column prop="value" label="参数值" />
<el-table-column :label="this.$t('global.operate')" width="180">
<template slot-scope="scope">
<el-button type="text" size="small" @click="editConditionData(scope.$index, scope.row)">修改</el-button>
<el-button type="text" size="small" @click="delCondition(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="button-box">
<el-button type="primary" size="small" round @click="addConditionData">添加</el-button>
</div>
</div>
<div style="overflow: hidden;">
<div class="param-title">指令参数:</div>
<el-table :data="formModel.paramList" border class="param-table">
@ -20,11 +36,13 @@
</div>
<div class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="back">返回</el-button>
<el-button @click="handleBack">返回</el-button>
</div>
<command-edit ref="create" type="ADD" @addData="addData" />
<command-edit ref="edit" type="EDIT" @editData="editData" />
<edit-condition ref="addCondition" type="ADD" @addData="addCondition" />
<edit-condition ref="editCondition" type="EDIT" @editData="editCondition" />
</div>
</template>
@ -32,25 +50,22 @@
import { createCommand, editCommand, getCommandDetail } from '@/api/management/dictionary';
import CommandEdit from './editParam';
import { getLineCodeList } from '@/api/management/mapline';
import EditCondition from './editCondition';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'DictionaryEdit',
components: {
CommandEdit
CommandEdit,
EditCondition
},
props: {
},
data() {
return {
taskStatusList: [],
deviceTypeList: [
{ label: '区段', value: 'section' },
{ label: '道岔', value: 'switch' },
{ label: '信号机', value: 'signal' },
{ label: '站台', value: 'station' },
{ label: '控制模式', value: 'stationConter' },
{ label: '临时全线限速', value: 'limitConter' }
],
deviceTypeList: [],
operateList: [],
type: 'add',
editIndex: 0,
formModel: {
@ -60,7 +75,8 @@ export default {
lineCode: '',
operateObject: '',
operate: '',
paramList: []
paramList: [],
conditionList: []
}
};
},
@ -69,11 +85,11 @@ export default {
const form = {
labelWidth: '120px',
items: [
{ prop: 'lineCode', label: this.$t('system.lineCode'), type: 'select', options: this.taskStatusList },
{ prop: 'simulationRole', label: this.$t('system.simulationRole'), type: 'select', options: this.$ConstSelect.simulationRole },
{ prop: 'controlMode', label: this.$t('system.controlMode'), type: 'select', options: this.$ConstSelect.controlMode },
{ prop: 'lineCode', label: this.$t('system.lineCode'), type: 'select', options: this.taskStatusList },
{ prop: 'operateObject', label: this.$t('system.deviceType'), type: 'select', options: this.deviceTypeList, change: true, onChange: this.deviceChange },
{ prop: 'operate', label: this.$t('system.instructionType'), type: 'text' }
{ prop: 'operateObject', label: this.$t('system.deviceType'), type: 'select', options: this.$ConstSelect.deviceTypeList, change: true, onChange: this.deviceChange },
{ prop: 'operate', label: this.$t('system.instructionType'), type: 'select', options: this.operateList }
]
};
return form;
@ -121,11 +137,12 @@ export default {
if (this.$route.query.id) {
getCommandDetail(this.$route.query.id).then(res => {
this.formModel = res.data;
this.operateList = Object.values(Commands[this.formModel.operateObject]);
});
}
},
deviceChange(code) {
console.log(code);
deviceChange(code) { //
this.operateList = Object.values(Commands[code]);
},
doSave() {
this.$refs.dataform.validateForm(() => {
@ -157,9 +174,6 @@ export default {
handleBack() {
this.$router.push({ path: `/system/commands`, query: { } });
},
back() {
this.$router.go(-1);
},
editData(data) {
this.formModel.paramList.splice(this.editIndex, 1, data);
@ -176,6 +190,23 @@ export default {
},
delParam(index) {
this.formModel.paramList.splice(index, 1);
},
editConditionData(index, row) {
this.$refs.editCondition.doShow(row);
this.editIndex = index;
},
addConditionData() {
this.$refs.addCondition.doShow();
},
addCondition(Condition) {
this.formModel.conditionList.push(Condition);
},
editCondition(Condition) {
this.formModel.conditionList.splice(this.editIndex, 1, Condition);
},
delCondition(index) {
this.formModel.conditionList.splice(index, 1);
}
}
};

View File

@ -0,0 +1,99 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="400px" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: 'EditCondition',
props: {
type: {
type: String,
required: true
}
},
data() {
return {
dialogVisible: false,
formModel: {
name: '',
value: ''
}
};
},
computed: {
form() {
const form = {
labelWidth: '100px',
items: [
{ prop: 'name', label: '参数名', type: 'text' },
{ prop: 'value', label: '参数值', type: 'text' }
]
};
return form;
},
rules() {
return {
name: [
{ required: true, message: '请输入内容', trigger: 'blur' }
],
value: [
{ required: true, message: '请输入内容', trigger: 'blur' }
]
};
},
title() {
if (this.type === 'ADD') {
return '创建条件参数';
} else {
return '修改条件参数';
}
}
},
methods: {
doShow(data) {
this.dialogVisible = true;
if (data) {
this.formModel = {
name: data.name,
value: data.value
};
}
},
doSave() {
const self = this;
this.$refs.dataform.validateForm(() => {
if (self.type === 'ADD') {
self.create();
} else {
self.update();
}
});
},
getData() {
return {
name: this.formModel.name,
value: this.formModel.value
};
},
create() {
this.$emit('addData', this.getData());
this.handleClose();
},
update() {
this.$emit('editData', this.getData());
this.handleClose();
},
handleClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false;
}
}
};
</script>

View File

@ -24,8 +24,6 @@ export default {
formModel: {
id: '',
name: ''
// pattern: '',
// val: ''
}
};
},
@ -35,23 +33,15 @@ export default {
labelWidth: '100px',
items: [
{ prop: 'name', label: '参数名', type: 'text' }
// { prop: 'pattern', label: '', type: 'text' },
// { prop: 'val', label: '', type: 'text' }
]
};
return form;
},
rules() {
return {
// pattern: [
// { required: true, message: '', trigger: 'blur' }
// ],
name: [
{ required: true, message: '请输入内容', trigger: 'blur' }
]
// val: [
// { required: true, message: '', trigger: 'blur' }
// ]
};
},
title() {
@ -87,8 +77,6 @@ export default {
return {
id: this.formModel.id,
name: this.formModel.name
// pattern: this.formModel.pattern,
// val: this.formModel.val
};
},
create() {

View File

@ -1,28 +1,25 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<show-condition ref="showCondition" />
</div>
</template>
<script>
import { getCommandList, delCommand } from '@/api/management/dictionary';
import { getLineCodeList } from '@/api/management/mapline';
import ShowCondition from './showCondition';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'CommandDictionary',
components: {
ShowCondition
},
data() {
return {
taskStatusList: [],
deviceTypeList: [
{ label: '区段', value: 'section' },
{ label: '道岔', value: 'switch' },
{ label: '信号机', value: 'signal' },
{ label: '站台', value: 'station' },
{ label: '控制模式', value: 'stationConter' },
{ label: '临时全线限速', value: 'limitConter' }
],
operateList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -74,15 +71,18 @@ export default {
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.deviceType'), //
title: this.$t('system.deviceType'), //
prop: 'operateObject',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.operateObject, this.deviceTypeList, ['value', 'label']); },
columnValue: (row) => { return this.$convertField(row.operateObject, this.$ConstSelect.deviceTypeList, ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.instructionType'), //
prop: 'operate'
prop: 'operate',
type: 'tag',
columnValue: (row) => { return this.convertField(row.operate, row.operateObject, ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.parameterName'), //
@ -94,8 +94,12 @@ export default {
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
width: '350',
buttons: [
{
name: '查看条件参数',
handleClick: this.showCondition
},
{
name: this.$t('global.edit'),
handleClick: this.handleEdit
@ -130,7 +134,7 @@ export default {
list.data.forEach(elem => {
this.queryForm.queryObject.lineCode.config.data.push({ value: elem.code, label: elem.name });
});
this.deviceTypeList.forEach(elem => {
this.$ConstSelect.deviceTypeList.forEach(elem => {
this.queryForm.queryObject.operateObject.config.data.push(elem);
});
} catch (error) {
@ -144,7 +148,21 @@ export default {
}
return getCommandList(params);
},
convertField(fieldValue, operateObject, converFormat) {
if (Commands) {
// debugger;
const enumList = Object.values(Commands[operateObject]);
if (enumList && converFormat && converFormat.length >= 2) {
const value = converFormat[0];
const label = converFormat[1];
for (let i = 0; i < enumList.length; i++) {
if (fieldValue == enumList[i][value]) {
return enumList[i][label];
}
}
}
}
},
replace(fieldValue) {
const arr = [];
if (fieldValue && fieldValue.length) {
@ -156,9 +174,15 @@ export default {
}
return arr;
},
//
showCondition(index, row) {
this.$refs.showCondition.doShow(row.conditionList);
},
//
handleEdit(index, row) {
this.$router.push({ path: `/system/commands/Detail`, query: { type: 'edit', id: row.id } });
},
//
handleAdd() {
this.$router.push({ path: `/system/commands/Detail`, query: { type: 'add' } });
},

View File

@ -0,0 +1,38 @@
<template>
<el-dialog v-dialogDrag title="条件参数" :visible.sync="dialogVisible" width="400px" :before-close="handleClose" center :close-on-click-modal="false">
<el-table :data="conditionList" border class="param-table">
<el-table-column prop="name" label="参数名" />
<el-table-column prop="value" label="参数值" />
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">关闭</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: 'ShowCondition',
data() {
return {
dialogVisible: false,
conditionList: []
};
},
mounted () {
},
methods: {
doShow(data) {
this.conditionList = data;
},
handleClose() {
this.dialogVisible = false;
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 KiB

1917
static/three.min.js vendored

File diff suppressed because one or more lines are too long

971
static/three.min1.js Normal file

File diff suppressed because one or more lines are too long