Merge remote-tracking branch 'origin/test'
@ -51,6 +51,14 @@ export function deleteMap(data) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除所有草稿地图 */
|
||||
export function deleteAllMap() {
|
||||
return request({
|
||||
url: `/api/mapBuild/delete/all`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
/** 保存草稿地图*/
|
||||
export function saveMap(data) {
|
||||
return request({
|
||||
@ -728,3 +736,10 @@ export function queryOverunSectionList(mapId) {
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
// 自动生成车辆段停车场连锁关系
|
||||
export function generateDepotCiData(mapId, stationCode) {
|
||||
return request({
|
||||
url: `/api/mapBuild/${mapId}/ci/generateAndSaveDepot?stationCode=${stationCode}`,
|
||||
method: 'post'
|
||||
});
|
||||
}
|
||||
|
BIN
src/assets/icon/transparent.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
src/assets/iscs_picture/check_arrow_double_hong.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
src/assets/iscs_picture/check_arrow_double_lv.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
src/assets/iscs_picture/check_arrow_left_hong.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
src/assets/iscs_picture/check_arrow_left_lv.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
src/assets/iscs_picture/check_arrow_right_hong.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
src/assets/iscs_picture/check_arrow_right_lv.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.2 KiB |
BIN
src/assets/iscs_picture/check_sell2_hong.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
src/assets/iscs_picture/check_sell2_lv.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
src/assets/iscs_picture/check_sell3.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
@ -5,6 +5,7 @@ export default {
|
||||
pleaseEnter: 'please input',
|
||||
sketchMap: 'Draft map list',
|
||||
newConstruction: 'Create',
|
||||
deleteAllMap: 'Delete All',
|
||||
importMap: 'Import the map',
|
||||
createNewMap: 'A new map',
|
||||
normalCreate: 'The normal to create',
|
||||
@ -569,6 +570,7 @@ export default {
|
||||
verifyMapName: 'Map name repeated, you confirm that publishing this map will overwrite the public map?',
|
||||
arcApproachSectionList: 'Interlock automatically tracks the approach section',
|
||||
greenOpen: 'Signal green light',
|
||||
signalColor:'Signal display',
|
||||
psdList: 'Platform screen door',
|
||||
espList: 'Platform emergency stop button',
|
||||
interlockingBlocks: 'Interlocking blocks',
|
||||
|
@ -76,8 +76,8 @@ export default {
|
||||
open: '开',
|
||||
front: '前',
|
||||
later: '后',
|
||||
electricGongSheng: '受电弓升',
|
||||
pantographFall: '受电弓降',
|
||||
electricGongSheng: '升弓',
|
||||
pantographFall: '降弓',
|
||||
lampButton: '试灯按钮',
|
||||
removalATP: 'ATP切除',
|
||||
infliction: '施加',
|
||||
|
@ -5,6 +5,7 @@ export default {
|
||||
pleaseEnter: '请输入',
|
||||
sketchMap: '草稿地图列表',
|
||||
newConstruction: '新建',
|
||||
deleteAllMap: '清空',
|
||||
bothCreate: '批量生成',
|
||||
importMap: '导入',
|
||||
createNewMap: '新建地图',
|
||||
@ -565,6 +566,7 @@ export default {
|
||||
verifyMapName: '地图名称重复,您确认发布此地图将会覆盖公共地图?',
|
||||
arcApproachSectionList: '联锁自动追踪接近区段',
|
||||
greenOpen: '信号开放绿灯(否则黄灯)',
|
||||
signalColor:'信号灯显示',
|
||||
psdList: '站台屏蔽门',
|
||||
espList: '站台紧急停车按钮',
|
||||
interlockingBlocks: '联锁区段',
|
||||
|
127
src/iscs/iscs.js
@ -180,14 +180,135 @@ class Iscs {
|
||||
update(list) {
|
||||
(list || []).forEach(elem => {
|
||||
const code = elem.code;
|
||||
const oDevice = this.iscsDevice[code];
|
||||
if (elem.dispose) {
|
||||
this.$painter.delete(oDevice);
|
||||
// 义乌项目暂时写死
|
||||
if (elem.deviceType === 'IBP') {
|
||||
if (this.iscsDevice['IscsCircle_20'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_20'].model.fillColor = elem.upStatus.operate ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_20']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_24'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_24'].model.fillColor = elem.downStatus.operate ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_24']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_17'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_17'].model.fillColor = elem.upStatus.openCommand ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_17']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_21'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_21'].model.fillColor = elem.downStatus.openCommand ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_21']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_18'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_18'].model.fillColor = elem.upStatus.openSideCommand ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_18']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_22'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_22'].model.fillColor = elem.downStatus.openSideCommand ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_22']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_19'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_19'].model.fillColor = elem.upStatus.closeCommand ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_19']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_23'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_23'].model.fillColor = elem.downStatus.closeCommand ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_23']);
|
||||
}
|
||||
} else if (elem.deviceType === 'PSL') {
|
||||
if (this.iscsDevice['IscsCircle_12'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_12'].model.fillColor = elem.upStatus.operate ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_12']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_13'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_13'].model.fillColor = elem.downStatus.operate ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_13']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_9'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_9'].model.fillColor = elem.upStatus.openCommand ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_9']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_14'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_14'].model.fillColor = elem.downStatus.openCommand ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_14']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_35'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_35'].model.fillColor = elem.upStatus.closeCommand ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_35']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_36'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_36'].model.fillColor = elem.downStatus.closeCommand ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_36']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_37'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_37'].model.fillColor = elem.upStatus.interlockRelease ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_37']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_38'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_38'].model.fillColor = elem.downStatus.interlockRelease ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_38']);
|
||||
}
|
||||
} else if (elem.deviceType === 'SAFETY_CIRCLE') {
|
||||
if (this.iscsDevice['IscsCircle_26'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_26'].model.fillColor = elem.upStatus.pfdcFault ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_26']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_28'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_28'].model.fillColor = elem.downStatus.pfdcFault ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_28']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_25'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_25'].model.fillColor = elem.upStatus.busFault ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_25']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_29'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_29'].model.fillColor = elem.downStatus.busFault ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_29']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_27'] && elem.upStatus) {
|
||||
this.iscsDevice['IscsCircle_27'].model.fillColor = elem.upStatus.safetyCircle ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_27']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_30'] && elem.downStatus) {
|
||||
this.iscsDevice['IscsCircle_30'].model.fillColor = elem.downStatus.safetyCircle ? '#0C0' : '#F00';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_30']);
|
||||
}
|
||||
} else if (elem.deviceType === 'SLIDING_DOOR') {
|
||||
const upPsdCodeList = ['FuzhouPsd_33', 'FuzhouPsd_34', 'FuzhouPsd_35', 'FuzhouPsd_36', 'FuzhouPsd_41', 'FuzhouPsd_42', 'FuzhouPsd_43', 'FuzhouPsd_44',
|
||||
'FuzhouPsd_61', 'FuzhouPsd_62', 'FuzhouPsd_63', 'FuzhouPsd_64', 'FuzhouPsd_69', 'FuzhouPsd_70', 'FuzhouPsd_71', 'FuzhouPsd_72', 'FuzhouPsd_65',
|
||||
'FuzhouPsd_66', 'FuzhouPsd_67', 'FuzhouPsd_68', 'FuzhouPsd_53', 'FuzhouPsd_54', 'FuzhouPsd_55', 'FuzhouPsd_56'];
|
||||
const downPsdCodeList = ['FuzhouPsd_1', 'FuzhouPsd_2', 'FuzhouPsd_3', 'FuzhouPsd_4', 'FuzhouPsd_9', 'FuzhouPsd_10', 'FuzhouPsd_11', 'FuzhouPsd_12',
|
||||
'FuzhouPsd_17', 'FuzhouPsd_18', 'FuzhouPsd_20', 'FuzhouPsd_19', 'FuzhouPsd_21', 'FuzhouPsd_22', 'FuzhouPsd_23', 'FuzhouPsd_24', 'FuzhouPsd_25',
|
||||
'FuzhouPsd_26', 'FuzhouPsd_27', 'FuzhouPsd_28', 'FuzhouPsd_29', 'FuzhouPsd_30', 'FuzhouPsd_31', 'FuzhouPsd_32'];
|
||||
if (this.iscsDevice['IscsCircle_57'] && elem.downStatus) {
|
||||
elem.downStatus && elem.downStatus.isolationMode ? this.iscsDevice['IscsCircle_57'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_57'].model.fillColor = '#FF0000';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_57']);
|
||||
}
|
||||
if (this.iscsDevice['IscsCircle_58'] && elem.upStatus) {
|
||||
elem.upStatus && elem.upStatus.isolationMode ? this.iscsDevice['IscsCircle_58'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_58'].model.fillColor = '#FF0000';
|
||||
this.$painter.update(this.iscsDevice['IscsCircle_58']);
|
||||
}
|
||||
upPsdCodeList.forEach(psdCode => {
|
||||
if (this.iscsDevice[psdCode] && elem.upStatus && elem.upStatus.status) {
|
||||
this.iscsDevice[psdCode].model.status = elem.upStatus.status;
|
||||
this.$painter.update(this.iscsDevice[psdCode]);
|
||||
}
|
||||
});
|
||||
downPsdCodeList.forEach(psdCode =>{
|
||||
if (this.iscsDevice[psdCode] && elem.downStatus && elem.downStatus.status) {
|
||||
this.iscsDevice[psdCode].model.status = elem.downStatus.status;
|
||||
this.$painter.update(this.iscsDevice[psdCode]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const oDevice = this.iscsDevice[code];
|
||||
if (oDevice && elem.dispose) {
|
||||
this.$painter.delete(oDevice);
|
||||
} else if (oDevice) {
|
||||
if (this.hookHandle(oDevice.model, elem)) {
|
||||
this.$painter.update(oDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
|
||||
|
@ -97,7 +97,7 @@ class Painter {
|
||||
} else {
|
||||
const instance = device.instance;
|
||||
if (instance) {
|
||||
instance.setState(device);
|
||||
instance.setState(device.model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,15 +68,29 @@ export default class fuzhouPsd extends Group {
|
||||
this.add(this.grouper);
|
||||
}
|
||||
setState(model) {
|
||||
if (model.alarm) {
|
||||
this.fuzhouPsdBorder.setStyle('lineWidth', 1);
|
||||
}
|
||||
if (model.noStatus) {
|
||||
// if (model.alarm) {
|
||||
// this.fuzhouPsdBorder.setStyle('lineWidth', 1);
|
||||
// }
|
||||
if (model.status === 'UNDEFINED') {
|
||||
this.fuzhouPsdLeft.attr({shape:{x: 2}});
|
||||
this.fuzhouPsdRight.attr({shape:{x: this.model.height * 0.9 - 0.4}});
|
||||
this.fuzhouPsdBorder.setStyle('fill', '#0f96dc');
|
||||
this.fuzhouPsdRight.setStyle('fill', '#0f96dc');
|
||||
this.fuzhouPsdLeft.setStyle('fill', '#0f96dc');
|
||||
} else if (model.status === 'DCU_FAULT') {
|
||||
this.fuzhouPsdBorder.setStyle('lineWidth', 1);
|
||||
} else if (model.status === 'OPEN') {
|
||||
this.fuzhouPsdLeft.attr({shape:{x: 2}});
|
||||
this.fuzhouPsdRight.attr({shape:{x: this.model.height * 0.9 - 0.4}});
|
||||
this.fuzhouPsdBorder.setStyle('fill', '#33CC00');
|
||||
this.fuzhouPsdRight.setStyle('fill', '#33CC00');
|
||||
this.fuzhouPsdLeft.setStyle('fill', '#33CC00');
|
||||
} else if (model.status === 'CLOSE') {
|
||||
this.fuzhouPsdLeft.attr({shape:{x: 2 + (this.model.height * 1.5 - 4) * 0.1}});
|
||||
this.fuzhouPsdRight.attr({shape:{x: (this.model.height * 1.5 - 4) * 0.5 + 2}});
|
||||
this.fuzhouPsdBorder.setStyle('fill', '#33CC00');
|
||||
this.fuzhouPsdRight.setStyle('fill', '#33CC00');
|
||||
this.fuzhouPsdLeft.setStyle('fill', '#33CC00');
|
||||
}
|
||||
}
|
||||
setModel(dx, dy) {
|
||||
|
@ -49,11 +49,20 @@ import iscsDibian from '@/assets/iscs_picture/iscs-dibian.png';
|
||||
import iscsPt1 from '@/assets/iscs_picture/iscs-pt1.png';
|
||||
import checkNormal from '@/assets/iscs_picture/check_normal.png';
|
||||
import checkArrowLeft from '@/assets/iscs_picture/check_arrow_left.png';
|
||||
import checkArrowLeftLv from '@/assets/iscs_picture/check_arrow_left_lv.png';
|
||||
import checkArrowLeftHong from '@/assets/iscs_picture/check_arrow_left_hong.png';
|
||||
import checkArrowRight from '@/assets/iscs_picture/check_arrow_right.png';
|
||||
import checkArrowRightLv from '@/assets/iscs_picture/check_arrow_right_lv.png';
|
||||
import checkArrowRightHong from '@/assets/iscs_picture/check_arrow_right_hong.png';
|
||||
import checkArrowDouble from '@/assets/iscs_picture/check_arrow_double.png';
|
||||
import checkArrowDoubleLv from '@/assets/iscs_picture/check_arrow_double_lv.png';
|
||||
import checkArrowDoubleHong from '@/assets/iscs_picture/check_arrow_double_hong.png';
|
||||
import checkFlowCumulative from '@/assets/iscs_picture/check_flow_cumulative.png';
|
||||
import checkSell from '@/assets/iscs_picture/check_sell.png';
|
||||
import checkSell2 from '@/assets/iscs_picture/check_sell2.png';
|
||||
import checkSell2Lv from '@/assets/iscs_picture/check_sell2_lv.png';
|
||||
import checkSell2Hong from '@/assets/iscs_picture/check_sell2_hong.png';
|
||||
import checkSell3 from '@/assets/iscs_picture/check_sell3.png';
|
||||
import bgShowRoom from '@/assets/iscs_picture/bg-showroom.jpg';
|
||||
import bgStand from '@/assets/iscs_picture/bg-stand.jpg';
|
||||
import bgFasPlatformA from '@/assets/iscs_picture/fas_platform_a_bg.png';
|
||||
@ -131,11 +140,17 @@ const pictureObj = {
|
||||
iscsPt1,
|
||||
checkNormal,
|
||||
checkArrowLeft,
|
||||
checkArrowLeftLv,
|
||||
checkArrowLeftHong,
|
||||
checkArrowRight,
|
||||
checkArrowRightLv,
|
||||
checkArrowRightHong,
|
||||
checkArrowDouble,
|
||||
checkFlowCumulative,
|
||||
checkSell,
|
||||
checkSell2,
|
||||
checkSell2Lv,
|
||||
checkSell2Hong,
|
||||
bgShowRoom,
|
||||
bgStand,
|
||||
basAnnulus,
|
||||
@ -210,6 +225,9 @@ export default class Picture extends Group {
|
||||
this.grouper.add(this.imageButton);
|
||||
this.add(this.grouper);
|
||||
}
|
||||
setStyle( style ) {
|
||||
this.imageButton.setStyle(style);
|
||||
}
|
||||
setModel(dx, dy) {
|
||||
this.model.point.x += dx;
|
||||
this.model.point.y += dy;
|
||||
|
@ -662,15 +662,16 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
|
||||
}
|
||||
//根据数据切换设备样式
|
||||
this.updateaction = function (data) {
|
||||
|
||||
if (data.type == "SWITCH") {
|
||||
if (data.normal == "0") {
|
||||
scope.modelmanager.switchmodel.normalPosition = "0";
|
||||
if (data.command == 'NP') {
|
||||
scope.modelmanager.switchmodel.normalPosition = data.command;
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = 0;
|
||||
scope.modelmanager.switchmodel.action.timeScale = 1;
|
||||
scope.modelmanager.switchmodel.action.play();
|
||||
} else if (data.normal == "1") {
|
||||
scope.modelmanager.switchmodel.normalPosition = "1";
|
||||
} else if (data.command == 'RP') {
|
||||
scope.modelmanager.switchmodel.normalPosition = data.command;
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
|
||||
scope.modelmanager.switchmodel.action.timeScale = -1;
|
||||
@ -678,36 +679,79 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.type == "SIGNAL") {//从上往下红绿黄
|
||||
|
||||
if(data.red == 1){
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = scope.signallights["red"];
|
||||
/** 无显示,灭灯 */
|
||||
if(data.command == 'No'){
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
|
||||
}
|
||||
if(data.yellow == 1){
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = scope.signallights["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
|
||||
}
|
||||
if(data.green == 1){
|
||||
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = scope.signallights["green"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红 */
|
||||
if(data.command == 'R'){
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["red"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 绿 */
|
||||
if(data.command == 'G'){
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["green"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 黄 */
|
||||
if(data.command == 'Y'){
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 月白 */
|
||||
if(data.command == 'W'){
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 蓝 */
|
||||
if(data.command == 'B'){
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红黄 */
|
||||
if(data.command == 'RY'){
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["red"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.type == "PSD" || data.type == "STAND") {
|
||||
|
||||
if (data.code == scope.nowcode) {
|
||||
if (data.open == "1" ) {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "0";
|
||||
if (data.command == 'K' ) {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = data.command;
|
||||
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = 0;
|
||||
@ -717,8 +761,8 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
|
||||
localVoicePlay("开往"+psdVoiceStationList[data.code].finlStationName+"方向的列车进站了!");
|
||||
}
|
||||
|
||||
if (data.open == "0" ) {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
|
||||
if (data.command == 'G' ) {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = data.command;
|
||||
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
|
||||
|
@ -130,3 +130,27 @@ export function trainSimulationDoorControl(group, data) {
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export function trainSimulationDoorSelection(group, data) {
|
||||
return request({
|
||||
url: `/simulation/${group}/operate/Driver_Door_Selection`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export function trainSimulationDoorMode(group, data) {
|
||||
return request({
|
||||
url: `/simulation/${group}/operate/Driver_Door_Mode`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export function trainSimulationCommand(group,data,operate) {
|
||||
return request({
|
||||
url: `/simulation/${group}/operate/${operate}`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
|
||||
scene.add(controls3.getObject());
|
||||
|
||||
let cameracctv = new THREE.PerspectiveCamera(50, dom.clientWidth/dom.clientHeight, 0.1, 50);
|
||||
cameracctv.position.set( -3, 0,4.5 );
|
||||
cameracctv.position.set( 1, 0,4.5 );
|
||||
|
||||
cameracctv.rotation.y = -Math.PI/2;
|
||||
cameracctv.rotation.x = Math.PI/2;
|
||||
@ -386,8 +386,8 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
|
||||
realsectionlist = loadrealsectionlist;
|
||||
rails = loadrails;
|
||||
|
||||
console.log(trainlisttest.group.children[0]);
|
||||
trainlisttest.group.children[0].getObjectByName("C3").add(cameracctv);
|
||||
// console.log(trainlisttest.group.children[0]);
|
||||
trainlisttest.group.children[0].getObjectByName("C6").add(cameracctv);
|
||||
}
|
||||
|
||||
this.eventon = function() {
|
||||
|
@ -81,7 +81,6 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(data.type == "DeviceCtrl_3D"){
|
||||
// console.log(data);
|
||||
if (data.body.type== 'SIGNAL' && signallist) {
|
||||
@ -107,6 +106,18 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
DeviceDestroy(data.body);
|
||||
return;
|
||||
}
|
||||
|
||||
if(data.type == "Simulation_Reset"){
|
||||
if(data.body == true ){
|
||||
restartTrain();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function restartTrain(){
|
||||
for(let i=0;i<trainlisttest.otherTrainmodels.length;i++){
|
||||
trainlisttest.otherTrainmodels[i].position.x = -99999;
|
||||
}
|
||||
}
|
||||
//切换车辆修改列车属性
|
||||
function changeNowTrain(data){
|
||||
@ -314,6 +325,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function tdtUpdate(data){
|
||||
|
||||
tdt.updateTdt(data.body);
|
||||
@ -809,22 +821,21 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
// console.log("direct:"+trainmodel.right);
|
||||
// console.log(trainmodel.openleft);
|
||||
// console.log(trainmodel.openright);
|
||||
if(trainmodel.code == data.code){
|
||||
|
||||
if(trainmodel.code == data.trainCode){
|
||||
if(trainmodel.right == "0"){
|
||||
if(data.doorCode == "2"){
|
||||
if(data.code == "2"){
|
||||
|
||||
if(trainmodel.openleft != data.open && data.open == "0"){
|
||||
trainmodel.openleft = "0";
|
||||
if(trainmodel.openleft != data.command && data.command == "G"){
|
||||
trainmodel.openleft = data.command;
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].reset();
|
||||
actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration;
|
||||
actions["traindoor"].top[an].timeScale = -1;
|
||||
actions["traindoor"].top[an].play();
|
||||
|
||||
}
|
||||
}else if(trainmodel.openleft != data.open && data.open == "1"){
|
||||
trainmodel.openleft = "1";
|
||||
console.log(data);
|
||||
}else if(trainmodel.openleft != data.command && data.command == "K"){
|
||||
trainmodel.openleft = data.command;
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].reset();
|
||||
actions["traindoor"].top[an].time = 0;
|
||||
@ -835,16 +846,16 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
}else{
|
||||
|
||||
|
||||
if (trainmodel.openright != data.open && data.open == '0') {
|
||||
trainmodel.openright = '0';
|
||||
if (trainmodel.openright != data.command && data.command == 'G') {
|
||||
trainmodel.openright = data.command;
|
||||
for (let an=actions["traindoor"].down.length-1; an>=0; an--) {
|
||||
actions["traindoor"].down[an].reset();
|
||||
actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration;
|
||||
actions["traindoor"].down[an].timeScale = -1;
|
||||
actions["traindoor"].down[an].play();
|
||||
}
|
||||
} else if (trainmodel.openright != data.open && data.open == '1') {
|
||||
trainmodel.openright = "1";
|
||||
} else if (trainmodel.openright != data.command && data.command == 'K') {
|
||||
trainmodel.openright = data.command;
|
||||
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
|
||||
actions["traindoor"].down[an].reset();
|
||||
actions["traindoor"].down[an].time = 0;
|
||||
@ -855,18 +866,18 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
|
||||
}
|
||||
}else{
|
||||
if(data.doorCode == "1"){
|
||||
if(data.code == "1"){
|
||||
|
||||
if(trainmodel.openleft != data.open && data.open == "0"){
|
||||
trainmodel.openleft = "0";
|
||||
if(trainmodel.openleft != data.command && data.command == "G"){
|
||||
trainmodel.openleft = data.command;
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].reset();
|
||||
actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration;
|
||||
actions["traindoor"].top[an].timeScale = -1;
|
||||
actions["traindoor"].top[an].play();
|
||||
}
|
||||
}else if(trainmodel.openleft != data.open && data.open == "1"){
|
||||
trainmodel.openleft = "1";
|
||||
}else if(trainmodel.openleft != data.command && data.command == "K"){
|
||||
trainmodel.openleft = data.command;
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].reset();
|
||||
actions["traindoor"].top[an].time = 0;
|
||||
@ -875,16 +886,16 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (trainmodel.openright != data.open && data.open == '0') {
|
||||
trainmodel.openright = '0';
|
||||
if (trainmodel.openright != data.command && data.command == 'G') {
|
||||
trainmodel.openright = data.command;
|
||||
for (let an=actions["traindoor"].down.length-1; an>=0; an--) {
|
||||
actions["traindoor"].down[an].reset();
|
||||
actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration;
|
||||
actions["traindoor"].down[an].timeScale = -1;
|
||||
actions["traindoor"].down[an].play();
|
||||
}
|
||||
} else if (trainmodel.openright != data.open && data.open == '1') {
|
||||
trainmodel.openright = "1";
|
||||
} else if (trainmodel.openright != data.command && data.command == 'K') {
|
||||
trainmodel.openright = data.command;
|
||||
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
|
||||
actions["traindoor"].down[an].reset();
|
||||
actions["traindoor"].down[an].time = 0;
|
||||
@ -957,15 +968,15 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
function initstand(data) {
|
||||
code = data.code;
|
||||
if ( actions[code]) {
|
||||
if (data.close == '1') {
|
||||
actions[code].status = '1';
|
||||
if (data.command == 'K') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
if (data.close == '0') {
|
||||
actions[code].status = '0';
|
||||
if (data.command == 'G') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
@ -975,16 +986,17 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
}
|
||||
function standupdate(data) {
|
||||
code = data.code;
|
||||
|
||||
if ( actions[code]) {
|
||||
if (data.open == '1') {
|
||||
actions[code].status = '1';
|
||||
if (data.command == 'K') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
if (data.open == '0') {
|
||||
actions[code].status = '0';
|
||||
if (data.command == 'G') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
@ -994,72 +1006,108 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
}
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
if(data.red == 1){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
}else{
|
||||
|
||||
if(data.command == 'No'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if(data.yellow == 1){
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
|
||||
}else{
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
if(data.green == 1){
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}else{
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
/** 红 */
|
||||
if(data.command == 'R'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 绿 */
|
||||
if(data.command == 'G'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 黄 */
|
||||
if(data.command == 'Y'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 月白 */
|
||||
if(data.command == 'W'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 蓝 */
|
||||
if(data.command == 'B'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红黄 */
|
||||
if(data.command == 'RY'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function initswitch(data) {
|
||||
code = data.code;
|
||||
if (data.routeLock == '0') {
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "02";
|
||||
} else if (data.routeLock == '1') {
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "01";
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
if (actions[code].normal != data.normal) {
|
||||
if (data.normal == '02') {
|
||||
if (actions[code].command != data.command) {
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "02";
|
||||
} else if (data.normal == '01') {
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "01";
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) {
|
||||
setpsdstationmap(JSON.parse(netdata.data.stands));
|
||||
Standtextureload(scope,netDataAssets.stationTextureList[0]);
|
||||
scope.modelmanager.loadpromise(JSON.parse(netdata.data.assets).maintainerAssetList, scope.mixers).then(function (data) {
|
||||
moveanima.initlistnew(scope.modelmanager.switchmodel.mesh);
|
||||
moveanima.initSwitchAnima(scope.modelmanager.switchmodel.mesh);
|
||||
daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA");
|
||||
|
||||
if(scope.modelmanager.standmodel.mesh.getObjectByName("zhantailiebiao") && scope.stationtexture["devicelist"]){
|
||||
@ -257,11 +257,10 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) {
|
||||
scope.modelmanager.standmodel.action.time = 0;
|
||||
scope.modelmanager.standmodel.action.timeScale = 1;
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
console.log(data.standCode);
|
||||
console.log(psdtexturemap);
|
||||
|
||||
if(psdtexturemap[data.code]){
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.code]];
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("DXHDQG").material.map =scope.stationtexture[psdtexturemap[data.code]];
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("DXHDQG").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
@ -285,7 +284,7 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) {
|
||||
} else {
|
||||
scope.nowcode = data.code;
|
||||
if (data.type == "room") {
|
||||
console.log(scope.modelmanager.roommodel.mesh);
|
||||
// console.log(scope.modelmanager.roommodel.mesh);
|
||||
scope.showmodel = scope.modelmanager.roommodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
scope.camera.position.set(5, 7, -9);
|
||||
@ -336,8 +335,8 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) {
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
|
||||
if(psdtexturemap[data.code]){
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.code]];
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("DXHDQG").material.map =scope.stationtexture[psdtexturemap[data.code]];
|
||||
scope.modelmanager.standmodel.mesh.getObjectByName("DXHDQG").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
|
||||
@ -434,14 +433,14 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) {
|
||||
|
||||
this.updateaction = function (data) {
|
||||
if (data.type == "SWITCH") {
|
||||
if (data.normal == "0") {
|
||||
scope.modelmanager.switchmodel.normalPosition = "0";
|
||||
if (data.command == 'NP') {
|
||||
scope.modelmanager.switchmodel.normalPosition = data.command;
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = 0;
|
||||
scope.modelmanager.switchmodel.action.timeScale = 1;
|
||||
scope.modelmanager.switchmodel.action.play();
|
||||
} else if (data.normal == "1") {
|
||||
scope.modelmanager.switchmodel.normalPosition = "1";
|
||||
} else if (data.command == 'RP') {
|
||||
scope.modelmanager.switchmodel.normalPosition = data.command;
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
|
||||
scope.modelmanager.switchmodel.action.timeScale = -1;
|
||||
@ -450,34 +449,77 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) {
|
||||
|
||||
}
|
||||
if (data.type == "SIGNAL") {//从上往下红绿黄
|
||||
if(data.red == 1){
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
|
||||
|
||||
if(data.command == 'No'){
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
}
|
||||
if(data.yellow == 1){
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
if(data.green == 1){
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["green"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红 */
|
||||
if(data.command == 'R'){
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["red"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}
|
||||
/** 绿 */
|
||||
if(data.command == 'G'){
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["green"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}
|
||||
/** 黄 */
|
||||
if(data.command == 'Y'){
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}
|
||||
/** 月白 */
|
||||
if(data.command == 'W'){
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}
|
||||
/** 蓝 */
|
||||
if(data.command == 'B'){
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红黄 */
|
||||
if(data.command == 'RY'){
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["red"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (data.type == "PSD") {
|
||||
if (data.code == scope.nowcode) {
|
||||
if (data.open == "1" ) {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "0";
|
||||
if (data.command == 'K' ) {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = data.command;
|
||||
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = 0;
|
||||
@ -485,8 +527,8 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) {
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
}
|
||||
|
||||
if (data.open == "0" ) {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
|
||||
if (data.command == 'G' ) {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = data.command;
|
||||
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
|
||||
|
@ -196,8 +196,8 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
if(event.data.body.type == "SIGNAL"){
|
||||
newfault.name = lableCodeMap.signal[newfault.code];
|
||||
newfault.typetext = "信号机";
|
||||
if(event.data.body.fault[1] == "MAIN_FILAMENT_BROKEN"){
|
||||
newfault.text = "主灯丝断丝故障";
|
||||
if(event.data.body.fault[1] == "NO_OPEN"){
|
||||
newfault.text = "无法开放(非CTC)";
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,8 +407,8 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
if(fault[i].type == "SIGNAL"){
|
||||
newfault.name = lableCodeMap.signal[newfault.code];
|
||||
newfault.typetext = "信号机";
|
||||
if(fault[i].fault[1] == "MAIN_FILAMENT_BROKEN"){
|
||||
newfault.text = "主灯丝断丝故障";
|
||||
if(fault[i].fault[1] == "NO_OPEN"){
|
||||
newfault.text = "无法开放(非CTC)";
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,7 +475,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
|
||||
// setpsdstationmap(JSON.parse(netdata.data.stands));
|
||||
scope.modelmanager.loadpromise(mixers).then(function (data) {
|
||||
switchModel = scope.modelmanager.otherDevice.mesh.getObjectByName("SWITCH1");
|
||||
moveanima.initlistnew(switchModel);
|
||||
moveanima.initSwitchAnima(switchModel);
|
||||
|
||||
scope.devicetext.initdevicetext(switchModel);
|
||||
// scope.scene.add(switchModel);
|
||||
|
@ -14,7 +14,7 @@ export function MoveanimateVr(main){
|
||||
this.status = true;
|
||||
//当前动画模型
|
||||
this.nowmodelname = undefined;
|
||||
this.initlistnew = function(switchmodel){
|
||||
this.initSwitchAnima = function(switchmodel){
|
||||
|
||||
|
||||
scope.animatelist[switchmodel.animacode+"chaijie"] = [];
|
||||
|
@ -202,8 +202,8 @@ export function Jl3dOtherVR(dom,group,skinCode) {
|
||||
if(event.data.body.type == "SIGNAL"){
|
||||
newfault.name = lableCodeMap.signal[newfault.code];
|
||||
newfault.typetext = "信号机";
|
||||
if(event.data.body.fault[1] == "MAIN_FILAMENT_BROKEN"){
|
||||
newfault.text = "主灯丝断丝故障";
|
||||
if(event.data.body.fault[1] == "NO_OPEN"){
|
||||
newfault.text = "无法开放(非CTC)";
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,8 +388,8 @@ export function Jl3dOtherVR(dom,group,skinCode) {
|
||||
if(fault[i].type == "SIGNAL"){
|
||||
newfault.name = lableCodeMap.signal[newfault.code];
|
||||
newfault.typetext = "信号机";
|
||||
if(fault[i].fault[1] == "MAIN_FILAMENT_BROKEN"){
|
||||
newfault.text = "主灯丝断丝故障";
|
||||
if(fault[i].fault[1] == "NO_OPEN"){
|
||||
newfault.text = "无法开放(非CTC)";
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ export function Jl3dOtherVR(dom,group,skinCode) {
|
||||
// setpsdstationmap(JSON.parse(netdata.data.stands));
|
||||
scope.modelmanager.loadpromise(mixers).then(function (data) {
|
||||
switchModel = scope.modelmanager.otherDevice.mesh.getObjectByName("SWITCH");
|
||||
moveanima.initlistnew(switchModel);
|
||||
moveanima.initSwitchAnima(switchModel);
|
||||
|
||||
scope.devicetext.initdevicetext(switchModel);
|
||||
// scope.scene.add(switchModel);
|
||||
|
@ -72,8 +72,8 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
if(event.data.body.type == "SIGNAL"){
|
||||
newfault.name = lablecodemap.signal[newfault.code];
|
||||
newfault.typetext = "信号机";
|
||||
if(event.data.body.fault == "MAIN_FILAMENT_BROKEN"){
|
||||
newfault.text = "主灯丝断丝故障";
|
||||
if(event.data.body.fault == "NO_OPEN"){
|
||||
newfault.text = "无法开放(非CTC)";
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,16 +81,41 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
newfault.name = lablecodemap.switch[newfault.code];
|
||||
newfault.typetext = "道岔";
|
||||
if(event.data.body.fault == "SPLIT"){
|
||||
newfault.text = "道岔挤岔";
|
||||
newfault.text = "失表";
|
||||
}
|
||||
if(event.data.body.fault == "NORMAL_SPLIT"){
|
||||
newfault.text = "定位失表";
|
||||
}
|
||||
if(event.data.body.fault == "REVERSE_SPLIT"){
|
||||
newfault.text = "反位失表";
|
||||
}
|
||||
if(event.data.body.fault == "SQUEEZE"){
|
||||
newfault.text = "挤岔";
|
||||
}
|
||||
if(event.data.body.fault == "CBTC_OCCUPIED_FAULT"){
|
||||
newfault.text = "通信车占用";
|
||||
}
|
||||
if(event.data.body.fault == "AXLE_FAULT"){
|
||||
newfault.text = "红光带故障";
|
||||
}
|
||||
if(event.data.body.fault == "ARB"){
|
||||
newfault.text = "橙光带故障";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(event.data.body.type == "SECTION"){
|
||||
newfault.name = lablecodemap.section[newfault.code];
|
||||
newfault.typetext = "区段";
|
||||
if(event.data.body.fault == "FAULT"){
|
||||
newfault.text = "计轴故障";
|
||||
newfault.text = "红光带故障";
|
||||
}
|
||||
|
||||
if(event.data.body.fault == "CBTC_OCCUPIED_FAULT"){
|
||||
newfault.text = "通信车占用";
|
||||
}
|
||||
|
||||
if(event.data.body.fault == "ARB"){
|
||||
newfault.text = "橙光带故障";
|
||||
}
|
||||
|
||||
}
|
||||
@ -105,6 +130,9 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
newfault.text = "屏蔽门无法开启";
|
||||
}
|
||||
|
||||
if(event.data.body.fault == "NO_CLOSE_AND_LOCK"){
|
||||
newfault.text = "无关闭锁紧信号";
|
||||
}
|
||||
}
|
||||
|
||||
warningmsg("新的故障设备:"+event.data.body.code);
|
||||
@ -138,8 +166,8 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
if(fault[i].type == "SIGNAL"){
|
||||
newfault.name = lablecodemap.signal[newfault.code];
|
||||
newfault.typetext = "信号机";
|
||||
if(fault[i].fault == "MAIN_FILAMENT_BROKEN"){
|
||||
newfault.text = "主灯丝断丝故障";
|
||||
if(fault[i].fault == "NO_OPEN"){
|
||||
newfault.text = "无法开放(非CTC)";
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,23 +175,50 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
newfault.name = lablecodemap.switch[newfault.code];
|
||||
newfault.typetext = "道岔";
|
||||
if(fault[i].fault == "SPLIT"){
|
||||
newfault.text = "失表";
|
||||
}
|
||||
if(fault[i].fault == "NORMAL_SPLIT"){
|
||||
newfault.text = "定位失表";
|
||||
}
|
||||
if(fault[i].fault == "REVERSE_SPLIT"){
|
||||
newfault.text = "道岔挤岔";
|
||||
}
|
||||
if(fault[i].fault == "SQUEEZE"){
|
||||
newfault.text = "反位失表";
|
||||
}
|
||||
if(fault[i].fault == "CBTC_OCCUPIED_FAULT"){
|
||||
newfault.text = "通信车占用";
|
||||
}
|
||||
if(fault[i].fault == "AXLE_FAULT"){
|
||||
newfault.text = "红光带故障";
|
||||
}
|
||||
if(fault[i].fault == "ARB"){
|
||||
newfault.text = "橙光带故障";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(fault[i].type == "SECTION"){
|
||||
newfault.name = lablecodemap.section[newfault.code];
|
||||
newfault.typetext = "区段";
|
||||
|
||||
if(fault[i].fault == "FAULT"){
|
||||
newfault.text = "计轴故障";
|
||||
newfault.text = "红光带故障";
|
||||
}
|
||||
|
||||
if(fault[i].fault == "CBTC_OCCUPIED_FAULT"){
|
||||
newfault.text = "通信车占用";
|
||||
}
|
||||
|
||||
if(fault[i].fault == "ARB"){
|
||||
newfault.text = "橙光带故障";
|
||||
}
|
||||
}
|
||||
|
||||
if(fault[i].type == "STAND"){
|
||||
newfault.name = newfault.code;
|
||||
newfault.typetext = "屏蔽门";
|
||||
|
||||
if(fault[i].fault == "PSD_CANNOT_BE_CLOSED"){
|
||||
newfault.text = "屏蔽门无法关闭";
|
||||
}
|
||||
@ -171,6 +226,10 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
newfault.text = "屏蔽门无法开启";
|
||||
}
|
||||
|
||||
if(fault[i].fault == "NO_CLOSE_AND_LOCK"){
|
||||
newfault.text = "无关闭锁紧信号";
|
||||
}
|
||||
|
||||
}
|
||||
updatefault(newfault);
|
||||
}
|
||||
@ -626,20 +685,20 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
}
|
||||
|
||||
function traindoorupdate(data){
|
||||
let code = data.code;
|
||||
let code = data.trainCode;
|
||||
if(trainlisttest.list[code].right == "0"){
|
||||
if(data.doorCode == "2"){
|
||||
if(data.code == "2"){
|
||||
|
||||
if(trainlisttest.list[code].open != data.open && data.open == "0"){
|
||||
trainlisttest.list[code].open = "0";
|
||||
if(trainlisttest.list[code].open != data.command && data.command == "G"){
|
||||
trainlisttest.list[code].open = data.command;
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = -1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}else if(trainlisttest.list[code].open != data.open && data.open == "1"){
|
||||
trainlisttest.list[code].open = "1";
|
||||
}else if(trainlisttest.list[code].open != data.command && data.command == "K"){
|
||||
trainlisttest.list[code].open = data.command;
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
@ -650,16 +709,16 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
}else{
|
||||
|
||||
|
||||
if (trainlisttest.list[code].open != data.open && data.open == '0') {
|
||||
trainlisttest.list[code].open = '0';
|
||||
if (trainlisttest.list[code].open != data.command && data.command == 'G') {
|
||||
trainlisttest.list[code].open = data.command;
|
||||
for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
||||
actions[code].down[an].timeScale = -1;
|
||||
actions[code].down[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].open != data.open && data.open == '1') {
|
||||
trainlisttest.list[code].open = "1";
|
||||
} else if (trainlisttest.list[code].open != data.command && data.command == 'K') {
|
||||
trainlisttest.list[code].open = data.command;
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = 0;
|
||||
@ -670,18 +729,18 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
|
||||
}
|
||||
}else{
|
||||
if(data.doorCode == "1"){
|
||||
if(data.code == "1"){
|
||||
|
||||
if(trainlisttest.list[code].open != data.open && data.open == "0"){
|
||||
trainlisttest.list[code].open = "0";
|
||||
if(trainlisttest.list[code].open != data.command && data.command == "G"){
|
||||
trainlisttest.list[code].open = data.command;
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = -1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}else if(trainlisttest.list[code].open != data.open && data.open == "1"){
|
||||
trainlisttest.list[code].open = "1";
|
||||
}else if(trainlisttest.list[code].open != data.command && data.command == "K"){
|
||||
trainlisttest.list[code].open = data.command;
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
@ -692,16 +751,16 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
}else{
|
||||
|
||||
|
||||
if (trainlisttest.list[code].open != data.open && data.open == '0') {
|
||||
trainlisttest.list[code].open = '0';
|
||||
if (trainlisttest.list[code].open != data.command && data.command == 'G') {
|
||||
trainlisttest.list[code].open = data.command;
|
||||
for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
||||
actions[code].down[an].timeScale = -1;
|
||||
actions[code].down[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].open != data.open && data.open == '1') {
|
||||
trainlisttest.list[code].open = "1";
|
||||
} else if (trainlisttest.list[code].open != data.command && data.command == 'K') {
|
||||
trainlisttest.list[code].open = data.command;
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = 0;
|
||||
@ -769,18 +828,19 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initstand(data) {
|
||||
code = data.code;
|
||||
if ( actions[code]) {
|
||||
if (data.close == '1') {
|
||||
actions[code].status = '1';
|
||||
if (data.command == 'K') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
if (data.close == '0') {
|
||||
actions[code].status = '0';
|
||||
if (data.command == 'G') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
@ -788,18 +848,19 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function standupdate(data) {
|
||||
code = data.code;
|
||||
if ( actions[code]) {
|
||||
if (data.open == '1') {
|
||||
actions[code].status = '1';
|
||||
if (data.command == 'K') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
if (data.open == '0') {
|
||||
actions[code].status = '0';
|
||||
if (data.command == 'G') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
@ -807,74 +868,112 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
if(data.red == 1){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[0];
|
||||
if(data.command == 'No'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
}else{
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红 */
|
||||
if(data.command == 'R'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if(data.yellow == 1){
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
|
||||
}else{
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if(data.green == 1){
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
|
||||
/** 绿 */
|
||||
if(data.command == 'G'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}else{
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
}
|
||||
/** 黄 */
|
||||
if(data.command == 'Y'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 月白 */
|
||||
if(data.command == 'W'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 蓝 */
|
||||
if(data.command == 'B'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红黄 */
|
||||
if(data.command == 'RY'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function initswitch(data) {
|
||||
code = data.code;
|
||||
if (data.routeLock == '0') {
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "02";
|
||||
} else if (data.routeLock == '1') {
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "01";
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
if (actions[code].normal != data.normal) {
|
||||
if (data.normal == '02') {
|
||||
|
||||
if (actions[code].command != data.command) {
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "02";
|
||||
} else if (data.normal == '01') {
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "01";
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
if(data.type == "DeviceCtrl_3D"){
|
||||
if(data.body.type == "PSD"){
|
||||
if(data.body.code == passerStation.nowStation.toppsd){
|
||||
if(data.body.open == 0){
|
||||
if(data.body.command == 'G'){
|
||||
|
||||
deviceaction.top.action.reset();
|
||||
deviceaction.top.action.time =deviceaction.top.action._clip.duration;
|
||||
@ -48,7 +48,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
}
|
||||
}
|
||||
if(data.body.code == passerStation.nowStation.downpsd){
|
||||
if(data.body.open == 0){
|
||||
if(data.body.command == 'G'){
|
||||
deviceaction.down.action.reset();
|
||||
deviceaction.down.action.time = deviceaction.down.action._clip.duration;
|
||||
deviceaction.down.action.timeScale = -1;
|
||||
@ -64,24 +64,24 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
}
|
||||
}
|
||||
if(data.body.type == "TRAIN_DOOR"){
|
||||
if(toptrain.nowcode == data.body.code){
|
||||
if(toptrain.nowcode == data.body.trainCode){
|
||||
|
||||
if(data.body.open == "0"){
|
||||
closetraindoor(toptrain,data.body.doorCode,"top");
|
||||
if(data.body.command == 'G'){
|
||||
closetraindoor(toptrain,data.body.code,"top");
|
||||
|
||||
}else{
|
||||
opentraindoor(toptrain,data.body.doorCode,"top");
|
||||
opentraindoor(toptrain,data.body.code,"top");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if(downtrain.nowcode == data.body.code){
|
||||
if(downtrain.nowcode == data.body.trainCode){
|
||||
// console.log(data.body);
|
||||
if(data.body.open == "0"){
|
||||
closetraindoor(downtrain,data.body.doorCode,"down");
|
||||
if(data.body.command == 'G'){
|
||||
closetraindoor(downtrain,data.body.code,"down");
|
||||
|
||||
}else{
|
||||
opentraindoor(downtrain,data.body.doorCode,"down");
|
||||
opentraindoor(downtrain,data.body.code,"down");
|
||||
|
||||
}
|
||||
|
||||
@ -96,7 +96,9 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
if(toptrain.nowcode != data.body[i].code){
|
||||
toptrain.nowcode = data.body[i].code;
|
||||
}
|
||||
toptrain.position.copy(toptrain.curve.getPointAt(data.body[i].offset));
|
||||
toptrain.position.copy(passerStation.nowStation.topcurve.getPointAt(data.body[i].offset));
|
||||
|
||||
// }
|
||||
|
||||
}else{
|
||||
if(downtrain.nowcode == data.body[i].code){
|
||||
@ -108,7 +110,8 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
if(downtrain.nowcode != data.body[i].code){
|
||||
downtrain.nowcode = data.body[i].code;
|
||||
}
|
||||
downtrain.position.copy(downtrain.curve.getPointAt(data.body[i].offset));
|
||||
|
||||
downtrain.position.copy(passerStation.nowStation.downcurve.getPointAt(data.body[i].offset));
|
||||
|
||||
}else{
|
||||
if(downtrain.nowcode == data.body[i].code){
|
||||
|
@ -122,7 +122,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup,viewMap) {
|
||||
passerStation.loadMaterial(netdata3d);
|
||||
this.modelmanager.loadpromise(JSON.parse(netdata3d.data.assets).cctvAssetList, scope.mixers).then(function (data) {
|
||||
|
||||
passerStation.initStationAnimation(scope.modelmanager.station.mesh,mixers,deviceaction,scene);
|
||||
passerStation.initStationAnimation(scope.modelmanager.station.mesh,mixers,deviceaction,scene,JSON.parse(netdata3d.data.stands),);
|
||||
passerCheckDoor.initCheckDoorInAnimation(scope.modelmanager.zhajiin.mesh,mixers,deviceaction,scene);
|
||||
passerCheckDoor.initCheckDoorOutAnimation(scope.modelmanager.zhajiout.mesh,mixers,deviceaction,scene);
|
||||
|
||||
@ -139,7 +139,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup,viewMap) {
|
||||
scope.switchviews('4views');
|
||||
passerHuman.initHumans(scope.modelmanager.man1.mesh,scope.modelmanager.man2.mesh);
|
||||
scene.add(humanlist);
|
||||
passerStation.initStationList(netdata.data.stationList,netdata.data.stationStandList,netdata.data.psdList);
|
||||
passerStation.initStationList(netdata.data.stationList,netdata.data.stationStandList,netdata.data.psdList,netdata.data.sectionList);
|
||||
socktest = new PassflowConnect(deviceaction,passerTrain.toptrain,passerTrain.downtrain,routegroup,passerStation,passerAi);
|
||||
|
||||
store.dispatch('app/animationsClose');
|
||||
|
@ -92,8 +92,9 @@ export function PasserStation() {
|
||||
|
||||
}
|
||||
//初始化车站名称数据
|
||||
this.initStationList = function(stationdata,standdata,psddata){
|
||||
this.initStationList = function(stationdata,standdata,psddata,sectiondata){
|
||||
let list = [];
|
||||
let sections = sectiondata;
|
||||
if(psddata){
|
||||
for(let i=0,leni = standdata.length;i<leni;i++){
|
||||
for(let j=0,lenj = psddata.length;j<lenj;j++){
|
||||
@ -121,6 +122,8 @@ export function PasserStation() {
|
||||
downpsd:null,
|
||||
topsection:null,
|
||||
downsection:null,
|
||||
topcurve:"",
|
||||
downcurve:"",
|
||||
};
|
||||
if(list[k][0].position.y<list[k][1].position.y){
|
||||
stationobject.toppsd = list[k][0].name;
|
||||
@ -138,6 +141,35 @@ export function PasserStation() {
|
||||
|
||||
}
|
||||
|
||||
for(let i=0;i<scope.stationlist.length;i++){
|
||||
let topOver = false;
|
||||
let downOver = false;
|
||||
for(let j = 0;j<sections.length;j++){
|
||||
|
||||
if(scope.stationlist[i].topsection == sections[j].code){
|
||||
let points = [];
|
||||
let lo = -71 - (sections[j].leftStopPointOffset);
|
||||
let ro = 60.73+(sections[j].lengthFact - sections[j].rightStopPointOffset);
|
||||
points.push(new THREE.Vector3(lo,0.06,-6.3));
|
||||
points.push(new THREE.Vector3(ro,0.06,-6.3));
|
||||
scope.stationlist[i].topcurve = new THREE.CatmullRomCurve3(points);
|
||||
topOver = true;
|
||||
}
|
||||
if(scope.stationlist[i].downsection == sections[j].code){
|
||||
let points = [];
|
||||
let lo = -71 - (sections[j].leftStopPointOffset);
|
||||
let ro = 60.73+(sections[j].lengthFact - sections[j].rightStopPointOffset);
|
||||
points.push(new THREE.Vector3(lo ,0.06,28.68));
|
||||
points.push(new THREE.Vector3(ro,0.06,28.68));
|
||||
scope.stationlist[i].downcurve = new THREE.CatmullRomCurve3(points);
|
||||
downOver = true;
|
||||
}
|
||||
if(topOver && downOver){
|
||||
j = sections.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scope.nowStation = scope.stationlist[0];
|
||||
if(scope.stationtexture["stationlist"]){
|
||||
scope.stationMesh.getObjectByName("zhantailiebiao").material.map =scope.stationtexture["stationlist"];
|
||||
|
@ -15,7 +15,7 @@ export function Moveanimate(main){
|
||||
//当前动画模型
|
||||
this.nowmodelname = undefined;
|
||||
//定义转辙机零件动画
|
||||
this.initlistnew = function(switchmodel){
|
||||
this.initSwitchAnima = function(switchmodel){
|
||||
scope.animatelist[switchmodel.animacode+"chaijie"] = [];
|
||||
scope.animatelist[switchmodel.animacode+"fuwei"] = [];
|
||||
for(let i=0,leni=switchmodel.children.length;i<leni;i++){
|
||||
|
@ -197,7 +197,7 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
|
||||
scope.modelmanager.loadpromise(netDataAssets.deviceAssetList, scope.mixers).then(function (data) {
|
||||
//综合演练情况下当模型加载后显示
|
||||
|
||||
moveanima.initlistnew(scope.modelmanager.switchmodel.mesh);
|
||||
moveanima.initSwitchAnima(scope.modelmanager.switchmodel.mesh);
|
||||
daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA");
|
||||
|
||||
|
||||
|
@ -165,7 +165,6 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
function trainRunNew(data){
|
||||
let code = data.code;
|
||||
|
||||
if(trainlisttest.list[code].right != data.right){
|
||||
if(data.right == "0"){
|
||||
|
||||
@ -609,20 +608,20 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
}
|
||||
|
||||
function traindoorupdate(data){
|
||||
let code = data.code;
|
||||
let code = data.trainCode;
|
||||
if(trainlisttest.list[code].right == "0"){
|
||||
if(data.doorCode == "2"){
|
||||
if(data.code == "2"){
|
||||
|
||||
if(trainlisttest.list[code].openleft != data.open && data.open == "0"){
|
||||
trainlisttest.list[code].openleft = "0";
|
||||
if(trainlisttest.list[code].openleft != data.command && data.command == "G"){
|
||||
trainlisttest.list[code].openleft = data.command;
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = -1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}else if(trainlisttest.list[code].openleft != data.open && data.open == "1"){
|
||||
trainlisttest.list[code].openleft = "1";
|
||||
}else if(trainlisttest.list[code].openleft != data.command && data.command == "K"){
|
||||
trainlisttest.list[code].openleft = data.command;
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
@ -633,16 +632,16 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
}else{
|
||||
|
||||
|
||||
if (trainlisttest.list[code].openright != data.open && data.open == '0') {
|
||||
trainlisttest.list[code].openright = '0';
|
||||
if (trainlisttest.list[code].openright != data.command && data.command == 'G') {
|
||||
trainlisttest.list[code].openright = data.command;
|
||||
for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
||||
actions[code].down[an].timeScale = -1;
|
||||
actions[code].down[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].openright != data.open && data.open == '1') {
|
||||
trainlisttest.list[code].openright = "1";
|
||||
} else if (trainlisttest.list[code].openright != data.command && data.command == 'K') {
|
||||
trainlisttest.list[code].openright = data.command;
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = 0;
|
||||
@ -653,18 +652,18 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
}
|
||||
}else{
|
||||
if(data.doorCode == "1"){
|
||||
if(data.code == "1"){
|
||||
|
||||
if(trainlisttest.list[code].openleft != data.open && data.open == "0"){
|
||||
trainlisttest.list[code].openleft = "0";
|
||||
if(trainlisttest.list[code].openleft != data.command && data.command == "G"){
|
||||
trainlisttest.list[code].openleft = data.command;
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = -1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}else if(trainlisttest.list[code].openleft != data.open && data.open == "1"){
|
||||
trainlisttest.list[code].openleft = "1";
|
||||
}else if(trainlisttest.list[code].openleft != data.command && data.command == "K"){
|
||||
trainlisttest.list[code].openleft = data.command;
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
@ -675,16 +674,16 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
}else{
|
||||
|
||||
|
||||
if (trainlisttest.list[code].openright != data.open && data.open == '0') {
|
||||
trainlisttest.list[code].openright = '0';
|
||||
if (trainlisttest.list[code].openright != data.command && data.command == 'G') {
|
||||
trainlisttest.list[code].openright = data.command;
|
||||
for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
||||
actions[code].down[an].timeScale = -1;
|
||||
actions[code].down[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].openright != data.open && data.open == '1') {
|
||||
trainlisttest.list[code].openright = "1";
|
||||
} else if (trainlisttest.list[code].openright != data.command && data.command == 'K') {
|
||||
trainlisttest.list[code].openright = data.command;
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = 0;
|
||||
@ -696,6 +695,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function trainstatus(data){
|
||||
@ -758,15 +759,15 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
function initstand(data) {
|
||||
code = data.code;
|
||||
if ( actions[code]) {
|
||||
if (data.close == '1') {
|
||||
actions[code].status = '1';
|
||||
if (data.command == 'K') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
if (data.close == '0') {
|
||||
actions[code].status = '0';
|
||||
if (data.command == 'G') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
@ -776,17 +777,16 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
}
|
||||
function standupdate(data) {
|
||||
code = data.code;
|
||||
|
||||
if ( actions[code]) {
|
||||
if (data.open == '1') {
|
||||
actions[code].status = '1';
|
||||
if (data.command == 'K') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
if (data.open == '0') {
|
||||
actions[code].status = '0';
|
||||
if (data.command == 'G') {
|
||||
actions[code].status = data.command;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
@ -797,33 +797,70 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
if(signallist.list[code]){
|
||||
if(data.red == 1){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
}else{
|
||||
/** 无显示,灭灯 */
|
||||
if(data.command == 'No'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if(data.yellow == 1){
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
|
||||
}else{
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
if(data.green == 1){
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}else{
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
/** 红 */
|
||||
if(data.command == 'R'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 绿 */
|
||||
if(data.command == 'G'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 黄 */
|
||||
if(data.command == 'Y'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 月白 */
|
||||
if(data.command == 'W'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 蓝 */
|
||||
if(data.command == 'B'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红黄 */
|
||||
if(data.command == 'RY'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -831,40 +868,40 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
function initswitch(data) {
|
||||
code = data.code;
|
||||
if (data.routeLock == '0') {
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "02";
|
||||
} else if (data.routeLock == '1') {
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "01";
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
if (actions[code].normal != data.normal) {
|
||||
if (data.normal == '1') {
|
||||
if (actions[code].command != data.command) {
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "1";
|
||||
} else if (data.normal == '0') {
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "0";
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export function silumationConnect(deviceaction,toptrain,downtrain,routegroup,pas
|
||||
if(data.body.type == "PSD"){
|
||||
|
||||
if(data.body.code == passerStation.nowStation.toppsd){
|
||||
if(data.body.open == 0){
|
||||
if(data.body.command == 'G'){
|
||||
|
||||
passerAi.passerout("top","end");
|
||||
deviceaction.top.action.reset();
|
||||
@ -54,7 +54,7 @@ export function silumationConnect(deviceaction,toptrain,downtrain,routegroup,pas
|
||||
}
|
||||
}
|
||||
if(data.body.code == passerStation.nowStation.downpsd){
|
||||
if(data.body.open == 0){
|
||||
if(data.body.command == 'G'){
|
||||
|
||||
deviceaction.down.action.reset();
|
||||
deviceaction.down.action.time = deviceaction.down.action._clip.duration;
|
||||
@ -74,9 +74,9 @@ export function silumationConnect(deviceaction,toptrain,downtrain,routegroup,pas
|
||||
|
||||
if(data.body.type == "TRAIN_DOOR"){
|
||||
|
||||
if(toptrain.nowcode == data.body.code){
|
||||
if(toptrain.nowcode == data.body.trainCode){
|
||||
|
||||
if(data.body.open == "0"){
|
||||
if(data.body.command == "G"){
|
||||
closetraindoor(toptrain,data.body.doorCode,"top");
|
||||
|
||||
}else{
|
||||
@ -86,9 +86,9 @@ export function silumationConnect(deviceaction,toptrain,downtrain,routegroup,pas
|
||||
|
||||
}
|
||||
|
||||
if(downtrain.nowcode == data.body.code){
|
||||
if(downtrain.nowcode == data.body.trainCode){
|
||||
|
||||
if(data.body.open == "0"){
|
||||
if(data.body.command == "G"){
|
||||
closetraindoor(downtrain,data.body.doorCode,"down");
|
||||
|
||||
}else{
|
||||
|
@ -60,6 +60,7 @@ let passerWebWork = new Worker(JL3D_LOCAL_STATIC+"/workertest/trafficplan/traffi
|
||||
//老版本临时ai控制
|
||||
let olddataai = false;
|
||||
|
||||
//北交大车站管理
|
||||
export function Jl3dStationManager(dom,skinCode,routegroup,initCode) {
|
||||
|
||||
// let stats = new Stats();
|
||||
|
@ -104,7 +104,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
if(data.body.type == "PSD"){
|
||||
|
||||
if(data.body.code == passerStation.nowStation.toppsd){
|
||||
if(data.body.open == 0){
|
||||
if(data.body.command == 'G'){
|
||||
|
||||
passerAi.passerout("top","end");
|
||||
deviceaction.top.action.reset();
|
||||
@ -121,7 +121,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
}
|
||||
}
|
||||
if(data.body.code == passerStation.nowStation.downpsd){
|
||||
if(data.body.open == 0){
|
||||
if(data.body.command == 'G'){
|
||||
|
||||
deviceaction.down.action.reset();
|
||||
deviceaction.down.action.time = deviceaction.down.action._clip.duration;
|
||||
@ -141,25 +141,25 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
|
||||
if(data.body.type == "TRAIN_DOOR"){
|
||||
|
||||
if(toptrain.nowcode == data.body.code){
|
||||
if(toptrain.nowcode == data.body.trainCode){
|
||||
|
||||
if(data.body.open == "0"){
|
||||
closetraindoor(toptrain,data.body.doorCode,"top");
|
||||
if(data.body.command == "G"){
|
||||
closetraindoor(toptrain,data.body.code,"top");
|
||||
|
||||
}else{
|
||||
opentraindoor(toptrain,data.body.doorCode,"top");
|
||||
opentraindoor(toptrain,data.body.code,"top");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(downtrain.nowcode == data.body.code){
|
||||
if(downtrain.nowcode == data.body.trainCode){
|
||||
|
||||
if(data.body.open == "0"){
|
||||
closetraindoor(downtrain,data.body.doorCode,"down");
|
||||
if(data.body.command == "K"){
|
||||
closetraindoor(downtrain,data.body.code,"down");
|
||||
|
||||
}else{
|
||||
opentraindoor(downtrain,data.body.doorCode,"down");
|
||||
opentraindoor(downtrain,data.body.code,"down");
|
||||
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,6 @@ export function PassflowPassConnect(deviceaction,toptrain,downtrain,routegroup,p
|
||||
}
|
||||
|
||||
if(data.type == "TRAIN_PFI_BL"){
|
||||
|
||||
if(toptrain.nowcode == data.body.code && scope.topswitch == true){
|
||||
|
||||
//根据上下车人数创建人
|
||||
|
@ -35,8 +35,8 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
|
||||
// console.log(trafficTrain.trainList);
|
||||
for(let k in trafficTrain.trainList){
|
||||
if(trafficTrain.trainList[k].code == data.body){
|
||||
console.log( trafficTrain.trainList[k].code);
|
||||
console.log( data.body);
|
||||
// console.log( trafficTrain.trainList[k].code);
|
||||
// console.log( data.body);
|
||||
updateTrafficTrainValue(data.body);
|
||||
trafficTrain.updateNowTrainCode(data.body);
|
||||
trafficTrain.updateNowTrunk(0+'');
|
||||
@ -116,19 +116,19 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
|
||||
|
||||
if(data.body.type == "TRAIN_DOOR"){
|
||||
for(let i=0;i<trafficTrain.trainList.length;i++){
|
||||
if(trafficTrain.trainList[i].code == data.body.code){
|
||||
trafficTrain.trainList[i].open = data.body.open;
|
||||
trafficTrain.trainList[i].doorCode = data.body.doorCode;
|
||||
if(trafficTrain.trainList[i].code == data.body.trainCode){
|
||||
trafficTrain.trainList[i].open = data.body.command;
|
||||
trafficTrain.trainList[i].doorCode = data.body.code;
|
||||
i = trafficTrain.trainList.length;
|
||||
}
|
||||
}
|
||||
if(toptrain.nowcode == data.body.code){
|
||||
if(toptrain.nowcode == data.body.trainCode){
|
||||
trafficTrain.updatePasserMove(data.body);
|
||||
if(data.body.open == "0"){
|
||||
closetraindoor(toptrain,data.body.doorCode,"top");
|
||||
if(data.body.command == "G"){
|
||||
closetraindoor(toptrain,data.body.code,"top");
|
||||
|
||||
}else{
|
||||
opentraindoor(toptrain,data.body.doorCode,"top");
|
||||
opentraindoor(toptrain,data.body.code,"top");
|
||||
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,8 @@ let passerWebWork = new Worker(JL3D_LOCAL_STATIC+"/workertest/passsimulation/sta
|
||||
//老版本临时ai控制
|
||||
let olddataai = false;
|
||||
|
||||
|
||||
//北交大列车管理
|
||||
export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap,initCode) {
|
||||
|
||||
// let stats = new Stats();
|
||||
@ -323,7 +325,7 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap,initCode) {
|
||||
|
||||
let nowLeaveDoor = null;
|
||||
this.updatePasserMove = function(doorData){
|
||||
nowLeaveDoor = doorData.doorCode;
|
||||
nowLeaveDoor = doorData.code;
|
||||
// console.log(doorData);
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import { AnimateManager } from '@/jlmap3d/lesson3d/manager/animatemanager.js';
|
||||
|
||||
import { Fire } from '@/jlmap3d/lesson3d/utils/fire.js';
|
||||
|
||||
import { Loading } from 'element-ui';
|
||||
|
||||
// import { AnimationManager } from '@/jlmap3d/lesson3d/manager/assetmodelmanager.js';
|
||||
|
||||
@ -55,16 +56,21 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
|
||||
let animateManager = new AnimateManager();
|
||||
|
||||
|
||||
let controlManager = new ControlManager( dom,scene,lessonData,lessonIndex);
|
||||
|
||||
let loadingInstance = Loading.service({ fullscreen: true });
|
||||
let assetModelManager = new AssetModelManager(scope,scene,controlManager);
|
||||
assetModelManager.lessonAssetsLoader(lessonData).then((result) => {
|
||||
scope.nowSceneType = lessonData.lessonProgress[0].progressScene;
|
||||
animateManager.initAnimation(assetModelManager);
|
||||
controlManager.init(animateManager.actions,assetModelManager);
|
||||
|
||||
console.log(lessonData.trainDeviceData);
|
||||
controlManager.init(animateManager.actions,assetModelManager,lessonData.trainDeviceData);
|
||||
|
||||
startLesson();
|
||||
animate();
|
||||
loadingInstance.close();
|
||||
resolve("loadeend"); //['成功了', 'success']
|
||||
}).catch((error) => {
|
||||
//console.log(error);
|
||||
@ -73,15 +79,17 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
|
||||
|
||||
this.actionModelControl = function(actionType,actionModel){
|
||||
console.log(actionType);
|
||||
console.log(actionModel);
|
||||
if(actionType == "remove"){
|
||||
|
||||
if(actionType == "remove"){
|
||||
assetModelManager.otherModel.remove(actionModel);
|
||||
}else if(actionType == "show"){
|
||||
actionModel.visible = true;
|
||||
assetModelManager.otherModel.add(actionModel);
|
||||
}else if(actionType == "changeIndex"){
|
||||
actionModel.visible = true;
|
||||
assetModelManager.otherModel.add(actionModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.actionRemove = function(actionModel){
|
||||
@ -91,30 +99,39 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
this.changeIndex = function(nowIndex){
|
||||
if(nowIndex!=0){
|
||||
oldIndex = lessonIndex;
|
||||
}
|
||||
if(lessonData.lessonProgress[oldIndex].roleName == nowRole){
|
||||
updateExam(lessonData.lessonProgress[oldIndex],oldIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
lessonIndex = nowIndex;
|
||||
|
||||
console.log(nowIndex);
|
||||
// console.log(nowIndex);
|
||||
scope.nowSceneType = lessonData.lessonProgress[nowIndex].progressScene;
|
||||
// console.log(nowRole);
|
||||
// console.log(lessonData.lessonProgress[lessonIndex].roleName);
|
||||
if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){
|
||||
controlManager.initControlMode(lessonIndex);
|
||||
assetModelManager.changeSceneGroup(scope.nowSceneType);
|
||||
controlManager.initRoleMode(true,nowRole);
|
||||
controlManager.initControlMode(lessonIndex);
|
||||
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,true,assetModelManager.lessonTriggerList[scope.nowSceneType]);
|
||||
|
||||
} else{
|
||||
controlManager.initControlMode(lessonIndex);
|
||||
if(lessonData.lessonProgress[lessonIndex].roleName == 'kong'){
|
||||
assetModelManager.changeSceneGroup(scope.nowSceneType);
|
||||
controlManager.initRoleMode(false,nowRole);
|
||||
}
|
||||
controlManager.initRoleMode(false,nowRole);
|
||||
controlManager.initControlMode(lessonIndex);
|
||||
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,false,assetModelManager.lessonTriggerList[scope.nowSceneType]);
|
||||
}
|
||||
|
||||
if(nowIndex == lessonData.lessonProgress.length-1){
|
||||
|
||||
if(nowIndex == (lessonData.lessonProgress.length-1)){
|
||||
// console.log(nowIndex);
|
||||
// console.log(lessonData.lessonProgress.length);
|
||||
lessonEnd();
|
||||
}
|
||||
}
|
||||
@ -133,6 +150,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
}
|
||||
controlManager.initRoleMode(roleMode);
|
||||
for(let i=0;i<lessonData.lessonProgress.length;i++){
|
||||
|
||||
if(nowRole == lessonData.lessonProgress[i].roleName){
|
||||
examList.push(
|
||||
{
|
||||
@ -153,7 +171,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
time:0,
|
||||
};
|
||||
controlManager.initExam(examList,examData);
|
||||
updataExamStatus(examData);
|
||||
// updataExamStatus(examData);
|
||||
// if(lessonData.lessonProgress[lessonIndex].action.length>0){
|
||||
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,roleMode,assetModelManager.lessonTriggerList[scope.nowSceneType]);
|
||||
|
||||
|
@ -13,6 +13,35 @@ export function AnimateManager() {
|
||||
|
||||
for(let k in assetModelManager.staticAsset){
|
||||
if(assetModelManager.staticAsset[k].mesh.animations.length > 0){
|
||||
// console.log(assetModelManager.staticAsset[k]);
|
||||
if(assetModelManager.staticAsset[k].modelId == "PBMDH"){
|
||||
|
||||
|
||||
// console.log(assetModelManager.staticAsset[k].mesh);
|
||||
let animations = assetModelManager.staticAsset[k].mesh.animations[0];
|
||||
for(let i=0;i <assetModelManager.staticAsset[k].mesh.children.length;i++){
|
||||
if(assetModelManager.staticAsset[k].mesh.children[i].type == "Group"){
|
||||
assetModelManager.staticAsset[k].mesh.children[i].animations = [];
|
||||
//
|
||||
// console.log(assetModelManager.staticAsset[k].mesh.children[i]);
|
||||
assetModelManager.staticAsset[k].mesh.children[i].animations.push(animations.clone());
|
||||
let mixer = new THREE.AnimationMixer( assetModelManager.staticAsset[k].mesh.children[i] );
|
||||
|
||||
let actionName = assetModelManager.staticAsset[k].mesh.children[i].name;
|
||||
|
||||
scope.actions[actionName] = {
|
||||
status:"01",
|
||||
action:mixer.clipAction( assetModelManager.staticAsset[k].mesh.children[i].animations[ 0 ])
|
||||
};
|
||||
|
||||
scope.actions[actionName].action.setLoop(THREE.LoopOnce);
|
||||
scope.actions[actionName].action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
let animations = assetModelManager.staticAsset[k].mesh.animations;
|
||||
let mixer = new THREE.AnimationMixer( assetModelManager.staticAsset[k].mesh );
|
||||
let actionName = assetModelManager.staticAsset[k].mesh.name;
|
||||
@ -24,6 +53,7 @@ export function AnimateManager() {
|
||||
// scope.actions[actionName].action.play();
|
||||
mixers.push(mixer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ export function AssetModelManager(editor,scene) {
|
||||
groupList["standstation"] = new THREE.Group();
|
||||
groupList["stopstation"] = new THREE.Group();
|
||||
groupList["device"] = new THREE.Group();
|
||||
groupList["occ"] = new THREE.Group();
|
||||
groupList["xl"] = new THREE.Group();
|
||||
groupList["dc"] = new THREE.Group();
|
||||
|
||||
@ -28,9 +29,9 @@ export function AssetModelManager(editor,scene) {
|
||||
scope.staticAsset['station'] = {
|
||||
modelId:'station',
|
||||
packageName:"车站",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/station.FBX",
|
||||
url:"/MODEL/2021-09-08/211-9861.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
assetType:'onlineasset',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"standstation",
|
||||
@ -79,17 +80,47 @@ export function AssetModelManager(editor,scene) {
|
||||
resourceType:"三维课程",
|
||||
sceneType:"standstation",
|
||||
};
|
||||
scope.staticAsset['wxc'] = {
|
||||
modelId:'wxc',
|
||||
packageName:"维修厂",
|
||||
url:"/MODEL/2021-08-12/200-34275.FBX",
|
||||
mesh:"",
|
||||
assetType:'onlineasset',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"stopstation",
|
||||
};
|
||||
|
||||
|
||||
scope.staticAsset['occ'] = {
|
||||
modelId:'occ',
|
||||
packageName:"occ大厅",
|
||||
url:"/MODEL/2021-09-02/210-32471.FBX",
|
||||
mesh:"",
|
||||
assetType:'onlineasset',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"occ",
|
||||
};
|
||||
//场景中可触发事件模型
|
||||
this.lessonTriggerList = [];
|
||||
|
||||
scope.lessonTriggerList["standstation"] = [];
|
||||
scope.lessonTriggerList["stopstation"] = [];
|
||||
scope.lessonTriggerList["device"] = [];
|
||||
scope.lessonTriggerList["occ"] = [];
|
||||
scope.lessonTriggerList["xl"] = [];
|
||||
scope.lessonTriggerList["dc"] = [];
|
||||
|
||||
this.changeSceneGroup = function(groupType){
|
||||
// console.log(groupType);
|
||||
// console.log(editor.nowSceneType);
|
||||
// console.log(scope.lessonTriggerList[editor.nowSceneType]);
|
||||
editor.nowSceneType = groupType;
|
||||
scene.remove(this.otherModel);
|
||||
this.otherModel = groupList[groupType];
|
||||
scene.add(this.otherModel);
|
||||
updateTriggerList(scope.lessonTriggerList[editor.nowSceneType]);
|
||||
}
|
||||
//加载课程资源
|
||||
this.lessonAssetsLoader = function(lessonData){
|
||||
let initlist = [];
|
||||
@ -188,7 +219,22 @@ export function AssetModelManager(editor,scene) {
|
||||
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").actionName = "PBMDH";
|
||||
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
|
||||
|
||||
// console.log(scope.loadAsset['default1'].mesh.getObjectByName("FTKG"));
|
||||
scope.staticAsset['station'].mesh.getObjectByName("DMH").showType = "default";
|
||||
scope.staticAsset['station'].mesh.getObjectByName("DMH").label = "隔离门";
|
||||
scope.staticAsset['station'].mesh.getObjectByName("DMH").actionName = "PBMDH";
|
||||
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("DMH"));
|
||||
|
||||
scope.staticAsset['station'].mesh.getObjectByName("DMH").rotation.z = Math.PI/2;
|
||||
|
||||
for(let i=0;i <scope.staticAsset['PBMDH'].mesh.children.length;i++){
|
||||
if(scope.staticAsset['PBMDH'].mesh.children[i].type == "Group"){
|
||||
let meshname = scope.staticAsset['PBMDH'].mesh.children[i].name;
|
||||
scope.staticAsset['PBMDH'].mesh.children[i].showType = "default";
|
||||
scope.staticAsset['PBMDH'].mesh.children[i].label = meshname;
|
||||
scope.lessonTriggerList["standstation"].push(scope.staticAsset['PBMDH'].mesh.getObjectByName(meshname));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//动态加载资源
|
||||
@ -251,6 +297,16 @@ export function AssetModelManager(editor,scene) {
|
||||
asset.mesh = object;
|
||||
groupList[asset.sceneType].add(object);
|
||||
// scene.add(object);
|
||||
resolve();
|
||||
} );
|
||||
}else if(asset.assetType == "onlineasset"){
|
||||
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
|
||||
if(asset.sceneType){
|
||||
object.sceneType = asset.sceneType;
|
||||
}
|
||||
asset.mesh = object;
|
||||
groupList[asset.sceneType].add(object);
|
||||
|
||||
resolve();
|
||||
} );
|
||||
}else{
|
||||
|
@ -13,6 +13,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
this.controls = {};
|
||||
this.nowCamera = null;
|
||||
this.eventHitMode = false;
|
||||
let modelManager;
|
||||
let nowRole = "";
|
||||
let roleMode = false;
|
||||
|
||||
@ -23,7 +24,10 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
let raycasterBoxs = [];
|
||||
let actionList = [];
|
||||
let eventTrigger;
|
||||
let nowActions;
|
||||
let nowActions = [];
|
||||
let allOverAction;
|
||||
let trainDeviceMode = false;
|
||||
let trainDeviceList = [];
|
||||
|
||||
let renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setClearColor(new THREE.Color(0x000000));
|
||||
@ -84,28 +88,45 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
|
||||
|
||||
let loaderObj = new THREE.OBJLoader();
|
||||
let pengzhuang;
|
||||
let standstationPZ,stopstationPZ,occPZ;
|
||||
// load a resource
|
||||
loaderObj.load(
|
||||
// resource URL
|
||||
JL3D_LOCAL_STATIC+'/lesson3d/PZ427.obj',
|
||||
// called when resource is loaded
|
||||
JL3D_LOCAL_STATIC+'/lesson3d/standstationPZ.obj',
|
||||
function ( object ) {
|
||||
pengzhuang = object;
|
||||
standstationPZ = object;
|
||||
},
|
||||
// called when loading is in progresses
|
||||
function ( xhr ) {
|
||||
|
||||
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
|
||||
|
||||
},
|
||||
// called when loading has errors
|
||||
function ( error ) {
|
||||
|
||||
console.log( 'An error happened' );
|
||||
|
||||
}
|
||||
);
|
||||
loaderObj.load(
|
||||
JL3D_LOCAL_STATIC+'/lesson3d/stopstationPZ.obj',
|
||||
function ( object ) {
|
||||
stopstationPZ = object;
|
||||
},
|
||||
function ( xhr ) {
|
||||
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
|
||||
},
|
||||
function ( error ) {
|
||||
console.log( 'An error happened' );
|
||||
}
|
||||
);
|
||||
loaderObj.load(
|
||||
JL3D_LOCAL_STATIC+'/lesson3d/occPZ.obj',
|
||||
function ( object ) {
|
||||
occPZ = object;
|
||||
},
|
||||
function ( xhr ) {
|
||||
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
|
||||
},
|
||||
function ( error ) {
|
||||
console.log( 'An error happened' );
|
||||
}
|
||||
);
|
||||
|
||||
this.initRoleMode = function(rMode,role){
|
||||
roleMode = rMode;
|
||||
nowRole = role;
|
||||
@ -162,7 +183,8 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
updatePlayer( deltaTime );
|
||||
|
||||
updateSpheres( deltaTime );
|
||||
|
||||
// console.log(scope.eventHitMode);
|
||||
// console.log(roleMode);
|
||||
if(scope.eventHitMode == true && roleMode){
|
||||
if(eventBoxs.length>0){
|
||||
attachBox.position.copy(fpsCamera.position);
|
||||
@ -210,9 +232,15 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
|
||||
|
||||
|
||||
this.init = function(actions){
|
||||
worldOctree.fromGraphNode( pengzhuang );
|
||||
this.init = function(actions,assetModelManager,trainDeviceData){
|
||||
// worldOctree.fromGraphNode( standstationPZ );
|
||||
actionList = actions;
|
||||
// console.log(actionList);
|
||||
modelManager = assetModelManager;
|
||||
if(trainDeviceData){
|
||||
trainDeviceMode = true;
|
||||
trainDeviceList = trainDeviceData;
|
||||
}
|
||||
}
|
||||
|
||||
this.updatePos = function(pos){
|
||||
@ -245,6 +273,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
// console.log("mousedown-----------------------");
|
||||
// console.log(raycasterBoxs);
|
||||
// console.log(roleMode);
|
||||
|
||||
if(raycasterBoxs.length>0 && roleMode){
|
||||
var mouse = new THREE.Vector2();
|
||||
|
||||
@ -261,9 +290,21 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
|
||||
if(intersects.length>0){
|
||||
if(raycasterBoxs[i].type == "switch"){
|
||||
|
||||
// console.log(raycasterBoxs[i]);
|
||||
// console.log(raycasterBoxs[i].actionMode);
|
||||
if(raycasterBoxs[i].actionMode == "jump"){
|
||||
actionEvent("remove",raycasterBoxs[i],raycasterBoxs[i].mesh);
|
||||
jumpEvent("action",raycasterBoxs[i]);
|
||||
}else if(raycasterBoxs[i].actionMode == "play"){
|
||||
if(raycasterBoxs[i].animateModel != "播放动画的模型"){
|
||||
if(raycasterBoxs[i].action.status == "01"){
|
||||
raycasterBoxs[i].action.status = "02";
|
||||
raycasterBoxs[i].action.action.play();
|
||||
}else if(raycasterBoxs[i].action.status == "02"){
|
||||
raycasterBoxs[i].action.status = "01";
|
||||
raycasterBoxs[i].action.action.stop();
|
||||
}
|
||||
}else{
|
||||
if(raycasterBoxs[i].action.status == "01"){
|
||||
raycasterBoxs[i].action.status = "02";
|
||||
@ -273,7 +314,9 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
raycasterBoxs[i].action.action.stop();
|
||||
}
|
||||
}
|
||||
|
||||
raycasterBoxs[i].actionStatus = "1";
|
||||
actionEvent("remove",raycasterBoxs[i],raycasterBoxs[i].mesh);
|
||||
}
|
||||
}else if(raycasterBoxs[i].type == "urgeSwitch"){
|
||||
if(raycasterBoxs[i].action.status == "02"){
|
||||
raycasterBoxs[i].action.status = "01";
|
||||
@ -284,6 +327,44 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if(trainDeviceMode == true){
|
||||
// var mouse = new THREE.Vector2();
|
||||
//
|
||||
// var raycaster = new THREE.Raycaster();
|
||||
//
|
||||
// mouse.x = ( event.clientX / dom.offsetWidth ) * 2 - 1;
|
||||
//
|
||||
// mouse.y = - ( event.clientY / dom.offsetHeight ) * 2 + 1;
|
||||
//
|
||||
// raycaster.setFromCamera(mouse,scope.nowCamera);
|
||||
//
|
||||
// var intersects = raycaster.intersectObject( modelManager.otherModel.children[1],true);
|
||||
// if(intersects.length>0){
|
||||
//
|
||||
// jl3dZzwwTrainTestUpdate(intersects[0].object.name);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
if(raycasterBoxs.length>0){
|
||||
let isOverEvent = false;
|
||||
let overEvent = "";
|
||||
// console.log(raycasterBoxs);
|
||||
for(let i=0;i<raycasterBoxs.length;i++){
|
||||
|
||||
if(raycasterBoxs[i].actionStatus == "0"){
|
||||
isOverEvent = true;
|
||||
}
|
||||
|
||||
}
|
||||
if(isOverEvent == false){
|
||||
jumpEvent("action",allOverAction);
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@ -463,6 +544,11 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
}
|
||||
|
||||
|
||||
if ( keyStates[ 'Space' ] ) {
|
||||
|
||||
playerVelocity.y = 10;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -476,9 +562,20 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
}
|
||||
|
||||
this.initControlMode = function(nowLessonIndex){
|
||||
// console.log(lessonData.lessonProgress[nowLessonIndex].progressScene);
|
||||
|
||||
if(lessonData.lessonProgress[nowLessonIndex].progressScene == "standstation"){
|
||||
worldOctree.fromGraphNode( standstationPZ );
|
||||
}else if(lessonData.lessonProgress[nowLessonIndex].progressScene == "stopstation"){
|
||||
worldOctree.fromGraphNode( stopstationPZ );
|
||||
}else if(lessonData.lessonProgress[nowLessonIndex].progressScene == "occ"){
|
||||
worldOctree.fromGraphNode( occPZ );
|
||||
}
|
||||
|
||||
if((lessonData.lessonProgress[nowLessonIndex].changeCamera == true && lessonData.lessonProgress[nowLessonIndex].roleName == nowRole) || nowLessonIndex == 0 || lessonData.lessonProgress[nowLessonIndex].roleName== 'kong'){
|
||||
|
||||
|
||||
scope.controlMode = lessonData.lessonProgress[nowLessonIndex].controlMode;
|
||||
if(lessonData.lessonProgress[nowLessonIndex].changeCamera == true){
|
||||
if(scope.controlMode == "free" || scope.controlMode == "non"){
|
||||
scope.nowCamera = orbitCamera;
|
||||
oribitControl.enabled = true;
|
||||
@ -517,33 +614,86 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
eventTrigger = lessonTriggerList;
|
||||
|
||||
nowActions = actions;
|
||||
let isOverAction = false;
|
||||
for(let i=0;i<nowActions.length;i++){
|
||||
if(nowActions[i].actionMode == "allover"){
|
||||
allOverAction = nowActions[i];
|
||||
isOverAction = true;
|
||||
}
|
||||
}
|
||||
if(isOverAction == false){
|
||||
allOverAction = null;
|
||||
}
|
||||
// let newEventBoxs = [];
|
||||
// eventBoxs = newEventBoxs;
|
||||
raycasterBoxs = [];
|
||||
roleMode = rMode;
|
||||
console.log("---------changeIndex--------");
|
||||
console.log(actions);
|
||||
console.log(roleMode);
|
||||
console.log(eventTrigger);
|
||||
console.log("----------------------------");
|
||||
if(actions.length>0 && roleMode){
|
||||
// console.log("---------changeIndex--------");
|
||||
// console.log(actions);
|
||||
// console.log(roleMode);
|
||||
// console.log(eventTrigger);
|
||||
// console.log("----------------------------");
|
||||
|
||||
if(actions.length>0 ){
|
||||
scope.eventHitMode = true;
|
||||
for(let i=0;i<actions.length;i++){
|
||||
|
||||
if(actions[i].actionType == "auto"){
|
||||
|
||||
if(actions[i].actionMode == "play"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
// console.log(eventTrigger[j].label);
|
||||
// console.log(actions);
|
||||
// console.log(actionList);
|
||||
// console.log( actions[i]);
|
||||
if(actionList[actions[i].actionModel]){
|
||||
if(actionList[actions[i].actionModel].status == "01"){
|
||||
actionList[actions[i].actionModel].status = "02";
|
||||
|
||||
if(actionList[eventTrigger[j].actionName].status == "01"){
|
||||
actionList[eventTrigger[j].actionName].status = "02";
|
||||
actionList[eventTrigger[j].actionName].action.play();
|
||||
actionList[actions[i].actionModel].action.reset();
|
||||
actionList[actions[i].actionModel].action.timeScale = 1;
|
||||
actionList[actions[i].actionModel].action.clampWhenFinished = true;
|
||||
actionList[actions[i].actionModel].action.setLoop(THREE.LoopOnce);
|
||||
actionList[actions[i].actionModel].action.play();
|
||||
|
||||
}else{
|
||||
actionList[actions[i].actionModel].status = "01";
|
||||
|
||||
actionList[actions[i].actionModel].action.reset();
|
||||
actionList[actions[i].actionModel].action.timeScale = -1;
|
||||
actionList[actions[i].actionModel].action.clampWhenFinished = true;
|
||||
actionList[actions[i].actionModel].action.setLoop(THREE.LoopOnce);
|
||||
actionList[actions[i].actionModel].action.play();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(actions[i].actionMode == "show"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
actionEvent("show",actions[i],eventTrigger[j]);
|
||||
j = eventTrigger.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(actions[i].actionMode == "remove"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
actionEvent("remove",actions[i],eventTrigger[j]);
|
||||
j = eventTrigger.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(eventTrigger);
|
||||
if(roleMode){
|
||||
if(actions[i].actionType == "contact"){
|
||||
if(eventTrigger){
|
||||
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
let eventTestBox = new THREE.Box3(new THREE.Vector3(), new THREE.Vector3());
|
||||
@ -555,6 +705,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(actions[i].actionType == "switch"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
@ -566,7 +717,13 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
type:actions[i].actionType,
|
||||
actionMode:actions[i].actionMode,
|
||||
jumpNode:actions[i].jumpNode,
|
||||
animateModel:actions[i].animateModel,
|
||||
actionStatus:"0",
|
||||
};
|
||||
|
||||
if(actions[i].animateModel != "播放动画的模型"){
|
||||
eventRaycaster.action = actionList[actions[i].animateModel];
|
||||
}
|
||||
raycasterBoxs.push(eventRaycaster);
|
||||
|
||||
actionEvent("changeIndex",actions[i],eventTrigger[j]);
|
||||
@ -587,8 +744,10 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else if(actions.length>0){
|
||||
console.log(actions);
|
||||
// console.log(actions);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -70,7 +70,7 @@ export function LessonData() {
|
||||
}
|
||||
|
||||
this.loadLessonProgress = function(loadData){
|
||||
console.log(loadData);
|
||||
// console.log(loadData);
|
||||
for(let i=0;i<loadData.length;i++){
|
||||
let newLessonProgress = {
|
||||
id:loadData[i].id,
|
||||
|
238
src/jlmap3d/lesson3dedit/accident/fire.js
Normal file
@ -0,0 +1,238 @@
|
||||
export function Fire() {
|
||||
let scope = this;
|
||||
this.points = {};
|
||||
var last_time_activate = Date.now();
|
||||
|
||||
|
||||
this.createNew = function(scene,pos){
|
||||
scope.points = new Points(pos);
|
||||
scope.points.init(pos);
|
||||
scene.add(scope.points.obj);
|
||||
}
|
||||
|
||||
this.update = function(){
|
||||
var now = Date.now();
|
||||
scope.points.update();
|
||||
if (now - last_time_activate > 10) {
|
||||
|
||||
scope.points.activateMover();
|
||||
last_time_activate = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
var Mover = function() {
|
||||
this.position = new THREE.Vector3();
|
||||
this.velocity = new THREE.Vector3();
|
||||
this.acceleration = new THREE.Vector3();
|
||||
this.anchor = new THREE.Vector3();
|
||||
this.mass = 1;
|
||||
this.r = 0;
|
||||
this.g = 0;
|
||||
this.b = 0;
|
||||
this.a = 1;
|
||||
this.time = 0;
|
||||
this.is_active = false;
|
||||
};
|
||||
|
||||
Mover.prototype = {
|
||||
init: function(vector) {
|
||||
this.position = vector.clone();
|
||||
this.velocity = vector.clone();
|
||||
this.anchor = vector.clone();
|
||||
this.acceleration.set(0, 0, 0);
|
||||
this.a = 1;
|
||||
this.time = 0;
|
||||
},
|
||||
updatePosition: function() {
|
||||
this.position.copy(this.velocity);
|
||||
},
|
||||
updateVelocity: function() {
|
||||
this.acceleration.divideScalar(this.mass);
|
||||
this.velocity.add(this.acceleration);
|
||||
// if (this.velocity.distanceTo(this.position) >= 1) {
|
||||
// this.direct(this.velocity);
|
||||
// }
|
||||
},
|
||||
applyForce: function(vector) {
|
||||
this.acceleration.add(vector);
|
||||
},
|
||||
applyFriction: function() {
|
||||
var friction = friction(this.acceleration, 0.1);
|
||||
this.applyForce(friction);
|
||||
},
|
||||
applyDragForce: function(value) {
|
||||
var drag = drag(this.acceleration, value);
|
||||
this.applyForce(drag);
|
||||
},
|
||||
hook: function(rest_length, k) {
|
||||
var force = hook(this.velocity, this.anchor, rest_length, k);
|
||||
this.applyForce(force);
|
||||
},
|
||||
activate: function() {
|
||||
this.is_active = true;
|
||||
},
|
||||
inactivate: function() {
|
||||
this.is_active = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var Points = function(pos) {
|
||||
this.movers_num = 3000;
|
||||
this.movers = [];
|
||||
this.pos = pos;
|
||||
this.geometry = null;
|
||||
this.material = null;
|
||||
this.obj = null;
|
||||
this.texture = null;
|
||||
this.antigravity = new THREE.Vector3(0, 0.1, 0);
|
||||
};
|
||||
|
||||
Points.prototype = {
|
||||
init: function(pos) {
|
||||
this.createTexture();
|
||||
this.geometry = new THREE.Geometry();
|
||||
this.material = new THREE.PointsMaterial({
|
||||
color: 0xff6633,
|
||||
size: 3,
|
||||
transparent: true,
|
||||
opacity: 0.5,
|
||||
map: this.texture,
|
||||
// depthTest: false,
|
||||
depthWrite:false,
|
||||
alphaTest: 0.1,
|
||||
blending: THREE.AdditiveBlending,
|
||||
});
|
||||
for (var i = 0; i < this.movers_num; i++) {
|
||||
var mover = new Mover();
|
||||
|
||||
mover.init(new THREE.Vector3((10*Math.random()+pos.x),pos.y, (10*Math.random()+pos.z)));
|
||||
this.movers.push(mover);
|
||||
this.geometry.vertices.push(mover.position);
|
||||
}
|
||||
this.obj = new THREE.Points(this.geometry, this.material);
|
||||
this.obj.renderOrder = 1;
|
||||
},
|
||||
update: function() {
|
||||
var points_vertices = [];
|
||||
|
||||
for (var i = 0; i < this.movers.length; i++) {
|
||||
var mover = this.movers[i];
|
||||
if (mover.is_active) {
|
||||
mover.applyForce(this.antigravity);
|
||||
mover.updateVelocity();
|
||||
mover.updatePosition();
|
||||
if (mover.position.y > (this.pos.y+5)) {
|
||||
mover.inactivate();
|
||||
}
|
||||
}
|
||||
points_vertices.push(mover.position);
|
||||
}
|
||||
this.obj.geometry.vertices = points_vertices;
|
||||
this.obj.geometry.verticesNeedUpdate = true;
|
||||
},
|
||||
activateMover: function() {
|
||||
var count = 0;
|
||||
let pos = this.pos;
|
||||
for (var i = 0; i < this.movers.length; i++) {
|
||||
var mover = this.movers[i];
|
||||
|
||||
if (mover.is_active) continue;
|
||||
var rad1 = getRadian(Math.log(getRandomInt(200, 256)) / Math.log(256) * 270);
|
||||
var rad2 = getRadian(getRandomInt(0, 360));
|
||||
var force = getSpherical(rad1, rad2, 1);
|
||||
mover.activate();
|
||||
mover.init(new THREE.Vector3((10*Math.random()+pos.x), pos.y+5, (10*Math.random()+pos.z)));
|
||||
mover.applyForce(force);
|
||||
|
||||
count++;
|
||||
if (count >= 10) break;
|
||||
}
|
||||
},
|
||||
createTexture: function() {
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
var grad = null;
|
||||
|
||||
canvas.width = 200;
|
||||
canvas.height = 200;
|
||||
grad = ctx.createRadialGradient(100, 100, 20, 100, 100, 100);
|
||||
grad.addColorStop(0.2, 'rgba(255, 255, 255, 1)');
|
||||
grad.addColorStop(0.5, 'rgba(255, 255, 255, 0.3)');
|
||||
grad.addColorStop(1.0, 'rgba(255, 255, 255, 0)');
|
||||
ctx.fillStyle = grad;
|
||||
ctx.arc(100, 100, 100, 0, Math.PI / 180, true);
|
||||
ctx.fill();
|
||||
this.texture = new THREE.Texture(canvas);
|
||||
this.texture.minFilter = THREE.NearestFilter;
|
||||
this.texture.needsUpdate = true;
|
||||
}
|
||||
};
|
||||
|
||||
var HemiLight = function() {
|
||||
this.rad1 = getRadian(60);
|
||||
this.rad2 = getRadian(30);
|
||||
this.range = 1000;
|
||||
this.hex1 = 0xffffff;
|
||||
this.hex2 = 0x333333;
|
||||
this.intensity = 1;
|
||||
this.obj;
|
||||
};
|
||||
|
||||
HemiLight.prototype = {
|
||||
init: function(hex1, hex2) {
|
||||
if (hex1) this.hex1 = hex1;
|
||||
if (hex2) this.hex2 = hex2;
|
||||
this.obj = new THREE.HemisphereLight(this.hex1, this.hex2, this.intensity);
|
||||
this.setPosition();
|
||||
},
|
||||
setPosition: function() {
|
||||
var points = getSpherical(this.rad1, this.rad2, this.range);
|
||||
this.obj.position.copy(points);
|
||||
}
|
||||
};
|
||||
|
||||
function getRandomInt(min, max) {
|
||||
return Math.floor(Math.random() * (max - min)) + min;
|
||||
}
|
||||
function getDegree(radian) {
|
||||
return radian / Math.PI * 180;
|
||||
}
|
||||
function getRadian(degrees) {
|
||||
return degrees * Math.PI / 180;
|
||||
}
|
||||
function getSpherical(rad1, rad2, r) {
|
||||
var x = Math.cos(rad1) * Math.cos(rad2) * r;
|
||||
var z = Math.cos(rad1) * Math.sin(rad2) * r;
|
||||
var y = Math.sin(rad1) * r;
|
||||
return new THREE.Vector3(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
function friction(acceleration, mu, normal, mass) {
|
||||
var force = acceleration.clone();
|
||||
if (!normal) normal = 1;
|
||||
if (!mass) mass = 1;
|
||||
force.multiplyScalar(-1);
|
||||
force.normalize();
|
||||
force.multiplyScalar(mu);
|
||||
return force;
|
||||
}
|
||||
|
||||
function drag(acceleration, value) {
|
||||
var force = acceleration.clone();
|
||||
force.multiplyScalar(-1);
|
||||
force.normalize();
|
||||
force.multiplyScalar(acceleration.length() * value);
|
||||
return force;
|
||||
}
|
||||
|
||||
function hook(velocity, anchor, rest_length, k) {
|
||||
var force = velocity.clone().sub(anchor);
|
||||
var distance = force.length() - rest_length;
|
||||
force.normalize();
|
||||
force.multiplyScalar(-1 * k * distance);
|
||||
return force;
|
||||
}
|
||||
|
||||
}
|
@ -13,6 +13,7 @@ export function AssetModelManager(editor,scene) {
|
||||
let groupList = [];
|
||||
groupList["standstation"] = new THREE.Group();
|
||||
groupList["stopstation"] = new THREE.Group();
|
||||
groupList["occ"] = new THREE.Group();
|
||||
groupList["device"] = new THREE.Group();
|
||||
groupList["xl"] = new THREE.Group();
|
||||
groupList["dc"] = new THREE.Group();
|
||||
@ -23,6 +24,13 @@ export function AssetModelManager(editor,scene) {
|
||||
planeDevice.rotation.x = -Math.PI/2;
|
||||
groupList["device"].add(planeDevice);
|
||||
|
||||
let geometryXl = new THREE.PlaneGeometry( 100, 100, 32 );
|
||||
let materialXl = new THREE.MeshBasicMaterial( {color: 0xffffff, side: THREE.DoubleSide} );
|
||||
let planeXl = new THREE.Mesh( geometryXl, materialXl );
|
||||
planeXl.rotation.x = -Math.PI/2;
|
||||
groupList["xl"].add(planeXl);
|
||||
|
||||
|
||||
this.loadAsset = [];
|
||||
|
||||
this.staticAsset = [];
|
||||
@ -80,6 +88,27 @@ export function AssetModelManager(editor,scene) {
|
||||
resourceType:"三维课程",
|
||||
sceneType:"standstation",
|
||||
};
|
||||
scope.staticAsset['wxc'] = {
|
||||
modelId:'wxc',
|
||||
packageName:"维修厂",
|
||||
url:"/MODEL/2021-08-12/196-43574.FBX",
|
||||
mesh:"",
|
||||
assetType:'onlineasset',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"stopstation",
|
||||
};
|
||||
|
||||
scope.staticAsset['occ'] = {
|
||||
modelId:'occ',
|
||||
packageName:"occ大厅",
|
||||
url:"/MODEL/2021-09-02/210-32471.FBX",
|
||||
mesh:"",
|
||||
assetType:'onlineasset',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"occ",
|
||||
};
|
||||
|
||||
|
||||
//场景中可触发事件模型
|
||||
@ -87,14 +116,17 @@ export function AssetModelManager(editor,scene) {
|
||||
|
||||
scope.lessonTriggerList["standstation"] = [];
|
||||
scope.lessonTriggerList["stopstation"] = [];
|
||||
|
||||
scope.lessonTriggerList["occ"] = [];
|
||||
|
||||
scope.lessonTriggerList["device"] = [];
|
||||
scope.lessonTriggerList["xl"] = [];
|
||||
scope.lessonTriggerList["dc"] = [];
|
||||
|
||||
this.changeSceneGroup = function(groupType){
|
||||
console.log(groupType);
|
||||
console.log(editor.nowSceneType);
|
||||
console.log(scope.lessonTriggerList[editor.nowSceneType]);
|
||||
// console.log(groupType);
|
||||
// console.log(editor.nowSceneType);
|
||||
// console.log(scope.lessonTriggerList[editor.nowSceneType]);
|
||||
editor.nowSceneType = groupType;
|
||||
scene.remove(this.otherModel);
|
||||
this.otherModel = groupList[groupType];
|
||||
@ -251,6 +283,11 @@ export function AssetModelManager(editor,scene) {
|
||||
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
|
||||
|
||||
|
||||
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").showType = "default";
|
||||
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").label = "屏蔽门开关";
|
||||
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
|
||||
|
||||
|
||||
|
||||
// console.log(scope.loadAsset['default1'].mesh.getObjectByName("FTKG"));
|
||||
}
|
||||
@ -319,6 +356,16 @@ export function AssetModelManager(editor,scene) {
|
||||
asset.mesh = object;
|
||||
groupList[asset.sceneType].add(object);
|
||||
// scope.otherModel.add(object);
|
||||
resolve();
|
||||
} );
|
||||
}else if(asset.assetType == "onlineasset"){
|
||||
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
|
||||
if(asset.sceneType){
|
||||
object.sceneType = asset.sceneType;
|
||||
}
|
||||
asset.mesh = object;
|
||||
groupList[asset.sceneType].add(object);
|
||||
|
||||
resolve();
|
||||
} );
|
||||
}else{
|
||||
|
@ -10,7 +10,9 @@ import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
//骨骼动画模型辅助工具
|
||||
import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js';
|
||||
|
||||
import { AssetModelManager } from '@/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js';
|
||||
import { AssetModelManager } from '@/jlmap3d/lesson3dedit/manager/assetmodelmanager.js';
|
||||
|
||||
import { AccidentManager } from '@/jlmap3d/lesson3dedit/manager/accidentmanager.js';
|
||||
|
||||
import { TransformControls } from '@/jlmap3d/lesson3dedit/controls/TransformControls';
|
||||
|
||||
@ -20,7 +22,6 @@ let delta;
|
||||
let scene;
|
||||
|
||||
export function Lesson3dEditor(dom,lessonData) {
|
||||
|
||||
// let stats = new Stats();
|
||||
// dom.appendChild( stats.dom );
|
||||
let lessonIndex = 0;
|
||||
@ -75,6 +76,8 @@ export function Lesson3dEditor(dom,lessonData) {
|
||||
//
|
||||
scene.add(transcontrol);
|
||||
|
||||
let accidentManager = new AccidentManager(scene);
|
||||
accidentManager.initAccident();
|
||||
|
||||
let assetModelManager = new AssetModelManager(scope,scene);
|
||||
|
||||
@ -85,6 +88,11 @@ export function Lesson3dEditor(dom,lessonData) {
|
||||
}else{
|
||||
assetModelManager.lessonAssetsLoader();
|
||||
}
|
||||
|
||||
if(lessonData.accidentList){
|
||||
accidentManager.loadAccidentList(lessonData.accidentList)
|
||||
}
|
||||
|
||||
}else{
|
||||
assetModelManager.lessonAssetsLoader();
|
||||
}
|
||||
@ -98,6 +106,7 @@ export function Lesson3dEditor(dom,lessonData) {
|
||||
render();
|
||||
scope.controls.update();
|
||||
// delta = clock.getDelta();
|
||||
accidentManager.update();
|
||||
requestAnimationFrame(animate);
|
||||
|
||||
}
|
||||
@ -112,7 +121,11 @@ export function Lesson3dEditor(dom,lessonData) {
|
||||
|
||||
this.changeIndex = function(nowIndex){
|
||||
lessonIndex = nowIndex;
|
||||
console.log(lessonData.lessonProgress[lessonIndex]);
|
||||
scope.nowSceneType = lessonData.lessonProgress[lessonIndex].progressScene;
|
||||
assetModelManager.changeSceneGroup(scope.nowSceneType);
|
||||
|
||||
accidentManager.changeSceneGroup(scope.nowSceneType);
|
||||
// if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){
|
||||
// controlManager.initControlMode(lessonIndex);
|
||||
// controlManager.initRoleMode(true,nowRole);
|
||||
@ -130,6 +143,7 @@ export function Lesson3dEditor(dom,lessonData) {
|
||||
console.log(value2);
|
||||
if(type == "changeScene"){
|
||||
assetModelManager.changeSceneGroup(value1);
|
||||
accidentManager.changeSceneGroup(value1);
|
||||
scope.nowSceneType = value1;
|
||||
}
|
||||
}
|
||||
@ -154,10 +168,32 @@ export function Lesson3dEditor(dom,lessonData) {
|
||||
|
||||
}
|
||||
|
||||
this.createAccident = function(accidentData,mousePos){
|
||||
var mouse = new THREE.Vector2();
|
||||
|
||||
var raycaster = new THREE.Raycaster();
|
||||
|
||||
mouse.x = ( mousePos.x / window.innerWidth ) * 2 - 1;
|
||||
|
||||
mouse.y = - ( mousePos.y / dom.offsetHeight ) * 2 + 1;
|
||||
|
||||
raycaster.setFromCamera(mouse,scope.camerass) // 也可以给构造函数传参的形式写
|
||||
|
||||
var intersects = raycaster.intersectObjects( scene.children,true );
|
||||
|
||||
if(intersects.length>0){
|
||||
accidentManager.createNewAccident(accidentData,intersects[0].point,scope.nowSceneType);
|
||||
}
|
||||
}
|
||||
|
||||
this.saveAssetModel = function(){
|
||||
return assetModelManager.saveModelList();
|
||||
}
|
||||
|
||||
this.saveAccidentModel = function(){
|
||||
return accidentManager.saveDataList();
|
||||
}
|
||||
|
||||
this.attachModel = function(selectModel){
|
||||
transcontrol.attach(selectModel);
|
||||
}
|
||||
@ -166,4 +202,8 @@ export function Lesson3dEditor(dom,lessonData) {
|
||||
transcontrol.detach();
|
||||
assetModelManager.deleteAsset(selectModel,scope.nowSceneType);
|
||||
}
|
||||
this.deleteAccident = function(selectAccident){
|
||||
accidentManager.deleteAccident(selectAccident,scope.nowSceneType);
|
||||
}
|
||||
|
||||
}
|
||||
|
146
src/jlmap3d/lesson3dedit/manager/accidentmanager.js
Normal file
@ -0,0 +1,146 @@
|
||||
// import { AssetModelManager } from '@/jlmap3d/lesson3dedit/manager/assetmodelmanager.js';
|
||||
import { Fire } from '@/jlmap3d/lesson3dedit/accident/fire.js';
|
||||
|
||||
export function AccidentManager(scene) {
|
||||
let scope = this;
|
||||
|
||||
this.accidentList = [];
|
||||
|
||||
this.accidentGroup = new THREE.Group();
|
||||
|
||||
//场景中可触发事件模型
|
||||
this.accidentList = [];
|
||||
|
||||
scope.accidentList["standstation"] = [];
|
||||
scope.accidentList["stopstation"] = [];
|
||||
|
||||
scope.accidentList["occ"] = [];
|
||||
|
||||
scope.accidentList["device"] = [];
|
||||
scope.accidentList["xl"] = [];
|
||||
scope.accidentList["dc"] = [];
|
||||
|
||||
let groupList = [];
|
||||
groupList["standstation"] = new THREE.Group();
|
||||
groupList["stopstation"] = new THREE.Group();
|
||||
groupList["occ"] = new THREE.Group();
|
||||
groupList["device"] = new THREE.Group();
|
||||
groupList["xl"] = new THREE.Group();
|
||||
groupList["dc"] = new THREE.Group();
|
||||
|
||||
let updateSceneType = "standstation";
|
||||
|
||||
scene.add(scope.accidentGroup);
|
||||
|
||||
this.initAccident = function(nowSceneType){
|
||||
let accidentData = [
|
||||
{
|
||||
id:'1',
|
||||
name:"火灾",
|
||||
type:"fire"
|
||||
}
|
||||
];
|
||||
jl3dUpdateAccidentData(accidentData);
|
||||
}
|
||||
|
||||
this.saveDataList = function(){
|
||||
let saveList = [];
|
||||
for(let g in scope.accidentList){
|
||||
for(let i=0;i<scope.accidentList[g].length;i++){
|
||||
if(scope.accidentList[g][i].showType != "default"){
|
||||
saveList.push({
|
||||
id:scope.accidentList[g][i].id,
|
||||
name:scope.accidentList[g][i].name,
|
||||
label:scope.accidentList[g][i].label,
|
||||
type:scope.accidentList[g][i].type,
|
||||
pos:{
|
||||
x:scope.accidentList[g][i].pos.x,
|
||||
y:scope.accidentList[g][i].pos.y,
|
||||
z:scope.accidentList[g][i].pos.z
|
||||
},
|
||||
showType:scope.accidentList[g][i].showType,
|
||||
sceneType:scope.accidentList[g][i].sceneType,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return saveList;
|
||||
}
|
||||
|
||||
this.changeSceneGroup = function(nowSceneType){
|
||||
if(scope.accidentGroup.children.length>0){
|
||||
scope.accidentGroup.remove(scope.accidentGroup.children[0]);
|
||||
}
|
||||
scope.accidentGroup.add(groupList[nowSceneType]);
|
||||
jl3dUpdateAccidentlist(scope.accidentList[nowSceneType]);
|
||||
updateSceneType = nowSceneType;
|
||||
}
|
||||
|
||||
this.createNewAccident = function(type,pos,nowSceneType){
|
||||
|
||||
var rand = Math.floor(Math.random () * 900) + 100;
|
||||
|
||||
let newAccident = {
|
||||
id:rand,
|
||||
name:type,
|
||||
label:type+rand,
|
||||
type:type,
|
||||
object:{},
|
||||
pos:pos,
|
||||
sceneType:nowSceneType,
|
||||
showType:"loadModel",
|
||||
};
|
||||
if(type == "fire"){
|
||||
newAccident.object = new Fire();
|
||||
newAccident.object.createNew(groupList[nowSceneType],pos);
|
||||
}
|
||||
scope.accidentList[nowSceneType].push(newAccident);
|
||||
jl3dUpdateAccidentlist(scope.accidentList[nowSceneType]);
|
||||
}
|
||||
|
||||
this.deleteAccident = function(selectAccident,nowSceneType){
|
||||
groupList[nowSceneType].remove(selectAccident.object.points.obj);
|
||||
console.log(selectAccident);
|
||||
for(let i=0;i<scope.accidentList[nowSceneType].length;i++){
|
||||
if(scope.accidentList[nowSceneType][i].id == selectAccident.id){
|
||||
scope.accidentList[nowSceneType].splice(i,1);
|
||||
jl3dUpdateAccidentlist(scope.accidentList[nowSceneType]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.loadAccidentList = function(accidentList){
|
||||
console.log(accidentList);
|
||||
for(let i=0;i<accidentList.length;i++){
|
||||
let newAccident = {
|
||||
id:accidentList[i].id,
|
||||
name:accidentList[i].name,
|
||||
label:accidentList[i].label,
|
||||
type:accidentList[i].type,
|
||||
object:{},
|
||||
pos:accidentList[i].pos,
|
||||
sceneType:accidentList[i].sceneType,
|
||||
showType:"loadModel",
|
||||
};
|
||||
if(accidentList[i].type == "fire"){
|
||||
newAccident.object = new Fire();
|
||||
newAccident.object.createNew(groupList[accidentList[i].sceneType],accidentList[i].pos);
|
||||
}
|
||||
scope.accidentList[accidentList[i].sceneType].push(newAccident);
|
||||
// jl3dUpdateAccidentlist(scope.accidentList[accidentList[i].sceneType]);
|
||||
}
|
||||
}
|
||||
|
||||
this.changeAccidentStatus = function(){
|
||||
|
||||
}
|
||||
|
||||
this.update = function(){
|
||||
for(let i=0;i<scope.accidentList[updateSceneType].length;i++){
|
||||
scope.accidentList[updateSceneType][i].object.update();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
401
src/jlmap3d/lesson3dedit/manager/assetmodelmanager.js
Normal file
@ -0,0 +1,401 @@
|
||||
import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
export function AssetModelManager(editor,scene) {
|
||||
let scope = this;
|
||||
|
||||
|
||||
this.assetList = [];
|
||||
|
||||
this.otherModel = new THREE.Group();
|
||||
|
||||
//场景中可触发事件模型
|
||||
this.lessonTriggerList = [];
|
||||
|
||||
scope.lessonTriggerList["standstation"] = [];
|
||||
scope.lessonTriggerList["stopstation"] = [];
|
||||
|
||||
scope.lessonTriggerList["occ"] = [];
|
||||
|
||||
scope.lessonTriggerList["device"] = [];
|
||||
scope.lessonTriggerList["xl"] = [];
|
||||
scope.lessonTriggerList["dc"] = [];
|
||||
|
||||
let groupList = [];
|
||||
groupList["standstation"] = new THREE.Group();
|
||||
groupList["stopstation"] = new THREE.Group();
|
||||
groupList["occ"] = new THREE.Group();
|
||||
groupList["device"] = new THREE.Group();
|
||||
groupList["xl"] = new THREE.Group();
|
||||
groupList["dc"] = new THREE.Group();
|
||||
|
||||
let geometryDevice = new THREE.PlaneGeometry( 100, 100, 32 );
|
||||
let materialDevice = new THREE.MeshBasicMaterial( {color: 0xffffff, side: THREE.DoubleSide} );
|
||||
let planeDevice = new THREE.Mesh( geometryDevice, materialDevice );
|
||||
planeDevice.rotation.x = -Math.PI/2;
|
||||
groupList["device"].add(planeDevice);
|
||||
|
||||
let geometryXl = new THREE.PlaneGeometry( 100, 100, 32 );
|
||||
let materialXl = new THREE.MeshBasicMaterial( {color: 0xffffff, side: THREE.DoubleSide} );
|
||||
let planeXl = new THREE.Mesh( geometryXl, materialXl );
|
||||
planeXl.rotation.x = -Math.PI/2;
|
||||
groupList["xl"].add(planeXl);
|
||||
|
||||
|
||||
this.loadAsset = [];
|
||||
|
||||
this.staticAsset = [];
|
||||
scope.staticAsset['station'] = {
|
||||
modelId:'station',
|
||||
packageName:"车站",
|
||||
url:"/MODEL/2021-09-08/211-9861.FBX",
|
||||
mesh:"",
|
||||
assetType:'onlineasset',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"standstation",
|
||||
};
|
||||
|
||||
scope.staticAsset['FTDH'] = {
|
||||
modelId:'FTDH',
|
||||
packageName:"电扶梯",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/FTDH.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"standstation",
|
||||
};
|
||||
|
||||
scope.staticAsset['IN'] = {
|
||||
modelId:'IN',
|
||||
packageName:"进闸机",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/IN.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"standstation",
|
||||
};
|
||||
|
||||
scope.staticAsset['OUT'] = {
|
||||
modelId:'OUT',
|
||||
packageName:"出闸机",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/OUT.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"standstation",
|
||||
};
|
||||
|
||||
scope.staticAsset['PBMDH'] = {
|
||||
modelId:'PBMDH',
|
||||
packageName:"屏蔽门",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/PBMDH.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"standstation",
|
||||
};
|
||||
scope.staticAsset['wxc'] = {
|
||||
modelId:'wxc',
|
||||
packageName:"维修厂",
|
||||
url:"/MODEL/2021-08-12/196-43574.FBX",
|
||||
mesh:"",
|
||||
assetType:'onlineasset',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"stopstation",
|
||||
};
|
||||
|
||||
scope.staticAsset['occ'] = {
|
||||
modelId:'occ',
|
||||
packageName:"occ大厅",
|
||||
url:"/MODEL/2021-09-02/210-32471.FBX",
|
||||
mesh:"",
|
||||
assetType:'onlineasset',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:"occ",
|
||||
};
|
||||
|
||||
|
||||
|
||||
this.changeSceneGroup = function(groupType){
|
||||
// console.log(groupType);
|
||||
// console.log(editor.nowSceneType);
|
||||
// console.log(scope.lessonTriggerList[editor.nowSceneType]);
|
||||
editor.nowSceneType = groupType;
|
||||
scene.remove(this.otherModel);
|
||||
this.otherModel = groupList[groupType];
|
||||
scene.add(this.otherModel);
|
||||
updateTriggerList(scope.lessonTriggerList[editor.nowSceneType]);
|
||||
}
|
||||
|
||||
this.saveModelList = function(){
|
||||
let modelList = {
|
||||
assetList:[],
|
||||
modelList:[],
|
||||
};
|
||||
|
||||
for(let k in scope.loadAsset){
|
||||
modelList.assetList.push({
|
||||
modelId:scope.loadAsset[k].modelId,
|
||||
packageName:scope.loadAsset[k].packageName,
|
||||
url:scope.loadAsset[k].url,
|
||||
assetType:scope.loadAsset[k].assetType,
|
||||
isUse:scope.loadAsset[k].isUse,
|
||||
resourceType:scope.loadAsset[k].resourceType,
|
||||
sceneType:scope.loadAsset[k].sceneType,
|
||||
});
|
||||
}
|
||||
|
||||
for(let g in scope.lessonTriggerList){
|
||||
for(let i=0;i<scope.lessonTriggerList[g].length;i++){
|
||||
if(scope.lessonTriggerList[g][i].showType != "default"){
|
||||
modelList.modelList.push({
|
||||
name:scope.lessonTriggerList[g][i].name,
|
||||
modelId:scope.lessonTriggerList[g][i].modelId,
|
||||
label:scope.lessonTriggerList[g][i].label,
|
||||
pos:{
|
||||
x:scope.lessonTriggerList[g][i].position.x,
|
||||
y:scope.lessonTriggerList[g][i].position.y,
|
||||
z:scope.lessonTriggerList[g][i].position.z
|
||||
},
|
||||
rot:{
|
||||
x:scope.lessonTriggerList[g][i].rotation.x,
|
||||
y:scope.lessonTriggerList[g][i].rotation.y,
|
||||
z:scope.lessonTriggerList[g][i].rotation.z
|
||||
},
|
||||
showType:scope.lessonTriggerList[g][i].showType,
|
||||
visible:scope.lessonTriggerList[g][i].visible,
|
||||
sceneType:scope.lessonTriggerList[g][i].sceneType,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
console.log(modelList);
|
||||
return modelList;
|
||||
}
|
||||
|
||||
//加载课程资源
|
||||
this.lessonAssetsLoader = function(lessonData){
|
||||
let initlist = [];
|
||||
if(lessonData){
|
||||
// scene.remove(this.otherModel);
|
||||
this.otherModel = groupList[lessonData.lessonProgress[0].progressScene];
|
||||
scene.add(this.otherModel);
|
||||
|
||||
let assetList = lessonData.assetList;
|
||||
for(let i = 0;i<assetList.length;i++){
|
||||
assetList[i].mesh = "";
|
||||
// assetList[i].sceneType = "standstation";
|
||||
if(assetList[i].modelId == "default1"){
|
||||
|
||||
}else{
|
||||
scope.loadAsset[assetList[i].modelId] = assetList[i];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
this.otherModel = groupList["standstation"];
|
||||
scene.add(this.otherModel);
|
||||
}
|
||||
|
||||
for(let k in scope.staticAsset){
|
||||
initlist.push(fbxpromise(scope.staticAsset[k]));
|
||||
}
|
||||
|
||||
for(let k in scope.loadAsset){
|
||||
initlist.push(fbxpromise(scope.loadAsset[k]));
|
||||
}
|
||||
return new Promise(function(resolve, reject){
|
||||
Promise.all(initlist).then((result) => {
|
||||
|
||||
initTriggerList();
|
||||
if(lessonData){
|
||||
let modelList = lessonData.modelList;
|
||||
for(let i=0;i<modelList.length;i++){
|
||||
let newModelTrigger = scope.loadAsset[modelList[i].modelId].mesh.clone(true);
|
||||
// modelList[i].sceneType = "standstation";
|
||||
newModelTrigger.showType = "loadModel";
|
||||
newModelTrigger.label = modelList[i].label;
|
||||
newModelTrigger.modelId = modelList[i].modelId;
|
||||
newModelTrigger.visible = modelList[i].visible;
|
||||
newModelTrigger.position.x = modelList[i].pos.x;
|
||||
newModelTrigger.position.y = modelList[i].pos.y;
|
||||
newModelTrigger.position.z = modelList[i].pos.z;
|
||||
newModelTrigger.rotation.x = modelList[i].rot.x;
|
||||
newModelTrigger.rotation.y = modelList[i].rot.y;
|
||||
newModelTrigger.rotation.z = modelList[i].rot.z;
|
||||
newModelTrigger.sceneType = modelList[i].sceneType;
|
||||
scope.lessonTriggerList[modelList[i].sceneType].push(newModelTrigger);
|
||||
groupList[modelList[i].sceneType].add(newModelTrigger);
|
||||
|
||||
}
|
||||
}
|
||||
editor.changeIndex(0);
|
||||
updateTriggerList(scope.lessonTriggerList[editor.nowSceneType]);
|
||||
|
||||
resolve("loaderassets"); //['成功了', 'success']
|
||||
}).catch((error) => {
|
||||
//console.log(error);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
this.deleteAsset = function(selectModel,nowSceneType){
|
||||
scope.otherModel.remove(selectModel);
|
||||
for(let i=0;i<scope.lessonTriggerList[nowSceneType].length;i++){
|
||||
if(scope.lessonTriggerList[nowSceneType][i].uuid == selectModel.uuid){
|
||||
scope.lessonTriggerList[nowSceneType].splice(i,1);
|
||||
updateTriggerList(scope.lessonTriggerList[nowSceneType]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// <el-option label="车站" value="standstation"></el-option>
|
||||
// <el-option label="停车场" value="stopstation"></el-option>
|
||||
// <el-option label="单体设备" value="device"></el-option>
|
||||
// <el-option label="线路" value="xl"></el-option>
|
||||
// <el-option label="道岔" value="dc"></el-option>
|
||||
//FT 扶梯
|
||||
//FTAN 扶梯按钮(急停)
|
||||
//FTD 扶梯灯
|
||||
//FTKG 扶梯开关(钥匙孔)
|
||||
//FTTJ 扶梯台阶
|
||||
function initTriggerList(){
|
||||
scope.staticAsset['station'].mesh.getObjectByName("FTAN").showType = "default";
|
||||
scope.staticAsset['station'].mesh.getObjectByName("FTAN").label = "扶梯急停按钮";
|
||||
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("FTAN"));
|
||||
|
||||
scope.staticAsset['station'].mesh.getObjectByName("FTKG").showType = "default";
|
||||
scope.staticAsset['station'].mesh.getObjectByName("FTKG").label = "扶梯钥匙孔";
|
||||
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("FTKG"));
|
||||
|
||||
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").showType = "default";
|
||||
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").label = "屏蔽门开关";
|
||||
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
|
||||
|
||||
// console.log(DMH);
|
||||
scope.staticAsset['station'].mesh.getObjectByName("DMH").showType = "default";
|
||||
scope.staticAsset['station'].mesh.getObjectByName("DMH").label = "隔离门";
|
||||
scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("DMH"));
|
||||
scope.staticAsset['station'].mesh.getObjectByName("DMH").rotation.z = Math.PI/2;
|
||||
|
||||
for(let i=0;i <scope.staticAsset['PBMDH'].mesh.children.length;i++){
|
||||
if(scope.staticAsset['PBMDH'].mesh.children[i].type == "Group"){
|
||||
let meshname = scope.staticAsset['PBMDH'].mesh.children[i].name;
|
||||
scope.staticAsset['PBMDH'].mesh.children[i].showType = "default";
|
||||
scope.staticAsset['PBMDH'].mesh.children[i].label = meshname;
|
||||
scope.lessonTriggerList["standstation"].push(scope.staticAsset['PBMDH'].mesh.getObjectByName(meshname));
|
||||
}
|
||||
|
||||
}
|
||||
// console.log(scope.loadAsset['default1'].mesh.getObjectByName("FTKG"));
|
||||
}
|
||||
|
||||
//动态加载资源
|
||||
this.lessonAssetsNewLoader = function(assetData,pos,nowSceneType){
|
||||
let isLoaded = false;
|
||||
var rand = Math.floor(Math.random () * 900) + 100;
|
||||
if(scope.loadAsset[assetData.id]){
|
||||
let newModelTrigger = scope.loadAsset[assetData.id].mesh.clone(true);
|
||||
newModelTrigger.modelId = assetData.id;
|
||||
newModelTrigger.showType = "loadModel";
|
||||
newModelTrigger.label = assetData.packageName +rand;
|
||||
newModelTrigger.position.copy(pos);
|
||||
newModelTrigger.sceneType = nowSceneType;
|
||||
|
||||
scope.lessonTriggerList[nowSceneType].push(newModelTrigger);
|
||||
groupList[nowSceneType].add(newModelTrigger);
|
||||
|
||||
updateTriggerList(scope.lessonTriggerList[nowSceneType]);
|
||||
}else{
|
||||
scope.loadAsset[assetData.id] = {
|
||||
modelId:assetData.id,
|
||||
packageName:assetData.packageName +rand,
|
||||
url:assetData.url,
|
||||
mesh:"",
|
||||
assetType:'loadModel',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
sceneType:nowSceneType,
|
||||
};
|
||||
console.log("new");
|
||||
|
||||
fbxpromise(scope.loadAsset[assetData.id]).then(function(object){
|
||||
|
||||
console.log(scope.loadAsset[assetData.id].mesh);
|
||||
|
||||
let newModelTrigger = scope.loadAsset[assetData.id].mesh.clone(true);
|
||||
newModelTrigger.showType = "loadModel";
|
||||
newModelTrigger.modelId = assetData.id;
|
||||
newModelTrigger.label = assetData.packageName+rand;
|
||||
newModelTrigger.position.copy(pos);
|
||||
newModelTrigger.sceneType = nowSceneType;
|
||||
|
||||
scope.lessonTriggerList[nowSceneType].push(newModelTrigger);
|
||||
groupList[nowSceneType].add(newModelTrigger);
|
||||
|
||||
updateTriggerList(scope.lessonTriggerList[nowSceneType]);
|
||||
// resolve("loadednew");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//fbx模型加载
|
||||
function fbxpromise(asset){
|
||||
return new Promise(function(resolve, reject){
|
||||
var loader = new THREE.FBXLoader();
|
||||
// console.log(asset);
|
||||
// console.log(asset.url);
|
||||
if(asset.assetType == "static"){
|
||||
loader.load( asset.url, function ( object ) {
|
||||
if(asset.sceneType){
|
||||
object.sceneType = asset.sceneType;
|
||||
}
|
||||
asset.mesh = object;
|
||||
groupList[asset.sceneType].add(object);
|
||||
// scope.otherModel.add(object);
|
||||
resolve();
|
||||
} );
|
||||
}else if(asset.assetType == "onlineasset"){
|
||||
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
|
||||
if(asset.sceneType){
|
||||
object.sceneType = asset.sceneType;
|
||||
}
|
||||
asset.mesh = object;
|
||||
groupList[asset.sceneType].add(object);
|
||||
|
||||
resolve();
|
||||
} );
|
||||
}else{
|
||||
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
|
||||
if(asset.sceneType){
|
||||
object.sceneType = asset.sceneType;
|
||||
}
|
||||
asset.mesh = object;
|
||||
if(asset.assetType == "default"){
|
||||
|
||||
console.log(object);
|
||||
// scene.add(object);
|
||||
}else if(asset.assetType == 'loadModel'){
|
||||
|
||||
}
|
||||
|
||||
resolve();
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -9,6 +9,7 @@ export function LessonData() {
|
||||
this.lessonData = {
|
||||
//资源列表
|
||||
assetList:[],
|
||||
accidentList:[],
|
||||
setup:{
|
||||
examMode:"",
|
||||
checkedRole:"",
|
||||
@ -32,7 +33,7 @@ export function LessonData() {
|
||||
roleName:"",
|
||||
roleUse:true,
|
||||
score:0,
|
||||
progressScene:"",
|
||||
progressScene:"standstation",
|
||||
nextCode:"",
|
||||
nextNode:"",
|
||||
triggerType:"",
|
||||
@ -76,7 +77,6 @@ export function LessonData() {
|
||||
}
|
||||
|
||||
this.loadLessonProgress = function(loadData){
|
||||
console.log(loadData);
|
||||
for(let i=0;i<loadData.length;i++){
|
||||
let newLessonProgress = {
|
||||
id:loadData[i].id,
|
||||
|
@ -119,6 +119,75 @@ export function JobPaneData() {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"列车司机",
|
||||
value:"lcsj",
|
||||
text:"",
|
||||
picurl:"",
|
||||
controlList:[
|
||||
//联控
|
||||
{
|
||||
name:"联控",
|
||||
data:[],
|
||||
},
|
||||
//动作
|
||||
{
|
||||
name:"动作",
|
||||
data:[],
|
||||
},
|
||||
//口呼
|
||||
{
|
||||
name:"口呼",
|
||||
data:[],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"故障列车司机",
|
||||
value:"gzlcsj",
|
||||
text:"",
|
||||
picurl:"",
|
||||
controlList:[
|
||||
//联控
|
||||
{
|
||||
name:"联控",
|
||||
data:[],
|
||||
},
|
||||
//动作
|
||||
{
|
||||
name:"动作",
|
||||
data:[],
|
||||
},
|
||||
//口呼
|
||||
{
|
||||
name:"口呼",
|
||||
data:[],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"救援列车司机",
|
||||
value:"jylcsj",
|
||||
text:"",
|
||||
picurl:"",
|
||||
controlList:[
|
||||
//联控
|
||||
{
|
||||
name:"联控",
|
||||
data:[],
|
||||
},
|
||||
//动作
|
||||
{
|
||||
name:"动作",
|
||||
data:[],
|
||||
},
|
||||
//口呼
|
||||
{
|
||||
name:"口呼",
|
||||
data:[],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"站长",
|
||||
value:"zz",
|
||||
@ -189,7 +258,7 @@ export function JobPaneData() {
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"生产调度",
|
||||
name:"通号调度",
|
||||
value:"scdd",
|
||||
text:"",
|
||||
picurl:"",
|
||||
|
533
src/jlmap3d/lesson3dedit/toolsmodel/zzwwtrain.js
Normal file
@ -0,0 +1,533 @@
|
||||
|
||||
export function ZzwwTrain() {
|
||||
let scope = this;
|
||||
this.deviceList = [
|
||||
{
|
||||
tittle:"防溜防护检查",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
|
||||
},
|
||||
{
|
||||
id:"ZLQ",
|
||||
name:"止轮器",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车辆端部检查(前端)",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"FD",
|
||||
name:"风笛",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"SDD",
|
||||
name:"上大灯",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"XDD",
|
||||
name:"下大灯",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"YGQ",
|
||||
name:"雨刮器",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"DFBL",
|
||||
name:"挡风玻璃",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"BYC",
|
||||
name:"百叶窗",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"DCFS",
|
||||
name:"调车扶手",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"XTB",
|
||||
name:"下踏板",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车辆端部检查(前端)",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"CG",
|
||||
name:"车钩",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"GS",
|
||||
name:"钩舌",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车辆端部检查(前端)",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"ZJSM",
|
||||
name:"折角塞门",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"ZDGRG",
|
||||
name:"制动管软管",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车辆端部检查(前端)",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"FCD",
|
||||
name:"防尘堵",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"AQL",
|
||||
name:"安全链",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车辆端部检查(前端)",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"PZQ",
|
||||
name:"排障器",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
|
||||
{
|
||||
id:"SSQ",
|
||||
name:"扫石器",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"左前部",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"ZJF",
|
||||
name:"中继阀",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"ZYFG",
|
||||
name:"作用风缸",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"ZDSM",
|
||||
name:"制动塞门",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"JCXHCGQ",
|
||||
name:"信号传感器",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"TJ",
|
||||
name:"托架",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"KYJ",
|
||||
name:"空压机",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"KYJPD",
|
||||
name:"空压机皮带",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
// ,
|
||||
// {
|
||||
// id:"PDYL",
|
||||
// name:"皮带压轮",
|
||||
// color:"#ff0000",
|
||||
// status:"",
|
||||
// value:"未检查",
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"转向架左侧",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"ZXTH",
|
||||
name:"轴箱弹簧",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"ZXDG",
|
||||
name:"轴箱端盖",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"YYJZQ",
|
||||
name:"液压减震器",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"CL",
|
||||
name:"车轮踏面",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"转向架左侧",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"QYZ",
|
||||
name:"牵引座",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"QYG",
|
||||
name:"牵引杆",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"GB",
|
||||
name:"拐臂",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"转向架左侧",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"SDCGQ",
|
||||
name:"速度传感器",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"转向架左侧",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"ZDG",
|
||||
name:"制动缸",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"ZW",
|
||||
name:"闸瓦",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"ZWT",
|
||||
name:"闸瓦托",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"ZWTZG",
|
||||
name:"闸瓦调整杆",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车辆中部(左侧)",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"RYX",
|
||||
name:"燃油箱",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"XDCX",
|
||||
name:"蓄电池箱",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"左侧后部",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"RLZDJAZZ",
|
||||
name:"人力制动机",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车辆(右侧)",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"ZFG",
|
||||
name:"总风缸",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"ZFGSM",
|
||||
name:"总风缸塞门",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"XYQ",
|
||||
name:"消音器",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"右前部",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"KLQ",
|
||||
name:"空滤器",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"JCXHCGQ",
|
||||
name:"信号传感器",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车辆底部检查",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"GWX",
|
||||
name:"钩尾销",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"BSX",
|
||||
name:"变速箱",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"FDJ",
|
||||
name:"发动机",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"CL",
|
||||
name:"车轮",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"CZ",
|
||||
name:"车轴",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"CDZ",
|
||||
name:"传动轴",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"CZCLX",
|
||||
name:"车轴齿轮箱",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车辆底部检查",
|
||||
text:"",
|
||||
devices: [
|
||||
{
|
||||
id:"FLP",
|
||||
name:"法兰盘",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车辆底部检查",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"ZJHXX",
|
||||
name:"中间换向箱",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"GDZ",
|
||||
name:"固定轴",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tittle:"车上检查",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
id:"CC",
|
||||
name:"车窗",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"CM",
|
||||
name:"车门",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
},
|
||||
{
|
||||
id:"BPX",
|
||||
name:"备品箱",
|
||||
color:"#ff0000",
|
||||
status:"",
|
||||
value:"未检查",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
];
|
||||
}
|
@ -102,7 +102,7 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
//console.log(assetloader);
|
||||
console.log(stationstandlist);
|
||||
// console.log(stationstandlist);
|
||||
return tdt.initTdt(stationstandlist.list,mapdata.sectionList,rails.sectionrail,sceneload);
|
||||
})
|
||||
.then(function(data){
|
||||
|
@ -52,6 +52,7 @@ export function SwitchListN() {
|
||||
let mixer = new THREE.AnimationMixer( autoswitch );
|
||||
actions[autoswitch.code] = {
|
||||
normal:"00",
|
||||
command:"",
|
||||
action:mixer.clipAction( autoswitch.animations[0])
|
||||
};
|
||||
actions[autoswitch.code].action.setLoop(THREE.LoopOnce);
|
||||
|
@ -36,11 +36,11 @@ export function TdtList() {
|
||||
let pos = stationData[k].mesh.position;
|
||||
if(stationData[k].stands[i].right == true){
|
||||
newmesh.rotation.y = -Math.PI/2;
|
||||
newmesh.position.set(pos.x+75,0,pos.z+14.8);
|
||||
newmesh.position.set(pos.x+72,0,pos.z+14.5);
|
||||
|
||||
}else{
|
||||
newmesh.rotation.y = Math.PI/2;
|
||||
newmesh.position.set(pos.x-75,0,pos.z-14.8);
|
||||
newmesh.position.set(pos.x-72,0,pos.z-14.5);
|
||||
|
||||
}
|
||||
|
||||
|
707
src/jlmap3d/otherproject/zzww/manager/controlmanager.js
Normal file
@ -0,0 +1,707 @@
|
||||
|
||||
import { Capsule } from '@/jlmap3d/lesson3d/math/Capsule.js';
|
||||
|
||||
import { Octree } from '@/jlmap3d/lesson3d/math/Octree.js';
|
||||
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
import { OBJLoader } from '@/jlmap3d/main/loaders/OBJLoader';
|
||||
|
||||
export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
|
||||
let scope = this;
|
||||
this.controlMode = "";
|
||||
this.controls = {};
|
||||
this.nowCamera = null;
|
||||
this.eventHitMode = false;
|
||||
let modelManager;
|
||||
let nowRole = "";
|
||||
let roleMode = false;
|
||||
|
||||
let examList = {};
|
||||
let examData = {};
|
||||
|
||||
let eventBoxs = [];
|
||||
let raycasterBoxs = [];
|
||||
let actionList = [];
|
||||
let eventTrigger;
|
||||
let nowActions;
|
||||
|
||||
let trainDeviceMode = false;
|
||||
let trainDeviceList = [];
|
||||
|
||||
let renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setClearColor(new THREE.Color(0x000000));
|
||||
renderer.setViewport( 0, 0, dom.offsetWidth, dom.offsetHeight);
|
||||
renderer.setScissor( 0, 0, dom.offsetWidth, dom.offsetHeight);
|
||||
renderer.setScissorTest( false );
|
||||
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
|
||||
renderer.sortObjects = true;
|
||||
dom.appendChild(renderer.domElement);
|
||||
|
||||
let orbitCamera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000);
|
||||
orbitCamera.position.set(0, 80, 40);
|
||||
orbitCamera.aspect = dom.offsetWidth / dom.offsetHeight;
|
||||
orbitCamera.updateProjectionMatrix();
|
||||
|
||||
let oribitControl = new THREE.OrbitControls(orbitCamera,dom);
|
||||
oribitControl.maxPolarAngle = Math.PI / 2;
|
||||
oribitControl.minPolarangle = Math.PI / 5;
|
||||
oribitControl.maxDistance = 800;
|
||||
oribitControl.screenSpacePanning = true;
|
||||
oribitControl.update();
|
||||
|
||||
|
||||
let fpsCamera = new THREE.PerspectiveCamera( 75,dom.offsetWidth / dom.offsetHeight, 0.1, 1000 );
|
||||
fpsCamera.aspect = dom.offsetWidth / dom.offsetHeight;
|
||||
fpsCamera.rotation.order = 'YXZ';
|
||||
|
||||
let attachBox = new THREE.Mesh(
|
||||
new THREE.BoxGeometry(1, 5, 1),
|
||||
new THREE.MeshBasicMaterial({color: 0xff00000,transparent: true,opacity: 0 })//RED box
|
||||
);
|
||||
let hitBox = new THREE.Box3(new THREE.Vector3(), new THREE.Vector3());
|
||||
hitBox.setFromObject(attachBox);
|
||||
scene.add(attachBox);
|
||||
|
||||
//fps control
|
||||
const GRAVITY = 30;
|
||||
|
||||
const NUM_SPHERES = 20;
|
||||
const SPHERE_RADIUS = 0.1;
|
||||
|
||||
const sphereGeometry = new THREE.SphereGeometry( SPHERE_RADIUS, 16, 16 );
|
||||
const sphereMaterial = new THREE.MeshStandardMaterial( { color: 0x888855, roughness: 0.8, metalness: 0.5, } );
|
||||
|
||||
const spheres = [];
|
||||
let sphereIdx = 0;
|
||||
|
||||
for ( let i = 0; i < NUM_SPHERES; i ++ ) {
|
||||
|
||||
const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial );
|
||||
|
||||
|
||||
scene.add( sphere );
|
||||
|
||||
spheres.push( { mesh: sphere, collider: new THREE.Sphere( new THREE.Vector3( 0, - 100, 0 ), SPHERE_RADIUS ), velocity: new THREE.Vector3() } );
|
||||
|
||||
}
|
||||
|
||||
|
||||
let loaderObj = new THREE.OBJLoader();
|
||||
let standstationPZ,stopstationPZ,occPZ;
|
||||
// load a resource
|
||||
loaderObj.load(
|
||||
JL3D_LOCAL_STATIC+'/lesson3d/standstationPZ.obj',
|
||||
function ( object ) {
|
||||
standstationPZ = object;
|
||||
},
|
||||
function ( xhr ) {
|
||||
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
|
||||
},
|
||||
function ( error ) {
|
||||
console.log( 'An error happened' );
|
||||
}
|
||||
);
|
||||
loaderObj.load(
|
||||
JL3D_LOCAL_STATIC+'/lesson3d/stopstationPZ.obj',
|
||||
function ( object ) {
|
||||
stopstationPZ = object;
|
||||
},
|
||||
function ( xhr ) {
|
||||
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
|
||||
},
|
||||
function ( error ) {
|
||||
console.log( 'An error happened' );
|
||||
}
|
||||
);
|
||||
loaderObj.load(
|
||||
JL3D_LOCAL_STATIC+'/lesson3d/occPZ.obj',
|
||||
function ( object ) {
|
||||
occPZ = object;
|
||||
},
|
||||
function ( xhr ) {
|
||||
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
|
||||
},
|
||||
function ( error ) {
|
||||
console.log( 'An error happened' );
|
||||
}
|
||||
);
|
||||
|
||||
this.initRoleMode = function(rMode,role){
|
||||
roleMode = rMode;
|
||||
nowRole = role;
|
||||
// console.log(roleMode);
|
||||
};
|
||||
|
||||
this.initExam = function(newExamList,newExamData){
|
||||
examList = newExamList;
|
||||
examData = newExamData;
|
||||
};
|
||||
|
||||
function updateExam(){
|
||||
updataExamStatus(examData);
|
||||
}
|
||||
|
||||
const worldOctree = new Octree();
|
||||
|
||||
const playerCollider = new Capsule( new THREE.Vector3( 0, 10, 0 ), new THREE.Vector3( 0, 11.9, 0 ), 1 );
|
||||
// playerCollider.set(
|
||||
// new THREE.Vector3(
|
||||
// lessonData.lessonProgress[lessonIndex].cameraPosition.x,
|
||||
// lessonData.lessonProgress[lessonIndex].cameraPosition.y,
|
||||
// lessonData.lessonProgress[lessonIndex].cameraPosition.z),
|
||||
// new THREE.Vector3(
|
||||
// lessonData.lessonProgress[lessonIndex].cameraPosition.x,
|
||||
// lessonData.lessonProgress[lessonIndex].cameraPosition.y+1.5,
|
||||
// lessonData.lessonProgress[lessonIndex].cameraPosition.z ), 1);
|
||||
// attachBox.position.x = lessonData.lessonProgress[lessonIndex].cameraPosition.x;
|
||||
// attachBox.position.y = lessonData.lessonProgress[lessonIndex].cameraPosition.y ;
|
||||
// attachBox.position.z = lessonData.lessonProgress[lessonIndex].cameraPosition.z;
|
||||
|
||||
|
||||
|
||||
|
||||
const playerVelocity = new THREE.Vector3();
|
||||
const playerDirection = new THREE.Vector3();
|
||||
|
||||
let playerOnFloor = false;
|
||||
|
||||
const keyStates = {};
|
||||
let clock = new THREE.Clock();
|
||||
|
||||
|
||||
this.updateOrbitControl = function(){
|
||||
oribitControl.update();
|
||||
render(orbitCamera);
|
||||
};
|
||||
|
||||
this.updateFpsControl = function(){
|
||||
const deltaTime = Math.min( 0.1, clock.getDelta() );
|
||||
|
||||
controls( deltaTime );
|
||||
|
||||
updatePlayer( deltaTime );
|
||||
|
||||
updateSpheres( deltaTime );
|
||||
// console.log(scope.eventHitMode);
|
||||
// console.log(roleMode);
|
||||
if(scope.eventHitMode == true && roleMode){
|
||||
if(eventBoxs.length>0){
|
||||
attachBox.position.copy(fpsCamera.position);
|
||||
for(let i=0;i<eventBoxs.length;i++){
|
||||
hitBox.setFromObject(attachBox);
|
||||
eventBoxs[i].setFromObject(eventBoxs[i].mesh);
|
||||
// console.log(eventBoxs[i]);
|
||||
if(hitBox.intersectsBox(eventBoxs[i])){
|
||||
// console.log("相交");
|
||||
// console.log(eventBoxs[i].action);
|
||||
|
||||
if(eventBoxs[i].action.actionMode == "remove"){
|
||||
actionEvent("remove",eventBoxs[i].action,eventBoxs[i].mesh);
|
||||
}
|
||||
|
||||
if(eventBoxs[i].action.actionMode == "jump"){
|
||||
jumpEvent("action",eventBoxs[i].action);
|
||||
actionEvent("remove",eventBoxs[i].action,eventBoxs[i].mesh);
|
||||
|
||||
}
|
||||
// console.log("slice");
|
||||
eventBoxs.splice(i,1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
scope.eventHitMod = false;
|
||||
}
|
||||
// attachBox.position.copy(fpsCamera.position);
|
||||
// hitBox.setFromObject(attachBox);
|
||||
// eventTestBox.setFromObject(eventBox);
|
||||
//
|
||||
// if(hitBox.intersectsBox(eventTestBox)){
|
||||
// //两个物体相交了
|
||||
// console.log("相交");
|
||||
// scope.eventHitMode = false;
|
||||
// }
|
||||
// else{
|
||||
// console.log("不相交");
|
||||
// }
|
||||
}
|
||||
|
||||
render(fpsCamera);
|
||||
};
|
||||
|
||||
|
||||
|
||||
this.init = function(actions,assetModelManager,trainDeviceData){
|
||||
// worldOctree.fromGraphNode( standstationPZ );
|
||||
actionList = actions;
|
||||
modelManager = assetModelManager;
|
||||
if(trainDeviceData){
|
||||
trainDeviceMode = true;
|
||||
trainDeviceList = trainDeviceData;
|
||||
}
|
||||
}
|
||||
|
||||
this.updatePos = function(pos){
|
||||
playerCollider.set(
|
||||
new THREE.Vector3(
|
||||
pos.x,
|
||||
pos.y,
|
||||
pos.z),
|
||||
new THREE.Vector3(
|
||||
pos.x,
|
||||
pos.y+1.5,
|
||||
pos.z ), 1);
|
||||
}
|
||||
|
||||
document.addEventListener( 'keydown', ( event ) => {
|
||||
|
||||
keyStates[ event.code ] = true;
|
||||
|
||||
} );
|
||||
|
||||
document.addEventListener( 'keyup', ( event ) => {
|
||||
|
||||
keyStates[ event.code ] = false;
|
||||
|
||||
} );
|
||||
let fpsMouseStatus = false;
|
||||
document.addEventListener( 'mousedown', (event) => {
|
||||
fpsMouseStatus = true;
|
||||
// document.body.requestPointerLock();
|
||||
console.log("mousedown-----------------------");
|
||||
console.log(raycasterBoxs);
|
||||
console.log(roleMode);
|
||||
|
||||
if(raycasterBoxs.length>0 && roleMode){
|
||||
var mouse = new THREE.Vector2();
|
||||
|
||||
var raycaster = new THREE.Raycaster();
|
||||
|
||||
mouse.x = ( event.clientX / dom.offsetWidth ) * 2 - 1;
|
||||
|
||||
mouse.y = - ( event.clientY / dom.offsetHeight ) * 2 + 1;
|
||||
|
||||
raycaster.setFromCamera(mouse,scope.nowCamera) // 也可以给构造函数传参的形式写
|
||||
|
||||
for(let i=0;i<raycasterBoxs.length;i++){
|
||||
var intersects = raycaster.intersectObject( raycasterBoxs[i].mesh,true);
|
||||
|
||||
if(intersects.length>0){
|
||||
if(raycasterBoxs[i].type == "switch"){
|
||||
if(raycasterBoxs[i].actionMode == "jump"){
|
||||
actionEvent("remove",raycasterBoxs[i],raycasterBoxs[i].mesh);
|
||||
jumpEvent("action",raycasterBoxs[i]);
|
||||
}else{
|
||||
if(raycasterBoxs[i].action.status == "01"){
|
||||
raycasterBoxs[i].action.status = "02";
|
||||
raycasterBoxs[i].action.action.play();
|
||||
}else if(raycasterBoxs[i].action.status == "02"){
|
||||
raycasterBoxs[i].action.status = "01";
|
||||
raycasterBoxs[i].action.action.stop();
|
||||
}
|
||||
}
|
||||
|
||||
}else if(raycasterBoxs[i].type == "urgeSwitch"){
|
||||
console.log(raycasterBoxs[i]);
|
||||
if(raycasterBoxs[i].action.status == "02"){
|
||||
raycasterBoxs[i].action.status = "01";
|
||||
raycasterBoxs[i].action.action.stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(trainDeviceMode == true){
|
||||
var mouse = new THREE.Vector2();
|
||||
|
||||
var raycaster = new THREE.Raycaster();
|
||||
|
||||
mouse.x = ( event.clientX / dom.offsetWidth ) * 2 - 1;
|
||||
|
||||
mouse.y = - ( event.clientY / dom.offsetHeight ) * 2 + 1;
|
||||
|
||||
raycaster.setFromCamera(mouse,scope.nowCamera);
|
||||
|
||||
var intersects = raycaster.intersectObject( modelManager.otherModel.children[1],true);
|
||||
if(intersects.length>0){
|
||||
|
||||
jl3dZzwwTrainTestUpdate(intersects[0].object.name);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} );
|
||||
|
||||
|
||||
|
||||
document.body.addEventListener( 'mousemove', ( event ) => {
|
||||
if(fpsMouseStatus == true){
|
||||
fpsCamera.rotation.y -= event.movementX / 500;
|
||||
fpsCamera.rotation.x -= event.movementY / 500;
|
||||
}
|
||||
// if ( document.pointerLockElement === document.body ) {
|
||||
// }
|
||||
} );
|
||||
|
||||
document.addEventListener( 'mouseup', () => {
|
||||
fpsMouseStatus = false;
|
||||
} );
|
||||
|
||||
|
||||
function playerCollitions() {
|
||||
|
||||
const result = worldOctree.capsuleIntersect( playerCollider );
|
||||
|
||||
playerOnFloor = false;
|
||||
|
||||
if ( result ) {
|
||||
|
||||
playerOnFloor = result.normal.y > 0;
|
||||
|
||||
if ( ! playerOnFloor ) {
|
||||
|
||||
playerVelocity.addScaledVector( result.normal, - result.normal.dot( playerVelocity ) );
|
||||
|
||||
}
|
||||
|
||||
playerCollider.translate( result.normal.multiplyScalar( result.depth ) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function updatePlayer( deltaTime ) {
|
||||
|
||||
if ( playerOnFloor ) {
|
||||
|
||||
const damping = Math.exp( - 3 * deltaTime ) - 1;
|
||||
playerVelocity.addScaledVector( playerVelocity, damping );
|
||||
|
||||
} else {
|
||||
|
||||
playerVelocity.y -= GRAVITY * deltaTime;
|
||||
|
||||
}
|
||||
|
||||
const deltaPosition = playerVelocity.clone().multiplyScalar( deltaTime );
|
||||
playerCollider.translate( deltaPosition );
|
||||
|
||||
playerCollitions();
|
||||
|
||||
fpsCamera.position.copy( playerCollider.end );
|
||||
|
||||
}
|
||||
|
||||
function spheresCollisions() {
|
||||
|
||||
for ( let i = 0; i < spheres.length; i ++ ) {
|
||||
|
||||
const s1 = spheres[ i ];
|
||||
|
||||
for ( let j = i + 1; j < spheres.length; j ++ ) {
|
||||
|
||||
const s2 = spheres[ j ];
|
||||
|
||||
const d2 = s1.collider.center.distanceToSquared( s2.collider.center );
|
||||
const r = s1.collider.radius + s2.collider.radius;
|
||||
const r2 = r * r;
|
||||
|
||||
if ( d2 < r2 ) {
|
||||
|
||||
const normal = s1.collider.clone().center.sub( s2.collider.center ).normalize();
|
||||
const v1 = normal.clone().multiplyScalar( normal.dot( s1.velocity ) );
|
||||
const v2 = normal.clone().multiplyScalar( normal.dot( s2.velocity ) );
|
||||
s1.velocity.add( v2 ).sub( v1 );
|
||||
s2.velocity.add( v1 ).sub( v2 );
|
||||
|
||||
const d = ( r - Math.sqrt( d2 ) ) / 2;
|
||||
|
||||
s1.collider.center.addScaledVector( normal, d );
|
||||
s2.collider.center.addScaledVector( normal, - d );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function updateSpheres( deltaTime ) {
|
||||
|
||||
spheres.forEach( sphere =>{
|
||||
|
||||
sphere.collider.center.addScaledVector( sphere.velocity, deltaTime );
|
||||
|
||||
const result = worldOctree.sphereIntersect( sphere.collider );
|
||||
|
||||
if ( result ) {
|
||||
|
||||
sphere.velocity.addScaledVector( result.normal, - result.normal.dot( sphere.velocity ) * 1.5 );
|
||||
sphere.collider.center.add( result.normal.multiplyScalar( result.depth ) );
|
||||
|
||||
} else {
|
||||
|
||||
sphere.velocity.y -= GRAVITY * deltaTime;
|
||||
|
||||
}
|
||||
|
||||
const damping = Math.exp( - 1.5 * deltaTime ) - 1;
|
||||
sphere.velocity.addScaledVector( sphere.velocity, damping );
|
||||
|
||||
spheresCollisions();
|
||||
|
||||
sphere.mesh.position.copy( sphere.collider.center );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
function getForwardVector() {
|
||||
|
||||
fpsCamera.getWorldDirection( playerDirection );
|
||||
playerDirection.y = 0;
|
||||
playerDirection.normalize();
|
||||
|
||||
return playerDirection;
|
||||
|
||||
}
|
||||
|
||||
function getSideVector() {
|
||||
|
||||
fpsCamera.getWorldDirection( playerDirection );
|
||||
playerDirection.y = 0;
|
||||
playerDirection.normalize();
|
||||
playerDirection.cross( fpsCamera.up );
|
||||
|
||||
return playerDirection;
|
||||
|
||||
}
|
||||
|
||||
function controls( deltaTime ) {
|
||||
|
||||
const speed = 25;
|
||||
|
||||
if ( playerOnFloor ) {
|
||||
|
||||
if ( keyStates[ 'KeyW' ] ) {
|
||||
|
||||
playerVelocity.add( getForwardVector().multiplyScalar( speed * deltaTime ) );
|
||||
|
||||
}
|
||||
|
||||
if ( keyStates[ 'KeyS' ] ) {
|
||||
|
||||
playerVelocity.add( getForwardVector().multiplyScalar( - speed * deltaTime ) );
|
||||
|
||||
}
|
||||
|
||||
if ( keyStates[ 'KeyA' ] ) {
|
||||
|
||||
playerVelocity.add( getSideVector().multiplyScalar( - speed * deltaTime ) );
|
||||
|
||||
}
|
||||
|
||||
if ( keyStates[ 'KeyD' ] ) {
|
||||
|
||||
playerVelocity.add( getSideVector().multiplyScalar( speed * deltaTime ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ( keyStates[ 'Space' ] ) {
|
||||
|
||||
playerVelocity.y = 10;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render(camera){
|
||||
renderer.render( scene, camera );
|
||||
}
|
||||
window.onresize = function () {
|
||||
renderer.setSize(dom.offsetWidth,dom.offsetHeight);
|
||||
}
|
||||
|
||||
this.initControlMode = function(nowLessonIndex){
|
||||
// console.log(lessonData.lessonProgress[nowLessonIndex].progressScene);
|
||||
|
||||
if(lessonData.lessonProgress[nowLessonIndex].progressScene == "standstation"){
|
||||
worldOctree.fromGraphNode( standstationPZ );
|
||||
}else if(lessonData.lessonProgress[nowLessonIndex].progressScene == "stopstation"){
|
||||
worldOctree.fromGraphNode( stopstationPZ );
|
||||
}else if(lessonData.lessonProgress[nowLessonIndex].progressScene == "occ"){
|
||||
worldOctree.fromGraphNode( occPZ );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if((lessonData.lessonProgress[nowLessonIndex].changeCamera == true && lessonData.lessonProgress[nowLessonIndex].roleName == nowRole) || nowLessonIndex == 0 || lessonData.lessonProgress[nowLessonIndex].roleName== 'kong'){
|
||||
|
||||
|
||||
scope.controlMode = lessonData.lessonProgress[nowLessonIndex].controlMode;
|
||||
if(scope.controlMode == "free" || scope.controlMode == "non"){
|
||||
scope.nowCamera = orbitCamera;
|
||||
oribitControl.enabled = true;
|
||||
|
||||
orbitCamera.position.x = lessonData.lessonProgress[nowLessonIndex].cameraPosition.x;
|
||||
orbitCamera.position.y = lessonData.lessonProgress[nowLessonIndex].cameraPosition.y;
|
||||
orbitCamera.position.z = lessonData.lessonProgress[nowLessonIndex].cameraPosition.z;
|
||||
oribitControl.target = new THREE.Vector3(lessonData.lessonProgress[nowLessonIndex].cameraTarget.x,lessonData.lessonProgress[nowLessonIndex].cameraTarget.y,lessonData.lessonProgress[nowLessonIndex].cameraTarget.z);
|
||||
scope.updateOrbitControl();
|
||||
|
||||
if(scope.controlMode == "non"){
|
||||
oribitControl.enabled = false;
|
||||
}
|
||||
}else if(scope.controlMode == "fps"){
|
||||
scope.nowCamera = fpsCamera;
|
||||
oribitControl.enabled = false;
|
||||
playerCollider.set(
|
||||
new THREE.Vector3(
|
||||
lessonData.lessonProgress[nowLessonIndex].cameraPosition.x,
|
||||
lessonData.lessonProgress[nowLessonIndex].cameraPosition.y,
|
||||
lessonData.lessonProgress[nowLessonIndex].cameraPosition.z),
|
||||
new THREE.Vector3(
|
||||
lessonData.lessonProgress[nowLessonIndex].cameraPosition.x,
|
||||
lessonData.lessonProgress[nowLessonIndex].cameraPosition.y+1.5,
|
||||
lessonData.lessonProgress[nowLessonIndex].cameraPosition.z ), 1);
|
||||
attachBox.position.x = lessonData.lessonProgress[nowLessonIndex].cameraPosition.x;
|
||||
attachBox.position.y = lessonData.lessonProgress[nowLessonIndex].cameraPosition.y ;
|
||||
attachBox.position.z = lessonData.lessonProgress[nowLessonIndex].cameraPosition.z;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
this.changeIndexEvent = function(actions,rMode,lessonTriggerList){
|
||||
|
||||
eventTrigger = lessonTriggerList;
|
||||
|
||||
nowActions = actions;
|
||||
// let newEventBoxs = [];
|
||||
// eventBoxs = newEventBoxs;
|
||||
raycasterBoxs = [];
|
||||
roleMode = rMode;
|
||||
// console.log("---------changeIndex--------");
|
||||
// console.log(actions);
|
||||
// console.log(roleMode);
|
||||
// console.log(eventTrigger);
|
||||
// console.log("----------------------------");
|
||||
|
||||
console.log(roleMode);
|
||||
if(actions.length>0 ){
|
||||
scope.eventHitMode = true;
|
||||
for(let i=0;i<actions.length;i++){
|
||||
|
||||
if(actions[i].actionType == "auto"){
|
||||
|
||||
console.log(actions[i]);
|
||||
if(actions[i].actionMode == "play"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
|
||||
if(actionList[eventTrigger[j].actionName].status == "01"){
|
||||
actionList[eventTrigger[j].actionName].status = "02";
|
||||
|
||||
actionList[eventTrigger[j].actionName].action.reset();
|
||||
actionList[eventTrigger[j].actionName].action.timeScale = 1;
|
||||
actionList[eventTrigger[j].actionName].action.clampWhenFinished = true;
|
||||
actionList[eventTrigger[j].actionName].action.setLoop(THREE.LoopOnce);
|
||||
actionList[eventTrigger[j].actionName].action.play();
|
||||
|
||||
}else{
|
||||
actionList[eventTrigger[j].actionName].status = "01";
|
||||
|
||||
actionList[eventTrigger[j].actionName].action.reset();
|
||||
actionList[eventTrigger[j].actionName].action.timeScale = -1;
|
||||
actionList[eventTrigger[j].actionName].action.clampWhenFinished = true;
|
||||
actionList[eventTrigger[j].actionName].action.setLoop(THREE.LoopOnce);
|
||||
actionList[eventTrigger[j].actionName].action.play();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(actions[i].actionMode == "show"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
actionEvent("show",actions[i],eventTrigger[j]);
|
||||
j = eventTrigger.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(actions[i].actionMode == "remove"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
actionEvent("remove",actions[i],eventTrigger[j]);
|
||||
j = eventTrigger.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(roleMode){
|
||||
if(actions[i].actionType == "contact"){
|
||||
if(eventTrigger){
|
||||
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
let eventTestBox = new THREE.Box3(new THREE.Vector3(), new THREE.Vector3());
|
||||
eventTestBox.setFromObject(eventTrigger[j]);
|
||||
eventTestBox.mesh = eventTrigger[j];
|
||||
eventTestBox.action = actions[i];
|
||||
eventBoxs.push(eventTestBox);
|
||||
actionEvent("changeIndex",eventBoxs[i].action,eventTestBox.mesh);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(actions[i].actionType == "switch"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
|
||||
let eventRaycaster = {
|
||||
mesh:eventTrigger[j],
|
||||
action:actionList[eventTrigger[j].actionName],
|
||||
type:actions[i].actionType,
|
||||
actionMode:actions[i].actionMode,
|
||||
jumpNode:actions[i].jumpNode,
|
||||
};
|
||||
raycasterBoxs.push(eventRaycaster);
|
||||
|
||||
actionEvent("changeIndex",actions[i],eventTrigger[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(actions[i].actionType == "urgeSwitch"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
let eventRaycaster = {
|
||||
mesh:eventTrigger[j],
|
||||
action:actionList[eventTrigger[j].actionName],
|
||||
type:actions[i].actionType,
|
||||
};
|
||||
raycasterBoxs.push(eventRaycaster);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else if(actions.length>0){
|
||||
// console.log(actions);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
213
src/jlmap3d/otherproject/zzww/zzww.js
Normal file
@ -0,0 +1,213 @@
|
||||
import store from '@/store/index';
|
||||
// import { Loading } from 'element-ui';
|
||||
import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
|
||||
//静态资源文件路径
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
//loader
|
||||
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
||||
//轨道视角控制
|
||||
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
//骨骼动画模型辅助工具
|
||||
import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js';
|
||||
|
||||
import { AssetModelManager } from '@/jlmap3d/lesson3d/manager/assetmodelmanager.js';
|
||||
|
||||
import { ControlManager } from '@/jlmap3d/otherproject/zzww/manager/controlmanager.js';
|
||||
|
||||
import { AnimateManager } from '@/jlmap3d/lesson3d/manager/animatemanager.js';
|
||||
|
||||
import { Fire } from '@/jlmap3d/lesson3d/utils/fire.js';
|
||||
|
||||
|
||||
// import { AnimationManager } from '@/jlmap3d/lesson3d/manager/assetmodelmanager.js';
|
||||
|
||||
|
||||
let scene;
|
||||
|
||||
export function ZzWw(dom,lessonData,lessonIndex) {
|
||||
|
||||
// let stats = new Stats();
|
||||
// dom.appendChild( stats.dom );
|
||||
|
||||
let scope = this;
|
||||
this.dom = dom;
|
||||
this.nowSceneType = "";
|
||||
|
||||
//定义当前课程角色
|
||||
let nowRole = "";
|
||||
let oldIndex = 0;
|
||||
//考试课程
|
||||
let examList = [];
|
||||
let examData = {};
|
||||
//定义场景(渲染容器)
|
||||
scene = new THREE.Scene();
|
||||
scene.background = new THREE.Color(0xa0a0a0);
|
||||
|
||||
//定义全局光
|
||||
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
|
||||
scene.add(ambientLight);
|
||||
var light = new THREE.HemisphereLight( 0xffffff, 0x444444 );
|
||||
light.position.set( 0, 4000, 0 );
|
||||
scene.add( light );
|
||||
|
||||
// let fire = new Fire();
|
||||
// fire.init(scene);
|
||||
|
||||
let animateManager = new AnimateManager();
|
||||
|
||||
|
||||
let controlManager = new ControlManager( dom,scene,lessonData,lessonIndex);
|
||||
|
||||
let assetModelManager = new AssetModelManager(scope,scene,controlManager);
|
||||
assetModelManager.lessonAssetsLoader(lessonData).then((result) => {
|
||||
scope.nowSceneType = lessonData.lessonProgress[0].progressScene;
|
||||
animateManager.initAnimation(assetModelManager);
|
||||
|
||||
|
||||
controlManager.init(animateManager.actions,assetModelManager,lessonData.trainDeviceData);
|
||||
|
||||
startLesson();
|
||||
animate();
|
||||
resolve("loadeend"); //['成功了', 'success']
|
||||
}).catch((error) => {
|
||||
//console.log(error);
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.actionModelControl = function(actionType,actionModel){
|
||||
// console.log(actionType);
|
||||
// console.log(actionModel);
|
||||
if(actionType == "remove"){
|
||||
assetModelManager.otherModel.remove(actionModel);
|
||||
}else if(actionType == "show"){
|
||||
actionModel.visible = true;
|
||||
assetModelManager.otherModel.add(actionModel);
|
||||
}else if(actionType == "changeIndex"){
|
||||
actionModel.visible = true;
|
||||
assetModelManager.otherModel.add(actionModel);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.actionRemove = function(actionModel){
|
||||
|
||||
}
|
||||
|
||||
this.changeIndex = function(nowIndex){
|
||||
if(nowIndex!=0){
|
||||
oldIndex = lessonIndex;
|
||||
if(lessonData.lessonProgress[oldIndex].roleName == nowRole){
|
||||
updateExam(lessonData.lessonProgress[oldIndex],oldIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
lessonIndex = nowIndex;
|
||||
|
||||
// console.log(nowIndex);
|
||||
scope.nowSceneType = lessonData.lessonProgress[nowIndex].progressScene;
|
||||
// console.log(nowRole);
|
||||
// console.log(lessonData.lessonProgress[lessonIndex].roleName);
|
||||
if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){
|
||||
assetModelManager.changeSceneGroup(scope.nowSceneType);
|
||||
controlManager.initRoleMode(true,nowRole);
|
||||
controlManager.initControlMode(lessonIndex);
|
||||
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,true,assetModelManager.lessonTriggerList[scope.nowSceneType]);
|
||||
|
||||
} else{
|
||||
if(lessonData.lessonProgress[lessonIndex].roleName == 'kong'){
|
||||
assetModelManager.changeSceneGroup(scope.nowSceneType); controlManager.initRoleMode(false,nowRole);
|
||||
}
|
||||
controlManager.initRoleMode(false,nowRole);
|
||||
controlManager.initControlMode(lessonIndex);
|
||||
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,false,assetModelManager.lessonTriggerList[scope.nowSceneType]);
|
||||
}
|
||||
|
||||
|
||||
if(nowIndex == (lessonData.lessonProgress.length-1)){
|
||||
console.log(nowIndex);
|
||||
console.log(lessonData.lessonProgress.length);
|
||||
lessonEnd();
|
||||
}
|
||||
}
|
||||
|
||||
this.changeCameraPos = function(pos){
|
||||
controlManager.updatePos(pos);
|
||||
}
|
||||
|
||||
this.initNowRole = function(role){
|
||||
if(role){
|
||||
nowRole = role;
|
||||
controlManager.initControlMode(lessonIndex);
|
||||
let roleMode = false;
|
||||
if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){
|
||||
roleMode = true;
|
||||
}
|
||||
controlManager.initRoleMode(roleMode);
|
||||
for(let i=0;i<lessonData.lessonProgress.length;i++){
|
||||
|
||||
if(nowRole == lessonData.lessonProgress[i].roleName){
|
||||
examList.push(
|
||||
{
|
||||
index:i,
|
||||
score:10,
|
||||
isTrue:false,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
examData = {
|
||||
allScore:examList.length*10,
|
||||
lastScore:0,
|
||||
allStep:examList.length,
|
||||
trueStep:[],
|
||||
falseStep:[],
|
||||
nowStep:0,
|
||||
time:0,
|
||||
};
|
||||
controlManager.initExam(examList,examData);
|
||||
// updataExamStatus(examData);
|
||||
// if(lessonData.lessonProgress[lessonIndex].action.length>0){
|
||||
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,roleMode,assetModelManager.lessonTriggerList[scope.nowSceneType]);
|
||||
|
||||
}else{
|
||||
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,false,assetModelManager.lessonTriggerList[scope.nowSceneType]);
|
||||
}
|
||||
// }
|
||||
};
|
||||
|
||||
function updateExam(newIndexData,newIndex){
|
||||
for(let i=0;i<examList.length;i++){
|
||||
if(examList[i].index == newIndex){
|
||||
examData.trueStep.push(newIndexData);
|
||||
examData.lastScore += 10;
|
||||
examData.nowStep += 1;
|
||||
updataExamStatus(examData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//循环渲染函数
|
||||
function animate() {
|
||||
|
||||
if(controlManager.controlMode == "free"){
|
||||
controlManager.updateOrbitControl();
|
||||
}
|
||||
if(controlManager.controlMode == "fps"){
|
||||
controlManager.updateFpsControl();
|
||||
}
|
||||
if(controlManager.controlMode == "non"){
|
||||
controlManager.updateOrbitControl();
|
||||
}
|
||||
// fire.update();
|
||||
animateManager.updateAnimation();
|
||||
requestAnimationFrame(animate);
|
||||
|
||||
}
|
||||
|
||||
this.attachModel = function(selectModel){
|
||||
}
|
||||
}
|
@ -127,12 +127,12 @@ class SkinCode extends defaultStyle {
|
||||
rightName: false, // 右侧限速值是否展示
|
||||
nameBackgroundIsRect: true, // 限速值背景是否为矩形
|
||||
nameBackgroundBorderWidth: 0, // 限速值背景是否边框宽度
|
||||
nameBackgroundBorderColor: '#C00808', // 限速值背景边框颜色
|
||||
nameBackgroundBorderColor: '#f00', // 限速值背景边框颜色
|
||||
limitValueDistance: 18,
|
||||
kilometerFontSize: 0, // 公里标大小
|
||||
switchSectionNoShow: true, // 道岔区段不展示限速
|
||||
nameNumberFontSize: 11, // 限速值大小
|
||||
nameNumberColor: '#C00808', // 限速值颜色
|
||||
nameNumberFontSize: 15, // 限速值大小
|
||||
nameNumberColor: '#f00', // 限速值颜色
|
||||
nameBackground: 'rgba(0,0,0,0)', // 限速名称背景颜色
|
||||
drogueWidth: 15, // 浮标宽度
|
||||
drogueHeight: 12 // 浮标高度
|
||||
@ -285,7 +285,7 @@ class SkinCode extends defaultStyle {
|
||||
|
||||
this[deviceType.StationStand] = {
|
||||
// 哈尔滨一号线站台元素 站台 站台紧急关闭 扣车元素 停站时间 运行等级 跳停
|
||||
elemnetType:['gapStand', 'emergentArrow', 'detainNormal', 'level', 'jump', 'trainStop', 'trainDepart', 'stationPlatform'],
|
||||
elemnetType:['gapStand', 'emergentArrow', 'detainNormal', 'level', 'jump', 'trainStop', 'trainDepart'],
|
||||
// 站台
|
||||
gapStand:{
|
||||
// 层级
|
||||
@ -321,6 +321,7 @@ class SkinCode extends defaultStyle {
|
||||
centerTrainColor: '#ff0', // 中心扣车颜色
|
||||
andCenterTrainColor: '#ff0', // 车站+中心扣车颜色
|
||||
detainTrainTextColor: '#ff0', // 车站扣除文字颜色
|
||||
noDetainTrainColor: '#8D918F', // 无扣车文字颜色
|
||||
fontSize: 14, // 字体大小
|
||||
fontWeight: 'bolder',
|
||||
textVerticalAlign: 'middle' // 车站扣车 文字垂直对齐方式
|
||||
@ -588,7 +589,7 @@ class SkinCode extends defaultStyle {
|
||||
jointImg: { // 道岔 A B C D四元素属性配置
|
||||
trapezoidLength: 8, // 直角梯形元素默认长度
|
||||
trapezoidBlock: true, // 梯形封锁显示
|
||||
fork: true, // 挤岔专用(如有挤岔操作 变为true)
|
||||
fork: false, // 挤岔专用(如有挤岔操作 变为true)
|
||||
forKColor: 'red' // 挤岔颜色 配合挤岔专用
|
||||
},
|
||||
arcBlcok: { // 圆形封锁图形
|
||||
@ -780,9 +781,9 @@ class SkinCode extends defaultStyle {
|
||||
fontColor: '#00C300'
|
||||
},
|
||||
trainServer: {
|
||||
serviceNumberPrefix: '000', // 服务号(表号)前缀
|
||||
serviceNumberPrefix: '00', // 服务号(表号)前缀
|
||||
defaultServiceNumber: 'BBB', // 默认服务号(表号)
|
||||
trainServerOffset: { x: 36, y: 3 }, // 列车服务号偏移
|
||||
trainServerOffset: { x: 42, y: 3 }, // 列车服务号偏移
|
||||
fontColor: '#00C300'
|
||||
},
|
||||
trainTarget: {
|
||||
|
@ -32,8 +32,7 @@ deviceState[deviceType.Switch] = {
|
||||
blockade: 0, // 是否封锁
|
||||
routeLock: 0, // 是否进路锁闭
|
||||
overlapLock: 0, // 是否进路延续保护锁闭
|
||||
normalPosition: 1, // 是否定位
|
||||
reversePosition: 0, // 是否反位
|
||||
pos:'N', // // 道岔位置定位、反位 N-定位 R-反位 NO-无(失表) EX-挤叉
|
||||
isCiConfirm: 0, // 是否进行联锁确认
|
||||
/** 定位状态*/
|
||||
// locateType: {
|
||||
@ -72,9 +71,7 @@ deviceState[deviceType.Switch] = {
|
||||
deviceState[deviceType.Signal] = {
|
||||
blockade: 0, // 是否锁闭
|
||||
logicLight: 0, // 逻辑点灯
|
||||
greenOpen: 0, // 绿灯开放
|
||||
yellowOpen: 0, // 黄灯开放
|
||||
redOpen: 1, // 红灯开放(默认状态)
|
||||
aspect:'R', // 信号机颜色默认状态
|
||||
delayTime: 0, // 信号机延迟解锁倒计时
|
||||
atsControl: 1, // 0是人工,1是自动
|
||||
checkConflict:0, // 0是不检查冲突,1是检测冲突(检测冲突进路)
|
||||
|
@ -45,8 +45,7 @@ class Status {
|
||||
blockade: device.blockade, // 是否封锁
|
||||
routeLock: device.routeLock, // 是否进路锁闭
|
||||
overlapLock: device.overlapLock, // 是否进路延续保护锁闭
|
||||
normalPosition: device.normalPosition, // 是否定位
|
||||
reversePosition: device.reversePosition, // 是否反位
|
||||
pos:device.pos, // 道岔位置定位、反位 N-定位 R-反位 NO-无(失表) EX-挤叉
|
||||
fault: device.fault /** 非故障*/
|
||||
};
|
||||
}
|
||||
@ -56,9 +55,7 @@ class Status {
|
||||
atsControl: device.atsControl, /** 0是人工控制,1是自动控制 */
|
||||
blockade: device.blockade,
|
||||
logicLight: device.logicLight,
|
||||
greenOpen: device.greenOpen,
|
||||
redOpen: device.redOpen,
|
||||
yellowOpen: device.yellowOpen,
|
||||
aspect:device.aspect, // 信号机颜色默认状态 R-红 G-绿 Y-黄 W-月白 B-蓝 RY-红黄 RW-红白 GG-绿绿 GY-绿黄 YY-黄黄 RF-红闪 YF-黄闪 GF-绿闪 WF-白闪
|
||||
ciControl: device.ciControl || 0,
|
||||
canSetCi: !!device.canSetCi
|
||||
};
|
||||
|
@ -37,6 +37,9 @@ class Jlmap {
|
||||
// 设备数据
|
||||
this.mapDevice = {};
|
||||
|
||||
// 大屏配置
|
||||
this.splitList = [];
|
||||
|
||||
// 默认状态
|
||||
this.defaultStateDict = this.loadDefaultState();
|
||||
|
||||
@ -143,6 +146,7 @@ class Jlmap {
|
||||
setOptions(opts) {
|
||||
const options = this.pullBack(opts);
|
||||
if (this.screenFlag) {
|
||||
this.$options.update(options);
|
||||
this.$painter.updateScreen(options);
|
||||
} else {
|
||||
this.$options.update(options);
|
||||
@ -213,15 +217,19 @@ class Jlmap {
|
||||
this.screenFlag = false;
|
||||
this.$painter.updateTransform({ scaleRate: opts.scaleRate, offsetX: opts.offsetX, offsetY: opts.offsetY });
|
||||
}
|
||||
setDepot(opts) {
|
||||
this.$options.scaleRate = opts.scaleRate;
|
||||
this.$options.offsetX = opts.offsetX;
|
||||
this.$options.offsetY = opts.offsetY;
|
||||
this.$painter.updateTransform({ scaleRate: opts.scaleRate, offsetX: opts.offsetX, offsetY: opts.offsetY });
|
||||
}
|
||||
setUpdateScreen(opts) {
|
||||
this.setRecover({ scaleRate: 1, offsetX: 0, offsetY: 0 });
|
||||
this.screenFlag = true;
|
||||
const screenList = [];
|
||||
const rectList = [];
|
||||
let rect = '';
|
||||
for (const i in this.mapDevice) {
|
||||
const element = this.mapDevice[i];
|
||||
if (element.instance && (element._type == 'Section' || element._type == 'Station' || element._type == 'StationStand')) {
|
||||
if (element.instance && (element._type == 'Section' || element._type == 'Station' || element._type == 'StationStand') && store.getters['map/checkDeviceShow'](i)) {
|
||||
if (!rect) {
|
||||
rect = element.instance.getBoundingRect().clone();
|
||||
} else {
|
||||
@ -233,31 +241,56 @@ class Jlmap {
|
||||
opts.offsetList = [];
|
||||
}
|
||||
const screenSplit = opts.list.length ? opts.list : Vue.prototype.$theme.loadPropConvert(this.lineCode).screenSplit;
|
||||
const screenDifference = Vue.prototype.$theme.loadPropConvert(this.lineCode).screenDifference || 160;
|
||||
const splitList = JSON.parse(JSON.stringify(screenSplit));
|
||||
this.splitList = JSON.parse(JSON.stringify(screenSplit));
|
||||
const num = screenSplit.length + 1;
|
||||
const offsetY = (opts.height - 100) / num; // 高度差
|
||||
const maxWidth = rect.width;
|
||||
splitList.push(maxWidth);
|
||||
this.splitList.push(maxWidth);
|
||||
const scaleX = Math.floor((((opts.width - 200) * num) / rect.width) * 100) / 100;
|
||||
const scaleY = Math.floor(((opts.height - 100) / (rect.height * num)) * 100) / 100;
|
||||
const scale = Math.min(scaleX, scaleY);
|
||||
this.screenScale = Math.min(scaleX, scaleY);
|
||||
|
||||
for (let i = 0; i < splitList.length; i++) {
|
||||
this.optsWidth = opts.width;
|
||||
this.optsHeight = opts.height;
|
||||
this.optsOffsetList = opts.offsetList;
|
||||
|
||||
const scaleBili = this.screenScale;
|
||||
|
||||
this.$options.scaleRate = this.screenScale || 1;
|
||||
this.$options.scaleIndex = 0;
|
||||
this.$options.offsetX = 0;
|
||||
this.$options.offsetY = 0;
|
||||
// 更新视图大小
|
||||
// this.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY });
|
||||
|
||||
const {screenList, rectList} = this.calculateScreenPosition(scaleBili);
|
||||
this.$painter.updateTransform1(screenList, rectList);
|
||||
}
|
||||
|
||||
calculateScreenPosition(scaleBili) {
|
||||
const screenList = [];
|
||||
const rectList = [];
|
||||
const screenDifference = Vue.prototype.$theme.loadPropConvert(this.lineCode).screenDifference || 160;
|
||||
const bili = scaleBili / this.screenScale;
|
||||
const offsetY = (this.optsHeight - 100) / this.splitList.length; // 高度差
|
||||
|
||||
for (let i = 0; i < this.splitList.length; i++) {
|
||||
let offsetX = '';
|
||||
if (i == 0) {
|
||||
offsetX = -(opts.width - splitList[0] * scale) / 2;
|
||||
offsetX = -(this.optsWidth - this.splitList[0] * scaleBili) / 2;
|
||||
} else {
|
||||
const dx = (opts.width - (splitList[i] - splitList[i - 1]) * scale) / 2; // 居中计算偏移值
|
||||
offsetX = splitList[i - 1] * scale - dx;
|
||||
const dx = (this.optsWidth - (this.splitList[i] - this.splitList[i - 1]) * scaleBili) / 2; // 居中计算偏移值
|
||||
offsetX = this.splitList[i - 1] * scaleBili - dx;
|
||||
}
|
||||
const offset = opts.offsetList[i] || 0;
|
||||
const param = { scaleRateX: scale, scaleRateY: scale, offsetX: offsetX, offsetY: -screenDifference - (offsetY * i) - offset };
|
||||
const offset = this.optsOffsetList[i] || 0;
|
||||
const param = { scaleRateX: scaleBili, scaleRateY: scaleBili, offsetX: offsetX, offsetY: (-screenDifference - (offsetY * i) - offset) * bili };
|
||||
screenList.push(param);
|
||||
const rect = {x: 0, y: 0, width: Number(splitList[i]) + 5, height: opts.height};
|
||||
const rect = {x: 0, y: 0, width: Number(this.splitList[i]) + 5, height: this.optsHeight};
|
||||
rectList.push(rect);
|
||||
}
|
||||
this.$painter.updateTransform1(screenList, rectList);
|
||||
return {
|
||||
screenList,
|
||||
rectList
|
||||
};
|
||||
}
|
||||
|
||||
setLevelVisible(list) {
|
||||
@ -279,14 +312,6 @@ class Jlmap {
|
||||
this.$painter.add(this.mapDevice[code]);
|
||||
}
|
||||
});
|
||||
|
||||
const prdType2ShowMode = { '01': '03', '02': '02'};
|
||||
const showMode = prdType2ShowMode[this.showConfig.prdType];
|
||||
const stationCode = this.stationCode;
|
||||
|
||||
this.updateShowMode(list, showMode);
|
||||
this.updateShowStation(list, stationCode);
|
||||
|
||||
if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); }
|
||||
}
|
||||
|
||||
@ -330,57 +355,22 @@ class Jlmap {
|
||||
getShowConfig() {
|
||||
return this.showConfig;
|
||||
}
|
||||
// showStationHandlePsd(oDevice, stationCode) {
|
||||
// if (store.getters['map/checkDeviceShow'](stationCode, oDevice.standCode) || !stationCode) {
|
||||
// this.$painter.updateSpecialShowStation(oDevice, true);
|
||||
// } else {
|
||||
// this.$painter.updateSpecialShowStation(oDevice, false);
|
||||
// }
|
||||
// }
|
||||
// showStationHandleSection(oDevice, stationCode) {
|
||||
// const trainWinDevice = this.mapDevice[oDevice.trainWindowCode];
|
||||
// if (oDevice.stationCode === stationCode || !stationCode) {
|
||||
// this.$painter.updateSpecialShowStation(trainWinDevice, true);
|
||||
// } else {
|
||||
// this.$painter.updateSpecialShowStation(trainWinDevice, false);
|
||||
// }
|
||||
// }
|
||||
// showStationHandleStation (oDevice, stationCode) {
|
||||
// if ((oDevice.centralized && oDevice.code === stationCode) || !stationCode) {
|
||||
// this.$painter.updateSpecialShowStation(oDevice, true);
|
||||
// oDevice.chargeStationCodeList.forEach(staCode => {
|
||||
// const staDevice = this.mapDevice[staCode];
|
||||
// this.$painter.updateSpecialShowStation(staDevice, true);
|
||||
// });
|
||||
// } else if (oDevice.centralized && oDevice.code !== stationCode) {
|
||||
// this.$painter.updateSpecialShowStation(oDevice, false);
|
||||
// oDevice.chargeStationCodeList.forEach(staCode => {
|
||||
// const staDevice = this.mapDevice[staCode];
|
||||
// this.$painter.updateSpecialShowStation(staDevice, false);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
amendDevice(list) {
|
||||
list.forEach(elem => {
|
||||
if (store.getters['map/amendPoints'](elem.code)) {
|
||||
const oDevice = this.mapDevice[elem.code];
|
||||
this.$painter.delete(oDevice);
|
||||
this.$painter.add(oDevice);
|
||||
}
|
||||
});
|
||||
}
|
||||
updateShowStation(list = [], stationCode = '') {
|
||||
this.stationCode = stationCode;
|
||||
|
||||
store.dispatch('map/setShowCentralizedStationCode', stationCode);
|
||||
list.forEach(elem => {
|
||||
const code = elem.code;
|
||||
const type = elem._type;
|
||||
const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig);
|
||||
// if (oDevice._type === deviceType.Station) {
|
||||
// this.showStationHandleStation(oDevice, stationCode);
|
||||
// } else if (oDevice._type === deviceType.Section) {
|
||||
// this.$painter.updateShowStation(oDevice, stationCode);
|
||||
// this.showStationHandleSection(oDevice, stationCode);
|
||||
// } else if (oDevice._type === deviceType.TrainWindow) {
|
||||
// // 不处理车次窗 勿删
|
||||
// } else if (oDevice._type === deviceType.Psd) {
|
||||
// this.showStationHandlePsd(oDevice, stationCode);
|
||||
// } else {
|
||||
// this.$painter.updateShowStation(oDevice, stationCode);
|
||||
// }
|
||||
this.$painter.updateShowStation(oDevice, stationCode);
|
||||
this.$painter.update(oDevice);
|
||||
});
|
||||
this.$painter.$transformHandle.revisibleAll();
|
||||
if (stationCode) {
|
||||
@ -397,22 +387,10 @@ class Jlmap {
|
||||
const type = elem._type;
|
||||
const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig);
|
||||
oDevice.showMode = showMode;
|
||||
this.$painter.updateShowMode(oDevice);
|
||||
oDevice.instance && oDevice.model && oDevice.instance.setState(oDevice.model);
|
||||
});
|
||||
this.$painter.$transformHandle.revisibleAll();
|
||||
}
|
||||
// updatePrdType(list = [], showMode = '03', val = '') {
|
||||
// this.showConfig.prdType = val;
|
||||
// this.showConfig.showMode = showMode;
|
||||
// list.forEach(item => {
|
||||
// const code = item.code;
|
||||
// const type = item._type;
|
||||
// const oDevice = this.mapDevice[code] || deviceFactory(type, item, this.showConfig);
|
||||
// this.hookHandle(oDevice, this.showConfig);
|
||||
// this.$painter.update(oDevice);
|
||||
// this.$painter.updateShowMode(oDevice);
|
||||
// });
|
||||
// }
|
||||
update(list = [], fetch = true) {
|
||||
this.setUpdateMapDevice(list, fetch); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息
|
||||
|
||||
@ -644,7 +622,14 @@ class Jlmap {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
initClearTrainData() {
|
||||
this.$painter.clearLevel(deviceType.Train);
|
||||
zrUtil.each(Object.values(this.mapDevice), device => {
|
||||
if (device._type == deviceType.Train) {
|
||||
delete this.mapDevice[device.code];
|
||||
}
|
||||
});
|
||||
}
|
||||
clearEvent() {
|
||||
this.$zr.curEvent = null;
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ class Painter {
|
||||
const instance = device.instance;
|
||||
if (instance) {
|
||||
this.mapInstanceLevel[device._type].remove(instance);
|
||||
device.instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,20 +186,12 @@ class Painter {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 更新显示模式
|
||||
*/
|
||||
updateShowMode(device) {
|
||||
if (device && device.instance) {
|
||||
device.instance.setShowMode();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 更新现地显示单独集中站
|
||||
* */
|
||||
updateShowStation(device, stationCode) {
|
||||
if (device && device.instance) {
|
||||
device.instance.setShowStation(stationCode);
|
||||
updateShowStation(device) {
|
||||
if (device && device.instance && device.model) {
|
||||
device.instance.setState(device.model);
|
||||
}
|
||||
}
|
||||
// updateSpecialShowStation(device, flag) {
|
||||
@ -225,6 +218,11 @@ class Painter {
|
||||
this.screenFlag = true;
|
||||
this.$transformHandleScreen.updateTransform(list, opts);
|
||||
}
|
||||
|
||||
updateScreenZoom(bili) {
|
||||
return this.$jmap.calculateScreenPosition(bili);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新zrender尺寸
|
||||
* @param {*} opt
|
||||
|
@ -273,7 +273,13 @@ export function parser(data, skinCode, showConfig) {
|
||||
|
||||
return mapDevice;
|
||||
}
|
||||
|
||||
// 初始化列车数据(仿真初始化时候,状态消息未初始化列车消息,前端暂时处理(临时解决方案))
|
||||
export function parserTrainData(mapDevice, trainList, skinCode, showConfig) {
|
||||
var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
|
||||
zrUtil.each(trainList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
}
|
||||
// 重置坐标点
|
||||
function handleResetPoint(points) {
|
||||
return (points[points.length - 1].x >= points[0].x);
|
||||
|
@ -11,10 +11,8 @@ export default class Arrow extends Group {
|
||||
this.z = 0;
|
||||
this.model = model;
|
||||
// this.style = style;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -41,27 +39,14 @@ export default class Arrow extends Group {
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
}
|
||||
// 设置显示模式
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = this.model.showConditions;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.arrow.show();
|
||||
} else {
|
||||
this.arrow.hide();
|
||||
// if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.arrow && this.arrow.show();
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
recover() {
|
||||
this.arrow && this.arrow.hide();
|
||||
}
|
||||
getAnchorPoint() {
|
||||
const rect = this.arrow.getBoundingRect();
|
||||
|
@ -18,11 +18,10 @@ export default class AutoTurnBack extends Group {
|
||||
this.zlevel = model.zlevel;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.isShowShape = true;
|
||||
this.isBigScreen = false;
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -101,7 +100,12 @@ export default class AutoTurnBack extends Group {
|
||||
}
|
||||
|
||||
recover() {
|
||||
this.control && this.control.show();
|
||||
this.text && this.text.show();
|
||||
this.subtitleText && this.subtitleText.show();
|
||||
this.arcBorder && this.arcBorder.show();
|
||||
this.control && this.control.setStyle({ fill: this.style.AutoTurnBack.lamp.controlColor });
|
||||
if (this.isBigScreen) { this.screenShow(); }
|
||||
}
|
||||
handleSignal() {
|
||||
this.control.setStyle({ fill: this.style.AutoTurnBack.lamp.lightUpColor });
|
||||
@ -109,8 +113,15 @@ export default class AutoTurnBack extends Group {
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.control && this.control.hide();
|
||||
this.text && this.text.hide();
|
||||
this.subtitleText && this.subtitleText.hide();
|
||||
this.arcBorder && this.arcBorder.hide();
|
||||
} else {
|
||||
model.setUp && this.handleSignal();
|
||||
}
|
||||
}
|
||||
|
||||
createMouseEvent() {
|
||||
if (this.style.LcControl.mouseOverStyle) {
|
||||
@ -159,42 +170,6 @@ export default class AutoTurnBack extends Group {
|
||||
}
|
||||
}
|
||||
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
if (showMode == '04') {
|
||||
this.hideMode();
|
||||
return;
|
||||
}
|
||||
const showConditions = this.style.AutoTurnBack.visibleConditions;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.showMode();
|
||||
} else {
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.isShowShape = true;
|
||||
this.showMode();
|
||||
} else {
|
||||
this.isShowShape = false;
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
showMode() {
|
||||
this.control && this.control.show();
|
||||
this.text && this.text.show();
|
||||
this.subtitleText && this.subtitleText.show();
|
||||
this.arcBorder && this.arcBorder.show();
|
||||
this.setState(this.model);
|
||||
}
|
||||
hideMode() {
|
||||
this.control && this.control.hide();
|
||||
this.text && this.text.hide();
|
||||
this.subtitleText && this.subtitleText.hide();
|
||||
this.arcBorder && this.arcBorder.hide();
|
||||
}
|
||||
|
||||
setControlColor(color) {
|
||||
if (color) {
|
||||
this.control.setStyle('fill', color);
|
||||
@ -206,6 +181,7 @@ export default class AutoTurnBack extends Group {
|
||||
}
|
||||
}
|
||||
screenShow() {
|
||||
this.isBigScreen = true;
|
||||
this.hideMode();
|
||||
}
|
||||
getAnchorPoint() {
|
||||
|
@ -21,7 +21,6 @@ export default class AutomacticRoute extends Group {
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -85,7 +84,13 @@ export default class AutomacticRoute extends Group {
|
||||
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
// if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.control && this.control.hide();
|
||||
this.text && this.text.hide();
|
||||
this.subtitleText && this.subtitleText.hide();
|
||||
} else {
|
||||
if (this.model.fleetMode) {
|
||||
this.control && this.control.setStyle('fill', this.style.AutomaticRoute.lamp.lightColor);
|
||||
} else {
|
||||
@ -93,6 +98,8 @@ export default class AutomacticRoute extends Group {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
createMouseEvent() {
|
||||
if (this.style.LcControl.mouseOverStyle) {
|
||||
this.mouseEvent = new EMouse(this);
|
||||
@ -127,35 +134,10 @@ export default class AutomacticRoute extends Group {
|
||||
return new BoundingRect(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = (this.style.AutomaticRoute || {}).displayCondition;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.showMode();
|
||||
} else {
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.isShowShape = true;
|
||||
this.showMode();
|
||||
} else {
|
||||
this.isShowShape = false;
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
showMode() {
|
||||
recover() {
|
||||
this.control && this.control.show();
|
||||
this.text && this.text.show();
|
||||
this.subtitleText && this.subtitleText.show();
|
||||
this.setState(this.model);
|
||||
}
|
||||
hideMode() {
|
||||
this.control && this.control.hide();
|
||||
this.text && this.text.hide();
|
||||
this.subtitleText && this.subtitleText.hide();
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.model.position;
|
||||
|
@ -21,7 +21,6 @@ export default class AxleReset extends Group {
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -90,14 +89,23 @@ export default class AxleReset extends Group {
|
||||
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
this.recover();
|
||||
// 只响应前端自定义类型的状态变化
|
||||
if (model._free) {
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.control && this.control.hide();
|
||||
this.text && this.text.hide();
|
||||
this.subtitleText && this.subtitleText.hide();
|
||||
} else if (model._free) {
|
||||
this.setAshShow();
|
||||
} else {
|
||||
if (!this.isShowShape) return;
|
||||
}
|
||||
}
|
||||
|
||||
recover() {
|
||||
this.control && this.control.show();
|
||||
this.text && this.text.show();
|
||||
this.subtitleText && this.subtitleText.show();
|
||||
}
|
||||
|
||||
createMouseEvent() {
|
||||
if (this.style.LcControl.mouseOverStyle) {
|
||||
this.mouseEvent = new EMouse(this);
|
||||
@ -132,35 +140,6 @@ export default class AxleReset extends Group {
|
||||
return new BoundingRect(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = (this.style.AxleReset || {}).displayCondition;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.showMode();
|
||||
} else {
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.isShowShape = true;
|
||||
this.showMode();
|
||||
} else {
|
||||
this.isShowShape = false;
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
showMode() {
|
||||
this.control && this.control.show();
|
||||
this.text && this.text.show();
|
||||
this.subtitleText && this.subtitleText.show();
|
||||
this.setState(this.model);
|
||||
}
|
||||
hideMode() {
|
||||
this.control && this.control.hide();
|
||||
this.text && this.text.hide();
|
||||
this.subtitleText && this.subtitleText.hide();
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.model.position;
|
||||
}
|
||||
|
@ -12,11 +12,10 @@ export default class DirectionRod extends Group {
|
||||
this.zlevel = model.zlevel;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.isShowShape = true;
|
||||
// this.isShowShape = true;
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
create() {
|
||||
const model = this.model;
|
||||
@ -59,18 +58,19 @@ export default class DirectionRod extends Group {
|
||||
});
|
||||
this.add(this.rod);
|
||||
this.add(this.tipText);
|
||||
// setTimeout(()=> {
|
||||
// console.log('*************');
|
||||
// this.rod.attr('rotation', Math.PI);
|
||||
// console.log(this.rod, '----');
|
||||
// }, 10000);
|
||||
}
|
||||
recover() {
|
||||
this.rod && this.rod.show();
|
||||
this.tipText && this.tipText.show();
|
||||
}
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
// if (!this.isShowShape) return;
|
||||
// this.recover();
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.rod && this.rod.hide();
|
||||
this.tipText && this.tipText.hide();
|
||||
} else {
|
||||
if (model.reversed && this.model.right) {
|
||||
this.rod.attr('rotation', 0);
|
||||
} else if (!model.reversed && this.model.right) {
|
||||
@ -82,38 +82,13 @@ export default class DirectionRod extends Group {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
createMouseEvent() {
|
||||
}
|
||||
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = (this.style.DirectionRod || {}).displayCondition;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.showMode();
|
||||
} else {
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
drawSelected() {
|
||||
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.isShowShape = true;
|
||||
this.showMode();
|
||||
} else {
|
||||
this.isShowShape = false;
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
showMode() {
|
||||
this.rod && this.rod.show();
|
||||
this.tipText && this.tipText.show();
|
||||
this.setState(this.model);
|
||||
}
|
||||
hideMode() {
|
||||
this.rod && this.rod.hide();
|
||||
this.tipText && this.tipText.hide();
|
||||
}
|
||||
getAnchorPoint() {
|
||||
const rect = this.rod.getBoundingRect();
|
||||
|
@ -19,7 +19,6 @@ export default class FloodGate extends Group {
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -41,42 +40,20 @@ export default class FloodGate extends Group {
|
||||
this.add(this.floodGate);
|
||||
}
|
||||
recover() {
|
||||
this.floodGate && this.floodGate.show();
|
||||
this.floodGate.setStyle({ stroke: this.style.FloodGate.spareStrokeColor, fill: this.style.FloodGate.spareFillColor });
|
||||
}
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
// if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.floodGate && this.floodGate.hide();
|
||||
}
|
||||
}
|
||||
|
||||
createMouseEvent() {
|
||||
}
|
||||
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = (this.style.FloodGate || {}).displayCondition;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.showMode();
|
||||
} else {
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.isShowShape = true;
|
||||
this.showMode();
|
||||
} else {
|
||||
this.isShowShape = false;
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
showMode() {
|
||||
this.floodGate && this.floodGate.show();
|
||||
this.setState(this.model);
|
||||
}
|
||||
hideMode() {
|
||||
this.floodGate && this.floodGate.hide();
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.model.position;
|
||||
}
|
||||
|
@ -17,11 +17,9 @@ export default class GuideLock extends Group {
|
||||
this.zlevel = model.zlevel;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -83,6 +81,9 @@ export default class GuideLock extends Group {
|
||||
this.add(this.text);
|
||||
}
|
||||
recover() {
|
||||
this.control && this.control.show();
|
||||
this.text && this.text.show();
|
||||
this.subtitleText && this.subtitleText.show();
|
||||
this.control && this.control.setStyle({ fill: this.style.GuideLock.lamp.controlColor });
|
||||
}
|
||||
handleSignal() {
|
||||
@ -96,15 +97,21 @@ export default class GuideLock extends Group {
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
// 只响应前端自定义类型的状态变化
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.control && this.control.hide();
|
||||
this.text && this.text.hide();
|
||||
this.subtitleText && this.subtitleText.hide();
|
||||
} else {
|
||||
if (model._free) {
|
||||
this.setAshShow();
|
||||
} else {
|
||||
if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
model.totalGuideLock && this.handleSignal();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
createMouseEvent() {
|
||||
if (this.style.LcControl.mouseOverStyle) {
|
||||
this.mouseEvent = new EMouse(this);
|
||||
@ -138,36 +145,6 @@ export default class GuideLock extends Group {
|
||||
return new BoundingRect(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = (this.style.GuideLock || {}).displayCondition;
|
||||
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.showMode();
|
||||
} else {
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.isShowShape = true;
|
||||
this.showMode();
|
||||
} else {
|
||||
this.isShowShape = false;
|
||||
this.hideMode();
|
||||
}
|
||||
}
|
||||
showMode() {
|
||||
this.control && this.control.show();
|
||||
this.text && this.text.show();
|
||||
this.subtitleText && this.subtitleText.show();
|
||||
this.setState(this.model);
|
||||
}
|
||||
hideMode() {
|
||||
this.control && this.control.hide();
|
||||
this.text && this.text.hide();
|
||||
this.subtitleText && this.subtitleText.hide();
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.model.position;
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ export default class LcControl extends Group {
|
||||
this.zlevel = model.zlevel;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
@ -61,12 +60,16 @@ export default class LcControl extends Group {
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
// 只响应前端自定义类型的状态变化
|
||||
if (model._free) {
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.control && this.control.hide();
|
||||
} else if (model._free) {
|
||||
this.setAshShow();
|
||||
} else {
|
||||
if (!this.isShowShape) return;
|
||||
}
|
||||
}
|
||||
recover() {
|
||||
this.control && this.control.show();
|
||||
}
|
||||
|
||||
createMouseEvent() {
|
||||
if (this.style.LcControl.mouseOverStyle) {
|
||||
@ -87,17 +90,6 @@ export default class LcControl extends Group {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
setShowMode() {}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.control.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.control.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.model.position;
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ export default class LimitControl extends Group {
|
||||
this.zlevel = model.zlevel;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.isShowShape = true;
|
||||
this.z = 20;
|
||||
this.create(model);
|
||||
this.createMouseEvent();
|
||||
@ -65,13 +64,16 @@ export default class LimitControl extends Group {
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
// 只响应前端自定义类型的状态变化
|
||||
if (model._free) {
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.control && this.control.hide();
|
||||
} else if (model._free) {
|
||||
this.setAshShow();
|
||||
} else {
|
||||
if (!this.isShowShape) return;
|
||||
}
|
||||
}
|
||||
|
||||
recover() {
|
||||
this.control && this.control.show();
|
||||
}
|
||||
createMouseEvent() {
|
||||
if (this.style.LimitControl.mouseOverStyle) {
|
||||
this.mouseEvent = new EMouse(this);
|
||||
@ -92,17 +94,6 @@ export default class LimitControl extends Group {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
setShowMode() {}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.control.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.control.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.model.position;
|
||||
}
|
||||
|
@ -11,10 +11,8 @@ export default class Line2 extends Group {
|
||||
this.z = 0;
|
||||
this.model = model;
|
||||
this.style = style.Line;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -90,32 +88,17 @@ export default class Line2 extends Group {
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.segment && this.segment.hide();
|
||||
this.viceSegment && this.viceSegment.hide();
|
||||
} else {
|
||||
this.setLineType(model.type);
|
||||
}
|
||||
// 设置显示模式
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = this.model.showConditions;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
}
|
||||
recover() {
|
||||
this.segment && this.segment.show();
|
||||
this.viceSegment && this.viceSegment.show();
|
||||
} else {
|
||||
this.segment && this.segment.hide();
|
||||
this.viceSegment && this.viceSegment.hide();
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.segment && this.segment.show();
|
||||
this.viceSegment && this.viceSegment.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.segment && this.segment.hide();
|
||||
this.viceSegment && this.viceSegment.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
getAnchorPoint() {
|
||||
if (this.segment) {
|
||||
|
@ -10,11 +10,10 @@ export default class OutFrame extends Group {
|
||||
this._code = model.code;
|
||||
this.style = style;
|
||||
this.zlevel = model.zlevel;
|
||||
this.isShowShape = true;
|
||||
this.isBigScreen = false;
|
||||
this.z = 0;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -40,34 +39,18 @@ export default class OutFrame extends Group {
|
||||
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
}
|
||||
// 设置显示模式
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = this.model.showConditions;
|
||||
if (showMode == '04') {
|
||||
// if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.box && this.box.hide();
|
||||
return;
|
||||
}
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
}
|
||||
recover() {
|
||||
this.box && this.box.show();
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.box && this.box.hide();
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.box && this.box.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.box && this.box.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
if (this.isBigScreen) { this.screenShow(); }
|
||||
}
|
||||
screenShow() {
|
||||
this.isBigScreen = true;
|
||||
this.box && this.box.hide();
|
||||
}
|
||||
getAnchorPoint() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import ETextName from '../element/ETextName'; // 名称文字 (共有)
|
||||
import BoundingRect from 'zrender/src/core/BoundingRect';
|
||||
import store from '@/store/index';
|
||||
|
||||
export default class OverAp extends Group {
|
||||
constructor(model, {style}) {
|
||||
@ -11,7 +12,6 @@ export default class OverAp extends Group {
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.z = 6;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
}
|
||||
@ -42,11 +42,15 @@ export default class OverAp extends Group {
|
||||
this.add(this.text);
|
||||
}
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
recover() {
|
||||
this.text && this.text.hide();
|
||||
}
|
||||
setState(model) {
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.text && this.text.hide();
|
||||
} else {
|
||||
if (model.remainTime && this.style.OverAp.show) { // 目前哈尔滨线路显示
|
||||
// console.log(model, model.remainTime, model.sectionName, '=====');
|
||||
this.text && this.text.show();
|
||||
let offset = 40;
|
||||
if (!model.offsetRight) {
|
||||
@ -61,19 +65,13 @@ export default class OverAp extends Group {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
getBoundingRect() {
|
||||
if (this.text) {
|
||||
return this.text.getBoundingRect().clone();
|
||||
} else {
|
||||
return new BoundingRect(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
// 设置显示模式
|
||||
setShowMode() {
|
||||
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
|
||||
}
|
||||
screenShow() {
|
||||
|
||||
|
@ -13,11 +13,10 @@ export default class Line2 extends Group {
|
||||
this.z = 0;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.isShowShape = true;
|
||||
this.isBigScreen = false;
|
||||
this.create();
|
||||
this.createTerminal();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -111,45 +110,27 @@ export default class Line2 extends Group {
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
// if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.line && this.line.hide();
|
||||
this.leftTerminal && this.leftTerminal.hide();
|
||||
this.rightTerminal && this.rightTerminal.hide();
|
||||
} else {
|
||||
this.setLineType(model.type);
|
||||
model.on && this.setCharged();
|
||||
}
|
||||
}
|
||||
|
||||
recover() {
|
||||
this.line.setStyle('stroke', this.style.Power.noElectricStrokeColor);
|
||||
}
|
||||
|
||||
// 设置显示模式
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = this.model.showConditions;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.eachChild((child) => {
|
||||
child.show();
|
||||
});
|
||||
} else {
|
||||
this.eachChild((child) => {
|
||||
child.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.eachChild((child) => {
|
||||
child.show();
|
||||
});
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.eachChild((child) => {
|
||||
child.hide();
|
||||
});
|
||||
this.isShowShape = false;
|
||||
}
|
||||
this.line && this.line.show();
|
||||
this.line && this.line.setStyle('stroke', this.style.Power.noElectricStrokeColor);
|
||||
this.leftTerminal && this.leftTerminal.show();
|
||||
this.rightTerminal && this.rightTerminal.show();
|
||||
if (this.isBigScreen) { this.screenShow(); }
|
||||
}
|
||||
screenShow() {
|
||||
this.isBigScreen = true;
|
||||
this.eachChild((child) => {
|
||||
child.hide();
|
||||
});
|
||||
|
@ -51,7 +51,8 @@ class EHorizontal2Door extends Group {
|
||||
}
|
||||
|
||||
recover() {
|
||||
|
||||
this.stand1 && this.stand1.show();
|
||||
this.stand2 && this.stand2.show();
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
|
@ -34,6 +34,7 @@ class ERect2Door extends Group {
|
||||
recover() {
|
||||
const style = this.model.style;
|
||||
this.psd.setStyle('fill', style.Psd.rectDoor.defaultColor);
|
||||
this.psd && this.psd.show();
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
|
@ -59,6 +59,8 @@ class ESafeDoor extends Group {
|
||||
recover() {
|
||||
const style = this.model.style;
|
||||
this.setColor(style.Psd.safetyDoorNormal.defaultColor);
|
||||
this.safeL && this.safeL.show();
|
||||
this.safeC && this.safeC.hide();
|
||||
}
|
||||
|
||||
setColor(color) {
|
||||
|
@ -62,6 +62,8 @@ class EVertical2Door extends Group {
|
||||
recover() {
|
||||
// const style = this.model.style;
|
||||
// this.setColor(style.Psd.vertical2Door.defaultColor);
|
||||
this.safeB && this.safeB.show();
|
||||
this.safeT && this.safeT.show();
|
||||
}
|
||||
|
||||
setColor(color) {
|
||||
|
@ -16,10 +16,8 @@ export default class Line2 extends Group {
|
||||
this.z = 1;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
this.setShowMode(true);
|
||||
this.checkIsDrawMap();
|
||||
}
|
||||
|
||||
@ -42,6 +40,7 @@ export default class Line2 extends Group {
|
||||
recover() {
|
||||
const currentTypeList = this.style.Psd.elemnetType;
|
||||
currentTypeList.forEach(element => {
|
||||
this[element].show();
|
||||
this[element].recover();
|
||||
});
|
||||
}
|
||||
@ -52,9 +51,17 @@ export default class Line2 extends Group {
|
||||
|
||||
setState(model) {
|
||||
this.recover();
|
||||
if (!this.isShowShape) return;
|
||||
|
||||
if (model._free) {
|
||||
if (this.model.showMode === '05') {
|
||||
const currentTypeList = this.style.Psd.elemnetType;
|
||||
currentTypeList.forEach(element => {
|
||||
this[element].hide();
|
||||
});
|
||||
} if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
const currentTypeList = this.style.Psd.elemnetType;
|
||||
currentTypeList.forEach(element => {
|
||||
this[element].hide();
|
||||
});
|
||||
} else if (model._free) {
|
||||
this.setAshShow();
|
||||
} else {
|
||||
const currentTypeList = this.style.Psd.elemnetType;
|
||||
@ -77,34 +84,6 @@ export default class Line2 extends Group {
|
||||
this.on('mouseover', () => { this.highlight.mouseover(); });
|
||||
}
|
||||
}
|
||||
setShowMode(flag) {
|
||||
const showMode = this.model.showMode;
|
||||
if (!flag) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.setState(this.model);
|
||||
}
|
||||
if (showMode == '05') {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.model.position;
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ export default class Resource extends Group {
|
||||
this.zlevel = model.zlevel;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.isShowShape = true;
|
||||
this.z = model.zIndex || 1;
|
||||
this.create();
|
||||
}
|
||||
@ -44,7 +43,13 @@ export default class Resource extends Group {
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.image && this.image.hide();
|
||||
}
|
||||
}
|
||||
recover() {
|
||||
this.image && this.image.show();
|
||||
}
|
||||
|
||||
// 整体图片
|
||||
@ -69,17 +74,6 @@ export default class Resource extends Group {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
setShowMode() {}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.image && this.image.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.image && this.image.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.model.position;
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ export default class Responder extends Group {
|
||||
this.zlevel = model.zlevel;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.isShowShape = true;
|
||||
this.anchorPoint = {x: 0, y: 0};
|
||||
this.z = model.z || 19;
|
||||
if (model.previewOrMapDraw) {
|
||||
@ -141,7 +140,11 @@ export default class Responder extends Group {
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.block && this.block.hide();
|
||||
this.text && this.text.hide();
|
||||
} else {
|
||||
const responderStyle = this.style.Responder || defaultStyle;
|
||||
const style = responderStyle.block.mapStyle[model.type] || {fill: '#000'};
|
||||
this.block && this.block.setStyle(style);
|
||||
@ -151,9 +154,12 @@ export default class Responder extends Group {
|
||||
if (this.delta2) {
|
||||
model.type == 'IB' ? this.delta2.show() : this.delta2.hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
recover() {
|
||||
this.block && this.block.show();
|
||||
this.text && this.text.show();
|
||||
}
|
||||
// 整体图片
|
||||
transformRotation(item, origin, rotation) {
|
||||
item.origin = origin;
|
||||
@ -187,17 +193,6 @@ export default class Responder extends Group {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
setShowMode() {}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.block && this.block.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.block && this.block.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.anchorPoint;
|
||||
}
|
||||
|
@ -23,11 +23,9 @@ export default class SaidLamp extends Group {
|
||||
this.style = style;
|
||||
this.deviceStyle = style[model._type];
|
||||
if (this.deviceStyle) {
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,7 +181,10 @@ export default class SaidLamp extends Group {
|
||||
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.control && this.control.hide();
|
||||
} else {
|
||||
if (model._type === deviceType.PowerSupply && model.name.includes('2')) {
|
||||
this.control && this.control.setControlColor(this.deviceStyle.lamp.offColor);
|
||||
this.control && this.control.setControlStroke(this.deviceStyle.lamp.strokeColor, 1);
|
||||
@ -191,7 +192,10 @@ export default class SaidLamp extends Group {
|
||||
this.control && this.control.setControlColor(this.deviceStyle.lamp.offColor);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
recover() {
|
||||
this.control && this.control.show();
|
||||
}
|
||||
createMouseEvent() {
|
||||
if (this.deviceStyle.mouseOverStyle) {
|
||||
this.mouseEvent = new EMouse(this);
|
||||
@ -211,27 +215,6 @@ export default class SaidLamp extends Group {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
if (this.deviceStyle) {
|
||||
const showConditions = (this.deviceStyle || {}).displayCondition;
|
||||
if (showConditions === '01' || showMode === showConditions) {
|
||||
this.control && this.control.show();
|
||||
} else {
|
||||
this.control && this.control.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.control && this.control.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.control && this.control.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
setControlColor(color, flag = false) {
|
||||
this.control && this.control.getControl && this.control.getControl().stopAnimation(false);
|
||||
this.control && this.control.setControlColor && this.control.setControlColor(color);
|
||||
|
@ -93,12 +93,12 @@ export default class EBadShunt extends Group {
|
||||
|
||||
if (swch && swch.instance) {
|
||||
const traingle = new JTriangle(swch.intersection, swch.skew);
|
||||
if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y) && !swch.normalPosition && swch.sectionCCode == model.code) {
|
||||
if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y) && swch.pos != 'N' && swch.sectionCCode == model.code) {
|
||||
beg.x = beg.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate();
|
||||
beg.y = beg.y + traingle.dricty * (swPadding + switchWidth);
|
||||
}
|
||||
|
||||
if ((swch.intersection.x === end.x) && (swch.intersection.y === end.y) && swch.normalPosition && swch.sectionCCode == model.code) {
|
||||
if ((swch.intersection.x === end.x) && (swch.intersection.y === end.y) && swch.pos == 'N' && swch.sectionCCode == model.code) {
|
||||
end.x = end.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate();
|
||||
end.y = end.y + traingle.dricty * (swPadding + switchWidth);
|
||||
}
|
||||
|
@ -93,12 +93,12 @@ export default class ELimitLines extends Group {
|
||||
|
||||
if (swch && swch.instance) {
|
||||
const traingle = new JTriangle(swch.intersection, swch.skew);
|
||||
if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y) && !swch.normalPosition && swch.sectionCCode == model.code) {
|
||||
if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y) && swch.pos != 'N' && swch.sectionCCode == model.code) {
|
||||
beg.x = beg.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate();
|
||||
beg.y = beg.y + traingle.dricty * (swPadding + switchWidth);
|
||||
}
|
||||
|
||||
if ((swch.intersection.x === end.x) && (swch.intersection.y === end.y) && swch.normalPosition && swch.sectionCCode == model.code) {
|
||||
if ((swch.intersection.x === end.x) && (swch.intersection.y === end.y) && swch.pos == 'N' && swch.sectionCCode == model.code) {
|
||||
end.x = end.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate();
|
||||
end.y = end.y + traingle.dricty * (swPadding + switchWidth);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ export default class ELimitName extends Group {
|
||||
style: {
|
||||
x: x1 + 2,
|
||||
y: y1,
|
||||
fontWeight: 'normal',
|
||||
fontWeight: 'bolder',
|
||||
fontSize: style.Section.speedLimitName.nameNumberFontSize,
|
||||
fontFamily: style.fontFamily,
|
||||
text: '',
|
||||
@ -107,7 +107,7 @@ export default class ELimitName extends Group {
|
||||
style: {
|
||||
x: x2 - 2,
|
||||
y: y2,
|
||||
fontWeight: 'normal',
|
||||
fontWeight: 'bolder',
|
||||
fontSize: style.Section.speedLimitName.nameNumberFontSize,
|
||||
fontFamily: style.fontFamily,
|
||||
text: '',
|
||||
|
@ -581,7 +581,7 @@ export default class ELines extends Group {
|
||||
}
|
||||
|
||||
recover() {
|
||||
|
||||
this.section && this.section.show();
|
||||
}
|
||||
|
||||
setState() {
|
||||
|
@ -6,6 +6,7 @@ class ETextName extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.isShow = false;
|
||||
this.create();
|
||||
}
|
||||
|
||||
@ -16,7 +17,6 @@ class ETextName extends Group {
|
||||
let styleY = '';
|
||||
let styleName = '';
|
||||
let isCreate = false;
|
||||
let isShow = false;
|
||||
|
||||
// 计算区段坐标位置
|
||||
const x = Math.min(model.points[0].x, model.points[model.points.length - 1].x) + Math.abs(model.points[model.points.length - 1].x - model.points[0].x) / 2;
|
||||
@ -37,7 +37,7 @@ class ETextName extends Group {
|
||||
}
|
||||
styleName = model.name;
|
||||
if (model.nameShow) {
|
||||
isShow = true;
|
||||
this.isShow = true;
|
||||
}
|
||||
}
|
||||
// 逻辑区段
|
||||
@ -49,7 +49,7 @@ class ETextName extends Group {
|
||||
styleName = model.name;
|
||||
isCreate = true;
|
||||
if (model.nameShow) {
|
||||
isShow = true;
|
||||
this.isShow = true;
|
||||
}
|
||||
}
|
||||
// 站台轨名称
|
||||
@ -63,7 +63,7 @@ class ETextName extends Group {
|
||||
styleName = model.standTrackName;
|
||||
}
|
||||
if (model.standTrackNameShow) {
|
||||
isShow = true;
|
||||
this.isShow = true;
|
||||
}
|
||||
}
|
||||
// 折返轨名称
|
||||
@ -77,7 +77,7 @@ class ETextName extends Group {
|
||||
styleName = model.reentryTrackName;
|
||||
}
|
||||
if (model.reentryTrackNameShow) {
|
||||
isShow = true;
|
||||
this.isShow = true;
|
||||
}
|
||||
}
|
||||
// 转换轨名称
|
||||
@ -91,7 +91,7 @@ class ETextName extends Group {
|
||||
styleName = model.transferTrackName;
|
||||
}
|
||||
if (model.transferTrackNameShow) {
|
||||
isShow = true;
|
||||
this.isShow = true;
|
||||
}
|
||||
}
|
||||
// 目的码名称
|
||||
@ -109,7 +109,7 @@ class ETextName extends Group {
|
||||
styleName = model.destinationCode;
|
||||
}
|
||||
if (model.destinationNameShow) {
|
||||
isShow = true;
|
||||
this.isShow = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ class ETextName extends Group {
|
||||
}
|
||||
});
|
||||
this.add(this.text);
|
||||
isShow ? this.text.show() : this.text.hide();
|
||||
this.isShow ? this.text.show() : this.text.hide();
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,6 +155,9 @@ class ETextName extends Group {
|
||||
|
||||
recover() {
|
||||
// 暂时不做状态初始化
|
||||
if (this.text) {
|
||||
this.isShow ? this.text.show() : this.text.hide();
|
||||
}
|
||||
const styleModel = this.model.style.Section[this.model.type];
|
||||
this.text && this.text.setStyle({textFill: this.model.approach && this.model.type === 'name' ? styleModel.approachColor : styleModel.fontColor });
|
||||
}
|
||||
|
@ -57,17 +57,19 @@ export default class Section extends Group {
|
||||
this._code = model.code;
|
||||
this._type = model._type;
|
||||
this.zlevel = model.zlevel;
|
||||
const amendData = store.getters['map/amendPoints'](this._code);
|
||||
if (amendData) {
|
||||
model.points = amendData.points;
|
||||
}
|
||||
this.z = 5 + parseInt(model.layer || 0);
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.mapDevice = mapDevice;
|
||||
this.selected = false; // 绘图选中状态
|
||||
this.selectedType = ''; // 绘图批量选中状态
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
this.setShowMode(true);
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -125,6 +127,7 @@ export default class Section extends Group {
|
||||
/** 设置区段恢复默认状态*/
|
||||
recover() {
|
||||
if (this.line) {
|
||||
this.line.show();
|
||||
this.line.setCrossUnBlock();
|
||||
this.line.stopAnimation(true);
|
||||
this.sectionMiddle && this.sectionMiddle.hide(); // 因此特殊区段
|
||||
@ -142,15 +145,23 @@ export default class Section extends Group {
|
||||
// this.line.setRunLineDefault();
|
||||
}
|
||||
this.name && this.name.recover();
|
||||
this.logicText && this.logicText.recover();
|
||||
this.transferTrackText && this.transferTrackText.recover();
|
||||
this.standTrackText && this.standTrackText.recover();
|
||||
this.destinationText && this.destinationText.recover();
|
||||
this.reentryTrackText && this.reentryTrackText.recover();
|
||||
this.derailer && this.derailer.hide();
|
||||
this.speedLimit && this.speedLimit.hide();
|
||||
this.speedLimitName && this.speedLimitName.hide();
|
||||
this.separator && this.separator.show();
|
||||
this.badShunt && this.badShunt.hide();
|
||||
|
||||
this.axle && this.axle.setStyle({
|
||||
stroke: this.style.Section.line.spareColor,
|
||||
fill: this.style.Section.line.spareColor
|
||||
});
|
||||
this.axle && this.axle.show();
|
||||
this.line && this.line.recover();
|
||||
this.line && this.line.recoverRoute();
|
||||
this.lineBorder && this.lineBorder.setStyle({ lineWidth: 0 });
|
||||
}
|
||||
@ -387,17 +398,19 @@ export default class Section extends Group {
|
||||
const switchModel = this.mapDevice[model.relSwitchCode];
|
||||
const sectionB = this.mapDevice[switchModel.sectionBCode];
|
||||
const sectionC = this.mapDevice[switchModel.sectionCCode];
|
||||
if (switchModel && switchModel.normalPosition === 1) {
|
||||
const sectionA = this.mapDevice[switchModel.sectionACode];
|
||||
// N-定位 R-反位 NO-无(失表) EX-挤叉
|
||||
if (switchModel && switchModel.pos === 'N') {
|
||||
this.setSwitchSectionColor(sectionC, sectionB);// 定位
|
||||
} else if (switchModel && switchModel.normalPosition === 0 && switchModel.reversePosition === 0 && switchModel.instance && switchModel.instance.switchPosition === 'reverse' && switchModel.fault !== 'SPLIT') {
|
||||
} else if (switchModel && switchModel.pos == 'NO' && switchModel.instance && switchModel.instance.switchPosition === 'reverse' && switchModel.fault !== 'SPLIT') {
|
||||
this.setSwitchSectionColor(sectionC, sectionB);// 反位转定位前
|
||||
} else if (switchModel && switchModel.normalPosition === 0 && switchModel.reversePosition === 0 && switchModel.instance && switchModel.instance.switchPosition === 'normal' && (switchModel.fault === 'SPLIT' || switchModel.fault === 'NORMAL_SPLIT')) {
|
||||
} else if (switchModel && switchModel.pos == 'NO' && switchModel.instance && switchModel.instance.switchPosition === 'normal' && (switchModel.fault === 'SPLIT' || switchModel.fault === 'NORMAL_SPLIT')) {
|
||||
this.setSwitchSectionColor(sectionC, sectionB);// 定位变失表或定位失表
|
||||
} else if (switchModel && switchModel.reversePosition === 1) {
|
||||
} else if (switchModel && switchModel.pos === 'R') {
|
||||
this.setSwitchSectionColor(sectionB, sectionC); // 反位
|
||||
} else if (switchModel && switchModel.normalPosition === 0 && switchModel.reversePosition === 0 && switchModel.instance && switchModel.instance.switchPosition === 'normal' && switchModel.fault !== 'SPLIT') {
|
||||
} else if (switchModel && switchModel.pos == 'NO' && switchModel.instance && switchModel.instance.switchPosition === 'normal' && switchModel.fault !== 'SPLIT') {
|
||||
this.setSwitchSectionColor(sectionB, sectionC); // 定位转反位前
|
||||
} else if (switchModel && switchModel.normalPosition === 0 && switchModel.reversePosition === 0 && switchModel.instance && switchModel.instance.switchPosition === 'reverse' && (switchModel.fault === 'SPLIT' || switchModel.fault === 'REVERSE_SPLIT')) {
|
||||
} else if (switchModel && switchModel.pos == 'NO' && switchModel.instance && switchModel.instance.switchPosition === 'reverse' && (switchModel.fault === 'SPLIT' || switchModel.fault === 'REVERSE_SPLIT')) {
|
||||
this.setSwitchSectionColor(sectionB, sectionC);// 反位变失表后反位失表
|
||||
}
|
||||
if (this.style.Section.switchFault && switchModel.fault === 'SQUEEZE') {
|
||||
@ -419,16 +432,32 @@ export default class Section extends Group {
|
||||
}
|
||||
} else {
|
||||
if (sectionB && sectionB.instance) { sectionB.instance.line.stopAnimation(true); sectionB.delayUnlock && sectionB.instance.delayUnlock(); }
|
||||
if (sectionC && sectionC.instance) { sectionC.instance.line.stopAnimation(true); sectionC.delayUnlock && sectionB.instance.delayUnlock(); }
|
||||
if (sectionC && sectionC.instance) { sectionC.instance.line.stopAnimation(true); sectionC.delayUnlock && sectionC.instance.delayUnlock(); }
|
||||
if (sectionA && sectionA.instance) { sectionA.instance.line.stopAnimation(true); sectionA.delayUnlock && sectionA.instance.delayUnlock(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
/** 设置状态*/
|
||||
setState(model, flag = false) {
|
||||
if (!this.isShowShape || model.showMode === '05') return;
|
||||
this.recover();
|
||||
// 只响应前端自定义类型的状态变化
|
||||
if (model._free) {
|
||||
if (this.model.showMode === '05') {
|
||||
this.line.setStyle({stroke: this.style.Section.line.troColor, lineWidth: this.style.Section.line.troWidth});
|
||||
this.separator && this.separator.hide();
|
||||
this.name && this.name.hide();
|
||||
this.logicText && this.logicText.hide();
|
||||
this.standTrackText && this.standTrackText.hide();
|
||||
this.reentryTrackText && this.reentryTrackText.hide();
|
||||
this.transferTrackText && this.transferTrackText.hide();
|
||||
this.destinationText && this.destinationText.hide();
|
||||
if (this.model.type === '05') {
|
||||
this.line.hide();
|
||||
}
|
||||
} else if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
} else if (model._free) {
|
||||
// 先初始化为灰色
|
||||
this.setAshShow();
|
||||
model.preGreen && this.line.setStyle({stroke: '#00FF00'});
|
||||
@ -573,60 +602,6 @@ export default class Section extends Group {
|
||||
mouseover() {
|
||||
this.line && this.line.setStyle({ stroke: 'rgba(255,255,255,0.8)' });
|
||||
}
|
||||
setShowMode(flag = false) {
|
||||
if (!flag) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.setState(this.model);
|
||||
}
|
||||
if (this.model.showMode === '05') {
|
||||
this.line.setStyle({stroke: this.style.Section.line.troColor, lineWidth: this.style.Section.line.troWidth});
|
||||
this.separator && this.separator.hide();
|
||||
this.name && this.name.hide();
|
||||
this.logicText && this.logicText.hide();
|
||||
this.standTrackText && this.standTrackText.hide();
|
||||
this.reentryTrackText && this.reentryTrackText.hide();
|
||||
this.transferTrackText && this.transferTrackText.hide();
|
||||
this.destinationText && this.destinationText.hide();
|
||||
if (this.model.type === '05') {
|
||||
this.line.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.isShowShape = true;
|
||||
if (this.name) {
|
||||
this.model.nameShow ? this.name.show() : this.name.hide();
|
||||
}
|
||||
if (this.logicText) {
|
||||
this.model.nameShow ? this.logicText.show() : this.logicText.hide();
|
||||
}
|
||||
if (this.transferTrackText) {
|
||||
this.model.transferTrackNameShow ? this.transferTrackText.show() : this.transferTrackText.hide();
|
||||
}
|
||||
if (this.standTrackText) {
|
||||
this.model.standTrackNameShow ? this.standTrackText.show() : this.standTrackText.hide();
|
||||
}
|
||||
if (this.destinationText) {
|
||||
this.model.destinationNameShow ? this.destinationText.show() : this.destinationText.hide();
|
||||
}
|
||||
if (this.reentryTrackText) {
|
||||
this.model.reentryTrackNameShow ? this.reentryTrackText.show() : this.reentryTrackText.hide();
|
||||
}
|
||||
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
|
||||
getAnchorPoint() {
|
||||
const rect = this.getBoundingRect();
|
||||
|
@ -54,25 +54,25 @@ class ESigLamp extends Group {
|
||||
this.add(this.lampSector);
|
||||
this.lampSector.hide();
|
||||
}
|
||||
if (style.Signal.lamp.faultType && style.Signal.lamp.faultType == 'flash') {
|
||||
this.lampFault = new ESigFault({
|
||||
zlevel: model.zlevel,
|
||||
z: model.z + 1,
|
||||
style:{
|
||||
lineWidth: 1,
|
||||
stroke: '#F00'
|
||||
},
|
||||
shape: {
|
||||
points: {
|
||||
x: model.x,
|
||||
y: model.y
|
||||
},
|
||||
radius:style.Signal.lamp.radiusR
|
||||
}
|
||||
});
|
||||
this.add(this.lampFault);
|
||||
this.lampFault.hide();
|
||||
}
|
||||
// if (style.Signal.lamp.faultType && style.Signal.lamp.faultType == 'flash') {
|
||||
// this.lampFault = new ESigFault({
|
||||
// zlevel: model.zlevel,
|
||||
// z: model.z + 1,
|
||||
// style:{
|
||||
// lineWidth: 1,
|
||||
// stroke: '#F00'
|
||||
// },
|
||||
// shape: {
|
||||
// points: {
|
||||
// x: model.x,
|
||||
// y: model.y
|
||||
// },
|
||||
// radius:style.Signal.lamp.radiusR
|
||||
// }
|
||||
// });
|
||||
// this.add(this.lampFault);
|
||||
// this.lampFault.hide();
|
||||
// }
|
||||
|
||||
if ( !style.Signal.lamp.logicDisplayNone ) {
|
||||
this.lstop = new Line({
|
||||
@ -158,13 +158,13 @@ class ESigLamp extends Group {
|
||||
}
|
||||
}
|
||||
|
||||
faultShow() {
|
||||
this.lampFault && this.lampFault.show();
|
||||
}
|
||||
|
||||
faultHide() {
|
||||
this.lampFault && this.lampFault.hide();
|
||||
}
|
||||
// faultShow() {
|
||||
// this.lampFault && this.lampFault.show();
|
||||
// }
|
||||
//
|
||||
// faultHide() {
|
||||
// this.lampFault && this.lampFault.hide();
|
||||
// }
|
||||
setGuideSectorShowHide(flag) {
|
||||
if (flag) {
|
||||
this.lampSector && this.lampSector.show();
|
||||
|
@ -189,13 +189,17 @@ class Signal extends Group {
|
||||
super();
|
||||
this._code = model.code;
|
||||
this._type = model._type;
|
||||
const amendData = store.getters['map/amendPoints'](this._code);
|
||||
if (amendData) {
|
||||
model.position = amendData.position;
|
||||
model.rotate = amendData.rotate;
|
||||
}
|
||||
this.model = model;
|
||||
this.mapDevice = mapDevice;
|
||||
this.style = style;
|
||||
this.count = parseInt(model.lampPositionType);
|
||||
this.lamps = new Array(this.count);
|
||||
this.zlevel = model.zlevel;
|
||||
this.isShowShape = true;
|
||||
this.z = 7;
|
||||
if (!model.positionPoint) {
|
||||
model.positionPoint = {
|
||||
@ -213,14 +217,13 @@ class Signal extends Group {
|
||||
this.checkIsDrawMap();
|
||||
this.transformRotation(this);
|
||||
this.setState(model);
|
||||
this.setShowMode(true);
|
||||
// this.checkIsDrawMap();
|
||||
}
|
||||
|
||||
create() {
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
const drict = this.model.right ? 1 : -1; // 朝向 左:右
|
||||
const drict = this.model.showRight ? 1 : -1; // 朝向 左:右
|
||||
const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下
|
||||
|
||||
// 信号机高柱矮柱 (信号机底座)
|
||||
@ -294,8 +297,8 @@ class Signal extends Group {
|
||||
this.tText.hide();
|
||||
}
|
||||
if (style.Signal.insideTriangle) {
|
||||
const right = model.right ? 1 : -1;
|
||||
const angle = Math.PI / 6 * right;
|
||||
const showRight = model.showRight ? 1 : -1;
|
||||
const angle = Math.PI / 6 * showRight;
|
||||
this.insideTriangle = new Isogon({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z + 1,
|
||||
@ -346,7 +349,7 @@ class Signal extends Group {
|
||||
// 信号机名称
|
||||
const sigNameX = model.position.x + model.positionPoint.x - drict * (style.Signal.post.standardVerticalWidth) + model.namePosition.x;
|
||||
const sigNameY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
|
||||
const textAlign = style.Signal.text.isAlignCenter ? 'middle' : this.model.right ? 'left' : 'right';
|
||||
const textAlign = style.Signal.text.isAlignCenter ? 'middle' : this.model.showRight ? 'left' : 'right';
|
||||
const textVerticalAlign = posit == 1 ? 'top' : 'bottom';
|
||||
this.sigName = new ESigName({
|
||||
zlevel: this.zlevel,
|
||||
@ -365,7 +368,7 @@ class Signal extends Group {
|
||||
});
|
||||
|
||||
const timeNameY = model.position.y + model.positionPoint.y - posit * 15;
|
||||
this.remainTImeName = new ESigName({
|
||||
this.remainTimeName = new ESigName({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
silent: false,
|
||||
@ -460,7 +463,7 @@ class Signal extends Group {
|
||||
this.style.Signal.text.show && model.nameShow ? this.sigName.show() : this.sigName.hide();
|
||||
this.add(this.sigRoute);
|
||||
this.add(this.sigDelay);
|
||||
this.add(this.remainTImeName);
|
||||
this.add(this.remainTimeName);
|
||||
|
||||
if (this.model.virtual) {
|
||||
// 虚拟信号机显示
|
||||
@ -482,13 +485,13 @@ class Signal extends Group {
|
||||
createTransmission() {
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
const drict = this.model.right ? 1 : -1; // 朝向 左:右
|
||||
const drict = this.model.showRight ? 1 : -1; // 朝向 左:右
|
||||
const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下
|
||||
// 信号机名称
|
||||
const actual = this.mapDevice[model.linkSignalCode];
|
||||
const sigNameX = model.position.x + model.positionPoint.x + drict * 0.433 * style.Signal.transmission.sideLength + model.namePosition.x;
|
||||
const sigNameY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
|
||||
const textAlign = style.Signal.text.isAlignCenter ? 'middle' : this.model.right ? 'left' : 'right';
|
||||
const textAlign = style.Signal.text.isAlignCenter ? 'middle' : this.model.showRight ? 'left' : 'right';
|
||||
const textVerticalAlign = posit == 1 ? 'top' : 'bottom';
|
||||
const fillColor = actual.virtual ? style.Signal.transmission.fillColorVirtual : style.Signal.transmission.fillColor;
|
||||
this.sigName = new ESigName({
|
||||
@ -693,6 +696,22 @@ class Signal extends Group {
|
||||
}
|
||||
}
|
||||
}
|
||||
lampWhite() {
|
||||
if (this.lamps.length === 1) {
|
||||
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.whiteColor);
|
||||
} else {
|
||||
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.whiteColor);
|
||||
this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor);
|
||||
}
|
||||
}
|
||||
lampBlue() {
|
||||
if (this.lamps.length === 1) {
|
||||
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
|
||||
} else {
|
||||
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.whiteColor);
|
||||
this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor);
|
||||
}
|
||||
}
|
||||
overlapLock() {
|
||||
if (this.style.Signal.lamp.overlapColor) {
|
||||
this.sigName && this.sigName.setStyle({ textFill: this.style.Signal.lamp.overlapColor });
|
||||
@ -753,7 +772,7 @@ class Signal extends Group {
|
||||
}
|
||||
fault() {
|
||||
if (this.style.Signal.lamp.faultType == 'flash') {
|
||||
this.lamps[0].faultShow();
|
||||
// this.lamps[0].faultShow();
|
||||
} else if (this.style.Signal.lamp.faultType == 'cross') {
|
||||
this.lamps[0].setFault2Corss(true);
|
||||
} else if (this.style.Signal.lamp.faultType == 'watch') {
|
||||
@ -826,7 +845,8 @@ class Signal extends Group {
|
||||
}
|
||||
if (this.style.Signal.post.autoRouteColor) {
|
||||
this.sigPost.setColor(this.style.Signal.post.autoRouteColor);
|
||||
} else if (this.style.Signal.post.autoRouteVerColor) {
|
||||
}
|
||||
if (this.style.Signal.post.autoRouteVerColor) {
|
||||
this.sigPost.setVerColor(this.style.Signal.post.autoRouteVerColor);
|
||||
}
|
||||
}
|
||||
@ -873,8 +893,8 @@ class Signal extends Group {
|
||||
}
|
||||
// 信号显示延迟解锁
|
||||
showRemainTime(number) {
|
||||
this.remainTImeName.show();
|
||||
this.remainTImeName && this.remainTImeName.setStyle({ text: number });
|
||||
this.remainTimeName.show();
|
||||
this.remainTimeName && this.remainTimeName.setStyle({ text: number });
|
||||
this.model.signalButtonList && this.model.signalButtonList.length && this.model.signalButtonList.forEach(item => {
|
||||
const button = store.getters['map/getDeviceByCode'](item);
|
||||
if (button.type === 'PICK') {
|
||||
@ -893,18 +913,20 @@ class Signal extends Group {
|
||||
}
|
||||
// 恢复状态
|
||||
recover() {
|
||||
this.sigName && this.sigName.show();
|
||||
this.sigName && this.sigName.setAnimationEnd();
|
||||
this.lamps && this.lamps.forEach(item=> { item.show(); item.setGuideSectorShowHide(false); });
|
||||
this.sigName.setStyle({ textBorderWidth: 0 });
|
||||
this.sigName.setColor(this.style.Signal.text.defaultColor);
|
||||
this.remainTImeName && this.remainTImeName.hide();
|
||||
this.remainTimeName && this.remainTimeName.hide();
|
||||
this.sigDelay && this.sigDelay.hide();
|
||||
if (this.style.Signal.auto.autoTriggerType != 'text') {
|
||||
this.setAutoClose();
|
||||
this.sigAuto && this.sigAuto.animationRecover();
|
||||
}
|
||||
this.sigAuto && this.sigAuto.hide();
|
||||
this.sigRoute && this.sigRoute.hide();
|
||||
this.sigBack && this.sigBack.hide();
|
||||
this.sigPost && this.sigPost.show();
|
||||
this.sigPost && this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色
|
||||
|
||||
if (this.style.Signal.lamp.guidName === 'singleRY') {
|
||||
@ -914,9 +936,7 @@ class Signal extends Group {
|
||||
this.lamps && this.lamps[1] && this.lamps[1].hide();
|
||||
}
|
||||
|
||||
if (this.style.Signal.lamp.faultType == 'flash') {
|
||||
this.lamps && this.lamps[0] && this.lamps[0].faultHide();
|
||||
} else if (this.style.Signal.lamp.faultType == 'cross') {
|
||||
if (this.style.Signal.lamp.faultType == 'cross') {
|
||||
this.lamps && this.lamps[0] && this.lamps[0].setFault2Corss(false);
|
||||
} else if (this.style.Signal.lamp.faultType == 'watch') {
|
||||
const device = findDeviceByModelDepType(this.model, deviceType.LampFilament, 'stationCode');
|
||||
@ -934,8 +954,12 @@ class Signal extends Group {
|
||||
this.ciConfirm && this.ciConfirm.hide();
|
||||
this.sigBack && this.sigBack.hide();
|
||||
this.tText && this.tText.hide();
|
||||
this.transmission && this.transmission.show();
|
||||
this.lowButton && this.lowButton.hide();
|
||||
|
||||
this.sigBack && this.sigBack.stopAnimation(false);
|
||||
this.lamps && this.lamps[0] && this.lamps[0].setAnimationEnd();
|
||||
this.virtualSignal && this.virtualSignal.show();
|
||||
this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.redColor);
|
||||
if (this.model.signalButtonList && this.model.signalButtonList.length) {
|
||||
this.model.signalButtonList.forEach(item => {
|
||||
@ -946,18 +970,21 @@ class Signal extends Group {
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
if (!this.isShowShape || this.model.type === 'TRANSMISSION' || model.showMode === '05') {
|
||||
return;
|
||||
}
|
||||
const path = window.location.href;
|
||||
this.recover();
|
||||
|
||||
// 只响应前端自定义类型的状态变化
|
||||
if (model._free) {
|
||||
if (this.model.showMode === '05') {
|
||||
this.eachChild(item => { item.hide(); });
|
||||
} if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.eachChild(item => { item.hide(); });
|
||||
} else if (model._free) {
|
||||
this.setAshShow();
|
||||
} else {
|
||||
/** 信号机进路按钮显示 */
|
||||
/** 终端信号机按钮 */
|
||||
if ( this.model.type === 'TRANSMISSION' ) {
|
||||
return;
|
||||
}
|
||||
if (model.isRouteActive) {
|
||||
this.setLowButtonActive();
|
||||
} else {
|
||||
@ -966,10 +993,41 @@ class Signal extends Group {
|
||||
model.isRouteSignal && this.setLowButtonShow();
|
||||
|
||||
/** 设置灯的颜色 */
|
||||
model.redOpen && !model.yellowOpen && !model.greenOpen && this.close(model.logicLight); // 信号关闭
|
||||
model.greenOpen && !model.redOpen && !model.yellowOpen && this.openPositive(model.logicLight); // 信号正向开放
|
||||
model.yellowOpen && !model.redOpen && !model.greenOpen && this.openLateral(model.logicLight); // 信号侧向开放
|
||||
model.redOpen && model.yellowOpen && !model.greenOpen && this.guid(); // 引导信号显示
|
||||
switch (model.aspect) {
|
||||
// 红
|
||||
case 'R': {
|
||||
this.close(model.logicLight); // 信号关闭
|
||||
break;
|
||||
}
|
||||
// 绿
|
||||
case 'G': {
|
||||
this.openPositive(model.logicLight); // 信号正向开放
|
||||
break;
|
||||
}
|
||||
// 黄
|
||||
case 'Y': {
|
||||
this.openLateral(model.logicLight); // 信号侧向开放
|
||||
break;
|
||||
}
|
||||
// 红黄
|
||||
case 'RY': {
|
||||
this.guid(); // 引导信号显示
|
||||
break;
|
||||
}
|
||||
case 'W': {
|
||||
this.lampWhite();
|
||||
break;
|
||||
}
|
||||
case 'B': {
|
||||
this.lampBlue();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this.close(model.logicLight); // 信号关闭
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (model.remainTime) {
|
||||
this.showRemainTime(model.remainTime);
|
||||
} else {
|
||||
@ -1034,12 +1092,15 @@ class Signal extends Group {
|
||||
});
|
||||
}
|
||||
}
|
||||
// LEVEL_Close = 0;---关闭 LEVEL_Guide = 1;-----引导级 LEVEL_Atp = 2;-----ATP级 LEVEL_Main = 3-----主信号级
|
||||
if ( model.level === 3 && this.style.Signal.post.mainSignalVerColor && !model.fleetMode) {
|
||||
this.sigPost.setVerColor(this.style.Signal.post.mainSignalVerColor);
|
||||
} else if (model.level === 1 && this.style.Signal.post.closeSignalVerColor && !model.fleetMode) {
|
||||
} else if (model.level === 0 && this.style.Signal.post.closeSignalVerColor && !model.fleetMode) {
|
||||
this.sigPost.setVerColor(this.style.Signal.post.closeSignalVerColor);
|
||||
} else if (model.level === 2 && this.style.Signal.post.guideSignalVerColor && !model.fleetMode) {
|
||||
} else if (model.level === 1 && this.style.Signal.post.guideSignalVerColor && !model.fleetMode) {
|
||||
this.sigPost.setVerColor(this.style.Signal.post.guideSignalVerColor);
|
||||
} else if (model.level === 2 && this.style.Signal.post.autoRouteVerColor && !model.fleetMode) {
|
||||
this.sigPost.setVerColor(this.style.Signal.post.autoRouteVerColor);
|
||||
}
|
||||
|
||||
if (this.style.Signal.lamp.special) {
|
||||
@ -1059,7 +1120,7 @@ class Signal extends Group {
|
||||
this.tText && this.tText.show();
|
||||
}
|
||||
// 设置灰显
|
||||
if (model.noStatus || model.level === 0) {
|
||||
if (model.noStatus) {
|
||||
this.setAshShow();
|
||||
}
|
||||
|
||||
@ -1067,6 +1128,9 @@ class Signal extends Group {
|
||||
if (this.style.Signal.text.conflictColor && model.checkConflict) {
|
||||
this.sigName.setColor(this.style.Signal.text.conflictColor);
|
||||
}
|
||||
if (store.state.training.prdType === '01') {
|
||||
this.lowButton && this.lowButton.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1093,7 +1157,7 @@ class Signal extends Group {
|
||||
rect = this.ciConfirm.getBoundingRect();
|
||||
break;
|
||||
default:
|
||||
var drict = this.model.right ? 1 : -1; // 朝向 右:左
|
||||
var drict = this.model.showRight ? 1 : -1; // 朝向 右:左
|
||||
var offsetY = this.model.positionType == '01' ? this.style.Signal.text.fontSize : 0; // 位置 上:下
|
||||
var shape = this.model.type == 'TRANSMISSION' ? this.transmission : this.sigPost;
|
||||
rect = shape.getBoundingRect().clone();
|
||||
@ -1133,7 +1197,7 @@ class Signal extends Group {
|
||||
/* 始端信号机选择后信号机变为三角形 */
|
||||
setLampToTriangle() {
|
||||
const endPoint = this.sigPost.getLampPosition(this.model.lampPostType);
|
||||
const drict = this.model.right ? 1 : -1; // 朝向 右:左
|
||||
const drict = this.model.showRight ? 1 : -1; // 朝向 右:左
|
||||
this.lampTriangle = new Polygon({
|
||||
zelvel: this.zlevel,
|
||||
z: this.z,
|
||||
@ -1168,42 +1232,6 @@ class Signal extends Group {
|
||||
});
|
||||
}
|
||||
}
|
||||
setShowMode(flag = false) {
|
||||
const showMode = this.model.showMode;
|
||||
if (!flag) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.setState(this.model);
|
||||
}
|
||||
if (showMode == '03') {
|
||||
this.lowButton && this.lowButton.show();
|
||||
this.model.prdType = '01';
|
||||
} else if (showMode == '02') {
|
||||
this.lowButton && this.lowButton.hide();
|
||||
this.model.prdType = '02';
|
||||
} else if (showMode == '05') {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.style.Signal.text.show && this.model.nameShow ? this.sigName.show() : this.sigName.hide();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
|
||||
setLowButtonShow() {
|
||||
this.lowButton.show();
|
||||
}
|
||||
|
@ -13,10 +13,8 @@ export default class SignalButton extends Group {
|
||||
this.z = 0;
|
||||
this.model = model;
|
||||
this.style = style.Line;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -116,6 +114,8 @@ export default class SignalButton extends Group {
|
||||
this.rectButton && this.rectButton.setStyle({ fill:this.getTypeColor() });
|
||||
this.rightLine && this.rightLine.hide();
|
||||
this.leftLine && this.leftLine.hide();
|
||||
this.rectButton && this.rectButton.show();
|
||||
this.buttonText && this.buttonText.show();
|
||||
}
|
||||
blockShow() {
|
||||
this.rightLine && this.rightLine.show();
|
||||
@ -123,27 +123,17 @@ export default class SignalButton extends Group {
|
||||
}
|
||||
setState(model) {
|
||||
this.recover();
|
||||
if (!this.isShowShape) return;
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.buttonText && this.buttonText.hide();
|
||||
this.rectButton && this.rectButton.hide();
|
||||
this.leftLine && this.leftLine.hide();
|
||||
this.rightLine && this.rightLine.hide();
|
||||
} else {
|
||||
if (model.hasSelected) {
|
||||
this.startAnimate();
|
||||
}
|
||||
}
|
||||
// 设置显示模式
|
||||
setShowMode() {
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
this.isShowShape = false;
|
||||
}
|
||||
|
||||
}
|
||||
getAnchorPoint() {
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ export default class SplitStation extends Group {
|
||||
this._type = model._type;
|
||||
this.zlevel = model.zlevel;
|
||||
this.model = model;
|
||||
this.isBigScreen = false;
|
||||
this.style = style;
|
||||
this.create();
|
||||
}
|
||||
@ -119,36 +120,26 @@ export default class SplitStation extends Group {
|
||||
this.add(this.leftText);
|
||||
this.add(this.rightText);
|
||||
}
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
if (showMode == '04') {
|
||||
this.eachChild(item => item.hide() );
|
||||
return;
|
||||
}
|
||||
const showConditions = this.model.showConditions;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.eachChild(item => item.show() );
|
||||
} else {
|
||||
this.eachChild(item => item.hide() );
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.isShowShape = true;
|
||||
} else {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.verticalLine && this.verticalLine.hide();
|
||||
this.arrowLeft && this.arrowLeft.hide();
|
||||
this.arrowRight && this.arrowRight.hide();
|
||||
this.leftText && this.leftText.hide();
|
||||
this.rightText && this.rightText.hide();
|
||||
}
|
||||
}
|
||||
recover() {
|
||||
this.verticalLine && this.verticalLine.show();
|
||||
this.arrowLeft && this.arrowLeft.show();
|
||||
this.arrowRight && this.arrowRight.show();
|
||||
this.leftText && this.leftText.show();
|
||||
this.rightText && this.rightText.show();
|
||||
if (this.isBigScreen) { this.screenShow(); }
|
||||
}
|
||||
screenShow() {
|
||||
this.isBigScreen = true;
|
||||
this.eachChild((child) => {
|
||||
child.hide();
|
||||
});
|
||||
|
@ -28,14 +28,11 @@ export default class Station extends Group {
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.noneBeforeMode = '';
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.createTurnBack(); // 创建按图折返
|
||||
this.createControlMode();
|
||||
this.setState(model);
|
||||
this.checkIsDrawMap();
|
||||
this.setVisible(model.visible);
|
||||
this.setShowMode();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -77,10 +74,7 @@ export default class Station extends Group {
|
||||
textFill: model.kmPostFontColor
|
||||
});
|
||||
this.add(this.mileageText);
|
||||
model.kmPostShow ? this.mileageText.show() : this.mileageText.hide();
|
||||
if (!model.visible) {
|
||||
this.mileageText.setStyle('fontSize', 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if (!model.visible) { // 隐藏车站
|
||||
@ -570,6 +564,9 @@ export default class Station extends Group {
|
||||
}
|
||||
|
||||
recover() {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
this.emergencyControl && this.emergencyControl.setTextColor(this.style.Station.StationControl.text.fontColor);
|
||||
this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
@ -579,15 +576,13 @@ export default class Station extends Group {
|
||||
this.interconnectedControl && this.interconnectedControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
this.interconnectedControl && this.interconnectedControl.setTextColor(this.style.Station.StationControl.text.fontColor);
|
||||
this.controlPreReset && this.controlPreReset.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
|
||||
this.troButton && this.troButton.hide();
|
||||
this.substationArrowsControl && this.substationArrowsControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
this.emergencyArrowsControl && this.emergencyArrowsControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
if (this.style.Station.stationText.isSpecialType) {
|
||||
// if()
|
||||
this.stationText.setColor(this.style.Station.stationText.noneModeColor);
|
||||
this.stationText.setBackground(this.style.Station.stationText.defaultBackColor);
|
||||
this.stationText && this.stationText.stopAnimate();
|
||||
// sationEle.controller
|
||||
} else {
|
||||
this.stationText && this.stationText.stopAnimate();
|
||||
}
|
||||
@ -595,25 +590,21 @@ export default class Station extends Group {
|
||||
|
||||
// 设置状态
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
this.setVisible();
|
||||
if (this.model.showMode === '05') {
|
||||
if (this.troButton) {
|
||||
this.troButton.show();
|
||||
} else {
|
||||
this.createTroButton(); // 创建轨道预览按钮
|
||||
}
|
||||
} else if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.eachChild(item => { item.hide(); });
|
||||
} else {
|
||||
model.controlMode && this['handle' + model.controlMode]();
|
||||
|
||||
// if (this.style.Station.syncCentralizeStation && model.controller && model.centralized) {
|
||||
// debugger;
|
||||
// model.chargeStationCodeList.forEach(item => {
|
||||
// const device = store.getters['map/getDeviceByCode'](item);
|
||||
// // device.controller = model.controller;
|
||||
// device && device.instance && device.instance.recover();
|
||||
// device && device.instance && device.instance.handleComplexControl(model.controller);
|
||||
// });
|
||||
// //
|
||||
// }
|
||||
// console.log(model.controller, model.centralized, '5555555555555');
|
||||
model.preResetValidDuration && this.handlePreResetLamp();
|
||||
model.controller && this.handleComplexControl(model.controller);
|
||||
model.emergencyController != undefined && this.handleEmergencyChange(model.emergencyController);
|
||||
// model.controlApplicant
|
||||
model.controlApplicant && this.handleControlApplicant(model);
|
||||
if (this.style.Station.syncCentralizeStation && (model.controlMode || model.controller || model.emergencyController != undefined) && model.centralized) {
|
||||
model.chargeStationCodeList.forEach(item => {
|
||||
@ -641,6 +632,7 @@ export default class Station extends Group {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
handlePreResetLamp() {
|
||||
this.controlPreReset && this.controlPreReset.setColor('#f00');
|
||||
}
|
||||
@ -772,42 +764,16 @@ export default class Station extends Group {
|
||||
this.on('mouseover', e => { this.EMouse.mouseover(e); });
|
||||
}
|
||||
}
|
||||
setShowMode() {
|
||||
if (this.model.showMode === '05') {
|
||||
if (this.troButton) {
|
||||
this.troButton.show();
|
||||
} else {
|
||||
this.createTroButton(); // 创建轨道预览按钮
|
||||
|
||||
setVisible() {
|
||||
if (!this.model.visible) {
|
||||
this.eachChild(elem => { elem.hide(); });
|
||||
}
|
||||
} else {
|
||||
this.troButton && this.troButton.hide();
|
||||
}
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
if (this.model.visible) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
if (this.mileageText) {
|
||||
this.model.kmPostShow ? this.mileageText.show() : this.mileageText.hide();
|
||||
}
|
||||
}
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
|
||||
setVisible(visible) {
|
||||
if (visible) {
|
||||
this.eachChild(elem => { elem.show(); });
|
||||
} else {
|
||||
this.eachChild(elem => { elem.hide(); });
|
||||
if (!this.model.visible) {
|
||||
this.mileageText && this.mileageText.hide();
|
||||
}
|
||||
}
|
||||
getAnchorPoint() {
|
||||
|
@ -15,7 +15,6 @@ export default class StationCounter extends Group {
|
||||
this.style = style;
|
||||
this.zlevel = model.zlevel;
|
||||
this.z = 30;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
}
|
||||
@ -83,27 +82,22 @@ export default class StationCounter extends Group {
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.counter && this.counter.hide();
|
||||
this.table && this.table.hide();
|
||||
this.counterName && this.counterName.hide();
|
||||
}
|
||||
}
|
||||
recover() {
|
||||
this.counter && this.counter.show();
|
||||
this.table && this.table.show();
|
||||
this.counterName && this.counterName.show();
|
||||
}
|
||||
|
||||
getShapeTipPoint() {
|
||||
return null;
|
||||
}
|
||||
setShowMode() {}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.model.position;
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ export default class StationDelayUnlock extends Group {
|
||||
this.style = style;
|
||||
this.zlevel = model.zlevel;
|
||||
this.z = 1;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
}
|
||||
@ -92,35 +91,32 @@ export default class StationDelayUnlock extends Group {
|
||||
|
||||
/** 延时解锁计数*/
|
||||
delayUnlock() {
|
||||
if (!this.isShowShape) return;
|
||||
this.table.setStyle('stroke', this.style.sidelineColor);
|
||||
this.time.setStyle('text', '' + this.model.remainTime);
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
this.recover();
|
||||
if (!store.getters['map/checkDeviceShow'](this._code)) {
|
||||
this.text && this.text.hide();
|
||||
this.table && this.table.hide();
|
||||
this.time && this.time.hide();
|
||||
} else {
|
||||
switch (model.status) {
|
||||
case '01': this.delayClose(); break; // 关闭
|
||||
case '02': this.delayUnlock(); break; // 延迟解锁
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getShapeTipPoint() {
|
||||
return null;
|
||||
}
|
||||
setShowMode() {}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || store.getters['map/checkDeviceShow'](stationCode, this._code)) {
|
||||
this.eachChild(item => {
|
||||
item.show();
|
||||
});
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.eachChild(item => {
|
||||
item.hide();
|
||||
});
|
||||
this.isShowShape = false;
|
||||
}
|
||||
recover() {
|
||||
this.text && this.text.show();
|
||||
this.table && this.table.show();
|
||||
this.time && this.time.show();
|
||||
}
|
||||
getAnchorPoint() {
|
||||
return this.model.position;
|
||||
|
@ -59,7 +59,8 @@ class EPatternFilter extends Group {
|
||||
}
|
||||
|
||||
recover() {
|
||||
|
||||
this.patternFilter1 && this.patternFilter1.show();
|
||||
this.patternFilter2 && this.patternFilter2.show();
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
|
@ -51,6 +51,7 @@ class EStationPlatform extends Group {
|
||||
}
|
||||
recover() {
|
||||
const style = this.model.style;
|
||||
this.showMode();
|
||||
this.setColor(style.StationStand.stationPlatform.defaultColor);
|
||||
}
|
||||
|
||||
|