Merge branch 'test'

# Conflicts:
#	src/utils/baseUrl.js
This commit is contained in:
zyy 2019-10-22 16:32:29 +08:00
commit 3bc3e66085
254 changed files with 13797 additions and 6674 deletions

188
src/api/designPlatform.js Normal file
View File

@ -0,0 +1,188 @@
import request from '@/utils/request';
export function getDraftLesson(params, mapId) {
/** 根据mapId获取草稿课程 */
return request({
url: `/api/mapSystem/findDraftLessonBy/${mapId}`,
method: 'get',
params
});
}
/** 获取用户地图树 */
export function getUserMapTree(cityCode) {
return request({
url: `/api/mapSystem/findDraftMapByCityCode?cityCode=${cityCode}`,
method: 'get'
});
}
/** 运行图*/
export function getRpListByUserMapId(mapId) {
return request({
url: `/api/draftMap/runPlan/findByDraftMapId/${mapId}`,
method: 'get'
});
}
export function getMapList(cityCode) {
/** 根据cityCode获取地图列表 */
return request({
url: `/api/mapSystem/queryMapByCityCode/${cityCode}`,
method: 'get'
});
}
/** 获取用户自己的运行图详情*/
export function getRpDetailByUserMapId(planId) {
return request({
url: `/api/draftMap/runPlan/selectDiagramData/${planId}`,
method: 'get'
});
}
/** 获取用户自己创建的草稿地图详情*/
export function getUserMapDetailByMapId(mapId) {
return request({
url: `/api/mapBuild/findById/${mapId}`,
method: 'get'
});
}
/** 用户自己的运行图仿真测试*/
export function runUserPlanNotify({ planId }) {
return request({
url: `/api/draftMap/runPlan/simulationCheck/${planId}`,
method: 'get'
});
}
/** 管理员获取需审核的课程列表 */
export function reviewLessonList(params) {
return request({
url: `/api/review/query/lesson`,
method: 'get',
params
});
}
/** 管理员发布课程接口 */
export function adminPublishLesson(data, id) {
return request({
url: `/api/review/${id}/publishLesson`,
method: 'post',
data: data
});
}
/** 管理员驳回课程发布申请 */
export function rejectedLessonRelease(data, id) {
return request({
url: `/api/review/lesson/${id}`,
method: 'post',
data: data
});
}
/** 普通用户申请课程发布和撤销申请 */
export function releaseOrCancel(id, status) {
return request({
url: `/api/review/lesson/releaseOrCancel/${id}/${status}`,
method: 'get'
});
}
/** 管理员获取需审核的剧本列表 ok */
export function reviewScriptList(params) {
return request({
url: `/api/review/query/script`,
method: 'get',
params
});
}
/** 管理员发布剧本 ok */
export function publishScript(id) {
return request({
url: `/api/review/${id}/publishScript`,
method: 'post'
});
}
/** 管理员剧本申请驳回 ok */
export function rejectScript(id, data) {
return request({
url: `/api/review/script/${id}`,
method: 'post',
data: data
});
}
/** 管理员获取需审核的运行图列表 */
export function reviewRunPlanList(params) {
return request({
url: `/api/review/query/runPlan`,
method: 'get',
params
});
}
/** 管理员发布运行图 */
export function publishRunPlan(planId, data) {
return request({
url: `/api/review/${planId}/publishRunPlan`,
method: 'post',
data: data
});
}
/** 普通用户申请或撤销运行图发布 */
export function releaseOrCancelRunPlan(planId, status) {
return request({
url: `/api/review/runPlan/releaseOrCancel/${planId}/${status}`,
method: 'get'
});
}
/** 管理员运行图申请驳回 */
export function rejectRunPlan(id, data) {
return request({
url: `/api/review/runPlan/${id}`,
method: 'post',
data: data
});
}
/** 用户申请发布剧本或者撤销剧本申请 */
export function releaseScript(id, status) {
return request({
url: `/api/review/script/releaseOrCancel/${id}/${status}`,
method: 'get'
});
}
/** 查看课程详情 */
export function reviewLessonDetail(id) {
return request({
url: `/api/review/previewLesson/${id}`,
method: 'get'
});
}
/** 管理员预览草稿运行图*/
export function previewRunPlan(planId) {
return request({
url: `/api/review/previewRunPlan/${planId}`,
method: 'get'
});
}
/** 加载剧本 */
export function loadDraftScript(scriptId, memberId, group) {
return request({
url: `api/simulation/${group}/scriptDraft/${scriptId}?memberId=${memberId}`,
method: 'post'
});
}
/** 获取已发布的有地图的城市列表*/
export function publisMapCityList(data) {
return request({
url: `/api/map/city?dicCode=${data}`,
method: 'get'
});
}

View File

@ -8,11 +8,10 @@ export function getPublishLessonList() {
}); });
} }
/** 获取发布列表树*/ /** 获取发布列表树*/
export function getPublishLessonTree(params) { export function getPublishLessonTree(id) {
return request({ return request({
url: '/api/lesson/tree', url: `/api/lesson/${id}/tree`,
method: 'get', method: 'get'
params: params || {}
}); });
} }

View File

@ -1,11 +1,10 @@
import request from '@/utils/request'; import request from '@/utils/request';
/** 获取课程树*/ /** 获取课程树*/
export function getLessonTree(params) { export function getLessonTree(skinCode) {
return request({ return request({
url: '/api/lessonDraft/tree', url: `/api/lessonDraft/${skinCode}/tree`,
method: 'get', method: 'get'
params: params
}); });
} }
@ -103,3 +102,11 @@ export function getLessonNameByMapIdAndLessonId(model) {
method: 'get' method: 'get'
}); });
} }
export function getLessonDrftList(params) {
return request({
url: `/api/lessonDraft`,
method: 'get',
params: params
});
}

View File

@ -58,10 +58,11 @@ export function getPublishTrainList(skinCode) {
} }
/** 获取发布地图列表*/ /** 获取发布地图列表*/
export function listPublishMap() { export function listPublishMap(params) {
return request({ return request({
url: '/api/map/list', url: `/api/map/list`,
method: 'get' method: 'get',
params
}); });
} }

View File

@ -264,3 +264,10 @@ export function putAutoSignal(data) {
}); });
} }
export function getListByCityCode(cityCode) {
return request({
url: `/api/mapBuild/${cityCode}/list`,
method: 'get'
});
}

View File

@ -1,14 +1,5 @@
import request from '@/utils/request'; import request from '@/utils/request';
/** 获取考试列表树*/
export function getCourseLessonTree(params) {
return request({
url: '/api/exam/tree',
method: 'get',
params: params
});
}
/** 创建对应课程考题 */ /** 创建对应课程考题 */
export function setCourseList(data) { export function setCourseList(data) {
return request({ return request({

View File

@ -1,16 +1,17 @@
import request from '@/utils/request'; import request from '@/utils/request';
/** 查找个人录制的仿真任务*/ /** 分页查找个人录制的仿真任务*/
export function getQuestPageList(mapId) { export function getQuestPageList(mapId, params) {
return request({ return request({
url: `/api/script/${mapId}/list`, url: `/api/script/draft/${mapId}/list`,
method: 'get' method: 'get',
params: params
}); });
} }
/** 创建任务 */ /** 创建任务 */
export function createQuest(data) { export function createQuest(data) {
return request({ return request({
url: `/api/script`, url: `/api/script/draft`,
method: 'post', method: 'post',
data data
}); });
@ -18,28 +19,28 @@ export function createQuest(data) {
/** 根据任务id删除任务 */ /** 根据任务id删除任务 */
export function deleteQuest(id) { export function deleteQuest(id) {
return request({ return request({
url: `/api/script/${id}`, url: `/api/script/draft/${id}`,
method: 'delete' method: 'delete'
}); });
} }
/** 根据id查询任务基础信息 */ /** 根据id查询任务基础信息 */
export function getQuestById(id) { export function getQuestById(id) {
return request({ return request({
url: `/api/script/${id}/basic`, url: `/api/script/draft/${id}`,
method: 'get' method: 'get'
}); });
} }
/** 根据id查询任务基础信息 */ /** 根据id查询任务详情信息 */
export function getQuestByIdList(id) { export function getQuestByIdList(id) {
return request({ return request({
url: `/api/quest/${id}/detail`, url: `/api/script/draft/${id}/detail`,
method: 'get' method: 'get'
}); });
} }
/** 更新任务基本信息 */ /** 更新任务基本信息 */
export function updateQuest(id, data) { export function updateQuest(id, data) {
return request({ return request({
url: `/api/script/${id}`, url: `/api/script/draft/${id}`,
method: 'put', method: 'put',
data data
}); });
@ -53,3 +54,21 @@ export function getQuestPageListOnline(params) {
params: params params: params
}); });
} }
/** 剧本发布 */
export function publishQuest(id, data) {
return request({
url: `/api/script/draft/${id}/publish`,
method: 'put',
data
});
}
/** 剧本撤销发布 */
export function retractQuest(id, data) {
return request({
url: `/api/script/draft/${id}/retract`,
method: 'put'
});
}

View File

@ -4,6 +4,7 @@ import request from '@/utils/request';
export function getScriptPageListOnline(params) { export function getScriptPageListOnline(params) {
return request({ return request({
url: `/api/script/paging/online`, url: `/api/script/paging/online`,
// url: `/api/script/paging/published`,
method: 'get', method: 'get',
params: params params: params
}); });
@ -17,10 +18,17 @@ export function getScriptByIdList(id) {
}); });
} }
/** 通过ID查询剧本的基础信息 */ /** 通过ID查询发布的剧本的详细信息 */
export function getScriptById(id) { export function getScriptById(id) {
return request({ return request({
url: `/api/script/${id}/detail`, url: `/api/script/${id}/detail`,
method: 'get' method: 'get'
}); });
} }
/** 通过ID查询未发布剧本的详细信息 */
export function getDraftScriptById(id) {
return request({
url: `/api/script/draft/${id}/detail`,
method: 'get'
});
}

View File

@ -0,0 +1,87 @@
import request from '@/utils/request';
export function getTrainingSystemList(cityCode, params) {
/** 根据cityCode后去对应地图及其子系统 */
return request({
url: `/api/mapSystem/city/${cityCode}`,
method: 'get',
params
});
}
export function querySystemByTypeAndPrdCode(params, prodCode) {
/** 根据系统类型和地图产品code查询系统的内容课程、章节、考试*/
return request({
url: `/api/mapSystem/queryByTypeAndPrdCode/${prodCode}`,
method: 'get',
params
});
}
export function getTrainingSystemListByMapId(mapId) {
/** 根据mapId去获取其子系统 */
return request({
url: `/api/mapSystem/${mapId}`,
method: 'get'
});
}
export function generateMapSystem(mapId) {
/** 根据mapId生成地图子系统 */
return request({
url: `/api/mapSystem/generate/${mapId}`,
method: 'post'
});
}
export function getSubSystemInfo(id) {
/** 查询子系统信息 */
return request({
url: `/api/mapSystem/${id}`,
method: 'get'
});
}
export function getSubSystemDetail(id) {
/** 查询子系统详情*/
return request({
url: `/api/mapSystem/${id}/detail`,
method: 'get'
});
}
export function getMapSystemPageList(params) {
/** 分页查询地图系统 */
return request({
url: `/api/mapSystem`,
method: 'get',
params
});
}
export function createMapSubSystem(data) {
/** 创建地图系统 */
return request({
url: `/api/mapSystem`,
method: 'post',
data: data
});
}
export function updateSubSystem(id, data) {
/** 查询子系统信息 */
return request({
url: `/api/mapSystem/${id}`,
method: 'put',
data: data
});
}
export function deleteSubSystem(id) {
/** 删除地图系统 */
return request({
url: `/api/mapSystem/${id}`,
method: 'delete'
});
}

BIN
src/assets/erCode.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
src/assets/logo_changan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -127,7 +127,7 @@
</el-row> </el-row>
</template> </template>
</el-col> </el-col>
<el-col :span="6" :offset="0"> <el-col :span="5" :offset="1">
<el-button type="primary" size="small" :disabled="!canQuery" @click="query">{{ $t('global.query') }}</el-button> <el-button type="primary" size="small" :disabled="!canQuery" @click="query">{{ $t('global.query') }}</el-button>
<el-button v-if="queryForm.reset" type="primary" size="small" :disabled="!canQuery" @click="doClean">{{ $t('global.reset') }}</el-button> <el-button v-if="queryForm.reset" type="primary" size="small" :disabled="!canQuery" @click="doClean">{{ $t('global.reset') }}</el-button>
<el-button v-if="exportFlag" type="primary" size="small" :disabled="!canQuery" @click="doExport">{{ $t('global.export') }}</el-button> <el-button v-if="exportFlag" type="primary" size="small" :disabled="!canQuery" @click="doExport">{{ $t('global.export') }}</el-button>
@ -139,6 +139,7 @@
size="small" size="small"
:style="button.style" :style="button.style"
@click="button.handler" @click="button.handler"
class="button_style"
>{{ button.text }}</el-button> >{{ button.text }}</el-button>
</template> </template>
</el-col> </el-col>
@ -480,4 +481,7 @@ export default {
max-width: 240px; max-width: 240px;
min-width: 100px; min-width: 100px;
} }
.button_style {
margin-bottom: 10px;
}
</style> </style>

View File

@ -453,7 +453,10 @@ export default {
currentChoose() { currentChoose() {
return this.choose; return this.choose;
}, },
refresh() { refresh(flag) {
if (flag) {
this.commitQuery();
}
this.queryList.data = [...this.queryList.data]; this.queryList.data = [...this.queryList.data];
} }
} }

View File

@ -0,0 +1,54 @@
import store from '@/store';
export default {
bind(el) {
const dialogHeaderEl = el.querySelector('.el-dialog__header');
const dragDom = el.querySelector('.el-dialog');
dialogHeaderEl.style.cursor = 'move';
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dialogHeaderEl.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - dialogHeaderEl.offsetLeft;
const disY = e.clientY - dialogHeaderEl.offsetTop;
/** 获取到的值带px 正则匹配替换*/
let styL, styT;
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
if (sty.left.includes('%')) {
// eslint-disable-next-line no-useless-escape
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
} else {
// eslint-disable-next-line no-useless-escape
styL = +sty.left.replace(/\px/g, '');
// eslint-disable-next-line no-useless-escape
styT = +sty.top.replace(/\px/g, '');
}
document.onmousemove = function (e) {
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
const t = e.clientY - disY;
/** 移动当前元素*/
dragDom.style.left = `${l + styL}px`;
dragDom.style.top = `${t + styT}px`;
/** 刷新提示标签位置*/
store.dispatch('training/emitTipFresh');
/** 将此时的位置传出去*/
// binding.value({ x: e.pageX, y: e.pageY });
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
};

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './dialogDrag';
const dialogDrag = function(Vue) {
Vue.directive('dialogDrag', install);
};
Vue.use(dialogDrag);

View File

@ -0,0 +1,25 @@
export default {
bind(el, binding) {
const dragDom = binding.value.$el.querySelector('.el-dialog');
el.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - el.offsetLeft;
document.onmousemove = function (e) {
/** 移动时禁用默认事件*/
e.preventDefault();
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
dragDom.style.width = `${l}px`;
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
};

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './dialogDragWidth';
const dialogDragWidth = function(Vue) {
Vue.directive('dialogDragWidth', install);
};
Vue.use(dialogDragWidth);

106
src/directive/drag/drag.js Normal file
View File

@ -0,0 +1,106 @@
export default {
bind(el) {
const dragDom = el.querySelector('.reminder-box');
const dragRight = el.querySelector('.drag-right');
const dragLeft = el.querySelector('.drag-left');
const dragBottom = el.querySelector('.drag-bottom');
const dragTop = el.querySelector('.drag-top');
const dragBody = el.querySelector('.tip-body');
const body = el.querySelector('.tip-body-box');
dragRight.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disX = iEvent.clientX;
var disW = dragDom.offsetWidth;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disW + (iEvent.clientX - disX) > 350) {
dragDom.style.width = disW + (iEvent.clientX - disX) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragLeft.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disX = iEvent.clientX;
var disW = dragDom.offsetWidth;
var OFFLeft = dragDom.offsetLeft;
document.onmousemove = function (e) {
const iEvent = e || event;
const width = disW - (iEvent.clientX - disX);
if (width > 350) {
dragDom.style.width = disW - (iEvent.clientX - disX) + 'px';
dragDom.style.left = OFFLeft + (iEvent.clientX - disX) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragBottom.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disY = iEvent.clientY;
var disH = dragDom.offsetHeight;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disH + (iEvent.clientY - disY) > 200) {
dragDom.style.height = disH + (iEvent.clientY - disY) + 'px';
body.style.height = disH + (iEvent.clientY - disY) - 40 + 'px';
dragBody.style.height = disH + (iEvent.clientY - disY) - 100 + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragTop.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disY = iEvent.clientY;
var disH = dragDom.offsetHeight;
var OOFTop = dragDom.offsetTop;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disH - (iEvent.clientY - disY) > 200) {
dragDom.style.height = disH - (iEvent.clientY - disY) + 'px';
body.style.height = disH - (iEvent.clientY - disY) - 40 + 'px';
dragBody.style.height = disH - (iEvent.clientY - disY) - 100 + 'px';
dragDom.style.top = OOFTop + (iEvent.clientY - disY) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
}
};

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './drag';
const drag = function(Vue) {
Vue.directive('drag', install);
};
Vue.use(drag);

View File

@ -0,0 +1,18 @@
export default {
// 当被绑定的元素插入到 DOM 中时
inserted: function (el, obj) {
// 这是需要页面刚加载就能进行聚焦操作使用的钩子函数,可以省略的,视具体需求而定
// 对值进行判断
if (obj.value) {
// 聚焦元素
el.focus();
}
},
// 当指令所在组件的 VNode 及其子 VNode 全部更新后调用
// 这是每当绑定的值发生改变时触发的钩子函数
componentUpdated: function (el, obj) {
if (obj.value) {
el.focus();
}
}
};

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './focus';
const focus = function(Vue) {
Vue.directive('focus', install);
};
Vue.use(focus);

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './quickMenuDrag';
const quickMenuDrag = function(Vue) {
Vue.directive('quickMenuDrag', install);
};
Vue.use(quickMenuDrag);

View File

@ -0,0 +1,45 @@
export default {
bind(el) {
const dragDom = el;
dragDom.style.cursor = 'move';
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dragDom.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX;
const disY = e.clientY;
/** 获取到的值带px 正则匹配替换*/
let styL, styT;
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
if (sty.left.includes('%')) {
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
} else {
styL = +sty.left.replace(/\px/g, '');
styT = +sty.top.replace(/\px/g, '');
}
document.onmousemove = function (e) {
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
const t = e.clientY - disY;
/** 移动当前元素*/
dragDom.style.left = `${l + styL}px`;
dragDom.style.top = `${t + styT}px`;
/** 将此时的位置传出去*/
// binding.value({ x: e.pageX, y: e.pageY });
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
};

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './waves';
const waves = function(Vue) {
Vue.directive('waves', install);
};
Vue.use(waves);

View File

@ -0,0 +1,26 @@
.waves-ripple {
position: absolute;
border-radius: 100%;
background-color: rgba(0, 0, 0, 0.15);
background-clip: padding-box;
pointer-events: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
opacity: 1;
}
.waves-ripple.z-active {
opacity: 0;
-webkit-transform: scale(2);
-ms-transform: scale(2);
transform: scale(2);
-webkit-transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;
transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;
transition: opacity 1.2s ease-out, transform 0.6s ease-out;
transition: opacity 1.2s ease-out, transform 0.6s ease-out, -webkit-transform 0.6s ease-out;
}

View File

@ -0,0 +1,72 @@
import './waves.css';
const context = '@@wavesContext';
function handleClick(el, binding) {
function handle(e) {
const customOpts = Object.assign({}, binding.value);
const opts = Object.assign({
ele: el, // 波纹作用元素
type: 'hit', // hit 点击位置扩散 center中心点扩展
color: 'rgba(0, 0, 0, 0.15)' // 波纹颜色
},
customOpts
);
const target = opts.ele;
if (target) {
target.style.position = 'relative';
target.style.overflow = 'hidden';
const rect = target.getBoundingClientRect();
let ripple = target.querySelector('.waves-ripple');
if (!ripple) {
ripple = document.createElement('span');
ripple.className = 'waves-ripple';
ripple.style.height = ripple.style.width = Math.max(rect.width, rect.height) + 'px';
target.appendChild(ripple);
} else {
ripple.className = 'waves-ripple';
}
switch (opts.type) {
case 'center':
ripple.style.top = rect.height / 2 - ripple.offsetHeight / 2 + 'px';
ripple.style.left = rect.width / 2 - ripple.offsetWidth / 2 + 'px';
break;
default:
ripple.style.top =
(e.pageY - rect.top - ripple.offsetHeight / 2 - document.documentElement.scrollTop ||
document.body.scrollTop) + 'px';
ripple.style.left =
(e.pageX - rect.left - ripple.offsetWidth / 2 - document.documentElement.scrollLeft ||
document.body.scrollLeft) + 'px';
}
ripple.style.backgroundColor = opts.color;
ripple.className = 'waves-ripple z-active';
return false;
}
}
if (!el[context]) {
el[context] = {
removeHandle: handle
};
} else {
el[context].removeHandle = handle;
}
return handle;
}
export default {
bind(el, binding) {
el.addEventListener('click', handleClick(el, binding), false);
},
update(el, binding) {
el.removeEventListener('click', el[context].removeHandle, false);
el.addEventListener('click', handleClick(el, binding), false);
},
unbind(el) {
el.removeEventListener('click', el[context].removeHandle, false);
el[context] = null;
delete el[context];
}
};

View File

@ -1,283 +0,0 @@
/* eslint-disable no-useless-escape */
import Vue from 'vue';
import store from '@/store';
/**
*元素获取焦点v-dialogDrag
* @param {*} el
* @param {*} binding
*/
Vue.directive('focus', {
// 当被绑定的元素插入到 DOM 中时
inserted: function (el, obj) {
// 这是需要页面刚加载就能进行聚焦操作使用的钩子函数,可以省略的,视具体需求而定
// 对值进行判断
if (obj.value) {
// 聚焦元素
el.focus();
}
},
// 当指令所在组件的 VNode 及其子 VNode 全部更新后调用
// 这是每当绑定的值发生改变时触发的钩子函数
componentUpdated: function (el, obj) {
if (obj.value) {
el.focus();
}
}
});
/**
*弹窗拖拽v-dialogDrag
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @param {*} oldvNode
*/
Vue.directive('dialogDrag', {
bind(el) {
const dialogHeaderEl = el.querySelector('.el-dialog__header');
const dragDom = el.querySelector('.el-dialog');
dialogHeaderEl.style.cursor = 'move';
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dialogHeaderEl.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - dialogHeaderEl.offsetLeft;
const disY = e.clientY - dialogHeaderEl.offsetTop;
/** 获取到的值带px 正则匹配替换*/
let styL, styT;
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
if (sty.left.includes('%')) {
// eslint-disable-next-line no-useless-escape
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
} else {
// eslint-disable-next-line no-useless-escape
styL = +sty.left.replace(/\px/g, '');
// eslint-disable-next-line no-useless-escape
styT = +sty.top.replace(/\px/g, '');
}
document.onmousemove = function (e) {
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
const t = e.clientY - disY;
/** 移动当前元素*/
dragDom.style.left = `${l + styL}px`;
dragDom.style.top = `${t + styT}px`;
/** 刷新提示标签位置*/
store.dispatch('training/emitTipFresh');
/** 将此时的位置传出去*/
// binding.value({ x: e.pageX, y: e.pageY });
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
});
/**
*弹窗宽度拖大,拖小dialogDragWidth
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @param {*} oldvNode
*/
Vue.directive('dialogDragWidth', {
bind(el, binding) {
const dragDom = binding.value.$el.querySelector('.el-dialog');
el.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - el.offsetLeft;
document.onmousemove = function (e) {
/** 移动时禁用默认事件*/
e.preventDefault();
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
dragDom.style.width = `${l}px`;
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
});
/**
* 弹窗拖拽v-quickEntryDrag
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @param {*} oldvNode
*/
Vue.directive('quickMenuDrag', {
bind(el) {
const dragDom = el;
dragDom.style.cursor = 'move';
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dragDom.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX;
const disY = e.clientY;
/** 获取到的值带px 正则匹配替换*/
let styL, styT;
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
if (sty.left.includes('%')) {
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
} else {
styL = +sty.left.replace(/\px/g, '');
styT = +sty.top.replace(/\px/g, '');
}
document.onmousemove = function (e) {
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
const t = e.clientY - disY;
/** 移动当前元素*/
dragDom.style.left = `${l + styL}px`;
dragDom.style.top = `${t + styT}px`;
/** 将此时的位置传出去*/
// binding.value({ x: e.pageX, y: e.pageY });
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
});
/**
*vue-自定义指令-拖拽 v-drag
*/
Vue.directive('drag', {
bind(el) {
const dragDom = el.querySelector('.reminder-box');
const dragRight = el.querySelector('.drag-right');
const dragLeft = el.querySelector('.drag-left');
const dragBottom = el.querySelector('.drag-bottom');
const dragTop = el.querySelector('.drag-top');
const dragBody = el.querySelector('.tip-body');
const body = el.querySelector('.tip-body-box');
dragRight.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disX = iEvent.clientX;
var disW = dragDom.offsetWidth;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disW + (iEvent.clientX - disX) > 350) {
dragDom.style.width = disW + (iEvent.clientX - disX) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragLeft.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disX = iEvent.clientX;
var disW = dragDom.offsetWidth;
var OFFLeft = dragDom.offsetLeft;
document.onmousemove = function (e) {
const iEvent = e || event;
const width = disW - (iEvent.clientX - disX);
if (width > 350) {
dragDom.style.width = disW - (iEvent.clientX - disX) + 'px';
dragDom.style.left = OFFLeft + (iEvent.clientX - disX) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragBottom.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disY = iEvent.clientY;
var disH = dragDom.offsetHeight;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disH + (iEvent.clientY - disY) > 200) {
dragDom.style.height = disH + (iEvent.clientY - disY) + 'px';
body.style.height = disH + (iEvent.clientY - disY) - 40 + 'px';
dragBody.style.height = disH + (iEvent.clientY - disY) - 100 + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragTop.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disY = iEvent.clientY;
var disH = dragDom.offsetHeight;
var OOFTop = dragDom.offsetTop;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disH - (iEvent.clientY - disY) > 200) {
dragDom.style.height = disH - (iEvent.clientY - disY) + 'px';
body.style.height = disH - (iEvent.clientY - disY) - 40 + 'px';
dragBody.style.height = disH - (iEvent.clientY - disY) - 100 + 'px';
dragDom.style.top = OOFTop + (iEvent.clientY - disY) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
}
});

View File

@ -0,0 +1,36 @@
export default {
applicant: 'Applicant',
map: 'Map',
status: 'Status',
unpublished: 'Unpublished',
pendingReview: 'PendingReview',
releaseSuccess: 'ReleaseSuccess',
overrule: 'Overrule',
scriptName: 'Script Name',
scriptDescription: 'Script Description',
applyTime: 'Apply Time',
applyPassed: 'Apply Passed',
applyReject: 'Apply Reject',
scriptPreview: 'Script Preview',
passedScript: 'Passed Script',
rejectScript: 'Reject Script',
explanation: 'Explanation',
inputScriptName: 'Please input script name',
inputRejectExplanation: 'Please input reject explanation',
passedScriptSuccess: 'Passed script success',
passedScriptFailed: 'Passed script failed',
rejectScriptSuccess: 'Reject script success',
rejectScriptFailed: 'Reject script failed',
runPlanName: 'Run Plan Name',
passedRunPlan: 'Passed Run Plan',
rejectRunPlan: 'Reject Run Plan',
runPlanPreview: 'RunPlan Preview',
inputRunPlanName: 'Please input run plan name',
courseDescription: 'Course description',
lookOver: 'Look over',
courseDetails: 'Course details',
instructions: 'Instructions',
chapterTrainingName: 'Chapter/training name',
revokeScriptSuccess: 'Revoke script success',
revokeScriptFailed: 'Revoke script failed'
};

View File

@ -1,7 +1,7 @@
export default { export default {
simulationSystem: 'Urban rail transit simulation system', simulationSystem: 'Urban rail transit simulation system',
simulationSystemDescription: 'Based on the subway signal system, the urban rail transit simulation system is reformed for the training part, aiming to build a set of professional simulation system for driving demonstration. The system has high flexibility for future expansion and upgrading. Meanwhile, the simulation system has two modes of normal operation and fault operation. Besides normal functional operation, it can also conduct fault simulation of equipment.', simulationSystemDescription: 'Based on the subway signal system, the urban rail transit simulation system is reformed for the training part, aiming to build a set of professional simulation system for driving demonstration. The system has high flexibility for future expansion and upgrading. Meanwhile, the simulation system has two modes of normal operation and fault operation. Besides normal functional operation, it can also conduct fault simulation of equipment.',
simulationName: 'Simulation name:', simulationName: 'Simulation module:',
noSimulationProducts: 'No simulation products', noSimulationProducts: 'No simulation products',
productDescription: 'Product description:', productDescription: 'Product description:',
startSimulation: 'Start the simulation', startSimulation: 'Start the simulation',

View File

@ -79,6 +79,7 @@ export default {
schema: { schema: {
selectProduct: 'Please select product type', selectProduct: 'Please select product type',
loadScript: 'Load Script', loadScript: 'Load Script',
selectRoles: 'Select Roles',
previewRunDiagram: 'Preview Run Diagram', previewRunDiagram: 'Preview Run Diagram',
loadRunDiagram: 'Load Run Diagram', loadRunDiagram: 'Load Run Diagram',
faultSetting: 'Fault Setting', faultSetting: 'Fault Setting',
@ -123,6 +124,7 @@ export default {
dispatcher: 'Dispatcher', dispatcher: 'Dispatcher',
attendant: 'Station', attendant: 'Station',
audience: 'Audience', audience: 'Audience',
repair: 'Repair',
driver: 'Train', driver: 'Train',
none: 'None' none: 'None'
}, },

View File

@ -91,5 +91,8 @@ export default {
getRunGraphDataFailed: 'Failed to get run graph data', getRunGraphDataFailed: 'Failed to get run graph data',
getStationListFail: 'Failed to get station list', getStationListFail: 'Failed to get station list',
obtainTrainGroupNumberFailed: 'Failed to obtain train group number', obtainTrainGroupNumberFailed: 'Failed to obtain train group number',
getTrainListFailed: 'Failed to get train list' getTrainListFailed: 'Failed to get train list',
getDraftCourseDataFailed: 'Failed to get draft course data!',
failedToGetCourseData: 'Failed to get course data!',
failedToGetSystemData: 'Failed to get system data!'
}; };

View File

@ -15,20 +15,21 @@ export default {
returnToExamList: 'Return to the exam list', returnToExamList: 'Return to the exam list',
totalScore: 'Total score', totalScore: 'Total score',
itemList: 'Item list', itemList: 'Item list',
courseName: 'Course name', courseName: 'Examination subject',
permissionsDetails: 'Permissions for details', permissionsDetails: 'Permission details',
buy: 'buy', buy: 'buy',
distributePermission: 'Permission distribution (examination)', distributePermission: 'Permission distribution (examination)',
viewCoursePapers: 'View course papers', viewCoursePapers: 'View course papers',
examStartTime: 'Exam start time', examStartTime: 'Start time',
theExamIsReadyAnyTime: 'The exam is ready any time', theExamIsReadyAnyTime: 'Anytime you are available',
testExplanation: 'Test Explanation', minutes: 'min',
examTimeAvailable: 'Exam time available', testExplanation: 'Notes',
fullMarksInTheExam: 'Full marks in the exam', examTimeAvailable: 'Duration',
passMarkTheExam: 'Pass mark the exam', fullMarksInTheExam: 'Full marks',
examinationRules: 'Examination rules', passMarkTheExam: 'Passing score',
examinationRules: 'Rules',
trainingType: 'Training type', trainingType: 'Training type',
numberOfQuestions: 'Number of questions', numberOfQuestions: 'Quantity',
score: 'Score', score: 'Score',
startTheExam: 'Start the exam', startTheExam: 'Start the exam',
examinationTiming: 'Examination timing', examinationTiming: 'Examination timing',

View File

@ -40,7 +40,7 @@ export default {
mobile: 'mobile', mobile: 'mobile',
name: 'Name', name: 'Name',
code: 'Code', code: 'Code',
status: 'Status', status: 'State',
remarks: 'Remarks', remarks: 'Remarks',
selectionTime: 'Selection of time', selectionTime: 'Selection of time',
permissionNumber: 'Number of permissions', permissionNumber: 'Number of permissions',
@ -56,11 +56,11 @@ export default {
transferScreenPermission: 'Large screen rights transfer', transferScreenPermission: 'Large screen rights transfer',
today: 'Today', today: 'Today',
total: 'Total', total: 'Total',
index: 'Indexes', index: 'Index',
startTime: 'Start time', startTime: 'Start',
endTime: 'End time', endTime: 'End',
isForever: 'Forever', isForever: 'Timelimit',
remains: 'Remainder', remains: 'Remaining',
hasPermissionTip: 'Public permission is {0}, private permission is {1}', hasPermissionTip: 'Public permission is {0}, private permission is {1}',
create: 'Create', create: 'Create',
update: 'Update', update: 'Update',
@ -158,5 +158,6 @@ export default {
processFailure: 'Process failure', processFailure: 'Process failure',
enterLastStep: 'Please enter a hint and click next', enterLastStep: 'Please enter a hint and click next',
pleaseOpearte: 'Please proceed', pleaseOpearte: 'Please proceed',
help: 'help' help: 'help',
city: 'City'
}; };

View File

@ -24,6 +24,8 @@ import joinTraining from './joinTraining';
import trainRoom from './trainRoom'; import trainRoom from './trainRoom';
import menu from './menu'; import menu from './menu';
import ibp from './ibp'; import ibp from './ibp';
import approval from './approval';
import systemGenerate from './systemGenerate';
export default { export default {
...enLocale, ...enLocale,
@ -51,5 +53,7 @@ export default {
joinTraining, joinTraining,
trainRoom, trainRoom,
menu, menu,
ibp ibp,
approval,
systemGenerate
}; };

View File

@ -102,5 +102,19 @@ export default {
train: 'Train', train: 'Train',
station: 'Station', station: 'Station',
trainWindow: 'Train window', trainWindow: 'Train window',
editStepInfo: 'Edit step information' editStepInfo: 'Edit step information',
trainingRecord: 'Training recording',
lesson: 'Lesson',
taskManage: 'Task manage',
trainingRule: 'Training rule',
trainingManage: 'Training manage',
newConstruction: 'New',
applicationForRelease: 'Application for release',
rejectReason: 'Reason for rejection',
withdraw: 'Withdraw',
notRelease: 'Not release',
pendingReview: 'Pending review',
published: 'Published',
rejected: 'Rejected',
review: 'Review'
}; };

View File

@ -11,6 +11,7 @@ export default {
saveMapAs: 'Save the map as', saveMapAs: 'Save the map as',
create: 'establish', create: 'establish',
dataVerification: 'data verification', dataVerification: 'data verification',
edit3d: '3D editor',
logicalView: 'logical view', logicalView: 'logical view',
physicalView: 'Physical view', physicalView: 'Physical view',
mixedView: 'The mixed view', mixedView: 'The mixed view',

View File

@ -491,5 +491,6 @@ export default {
settingTrain: 'Setting train', settingTrain: 'Setting train',
sourceTrainWindow: 'Source train window', sourceTrainWindow: 'Source train window',
trainWindow: 'Train window', trainWindow: 'Train window',
targetTrainWindow: 'Target train window' targetTrainWindow: 'Target train window',
category: 'category'
}; };

View File

@ -1,16 +1,16 @@
export default { export default {
updateStation: { updateStation: {
level1: 'level one: ', level1: 'level1: ',
level2: 'level two: ', level2: 'level2: ',
level3: 'level three: ', level3: 'level3: ',
level4: 'level four: ', level4: 'level4: ',
level5: 'level five: ', level5: 'level5: ',
updateData: 'Update data', updateData: 'Update data',
pleaseInputLevel1: 'Please input level one', pleaseInputLevel1: 'Please input level1',
pleaseInputLevel2: 'Please input level two', pleaseInputLevel2: 'Please input level2',
pleaseInputLevel3: 'Please input level three', pleaseInputLevel3: 'Please input level3',
pleaseInputLevel4: 'Please input level four', pleaseInputLevel4: 'Please input level4',
pleaseInputLevel5: 'Please input level five', pleaseInputLevel5: 'Please input level5',
systemOutPut: 'System output', systemOutPut: 'System output',
selectPrintArea: 'Selec print area', selectPrintArea: 'Selec print area',
selectDeleteRoute: 'Select delete route', selectDeleteRoute: 'Select delete route',
@ -229,5 +229,9 @@ export default {
editPlanningTrain: 'Edit planning train', editPlanningTrain: 'Edit planning train',
runGraphName: 'Run graph name', runGraphName: 'Run graph name',
tipOperationTime: '请先设置区段站间运行时间, 【文件】-> 【修改站间运行时间】', tipOperationTime: '请先设置区段站间运行时间, 【文件】-> 【修改站间运行时间】',
serverTrainNum: '表号车次号' serverTrainNum: '表号车次号',
explanation: 'Explanation',
creationDate: 'Creation date',
load: 'Load',
modifyName: 'Modify name'
}; };

View File

@ -7,6 +7,9 @@ export default {
runPlanManage: 'Run plan', runPlanManage: 'Run plan',
productEdit: 'Product editor', productEdit: 'Product editor',
designhomePage: 'Public map',
designUserPage: 'Personal map',
lessaonManage: 'Lesson', lessaonManage: 'Lesson',
lessonEdit: 'Lesson editor', lessonEdit: 'Lesson editor',
trainingRecord: 'Trainning recording', trainingRecord: 'Trainning recording',
@ -58,5 +61,11 @@ export default {
userExamManage: 'User examination management', userExamManage: 'User examination management',
userSimulationManage: 'User simulation management', userSimulationManage: 'User simulation management',
existingSimulation: 'Existence simulation management', existingSimulation: 'Existence simulation management',
ibpDraw: 'ibp Draw' ibpDraw: 'Ibp Draw',
trainingPlatform: 'trainingPlatform',
releaseApplication: 'Release application',
courseApplication: 'Course release application',
scriptReleaseApplication: 'Script release application',
runGraphReleaseApplication: 'Run graph release application',
subsystemGeneration: 'Subsystem generation'
}; };

View File

@ -239,9 +239,9 @@ export default {
selectOneTrainingType: 'Only one training type can be selected', selectOneTrainingType: 'Only one training type can be selected',
enterProductType: 'Please enter product type', enterProductType: 'Please enter product type',
selectAssociatedStation: 'Please select the associated station', selectAssociatedStation: 'Please select the associated station',
pleaseSelectTrainDir: '请选择列车所在方向', pleaseSelectTrainDir: 'Please select the direction of the train',
pleaseEnterSplit: '请输入拆分数量', pleaseEnterSplit: 'Please enter the split number',
pleaseEnterSplitNumber: '请输入合理的拆分数量', pleaseEnterSplitNumber: 'Please enter a reasonable number of split',
enterScale: 'Please enter the zoom ratio', enterScale: 'Please enter the zoom ratio',
enterXOffset: 'Please enter X offset', enterXOffset: 'Please enter X offset',
enterYOffset: 'Please enter Y offset', enterYOffset: 'Please enter Y offset',
@ -276,7 +276,7 @@ export default {
accessNumber: 'Please input the number of permissions', accessNumber: 'Please input the number of permissions',
courseNameEmpty: 'Course name cannot be empty', courseNameEmpty: 'Course name cannot be empty',
purchaseMonth: 'Please input the number of months to buy', purchaseMonth: 'Please input the number of months to buy',
pleaseEnterGoodPrice: '请输入商品价格', pleaseEnterGoodPrice: 'Please enter the price of the goods',
enterTheNameOfTheRunGraph: 'Please enter the name of the run graph', enterTheNameOfTheRunGraph: 'Please enter the name of the run graph',
chooseToPublishTheRunGraph: 'Please choose to publish the run chart', chooseToPublishTheRunGraph: 'Please choose to publish the run chart',
enterTheAlarmCode: 'Please enter the alarm code', enterTheAlarmCode: 'Please enter the alarm code',
@ -306,5 +306,6 @@ export default {
enterTheKeyWidth: 'Please enter the key width', enterTheKeyWidth: 'Please enter the key width',
enterTheKeyDirection: 'Please select the key direction', enterTheKeyDirection: 'Please select the key direction',
enterTheUpperText: 'Please enter the upper text', enterTheUpperText: 'Please enter the upper text',
enterTheLowerText: 'Please enter the lower text' enterTheLowerText: 'Please enter the lower text',
enterRejectReason: 'Please enter reject reason'
}; };

View File

@ -4,6 +4,7 @@ export default {
saveData: 'Save Data', saveData: 'Save Data',
mapList: 'Map List', mapList: 'Map List',
createScript: 'Create Script', createScript: 'Create Script',
modifyScript: 'Modify Script',
scriptName: 'Script Name', scriptName: 'Script Name',
addScript: 'Add Script', addScript: 'Add Script',
map: 'Map', map: 'Map',
@ -15,6 +16,7 @@ export default {
createScriptFail: 'Create script failure', createScriptFail: 'Create script failure',
scriptDetail: 'Script Detail', scriptDetail: 'Script Detail',
scriptRecord: 'Edit', scriptRecord: 'Edit',
scriptCreate: 'Create',
scriptModify: 'Modify', scriptModify: 'Modify',
scriptDelete: 'Delete', scriptDelete: 'Delete',
getScriptFail: 'Get script information failure', getScriptFail: 'Get script information failure',
@ -81,7 +83,25 @@ export default {
scriptBack: 'Back', scriptBack: 'Back',
speakTo: 'to', speakTo: 'to',
executeCommandTips: 'execute command: ', executeCommandTips: 'execute command: ',
operate: 'Operate',
scriptList: 'Script List',
applyPublish: 'Apply for release',
preview: 'Preview',
status: 'Status',
applyRevoke: 'Revoke',
publish: 'Publish',
revokeReason: 'Revoke explanation',
language: 'language', language: 'language',
chinese: 'Chinese Simplified', chinese: 'Chinese Simplified',
english: 'English' english: 'English',
publishScript: 'Publish Script',
releaseScriptSuccess: 'release script success',
releaseScriptFailed: 'release script failed',
publishScriptSuccess: 'Publish Script Success',
publishScriptFailed: 'Publish Script Failed',
releaseScriptTip: 'This action will apply to release script, whether to continue?',
revokeScriptTip: 'This action will undo release script, whether to continue?',
inputScriptName: 'Please input script name',
selectMap: 'Please select map',
inputScriptDescription: 'Please input script description'
}; };

View File

@ -0,0 +1,30 @@
export default {
map: 'Map',
mapName: 'Map Name',
prdName: 'Product Name',
name: 'Name',
type: 'Type',
updateData: 'Modify',
generate: 'Generate',
selectMap: 'Please select map',
generateSuccess: 'The subsystem under the map is generated successfully!',
generateFail: 'The subsystem under the map failed to generate!',
inputName: 'Please input subsystem name',
selectType: 'Please select type',
selectPrdName: 'Please select product name',
createSubSystem: 'Commission SubSystem',
modifySubSystem: 'Modify SubSystem',
commission: 'Commission',
customized: 'Project',
selectProject: 'Please select project',
createMapSystemSuccess: 'Create map system success',
createMapSystemFail: 'Create map system failed',
getSubSystemInfoFail: 'Get subsystem infomation failed',
updateMapSystemSuccess: 'Update map system success',
updateMapSystemFail: 'Update map system failed',
generation: 'One-click Generation',
deleteData: 'Delete',
deleteMapSystemSuccess: 'Delete map system success',
deleteMapSystemFail: 'Delete map system fail',
deleteMapSystemTip: 'This action will apply to delete map system, whether to continue?'
};

View File

@ -198,5 +198,12 @@ export default {
runGraphNameModifiedSuccessfully: 'Run graph name modified successfully!', runGraphNameModifiedSuccessfully: 'Run graph name modified successfully!',
modifyRunGraphNameFailed: 'Modify run graph name failed!', modifyRunGraphNameFailed: 'Modify run graph name failed!',
planCreationSuccessful: 'Plan creation successful!', planCreationSuccessful: 'Plan creation successful!',
createPlanFailed: 'Failed to create plan!' createPlanFailed: 'Failed to create plan!',
cancelCoursePublicationHint: 'This action will cancel the course publication application, is it OK?',
cancelTheSuccessfulApplicationOfTheCourseRelease: 'Cancel the successful application of the course release!',
cancellationOfCoursePublicationApplicationFailed: 'Cancellation of course publication application failed!',
publishTheCourseHint: 'This operation will publish the course. Are you sure?',
rejectedCourseReleaseApplicationSuccessful: 'Rejected course release application successful!',
rejectedCourseReleaseApplicationFailed: 'Rejected course release application failed!',
duplicatePlanFailedTips: 'The interval needs to be more than 30 seconds or the times is more than 1'
}; };

View File

@ -0,0 +1,37 @@
export default {
applicant: '申请人',
map: '地图',
status: '状态',
unpublished: '未发布',
pendingReview: '待审核',
releaseSuccess: '发布成功',
overrule: '驳回',
scriptName: '剧本名称',
scriptDescription: '剧本简介',
applyTime: '申请时间',
applyPassed: '通过',
applyReject: '驳回',
scriptPreview: '预览',
passedScript: '通过剧本',
rejectScript: '驳回剧本',
explanation: '驳回说明',
inputScriptName: '请输入剧本名称',
inputRejectExplanation: '请输入驳回说明',
passedScriptSuccess: '通过剧本成功',
passedScriptFailed: '通过剧本失败',
rejectScriptSuccess: '驳回剧本成功',
rejectScriptFailed: '驳回剧本失败',
runPlanName: '运行图名称',
passedRunPlan: '通过运行图',
rejectRunPlan: '驳回运行图',
runPlanPreview: '预览',
inputRunPlanName: '请输入运行图名称',
courseDescription: '课程说明',
lookOver: '查看',
courseDetails: '课程详情',
instructions: '说明',
chapterTrainingName: '章节/课程名称',
revokeScriptSuccess: '撤回成功',
revokeScriptFailed: '撤回失败'
};

View File

@ -79,6 +79,7 @@ export default {
schema: { schema: {
selectProduct: '请选择产品类型', selectProduct: '请选择产品类型',
loadScript: '加载剧本', loadScript: '加载剧本',
selectRoles: '选择角色',
previewRunDiagram: '运行图预览', previewRunDiagram: '运行图预览',
loadRunDiagram: '运行图加载', loadRunDiagram: '运行图加载',
faultSetting: '故障设置', faultSetting: '故障设置',
@ -123,6 +124,7 @@ export default {
dispatcher: '行调', dispatcher: '行调',
attendant: '车站', attendant: '车站',
audience: '观众', audience: '观众',
repair: '通号',
driver: '列车', driver: '列车',
none: '无' none: '无'
}, },

View File

@ -91,5 +91,8 @@ export default {
getRunGraphDataFailed: '获取运行图数据失败', getRunGraphDataFailed: '获取运行图数据失败',
getStationListFail: '获取车站列表失败', getStationListFail: '获取车站列表失败',
obtainTrainGroupNumberFailed: '获取列车车组号失败', obtainTrainGroupNumberFailed: '获取列车车组号失败',
getTrainListFailed: '获取列车列表失败' getTrainListFailed: '获取列车列表失败',
getDraftCourseDataFailed: '获取草稿课程数据失败!',
failedToGetCourseData: '获取课程数据失败!',
failedToGetSystemData: '获取系统数据失败!'
}; };

View File

@ -22,6 +22,7 @@ export default {
viewCoursePapers: '查看课程试卷', viewCoursePapers: '查看课程试卷',
nameOfTestPaper: '试卷名称', nameOfTestPaper: '试卷名称',
examStartTime: '考试时间', examStartTime: '考试时间',
minutes: '分钟',
theExamIsReadyAnyTime: '随时都可以考试', theExamIsReadyAnyTime: '随时都可以考试',
testExplanation: '考试说明', testExplanation: '考试说明',
examTimeAvailable: '考试时长', examTimeAvailable: '考试时长',

View File

@ -158,6 +158,6 @@ export default {
processFailure: '处理失败', processFailure: '处理失败',
enterLastStep: '请输入提示并点击下一步', enterLastStep: '请输入提示并点击下一步',
pleaseOpearte: '请开始操作', pleaseOpearte: '请开始操作',
help: '帮助' help: '帮助',
city: '城市'
}; };

View File

@ -24,6 +24,8 @@ import joinTraining from './joinTraining';
import trainRoom from './trainRoom'; import trainRoom from './trainRoom';
import menu from './menu'; import menu from './menu';
import ibp from './ibp'; import ibp from './ibp';
import approval from './approval';
import systemGenerate from './systemGenerate';
export default { export default {
...cnLocale, ...cnLocale,
@ -51,5 +53,7 @@ export default {
joinTraining, joinTraining,
trainRoom, trainRoom,
menu, menu,
ibp ibp,
approval,
systemGenerate
}; };

View File

@ -101,6 +101,21 @@ export default {
train: '列车', train: '列车',
station: '车站', station: '车站',
trainWindow: '车次窗', trainWindow: '车次窗',
countSkinCode: '复制皮肤与被复制皮肤类型不能一样' countSkinCode: '复制皮肤与被复制皮肤类型不能一样',
trainingRecord: '实训录制',
lesson: '课程',
taskManage: '任务管理',
trainingRule: '操作定义',
trainingManage: '实训管理',
newConstruction: '新建',
applicationForRelease: '申请发布',
rejectReason: '驳回原因',
withdraw: '撤销',
notRelease: '未发布',
pendingReview: '待审核',
published: '已发布',
rejected: '已驳回',
review: '查看'
}; };

View File

@ -12,6 +12,7 @@ export default {
saveMapAs: '地图另存为', saveMapAs: '地图另存为',
create: '创建', create: '创建',
dataVerification: '数据校验', dataVerification: '数据校验',
edit3d: '三维编辑',
logicalView: '逻辑视图', logicalView: '逻辑视图',
physicalView: '物理视图', physicalView: '物理视图',
mixedView: '混合视图', mixedView: '混合视图',
@ -116,7 +117,7 @@ export default {
editAutoRouting: '编辑自动信号', editAutoRouting: '编辑自动信号',
setSwitch: '联动道岔', setSwitch: '联动道岔',
pathUnit: '路径单元', pathUnit: '路径单元',
jlmap3d: '三维编辑', jlmap3d: '三维编辑',
automaticSignalList: '自动信号列表', automaticSignalList: '自动信号列表',
automaticSignalCode: '自动信号编码', automaticSignalCode: '自动信号编码',

View File

@ -487,6 +487,7 @@ export default {
settingTrain: '设置列车', settingTrain: '设置列车',
sourceTrainWindow: '源车次窗', sourceTrainWindow: '源车次窗',
trainWindow: '车次窗', trainWindow: '车次窗',
targetTrainWindow: '目的车次窗' targetTrainWindow: '目的车次窗',
category: '类别'
}; };

View File

@ -232,5 +232,9 @@ export default {
endTime: '终到时间', endTime: '终到时间',
editPlanningTrain: '编辑计划车', editPlanningTrain: '编辑计划车',
tipOperationTime: '请先设置区段站间运行时间, 【文件】-> 【修改站间运行时间】', tipOperationTime: '请先设置区段站间运行时间, 【文件】-> 【修改站间运行时间】',
serverTrainNum: '表号车次号' serverTrainNum: '表号车次号',
explanation: '驳回说明',
creationDate: '创建日期',
load: '加载',
modifyName: '修改名称'
}; };

View File

@ -1,6 +1,9 @@
export default { export default {
homePage: '首页', homePage: '首页',
designhomePage: '公共地图',
designUserPage: '个人地图',
mapManage: '地图管理', mapManage: '地图管理',
skinManage: '皮肤管理', skinManage: '皮肤管理',
mapDraw: '地图绘制', mapDraw: '地图绘制',
@ -59,5 +62,11 @@ export default {
userSimulationManage: '用户仿真统计', userSimulationManage: '用户仿真统计',
existingSimulation: '存在仿真管理', existingSimulation: '存在仿真管理',
ibpDraw: 'Ibp盘绘制' ibpDraw: 'Ibp盘绘制',
trainingPlatform: '实训平台',
releaseApplication: '发布申请',
courseApplication: '课程发布申请',
scriptReleaseApplication: '剧本发布申请',
runGraphReleaseApplication: '运行图发布申请',
subsystemGeneration: '子系统生成'
}; };

View File

@ -308,5 +308,6 @@ export default {
enterTheKeyWidth: '请输入钥匙宽度', enterTheKeyWidth: '请输入钥匙宽度',
selectTheKeyDirection: '请选择钥匙朝向', selectTheKeyDirection: '请选择钥匙朝向',
enterTheUpperText: '请输入上侧文字', enterTheUpperText: '请输入上侧文字',
enterTheLowerText: '请输入下侧文字' enterTheLowerText: '请输入下侧文字',
enterRejectReason: '请输入驳回说明'
}; };

View File

@ -4,6 +4,7 @@ export default {
saveData: '保存数据', saveData: '保存数据',
mapList: '地图列表', mapList: '地图列表',
createScript: '创建剧本', createScript: '创建剧本',
modifyScript: '修改剧本',
scriptName: '剧本名称', scriptName: '剧本名称',
addScript: '添加剧本', addScript: '添加剧本',
map: '所属地图', map: '所属地图',
@ -15,6 +16,7 @@ export default {
createScriptFail: '创建剧本失败', createScriptFail: '创建剧本失败',
scriptDetail: '剧本详情', scriptDetail: '剧本详情',
scriptRecord: '编制', scriptRecord: '编制',
scriptCreate: '创建',
scriptModify: '修改', scriptModify: '修改',
scriptDelete: '删除', scriptDelete: '删除',
getScriptFail: '获取剧本信息失败', getScriptFail: '获取剧本信息失败',
@ -82,7 +84,25 @@ export default {
scriptBack: '返回', scriptBack: '返回',
speakTo: '对', speakTo: '对',
executeCommandTips: '执行指令: ', executeCommandTips: '执行指令: ',
operate: '操作',
scriptList: '剧本列表',
applyPublish: '申请发布',
preview: '预览',
status: '状态',
applyRevoke: '撤回',
publish: '发布',
revokeReason: '驳回原因',
language: '语言', language: '语言',
chinese: '中文', chinese: '中文',
english: '英文' english: '英文',
publishScript: '发布剧本',
releaseScriptSuccess: '申请发布成功',
releaseScriptFailed: '申请发布失败',
publishScriptSuccess: '发布成功',
publishScriptFailed: '发布失败',
releaseScriptTip: '此操作将申请发布剧本, 是否继续?',
revokeScriptTip: '此操作将撤销发布剧本申请, 是否继续?',
inputScriptName: '请输入剧本',
selectMap: '请选择地图',
inputScriptDescription: '请输入剧本描述'
}; };

View File

@ -0,0 +1,31 @@
export default {
map: '地图',
mapName: '地图名称',
prdName: '产品名称',
name: '名称',
type: '类型',
updateData: '更新',
generate: '生成',
selectMap: '请选择地图',
generateSuccess: '生成该地图下子系统成功!',
generateFail: '生成该地图下子系统失败!',
inputName: '请输入子系统名称',
selectType: '请选择类型',
selectPrdName: '请选择产品名称',
createSubSystem: '定制子系统',
modifySubSystem: '修改子系统',
commission: '定制',
customized: '项目',
selectProject: '请选择项目',
createMapSystemSuccess: '创建地图系统成功',
createMapSystemFail: '创建地图系统失败',
getSubSystemInfoFail: '获取子系统信息失败',
updateMapSystemSuccess: '更新地图系统成功',
updateMapSystemFail: '更新地图系统失败',
generation: '一键生成',
deleteData: '删除',
deleteMapSystemSuccess: '删除地图系统成功',
deleteMapSystemFail: '删除地图系统失败',
deleteMapSystemTip: '此操作将删除地图系统, 是否继续?'
};

View File

@ -198,5 +198,12 @@ export default {
runGraphNameModifiedSuccessfully: '修改运行图名称成功!', runGraphNameModifiedSuccessfully: '修改运行图名称成功!',
modifyRunGraphNameFailed: '修改运行图名称失败!', modifyRunGraphNameFailed: '修改运行图名称失败!',
planCreationSuccessful: '创建计划成功!', planCreationSuccessful: '创建计划成功!',
createPlanFailed: '创建计划失败!' createPlanFailed: '创建计划失败!',
cancelCoursePublicationHint: '此操作将撤销课程发布申请,是否确定?',
cancelTheSuccessfulApplicationOfTheCourseRelease: '撤销课程发布申请成功!',
cancellationOfCoursePublicationApplicationFailed: '撤销课程发布申请失败!',
publishTheCourseHint: '此操作将发布课程,是否确定?',
rejectedCourseReleaseApplicationSuccessful: '驳回课程发布申请成功!',
rejectedCourseReleaseApplicationFailed: '驳回课程发布申请失败!',
duplicatePlanFailedTips: '间隔时间需要大于30秒或次数大于1'
}; };

View File

@ -154,7 +154,7 @@ export function Jlmap3ddata(mapid,scope){
}) })
.then(function(data){ .then(function(data){
//console.log(data); //console.log(data);
return jlmap3ddata.signallist.loadpromise(signaldata,scene,assetloader); return jlmap3ddata.signallist.loadpromise(signaldata,scene,assetloader,mapdata.signalList);
}) })
.then(function(data){ .then(function(data){
//console.log(data); //console.log(data);

View File

@ -48,7 +48,8 @@ export function getmodels(data) {
rightlist:data.mapdata.linklist.linksgroup.children[i].rightlist, rightlist:data.mapdata.linklist.linksgroup.children[i].rightlist,
leftlist:data.mapdata.linklist.linksgroup.children[i].leftlist, leftlist:data.mapdata.linklist.linksgroup.children[i].leftlist,
lp:data.mapdata.linklist.linksgroup.children[i].lp, lp:data.mapdata.linklist.linksgroup.children[i].lp,
rp:data.mapdata.linklist.linksgroup.children[i].rp rp:data.mapdata.linklist.linksgroup.children[i].rp,
rail:data.mapdata.linklist.linksgroup.children[i].rail,
} }
links.push(link); links.push(link);
} }
@ -57,6 +58,7 @@ export function getmodels(data) {
//section隧道 //section隧道
console.log(data.mapdata.sectionlist.sections); console.log(data.mapdata.sectionlist.sections);
let sections = []; let sections = [];
for(let i=0;i<data.mapdata.sectionlist.sections.datalist.length;i++){ for(let i=0;i<data.mapdata.sectionlist.sections.datalist.length;i++){
let section = { let section = {
uuid:data.mapdata.sectionlist.sections.modellist[i].uuid, uuid:data.mapdata.sectionlist.sections.modellist[i].uuid,
@ -80,6 +82,7 @@ export function getmodels(data) {
sections.push(section); sections.push(section);
} }
console.log(links);
let arrray = { let arrray = {
link:links, link:links,
section:sections, section:sections,

View File

@ -89,7 +89,7 @@ function linkhelp(data,scene){
testmesh2.lengthfact = data[i].lengthfact; testmesh2.lengthfact = data[i].lengthfact;
for(let i=0;i<testmesh2.rightlist.length;i++){ for(let i=0;i<testmesh2.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-29; testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-25;
testmesh2.geometry.attributes.uv.array[testmesh2.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3]; testmesh2.geometry.attributes.uv.array[testmesh2.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
} }
let newrail = new THREE.BufferGeometry(); let newrail = new THREE.BufferGeometry();
@ -208,7 +208,7 @@ function linkhelp(data,scene){
let testmesh2 = autorail.clone(true); let testmesh2 = autorail.clone(true);
for(let i=0;i<autorail.rightlist.length;i++){ for(let i=0;i<autorail.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[autorail.rightlist[i]*3] = len-26; testmesh2.geometry.attributes.position.array[autorail.rightlist[i]*3] = len-25;
testmesh2.geometry.attributes.uv.array[autorail.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3]; testmesh2.geometry.attributes.uv.array[autorail.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
} }
let newrail = new THREE.BufferGeometry(); let newrail = new THREE.BufferGeometry();
@ -240,11 +240,11 @@ function linkhelp(data,scene){
let rotenum = axixnow.angleTo(axix); let rotenum = axixnow.angleTo(axix);
//不同坐标系方向值不同 //不同坐标系方向值不同
if(data.lp.y>data.rp.y){ if(data.lp.y>data.rp.y){
testmesh2.rotation.z = 0.197; testmesh2.rotation.z = 0.218;
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z); data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z); data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else if(data.lp.y<data.rp.y){ }else if(data.lp.y<data.rp.y){
testmesh2.rotation.z = -0.197; testmesh2.rotation.z = -0.218;
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z); data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z); data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else{ }else{
@ -272,11 +272,11 @@ function linkhelp(data,scene){
let rotenum = axixnow.angleTo(axix); let rotenum = axixnow.angleTo(axix);
//不同坐标系方向值不同 //不同坐标系方向值不同
if(data.lp.y>data.rp.y){ if(data.lp.y>data.rp.y){
testmesh2.rotation.z = 0.197; testmesh2.rotation.z = 0.218;
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z); data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z); data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else if(data.lp.y<data.rp.y){ }else if(data.lp.y<data.rp.y){
testmesh2.rotation.z = -0.197; testmesh2.rotation.z = -0.218;
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z); data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z); data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
} }

View File

@ -15,7 +15,7 @@ export function RailList(){
let raillink = mapdata.linklist.linksgroup.children; let raillink = mapdata.linklist.linksgroup.children;
for(let i=0;i<raillink.length;i++){ for(let i=0;i<raillink.length;i++){
var geometry = new THREE.PlaneBufferGeometry( raillink[i].lengthfact-20.5, 0.1, 0.1 ); var geometry = new THREE.PlaneBufferGeometry( raillink[i].lengthfact-25, 0.1, 0.1 );
var material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} ); var material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} );
var plane = new THREE.Mesh( geometry, material ); var plane = new THREE.Mesh( geometry, material );
plane.position.x = raillink[i].position.x; plane.position.x = raillink[i].position.x;
@ -29,15 +29,23 @@ export function RailList(){
var geometry2 = new THREE.CircleBufferGeometry( 1, 16 ); var geometry2 = new THREE.CircleBufferGeometry( 1, 16 );
var material2 = new THREE.MeshBasicMaterial( { color: 0xff2000 } ); var material2 = new THREE.MeshBasicMaterial( { color: 0xff2000 } );
var circle1 = new THREE.Mesh( geometry1, material1 ); var circle1 = new THREE.Mesh( geometry1, material1 );
circle1.position.x = plane.position.x + (raillink[i].lengthfact-20.5)/2*Math.cos(plane.rotation.z); circle1.position.x = plane.position.x + (raillink[i].lengthfact-25)/2*Math.cos(plane.rotation.z);
circle1.position.z = plane.position.z - (raillink[i].lengthfact-20.5)/2*Math.sin(plane.rotation.z); circle1.position.z = plane.position.z - (raillink[i].lengthfact-25)/2*Math.sin(plane.rotation.z);
circle1.rotation.x = -Math.PI/2; circle1.rotation.x = -Math.PI/2;
scene.add( circle1 ); scene.add( circle1 );
var circle2 = new THREE.Mesh( geometry2, material2 ); var circle2 = new THREE.Mesh( geometry2, material2 );
circle2.position.x = plane.position.x - (raillink[i].lengthfact-20.5)/2*Math.cos(plane.rotation.z); circle2.position.x = plane.position.x - (raillink[i].lengthfact-25)/2*Math.cos(plane.rotation.z);
circle2.position.z = plane.position.z + (raillink[i].lengthfact-20.5)/2*Math.sin(plane.rotation.z); circle2.position.z = plane.position.z + (raillink[i].lengthfact-25)/2*Math.sin(plane.rotation.z);
circle2.rotation.x = -Math.PI/2; circle2.rotation.x = -Math.PI/2;
mapdata.linklist.linksgroup.children[i].rail = [{
x:circle2.position.x,
z:circle2.position.z
},{
x:circle1.position.x,
z:circle1.position.z
}];
scene.add( circle2 ); scene.add( circle2 );
scene.add( plane ); scene.add( plane );
} }
@ -51,6 +59,8 @@ export function RailList(){
circle1.rotation.x = -Math.PI/2; circle1.rotation.x = -Math.PI/2;
scene.add( circle1 ); scene.add( circle1 );
} }
}; };
this.getrail = function(){ this.getrail = function(){

View File

@ -6,11 +6,11 @@ export function SectionList() {
this.type = "sectionlist"; this.type = "sectionlist";
let sectiongroup = new THREE.Group(); this.sectiongroup = new THREE.Group();
sectiongroup.name = "section"; this.sectiongroup.name = "section";
let switchgroup = new THREE.Group(); this.switchgroup = new THREE.Group();
switchgroup.name = "switch"; this.switchgroup.name = "switch";
this.sections = { this.sections = {
datalist:[], datalist:[],
@ -24,8 +24,8 @@ export function SectionList() {
this.initpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){ this.initpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
scene.add(sectiongroup); scene.add(scope.sectiongroup);
scene.add(switchgroup); scene.add(scope.switchgroup);
let linkdata = jlmap3ddata.linklist; let linkdata = jlmap3ddata.linklist;
//遍历区段 //遍历区段
for(let i=0;i<sectiondata.length;i++){ for(let i=0;i<sectiondata.length;i++){
@ -187,7 +187,7 @@ export function SectionList() {
testswitch.position.z = switchposz; testswitch.position.z = switchposz;
scope.switchs.modellist.push(testswitch); scope.switchs.modellist.push(testswitch);
switchgroup.add(testswitch); scope.switchgroup.add(testswitch);
} }
resolve("loadersection"); resolve("loadersection");
@ -271,8 +271,8 @@ export function SectionList() {
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){ this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
console.log(sectiondata); console.log(sectiondata);
scene.add(sectiongroup); scene.add(scope.sectiongroup);
scene.add(switchgroup); scene.add(scope.switchgroup);
let linkdata = jlmap3ddata.linklist; let linkdata = jlmap3ddata.linklist;
for(let i=0;i<sectiondata.length;i++){ for(let i=0;i<sectiondata.length;i++){
@ -347,12 +347,12 @@ export function SectionList() {
if(testmesh1.isStandTrack == false){ if(testmesh1.isStandTrack == false){
sectiongroup.add(testmesh1); // scope.sectiongroup.add(testmesh1);
}else{ }else{
scope.standtrack.push(testmesh1); scope.standtrack.push(testmesh1);
var box = new THREE.BoxHelper( testmesh1, 0xff0000 ); var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
sectiongroup.add( box ); // scope.sectiongroup.add( box );
} }
scope.sections.modellist.push(testmesh1); scope.sections.modellist.push(testmesh1);
} }
@ -367,7 +367,8 @@ export function SectionList() {
switchmesh2 = assetloader.modellist[i].mesh; switchmesh2 = assetloader.modellist[i].mesh;
} }
} }
// switchmesh1.rotation.x = Math.PI/2;
// switchmesh2.rotation.z = Math.PI/2;
for(let i=0;i<switchdata.length;i++){ for(let i=0;i<switchdata.length;i++){
let newswitch = { let newswitch = {
code:switchdata[i].code, code:switchdata[i].code,
@ -406,6 +407,7 @@ export function SectionList() {
}else{ }else{
testswitch = switchmesh1.clone(true); testswitch = switchmesh1.clone(true);
} }
testswitch.rotation.z = Math.PI;
} }
}else{ }else{
if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[1].y){ if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[1].y){
@ -420,19 +422,20 @@ export function SectionList() {
}else{ }else{
testswitch = switchmesh1.clone(true); testswitch = switchmesh1.clone(true);
} }
testswitch.rotation.z = Math.PI;
} }
} }
testswitch.position.x = switchdata[i].position.x; testswitch.position.x = switchdata[i].position.x;
testswitch.position.y = switchdata[i].position.y; testswitch.position.y = switchdata[i].position.y;
testswitch.position.z = switchdata[i].position.z; testswitch.position.z = switchdata[i].position.z;
testswitch.rotation.x = switchdata[i].rotation._x; // testswitch.rotation.x = switchdata[i].rotation._x;
testswitch.rotation.y = switchdata[i].rotation._y; // testswitch.rotation.y = switchdata[i].rotation._y;
testswitch.rotation.z = switchdata[i].rotation._z; // testswitch.rotation.z = switchdata[i].rotation._z;
scope.switchs.datalist.push(newswitch); scope.switchs.datalist.push(newswitch);
scope.switchs.modellist.push(testswitch); scope.switchs.modellist.push(testswitch);
switchgroup.add(testswitch); scope.switchgroup.add(testswitch);
} }
resolve("loadersection"); resolve("loadersection");
@ -538,17 +541,21 @@ export function SectionList() {
testmesh1.lengthfact = len; testmesh1.lengthfact = len;
testmesh1.linkCode = suidao.linkCode; testmesh1.linkCode = suidao.linkCode;
if(suidaodata.datalist[i].isStandTrack == false){ if(suidaodata.datalist[i].isStandTrack == false){
sectiongroup.add(testmesh1); scope.sectiongroup.add(testmesh1);
}else{ }else{
scope.standtrack.push(testmesh1); scope.standtrack.push(testmesh1);
var box = new THREE.BoxHelper( testmesh1, 0xff0000 ); var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
sectiongroup.add( box ); scope.sectiongroup.add( box );
} }
scope.sections.modellist.push(testmesh1); scope.sections.modellist.push(testmesh1);
} }
} }
this.resetsection = function(scene){
scene.remove(scope.sectiongroup);
};
this.reposition = function(){ this.reposition = function(){
} }

View File

@ -59,7 +59,10 @@ export function SignalList() {
newmesh.scale.x = 0.05; newmesh.scale.x = 0.05;
newmesh.scale.y = 0.05; newmesh.scale.y = 0.05;
newmesh.scale.z = 0.05; newmesh.scale.z = 0.05;
newmesh.offset = data[i].offset;
newmest.linkCode = data[i].linkCode;
newsignal.mesh = newmesh; newsignal.mesh = newmesh;
newsignal.offset = data[i].offset;
newsignal.mesh.status = "01"; newsignal.mesh.status = "01";
scope.group.add(newsignal.mesh); scope.group.add(newsignal.mesh);
scope.list.push(newsignal); scope.list.push(newsignal);
@ -101,7 +104,7 @@ export function SignalList() {
}); });
} }
this.loadpromise = function(signaldata,scene,assetloader){ this.loadpromise = function(signaldata,scene,assetloader,data){
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
for(let i=0;i<signaldata.length;i++){ for(let i=0;i<signaldata.length;i++){
let newsignal = new SignalModel(signaldata[i]); let newsignal = new SignalModel(signaldata[i]);
@ -111,11 +114,15 @@ export function SignalList() {
num = j; num = j;
} }
} }
let newmesh = assetloader.modellist[num].mesh.clone(true); let newmesh = assetloader.modellist[num].mesh.clone(true);
newmesh.uuid = signaldata[i].id; newmesh.uuid = signaldata[i].id;
newmesh.name = signaldata[i].name; newmesh.name = signaldata[i].name;
newmesh.modelid = assetloader.modellist[num].id; newmesh.modelid = assetloader.modellist[num].id;
newmesh.code = signaldata[i].code; newmesh.code = signaldata[i].code;
newmesh.offset = data[i].offset;
newmesh.linkCode = data[i].linkCode;
newmesh.directionType = data[i].directionType;
newmesh.position.x = signaldata[i].position.x; newmesh.position.x = signaldata[i].position.x;
newmesh.position.y = signaldata[i].position.y; newmesh.position.y = signaldata[i].position.y;
newmesh.position.z = signaldata[i].position.z; newmesh.position.z = signaldata[i].position.z;
@ -132,7 +139,30 @@ export function SignalList() {
resolve("loadedsignal"); resolve("loadedsignal");
}); });
}; };
this.resetsignal = function(jlmap3ddata){
console.log(jlmap3ddata.linksgroup);
console.log(scope);
let linkdata = jlmap3ddata.linksgroup;
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;
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 );
}
}
};
this.init = function(data,realsectionlist,scene,assetloader){ this.init = function(data,realsectionlist,scene,assetloader){

View File

@ -158,9 +158,12 @@ export function JLmap3dEdit(dom, data, mapid) {
}; };
this.export = function(){ this.export = function(){
var exporter = new THREE.OBJExporter(); let exporter = new THREE.OBJExporter();
console.log(scope.exportmodel); console.log(scope.mapdata);
var result = exporter.parse( scope.exportmodel ); // let exportmodels = scope.mapdata.linklist.linksgroup;
// let exportmodels = scope.mapdata.sectionlist.switchgroup;
let exportmodels = scope.mapdata.stationstandlist.group;
let result = exporter.parse( exportmodels );
console.log(result); console.log(result);
} }
@ -243,6 +246,8 @@ export function JLmap3dEdit(dom, data, mapid) {
this.autoss = function(){ this.autoss = function(){
console.log("autoss"); console.log("autoss");
console.log(scope.mapdata);
scope.mapdata.signallist.resetsignal(scope.mapdata.linklist);
}; };
function onWindowResize() { function onWindowResize() {

View File

@ -6,11 +6,6 @@ import {OBJLoader} from '@/jlmap3d/main/loaders/OBJLoader.js';
import {MTLLoader} from '@/jlmap3d/main/loaders/MTLLoader.js'; import {MTLLoader} from '@/jlmap3d/main/loaders/MTLLoader.js';
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader.js'; import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader.js';
// controls
import {OrbitControls} from '@/jlmap3d/main/control/OrbitControls.js';
import { DragControls } from '@/jlmap3d/main/control/DragControls.js';
// component
// data // data
import { Jl3ddata } from '@/jlmap3d/main/model/jl3ddata'; import { Jl3ddata } from '@/jlmap3d/main/model/jl3ddata';
@ -20,11 +15,14 @@ import { SetRender } from '@/jlmap3d/config/SetRender';
import { SetScene } from '@/jlmap3d/config/SetScene'; import { SetScene } from '@/jlmap3d/config/SetScene';
import { SetLights } from '@/jlmap3d/config/SetLights'; import { SetLights } from '@/jlmap3d/config/SetLights';
// controls
import {OrbitControls} from '@/jlmap3d/main/control/OrbitControls.js';
import { DragControls } from '@/jlmap3d/main/control/DragControls.js';
// 加载器 // 加载器
import { ModelLoad } from '@/jlmap3d/main/loaders/simulationloader'; import { ModelLoad } from '@/jlmap3d/main/loaders/simulationloader';
// connect // connect
import {Jl3dDriving} from '@/jlmap3d/jl3ddrive/moveupdate/DrivingConnect'; import {Jl3dDriving} from '@/jlmap3d/jl3ddrive/moveupdate/DrivingConnect';
import { getPublishMapVersion, getPublishMapDetail, getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata'; import { getPublishMapVersion, getPublishMapDetail, getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
// utils // utils
@ -38,9 +36,9 @@ import {MouseControls} from '@/jlmap3d/main/control/FirstControls';
var clock = new THREE.Clock(); var clock = new THREE.Clock();
export function JLmapDriving(dom, data, skinCode) { export function JLmapDriving(dom, data, skinCode,storemod) {
const scope = this; let scope = this;
//界面更新函数 //界面更新函数
let updatemmi = {}; let updatemmi = {};
@ -49,7 +47,7 @@ export function JLmapDriving(dom, data, skinCode) {
this.animateswitch = false; this.animateswitch = false;
this.cctvswitch = false; this.cctvswitch = false;
// 初始化webgl渲染 // 初始化webgl渲染
const renderer = SetRender(dom); let renderer = SetRender(dom);
renderer.domElement.style.position = 'absolute'; renderer.domElement.style.position = 'absolute';
renderer.domElement.style.top = '0'; renderer.domElement.style.top = '0';
@ -63,9 +61,9 @@ export function JLmapDriving(dom, data, skinCode) {
// 定义相机 // 定义相机
//let camera = SetCamera(dom); //let camera = SetCamera(dom);
// 定义场景(渲染容器) // 定义场景(渲染容器)
const scene = SetScene(); let scene = SetScene();
const speed = 0; let speed = 0;
let drivingcode = null; let drivingcode = null;
@ -98,11 +96,11 @@ export function JLmapDriving(dom, data, skinCode) {
// 地图模型数据 // 地图模型数据
let mapdata = new Jl3ddata(); let mapdata = new Jl3ddata();
let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 1100); let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 11000);
camera.position.set( 0, 0, 0 ); camera.position.set( 0, 0, 0 );
camera.aspect = window.innerWidth / window.innerHeight; camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix(); camera.updateProjectionMatrix();
camera.rotation.x = 0;
let listener = new THREE.AudioListener(); let listener = new THREE.AudioListener();
listener.position.y = -2; listener.position.y = -2;
camera.add( listener ); camera.add( listener );
@ -119,12 +117,13 @@ export function JLmapDriving(dom, data, skinCode) {
sound.play(); sound.play();
}); });
const controls3 = new MouseControls(camera, 1.6); let controls3 = new MouseControls(camera, 1.6);
controls3.enabled = true; controls3.enabled = true;
// controls3.getObject().rotation.x = Math.PI/2;
scene.add(controls3.getObject()); 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, 120);
cameracctv.position.set( 5, -3,27 ); cameracctv.position.set( 2, -1,27 );
cameracctv.rotation.y = Math.PI/5*3; cameracctv.rotation.y = Math.PI/5*3;
camera.add(cameracctv); camera.add(cameracctv);
@ -133,18 +132,46 @@ export function JLmapDriving(dom, data, skinCode) {
this.Subscribe.socketon(scope.Subscribe.topic); this.Subscribe.socketon(scope.Subscribe.topic);
var timer = setInterval(function() { var timer = setInterval(function() {
if(mapdata.trainlisttest.group){ if(mapdata.trainlisttest){
if(mapdata.trainlisttest.group.children[0]){ 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){
const ddd = storemod.getters['map/getDeviceByCode'](k);
let switchdata = mapdata.rails.switchrail[k];
mapdata.rails.switchrail[k].locateType = ddd.locateType;
updatemmi.updatedrivingcode(mapdata.trainlisttest.group.children[0].name); if(ddd.locateType == "01"){
scope.Subscribe.initdrivercode(mapdata.trainlisttest.group.children[0].name); //1--向左 2--向右
clearInterval(timer); //__\__ __/__
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;
}
}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;
}
}
}
clearInterval(timer);
}
} }
} }
}, 1000);
}, 2000);
// 初始化加载数据和模型 // 初始化加载数据和模型
getPublish3dMapDetail(skinCode).then(netdata => { getPublish3dMapDetail(skinCode).then(netdata => {
ModelLoad(data, scope, netdata.data, mapdata, camera, controls3, scene,mixers); ModelLoad(data, scope, netdata.data, mapdata, camera, controls3, scene,mixers,storemod);
}); });
// let stats = new Stats(); // let stats = new Stats();
// dom.appendChild( stats.dom ); // dom.appendChild( stats.dom );
@ -170,7 +197,7 @@ export function JLmapDriving(dom, data, skinCode) {
renderercctv.render(scene,cameracctv); renderercctv.render(scene,cameracctv);
} }
//相机按键位移 //相机按键位移
//controls3.update(); // controls3.update();
delta = clock.getDelta(); delta = clock.getDelta();
for (let i=mixers.length-1; i>=0; i--) { for (let i=mixers.length-1; i>=0; i--) {
mixers[i].update( delta ); mixers[i].update( delta );
@ -186,6 +213,8 @@ export function JLmapDriving(dom, data, skinCode) {
controls3.getObject().position.y=10; controls3.getObject().position.y=10;
controls3.getObject().position.z = mapdata.trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14]; controls3.getObject().position.z = mapdata.trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14];
console.log(controls3);
} }
} }
@ -227,12 +256,11 @@ export function JLmapDriving(dom, data, skinCode) {
updatemmi.updatedrivingcode = function(code) { updatemmi.updatedrivingcode = function(code) {
drivingcode = code; drivingcode = code;
mapdata.trainlisttest.list[drivingcode].children[0].add(controls3.getObject()); mapdata.trainlisttest.list[drivingcode].children[0].add(controls3.getObject());
mapdata.trainlisttest.list[drivingcode].children[0].add(scope.assetloader.modellist[4].mesh); controls3.getObject().position.x = 10;
controls3.getObject().position.x = 40; controls3.getObject().position.y = 0;
controls3.getObject().position.y= 12.5; controls3.getObject().position.z = 2.5;
controls3.getObject().rotation.x = Math.PI/2;
controls3.getObject().rotation.y = -Math.PI/2; controls3.getObject().rotation.y = -Math.PI/2;
scope.assetloader.modellist[4].mesh.position.x = 34;
scope.assetloader.modellist[4].mesh.position.y = 0;
}; };
this.dispose = function() { this.dispose = function() {
@ -253,6 +281,7 @@ export function JLmapDriving(dom, data, skinCode) {
scope.actions = null; scope.actions = null;
scope.Subscribe = null; scope.Subscribe = null;
sound.stop(); sound.stop();
scope.webwork.terminate();
// console.log(scope); // console.log(scope);
// scope = null; // scope = null;
}; };
@ -373,9 +402,9 @@ export function JLmapDriving(dom, data, skinCode) {
if (event.button == '0') { if (event.button == '0') {
// 定义光线 // 定义光线
const raycaster = new THREE.Raycaster(); let raycaster = new THREE.Raycaster();
// 定义平面鼠标点击坐标 // 定义平面鼠标点击坐标
const mouse = new THREE.Vector2(); let mouse = new THREE.Vector2();
mouse.x = (event.clientX / window.innerWidth) * 2 - 1; mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
@ -387,7 +416,7 @@ export function JLmapDriving(dom, data, skinCode) {
if (scope.raycasterswitch == 'stand') { if (scope.raycasterswitch == 'stand') {
// 从站台对象组获取点击目标 // 从站台对象组获取点击目标
const intersects1 = raycaster.intersectObjects( mapdata.stationstandlist.textlist); let intersects1 = raycaster.intersectObjects( mapdata.stationstandlist.textlist);
// 获取最近处点击到的模型对象 // 获取最近处点击到的模型对象
if (intersects1[0]) { if (intersects1[0]) {
// 遍历对象组获取对象坐标更新相机数据 // 遍历对象组获取对象坐标更新相机数据
@ -405,7 +434,7 @@ export function JLmapDriving(dom, data, skinCode) {
} }
if (scope.raycasterswitch == 'train') { if (scope.raycasterswitch == 'train') {
const intersects = raycaster.intersectObjects( mapdata.trainlisttest.textlist); let intersects = raycaster.intersectObjects( mapdata.trainlisttest.textlist);
if (intersects[0]) { if (intersects[0]) {
for (let j=0; j<mapdata.trainlisttest.list.length; j++) { for (let j=0; j<mapdata.trainlisttest.list.length; j++) {
if (intersects[0].object.name == mapdata.trainlisttest.list[j].name) { if (intersects[0].object.name == mapdata.trainlisttest.list[j].name) {
@ -419,7 +448,7 @@ export function JLmapDriving(dom, data, skinCode) {
if (scope.raycasterswitch == 'section') { if (scope.raycasterswitch == 'section') {
// console.log(mapdata.sectionlist.sections.modellist); // console.log(mapdata.sectionlist.sections.modellist);
const intersects = raycaster.intersectObjects( mapdata.sectionlist.sections.modellist, true); let intersects = raycaster.intersectObjects( mapdata.sectionlist.sections.modellist, true);
if (intersects[0]) { if (intersects[0]) {
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 ); scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
@ -429,7 +458,7 @@ export function JLmapDriving(dom, data, skinCode) {
if (scope.raycasterswitch == 'signal') { if (scope.raycasterswitch == 'signal') {
const intersects = raycaster.intersectObjects( mapdata.signallist.group.children, true); let intersects = raycaster.intersectObjects( mapdata.signallist.group.children, true);
if (intersects[0]) { if (intersects[0]) {
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 ); scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
@ -438,7 +467,7 @@ export function JLmapDriving(dom, data, skinCode) {
} }
if (scope.raycasterswitch == 'switch') { if (scope.raycasterswitch == 'switch') {
const intersects = raycaster.intersectObjects( mapdata.sectionlist.switchs.modellist, true); let intersects = raycaster.intersectObjects( mapdata.sectionlist.switchs.modellist, true);
if (intersects[0]) { if (intersects[0]) {
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 ); scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );

View File

@ -19,6 +19,9 @@ export function Jl3dDriving(updatemmi,sound) {
var sectionlist = null; var sectionlist = null;
var materials = null; var materials = null;
var actions = null; var actions = null;
var rails = null;
var links = null;
var scenes = null; var scenes = null;
var code = null; var code = null;
@ -52,7 +55,8 @@ export function Jl3dDriving(updatemmi,sound) {
materials = materiallist; materials = materiallist;
scenes = scene; scenes = scene;
actions = nowaction; actions = nowaction;
links = this.map.linklist;
rails = this.map.rails;
}; };
this.initdrivercode = function(code) { this.initdrivercode = function(code) {
@ -98,16 +102,16 @@ export function Jl3dDriving(updatemmi,sound) {
// //
// } // }
switch (data.type) { switch (data.type) {
case 'Simulation_Driver_Change':
drivingcode = data.body.code;
// sound.volswitch = true;
updatemmi.updatedrivingcode( data.body.code);
break;
case 'Simulation_TrainSpeed': case 'Simulation_TrainSpeed':
trainspeed(data); trainspeed(data);
break; break;
case 'Simulation_Drive_Data_Routing': case 'Simulation_Drive_Data_Routing':
updatemmi.updatedrivedata(data.body); updatemmi.updatedrivedata(data.body);
break;
case 'Simulation_Driver_Change':
drivingcode = data.body.code;
sound.volswitch = true;
updatemmi.updatedrivingcode( data.body.code);
break; break;
case 'SJL3D_TrainStatus': case 'SJL3D_TrainStatus':
trainstatus(data); trainstatus(data);
@ -153,13 +157,13 @@ export function Jl3dDriving(updatemmi,sound) {
if (trainlisttest.list[code].runMode == '02') { if (trainlisttest.list[code].runMode == '02') {
if (trainlisttest.list[code].isStandTrack == true) { if (trainlisttest.list[code].isStandTrack == true) {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/19.5/trainlisttest.list[code].len); trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
} else { } else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20.3/trainlisttest.list[code].len); trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
} }
} else { } else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len); trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
} }
if (code == drivingcode) { if (code == drivingcode) {
@ -168,6 +172,8 @@ export function Jl3dDriving(updatemmi,sound) {
// } else { // } else {
updatemmi.updatenowspeed(Math.abs(data.body[tl].v)); updatemmi.updatenowspeed(Math.abs(data.body[tl].v));
// console.log(data.body[i]);
// } // }
} }
} }
@ -189,6 +195,25 @@ export function Jl3dDriving(updatemmi,sound) {
} else { } else {
updatemmi.updateatospeed(-1); updatemmi.updateatospeed(-1);
} }
if(trainlisttest.list[code].progress<1){
let syncdata = {
type: 'Train',
code: code,
linkCode: trainlisttest.list[code].nowcode,
percent: 0
};
if (trainlisttest.list[code].status == '02') {
syncdata.percent = trainlisttest.list[code].progress;
} else {
syncdata.percent = 1 - trainlisttest.list[code].progress;
}
// console.log(syncdata);
// console.log(trainlisttest.list[code].nextcurve);
// console.log("=============");
scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
}
} }
} }
} }
@ -208,29 +233,6 @@ export function Jl3dDriving(updatemmi,sound) {
//更新车组号 //更新车组号
updatemmi.updatetrainnum(data.body[i].groupNumber); updatemmi.updatetrainnum(data.body[i].groupNumber);
//更新列车 //更新列车
let syncdata = {
type: 'Train',
code: code,
sectionCode: data.body[i].sectionCode,
percent: 0
};
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
if (data.body[i].directionType == '02') {
syncdata.percent = 1-(sectionlist.sections.datalist[data.body[i].sectionCode].rstop/trainlisttest.list[code].len);
} else {
syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len;
}
//scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
} else {
if (data.body[i].directionType == '02') {
syncdata.percent = trainlisttest.list[code].progress;
} else {
syncdata.percent = 1 - trainlisttest.list[code].progress;
}
//scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
}
if (data.body[i].parkRemainTime>0) { if (data.body[i].parkRemainTime>0) {
updatemmi.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime)); updatemmi.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime));
} else { } else {
@ -304,91 +306,49 @@ export function Jl3dDriving(updatemmi,sound) {
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) { if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) { if (rails.linkrail[data.body[i].linkCode]) {
trainlisttest.group.add(trainlisttest.list[code]); trainlisttest.group.add(trainlisttest.list[code]);
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
trainlisttest.list[code].progress = 0; trainlisttest.list[code].progress = 0;
trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent; trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
trainlisttest.list[code].dispose = false; trainlisttest.list[code].dispose = false;
trainlisttest.list[code].nowcode = data.body[i].sectionCode; trainlisttest.list[code].nowcode = data.body[i].linkCode;
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
let vexlist = []; let vexlist = [];
let endrotation = null; let endrotation = null;
if (data.body[i].directionType == '02') { // 向右 if (data.body[i].directionType == '02') { // 向右
let offset = null; let point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(data.body[i].linkOffsetPercent);
let rotaposx = null;
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
} else {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
}
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z;
trainlisttest.list[code].rotation.y = 0; trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = rotaposx; trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz; trainlisttest.list[code].children[tl].position.z = point.z;
} }
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
trainlisttest.list[code].status = '02'; trainlisttest.list[code].status = '02';
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
trainlisttest.list[code].progress = data.body[i].sectionOffsetPercent; trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
} else if (data.body[i].directionType == '03') { // 向左 } else if (data.body[i].directionType == '03') { // 向左
trainlisttest.list[code].dispose = false; let point = rails.linkrail[data.body[i].linkCode].lineright.getPointAt((1-data.body[i].linkOffsetPercent));
trainlisttest.group.add(trainlisttest.list[code]);
let offset = null;
let rotaposx = null;
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
} else {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
}
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z;
trainlisttest.list[code].rotation.y = Math.PI; trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = rotaposx; trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = -rotaposz; trainlisttest.list[code].children[tl].position.z = -point.z;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} }
// if(trainlisttest.list[code].rname == "006"){
// console.log("0000000000000000");
// console.log(data.body[i].linkOffsetPercent);
// }
trainlisttest.list[code].status = '03'; trainlisttest.list[code].status = '03';
trainlisttest.list[code].progress = 1-data.body[i].sectionOffsetPercent; trainlisttest.list[code].progress = 1-data.body[i].linkOffsetPercent;
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
} }
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
// trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist); // trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
if(data.body[i].speed == 0){ if(data.body[i].speed == 0){
@ -397,9 +357,10 @@ export function Jl3dDriving(updatemmi,sound) {
// trainlisttest.list[code].startmark = 1; // trainlisttest.list[code].startmark = 1;
}else{ }else{
trainlisttest.list[code].speeds = data.body[i].speed; trainlisttest.list[code].speeds = data.body[i].speed;
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len); trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/22/trainlisttest.list[code].len);
} }
} }
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) { } else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
@ -415,7 +376,7 @@ export function Jl3dDriving(updatemmi,sound) {
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) { } else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) { if (rails.linkrail[data.body[i].linkCode]) {
if (driverswitch == '02' && code == drivingcode) { if (driverswitch == '02' && code == drivingcode) {
updatemmi.updatenowspeed(data.body[i].speed); updatemmi.updatenowspeed(data.body[i].speed);
if (data.body[i].atpSpeed) { if (data.body[i].atpSpeed) {
@ -433,8 +394,19 @@ export function Jl3dDriving(updatemmi,sound) {
} else { } else {
updatemmi.updatenowlen(0); updatemmi.updatenowlen(0);
} }
// if(trainlisttest.list[code].isStandTrack == true){
// pointstand = null;
// if(data.body[i].directionType == "02"){
// pointstand = trainlisttest.list[code].curve.getPointAt(data.body[i].sectionOffsetPercent);
// }else{
// pointstand = trainlisttest.list[code].curve.getPointAt(1-data.body[i].sectionOffsetPercent);
// }
// console.log(data.body[i].sectionOffsetPercent)
// console.log(pointstand.x);
//
// trainlisttest.list[code].position.x = pointstand.x;
// }
} }
if (driverswitch == '05' && code == drivingcode) { if (driverswitch == '05' && code == drivingcode) {
if (data.body[i].maLen) { if (data.body[i].maLen) {
updatemmi.updatenowlen(data.body[i].maLen); updatemmi.updatenowlen(data.body[i].maLen);
@ -442,15 +414,10 @@ export function Jl3dDriving(updatemmi,sound) {
updatemmi.updatenowlen(0); updatemmi.updatenowlen(0);
} }
} }
if (trainlisttest.list[code].nowcode != data.body[i].sectionCode) {
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
const vexlist = [];
const endrotation = null;
if (data.body[i].directionType == '02') { // 向右 if (data.body[i].directionType == '02') { // 向右
if (trainlisttest.list[code].status != data.body[i].directionType) { if (trainlisttest.list[code].status != data.body[i].directionType) {
trainlisttest.list[code].progress = 0;
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12]; const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14]; const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
trainlisttest.list[code].rotation.y = 0; trainlisttest.list[code].rotation.y = 0;
@ -458,126 +425,110 @@ export function Jl3dDriving(updatemmi,sound) {
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz; trainlisttest.list[code].children[tl].position.z = rotaposz;
} }
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}
} else {
if(data.body[i].speed > 0){
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}else if(data.body[i].speed < 0){
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
} else { trainlisttest.list[code].progress = (rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) { trainlisttest.list[code].status = '02';
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) { trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); trainlisttest.list[code].nextcurve = null;
}
}
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
}
}
trainlisttest.list[code].rotation.y = 0;
} }
trainlisttest.list[code].status = '02'; trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
} else if (data.body[i].directionType == '03') { // 向左 } else if (data.body[i].directionType == '03') { // 向左
if (trainlisttest.list[code].status != data.body[i].directionType) { if (trainlisttest.list[code].status != data.body[i].directionType) {
trainlisttest.list[code].progress = 0;
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12]; const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]); const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
trainlisttest.list[code].rotation.y = Math.PI; trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = rotaposx; trainlisttest.list[code].position.x = rotaposx;
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz; trainlisttest.list[code].children[tl].position.z = -rotaposz;
} }
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { trainlisttest.list[code].progress = 1-(rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14])); trainlisttest.list[code].status = '03';
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) { trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) { trainlisttest.list[code].nextcurve = null;
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}
} else {
if(data.body[i].speed > 0){
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}else if(data.body[i].speed < 0){
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
}
}
trainlisttest.list[code].rotation.y = Math.PI;
} }
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
}
// console.log(data.body[i].directionType);
// console.log(data.body[i].linkCode);
// console.log(rails.linkrail[data.body[i].linkCode].lengthfact);
// console.log(rails.linkrail[data.body[i].linkCode].lconnect);
// console.log(rails.linkrail[data.body[i].linkCode].rconnect);
// console.log("--------------------");
// console.log(rails.linkrail[rails.linkrail[data.body[i].linkCode].lconnect].lconnect);
// console.log(rails.linkrail[rails.linkrail[data.body[i].linkCode].lconnect].rconnect);
// console.log("---------------------");
// console.log(trainlisttest.list[code].curve.points);
// console.log(rails.linkrail[nextcode].lineleft.points);
// console.log("***********************");
// console.log(rails.linkrail[nextcode].lineleft.points);
if(code == drivingcode){
let nextcode;
if(data.body[i].directionType == '02'){
trainlisttest.list[code].status = '02';
nextcode = rails.linkrail[data.body[i].linkCode].rconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
}
}else if(data.body[i].directionType == '03'){
trainlisttest.list[code].status = '03'; trainlisttest.list[code].status = '03';
} nextcode = rails.linkrail[data.body[i].linkCode].lconnect;
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist); if(nextcode){
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack; trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance; trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
}
trainlisttest.list[code].speed = data.body[i].speed;
if(data.body[i].speed>0){
trainlisttest.list[code].progress = 0;
}else if(data.body[i].speed<0){
trainlisttest.list[code].progress = 0.999;
} }
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len); trainlisttest.list[code].nextcode = nextcode;
// console.log(trainlisttest.list[code].nowcode);
// console.log(trainlisttest.list[code].nextcode);
// console.log(trainlisttest.list[code].curve.points);
// console.log(trainlisttest.list[code].nextcurve.points);
// console.log("=========================");
}else{
let nextcode;
if(data.body[i].directionType == '02'){
if(rails.linkrail[data.body[i].linkCode].lineleft){
trainlisttest.list[code].status = '02';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/21/trainlisttest.list[code].len);
}
}else if(data.body[i].directionType == '03'){
if(rails.linkrail[data.body[i].linkCode].lineright){
trainlisttest.list[code].status = '03';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
trainlisttest.list[code].progress = 1-data.body[i].linkOffsetPercent;
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/21/trainlisttest.list[code].len);
}
}
trainlisttest.list[code].nextcode = nextcode;
} }
// console.log(data.body[i].linkOffsetPercent);
// console.log(trainlisttest.list[code].progress);
// console.log(trainlisttest.list[code].curve.points);
// console.log(trainlisttest.list[code].nextcurve.points);
// console.log(trainlisttest.list[code].len);
// console.log(trainlisttest.list[code].nextlen);
// console.log("==========================================");
} }
} }
} }
@ -734,9 +685,11 @@ export function Jl3dDriving(updatemmi,sound) {
function switchupdate(data) { function switchupdate(data) {
code = data.code; code = data.code;
for (let j=sectionlist.switchs.modellist.length-1; j>=0; j--) { for (let j=sectionlist.switchs.modellist.length-1; j>=0; j--) {
if (sectionlist.switchs.modellist[j].code == code) { if (rails.switchrail[code]) {
if (sectionlist.switchs.modellist[j].locateType != data.locateType) { if (rails.switchrail[code].locateType != data.locateType) {
// console.log("道岔变化:"+code);
if (data.locateType == '02') { if (data.locateType == '02') {
// console.log("02 反位");
if (actions[sectionlist.switchs.modellist[j].code]) { if (actions[sectionlist.switchs.modellist[j].code]) {
sectionlist.switchs.modellist[j].locateType = data.locateType; sectionlist.switchs.modellist[j].locateType = data.locateType;
actions[sectionlist.switchs.modellist[j].code].reset(); actions[sectionlist.switchs.modellist[j].code].reset();
@ -744,7 +697,26 @@ export function Jl3dDriving(updatemmi,sound) {
actions[sectionlist.switchs.modellist[j].code].timeScale = 1; actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
actions[sectionlist.switchs.modellist[j].code].play(); actions[sectionlist.switchs.modellist[j].code].play();
} }
rails.switchrail[code].locateType = "02";
let testswitch = rails.switchrail[code];
if(rails.switchrail[code].directtype == "1"){
// console.log("道岔朝向1向左");
// console.log("aleft:"+testswitch.clink);
// console.log("cright:"+testswitch.alink);
rails.linkrail[testswitch.alink].lconnect = testswitch.clink;
rails.linkrail[testswitch.clink].rconnect = testswitch.alink;
}else if(rails.switchrail[code].directtype == "2"){
// console.log("道岔朝向2向右");
// console.log("aright:"+testswitch.clink);
// console.log("cleft:"+testswitch.alink);
rails.linkrail[testswitch.alink].rconnect = testswitch.clink;
rails.linkrail[testswitch.clink].lconnect = testswitch.alink;
}
} else if (data.locateType == '01') { } else if (data.locateType == '01') {
// console.log("01 定位");
if (actions[sectionlist.switchs.modellist[j].code]) { if (actions[sectionlist.switchs.modellist[j].code]) {
sectionlist.switchs.modellist[j].locateType = data.locateType; sectionlist.switchs.modellist[j].locateType = data.locateType;
actions[sectionlist.switchs.modellist[j].code].reset(); actions[sectionlist.switchs.modellist[j].code].reset();
@ -752,6 +724,23 @@ export function Jl3dDriving(updatemmi,sound) {
actions[sectionlist.switchs.modellist[j].code].timeScale = -1; actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
actions[sectionlist.switchs.modellist[j].code].play(); actions[sectionlist.switchs.modellist[j].code].play();
} }
rails.switchrail[code].locateType = "01";
let testswitch = rails.switchrail[code];
if(rails.switchrail[code].directtype == "1"){
// console.log("道岔朝向1向左");
// console.log("aleft"+testswitch.blink);
// console.log("cright:"+testswitch.alink);
rails.linkrail[testswitch.alink].lconnect = testswitch.blink;
rails.linkrail[testswitch.blink].rconnect = testswitch.alink;
}else if(rails.switchrail[code].directtype == "2"){
// console.log("道岔朝向2向右");
// console.log("aright:"+testswitch.blink);
// console.log("cleft:"+testswitch.alink);
rails.linkrail[testswitch.alink].rconnect = testswitch.blink;
rails.linkrail[testswitch.blink].lconnect = testswitch.alink;
}
} }
} }
j = 0; j = 0;

View File

@ -4,7 +4,7 @@ export function UpdateTrain(camera,traindata,control){
for(let j=traindata.group.children.length-1;j>=0;j--){ for(let j=traindata.group.children.length-1;j>=0;j--){
//判断是否有移动事件 //判断是否有移动事件
//if(traindata.group.children[j].dispose == false){ if(traindata.group.children[j].dispose == false){
if(traindata.group.children[j].progress != null){ if(traindata.group.children[j].progress != null){
@ -12,22 +12,26 @@ export function UpdateTrain(camera,traindata,control){
if(trainmodel.speeds > 0 && trainmodel.speeds){ if(trainmodel.speeds > 0 && trainmodel.speeds){
let speed = null; let speed = null;
if(traindata.group.children[j].progress<1){ if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){
let movecurve = trainmodel.curve; let movecurve = trainmodel.curve;
if(trainmodel.status == "03"){ if(trainmodel.status == "03"){
if(movecurve.points.length>1){ if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[j].progress); let point = movecurve.getPointAt(traindata.group.children[j].progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.001){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0); 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[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = { let rotas = {
posr:point, posr:point,
rota:trainmodel.children[0].rotation.y rota:trainmodel.children[0].rotation.z
} }
trainmodel.children[1].rotalist.push(rotas); trainmodel.children[1].rotalist.push(rotas);
@ -48,7 +52,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz; trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){ for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-38)<=trainmodel.children[rs].rotalist[0].posr.x){ if((trainmodel.children[rs].matrixWorld.elements[12]-6)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){ if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0]; let asd = trainmodel.children[rs].rotalist[0];
@ -56,7 +60,7 @@ export function UpdateTrain(camera,traindata,control){
} }
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota; trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1) trainmodel.children[rs].rotalist.splice(0,1)
xh--; xh--;
}else{ }else{
@ -74,16 +78,19 @@ export function UpdateTrain(camera,traindata,control){
if(trainmodel.status == "02"){ if(trainmodel.status == "02"){
if(movecurve.points.length>1){ if(movecurve.points.length>1){
let point = movecurve.getPointAt(trainmodel.progress); let point = movecurve.getPointAt(trainmodel.progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.001){
trainmodel.children[0].up = new THREE.Vector3(1,0,0); 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[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = { let rotas = {
posr:point, posr:point,
rota:trainmodel.children[0].rotation.y rota:trainmodel.children[0].rotation.z
} }
trainmodel.children[1].rotalist.push(rotas); trainmodel.children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]); let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]);
@ -103,7 +110,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz; trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){ for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+38)>=trainmodel.children[rs].rotalist[0].posr.x){ if((trainmodel.children[rs].matrixWorld.elements[12]+6)>=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){ if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0]; let asd = trainmodel.children[rs].rotalist[0];
@ -112,7 +119,7 @@ export function UpdateTrain(camera,traindata,control){
} }
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12]; //let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota; trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1) trainmodel.children[rs].rotalist.splice(0,1)
xh--; xh--;
}else{ }else{
@ -127,32 +134,62 @@ export function UpdateTrain(camera,traindata,control){
} }
// console.log(trainmodel.rotalist); // console.log(trainmodel.rotalist);
} }
trainmodel.progress += trainmodel.speeds; 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/21/trainmodel.len);
trainmodel.curve = trainmodel.nextcurve;
trainmodel.nextcurve = null;
trainmodel.nextlen = null;
trainmodel.nextcode = null;
}
// console.log(trainmodel.name);
// console.log(trainmodel.progress);
// console.log(trainmodel.nextcurve);
// if(trainmodel.status == "02"){
// trainmodel.progress = 0;
// }else if(trainmodel.status == "03"){
// trainmodel.progress = 1;
// }
// trainmodel.curve = trainmodel.nextcurve;
} }
}else if(trainmodel.speeds < 0 && trainmodel.speeds){ }else if(trainmodel.speeds < 0 && trainmodel.speeds){
let speed = null; let speed = null;
if(traindata.group.children[j].progress<1){ if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){
let movecurve = trainmodel.curve; let movecurve = trainmodel.curve;
if(trainmodel.status == "03" && trainmodel.progress>0){ if(trainmodel.status == "03" && trainmodel.progress>0){
if(movecurve.points.length>1){ if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[j].progress); let point = movecurve.getPointAt(traindata.group.children[j].progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){ if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.01){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0); 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[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = { let rotas = {
posr:point, posr:point,
rota:trainmodel.children[0].rotation.y rota:trainmodel.children[0].rotation.z
} }
trainmodel.children[1].rotalist.push(rotas); trainmodel.children[1].rotalist.push(rotas);
@ -173,7 +210,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz; trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){ for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-38)<=trainmodel.children[rs].rotalist[0].posr.x){ if((trainmodel.children[rs].matrixWorld.elements[12]-6)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){ if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0]; let asd = trainmodel.children[rs].rotalist[0];
@ -181,7 +218,7 @@ export function UpdateTrain(camera,traindata,control){
} }
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota; trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1) trainmodel.children[rs].rotalist.splice(0,1)
xh--; xh--;
}else{ }else{
@ -203,16 +240,18 @@ export function UpdateTrain(camera,traindata,control){
if(movecurve.points.length>1 && trainmodel.progress>0){ if(movecurve.points.length>1 && trainmodel.progress>0){
let point = movecurve.getPointAt(trainmodel.progress); let point = movecurve.getPointAt(trainmodel.progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){ if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.01){
trainmodel.children[0].up = new THREE.Vector3(1,0,0); 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[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = { let rotas = {
posr:point, posr:point,
rota:trainmodel.children[0].rotation.y rota:trainmodel.children[0].rotation.z
} }
trainmodel.children[1].rotalist.push(rotas); trainmodel.children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]); let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]);
@ -232,7 +271,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz; trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){ for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+38)>=trainmodel.children[rs].rotalist[0].posr.x){ if((trainmodel.children[rs].matrixWorld.elements[12]+6)>=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){ if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0]; let asd = trainmodel.children[rs].rotalist[0];
@ -241,7 +280,7 @@ export function UpdateTrain(camera,traindata,control){
} }
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12]; //let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota; trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1) trainmodel.children[rs].rotalist.splice(0,1)
xh--; xh--;
}else{ }else{
@ -257,7 +296,7 @@ export function UpdateTrain(camera,traindata,control){
// console.log(trainmodel.rotalist); // console.log(trainmodel.rotalist);
} }
console.log(trainmodel.nextcurve);
if(trainmodel.progress > -(trainmodel.speeds)){ if(trainmodel.progress > -(trainmodel.speeds)){
trainmodel.progress += trainmodel.speeds; trainmodel.progress += trainmodel.speeds;
} }
@ -269,7 +308,7 @@ export function UpdateTrain(camera,traindata,control){
} }
//} }
} }

View File

@ -19,6 +19,9 @@ export function Jlmap3dSubscribe(jlmap3d) {
var sectionlist = null; var sectionlist = null;
var materials = null; var materials = null;
var actions = null; var actions = null;
var rails = null;
var links = null;
var scenes = null; var scenes = null;
var code = null; var code = null;
@ -52,6 +55,8 @@ export function Jlmap3dSubscribe(jlmap3d) {
materials = materiallist; materials = materiallist;
scenes = scene; scenes = scene;
actions = nowaction; actions = nowaction;
links = this.map.linklist;
rails = this.map.rails;
}; };
@ -111,11 +116,11 @@ export function Jlmap3dSubscribe(jlmap3d) {
if (trainlisttest.list[code].isStandTrack == true) { if (trainlisttest.list[code].isStandTrack == true) {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/17/trainlisttest.list[code].len); trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/17/trainlisttest.list[code].len);
} else { } else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len); trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
} }
} else { } else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len); trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
} }
if (code == drivingcode) { if (code == drivingcode) {
@ -150,30 +155,31 @@ export function Jlmap3dSubscribe(jlmap3d) {
if ( trainlisttest.list[code]) { if ( trainlisttest.list[code]) {
if (code == drivingcode) { if (code == drivingcode) {
driverswitch = data.body[i].runMode; driverswitch = data.body[i].runMode;
//更新车组号
jlmap3d.updatetrainnum(data.body[i].groupNumber); jlmap3d.updatetrainnum(data.body[i].groupNumber);
// console.log(trainlisttest.list[code].progress); //更新列车
const syncdata = { let syncdata = {
type: 'Train', type: 'Train',
code: code, code: code,
sectionCode: data.body[i].sectionCode, sectionCode: data.body[i].sectionCode,
percent: 0 percent: 0
}; };
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) { // if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
if (data.body[i].directionType == '02') { // if (data.body[i].directionType == '02') {
syncdata.percent = 1-(sectionlist.sections.datalist[data.body[i].sectionCode].rstop/trainlisttest.list[code].len); // syncdata.percent = 1-(sectionlist.sections.datalist[data.body[i].sectionCode].rstop/trainlisttest.list[code].len);
} else { // } else {
syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len; // syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len;
} // }
scope.teststomp.send('/app/topic/simulation/client/drive', syncdata); // scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
} else { // } else {
if (data.body[i].directionType == '02') { // if (data.body[i].directionType == '02') {
syncdata.percent = trainlisttest.list[code].progress; // syncdata.percent = trainlisttest.list[code].progress;
} else { // } else {
syncdata.percent = 1 - trainlisttest.list[code].progress; // syncdata.percent = 1 - trainlisttest.list[code].progress;
} // }
scope.teststomp.send('/app/topic/simulation/client/drive', syncdata); // scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
} // }
if (data.body[i].parkRemainTime>0) { if (data.body[i].parkRemainTime>0) {
jlmap3d.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime)); jlmap3d.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime));
@ -181,21 +187,21 @@ export function Jlmap3dSubscribe(jlmap3d) {
if (data.body[i].runMode == '02') { if (data.body[i].runMode == '02') {
jlmap3d.updatestoptime('列车自动驾驶中'); jlmap3d.updatestoptime('列车自动驾驶中');
} else { } else {
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) { // if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
// if(stoptimer){ // // if(stoptimer){
// // //
// }else{ // // }else{
// stoptimer = setInterval(function(){ // // stoptimer = setInterval(function(){
// if(num >=0){ // // if(num >=0){
// jlmap3d.updatestoptime("停站时间:"+num); // // jlmap3d.updatestoptime("停站时间:"+num);
// num --; // // num --;
// } // // }
// },1000); // // },1000);
// } // // }
//
} else { // } else {
jlmap3d.updatestoptime('列车人工驾驶中'); // jlmap3d.updatestoptime('列车人工驾驶中');
} // }
} }
} }
@ -252,106 +258,53 @@ export function Jlmap3dSubscribe(jlmap3d) {
// } // }
// } // }
// 遍历获取所在轨道 // 遍历获取所在轨道
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) { if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) { if (rails.linkrail[data.body[i].linkCode]) {
trainlisttest.group.add(trainlisttest.list[code]); trainlisttest.group.add(trainlisttest.list[code]);
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
trainlisttest.list[code].progress = 0; trainlisttest.list[code].progress = 0;
trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent; trainlisttest.list[code].oldoffset = data.body[i].linkOffsetPercent;
trainlisttest.list[code].dispose = false; trainlisttest.list[code].dispose = false;
trainlisttest.list[code].nowcode = data.body[i].sectionCode; trainlisttest.list[code].nowcode = data.body[i].linkCode;
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode; trainlisttest.list[code].nextcode = rails.linkrail[data.body[i].linkCode].next;
let vexlist = []; let vexlist = [];
let endrotation = null;
if (data.body[i].directionType == '02') { // 向右 if (data.body[i].directionType == '02') { // 向右
let offset = null; let point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(data.body[i].linkOffsetPercent);
let rotaposx = null;
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
} else {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
}
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z;
trainlisttest.list[code].rotation.y = 0; trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = rotaposx; trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz; trainlisttest.list[code].children[tl].position.z = point.z;
} }
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>rotaposx) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>rotaposx) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}
trainlisttest.list[code].status = '02'; trainlisttest.list[code].status = '02';
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
} else if (data.body[i].directionType == '03') { // 向左 } else if (data.body[i].directionType == '03') { // 向左
let point = rails.linkrail[data.body[i].linkCode].lineright.getPointAt((1-data.body[i].linkOffsetPercent));
trainlisttest.list[code].dispose = false;
trainlisttest.group.add(trainlisttest.list[code]);
let offset = null;
let rotaposx = null;
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
} else {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
}
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z;
trainlisttest.list[code].rotation.y = Math.PI; trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = rotaposx; trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = -rotaposz; trainlisttest.list[code].children[tl].position.z = -point.z;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<rotaposx) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<rotaposx) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} }
// if(trainlisttest.list[code].rname == "006"){
// console.log("0000000000000000");
// console.log(data.body[i].linkOffsetPercent);
// }
trainlisttest.list[code].status = '03'; trainlisttest.list[code].status = '03';
trainlisttest.list[code].progress = 1-data.body[i].linkOffsetPercent;
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
} }
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack; trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
trainlisttest.list[code].progress = 0; // trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
// trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
if(data.body[i].speed == 0){ if(data.body[i].speed == 0){
@ -360,7 +313,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
// trainlisttest.list[code].startmark = 1; // trainlisttest.list[code].startmark = 1;
}else{ }else{
trainlisttest.list[code].speeds = data.body[i].speed; trainlisttest.list[code].speeds = data.body[i].speed;
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len); trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/21/trainlisttest.list[code].len);
} }
} }
@ -377,7 +330,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) { } else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) { if (rails.linkrail[data.body[i].linkCode]) {
if (driverswitch == '02' && code == drivingcode) { if (driverswitch == '02' && code == drivingcode) {
jlmap3d.updatenowspeed(data.body[i].speed); jlmap3d.updatenowspeed(data.body[i].speed);
if (data.body[i].atpSpeed) { if (data.body[i].atpSpeed) {
@ -415,13 +368,11 @@ export function Jlmap3dSubscribe(jlmap3d) {
jlmap3d.updatenowlen(0); jlmap3d.updatenowlen(0);
} }
} }
if(trainlisttest.list[code].nowcode != data.body[i].linkCode){
if (trainlisttest.list[code].nowcode != data.body[i].sectionCode || trainlisttest.list[code].nextcode != data.body[i].nextSectionCode) { trainlisttest.list[code].nowcode = data.body[i].linkCode;
trainlisttest.list[code].nowcode = data.body[i].sectionCode; trainlisttest.list[code].nextcode = rails.linkrail[data.body[i].linkCode].next;
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
const vexlist = [];
const endrotation = null;
if (data.body[i].directionType == '02') { // 向右 if (data.body[i].directionType == '02') { // 向右
trainlisttest.list[code].progress = 0;
if (trainlisttest.list[code].status != data.body[i].directionType) { if (trainlisttest.list[code].status != data.body[i].directionType) {
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12]; const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14]; const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
@ -430,81 +381,52 @@ export function Jlmap3dSubscribe(jlmap3d) {
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz; trainlisttest.list[code].children[tl].position.z = rotaposz;
} }
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14])); trainlisttest.list[code].progress = (rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}
} else {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
trainlisttest.list[code].rotation.y = 0;
} }
trainlisttest.list[code].status = '02'; trainlisttest.list[code].status = '02';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
} else if (data.body[i].directionType == '03') { // 向左 } else if (data.body[i].directionType == '03') { // 向左
trainlisttest.list[code].progress = 0;
if (trainlisttest.list[code].status != data.body[i].directionType) { if (trainlisttest.list[code].status != data.body[i].directionType) {
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12]; const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]); const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
trainlisttest.list[code].rotation.y = Math.PI; trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = rotaposx; trainlisttest.list[code].position.x = rotaposx;
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz; trainlisttest.list[code].children[tl].position.z = -rotaposz;
} }
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { trainlisttest.list[code].progress = 1-(rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}
} else {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
trainlisttest.list[code].rotation.y = Math.PI;
} }
trainlisttest.list[code].status = '03';
}
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
trainlisttest.list[code].progress = 0;
trainlisttest.list[code].speed = data.body[i].speed;
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
trainlisttest.list[code].status = '03';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
}
// console.log(rails.linkrail[data.body[i].linkCode]);
// console.log(data.body[i].linkCode)
// console.log(nextcode);
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
} }
if(data.body[i].directionType == '02'){
let nextcode = rails.linkrail[data.body[i].linkCode].rconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
}
}else if(data.body[i].directionType == '03'){
let nextcode = rails.linkrail[data.body[i].linkCode].lconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
}
}
} }
} }
} }
@ -514,6 +436,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
} }
if (data.type == 'Simulation_DeviceStatus') { if (data.type == 'Simulation_DeviceStatus') {
for (let i=data.body.length-1; i>=0; i--) { for (let i=data.body.length-1; i>=0; i--) {
// 0xFFFFFF // 0xFFFFFF
// 0xCD0000 红 // 0xCD0000 红
@ -663,8 +586,8 @@ export function Jlmap3dSubscribe(jlmap3d) {
function switchupdate(data) { function switchupdate(data) {
code = data.code; code = data.code;
for (let j=sectionlist.switchs.modellist.length-1; j>=0; j--) { for (let j=sectionlist.switchs.modellist.length-1; j>=0; j--) {
if (sectionlist.switchs.modellist[j].code == code) { if (rails.switchrail[code]) {
if (sectionlist.switchs.modellist[j].locateType != data.locateType) { if (rails.switchrail[code].locateType != data.locateType) {
if (data.locateType == '02') { if (data.locateType == '02') {
if (actions[sectionlist.switchs.modellist[j].code]) { if (actions[sectionlist.switchs.modellist[j].code]) {
sectionlist.switchs.modellist[j].locateType = data.locateType; sectionlist.switchs.modellist[j].locateType = data.locateType;
@ -673,6 +596,21 @@ export function Jlmap3dSubscribe(jlmap3d) {
actions[sectionlist.switchs.modellist[j].code].timeScale = 1; actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
actions[sectionlist.switchs.modellist[j].code].play(); actions[sectionlist.switchs.modellist[j].code].play();
} }
rails.switchrail[code].locateType = "02";
let testswitch = rails.switchrail[code];
// console.log(testswitch);
// console.log(rails.linkrail[testswitch.alink]);
// console.log(rails.linkrail[testswitch.clink]);
if(rails.switchrail[code].directtype == "1"){
rails.linkrail[testswitch.alink].lconnect = testswitch.clink;
rails.linkrail[testswitch.clink].rconnect = testswitch.alink;
}else if(rails.switchrail[code].directtype == "2"){
rails.linkrail[testswitch.alink].rconnect = testswitch.clink;
rails.linkrail[testswitch.clink].lconnect = testswitch.alink;
}
} else if (data.locateType == '01') { } else if (data.locateType == '01') {
if (actions[sectionlist.switchs.modellist[j].code]) { if (actions[sectionlist.switchs.modellist[j].code]) {
sectionlist.switchs.modellist[j].locateType = data.locateType; sectionlist.switchs.modellist[j].locateType = data.locateType;
@ -681,6 +619,20 @@ export function Jlmap3dSubscribe(jlmap3d) {
actions[sectionlist.switchs.modellist[j].code].timeScale = -1; actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
actions[sectionlist.switchs.modellist[j].code].play(); actions[sectionlist.switchs.modellist[j].code].play();
} }
rails.switchrail[code].locateType = "01";
let testswitch = rails.switchrail[code];
console.log(testswitch);
console.log(rails.linkrail[testswitch.alink]);
console.log(rails.linkrail[testswitch.clink]);
if(rails.switchrail[code].directtype == "1"){
rails.linkrail[testswitch.alink].lconnect = testswitch.blink;
rails.linkrail[testswitch.blink].rconnect = testswitch.alink;
}else if(rails.switchrail[code].directtype == "2"){
rails.linkrail[testswitch.alink].rconnect = testswitch.blink;
rails.linkrail[testswitch.blink].lconnect = testswitch.alink;
}
} }
} }
j = 0; j = 0;

View File

@ -17,7 +17,6 @@ import { SetRender } from '@/jlmap3d/config/SetRender';
import { SetScene } from '@/jlmap3d/config/SetScene'; import { SetScene } from '@/jlmap3d/config/SetScene';
import { SetLights } from '@/jlmap3d/config/SetLights'; import { SetLights } from '@/jlmap3d/config/SetLights';
//controls //controls
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls'; import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { DragControls } from '@/jlmap3d/main/control/DragControls'; import { DragControls } from '@/jlmap3d/main/control/DragControls';
@ -29,15 +28,15 @@ import {Jlmap3dSubscribe } from '@/jlmap3d/jl3dsimulation/connect/TrainingConnec
import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata'; import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
//utils //utils
import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrain'; // import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrain';
//import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrainTest'; import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrainTest';
// import { ReStart } from '@/jlmap3d/main/utils/ReStart'; // import { ReStart } from '@/jlmap3d/main/utils/ReStart';
import {Stats} from '@/jlmap3d/main/lib/stats.min.js'; import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
var clock = new THREE.Clock(); var clock = new THREE.Clock();
export function JLmap3d(dom, data,skinCode) { export function JLmap3d(dom, data,skinCode,storemod) {
let scope = this; let scope = this;
@ -55,7 +54,6 @@ export function JLmap3d(dom, data,skinCode) {
//定义场景(渲染容器) //定义场景(渲染容器)
let scene = SetScene(); let scene = SetScene();
//定义镜头操作 //定义镜头操作
console.log(THREE.OrbitControls);
let controls = new THREE.OrbitControls(camera); let controls = new THREE.OrbitControls(camera);
controls.maxPolarAngle = Math.PI/2; controls.maxPolarAngle = Math.PI/2;
//controls.minPolarAngle = Math.PI/8; //controls.minPolarAngle = Math.PI/8;
@ -83,14 +81,13 @@ export function JLmap3d(dom, data,skinCode) {
this.Subscribe = new Jlmap3dSubscribe(this.webwork); this.Subscribe = new Jlmap3dSubscribe(this.webwork);
//连接到通信 //连接到通信
//console.log(this.Subscribe.config); //console.log(this.Subscribe.config);
//this.webwork.postMessage(this.Subscribe.teststomp); //this.webwork.postMessage(this.Subscribe.teststomp);
this.Subscribe.socketon(scope.Subscribe.topic); this.Subscribe.socketon(scope.Subscribe.topic);
//初始化加载数据和模型 //初始化加载数据和模型
getPublish3dMapDetail(skinCode).then(netdata => { getPublish3dMapDetail(skinCode).then(netdata => {
ModelLoad(data,scope,netdata.data,mapdata,camera,controls,scene); ModelLoad(data,scope,netdata.data,mapdata,camera,controls,scene,storemod);
}); });
// //
// let stats = new Stats(); // let stats = new Stats();

View File

@ -142,7 +142,7 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
// _movemesh.geometry.computeBoundingBox(); // _movemesh.geometry.computeBoundingBox();
_movemesh.geometry.computeBoundingSphere(); _movemesh.geometry.computeBoundingSphere();
_movemesh.geometry.center(); _movemesh.geometry.center();
_movemesh.lengthfact = (_movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]])*2+20.5; _movemesh.lengthfact = (_movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]])*2+28;
// testmesh2.position.z = 50; // testmesh2.position.z = 50;
// testmesh2.geometry.center(); // testmesh2.geometry.center();

View File

@ -9,7 +9,7 @@ let defaultsignal = {
deviceType:"signal", deviceType:"signal",
type:"low", type:"low",
picUrl:"", picUrl:"",
assetUrl:"https://joylink.club/oss/models/signal/d3d.FBX" assetUrl:"https://test.joylink.club/oss/models/signal/d3d.FBX"
} }
let defaulttrain = { let defaulttrain = {
@ -18,7 +18,7 @@ let defaulttrain = {
deviceType:"train", deviceType:"train",
type:"num4", type:"num4",
picUrl:"", picUrl:"",
assetUrl:"https://joylink.club/oss/models/train/train.FBX" assetUrl:"https://test.joylink.club/oss/models/train/train.FBX"
} }
@ -28,8 +28,10 @@ let defaultstation = {
deviceType:"stand", deviceType:"stand",
type:"num4", type:"num4",
picUrl:"", picUrl:"",
assetUrl:"../../static/model/station/fuzhou.FBX" assetUrl:"https://test.joylink.club/oss/models/station/fuzhou/fuzhou.FBX"
}//https://joylink.club/oss/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 //../../static/model/station/zhantai715(2).FBX
let defaultswitch = { let defaultswitch = {
@ -38,7 +40,7 @@ let defaultswitch = {
deviceType:"switch", deviceType:"switch",
type:"fuzhou", type:"fuzhou",
picUrl:"", picUrl:"",
assetUrl:"../../static/model/daocha/daocha.FBX" assetUrl:"https://test.joylink.club/oss/models/daocha/daocha.FBX"
} }
let defaultdriver = { let defaultdriver = {
@ -56,8 +58,10 @@ let defaultsuidao = {
deviceType:"suidao", deviceType:"suidao",
type:"suidao", type:"suidao",
picUrl:"", picUrl:"",
assetUrl:"https://joylink.club/oss/models/suidao/suidao.FBX" assetUrl:"https://test.joylink.club/oss/models/suidao/suidao.FBX"
}//https://joylink.club/oss/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/
let defaultautorail = { let defaultautorail = {
@ -75,7 +79,7 @@ let defaultautosuidao = {
deviceType:"autosuidao", deviceType:"autosuidao",
type:"autosuidao", type:"autosuidao",
picUrl:"", picUrl:"",
assetUrl:"../../static/model/auto/suidao.FBX" assetUrl:"https://test.joylink.club/oss/models/auto/suidao.FBX"
} }
let autoswitch1 = { let autoswitch1 = {
@ -84,7 +88,7 @@ let autoswitch1 = {
deviceType:"autoswitch1", deviceType:"autoswitch1",
type:"fuzhou", type:"fuzhou",
picUrl:"", picUrl:"",
assetUrl:"../../static/model/auto/switch1.FBX" assetUrl:"https://test.joylink.club/oss/models/auto/switch1.FBX"
} }
let autoswitch2 = { let autoswitch2 = {
@ -93,7 +97,7 @@ let autoswitch2 = {
deviceType:"autoswitch2", deviceType:"autoswitch2",
type:"fuzhou", type:"fuzhou",
picUrl:"", picUrl:"",
assetUrl:"../../static/model/auto/switch2.FBX" assetUrl:"https://test.joylink.club/oss/models/auto/switch2.FBX"
} }
export function AssetLoader(){ export function AssetLoader(){
@ -107,7 +111,7 @@ export function AssetLoader(){
this.materiallist = []; this.materiallist = [];
//初始化资源加载器 //初始化资源加载器
this.setmodellist = function (data){ this.setmodellist = function (data){
// console.log("setmodellist");
let defaultmodel1 = new AssetModel(defaultsignal); let defaultmodel1 = new AssetModel(defaultsignal);
scope.modellist.push(defaultmodel1); scope.modellist.push(defaultmodel1);
@ -129,7 +133,6 @@ export function AssetLoader(){
let defaultswitch2 = new AssetModel(autoswitch2); let defaultswitch2 = new AssetModel(autoswitch2);
scope.modellist.push(defaultswitch2); scope.modellist.push(defaultswitch2);
let modeldata = JSON.parse(data); let modeldata = JSON.parse(data);
for(let j=0;j<modeldata.length;j++){ for(let j=0;j<modeldata.length;j++){
@ -444,10 +447,9 @@ export function AssetLoader(){
var loader = new THREE.FBXLoader(); var loader = new THREE.FBXLoader();
loader.load( asset.assetUrl, function ( object ) { loader.load( asset.assetUrl, function ( object ) {
let mixer = new THREE.AnimationMixer( object ); let mixer = new THREE.AnimationMixer( object );
// object.traverse(function (node) {//获取其中对象 //object.traverse(function (node) {//获取其中对象
// node.frustumCulled = true; // node.frustumCulled = true;
// //});
// });
if(asset.deviceType == "train"){ if(asset.deviceType == "train"){
@ -456,7 +458,7 @@ export function AssetLoader(){
let name = "c"+j; let name = "c"+j;
for(let i=0;i<object.children.length;i++){ for(let i=0;i<object.children.length;i++){
if(object.children[i].name == name){ if(object.children[i].name == name){
object.children[i].position.x = object.children[i].position.x+38.1; object.children[i].position.x = object.children[i].position.x;
//object.children[i].position.y = j*10; //object.children[i].position.y = j*10;
realtrain.add(object.children[i]); realtrain.add(object.children[i]);
i--; i--;

View File

@ -4,13 +4,15 @@ import {SignalList} from '@/jlmap3d/main/model/SignalList.js';
import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js'; import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js';
import {TrainList} from '@/jlmap3d/main/model/TrainList.js'; import {TrainList} from '@/jlmap3d/main/model/TrainList.js';
import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js'; import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js';
import {LinkList} from '@/jlmap3d/main/model/LinkList.js';
import {RailList} from '@/jlmap3d/main/model/RailList.js';
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js'; import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { Loading } from 'element-ui'; import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js'; // import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,storemod){
//console.log(mapdata); //console.log(mapdata);
Materialload(scope); Materialload(scope);
//console.log(data); //console.log(data);
@ -28,13 +30,13 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
let isSection = false; let isSection = false;
if(netdata.assets){ if(netdata.assets){
let assetsdata = JSON.parse(netdata.assets); let assetsdata = JSON.parse(netdata.sections);
for(let i=0;i<assetsdata.length;i++){ if(assetsdata.link){
if(assetsdata[i].deviceType == "mapSection"){ isSection = true;
isSection = true;
}
} }
} }
if(isSection == true){ if(isSection == true){
init3d(data,netdata); init3d(data,netdata);
}else{ }else{
@ -48,7 +50,9 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
// console.log(data); // console.log(data);
//初始化轨道和道岔 暂时 //初始化轨道和道岔 暂时
lengthfact(data); lengthfact(data);
jlmap3ddata.linklist = new LinkList();
jlmap3ddata.sectionlist = new SectionList(); jlmap3ddata.sectionlist = new SectionList();
//初始化信号机
jlmap3ddata.signallist = new SignalList(); jlmap3ddata.signallist = new SignalList();
//初始化站台 //初始化站台
jlmap3ddata.stationstandlist = new StationStandList(); jlmap3ddata.stationstandlist = new StationStandList();
@ -56,10 +60,19 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
jlmap3ddata.trainlisttest = new TrainList(); jlmap3ddata.trainlisttest = new TrainList();
jlmap3ddata.realsectionlist = new RealSectionList(); jlmap3ddata.realsectionlist = new RealSectionList();
jlmap3ddata.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);
// console.log(netdata.assets);
assetloader.setmodellist(netdata.assets); assetloader.setmodellist(netdata.assets);
assetloader.assetpromise(sceneload) assetloader.assetpromise(sceneload)
.then(function(data){
//console.log(data);
return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader);
})
.then(function(data){ .then(function(data){
//console.log(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);
@ -71,53 +84,31 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
}) })
.then(function(data){ .then(function(data){
//console.log(data); //console.log(data);
return jlmap3ddata.sectionlist.initpromise(mapdata.sectionList,mapdata.switchList,sceneload); return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,sceneload);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
}) })
// .then(function(data){
// //console.log(data);
// return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
// })
.then(function(data){ .then(function(data){
//console.log(data); //console.log(data);
return jlmap3ddata.signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals); return jlmap3ddata.signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
}) })
.then(function(data){ .then(function(data){
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
jlmap3ddata.rails.init(loaderdata.link,switchdata,sceneload,storemod);
let loader = new THREE.OBJLoader( ); resolve("loadrail");
loader.load( '../../static/rail/fuzhoupath.obj', function ( obj ) {
let object = obj;
//console.log(object.children.length);
let rail = [];
for(let i=0;i<object.children.length;i++){
let name = object.children[i].name.split("_");
let newmeshname = name[0]+"_"+name[1]+"_"+name[2]+"."+name[3];
let vexlist = [];
//console.log( object.children[i].geometry.attributes.position.array);
for(let j=0;j<object.children[i].geometry.attributes.position.array.length;j){
//console.log(object.children[i].geometry.attributes.position.array[j]);
let ved = new THREE.Vector3( object.children[i].geometry.attributes.position.array[j], object.children[i].geometry.attributes.position.array[j+1], object.children[i].geometry.attributes.position.array[j+2] );
j=j+3;
vexlist.push(ved);
}
if(jlmap3ddata.sectionlist.sections.datalist[newmeshname].code){
jlmap3ddata.sectionlist.sections.datalist[newmeshname].rail = vexlist;
//console.log(jlmap3ddata.sectionlist.sections.datalist[n].rail.length);
}
}
resolve("loadedrealsection");
}, onProgress, onError );
}); });
}) })
.then(function(data){ .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);
// }
// }
scope.animateswitch = true; scope.animateswitch = true;

View File

@ -4,13 +4,15 @@ import {SignalList} from '@/jlmap3d/main/model/SignalList.js';
import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js'; import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js';
import {TrainList} from '@/jlmap3d/main/model/TrainList.js'; import {TrainList} from '@/jlmap3d/main/model/TrainList.js';
import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js'; import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js';
import {LinkList} from '@/jlmap3d/main/model/LinkList.js';
import {RailList} from '@/jlmap3d/main/model/RailList.js';
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js'; import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { Loading } from 'element-ui'; import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js'; // import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixerss){ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixerss,storemod){
//console.log(mapdata); //console.log(mapdata);
Materialload(scope); Materialload(scope);
//console.log(data); //console.log(data);
@ -27,12 +29,12 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
let isSection = false; let isSection = false;
if(netdata.assets){ if(netdata.assets){
let assetsdata = JSON.parse(netdata.assets); let assetsdata = JSON.parse(netdata.sections);
for(let i=0;i<assetsdata.length;i++){ // console.log(netdata);
if(assetsdata[i].deviceType == "mapSection"){ if(assetsdata.link){
isSection = true; isSection = true;
}
} }
} }
if(isSection == true){ if(isSection == true){
@ -48,6 +50,7 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
// console.log(data); // console.log(data);
//初始化轨道和道岔 暂时 //初始化轨道和道岔 暂时
lengthfact(data); lengthfact(data);
jlmap3ddata.linklist = new LinkList();
jlmap3ddata.sectionlist = new SectionList(); jlmap3ddata.sectionlist = new SectionList();
jlmap3ddata.signallist = new SignalList(); jlmap3ddata.signallist = new SignalList();
//初始化站台 //初始化站台
@ -56,10 +59,18 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
jlmap3ddata.trainlisttest = new TrainList(); jlmap3ddata.trainlisttest = new TrainList();
jlmap3ddata.realsectionlist = new RealSectionList(); jlmap3ddata.realsectionlist = new RealSectionList();
jlmap3ddata.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.setmodellist(netdata.assets);
assetloader.assetpromise(sceneload) assetloader.assetpromise(sceneload)
.then(function(data){
//console.log(data);
return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader);
})
.then(function(data){ .then(function(data){
//console.log(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);
@ -71,64 +82,34 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
}) })
.then(function(data){ .then(function(data){
//console.log(data); //console.log(data);
return jlmap3ddata.sectionlist.initpromise(mapdata.sectionList,mapdata.switchList,sceneload); return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,sceneload);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
}) })
// .then(function(data){
// //console.log(data);
// return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
// })
.then(function(data){ .then(function(data){
//console.log(data); //console.log(data);
return jlmap3ddata.signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals); return jlmap3ddata.signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
}) })
.then(function(data){ .then(function(data){
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
jlmap3ddata.rails.init(loaderdata.link,switchdata,sceneload,storemod);
let loader = new THREE.OBJLoader( ); resolve("loadrail");
loader.load( '../../static/rail/fuzhoupath.obj', function ( obj ) {
let object = obj;
//console.log(object.children.length);
let rail = [];
for(let i=0;i<object.children.length;i++){
let name = object.children[i].name.split("_");
let newmeshname = name[0]+"_"+name[1]+"_"+name[2]+"."+name[3];
let vexlist = [];
//console.log( object.children[i].geometry.attributes.position.array);
for(let j=0;j<object.children[i].geometry.attributes.position.array.length;j){
//console.log(object.children[i].geometry.attributes.position.array[j]);
let ved = new THREE.Vector3( object.children[i].geometry.attributes.position.array[j], object.children[i].geometry.attributes.position.array[j+1], object.children[i].geometry.attributes.position.array[j+2] );
j=j+3;
vexlist.push(ved);
}
if(jlmap3ddata.sectionlist.sections.datalist[newmeshname].code){
jlmap3ddata.sectionlist.sections.datalist[newmeshname].rail = vexlist;
//console.log(jlmap3ddata.sectionlist.sections.datalist[n].rail.length);
}
}
resolve("loadedrealsection");
}, onProgress, onError );
}); });
}) })
.then(function(data){
.then(function(data){
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){ for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "驾驶台"){
scope.assetloader.modellist[mn].mesh.position.y = -50000;
scene.add(scope.assetloader.modellist[mn].mesh);
}
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){ 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;
scene.add(scope.assetloader.modellist[mn].mesh); scene.add(scope.assetloader.modellist[mn].mesh);
} }
} }
scope.animateswitch = true; scope.animateswitch = true;
mapdata = jlmap3ddata; mapdata = jlmap3ddata;

View File

@ -0,0 +1,309 @@
export function LinkList(data){
let scope = this;
this.type = "linklist";
this.linkdata = [];
this.linksgroup = new THREE.Group();
this.linksgroup.name = "link";
this.initpromise = function(linkdata,scene,assetloader){
return new Promise(function(resolve, reject){
linkhelp(linkdata,scene);
scene.add(scope.linksgroup);
linktest(linkdata,scene,assetloader);
resolve("loadedrealsection");
});
};
this.loadpromise = function(linkdata,scene,assetloader){
return new Promise(function(resolve, reject){
scene.add(scope.linksgroup);
loadlink(linkdata,scene,assetloader);
resolve("loadedrealsection");
});
};
function linkhelp(data,scene){
let groups = new THREE.Group();
for(let i=0;i<data.length;i++){
let lineGeometry = new THREE.Geometry();//生成几何体
lineGeometry.vertices.push(new THREE.Vector3(data[i].lp.x, 1, data[i].lp.y));//线段的两个顶点
lineGeometry.vertices.push(new THREE.Vector3(data[i].rp.x, 1, data[i].rp.y));
let line = new THREE.Line(lineGeometry, new THREE.LineDashedMaterial({
color: 0xffffff,//线段的颜色
dashSize: 1,//短划线的大小
gapSize: 3//短划线之间的距离
}));
line.name = data[i].code;
line.lengthFact = data[i].lengthFact;
line.lp = data[i].lp;
line.rp = data[i].rp;
line.distancex = data[i].rp.x-data[i].lp.x;
line.distancey = data[i].rp.y-data[i].lp.y;
line.computeLineDistances();//不可或缺的,若无,则线段不能显示为虚线
groups.add(line);
}
groups.position.z = 2000;
scene.add(groups);
}
function loadlink(data,scene,assetloader){
let autorail;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autorail"){
autorail = assetloader.modellist[i].mesh.children[0];
}
}
let count = autorail.geometry.attributes.position.count;
let rightlist = [];
let leftlist = [];
for(let i=0;i<count;i++){
if(autorail.geometry.attributes.position.array[i*3] >0.49){
rightlist.push(i);
}
if(autorail.geometry.attributes.position.array[i*3] <-0.49){
leftlist.push(i);
}
}
for(let i=0;i<data.length;i++){
let testmesh2 = autorail.clone(true);
testmesh2.code = data[i].code;
testmesh2.name = data[i].name;
testmesh2.rightlist = rightlist;
testmesh2.leftlist = leftlist;
testmesh2.rp = data[i].rp;
testmesh2.lp = data[i].lp;
testmesh2.lengthfact = data[i].lengthfact;
for(let i=0;i<testmesh2.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-25;
testmesh2.geometry.attributes.uv.array[testmesh2.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
}
let newrail = new THREE.BufferGeometry();
newrail.copy(testmesh2.geometry);
testmesh2.geometry = newrail;
testmesh2.geometry.attributes.position.needsUpdate = true;
testmesh2.geometry.attributes.uv.needsUpdate = true;
testmesh2.geometry.computeBoundingSphere();
testmesh2.geometry.center();
testmesh2.position.x = data[i].position.x;
testmesh2.position.y = data[i].position.y;
testmesh2.position.z = data[i].position.z;
// testmesh2.rotation.x = data[i].rotation._x;
// testmesh2.rotation.y = data[i].rotation._y;
testmesh2.rotation.z = data[i].rotation._z;
scope.linkdata.push(testmesh2);
scope.linksgroup.add(testmesh2);
}
}
// return linklist;
function linktest(data,scene,assetloader){
let autorail = null;
let autosuidao = null;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autorail"){
autorail = assetloader.modellist[i].mesh.children[0];
}
}
let rightlist = [];
let leftlist = [];
let count = autorail.geometry.attributes.position.count;
for(let i=0;i<count;i++){
if(autorail.geometry.attributes.position.array[i*3] >0.49){
rightlist.push(i);
}
if(autorail.geometry.attributes.position.array[i*3] <-0.49){
leftlist.push(i);
}
}
autorail.rightlist = rightlist;
autorail.leftlist = leftlist;
let reallinks = [];
let testlink;
testlink = data;
if(data){
let index,startdata;
for(let n=0;n<data.length;n++){
if(data[n].leftFdCode == undefined && data[n].leftSdCode == undefined && data[n].rightFdCode ){
if(startdata){
if(data[n].lp.x<startdata.lp.x){
startdata = data[n];
index = n;
}
}else{
startdata = data[n];
index = n;
}
}
}
buildmodel(startdata);
reallinks.push(startdata);
data.splice(index,1);
for(let i=0;i<reallinks.length;i++){
for(let j=0;j<data.length;j++){
if(reallinks[i].leftFdCode && j>=0){
if(reallinks[i].leftFdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"left");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
if(reallinks[i].leftSdCode && j>=0){
if(reallinks[i].leftSdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"left");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
if(reallinks[i].rightFdCode && j>=0){
if(reallinks[i].rightFdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"right");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
if(reallinks[i].rightSdCode && j>=0){
if(reallinks[i].rightSdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"right");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
}
}
function buildmodel(data,mdata,sx,direct){
let len = data.lengthFact;
let testmesh2 = autorail.clone(true);
for(let i=0;i<autorail.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[autorail.rightlist[i]*3] = len-25;
testmesh2.geometry.attributes.uv.array[autorail.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
}
let newrail = new THREE.BufferGeometry();
newrail.copy(testmesh2.geometry);
testmesh2.geometry = newrail;
testmesh2.geometry.attributes.position.needsUpdate = true;
testmesh2.geometry.attributes.uv.needsUpdate = true;
testmesh2.geometry.computeBoundingSphere();
testmesh2.geometry.center();
// data.lp.y *= 10;
// data.rp.y *= 10;
if(mdata){
if(direct == "left"){
let dx = Math.abs(data.lp.x - data.rp.x);
    let dy = Math.abs(data.lp.y - data.rp.y);
    let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
data.lp.x = (data.lp.x-data.rp.x)*data.lengthFact/distance+mdata.lp.x;
data.lp.y = (data.lp.y-data.rp.y)*data.lengthFact/distance+mdata.lp.y;
data.rp.x = mdata.lp.x;
data.rp.y = mdata.lp.y;
let axix = new THREE.Vector3(1,0,0);
let axixnow = new THREE.Vector3(data.rp.x-data.lp.x,0,data.rp.y-data.lp.y);
let rotenum = axixnow.angleTo(axix);
//不同坐标系方向值不同
if(data.lp.y>data.rp.y){
testmesh2.rotation.z = 0.218;
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else if(data.lp.y<data.rp.y){
testmesh2.rotation.z = -0.218;
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else{
testmesh2.rotation.z = rotenum;
}
testmesh2.position.x = (data.rp.x + data.lp.x)/2;
testmesh2.position.z = (data.rp.y + data.lp.y)/2;
}
if(direct == "right"){
let dx = Math.abs(data.lp.x - data.rp.x);
    let dy = Math.abs(data.lp.y - data.rp.y);
    let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
data.rp.x = (data.rp.x-data.lp.x)*data.lengthFact/distance+mdata.rp.x;
data.rp.y = (data.rp.y-data.lp.y)*data.lengthFact/distance+mdata.rp.y;
data.lp.x = mdata.rp.x;
data.lp.y = mdata.rp.y;
let axix = new THREE.Vector3(1,0,0);
let axixnow = new THREE.Vector3(data.rp.x-data.lp.x,0,data.rp.y-data.lp.y);
let rotenum = axixnow.angleTo(axix);
//不同坐标系方向值不同
if(data.lp.y>data.rp.y){
testmesh2.rotation.z = 0.218;
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else if(data.lp.y<data.rp.y){
testmesh2.rotation.z = -0.218;
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
}
testmesh2.position.x = (data.lp.x + data.rp.x)/2;
testmesh2.position.z = (data.lp.y + data.rp.y)/2;
}
}else{
data.lp.x = data.lp.x;
data.rp.x = data.lp.x + data.lengthFact;
testmesh2.position.x = (data.lp.x + data.rp.x)/2;
testmesh2.position.z = (data.lp.y + data.rp.y)/2;
}
// testmesh2.position.y = 10;
testmesh2.code = data.code;
testmesh2.name = data.name;
testmesh2.meshtype = "link";
testmesh2.lp = data.lp;
testmesh2.rp = data.rp;
testmesh2.rightlist = autorail.rightlist;
testmesh2.leftlist = autorail.leftlist;
testmesh2.lengthfact = data.lengthFact;
scope.linksgroup.add( testmesh2 );
scope.linkdata.push(testmesh2);
}
}
}
}

View File

@ -0,0 +1,149 @@
export function RailList(){
let scope = this;
this.linkrail = [];
this.switchrail = [];
this.setrail = function(){
};
this.init = function(linkdata,switchdata,scene,storemod){
for(let i=0;i<linkdata.length;i++){
scope.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
};
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,
blink:switchdata[i].blink,
clink:switchdata[i].clink,
position:switchdata[i].position,
directtype:null,
locateType:0
};
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";
}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";
}
//
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";
}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";
}
const ddd = storemod.getters['map/getDeviceByCode'](switchdata[i].code);
scope.switchrail[switchdata[i].code].locateType = ddd.locateType;
if(ddd.locateType == "01"){
//1--向左 2--向右
//__\__ __/__
if(scope.switchrail[switchdata[i].code].directtype == "1"){
scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].blink;
scope.linkrail[switchdata[i].blink].rconnect = switchdata[i].alink;
}else if(scope.switchrail[switchdata[i].code].directtype == "2"){
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;
scope.linkrail[switchdata[i].clink].rconnect = switchdata[i].alink;
}else if(switchdata[i].directtype == "2"){
scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].clink;
scope.linkrail[switchdata[i].clink].lconnect = switchdata[i].alink;
}
}
}
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.tension = 0.2;
let rightpoints = [];
scope.linkrail[linkdata[i].code].points.forEach(item=>{
rightpoints.push(item);
}
);
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 );
// scene.add(curveObject);
}
}
this.getrail = function(){
};
}

View File

@ -6,6 +6,12 @@ export function SectionList() {
this.type = 'sectionlist'; this.type = 'sectionlist';
let sectiongroup = new THREE.Group();
sectiongroup.name = "section";
let switchgroup = new THREE.Group();
switchgroup.name = "switch";
this.sections = { this.sections = {
datalist: [], datalist: [],
modellist: [] modellist: []
@ -15,6 +21,7 @@ export function SectionList() {
datalist: [], datalist: [],
modellist: [] modellist: []
}; };
this.standtrack = [];
this.initpromise = function (sectiondata, switchdata, scene) { this.initpromise = function (sectiondata, switchdata, scene) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
@ -97,78 +104,287 @@ export function SectionList() {
}); });
}; };
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){
// scene.add(sectiongroup);
scene.add(switchgroup);
let linkdata = jlmap3ddata.linklist;
for(let i=0;i<sectiondata.length;i++){
if(sectiondata[i].type == "01"){
//初始化区段对象数据
let newsection = new SectionModel(sectiondata);
newsection.name = sectiondata[i].code;
newsection.code = sectiondata[i].code;
newsection.index = i;
newsection.isStandTrack = sectiondata[i].isStandTrack;
newsection.relStandCode = sectiondata[i].relStandCode;
newsection.type = sectiondata[i].type;
newsection.offsetRight = sectiondata[i].offsetRight;
newsection.offsetLeft = sectiondata[i].offsetLeft;
newsection.linkCode = sectiondata[i].linkCode;
scope.sections.datalist.push(newsection);
// scope.sections.modellist.push("");
}
}
let autosuidao;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autosuidao"){
autosuidao = assetloader.modellist[i].mesh.children[0];
}
}
for(let i = 0;i < sectiondata.length;i++){
let testmesh1 = autosuidao.clone(true);
testmesh1.code = sectiondata[i].code;
testmesh1.name = sectiondata[i].code;
if(sectiondata[i].relStandCode){
testmesh1.relStandCode = sectiondata[i].relStandCode;
}else{
testmesh1.relStandCode = "";
}
testmesh1.rightlist = sectiondata[i].rightlist;
testmesh1.leftlist = sectiondata[i].leftlist;
testmesh1.rightpoint = sectiondata[i].rightpoint;
testmesh1.leftpoint = sectiondata[i].leftpoint;
testmesh1.isStandTrack = sectiondata[i].isStandTrack;
testmesh1.lengthfact = sectiondata[i].lengthfact;
for(let i=0;i<testmesh1.rightlist.length;i++){
testmesh1.geometry.attributes.position.array[testmesh1.rightlist[i]*3] = testmesh1.lengthfact;
testmesh1.geometry.attributes.uv.array[testmesh1.rightlist[i]*2] = (testmesh1.geometry.attributes.position.array[3]-testmesh1.geometry.attributes.position.array[0])/15.3;
}
let newsuidao = new THREE.BufferGeometry();
newsuidao.copy(testmesh1.geometry);
testmesh1.geometry = newsuidao;
testmesh1.geometry.attributes.position.needsUpdate = true;
testmesh1.geometry.attributes.uv.needsUpdate = true;
testmesh1.geometry.computeBoundingSphere();
testmesh1.geometry.center();
testmesh1.position.x = sectiondata[i].position.x;
testmesh1.position.y = sectiondata[i].position.y;
testmesh1.position.z = sectiondata[i].position.z;
testmesh1.rotation.x = -Math.PI/2;
testmesh1.rotation.z = sectiondata[i].rotation._z;
let newsection = new SectionModel(sectiondata);
newsection.name = sectiondata[i].code;
newsection.code = sectiondata[i].code;
newsection.isStandTrack = sectiondata[i].isStandTrack;
newsection.relStandCode = sectiondata[i].relStandCode;
newsection.linkCode = sectiondata[i].linkCode;
scope.sections.datalist.push(newsection);
if(testmesh1.isStandTrack == false){
sectiongroup.add(testmesh1);
}else{
scope.standtrack.push(testmesh1);
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
sectiongroup.add( box );
}
scope.sections.modellist.push(testmesh1);
}
let switchmesh1;
let switchmesh2;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autoswitch1"){
switchmesh1 = assetloader.modellist[i].mesh;
}
if(assetloader.modellist[i].deviceType == "autoswitch2"){
switchmesh2 = assetloader.modellist[i].mesh;
}
}
// switchmesh1.rotation.x = Math.PI/2;
// switchmesh2.rotation.z = Math.PI/2;
for(let i=0;i<switchdata.length;i++){
let newswitch = {
code:switchdata[i].code,
pa:switchdata[i].pa,
pb:switchdata[i].pb,
pc:switchdata[i].pc,
paname:switchdata[i].paname,
pbname:switchdata[i].pbname,
pcname:switchdata[i].pcname,
alink:switchdata[i].alink,
blink:switchdata[i].blink,
clink:switchdata[i].clink
};
let sectionA,sectionB,sectionC;
for(let j=0;j<scope.sections.modellist.length;j++){
if(newswitch.paname == scope.sections.modellist[j].code){
sectionA = scope.sections.modellist[j];
}else if(newswitch.pbname == scope.sections.modellist[j].code){
sectionB = scope.sections.modellist[j];
}else if(newswitch.pcname == scope.sections.modellist[j].code){
sectionC = scope.sections.modellist[j];
}
}
let testswitch;
if(switchdata[i].pa[0].x>switchdata[i].pb[0].x){
if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[0].y){
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){
testswitch = switchmesh1.clone(true);
}else{
testswitch = switchmesh2.clone(true);
}
}else{
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){
testswitch = switchmesh2.clone(true);
}else{
testswitch = switchmesh1.clone(true);
}
testswitch.rotation.z = Math.PI;
}
}else{
if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[1].y){
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){
testswitch = switchmesh1.clone(true);
}else{
testswitch = switchmesh2.clone(true);
}
}else{
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){
testswitch = switchmesh2.clone(true);
}else{
testswitch = switchmesh1.clone(true);
}
testswitch.rotation.z = Math.PI;
}
}
testswitch.position.x = switchdata[i].position.x;
testswitch.position.y = switchdata[i].position.y;
testswitch.position.z = switchdata[i].position.z;
// testswitch.rotation.x = switchdata[i].rotation._x;
// testswitch.rotation.y = switchdata[i].rotation._y;
// testswitch.rotation.z = switchdata[i].rotation._z;
scope.switchs.datalist.push(newswitch);
scope.switchs.modellist.push(testswitch);
switchgroup.add(testswitch);
}
resolve("loadersection");
});
}
function buildsuidao(linkdata,suidaodata,assetloader,scene){
let autosuidao;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autosuidao"){
autosuidao = assetloader.modellist[i].mesh.children[0];
}
}
let rightlist = [];
let leftlist = [];
let rightpoint = 0;
let leftpoint = 0;
let count = autosuidao.geometry.attributes.position.count;
for(let i=0;i<count;i++){
if(autosuidao.geometry.attributes.position.array[i*3] >7){
rightlist.push(i);
if(autosuidao.geometry.attributes.position.array[i*3] > rightpoint){
rightpoint = i;
}
}
if(autosuidao.geometry.attributes.position.array[i*3] <-7){
leftlist.push(i);
if(autosuidao.geometry.attributes.position.array[i*3] < rightpoint){
leftpoint = i;
}
}
}
autosuidao.rightlist = rightlist;
autosuidao.leftlist = leftlist;
autosuidao.rightpoint = rightpoint;
autosuidao.leftpoint = leftpoint;
// console.log(autosuidao);
// console.log(linkdata.linksgroup.children);
// console.log(suidaodata.datalist);
for(let i = 0;i < suidaodata.datalist.length;i++){
let link = linkdata.linksgroup.getObjectByProperty("code",suidaodata.datalist[i].linkCode);
let suidao = suidaodata.datalist[i];
let len = suidao.offsetRight-suidao.offsetLeft;
// console.log("-------------------------------------");
// console.log("name:"+link.name);
// console.log(link.lengthfact);
// console.log(len);
// console.log("ofl:"+suidao.offsetLeft+" "+"ofr:"+suidao.offsetRight);
// console.log("-------------------------------------");
let testmesh1 = autosuidao.clone(true);
for(let i=0;i<autosuidao.rightlist.length;i++){
testmesh1.geometry.attributes.position.array[autosuidao.rightlist[i]*3] = len-7.5;
testmesh1.geometry.attributes.uv.array[autosuidao.rightlist[i]*2] = (testmesh1.geometry.attributes.position.array[3]-testmesh1.geometry.attributes.position.array[0])/15.3;
}
let newsuidao = new THREE.BufferGeometry();
newsuidao.copy(testmesh1.geometry);
testmesh1.geometry = newsuidao;
testmesh1.geometry.attributes.position.needsUpdate = true;
testmesh1.geometry.attributes.uv.needsUpdate = true;
testmesh1.geometry.computeBoundingSphere();
testmesh1.geometry.center();
let lenfact = link.lengthfact;
testmesh1.rotation.x = -Math.PI/2;
testmesh1.rotation.z = link.rotation.z;
//
// console.log(link.lp.x);
// console.log(link.rp.x);
// console.log(suidao.offsetLeft*(len/lenfact));
// console.log((link.rp.x-link.lp.x)*(len/lenfact)/2);
// console.log("==============");
//
if(testmesh1.rotation.z != 0){
testmesh1.position.x = link.lp.x+suidao.offsetLeft*(len/lenfact)+ (link.rp.x-link.lp.x)*(len/lenfact)/2;
if(link.lp.y > link.rp.y){
testmesh1.position.z = link.lp.y-suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2;
}else{
testmesh1.position.z = link.lp.y+suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2;
}
}else{
testmesh1.position.x = link.lp.x+suidao.offsetLeft+len/2;
testmesh1.position.z = link.position.z;
}
testmesh1.position.y = 3.5;
// testmesh1.rotation.x = Math.PI/4;
testmesh1.code = suidaodata.datalist[i].code;
testmesh1.name = suidaodata.datalist[i].code;
// testmesh1.position.z = link.position.z;
testmesh1.relStandCode = suidaodata.datalist[i].relStandCode;
// testmesh1.stationCode = suidaodata.datalist[i].stationCode;
testmesh1.rightlist = autosuidao.rightlist;
testmesh1.leftlist = autosuidao.leftlist;
testmesh1.rightpoint = autosuidao.rightpoint;
testmesh1.leftpoint = autosuidao.leftpoint;
testmesh1.isStandTrack = suidaodata.datalist[i].isStandTrack;
testmesh1.lengthfact = len;
testmesh1.linkCode = suidao.linkCode;
if(suidaodata.datalist[i].isStandTrack == false){
sectiongroup.add(testmesh1);
}else{
scope.standtrack.push(testmesh1);
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
sectiongroup.add( box );
}
scope.sections.modellist.push(testmesh1);
}
}
// this.init = function(sectiondata,switchdata,scene){
//
// //遍历区段
// for(let i=0;i<sectiondata.length;i++){
// if(sectiondata[i].type == "01"){
// //初始化区段对象数据
// let newsection = new SectionModel(sectiondata);
//
// newsection.name = sectiondata[i].code;
// newsection.code = sectiondata[i].code;
// newsection.index = i;
// newsection.isStandTrack = sectiondata[i].isStandTrack;
// newsection.type = sectiondata[i].type;
//
// scope.sections.datalist.push(newsection);
// scope.sections.modellist.push("");
// }
//
// }
//
// //定义区分道岔组
// let switchlist = [];
// //遍历道岔数据
// for(let i=0;i<switchdata.length;i++){
// //道岔信息
// let newswitch = {
// code:null,
// pa:null,
// pb:null,
// pc:null,
// paname:null,
// pbname:null,
// pcname:null
// };
// //获取道岔分辨的点 PS:可能修改动态判断
// for(let j=0;j<sectiondata.length;j++){
// if(switchdata[i].sectionACode == sectiondata[j].code){
// newswitch.pa = sectiondata[j].points;
// newswitch.paname = switchdata[i].sectionACode;
// }
// if(switchdata[i].sectionBCode == sectiondata[j].code){
// newswitch.pb = sectiondata[j].points;
// newswitch.pbname = switchdata[i].sectionBCode;
// }
// if(switchdata[i].sectionCCode == sectiondata[j].code){
// newswitch.pc = sectiondata[j].points;
// newswitch.pcname = switchdata[i].sectionCCode;
// }
// if(newswitch.pa != null && newswitch.pb!= null && newswitch.pc != null){
// newswitch.code = switchdata[i].code;
// switchlist.push(newswitch);
// j = sectiondata.length;
// }
// }
// }
//
// //道岔贴图
// //遍历道岔信息组合轨道
// for(let i=0;i<switchlist.length;i++){
// //道岔对象组
// let newswitch = new SwitchModel();
//
// newswitch.name = switchlist[i].code;
// newswitch.code = switchlist[i].code;
//
// newswitch.index = i;
//
// scope.switchs.datalist.push(newswitch);
// scope.switchs.modellist.push("");
// }
//
// }
} }

View File

@ -8,8 +8,10 @@ export function SectionModel(data) {
this.index = null; this.index = null;
//轨迹点 //轨迹点
this.rail = []; this.rail = [];
this.railline = null;
//长度 //长度
this.distance = null; this.distance = [];
this.isStandTrack = null; this.isStandTrack = null;

View File

@ -50,11 +50,13 @@ export function StationStandList() {
} }
} }
} }
newstationstand.index = i; newstationstand.num = i;
scope.list[stationdata[i].code] = newstationstand; scope.list[stationdata[i].code] = newstationstand;
} }
} }
let map = scope.list; let map = scope.list;
for(let k in map){ for(let k in map){
@ -65,10 +67,6 @@ export function StationStandList() {
num = j; num = j;
} }
} }
map[k].mesh = assetloader.modellist[num].mesh.clone(true); map[k].mesh = assetloader.modellist[num].mesh.clone(true);
map[k].id = assetloader.modellist[num].id; map[k].id = assetloader.modellist[num].id;
map[k].mesh.code = map[k].code; map[k].mesh.code = map[k].code;
@ -98,25 +96,19 @@ export function StationStandList() {
textmaterial.dispose(); textmaterial.dispose();
textt.dispose(); textt.dispose();
}else{ }else{
for(let netnum =0;netnum <netstand.length;netnum++){
if(netstand[netnum].code == k ){
for(let j=0;j<assetloader.modellist.length;j++){
for(let netnum =0;netnum <netstand.length;netnum++){ if(assetloader.modellist[j].id == netstand[netnum].modelid){
if(netstand[netnum].code == k ){ num = j;
map[k].index = netnum;
for(let j=0;j<assetloader.modellist.length;j++){ j = assetloader.modellist.length;
if(assetloader.modellist[j].id == netstand[netnum].modelid){
num = j;
map[k].index = netnum;
j = assetloader.modellist.length;
}
} }
netnum = netstand.length; }
} netnum = netstand.length;
} }
}
map[k].mesh = assetloader.modellist[num].mesh.clone(true); map[k].mesh = assetloader.modellist[num].mesh.clone(true);
let newclip = assetloader.modellist[num].mesh.animations[ 0 ]; let newclip = assetloader.modellist[num].mesh.animations[ 0 ];
@ -172,16 +164,15 @@ export function StationStandList() {
map[k].mesh.scale.x = netstand[map[k].index].scale.x; 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.y = netstand[map[k].index].scale.y;
map[k].mesh.scale.z = netstand[map[k].index].scale.z; map[k].mesh.scale.z = netstand[map[k].index].scale.z;
let textgeometry = new THREE.PlaneBufferGeometry( 271, 374, 1 ); let textgeometry = new THREE.PlaneBufferGeometry( 271, 374, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[map[k].index])); let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[map[k].num]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} ); let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial ); let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = stationdata[map[k].index].code; textplane.name = stationdata[map[k].num].code;
map[k].type = "station"; map[k].type = "station";
map[k].rname = stationdata[map[k].index].runPlanName; map[k].rname = stationdata[map[k].num].runPlanName;
map[k].kmmark = stationdata[map[k].index].kmPost; map[k].kmmark = stationdata[map[k].num].kmPost;
textplane.position.y = 300; textplane.position.y = 300;
textplane.rotation.x = Math.PI/2; textplane.rotation.x = Math.PI/2;

View File

@ -10,7 +10,7 @@ export function StationStandModel(opts) {
this.ismodel = false; this.ismodel = false;
this.istexture = false; this.istexture = false;
this.modelurl = null; this.modelurl = null;
this.index = null;
this.direction1= { this.direction1= {
position:null, position:null,
name:null, name:null,

View File

@ -38,6 +38,7 @@ export function TrainList() {
top:[], top:[],
down:[] down:[]
}; };
for(let j=0;j<newmesh.children.length;j++){ for(let j=0;j<newmesh.children.length;j++){
if(newmesh.children[j].name == "c1" || newmesh.children[j].name == "c6"){ if(newmesh.children[j].name == "c1" || newmesh.children[j].name == "c6"){
@ -122,8 +123,9 @@ export function TrainList() {
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} ); let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial ); let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = data[i].code; textplane.name = data[i].code;
textplane.position.x = -50; textplane.position.x = 0;
textplane.position.y = 130; textplane.position.y = 0;
textplane.position.z = 60;
textplane.tcode = data[i].code; textplane.tcode = data[i].code;
//textplane.rotation.x = Math.PI; //textplane.rotation.x = Math.PI;
scope.textlist.push(textplane); scope.textlist.push(textplane);
@ -139,7 +141,7 @@ export function TrainList() {
newmesh.groupNumber = data[i].groupNumber; newmesh.groupNumber = data[i].groupNumber;
newmesh.position.set(0,-50000,0); newmesh.position.set(0,-50000,0);
newmesh.children[0].position.y = 0; // newmesh.children[0].position.y = 0;
//newmesh.rotation.y = Math.PI/2; //newmesh.rotation.y = Math.PI/2;
newmesh.status = "00"; newmesh.status = "00";
newmesh.nowcode = null; newmesh.nowcode = null;

View File

@ -12,107 +12,61 @@ export function UpdateTrain(camera,traindata){
if(trainmodel.speeds > 0 && trainmodel.speeds){ if(trainmodel.speeds > 0 && trainmodel.speeds){
let speed = null; let speed = null;
if(traindata.group.children[j].progress<1){ if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){
// console.log(trainmodel.rname); // console.log(trainmodel.rname);
// console.log(trainmodel.speeds); // console.log(trainmodel.speeds);
// console.log(trainmodel.progress); // console.log(trainmodel.progress);
let movecurve = trainmodel.curve; 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"){//向左 if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){
let point = movecurve.getPointAt(traindata.group.children[j].progress); trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){ let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
trainmodel.children[0].up = new THREE.Vector3(-1,0,0); trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize(); let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
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);
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.y
}
trainmodel.children[1].rotalist.push(rotas);
let offsetz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]) - parseFloat(point.z); trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].position.z += offsetz; trainmodel.children[0].rotation.x = -Math.PI/2;
//trainmodel.position.z = point.z; trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
} trainmodel.children[0].rotation.y = 0;
trainmodel.position.x = point.x; // console.log(trainmodel.children[0].rotation.x);
trainmodel.position.y = 0; // console.log(trainmodel.children[0].rotation.y);
// console.log(trainmodel.children[0].rotation.z);
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){ let rotas = {
for(let rs = 1;rs<6;rs++){ posr:point,
//console.log(rs); rota:trainmodel.children[0].rotation.z
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].matrixWorld.elements[14]) - parseFloat(trainmodel.children[rs].rotalist[0].posr.z);
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-38)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
trainmodel.children[rs+1].rotalist.push(asd);
}
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
xh = trainmodel.children[rs].rotalist.length;
}
}
//console.log(trainmodel.children[rs].rotalist.length);
} }
trainmodel.children[1].rotalist.push(rotas);
let offsetz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]) - parseFloat(point.z);
trainmodel.children[0].position.z += offsetz;
//trainmodel.position.z = point.z;
} }
}
trainmodel.progress += trainmodel.speeds;
}
if(trainmodel.status == "02"){ trainmodel.position.x = point.x;
trainmodel.position.y = 0;
let point = movecurve.getPointAt(trainmodel.progress); 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){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){ for(let rs = 1;rs<6;rs++){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].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);
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.y
}
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.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++){
//console.log(rs); //console.log(rs);
if(trainmodel.children[rs].rotalist[0]){ if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].matrixWorld.elements[14]) - parseFloat(trainmodel.children[rs].rotalist[0].posr.z);
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
trainmodel.children[rs].position.z += offsetz; trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){ for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+38)>=trainmodel.children[rs].rotalist[0].posr.x){ if((trainmodel.children[rs].matrixWorld.elements[12]-8)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){ if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0]; let asd = trainmodel.children[rs].rotalist[0];
trainmodel.children[rs+1].rotalist.push(asd); trainmodel.children[rs+1].rotalist.push(asd);
} }
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota; trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1) trainmodel.children[rs].rotalist.splice(0,1)
xh--; xh--;
}else{ }else{
@ -120,17 +74,94 @@ export function UpdateTrain(camera,traindata){
} }
} }
//console.log(trainmodel.children[rs].rotalist.length); //console.log(trainmodel.children[rs].rotalist.length);
} }
}
} }
// console.log(trainmodel.rotalist); trainmodel.progress += trainmodel.speeds;
} }
trainmodel.progress += trainmodel.speeds;
} }
if(trainmodel.status == "02"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(trainmodel.progress);
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();
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);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.z
}
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.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++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+8)>=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
trainmodel.children[rs+1].rotalist.push(asd);
}
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
xh = trainmodel.children[rs].rotalist.length;
}
}
//console.log(trainmodel.children[rs].rotalist.length);
}
}
// console.log(trainmodel.rotalist);
}
trainmodel.progress += trainmodel.speeds;
}
}
}
else{
if(trainmodel.status == '02'){
trainmodel.curve = trainmodel.nextcurve;
}else if(trainmodel.status == '03'){
trainmodel.curve = trainmodel.nextcurve;
}
// console.log(trainmodel.name);
// console.log(trainmodel.progress);
// console.log(trainmodel.nextcurve);
// if(trainmodel.status == "02"){
// trainmodel.progress = 0;
// }else if(trainmodel.status == "03"){
// trainmodel.progress = 1;
// }
// trainmodel.curve = trainmodel.nextcurve;
} }
} }

View File

@ -250,6 +250,7 @@ class StationStand extends Group {
/** 中心+车站扣车*/ /** 中心+车站扣车*/
standAndCenterDetainTrain() { standAndCenterDetainTrain() {
this.detain && this.detain.show(); this.detain && this.detain.show();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.andCenterTrainColor);
} }
/** 人工设置停战时间*/ /** 人工设置停战时间*/

View File

@ -70,7 +70,7 @@ export default {
this.$store.state.training.roles == 'BigScreen'; this.$store.state.training.roles == 'BigScreen';
}, },
isShowMenu() { isShowMenu() {
return this.$store.state.training.prdType != ''; return this.$store.state.training.prdType;
} }
}, },
watch: { watch: {

View File

@ -72,7 +72,7 @@ export default {
this.$store.state.training.roles != 'BigScreen'; this.$store.state.training.roles != 'BigScreen';
}, },
isShowBar() { isShowBar() {
return this.$store.state.training.prdType != ''; return this.$store.state.training.prdType;
} }
}, },
watch: { watch: {

View File

@ -157,7 +157,7 @@ export default {
operate: OperationEvent.Command.mBar.system, operate: OperationEvent.Command.mBar.system,
children: [ children: [
{ {
title: '登', title: '登',
click: this.undeveloped click: this.undeveloped
}, },
{ {
@ -424,7 +424,7 @@ export default {
operate: OperationEvent.Command.mBar.system, operate: OperationEvent.Command.mBar.system,
children: [ children: [
{ {
title: '登', title: '登',
click: this.undeveloped click: this.undeveloped
}, },
{ {

View File

@ -1,355 +0,0 @@
<template>
<el-dialog class="chengdou-03__systerm stand-detain-train" :title="title" :visible.sync="show" width="380px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<div class="head_content content">
<span class="base-label" style="left: 0px;">会话管理</span>
<el-col :span="8">
<el-button class="status">查询会话状态</el-button>
</el-col>
<el-col :span="15" :offset="1">
<el-input :value="messageText" placeholder="" size="mini" disabled></el-input>
</el-col>
<el-col :span="12">
<el-button class="status_btn" :id="openMessageId" @click="handleMessage('open')"
:disabled="isOpenMessage">打开会话</el-button>
</el-col>
<el-col :span="12">
<el-button class="status_btn" :id="closeMessageId" @click="handleMessage('close')"
:disabled="!isOpenMessage">关闭会话
</el-button>
</el-col>
</div>
<div class="content cotnent_body">
<span class="base-label" style="left: 0px;">操作</span>
<el-col :span="3">
<div class="text">操作</div>
</el-col>
<el-col :span="11" :offset="1">
<el-input :value="messageText1" placeholder="" size="mini" disabled></el-input>
</el-col>
<el-col :span="8" :offset="1">
<el-button class="status_btn" :id="confirmId1" @click="confirm1" :disabled="disabledConfirm1">确认
</el-button>
</el-col>
</div>
<div class="content cotnent_body">
<span class="base-label" style="left: 0px;">确认</span>
<el-col :span="3">
<div class="text">操作</div>
</el-col>
<el-col :span="11" :offset="1">
<el-input :value="messageText2" placeholder="" size="mini" disabled></el-input>
</el-col>
<el-col :span="8" :offset="1">
<el-button class="status_btn" :id="confirmId2" @click="confirm2" :disabled="disabledConfirm2">确认
</el-button>
</el-col>
</div>
<div class="body_cont">
<el-col :span="7">
<div class="text">操作倒计时</div>
</el-col>
<el-col :span="17">
<div style="border: 2px inset #E9E9E9; height: 30px; width: 100%;">
{{timeCountConfirm == -1 ? '' : timeCountConfirm}}</div>
</el-col>
</div>
<div class="body_cont">
<div class="status_text">状态</div>
<div class="textarea_content"></div>
</div>
<el-button class="close_btn" :id="domIdConfirm" type="primary" @click="commit">关闭</el-button>
<confirm-tip ref='ConfirmTip' @close="closeMessage"></confirm-tip>
</el-dialog>
</template>
<script>
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus';
import ConfirmTip from './childDialog/confirmTip';
export default {
name: 'StandDetainTrain',
components: {
ConfirmTip
},
data() {
return {
dialogShow: false,
standName: '',
stationName: '',
selected: null,
operation: null,
radio: '1',
radio1: '1',
earlyDepar: false,
messageText: '',
messageText1: '',
messageText2: '',
isOpenMessage: false,
timeCountConfirm: -1,
disabledConfirm1: false,
disabledConfirm2: false,
}
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
openMessageId() {
return this.dialogShow ? OperationEvent.LimitControl.CancelAllLimit.openMessage.domId : '';
},
closeMessageId() {
return this.dialogShow ? OperationEvent.LimitControl.CancelAllLimit.closeMessage.domId : '';
},
confirmId1() {
return this.dialogShow ? OperationEvent.LimitControl.CancelAllLimit.confirm1.domId : '';
},
confirmId2() {
return this.dialogShow ? OperationEvent.LimitControl.CancelAllLimit.confirm2.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.LimitControl.CancelAllLimit.confirm.domId : '';
},
title() {
return '取消全线临时限速';
},
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
this.timer = setInterval(() => {
if (this.timeCountConfirm > 0) {
this.timeCountConfirm--;
} else if (this.timeCountConfirm == 0) { //
this.timeCountConfirm = -1;
this.disabledConfirm2 = true;
}
}, 1000)
},
methods: {
doShow(operate, selected) {
this.selected = selected;
if (!this.dialogShow) {
this.standName = '';
this.stationName = '';
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
},
handleMessage(message) {
if (message == 'open') {
let operate = {
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.openMessage.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.isOpenMessage = true;
this.messageText1 = '取消全线临时限速';
}
}).catch(error => {
this.doClose();
});
} else {
let operate = {
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.closeMessage.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.isOpenMessage = false;
this.messageText1 = '';
this.messageText2 = '';
this.disabledConfirm1 = false;
this.disabledConfirm2 = false;
this.timeCountConfirm = -1; //
}
}).catch(error => {
this.doClose();
});
}
},
confirm1() {
let operate = {
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.confirm1.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.isOpenMessage = true;
this.messageText1 = '**************';
this.messageText2 = '取消全线临时限速';
this.disabledConfirm1 = true;
this.timeCountConfirm = 60; //
}
}).catch(error => {
this.doClose();
});
},
confirm2() {
let operate = {
send: true,
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.confirm2.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.isOpenMessage = true;
this.messageText2 = '**************';
this.disabledConfirm2 = true;
this.timeCountConfirm = -1;
}
}).catch(error => {
this.doClose();
});
},
commit() {
let operate = {
send: true,
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.confirm.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (!this.isOpenMessage) {
this.doClose();
} else {
let operate = {
message: `是否关闭会话,并关闭窗口`,
confirmId: OperationEvent.LimitControl.CancelAllLimit.close.domId,
}
this.$refs.ConfirmTip.doShow(operate);
}
}).catch(error => {
console.log(error);
})
},
closeMessage() {
let operate = {
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.close.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.ConfirmTip.doClose();
this.isOpenMessage = false;
this.messageText1 = '';
this.messageText2 = '';
this.disabledConfirm1 = false;
this.disabledConfirm2 = false;
this.timeCountConfirm = -1; //
this.doClose();
}).catch(error => {
console.log(error);
})
}
}
}
</script>
<style scoped lang="scss">
.stand-detain-train .context {
height: 80px !important;
}
.content {
width: 100%;
border: 1px solid lightgray;
padding: 18px 5px;
position: relative;
.base-label {
position: absolute;
top: -5px;
left: 20px;
background-color: #F0F0F0;
padding: 0 5px;
}
.el-button {
width: 100%;
line-height: 28px;
}
.status_btn {
width: 110px;
margin: 15px auto 0;
display: block;
}
}
.head_content {
height: 110px;
margin-bottom: 10px;
}
.cotnent_body {
height: 60px;
margin-bottom: 10px;
.text {
line-height: 30px;
text-align: center;
font-size: 15px;
}
.status_btn {
width: 80px;
margin: 0 auto
}
}
.close_btn {
margin: 0 auto;
width: 80px;
display: block;
}
.body_cont {
margin-bottom: 10px;
padding: 0 3px;
overflow: hidden;
.text {
line-height: 30px;
text-align: center;
font-size: 15px;
}
.status_text {
margin-bottom: 3px;
font-size: 14px;
padding-left: 8px;
}
.textarea_content {
height: 85px;
width: 100%;
border: 2px solid #E9E9E9;
box-shadow: 2px 2px #959595 inset;
}
}
</style>

View File

@ -107,11 +107,7 @@ export default {
} }
}, },
domIdConfirm() { domIdConfirm() {
if (this.operate && this.operate.operateCode) { return this.dialogShow ? getDomIdByOperation(this.operate.operateNext) : '';
return this.dialogShow ? getDomIdByOperation(this.operate.operateCode) : '';
} else {
return this.dialogShow ? OperationEvent.Command.close.confirm.domId : '';
}
} }
}, },
mounted() { mounted() {
@ -135,29 +131,10 @@ export default {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}, },
commit() { commit() {
const operate = {
send: this.operate.operateCode != null,
type: this.operate.type,
operation: this.operate.operateCode != null ? this.operate.operateCode : OperationEvent.Command.close.confirm.operation
};
if (this.operate.val) {
operate['val'] = this.operate.val;
}
if (this.passwordCheck === this.correctPassword) { if (this.passwordCheck === this.correctPassword) {
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$emit('checkOver', this.operate);
this.loading = false; this.doClose();
this.inputClear();
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$emit('checkOver');
this.doClose();
this.inputClear();
}
}).catch(() => {
this.loading = false;
this.$refs.noticeInfo && this.$refs.noticeInfo.doShow(operate);
});
} else { } else {
this.showMistake = true; this.showMistake = true;
} }

View File

@ -27,7 +27,7 @@
</el-col> </el-col>
</el-row> </el-row>
<confirm-control ref="confirmControl" /> <confirm-control ref="confirmControl" />
<password-box ref="password" @checkOver="doClose" /> <password-box ref="password" @checkOver="passWordCommit" />
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
</el-dialog> </el-dialog>
</template> </template>
@ -79,10 +79,6 @@ export default {
return '信号封锁'; return '信号封锁';
} else if (this.operation == OperationEvent.Signal.unlock.menu.operation) { } else if (this.operation == OperationEvent.Signal.unlock.menu.operation) {
return '信号解封'; return '信号解封';
} else if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
return '进路收人工控';
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
return '进路交自动控';
} else if (this.operation == OperationEvent.Signal.signalClose.menu.operation) { } else if (this.operation == OperationEvent.Signal.signalClose.menu.operation) {
return '信号关灯'; return '信号关灯';
} }
@ -138,17 +134,26 @@ export default {
} else if (this.operation == OperationEvent.Signal.unlock.menu.operation) { } else if (this.operation == OperationEvent.Signal.unlock.menu.operation) {
/** 信号解封*/ /** 信号解封*/
this.unlock(); this.unlock();
} else if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
/** 进路收人工控*/
this.humanControl();
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
/** 进路交自动控*/
this.atsAutoControl();
} else if (this.operation == OperationEvent.Signal.signalClose.menu.operation) { } else if (this.operation == OperationEvent.Signal.signalClose.menu.operation) {
/** 信号关灯*/ /** 信号关灯*/
this.signalClose(); this.signalClose();
} }
}, },
passWordCommit(data) {
const operate = {
send: true,
type: data.type,
operation: data.operateNext
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { this.doClose(); }
}).catch(() => {
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
// //
cancelTrainRoute() { cancelTrainRoute() {
if (this.$store.state.training.prdType == '01') { if (this.$store.state.training.prdType == '01') {
@ -174,7 +179,6 @@ export default {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate);
}); });
@ -194,7 +198,6 @@ export default {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate);
}); });
@ -204,7 +207,7 @@ export default {
const operate = { const operate = {
type: MapDeviceType.Signal.type, type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.humanTrainRoute.menu.operation, operation: OperationEvent.Signal.humanTrainRoute.menu.operation,
operateCode: OperationEvent.Signal.humanTrainRoute.confirm.operation operateNext: OperationEvent.Signal.humanTrainRoute.confirm.operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -213,7 +216,6 @@ export default {
this.$refs.password.doShow(operate); this.$refs.password.doShow(operate);
} }
}).catch(() => { }).catch(() => {
this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate);
}); });
@ -233,7 +235,6 @@ export default {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate);
}); });
@ -243,7 +244,7 @@ export default {
const operate = { const operate = {
type: MapDeviceType.Signal.type, type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.lock.menu.operation, operation: OperationEvent.Signal.lock.menu.operation,
operateCode: OperationEvent.Signal.lock.confirm.operation operateNext: OperationEvent.Signal.lock.confirm.operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -259,7 +260,7 @@ export default {
const operate = { const operate = {
type: MapDeviceType.Signal.type, type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.unlock.menu.operation, operation: OperationEvent.Signal.unlock.menu.operation,
operateCode: OperationEvent.Signal.unlock.confirm.operation operateNext: OperationEvent.Signal.unlock.confirm.operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -270,51 +271,6 @@ export default {
}).catch(() => { }).catch(() => {
}); });
}, },
//
humanControl() {
const operate = {
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.humanControl.menu.operation,
operateCode: OperationEvent.Signal.humanControl.confirm.operation,
val: this.operateCode
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.password.doShow(operate);
}
}).catch(() => {
this.loading = false;
// this.doClose();
// this.$refs.noticeInfo.doShow(operate);
});
},
//
atsAutoControl() {
const operate = {
// send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.atsAutoControl.menu.operation,
operateCode: OperationEvent.Signal.atsAutoControl.confirm.operation,
val: this.operateCode
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.password.doShow(operate);
}
}).catch(() => {
this.loading = false;
// this.doClose();
// this.$refs.noticeInfo.doShow(operate);
});
},
// //
signalClose() { signalClose() {
const operate = { const operate = {

View File

@ -22,17 +22,7 @@
</el-row> </el-row>
<div class="route-table-box"> <div class="route-table-box">
<span class="route-table-tip">进路列表</span> <span class="route-table-tip">进路列表</span>
<el-table <el-table ref="table" :data="tempData" border :cell-style="tableStyle" style="width: 99%;" size="mini" height="90" highlight-current-row @row-click="clickEvent">
ref="table"
:data="tempData"
border
:cell-style="tableStyle"
style="width: 99%;"
size="mini"
height="90"
highlight-current-row
@row-click="clickEvent"
>
<el-table-column :id="domIdChoose" prop="name" label="进路" style="margin-left:30px" /> <el-table-column :id="domIdChoose" prop="name" label="进路" style="margin-left:30px" />
<el-table-column :id="domIdChoose" prop="controlType" label="进路属性" style="margin-left:30px"> <el-table-column :id="domIdChoose" prop="controlType" label="进路属性" style="margin-left:30px">
<template slot-scope="scope">{{ controlTypeNameMap[scope.row.controlType] }} </template> <template slot-scope="scope">{{ controlTypeNameMap[scope.row.controlType] }} </template>
@ -55,7 +45,7 @@
</el-col> </el-col>
</el-row> </el-row>
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
<password-box ref="passwordBox" @checkOver="doClose" /> <password-box ref="passwordBox" @checkOver="passWordCommit" />
</el-dialog> </el-dialog>
</template> </template>
@ -78,7 +68,6 @@ export default {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
selected: null, selected: null,
row: null,
operation: '', operation: '',
display: true, display: true,
stationName: '', stationName: '',
@ -160,47 +149,40 @@ export default {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
passWordCommit(data) {
const operate = {
send: true,
type: data.type,
operation: data.operateNext
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.guide();
this.$refs.table.setCurrentRow(); this.$refs.table.setCurrentRow();
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected); mouseCancelState(this.selected);
}, },
guide() {
//
if (this.beforeSectionList && this.beforeSectionList.length) {
this.beforeSectionList.forEach(elem => {
elem.cutOff = false;
});
}
this.$store.dispatch('training/updateMapState', [...this.beforeSectionList]);
this.beforeSectionList = [];
},
clickEvent(row, event, column) { clickEvent(row, event, column) {
this.row = row;
if (row) { if (row) {
//
this.guide();
row.canSetting = true;
//
if (row.containSectionList && row.containSectionList.length) {
//
row.containSectionList.forEach(elem => {
elem.cutOff = true;
});
}
this.$store.dispatch('training/updateMapState', [...row.containSectionList]);
this.beforeSectionList = row.containSectionList || [];
//
const operate = { const operate = {
repeat: true,
type: MapDeviceType.Signal.type, type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.guide.choose.operation, operation: OperationEvent.Signal.guide.choose.operation,
val: row.code val: row.code,
selection: row
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -216,7 +198,7 @@ export default {
const operate = { const operate = {
type: MapDeviceType.Signal.type, type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.guide.menu.operation, operation: OperationEvent.Signal.guide.menu.operation,
operateCode: OperationEvent.Signal.guide.confirm.operation operateNext: OperationEvent.Signal.guide.confirm.operation
}; };
this.loading = true; this.loading = true;

View File

@ -0,0 +1,285 @@
<template>
<div>
<el-dialog v-dialogDrag class="chengdou-03__systerm route-hand-control" :title="title" :visible.sync="show" width="500px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-row class="header">
<el-col :span="11"><span>车站</span></el-col>
<el-col :span="11" :offset="2"><span>始端信号机</span></el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-input v-model="stationName" size="small" disabled />
</el-col>
<el-col :span="11" :offset="2">
<el-input v-model="signalName" size="small" disabled />
</el-col>
</el-row>
<div class="table">
<el-table ref="tempTable" :data="tempData" border style="width: 100%" size="mini" :highlight-current-row="highlight" :height="140" @row-click="clickEvent">
<el-table-column :id="domIdChoose" prop="name" width="155" label="描述" style="margin-left:30px">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column :id="domIdChoose" prop="name" label="方向" style="">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">111</span>
</template>
</el-table-column>
<el-table-column :id="domIdChoose" prop="name" label="属性" style="">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">1111</span>
</template>
</el-table-column>
<el-table-column :id="domIdChoose" prop="name" label="控制" style="">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.controlType == '01' ? '自动' : '人工' }}</span>
</template>
</el-table-column>
</el-table>
</div>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :disabled="commitDisabled" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<confirm-control ref="confirmControl" />
<notice-info ref="noticeInfo" />
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import ConfirmControl from './childDialog/confirmControl';
import { mouseCancelState } from '../utils/menuItemStatus';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default {
name: 'RouteHandControl',
components: {
ConfirmControl,
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
selected: null,
tempData: [],
operation: null,
selection: [],
stationName: '',
signalName: '',
allSelect: false,
highlight: true
};
},
computed: {
...mapGetters('map', [
'signalList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdChoose() {
if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
return OperationEvent.Signal.humanControl.choose.domId;
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
return OperationEvent.Signal.atsAutoControl.choose.domId;
}
return '';
},
domIdConfirm() {
return this.dialogShow ? getDomIdByOperation(this.operation) : '';
},
title() {
if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
return '进路交人工控';
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
return '进路交自动控';
}
return '';
},
commitDisabled() {
let disabled = true;
if (this.selection && this.selection.length) {
disabled = false;
}
return disabled;
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(operate, selected, tempData) {
this.selected = selected;
//
if (!this.dialogShow) {
this.signalName = '';
this.stationName = '';
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase()) {
this.signalName = selected.name;
const station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
if (station) {
this.stationName = station.name;
}
}
if (tempData && tempData.length > 0) {
tempData.forEach(elem => {
elem.check = false;
elem.disabled = false;
//
if (operate.operation === OperationEvent.Signal.humanControl.menu.operation && elem.controlType == '01') {
elem.disabled = true;
} if (operate.operation === OperationEvent.Signal.atsAutoControl.menu.operation && elem.controlType == '02') {
elem.disabled = true;
}
});
}
this.tempData = tempData || [];
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$refs.tempTable.setCurrentRow();
this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
},
allSelectChange() {
if (this.allSelect) {
this.tempData.forEach(item => {
if (!item.disabled) {
item.check = true;
}
});
} else {
this.tempData.forEach(item => {
if (!item.disabled) {
item.check = false;
}
});
}
},
// code
serializeCodeListWithSeparator(sep) {
const codeList = [];
if (this.selection && this.selection.length) {
this.selection.forEach(elem => {
codeList.push(elem.code);
});
}
return codeList.join(sep);
},
clickEvent(row, event, column) {
this.highlight = false;
if (row && !row.disabled) {
this.highlight = true;
this.selection = [row];
this.beforeSectionList = row.containSectionList || [];
//
const operate = {
repeat: true,
type: MapDeviceType.Signal.type,
operation: '',
val: row.code,
selection: row
};
if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
/** 进路交人工控*/
operate.operation = OperationEvent.Signal.humanControl.choose.operation;
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
/** 进路交自动控*/
operate.operation = OperationEvent.Signal.atsAutoControl.choose.operation;
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
}
},
commit() {
if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
/** 进路交人工控*/
this.humanControl();
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
/** 进路交自动控*/
this.atsAutoControl();
}
},
//
humanControl() {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.humanControl.menu.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
atsAutoControl() {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.atsAutoControl.menu.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
cancel() {
const operate = {
type: MapDeviceType.Signal.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => { this.doClose(); });
}
}
};
</script>

View File

@ -27,7 +27,7 @@
</el-col> </el-col>
</el-row> </el-row>
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
<password-box ref="passwordBox" @checkOver="doClose" /> <password-box ref="passwordBox" @checkOver="passWordCommit" />
</el-dialog> </el-dialog>
</template> </template>
@ -129,6 +129,22 @@ export default {
this.fault(); this.fault();
} }
}, },
passWordCommit(data) {
const operate = {
send: true,
type: data.type,
operation: data.operateNext
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
// //
lock() { lock() {
const operate = { const operate = {
@ -192,10 +208,9 @@ export default {
// //
fault() { fault() {
const operate = { const operate = {
// send: true,
type: MapDeviceType.Section.type, type: MapDeviceType.Section.type,
operation: OperationEvent.Section.fault.menu.operation, operation: OperationEvent.Section.fault.menu.operation,
operateCode: OperationEvent.Section.fault.confirm.operation operateNext: OperationEvent.Section.fault.confirm.operation
}; };
this.loading = true; this.loading = true;

View File

@ -31,7 +31,7 @@
</el-col> </el-col>
</el-row> </el-row>
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
<password-box ref="passwordBox" @checkOver="doClose" /> <password-box ref="passwordBox" @checkOver="passWordCommit" />
</el-dialog> </el-dialog>
</template> </template>
@ -153,6 +153,22 @@ export default {
this.openPasswordBox(this.operation, OperationEvent.Switch.fault.confirm.operation); this.openPasswordBox(this.operation, OperationEvent.Switch.fault.confirm.operation);
} }
}, },
passWordCommit(data) {
const operate = {
send: true,
type: data.type,
operation: data.operateNext
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
// //
lock() { lock() {
const operate = { const operate = {
@ -311,11 +327,11 @@ export default {
}); });
}, },
// //
openPasswordBox(operation, code) { openPasswordBox(operation, operateNext) {
const operate = { const operate = {
type: MapDeviceType.Switch.type, type: MapDeviceType.Switch.type,
operation: operation, operation: operation,
operateCode: code operateNext: operateNext
}; };
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {

View File

@ -1,158 +1,153 @@
<template> <template>
<el-dialog class="chengdou-03__systerm route-create" :title="title" :visible.sync="show" width="580px" <el-dialog v-dialogDrag class="chengdou-03__systerm route-create" :title="title" :visible.sync="show" width="380px" label-position="top" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
label-position="top" :before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" <div style="padding: 10px 20px; border: 1px solid lightgray;">
v-dialogDrag> <el-form size="small" label-width="100px">
<div style="padding: 10px 20px; border: 1px solid lightgray;"> <el-form-item label="列车:" prop="trainCode">
<el-form size="small" label-width="100px"> <el-select v-model="trainCode" filterable placeholder="列车">
<el-form-item label="列车:" prop="trainCode"> <el-option
<el-select v-model="trainCode" filterable placeholder="列车"> v-for="item in trainList"
<el-option v-for="item in trainList" :key="item.code" :label="item.groupNumber" :key="item.code"
:value="item.code"></el-option> :label="item.groupNumber"
</el-select> :value="item.code"
</el-form-item> />
<!-- <el-form-item label="列车车次:" prop="tripNumber"> </el-select>
<el-select v-model="tripNumber" filterable placeholder="列车车次"> </el-form-item>
<el-option v-for="no in trainNoList" :key="no" :label="no" :value="no"></el-option> <el-form-item label="列车方向:" prop="direction">
</el-select> <el-select v-model="direction" filterable placeholder="列车方向">
<div style="font-size: 12px;">(上行路线车次号选择偶数下行路线车次号选择基数)</div> <el-option v-for="no in directionList" :key="no.value" :label="no.label" :value="no.value" />
</el-form-item> --> </el-select>
<el-form-item label="列车方向:" prop="direction"> <!-- <div style="font-size: 12px;">(上行路线车次号选择偶数下行路线车次号选择基数)</div> -->
<el-select v-model="direction" filterable placeholder="列车方向"> </el-form-item>
<el-option v-for="no in directionList" :key="no.value" :label="no.label" :value="no.value"> </el-form>
</el-option> <el-row>
</el-select> <el-col style="text-align: right;">
<!-- <div style="font-size: 12px;">(上行路线车次号选择偶数下行路线车次号选择基数)</div> --> <el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-form-item> <el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-form> </el-col>
<el-row> </el-row>
<el-col style="text-align: right;"> </div>
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button> <notice-info ref="noticeInfo" />
<el-button :id="domIdCancel" @click="cancel"> </el-button> </el-dialog>
</el-col>
</el-row>
</div>
<notice-info ref="noticeInfo"></notice-info>
</el-dialog>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map'; import { getPublishTrainList } from '@/api/jmap/map';
import { mouseCancelState } from '../utils/menuItemStatus'; import { mouseCancelState } from '../utils/menuItemStatus';
import NoticeInfo from './childDialog/childDialog/noticeInfo' import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default { export default {
name: 'RouteCreate', name: 'RouteCreate',
components: { components: {
NoticeInfo NoticeInfo
}, },
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
trainList: [], trainList: [],
trainNoList: [], trainNoList: [],
directionList: [ directionList: [
{ {
value: '2', value: '2',
label: '上行' label: '上行'
}, },
{ {
value: '1', value: '1',
label: '下行' label: '下行'
} }
], ],
trainCode: '', trainCode: '',
tripNumber: '', tripNumber: '',
direction: '', direction: '',
selected: null selected: null
} };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'map' 'map'
]), ]),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
domIdConfirm() { domIdConfirm() {
return OperationEvent.Section.newtrain.menu.domId; return OperationEvent.Section.newtrain.menu.domId;
}, },
title() { title() {
return '设置列车'; return '设置列车';
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}) });
}, },
methods: { methods: {
loadInitData(map) { loadInitData(map) {
if (Object.keys(map || {}).length) { if (Object.keys(map || {}).length) {
getPublishTrainList(map.skinCode).then(response => { getPublishTrainList(map.skinCode).then(response => {
this.trainList = response.data; this.trainList = response.data;
}).catch(error => { }).catch(() => {
this.$messageBox(`获取列车列表失败`); this.$messageBox(`获取列车列表失败`);
}) });
} }
}, },
doShow(operate, selected) { doShow(operate, selected) {
this.dialogShow = true; this.dialogShow = true;
this.selected = selected; this.selected = selected;
console.log(this.map);
/** 加载列车数据*/
this.loadInitData(this.map);
/** 加载列车数据*/ this.$nextTick(function () {
this.loadInitData(this.map); this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.trainCode = '';
this.direction = '';
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
},
commit() {
const operate = {
send: true,
type: MapDeviceType.Section.type,
operation: OperationEvent.Section.newtrain.menu.operation,
val: '' + this.direction + '::' + this.trainCode
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
cancel() {
const operate = {
type: MapDeviceType.Section.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$nextTick(function () { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('training/emitTipFresh'); if (valid) {
}); this.doClose();
}, }
doClose() { }).catch(() => {
this.trainCode = ''; this.doClose();
this.direction = ''; });
this.loading = false; }
this.dialogShow = false; }
this.$store.dispatch('training/emitTipFresh'); };
mouseCancelState(this.selected); </script>
},
commit() {
let operate = {
send: true,
type: MapDeviceType.Section.type,
operation: OperationEvent.Section.newtrain.menu.operation,
val: '' + this.direction + '::' + this.trainCode
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
cancel() {
let operate = {
type: MapDeviceType.Section.type,
operation: OperationEvent.Command.cancel.menu.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => {
this.doClose();
});
}
}
}
</script>

View File

@ -1,180 +1,174 @@
<template> <template>
<el-dialog class="chengdou-03__systerm stand-stop-time" :title="title" :visible.sync="show" width="480px" <el-dialog v-dialogDrag class="chengdou-03__systerm stand-stop-time" :title="title" :visible.sync="show" width="480px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag> <div class="el-dialog-div">
<div class="el-dialog-div"> <el-form ref="form" size="small" label-width="80px" :model="addModel" :rules="rules" label-position="left">
<el-form size="small" label-width="80px" :model="addModel" :rules="rules" ref="form" label-position="left"> <el-form-item>
<el-row> <el-col :span="11">
<el-col :span="11"> <el-form-item prop="stationName">
<el-form-item prop="stationName"> <span slot="label">车站</span>
<span slot="label">车站</span> <el-input v-model="addModel.stationName" :disabled="true" />
<el-input v-model="addModel.stationName" :disabled="true"></el-input> </el-form-item>
</el-form-item>
</el-col>
<el-col :span="11" :offset="1">
<el-form-item prop="trainWindowCode">
<span slot="label">车次窗</span>
<el-input v-model="addModel.trainWindowCode" :disabled="true"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="旧车组号" prop="oldGroupNumber">
<el-select v-model="addModel.oldGroupNumber" filterable disabled>
<el-option v-for="train in trainList" :key="train.oldGroupNumber" :label="train.oldGroupNumber"
:value="train.oldGroupNumber">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11" :offset="1">
<el-form-item label="新车组号" prop="newGroupNumber">
<el-select v-model="addModel.newGroupNumber">
<el-option v-for="train in trainList" :key="train.newGroupNumber" :label="train.newGroupNumber"
:value="train.newGroupNumber">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<el-row justify="center" class="button-group-train">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col> </el-col>
<el-col :span="8" :offset="4"> <el-col :span="11" :offset="1">
<el-button :id="domIdCancel" @click="cancel"> </el-button> <el-form-item prop="trainWindowCode">
<span slot="label">车次窗</span>
<el-input v-model="addModel.trainWindowCode" :disabled="true" />
</el-form-item>
</el-col>
</el-form-item>
<el-row>
<el-col :span="11">
<el-form-item label="旧车组号" prop="oldGroupNumber">
<el-select v-model="addModel.oldGroupNumber" filterable disabled>
<el-option v-for="train in trainList" :key="train.oldGroupNumber" :label="train.oldGroupNumber" :value="train.oldGroupNumber" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="11" :offset="1">
<el-form-item label="新车组号" prop="newGroupNumber">
<el-select v-model="addModel.newGroupNumber">
<el-option v-for="train in trainList" :key="train.newGroupNumber" :label="train.newGroupNumber" :value="train.newGroupNumber" />
</el-select>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-dialog> </el-form>
</div>
<el-row justify="center" class="button-group-train">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
</el-dialog>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus'; import { mouseCancelState } from '../utils/menuItemStatus';
import { getPublishTrainList } from '@/api/jmap/map'; import { getPublishTrainList } from '@/api/jmap/map';
export default { export default {
name: 'TrainEditNumber', name: 'TrainEditNumber',
components: { components: {
}, },
data() { data() {
return { return {
trainNoList: [], trainNoList: [],
trainList: [], trainList: [],
selected: null, selected: null,
addModel: { addModel: {
stationName:'', stationName: '',
trainWindowCode: '', trainWindowCode: '',
oldGroupNumber:'', oldGroupNumber: '',
newGroupNumber:'', newGroupNumber: ''
}, },
rules: { rules: {
newGroupNumber: [ newGroupNumber: [
{ required: true, message: '请输入新车组号', trigger: 'blur'} { required: true, message: '请输入新车组号', trigger: 'blur'}
], ]
}, },
dialogShow: false, dialogShow: false,
loading: false, loading: false
} };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'stationStandList' 'stationStandList'
]), ]),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
domIdConfirm() { domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : ''; return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : '';
}, },
title() { title() {
return '修改车组号' return '修改车组号';
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}) });
}, },
methods: { methods: {
loadInitData(map) { loadInitData(map) {
if (map) { if (map) {
getPublishTrainList(map.skinCode).then(resp => { getPublishTrainList(map.skinCode).then(resp => {
this.trainList = resp.data; this.trainList = resp.data;
}).catch(error => { }).catch(() => {
this.$messageBox(`获取列车车组号失败`); this.$messageBox(`获取列车车组号失败`);
}); });
} }
}, },
doShow(operate, selected) { doShow(operate, selected) {
this.selected = selected; this.selected = selected;
// //
if (!this.dialogShow) { if (!this.dialogShow) {
this.addModel ={ this.addModel ={
stationName:'', stationName: '',
trainWindowCode: '', trainWindowCode: '',
oldGroupNumber:'', oldGroupNumber: '',
newGroupNumber:'', newGroupNumber: ''
} };
} }
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false); this.$store.dispatch('map/setTrainWindowShow', false);
mouseCancelState(this.selected); mouseCancelState(this.selected);
}, },
commit() { commit() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
let operate = { const operate = {
send: true, send: true,
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
operation: OperationEvent.Train.editTrainNo.menu.operation, operation: OperationEvent.Train.editTrainNo.menu.operation
} };
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(error => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
// this.$refs.noticeInfo.doShow(operate); });
}) } else {
} else { return false;
return false; }
} });
}); },
}, cancel() {
cancel() { const operate = {
let operate = { type: MapDeviceType.Train.type,
type: MapDeviceType.Train.type, operation: OperationEvent.Command.cancel.menu.operation
operation: OperationEvent.Command.cancel.menu.operation, };
}
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(error => { this.doClose(); }); }).catch(() => { this.doClose(); });
} }
} }
} };
</script> </script>
<style scoped> <style scoped>
.chengdou-03__systerm .el-dialog .base-label { .chengdou-03__systerm .el-dialog .base-label {

View File

@ -13,7 +13,6 @@
<menu-section ref="menuSection" :selected="selected" /> <menu-section ref="menuSection" :selected="selected" />
<menu-train ref="menuTrain" :selected="selected" /> <menu-train ref="menuTrain" :selected="selected" />
<menu-station ref="menuStation" :selected="selected" /> <menu-station ref="menuStation" :selected="selected" />
<!-- <menu-limit ref="menuLimit" :selected="selected" /> -->
<passive-alarm ref="passiveAlarm" /> <passive-alarm ref="passiveAlarm" />
<passive-contorl ref="passiveControl" /> <passive-contorl ref="passiveControl" />
<passive-Timeout ref="passiveTimeout" /> <passive-Timeout ref="passiveTimeout" />
@ -33,7 +32,6 @@ import MenuSection from './menuSection';
import MenuTrain from './menuTrain'; import MenuTrain from './menuTrain';
import MenuStation from './menuStation'; import MenuStation from './menuStation';
import MenuBar from './menuBar'; import MenuBar from './menuBar';
// import MenuLimit from './menuLimit';
import PassiveAlarm from './passiveDialog/alarm'; import PassiveAlarm from './passiveDialog/alarm';
import PassiveContorl from './passiveDialog/control'; import PassiveContorl from './passiveDialog/control';
import PassiveTimeout from './passiveDialog/timeout'; import PassiveTimeout from './passiveDialog/timeout';
@ -51,7 +49,6 @@ export default {
MenuStationStand, MenuStationStand,
MenuStation, MenuStation,
MenuTrain, MenuTrain,
// MenuLimit,
PassiveAlarm, PassiveAlarm,
PassiveContorl, PassiveContorl,
PassiveTimeout PassiveTimeout
@ -74,7 +71,7 @@ export default {
this.$store.state.training.roles != 'BigScreen'; this.$store.state.training.roles != 'BigScreen';
}, },
isShowBar() { isShowBar() {
return this.$store.state.training.prdType != ''; return this.$store.state.training.prdType;
} }
}, },
watch: { watch: {

View File

@ -133,7 +133,7 @@ export default {
operate: OperationEvent.Command.mBar.system, operate: OperationEvent.Command.mBar.system,
children: [ children: [
{ {
title: '登', title: '登',
click: this.undeveloped click: this.undeveloped
}, },
{ {
@ -400,7 +400,7 @@ export default {
operate: OperationEvent.Command.mBar.system, operate: OperationEvent.Command.mBar.system,
children: [ children: [
{ {
title: '登', title: '登',
click: this.undeveloped click: this.undeveloped
}, },
{ {

View File

@ -97,13 +97,13 @@
<center><b></b><b></b></center> <center><b></b><b></b></center>
</span> </span>
</button> </button>
<button id="mbm_clear" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown('mbm_clear')"> <button :id="Command.cancel.clearMbm.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Command.cancel.clearMbm.operation)">
<span style="color: black"> <span style="color: black">
<center><b></b></center> <center><b></b></center>
<center><b></b></center> <center><b></b></center>
</span> </span>
</button> </button>
<password-box ref="password" @checkOver="doClose" /> <password-box ref="password" @checkOver="passWordCommit" />
</div> </div>
</template> </template>
@ -146,6 +146,9 @@ export default {
MixinCommand() { MixinCommand() {
return OperationEvent.MixinCommand; return OperationEvent.MixinCommand;
}, },
Command() {
return OperationEvent.Command;
},
isShowBtn() { isShowBtn() {
return this.$store.state.training.prdType == '01'; return this.$store.state.training.prdType == '01';
} }
@ -165,8 +168,19 @@ export default {
this.resetPosition(); this.resetPosition();
}, },
methods: { methods: {
doClose() { passWordCommit(data) {
const operate = {
type: 'mbm',
operation: data.operateNext
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
}, },
resetPosition() { resetPosition() {
this.$nextTick(() => { this.$nextTick(() => {
@ -199,30 +213,50 @@ export default {
} }
}, },
buttonDown(operation) { buttonDown(operation) {
if (operation != 'mbm_clear') { if (operation != this.Command.cancel.clearMbm.operation) {
const operate = { const operate = {
type: 'mbm', type: 'mbm',
operation: operation operation: operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.operation = operation;
this.$store.dispatch('menuOperation/setButtonOperation', operation); // this.$store.dispatch('menuOperation/setButtonOperation', operation); //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (operation == this.Signal.humanTrainRoute.button.operation) { // if (operation == this.Signal.humanTrainRoute.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
} else if (operation == this.Section.fault.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
} else if (operation == this.Switch.unlock.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
} else if (operation == this.MixinCommand.unblock.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate); this.$refs.password.doShow(operate);
} }
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
} }
}); });
} else { } else {
OperateHandler.cleanOperates(); // const operate = {
this.$store.dispatch('menuOperation/setButtonOperation', null); type: 'mbm',
operation: operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/setButtonOperation', null);
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
OperateHandler.cleanOperates(); //
}
});
} }
}, },
selectedChange() { selectedChange() {
// //
if (this.$store.state.menuOperation.buttonOperation) { if (this.$store.state.menuOperation.buttonOperation) {
const model = this.$store.state.menuOperation.selected; const model = this.$store.state.menuOperation.selected; //
if (model._type) { if (model._type) {
const deviceType = MapDeviceType[model._type]; const deviceType = MapDeviceType[model._type];
const modelData = deepAssign({}, model); const modelData = deepAssign({}, model);
@ -239,7 +273,12 @@ export default {
if (valid) { if (valid) {
if (response) { if (response) {
this.tempData = response.data; this.tempData = response.data;
// console.log(this.tempData, ''); }
if (this.operation == this.Signal.guide.button.operation) { //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
operate['operateNext'] = this.Command.close.password.operation;
this.operation = '0';
this.$refs.password.doShow(operate);
} }
} }
}); });

View File

@ -1,120 +0,0 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<cancel-all-limit ref="cancelAllLimit" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import CancelAllLimit from './dialog/cancelAllLimit';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState } from './utils/menuItemStatus';
export default {
name: 'MenuLimit',
components: {
PopMenu,
CancelAllLimit
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: '',
auth: { station: true, center: false }
}],
menuNormal: {
local: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: true, center: false }
}
],
central: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: false, center: true }
}
]
}
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.LimitControl) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu];
}
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
cancelSpeed() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.LimitControl.type,
label: MapDeviceType.LimitControl.label,
operation: OperationEvent.LimitControl.CancelAllLimit.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.cancelAllLimit.doShow(operate, this.selected);
}
});
}
}
};
</script>

View File

@ -5,6 +5,7 @@
<route-control ref="routeControl" /> <route-control ref="routeControl" />
<route-detail ref="routeDetail" /> <route-detail ref="routeDetail" />
<route-guide ref="routeGuide" /> <route-guide ref="routeGuide" />
<route-hand-control ref="routeHandControl" />
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
</div> </div>
</template> </template>
@ -14,6 +15,7 @@ import PopMenu from '@/components/PopMenu';
import RouteControl from './dialog/routeControl'; import RouteControl from './dialog/routeControl';
import RouteSelection from './dialog/routeSelection'; import RouteSelection from './dialog/routeSelection';
import RouteDetail from './dialog/routeDetail'; import RouteDetail from './dialog/routeDetail';
import RouteHandControl from './dialog/routeHandControl';
import RouteGuide from './dialog/routeGuide'; import RouteGuide from './dialog/routeGuide';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo'; import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
@ -28,6 +30,7 @@ export default {
PopMenu, PopMenu,
RouteControl, RouteControl,
RouteSelection, RouteSelection,
RouteHandControl,
RouteDetail, RouteDetail,
RouteGuide, RouteGuide,
NoticeInfo NoticeInfo
@ -441,7 +444,7 @@ export default {
tempData = response.data; tempData = response.data;
} }
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected, tempData); this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
} }
}); });
}, },
@ -462,7 +465,7 @@ export default {
tempData = response.data; tempData = response.data;
} }
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected, tempData); this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
} }
}); });
}, },

Some files were not shown because too many files have changed in this diff Show More