diff --git a/.gitignore b/.gitignore index b3798daf9..062ff8ba4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ yarn-debug.log* yarn-error.log* package-lock.json tests/**/coverage/ +/src/utils/baseUrl.js # Editor directories and files .idea diff --git a/src/api/chat.js b/src/api/chat.js index 1c2c5a977..0cf5433f3 100644 --- a/src/api/chat.js +++ b/src/api/chat.js @@ -1,300 +1,6 @@ import request from '@/utils/request'; -export function postDataBd(data) { - return request({ - url: `/api/audio/bd?group=${data.group}&conversationId=${data.conversationId}`, - method: 'post', - data: data.file - }); -} - -// 创建/获取会话id -export function getConversation(data) { - return request({ - url: `/api/audio/conversation`, - method: 'get', - params: { - group: data.group, - userId: data.userId, - code: data.code - } - }); -} - -export function postDataXf(data) { - return request({ - url: `/api/audio/xf`, - method: 'post', - data: data - }); -} - -// 获取语音历史记录 -export function getHistoryVoice(code) { - return request({ - url: `/api/audio/${code}/history`, - method: 'get' - }); -} - -// 文字聊天 发送文字 -export function chatWithText(data, group) { - return request({ - url: `/api/jointTraining/chatWithText?group=${group}`, - method: 'post', - data: { - message: data - } - }); -} - -// 文字聊天 发送语音 -export function chatWithAudio(file, group) { - return request({ - url: `/api/jointTraining/chatWithAudio?group=${group}`, - method: 'post', - data: file - }); -} - -// 文字聊天 发送语音(新版) -export function chatWithAudioNew(file, group) { - return request({ - url: `/api/v1/jointTraining/chatWithAudio?group=${group}`, - method: 'post', - data: file - }); -} - -// 生成分发二维码 -export function getJoinTrainCode(data, group) { - return request({ - url: `/api/jointTraining/qrCode?group=${group}`, - method: 'post', - data: data - }); -} - -// 创建房间 -export function postCreateRoom(data) { - return request({ - url: `/api/jointTraining/room`, - method: 'post', - data: data - }); -} - -// 检查房间存在 -export function checkRoomExist(params) { - return request({ - url: `/api/simulationRoom`, - method: 'get', - params - }); -} - -// 获取房间详情 -export function postRoomDetail(group) { - return request({ - url: `/api/jointTraining/room/${group}`, - method: 'get' - }); -} - -// 销毁房间 -export function deljointTrainRoom(group) { - return request({ - url: `/api/jointTraining/room`, - method: 'delete', - params: { - group: group - } - }); -} - -// 查询有权限房间列表 -export function getjointTrainList(params) { - return request({ - url: `/api/jointTraining/room/list`, - method: 'get', - params: params - }); -} - -// 加入房间 -export function getjointTraining(group) { - return request({ - url: `/api/jointTraining/room/join`, - method: 'put', - params: { - group: group - } - }); -} - -// 设置人员角色 -export function putUserRoles(data, group) { - return request({ - url: `/api/jointTraining/room/user/role?group=${group}`, - method: 'put', - data: data - }); -} - -// 获取房间里的用户列表 -export function getJointTrainRoomUserList(group) { - return request({ - url: `/api/jointTraining/room/${group}/user/list`, - method: 'get' - }); -} - -// 离开房间接口 -export function putJointTrainingExit(group) { - return request({ - url: `/api/jointTraining/room/exit`, - method: 'put', - params: { - group: group - } - }); -} - -// 开始联合演练 -export function startJointTraining(group) { - return request({ - url: `/api/jointTraining/room/simulation`, - method: 'post', - params: { - group: group - } - }); -} - -// 获取个人信息 -export function getUserRoles(group) { - return request({ - url: `/api/jointTraining/room/user/role`, - method: 'get', - params: { - group: group - } - }); -} - -// 踢出用户 -export function putJointTrainingUserkicked(userId, group) { - return request({ - url: `/api/jointTraining/room/user`, - method: 'put', - params: { - userId: userId, - group: group - } - }); -} - -// 管理员结束所有人的仿真 -export function putJointTrainingSimulation(group) { - return request({ - url: `/api/jointTraining/room/simulation/all`, - method: 'put', - params: { - group: group - } - }); -} - -// 结束仿真返回房间 -export function putJointTrainingSimulationUser(group) { - return request({ - url: `/api/jointTraining/room/simulation/user/exit`, - method: 'put', - params: { - group: group - } - }); -} - -// 进入仿真 -export function putJointTrainingSimulationEntrance(group) { - return request({ - url: `/api/jointTraining/room/simulation/user/entrance`, - method: 'put', - params: { - group: group - } - }); -} - -/** - * 权限获取(房间权限) - */ -export function getPermissionJoint(group) { - return request({ - url: '/api/jointTraining/qrCode', - method: 'get', - params: { - group: group - } - }); -} - -// 添加或更新真实设备和仿真对象连接 -export function setRealDevice(group, data) { - return request({ - url: `/api/jointTraining/room/realDevice?group=${group}`, - method: 'post', - data: data - }); -} - -// 删除真实设备和仿真对象连接 -export function delRealDevice(id, group) { - return request({ - url: `/api/jointTraining/room/realDevice/${id}`, - method: 'delete', - params: { group: group } - }); -} - -// 获取真实设备列表 -export function getRealDevices(group) { - return request({ - url: `/api/jointTraining/room/${group}/devices`, - method: 'get' - }); -} - -// 获取房间真实设备连接关系 -export function getRealDevicesInRoom(group) { - return request({ - url: `/api/jointTraining/room/${group}/realDevice/connect`, - method: 'get' - }); -} - -// 更新真实设备的连接关系 -export function updateRealDevices(group, data) { - return request({ - url: `/api/jointTraining/room/${group}/realDevice`, - method: 'put', - data: data - }); -} - -// 真实设备是否被其他仿真使用 -export function realDeviceIsUsed(group, projectCode) { - return request({ - url: `/api/jointTraining/room/${group}/realDeviceUsed`, - method: 'get', - params: { - projectCode: projectCode - } - }); -} - // 获取仿真成员列表(新版地图) export function getSimulationMembersNew(group) { return request({ @@ -302,23 +8,6 @@ export function getSimulationMembersNew(group) { method: 'get' }); } - -// 获取仿真会话消息列表(新版地图) -export function getSimulationContextListNew(group, conversationId) { - return request({ - url: `/simulation/${group}/conversation/${conversationId}`, - method: 'get' - }); -} - -// 接受其他人的会话邀请 (新版地图) -export function acceptCoversitionInvite(group, conversationId) { - return request({ - url: `/simulation/${group}/${conversationId}/accept`, - method: 'put' - }); -} - /** 发起会话 */ export function startConversition(group, data, sign) { return request({ @@ -327,13 +16,6 @@ export function startConversition(group, data, sign) { data }); } -/** 根据会话id获取仿真会话 */ -export function getSimulationConversition(group, conversationId) { - return request({ - url: `/api/simulation/${group}/conversation/${conversationId}`, - method: 'get' - }); -} /** 发送会话消息 */ export function sendSimulationConversition(group, conversationId, file) { return request({ @@ -363,3 +45,11 @@ export function getAllConversition(group) { method: 'get' }); } + +/** 语音播完的接口 */ +export function overConversationMessage(group, conversationMessageId) { + return request({ + url: `/api/v1/competitionPractical/${group}/audio/over/${conversationMessageId}`, + method: 'put' + }); +} diff --git a/src/api/company.js b/src/api/company.js index a7c1ff06e..b39fcd373 100644 --- a/src/api/company.js +++ b/src/api/company.js @@ -22,13 +22,7 @@ export function deleteCompany(id) { method: 'delete' }); } -/** 根据id查询公司信心 */ -export function getCompanyById(id) { - return request({ - url: `/api/company/${id}`, - method: 'get' - }); -} + /** 更新公司信息 */ export function updateCompany(id, data) { return request({ diff --git a/src/api/competition.js b/src/api/competition.js index 194d0d9d9..248589fd9 100644 --- a/src/api/competition.js +++ b/src/api/competition.js @@ -7,20 +7,7 @@ export function refereeExitSimulation(group) { method: 'delete' }); } -/** 裁判进入仿真 */ -export function refereeEnterSimulation(group) { - return request({ - url: `/api/v1/competition/room/${group}/refree`, - method: 'post' - }); -} -/** 裁判查询竞赛人员的房间列表 */ -export function refereeGetCompetitionList(id) { - return request({ - url: `/api/v1/competition/${id}/room`, - method: 'get' - }); -} + /** 参赛者创建演练房间 */ export function participantCreatTrainingRoom(id, data) { return request({ @@ -30,23 +17,6 @@ export function participantCreatTrainingRoom(id, data) { }); } -// 加载试卷 -export function loadingPaper(competitionId, data) { - return request({ - url: `/api/v1/competition/${competitionId}/testPaper`, - method: 'post', - data - }); -} -/** 竞赛报名 */ -export function postSignUp(id, data) { - return request({ - url: `/api/race/${id}/signUp`, - method: 'post', - data - }); -} - /** 查询用户是否已经报名该竞赛 */ export function getIsSignUp(raceId, params = {}) { return request({ @@ -56,24 +26,6 @@ export function getIsSignUp(raceId, params = {}) { }); } -/** 分页查询竞赛报名人员 */ -export function getRaceUserList(params) { - return request({ - url: `/api/race/${params.raceId}/raceUser/page`, - method: 'get', - params - }); -} - -/** 裁判打分 */ -export function putRefereeScoring(data) { - return request({ - url: `/api/v1/competition/referee/scoring`, - method: 'put', - data - }); -} - /** 提交试卷 */ export function postCompetitionTheory(data) { return request({ @@ -83,14 +35,6 @@ export function postCompetitionTheory(data) { }); } -/** 查询本竞赛用的实操列表 */ -export function getCompetitionPractical(competitionId) { - return request({ - url: `/api/v1/competitionPractical/competition/${competitionId}`, - method: 'get' - }); -} - /** 查询竞赛报名人员详情 */ export function getRaceUserById(raceId) { return request({ @@ -169,68 +113,6 @@ export function getPracticalCompetitionResult(competitionId) { }); } -/** 回访准备 */ -export function playBackReady(params) { - return request({ - url: `/api/v1/simulationRecord/playback/ready`, - method: 'get', - params - }); -} - -/** 设置倍速 */ -export function setPlaySpeed(params) { - return request({ - url: `/api/v1/simulationRecord/playback/setPlaySpeed`, - method: 'get', - params - }); -} - -/** 开始播放 */ -export function startPlaying(params) { - return request({ - url: `/api/v1/simulationRecord/playback/startPlaying`, - method: 'get', - params - }); -} - -/** 暂停播放 */ -export function playingPause(params) { - return request({ - url: `/api/v1/simulationRecord/playback/pausePlaying`, - method: 'get', - params - }); -} - -/** 结束播放 */ -export function endPlaying(params) { - return request({ - url: `/api/v1/simulationRecord/playback/endPlaying`, - method: 'get', - params - }); -} - -/** 从暂停中播放 */ -export function fromPauseToPlay(params) { - return request({ - url: `/api/v1/simulationRecord/playback/playing`, - method: 'get', - params - }); -} - -/** 裁判查询理论考试结果 */ -export function getTheroyCompetitionResult(competitionId, raceUserId) { - return request({ - url: `api/v1/competitionTheory/detail/competition/${competitionId}/raceUser/${raceUserId}`, - method: 'get' - }); -} - // 以下drts项目使用 /** 项目获取试题列表 */ @@ -360,3 +242,21 @@ export function getEmptyOperationalStatistics(group) { }); } +/** 草稿场景数据导入*/ +export function postSceneImport(scriptId, name, data) { + return request({ + url: `/api/v1/competitionPractical/${scriptId}/import?name=${name}`, + method: 'post', + data: data, + time: 60000 + }); +} + +/** 草稿场景数据导出 */ +export function getSceneExport(id) { + return request({ + url: `/api/v1/competitionPractical/${id}/export`, + method: 'get' + }); +} + diff --git a/src/api/designPlatform.js b/src/api/designPlatform.js index 3582533a6..985d6a6e8 100644 --- a/src/api/designPlatform.js +++ b/src/api/designPlatform.js @@ -138,37 +138,10 @@ export function previewRunPlan(planId) { }); } -/** 加载剧本 */ -export function loadDraftScript(scriptId, memberId, group) { - return request({ - url: `/api/simulation/${group}/scriptDraft/${scriptId}?memberId=${memberId}`, - method: 'post' - }); -} - /** 剧本预览选择角色 */ export function loadDraftScriptNew(memberId, group) { return request({ - // url: `/simulation/${group}/choosePlay?memberId=${memberId}`, url: `/api/scriptSimulation/${group}/chooseMemberAndStart?memberId=${memberId}`, method: 'put' }); } - -/** 剧本预览选择角色 */ -export function loadDraftScriptNewMode(memberId, group, mode) { - return request({ - // url: `/simulation/${group}/choosePlay?memberId=${memberId}`, - url: `/api/scriptSimulation/${group}/chooseMemberAndStart?memberId=${memberId}&mode=${mode}`, - method: 'put' - }); -} - -/** 获取已发布的有地图的城市列表*/ -export function publisMapCityList(data) { - return request({ - url: `/api/map/city?dicCode=${data}`, - method: 'get' - }); -} - diff --git a/src/api/jmap/lesson.js b/src/api/jmap/lesson.js index 12d67929d..e1960957f 100644 --- a/src/api/jmap/lesson.js +++ b/src/api/jmap/lesson.js @@ -95,3 +95,10 @@ export function aKeyGeneratingLesson(data) { data: data }); } +/** 根据课程ID获取班级 */ +export function getExamClassList(lessonId) { + return request({ + url: `/api/lesson/${lessonId}/classes`, + method: 'get' + }); +} diff --git a/src/api/jmap/lessondraft.js b/src/api/jmap/lessondraft.js index 7c8a9bb9e..e1a1475ec 100644 --- a/src/api/jmap/lessondraft.js +++ b/src/api/jmap/lessondraft.js @@ -85,15 +85,6 @@ export function getLessonChapterDetail(data) { }); } -/** 发布课程*/ -export function publishLesson(data) { - return request({ - url: `/api/lessonDraft/${data.id}/publish`, - method: 'post', - data: data - }); -} - /** 课程章节拖拽排序*/ export function dragSortLessonChapter(data) { return request({ diff --git a/src/api/jmap/map.js b/src/api/jmap/map.js index 0ded2d724..9acfc87ba 100644 --- a/src/api/jmap/map.js +++ b/src/api/jmap/map.js @@ -16,14 +16,6 @@ export function getPublishMapListOnline() { }); } -/** 根据皮肤获取发布地图列表*/ -export function getPublishMapListByLineCode(lineCode) { - return request({ - url: `/api/map/${lineCode}/list`, - method: 'get' - }); -} - /** 根据地图id获取地图版本信息*/ export function getPublishMapVersionById(id) { return request({ @@ -107,15 +99,6 @@ export function putMapOffLine(mapId) { }); } -// /** 修改发布地图名称*/ -// export function updatePublishMapName(data) { -// return request({ -// url: `/api/map/${data.mapId}/updateName`, -// method: 'put', -// data: data -// }); -// } - // 检测地图名称唯一性 export function checkMapName(name) { return request({ @@ -133,23 +116,6 @@ export function getPublishMapDetailList(params, code) { }); } -/** 获取有屏蔽门的站台列表*/ -export function hasDoorStationList(mapId) { - return request({ - url: `/api/map/${mapId}/stand/hasDoor`, - method: 'get' - }); -} - -// /** 修改发布地图城市*/ -// export function updatePublishMapCity(data) { -// return request({ -// url: `/api/map/${data.mapId}/city`, -// method: 'put', -// data: data -// }); -// } - // 修改地图基本信息 export function updatePublishMapInfo(data) { return request({ @@ -254,3 +220,19 @@ export function getStandListByStationCode(id, stationCode) { method: 'get' }); } + +/** 获取已发布的有地图的城市列表*/ +export function publisMapCityList(data) { + return request({ + url: `/api/map/city?dicCode=${data}`, + method: 'get' + }); +} + +/** 新版地图根据仿真mapId获取仿真地图数据 */ +export function getNewMapDataByMapId(mapId) { + return request({ + url: `/api/map/${mapId}/mapData`, + method: 'get' + }); +} diff --git a/src/api/jmap/mapdraft.js b/src/api/jmap/mapdraft.js index 97d180405..0332b4ef4 100644 --- a/src/api/jmap/mapdraft.js +++ b/src/api/jmap/mapdraft.js @@ -60,15 +60,6 @@ export function saveMap(data) { }); } -// 保存新草稿地图 -// export function saveNewMap(data) { -// return request({ -// url: `/api/mapBuild/${data.mapId}/saveNewElements`, -// method: 'post', -// data: data -// }); -// } - /** 草稿地图另存为*/ export function saveAsMap(data) { return request({ @@ -124,78 +115,6 @@ export function getBuildMapExport(mapId) { }); } -/** 查询进路列表*/ -export function listRouteRoute(mapId, params) { - return request({ - url: `/api/mapBuild/${mapId}/route`, - method: 'get', - params: params - }); -} -/** 查询进路地图列表*/ -export function listRouteMapRoute(mapId) { - return request({ - url: `/api/mapBuild/${mapId}/route/all`, - method: 'get' - }); -} -/** 查询进路明细*/ -export function queryRouteRouteDetail(data) { - return request({ - url: `/api/mapBuild/route/${data.id}`, - method: 'get' - }); -} -/** 创建进路*/ -export function createRouteRoute(data) { - return request({ - url: `/api/mapBuild/route`, - method: 'post', - data: data - }); -} -/** 删除进路*/ -export function deleteRouteRoute(id) { - return request({ - url: `/api/mapBuild/route/${id}`, - method: 'delete' - }); -} -/** 更新进路*/ -export function updateRouteRoute(data) { - return request({ - url: `/api/mapBuild/route/${data.id}`, - method: 'put', - data: data - }); -} - -/** 创建联动道岔*/ -export function createLinkageSwitch(data) { - return request({ - url: `/api/mapBuild/switchCoupled`, - method: 'post', - data: data - }); -} - -/** 删除联动道岔*/ -export function deleteLinkageSwitch(coupleId) { - return request({ - url: `/api/mapBuild/switchCoupled/${coupleId}`, - method: 'delete' - }); -} - -/** get联动道岔列表*/ -export function listLinkageSwitch(mapId, params) { - return request({ - url: `/api/mapBuild/${mapId}/switchCoupled`, - method: 'get', - params: params - }); -} - /** 草稿地图数据校验*/ export function verifyMap(id) { return request({ @@ -204,49 +123,6 @@ export function verifyMap(id) { }); } -/** 分页查询交路数据*/ -export function listRouting(mapId, params) { - return request({ - url: `/api/mapBuild/${mapId}/routing`, - method: 'get', - params: params - }); -} - -/** 创建交路*/ -export function addRouting(data) { - return request({ - url: `/api/mapBuild/routing`, - method: 'post', - data: data - }); -} - -/** 删除交路*/ -export function deleteRouting(routingId) { - return request({ - url: `/api/mapBuild/routing/${routingId}`, - method: 'delete' - }); -} - -/** 获取交路详情*/ -export function getRouting(routingId) { - return request({ - url: `/api/mapBuild/routing/${routingId}`, - method: 'get' - }); -} - -/** 更新交路*/ -export function updateRouting(data) { - return request({ - url: `/api/mapBuild/routing/${data.id}`, - method: 'put', - data: data - }); -} - /** 分页查询交路数据(新版)*/ export function listRoutingData(mapId, params) { return request({ @@ -307,49 +183,6 @@ export function generateStationRunData(routingId) { }); } -// 创建自动信号 old(旧数据) -export function postAutoSignal(data) { - return request({ - url: `/api/mapBuild/autoSignal`, - method: 'post', - data: data - }); -} - -// 删除自动信号 old(旧数据) -export function delAutoSignal(autoSignalId) { - return request({ - url: `/api/mapBuild/autoSignal/${autoSignalId}`, - method: 'delete' - }); -} - -// 分页获取自动信号列表 old(旧数据) -export function getAutoSignalList(mapId, params) { - return request({ - url: `/api/mapBuild/${mapId}/autoSignal`, - method: 'get', - params - }); -} - -// 获取自动信号详情 old(旧数据) -export function getAutoSignalDetail(autoSignalId) { - return request({ - url: `/api/mapBuild/autoSignal/${autoSignalId}`, - method: 'get' - }); -} - -// 更新自动信号 old(旧数据) -export function putAutoSignal(data) { - return request({ - url: `/api/mapBuild/autoSignal/${data.autoSignalId}`, - method: 'put', - data: data - }); -} - // 分页获取自动信号列表 new(新数据) export function getAutoSignalListNew(mapId, params) { return request({ @@ -392,14 +225,6 @@ export function putAutoSignalNew(data) { data: data }); } - -export function getListByCityCode(cityCode) { - return request({ - url: `/api/mapBuild/${cityCode}/list`, - method: 'get' - }); -} - // 创建信号机接近区段 export function postApproachSection(data) { return request({ @@ -464,12 +289,6 @@ export function delContinueProtect(id) { method: 'delete' }); } -export function getContinueProtectById(id) { - return request({ - url: `/api/mapBuild/overlap/${id}`, - method: 'get' - }); -} export function getContinueProtectList(mapId, params) { return request({ url: `/api/mapBuild/${mapId}/overlap/paging`, @@ -545,15 +364,6 @@ export function getRouteNewList(mapId, params) { params }); } -// 获取自动折返分组列表 -export function getAutoReentryGroupList(mapId, params) { - return request({ - url: `/api/mapBuild/${mapId}/autoReentry/group/reentryTrack`, - method: 'get', - params - }); -} - // 新建进路侧防 export function postFlankProtection(data) { return request({ diff --git a/src/api/jmap/pathunit.js b/src/api/jmap/pathunit.js index e0a4ab3f3..c5bc487f2 100644 --- a/src/api/jmap/pathunit.js +++ b/src/api/jmap/pathunit.js @@ -1,44 +1,2 @@ -import request from '@/utils/request'; +// import request from '@/utils/request'; -/** 获取路径单元列表*/ -export function getRouteUnitList(id, data) { - return request({ - url: `/api/mapBuild/${id}/routeUnit`, - method: 'get', - params: data - }); -} - -/** 创建路径单元*/ -export function addRouteUnit(data) { - return request({ - url: `/api/mapBuild/routeUnit`, - method: 'post', - data: data - }); -} - -/** 删除路径单元*/ -export function delRouteUnit(id) { - return request({ - url: `/api/mapBuild/routeUnit/${id}`, - method: 'DELETE' - }); -} - -/** 获取路径单元*/ -export function getRouteUnit(id) { - return request({ - url: `/api/mapBuild/routeUnit/${id}`, - method: 'get' - }); -} - -/** 更新路径单元*/ -export function setRouteUnit(data) { - return request({ - url: `/api/mapBuild/routeUnit/${data.id}`, - method: 'put', - data: data - }); -} diff --git a/src/api/jmap/training.js b/src/api/jmap/training.js index ec7c4584e..280a8c200 100644 --- a/src/api/jmap/training.js +++ b/src/api/jmap/training.js @@ -1,29 +1,5 @@ import request from '@/utils/request'; -/** 开始实训 0*/ -export function startTraining(args, group) { - return request({ - url: `/api/training/${args.id}/start`, - method: 'get', - params: { - group - } - }); -} - -/** 实训结束*/ -export function endTraining(args, group) { - return request({ - url: `/api/training/${args.lessonId}/${args.id}/end`, - method: 'get', - params: { - mode: args.mode, - usedTime: args.usedTime, - group - } - }); -} - /** 发送步骤数据*/ export function sendTrainingNextStep(data, group) { return request({ @@ -35,32 +11,6 @@ export function sendTrainingNextStep(data, group) { } }); } -/** 获取章节基本信息 0*/ -export function getTrainingDetail(trainingId) { - return request({ - url: `/api/training/${trainingId}`, - method: 'get' - }); -} - -/** 添加实训 0*/ -export function addTraining(data) { - return request({ - url: '/api/training', - method: 'post', - data: data - }); -} - -/** 获取实训步骤数据 0*/ -export function getTrainingStepsDetail(trainingId, params) { - return request({ - url: `/api/training/${trainingId}/detail`, - method: 'get', - params: params - }); -} - /** 查询实训列表 0*/ export function pageQueryTraining(params) { return request({ @@ -69,41 +19,6 @@ export function pageQueryTraining(params) { params: params }); } -/** 自动生成实训操作 0*/ -export function addAutoTraining(data) { - return request({ - url: `/api/training/generate`, - method: 'post', - data: data - }); -} - -/** 修改自动删除实训操作 0*/ -export function updateAutoTraining(data) { - return request({ - url: `/api/training/batchUpdateGenerate`, - method: 'put', - data: data - }); -} -/** 删除自动生成实训 0*/ -export function deleteAutoTraining(params) { - return request({ - url: `/api/training/generate`, - method: 'delete', - params: params - }); -} - -/** 获取用户实训列表 0*/ -export function getTrainingList(data) { - return request({ - url: `/api/training/list`, - method: 'get', - params: data - }); -} - export function sendCommand(group, command) { return request({ url: `/api/training/deviceChange?group=${group}`, @@ -125,29 +40,6 @@ export function sendCommandNew(group, commandDefinitionId, command) { data: command }); } -// 添加用户实训数据 0 -export function addUserTraining(data) { - return request({ - url: `/api/training/userTraining`, - method: 'post', - data: data - }); -} -// 更新用户实训数据 0 -export function putUserTraining(data) { - return request({ - url: `/api/training/userTraining/${data.id}`, - method: 'put', - data: data - }); -} -// 清除实训数据 0 -export function deleteUserTraining(statsId) { - return request({ - url: `/api/training/userTraining/${statsId}`, - method: 'delete' - }); -} /** 开始实训 (新版地图) */ export function startTrainingNew (args, group) { @@ -184,7 +76,8 @@ export function getTrainingDetailNew(trainingId) { url: `/api/v1/training/${trainingId}`, method: 'get' }); -}/** 添加实训(新版地图) */ +} +/** 添加实训(新版地图) */ export function addTrainingNew(data) { return request({ url: '/api/v1/training', diff --git a/src/api/jointTraining.js b/src/api/jointTraining.js index 7c77e7245..ebd203cff 100644 --- a/src/api/jointTraining.js +++ b/src/api/jointTraining.js @@ -1,34 +1,5 @@ import request from '@/utils/request'; -// 文字聊天 发送文字 -export function chatWithTextNew(data, group) { - return request({ - url: `/api/v1/jointTraining/chatWithText?group=${group}`, - method: 'post', - data: { - message: data - } - }); -} - -// 生成分发二维码 -export function getJoinTrainCodeNew(data, group) { - return request({ - url: `/api/v1/jointTraining/qrCode?group=${group}`, - method: 'post', - data: data - }); -} - -// 创建房间 -export function postCreateRoomNew(data) { - return request({ - url: `/api/v1/jointTraining/room`, - method: 'post', - data: data - }); -} - // 检查房间存在 export function checkRoomExistNew(params) { return request({ @@ -38,45 +9,6 @@ export function checkRoomExistNew(params) { }); } -// 获取房间详情 -export function postRoomDetailNew(group) { - return request({ - url: `/api/v1/jointTraining/room/${group}`, - method: 'get' - }); -} - -// 销毁房间 -export function deljointTrainRoomNew(group) { - return request({ - url: `/api/v1/jointTraining/room`, - method: 'delete', - params: { - group: group - } - }); -} - -// 查询有权限房间列表 -export function getjointTrainListNew(params) { - return request({ - url: `/api/v1/jointTraining/room/list`, - method: 'get', - params: params - }); -} - -// 加入房间 -export function getjointTrainingNew(group) { - return request({ - url: `/api/v1/jointTraining/room/join`, - method: 'put', - params: { - group: group - } - }); -} - // 设置人员角色 export function putUserRolesNew(data, group) { return request({ @@ -86,70 +18,6 @@ export function putUserRolesNew(data, group) { }); } -// 获取房间里的用户列表 -export function getJointTrainRoomUserListNew(group) { - return request({ - url: `/api/v1/jointTraining/room/${group}/user/list`, - method: 'get' - }); -} - -// 离开房间接口 -export function putJointTrainingExitNew(group) { - return request({ - url: `/api/v1/jointTraining/room/exit`, - method: 'put', - params: { - group: group - } - }); -} - -// 开始联合演练 -export function startJointTrainingNew(group) { - return request({ - url: `/api/v1/jointTraining/room/simulation`, - method: 'post', - params: { - group: group - } - }); -} - -// 获取个人信息 -export function getUserRolesNew(group) { - return request({ - url: `/api/v1/jointTraining/room/user/role`, - method: 'get', - params: { - group: group - } - }); -} - -// 踢出用户 -export function putJointTrainingUserkickedNew(userId, group) { - return request({ - url: `/api/v1/jointTraining/room/user`, - method: 'put', - params: { - userId: userId, - group: group - } - }); -} - -// 管理员结束所有人的仿真 -export function putJointTrainingSimulationNew(group) { - return request({ - url: `/api/v1/jointTraining/room/simulation/all`, - method: 'put', - params: { - group: group - } - }); -} - // 结束仿真返回房间 export function putJointTrainingSimulationUserNew(group) { return request({ @@ -160,90 +28,3 @@ export function putJointTrainingSimulationUserNew(group) { } }); } - -// 进入仿真 -export function putJointTrainingSimulationEntranceNew(group) { - return request({ - url: `/api/v1/jointTraining/room/simulation/user/entrance`, - method: 'put', - params: { - group: group - } - }); -} - -/** - * 权限获取(房间权限) - */ -export function getPermissionJointNew(group) { - return request({ - url: '/api/v1/jointTraining/qrCode', - method: 'get', - params: { - group: group - } - }); -} - -// 添加或更新真实设备和仿真对象连接 -export function setRealDeviceNew(group, data) { - return request({ - url: `/api/v1/jointTraining/room/realDevice?group=${group}`, - method: 'post', - data: data - }); -} - -// 删除真实设备和仿真对象连接 -export function delRealDeviceNew(id, group) { - return request({ - url: `/api/v1/jointTraining/room/realDevice/${id}`, - method: 'delete', - params: { group: group } - }); -} - -// 获取真实设备列表 -export function getRealDevicesNew(group) { - return request({ - url: `/api/v1/jointTraining/room/${group}/devices`, - method: 'get' - }); -} - -// 获取房间真实设备连接关系 -export function getRealDevicesInRoomNew(group) { - return request({ - url: `/api/v1/jointTraining/room/${group}/realDevice/connect`, - method: 'get' - }); -} - -// 更新真实设备的连接关系 -export function updateRealDevicesNew(group, data) { - return request({ - url: `/api/v1/jointTraining/room/${group}/realDevice`, - method: 'put', - data: data - }); -} - -// 真实设备是否被其他仿真使用 -export function realDeviceIsUsedNew(group, projectCode) { - return request({ - url: `/api/v1/jointTraining/room/${group}/realDeviceUsed`, - method: 'get', - params: { - projectCode: projectCode - } - }); -} - -// 获取所有需要值班员的车站(新版) -export function getAvailableStaionList(mapId) { - return request({ - url: `/api/map/${mapId}/station/needSupervisor`, - method: 'get' - }); -} - diff --git a/src/api/management/author.js b/src/api/management/author.js index 4b65a86e5..e580cf508 100644 --- a/src/api/management/author.js +++ b/src/api/management/author.js @@ -10,15 +10,6 @@ export function getLessonPermissonPageList(params) { }); } -/** 创建课程权限*/ -export function createLessonPermisson(data) { - return request({ - url: '/api/permission', - method: 'post', - data: data - }); -} - /** 获取权限详情*/ export function getPermissonDetail(id) { return request({ @@ -44,14 +35,6 @@ export function postPermissonList(mapId) { }); } -/** 获取用户某课程某段时间内可用的权限数量*/ -export function getTotalRemains(params) { - return request({ - url: '/api/userPermission/totalRemains', - method: 'get', - params: params - }); -} /** 设置权限失效或有效*/ export function setLessonPermisson(data) { return request({ @@ -61,25 +44,7 @@ export function setLessonPermisson(data) { }); } -/** 设置权限失效或有效*/ -export function getPermissionList(id) { - return request({ - url: `/api/permission/${id}`, - method: 'get' - }); -} - -/** 获取大屏权限列表*/ -export function queryPermissionScreen() { - return request({ - url: `/api/userPermission/bigScreen`, - method: 'get' - }); -} - -/** - * 用户权限列表 - */ +/** 用户权限列表*/ export function listPermision(params) { return request({ url: `/api/userPermission`, @@ -88,9 +53,7 @@ export function listPermision(params) { }); } -/** - * 个人权限列表 - */ +/** 个人权限列表*/ export function listUserPermision(params) { return request({ url: `/api/userPermission/my`, @@ -99,14 +62,6 @@ export function listUserPermision(params) { }); } -/** 用户权限列表 */ -export function getDistribute(id) { - return request({ - url: `/api/distribute/${id}`, - method: 'get' - }); -} - /** 设置权限所有者 */ export function putPermissionOwner(data) { return request({ diff --git a/src/api/management/dictionary.js b/src/api/management/dictionary.js index ea2446efd..f1d4b1d0c 100644 --- a/src/api/management/dictionary.js +++ b/src/api/management/dictionary.js @@ -48,10 +48,7 @@ export function update(data) { }); } -/** - * 根据字典code获取明细列表 - * @param {*} code - */ +/** 根据字典code获取明细列表*/ export function getDetailList(code) { return request({ url: '/api/dictionary/getDetailListByCode', diff --git a/src/api/management/distribute.js b/src/api/management/distribute.js index 152c27809..97c19a813 100644 --- a/src/api/management/distribute.js +++ b/src/api/management/distribute.js @@ -1,32 +1,5 @@ import request from '@/utils/request'; -/** 权限转增*/ -export function getLessons(data) { - return request({ - url: '/api/distribute/getLessons', - method: 'get', - data: data - }); -} - -/** 权限分发*/ -export function giveLessons(data) { - return request({ - url: '/api/distribute/distribute', - method: 'post', - data: data - }); -} - -/** 权限转增*/ -export function permissionTurnAdd(data) { - return request({ - url: '/api/distribute/transfer', - method: 'post', - data: data - }); -} - /** 权限获取*/ export function getPermission(state) { return request({ @@ -35,24 +8,6 @@ export function getPermission(state) { }); } -/** 接收课程权限*/ -export function receiveLessons(data) { - return request({ - url: '/api/distribute/receiveLessons', - method: 'get', - data: data - }); -} - -/** 考试权限分发*/ -export function giveExams(data) { - return request({ - url: `/api/distribute/giveExams`, - method: 'post', - data: data - }); -} - /** 权限打包分页查询*/ export function listPackagePermission(params) { return request({ @@ -62,15 +17,6 @@ export function listPackagePermission(params) { }); } -/** 打包权限*/ -export function packagePermissionDistribute(data) { - return request({ - url: `/api/distribute/givePermission/package`, - method: 'post', - data: data - }); -} - /** 权限回收*/ export function restorePackagePermission(id) { return request({ @@ -97,32 +43,6 @@ export function getPermissionPackageDetail(id, params) { }); } -/** 权限分发打包*/ -export function permissionDistributePackage(data) { - return request({ - url: `/api/distribute/package`, - method: 'post', - data: data - }); -} - -/** 权限分发解包*/ -export function permissionDistributeUnPackage(permissionId) { - return request({ - url: `/api/distribute/${permissionId}/unPackage`, - method: 'delete' - }); -} - -/** 查询可打包的权限分发*/ -export function listCanPackagePermission(params) { - return request({ - url: `/api/distribute/package`, - method: 'get', - params: params - }); -} - // 设置权限分发列表 权限失效 export function setCommodityStatus(id) { return request({ @@ -148,11 +68,3 @@ export function givePermission(data) { data: data }); } - -/** 查询权限分发领取用户列表 */ -export function distributeUsers(distributeId) { - return request({ - url: `/api/distribute/${distributeId}/distributeUsers`, - method: 'get' - }); -} diff --git a/src/api/management/exam.js b/src/api/management/exam.js index 51d0ac757..88e2b9b4f 100644 --- a/src/api/management/exam.js +++ b/src/api/management/exam.js @@ -93,19 +93,3 @@ export function updateExamRules(data) { data: data }); } - -/** 根据课程ID获取试卷 */ -export function getExamParperList(lessonId) { - return request({ - url: `/api/exam/${lessonId}/list`, - method: 'get' - }); -} - -/** 根据课程ID获取班级 */ -export function getExamClassList(lessonId) { - return request({ - url: `/api/lesson/${lessonId}/classes`, - method: 'get' - }); -} diff --git a/src/api/management/goods.js b/src/api/management/goods.js index ae1a9ff6a..aeb3d25a4 100644 --- a/src/api/management/goods.js +++ b/src/api/management/goods.js @@ -9,9 +9,7 @@ export function getCommodityDetailByParams(data) { }); } -/** - * 获取商品明细列表 - */ +/** 获取商品明细列表*/ export function getCommodityList(params) { return request({ url: '/api/goods', @@ -20,20 +18,7 @@ export function getCommodityList(params) { }); } -/** - * 保存商品明细列表 - */ -export function saveCommodityList(params) { - return request({ - url: '/api/goods', - method: 'post', - data: params - }); -} - -/** - * 删除商品明细 - */ +/** 删除商品明细*/ export function delCommodity(id) { return request({ url: `/api/goods/${id}`, @@ -41,29 +26,7 @@ export function delCommodity(id) { }); } -/** - * 获取商品地图,产品,课程列表 - */ -export function getMapLesson() { - return request({ - url: `/api/goods/tree`, - method: 'get' - }); -} - -/** - * 获取商品地图,产品,课程列表 - */ -export function getCommodityDetailById(id) { - return request({ - url: `/api/goods/${id}`, - method: 'get' - }); -} - -/** - * 获取商品地图,产品,课程列表 - */ +/** 获取商品地图,产品,课程列表*/ export function updataCommodityList(data) { return request({ url: `/api/goods/${data.id}`, @@ -72,9 +35,7 @@ export function updataCommodityList(data) { }); } -/** - * 设置失效或有效切换 - */ +/** 设置失效或有效切换*/ export function setCommodityStatus(id) { return request({ url: `/api/goods/${id}/status`, @@ -110,44 +71,6 @@ export function getGoodsList() { }); } -// 根据权限id查询商品 -export function getGoodsByPermissionId(id) { - return request({ - url: `/api/goods/permissionId`, - method: 'get', - params: { - permissionId: id - } - }); -} - -// 创建商品 -export function postsPermissionGoods(data) { - return request({ - // url: `/api/goods`, - url: `/api/goods/create/list`, - method: 'post', - data: data - }); -} - -// 创建万能权限商品 -export function postPermissionIdsGoods(data) { - return request({ - url: `/api/goods/permissionIds`, - method: 'post', - data: data - }); -} - -// 创建万能权限商品 -export function postCreatePackage(data) { - return request({ - url: `/api/goods/create/package`, - method: 'post', - data: data - }); -} // 获取订单对应的商品列表 export function getGoodsListByOrderId(id) { return request({ diff --git a/src/api/management/mapline.js b/src/api/management/mapline.js index baf989ed9..f3b2acc6d 100644 --- a/src/api/management/mapline.js +++ b/src/api/management/mapline.js @@ -26,14 +26,6 @@ export function delSkinCode(id) { }); } -/** 根据id查询真实线路 */ -export function querySkinCode(id) { - return request({ - url: `/api/realLine/${id}`, - method: 'get' - }); -} - /** 修改真实线路*/ export function updateSkinCode(data) { return request({ @@ -60,23 +52,6 @@ export function putRealLineConfig(id, data) { }); } -/** 通过皮肤Code更新地图皮肤*/ -export function updateSkinCodeByCode(data) { - return request({ - url: `/api/realLine/${data.code}/update`, - method: 'put', - data: data - }); -} - -/** 检查code是否存在*/ -export function querySkinCodeExistByCode(code) { - return request({ - url: `/api/realLine/${code}/exist`, - method: 'get' - }); -} - /** 获取真实线路列表*/ export function getLineCodeList() { return request({ diff --git a/src/api/management/order.js b/src/api/management/order.js index 1c8d91a9f..519a15197 100644 --- a/src/api/management/order.js +++ b/src/api/management/order.js @@ -10,15 +10,6 @@ export function getOrderPageList(params) { }); } -/** 根据ID获取订单数据*/ -export function getOrderDetail(id, params) { - return request({ - url: `/api/order/${id}`, - method: 'get', - params: params - }); -} - /** 创建一个订单*/ export function createOrder(data) { return request({ @@ -37,31 +28,6 @@ export function updateOrder(data) { }); } -export function deleteOrder(id) { - return request({ - url: `/api/order/${id}`, - method: 'delete' - }); -} - -/** 订单权限领取*/ -export function getOrder(params) { - return request({ - url: '/api/order/getOrder', - method: 'get', - params: params - }); -} - -/** 订单权限分发*/ -export function giveOrder(data) { - return request({ - url: '/api/order/giveOrder', - method: 'post', - data: data - }); -} - /** 订单续费*/ export function getOrderCharge(id) { return request({ @@ -104,14 +70,6 @@ export function cancalOrder(orderId) { }); } -// 万能权限查询权限包商品 -export function postFindPermission(ids) { - return request({ - url: `/api/goods/permissionIds?ids=${ids}`, - method: 'get' - }); -} - // 获取订单的分发二维码 export function getDistributeFromOrder(orderCode) { return request({ diff --git a/src/api/management/user.js b/src/api/management/user.js index 62f0f5af3..910e2113f 100644 --- a/src/api/management/user.js +++ b/src/api/management/user.js @@ -1,29 +1,4 @@ import request from '@/utils/request'; -/** 注册用户*/ -export function createUserInfo(data) { - return request({ - url: '/api/userinfo/create', - method: 'put', - data: data - }); -} -/** 根据用户Id获取用户信息*/ -export function getUserInfoByOpenId(params) { - return request({ - url: '/api/userinfo/getByOpenId', - method: 'get', - params: params - }); -} - -/** 根据姓名或者手机号查询用户*/ -export function getUserInfoByNameOrMobile(params) { - return request({ - url: '/api/userinfo/nameOrMobile', - method: 'get', - params: params - }); -} /** 查询用户参数*/ export function getUserConfigInfo() { @@ -33,15 +8,6 @@ export function getUserConfigInfo() { }); } -/** 设置用户参数*/ -export function setUserConfigInfo(data) { - return request({ - url: '/api/user/config', - method: 'post', - data: data - }); -} - /** 获取销售列表*/ export function getSellerList() { return request({ @@ -85,10 +51,10 @@ export function saveUserSubscribe(data) { }); } -// 修改用户权限 +// 修改用户信息 export function putRoles(data) { return request({ - url: `/api/user/${data.id}/role`, + url: `/api/user/${data.id}/info`, method: 'put', data: data }); @@ -211,14 +177,6 @@ export function exportStudentResults(projectCode, data) { data: data }); } -// 生成绑定微信二维码 -export function getWxQrCode(params) { - return request({ - url: `/api/user/wmurl`, - method: 'get', - params: params - }); -} // 获取微信小程序绑定二维码 export function getBindWxQrCodeUrl() { diff --git a/src/api/management/userexam.js b/src/api/management/userexam.js index ec588788c..584a2745d 100644 --- a/src/api/management/userexam.js +++ b/src/api/management/userexam.js @@ -51,22 +51,6 @@ export function delPublishExam(id) { }); } -/** 删除用户实训*/ -export function delTrainingList() { - return request({ - url: `/api/userExam/list`, - method: 'delet' - }); -} - -/** 设置试卷失效 */ -export function setExamGive(id) { - return request({ - url: `/api/userExam/${id}/abandon`, - method: 'put' - }); -} - export function updateExam(data) { return request({ url: `/api/userExam/${data.id}`, diff --git a/src/api/project.js b/src/api/project.js index d80bfdab0..480992756 100644 --- a/src/api/project.js +++ b/src/api/project.js @@ -23,13 +23,6 @@ export function getProjectDeviceList(params) { params:params }); } -// export function getProjectDeviceList(params) { -// return request({ -// url: `/api/device/paging`, -// method: 'get', -// params:params -// }); -// } /** 删除项目设备 */ export function deleteProjectDevice(id) { return request({ @@ -92,14 +85,7 @@ export function setPscConfig(id, data) { data: data }); } -/** 查询项目下的所有设备 */ -export function getAllDeviceInProject(params) { - return request({ - url: `/api/project/device/project`, - method: 'get', - params - }); -} + /** 添加/修改ibp设备配置 */ export function setVrIbpConfig(id, data) { return request({ @@ -183,3 +169,11 @@ export function setSandboxConfig(id, data) { data: data }); } +/** 添加/修改联锁工作站配置 */ +export function setIlwConfig(id, data) { + return request({ + url: `/api/device/${id}/config/ilw`, + method: 'put', + data: data + }); +} diff --git a/src/api/pushMessage.js b/src/api/pushMessage.js index bf435773e..0a13502d1 100644 --- a/src/api/pushMessage.js +++ b/src/api/pushMessage.js @@ -15,3 +15,43 @@ export function pushSysNotice(data) { data }); } + +export function postLicense(data) { + return request({ + url: `/api/license`, + method: 'post', + data + }); +} + +export function postLicenseValidate(data) { + return request({ + url: `/api/license/validate`, + method: 'post', + // baseURL: 'https://joylink.club/jlcloud', + data + }); +} + +export function postLicenseLocal(data) { + return request({ + url: `/api/license/local`, + method: 'post', + data + }); +} + +export function getPagingQueryList(params) { + return request({ + url: `/api/license/pagingQuery`, + method: 'get', + params + }); +} + +export function putLicenseValid(id) { + return request({ + url: `/api/license/${id}/invalidating`, + method: 'put' + }); +} diff --git a/src/api/questionsRule.js b/src/api/questionsRule.js index a9d6668e7..4bd9c236c 100644 --- a/src/api/questionsRule.js +++ b/src/api/questionsRule.js @@ -1,12 +1,5 @@ import request from '@/utils/request'; -/** 获取出题规则列表 */ -export function getQuestionRuleList() { - return request({ - url: `/api/questionsRule`, - method: 'get' - }); -} /** 添加出题规则 */ export function addQuestionRule(data) { return request({ @@ -30,13 +23,7 @@ export function deleteQuestionRule(id) { method: 'delete' }); } -/** 查询单个出题规则 */ -export function selectedQuestionRule(id) { - return request({ - url: `/api/questionsRule/${id}`, - method: 'get' - }); -} + /** 更改出题规则内容 */ export function updateQuestionRule(id, data) { return request({ diff --git a/src/api/race.js b/src/api/race.js index 0badd499c..c5f6bc3ef 100644 --- a/src/api/race.js +++ b/src/api/race.js @@ -1,43 +1,17 @@ import request from '@/utils/request'; -/** 分页查询竞赛 */ -export function getRaceList(params) { - return request({ - url: `/api/race`, - method: 'get', - params: params - }); -} -/** 创建竞赛 */ -export function createRace(data) { - return request({ - url: `/api/race`, - method: 'post', - data - }); -} -/** 修改竞赛信息 */ -export function updateRace(id, data) { - return request({ - url: `/api/race/${id}`, - method: 'put', - data - }); -} - -// /** 获取实操试题列表(题库)*/ -// export function getPracticeList(params) { -// return request({ -// url: `/api/v1/competitionPractical`, -// method: 'get', -// params -// }); -// } /** 导入项目试题库 */ -export function importQuestionBand(data, projectCode) { +export function importQuestionBand(data, companyId) { return request({ - url: `/api/questionBank/project/${projectCode}/questions`, + url: `/api/questionBank/questions/import?id=${companyId}`, method: 'post', data }); } +/** 查询公司下题目类型数量 */ +export function selectQuestionTypeNum(companyId) { + return request({ + url: `/api/questionBank/type/number?companyId=${companyId}`, + method: 'get' + }); +} diff --git a/src/api/rpTools.js b/src/api/rpTools.js index 12eff69fe..142d92f61 100644 --- a/src/api/rpTools.js +++ b/src/api/rpTools.js @@ -1,68 +1,197 @@ import request from '@/utils/request'; /** - * 获取运行图数据 + * 查询线路列表 */ -export function getRpTools() { +export function listLines() { + return request({ + url: `/api/rpTools/map`, + method: 'get' + }) +} + +/** + * 查询线路列表 + */ +export function listStations(lineId) { + return request({ + url: `/api/rpTools/${lineId}/station`, + method: 'get' + }) +} + +/** + * 更新线路车站 + */ +export function updateStation(stationId, data) { + return request({ + url: `/api/rpTools/station/${stationId}`, + method: 'put', + data + }) +} + +/** + * 查询运行图列表 + */ +export function listRps() { return request({ - url: '/api/rpTools', + url: `/api/rpTools`, method: 'get' }); } -/** - * 添加车次 - */ -export function addRpTrip(data) { - return request({ - url: '/api/rpTools/trip', - method: 'post', - data +/** 创建运行图*/ +export function createRp(data) { + return request({ + url: `/api/rpTools`, + method: 'post', + data }); } /** - * 删除车次 + * 删除运行图组 */ -export function delRpTrip(tripNo) { +export function deleteRp(groupId) { return request({ - url: `/api/rpTools/${tripNo}/trip`, + url: `/api/rpTools/${groupId}`, method: 'delete' }) } -/** - * 修改运行时间 - */ -export function justTripNoRunning(tripNo, data) { +/** 获取运行图配置*/ +export function getRpConfig(planId) { + return request({ + url: `/api/rpTools/${planId}/config`, + method: 'get' + }); +} + +/** 修改运行图配置*/ +export function modifyRpConfig(planId, data) { + return request({ + url: `/api/rpTools/${planId}/config`, + method: 'put', + data + }); +} + +/** 获取运行图数据*/ +export function getRpTools(planId) { + return request({ + url: `/api/rpTools/${planId}`, + method: 'get' + }); +} + +/** 添加车次*/ +export function addRpTrip(planId, data) { + return request({ + url: `/api/rpTools/${planId}/trip`, + method: 'post', + data + }); +} + +/** 删除车次*/ +export function delRpTrip(planId, tripNo) { + return request({ + url: `/api/rpTools/${planId}/${tripNo}/trip`, + method: 'delete' + }); +} + +/** 平移服务*/ +export function translateRpService(planId, serviceNo, data) { + return request({ + url: `/api/rpTools/${planId}/${serviceNo}/service`, + method: 'put', + data + }); +} + +/** 删除服务*/ +export function delRpService(planId, serviceNo) { + return request({ + url: `/api/rpTools/${planId}/${serviceNo}/service`, + method: 'delete' + }); +} + +/** 添加区域*/ +export function createRpArea(planId, data) { + return request({ + url: `/api/rpTools/${planId}/area`, + method: 'post', + data + }); +} + +/** 修改区域*/ +export function modifyRpArea(planId, areaNo, data) { + return request({ + url: `/api/rpTools/${planId}/${areaNo}/area`, + method: 'put', + data + }); +} + +/** 修改区域文字*/ +export function modifyAreaNote(planId, areaNo, data) { + return request({ + url: `/api/rpTools/${planId}/${areaNo}/text`, + method: 'put', + data + }); +} +/** 删除区域*/ +export function delRpArea(planId, areaNo) { + return request({ + url: `/api/rpTools/${planId}/${areaNo}/area`, + method: 'delete' + }); +} + +/** 修改运行时间*/ +export function justTripNoRunning(planId, tripNo, data) { + return request({ + url: `/api/rpTools/${planId}/${tripNo}/running`, + method: 'put', + data + }); +} + +/** 修改停站时间*/ +export function justTripNoStop(planId, tripNo, data) { + return request({ + url: `/api/rpTools/${planId}/${tripNo}/stop`, + method: 'put', + data + }); +} + +/** 修改折返时间*/ +export function justTripTurnBack(planId, tripNo, data) { + return request({ + url: `/api/rpTools/${planId}/${tripNo}/turnBack`, + method: 'put', + data + }); +} + +/** 开始编辑*/ +export function startRpEdit(planId) { return request({ - url: `/api/rpTools/${tripNo}/running`, - method: 'put', - data + url: `/api/rpTools/${planId}/edit`, + method: 'put' }) } - -/** - * 修改停站时间 - */ -export function justTripNoStop(tripNo, data) { +/** 开始编辑*/ +export function endRpEdit(planId) { return request({ - url: `/api/rpTools/${tripNo}/stop`, - method: 'put', - data + url: `/api/rpTools/${planId}/endEdit`, + method: 'put' }) } - -/** - * 平移车次 - */ -export function translateTripNo(tripNo, data) { - return request({ - url: `/api/rpTools/${tripNo}/trip`, - method: 'put', - data - }) -} - - diff --git a/src/api/runplan.js b/src/api/runplan.js index 1e0d5198d..4d90b75de 100644 --- a/src/api/runplan.js +++ b/src/api/runplan.js @@ -1,19 +1,6 @@ import request from '@/utils/request'; -/** - * 新建地图速度等级列表 - */ -export function newSpeedLevels(data) { - return request({ - url: '/api/runPlan/draft/speed', - method: 'post', - data: data - }); -} - -/** - * 获取运行图的车站列表 - */ +/** 获取运行图的车站列表*/ export function getStationList(mapId) { return request({ url: `/api/runPlan/draft/station/${mapId}`, @@ -30,20 +17,7 @@ export function populatingGenericData(planId, data) { }); } -/** - * 创建运行图 - */ -export function newRunPlan(data) { - return request({ - url: '/api/runPlan/draft', - method: 'post', - data: data - }); -} - -/** - * 查询运行图获取数据 - */ +/** 查询运行图获取数据*/ export function queryRunPlan(planId) { return request({ url: `/api/runPlan/draft/${planId}`, @@ -96,9 +70,7 @@ export function publishRunPlan(data) { }); } -/** - * 导入真实运行图 - */ +/** 导入真实运行图*/ export function importRunPlan(data) { return request({ url: `/api/runPlan/draft/${data.mapId}/prdPlan`, @@ -115,13 +87,6 @@ export function getRpListByMapId(mapId) { }); } -/** 获取站间运行时间*/ -export function getStationRunning(mapId) { - return request({ - url: `/api/runPlan/draft/${mapId}/stationRunning`, - method: 'get' - }); -} /** 获取地图原始站间运行等级 */ export function getMapStationRun(mapId) { return request({ @@ -188,6 +153,15 @@ export function addPlanService(data) { }); } +/** 修改计划*/ +export function updatePlanService(planId, serviceNumber, data) { + return request({ + url: `/api/runPlan/draft/${planId}/service/${serviceNumber}`, + method: 'put', + data: data + }); +} + /** 删除计划*/ export function deletePlanService(data) { return request({ @@ -243,6 +217,22 @@ export function getRoutingBySDTNumber(params) { }); } +/** 修改计划号*/ +export function updateServiceNumber(planId, serviceNumber, newServiceNumber) { + return request({ + url: `/api/runPlan/draft/${planId}/service/${serviceNumber}/serviceNumber?newServiceNumber=${newServiceNumber}`, + method: 'put' + }); +} + +/** 修改任务车次号*/ +export function updateTripNumber(planId, SDTNumber, tripNumber) { + return request({ + url: `/api/runPlan/draft/${planId}/trip/${SDTNumber}/tripNumber?tripNumber=${tripNumber}`, + method: 'put' + }); +} + /** 运行图仿真测试*/ export function runPlanNotify({ planId }) { return request({ diff --git a/src/api/scheduling.js b/src/api/scheduling.js index f0d5cdd05..1de48c2f5 100644 --- a/src/api/scheduling.js +++ b/src/api/scheduling.js @@ -1,58 +1,12 @@ import request from '@/utils/request'; -export function querySecheduling(group, params) { - return request({ - url: `/api/scheduling/${group}/day`, - method: 'get', - params - }); -} - -export function generateScheduling(group, params) { - return request({ - url: `/api/scheduling/${group}/generate`, - method: 'post', - params - }); -} - -export function getSchedulingAllTrains(group) { - return request({ - url: `/api/scheduling/${group}/train/all`, - method: 'get' - }); -} - -export function checkScheduling(group, data) { - return request({ - url: `/api/scheduling/${group}/check`, - method: 'post', - data - }); -} - -export function saveScheduling(group, data) { - return request({ - url: `/api/scheduling/${group}/save`, - method: 'post', - data - }); -} - export function generateSchedulingAgain(group) { return request({ url: `/api/scheduling/${group}/rebuild`, method: 'delete' }); } -/** 生成地图通用派班计划 */ -export function generateCommonScheduling (data) { - return request({ - url: `/api/v1/scheduling/generate/common`, - method: 'post', - data - }); -} + /** 查询某天的派班计划 */ export function querySechedulingNew (group, params) { return request({ diff --git a/src/api/script.js b/src/api/script.js index 012b46a0a..dfff747cf 100644 --- a/src/api/script.js +++ b/src/api/script.js @@ -1,15 +1,5 @@ import request from '@/utils/request'; -/** 分页查找上线的剧本*/ -export function getScriptPageListOnline(params) { - return request({ - url: `/api/script/paging/online`, - // url: `/api/script/paging/published`, - method: 'get', - params: params - }); -} - /** 分页查找上线的剧本(新版)*/ export function getScriptPageListOnlineNew(params) { return request({ @@ -19,14 +9,6 @@ export function getScriptPageListOnlineNew(params) { }); } -/** 通过ID查询发布的剧本的详细信息 */ -export function getScriptById(id) { - return request({ - url: `/api/script/${id}/detail`, - method: 'get' - }); -} - /** 通过ID查询发布的剧本的详细信息(新版) */ export function getScriptByIdNew(id) { return request({ @@ -35,14 +17,6 @@ export function getScriptByIdNew(id) { }); } -/** 通过group查询未发布剧本的详细信息 */ -export function getDraftScriptByGroup(group) { - return request({ - url: `/api/simulation/${group}/script/loadedScript`, - method: 'get' - }); -} - /** 通过group查询未发布剧本的详细信息(新版) */ export function getDraftScriptByGroupNew(group) { return request({ @@ -52,7 +26,7 @@ export function getDraftScriptByGroupNew(group) { } /** 剧本撤销发布 */ -export function retractScript(id, data) { +export function retractScript(id) { return request({ url: `/api/script/draft/${id}/retract`, method: 'put' @@ -127,19 +101,20 @@ export function getAllSelectedScriptRole(group) { }); } -/** 加载剧本接口(仿真使用 竞赛) */ -export function loadScript(group, scriptId) { +/** 草稿剧本数据导入*/ +export function postScriptImport(mapId, name, data) { return request({ - url: `/api/scriptSimulation/${group}/load/script/${scriptId}`, - method: 'PUT' + url: `/api/script/draft/${mapId}/import?name=${name}`, + method: 'post', + data: data, + time: 60000 }); } -/** 剧本实训结束 接口(仿真使用 竞赛) */ -export function endScriptTraining(group) { +/** 草稿剧本数据导出 */ +export function getScriptExport(id) { return request({ - url: `/api/scriptSimulation/${group}/finish`, + url: `/api/script/draft/${id}/export`, method: 'get' }); } - diff --git a/src/api/simulation.js b/src/api/simulation.js index b9a55ad1c..c6efd75d2 100644 --- a/src/api/simulation.js +++ b/src/api/simulation.js @@ -1,23 +1,5 @@ import request from '@/utils/request'; -/** 获取故障规则列表*/ -export function getFailureGenerateRules(params) { - return request({ - url: `/api/simulation/failureGenerateRules`, - method: 'get', - params: params - }); -} - -/** 设置自动故障*/ -export function setFailureMode(data, group) { - return request({ - url: `/api/simulation/${group}/failureMode`, - method: 'post', - data: data - }); -} - /** 设置自动故障(新版)*/ export function setFailureModeNew(data, group) { return request({ @@ -41,15 +23,6 @@ export function getSimulationFaultRules(group) { }); } -// 创建故障规则(新版) -export function addFailureRule(data) { - return request({ - url: `/api/v1/faultRule`, - method: 'post', - data: data - }); -} - /** 根据id删除故障规则 */ export function deleteFailureRule(id) { return request({ @@ -58,56 +31,7 @@ export function deleteFailureRule(id) { }); } -/** 获取故障规则列表(新版)*/ -export function getFailureRulesNew(params) { - return request({ - url: `/api/v1/faultRule/page`, - method: 'get', - params: params - }); -} - -// 修改故障规则(新版) -export function modifyFailureRule(data) { - return request({ - url: `/api/v1/faultRule`, - method: 'put', - data: data - }); -} - -/** 通过id获取故障规则(新版)*/ -export function getFailureRulesByIdNew(id) { - return request({ - url: `/api/v1/faultRule/${id}`, - method: 'get' - }); -} - -/** - * 仿真系统按计划行车 - */ -export function runDiagramStart(params, group) { - return request({ - url: `/api/simulation/${group}/start`, - method: 'put', - params: params - }); -} - -/** - * 仿真系统结束计划行车 - */ -export function runDiagramOver(group) { - return request({ - url: `/api/simulation/${group}/over`, - method: 'put' - }); -} - -/** - * 退出仿真系统 - */ +/** 退出仿真系统*/ export function runDiagramQuit(group) { return request({ url: `/api/simulation/${group}/quit`, @@ -115,43 +39,6 @@ export function runDiagramQuit(group) { }); } -/** 获取仿真系统时间*/ -export function runDiagramGetTime(group) { - return request({ - url: `/api/simulation/${group}/systemTime`, - method: 'get' - }); -} - -// 查看是否开始按计划行车 -export function runDiagramIsStart(group) { - return request({ - url: `/api/simulation/${group}/isRunPlanStart`, - method: 'get' - }); -} - -/** - * 仿真系统CBTC - * @param {*} mapId - */ -export function simulationNotify({ mapId, prdType }) { - return request({ - url: `/api/simulation/${mapId}/${prdType}`, - method: 'get' - }); -} - -/** - * 实训系统CBTC - * @param {*} data - */ -export function trainingNotify({ trainingId }) { - return request({ - url: `/api/simulation/training/${trainingId}`, - method: 'get' - }); -} /** 实训系统(新版地图) */ export function trainingNotifyNew({ trainingId }) { return request({ @@ -159,16 +46,7 @@ export function trainingNotifyNew({ trainingId }) { method: 'get' }); } -/** - * 考试系统CBTC - * @param {*} data - */ -export function examNotify({ examId }) { - return request({ - url: `/api/simulation/exam/${examId}`, - method: 'get' - }); -} + /** 考试系统(新版地图)*/ export function examNotifyNew({ examId }) { return request({ @@ -211,30 +89,6 @@ export function deleteSimulationStats(statsId) { }); } -/** 获取用户鼠标左键选中的设备信息*/ -export function letfMouseSelectDevice(deviceCode, group) { - return request({ - url: `/api/simulation/${group}/device/${deviceCode}`, - method: 'get' - }); -} - -/** 获取每日运行图*/ -export function getEveryDayRunPlanData(group) { - return request({ - url: `/api/simulation/${group}/runPlan`, - method: 'get' - }); -} - -/** 录制脚本仿真*/ -export function scriptRecordNotify(scriptId) { - return request({ - url: `/api/simulation/scriptWrite/${scriptId}`, - method: 'get' - }); -} - /** 录制脚本仿真(新版)*/ export function scriptRecordNotifyNew(scriptId) { return request({ @@ -243,14 +97,6 @@ export function scriptRecordNotifyNew(scriptId) { }); } -/** 保存剧本背景*/ -export function saveScriptScenes(group) { - return request({ - url: `/api/simulation/${group}/scriptWrite/scenes`, - method: 'put' - }); -} - /** 保存剧本背景(新版)*/ export function saveScriptScenesNew(group) { return request({ @@ -267,14 +113,6 @@ export function scriptRePreview(group) { }); } -/** 保存录制任务数据*/ -export function saveScriptData(group) { - return request({ - url: `/api/simulation/${group}/scriptWrite/saveData`, - method: 'put' - }); -} - /** 保存录制任务数据(新版)*/ export function saveScriptDataNew(group) { return request({ @@ -283,15 +121,6 @@ export function saveScriptDataNew(group) { }); } -/** 更新任务地图定位信息*/ -export function updateMapLocation(group, data) { - return request({ - url: `/api/simulation/${group}/scriptWrite/mapLocation`, - method: 'put', - data - }); -} - /** 更新任务地图定位信息(新版)*/ export function updateMapLocationNew(group, data) { return request({ @@ -301,82 +130,6 @@ export function updateMapLocationNew(group, data) { }); } -/** 获取剧本编制的所有成员角色*/ -export function getScriptMemberData(group) { - return request({ - url: `/api/simulation/${group}/scriptWrite/members`, - method: 'get' - }); -} - -/** 获取剧本出演成员角色 */ -export function getScriptPlayMember(group) { - return request({ - url: `/api/simulation/${group}/scriptWrite/players`, - method: 'get' - }); -} - -/** 获取剧本出演成员角色(新版地图) */ -export function getScriptPlayMemberNew(group) { - return request({ - url: `/api/scriptSimulation/${group}/allPlayer`, - method: 'get' - }); -} - -/** 取消剧本演出成员角色 */ -export function cancleScriptMembers(group, data) { - return request({ - url: `/api/simulation/${group}/scriptWrite/removePlayers`, - method: 'put', - data - }); -} - -/** 取消剧本演出成员角色 */ -export function cancleScriptMembersNew(group, data) { - return request({ - url: `/api/scriptSimulation/${group}/removePlayers`, - method: 'put', - data - }); -} - -/** 选择剧本演出成员角色 */ -export function selectScriptMembers(group, data) { - return request({ - url: `/api/simulation/${group}/scriptWrite/choosePlayers`, - method: 'put', - data - }); -} - -/** 选择剧本演出成员角色 (新版地图)*/ -export function selectScriptMembersNew(group, data) { - return request({ - url: `/api/scriptSimulation/${group}/choosePlayers`, - method: 'put', - data - }); -} - -/** 修改剧本演出成员性别 */ -export function modifyScriptMemberSex(group, playerId, data) { - return request({ - url: `/api/simulation/${group}/scriptWrite/player/${playerId}?gender=${data.gender}`, - method: 'put' - }); -} - -/** 清除仿真剧本数据*/ -export function dumpScriptData(group) { - return request({ - url: `/api/simulation/${group}/scriptWrite/saveData`, - method: 'delete' - }); -} - /** 清除仿真剧本数据(新版)*/ export function dumpScriptDataNew(group) { return request({ @@ -385,57 +138,6 @@ export function dumpScriptDataNew(group) { }); } -/** 查询录制剧本步骤*/ -export function queryScriptStep(group) { - return request({ - url: `/api/simulation/${group}/scriptRecordStage`, - method: 'get' - }); -} - -/** 获取指定时间里可加载列车的个数*/ -export function getDesignatedTimeTrainNum(params, group) { - return request({ - url: `/api/simulation/${group}/plan/trainNum`, - method: 'get', - params - }); -} -/** 添加剧本动作 */ -export function addScriptAction(group, data) { - return request({ - url: `/api/simulation/${group}/scriptWrite/action`, - method: 'post', - data - }); -} - -/** 添加剧本动作(新版) */ -export function addScriptActionNew(group, data) { - return request({ - url: `/api/scriptSimulation/${group}/addAction`, - method: 'PUT', - data - }); -} - -/** 删除剧本动作 */ -export function deleteScriptAction(group, actionId) { - return request({ - url: `/api/simulation/${group}/scriptWrite/action/${actionId}`, - method: 'delete' - }); -} - -/** 修改剧本动作 */ -export function modifyScriptAction(group, actionId, data) { - return request({ - url: `/api/simulation/${group}/scriptWrite/action/${actionId}`, - method: 'put', - data - }); -} - /** 修改剧本动作(新版) */ export function modifyScriptActionNew(group, data) { return request({ @@ -461,22 +163,6 @@ export function deleteExistingSimulation(group) { method: 'delete' }); } -/** 根据设备类型获取设备列表 */ -export function getDeviceCodeByDeviceType(group, params) { - return request({ - url: `/api/simulation/${group}/deviceType/devices`, - method: 'get', - params - }); -} - -/** 获取任务录制的数据 */ -export function getScriptRecord(group) { - return request({ - url: `/api/simulation/${group}/scriptWrite`, - method: 'get' - }); -} /** 获取任务录制的所有动作(新版)*/ export function getScriptAllAction(group) { @@ -486,22 +172,6 @@ export function getScriptAllAction(group) { }); } -/** 加载任务*/ -export function loadQuest(questId, memberId, group) { - return request({ - url: `/api/simulation/${group}/quest/${questId}?memberId=${memberId}`, - method: 'post' - }); -} - -/** 加载剧本 */ -export function loadScript(scriptId, memberId, group) { - return request({ - url: `api/simulation/${group}/script/${scriptId}?memberId=${memberId}`, - method: 'post' - }); -} - /** 加载剧本(新版) */ export function loadScriptNew(scriptId, memberId, group) { return request({ @@ -510,14 +180,6 @@ export function loadScriptNew(scriptId, memberId, group) { }); } -/** 退出剧本*/ -export function quitScript(group) { - return request({ - url: `/api/simulation/${group}/script`, - method: 'delete' - }); -} - /** 退出剧本(新版)*/ export function quitScriptNew(group) { return request({ @@ -526,48 +188,6 @@ export function quitScriptNew(group) { }); } -/** 退出任务*/ -export function quitQuest(group) { - return request({ - url: `/api/simulation/${group}/quest`, - method: 'put' - }); -} - -/** 根据group获取仿真对象*/ -export function getSimulationInfo(group) { - return request({ - url: `/api/simulation/${group}`, - method: 'get' - }); -} - -/** 获取可用的设备指令*/ -export function getAvailableDeviceCommand(params) { - return request({ - url: `/api/simulation/deviceCommand/available`, - method: 'get', - params - }); -} - -/** 保存/修改任务剧本*/ -export function saveTaskScript(group, data) { - return request({ - url: `/api/simulation/${group}/questRecord/script`, - method: 'post', - data - }); -} - -/** 暂停剧本编制的仿真 */ -export function scriptPause(group) { - return request({ - url: `/api/simulation/${group}/scriptWrite/pause`, - method: 'post' - }); -} - /** 暂停仿真 */ export function simulationPause(group) { return request({ @@ -576,57 +196,15 @@ export function simulationPause(group) { }); } -/** 恢复仿真运行并执行刚编辑的剧本动作 */ -export function executeScript(group) { - return request({ - url: `/api/simulation/${group}/scriptWrite/execute`, - method: 'post' - }); -} - /** 恢复仿真运行并执行刚编辑的剧本动作(新版) */ export function executeScriptNew(group) { return request({ - // url: `/api/scriptSimulation/${group}/recoverAndExecute`, url: `/simulation/${group}/resume`, method: 'PUT' }); } -/** 生成用户自己的当日运行图*/ -export function generateDayRunPlan(planId, group) { - return request({ - url: `/api/simulation/${group}/loadRunPlan/${planId}`, - method: 'post' - }); -} - -/** 创建派班计划仿真*/ -export function schedulingNotify(params) { - return request({ - url: `/api/scheduling/simulation`, - method: 'post', - params - }); -} - -/** 获取PLC网关 */ -export function getPlcGateway(group) { - return request({ - url: `/api/simulation/${group}/plcGateway`, - method: 'get' - }); -} - /** 处理ibp盘事件 */ -// export function handlerIbpEvent(group, data) { -// return request({ -// url: `/api/simulation/${group}/ibp/event`, -// method: 'post', -// data: data -// }); -// } - export function handlerIbpEvent(group, button, stationCode) { return request({ url: `/simulation/${group}/ibp/${button}?stationCode=${stationCode}`, @@ -673,22 +251,6 @@ export function getNewMapDataByGroup(group) { }); } -/** 新版地图根据仿真mapId获取仿真地图数据 */ -export function getNewMapDataByMapId(mapId) { - return request({ - url: `/api/map/${mapId}/mapData`, - method: 'get' - }); -} - -/** 新版地图指令操作定义 */ -export function newMapOperate(group, operationId, data) { - return request({ - url: `/simulation/${group}/operate/${operationId}`, - method: 'post', - data: data - }); -} /** 新版地图根据group获取仿真运行图 */ export function getEveryDayRunPlanNew(group) { return request({ @@ -713,15 +275,6 @@ export function clearSimulation(group) { }); } -/** 查询进路信息*/ -export function querySignalStatus(group, params) { - return request({ - url: `/api/simulation/${group}/status/signal`, - method: 'get', - params - }); -} - /** 获取仿真运行图车次号列表 */ export function getTripNumberList(group) { return request({ @@ -827,3 +380,19 @@ export function getIbpInitialState (group, stationCode) { method: 'get' }); } +// 获取报警列表 +export function getAlarmList(group, params) { + return request({ + url: `/simulation/${group}/alarm`, + method: 'get', + params:params + }); +} +// 报警确认 +export function confirmAlarm(group, data) { + return request({ + url: `/simulation/${group}/alarm/confirm`, + method: 'put', + data + }); +} diff --git a/src/api/statistics.js b/src/api/statistics.js index ad16cd257..c761cf7f0 100644 --- a/src/api/statistics.js +++ b/src/api/statistics.js @@ -1,89 +1 @@ -import request from '@/utils/request'; - -// 课程列表 -export function getLessonList(code) { - return request({ - url: '/api/stats/lesson/list', - method: 'get', - params: { - wmCode: code - } - }); -} - -// 课程内实训数据统计 -export function getLessonTimeChart(data) { - return request({ - url: `/api/stats/lesson/${data.id}/stats`, - method: 'get', - params: { - wmCode: data.code - } - }); -} - -// 查询参与考试的课程列表 -export function getExamTree(code) { - return request({ - url: '/api/stats/exam/lessonList', - method: 'get', - params: { - wmCode: code - } - }); -} - -// 查询参与考试的试题列表 -export function getstatsExamList(data) { - return request({ - url: `/api/stats/exam/${data.lessonId}/list`, - method: 'get', - params: { - wmCode: data.code - } - }); -} - -// 个人考试数据统计 -export function getExamChart(data) { - return request({ - url: `/api/stats/exam/${data.examId}/stats`, - method: 'get', - params: { - wmCode: data.code - } - }); -} - -// 个人关注地图数据统计列表 -export function getRelevanceMapList(code) { - return request({ - url: `/api/user/subscribe`, - method: 'get', - params: { - wmCode: code - } - }); -} - -// 仿真地图下产品列表 -export function getSimulationPrdList(mapId, code) { - return request({ - url: `/api/stats/simulation/${mapId}/prdList`, - method: 'get', - params: { - wmCode: code - } - }); -} - -// 个人仿真数据统计 -export function getSimulationTimeChart(data) { - return request({ - url: `/api/stats/simulation/${data.mapId}/stats`, - method: 'get', - params: { - wmCode: data.code - } - }); -} +// import request from '@/utils/request'; diff --git a/src/api/trainingPlatform.js b/src/api/trainingPlatform.js index 8e05dae65..277ffebb1 100644 --- a/src/api/trainingPlatform.js +++ b/src/api/trainingPlatform.js @@ -1,75 +1,68 @@ import request from '@/utils/request'; +/** 根据cityCode后去对应地图及其子系统 */ export function getTrainingSystemList(cityCode, params) { - /** 根据cityCode后去对应地图及其子系统 */ return request({ url: `/api/mapSystem/city/${cityCode}`, method: 'get', params }); } - +/** 根据mapId生成地图子系统 */ export function generateMapSystem(mapId) { - /** 根据mapId生成地图子系统 */ return request({ url: `/api/mapSystem/generate/${mapId}`, method: 'post' }); } - +/** 查询子系统信息 */ export function getSubSystemInfo(id) { - /** 查询子系统信息 */ return request({ url: `/api/mapSystem/${id}`, method: 'get' }); } - +/** 查询子系统详情*/ export function getSubSystemDetail(id) { - /** 查询子系统详情*/ return request({ url: `/api/mapSystem/${id}/detail`, method: 'get' }); } - +/** 分页查询地图系统 */ export function getMapSystemPageList(params) { - /** 分页查询地图系统 */ return request({ url: `/api/mapSystem`, method: 'get', params }); } - +/** 创建地图系统 */ export function createMapSubSystem(data) { - /** 创建地图系统 */ return request({ url: `/api/mapSystem`, method: 'post', data: data }); } - +/** 查询子系统信息 */ export function updateSubSystem(id, data) { - /** 查询子系统信息 */ return request({ url: `/api/mapSystem/${id}`, method: 'put', data: data }); } - +/** 删除地图系统 */ export function deleteSubSystem(id) { - /** 删除地图系统 */ return request({ url: `/api/mapSystem/${id}`, method: 'delete' }); } +/** 根据项目编号查询地图子系统 */ export function getSubSystemByProjectCode() { - /** 根据项目编号查询地图子系统 */ return request({ url: `/api/mapSystem/project`, method: 'get' diff --git a/src/assets/icon/favicon_bjd.png b/src/assets/icon/favicon_bjd.png new file mode 100644 index 000000000..b2d5e932d Binary files /dev/null and b/src/assets/icon/favicon_bjd.png differ diff --git a/src/assets/teleRing.mp3 b/src/assets/teleRing.mp3 new file mode 100644 index 000000000..bbd0572e7 Binary files /dev/null and b/src/assets/teleRing.mp3 differ diff --git a/src/assets/voiceClose.png b/src/assets/voiceClose.png new file mode 100644 index 000000000..84f7f1e65 Binary files /dev/null and b/src/assets/voiceClose.png differ diff --git a/src/assets/voiceOpen.png b/src/assets/voiceOpen.png new file mode 100644 index 000000000..87c81818f Binary files /dev/null and b/src/assets/voiceOpen.png differ diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 7b3c46046..893268877 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -13,53 +13,51 @@ import pathToRegexp from 'path-to-regexp'; export default { - data() { - return { - levelList: null - }; - }, - watch: { - $route() { - this.getBreadcrumb(); - } - }, - created() { - this.getBreadcrumb(); - }, - methods: { - getBreadcrumb() { - // only show routes with meta.title - let matched = this.$route.matched.filter(item => item.meta && item.meta.title); - const first = matched[0]; + data() { + return { + levelList: null + }; + }, + watch: { + $route() { + this.getBreadcrumb(); + } + }, + created() { + this.getBreadcrumb(); + }, + methods: { + getBreadcrumb() { + let matched = this.$route.matched.filter(item => item.meta && item.meta.title); + const first = matched[0]; - if (!this.isDashboard(first)) { - matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched); - } + if (!this.isDashboard(first)) { + matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched); + } - this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false); - }, - isDashboard(route) { - const name = route && route.name; - if (!name) { - return false; - } - return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase(); - }, - pathCompile(path) { - // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561 - const { params } = this.$route; - var toPath = pathToRegexp.compile(path); - return toPath(params); - }, - handleLink(item) { - const { redirect, path } = item; - if (redirect) { - this.$router.push(redirect); - return; - } - this.$router.push(this.pathCompile(path)); - } - } + this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false); + }, + isDashboard(route) { + const name = route && route.name; + if (!name) { + return false; + } + return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase(); + }, + pathCompile(path) { + const { params } = this.$route; + var toPath = pathToRegexp.compile(path); + return toPath(params); + }, + handleLink(item) { + const { redirect, path } = item; + if (redirect) { + this.$router.push(redirect); + return; + } + this.$router.push(this.pathCompile(path)); + } + } }; diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue index 4b927baaa..62cbc67e7 100644 --- a/src/components/Hamburger/index.vue +++ b/src/components/Hamburger/index.vue @@ -15,18 +15,18 @@ diff --git a/src/components/QueryListPage/DataForm.vue b/src/components/QueryListPage/DataForm.vue index f4a9a984d..f9edadf9c 100644 --- a/src/components/QueryListPage/DataForm.vue +++ b/src/components/QueryListPage/DataForm.vue @@ -214,6 +214,7 @@ document.body.clientWidth - dragDom.clientWidth - 30) { - dragDom.style.left = `${document.body.clientWidth - dragDom.clientWidth - 30}px`; + } else if (l + styL > document.body.clientWidth - dragDom.clientWidth - 100) { + dragDom.style.left = `${document.body.clientWidth - dragDom.clientWidth - 100}px`; } else { dragDom.style.left = `${l + styL}px`; } - if (t + styT < 0) { - dragDom.style.top = `0px`; - } else if (t + styT > document.body.clientHeight - dragDom.clientHeight - 10) { - dragDom.style.top = `${document.body.clientHeight - dragDom.clientHeight - 10}px`; + + if (document.body.clientHeight - (styT - t) - dragDom.clientHeight < 0) { + dragDom.style.bottom = `${document.body.clientHeight - dragDom.clientHeight}px`; + } else if (document.body.clientHeight - (styT - t) - dragDom.clientHeight > document.body.clientHeight - dragDom.clientHeight) { + dragDom.style.bottom = `0px`; } else { - dragDom.style.top = `${t + styT}px`; + dragDom.style.bottom = `${styT - t}px`; } /** 将此时的位置传出去*/ diff --git a/src/i18n/langs/en/router.js b/src/i18n/langs/en/router.js index 1ecff02c9..399e4d745 100644 --- a/src/i18n/langs/en/router.js +++ b/src/i18n/langs/en/router.js @@ -82,5 +82,9 @@ export default { practiceManage:'Practice manage', bankManage: 'Bank manage', sceneManage:'Scene manage', - companyManage: 'Company manage' + companyManage: 'Company manage', + authorApply: 'Grant application', + AuthorList: 'Authorization code list', + questionsRuleManage: 'Question rule manage', + preTheoryData: 'Pre Theory Data' }; diff --git a/src/i18n/langs/en/system.js b/src/i18n/langs/en/system.js index 4d6d0a763..e5dcaf2c6 100644 --- a/src/i18n/langs/en/system.js +++ b/src/i18n/langs/en/system.js @@ -41,7 +41,7 @@ export default { nickname: 'Nickname', wellDelType: 'This operation will delete the type. Do you want to continue?', permission: 'Permission', - editUserPermission: 'Edit User Rights', + editUserPermission: 'Edit User Info', lessonName: 'Lesson Name', selectTraining: 'Selection Training', createUserTraining: 'Creating User Training', diff --git a/src/i18n/langs/zh/router.js b/src/i18n/langs/zh/router.js index dc0645d33..915c11833 100644 --- a/src/i18n/langs/zh/router.js +++ b/src/i18n/langs/zh/router.js @@ -87,5 +87,9 @@ export default { bankManage: '题库列表', practiceManage:'实操列表', sceneManage:'场景列表', - companyManage: '单位管理' + companyManage: '单位管理', + authorApply: '授权申请', + AuthorList: '授权列表', + questionsRuleManage: '出题规则管理', + preTheoryData: '理论导入预处理' }; diff --git a/src/i18n/langs/zh/system.js b/src/i18n/langs/zh/system.js index d41320c94..3c9e83713 100644 --- a/src/i18n/langs/zh/system.js +++ b/src/i18n/langs/zh/system.js @@ -41,7 +41,7 @@ export default { nickname: '昵称', wellDelType: '此操作将删除该类型, 是否继续?', permission: '权限', - editUserPermission: '编辑用户权限', + editUserPermission: '编辑用户信息', lessonName: '课程名称', selectTraining: '选择实训', createUserTraining: '创建用户实训', diff --git a/src/iscs/shape/text.js b/src/iscs/shape/text.js index 8b6386bb6..7a57815d8 100644 --- a/src/iscs/shape/text.js +++ b/src/iscs/shape/text.js @@ -67,7 +67,7 @@ export default class text extends Group { } setState(model) { this.textName.setStyle('text', model.context); - this.textName.setStyle('textBackgroundColor', model.gbColor); + model.gbColor && this.textName.setStyle('textBackgroundColor', model.gbColor); } setSize(width, height) { this.model.width = width; diff --git a/src/iscs/status/mapElement.js b/src/iscs/status/mapElement.js index 66e128dec..1f321d3ea 100644 --- a/src/iscs/status/mapElement.js +++ b/src/iscs/status/mapElement.js @@ -1,5 +1,5 @@ import elType from './elType'; -import iscs from '../iscs'; +import Vue from 'vue'; export default { [elType.A.lab]: { @@ -35,7 +35,7 @@ export default { context: '' }, stateB: { - context: '' + context: '0' } } } // 数组 @@ -46,32 +46,36 @@ const arrNumKV = [45.8, 57.4, 67.1, 25.8, 34.8, 48.1]; const arrNumKW = [113.5, 178.0, 254.6, 157.6, 135.7]; const arrNumMVar = [0.254, 0.54, 0.971, 1.257]; -export function setNum(groupList) { +export function setNum(groupList, jubeg) { + const typeC = []; groupList.forEach(group => { - group.elemList.forEach(el => { - switch (el.type) { - case elType.C.lab: - switch (iscs.iscsDevice[el.code].unit) { - case 'A': - el.context = Math.floor(Math.random() * arrNumA.length + 1) - 1; - break; - case 'V': - el.context = Math.floor(Math.random() * arrNumV.length + 1) - 1; - break; - case 'KV': - el.context = Math.floor(Math.random() * arrNumKV.length + 1) - 1; - break; - case 'KW': - el.context = Math.floor(Math.random() * arrNumKW.length + 1) - 1; - break; - case 'MVar': - el.context = Math.floor(Math.random() * arrNumMVar.length + 1) - 1; - break; - } + switch (group.type) { + case elType.C.lab: + switch (Vue.prototype.$iscs.iscsDevice[group.code].model.unit) { + case 'A': + group.context = jubeg ? '0A' : `${arrNumA[Math.floor(Math.random() * arrNumA.length + 1) - 1]}A`; + typeC.push(group); + break; + case 'V': + group.context = jubeg ? '0V' : `${arrNumV[Math.floor(Math.random() * arrNumV.length + 1) - 1]}V`; + typeC.push(group); + break; + case 'KV': + group.context = jubeg ? '0KV' : `${arrNumKV[Math.floor(Math.random() * arrNumKV.length + 1) - 1]}KV`; + typeC.push(group); + break; + case 'KW': + group.context = jubeg ? '0KW' : `${arrNumKW[Math.floor(Math.random() * arrNumKW.length + 1) - 1]}KW`; + typeC.push(group); + break; + case 'MVar': + group.context = jubeg ? '0MVar' : `${arrNumMVar[Math.floor(Math.random() * arrNumMVar.length + 1) - 1]}MVar`; + typeC.push(group); break; } - }); + break; + } }); - return groupList; + return typeC; } diff --git a/src/jlmap3d/edit/connect/initDataSave.js b/src/jlmap3d/edit/connect/initDataSave.js index 755c4fc4b..ab1b3749d 100644 --- a/src/jlmap3d/edit/connect/initDataSave.js +++ b/src/jlmap3d/edit/connect/initDataSave.js @@ -32,23 +32,32 @@ export function initDataSave(data) { let sections = []; // console.log(data.mapdata.sectionlist.sections.datalist); for(let i in data.mapdata.sectionlist.sections.datalist){ - console.log(data.mapdata.sectionlist.sections.datalist[i].mesh.railpoint); + let section = { // uuid:data.mapdata.sectionlist.sections.modellist[i].uuid, code:data.mapdata.sectionlist.sections.datalist[i].code, name:data.mapdata.sectionlist.sections.datalist[i].name, - lengthFact:data.mapdata.sectionlist.sections.datalist[i].mesh.lengthFact, + lengthFact:null, standTrack:data.mapdata.sectionlist.sections.datalist[i].standTrack, rp:data.mapdata.sectionlist.sections.datalist[i].rp, lp:data.mapdata.sectionlist.sections.datalist[i].lp, - railpoint:data.mapdata.sectionlist.sections.datalist[i].mesh.railpoint, + railpoint:null, rail:data.mapdata.sectionlist.sections.datalist[i].rail, - position:data.mapdata.sectionlist.sections.datalist[i].mesh.position, - rotation:data.mapdata.sectionlist.sections.datalist[i].mesh.rotation, - scale:data.mapdata.sectionlist.sections.datalist[i].mesh.scale, + position:null, + rotation:null, + scale:null, } - let nowmesh = data.mapdata.sectionlist.sectiongroup.getObjectByProperty("code",section.code); - section.railpoint = nowmesh.railpoint; + if(data.mapdata.sectionlist.sections.datalist[i].mesh){ + console.log(data.mapdata.sectionlist.sections.datalist[i].mesh.railpoint); + let nowmesh = data.mapdata.sectionlist.sectiongroup.getObjectByProperty("code",section.code); + section.railpoint = nowmesh.railpoint; + section.lengthFact = data.mapdata.sectionlist.sections.datalist[i].mesh.lengthFact; + section.position = data.mapdata.sectionlist.sections.datalist[i].mesh.position; + section.rotation = data.mapdata.sectionlist.sections.datalist[i].mesh.rotation; + section.scale = data.mapdata.sectionlist.sections.datalist[i].mesh.scale; + sections.push(section); + } + // console.log(nowmesh.railpoint); // if(data.mapdata.sectionlist.sections.datalist[i].rsection){ // section.rsection = data.mapdata.sectionlist.sections.datalist[i].rsection; @@ -62,7 +71,7 @@ export function initDataSave(data) { // testmesh1.position.z = link.position.z; - sections.push(section); + } let arrray = { section:sections, diff --git a/src/jlmap3d/edit/jlmap3dedit.js b/src/jlmap3d/edit/jlmap3dedit.js index e99031062..8a2487794 100644 --- a/src/jlmap3d/edit/jlmap3dedit.js +++ b/src/jlmap3d/edit/jlmap3dedit.js @@ -423,63 +423,12 @@ export function JLmap3dEdit(dom, data, mapid) { for(let i=0;i2){ - newAlignmentSection.lengthFact = newAlignmentSection.lengthFact/5; - } - - let len = newAlignmentSection.lengthFact; - // closedSpline.arcLengthDivisions; - let count = newAlignmentSection.geometry.attributes.position.count/3; - - for(let i=0;i2){ newAlignmentSection.lengthFact = newAlignmentSection.lengthFact/5; } - let len = newAlignmentSection.lengthFact; // closedSpline.arcLengthDivisions; let count = newAlignmentSection.geometry.attributes.position.count/3; + for(let i=0;i section.lengthFact/2){ - posx = section.mesh.position.x + data[i].sectionOffset - section.lengthFact/2; - }else{ - posx = section.mesh.position.x - (section.lengthFact/2 - data[i].sectionOffset); + if(section.lsection == undefined){ + section = sectiondata[section.rsection]; + data[i].sectionOffset = section.lengthFact; + data[i].sectionCode = section.rsection; } - //根据线路方向修改信号灯位置 - if(data[i].right == false){ - if(section.standTrack == true){ - posx = posx - 7; - } - - newmesh.position.set(posx,0,section.mesh.position.z-3); - newmesh.rotation.z = ( Math.PI / 2 ); - }else if(data[i].right == true){ - if(section.standTrack == true){ - posx = posx + 7; - } - newmesh.position.set(posx,0,section.mesh.position.z+3); - newmesh.rotation.z = ( - Math.PI / 2 ); + if(section.rsection == undefined){ + section = sectiondata[section.lsection]; + data[i].sectionOffset = 0; + data[i].sectionCode = section.rsection; } - newmesh.scale.x = 0.05; - newmesh.scale.y = 0.05; - newmesh.scale.z = 0.05; - newmesh.sectionOffset = data[i].sectionOffset; - newmesh.sectionCode = data[i].sectionCode; - newmesh.right = data[i].right; - newsignal.mesh = newmesh; - newsignal.sectionOffset = data[i].sectionOffset; - newsignal.mesh.status = "01"; - newsignal.name = data[i].name; - newsignal.modelid = assetloader.modellist[num].id; - newsignal.code = data[i].code; - newsignal.sectionCode = data[i].sectionCode; - newsignal.right = data[i].right; - scope.group.add(newmesh); - scope.list.push(newsignal); + if(data[i].sectionOffset > section.lengthFact/2){ + posx = section.mesh.position.x + data[i].sectionOffset - section.lengthFact/2; + }else{ + posx = section.mesh.position.x - (section.lengthFact/2 - data[i].sectionOffset); + } + //根据线路方向修改信号灯位置 + if(data[i].right == false){ + if(section.standTrack == true){ + posx = posx - 7; + } + + newmesh.position.set(posx,0,section.mesh.position.z-3); + newmesh.rotation.z = ( Math.PI / 2 ); + }else if(data[i].right == true){ + if(section.standTrack == true){ + posx = posx + 7; + } + newmesh.position.set(posx,0,section.mesh.position.z+3); + newmesh.rotation.z = ( - Math.PI / 2 ); + } + newmesh.scale.x = 0.05; + newmesh.scale.y = 0.05; + newmesh.scale.z = 0.05; + newmesh.sectionOffset = data[i].sectionOffset; + newmesh.sectionCode = data[i].sectionCode; + newmesh.right = data[i].right; + newsignal.mesh = newmesh; + + newsignal.sectionOffset = data[i].sectionOffset; + newsignal.mesh.status = "01"; + newsignal.name = data[i].name; + newsignal.modelid = assetloader.modellist[num].id; + newsignal.code = data[i].code; + newsignal.sectionCode = data[i].sectionCode; + newsignal.right = data[i].right; + scope.group.add(newmesh); + scope.list.push(newsignal); + }else{ for(let j=0;j= scope.playlist[scope.playorder].length-1){ if(scope.playorder >= scope.playlist.length-1 ){ scope.playlist = null; @@ -340,7 +329,6 @@ export function Moveanimate(main){ } } - }else{ // console.log(scope.animatelist[k].connectmodel); if(scope.nowmodelname != scope.playlist[scope.playorder][i].connectmodel.name){ @@ -383,5 +371,4 @@ export function Moveanimate(main){ } } - } diff --git a/src/jlmap3d/jl3ddevice/component/signallight.js b/src/jlmap3d/jl3ddevice/component/signallight.js index 6bb3178f4..9648653c5 100644 --- a/src/jlmap3d/jl3ddevice/component/signallight.js +++ b/src/jlmap3d/jl3ddevice/component/signallight.js @@ -1,8 +1,8 @@ import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; +//信号机贴图 export function Signallightload(lights) { - settexture(lights, "red", JL3D_LOCAL_STATIC+'/MODEL/device/signal/1.jpg'); settexture(lights, "yellow", JL3D_LOCAL_STATIC+'/MODEL/device/signal/2.jpg'); @@ -12,6 +12,7 @@ export function Signallightload(lights) { settexture(lights, "black", JL3D_LOCAL_STATIC+'/MODEL/device/signal/4.jpg'); } +//加载贴图 function settexture(lights, name, textureurl) { var loader = new THREE.TextureLoader(); diff --git a/src/jlmap3d/jl3ddevice/component/textconfig.js b/src/jlmap3d/jl3ddevice/component/textconfig.js index 1c6545f04..1c9a86ca5 100644 --- a/src/jlmap3d/jl3ddevice/component/textconfig.js +++ b/src/jlmap3d/jl3ddevice/component/textconfig.js @@ -4,13 +4,6 @@ export function Textconfig(){ this.devicelist = []; - this.jdqinit = function(){ - - } - - this.jdqraycast = function(){ - - } //配置继电器文字信息 this.initdevicetext = function(selectmodel){ diff --git a/src/jlmap3d/jl3ddevice/jl3ddevice.js b/src/jlmap3d/jl3ddevice/jl3ddevice.js deleted file mode 100644 index cdb2723cb..000000000 --- a/src/jlmap3d/jl3ddevice/jl3ddevice.js +++ /dev/null @@ -1,729 +0,0 @@ -import { Staticmodel } from '@/jlmap3d/jl3ddevice/config.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 { ModelManager } from '@/jlmap3d/jl3ddevice/loader.js'; -import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js'; -import { Moveanimate } from '@/jlmap3d/jl3ddevice/component/moveanimate.js'; -import { Textconfig } from '@/jlmap3d/jl3ddevice/component/textconfig.js'; -import StompClient from '@/utils/sock'; - -var clock = new THREE.Clock(); -export function Jl3ddevice(dom,group,token) { - var scope = this; - - this.dom = dom; - this.nowcode = null; - this.animateswitch = false; - this.signallights = []; - Signallightload(this.signallights); - this.mixers = []; - this.showmodel = null; - - //新数据交互 - let helpbox,textplane; - let daochamodel; - //点击事件状态 - this.raycasterstatus = false; - //动画状态 - this.animastats = false; - //当前选中模型 - this.nowobject = null; - //当前动画播放模型 - this.animationmodel = null; - this.devicetext = new Textconfig(); - this.windowstatus = '0'; - - //初始化webgl渲染 - this.renderer = new THREE.WebGLRenderer({ antialias: true }); - - this.renderer.setClearColor(new THREE.Color(0x000000)); - this.renderer.setSize(dom.offsetWidth, dom.offsetHeight); - this.renderer.shadowMap.enabled = true; - this.renderer.shadowMap.type = THREE.PCFSoftShadowMap; - this.dom.appendChild(this.renderer.domElement); - - //定义相机 - - this.camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 120); - this.camera.position.set(0, 20, 30); - this.camera.aspect = dom.offsetWidth / dom.offsetHeight; - this.camera.updateProjectionMatrix(); - //定义场景(渲染容器) - this.scene = new THREE.Scene(); - this.scene.background = new THREE.Color(0xa0a0a0); - - var mesh = new THREE.Mesh(new THREE.PlaneBufferGeometry(200, 200), new THREE.MeshPhongMaterial({ color: 0x999999, depthWrite: false })); - mesh.rotation.x = - Math.PI / 2; - mesh.receiveShadow = true; - this.scene.add(mesh); - - var grid = new THREE.GridHelper(200, 20, 0x000000, 0x000000); - grid.material.opacity = 0.2; - grid.material.transparent = true; - this.scene.add(grid); - - - //定义全局光 - let ambientLight = new THREE.AmbientLight(0xffffff, 1.3); - this.scene.add(ambientLight); - - - var spotLight = new THREE.SpotLight(0xffffff); - spotLight.position.set(-50, 60, 15); - spotLight.castShadow = true; - spotLight.shadow.mapSize.width = 1024; - spotLight.shadow.mapSize.height = 1024; - this.scene.add(spotLight); - - - - this.controls = new THREE.OrbitControls(this.camera, dom); - this.controls.maxPolarAngle = Math.PI / 2; - this.controls.minPolarangle = Math.PI / 5; - this.controls.maxDistance = 80; - this.controls.update(); - this.selectmodel = null; - - let moveanima = new Moveanimate(scope); - document.addEventListener( "mousedown", onselect, false ); - - - let teststomp = new StompClient(); - let topic = '/user/topic/simulation/assistant/'+group; - // let topic = '/user/queue/simulation/jl3d/'+group; - let header = {'X-Token': token}; - try { - // console.log("teststomp"); - teststomp.subscribe(topic, callback, header); - } catch (error) { - console.error('websocket订阅失败'); - } - - function callback(Response) { - let data = JSON.parse(Response.body); - if(scope.nowcode != data.body.code){ - scope.nowcode = data.body.code; - scope.selectmodel(data); - }else{ - scope.updateaction(data); - } - - } - window.onresize = function () { - scope.camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight; - scope.camera.updateProjectionMatrix(); - scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight); - } - this.domresize = function(){ - scope.camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight; - scope.camera.updateProjectionMatrix(); - scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight); - } - this.anime = null; - - this.modelmanager = new ModelManager(); - this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) { - moveanima.initlistnew(scope.modelmanager.switchmodel.mesh); - daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA"); - - animate(); - }) - - //循环渲染函数 - function animate() { - - scope.anime = requestAnimationFrame(animate); - scope.renderer.render(scope.scene, scope.camera); - scope.controls.update(); - //scope.camera.lookAt(plane); - // - moveanima.animateupdate(); - let delta = clock.getDelta(); - if (scope.mixers) { - for (let i = 0; i < scope.mixers.length; i++) { - if (scope.mixers[i]) { - scope.mixers[i].update(delta); - } - } - } - - - } - - this.selectmodel = function (data) { - if (scope.showmodel) { - scope.nowcode = data.body.code; - if (scope.showmodel.code != data.body.code) { - scope.scene.remove(scope.showmodel); - scope.showmodel = null - - if (data.body._type == "Switch") { - scope.modelmanager.switchmodel.locateType = data.body.locateType; - scope.modelmanager.switchmodel.code = data.body.code; - - scope.showmodel = scope.modelmanager.switchmodel.mesh; - scope.scene.add(scope.showmodel); - - scope.devicetext.initdevicetext(scope.modelmanager.switchmodel.mesh); - scope.nowobject = scope.modelmanager.switchmodel.mesh; - updatemenulist(scope.devicetext.devicelist); - scope.raycasterstatus = true; - - }else{ - scope.raycasterstatus = false; - scope.nowobject = ""; - updatemenulist(); - } - - if (data.body._type == "Signal") { - scope.modelmanager.signalmodel.code = data.body.code; - - scope.showmodel = scope.modelmanager.signalmodel.mesh; - scope.scene.add(scope.showmodel); - - } - - if (data.body._type == "StationStand") { - - scope.modelmanager.standmodel.code = data.body.code; - - scope.showmodel = scope.modelmanager.standmodel.mesh; - scope.scene.add(scope.showmodel); - } - - if(scope.showmodel){ - scope.resetmodel(); - scope.showmodel.code = data.code; - initstatus(data); - } - - } - } else { - if (data.body._type == "Switch") { - scope.modelmanager.switchmodel.locateType = data.body.locateType; - scope.modelmanager.switchmodel.code = data.body.code; - scope.showmodel = scope.modelmanager.switchmodel.mesh; - scope.scene.add(scope.showmodel); - - scope.devicetext.initdevicetext(scope.modelmanager.switchmodel.mesh); - scope.nowobject = scope.modelmanager.switchmodel.mesh; - updatemenulist(scope.devicetext.devicelist); - scope.raycasterstatus = true; - if (data.body.locateType == "01") { - scope.modelmanager.switchmodel.locateType = "01"; - 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.body.locateType == "02") { - scope.modelmanager.switchmodel.locateType = "02"; - scope.modelmanager.switchmodel.action.reset(); - scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration; - scope.modelmanager.switchmodel.action.timeScale = 1; - scope.modelmanager.switchmodel.action.play(); - - } - - }else{ - scope.raycasterstatus = false; - scope.nowobject = ""; - updatemenulist(); - } - if (data.body._type == "Signal") { - scope.modelmanager.signalmodel.code = data.body.code; - scope.showmodel = scope.modelmanager.signalmodel.mesh; - scope.scene.add(scope.showmodel); - } - - if (data.body._type == "StationStand") { - scope.modelmanager.standmodel.code = data.body.code; - scope.showmodel = scope.modelmanager.standmodel.mesh; - scope.scene.add(scope.showmodel); - } - initstatus(data); - } - - - } - - this.updateaction = function (data) { - - if (data.body._type == "Switch") { - if (data.body.code == scope.modelmanager.switchmodel.code) { - if (scope.modelmanager.switchmodel.locateType != data.body.locateType) { - if (data.body.locateType == "03" && scope.modelmanager.switchmodel.locateType == "01") { - - scope.modelmanager.switchmodel.locateType = "02"; - 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.body.locateType == "03" && scope.modelmanager.switchmodel.locateType == "02") { - - scope.modelmanager.switchmodel.locateType = "01"; - scope.modelmanager.switchmodel.action.reset(); - scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration; - scope.modelmanager.switchmodel.action.timeScale = -1; - scope.modelmanager.switchmodel.action.play(); - - } - } - } - - } - if (data.body._type == "Signal") {//从上往下红绿黄 - if (data.body.code == scope.modelmanager.signalmodel.code) { - scope.modelmanager.signalmodel.status = data.body.status; - - if (data.body.lightType == "01") { - - if (data.body.status == "01") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - //开放 - if (data.body.status == "02") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["green"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - //开放侧向 - if (data.body.status == "03") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["yellow"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - //引导 - if (data.body.status == "04") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["yellow"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - //封锁 - if (data.body.status == "05") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - //故障 - if (data.body.status == "06") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - - } else if (data.body.lightType == "02") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - } - - } - - - if (data.body._type == "StationStand") { - if (data.body.code == scope.modelmanager.standmodel.code) { - if (data.body.screenDoorOpenStatus == "02" && scope.modelmanager.standmodel.screenDoorOpenStatus == "01") { - scope.modelmanager.standmodel.screenDoorOpenStatus = "00"; - } - if (data.body.screenDoorOpenStatus == "02" && scope.modelmanager.standmodel.screenDoorOpenStatus == "00") { - scope.modelmanager.standmodel.screenDoorOpenStatus = "02"; - - scope.modelmanager.standmodel.action.reset(); - scope.modelmanager.standmodel.action.time = 0; - scope.modelmanager.standmodel.action.timeScale = 1; - scope.modelmanager.standmodel.action.play(); - } - - if (data.body.screenDoorOpenStatus == "01" && scope.modelmanager.standmodel.screenDoorOpenStatus == "02") { - scope.modelmanager.standmodel.screenDoorOpenStatus = "00"; - } - if (data.body.screenDoorOpenStatus == "01" && scope.modelmanager.standmodel.screenDoorOpenStatus == "00") { - scope.modelmanager.standmodel.screenDoorOpenStatus = "01"; - - scope.modelmanager.standmodel.action.reset(); - scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration; - scope.modelmanager.standmodel.action.timeScale = -1; - scope.modelmanager.standmodel.action.play(); - } - } - - } - // scope.showmodel. - } - - function initstatus(data) { - - if (data.body._type == "Switch") { - - if (data.body.locateType == "01") { - scope.modelmanager.switchmodel.locateType = "01"; - 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.body.locateType == "02") { - scope.modelmanager.switchmodel.locateType = "02"; - scope.modelmanager.switchmodel.action.reset(); - scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration; - scope.modelmanager.switchmodel.action.timeScale = 1; - scope.modelmanager.switchmodel.action.play(); - - } - - - } - - if (data.body._type == "Signal") { - if (data.body.lightType == "01") { - - if (data.body.status == "01") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - //开放 - if (data.body.status == "02") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["green"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - if (data.body.switchLocateType == "03") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["yellow"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - //引导 - if (data.body.status == "03") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["yellow"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - //封锁 - if (data.body.status == "04") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - //故障 - if (data.body.status == "05") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - - } else if (data.body.lightType == "02") { - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - } - - if (data.body._type == "StationStand") { - if (data.body.code == scope.modelmanager.standmodel.code) { - - if (data.body.screenDoorOpenStatus == "02") { - scope.modelmanager.standmodel.screenDoorOpenStatus = "02"; - - scope.modelmanager.standmodel.action.reset(); - scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration; - scope.modelmanager.standmodel.action.timeScale = 1; - scope.modelmanager.standmodel.action.play(); - } - - if (data.body.screenDoorOpenStatus == "01") { - scope.modelmanager.standmodel.screenDoorOpenStatus = "01"; - - scope.modelmanager.standmodel.action.reset(); - scope.modelmanager.standmodel.action.time = 0; - scope.modelmanager.standmodel.action.timeScale = -1; - scope.modelmanager.standmodel.action.play(); - } - } - - } - - } - - //设备分解、归位动画按钮 - this.disperdevice1 = function(){ - if(scope.nowobject.animacode){ - if(moveanima.status == true){ - if(scope.animastats == false){ - scope.animastats = true; - moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"on"],true) - } else if(scope.animastats == true){ - scope.animastats = false; - moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"off"],true); - } - } - } - - - }; - - this.disperdevice2 = function(){ - if(scope.nowobject.animacode){ - if(moveanima.status == true){ - if(scope.animastats == false){ - scope.animastats = true; - moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"chaijie"],true); - } else if(scope.animastats == true){ - scope.animastats = false; - moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"fuwei"],true); - } - } - } - - }; - - this.resetmodel = function(){ - if(scope.nowobject.animacode){ - scope.animastats = false; - moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"fuwei"],true); - } - - }; - - this.animationmsgshowon = function(nowobject){ - scope.animationmodel = nowobject; - if(helpbox){ - scope.animationmodel.helpbox = null; - scope.scene.remove( helpbox ); - helpbox = undefined; - } - - settext(scope.animationmodel,scope.animationmodel.position); - // console.log(scope.animationmodel); - helpbox = new THREE.BoxHelper( scope.animationmodel, 0xff0000 ); - moveanima.updatehelpbox(helpbox,textplane); - // settext(intersects[0].object,intersects[0].point); - // getdevicemsg(intersects[0].object.name); - scope.scene.add( helpbox ); - getdevicemsg(nowobject.name); - } - - this.animationmsgshowoff = function(nowobject){ - if(helpbox){ - scope.animationmodel.helpbox = null; - scope.scene.remove( helpbox ); - helpbox = undefined; - } - if(textplane){ - scope.scene.remove(textplane); - textplane.geometry.dispose(); - textplane.material.dispose(); - } - scope.animationmodel = null; - } - - this.updateselect = function(updata){ - // console.log(updata); - if(helpbox){ - scope.scene.remove( helpbox ); - helpbox = null; - } - helpbox = new THREE.BoxHelper( updata.mesh, 0xff0000 ); - // console.log(updata.mesh); - let point = { - x:updata.mesh.matrixWorld.elements[12], - y:updata.mesh.matrixWorld.elements[13], - z:updata.mesh.matrixWorld.elements[14] - }; - settext(updata.mesh,point) - getdevicemsg(updata.mesh.name); - scope.scene.add( helpbox ); - } - - function getdevicemsg(selectname){ - // console.log(selectname); - for(let i=0,leni=scope.devicetext.devicelist.length;i { let netDataAssets = JSON.parse(netdata.data.assets); @@ -274,9 +264,18 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) { } }) - animate(); + let checkobject = setInterval(function(){ + if(scope.modelmanager.switchmodel.mesh){ + clearInterval(checkobject); + animate(); + } + + + },1000); + }); + //初始化屏蔽门贴图 function setpsdstationmap(stationlist){ for(let i=0,leni=stationlist.length;i { - this.onUsed = true; - const that = this; - const header = { - login: 'relay', - passcode: 'relay' - }; - this.client.connect(header, - ()=>{ - that.connected = true; - // 重连时需要重新订阅 - that.subscribeMap.forEach((subscribe, dest) => { - that.subscribe(subscribe.dest, subscribe.handler); - }); - resolve(); - }, - (error)=>{ - console.error(error); - this.connected = false; - reject(error); - }); - }); - } - - disconnect() { - this.onUsed = false; - this.client.disconnect(); - } - - subscribe(destination, handler) { - if (!this.connected) { - const that = this; - this.connect().then(() => { - that.subscribe(destination, handler); - }); - } else { - const sub = this.client.subscribe(destination, handler); - this.subscribeMap.set(destination, {dest: destination, handler: handler, sub: sub}); - } - } - - unsubscribe(destination) { - const subscribe = this.subscribeMap.get(destination); - if (subscribe && subscribe.sub) { - subscribe.sub.unsubscribe(); - } else if (subscribe) { - this.subscribeMap.delete(destination); - } - } - - send(destination, body) { - if (body) { - body = JSON.stringify(body); - this.client.send(destination, {}, body); - } else { - console.error('stomp send body required'); - } - } -} - -export default StompClient; diff --git a/src/jlmap3d/jl3ddevicetrain/component/deviceconnect.js b/src/jlmap3d/jl3ddevicetrain/component/deviceconnect.js deleted file mode 100644 index a2e08f32a..000000000 --- a/src/jlmap3d/jl3ddevicetrain/component/deviceconnect.js +++ /dev/null @@ -1,43 +0,0 @@ -import StompClient from '@/utils/sock'; - -// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation'; -// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp'; -import { getBaseUrl } from '@/utils/baseUrl' -import { getToken } from '@/utils/auth'; - -// 定于仿真socket接口 -export function DeviceSubscribe(jlmap3d,routegroup,jsonwebwork) { - - const scope = this; - this.map = null; - - this.teststomp = new StompClient(); - this.topic = '/user/queue/simulation/jl3d/'+routegroup; - let header = {'X-Token': getToken() }; - - - this.updatamap = function() { - - }; - - this.socketon = function(topic) { - try { - // console.log("teststomp"); - scope.teststomp.subscribe(topic, callback, header); - } catch (error) { - console.error('websocket订阅失败'); - } - - }; - - this.socketoff = function(topic) { - scope.teststomp.unsubscribe(topic); - }; - - // 仿真socket接口回调函数 - function callback(Response) { - - - } - -} diff --git a/src/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js b/src/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js deleted file mode 100644 index fa1fa9e21..000000000 --- a/src/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js +++ /dev/null @@ -1,147 +0,0 @@ - -export function Jdqcontrol(){ - let scope = this; - - this.devicelist = []; - - this.jdqinit = function(){ - - } - - this.jdqraycast = function(){ - - } - - //配置继电器文字信息 - this.jdqdevicelist = function(selectmodel){ - if(scope.devicelist.length>0){ - scope.devicelist = []; - } - for(let i=0,leni=selectmodel.children.length;i=1){ - let point = scope.playlist[scope.playorder][i].curve.getPointAt(1); - //更新模型坐标 - scope.playlist[scope.playorder][i].connectmodel.position.x = point.x; - scope.playlist[scope.playorder][i].connectmodel.position.y = point.y; - scope.playlist[scope.playorder][i].connectmodel.position.z = point.z; - scope.playlist[scope.playorder][i].enable = false; - scope.playlist[scope.playorder][i].status = "end"; - scope.playlist[scope.playorder][i].progress = 0; - - - if(i >= scope.playlist[scope.playorder].length-1){ - if(scope.playorder >= scope.playlist.length-1 ){ - scope.playlist = null; - scope.status = true; - scope.enable = false; - main.animationmsgshowoff(); - scope.nowmodelname = undefined; - scope.playorder = null; - break; - }else{ - scope.playorder += 1; - } - } - - - }else{ - // console.log(scope.animatelist[k].connectmodel); - if(scope.nowmodelname != scope.playlist[scope.playorder][i].connectmodel.name){ - scope.nowmodelname = scope.playlist[scope.playorder][i].connectmodel.name; - main.animationmsgshowon(scope.playlist[scope.playorder][i].connectmodel); - } - //根据动画进度获取动画轨迹上点 - scope.status = false; - let point = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress); - - //更新模型坐标 - scope.playlist[scope.playorder][i].connectmodel.position.x = point.x; - scope.playlist[scope.playorder][i].connectmodel.position.y = point.y; - scope.playlist[scope.playorder][i].connectmodel.position.z = point.z; - - if(scope.helpbox){ - scope.helpbox.update(); - } - if(scope.textplane){ - - scope.textplane.position.x = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[12]; - scope.textplane.position.y = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[13]+100; - scope.textplane.position.z = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[14]; - } - //判断模型转向 - if(scope.playlist[scope.playorder][i].directchange){ - let tangent = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress+0.001); - // scope.animatelist[k] - tangent = null; - } - //增加动画进度,释放点变量 - scope.playlist[scope.playorder][i].progress += scope.playlist[scope.playorder][i].speed; - point = null; - - } - - } - - } - } - } - - -} diff --git a/src/jlmap3d/jl3ddevicetrain/config.js b/src/jlmap3d/jl3ddevicetrain/config.js deleted file mode 100644 index 073cc3b34..000000000 --- a/src/jlmap3d/jl3ddevicetrain/config.js +++ /dev/null @@ -1,73 +0,0 @@ -import { getBaseUrl } from '@/utils/baseUrl'; -import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; - - -const BASE_API = getBaseUrl(); -let modelurl = JL3D_LOCAL_STATIC+"/MODEL/jdq/"; -// if(BASE_API == 'https://joylink.club/jlcloud'){ -// modelurl = "https://joylink.club/oss/jdq/"; -// }else if(BASE_API == 'https://test.joylink.club/jlcloud'){ -// modelurl = "https://test.joylink.club/oss/jdq/"; -// } - -var Staticmodel = { - Jdq1: { - id: "1", - name: "继电器a1700", - deviceType: "jdq1700", - type: "training", - picUrl: "", - assetUrl: modelurl + "jdq1700.FBX" - }, - Jdq2: { - id: "1", - name: "继电器b1700", - deviceType: "jdq1700", - type: "training", - picUrl: "", - assetUrl: modelurl + "jdq1700.FBX" - }, - Jdq3: { - id: "1", - name: "继电器c1700", - deviceType: "jdq1700", - type: "training", - picUrl: "", - assetUrl: modelurl + "jdq1700.FBX" - }, - Jdq4: { - id: "1", - name: "继电器h18", - deviceType: "jdq", - type: "training", - picUrl: "", - assetUrl: modelurl + "jdqh18.FBX" - }, - Jdq5: { - id: "1", - name: "继电器H125", - deviceType: "jdq", - type: "training", - picUrl: "", - assetUrl: modelurl + "jdqH125.FBX" - }, - - Jdq6: { - id: "1", - name: "继电器135", - deviceType: "jdq", - type: "training", - picUrl: "", - assetUrl: modelurl + "jdq135.FBX" - }, - Jdqg:{ - id: "0", - name: "继电器柜", - deviceType: "jdqg", - type: "training", - picUrl: "", - assetUrl: modelurl + "jdqg.FBX" - } -} - -export { Staticmodel } diff --git a/src/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js b/src/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js deleted file mode 100644 index 511475cdb..000000000 --- a/src/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js +++ /dev/null @@ -1,576 +0,0 @@ -import { Staticmodel } from '@/jlmap3d/jl3ddevicetrain/config.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 { ModelManager } from '@/jlmap3d/jl3ddevicetrain/loader.js'; -import { Moveanimate } from '@/jlmap3d/jl3ddevicetrain/component/moveanimate.js'; -import { Jdqcontrol } from '@/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js'; - -import { DragControls } from '@/jlmap3d/main/control/DragControls.js'; - -import StompClient from '@/jlmap3d/jl3ddevicetrain/component/StompClient.js'; -// import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js'; - -// import StompClient from '@/utils/sock'; -import {Stats} from '@/jlmap3d/main/lib/stats.min.js'; - -var clock = new THREE.Clock(); -export function Jl3ddevice(dom,serviceid) { - let scope = this; - //helpbox选中包围框 - //textplane三维介绍标牌 - let helpbox,textplane; - let connect = null; - this.dom = dom; - this.nowcode = null; - this.animateswitch = false; - this.mixers = []; - this.showmodel = null; - //场景状态 - this.status = 0; - //动画状态 - this.animastats = false; - //当前选中模型 - this.selectmodel = null; - //当前动画播放模型 - this.animationmodel = null; - //初始化webgl渲染 - let renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio( window.devicePixelRatio ); - renderer.setSize(dom.offsetWidth, dom.offsetHeight); - - // renderer.shadowMap.enabled = true; - // renderer.shadowMap.type = THREE.PCFSoftShadowMap; - renderer.setClearColor( 0x000000, 0 ); - this.dom.appendChild(renderer.domElement); - - //定义相机 - let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 4000); - camera.position.set(-1000, 1500, 0); - camera.aspect = dom.offsetWidth / dom.offsetHeight; - camera.updateProjectionMatrix(); - - //视角轨迹控制器 - this.controls = new THREE.OrbitControls(camera, dom); - this.controls.enabled = true; - this.controls.target = new THREE.Vector3(500,1000,0); - this.controls.screenSpacePanning = true; - this.controls.update(); - this.controls.maxDistance = 3000; - - //定义场景(渲染容器) - let scene = new THREE.Scene(); - var bgTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/other.jpg"); - scene.background = bgTexture; - - //定义全局光 - let ambientLight = new THREE.AmbientLight(0xffffff, 1.3); - scene.add(ambientLight); - - var light = new THREE.HemisphereLight( 0xffffff, 0x444444 ); - light.position.set( 0, 200, 0 ); - scene.add( light ); - - //网格地面 - // var grid = new THREE.GridHelper( 1000, 20, 0x000000, 0x000000 ); - // grid.material.opacity = 0.2; - // grid.material.transparent = true; - // grid.position.x = 10000; - // scene.add( grid ); - let objects = []; - let dragcontrol = new THREE.DragControls( objects, camera, scope.dom ); - dragcontrol.enabled = false; - - //菜单选中设备更新设备较少 - this.updateselect = function(updata){ - // console.log(updata); - if(helpbox){ - scene.remove( helpbox ); - helpbox = null; - } - helpbox = new THREE.BoxHelper( updata.mesh, 0xff0000 ); - // console.log(updata.mesh); - let point = { - x:updata.mesh.matrixWorld.elements[12], - y:updata.mesh.matrixWorld.elements[13], - z:updata.mesh.matrixWorld.elements[14] - }; - settext(updata.mesh,point) - getdevicemsg(updata.mesh.name); - scene.add( helpbox ); - } - - //返回设备选择 - this.backselect = function(){ - move3(); - updatemenulist(scope.jdqcontrol.devicelist,"all"); - - scope.modelmanager.controllist[0].position.set(19,1270,-275); - scope.modelmanager.controllist[0].rotation.y = -Math.PI/2; - scope.modelmanager.controllist[0].rotation.z = -Math.PI/2; - - scope.modelmanager.controllist[1].position.set(19,1270,-165); - scope.modelmanager.controllist[1].rotation.y = -Math.PI/2; - scope.modelmanager.controllist[1].rotation.z = -Math.PI/2; - - scope.modelmanager.controllist[2].position.set(19,1270,-55); - scope.modelmanager.controllist[2].rotation.y = -Math.PI/2; - scope.modelmanager.controllist[2].rotation.z = -Math.PI/2; - - scope.modelmanager.controllist[3].position.set(19,1270,65); - scope.modelmanager.controllist[3].rotation.y = -Math.PI/2; - scope.modelmanager.controllist[3].rotation.z = -Math.PI/2; - - scope.modelmanager.controllist[4].position.set(19,1270,170); - scope.modelmanager.controllist[4].rotation.y = -Math.PI/2; - scope.modelmanager.controllist[4].rotation.z = -Math.PI/2; - - scope.modelmanager.controllist[5].position.set(19,1270,280); - scope.modelmanager.controllist[5].rotation.y = -Math.PI/2; - scope.modelmanager.controllist[5].rotation.z = -Math.PI/2; - - camera.position.set(-1000, 1500, 0); - scope.controls.target = new THREE.Vector3(500,1000,0); - scope.controls.update(); - scope.status = '0'; - if(textplane){ - scene.remove(textplane); - textplane.geometry.dispose(); - textplane.material.dispose(); - } - scope.selectmodel = null; - scope.jdqcontrol.devicelist = []; - scope.animastats = false; - updatemsg(); - }; - - //设备分解、归位动画按钮 - this.disperdevice1 = function(){ - - if(scope.status == '1'){ - if(moveanima.status == true){ - if(scope.animastats == false){ - scope.animastats = true; - move1(); - } else if(scope.animastats == true){ - scope.animastats = false; - move2(); - } - } - - - } - }; - - this.disperdevice2 = function(){ - - if(scope.status == '1'){ - if(moveanima.status == true){ - if(scope.animastats == false){ - scope.animastats = true; - moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"chaijie"],true); - } else if(scope.animastats == true){ - scope.animastats = false; - moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true); - } - } - - - } - }; - - - - // let stats = new Stats(); - // dom.appendChild( stats.dom ); - - document.addEventListener( "mousedown", onselect, false ); - document.addEventListener( "mouseup", onmouseup, false ); - document.addEventListener( "touchstart", ontouch, false ); - window.onresize = function () { - camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight; - camera.updateProjectionMatrix(); - renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight); - } - - this.jdqcontrol = new Jdqcontrol(); - - let moveanima = new Moveanimate(scope); - - this.anime = null; - this.modelmanager = new ModelManager(); - this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) { - moveanima.initlistnew( scope.modelmanager.controllist); - connect = new StompClient(); - // debugger - connect.subscribe("/queue/simulation/"+serviceid,callback); - animate(); - }); - this.sendmsg = function (type,index){ - // console.log(index); - let msg = { - // deskId:serviceid, - id:index+1, - on:null - }; - if(type == "0"){ - msg.on = true; - } - if(type == "1"){ - msg.on = false; - } - //"/app/topic/relay/"+msg.id+"/control/"+msg.on - - connect.send("/app/topic/simulation/"+serviceid+"/relay/"+msg.id+"/control/"+msg.on,{}); - } - - this.upmodelaction = function(type,index){ - - if(type == "0"){ - scope.modelmanager.actionlist[index].reset(); - scope.modelmanager.actionlist[index].time = 0; - scope.modelmanager.actionlist[index].timeScale = 1; - scope.modelmanager.actionlist[index].play(); - } - if(type == "1"){ - scope.modelmanager.actionlist[index].reset(); - scope.modelmanager.actionlist[index].time = scope.modelmanager.actionlist[index]._clip.duration; - scope.modelmanager.actionlist[index].timeScale = -1; - scope.modelmanager.actionlist[index].play(); - } - }; - - this.buttoncontrol = function(action){ - if("startstop"){ - moveanima.startstop(); - } - if("next"){ - moveanima.next(); - } - if("before"){ - moveanima.before(); - } - - }; - - this.resetmodel = function(){ - moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true); - }; - //循环渲染函数 - let delta; - let data; - function callback(Response){ - // console.log(Response); - data = JSON.parse(Response.body); - // console.log(data); - upjdqstats(data); - } - function animate() { - - scope.anime = requestAnimationFrame(animate); - renderer.render(scene, camera); - moveanima.animateupdate(); - // scope.controls.update(); - // stats.update(); - delta = clock.getDelta(); - if(textplane){ - textplane.lookAt(camera.position); - } - if (scope.mixers) { - for (let i = 0; i < scope.mixers.length; i++) { - if (scope.mixers[i]._actions[0].isRunning()) { - scope.mixers[i].update(delta); - } - } - } - - } - - - function move1(){ - moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"on"],true); - } - - function move2(){ - if(scope.selectmodel){ - moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"off"],true); - } - } - - function move3(){ - if(scope.selectmodel){ - moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true); - } - - } - function ontouch(event){ - if(scope.status == '0'){ - let raycaster = new THREE.Raycaster(); - //定义平面鼠标点击坐标 - - let mouse = new THREE.Vector2(); - mouse.x = (event.touches[0].pageX / dom.offsetWidth) * 2 - 1; - mouse.y = -(event.touches[0].pageY / dom.offsetHeight) * 2 + 1; - - raycaster.setFromCamera( mouse, camera ); - for(let i=0,leni=scope.modelmanager.controllist.length;i { - jdq1.mesh.stats = "0"; - jdq1.mesh.position.x = 19; - jdq1.mesh.position.z = -275; - jdq1.mesh.position.y = 1270; - jdq1.mesh.rotation.y = -Math.PI/2; - jdq1.mesh.rotation.z = -Math.PI/2; - - jdq2.mesh.stats = "0"; - jdq2.mesh.position.x = 19; - jdq2.mesh.position.z = -165; - jdq2.mesh.position.y = 1270; - jdq2.mesh.rotation.y = -Math.PI/2; - jdq2.mesh.rotation.z = -Math.PI/2; - - jdq3.mesh.stats = "0"; - jdq3.mesh.position.x = 19; - jdq3.mesh.position.z = -55; - jdq3.mesh.position.y = 1270; - jdq3.mesh.rotation.y = -Math.PI/2; - jdq3.mesh.rotation.z = -Math.PI/2; - - jdq4.mesh.stats = "0"; - jdq4.mesh.position.x = 19; - jdq4.mesh.position.z = 65; - jdq4.mesh.position.y = 1270; - jdq4.mesh.rotation.y = -Math.PI/2; - jdq4.mesh.rotation.z = -Math.PI/2; - - jdq5.mesh.stats = "0"; - jdq5.mesh.position.x = 19; - jdq5.mesh.position.z = 170; - jdq5.mesh.position.y = 1270; - jdq5.mesh.rotation.y = -Math.PI/2; - jdq5.mesh.rotation.z = -Math.PI/2; - - jdq6.mesh.stats = "0"; - jdq6.mesh.position.x = 19; - jdq6.mesh.position.z = 280; - jdq6.mesh.position.y = 1270; - jdq6.mesh.rotation.y = -Math.PI/2; - jdq6.mesh.rotation.z = -Math.PI/2; - - scope.controllist.push(jdq1.mesh); - scope.controllist.push(jdq2.mesh); - scope.controllist.push(jdq3.mesh); - scope.controllist.push(jdq4.mesh); - scope.controllist.push(jdq5.mesh); - scope.controllist.push(jdq6.mesh); - // console.log(jdq1); - scope.actionlist.push(jdq1.action); - scope.actionlist.push(jdq2.action); - scope.actionlist.push(jdq3.action); - scope.actionlist.push(jdq4.action); - scope.actionlist.push(jdq5.action); - scope.actionlist.push(jdq6.action); - - scene.add(jdq1.mesh); - scene.add(jdq2.mesh); - scene.add(jdq3.mesh); - scene.add(jdq4.mesh); - scene.add(jdq5.mesh); - scene.add(jdq6.mesh); - scene.add(scope.jdqg.mesh); - resolve("success"); //['成功了', 'success'] - }).catch((error) => { - //console.log(error); - }); - - }); - } - -} - -function fbxpromise(asset,mixers,model){ - return new Promise(function(resolve, reject){ - var loader = new THREE.FBXLoader(); - - loader.load( asset.assetUrl, function ( object ) { - let mixer = new THREE.AnimationMixer( object ); - // object.traverse( function ( child ) { - // if ( child.isMesh ) { - // child.castShadow = true; - // child.receiveShadow = true; - // } - // } ); - - //设置透明贴图的材质属性 - for(let i=0,leni=object.children.length;i0){ - - model.action = mixer.clipAction( object.animations[ 0 ] ); - model.action.setLoop(THREE.LoopOnce); - model.action.clampWhenFinished = true; - // model.action.play(); - // scope.actionlist.push("1"); - mixers.push(mixer); - } - resolve(asset.deviceType); - } ); - - }); -} diff --git a/src/jlmap3d/jl3ddrive/jl3ddrive.js b/src/jlmap3d/jl3ddrive/jl3ddrive.js index 39f4274e1..50aa53bf9 100644 --- a/src/jlmap3d/jl3ddrive/jl3ddrive.js +++ b/src/jlmap3d/jl3ddrive/jl3ddrive.js @@ -8,7 +8,7 @@ import {MTLLoader} from '@/jlmap3d/main/loaders/MTLLoader.js'; import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader.js'; // data -import { Jl3ddata } from '@/jlmap3d/main/model/jl3ddata'; +import { Jl3ddata } from '@/jlmap3d/main/newmodel/jl3ddata'; // setconfig import { SetCamera } from '@/jlmap3d/config/SetCamera'; @@ -21,10 +21,8 @@ import {OrbitControls} from '@/jlmap3d/main/control/OrbitControls.js'; import { DragControls } from '@/jlmap3d/main/control/DragControls.js'; // 加载器 -import { DriverLoad } from '@/jlmap3d/main/loaders/DriverLoad'; import { DriverLoadNew } from '@/jlmap3d/main/loaders/DriverLoadNew'; // connect -import {Jl3dDriving} from '@/jlmap3d/jl3ddrive/moveupdate/DrivingConnect'; import {Jl3dDrivingNew} from '@/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew'; import { getPublishMapVersion, getPublishMapDetail, getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata'; @@ -158,57 +156,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj getPublish3dMapDetail(mapId).then(netdata => { // console.log(netdata); let assetsdata = JSON.parse(netdata.data.sections); - if(assetsdata.link){ - scope.datatype = "old"; - // datanew(); - // scope.jsonwebwork = new Worker(JL3D_LOCAL_STATIC+"/workertest/jsonworker.js"); - // scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork); - // scope.Subscribe.socketon(scope.Subscribe.topic); - scope.Subscribe = new Jl3dDriving(mixers,updatemmi,sound,translation,routegroup); - - scope.Subscribe.socketon(scope.Subscribe.topic); - DriverLoad(data,scope,netdata.data,sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails, camera, controls3, scene,mixers,storemod); - var timer = setInterval(function() { - if(trainlisttest){ - if(trainlisttest.group){ - if(trainlisttest.group.children[0]){ - // console.log(trainlisttest.group.children[0].name); - updatemmi.updatedrivingcode(trainlisttest.group.children[0].name); - scope.Subscribe.initdrivercode(trainlisttest.group.children[0].name); - for(let k in rails.switchrail){ - const ddd = storemod.getters['map/getDeviceByCode'](k); - let switchdata = rails.switchrail[k]; - rails.switchrail[k].locateType = ddd.locateType; - - if(ddd.locateType == "01"){ - //1--向左 2--向右 - //__\__ __/__ - if(rails.switchrail[k].directtype == "1"){ - rails.linkrail[switchdata.alink].lconnect = switchdata.blink; - rails.linkrail[switchdata.blink].rconnect = switchdata.alink; - }else if(rails.switchrail[k].directtype == "2"){ - rails.linkrail[switchdata.alink].rconnect = switchdata.blink; - rails.linkrail[switchdata.blink].lconnect = switchdata.alink; - } - - }else if(ddd.locateType == "02"){ - if(rails.switchrail[k].directtype == "1"){ - rails.linkrail[switchdata.alink].lconnect = switchdata.clink; - rails.linkrail[switchdata.clink].rconnect = switchdata.alink; - }else if(rails.switchrail[k].directtype == "2"){ - rails.linkrail[switchdata.alink].rconnect = switchdata.clink; - rails.linkrail[switchdata.clink].lconnect = switchdata.alink; - } - } - } - clearInterval(timer); - } - } - } - - }, 2000); - }else{ scope.datatype = "new"; driverWebWorker = new Worker(JL3D_LOCAL_STATIC+"/workertest/driverWebWorker.js"); scope.Subscribe = new Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,driverWebWorker,stats); @@ -230,7 +178,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj }, 2000); - } + }); }); diff --git a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js deleted file mode 100644 index 5324265a7..000000000 --- a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js +++ /dev/null @@ -1,886 +0,0 @@ -import StompClient from '@/utils/sock'; - -import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation'; - -import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp'; -import { getToken } from '@/utils/auth'; -import router from '@/router/index_APP_TARGET'; - -// 定于仿真socket接口 -export function Jl3dDriving(mixers, updatemmi, sound, translation, routegroup) { - - const scope = this; - this.map = null; - const toppic = '/app/topic/simulation/client/' + routegroup + '/drive'; - var trainlisttest = null; - var sectionlist = null; - var signallist = null; - var stationstandlist = null; - var sectionlist = null; - var materials = null; - var actions = null; - var rails = null; - var links = null; - - var scenes = null; - - var code = null; - - var drivingcode = null; - var drivingspeed = null; - var drivingaptspeed = null; - - let driverswitch = false; - - const stoptimer = null; - const num = 30; - const pointstand = null; - // run as plane = 01; - // reset = 02; - var datatype = '00'; - this.teststomp = new StompClient(); - this.topic = '/user/queue/simulation/jl3d/' + routegroup; - const header = {'X-Token': getToken() }; - - this.updatamap = function(newsectionlist, newlinklist, newsignallist, newstationstandlist, newtrainlisttest, newrealsectionlist, newrails, materiallist, nowaction, scene) { - // console.log(mapdata); - // console.log(newtrainlisttest); - trainlisttest = newtrainlisttest; - sectionlist = newsectionlist; - signallist = newsignallist; - stationstandlist = newstationstandlist; - materials = materiallist; - scenes = scene; - actions = nowaction; - links = newlinklist; - rails = newrails; - }; - - this.initdrivercode = function(code) { - drivingcode = code; - }; - - this.socketon = function(topic) { - try { - // console.log("teststomp"); - scope.teststomp.subscribe(topic, callback, header); - } catch (error) { - console.error('websocket订阅失败'); - } - - }; - - this.socketoff = function(topic) { - scope.teststomp.unsubscribe(topic); - for (let i = 0; i < trainlisttest.group.children.length; i++) { - if (trainlisttest.group.children[i].dispose == false) { - code = trainlisttest.group.children[i].name; - trainlisttest.list[code].rotation.y = 0; - trainlisttest.list[code].doorStatus = '01'; - trainlisttest.list[code].speed = 0; - trainlisttest.group.children[i].dispose = true; - trainlisttest.group.children[i].position.x = -50000; - trainlisttest.group.children[i].position.y = -50000; - trainlisttest.group.remove(trainlisttest.group.children[i]); - i--; - } - } - }; - - // 仿真socket接口回调函数 - function callback(Response) { - // console.log(Response); - // 对象化数据 - const data = JSON.parse(Response.body); - // 遍历后台数据 - - // 判断消息类型 - // if(data.type == "Simulation_TrainPosition"){ - // - // - // } - // console.log(data); - // console.log(data); - switch (data.type) { - case 'Simulation_Driver_Change': - - trainlisttest.group.remove(trainlisttest.list[drivingcode]); - trainlisttest.list[data.body.code].dispose = true; - trainlisttest.list[drivingcode].dispose = true; - drivingcode = data.body.code; - trainlisttest.group.add(trainlisttest.list[drivingcode]); - - // sound.volswitch = true; - updatemmi.updatedrivingcode( data.body.code); - break; - case 'Simulation_TrainSpeed': - - trainspeed(data); - break; - case 'SJL3D_TrainStatus': - trainstatus(data); - break; - case 'Simulation_DeviceStatus': - devicestatus(data); - break; - case 'Simulation_Drive_Data_Routing': - updatemmi.updatedrivedata(data.body); - break; - case 'Simulation_Reset': - simulationreset(data); - default : - // TODO - } - - // if(data.type == 'Simulation_Drive_Data_Routing'){ - // updatemmi.updatedrivedata(data.body); - // } - // - // if (data.type == 'Simulation_Driver_Change') { - // drivingcode = data.body.code; - // updatemmi.updatedrivingcode( data.body.code); - // } - // - // if (data.type == 'Simulation_TrainSpeed') { - // trainspeed(data); - // } - // - // if (data.type == 'SJL3D_TrainStatus') { - // trainstatus(data); - // } - // - // if (data.type == 'Simulation_DeviceStatus') { - // devicestatus(data); - // } - - } - - function trainspeed(data) { - // console.log(data); - if (trainlisttest) { - for (let tl = 0; tl < data.body.length; tl++) { - code = data.body[tl].id; - if (trainlisttest.list[code].speed != data.body[tl].v) { - trainlisttest.list[code].speed = data.body[tl].v; - - if (trainlisttest.list[code].runMode == '02') { - - if (trainlisttest.list[code].isStandTrack == true) { - trainlisttest.list[code].speeds = parseFloat(data.body[tl].v * 10 / 36 / 25 / trainlisttest.list[code].len); - } else { - trainlisttest.list[code].speeds = parseFloat(data.body[tl].v * 10 / 36 / 25 / trainlisttest.list[code].len); - } - } else { - - trainlisttest.list[code].speeds = parseFloat(data.body[tl].v * 10 / 36 / 25 / trainlisttest.list[code].len); - } - - if (code == drivingcode) { - // if (data.body[tl].v >0) { - // updatemmi.updatenowspeed(data.body[tl].v); - // } else { - - updatemmi.updatenowspeed(Math.abs(data.body[tl].v)); - // console.log(data.body[i]); - - // } - } - } - - if (code == drivingcode) { - // if(sound.volswitch == true){ - // sound.setVolume( data.body[tl].v/100 ); - // } - if (data.body[tl].atpv) { - updatemmi.updateatpspeed(data.body[tl].atpv); - } else { - updatemmi.updateatpspeed(-1); - } - if (data.body[tl].atov) { - updatemmi.updateatospeed(data.body[tl].atov); - } else { - updatemmi.updateatospeed(-1); - } - if (trainlisttest.list[code].progress < 1) { - const syncdata = { - type: 'Train', - code: code, - linkCode: trainlisttest.list[code].nowcode, - percent: 0 - }; - if (trainlisttest.list[code].status == '02') { - if (trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode) { - if ((trainlisttest.list[code].linkOffsetPercent / trainlisttest.list[code].pc) >= trainlisttest.list[code].targetpercent) { - syncdata.percent = trainlisttest.list[code].progress; - } else { - syncdata.percent = trainlisttest.list[code].progress * trainlisttest.list[code].pc; - } - } else { - syncdata.percent = trainlisttest.list[code].progress; - } - - } else { - if (trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode) { - if ((trainlisttest.list[code].linkOffsetPercent / trainlisttest.list[code].pc) <= trainlisttest.list[code].targetpercent) { - syncdata.percent = (1 - trainlisttest.list[code].progress); - } else { - syncdata.percent = (1 - trainlisttest.list[code].progress) * trainlisttest.list[code].pc; - } - } else { - syncdata.percent = (1 - trainlisttest.list[code].progress); - } - } - // console.log("send"); - // console.log(trainlisttest.list[code]); - // - // console.log(syncdata); - // console.log("============="); - scope.teststomp.send(toppic, syncdata); - } - - } - } - } - } - - function trainstatus(data) { - // console.log(data.body); - for (let i = data.body.length - 1; i >= 0; i--) { - // 遍历列车对象组 - // console.log(trainlisttest); - if (trainlisttest) { - - code = data.body[i].code; - // 剔除不显示的车 - // 找到对应列车 - - if (code == drivingcode) { - - driverswitch = data.body[i].runMode; - // 更新车组号 - updatemmi.updatetrainnum(data.body[i].groupNumber); - // 更新列车 - if (data.body[i].parkRemainTime > 0) { - updatemmi.updatestoptime(translation.stopTime + parseInt(data.body[i].parkRemainTime)); - } else { - if (data.body[i].runMode == '02') { - updatemmi.updatestoptime(translation.trainAtoOn); - } else { - if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress > 0.95 && trainlisttest.list[code].speed <= 0) { - // if(stoptimer){ - // - // }else{ - // stoptimer = setInterval(function(){ - // if(num >=0){ - // updatemmi.updatestoptime("停站时间:"+num); - // num --; - // } - // },1000); - // } - - } else { - updatemmi.updatestoptime(translation.trainAtoOff); - } - } - } - } - trainlisttest.list[code].runMode = data.body[i].runMode; - - // 车门开关验证 - if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') { - // console.log("close"); - trainlisttest.list[code].doorStatus = '01'; - 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].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') { - // console.log("open"); - trainlisttest.list[code].doorStatus = '02'; - for (let an = actions[code].top.length - 1; an >= 0; an--) { - actions[code].top[an].reset(); - actions[code].top[an].time = 0; - actions[code].top[an].timeScale = 1; - actions[code].top[an].play(); - } - } - // if (data.body[i].directionType == '02') { - // - // } else { - // if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') { - // // console.log("close"); - // trainlisttest.list[code].doorStatus = '01'; - // for (let an=actions[code].down.length-1; an>=0; an--) { - // actions[code].down[an].reset(); - // actions[code].down[an].time = actions[code].top[an]._clip.duration; - // actions[code].down[an].timeScale = -1; - // actions[code].down[an].play(); - // } - // } else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') { - // // console.log("open"); - // trainlisttest.list[code].doorStatus = '02'; - // for (let an=actions[code].down.length-1; an>=0; an--) { - // actions[code].down[an].reset(); - // actions[code].down[an].time = 0; - // actions[code].down[an].timeScale = 1; - // actions[code].down[an].play(); - // } - // } - // } - // 遍历获取所在轨道 - - if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) { - - if (rails.linkrail[data.body[i].linkCode]) { - // console.log(trainlisttest.group); - if (trainlisttest.group.children.length < 1) { - trainlisttest.group.add(trainlisttest.list[code]); - drivingcode = code; - updatemmi.updatedrivingcode(drivingcode); - } - if (trainlisttest.list[code].mixerpush == false) { - for (let mi = 0, lenmi = trainlisttest.list[code].mixer.length; mi < lenmi; mi++) { - mixers.push(trainlisttest.list[code].mixer[mi]); - } - trainlisttest.list[code].mixerpush = true; - } - // trainlisttest.group.add(trainlisttest.list[code]); - trainlisttest.list[code].position.y = 0; - trainlisttest.list[code].progress = 0; - // trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent; - trainlisttest.list[code].dispose = false; - trainlisttest.list[code].nowcode = data.body[i].linkCode; - - trainlisttest.list[code].pc = 1; - // console.log(data.body[i]); - if (data.body[i].directionType == '02') { // 向右 - - if (data.body[i].targetStation) { - - trainlisttest.list[code].stopstation = data.body[i].targetStation; - // console.log(rails.stops[data.body[i].targetStation].direct2.percent); - trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct2.percent; - trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent; - trainlisttest.list[code].progress = data.body[i].linkOffsetPercent / trainlisttest.list[code].pc; - trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; - trainlisttest.list[code].targetLink = data.body[i].targetLink; - } else { - trainlisttest.list[code].progress = data.body[i].linkOffsetPercent; - trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; - } - - trainlisttest.list[code].status = '02'; - - trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft; - const point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(trainlisttest.list[code].progress); - trainlisttest.list[code].rotation.y = 0; - trainlisttest.list[code].position.x = point.x; - trainlisttest.list[code].position.y = 0; - for (let tl = 0; tl < 6; tl++) { - trainlisttest.list[code].children[tl].position.z = point.z; - } - } else if (data.body[i].directionType == '03') { // 向左 - - // if(trainlisttest.list[code].rname == "006"){ - // console.log("0000000000000000"); - // console.log(data.body[i].linkOffsetPercent); - // } - if (data.body[i].targetStation) { - - trainlisttest.list[code].stopstation = data.body[i].targetStation; - trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct1.percent; - // console.log(data.body[i].targetLinkPercent); - // console.log(rails.stops[data.body[i].targetStation].direct1.percent); - // console.log(trainlisttest.list[code].pc); - trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent; - trainlisttest.list[code].progress = 1 - data.body[i].linkOffsetPercent / trainlisttest.list[code].pc; - trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; - trainlisttest.list[code].targetLink = data.body[i].targetLink; - } else { - trainlisttest.list[code].progress = 1 - data.body[i].linkOffsetPercent; - trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; - } - // console.log("progress:"+trainlisttest.list[code].progress); - // console.log("linkOffsetPercent:"+trainlisttest.list[code].linkOffsetPercent); - // console.log("datatarget:"+ data.body[i].targetLinkPercent); - // console.log("directpercent:"+trainlisttest.list[code].targetpercent); - // console.log("===================="); - trainlisttest.list[code].status = '03'; - - trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright; - const point = rails.linkrail[data.body[i].linkCode].lineright.getPointAt(trainlisttest.list[code].progress); - trainlisttest.list[code].rotation.y = Math.PI; - trainlisttest.list[code].position.x = point.x; - trainlisttest.list[code].position.y = 0; - for (let tl = 0; tl < 6; tl++) { - trainlisttest.list[code].children[tl].position.z = -point.z; - } - } - trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact; - // trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack; - - // trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance; - - if (data.body[i].speed == 0) { - trainlisttest.list[code].speeds = data.body[i].speed; - trainlisttest.list[code].speeds = 0; - // trainlisttest.list[code].startmark = 1; - } else { - trainlisttest.list[code].speeds = data.body[i].speed; - trainlisttest.list[code].speeds = parseFloat(data.body[i].speed * 10 / 36 / 25 / trainlisttest.list[code].len); - } - - } - - } else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) { - trainlisttest.group.remove(trainlisttest.list[code]); - trainlisttest.list[code].progress = null; - trainlisttest.list[code].dispose = true; - code = trainlisttest.group.children[i].name; - trainlisttest.list[code].rotation.y = 0; - trainlisttest.list[code].doorStatus = '01'; - trainlisttest.list[code].speed = 0; - trainlisttest.list[code].position.x = -50000; - trainlisttest.list[code].position.y = -50000; - trainlisttest.list[code].pc = 1; - } else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) { - - if (rails.linkrail[data.body[i].linkCode]) { - if (driverswitch == '02' && code == drivingcode) { - updatemmi.updatenowspeed(data.body[i].speed); - if (data.body[i].atpSpeed) { - updatemmi.updateatpspeed(data.body[i].atpSpeed); - } else { - updatemmi.updateatpspeed(-1); - } - if (data.body[i].targetSpeed) { - updatemmi.updateatospeed(data.body[i].targetSpeed); - } else { - updatemmi.updateatospeed(-1); - } - if (data.body[i].maLen) { - updatemmi.updatenowlen(data.body[i].maLen); - } else { - updatemmi.updatenowlen(0); - } - // if(trainlisttest.list[code].isStandTrack == true){ - // pointstand = null; - // if(data.body[i].directionType == "02"){ - // pointstand = trainlisttest.list[code].curve.getPointAt(data.body[i].sectionOffsetPercent); - // }else{ - // pointstand = trainlisttest.list[code].curve.getPointAt(1-data.body[i].sectionOffsetPercent); - // } - // console.log(data.body[i].sectionOffsetPercent) - // console.log(pointstand.x); - // - // trainlisttest.list[code].position.x = pointstand.x; - // } - } - if (driverswitch == '05' && code == drivingcode) { - if (data.body[i].maLen) { - updatemmi.updatenowlen(data.body[i].maLen); - } else { - updatemmi.updatenowlen(0); - } - } - if (trainlisttest.list[code].status != data.body[i].directionType) { - if (data.body[i].directionType == '02') { // 向右 - - trainlisttest.list[code].progress = 0; - const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12]; - const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14]; - trainlisttest.list[code].rotation.y = 0; - trainlisttest.list[code].position.x = rotaposx; - for (let tl = 0; tl < 6; tl++) { - trainlisttest.list[code].children[tl].position.z = rotaposz; - } - - trainlisttest.list[code].progress = (rotaposx - rails.linkrail[data.body[i].linkCode].lp.x) / rails.linkrail[data.body[i].linkCode].lengthfact; - trainlisttest.list[code].status = '02'; - trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft; - trainlisttest.list[code].nextcurve = null; - - trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact; - - } else if (data.body[i].directionType == '03') { // 向左 - trainlisttest.list[code].progress = 0; - const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12]; - const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]); - trainlisttest.list[code].rotation.y = Math.PI; - trainlisttest.list[code].position.x = rotaposx; - for (let tl = 0; tl < 6; tl++) { - trainlisttest.list[code].children[tl].position.z = -rotaposz; - } - trainlisttest.list[code].progress = 1 - (rotaposx - rails.linkrail[data.body[i].linkCode].lp.x) / rails.linkrail[data.body[i].linkCode].lengthfact; - trainlisttest.list[code].status = '03'; - trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright; - trainlisttest.list[code].nextcurve = null; - - trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact; - - } - } - let nextcode; - - if (code == drivingcode) { - // console.log(data.body[i].targetStation); - // console.log("netpercent"); - // console.log(data.body[i].targetLinkPercent); - // console.log(data.body[i].linkOffsetPercent); - // console.log("3dpercent"); - // if(rails.stops[data.body[i].targetStation]){ - // console.log(rails.stops[data.body[i].targetStation].direct2.percent); - // } - // - // console.log(trainlisttest.list[code].progress); - // console.log(trainlisttest.list[code].pc); - // console.log("==============="); - // console.log(data.body[i]); - if (data.body[i].directionType == '02') { - if (trainlisttest.list[code].stopstation != data.body[i].targetStation) { - trainlisttest.list[code].stopstation = data.body[i].targetStation; - if (data.body[i].targetStation) { - trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct2.percent; - trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent; - trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; - trainlisttest.list[code].targetLink = data.body[i].targetLink; - - // trainlisttest.list[code].progress = trainlisttest.list[code].linkOffsetPercent*trainlisttest.list[code].pc; - } - } - - trainlisttest.list[code].status = '02'; - nextcode = rails.linkrail[data.body[i].linkCode].rconnect; - if (nextcode) { - // console.log(rails.linkrail[nextcode].lineleft.points); - trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft; - trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact; - } else { - - trainlisttest.list[code].nextlen = 0; - } - } else if (data.body[i].directionType == '03') { - if (trainlisttest.list[code].stopstation != data.body[i].targetStation) { - trainlisttest.list[code].stopstation = data.body[i].targetStation; - if (data.body[i].targetStation) { - trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct1.percent; - trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent; - trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; - trainlisttest.list[code].targetLink = data.body[i].targetLink; - // trainlisttest.list[code].progress = (1-trainlisttest.list[code].linkOffsetPercent)*trainlisttest.list[code].pc; - } - } - trainlisttest.list[code].status = '03'; - nextcode = rails.linkrail[data.body[i].linkCode].lconnect; - if (nextcode) { - trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright; - trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact; - } else { - - trainlisttest.list[code].nextlen = 0; - } - } - trainlisttest.list[code].nextcode = nextcode; - - // console.log(trainlisttest.list[code].nowcode); - // console.log(trainlisttest.list[code].nextcode); - // console.log(trainlisttest.list[code].curve.points); - // console.log(trainlisttest.list[code].nextcurve.points); - // console.log("========================="); - - } else { - - // trainlisttest.list[code].stopstation = data.body[i].targetStation; - // // console.log(rails.stops[data.body[i].targetStation].direct2.percent); - // trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct2.percent; - // trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent; - // trainlisttest.list[code].progress = data.body[i].linkOffsetPercent*trainlisttest.list[code].pc; - // trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; - // trainlisttest.list[code].targetLink = data.body[i].targetLink; - - let nextcode; - if (data.body[i].directionType == '02') { - if (rails.linkrail[data.body[i].linkCode].lineleft) { - nextcode = rails.linkrail[data.body[i].linkCode].rconnect; - trainlisttest.list[code].status = '02'; - if (nextcode) { - trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft; - trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact; - } - trainlisttest.list[code].nowcode = data.body[i].linkCode; - trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft; - trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact; - trainlisttest.list[code].progress = data.body[i].linkOffsetPercent; - trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; - if (data.body[i].targetStation) { - trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct2.percent; - trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent; - trainlisttest.list[code].targetLink = data.body[i].targetLink; - trainlisttest.list[code].progress = data.body[i].linkOffsetPercent / trainlisttest.list[code].pc; - } - trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed * 10 / 36 / 25 / trainlisttest.list[code].len); - } - } else if (data.body[i].directionType == '03') { - if (rails.linkrail[data.body[i].linkCode].lineright) { - nextcode = rails.linkrail[data.body[i].linkCode].lconnect; - trainlisttest.list[code].status = '03'; - - if (nextcode) { - trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright; - trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact; - } - trainlisttest.list[code].nowcode = data.body[i].linkCode; - trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright; - trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact; - trainlisttest.list[code].progress = 1 - data.body[i].linkOffsetPercent; - trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; - if (data.body[i].targetStation) { - trainlisttest.list[code].pc = data.body[i].targetLinkPercent / rails.stops[data.body[i].targetStation].direct1.percent; - trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent; - trainlisttest.list[code].targetLink = data.body[i].targetLink; - trainlisttest.list[code].progress = (1 - data.body[i].linkOffsetPercent) / trainlisttest.list[code].pc; - } - trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed * 10 / 36 / 25 / trainlisttest.list[code].len); - } - } - trainlisttest.list[code].nextcode = nextcode; - } - - // console.log(data.body[i].linkOffsetPercent); - // console.log(trainlisttest.list[code].progress); - // console.log(trainlisttest.list[code].curve.points); - // console.log(trainlisttest.list[code].nextcurve.points); - // console.log(trainlisttest.list[code].len); - // console.log(trainlisttest.list[code].nextlen); - // console.log("=========================================="); - } - } - - } - } - } - - function simulationreset(data) { - // console.log(data); - for (const k in trainlisttest.list) { - trainlisttest.list[k].dispose = true; - trainlisttest.group.remove(trainlisttest.list[k]); - trainlisttest.list[k].stopstation = null; - trainlisttest.list[k].pc = null; - trainlisttest.list[k].targetpercent = null; - trainlisttest.list[k].progress = null; - trainlisttest.list[k].linkOffsetPercent = null; - trainlisttest.list[k].targetLink = null; - drivingcode = null; - } - } - - function devicestatus(data) { - for (let i = data.body.length - 1; i >= 0; i--) { - // 0xFFFFFF - // 0xCD0000 红 - // 0xEEEE00 黄 - // 0x32CD32 绿 - if (data.body[i]._type == 'Signal') { - if (signallist) { - signalupdate(data.body[i]); - } - } - - if (data.body[i]._type == 'StationStand' ) { - if (actions) { - standupdate(data.body[i]); - } - } - - if (data.body[i]._type == 'Switch') { - if (sectionlist) { - switchupdate(data.body[i]); - } - } - - } - } - - function standupdate(data) { - code = data.code; - if ( actions[code]) { - if (data.screenDoorOpenStatus == '02' && actions[code].status == '01') { - actions[code].status = '00'; - } - if (data.screenDoorOpenStatus == '02' && actions[code].status == '00') { - actions[code].status = '02'; - actions[code].action.reset(); - actions[code].action.time = 0; - actions[code].action.timeScale = 1; - actions[code].action.play(); - } - - if (data.screenDoorOpenStatus == '01' && actions[code].status == '02') { - actions[code].status = '00'; - } - if (data.screenDoorOpenStatus == '01' && actions[code].status == '00') { - actions[code].status = '01'; - actions[code].action.reset(); - actions[code].action.time = actions[code].action._clip.duration; - actions[code].action.timeScale = -1; - actions[code].action.play(); - } - } - - } - - function signalupdate(data) { - code = data.code; - if (data.lightType == '01') { - if (signallist.list[code].mesh.code) { - signallist.list[code].mesh.status = data.status; - - // 55 - // 33 - // 77 - // 关闭 - if (data.status == '01') { - signallist.list[code].mesh.getObjectByName('red').material.map = materials[0]; - signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true; - 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[3]; - signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true; - - } - // 开放 - if (data.status == '02') { - signallist.list[code].mesh.getObjectByName('red').material.map = materials[3]; - signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true; - 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[2]; - signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true; - } - if (data.status == '03') { - signallist.list[code].mesh.getObjectByName('red').material.map = materials[3]; - signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true; - signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[1]; - signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true; - signallist.list[code].mesh.getObjectByName('green').material.map = materials[3]; - signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true; - - } - // 引导 - if (data.status == '03') { - signallist.list[code].mesh.getObjectByName('red').material.map = materials[0]; - signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true; - signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[1]; - signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true; - signallist.list[code].mesh.getObjectByName('green').material.map = materials[3]; - signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true; - - } - // 封锁 - if (data.status == '04') { - signallist.list[code].mesh.getObjectByName('red').material.map = materials[3]; - signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true; - 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[3]; - signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true; - - } - // 故障 - if (data.status == '05') { - signallist.list[code].mesh.getObjectByName('red').material.map = materials[3]; - signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true; - 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[3]; - signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true; - - } - - } - - } else if (data.lightType == '02') { - if (signallist.list[code].mesh.code) { - signallist.list[code].mesh.getObjectByName('red').material.map = materials[3]; - signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true; - 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[3]; - signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true; - - } - - } - - } - - function switchupdate(data) { - code = data.code; - for (let j = sectionlist.switchs.modellist.length - 1; j >= 0; j--) { - if (rails.switchrail[code]) { - if (rails.switchrail[code].locateType != data.locateType) { - // console.log("道岔变化:"+code); - if (data.locateType == '02') { - // console.log("02 反位"); - if (actions[sectionlist.switchs.modellist[j].code]) { - sectionlist.switchs.modellist[j].locateType = data.locateType; - actions[sectionlist.switchs.modellist[j].code].reset(); - actions[sectionlist.switchs.modellist[j].code].time = 0; - actions[sectionlist.switchs.modellist[j].code].timeScale = 1; - actions[sectionlist.switchs.modellist[j].code].play(); - } - - rails.switchrail[code].locateType = '02'; - - const testswitch = rails.switchrail[code]; - if (rails.switchrail[code].directtype == '1') { - // console.log("道岔朝向1向左"); - // console.log("aleft:"+testswitch.clink); - // console.log("cright:"+testswitch.alink); - rails.linkrail[testswitch.alink].lconnect = testswitch.clink; - rails.linkrail[testswitch.clink].rconnect = testswitch.alink; - } else if (rails.switchrail[code].directtype == '2') { - // console.log("道岔朝向2向右"); - // console.log("aright:"+testswitch.clink); - // console.log("cleft:"+testswitch.alink); - rails.linkrail[testswitch.alink].rconnect = testswitch.clink; - rails.linkrail[testswitch.clink].lconnect = testswitch.alink; - } - - } else if (data.locateType == '01') { - // console.log("01 定位"); - if (actions[sectionlist.switchs.modellist[j].code]) { - sectionlist.switchs.modellist[j].locateType = data.locateType; - actions[sectionlist.switchs.modellist[j].code].reset(); - actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration; - actions[sectionlist.switchs.modellist[j].code].timeScale = -1; - actions[sectionlist.switchs.modellist[j].code].play(); - } - - rails.switchrail[code].locateType = '01'; - const testswitch = rails.switchrail[code]; - if (rails.switchrail[code].directtype == '1') { - // console.log("道岔朝向1向左"); - // console.log("aleft"+testswitch.blink); - // console.log("cright:"+testswitch.alink); - rails.linkrail[testswitch.alink].lconnect = testswitch.blink; - rails.linkrail[testswitch.blink].rconnect = testswitch.alink; - } else if (rails.switchrail[code].directtype == '2') { - // console.log("道岔朝向2向右"); - // console.log("aright:"+testswitch.blink); - // console.log("cleft:"+testswitch.alink); - rails.linkrail[testswitch.alink].rconnect = testswitch.blink; - rails.linkrail[testswitch.blink].lconnect = testswitch.alink; - } - - } - } - j = 0; - } - } - } - -} diff --git a/src/jlmap3d/jl3dmaintainer/jlmap3dmaintainer.js b/src/jlmap3d/jl3dmaintainer/jlmap3dmaintainer.js index b473a1acb..91c00ae88 100644 --- a/src/jlmap3d/jl3dmaintainer/jlmap3dmaintainer.js +++ b/src/jlmap3d/jl3dmaintainer/jlmap3dmaintainer.js @@ -7,7 +7,7 @@ import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader'; import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; //data -import { Jl3ddata } from '@/jlmap3d/main/model/jl3ddata'; +import { Jl3ddata } from '@/jlmap3d/main/newmodel/jl3ddata'; //setconfig import { SetCamera } from '@/jlmap3d/config/SetCamera'; @@ -30,7 +30,6 @@ import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from ' //utils // import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrain'; import { UpdateTrain } from '@/jlmap3d/jl3dsimulation/connect/UpdateTrainTest'; -import { UpdateTrainNew } from '@/jlmap3d/jl3dsimulation/connect/UpdateTrainNew'; // import { ReStart } from '@/jlmap3d/main/utils/ReStart'; import {Stats} from '@/jlmap3d/main/lib/stats.min.js'; @@ -198,12 +197,7 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project scope.webwork.onmessage = function (event) { //更新列车位置 - // if(scope.datatype == "new"){ - // - // UpdateTrainNew(camera,trainlisttest); - // }else{ - // UpdateTrain(camera,trainlisttest); - // } + if(camerarail.moveswitch == true){ // console.log(camerarail.progress); diff --git a/src/jlmap3d/jl3dmaintainer/maintainerload.js b/src/jlmap3d/jl3dmaintainer/maintainerload.js index ac67a1cd0..97d886f15 100644 --- a/src/jlmap3d/jl3dmaintainer/maintainerload.js +++ b/src/jlmap3d/jl3dmaintainer/maintainerload.js @@ -1,11 +1,4 @@ //componnent -import {SectionList} from '@/jlmap3d/main/model/SectionList.js'; -import {SignalList} from '@/jlmap3d/main/model/SignalList.js'; -import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js'; -import {TrainList} from '@/jlmap3d/main/model/TrainList.js'; -import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js'; -import {LinkList} from '@/jlmap3d/main/model/LinkList.js'; -import {RailList} from '@/jlmap3d/main/model/RailList.js'; import {TrainListN} from '@/jlmap3d/main/newmodel/TrainListN.js'; import {SectionListN} from '@/jlmap3d/main/newmodel/SectionListN'; @@ -52,8 +45,6 @@ export function MaintainerLoad(data,scope,netdata,mapdata,camera,controls,scene) let mapdata = data; //初始化轨道和道岔 - // lengthfact(data); - // linklist = new LinkList(); sectionlist = new SectionListN(); signallist = new SignalListN(); @@ -177,39 +168,3 @@ export function MaintainerLoad(data,scope,netdata,mapdata,camera,controls,scene) } - -function lengthfact(data){ - let linklist = []; - //console.log(data); - for(let i=0;i=0;i--){ - if ( mixers[i] && mixers[i].runplay == true){ - mixers[i].update( delta ); - } - } - moveanimateupdate(); - - requestAnimationFrame(animate); - - } - - function moveanimateinit(model,name,points,index,speed){ - - let curve = new THREE.CatmullRomCurve3(points); - curve.curvrtype = "chordal"; - // curve动画轨迹 - // progress动画进度 - // enable当前动画开关 - // speed动画速度 - - let animate = { - name:index, - index:index, - curve:curve, - progress:0, - directchange:false, - enable:true, - status:"start", - speed:speed, - }; - humans[index].runrail = animate; - humans[index].status = 1; - humans[index].action.play(); - humans[index].mixer.runplay = true; - moveanimatelist.push(animate); - } - - function moveanimateupdate(){ - if(humans.length>0){ - for(let i=0;i=1){ - // let point = humans[i].runrail.curve.getPointAt(1); - //更新模型坐标 - // console.log(moveanimatelist); - if(humans[i].status == 1){ - humans[i].runrail.enable = false; - humans[i].runrail.progress = 1; - humans[i].mixer.runplay = false; - humans[i].action.stop(); - humans[i].status = 0; - - if(humans[i].stage == 4){ - - rungroup.remove(humans[i].mesh); - // humans.splice(i,1); - } - - if(humans[i].stage == 3){ - - if(humans[i].direct == 1){ - - stationleft[humans[i].doors].waiting = 0; - }else{ - - stationright[humans[i].doors].waiting = 0; - } - humans[i].stage = 4; - - } - - if(humans[i].stage == 2){ - humans[i].stage = 3; - - } - - if(humans[i].stage == 1){ - - - humans[i].stage = 2; - - } - - if(humans[i].stage == 0){ - // console.log(humans[i].doors); - zhajiin[humans[i].doors].waiting = 0; - humans[i].stage = 1; - } - - moveanimatelist.splice(i,1); - - } - - }else{ - //根据动画进度获取动画轨迹上点 - - let point = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress); - - //更新模型坐标 - humans[i].mesh.position.x = point.x; - humans[i].mesh.position.y = point.y; - humans[i].mesh.position.z = point.z; - if((humans[i].runrail.progress+0.001)<1){ - let tangent = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress+0.001); - humans[i].mesh.lookAt(new THREE.Vector3(tangent.x,humans[i].mesh.position.y,tangent.z)); - } - - humans[i].runrail.progress += humans[i].runrail.speed; - point = null; - - } - - } - } - } - } - - function newhumancreate(){ - var direct = Math.floor(Math.random()*(3-1+1))+1; - var mantype = Math.floor(Math.random()*(3-1+1))+1; - // console.log(direct); - let points = []; - let newhuman; - if(mantype == 1){ - newhuman = THREE.SkeletonUtils.clone( originhuman1 ); - newhuman.animations = []; - newhuman.animations.push(originanima1.clone()); - }else{ - newhuman = THREE.SkeletonUtils.clone( originhuman2 ); - newhuman.animations = []; - newhuman.animations.push(originanima2.clone()); - } - if(direct == 1|| direct == 2){ - newhuman.position.set(32,10,25); - points.push(new THREE.Vector3(32,10,25)); - points.push(new THREE.Vector3(26,10,21)); - points.push(new THREE.Vector3(18,10,18)); - }else{ - newhuman.position.set(32,10,-5); - points.push(new THREE.Vector3(32,10,-5)); - points.push(new THREE.Vector3(26,10,12)); - points.push(new THREE.Vector3(24,10,17)); - points.push(new THREE.Vector3(18,10,18)); - } - - let j = Math.floor(Math.random()*(4-1+1))+1; - points.push(new THREE.Vector3(-0.5+j*1.4,10,18.5)); - // zhajiin[j].waiting = 1; - - let mixer = new THREE.AnimationMixer( newhuman ); - mixer.runplay = false; - let action = mixer.clipAction( newhuman.animations[ 0 ] ); - - var stationdirection = Math.floor(Math.random()*(2-1+1))+1; - let newone = { - id:humans.length, - mesh:newhuman, - status:1, - stage:0, - direct:stationdirection, - doorstatus:null, - doors:j, - action:action, - mixer:mixer, - runrail:null - }; - - humans.push(newone); - mixers.push(mixer); - rungroup.add(newhuman); - - - moveanimateinit(newone,humans.length,points,newone.id,0.002); - - // return newone; - } - - function initstationanimation(object){ - let mixer = new THREE.AnimationMixer( object ); - - let newclip = object.animations[ 0 ]; - for(let j=0;j { + passerStation.loadMaterial(netdata3d); this.modelmanager.loadpromise(JSON.parse(netdata3d.data.assets).cctvAssetList, scope.mixers).then(function (data) { - // console.log(scope.modelmanager); - initstationanimation(scope.modelmanager.station.mesh); - initzhajiinaimation(scope.modelmanager.zhajiin.mesh); - initzhajioutanimation(scope.modelmanager.zhajiout.mesh); - inittrain(scope.modelmanager.train.mesh); - scene.add(scope.modelmanager.section.mesh); - // scene.add(scope.modelmanager.train.mesh); - level = scope.modelmanager.station.mesh; + passerStation.initStationAnimation(scope.modelmanager.station.mesh,mixers,deviceaction,scene); + passerCheckDoor.initCheckDoorInAnimation(scope.modelmanager.zhajiin.mesh,mixers,deviceaction,scene); + passerCheckDoor.initCheckDoorOutAnimation(scope.modelmanager.zhajiout.mesh,mixers,deviceaction,scene); + + passerTrain.initTrain(scope.modelmanager.train.mesh,mixers,deviceaction,scene); + + scene.add(scope.modelmanager.section.mesh); monitor = scope.modelmanager.monitor.mesh; scene.add(monitor); - Materialload(scope,JSON.parse(netdata3d.data.assets).stationTextureList[0]); + getPublishMapDetail(skinCode).then(netdata => { - scope.switchviews(4); - inithumans(); - initstationlist(netdata.data.stationList,netdata.data.stationStandList,netdata.data.psdList); - socktest = new PassflowConnect(scope,deviceaction,toptrain,downtrain,routegroup); + 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); + socktest = new PassflowConnect(deviceaction,passerTrain.toptrain,passerTrain.downtrain,routegroup,passerStation,passerAi); + store.dispatch('app/animationsClose'); + + let checkobject = setInterval(function(){ + + clearInterval(checkobject); + //进站控制 + startWorker(); + passerWebWork.postMessage("on"); + + },1000); }); - // loadingInstance.close(); - store.dispatch('app/animationsClose'); animate(); }) }); - function initView(viewMap){ - if(viewMap == "normal"){ - views4 = [ - { - left: 0, - bottom: 0, - width: 0.5, - height: 0.5, - background: new THREE.Color( 0.5, 0.5, 0.7 ), - eye: [ 3.7, 16, 26 ], - up: [3.7, 10 ,16 ], - fov: 30 - }, - { - left: 0, - bottom: 0.5, - width: 0.5, - height: 0.5, - background: new THREE.Color( 0.5, 0.5, 0.7 ), - eye: [ 3.7,17,-4 ], - up: [ 3.7, 10 ,16], - fov: 30 - }, - { - left: 0.5, - bottom: 0, - width: 0.5, - height: 0.5, - background: new THREE.Color( 0.7, 0.5, 0.5 ), - eye: [ -60, 6,11], - up: [ -59, 5.9,11 ], - fov: 45 - }, - { - left: 0.5, - bottom: 0.5, - width: 0.5, - height: 0.5, - background: new THREE.Color( 0.5, 0.7, 0.7 ), - eye: [ -7,17,2], - up: [-7, 10, 8], - fov: 60 - } - ]; - views2 = [ - { - left: 0, - bottom: 0, - width: 0.5, - height: 1, - background: new THREE.Color( 0.5, 0.5, 0.7 ), - eye: [ 3.7, 16, 26 ], - up: [3.7, 10 ,16 ], - fov: 60 - }, - { - left: 0.5, - bottom: 0, - width: 0.5, - height: 1, - background: new THREE.Color( 0.7, 0.5, 0.5 ), - eye: [ -60, 6,11], - up: [ -59, 5.9,11 ], - fov: 60 - }, - ]; - }else{ - views4 = [ - { - left: 0, - bottom: 0, - width: 0.24, - height: 0.5, - background: new THREE.Color( 0.5, 0.5, 0.7 ), - eye: [ 3.7, 16, 26 ], - up: [3.7, 10 ,16 ], - fov: 30 - }, - { - left:0.25, - bottom: 0, - width: 0.24, - height: 0.5, - background: new THREE.Color( 0.5, 0.5, 0.7 ), - eye: [ 3.7,17,-4 ], - up: [ 3.7, 10 ,16], - fov: 30 - }, - { - left: 0.5, - bottom: 0, - width: 0.24, - height: 0.5, - background: new THREE.Color( 0.7, 0.5, 0.5 ), - eye: [ -60, 6,11], - up: [ -59, 5.9,11 ], - fov: 45 - }, - { - left: 0.75, - bottom: 0, - width: 0.24, - height: 0.5, - background: new THREE.Color( 0.5, 0.7, 0.7 ), - eye: [ -7,17,2], - up: [-7, 10, 8], - fov: 60 - } - ]; - - views2 = [ - { - left: 0, - bottom: 0, - width: 0.5, - height: 0.5, - background: new THREE.Color( 0.5, 0.5, 0.7 ), - eye: [ 3.7, 16, 26 ], - up: [3.7, 10 ,16 ], - fov: 60 - }, - { - left: 0.5, - bottom: 0, - width: 0.5, - height: 0.5, - background: new THREE.Color( 0.7, 0.5, 0.5 ), - eye: [ -60, 6,11], - up: [ -59, 5.9,11 ], - fov: 60 - }, - ]; - - } - } - function inithumans(){ - originhuman1 = scope.modelmanager.man1.mesh; - originhuman1.progress = 1; - // scene.add(originhuman1); - originhuman2 = scope.modelmanager.man2.mesh; - - let mixer1 = new THREE.AnimationMixer( originhuman1 ); - let mixer2 = new THREE.AnimationMixer( originhuman2 ); - originanima1 = originhuman1.animations[ 0 ]; - originanima2 = originhuman2.animations[ 0 ]; - originhuman1.remove(originhuman1.children[2]); - scene.add(humanlist); - // scene.add(scope.modelmanager.man1.mesh); - } - - - let checkobject = setInterval(function(){ - // console.log(originhuman1); - if(originhuman1){ - clearInterval(checkobject); - //进站控制 - startWorker(); - stationwebwork.postMessage("on"); - - // passerwebwork.postMessage("on"); - - }; - },1000); this.changestation = function(stationname){ - for(let i=0,leni=stationlist.length;i=0;an--){ - toptrain.action.top[an].reset(); - toptrain.action.top[an].time = toptrain.action.top[an]._clip.duration; - toptrain.action.top[an].timeScale = -1; - toptrain.action.top[an].play(); + for(let an=passerTrain.toptrain.action.top.length-1;an>=0;an--){ + passerTrain.toptrain.action.top[an].reset(); + passerTrain.toptrain.action.top[an].time = passerTrain.toptrain.action.top[an]._clip.duration; + passerTrain.toptrain.action.top[an].timeScale = -1; + passerTrain.toptrain.action.top[an].play(); } - for(let an=toptrain.action.down.length-1;an>=0;an--){ - toptrain.action.down[an].reset(); - toptrain.action.down[an].time = toptrain.action.down[an]._clip.duration; - toptrain.action.down[an].timeScale = -1; - toptrain.action.down[an].play(); + for(let an=passerTrain.toptrain.action.down.length-1;an>=0;an--){ + passerTrain.toptrain.action.down[an].reset(); + passerTrain.toptrain.action.down[an].time = passerTrain.toptrain.action.down[an]._clip.duration; + passerTrain.toptrain.action.down[an].timeScale = -1; + passerTrain.toptrain.action.down[an].play(); } // for(let an=actions.length-1;an>=0;an--){ // actions[an].reset(); @@ -678,172 +212,38 @@ export function Jl3dpassflow(dom,skinCode,routegroup,viewMap) { // actions[an].play(); // } setTimeout(function(){ - initpasser(); + passerAi.initPasser(humanlist,passerHuman); aiswitch = 0; }, 2000); } - this.uncache = function(uncachemodel){ - if(uncachemodel){ - uncachemodel.mixer.uncacheAction(); - uncachemodel.traverse( function ( child ) { - if ( child.isMesh ) { - child.geometry.dispose(); - child.material.dispose(); - } - } ); - } - - } - - this.passerout = function(direct){ - // console.log(direct); - if(direct == "top"){ - // console.log("toppasser"); - // console.log(stationzon.list["standtop"]); - toppasseron = true; - setTimeout(function(){ - toppasseron = false - toppasserin = true; - - setTimeout(function(){ - toppasserin = false; - }, 20000); - }, 5000); - } - if(direct == "down"){ - // console.log("downpasser"); - // console.log(stationzon.list["standdown"]); - downpasseron = true; - setTimeout(function(){ - downpasseron = false; - downpasserin = true; - setTimeout(function(){ - downpasserin = false; - }, 20000); - }, 5000); - } - } - - this.switchviews = function(viewmode){ - if(viewmode == 4){ - rendermode = 4; - } - if(viewmode == 2){ - rendermode = 2; - } - if(viewmode == 1){ - rendermode = 1; - } - if(viewmode == "auto"){ - - rendermode = 0; - renderer.setViewport( 0, 0, scope.dom.offsetWidth, scope.dom.offsetHeight ); - renderer.setScissor( 0, 0, scope.dom.offsetWidth, scope.dom.offsetHeight ); - renderer.setScissorTest( false ); - renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight); - camerass.aspect = dom.offsetWidth / dom.offsetHeight; - camerass.updateProjectionMatrix(); - } - } - - function initpasser(){ - - for(let i=0;i<3;i++){ - - newhumancreate(stationzon.getinitposition("enter1"),0); - } - for(let i=0;i<3;i++){ - newhumancreate(stationzon.getinitposition("enter2"),0); - } - for(let i=0;i<3;i++){ - newhumancreate(stationzon.getinitposition("security"),1); - } - // for(let i=0;i<2;i++){ - // // newhumancreate(stationzon.getinitposition("entergate"),3); - // } - for(let i=0;i<6;i++){ - let standdata = stationzon.getstandposition("standtop"); - newhumancreate(standdata.point,4,"top",standdata.door); - } - for(let i=0;i<6;i++){ - let standdata = stationzon.getstandposition("standdown"); - newhumancreate(standdata.point,4,"down",standdata.door); - } - // for(let i=0;i<5;i++){ - // // newhumancreate(stationzon.getinitposition("exitgate"),6); - // } - } - - function speciTest(){ - // stats.update(); - if(aiswitch == 0){ - moveanimateupdate(); - passerai(); - - delta = clock.getDelta(); - // tick(delta); - - for(let i=mixers.length-1;i>=0;i--){ - if(mixers[i]._actions[0].isRunning()){ - mixers[i].update( delta ); - } - } - for(let i=humanlist.children.length-1;i>=0;i--){ - if(humanlist.children[i].mixer._actions[0].isRunning()){ - humanlist.children[i].mixer.update( delta ); - } - } - } - } function startWorker(){ - initpasser(); + passerAi.initPasser(humanlist,passerHuman); let updateaianimate = setInterval( function(){ // console.log("?"); - if(aiswitch == 0){ - moveanimateupdate(); - passerai(); + if(aiswitch == 0){ + passerHuman.moveAnimateUpdate(humanlist,olddataai,passerHuman); + passerAi.aiUpdate(humanlist,passerHuman,passerCheckDoor,deviceaction); - delta = clock.getDelta(); - // tick(delta); + delta = clock.getDelta(); - for(let i=mixers.length-1;i>=0;i--){ - if(mixers[i]._actions[0].isRunning()){ - mixers[i].update( delta ); - } + for(let i=mixers.length-1;i>=0;i--){ + if(mixers[i]._actions[0].isRunning()){ + mixers[i].update( delta ); } - for(let i=humanlist.children.length-1;i>=0;i--){ - if(humanlist.children[i].mixer._actions[0].isRunning()){ - humanlist.children[i].mixer.update( delta ); - } + } + for(let i=humanlist.children.length-1;i>=0;i--){ + if(humanlist.children[i].mixer._actions[0].isRunning()){ + humanlist.children[i].mixer.update( delta ); } - } - }, 100); - // passerwebwork.onmessage = function (event) { - // - // stats.update(); - // if(aiswitch == 0){ - // moveanimateupdate(); - // passerai(); - // - // delta = clock.getDelta(); - // // tick(delta); - // - // for(let i=mixers.length-1;i>=0;i--){ - // if(mixers[i]._actions[0].isRunning()){ - // mixers[i].update( delta ); - // } - // } - // for(let i=humanlist.children.length-1;i>=0;i--){ - // if(humanlist.children[i].mixer._actions[0].isRunning()){ - // humanlist.children[i].mixer.update( delta ); - // } - // } - // } - // }; - stationwebwork.onmessage = function (event) { + } + } + } + , 100); + + passerWebWork.onmessage = function (event) { if(aiswitch == 0){ // console.log(humanlist.children.length); if(humanlist.children.length < 80){ @@ -851,23 +251,23 @@ export function Jl3dpassflow(dom,skinCode,routegroup,viewMap) { //1--top //2-- down if(direct == 1){ - newhumancreate(stationzon.getzoneposition("enter1"),0); + passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter1"),0); }else{ - newhumancreate(stationzon.getzoneposition("enter2"),0); + passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter2"),0); } - if(toppasseron){ - for(let i=0,leni=stationzon.list["standtop"].doorpoints.length;i=1){ - //更新模型坐标 - if(humanlist.children[i].status == 1){ - - - humanlist.children[i].progress = 1; - humanlist.children[i].action.stop(); - humanlist.children[i].status = 0; - - if(humanlist.children[i].stage == 8){ - scope.uncache(humanlist.children[i]); - humanlist.remove(humanlist.children[i]); - i--; - }else if(humanlist.children[i].stage == 7){ - humanlist.children[i].stage = 8; - } - // else if(humanlist.children[i].stage == 6){ - // - // humanlist.children[i].stage = 7; - // - // } - else if(humanlist.children[i].stage == 5){ - - humanlist.children[i].stage = 7; - - }else if(humanlist.children[i].stage == 4){ - scope.uncache(humanlist.children[i]); - humanlist.remove(humanlist.children[i]); - i--; - }else if(humanlist.children[i].stage == 3){ - - humanlist.children[i].stage = 4; - if(olddataai){ - humanlist.children[i].stage = 5; - } - - }else if(humanlist.children[i].stage == 2){ - humanlist.children[i].stage = 3; - - }else if(humanlist.children[i].stage == 1){ - - - humanlist.children[i].stage = 2; - - }else if(humanlist.children[i].stage == 0){ - // // console.log(humans[i].doors); - // zhajiin[humanlist.children[i].doors].waiting = 0; - humanlist.children[i].stage = 1; - } - - } - - }else{ - //根据动画进度获取动画轨迹上点 - // console.log(i); - // console.log(humanlist.children[i].runrail); - // console.log(humanlist.children[i].progress); - let point = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress); - - //更新模型坐标 - humanlist.children[i].position.x = point.x; - humanlist.children[i].position.y = point.y; - humanlist.children[i].position.z = point.z; - if((humanlist.children[i].progress+0.001)<1){ - let tangent = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress+0.001); - humanlist.children[i].lookAt(new THREE.Vector3(tangent.x,humanlist.children[i].position.y,tangent.z)); - } - - humanlist.children[i].progress += humanlist.children[i].speed; - point = null; - - } - } - } + this.switchviews = function(viewmode){ + passerRender.changeRenderMode(viewmode); } - function newhumancreate(position,stage,direct,door){ - let mantype = Math.floor(Math.random()*(3-1+1))+1; - let newhuman; - if(mantype == 1){ - newhuman = THREE.SkeletonUtils.clone( originhuman1 ); - newhuman.animations = []; - newhuman.animations.push(originanima1.clone()); - }else{ - newhuman = THREE.SkeletonUtils.clone( originhuman2 ); - newhuman.animations = []; - newhuman.animations.push(originanima2.clone()); - } - - let mixer = new THREE.AnimationMixer( newhuman ); - newhuman.position.copy(position); - newhuman.status = 0; - - newhuman.stage = stage; - if(direct){ - if(direct == "top"){ - newhuman.rotation.y = Math.PI; - } - newhuman.direct = direct; - }else{ - newhuman.direct = null; - } - - newhuman.doorstatus = null; - if(door){ - newhuman.door = door; - }else{ - newhuman.door = null; - } - - newhuman.action = mixer.clipAction( newhuman.animations[ 0 ] ); - newhuman.mixer = mixer; - newhuman.runrail = null; - newhuman.speed = 0; - newhuman.mixer = mixer; - humanlist.add(newhuman); - // console.log(humanlist.children.length); - } - function initstationlist(stationdata,standdata,psddata){ - - let list = []; - if(psddata){ - for(let i=0,leni = standdata.length;i0){ - let stationobject = { - code : list[k][0].stationCode, - name : k, - toppsd:null, - downpsd:null, - topsection:null, - downsection:null, - }; - if(list[k][0].position.y { @@ -108,18 +108,13 @@ export function ModelManager(){ } } - +//fbx模型加载 function fbxpromise(asset,mixers,model){ return new Promise(function(resolve, reject){ var loader = new THREE.FBXLoader(); loader.load( BASE_ASSET_API+asset.url, function ( object ) { - // let mixer = new THREE.AnimationMixer( object ); - // object.traverse( function ( child ) { - // if ( child.isMesh ) { - // child.castShadow = true; - // child.receiveShadow = true; - // } - // } ); + + //列车模型子物体重新排序 if(asset.type == "cctvTrain"){ // let mixer = new THREE.AnimationMixer( object ); let realtrain = new THREE.Group(); diff --git a/src/jlmap3d/jl3dpassflow/model/passercheckdoor.js b/src/jlmap3d/jl3dpassflow/model/passercheckdoor.js new file mode 100644 index 000000000..9f87578d3 --- /dev/null +++ b/src/jlmap3d/jl3dpassflow/model/passercheckdoor.js @@ -0,0 +1,230 @@ +export function PasserCheckDoor(data) { + var scope = this; + //入口闸机组 + this.zhajiin = []; + //出口闸机组 + this.zhajiout = []; + //定义闸机状态 + for(let i=0;i<5;i++){ + let zhaji = { + id:"in0"+(i+1), + status:0, + waiting:0 + } + scope.zhajiin.push(zhaji); + } + for(let i=0;i<5;i++){ + let zhaji = { + id:"out0"+(i+1), + status:0, + waiting:0 + } + scope.zhajiout.push(zhaji); + } + //初始化闸机动画 + this.initCheckDoorInAnimation = function(object,mixers ,deviceaction ,scene){ + let mixer = new THREE.AnimationMixer( object ); + let newclip = object.animations[ 0 ]; + let newzhaji = object; + for(let i=0;i=1){ + //更新模型坐标 + if(humanlist.children[i].status == 1){ + + + humanlist.children[i].progress = 1; + humanlist.children[i].action.stop(); + humanlist.children[i].status = 0; + + if(humanlist.children[i].stage == 8){ + passerHuman.uncache(humanlist.children[i]); + humanlist.remove(humanlist.children[i]); + i--; + }else if(humanlist.children[i].stage == 7){ + humanlist.children[i].stage = 8; + } + // else if(humanlist.children[i].stage == 6){ + // + // humanlist.children[i].stage = 7; + // + // } + else if(humanlist.children[i].stage == 5){ + + humanlist.children[i].stage = 7; + + }else if(humanlist.children[i].stage == 4){ + passerHuman.uncache(humanlist.children[i]); + humanlist.remove(humanlist.children[i]); + i--; + }else if(humanlist.children[i].stage == 3){ + + humanlist.children[i].stage = 4; + if(olddataai){ + humanlist.children[i].stage = 5; + } + + }else if(humanlist.children[i].stage == 2){ + humanlist.children[i].stage = 3; + + }else if(humanlist.children[i].stage == 1){ + + + humanlist.children[i].stage = 2; + + }else if(humanlist.children[i].stage == 0){ + // // console.log(humans[i].doors); + // zhajiin[humanlist.children[i].doors].waiting = 0; + humanlist.children[i].stage = 1; + } + + } + + }else{ + //根据动画进度获取动画轨迹上点 + // console.log(i); + // console.log(humanlist.children[i].runrail); + // console.log(humanlist.children[i].progress); + let point = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress); + + //更新模型坐标 + humanlist.children[i].position.x = point.x; + humanlist.children[i].position.y = point.y; + humanlist.children[i].position.z = point.z; + if((humanlist.children[i].progress+0.001)<1){ + let tangent = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress+0.001); + humanlist.children[i].lookAt(new THREE.Vector3(tangent.x,humanlist.children[i].position.y,tangent.z)); + } + + humanlist.children[i].progress += humanlist.children[i].speed; + point = null; + + } + } + } + } + //离开车站释放缓存 + this.uncache = function(uncachemodel){ + if(uncachemodel){ + uncachemodel.mixer.uncacheAction(); + uncachemodel.traverse( function ( child ) { + if ( child.isMesh ) { + child.geometry.dispose(); + child.material.dispose(); + } + } ); + } + } +} diff --git a/src/jlmap3d/jl3dpassflow/model/passerstation.js b/src/jlmap3d/jl3dpassflow/model/passerstation.js new file mode 100644 index 000000000..05ca190a2 --- /dev/null +++ b/src/jlmap3d/jl3dpassflow/model/passerstation.js @@ -0,0 +1,176 @@ +import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js'; + +export function PasserStation() { + var scope = this; + this.stationMesh = null; + this.stationleft = []; + this.stationright = []; + //替换材质组(站台的) + this.stationtexture = []; + + this.stationlist = []; + + this.nowStation = null; + + for(let i=0;i<22;i++){ + let sl = { + id:"left"+i, + status:0, + waiting:0 + } + scope.stationleft.push(sl); + } + + for(let i=0;i<22;i++){ + let sr = { + id:"right"+i, + status:0, + waiting:0 + } + scope.stationright.push(sr); + } + //初始化车站模型动画 + this.initStationAnimation = function( object,mixers ,deviceaction ,scene){ + let mixer = new THREE.AnimationMixer( object ,mixers ,deviceaction ,scene); + + let newclip = object.animations[ 0 ]; + for(let j=0;j0){ + let stationobject = { + code : list[k][0].stationCode, + name : k, + toppsd:null, + downpsd:null, + topsection:null, + downsection:null, + }; + if(list[k][0].position.y=0; i--) { - // console.log(data.body[i]); - - // console.log(data); - // 遍历列车对象组 - if (trainlisttest) { - code = data.code; - // 剔除不显示的车 - // 找到对应列车 - - - if ( trainlisttest.list[code]) { - - trainlisttest.list[code].runMode = data.runMode; - // 车门开关验证 - // if(data.directionType == "02"){ - if (trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == '01') { - // console.log("close"); - trainlisttest.list[code].doorStatus = '01'; - 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].doorStatus != data.doorStatus && data.doorStatus == '02') { - // console.log("open"); - trainlisttest.list[code].doorStatus = '02'; - for (let an=actions[code].top.length-1; an>=0; an--) { - actions[code].top[an].reset(); - actions[code].top[an].time = 0; - actions[code].top[an].timeScale = 1; - actions[code].top[an].play(); - } - } - // if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "01"){ - // //console.log("close"); - // trainlisttest.list[code].doorStatus = "01"; - // for(let an=actions[code].down.length-1;an>=0;an--){ - // actions[code].down[an].reset(); - // actions[code].down[an].time = actions[code].top[an]._clip.duration; - // actions[code].down[an].timeScale = -1; - // actions[code].down[an].play(); - // } - // }else if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "02"){ - // //console.log("open"); - // trainlisttest.list[code].doorStatus = "02"; - // for(let an=actions[code].down.length-1;an>=0;an--){ - // actions[code].down[an].reset(); - // actions[code].down[an].time = 0; - // actions[code].down[an].timeScale = 1; - // actions[code].down[an].play(); - // } - // } - // } - // 遍历获取所在轨道 - if (trainlisttest.list[code].dispose != data.dispose && data.dispose == false) { - - if (rails.linkrail[data.linkCode]) { - trainlisttest.group.add(trainlisttest.list[code]); - trainlisttest.list[code].position.y = 0; - // trainlisttest.list[code].progress = 0; - trainlisttest.list[code].dispose = false; - trainlisttest.list[code].nowcode = data.linkCode; - trainlisttest.list[code].nextcode = null; - trainlisttest.list[code].pc = 1; - - if(trainlisttest.list[code].mixerpush == false){ - for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi=0; j--) { - if (rails.switchrail[code]) { - if (rails.switchrail[code].locateType != data.locateType) { - if (data.locateType == '02') { - if (actions[sectionlist.switchs.modellist[j].code]) { - sectionlist.switchs.modellist[j].locateType = data.locateType; - actions[sectionlist.switchs.modellist[j].code].reset(); - actions[sectionlist.switchs.modellist[j].code].time = 0; - actions[sectionlist.switchs.modellist[j].code].timeScale = 1; - actions[sectionlist.switchs.modellist[j].code].play(); - } - - rails.switchrail[code].locateType = "02"; - - let testswitch = rails.switchrail[code]; - // console.log(testswitch); - // console.log(rails.linkrail[testswitch.alink]); - // console.log(rails.linkrail[testswitch.clink]); - if(rails.switchrail[code].directtype == "1"){ - rails.linkrail[testswitch.alink].lconnect = testswitch.clink; - rails.linkrail[testswitch.clink].rconnect = testswitch.alink; - }else if(rails.switchrail[code].directtype == "2"){ - rails.linkrail[testswitch.alink].rconnect = testswitch.clink; - rails.linkrail[testswitch.clink].lconnect = testswitch.alink; - } - - } else if (data.locateType == '01') { - if (actions[sectionlist.switchs.modellist[j].code]) { - sectionlist.switchs.modellist[j].locateType = data.locateType; - actions[sectionlist.switchs.modellist[j].code].reset(); - actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration; - actions[sectionlist.switchs.modellist[j].code].timeScale = -1; - actions[sectionlist.switchs.modellist[j].code].play(); - } - - rails.switchrail[code].locateType = "01"; - let testswitch = rails.switchrail[code]; - // console.log(testswitch); - // console.log(rails.linkrail[testswitch.alink]); - // console.log(rails.linkrail[testswitch.clink]); - if(rails.switchrail[code].directtype == "1"){ - rails.linkrail[testswitch.alink].lconnect = testswitch.blink; - rails.linkrail[testswitch.blink].rconnect = testswitch.alink; - }else if(rails.switchrail[code].directtype == "2"){ - rails.linkrail[testswitch.alink].rconnect = testswitch.blink; - rails.linkrail[testswitch.blink].lconnect = testswitch.alink; - } - - } - } - j = 0; - } - } - } - function simulationreset(data){ - for(let i=0;i=0; i--) { - // console.log(data.body[i]); - - // console.log(data); - // 遍历列车对象组 - if (trainlisttest) { - code = data.code; - // 剔除不显示的车 - // 找到对应列车 - - - if ( trainlisttest.list[code]) { - - trainlisttest.list[code].runMode = data.runMode; - // 车门开关验证 - // if(data.directionType == "02"){ - if (trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == '01') { - // console.log("close"); - trainlisttest.list[code].doorStatus = '01'; - 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].doorStatus != data.doorStatus && data.doorStatus == '02') { - // console.log("open"); - trainlisttest.list[code].doorStatus = '02'; - for (let an=actions[code].top.length-1; an>=0; an--) { - actions[code].top[an].reset(); - actions[code].top[an].time = 0; - actions[code].top[an].timeScale = 1; - actions[code].top[an].play(); - } - } - // if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "01"){ - // //console.log("close"); - // trainlisttest.list[code].doorStatus = "01"; - // for(let an=actions[code].down.length-1;an>=0;an--){ - // actions[code].down[an].reset(); - // actions[code].down[an].time = actions[code].top[an]._clip.duration; - // actions[code].down[an].timeScale = -1; - // actions[code].down[an].play(); - // } - // }else if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "02"){ - // //console.log("open"); - // trainlisttest.list[code].doorStatus = "02"; - // for(let an=actions[code].down.length-1;an>=0;an--){ - // actions[code].down[an].reset(); - // actions[code].down[an].time = 0; - // actions[code].down[an].timeScale = 1; - // actions[code].down[an].play(); - // } - // } - // } - // 遍历获取所在轨道 - if (trainlisttest.list[code].dispose != data.dispose && data.dispose == false) { - - if (rails.linkrail[data.linkCode]) { - trainlisttest.group.add(trainlisttest.list[code]); - trainlisttest.list[code].position.y = 0; - // trainlisttest.list[code].progress = 0; - trainlisttest.list[code].dispose = false; - trainlisttest.list[code].nowcode = data.linkCode; - trainlisttest.list[code].nextcode = null; - trainlisttest.list[code].pc = 1; - - if(trainlisttest.list[code].mixerpush == false){ - for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi=0; j--) { - if (rails.switchrail[code]) { - if (rails.switchrail[code].locateType != data.locateType) { - if (data.locateType == '02') { - if (actions[sectionlist.switchs.modellist[j].code]) { - sectionlist.switchs.modellist[j].locateType = data.locateType; - actions[sectionlist.switchs.modellist[j].code].reset(); - actions[sectionlist.switchs.modellist[j].code].time = 0; - actions[sectionlist.switchs.modellist[j].code].timeScale = 1; - actions[sectionlist.switchs.modellist[j].code].play(); - } - - rails.switchrail[code].locateType = "02"; - - let testswitch = rails.switchrail[code]; - // console.log(testswitch); - // console.log(rails.linkrail[testswitch.alink]); - // console.log(rails.linkrail[testswitch.clink]); - if(rails.switchrail[code].directtype == "1"){ - rails.linkrail[testswitch.alink].lconnect = testswitch.clink; - rails.linkrail[testswitch.clink].rconnect = testswitch.alink; - }else if(rails.switchrail[code].directtype == "2"){ - rails.linkrail[testswitch.alink].rconnect = testswitch.clink; - rails.linkrail[testswitch.clink].lconnect = testswitch.alink; - } - - } else if (data.locateType == '01') { - if (actions[sectionlist.switchs.modellist[j].code]) { - sectionlist.switchs.modellist[j].locateType = data.locateType; - actions[sectionlist.switchs.modellist[j].code].reset(); - actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration; - actions[sectionlist.switchs.modellist[j].code].timeScale = -1; - actions[sectionlist.switchs.modellist[j].code].play(); - } - - rails.switchrail[code].locateType = "01"; - let testswitch = rails.switchrail[code]; - // console.log(testswitch); - // console.log(rails.linkrail[testswitch.alink]); - // console.log(rails.linkrail[testswitch.clink]); - if(rails.switchrail[code].directtype == "1"){ - rails.linkrail[testswitch.alink].lconnect = testswitch.blink; - rails.linkrail[testswitch.blink].rconnect = testswitch.alink; - }else if(rails.switchrail[code].directtype == "2"){ - rails.linkrail[testswitch.alink].rconnect = testswitch.blink; - rails.linkrail[testswitch.blink].lconnect = testswitch.alink; - } - - } - } - j = 0; - } - } - } - function simulationreset(data){ - for(let i=0;i= 0; i--) { - - if (data.body[i]._type == 'Train') { - - // console.log(data.body[i]); - // 遍历列车对象组 - // console.log(data.body[i]); - if (trainlisttest) { - code = data.body[i].code; - // 剔除不显示的车 - // 找到对应列车 - - if (trainlisttest.list[code]) { - // 车门开关验证 - // if(data.body[i].directionType == "02"){ - if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') { - // console.log("close"); - trainlisttest.list[code].doorStatus = '01'; - 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].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') { - // console.log("open"); - trainlisttest.list[code].doorStatus = '02'; - for (let an = actions[code].top.length - 1; an >= 0; an--) { - actions[code].top[an].reset(); - actions[code].top[an].time = 0; - actions[code].top[an].timeScale = 1; - actions[code].top[an].play(); - } - } - // }else{ - // if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "01"){ - // //console.log("close"); - // trainlisttest.list[code].doorStatus = "01"; - // for(let an=actions[code].down.length-1;an>=0;an--){ - // actions[code].down[an].reset(); - // actions[code].down[an].time = actions[code].top[an]._clip.duration; - // actions[code].down[an].timeScale = -1; - // actions[code].down[an].play(); - // } - // }else if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "02"){ - // //console.log("open"); - // trainlisttest.list[code].doorStatus = "02"; - // for(let an=actions[code].down.length-1;an>=0;an--){ - // actions[code].down[an].reset(); - // actions[code].down[an].time = 0; - // actions[code].down[an].timeScale = 1; - // actions[code].down[an].play(); - // } - // } - // } - // 遍历获取所在轨道 - if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) { - trainlisttest.group.add(trainlisttest.list[code]); - - if (sectionlist.sections.datalist[data.body[i].sectionCode].code) { - - trainlisttest.list[code].position.y = 0; - trainlisttest.list[code].progress = 0; - trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent; - trainlisttest.list[code].dispose = false; - - if (data.body[i].directionType == '02') { - trainlisttest.list[code].status = '02'; - trainlisttest.list[code].rotation.y = 0; - } else if (data.body[i].directionType == '03') { - trainlisttest.list[code].status = '03'; - trainlisttest.list[code].rotation.y = Math.PI; - } - - } - - } else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) { - trainlisttest.group.remove(trainlisttest.list[code]); - trainlisttest.list[code].progress = null; - trainlisttest.list[code].dispose = true; - - } else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) { - - if (sectionlist.sections.datalist[data.body[i].sectionCode].code) { - if (trainlisttest.list[code].nowcode != data.body[i].sectionCode || trainlisttest.list[code].nextcode != data.body[i].nextSectionCode) { - trainlisttest.list[code].nowcode = data.body[i].sectionCode; - trainlisttest.list[code].nextcode = data.body[i].nextSectionCode; - const vexlist = []; - const endrotation = null; - if (data.body[i].directionType == '02') { // 向右 - if (trainlisttest.list[code].status != data.body[i].directionType) { - console.log(trainlisttest.list[code].position); - console.log(trainlisttest.list[code].children[5].matrixWorld); - trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12]; - trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14]; - trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14]; - trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14]; - trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14]; - trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14]; - trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14]; - - if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { - vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14])); - for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) { - if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) { - vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); - } - - } - } else { - vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14])); - for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) { - if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) { - vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); - } - } - } - } else { - if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { - for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) { - vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); - } - } else { - for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) { - vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); - } - } - } - trainlisttest.list[code].status = '02'; - trainlisttest.list[code].rotation.y = 0; - - } else if (data.body[i].directionType == '03') { // 向左 - - if (trainlisttest.list[code].status != data.body[i].directionType) { - trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12]; - trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14]; - trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14]; - trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14]; - trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14]; - trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14]; - trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14]; - // - if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { - vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14])); - for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) { - if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) { - vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); - } - } - } else { - vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14])); - for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) { - if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) { - vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); - } - } - } - } else { - // - if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { - for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) { - vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); - } - - } else { - for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) { - vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]); - } - } - } - trainlisttest.list[code].status = '03'; - trainlisttest.list[code].rotation.y = Math.PI; - - } - - trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist); - // console.log(trainlisttest.list[code].curve.points); - // console.log(data.body[i].speed) - // console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance); - trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance; - - trainlisttest.list[code].progress = 0; - } - // console.log("speed"); - // console.log(data.body[i].speed); - // console.log(trainlisttest.list[code].speed); - if (data.body[i].speed != trainlisttest.list[code].speed) { - trainlisttest.list[code].speed = data.body[i].speed; - trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance; - // if(trainlisttest.list[code].speeds > 0.1){ - // console.log(data.body[i]); - // console.log(data.body[i].speed) - // console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance); - // console.log(trainlisttest.list[code].speeds); - // } - } - - } - - } - - } - - } - } - - // 0xFFFFFF - // 0xCD0000 红 - // 0xEEEE00 黄 - // 0x32CD32 绿 - if (data.body[i]._type == 'Signal') { - - if (signallist) { - code = data.body[i].code; - if (data.body[i].lightType == '01') { - if (signallist.list[code].mesh.code) { - signallist.list[code].mesh.status = data.body[i].status; - - // 55 - // 33 - // 77 - // 关闭 - if (data.body[i].status == '01') { - signallist.list[code].mesh.children[0].material.map = materials[3]; - signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[0]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; - signallist.list[code].mesh.children[2].material.map = materials[3]; - signallist.list[code].mesh.children[2].material.map.needsUpdate = true; - - } - // 开放 - if (data.body[i].status == '02') { - - if (data.body[i].switchLocateType == '01') { - signallist.list[code].mesh.children[0].material.map = materials[2]; - signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; - signallist.list[code].mesh.children[2].material.map = materials[3]; - signallist.list[code].mesh.children[2].material.map.needsUpdate = true; - - } - - if (data.body[i].switchLocateType == '02') { - signallist.list[code].mesh.children[0].material.map = materials[3]; - signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; - signallist.list[code].mesh.children[2].material.map = materials[1]; - signallist.list[code].mesh.children[2].material.map.needsUpdate = true; - - } - - } - // 引导 - if (data.body[i].status == '03') { - signallist.list[code].mesh.children[0].material.map = materials[3]; - signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[0]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; - signallist.list[code].mesh.children[2].material.map = materials[1]; - signallist.list[code].mesh.children[2].material.map.needsUpdate = true; - - } - // 封锁 - if (data.body[i].status == '04') { - signallist.list[code].mesh.children[0].material.map = materials[3]; - signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; - signallist.list[code].mesh.children[2].material.map = materials[3]; - signallist.list[code].mesh.children[2].material.map.needsUpdate = true; - - } - // 故障 - if (data.body[i].status == '05') { - signallist.list[code].mesh.children[0].material.map = materials[3]; - signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; - signallist.list[code].mesh.children[2].material.map = materials[3]; - signallist.list[code].mesh.children[2].material.map.needsUpdate = true; - - } - - } - - } else if (data.body[i].lightType == '01') { - if (signallist.list[code].mesh.code) { - signallist.list[code].mesh.children[0].material.map = materials[3]; - signallist.list[code].mesh.children[0].material.map.needsUpdate = true; - signallist.list[code].mesh.children[1].material.map = materials[3]; - signallist.list[code].mesh.children[1].material.map.needsUpdate = true; - signallist.list[code].mesh.children[2].material.map = materials[3]; - signallist.list[code].mesh.children[2].material.map.needsUpdate = true; - - } - - } - - } - - } - - if (data.body[i]._type == 'StationStand') { - if (actions) { - code = data.body[i].code; - if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '01') { - actions[code].status = '00'; - } - if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '00') { - actions[code].status = '02'; - actions[code].action.reset(); - actions[code].action.time = 0; - actions[code].action.timeScale = 1; - actions[code].action.play(); - } - - if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '02') { - actions[code].status = '00'; - } - if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '00') { - actions[code].status = '01'; - actions[code].action.reset(); - actions[code].action.time = actions[code].action._clip.duration; - actions[code].action.timeScale = -1; - actions[code].action.play(); - } - - } - - } - - if (data.body[i]._type == 'Switch') { - - if (sectionlist) { - code = data.body[i].code; - for (let j = sectionlist.switchs.modellist.length - 1; j >= 0; j--) { - if (sectionlist.switchs.modellist[j].code == code) { - if (sectionlist.switchs.modellist[j].locateType != data.body[i].locateType) { - if (data.body[i].locateType == '02') { - sectionlist.switchs.modellist[j].locateType = data.body[i].locateType; - actions[sectionlist.switchs.modellist[j].code].reset(); - actions[sectionlist.switchs.modellist[j].code].time = 0; - actions[sectionlist.switchs.modellist[j].code].timeScale = 1; - actions[sectionlist.switchs.modellist[j].code].play(); - - } else if (data.body[i].locateType == '01') { - sectionlist.switchs.modellist[j].locateType = data.body[i].locateType; - actions[sectionlist.switchs.modellist[j].code].reset(); - actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration; - actions[sectionlist.switchs.modellist[j].code].timeScale = -1; - actions[sectionlist.switchs.modellist[j].code].play(); - - } - } - - // console.log(sectionlist.group[j].name); - j = 0; - } - } - } - - } - } - - } else if (data.body.length > 200) { - - } - - } - - } - -} diff --git a/src/jlmap3d/jl3dsimulation/connect/UpdateTrainNew.js b/src/jlmap3d/jl3dsimulation/connect/UpdateTrainNew.js deleted file mode 100644 index e0e9d5921..000000000 --- a/src/jlmap3d/jl3dsimulation/connect/UpdateTrainNew.js +++ /dev/null @@ -1,174 +0,0 @@ - -export function UpdateTrainNew(camera,traindata){ - if(traindata != undefined ){ - for(let j=traindata.group.children.length-1;j>=0;j--){ - //判断是否有移动事件 - - let trainmodel = traindata.group.children[j]; - - if(trainmodel.speeds > 0 && trainmodel.speeds){ - let speed = null; - if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){ - - let movecurve = trainmodel.curve; - if(trainmodel.status == "1"){ - - let point = movecurve.getPointAt(trainmodel.progress); - let worldpositionz = trainmodel.children[0].position.z; - - - trainmodel.position.x = point.x; - trainmodel.position.y = 0; - let offset = Math.abs( point.z -parseFloat(worldpositionz)); - if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){ - trainmodel.children[0].up = new THREE.Vector3(1,0,0); - let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize(); - trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); - let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); - trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); - trainmodel.children[0].rotation.x = -Math.PI/2; - trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y; - trainmodel.children[0].rotation.y = 0; - let rotas = { - posr:point, - rota:trainmodel.children[0].rotation.z - } - trainmodel.children[1].rotalist.push(rotas); - let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]); - trainmodel.children[0].position.z += offsetz; - } - - if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){ - - for(let rs = 1;rs<6;rs++){ - if(trainmodel.children[rs].rotalist[0]){ - - let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]); - trainmodel.children[rs].position.z += offsetz; - - for(let xh=0;xh=trainmodel.children[rs].rotalist[0].posr.x){ - - if(rs != 5){ - let asd = trainmodel.children[rs].rotalist[0]; - trainmodel.children[rs+1].rotalist.push(asd); - - } - trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota; - trainmodel.children[rs].rotalist.splice(0,1) - xh--; - }else{ - xh = trainmodel.children[rs].rotalist.length; - } - } - } - } - } - trainmodel.progress += trainmodel.speeds; - // if(trainmodel.statsstop == 0){ - // if((1-trainmodel.progress) > 0.95){ - // - // trainmodel.progress += trainmodel.speeds; - // } - // - // }else{ - // trainmodel.progress += trainmodel.speeds; - // } - - } - - if(trainmodel.status == "0"){ - let point = movecurve.getPointAt(trainmodel.progress); - let worldpositionz = trainmodel.children[0].position.z; - - trainmodel.position.x = point.x; - trainmodel.position.y = 0; - - if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){ - trainmodel.children[0].up = new THREE.Vector3(-1,0,0); - let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize(); - trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); - let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); - - trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); - trainmodel.children[0].rotation.x = -Math.PI/2; - trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y; - trainmodel.children[0].rotation.y = 0; - - let rotas = { - posr:point, - rota:trainmodel.children[0].rotation.z - } - trainmodel.children[1].rotalist.push(rotas); - - let offsetz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]) - parseFloat(point.z); - trainmodel.children[0].position.z += offsetz; - - } - - if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){ - for(let rs = 1;rs<6;rs++){ - if(trainmodel.children[rs].rotalist[0]){ - let offsetz = parseFloat(trainmodel.children[rs].matrixWorld.elements[14]) - parseFloat(trainmodel.children[rs].rotalist[0].posr.z); - - trainmodel.children[rs].position.z += offsetz; - - for(let xh=0;xh=0;j--){ diff --git a/src/jlmap3d/jl3dsimulation/jlmap3d.js b/src/jlmap3d/jl3dsimulation/jlmap3d.js index 9a3f38fae..596e6f7d4 100644 --- a/src/jlmap3d/jl3dsimulation/jlmap3d.js +++ b/src/jlmap3d/jl3dsimulation/jlmap3d.js @@ -6,7 +6,7 @@ import { AssetLoader } from '@/jlmap3d/main/loaders/AssetLoader'; import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader'; import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; //data -import { Jl3ddata } from '@/jlmap3d/main/model/jl3ddata'; +import { Jl3ddata } from '@/jlmap3d/main/newmodel/jl3ddata'; //setconfig import { SetCamera } from '@/jlmap3d/config/SetCamera'; @@ -19,11 +19,9 @@ import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls'; // import { DragControls } from '@/jlmap3d/main/control/DragControls'; //加载器 -import { SimulationLoad } from '@/jlmap3d/main/loaders/SimulationLoad'; import { SimulationLoadNew } from '@/jlmap3d/main/loaders/SimulationLoadNew'; //connect -import {Jlmap3dSubscribe } from '@/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribe'; import {Jlmap3dSubscribeNew } from '@/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribeNew'; import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata'; @@ -31,7 +29,6 @@ import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from ' //utils // import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrain'; import { UpdateTrain } from '@/jlmap3d/jl3dsimulation/connect/UpdateTrainTest'; -import { UpdateTrainNew } from '@/jlmap3d/jl3dsimulation/connect/UpdateTrainNew'; // import { ReStart } from '@/jlmap3d/main/utils/ReStart'; import {Stats} from '@/jlmap3d/main/lib/stats.min.js'; @@ -40,7 +37,6 @@ var clock = new THREE.Clock(); export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { - let scope = this; this.dom = dom; @@ -49,8 +45,10 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { renderer.domElement.style.position = "absolute"; renderer.domElement.style.top = "0"; document.getElementById('testjlmap3d').appendChild(renderer.domElement); + //定义相机 let camera = SetCamera(dom); + //定义场景(渲染容器) let scene = SetScene(project); let scenesimulation = new THREE.Group(); @@ -82,6 +80,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { //模型操作命令组 this.actions = {}; + //设备数据 let sectionlist = null; let linklist = null; let signallist = null; @@ -90,82 +89,31 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { let realsectionlist = null; let rails = null; + //轨道相机 let camerarail = { curve:null, progress:0, moveswitch:false }; + //地图模型数据 let mapdata = new Jl3ddata(); - //订阅仿真socket - // console.log(routegroup); - // this.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork); - //连接到通信 - //console.log(this.Subscribe.config); + //订阅仿真socket this.webwork = new Worker(JL3D_LOCAL_STATIC+"/workertest/trainworker.js"); //初始化加载数据和模型getPublishMapDetail getPublishMapDetail(skinCode).then(data => { let mapnetdata = data.data; getPublish3dMapDetail(skinCode).then(netdata => { let assetsdata = JSON.parse(netdata.data.sections); - if(assetsdata.link){ - scope.datatype = "old"; - scope.jsonwebwork = new Worker(JL3D_LOCAL_STATIC+"/workertest/jsonworker.js"); - scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork); - scope.Subscribe.socketon(scope.Subscribe.topic); - SimulationLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod); - - }else{ - scope.datatype = "new"; - scope.jsonwebworknew = new Worker(JL3D_LOCAL_STATIC+"/workertest/jsonworkernew.js"); - scope.Subscribe = new Jlmap3dSubscribeNew(scope,routegroup,scope.jsonwebworknew); - scope.Subscribe.socketon(scope.Subscribe.topic); - SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod); - } - + scope.datatype = "new"; + scope.jsonwebworknew = new Worker(JL3D_LOCAL_STATIC+"/workertest/jsonworkernew.js"); + scope.Subscribe = new Jlmap3dSubscribeNew(scope,routegroup,scope.jsonwebworknew); + scope.Subscribe.socketon(scope.Subscribe.topic); + SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod); }); }); - // - // let stats = new Stats(); - // dom.appendChild( stats.dom ); - // var timer = setInterval(function() { - // if(trainlisttest){ - // if(trainlisttest.group){ - // if(trainlisttest.group.children[0]){ - // for(let k in rails.switchrail){ - // const ddd = storemod.getters['map/getDeviceByCode'](k); - // let switchdata = rails.switchrail[k]; - // rails.switchrail[k].locateType = ddd.locateType; - // - // if(ddd.locateType == "01"){ - // //1--向左 2--向右 - // //__\__ __/__ - // if(rails.switchrail[k].directtype == "1"){ - // rails.linkrail[switchdata.alink].lconnect = switchdata.blink; - // rails.linkrail[switchdata.blink].rconnect = switchdata.alink; - // }else if(rails.switchrail[k].directtype == "2"){ - // rails.linkrail[switchdata.alink].rconnect = switchdata.blink; - // rails.linkrail[switchdata.blink].lconnect = switchdata.alink; - // } - // - // }else if(ddd.locateType == "02"){ - // if(rails.switchrail[k].directtype == "1"){ - // rails.linkrail[switchdata.alink].lconnect = switchdata.clink; - // rails.linkrail[switchdata.clink].rconnect = switchdata.alink; - // }else if(rails.switchrail[k].directtype == "2"){ - // rails.linkrail[switchdata.alink].rconnect = switchdata.clink; - // rails.linkrail[switchdata.clink].lconnect = switchdata.alink; - // } - // } - // } - // clearInterval(timer); - // } - // } - // } - // - // }, 2000); //开启渲染 animate(); startWorker(scope.webwork); @@ -174,18 +122,13 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { //循环渲染函数 function animate() { //循环渲染 - //requestAnimationFrame(animate); - //renderer.setAnimationLoop(animate); requestAnimationFrame(animate); - //判断渲染是否开启 - //根据相机渲染场景 + //根据相机渲染场景 renderer.render(scene,camera); - //检测动画构造器播放动画 - - // } // stats.update(); } + //利用webworker当做定时器驱动设备动画,更新列车状态,车站漫游动画 function startWorker(webwork){ if(typeof(Worker)!=="undefined"){ @@ -193,11 +136,19 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { //更新列车位置 if(scope.datatype == "new"){ - // UpdateTrainNew(camera,trainlisttest); }else{ UpdateTrain(camera,trainlisttest); } + delta = clock.getDelta(); + for(let i=scope.mixers.length-1;i>=0;i--){ + if(scope.mixers[i]._actions[0].isRunning()){ + // console.log(scope.mixers[i]._actions[0].isRunning()); + scope.mixers[i].update( delta ); + } + } + + //开启车站漫游 if(camerarail.moveswitch == true){ // console.log(camerarail.progress); if(camerarail.progress>=0.99){ @@ -218,18 +169,12 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { } - delta = clock.getDelta(); - for(let i=scope.mixers.length-1;i>=0;i--){ - if(scope.mixers[i]._actions[0].isRunning()){ - // console.log(scope.mixers[i]._actions[0].isRunning()); - scope.mixers[i].update( delta ); - } - } }; } } + //释放场景缓存关闭渲染循环 this.dispose = function(){ renderer.setAnimationLoop(null); renderer.dispose(); @@ -259,6 +204,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { } }; + //切换显示车站信息 this.showstationmsg = function(showtype){ if(showtype == "show"){ for(let st=0;st0.49){ - rightlist.push(i); - } - if(autorail.geometry.attributes.position.array[i*3] <-0.49){ - leftlist.push(i); - } - } - - - - for(let i=0;i0.49){ - rightlist.push(i); - } - if(autorail.geometry.attributes.position.array[i*3] <-0.49){ - leftlist.push(i); - } - } - - autorail.rightlist = rightlist; - autorail.leftlist = leftlist; - - - let reallinks = []; - let testlink; - testlink = data; - if(data){ - let index,startdata; - for(let n=0;n=0){ - if(reallinks[i].leftFdCode == data[j].code){ - buildmodel(data[j],reallinks[i],j,"left"); - reallinks.push(data[j]); - data.splice(j,1); - j--; - } - } - if(reallinks[i].leftSdCode && j>=0){ - - if(reallinks[i].leftSdCode == data[j].code){ - buildmodel(data[j],reallinks[i],j,"left"); - reallinks.push(data[j]); - data.splice(j,1); - j--; - } - } - - if(reallinks[i].rightFdCode && j>=0){ - if(reallinks[i].rightFdCode == data[j].code){ - - buildmodel(data[j],reallinks[i],j,"right"); - reallinks.push(data[j]); - data.splice(j,1); - j--; - } - } - - if(reallinks[i].rightSdCode && j>=0){ - if(reallinks[i].rightSdCode == data[j].code){ - buildmodel(data[j],reallinks[i],j,"right"); - reallinks.push(data[j]); - data.splice(j,1); - j--; - } - } - - } - } - - function buildmodel(data,mdata,sx,direct){ - let len = data.lengthFact; - - let testmesh2 = autorail.clone(true); - for(let i=0;idata.rp.y){ - testmesh2.rotation.z = 0.218; - data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z); - data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z); - }else if(data.lp.ydata.rp.y){ - testmesh2.rotation.z = 0.218; - data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z); - data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z); - }else if(data.lp.y0){ - let testline = new THREE.CatmullRomCurve3([ - new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z), - new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z) - ]); - - scope.linkrail[linkdata[i].code].type = 1; - if(scope.linkrail[linkdata[i].code].lswitch){ - let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position; - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+4.5,0,switchpoint.z-0.05)); - } - - scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12)); - scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22)); - scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82)); - scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92)); - - if(scope.linkrail[linkdata[i].code].rswitch){ - let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position; - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-4.5,0,switchpoint.z+0.05)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z)); - } - - }else{ - let testline = new THREE.CatmullRomCurve3([ - new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z), - new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z) - ]); - scope.linkrail[linkdata[i].code].type = 2; - if(scope.linkrail[linkdata[i].code].lswitch){ - let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position; - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+4.5,0,switchpoint.z+0.05)); - } - - scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12)); - scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22)); - scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82)); - scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92)); - - if(scope.linkrail[linkdata[i].code].rswitch){ - let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position; - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-4.5,0,switchpoint.z-0.05)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z)); - scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z)); - } - } - } - - } - - for(let i=0;i{ - rightpoints.push(item); - } - ); - rightpoints.reverse(); - scope.linkrail[linkdata[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints); - scope.linkrail[linkdata[i].code].lineright.curveType = "centripetal"; - // - // for(let n=0,nm=scope.linkrail[linkdata[i].code].lineleft.points.length;nswitchdata[i].pb[0].x){ - if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[0].y){ - if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){ - testswitch = switchmesh1.clone(true); - }else{ - testswitch = switchmesh2.clone(true); - } - }else{ - if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){ - testswitch = switchmesh2.clone(true); - }else{ - testswitch = switchmesh1.clone(true); - } - testswitch.rotation.z = Math.PI; - } - }else{ - if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[1].y){ - if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){ - testswitch = switchmesh1.clone(true); - }else{ - testswitch = switchmesh2.clone(true); - } - }else{ - if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){ - testswitch = switchmesh2.clone(true); - }else{ - testswitch = switchmesh1.clone(true); - } - testswitch.rotation.z = Math.PI; - } - } - - testswitch.position.x = switchdata[i].position.x; - testswitch.position.y = switchdata[i].position.y; - testswitch.position.z = switchdata[i].position.z; - // testswitch.rotation.x = switchdata[i].rotation._x; - // testswitch.rotation.y = switchdata[i].rotation._y; - // testswitch.rotation.z = switchdata[i].rotation._z; - - scope.switchs.datalist.push(newswitch); - scope.switchs.modellist.push(testswitch); - switchgroup.add(testswitch); - } - - resolve("loadersection"); - }); - - } - - function buildsuidao(linkdata,suidaodata,assetloader,scene){ - let autosuidao; - for(let i=0;i7){ - rightlist.push(i); - if(autosuidao.geometry.attributes.position.array[i*3] > rightpoint){ - rightpoint = i; - } - } - if(autosuidao.geometry.attributes.position.array[i*3] <-7){ - leftlist.push(i); - if(autosuidao.geometry.attributes.position.array[i*3] < rightpoint){ - leftpoint = i; - } - } - } - autosuidao.rightlist = rightlist; - autosuidao.leftlist = leftlist; - autosuidao.rightpoint = rightpoint; - autosuidao.leftpoint = leftpoint; - // console.log(autosuidao); - // console.log(linkdata.linksgroup.children); - // console.log(suidaodata.datalist); - for(let i = 0;i < suidaodata.datalist.length;i++){ - let link = linkdata.linksgroup.getObjectByProperty("code",suidaodata.datalist[i].linkCode); - let suidao = suidaodata.datalist[i]; - let len = suidao.offsetRight-suidao.offsetLeft; - // console.log("-------------------------------------"); - // console.log("name:"+link.name); - // console.log(link.lengthfact); - // console.log(len); - // console.log("ofl:"+suidao.offsetLeft+" "+"ofr:"+suidao.offsetRight); - // console.log("-------------------------------------"); - - let testmesh1 = autosuidao.clone(true); - for(let i=0;i link.rp.y){ - testmesh1.position.z = link.lp.y-suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2; - }else{ - testmesh1.position.z = link.lp.y+suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2; - } - }else{ - testmesh1.position.x = link.lp.x+suidao.offsetLeft+len/2; - testmesh1.position.z = link.position.z; - } - testmesh1.position.y = 3.5; - // testmesh1.rotation.x = Math.PI/4; - testmesh1.code = suidaodata.datalist[i].code; - testmesh1.name = suidaodata.datalist[i].code; - // testmesh1.position.z = link.position.z; - testmesh1.relStandCode = suidaodata.datalist[i].relStandCode; - // testmesh1.stationCode = suidaodata.datalist[i].stationCode; - - testmesh1.rightlist = autosuidao.rightlist; - testmesh1.leftlist = autosuidao.leftlist; - testmesh1.rightpoint = autosuidao.rightpoint; - testmesh1.leftpoint = autosuidao.leftpoint; - testmesh1.isStandTrack = suidaodata.datalist[i].isStandTrack; - testmesh1.lengthfact = len; - testmesh1.linkCode = suidao.linkCode; - if(suidaodata.datalist[i].isStandTrack == false){ - sectiongroup.add(testmesh1); - - }else{ - scope.standtrack.push(testmesh1); - var box = new THREE.BoxHelper( testmesh1, 0xff0000 ); - sectiongroup.add( box ); - } - scope.sections.modellist.push(testmesh1); - } - } - - -} diff --git a/src/jlmap3d/main/model/SectionModel.js b/src/jlmap3d/main/model/SectionModel.js deleted file mode 100644 index 9ba9abb07..000000000 --- a/src/jlmap3d/main/model/SectionModel.js +++ /dev/null @@ -1,26 +0,0 @@ -export function SectionModel(data) { - var scope = this; - //命名 - this.name = null; - //code - this.code = null; - //索引位置 - this.index = null; - //轨迹点 - this.rail = []; - - this.railline = null; - //长度 - this.distance = []; - - this.isStandTrack = null; - - this.type = null; - //指向模型 - this.mesh = null; - // //模型地址 - // this.meshurl = null; - // //贴图地址 - // this.picurl = null; - -} diff --git a/src/jlmap3d/main/model/SignalList.js b/src/jlmap3d/main/model/SignalList.js deleted file mode 100644 index 68c3727d3..000000000 --- a/src/jlmap3d/main/model/SignalList.js +++ /dev/null @@ -1,113 +0,0 @@ -import {SignalModel} from '@/jlmap3d/main/model/SignalModel.js'; - -export function SignalList() { - - let scope = this; - - this.type = "signallist"; - - this.list = {}; - - this.group = new THREE.Group(); - - this.initpromise = function(data,scene,assetloader,netdata){ - return new Promise(function(resolve, reject){ - scope.group.name = "signal"; - //遍历信号数据 - let netsignal = null; - let haddata = false; - if(netdata){ - netsignal = JSON.parse(netdata); - haddata = true; - } - let selectmesh = null; - for(let j=0;j=0;n--){ - if(assetloader.modellist[n].deviceType == "train"){ - - selectmesh = assetloader.modellist[n].mesh - - ntracks1 = assetloader.modellist[n].animations.slice(16,27); - - tclip = new THREE.AnimationClip("three",2,ntracks1); - - ntracks2 = assetloader.modellist[n].animations.slice(0,15); - - fclip = new THREE.AnimationClip("four",2,ntracks2); - - n = 0; - } - } - //遍历列车数据 - // console.log(data.length); - for(let i=0;i=1;n--){ - // newmesh.children[n].position.x = -76; - // newmesh.children[n-1].add(newmesh.children[n]); - // } - //创建列车字牌 - if(mode){ - if(mode == "02"){ - let textgeometry = new THREE.PlaneBufferGeometry( 150, 100, 1 ); - let textt = new THREE.CanvasTexture(getTextCanvas(data[i])); - let textmaterial = new THREE.MeshBasicMaterial( { - side: THREE.DoubleSide, - map:textt ,transparent: true, - alphaTest:0.1 - } ); - let textplane = new THREE.Mesh( textgeometry, textmaterial ); - textplane.name = data[i].code; - textplane.position.x = 0; - textplane.position.y = 0; - textplane.position.z = 60; - textplane.tcode = data[i].code; - //textplane.rotation.x = Math.PI; - scope.textlist.push(textplane); - newmesh.children[0].add(textplane); - textgeometry.dispose(); - textmaterial.dispose(); - textt.dispose(); - } - } - - - - //group.add(textplane); - newmesh.first = false; - newmesh.name = data[i].code; - newmesh.rname = data[i].groupNumber; - newmesh.groupNumber = data[i].groupNumber; - - newmesh.position.set(0,-50000,0); - // newmesh.children[0].position.y = 0; - //newmesh.rotation.y = Math.PI/2; - newmesh.status = "00"; - newmesh.nowcode = null; - newmesh.curve = null; - newmesh.doorStatus = "01"; - newmesh.dispose = true; - newmesh.nowsection = null; - newmesh.nextsection = null; - newmesh.speed = 0; - newmesh.speeds = 0; - newmesh.progress = null; - newmesh.startmark = 0; - - - scope.list[data[i].code] = newmesh; - //scene.add(newmesh); - } - // console.log(selectmesh); - // for(let i=0,leni=selectmesh.children.length;i0.01){ - console.log(newsection.railpoint); closedSpline = new THREE.CatmullRomCurve3( [ new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z), new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[1].y,newsection.railpoint[1].z+0.001), @@ -110,9 +110,9 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){ ] ); }else{ closedSpline = new THREE.CatmullRomCurve3( [ - new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z), - new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[0].y,newsection.railpoint[1].z+0.001), - new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[0].y,newsection.railpoint[2].z) + new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[2].y,newsection.railpoint[0].z), + new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[2].y,newsection.railpoint[1].z+0.0015), + new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[2].y,newsection.railpoint[2].z) ] ); } @@ -123,18 +123,18 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){ closedSpline.tension = 0.15; closedSpline.closed = false; var extrudeSettings = { - steps : 6, - curveSegments : 1, - bevelSegments : 1, - bevelEnabled : false, - extrudePath : closedSpline, + steps : 6, + curveSegments : 1, + bevelSegments : 1, + bevelEnabled : false, + extrudePath : closedSpline, }; var shape = new THREE.Shape(); len = closedSpline.getLength(); - if(Math.abs(newsection.railpoint[0].y - newsection.railpoint[2].y)>0.001){ + if(Math.abs(newsection.railpoint[0].y - newsection.railpoint[2].y)>0.01){ shape.moveTo( -2, 0 ); shape.lineTo( 2, 0 ); }else{ diff --git a/src/jlmap3d/main/newmodel/StationStandListN.js b/src/jlmap3d/main/newmodel/StationStandListN.js index 89a61b2dd..22486a36e 100644 --- a/src/jlmap3d/main/newmodel/StationStandListN.js +++ b/src/jlmap3d/main/newmodel/StationStandListN.js @@ -110,6 +110,7 @@ export function StationStandListN() { if(mode == "02"){ let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 ); let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[i])); + let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} ); let textplane = new THREE.Mesh( textgeometry, textmaterial ); textplane.name = stationdata[i].code; @@ -289,6 +290,7 @@ export function StationStandListN() { if(mode == "02"){ let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 ); let textt = new THREE.CanvasTexture(getTextCanvas(standsdata[i])); + let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} ); let textplane = new THREE.Mesh( textgeometry, textmaterial ); textplane.name = standsdata[i].code; @@ -414,7 +416,9 @@ export function StationStandListN() { } } } + } + // scene.add(scope.textlist); stationdata = null; psddata = null; diff --git a/src/jlmap3d/main/model/jl3ddata.js b/src/jlmap3d/main/newmodel/jl3ddata.js similarity index 100% rename from src/jlmap3d/main/model/jl3ddata.js rename to src/jlmap3d/main/newmodel/jl3ddata.js diff --git a/src/jmap/config/defaultStyle.js b/src/jmap/config/defaultStyle.js deleted file mode 100644 index d20fc5a23..000000000 --- a/src/jmap/config/defaultStyle.js +++ /dev/null @@ -1,124 +0,0 @@ -export default class defaultStyle { - constructor() { - /** 透明填充 颜色*/ - this.transparentColor = 'rgba(0,0,0,0)'; - - /** 默认背景 颜色*/ - this.backgroundColor = '#000000'; - - /** 默认提示背景 颜色*/ - this.tipBackgroundColor = 'yellow'; - - /** 默认边线 颜色*/ - this.sidelineColor = '#FFFFFF'; - - /** 默认字体 大小*/ - this.textFontSize = 10; - - /** 默认字体 族类*/ - this.fontFamily = '宋体'; - - /** 默认字体颜色*/ - this.textFontColor = '#C0C0C0'; - - /** 默认提示字体大小*/ - this.arrowFontSize = 10; - - /** 列车长度*/ - this.trainWidth = 40; - - /** 列车高度*/ - this.trainHeight = 20; - - /** 列车字号*/ - this.trainTextFontSize = 12; - - /** 列车HDSA字号*/ - this.trainHSDATextFontSize = 9; - - /** 列车信号的半径*/ - this.trainConflictR = 3; - - /** 列车信号距离车的距离*/ - this.trainConflictDistance = 5; - - /** 列车车头比车身高出的长度;上下相比车体伸出去的边框*/ - this.trainMoreLength = 0; - - /** 列车和车头之间的间距*/ - this.trainHeadDistance = 4; - - /** 列车竖杠的宽度*/ - this.trainConntWidth = 3; - - /** 列车竖杠和方向之间的间隔*/ - this.trainPadding = 4; - - /** 列车方向的宽度*/ - this.trainArrowWidth = 6; - - /** 列车和区段之间的距离*/ - this.trainDistance = 30; - - /** 列车边线颜色*/ - this.trainSidelineColor = '#C0C0C0'; - - /** 列车背景*/ - this.trainBackground = '#000000'; - - /** 列车 灰色*/ - this.trainGrayColor = '#C0C0C0'; - - /** 列车 白色*/ - this.trainWitheColor = '#FFFFFF'; - - /** 列车 棕色*/ - this.trainBrownColor = '#A0522D'; - - /** 列车 黄色*/ - this.trainYellowColor = '#FFFF00'; - - /** 列车 棕灰色 */ - this.trainBrown1Color = '#725A64'; - - /** 列车 绿色*/ - this.trainGreenColor = '#00FF00'; - - /** 列车 蓝色*/ - this.trainBlueColor = '#3265FF'; - - /** 列车 红色*/ - this.trainRedColor = '#FF0000'; - - /** 列车 橘色*/ - this.trainOrangeColor = 'orange'; - - /** 列车 紫色*/ - this.trainPurpleColor = 'purple'; - - /** 列车 粉色*/ - this.trainPinkColor = 'pink'; - - /** 车次窗高度*/ - this.trainWindowWidth = 40; - - /** 车次窗高度*/ - this.trainWindowHeight = 15; - - /** 列车文字颜色*/ - this.trainTextColor = '#ffffff'; - - /** 灯包围框样式 */ - this.arcBorderStyle = { - lineDash: [3, 3], - stroke: '#FFFFFF', - fill: 'rgba(0,0,0,0)' - }; - /** 字体包围框样式 */ - this.textBorderStyle = { - lineDash: [3, 3], - stroke: '#FFFFFF', - fill: '#00FFFF' - }; - } -} diff --git a/src/jmap/config/deviceStyle.js b/src/jmap/config/deviceStyle.js deleted file mode 100644 index 1eb3cf035..000000000 --- a/src/jmap/config/deviceStyle.js +++ /dev/null @@ -1,10 +0,0 @@ -const mapDeviceStyle = { - // '01': 'chengdu_04', - '02': 'fuzhou_01' - // '03': 'bejing_01', - // '04': 'chengdu_03' -}; - -export function selectLineCode(code) { - return Object.assign({}, require(`./skinCode/${mapDeviceStyle[code || '02']}`).default); -} diff --git a/src/jmap/config/skinCode/fuzhou_01.js b/src/jmap/config/skinCode/fuzhou_01.js deleted file mode 100644 index aa79a4871..000000000 --- a/src/jmap/config/skinCode/fuzhou_01.js +++ /dev/null @@ -1,547 +0,0 @@ -import defaultStyle from '../defaultStyle'; -import deviceType from '../../constant/deviceType'; - -class SkinCode extends defaultStyle { - constructor() { - super(); - this[deviceType.Link] = { - lineWidthColor: '#FFFFFF', // line 颜色 - linkWidth: 4.4, // link 宽度 - linkColor: '#3F3F3F', // link 线条颜色 - linkTextColor: '#FFFFFF' // link 字体颜色 - }; - - this[deviceType.Section] = { - active: { - routeColor: false // 进路触发颜色 - }, - text: { - show: true, // 物理区段名称显示 - position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 - distance: 18, // 文字离区段距离 - fontSize: 11, // 字体大小 - fontWeight: 'normal', // 字体粗细 - fontColor: '#FFFFFF', // 字体颜色 - textAlign: 'center', // 水平对齐方式 - textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 - }, - logicText: { - show: true, // 逻辑区段名称显示 - position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 - distance: 6, // 文字离区段距离 - fontSize: 8, // 字体大小 - fontWeight: 'normal', // 字体粗细 - fontColor: '#FFFFFF', // 字体颜色 - textAlign: 'center', // 水平对齐方式 - textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 - }, - standText: { - show: true, // 站台轨名称显示 - position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 - distance: 30, // 文字离区段距离 - fontSize: 11, // 字体大小 - fontWeight: 'normal', // 字体粗细 - fontColor: '#FFFFFF', // 字体颜色 - textAlign: 'center', // 水平对齐方式 - textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 - }, - reentryText: { - show: true, // 折返轨名称显示 - position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 - distance: 30, // 文字离区段距离 - fontSize: 11, // 字体大小 - fontWeight: 'normal', // 字体粗细 - fontColor: '#FFFFFF', // 字体颜色 - textAlign: 'center', // 水平对齐方式 - textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 - }, - transferText: { - show: true, // 转换轨名称显示 - position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 - distance: 28, // 文字离区段距离 - fontSize: 11, // 字体大小 - fontWeight: 'normal', // 字体粗细 - fontColor: '#FFFFFF', // 字体颜色 - textAlign: 'center', // 水平对齐方式 - textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 - }, - destinationText: { - show: true, // 目的码名称显示 - opposite: true, // 对称相反 - position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 - distance: 10, // 文字离区段距离 - fontSize: 10, // 字体大小 - fontWeight: 'bold', // 字体粗细 - fontColor: 'yellow', // 字体颜色 - textAlign: 'center', // 水平对齐方式 - textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 - }, - line: { - width: 5, // 区段宽度 - beyondWidth: 1, // 区段宽超出宽度 - invadeColor: '#EF0C08', // 区段侵入颜色 - spareColor: '#3F3F3F', // 区段空闲颜色 - communicationOccupiedColor: '#FF329A', // 区段通信车占用颜色 - unCommunicationOccupiedColor: '#FE0000', // 区段非通讯车占用颜色 - routeLockColor: '#FFFFFF', // 区段路由锁定颜色 - faultLockColor: '#9B4A0A', // 区段故障锁定颜色 - undefinedColor: '#0071C1', // 区段未定义颜色 - protectionLockedColor: '#FEFF00', // 保护区段锁闭(未用) - blockColor: '#800080', // 区段封锁颜色 - atcExcisionColor: '#A0522D', // 区段atc切除颜色 - atsExcisionColor: '#A0522D', // 区段ats切除颜色 - timeReleaseColor: '#3F3F3F', // 区段延时释放颜色 - protectiveLockColor: '#FFFF00', // 区段保护锁闭 - protectiveTimeReleaseColor: '#0071C1', // 区段保护延时解锁 - logicalColor: '#FFFF00', // 逻辑区段颜色 (未用) - logicalTextColor: '#FFFFFF' // 逻辑区段名称颜色 (未用) - }, - axle: { - radius: 3, // 计轴 半径 - distance: 5, // 计轴和区段之间的距离 (未用) - color: '#FFFFFF', // 区段计轴颜色 - resetColor: '#00FFFF', // 区段计轴预复位颜色 - Failure: '#E6A23C' // #FFFF00 计轴失效 - }, - speedLimit: { // 限速元素 - width: 1, // 限速线的宽短 - distance: 5, // 限速线距离区段距离 - lineColor: '#FFFF00', // 限速线颜色 - nameShow: false // 名称显示 - }, - separator: { - z: 6, // 分割符层级 - width: 1.2, // 分隔符宽度 - endWidth: 3.5, // 尽头分隔符宽度 - endColor: '#3F3F3F', // 尽头分隔符颜色 - color: '#3149C3' // 区段边界符颜色 - } - }; - - this[deviceType.Signal] = { - distance: 3, // 设备距离区段的距离 - post: { - standardColor: '#3149C3', // 灯珠颜色 - standardWidth: 2 // 灯珠宽度 - }, - text: { - show: true, // 信号机名称显示 - distance: 0, // 文字和灯杆的距离 - isNoRotation: true, // 是否禁止旋转 - isAlignCenter: true, // 信号字体对其方式 - fontSize: 11, // 信号机名称字体大小 - fontWeight: 'bold', // 信号机名称字体粗细 - defaultColor: '#FFFFFF', // 信号灯字体默认色 - blockColor: '#FFFFFF', // 信号灯字体锁定颜色 - checkColor: '#00FF00', // 信号字体 - nameBorderShow: true // 信号机名字边框显示 - }, - lamp: { - guidName: 'defult', // 默认引导类型 - stopWidth: 2, // 禁止线宽度 - borderWidth: 1, // 信号灯边框线宽度 - borderColor: '#3149C3', // 信号灯边框线颜色 - radiusR: 6, // 信号灯半径 - blockColor: '#EF0C08', // 信号灯锁闭 - grayColor: '#7F7F7F', // 信号灯灰色 - redColor: '#FF0000', // 信号灯红色 - greenColor: '#00FF00', // 信号灯绿色 - yellowColor: '#FFFF00', // 信号灯黄色 - whiteColor: '#FFFFFF', // 信号灯白色 - blueColor: '#0070C0' // 信号灯蓝色 - }, - route: { - direction: false, // 自动进路方向 - offset: { x: -4, y: 0 }, // 自动进路偏移量 - routeColor: '#00FF00' // 自动进路 - }, - auto: { - direction: false, // 自动通过方向 - offset: { x: -4, y: 0}, // 自动通过偏移量 - width: 5, // 自动宽度 - autoRoute: '#00FF00', // 自动进路 - autoTrigger: '#FFFF00', // 自动触发 - manualControl: '#FFFF00', // 人工控制 - outConflict: '#C00808' // 出车冲突 - }, - delay: { - direction: true, // 延时解锁方向 - offset: { x: 15, y: -10}, // 延时解锁偏移量 - fontSize: 11, // 延迟解锁字体大小 - fontColor: '#FF0000', // 延迟解锁颜色 - fontWeight: 'bold' // 字体粗细 - }, - button: { - distance: 5, // 信号灯按钮距离区段的距离 - borderDashColor: '#FFFFFF', // 信号灯按钮边线 - buttonColor: 'darkgreen', // 信号灯按钮颜色 - buttonLightenColor: '#E4EF50' // 信号灯按钮闪烁颜色 - } - }; - - this[deviceType.StationStand] = { - common: { // 通用属性 - textFontSize: 11 // 站台默认字体大小 - }, - safetyDoor: { // 屏蔽门 - height: 3, // 站台屏蔽门高度 - distance: 8, // 站台和屏蔽门之间的距离 - defaultColor: '#00FF00', // 屏蔽门默认颜色 - splitDoorColor: '#F61107' // 屏蔽门切除颜色 - }, - stand: { // 站台 - headFontSize: 11, // 站台首端字体大小 - spareColor: '#606060', // 站台空闲颜色 - stopColor: '#FEFE00', // 站台列车停站颜色 - jumpStopColor: '#9A99FF', // 站台跳停颜色 - designatedJumpStopColor: 'lightSkyBlue' // 站台指定列车跳停颜色 - }, - standEmergent: { // 紧急关闭 - mergentR: 4, // 站台紧急关闭半径 - offset: {x: 0, y: 40}, // 站台紧急关闭偏移量 - closeColor: '#F61107' // 站台紧急关闭颜色 - }, - reentry: { // 站台折返策略 - position: 0, // 折返方向 - offset: {x: -16, y: 20}, // 折返偏移量 - noHumanColor: '#0F16DA', // 站台无人折返 - autoChangeEndsColor: '#0BF400' // 站台自动换端 - }, - detainCar: { // 扣车 - text: 'H', // 扣车显示内容 - position: -1, // 扣车方向 - offset: {x: -8, y: -6}, // 扣车偏移量 - trainColor: '#E4EF50', // 车站扣车颜色 - centerTrainColor: '#FFFFFF', // 中心扣车颜色 - andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 - detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 - }, - stopTime: { // 停站时间 - position: 1, // 运行时间方向 - offset: {x: -8, y: 26}, // 运行时间偏移量 - textColor: '#FFFFFF' // 停站时间字体颜色 - }, - level: { // 运行等级 - position: 1, // 运行等级方向 - offset: {x: -8, y: 6}, // 运行等级偏移量 - textColor: '#FFFFFF' // 停站等级字体颜色 - } - }; - - this[deviceType.StationControl] = { - text: { - distance: 2, // 灯和文字之间的距离 - fontSize: 11, // 字体大小 - fontFormat: 'consolas', // 字体格式 - fontColor: '#ffffff', // 字体颜色 - fontWeight: 'normal', // 字体粗细 - textAlign: 'middle', // 字体水平对齐 - textVerticalAlign: 'top' // 字体垂直对齐 - }, - lamp: { - count: 2, // 控制模式灯个数 - offset: {x: 0, y: 0}, // 控制模式灯偏移量 - radiusR: 4, // 控制模式灯的半径 - distance: 36, // 控制模式之间灯之间的距离 - grayColor: '#7F7F7F', // 控制模式灰色 - greenColor: '#00FF00', // 控制模式绿色 - redColor: '#FF0000', // 控制模式红色 - yellowColor: '#FFFF00', // 控制模式黄色 - emergencyControlShow: false, // 紧急站控显示 - centerControlShow: true, // 中控显示 - substationControlShow: true, // 站控按钮显示 - interconnectedControlShow: false // 联锁控显示 - }, - arrow: { - show: true // 控制模式箭头显隐 - }, - mouseOverStyle: { // 鼠标悬浮样式 - fontSize: null, - fontFormat: 'consolas', - fontColor: '#000', - fontWeight: 'normal', - textAlign: 'middle', - textVerticalAlign: 'top' - } - }; - - this[deviceType.StationCounter] = { - text: { - distance: 2, // 计数器名称和文字的距离 - fontColor: '#FFFFFF', // 计数器字体颜色 - borderColor: '#E4EF50' // 计数器边框颜色 - } - }; - - this[deviceType.StationDelayUnlock] = { - text: { - distance: 3, // 延迟解锁和设备之间的距离 - fontColor: '#FFFFFF', // 延时解锁字体颜色 - borderColor: '#FFFFFF' // 延迟解锁边框颜色 - } - }; - - this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, - kmPostShow: true, // 公里标显示 - kilometerPosition: 'up' // 公里标朝向 - }; - - this[deviceType.Switch] = { - text: { - show: true, // 道岔名称显示 - position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 - offset: {x: 0, y: 8}, // 道岔名称与区段距离 - fontSize: 11, // 字体大小 - fontColor: '#C0C0C0', // 道岔名称颜色 - fontWeight: 'bold', // 字体粗细 - borderColor: '#FE0000', // 道岔边框颜色 - lossColor: '#FFFFFF', // 道岔失去颜色 - locateColor: '#00FF00', // 道岔定位颜色 - inversionColor: '#9C9D09', // 道岔反位颜色 - monolockColor: '#870E10' // 道岔单锁颜色 - }, - core: { - length: 6 // 道岔单边长度 - }, - block: { // 道岔封锁配置 - nameBorderShow: true, // 道岔名称是否有包围框 显示 - contentRectShow: false // 道岔封锁显示 - }, - monolock: { // 道岔单锁配置 - locationColor: '#ea282c', // 道岔单锁定位颜色 (红色) - inversionColor: '#ea282c', // 道岔单锁反位颜色 (红色) - rectShow: false // 道岔单锁 矩形框是否显示 - } - }; - - this[deviceType.Line] = { - lineColor: '#FFFFFF' // 线条颜色 - }; - - this[deviceType.LcControl] = { - text: { - fontSize: 10, // 灯字体大小 - fontWeight: 'normal', // 字体粗细 - distance: 5 // 灯跟文字距离 - }, - lamp: { - radiusR: 6, // 灯大小 - controlColor: '#FFFF00' // 灯颜色 - }, - mouseOverStyle: { - fontSize: 10, - fontFormat: 'consolas', - fontColor: '#FFF000', - fontWeight: 'normal', - textAlign: 'middle', - textVerticalAlign: 'top', - arcColor: '#00FFFF', - textColor: '#000000' - } - }; - - this[deviceType.ZcControl] = { - text: { - fontSize: 10, // 字体大小 - fontWeight: 'normal', // 字体粗细 - distance: 5 // 灯跟文字距离 - }, - lamp: { - radiusR: 6, // 灯大小 - controlColor: '#00FF00' // 灯颜色 - }, - mouseOverStyle: { - fontSize: 10, - fontFormat: 'consolas', - fontColor: '#FFF000', - fontWeight: 'normal', - textAlign: 'middle', - textVerticalAlign: 'top', - arcColor: '#00FFFF', - textColor: '#000000' - } - }; - - this[deviceType.LimitControl] = { - text: { - fontSize: 10, // 字体大小 - fontWeight: 'normal', // 字体粗细 - distance: 5 // 灯跟文字距离 - }, - lamp: { - radiusR: 6, // 灯大小 - controlColor: '#ECE9D8' // 灯颜色 - }, - mouseOverStyle: { - fontSize: 10, - fontFormat: 'consolas', - fontColor: '#FFF000', - fontWeight: 'normal', - textAlign: 'middle', - textVerticalAlign: 'top', - textColor: '#000000', - arcColor: '#00FFFF' - } - }; - - this[deviceType.TrainWindow] = { - lineColor: '#4DD43F', // 车次窗颜色 - lineDash: null, // 车次窗虚线间隔 - lineWidth: 1, // 车次窗线宽 - trainWindowSmooth: 0 // 车次窗矩形圆滑程度 - }; - - this[deviceType.Train] = { - trainBody: { - trainBodyLineWidth: 0, // 车身line宽 - changeTrainWidth: true, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 - specialTrainType: [ - { - type: '03', - serviceNumber: 'MM', - nameFormat: 'serviceNumber:groupNumber' - }, - { - type: '02', - nameFormat: 'targetCode:groupNumber' - } - ], // 特殊列车类型需设置显示格式 - lrPadding: 1, // 两边间隔 - upPadding: 1, // 上边距离 - trainBodyFillColor: '#000000', // 列车车身填充颜色 - trainNameFormat: 'targetCode:serviceNumber:tripNumber'// 列车显示格式 - }, - hsda: { - trainHSDATextFontSize: 8// 列车HDSA字号 - }, - trainNumber: { - targetCodePrefix: '000', // 目的地码前缀 - defaultTargetCode: 'AAA', // 默认目的地码 - trainTargetTextAlign: 'left', // 车次号文字显示位置 - trainNumberOffset: { x: 1, y: 1}// 目的地码偏移量 - }, - trainServer: { - serviceNumberPrefix: '00', // 服务号(表号)前缀 - defaultServiceNumber: 'BB', // 默认服务号(表号) - trainServerOffset: { x: 26, y: 1}// 列车服务号偏移 - }, - trainTarget: { - tripNumberPrefix: '0000', // 车次号前缀 - defaultDirectionCode: 'D', // 默认车次号1 - defaultTripNumber: 'CCC', // 默认车次号2 - trainTargetOffset: { x: 42, y: 1}// 列车车次号偏移 - }, - trainTargetNumber: { - groupNumberPrefix: '000', // 车组号前缀 - defaultGroupNumber: 'EEE', // 默认车组号 - trainTargetNumberOffset: {x: 0, y: 1}// 车组号偏移量 - }, - trainHead: { - trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框 - trainHeadTriangleFirst: { x: 0, y: 0}, // 列车车头三角坐标1偏移量 - trainHeadTriangleSecond: { x: 4, y: 7.5}, // 列车车头三角坐标2偏移量 - trainHeadTriangleThird: { x: 0, y: 15}, // 列车车头三角坐标3偏移量 - trainHeadRectHeight: 15, // 列车车头矩形高度 - trainConntWidth: 4, // 列车竖杠的宽度 - trainHeadFillColor: '#EF0C08'// 列车车头矩形填充颜色 - }, - common: { - trainHeight: 17, // 列车高度 - trainHeadDistance: 2, // 列车和车头之间的间距 - trainWidth: 76, // 列车长度 - trainTextFontSize: 15, // 列车字号 - fontFamily: 'consolas', // 默认字体 族类 - nameFontSize: 15, // 字体大小 - haveTextHSDA: false, // 是否需创建textHSDA对象 - haveArrowText: true, // 是否需创建arrowText对象 - haveTrainBorder: false, // 是否需创建trainBorder对象 - aspectRatio: 8 / 15, // 字体宽高比例(用以拼接text是计算位置) - textOffset: 1, // 字体偏移(用以控制字体据车头的距离) - trainWidthMoreText: 2 // 计算列车长度时--列车长比text多出尺寸 - }, - trainStatusStyle: { - destinationStatus: [ - {status: '01', showColor: '#FFFFFF'}, - {status: '02', showColor: '#00FF00'}, - {status: '03', showColor: '#3265FF'}, - {status: '04', showColor: '#9B4A09'}, - {status: '05', showColor: '#EF0C08'}, - {status: '06', showColor: '#FFFFFF'}, - {status: '07', showColor: '#FFFF00'} - ], // 目的地状态 01准点 02早点 03严重早点 04晚点 05严重晚点 06头码车 07ATP切除 - destinationStatusSetText: 'trainServer', // 目的地状态设置的对应哪个text的颜色 - directionType: [ - { - type: '01', - lineLShow: false, - lineRShow: false, - arrowLShow: false, - arrowRShow: false - }, - { - type: '02', - lineLShow: false, - lineRShow: false, - arrowLShow: false, - arrowRShow: true - }, - { - type: '03', - lineLShow: false, - lineRShow: false, - arrowLShow: true, - arrowRShow: false - } - ], // 运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 - directionStopType: [ - {type: '01', lineLShow: false, lineRShow: false}, - {type: '02', lineLShow: false, lineRShow: true}, - {type: '03', lineLShow: true, lineRShow: false} - ], // 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 - runModeStatus: [ - { - status: '01', - trainLColor: '#EF0C08', - trainRColor: '#EF0C08' - }, - { - status: '02', - trainLColor: '#00FF00', - trainRColor: '#00FF00' - }, - { - status: '03', - trainLColor: '#FFFF00', - trainRColor: '#FFFF00' - }, - { - status: '04', - trainLColor: '#EA700D', - trainRColor: '#EA700D' - }, - { - status: '05', - trainLColor: '#A0522D', - trainRColor: '#A0522D' - } - ], // 列车运行模式对应车头颜色 01信号中断 02 ATO自动驾驶模式AM 03 ATP监控下的人工驾驶模式CM 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM - runControlStatus: [], // 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false} - doorStatus: [], // 设置车门状态类型 eg:{status: '01', dShow: false} - communicationStatus: [], // 设置通信状态 eg:{status: '01', trainColor:'#725A64'} - alarmStatus: [], // 设置报警状态 eg:{status: '01', aShow: false} - serverNoType: []// 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'} - } - }; - } -} - -export default new SkinCode(); diff --git a/src/jmap/constant/deviceRender.js b/src/jmap/constant/deviceRender.js deleted file mode 100644 index 1bac56f0e..000000000 --- a/src/jmap/constant/deviceRender.js +++ /dev/null @@ -1,117 +0,0 @@ -import deviceType from './deviceType'; - -const deviceRender = {}; - -/** link渲染配置*/ -deviceRender[deviceType.Link] = { - _type: deviceType.Link, - zlevel: 1 -}; - -/** Section渲染配置*/ -deviceRender[deviceType.Section] = { - _type: deviceType.Section, - zlevel: 1 -}; - -/** Signal渲染配置*/ -deviceRender[deviceType.Signal] = { - _type: deviceType.Signal, - zlevel: 1 -}; - -/** Switch渲染配置*/ -deviceRender[deviceType.Switch] = { - _type: deviceType.Switch, - zlevel: 1 -}; - -/** Station渲染配置*/ -deviceRender[deviceType.Station] = { - _type: deviceType.Station, - zlevel: 1 -}; - -/** StationStand渲染配置*/ -deviceRender[deviceType.StationStand] = { - _type: deviceType.StationStand, - zlevel: 1 -}; - -/** StationControl渲染配置*/ -deviceRender[deviceType.StationControl] = { - _type: deviceType.StationControl, - zlevel: 1 -}; - -/** ImageControl渲染配置*/ -deviceRender[deviceType.ImageControl] = { - _type: deviceType.ImageControl, - zlevel: 1 -}; - -/** ZcControl渲染配置*/ -deviceRender[deviceType.ZcControl] = { - _type: deviceType.ZcControl, - zlevel: 1 -}; - -/** LcControl渲染配置*/ -deviceRender[deviceType.LcControl] = { - _type: deviceType.LcControl, - zlevel: 1 -}; - -/** LimitControl渲染配置*/ -deviceRender[deviceType.LimitControl] = { - _type: deviceType.LimitControl, - zlevel: 1 -}; - -/** StationDelayUnlock渲染配置*/ -deviceRender[deviceType.StationDelayUnlock] = { - _type: deviceType.StationDelayUnlock, - zlevel: 1 -}; - -/** Train渲染配置*/ -deviceRender[deviceType.Train] = { - _type: deviceType.Train, - zlevel: 1 -}; - -/** TrainWindow渲染配置*/ -deviceRender[deviceType.TrainWindow] = { - _type: deviceType.TrainWindow, - zlevel: 1 -}; - -/** Line渲染配置*/ -deviceRender[deviceType.Line] = { - _type: deviceType.Line, - zlevel: 1 -}; - -/** Text渲染配置*/ -deviceRender[deviceType.Text] = { - _type: deviceType.Text, - zlevel: 1 -}; - -/** TrainWindow渲染配置*/ -deviceRender[deviceType.TrainWindow] = { - _type: deviceType.TrainWindow, - zlevel: 1 -}; -/** Train渲染配置*/ -deviceRender[deviceType.TRain] = { - _type: deviceType.TRain, - zlevel: 1 -}; -/** CheckBox渲染配置*/ -deviceRender[deviceType.CheckBox] = { - _type: deviceType.CheckBox, - zlevel: 1 -}; - -export default deviceRender; diff --git a/src/jmap/constant/deviceState.js b/src/jmap/constant/deviceState.js deleted file mode 100644 index dfa97f886..000000000 --- a/src/jmap/constant/deviceState.js +++ /dev/null @@ -1,334 +0,0 @@ -import deviceType from './deviceType'; - -const deviceState = {}; - -deviceState[deviceType.Section] = { -/** 区段状态*/ - status: { - Default: '01', /** 空闲(缺省值)*/ - State00: '00', /** 未定义状态 */ - State01: '01', /** 空闲 */ - State02: '02', /** 通信车占用 */ - State03: '03', /** 非通信车占用 */ - State04: '04', /** 进路锁闭 */ - State05: '05', /** 故障锁闭 */ - State06: '06', /** 封锁 */ - State07: '07', /** ATC切除 */ - State08: '08', /** ATS切除 */ - State09: '09', /** 进路延续保护 */ - State10: '10', /** 延时释放 */ - State11: '11', /** 保护区段锁闭 */ - State12: '12', /** 保护区段延时解锁 */ - State13: '13', /** ARB出清检测错误状态 */ - State14: '14' /** 计轴失效 */ - }, - /** 限速*/ - speedUpperLimit: { - Default: -1 /** 不限速*/ - }, - /** 是否切除*/ - cutOff: { - Default: false /** 是否切除*/ - }, - /** 是否故障*/ - fault: { - Default: false /** 非故障*/ - } -}; - -deviceState[deviceType.Switch] = { - /** 定位状态*/ - locateType: { - Default: '01', /** 道岔位置类型 - 定位(缺省值)*/ - State01: '01', /** 道岔位置类型 - 定位 */ - State02: '02', /** 道岔位置类型 - 反位 */ - State03: '03', /** 道岔位置类型 - 失去表示 */ - State04: '04' /** 道岔位置类型 - 挤岔 */ - }, - /** 道岔状态*/ - status: { - Default: '01', /** 道岔状态类型 - 空闲(缺省值)*/ - State01: '01', /** 道岔状态类型 - 空闲 */ - State02: '02', /** 道岔状态类型 - 通信车占用 */ - State03: '03', /** 道岔状态类型 - 非通信车占用 */ - State04: '04', /** 道岔状态类型 - 进路锁闭 */ - State05: '05', /** 道岔状态类型 - 故障锁闭 */ - State06: '06', /** 道岔状态类型 - 进路延续保护 */ - State07: '07', /** 道岔状态类型 - 进路延续保护解锁 */ - State08: '08', /** 道岔状态类型 - ATC切除 */ - State09: '09', /** 道岔状态类型 - ATS切除 */ - State10: '10', /** 道岔状态类型 - 人工单锁 */ - State11: '11', /** 道岔状态类型 - 逻辑锁 */ - State12: '12', /** 道岔状态类型 - 人工锁+逻辑锁 */ - State13: '13', /** 道岔状态类型 - 延时释放*/ - State14: '14' /** 道岔状态类型 - 封锁*/ - }, - /** 是否故障*/ - fault: { - Default: false /** 非故障*/ - }, - /** 是否切除*/ - cutOff: { - Default: false /** 是否切除*/ - } -}; - -deviceState[deviceType.Signal] = { - /** 进路性质类型 */ - natureType: { - Default: '00', /** 无状态(缺省值)*/ - State01: '01', /** 列车进路 */ - State02: '02', /** 调车进路 */ - State03: '03' /** 折返进路 */ - }, - /** 信号机状态类型 */ - status: { - Default: '01', /** 关闭(缺省值)*/ - State01: '01', /** 关闭 */ - State02: '02', /** 开放正向 */ - State03: '03', /** 开放侧向 */ - State04: '04', /** 引导 */ - State05: '05', /** 封锁 */ - State06: '06', /** 故障 */ - State07: '07', /** 功能封锁 */ - State08: '08' /** 信号保护区段监视 */ - }, - /** 信号机状态类型 */ - lightType: { - Default: '01', /** 物理点灯(缺省值)*/ - State01: '01', /** 物理点灯 */ - State02: '02' /** 逻辑点灯 */ - }, - /** 信号机延时状态类型 */ - delayType: { - Default: '01', /** 未延时解锁(缺省值)*/ - State01: '01', /** 未延时解锁 */ - State02: '02', /** 人工闭塞延时解锁 */ - State03: '03' /** 自动闭塞延时解锁 */ - }, - /** 信号机自动信号状态类型 */ - autoType: { - Default: '01', /** 隐藏(缺省值)*/ - State01: '01', /** 隐藏 */ - State02: '02', /** 设置自动信号模式状态类型 */ - State03: '03', /** 设置自动进路模式状态类型 */ - State04: '04' /** 信号机进路自动触发模式状态类型 */ - }, - /** 信号机自动通过信号状态类型 */ - autoRouteType: { - Default: '01', /** 不自动通过(缺省值)*/ - State01: '01', /** 不自动通过 */ - State02: '02' /** 自动通过 */ - }, - /** 信号机按钮状态类型 */ - buttonState: { - Default: '01', /** 空闲(缺省值)*/ - State01: '01', /** 空闲 */ - State02: '02', /** 选择基本进路始端 */ - State03: '03', /** 选择折返进路始端 */ - State04: '04', /** 基本进路终端待选 */ - State05: '05' /** 折返进路终端待选 */ - }, - /** 引导信号按钮状态类型 */ - guideStatus: { - Default: '01', /** 空闲(缺省值)*/ - State01: '01', /** 空闲 */ - State02: '02' /** 引导 */ - - }, - /** 道岔定位状态*/ - switchLocateType: { - Default: '01', /** 定位(缺省值)*/ - State01: '01', /** 定位*/ - State02: '02' /** 反位*/ - }, - /** 信号机进路办理*/ - routeSetting: { - Default: false /** 信号机进路办理*/ - }, - /** 是否故障*/ - fault: { - Default: false /** 非故障*/ - } -}; - -deviceState[deviceType.Station] = { - /** 是否故障*/ - fault: { - Default: false /** 非故障*/ - } -}; - -deviceState[deviceType.StationControl] = { - /** 控制模式状态 */ - status: { - Default: '01', /** 中控(缺省值)*/ - State01: '01', /** 中控 */ - State02: '02', /** 站控 */ - State03: '03' /** 紧急站控 */ - }, - /** 是否故障*/ - fault: { - Default: false /** 非故障*/ - } -}; - -deviceState[deviceType.StationDelayUnlock] = { - /** 延迟解锁状态*/ - status: { - Default: '01', /** 关闭(默认值)*/ - State01: '01', /** 关闭 */ - State02: '02' /** 显示 */ - - }, - /** 是否故障*/ - fault: { - Default: false /** 非故障*/ - } -}; - -deviceState[deviceType.StationStand] = { - /** 车站状态*/ - status: { - Default: '01', /** 空闲(缺省值)*/ - State01: '01', /** 空闲 */ - State02: '02', /** 列车停站 */ - State05: '03' /** 站台紧急关闭 */ - }, - /** 屏蔽门状态*/ - screenDoorStatus: { - Default: '01', /** 关门(缺省值)*/ - State01: '01', /** 正常 */ - State02: '02', /** 故障 */ - State03: '03' /** 切除 */ - }, - /** 屏蔽门开门状态*/ - screenDoorOpenStatus: { - Default: '01', /** 关门(缺省值)*/ - State01: '01', /** 关门 */ - State02: '02' /** 开门 */ - }, - /** 扣车状态*/ - holdStatus: { - Default: '01', /** 未设置扣车(缺省值)*/ - State01: '01', /** 未设置扣车*/ - State02: '02', /** 车站扣车*/ - State03: '03', /** 中心扣车*/ - State04: '04' /** 中心+车站扣车*/ - }, - /** 跳停*/ - jumpStopStatus: { - Default: '01', /** 未设置跳停(缺省值)*/ - State01: '01', /** 未设置跳停 */ - State02: '02', /** 指定列车跳停 */ - State03: '03' /** 全部跳停 */ - }, - /** 停站时间*/ - parkingTime: { - Default: -1 /** 无停站时间*/ - }, - /** 运行等级*/ - intervalRunTime: { - Default: -1 /** 无运行等级*/ - }, - /** 折返策略*/ - reentryStrategy: { - Default: '01', /** 默认(缺省值)*/ - State01: '01', /** 无折返策略 */ - State02: '02', /** 无人折返 */ - State03: '03', /** 自动换端 */ - State04: '04' /** 默认 */ - }, - /** 是否故障*/ - fault: { - Default: false /** 非故障*/ - } -}; - -deviceState[deviceType.Train] = { - /** 列车类型*/ - type: { - Default: '01', /** 计划车-指运行图编制出的有车组号、表号、车次号的列车(缺省值)*/ - State01: '01', /** 计划车-指运行图编制出的有车组号、表号、车次号的列车*/ - State02: '02', /** 头码车-指赋予了车组号和运行目的地的非计划列车*/ - State03: '03' /** 人工车-指由调度员手工添加的并人工组织运行的只赋予车组号的非计划列车*/ - }, - /** 服务号状态类型*/ - serverNoType: { - Default: '01', /** 显示服务号,白色(缺省值)*/ - State01: '01', /** 显示服务号,白色 */ - State02: '02', /** 显示车组号(计划车、头码车),黄色 */ - State03: '03' /** 显示车组号(人工车),粉色 */ - }, - /** 目的地状态类型*/ - destinationStatus: { - Default: '01', /** 准点(缺省值)*/ - State01: '01', /** 准点*/ - State02: '02', /** 早点*/ - State03: '03', /** 严重早点*/ - State04: '04', /** 晚点*/ - State05: '05', /** 严重晚点*/ - State06: '06', /** 头码车*/ - State07: '07' /** ATP切除*/ - }, - /** 运行方向状态类型*/ - directionType: { - Default: '01', /** 未知方向(缺省值)*/ - State01: '01', /** 未知方向 */ - State02: '02', /** 从左向右 */ - State03: '03' /** 从右向左 */ - }, - /** 运行状态*/ - runStatus: { - Default: '01', /** 停止(缺省值)*/ - State01: '01', /** 停止 */ - State02: '02' /** 运行 */ - }, - /** 运行模式*/ - runMode: { - Default: '01', /** 未知模式(缺省值)*/ - State01: '01', /** 未知模式 */ - State02: '02', /** ATO自动驾驶模式 AM */ - State03: '03', /** ATP监控下的人工驾驶模式 CM */ - State04: '04', /** 限制人工驾驶模式 RM */ - State05: '05' /** 非限制人工驾驶模式 RM */ - }, - /** 运行控制状态类型*/ - runControlStatus: { - Default: '01', /** 正常(缺省值)*/ - State01: '01', /** 正常 */ - State02: '02', /** 扣车 */ - State03: '03' /** 跳停 */ - }, - /** 车门状态 */ - doorStatus: { - Default: '01', /** 关门(缺省值)*/ - State01: '01', /** 关门 */ - State02: '02', /** 开门 */ - State03: '03' /** 故障 */ - }, - /** 通信状态类型*/ - communicationStatus: { - Default: '01', /** 正常(缺省值)*/ - State01: '01', /** 正常 */ - State02: '02' /** 故障 */ - }, - /** 计划冲突状态*/ - planConflictStatus: { - Default: '01', /** 无冲突(缺省值)*/ - State01: '01', /** 无冲突 */ - State02: '02' /** 有冲突 */ - }, - /** 报警状态*/ - alarmStatus: { - Default: '01', /** 无报警(缺省值)*/ - State01: '01', /** 无报警 */ - State02: '02' /** 有报警 */ - }, - /** 是否故障*/ - fault: { - Default: false /** 非故障*/ - } -}; - -export default deviceState; diff --git a/src/jmap/constant/deviceType.js b/src/jmap/constant/deviceType.js deleted file mode 100644 index 9ecbe5129..000000000 --- a/src/jmap/constant/deviceType.js +++ /dev/null @@ -1,23 +0,0 @@ -const deviceType = { - Link: 'Link', - Section: 'Section', - Switch: 'Switch', - Signal: 'Signal', - ZcControl: 'ZcControl', - LcControl: 'LcControl', - LimitControl: 'LimitControl', - ImageControl: 'ImageControl', - Station: 'Station', - StationStand: 'StationStand', - StationControl: 'StationControl', - StationCounter: 'StationCounter', - ButtonControl: 'ButtonControl', - StationDelayUnlock: 'StationDelayUnlock', - Train: 'Train', - TrainWindow: 'TrainWindow', - Line: 'Line', - Text: 'Text', - CheckBox: 'CheckBox' -}; - -export default deviceType; diff --git a/src/jmap/keyboardController.js b/src/jmap/keyboardController.js deleted file mode 100644 index 9c40ef810..000000000 --- a/src/jmap/keyboardController.js +++ /dev/null @@ -1,82 +0,0 @@ -import Eventful from 'zrender/src/mixin/Eventful'; - -class KeyboardController extends Eventful { - constructor(jmap) { - super(); - this.$jmap = jmap; - this.$zr = jmap.getZr(); - this.events = jmap.getEvents(); - this.initData(); - this.initHandler(this.$zr); - } - - initHandler(zr) { - if (zr) { - var keydownHandle = this.keydown.bind(this); - var keyupHandle = this.keyup.bind(this); - var dom = this.$zr.dom; - - this.enable = function (opts) { - opts = opts || {}; - this._keyOnDownUp = opts.keyOnDownUp || true; - - dom.addEventListener('keydown', keydownHandle, false); - dom.addEventListener('keyup', keyupHandle, false); - dom.focus(); - }; - - this.disable = function () { - dom.removeEventListener('keydown', keydownHandle, false); - dom.removeEventListener('keyup', keyupHandle, false); - }; - - this.dispose = function() { - this.disable(); - }; - } - } - - initData() { - this._keyboards = [ - { key: 'Control', keyCode: 17, active: false }, - { key: 'Shift', keyCode: 16, active: false }, - { key: 'Alt', keyCode: 18, active: false } - ]; - } - - keydown(e) { - if (this._keyOnDownUp && !e.repeat) { - var index = this._keyboards.findIndex( - elem=> { return elem.keyCode == e.keyCode; } - ); - - if (index >= 0) { - this._keyboards[index].active = true; - } else { - var str = ''; - this._keyboards.forEach(elem => { - if (elem.active) { - str += elem.key; - str += '_'; - } - }); - - str += e.key.toUpperCase(); - this.trigger(this.events.Keyboard, str); - this._keyboards.forEach(elem => { elem.active = false; }); - } - } - } - - keyup(e) { - if (this._keyOnDownUp && !e.repeat) { - this._keyboards.forEach(elem=> { - if (elem.keyCode == e.keyCode) { - elem.active = false; - } - }); - } - } -} - -export default KeyboardController; diff --git a/src/jmap/map.js b/src/jmap/map.js deleted file mode 100644 index 0f52b3dde..000000000 --- a/src/jmap/map.js +++ /dev/null @@ -1,400 +0,0 @@ -import * as zrUtil from 'zrender/src/core/util'; -import zrender from 'zrender'; -import localStore from 'storejs'; -import Painter from './painter'; -import Options from './options'; -import MouseController from './mouseController'; -import KeyboardController from './keyboardController'; -import deviceState from './constant/deviceState'; -import deviceType from './constant/deviceType'; -import { selectLineCode } from './config/deviceStyle'; -import { deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser'; -import { deepAssign } from '@/utils/index'; - -const renderer = 'canvas'; -const devicePixelRatio = 1; - -class Jlmap { - constructor(opts) { - // 回调事件 - this.methods = opts.methods; - - // 鼠标事件 - this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom', Keyboard: 'keyboard'}; - - // 线路参数 - this.lineCode = ''; - - // 皮肤风格 - this.style = {}; - - // 设备数据 - this.mapDevice = {}; - - // 默认状态 - this.defaultStateDict = this.loadDefaultState(); - - this.initMapInstance(opts); - } - - // 初始化属性有鼠标事件 缩放等 - initMapInstance(opts) { - const width = opts.dom.clientWidth; - const height = opts.dom.clientHeight; - this.zoomOnMouseWheel = opts.options.zoomOnMouseWheel; - - this.$zr = zrender.init(opts.dom, deepAssign({ renderer, devicePixelRatio, width, height }, opts.config)); - this.$zr.dom.setAttribute('tabIndex', -1); - this.$options = new Options(deepAssign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {}), (dataZoom) => { this.$mouseController.trigger(this.events.DataZoom, dataZoom); }); // 缩放 - this.$painter = new Painter(this); - this.$painter.updateZrSize({width: this.$zr.getWidth(), height: this.$zr.getHeight()}); - this.$painter.updateTransform(this.$options); - - this.optionsHandler = this.setOptions.bind(this); - - this.$mouseController = new MouseController(this); - this.$mouseController.enable(); - - this.$mouseController.on(this.events.__Pan, this.optionsHandler); - this.$mouseController.on(this.events.__Zoom, this.optionsHandler); - - this.$keyboardController = new KeyboardController(this); - this.$keyboardController.enable(); - } - - loadStyle(lineCode) { - return selectLineCode(lineCode); - } - - loadDefaultState() { - const defaultStateDict = {}; - - zrUtil.each(Object.keys(deviceState), (type) => { - defaultStateDict[type] = {}; - zrUtil.each(Object.keys(deviceState[type] || {}), (state) => { - defaultStateDict[type][state] = deviceState[type][state].Default; - }, this); - }, this); - - return defaultStateDict; - } - - setMap(map, mapDevice) { - // 保存皮肤类型 - if (map.skinVO) { - this.lineCode = map.skinVO.code; - this.$options.scaleRate = map.skinVO.scaling || 1; - this.$options.offsetX = map.skinVO.origin ? map.skinVO.origin.x : 0; - this.$options.offsetY = map.skinVO.origin ? map.skinVO.origin.y : 0; - } - - // 更新视图大小 - this.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY }); - - // 解析后的数据 - this.mapDevice = mapDevice; - - // 加载对应皮肤 - this.style = this.loadStyle(this.lineCode); - - // 数据加载完成 回调 - if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.mapDevice); } - - // 初次渲染视图 - this.$painter.repaint(this.mapDevice); - - // 视图加载完成 回调 - if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.mapDevice); } - } - - setMapDevice(mapDevice) { - this.mapDevice = mapDevice; - } - - setDefaultState() { - const list = []; - - Object.values(this.mapDevice).forEach(elem => { - const code = elem.code; - const type = elem._type; - // 列车不需要设置默认状态 - type != deviceType.Train && list.push(Object.assign({ code, _type: type }, this.defaultStateDict[type])); - }); - - this.update(list); - - if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); } - } - - setOptions(opts) { - const options = this.pullBack(opts); - this.$options.update(options); - this.$painter.updateTransform(this.$options); - - if (this.$options.disabled == true) { - this.$mouseController.disable(); - } else { - opts['zoomOnMouseWheel'] = this.zoomOnMouseWheel; - this.$mouseController.enable(opts); - } - - if (this.methods.optionsUpdate instanceof Function) { this.methods.optionsUpdate(this.$options); } - } - - setCenter(deviceCode) { - const device = this.mapDevice[deviceCode]; - if (device && device.instance) { - var rect = createBoundingRect(device.instance); - var dcenter = calculateDCenter(rect, { width: this.$zr.getWidth(), height: this.$zr.getHeight() }); - this.setOptions(dcenter); - } - } - - setLayerVisible(layer) { - this.$painter.setLayerVisible(layer); - } - - setLevelVisible(list) { - this.$painter.setLevelVisible(list); - } - - render(list) { - (list || []).forEach(elem => { - const code = elem.code; - const type = elem._type; - const oDevice = this.mapDevice[code] || deviceFactory(type, elem); - const nDevice = deepAssign(oDevice || {}, elem); - this.$painter.delete(oDevice); - delete this.mapDevice[code]; - if (!elem._dispose) { - this.mapDevice[code] = nDevice; - this.$painter.add(nDevice); - } - }); - - if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); } - } - - // 中间处理 - hookHandle(oDevice, elem) { - const code = elem.code; - const type = elem._type; - // 如果是延时计时,需要保存计数值到全局 - if (type === deviceType.StationCounter) { - let val = '' + elem.val; - if (val === '0' || !elem.val) { - val = elem.val = localStore.get(code) || '0'; - } - - localStore(code, val); - } - - for (var prop in elem) { - if (oDevice[prop] != elem[prop]) { - deepAssign(oDevice, elem); - return true; - } - } - - return false; - } - - // 后处理 - postHandle(list) { - list.forEach(elem => { - const code = elem.code; - const type = elem._type; - if (type == deviceType.Switch) { - const item = this.mapDevice[code]; - if (item) { - const sectionA = this.mapDevice[item.sectionACode]; - const sectionB = this.mapDevice[item.sectionBCode]; - const sectionC = this.mapDevice[item.sectionCCode]; - if (sectionA && sectionB && sectionC) { - item['cutOff'] = sectionA.cutOff; - item['sectionAstatus'] = sectionA.status; - item['sectionBstatus'] = sectionB.status; - item['sectionCstatus'] = sectionC.status; - } - } - - this.$painter.update(item); - } - - if (type == deviceType.Section) { - const item = this.mapDevice[code]; - if (item) { - const swch = this.mapDevice[item.relSwitchCode]; - if (swch) { - const sectionA = this.mapDevice[swch.sectionACode]; - const sectionB = this.mapDevice[swch.sectionBCode]; - const sectionC = this.mapDevice[swch.sectionCCode]; - if (sectionA && sectionB && sectionC) { - swch['cutOff'] = sectionA.cutOff; - swch['sectionAstatus'] = sectionA.status; - swch['sectionBstatus'] = sectionB.status; - swch['sectionCstatus'] = sectionC.status; - } - - this.$painter.update(swch); - } - } - } - }); - } - - update(list) { - (list || []).forEach(elem => { - const code = elem.code; - const type = elem._type; - const oDevice = this.mapDevice[code] || deviceFactory(type, elem); - if (elem.dispose) { - this.$painter.delete(oDevice); - } else { - if (this.hookHandle(oDevice, elem)) { - this.$painter.update(oDevice); - } - } - }); - - // 状态后处理 - this.postHandle(list || []); - - if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); } - } - - pullBack(payload) { - if (payload.type === 'zoom') { - const zrWidth = this.$zr.getWidth(); - const zrHeight = this.$zr.getHeight(); - const originX = payload.originX || zrWidth / 2; - const originY = payload.originY || zrHeight / 2; - const x = (this.$options.offsetX + originX) / this.$options.scaleRate; - const y = (this.$options.offsetY + originY) / this.$options.scaleRate; - const newScaleRate = this.$options.getScaleRate(payload.scale); - const dx = originX - (x * newScaleRate - this.$options.offsetX); - const dy = originY - (y * newScaleRate - this.$options.offsetY); - payload.dx = dx; - payload.dy = dy; - } - - return payload || {}; - } - - getZr() { - return this.$zr; - } - - getEvents() { - return this.events; - } - - getDeviceByCode(code) { - return this.mapDevice[code]; - } - - getShapeTipPoint(opts) { - const device = this.mapDevice[opts.code]; - if (device) { - return this.$painter.getShapeTipPoint(device.instance, opts); - } - } - - resize(opt) { - this.$zr.resize(opt); - this.$painter.updateZrSize(opt); - } - - refresh() { - this.$painter.refresh(); - } - - clearTrainView() { - this.$painter.clearLevel(deviceType.Train); - zrUtil.each(Object.values(this.mapDevice), device => { - if (device._type == deviceType.Train) { - device.instance = null; - } - }); - } - - clear() { - this.lineCode = ''; - this.style = {}; - this.mapDevice = {}; - this.$painter.clear(); - } - - dispose() { - this.off(this.events.Pan, this.optionsHandler); - this.off(this.events.Zoom, this.optionsHandler); - - this.clear(); - - this.$mouseController.dispose(); - this.$keyboardController.dispose(); - this.$zr && zrender.dispose(this.$zr); - this.$painter.dispose(); - } - - on(eventname, cb, context) { - const idx = Object.values(this.events).indexOf(eventname); - if (idx >= 0) { - switch (eventname) { - case this.events.Selected: - this.$mouseController.on(this.events.Selected, cb, context); - break; - case this.events.Contextmenu: - this.$mouseController.on(this.events.Contextmenu, cb, context); - break; - case this.events.DataZoom: - this.$mouseController.on(this.events.DataZoom, cb, context); - break; - case this.events.Keyboard: - this.$keyboardController.on(this.events.Keyboard, cb, context); - } - } - } - - off(eventname, cb) { - const idx = Object.values(this.events).indexOf(eventname); - if (idx >= 0) { - switch (eventname) { - case this.events.Selected: - this.$mouseController.off(this.events.Selected, cb); - break; - case this.events.Contextmenu: - this.$mouseController.off(this.events.Contextmenu, cb); - break; - case this.events.DataZoom: - this.$mouseController.off(this.events.DataZoom, cb); - break; - case this.events.Keyboard: - this.$keyboardController.off(this.events.keyboard, cb); - break; - } - } - } - - renderCheckBox(model) { - const type = model._type; - const code = model.code; - const oDevice = this.mapDevice[code] || deviceFactory(type, model); - const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, model)); - delete this.mapDevice[code]; - this.$painter.delete(oDevice); - if (!model._dispose) { - this.mapDevice[code] = nDevice; - this.$painter.add(nDevice); - } - } - deleteCheckBox(code) { - const oDevice = this.mapDevice[code]; - if (oDevice) { - delete this.mapDevice[code]; - this.$painter.delete(oDevice); - } - } -} - -export default Jlmap; diff --git a/src/jmap/mouseController.js b/src/jmap/mouseController.js deleted file mode 100644 index a3262fbd7..000000000 --- a/src/jmap/mouseController.js +++ /dev/null @@ -1,306 +0,0 @@ -import deviceType from './constant/deviceType'; -import Eventful from 'zrender/src/mixin/Eventful'; -import * as eventTool from 'zrender/src/core/event'; -import store from '@/store/index_APP_TARGET'; - -class EventModel { - constructor(e) { - this.clientX = e.event.clientX; - this.clientY = e.event.clientY; - - let view = e.target; - while (view) { - if (Object.values(deviceType).includes(view._type)) { - this.deviceCode = view._code; - this.deviceType = view._type; - this.eventTarget = view; - break; - } - - if (view._subType) { - this.subType = view._subType; - } - if (view._val) { - this.val = view._val; - } - - view = view.parent; - } - } -} - -class MouseController extends Eventful { - constructor(jmap) { - super(); - this.$jmap = jmap; - this.deviceList = []; - this.rightClickPoint = { - x: 0, - y: 0 - }; // 右键点击坐标 - this.$zr = jmap.getZr(); - this.events = jmap.getEvents(); - this.initHandler(this.$zr); - } - - initHandler(zr) { - if (zr) { - zr.on('click', this.click, this); - zr.on('contextmenu', this.contextmenu, this); - zr.on('mousemove', this.moveEvent, this); - - this.enable = function (opts) { - opts = opts || {}; - this._moveOnMouseMove = opts.moveOnMouseMove || true; - this._zoomOnMouseWheel = opts.zoomOnMouseWheel || false; - this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true; - - this.disable(); - - zr.on('mousedown', this.mousedown, this); - zr.on('mousemove', this.mousemove, this); - zr.on('mouseup', this.mouseup, this); - zr.on('mousewheel', this.mousewheel, this); - }; - - this.disable = function () { - zr.off('mousedown', this.mousedown); - zr.off('mousemove', this.mousemove); - zr.off('mouseup', this.mouseup); - zr.off('mousewheel', this.mousewheel); - }; - - this.dispose = function () { - zr.off('click', this.click); - zr.off('contextmenu', this.contextmenu); - zr.off('mousemove', this.moveEvent); - this.disable(); - }; - - this.isDragging = function () { return this._dragging; }; - } - } - - mousedown(e) { - // if (eventTool.notLeftMouse(e)) { - // return; - // } - - this.$zr.dom.focus(); - if (e.which == 1 || e.which == 3) { - var x = e.offsetX; - var y = e.offsetY; - - this._x = x; - this._y = y; - this._dragging = true; - if (e.which == 3 && this._zoomOnMouseWheel) { - this.handleMouseDownRight(e); - } else if (e.which == 1 && this._zoomOnMouseWheel) { - this.handleMouseDownLeft(e); - } - } - } - - mousemove(e) { - // if (eventTool.notLeftMouse(e) || - // !this._moveOnMouseMove || - // !this._dragging - // ) { - // return; - // } - - const oldX = this._x; - const oldY = this._y; - - const dx = e.offsetX - oldX; - const dy = e.offsetY - oldY; - - this._x = e.offsetX; - this._y = e.offsetY; - - if (e.which == 1) { - this._preventDefaultMouseMove && eventTool.stop(e.event); - - this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y }); - } else if (e.which === 3 && this._zoomOnMouseWheel) { - this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY}); - } - } - - mouseup(e) { - if (!eventTool.notLeftMouse(e)) { - this._dragging = false; - } - if (this._zoomOnMouseWheel && this.$jmap.mapDevice['check_box']) { - this.eventTarget = this.$jmap.mapDevice['check_box'].instance; - this.handleBoundingRect(this.eventTarget); - var em = this.checkEvent(e); - this.trigger(this.events.Selected, em); - } - } - - mousewheel(e) { - const shouldZoom = this._zoomOnMouseWheel; - const wheelDelta = e.wheelDelta; - const originX = e.offsetX; - const originY = e.offsetY; - - if (wheelDelta === 0 || !shouldZoom) { - return; - } - - if (shouldZoom) { - eventTool.stop(e.event); - let scale = 1; - if (wheelDelta > 0) { - scale = 1; - } else if (wheelDelta < 0) { - scale = -1; - } - - this.trigger(this.events.__Zoom, {type: this.events.__Zoom, scale, originX, originY }); - } - } - - click(e) { - var em = this.checkEvent(e); - this.trigger(this.events.Selected, em); - } - - contextmenu(e) { - var em = this.checkEvent(e); - this.trigger(this.events.Contextmenu, em); - } - - moveEvent(e) { - const newEm = new EventModel(e); - const trainDetails = store.state.map.trainDetails; - if (trainDetails) { - if (newEm.deviceType != deviceType.Train || trainDetails.code != newEm.deviceCode) { - var instance = (this.$jmap.getDeviceByCode(trainDetails.code) || {} ).instance; - instance && instance.removeTrainDetail && instance.removeTrainDetail(); - } - } - } - - checkEvent(e) { - var oldEm = new EventModel(this.$zr.curEvent || { event: {} }); - var newEm = new EventModel(e); - if ([1, 3].includes(e.which)) { - // 查找之前和当前鼠标选中的实例 - var oldDevice = this.$jmap.getDeviceByCode(oldEm.deviceCode) || {}; - var newDevice = this.$jmap.getDeviceByCode(newEm.deviceCode) || {}; - var oldInstance = (this.$jmap.getDeviceByCode(oldEm.deviceCode) || {}).instance || {}; - var newInstance = (this.$jmap.getDeviceByCode(newEm.deviceCode) || {}).instance || {}; - - // 如果之前和当前选中的实例不一致 - if (oldInstance != newInstance) { - // 如果实例有取消选择函数并且被点击,则执行取消选中函数 - if (oldInstance.mouseEvent && oldInstance.mouseEvent.mouseout) { - // 视图数据设置点击标志,同步执行 - oldDevice['down'] = false; - oldInstance.mouseEvent['mouseout'](e); - } - - // 如果实例有选中函数并且被点击,则执行选中函数 - if (e.which == 3 && newInstance.mouseEvent && newInstance.mouseEvent.mouseover) { - newDevice['down'] = true; - newInstance.mouseEvent['mouseover'](e); - } - } - - // 保存当前实例到全局 - this.$zr.curEvent = e; - } - - return newEm; - } - - // 处理鼠标右键按下事件 - handleMouseDownRight(e) { - this.rightClickPoint.x = e.offsetX; - this.rightClickPoint.y = e.offsetY; - } - // 处理鼠标左键按下事件 - handleMouseDownLeft(e) { - const em = new EventModel(e); - this.eventTarget = em.eventTarget; - if (this.eventTarget && this.eventTarget._type === deviceType.CheckBox) { - this.handleBoundingRect(this.eventTarget); - } else { - this.$jmap.deleteCheckBox('check_box'); - this.eventTarget = ''; - this.deviceList = []; - } - } - // 通过包围盒筛选选中区域的元素 - handleBoundingRect(eventTarget) { - this.deviceList = []; - const boundingRect = this.createFakeBoundingRect(eventTarget); - const deviceList = Object.values(this.$jmap.mapDevice); - const includeDeviceList = []; - deviceList.forEach( item =>{ - if (item.instance && item.instance._type == deviceType.Section) { - let deviceBoundingRect = {}; - if (item.type == '03') { - deviceBoundingRect = { - x1: item.namePosition.x, - y1: item.namePosition.y, - x2: item.namePosition.x, - y2: item.namePosition.y - }; - } else { - deviceBoundingRect = { - x1: item.points[0].x, - y1: item.points[0].y, - x2: item.points[item.points.length - 1].x, - y2: item.points[item.points.length - 1].y - }; - } - if (this.whetherInclude(boundingRect, deviceBoundingRect )) { - includeDeviceList.push(item); - } - } - if (item.instance && item.instance._type == deviceType.Switch) { - const deviceBoundingRect = { - x1: item.intersection.x, - y1: item.intersection.y, - x2: item.intersection.x, - y2: item.intersection.y - }; - if (this.whetherInclude(boundingRect, deviceBoundingRect )) { - includeDeviceList.push(item); - } - } - }); - this.deviceList = includeDeviceList; - store.dispatch('map/setSeclectDeviceList', this.deviceList); - } - // 生成包围盒对象坐标 - createFakeBoundingRect(instance) { - return { - x1: instance.model.point.x, - y1: instance.model.point.y, - x2: instance.model.point.x + instance.model.width, - y2: instance.model.point.y + instance.model.height - }; - } - - // 判断元素包围盒是否在选中区域 - whetherInclude(boundingRect1, boundingRect2) { - return boundingRect1.x1 <= boundingRect2.x1 && boundingRect1.y1 <= boundingRect2.y1 && boundingRect1.x2 >= boundingRect2.x2 && boundingRect1.y2 >= boundingRect2.y2; - } - - // 右键拖动区域大小 - handleMouseMoveRight(point2) { - const point1 = this.rightClickPoint; - const x = Math.min(point1.x, point2.x) + this.$jmap.$options.offsetX; - const y = Math.min(point1.y, point2.y) + this.$jmap.$options.offsetY; - const width = Math.abs(point1.x - point2.x); - const height = Math.abs(point1.y - point2.y); - this.$jmap.renderCheckBox({code: 'check_box', _type: 'CheckBox', point: {x: x, y: y}, width: width, height: height }); - } -} - -export default MouseController; diff --git a/src/jmap/options.js b/src/jmap/options.js deleted file mode 100644 index 8cb57b92f..000000000 --- a/src/jmap/options.js +++ /dev/null @@ -1,100 +0,0 @@ -class Options { - constructor(opts, trigger) { - this.scaleIndex = 0; - this.scaleList = [ - 0.8, 0.9, - 1, 1.2, 1.4, 1.6, 1.8, - 2, 2.2, 2.4, 2.6, 2.8, - 3, 3.2, 3.4, 3.6, 3.8, - 4, 4.2, 4.4, 4.6, 4.8, - 5, 5.2, 5.4, 5.6, 5.8, - 6, 6.2, 6.4, 6.6, 6.8, - 7, 7.2, 7.4, 7.6, 7.8, - 8 - ]; - - if (Number.isFinite(opts.scaleRate)) { - const idx = this.scaleList.indexOf(opts.scaleRate); - if (idx >= 0) { - this.scaleIndex = idx; - } - } - - this.scaleRate = opts.scaleRate || this.scaleList[this.scaleIndex]; // 缩放比例 - - this.offsetX = opts.offsetX || 0; // x偏移 - - this.offsetY = opts.offsetY || 0; // y偏移 - - this.throttle = opts.throttle || 100; // 刷新频率 - - this.disabled = false; - - this.moveOnMouseMove = true; - - this.zoomOnMouseWheel = false; - - this.preventDefaultMouseMove = true; - - this.trigger = trigger; - } - - update(payload) { - if (Number.isFinite(payload.dx)) { - this.offsetX -= payload.dx; - } - if (Number.isFinite(payload.dy)) { - this.offsetY -= payload.dy; - } - - if (Number.isFinite(payload.offsetX)) { - this.offsetX = payload.offsetX; - } - if (Number.isFinite(payload.offsetY)) { - this.offsetY = payload.offsetY; - } - - if (Number.isFinite(payload.scale)) { - if (Number.isFinite(payload.scale)) { - if ((this.scaleIndex + payload.scale) >= 0 && (this.scaleIndex + payload.scale) < this.scaleList.length) { - this.scaleIndex = this.scaleIndex + payload.scale; - } - } - this.scaleRate = this.scaleList[this.scaleIndex]; - } - - if (Number.isFinite(payload.scaleRate)) { - const idx = this.scaleList.indexOf(payload.scaleRate); - if (idx < 0) { - return; - } - this.scaleIndex = idx; - this.scaleRate = payload.scaleRate; - } - - if (payload.disabled === true || payload.disabled === false) { - this.disabled = payload.disabled; - } - - if (payload.moveOnMouseMove === true || payload.moveOnMouseMove === false) { - this.moveOnMouseMove = payload.moveOnMouseMove; - } - - if (payload.zoomOnMouseWheel === true || payload.zoomOnMouseWheel === false) { - this.zoomOnMouseWheel = payload.zoomOnMouseWheel; - } - - if (this.trigger instanceof Function) { this.trigger(this); } - } - - getScaleRate(scale) { - if (Number.isFinite(scale)) { - if ((this.scaleIndex + scale) >= 0 && (this.scaleIndex + scale) < this.scaleList.length) { - return this.scaleList[this.scaleIndex + scale]; - } - } - return this.scaleList[this.scaleIndex]; - } -} - -export default Options; diff --git a/src/jmap/painter.js b/src/jmap/painter.js deleted file mode 100644 index f2a5cdc82..000000000 --- a/src/jmap/painter.js +++ /dev/null @@ -1,271 +0,0 @@ -import * as zrUtil from 'zrender/src/core/util'; -import * as vector from 'zrender/src/core/vector'; -import Group from 'zrender/src/container/Group'; -import deviceType from './constant/deviceType'; -import shapefactory from './shape/factory'; -import TransformHandle from './transformHandle'; - -class Painter { - constructor(jmap) { - // 父级实例 - this.$jmap = jmap; - this.$zr = jmap.getZr(); - - // 图层数据 - this.mapInstanceLevel = {}; - - // 初始图层 - this.initLevels(); - - // 视图控制器 - this.$transformHandle = new TransformHandle(this); - } - - /** - * 初始绘图实例 - * @param {*} dom - * @param {*} config - */ - initLevels() { - // 图层分级策略 - this.layerBranch = {}; - this.layerBranch['01'] = (type) => { return type == deviceType.Link; }; // 逻辑图层级 - this.layerBranch['02'] = (type) => { return type != deviceType.Link; }; // 物理图层级 - this.layerBranch['03'] = (type) => { return true; }; // 混合图层级 - - // 添加父级图层 - this.parentLevel = new Group({ name: '__parent__' }); - this.$zr.add(this.parentLevel); - - // 添加子级图层 - zrUtil.each(Object.values(deviceType), (type) => { - const level = new Group({ name: `__${type}__` }); - this.mapInstanceLevel[type] = level; - this.parentLevel.add(level); - }); - - // 设置默认显示图级 - this.setLayerVisible('02'); - } - - /** - * 重绘视图 - * @param {*} mapDevice - */ - repaint(mapDevice) { - // 清空视图 - this.clear(); - - // 创建视图 - Object.values(mapDevice).forEach(device => { - this.add(device); - }); - } - - /** - * 添加视图 - * @param {*} device - */ - add(device) { - try { - const instance = shapefactory(device, this.$jmap); - if (instance) { - device.instance = instance; - this.$transformHandle.transformView(instance); - this.mapInstanceLevel[device._type].add(instance); - } - } catch (err) { - console.error(err); - } - } - - /** - * 删除视图 - * @param {*} device - */ - delete(device) { - const instance = device.instance; - if (instance) { - this.mapInstanceLevel[device._type].remove(instance); - } - } - - checkIntersect(device) { - var intersect = false; - var befor = device.instance; - var train = shapefactory(device, this.$jmap); - - this.mapInstanceLevel[deviceType.Train].eachChild(elem => { - if (elem !== befor && elem.getBoundingRect().intersect(train.getBoundingRect())) { - intersect = true; - return; - } - }); - - return intersect; - } - - /** - * 更新列车 - * @param {*} device - */ - updateTrain(device) { - var oldTrainWindowModel = null; - var instance = device.instance; - var curModel = device; - - if (instance) { - oldTrainWindowModel = device.trainWindowModel; - } - - if (curModel.sectionCode) { - curModel.sectionModel = this.$jmap.getDeviceByCode(curModel.sectionCode); - } - - if (curModel.trainWindowCode) { - curModel.trainWindowModel = this.$jmap.getDeviceByCode(curModel.trainWindowCode); - } - - if (instance && oldTrainWindowModel && this.checkIntersect(device)) { - device.trainWindowModel = oldTrainWindowModel; - } - - instance && this.mapInstanceLevel[deviceType.Train].remove(instance); - this.add(device); - } - - /** - * 更新视图 - * @param {*} device - */ - update(device) { - if (device) { - try { - if (device._dispose) { - this.delete(device); - } else if (deviceType.Train == device._type) { - this.updateTrain(device); - } else { - const instance = device.instance; - if (instance) { - instance.setState(device); - } - } - } catch (err) { - console.error(err); - } - } - } - - /** - * 更新transform变化 - * @param {*} opt - */ - updateTransform(opt) { - this.$transformHandle.updateTransform(opt); - } - - /** - * 更新zrender尺寸 - * @param {*} opt - */ - updateZrSize(opt) { - this.$transformHandle.updateZrSize(opt); - } - - /** - * 过去坐标提示位置 - * @param {*} opts - */ - getShapeTipPoint(instance, opts) { - if (instance) { - var point = instance.getShapeTipPoint(opts); - if (point) { - // 矩阵变换 - var transform = this.$transformHandle.transform; - var transPoint = vector.applyTransform([], [point.x, point.y], transform); - return { - x: transPoint[0], - y: transPoint[1] - }; - } - - } - } - - /** - * 设置逻辑和物理图层 - * @param {*} layer - */ - setLayerVisible(layer) { - zrUtil.each(Object.values(deviceType), type => { - const level = this.mapInstanceLevel[type]; - if (this.layerBranch[layer](type)) { - level.show(); - } else { - level.hide(); - } - }, this); - } - - /** - * 设置图层可见 - * @param {*} code - */ - setLevelVisible(list) { - zrUtil.each(Object.values(deviceType), type => { - const level = this.mapInstanceLevel[type]; - if (list.includes(type)) { - level.show(); - } else { - level.hide(); - } - }, this); - } - - /** - * 刷新图层 - */ - refresh() { - this.$zr.refresh(); - } - - /** - * 清除图层 - */ - clearLevel(type) { - const level = this.mapInstanceLevel[type]; - if (level) { - level.removeAll(); - } - } - - /** - * 清除canvas - */ - clear() { - zrUtil.each(Object.values(this.mapInstanceLevel), (level) => { - level && level.removeAll(); - }, this); - - this.refresh(); - } - - /** - * 销毁图层 - */ - dispose() { - this.mapInstanceLevel = {}; - this.parentLevel = null; - } - - /** - * 父级图层 - */ - getParentLevel() { - return this.parentLevel; - } - -} - -export default Painter; diff --git a/src/jmap/shape/ButtonControl/index.js b/src/jmap/shape/ButtonControl/index.js deleted file mode 100644 index 29e2887d4..000000000 --- a/src/jmap/shape/ButtonControl/index.js +++ /dev/null @@ -1,67 +0,0 @@ -/* -* lC区域控制模式 -*/ -import Group from 'zrender/src/container/Group'; -import EControl from '../element/EControl'; - -export default class ButtonControl extends Group { - constructor(model, style) { - super(); - this.z = 20; - this._code = model.code; - this._type = model._type; - this.zlevel = 10; - this.model = model; - this.style = style; - this.create(); - this.setState(model); - } - - create() { - const model = this.model; - this.control = new EControl({ - zlevel: this.zlevel, - z: this.z, - arc: { - shape: { - cx: model.position.x, - cy: model.position.y, - r: this.style.ButtonControl.lamp.radiusR - }, - lineWidth: 0, - fill: this.style.ButtonControl.lamp.controlColor - }, - text: { - position: [0, 0], - x: model.position.x, - y: model.position.y + this.style.ButtonControl.lamp.radiusR + this.style.ButtonControl.text.distance, - fontWeight: this.style.ButtonControl.text.fontWeight, - fontSize: this.style.ButtonControl.text.fontSize, - fontFamily: this.style.fontFamily, - text: model.text || '按图折返', - textFill: '#fff', - textAlign: 'middle', - textVerticalAlign: 'top' - }, - style: this.style - }); - - this.add(this.control); - } - - // 设置状态 - setState(model) { - } - - getShapeTipPoint() { - if (this.control) { - var distance = 2; - var rect = this.control.getBoundingRect(); - return { - x: rect.x + rect.width / 2, - y: rect.y - distance - }; - } - return null; - } -} diff --git a/src/jmap/shape/ImageControl/index.js b/src/jmap/shape/ImageControl/index.js deleted file mode 100644 index c00ba0664..000000000 --- a/src/jmap/shape/ImageControl/index.js +++ /dev/null @@ -1,69 +0,0 @@ -/* -* 图片list -*/ -import Group from 'zrender/src/container/Group'; -import Image from 'zrender/src/graphic/Image'; - -export default class ImageControl extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.model = model; - this.style = style; - this.z = model.zIndex || 1; - this.create(); - } - - create() { - const model = this.model; - this.image = new Image({ - zlevel: this.zlevel, - z: this.z, - origin: { - x: model.position.x, - y: model.position.y - }, - rotation: -Math.PI / 180 * model.rotate, - style: { - image: model.url, - x: model.position.x, - y: model.position.y, - width: model.width, - height: model.height - } - }); - this.add(this.image); - // 旋转 - if (model.rotate) { - this.transformRotation(this.image); - } - } - - setState(model) { - } - - // 整体图片 - transformRotation(item) { - if (this.model.rotate) { - const origin = [this.model.position.x, this.model.position.y]; - const rotation = -Math.PI / 180 * Number(this.model.rotate); - item.origin = origin; - item.rotation = rotation; - item.dirty(); - } - } - - getShapeTipPoint() { - if (this.image) { - var distance = 2; - var rect = this.image.getBoundingRect(); - return { - x: rect.x + rect.width / 2, - y: rect.y - distance - }; - } - return null; - } -} diff --git a/src/jmap/shape/LcControl/EMouse.js b/src/jmap/shape/LcControl/EMouse.js deleted file mode 100644 index fdb639e95..000000000 --- a/src/jmap/shape/LcControl/EMouse.js +++ /dev/null @@ -1,53 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -export default class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.create(); - } - create() { - this.text = new Text({ - zlevel: this.device.zlevel, - z: this.device.z+1, - position: [0, 0], - style: { - x: this.device.model.position.x, - y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance-30, - fontWeight: 'normal', - fontSize: this.device.style.LcControl.mouseOverStyle.fontSize, - fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily, - text: this.device.model.name, - textFill: this.device.style.LcControl.mouseOverStyle.fontColor, - textAlign: this.device.style.LcControl.mouseOverStyle.textAlign, - textVerticalAlign: this.device.style.LcControl.mouseOverStyle.textVerticalAlign - } - }); - this.add(this.text); - this.text.hide(); - } - mouseover(e) { - if (e.target && e.target._subType == 'Text') { - this.text.show(); - } else { - this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); - this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor); - this.device.control.setTextBorder(true); - this.device.control.setArcBorder(true); - } - } - - mouseout(e) { - if (!this.device.model.down) { - if (e.target && e.target._subType == 'Text') { - this.text.hide(); - } else { - this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); - this.device.control.setTextColor('#FFFFFF'); - this.device.control.setTextBorder(false); - this.device.control.setArcBorder(false); - } - } - } -} diff --git a/src/jmap/shape/LcControl/index.js b/src/jmap/shape/LcControl/index.js deleted file mode 100644 index 985bea40d..000000000 --- a/src/jmap/shape/LcControl/index.js +++ /dev/null @@ -1,78 +0,0 @@ -/* -* lC区域控制模式 -*/ -import Group from 'zrender/src/container/Group'; -import EControl from '../element/EControl'; -import EMouse from './EMouse'; - -export default class LcControl extends Group { - constructor(model, style) { - super(); - this.z = 20; - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.model = model; - this.style = style; - this.create(); - this.createMouseEvent(); - this.setState(model); - } - - create() { - const model = this.model; - this.control = new EControl({ - zlevel: this.zlevel, - z: this.z, - arc: { - shape: { - cx: model.position.x, - cy: model.position.y, - r: this.style.LcControl.lamp.radiusR - }, - lineWidth: 0, - fill: this.style.LcControl.lamp.controlColor - }, - text: { - position: [0, 0], - x: model.position.x, - y: model.position.y + this.style.LcControl.lamp.radiusR + this.style.LcControl.text.distance, - fontWeight: this.style.LcControl.text.fontWeight, - fontSize: this.style.LcControl.text.fontSize, - fontFamily: this.style.fontFamily, - text: model.name, - textFill: '#fff', - textAlign: 'middle', - textVerticalAlign: 'top' - }, - style: this.style - }); - - this.add(this.control); - } - - // 设置状态 - setState(model) { - } - - createMouseEvent() { - if (this.style.LcControl.mouseOverStyle) { - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - } - - getShapeTipPoint() { - if (this.control) { - var distance = 2; - var rect = this.control.getBoundingRect(); - return { - x: rect.x + rect.width / 2, - y: rect.y - distance - }; - } - return null; - } -} diff --git a/src/jmap/shape/LimitControl/EMouse.js b/src/jmap/shape/LimitControl/EMouse.js deleted file mode 100644 index 4abd12d5d..000000000 --- a/src/jmap/shape/LimitControl/EMouse.js +++ /dev/null @@ -1,54 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -export default class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.create(); - } - create() { - this.text = new Text({ - _subType: 'Text', - zlevel: this.device.zlevel, - z: this.device.z+1, - position: [0, 0], - style: { - x: this.device.model.position.x, - y: this.device.model.position.y + this.device.style.LimitControl.lamp.radiusR + this.device.style.LimitControl.text.distance-30, - fontWeight: this.device.style.LimitControl.mouseOverStyle.fontWeight, - fontSize: this.device.style.LimitControl.mouseOverStyle.fontSize, - fontFamily: this.device.style.LimitControl.mouseOverStyle.fontFormat, - text: this.device.model.name, - textFill: this.device.style.LimitControl.mouseOverStyle.fontColor, - textAlign: this.device.style.LimitControl.mouseOverStyle.textAlign, - textVerticalAlign: this.device.style.LimitControl.mouseOverStyle.textVerticalAlign - } - }); - this.add(this.text); - this.text.hide(); - } - mouseover(e) { - if (e.target && e.target._subType == 'Text') { - this.text.show(); - } else { - this.device.control.setControlColor(this.device.style.LimitControl.mouseOverStyle.arcColor); - this.device.control.setTextColor(this.device.style.LimitControl.mouseOverStyle.textColor); - this.device.control.setTextBorder(true); - this.device.control.setArcBorder(true); - } - } - - mouseout(e) { - if (!this.device.model.down) { - if (e.target && e.target._subType == 'Text') { - this.text.hide(); - } else { - this.device.control.setControlColor(this.device.style.LimitControl.lamp.controlColor); - this.device.control.setTextColor('#FFFFFF'); - this.device.control.setTextBorder(false); - this.device.control.setArcBorder(false); - } - } - } -} diff --git a/src/jmap/shape/LimitControl/index.js b/src/jmap/shape/LimitControl/index.js deleted file mode 100644 index cc2bf0d94..000000000 --- a/src/jmap/shape/LimitControl/index.js +++ /dev/null @@ -1,82 +0,0 @@ -/* -* 权限临时限速 -*/ -import Group from 'zrender/src/container/Group'; -import EControl from '../element/EControl'; -import EMouse from './EMouse'; - -export default class LimitControl extends Group { - constructor(model, style) { - super(); - this.selected = false; - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.model = model; - this.style = style; - this.z = 20; - this.create(model); - this.createMouseEvent(); - this.setState(model); - } - - create(model) { - this.control = new EControl({ - zlevel: this.zlevel, - z: this.z, - arc: { - shape: { - cx: model.position.x, - cy: model.position.y, - r: this.style.LimitControl.lamp.radiusR - }, - lineWidth: 0, - fill: this.style.LimitControl.lamp.controlColor, - mouseover: this.mouseoverArc, - mouseout: this.mouseoutArc - }, - text: { - position: [0, 0], - x: model.position.x, - y: model.position.y + this.style.LimitControl.lamp.radiusR + this.style.LimitControl.text.distance, - fontWeight: this.style.LimitControl.text.fontWeight, - fontSize: this.style.LimitControl.text.fontSize, - fontFamily: this.style.fontFamily, - text: model.name, - textFill: '#fff', - textAlign: 'middle', - textVerticalAlign: 'top', - mouseover: this.mouseoverText, - mouseout: this.mouseoutText - }, - style: this.style - }); - - this.add(this.control); - } - - // 设置状态 - setState(model) { - } - - createMouseEvent() { - if (this.style.LimitControl.mouseOverStyle) { - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - } - - getShapeTipPoint() { - if (this.control) { - var distance = 2; - var rect = this.control.getBoundingRect(); - return { - x: rect.x + rect.width / 2, - y: rect.y - distance - }; - } - return null; - } -} diff --git a/src/jmap/shape/Line/index.js b/src/jmap/shape/Line/index.js deleted file mode 100644 index 05be49bec..000000000 --- a/src/jmap/shape/Line/index.js +++ /dev/null @@ -1,54 +0,0 @@ -import Line from 'zrender/src/graphic/shape/Line'; -import Group from 'zrender/src/container/Group'; - -export default class Line2 extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.z = 0; - this.model = model; - this.style = style; - this.create(); - this.setState(model); - } - - create() { - const model = this.model; - const style = this.style; - if (model && model.points.length > 1) { - for (let i = 0; i < (model.points.length - 1); i++) { - this.add(new Line({ - zlevel: model.zlevel, - z: model.isLogic ? this.z : this.z + 1, - shape: { - x1: model.points[i].x, - y1: model.points[i].y, - x2: model.points[i + 1].x, - y2: model.points[i + 1].y - }, - style: { - lineWidth: model.width, - stroke: style.Line.lineColor - } - })); - } - } - } - - setLineType(type) { - switch (type) { - case '01': break; - case '02': - this.eachChild((child) => { - child.setStyle('lineDash', [4]); - }); - break; - } - } - - setState(model) { - this.setLineType(model.type); - } -} diff --git a/src/jmap/shape/Link/EMouse.js b/src/jmap/shape/Link/EMouse.js deleted file mode 100644 index 7b35db79e..000000000 --- a/src/jmap/shape/Link/EMouse.js +++ /dev/null @@ -1,39 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Rect from 'zrender/src/graphic/shape/Rect'; -// import Vue from 'vue'; -// import store from '@/store'; - -class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.create(); - } - create() { - if (this.device.link) { - const rect = this.device.link.getBoundingRect(); - this.lineBorder = new Rect({ - zlevel: this.device.zlevel, - z: this.device.z - 1, - shape: rect, - style: { - lineDash: [3, 3], - stroke: '#fff', - fill: this.device.style.transparentColor - } - }); - - this.add(this.lineBorder); - this.lineBorder.hide(); - } - } - - mouseover(e) { - this.lineBorder && this.lineBorder.show(); - } - - mouseout(e) { - this.lineBorder && this.lineBorder.hide(); - } -} -export default EMouse; diff --git a/src/jmap/shape/Link/index.js b/src/jmap/shape/Link/index.js deleted file mode 100644 index 08079f026..000000000 --- a/src/jmap/shape/Link/index.js +++ /dev/null @@ -1,68 +0,0 @@ -import Line from 'zrender/src/graphic/shape/Line'; -import Group from 'zrender/src/container/Group'; -import EMouse from './EMouse'; - -class Link extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.model = model; - this.style = style; - this.create(); - } - - create() { - const model = this.model; - const style = this.style; - - let textPosition = 'insideBottom'; - if (model.lp.x !== model.rp.x && model.lp.y !== model.rp.y) { - textPosition = model.lp.y > model.rp.y ? 'insideLeft' : 'insideRight'; - } - // 标准link - this.link = new Line({ - zlevel: this.zlevel, - z: 0, - shape: { - x1: model.lp.x, - y1: model.lp.y, - x2: model.rp.x, - y2: model.rp.y - }, - style: { - lineWidth: style.Link.linkWidth, - stroke: style.Link.linkColor, - text: model.name, - textDistance: style.Link.linkWidth * 2, - textPosition: textPosition, // 'inside', - textAlign: 'middle', - fontSize: style.Link.textFontSize, - textFill: style.Link.linkTextColor, - textStroke: style.Link.backgroundColor - } - }); - this.add(this.link); - const path = window.location.href; - if (path.includes('/map/draw')) { - // 鼠标事件 - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - } - - setState(model) { - } - - tipBasePoint() { - } - - getBoundingRect() { - return this.link.getBoundingRect(); - } -} - -export default Link; diff --git a/src/jmap/shape/Section/EAxle.js b/src/jmap/shape/Section/EAxle.js deleted file mode 100644 index 17e404671..000000000 --- a/src/jmap/shape/Section/EAxle.js +++ /dev/null @@ -1,85 +0,0 @@ -// import Group from 'zrender/src/container/Group'; -// import Line from 'zrender/src/graphic/shape/Line'; -// import Circle from 'zrender/src/graphic/shape/Circle'; -import Path from 'zrender/src/graphic/Path'; - -// 计轴 -export const EAxle = Path.extend({ - type: 'EAxle', - shape: { - point: null - }, - buildPath: function (ctx, model) { - if (model && model.style && model.traingle) { - const axleLength = 2 * model.style.Section.axle.radius; - const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength)); - const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength)); - // 圆弧 - const arcX = positionx - model.dricty * model.traingle.getSin(axleLength); - const arcY = positiony + model.drictx * model.traingle.getSin(axleLength); - const arcR = model.style.Section.axle.radius; - ctx.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false); - ctx.closePath(); - - const x1 = positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength); - const y1 = positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength); - const x2 = positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength); - const y2 = positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength); - ctx.moveTo(x1, y1); - ctx.lineTo(x2, y2); - ctx.closePath(); - } - } -}); - -// export default class EAxle extends Group { -// constructor(model) { -// super(); -// this.model = model; -// this.zlevel = model.zlevel; -// this.z = 5; -// this.create(model); -// } - -// create(model) { -// if (model && model.style && model.traingle) { -// const axleLength = 2 * model.style.Section.axle.radius; -// const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength)); -// const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength)); - -// this.line = new Line({ -// zlevel: this.zlevel, -// z: this.z, -// progressive: model.progressive, -// shape: { -// x1: positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), -// y1: positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength), -// x2: positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), -// y2: positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength) -// }, -// style: { -// GBaseLineWidth: 1, -// stroke: model.style.Section.axle.color -// } -// }); -// this.axle = new Circle({ -// zlevel: this.zlevel, -// z: this.z, -// progressive: model.progressive, -// shape: { -// cx: positionx - model.dricty * model.traingle.getSin(axleLength), -// cy: positiony + model.drictx * model.traingle.getSin(axleLength), -// r: model.style.Section.axle.radius -// }, -// style: { -// GBaseLineWidth: 1, -// stroke: model.style.Section.axle.color, -// fill: model.style.transparentColor -// } -// }); - -// this.add(this.line); -// this.add(this.axle); -// } -// } -// } diff --git a/src/jmap/shape/Section/EBackArrow.js b/src/jmap/shape/Section/EBackArrow.js deleted file mode 100644 index 5c3506271..000000000 --- a/src/jmap/shape/Section/EBackArrow.js +++ /dev/null @@ -1,42 +0,0 @@ -import Path from 'zrender/src/graphic/Path'; - -// 成都三号线 折返进路 -export const EBackArrow = Path.extend({ - type: 'EBackArrow', - shape: { - points: null - }, - buildPath: function (ctx, shape) { - const points = shape.points; - var r = shape.height; - var x = points.x + shape.drict * shape.width / 2; - var y = points.y; - ctx.moveTo(points.x - shape.drict * shape.width, points.y + shape.height); - ctx.lineTo(points.x + shape.drict * shape.width / 2, points.y + shape.height); - if (shape.drict) { - ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, true); - } else { - ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false); - } - ctx.moveTo(points.x + shape.drict * shape.width / 2, points.y - shape.height); - ctx.lineTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height); - } -}); - -// 箭头 -export const EBackArrowTriangle = Path.extend({ - type: 'EBackArrowTriangle', - shape: { - points: null - }, - buildPath: function (ctx, shape) { - const points = shape.points; - ctx.moveTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height - 3); - if (shape.drict) { - ctx.lineTo(points.x - shape.drict * shape.width, points.y - shape.height); - } else { - ctx.lineTo(points.x - shape.drict * shape.width, points.y - shape.height); - } - ctx.lineTo(points.x - shape.drict * (shape.width - 5), points.y - shape.height + 3); - } -}); diff --git a/src/jmap/shape/Section/ELimitLines.js b/src/jmap/shape/Section/ELimitLines.js deleted file mode 100644 index 6056db14d..000000000 --- a/src/jmap/shape/Section/ELimitLines.js +++ /dev/null @@ -1,218 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import BezierCurve from 'zrender/src/graphic/shape/BezierCurve'; -import Line from 'zrender/src/graphic/shape/Line'; -import JTriangle from '../../utils/JTriangle'; -// import Path from 'zrender/src/graphic/Path'; - -// 创建区段限速限集合 -// export const ELimitLines = Path.extend({ -// type: 'ELimitLines', -// shape: { -// points: null -// }, -// buildPath: function (ctx, model) { -// /** 创建区段*/ -// if (model && model.points.length > 1) { -// if (model.isCurve) { -// ctx.beginPath(); -// const shape = {}; -// for (let i = 1; i < (model.points.length - 1); i++) { -// shape[`cpx${i}`] = model.points[i].x; -// shape[`cpy${i}`] = model.points[i].y; -// } -// shape[`x1`] = model.points[0].x; -// shape[`y1`] = model.points[0].y; -// shape[`x2`] = model.points[model.points.length - 1].x; -// shape[`y2`] = model.points[model.points.length - 1].y; - -// ctx.moveTo(shape[`x1`], shape[`y1`]); -// if (model.points.length <= 3) { -// ctx.quadraticCurveTo(shape[`cpx1`], shape[`cpy1`], shape[`x2`], shape[`y2`]); -// } else { -// ctx.bezierCurveTo(shape[`cpx1`], shape[`cpy1`], shape[`cpx2`], shape[`cpy2`], shape[`x2`], shape[`y2`]); -// } -// } else { -// const swPadding = model.style.Switch.core.length; // 定位和反位时区段距离岔芯的距离 -// var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度 -// const beg = Object.assign({}, model.points[0]); -// const end = Object.assign({}, model.points[model.points.length - 1]); -// if (model.isSwitchSection && beg.y !== end.y) { -// const swch = model.switch; -// if (swch) { -// const traingle = new JTriangle(swch.intersection, swch.skew); -// if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y)) { -// 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)) { -// end.x = end.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); -// end.y = end.y + traingle.dricty * (swPadding + switchWidth); -// } -// } -// } - -// if (model.points.length == 2) { -// ctx.moveTo(beg.x, beg.y); -// ctx.lineTo(end.x, end.y); -// ctx.closePath(); -// } else { -// ctx.moveTo(beg.x, beg.y); -// ctx.lineTo(model.points[1].x, model.points[1].y); -// ctx.closePath(); - -// for (let i = 1; i < (model.points.length - 2); i++) { -// ctx.moveTo(model.points[i].x, model.points[i].y); -// ctx.lineTo(model.points[i + 1].x, model.points[i + 1].y); -// ctx.closePath(); -// } -// ctx.moveTo(model.points[model.points.length - 2].x, model.points[model.points.length - 2].y); -// ctx.lineTo(end.x, end.y); -// ctx.closePath(); -// } -// } -// } -// } -// }); - -export default class ELimitLines extends Group { - constructor(model) { - super(); - this.model = model; - this.zlevel = model.zlevel; - this.z = model.z; - this.create(model); - } - - create(model) { - /** 创建区段*/ - if (model && model.points.length > 1) { - if (model.isCurve) { - const shape = {}; - for (let i = 1; i < (model.points.length - 1); i++) { - shape[`cpx${i}`] = model.points[i].x; - shape[`cpy${i}`] = model.points[i].y; - } - - shape[`x1`] = model.points[0].x; - shape[`y1`] = model.points[0].y; - shape[`x2`] = model.points[model.points.length - 1].x; - shape[`y2`] = model.points[model.points.length - 1].y; - - this.add(new BezierCurve({ - isLine: true, - zlevel: this.zlevel, - progressive: model.progressive, - z: this.z, - culling: true, - shape: shape, - position: model.position, - style: { - lineWidth: model.style.Section.speedLimit.width, - stroke: model.style.Section.speedLimit.lineColor, - fillOpacity: 0 - } - })); - } else { - // const beg = Object.assign({}, model.points[0]); - // const end = Object.assign({}, model.points[model.points.length - 1]); - - const swPadding = model.style.Switch.core.length; // 定位和反位时区段距离岔芯的距离 - var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度 - const beg = Object.assign({}, model.points[0]); - const end = Object.assign({}, model.points[model.points.length - 1]); - if (model.isSwitchSection && beg.y !== end.y) { - const swch = model.switch; - if (swch) { - const traingle = new JTriangle(swch.intersection, swch.skew); - if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y)) { - 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)) { - end.x = end.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); - end.y = end.y + traingle.dricty * (swPadding + switchWidth); - } - } - } - - if (model.points.length == 2) { - this.add(new Line({ - isLine: true, - zlevel: this.zlevel, - progressive: model.progressive, - z: this.z, - position: model.position, - shape: { - x1: beg.x, - y1: beg.y, - x2: end.x, - y2: end.y - }, - style: { - lineWidth: model.style.Section.speedLimit.width, - stroke: model.style.Section.speedLimit.lineColor - } - })); - } else { - this.add(new Line({ - isLine: true, - zlevel: this.zlevel, - progressive: model.progressive, - z: this.z, - position: model.position, - shape: { - x1: beg.x, - y1: beg.y, - x2: model.points[1].x, - y2: model.points[1].y - }, - style: { - lineWidth: model.style.Section.speedLimit.width, - stroke: model.style.Section.speedLimit.lineColor - } - })); - - for (let i = 1; i < (model.points.length - 2); i++) { - this.add(new Line({ - isLine: true, - zlevel: this.zlevel, - z: this.z, - progressive: model.progressive, - position: model.position, - shape: { - x1: model.points[i].x, - y1: model.points[i].y, - x2: model.points[i + 1].x, - y2: model.points[i + 1].y - }, - style: { - lineWidth: model.style.Section.speedLimit.width, - stroke: model.style.Section.speedLimit.lineColor - } - })); - } - - this.add(new Line({ - isLine: true, - zlevel: this.zlevel, - z: this.z, - position: model.position, - progressive: model.progressive, - shape: { - x1: model.points[model.points.length - 2].x, - y1: model.points[model.points.length - 2].y, - x2: end.x, - y2: end.y - }, - style: { - lineWidth: model.style.Section.speedLimit.width, - stroke: model.style.Section.speedLimit.lineColor - } - })); - } - } - } - } -} diff --git a/src/jmap/shape/Section/ELimitName.js b/src/jmap/shape/Section/ELimitName.js deleted file mode 100644 index dbdcf0494..000000000 --- a/src/jmap/shape/Section/ELimitName.js +++ /dev/null @@ -1,91 +0,0 @@ -// import Path from 'zrender/src/graphic/Path'; - -// 成都三号线 临时限速名称显示 -// export const ELimitName = Path.extend({ -// type: 'ELimitName', -// shape: { -// points: null -// }, -// buildPath: function (ctx, shape) { -// const points = shape.points; -// const y = points.y - 15; -// ctx.moveTo(points.x, y); -// ctx.lineTo(points.x - shape.drict * shape.style.Section.speedLimit.drogueWidth, y); -// ctx.lineTo(points.x - shape.drict * (shape.style.Section.speedLimit.drogueWidth + 5), y - 5); -// ctx.lineTo(points.x - shape.drict * shape.style.Section.speedLimit.drogueWidth, y - 10); -// ctx.lineTo(points.x, y - 10); -// ctx.lineTo(points.x, y); -// } -// }); - -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; -import Polygon from 'zrender/src/graphic/shape/Polygon'; - -export default class ELimitName extends Group { - constructor(model) { - super(); - this.model = model; - this.zlevel = model.zlevel; - this.z = model.z; - this.create(model); - } - - create(model) { - const rectW = model.style.Section.speedLimit.drogueWidth; - const rectH = model.style.Section.speedLimit.drogueHeight; - this.add(new Polygon({ - zlevel: this.zlevel, - z: this.z + 9, - shape: { - points: [ - [model.x, model.y], - [model.x - model.drict * rectW, model.y], - [model.x - model.drict * (rectW + rectH / 2), model.y - rectH / 2], - [model.x - model.drict * rectW, model.y - rectH], - [model.x, model.y - rectH] - ] - }, - style: { - lineWidth: 0, - fill: model.style.Section.speedLimit.nameBackground - } - })); - - // 公里标内容 - this.add(new Text({ - zlevel: this.zlevel, - z: this.z + 10, - style: { - x: model.x - model.drict * 2, - y: model.y, - fontWeight: 'normal', - fontSize: model.style.Section.speedLimit.nameNumberFontSize, - fontFamily: model.style.fontFamily, - text: '15', - textFill: model.style.Section.speedLimit.nameNumberColor, - textAlign: model.drict == -1 ? 'left' : 'right', - textPosition: model.style.Section.text.textPosition || 'inside', - textVerticalAlign: 'bottom' - } - })); - - // 公里值 - this.add(new Text({ - zlevel: this.zlevel, - z: this.z + 10, - style: { - x: model.x, - y: model.y + 12, - fontWeight: 'normal', - fontSize: model.style.Section.speedLimit.kilometerFontSize, - fontFamily: model.style.fontFamily, - text: '17.981km', - textFill: model.style.Section.speedLimit.kilometerColor, - textAlign: model.drict == -1 ? 'left' : 'right', - textPosition: model.style.Section.text.textPosition || 'inside', - textVerticalAlign: 'bottom' - } - })); - } -} diff --git a/src/jmap/shape/Section/ELines.js b/src/jmap/shape/Section/ELines.js deleted file mode 100644 index 8d4b80c8b..000000000 --- a/src/jmap/shape/Section/ELines.js +++ /dev/null @@ -1,102 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Line from 'zrender/src/graphic/shape/Line'; -import BezierCurve from 'zrender/src/graphic/shape/BezierCurve'; - -/** 创建区段线集合*/ -export default class ELines extends Group { - constructor(model) { - super(); - this.model = model; - this.zlevel = model.zlevel; - this.z = model.z; - this.create(model); - } - - create(model) { - /** 创建区段*/ - if (model && model.points.length > 1) { - if (model.isCurve) { - const shape = {}; - for (let i = 1; i < (model.points.length - 1); i++) { - shape[`cpx${i}`] = model.points[i].x; - shape[`cpy${i}`] = model.points[i].y; - } - - shape[`x1`] = model.points[0].x; - shape[`y1`] = model.points[0].y; - shape[`x2`] = model.points[model.points.length - 1].x; - shape[`y2`] = model.points[model.points.length - 1].y; - - this.add(new BezierCurve({ - isLine: true, - zlevel: this.zlevel, - progressive: model.progressive, - z: this.z + 1, - culling: true, - shape: shape, - style: { - lineWidth: model.style.Section.line.width, - stroke: model.style.Section.line.spareColor, - fillOpacity: 0 - } - })); - } else { - for (let i = 0; i < (model.points.length - 1); i++) { - this.add(new Line({ - isLine: true, - zlevel: this.zlevel, - progressive: model.progressive, - z: this.z, - shape: { - x1: model.points[i].x, - y1: model.points[i].y, - x2: model.points[i + 1].x, - y2: model.points[i + 1].y - }, - style: { - lineWidth: model.style.Section.line.width, - stroke: model.style.Section.line.spareColor - } - })); - } - } - } - } - - setStyle(styles) { - this.eachChild((child) => { - if (child.setStyle && child.isLine) { - child.setStyle(styles); - } - }); - } - - animateStyle(loop, animates) { - if (animates && animates.length) { - this.eachChild((child) => { - if (child.animateStyle && child.isLine) { - let an = child.animateStyle(loop); - animates.forEach(elem => { - an = an.when(elem.time, elem.styles); - }); - an.start(); - } - }); - } - } - - stopAnimation(flag) { - this.eachChild((child) => { - if (child.stopAnimation && child.isLine) { - child.stopAnimation(flag); - } - }); - } - - setBorderVisible(isVisible) { - this.lineBorder && this.lineBorder.hide(); - if (isVisible) { - this.lineBorder && this.lineBorder.show(); - } - } -} diff --git a/src/jmap/shape/Section/EMouse.js b/src/jmap/shape/Section/EMouse.js deleted file mode 100644 index 17a26e812..000000000 --- a/src/jmap/shape/Section/EMouse.js +++ /dev/null @@ -1,152 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; -import Rect from 'zrender/src/graphic/shape/Rect'; -// import Vue from 'vue'; -import store from '@/store/index_APP_TARGET'; -class EMouse extends Group { - constructor(device, code) { - super(); - this.device = device; - this.code = code; - this.create(); - } - create() { - if (this.device.name) { - const rect = this.device.name.getBoundingRect(); - if (!this.device.isSwitchSection) { - this.sectionTextBorder = new Rect({ - zlevel: this.device.zlevel, - z: this.device.z + 4, - shape: rect, - style: { - lineDash: [3, 3], - stroke: '#fff', // 白色 - fill: this.device.model.sectionType == '02' ? this.device.style.Section.line.logicalColor : '#00FFFF' // 蓝色 - } - }); - this.add(this.sectionTextBorder); - this.sectionTextBorder.hide(); - } - - const fontSize = this.device.model.type == '02' ? this.device.style.Section.text.fontSize + 2 : this.device.style.Section.text.fontSize; - this.TextName = new Text({ - zlevel: this.device.zlevel, - z: this.device.z + 4, - style: { - x: rect.x + (rect.width / 2), - y: rect.y + (rect.height / 2), - fontWeight: 'normal', - fontSize: fontSize, - fontFamily: this.device.style.fontFamily, - text: this.device.model.name, - textFill: '#000', - textAlign: this.device.style.Section.text.textAlign, - textPosition: this.device.style.Section.text.textPosition || 'inside', - textVerticalAlign: this.device.style.Section.text.textVerticalAlign || null - } - }); - this.add(this.TextName); - this.TextName.hide(); - - this.sectionTextShadow = new Text({ - zlevel: this.zlevel + 3, - z: 5, - position: [4, -2], - silent: true, - style: { - x: rect.x + (rect.width / 2), - y: rect.y + (rect.height / 2), - text: this.device.model.name, - textFill: this.device.style.Section.mouseOverStyle.textShadowColor, // 黄色 - textAlign: 'middle', - textVerticalAlign: 'top', - textFont: 'bold ' + (fontSize + 1) + 'px ' + this.device.style.fontFamily - } - }); - this.add(this.sectionTextShadow); - this.sectionTextShadow.hide(); - } - if (this.device.section) { - const rect = this.device.section.getBoundingRect(); - this.lineBorder = new Rect({ - zlevel: this.device.zlevel, - z: this.device.z - 1, - shape: rect, - style: { - lineDash: [3, 3], - stroke: this.device.style.Section.mouseOverStyle.borderColor, - fill: this.device.style.transparentColor - } - }); - - this.add(this.lineBorder); - this.lineBorder.hide(); - } - } - - getInstanceByCode(code) { - return (store.getters['map/getDeviceByCode'](code) || {}).instance; - } - - mouseover(e) { - if (this.device.model.isSwitchSection && this.device.model.relSwitchCode) { - const instance = this.getInstanceByCode(this.device.model.relSwitchCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) { - instance.mouseEvent.mouseover(e); - } - } else { - this.TextName && this.TextName.show(); - this.sectionTextBorder && this.sectionTextBorder.show(); - this.lineBorder && this.lineBorder.show(); - const instance = this.getInstanceByCode(this.device.model.trainWindowCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) { - instance.mouseEvent.mouseEnter(e); - } - } - } - - mouseout(e) { - if (!this.device.model.down) { - this.sectionTextShadow && this.sectionTextShadow.hide(); - if (this.device.model.isSwitchSection && this.device.model.relSwitchCode) { - const instance = this.getInstanceByCode(this.device.model.relSwitchCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseout) { - instance.mouseEvent.mouseout(e); - } - } else { - this.TextName && this.TextName.hide(); - this.sectionTextBorder && this.sectionTextBorder.hide(); - this.lineBorder && this.lineBorder.hide(); - const instance = this.getInstanceByCode(this.device.model.trainWindowCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseLeave) { - instance.mouseEvent.mouseLeave(e); - } - } - } - } - - mouseEnter(e) { - this.TextName && this.TextName.show(); - this.sectionTextBorder && this.sectionTextBorder.show(); - this.lineBorder && this.lineBorder.show(); - if (this.device.model.isSwitchSection && this.device.model.relSwitchCode) { - const instance = this.getInstanceByCode(this.device.model.relSwitchCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) { - instance.mouseEvent.mouseEnter(e); - } - } - } - - mouseLeave(e) { - this.TextName && this.TextName.hide(); - this.sectionTextBorder && this.sectionTextBorder.hide(); - this.lineBorder && this.lineBorder.hide(); - if (this.device.model.isSwitchSection && this.device.model.relSwitchCode) { - const instance = this.getInstanceByCode(this.device.model.relSwitchCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseLeave) { - instance.mouseEvent.mouseLeave(e); - } - } - } -} -export default EMouse; diff --git a/src/jmap/shape/Section/ERelease.js b/src/jmap/shape/Section/ERelease.js deleted file mode 100644 index d71c886c2..000000000 --- a/src/jmap/shape/Section/ERelease.js +++ /dev/null @@ -1,72 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Line from 'zrender/src/graphic/shape/Line'; - -/** 延时释放*/ -export default class ERelease extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - - } - - create() { - if (!this.isNew) { - const model = this.model; - - this.isNew = true; - this.lines = new Line({ - zlevel: model.zlevel, - z: model.z, - shape: model.shape, - progressive: model.progressive, - style: { - lineWidth: model.lineWidth, - stroke: model.stroke - } - }); - this.add(this.lines); - } - } - - setStyle(model) { - this.create(); - this.lines.setStyle(model); - } - - hide() { - this.create(); - this.lines.hide(); - } - - show() { - this.create(); - this.lines.show(); - } - - // 开始动画 - animateStyle(loop, animates) { - this.create(); - if (animates && animates.length) { - this.eachChild((child) => { - if (child.animateStyle) { - let an = child.animateStyle(loop); - animates.forEach(elem => { - an = an.when(elem.time, elem.styles); - }); - an.start(); - } - }); - } - } - - // 结束动画 - stopAnimation(flag) { - this.create(); - this.eachChild((child) => { - if (child.stopAnimation) { - child.stopAnimation(flag); - } - }); - } -} diff --git a/src/jmap/shape/Section/ESeparator.js b/src/jmap/shape/Section/ESeparator.js deleted file mode 100644 index ee5cc27ef..000000000 --- a/src/jmap/shape/Section/ESeparator.js +++ /dev/null @@ -1,92 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Polyline from 'zrender/src/graphic/shape/Polyline'; -import Circle from 'zrender/src/graphic/shape/Circle'; - -/** 分隔符*/ -export default class ESeparator extends Group { - constructor(model) { - super(); - this.model = model; - this.zlevel = model.zlevel; - this.z = model.style.Section.separator.z || 6; - this.style = model.style; - this.setType(); - } - - createModel(points, lineWidth = null, stroke = null) { - const model = this.model; - this.partition = new Polyline({ - zlevel: this.zlevel, - progressive: model.progressive, - z: this.z, - shape: { - points: points - }, - style: { - lineWidth: lineWidth || this.style.Section.separator.width, - stroke: stroke || this.style.Section.separator.color - } - }); - this.add(this.partition); - } - - // 创建 侵限分隔符 - createCircle() { - const model = this.model; - this.circle = new Circle({ - zlevel: this.zlevel, - z: this.z, - progressive: model.progressive, - shape: { - cx: model.point.x, - cy: model.point.y, - r: this.style.Section.line.width - }, - style: { - stroke: this.style.Section.line.invadeColor, - GBaseLineWidth: 0.5, - fill: this.style.transparentColor - } - }); - this.add(this.circle); - } - - setType() { - const type = this.model.sepType; - const model = this.model; - if (model && this.style && model.traingle) { - if (type === '01') { // 普通分割 - const points = [ - [model.point.x, model.point.y - (this.style.Section.line.width)], - [model.point.x, model.point.y + (this.style.Section.line.width)] - ]; - this.createModel(points); - } else if (type === '02') { // 单侧分割符 - const points = [ - [model.point.x + model.drict * (this.style.Section.line.width), model.point.y - (this.style.Section.line.width * 1.5)], - [model.point.x, model.point.y - (this.style.Section.line.width * 1.5)], - [model.point.x, model.point.y + (this.style.Section.line.width * 1.5)] - ]; - this.createModel(points); - } else if (type === '03') { // 尽头分隔符 - const points = [ - [model.point.x + model.drict * (this.style.Section.line.width) * 1.2, model.point.y - (this.style.Section.line.width * 1.2)], - [model.point.x, model.point.y - (this.style.Section.line.width * 1.2)], - [model.point.x, model.point.y + (this.style.Section.line.width * 1.2)], - [model.point.x + model.drict * (this.style.Section.line.width) * 1.2, model.point.y + (this.style.Section.line.width * 1.2)] - ]; - const lineWidth = this.style.Section.separator.endWidth; - const stroke = this.style.Section.separator.endColor; - this.createModel(points, lineWidth, stroke); - } else if (type === '04') { // 侵限分隔符 - this.createCircle(); - } - } - - if (model.traingle) { - this.origin = [model.point.x, model.point.y]; - this.rotation = Math.PI * 2 - Math.atan2(model.traingle.absy, model.traingle.absx) * model.traingle.drictx * model.traingle.dricty; - this.dirty(); // 可以无需调用 - } - } -} diff --git a/src/jmap/shape/Section/index.js b/src/jmap/shape/Section/index.js deleted file mode 100644 index f1ec4a72d..000000000 --- a/src/jmap/shape/Section/index.js +++ /dev/null @@ -1,847 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import ETextName from '../element/ETextName'; // 名称文字 (共有) -import ERelease from './ERelease'; // 线段 (共有) -import ELimitLines from './ELimitLines'; // 区段限速 (私有) -import ELines from './ELines'; // 创建多线条 曲线 (私有) -import ESeparator from './ESeparator'; // 分隔符 (私有) -import EMouse from './EMouse'; -import { EAxle } from './EAxle'; // 创建计轴 (私有) -import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头 -import ELimitName from './ELimitName'; // 成都三号线 限速名称 -import JTriangle from '../../utils/JTriangle'; -import Rect from 'zrender/src/graphic/shape/Rect'; - -/** 区段*/ -export default class Section extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.z = 5 + parseInt(model.layer || 0); - this.model = model; - this.style = style; - this.create(); - this.createMouseEvent(); - this.createMouse(); // 框选鼠标移入移事件 - this.setState(model); - } - - create() { - const model = this.model; - // 01:物理区段;02逻辑区段;03道岔区段 - this.createSectionText(); // 创建区段文字 - if (model.type === '01' && ( - model.logicSectionNum.length <= 0 || - model.logicSectionNum.length == 1 && model.logicSectionNum[0] == 0) || - model.type === '02') { - this.createSection(); // 创建区段 - this.creatRelease(); // 创建延时释放 - this.createSeparator(); // 创建分隔符 - this.createTurnBack(); // 创建成都三号线 折返箭头 - if (model.type === '01') { - this.createAxles(); // 创建计轴 - } - } - } - - createMouseEvent() { - // 鼠标事件 - if (this.style.Section.mouseOverStyle) { - this.mouseEvent = new EMouse(this, this.model.relSwitchCode); - this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - } - - /** 创建区段*/ - createSection() { - const model = this.model; - const style = this.style; - - // 创建区段 - this.section = new ELines({ - zlevel: this.zlevel, - z: this.z, - isSwitchSection: model.isSwitchSection, - isCurve: model.isCurve, - points: model.points, - style: style - }); - - this.add(this.section); - } - - // 折返箭头 - createTurnBack() { - const model = this.model; - const style = this.style; - if (model.isReentryTrack && style.Section.shuttleBack) { - const radius = 3; - model.drict = 1; // 箭头朝向 (是折返轨加一个方向选择) 目前在区段右边 - const width = style.Section.line.width * 2; - const height = style.Section.line.width * 1; - const turnBackDistance = style.Section.shuttleBack.distance + radius * 4; - - const points = model.points; - let x = -model.drict * width * 1.2; - let y = -turnBackDistance; - - if (model.drict < 0) { - x += points[0].x; - y += points[0].y; - } else { - x += points[points.length - 1].x; - y += points[points.length - 1].y; - } - - this.turnBack = new EBackArrow({ - zlevel: this.zlevel, - z: this.z + 10, - shape: { - drict: model.drict, - width: width, - height: height, - points: { - x: x, - y: y - } - }, - style: { - lineWidth: style.Section.separator.width, - stroke: style.Section.separator.color, - fill: 'rgba(0, 0, 0, 0)' - } - }); - this.turnBackriangle = new EBackArrowTriangle({ - zlevel: this.zlevel, - z: this.z + 10, - shape: { - drict: model.drict, - width: width, - height: height, - points: { - x: x, - y: y - } - }, - style: { - lineWidth: style.Section.separator.width, - stroke: style.Section.separator.color, - fill: style.Section.separator.color - } - }); - this.add(this.turnBack); - this.add(this.turnBackriangle); - this.turnBack.hide(); - this.turnBackriangle.hide(); - } - } - - // 创建延时释放 (需要在创建) - creatRelease() { - const model = this.model; - const style = this.style; - const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); - this.release = new ERelease({ - zlevel: this.zlevel, - z: this.z, - shape: { - x1: model.points[0].x + traingle.getCos(traingle.absz / 3), - y1: model.points[0].y + traingle.getSin(traingle.absz / 3), - x2: model.points[0].x + traingle.getCos(traingle.absz / 3 * 2), - y2: model.points[0].y + traingle.getSin(traingle.absz / 3 * 2) - }, - lineWidth: style.Section.line.width, - stroke: style.Section.line.spareColor - }); - - this.add(this.release); - } - - // 创建限速线 (需要在创建) - creatSpeedLimit() { - const model = this.model; - const style = this.style; - const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); - let x = traingle.drictx * (style.Section.speedLimit.distance) * traingle.getSinRate(); - let y = traingle.dricty * (style.Section.speedLimit.distance) * traingle.getCosRate(); - if (x == Infinity) { x = 0; } - if (y == Infinity) { y = 0; } - if (!this.speedLimitLeft && !this.speedLimitRight) { - this.speedLimitLeft = new ELimitLines({ - zlevel: this.zlevel, - z: this.z, - position: [x, -y], - style: style, - switch: model.switch, - isSwitchSection: model.isSwitchSection, - relSwitchCode: model.relSwitchCode, - isCurve: model.isCurve, // 是否曲线 - points: model.points - }); - this.speedLimitRight = new ELimitLines({ - zlevel: this.zlevel, - z: this.z, - position: [-x, y], - style: style, - switch: model.switch, - isSwitchSection: model.isSwitchSection, - relSwitchCode: model.relSwitchCode, - isCurve: model.isCurve, // 是否曲线 - points: model.points - }); - if (style.Section.speedLimit.nameShow) { - // 开头 起点位置 - this.speedLimitNameLeft = new ELimitName({ - zlevel: this.zlevel, - z: this.z + 10, - drict: -1, - x: model.points[0].x, - y: model.points[0].y - 15, - style: style - }); - // 终点位置 - this.speedLimitNameRight = new ELimitName({ - zlevel: this.zlevel, - z: this.z + 10, - drict: 1, - x: model.points[model.points.length - 1].x, - y: model.points[model.points.length - 1].y - 15, - style: style - }); - this.add(this.speedLimitNameLeft); - this.add(this.speedLimitNameRight); - } - } - this.add(this.speedLimitLeft); - this.add(this.speedLimitRight); - } - - // 创建区段名称 - createSectionText() { - const model = this.model; - const style = this.style; - - if (model && style) { - // 计算区段坐标位置 - 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; - const y = Math.min(model.points[0].y, model.points[model.points.length - 1].y) + Math.abs(model.points[model.points.length - 1].y - model.points[0].y) / 2; - const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); - const drict = model.trainPosType != '01' ? 1 : -1; - if (model.type == '01' && style.Section.text.show && model.nameShow && !model.isSwitchSection) { // 物理区段名称 - const opposite = style.Section.text.opposite ? -1 : 1; - const tempx = x + traingle.getSin(style.Section.text.distance); - const tempy = y + traingle.getCos(style.Section.text.distance) * (style.Section.text.position || opposite * drict); - this.name = new ETextName({ - zlevel: this.zlevel, - z: this.z + 2, - style: this.style, - silent: false, - x: tempx + model.namePosition.x, - y: tempy + model.namePosition.y, - fontWeight: style.Section.text.fontWeight, - fontSize: style.Section.text.fontSize, - fontFamily: style.fontFamily, - text: model.name, - textFill: style.Section.text.fontColor, - textAlign: style.Section.text.textAlign, - textPosition: style.Section.text.textPosition, - textVerticalAlign: style.Section.text.textVerticalAlign - }); - this.add(this.name); - } else if (model.type == '02' && style.Section.logicText.show && model.nameShow) { // 逻辑区段 - const opposite = style.Section.logicText.opposite ? -1 : 1; - const tempx = x + traingle.getSin(style.Section.logicText.distance); - const tempy = y + traingle.getCos(style.Section.logicText.distance) * (style.Section.logicText.position || opposite * drict); - this.name = new ETextName({ - zlevel: this.zlevel, - z: this.z + 2, - style: this.style, - silent: false, - x: tempx + model.namePosition.x, - y: tempy + model.namePosition.y, - fontWeight: style.Section.logicText.fontWeight, - fontSize: style.Section.logicText.fontSize, - fontFamily: style.fontFamily, - text: model.name, - textFill: style.Section.logicText.fontColor, - textAlign: style.Section.logicText.textAlign, - textPosition: style.Section.logicText.textPosition, - textVerticalAlign: style.Section.logicText.textVerticalAlign - }); - this.add(this.name); - } else if (model.type == '03' && model.nameShow) { // 道岔区段 (实际道岔计轴区段) - this.name = new ETextName({ - zlevel: this.zlevel, - z: this.z + 2, - style: this.style, - silent: false, - x: x + model.namePosition.x, - y: y + model.namePosition.y + style.Section.text.distance * drict, - fontWeight: style.Section.text.fontWeight, - fontSize: style.Section.text.fontSize, - fontFamily: style.fontFamily, - text: model.name, - textFill: style.Section.text.fontColor, - textAlign: style.Section.text.textAlign, - textPosition: style.Section.text.textPosition, - textVerticalAlign: style.Section.text.textVerticalAlign - }); - this.add(this.name); - } - - /** 站台轨名称*/ - if (model.isStandTrack && model.standTrackNameShow && style.Section.standText.show) { - const opposite = style.Section.standText.opposite ? -1 : 1; - const tempx = x + traingle.getSin(style.Section.standText.distance); - const tempy = y + traingle.getCos(style.Section.standText.distance) * (style.Section.standText.position || opposite * drict); - this.standTrackText = new ETextName({ - zlevel: this.zlevel, - z: this.z + 2, - silent: false, - x: tempx + model.standTrackNamePosition.x, - y: tempy + model.standTrackNamePosition.y, - fontWeight: style.Section.standText.fontWeight, - fontSize: style.Section.standText.fontSize, - fontFamily: style.fontFamily, - text: model.standTrackName, - textFill: style.Section.standText.fontColor, - textAlign: style.Section.standText.textAlign, - textPosition: style.Section.standText.textPosition, - textVerticalAlign: style.Section.standText.textVerticalAlign - }); - this.add(this.standTrackText); - } - - /** 折返轨名称*/ - if (model.isReentryTrack && model.reentryTrackNameShow && style.Section.reentryText.show) { - const opposite = style.Section.reentryText.opposite ? -1 : 1; - const tempx = x + traingle.getSin(style.Section.reentryText.distance); - const tempy = y + traingle.getCos(style.Section.reentryText.distance) * (style.Section.reentryText.position || opposite * drict); - this.reentryTrackText = new ETextName({ - zlevel: this.zlevel, - z: this.z + 2, - silent: false, - x: tempx + model.reentryTrackNamePosition.x, - y: tempy + model.reentryTrackNamePosition.y, - fontWeight: style.Section.reentryText.fontWeight, - fontSize: style.Section.reentryText.fontSize, - fontFamily: style.fontFamily, - text: model.reentryTrackName, - textFill: style.Section.reentryText.fontColor, - textAlign: style.Section.reentryText.textAlign, - textPosition: style.Section.reentryText.textPosition, - textVerticalAlign: style.Section.reentryText.textVerticalAlign - }); - this.add(this.reentryTrackText); - } - - /** 转换轨名称*/ - if (model.isTransferTrack && model.transferTrackNameShow && style.Section.transferText.show) { - const opposite = style.Section.transferText.opposite ? -1 : 1; - const tempx = x + traingle.getSin(style.Section.transferText.distance); - const tempy = y + traingle.getCos(style.Section.transferText.distance) * (style.Section.transferText.position || opposite * drict); - this.transferTrackText = new ETextName({ - zlevel: this.zlevel, - z: this.z + 2, - silent: false, - x: tempx + model.transferTrackNamePosition.x, - y: tempy + model.transferTrackNamePosition.y, - fontWeight: style.Section.transferText.fontWeight, - fontSize: style.Section.transferText.fontSize, - fontFamily: style.fontFamily, - text: model.transferTrackName, - textFill: style.Section.transferText.fontColor, - textAlign: style.Section.transferText.textAlign, - textPosition: style.Section.transferText.textPosition, - textVerticalAlign: style.Section.transferText.textVerticalAlign - }); - this.add(this.transferTrackText); - } - - /** 目的码名称*/ - if (model.destinationCode && model.destinationNameShow && style.Section.destinationText.show) { - const opposite = style.Section.destinationText.opposite ? -1 : 1; - const tempx = x + traingle.getSin(style.Section.destinationText.distance); - const tempy = y + traingle.getCos(style.Section.destinationText.distance) * (style.Section.destinationText.position || opposite * drict); - this.destinationText = new ETextName({ - zlevel: this.zlevel, - z: this.z + 2, - silent: false, - x: tempx + model.destinationCodePoint.x, - y: tempy + model.destinationCodePoint.y, - fontWeight: style.Section.destinationText.fontWeight, - fontSize: style.Section.destinationText.fontSize, - fontFamily: style.fontFamily, - text: model.destinationCode, - textFill: style.Section.destinationText.fontColor, - textAlign: style.Section.destinationText.textAlign, - textPosition: style.Section.destinationText.textPosition, - textVerticalAlign: style.Section.destinationText.textVerticalAlign - }); - this.add(this.destinationText); - } - } - } - - // 创建计轴 (需要在创建) - createAxles() { - const model = this.model; - const style = this.style; - - /** 创建四个计轴*/ - let traingle = null; - if (model && style && model.axleShow && model.points && model.points.length > 1) { - traingle = new JTriangle(model.points[0], model.points[1]); - this.lUpAxle = new EAxle({ - zlevel: this.zlevel, - z: this.z + 5, // 层级大于道岔z 否则会压住显示完整 - shape: { - point: { - x: model.points[0].x, - y: model.points[0].y - }, - drictx: 1, - dricty: -1, - traingle: traingle, - style: style - }, - style: { - GBaseLineWidth: 1, - stroke: style.Section.axle.color - } - }); - this.lBottomAxle = new EAxle({ - zlevel: this.zlevel, - z: this.z + 5, // 层级大于道岔z 否则会压住显示完整 - shape: { - point: { - x: model.points[0].x, - y: model.points[0].y - }, - drictx: 1, - dricty: 1, - traingle: traingle, - style: style - }, - style: { - GBaseLineWidth: 1, - stroke: style.Section.axle.color - } - }); - - traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); - this.rUpAxle = new EAxle({ - zlevel: this.zlevel, - z: this.z + 5, // 层级大于道岔z 否则会压住显示完整 - shape: { - point: { - x: model.points[model.points.length - 1].x, - y: model.points[model.points.length - 1].y - }, - drictx: -1, - dricty: -1, - traingle: traingle, - style: style - }, - style: { - GBaseLineWidth: 1, - stroke: style.Section.axle.color - } - }); - this.rBottomAxle = new EAxle({ - zlevel: this.zlevel, - z: this.z + 5, // 层级大于道岔z 否则会压住显示完整 - shape: { - point: { - x: model.points[model.points.length - 1].x, - y: model.points[model.points.length - 1].y - }, - drictx: -1, - dricty: 1, - traingle: traingle, - style: style - }, - style: { - GBaseLineWidth: 1, - stroke: style.Section.axle.color - } - }); - - this.add(this.lUpAxle); - this.add(this.rUpAxle); - this.add(this.lBottomAxle); - this.add(this.rBottomAxle); - } - } - - // 创建分隔符 (内层需要在创建) - createSeparator() { - const model = this.model; - const style = this.style; - let traingle = null; - - if (model && style && model.points && model.points.length > 1) { - /** 创建左侧分隔符*/ - traingle = new JTriangle(model.points[0], model.points[1]); - this.lPartition = new ESeparator({ - style: style, - zlevel: this.zlevel, - traingle: traingle, - point: { - x: model.points[0].x, - y: model.points[0].y - }, - sepType: model.sepTypeLeft, - drict: -1 // 方向 - }); - - /** 创建右侧分隔符*/ - traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); - this.rPartition = new ESeparator({ - style: style, - zlevel: this.zlevel, - traingle: traingle, - point: { - x: model.points[model.points.length - 1].x, - y: model.points[model.points.length - 1].y - }, - sepType: model.sepTypeRight, - drict: 1 // 方向 - }); - - /** 添加视图*/ - this.add(this.lPartition); - this.add(this.rPartition); - } - } - - /** 设置区段集合显隐*/ - setInvisible() { - const invisible = this.model.type === '02' && this.model.logicSectionShow; - this.eachChild((child) => { - child.attr('invisible', invisible); - }); - } - - /** 设置区段恢复默认状态*/ - recover() { - if (this.section) { - this.section.stopAnimation(true); - this.section.setStyle({ - fill: this.style.backgroundColor, - stroke: this.style.Section.line.spareColor, - lineWidth: this.style.Section.line.width - }); - - if (this.release) { - this.release.hide(); - } - if (this.speedLimitLeft && this.speedLimitRight) { - this.remove(this.speedLimitLeft); - this.remove(this.speedLimitRight); - } - } - } - - /** 未定义状态 00*/ - undefine() { - if (this.section) { - this.section.setStyle({ - stroke: this.style.Section.line.undefinedColor, - lineWidth: this.style.Section.line.width - }); - } - } - - /** 空闲状态 01*/ - spare() { - if (this.section) { - this.section.setStyle({ - stroke: this.style.Section.line.spareColor, - lineWidth: this.style.Section.line.width - }); - } - } - - /** 通信车占用状态 02*/ - communicationOccupied() { - if (this.section) { - this.section.setStyle({ - stroke: this.style.Section.line.communicationOccupiedColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - } - } - - /** 非通信车占用状态 03*/ - unCommunicationOccupied() { - if (this.section) { - this.section.setStyle({ - stroke: this.style.Section.line.unCommunicationOccupiedColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - } - } - - /** 进路锁闭 04*/ - routeLock() { - if (this.section) { - this.section.setStyle({ - stroke: this.style.Section.line.routeLockColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - } - } - - /** 封锁 06*/ - block() { - if (this.section) { - this.section.setStyle({ - stroke: this.style.Section.line.blockColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - } - } - - /** 故障锁定状态 05*/ - faultLock() { - if (this.section) { - this.section.setStyle({ - stroke: this.style.Section.line.faultLockColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - } - } - - /** atc切除状态 07*/ - atcExcision() { - if (this.section) { - this.section.setStyle({ - stroke: this.style.Section.line.atcExcisionColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - } - } - - /** ats切除状态 08*/ - atsExcision() { - if (this.section) { - this.atcExcision(); - this.section.animateStyle(true, [ - { time: 1000, styles: { stroke: this.style.backgroundColor } }, - { time: 2000, styles: { stroke: this.style.Section.line.atsExcisionColor, lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth } } - ]); - } - } - - /** 保护区段锁闭 09*/ - protectiveLock() { - if (this.section) { - this.section.setStyle({ - stroke: this.style.Section.line.protectiveLockColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - } - } - - /** 延时释放 10*/ - async timeRelease() { - this.section.setStyle({ - stroke: this.style.Section.line.routeLockColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - - if (this.release) { - this.release.show(); - this.release.setStyle({ - stroke: this.style.Section.line.routeLockColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - this.release.animateStyle(true, [ - { time: 1000, styles: { stroke: this.style.Section.line.routeLockColor } }, - { time: 2000, styles: { stroke: this.style.Section.line.timeReleaseColor } } - ]); - } - } - - /** 保护区段延时解锁 11*/ - protectiveTimeRelease() { - this.section.setStyle({ - stroke: this.style.Section.line.protectiveLockColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - this.release && this.release.show(); - this.release && this.release.setStyle({ - stroke: this.style.Section.line.protectiveLockColor, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - this.release && this.release.animateStyle(true, [ - { time: 1000, styles: { stroke: this.style.Section.line.protectiveLockColor } }, - { time: 2000, styles: { stroke: this.style.Section.line.protectiveTimeReleaseColor } } - ]); - } - - /** 区段切除*/ - sectionCutOff() { - const lineWidth = this.style.Section.line.width + (this.model.status != '01' ? this.style.Section.line.beyondWidth : 0); - if (this.section) { - this.section.animateStyle(true, [ - { time: 0, styles: { lineWidth: lineWidth } }, - { time: 1000, styles: { stroke: this.style.backgroundColor } }, - { time: 2000, styles: { lineWidth: lineWidth } } - ]); - } - } - - /** 设置限速*/ - setSpeedUpperLimit() { - if (this.section) { - this.creatSpeedLimit(); - } - } - - /** 计轴预复位 12*/ - axleReset() { - if (this.release) { - this.release.show(); - this.release && this.release.setStyle({ - stroke: this.style.Section.axle.resetColor, - fill: 'green' - }); - } - } - - /** 计轴失效 13*/ - alxeFailure() { - if (this.section) { - this.section.setStyle({ - stroke: this.style.Section.axle.Failure, - lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth - }); - } - } - - /** 设置状态*/ - setState(model) { - this.recover(); - if (model.status == '01' || model.status == '00' || model.status == undefined) { - if (this.name && this.style.Section.active.routeColor) { - this.name.setStyle({textFill: this.style.Section.text.fontColor}); - } - } else { - if (this.name && this.style.Section.active.routeColor) { - this.name.setStyle({textFill: 'green'}); - } - } - switch (model.status) { - case '00': /** 未定义*/ - this.undefine(); - break; - case '01': /** 空闲*/ - this.spare(); // 空闲状态下 名称白色 其他条件为绿色 - break; - case '02': /** 通信车占用*/ - this.communicationOccupied(); - break; - case '03': /** 非通信车占用*/ - this.unCommunicationOccupied(); - break; - case '04': /** 进路锁闭*/ - this.routeLock(); - break; - case '05': /** 故障锁闭*/ - this.faultLock(); - break; - case '06': /** 封锁*/ - this.block(); - break; - case '07': /** ATC切除*/ - this.atcExcision(); - break; - case '08': /** ATS切除*/ - this.atsExcision(); - break; - case '09': /** 保护区段锁闭 */ - this.protectiveLock(); - break; - case '10': /** 延时释放 */ - this.timeRelease(); - break; - case '11': /** 保护区段延时解锁*/ - this.protectiveTimeRelease(); - break; - case '12': /** 计轴预复位*/ - this.axleReset(); - break; - case '13': /** ARB出清检测错误状态*/ - break; - case '14': /** 计轴失效*/ - this.alxeFailure(); - break; - } - - /** 区段切除*/ - if (model.cutOff) { - this.sectionCutOff(); - } - /** 是否限速*/ - if (model.speedUpperLimit >= 0) { - this.setSpeedUpperLimit(); - } - } - - createMouse() { - const rect = this.getBoundingRect(); - this.lineBorder = new Rect({ - zlevel: this.zlevel, - z: this.z - 1, - shape: rect, - style: { - lineDash: [3, 3], - stroke: '#fff', - fill: this.style.transparentColor - } - }); - - this.add(this.lineBorder); - this.lineBorder.hide(); - } - - mouseout() { - this.lineBorder && this.lineBorder.show(); - } - - mouseover() { - this.lineBorder && this.lineBorder.hide(); - } - - /** 计算提示位置*/ - getShapeTipPoint() { - let rect = this.getBoundingRect(); - let distance = this.style.Section.line.width / 2; - if (this.section) { - rect = this.section.getBoundingRect(); - if (this.model.type !== '02' && this.model.nameShow) { - if (this.model.trainPosType == '01') { - distance = distance + this.style.Section.text.distance + this.style.Section.text.fontSize; - } - } - } - - return { - x: rect.x + rect.width / 2, - y: rect.y + rect.height / 2.7 - distance - }; - } - - getBoundingRect() { - if (this.section) { - return this.section.getBoundingRect(); - } else { - return super.getBoundingRect(); - } - } -} diff --git a/src/jmap/shape/Signal/EMouse.js b/src/jmap/shape/Signal/EMouse.js deleted file mode 100644 index 1b7ef9e6a..000000000 --- a/src/jmap/shape/Signal/EMouse.js +++ /dev/null @@ -1,63 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Rect from 'zrender/src/graphic/shape/Rect'; - -export default class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.zlevel = device.zlevel; - this.style = device.style; - this.create(); - } - - create() { - this.lampRect = new Rect({ - silent: true, - zlevel: this.zlevel, - z: 6, - shape: this.device.getBoundingRect(), - style: { - lineDash: this.style.Signal.mouseOverStyle.borderLineDash, - stroke: this.style.Signal.mouseOverStyle.borderLineColor, - fill: this.style.transparentColor - } - }); - - this.nameRect = new Rect({ - silent: true, - zlevel: this.zlevel, - z: 5, - shape: this.device.sigName.getBoundingRect(), - style: { - lineDash: this.style.Signal.mouseOverStyle.borderLineDash, - stroke: this.style.Signal.mouseOverStyle.borderLineColor, - fill: this.style.Signal.mouseOverStyle.nameBackgroundColor - } - }); - - this.lampRect.hide(); - this.nameRect.hide(); - this.add(this.lampRect); - this.add(this.nameRect); - } - - mouseover(e) { - this.nameRect.show(); - this.lampRect.show(); - this.device.lamps.forEach(elem => { - elem.setBorderColor(this.style.Signal.mouseOverStyle.lampBorderLineColor); - }); - this.device.sigName && this.device.sigName.setColor(this.style.backgroundColor); - } - - mouseout(e) { - if (!this.device.model.down) { - this.nameRect.hide(); - this.lampRect.hide(); - this.device.lamps.forEach(elem => { - elem.setBorderColor(this.style.Signal.lamp.borderColor); - }); - this.device.setState(this.device.model); - } - } -} diff --git a/src/jmap/shape/Signal/ESigAuto.js b/src/jmap/shape/Signal/ESigAuto.js deleted file mode 100644 index 6d80623d9..000000000 --- a/src/jmap/shape/Signal/ESigAuto.js +++ /dev/null @@ -1,77 +0,0 @@ -import Polygon from 'zrender/src/graphic/shape/Polygon'; -import Group from 'zrender/src/container/Group'; -import { arrow } from '../utils/ShapePoints'; - -class ESigPass extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } - - create() { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; - const rotation = model.drict != 1? 0 : Math.PI; - - this.isNew = true; - this.arrow = new Polygon({ - zlevel: model.zlevel, - z: model.z, - origin: [model.x, model.y], - rotation: rotation, - shape: { - points: arrow(model.x, model.y, style.Signal.auto.width, style.Signal.lamp.radiusR * 0.8) - }, - style: { - stroke: model.stroke, - lineWidth: model.lineWidth, - fill: model.fill - } - }); - this.add(this.arrow); - } - } - - // 停止动画 - animationRecover() { - this.create(); - this.arrow.stopAnimation(false); - } - - // 箭头颜色 - setColor(color) { - this.create(); - this.arrow.setStyle('fill', color); - } - - // 箭头闪烁 - arrowsAnimation() { - this.create(); - - const style = this.model.style; - const fill = this.arrow.style.fill; - - this.arrow.animateStyle(true) - .when(1000, { fill: style.backgroundColor, stroke: style.backgroundColor }) - .when(2000, { fill: fill, stroke: style.sidelineColor }) - .when(3000, { fill: style.backgroundColor, stroke: style.backgroundColor }) - .when(4000, { fill: fill, stroke: style.sidelineColor }) - .start(); - } - - // 隐藏 - hide() { - this.create(); - this.arrow.hide(); - } - - // 显示 - show() { - this.create(); - this.arrow.show(); - } -} - -export default ESigPass; diff --git a/src/jmap/shape/Signal/ESigButton.js b/src/jmap/shape/Signal/ESigButton.js deleted file mode 100644 index 1d421edb1..000000000 --- a/src/jmap/shape/Signal/ESigButton.js +++ /dev/null @@ -1,113 +0,0 @@ -import Polyline from 'zrender/src/graphic/shape/Polyline'; -import Circle from 'zrender/src/graphic/shape/Circle'; -import Arc from 'zrender/src/graphic/shape/Arc'; -import Rect from 'zrender/src/graphic/shape/Rect'; -import Group from 'zrender/src/container/Group'; - -class ESigButton extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } - - create() { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; - const padding = 1; - const r = style.Signal.lamp.radiusR * 0.8; - - this.isNew = true; - this.sigNormalButtom = new Rect({ - zlevel: model.zlevel, - z: model.z, - _subType: 'SignalButton', - _val: '1', - shape: { - x: model.x - style.Signal.lamp.radiusR, - y: model.y - r + r * model.posit, - width: style.Signal.lamp.radiusR * 2, - height: style.Signal.lamp.radiusR * 2 - }, - style: { - lineWidth: 0.2, - stroke: style.Signal.button.borderDashColor, - fill: style.Signal.button.buttonColor - } - }); - - this.sigNormalButtomDown = new Polyline({ - _subType: 'SignalButton', - _val: '1', - zlevel: model.zlevel, - z: model.z, - silent: true, - shape: { points: [ - [model.x - padding + r, this.sigNormalButtom.shape.y + padding], - [model.x + padding - r, this.sigNormalButtom.shape.y + padding], - [model.x + padding - r, this.sigNormalButtom.shape.y + padding * 2 + r] - ] }, - style: { - lineWidth: 0.8, - stroke: style.backgroundColor - } - }); - - this.sigReentryButton = new Circle({ - zlevel: model.zlevel, - z: model.z, - _subType: 'SignalButton', - _val: '2', // 折返按钮 - shape: { - cx: model.x, - cy: model.y - 5 / 2 * r * model.posit, - r: style.Signal.lamp.radiusR - }, - style: { - lineWidth: 0.2, - stroke: style.Signal.button.borderDashColor, - fill: style.Signal.button.buttonColor - } - }); - - this.sigReentryButtonDown = new Arc({ - _subType: 'SignalButton', - _val: '2', // 折返按钮 - zlevel: model.zlevel, - z: model.z, - silent: true, - shape: { - cx: this.sigReentryButton.shape.cx, - cy: this.sigReentryButton.shape.cy, - r: this.sigReentryButton.shape.r - padding, - startAngle: Math.PI * 8 / 5, - endAngle: Math.PI * 4 / 5, - clockwise: false - }, - style: { - lineWidth: 0.8, - stroke: style.backgroundColor - } - }); - - this.add(this.sigNormalButtom); - this.add(this.sigReentryButton); - this.hide(); - } - } - - hide() { - this.create(); - this.sigNormalButtom.hide(); - this.sigReentryButton.hide(); - } - - show() { - this.create(); - this.sigNormalButtom.show(); - this.sigReentryButton.show(); - } -} - -export default ESigButton; diff --git a/src/jmap/shape/Signal/ESigDelay.js b/src/jmap/shape/Signal/ESigDelay.js deleted file mode 100644 index 00daeff35..000000000 --- a/src/jmap/shape/Signal/ESigDelay.js +++ /dev/null @@ -1,59 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -class ESigDelay extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } - - create() { - if (!this.isNew) { - const model = this.model; - - this.isNew = true; - this.name = new Text({ - _subType: model._subType, - zlevel: model.zlevel, - z: model.z, - silent: model.silent || false, - style: { - x: model.x, - y: model.y, - fontWeight: model.fontWeight, - fontSize: model.fontSize, - fontFamily: model.fontFamily, - text: model.text, - textFill: model.textFill, - textAlign: model.textAlign, - textPosition: model.textPosition || 'inside', - textVerticalAlign: model.textVerticalAlign || null - } - }); - this.add(this.name); - } - } - - setStyle(model) { - this.create(); - this.name.setStyle(model); - } - - setColor(color) { - this.create(); - this.name.setStyle('textFill', color); - } - - hide() { - this.create(); - this.name.hide(); - } - - show() { - this.create(); - this.name.show(); - } -} - -export default ESigDelay; diff --git a/src/jmap/shape/Signal/ESigLamp.js b/src/jmap/shape/Signal/ESigLamp.js deleted file mode 100644 index df106cdda..000000000 --- a/src/jmap/shape/Signal/ESigLamp.js +++ /dev/null @@ -1,111 +0,0 @@ -import Line from 'zrender/src/graphic/shape/Line'; -import Arc from 'zrender/src/graphic/shape/Arc'; -import Group from 'zrender/src/container/Group'; - -class ESigLamp extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - - create() { - const model = this.model; - const style = this.model.style; - - this.lamp = new Arc({ - _subType: 'SignalLamp', - _val: '3', - name: model.index, - zlevel: model.zlevel, - z: model.z, - shape: { - cx: model.x, - cy: model.y, - r: style.Signal.lamp.radiusR - }, - style: { - lineWidth: style.Signal.lamp.borderWidth, - fill: style.backgroundColor, - stroke: style.Signal.lamp.borderColor - } - }); - - this.lstop = new Line({ - _subType: 'SignalLamp', - _val: '3', - zlevel: model.zlevel, - z: model.z, - origin: { - x: model.originX, - y: model.originY - }, - shape: { - x1: model.x + (style.Signal.lamp.radiusR + 1) * Math.cos(Math.PI / 4), - y1: model.y + (style.Signal.lamp.radiusR + 1) * Math.sin(Math.PI / 4), - x2: model.x - (style.Signal.lamp.radiusR + 1) * Math.cos(Math.PI / 4), - y2: model.y - (style.Signal.lamp.radiusR + 1) * Math.sin(Math.PI / 4) - }, - style: { - lineWidth: style.Signal.lamp.stopWidth, - stroke: style.backgroundColor - } - }); - - this.rstop = new Line({ - _subType: 'SignalLamp', - _val: '3', - zlevel: model.zlevel, - z: model.z, - origin: { - x: model.originX, - y: model.originY - }, - shape: { - x1: model.x + (style.Signal.lamp.radiusR + 1) * Math.cos(Math.PI / 4), - y1: model.y + (style.Signal.lamp.radiusR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)), - x2: model.x - (style.Signal.lamp.radiusR + 1) * Math.cos(Math.PI / 4), - y2: model.y - (style.Signal.lamp.radiusR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)) - }, - style: { - lineWidth: style.Signal.lamp.stopWidth, - stroke: style.backgroundColor - } - }); - this.add(this.lamp); - this.add(this.lstop); - this.add(this.rstop); - } - - setColor(color) { - if (this.model.style.Signal.lamp.borderVariable) { - this.lamp.setStyle({ fill: color, stroke: color }); - } else { - this.lamp.setStyle({ fill: color }); - } - } - - setBorderColor(color) { - this.lamp.setStyle({stroke: color}); - } - - setStyle(data) { - this.lamp.setStyle(data); - } - - setStop(has) { - if (has) { - this.lstop.show(); - this.rstop.show(); - } else { - this.lstop.hide(); - this.rstop.hide(); - } - } - - getBoundingRect() { - return this.lamp.getBoundingRect(); - } -} - -export default ESigLamp; diff --git a/src/jmap/shape/Signal/ESigName.js b/src/jmap/shape/Signal/ESigName.js deleted file mode 100644 index 367bc23cb..000000000 --- a/src/jmap/shape/Signal/ESigName.js +++ /dev/null @@ -1,56 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -class ESigName extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - - create() { - const model = this.model; - this.name = new Text({ - _subType: 'SignalLamp', - _val: '3', - zlevel: model.zlevel, - z: model.z, - silent: model.silent, - style: { - textBorderColor: 'red', - textBorderWidth: 0, - x: model.x, - y: model.y, - fontWeight: model.fontWeight, - fontSize: model.fontSize, - fontFamily: model.fontFamily, - text: model.text, - textFill: model.textFill, - textAlign: model.textAlign, - textPosition: model.textPosition || 'inside', - textVerticalAlign: model.textVerticalAlign || null - } - }); - this.add(this.name); - } - - setStyle(model) { - this.name.setStyle(model); - } - - setColor(color) { - this.name.setStyle('textFill', color); - } - - // 隐藏 - hide() { - this.name.hide(); - } - - // 显示 - show() { - this.name.show(); - } -} - -export default ESigName; diff --git a/src/jmap/shape/Signal/ESigPost.js b/src/jmap/shape/Signal/ESigPost.js deleted file mode 100644 index a93a764db..000000000 --- a/src/jmap/shape/Signal/ESigPost.js +++ /dev/null @@ -1,70 +0,0 @@ -import Polyline from 'zrender/src/graphic/shape/Polyline'; -import Group from 'zrender/src/container/Group'; - -class ESigPost extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - - create() { - const model = this.model; - const style = this.model.style; - - this.ver = new Polyline({ - _subType: 'SignalLamp', - _val: '3', - zlevel: model.zlevel, - z: model.z, - shape: { - points: [ - [model.x, model.y + style.Signal.lamp.radiusR * 1.2], - [model.x, model.y - style.Signal.lamp.radiusR * 1.2] - ] - }, - style: { - lineWidth: style.Signal.post.standardWidth, - stroke: style.Signal.post.standardColor - } - }); - - this.hor = new Polyline({ - zlevel: model.zlevel, - z: model.z, - shape: { - points: [ - [model.x, model.y], - [model.x + model.drict * style.Signal.lamp.radiusR * 1.2, model.y] - ] - }, - style: { - lineWidth: style.Signal.post.standardWidth, - stroke: style.Signal.post.standardColor - } - }); - - this.add(this.ver); - this.add(this.hor); - - model.type === '01' ? this.hor.hide() : this.hor.show(); - } - - getLampPosition(type) { - const model = this.model; - const style = this.model.style; - if (type === '01') { - return { - x: model.x + model.drict * style.Signal.lamp.radiusR * 3 / 2, - y: model.y - }; - } else { - return { - x: this.hor.shape.points[1][0] + model.drict * style.Signal.lamp.radiusR, - y: this.hor.shape.points[1][1] - }; - } - } -} - -export default ESigPost; diff --git a/src/jmap/shape/Signal/ESigRoute.js b/src/jmap/shape/Signal/ESigRoute.js deleted file mode 100644 index ad6b13fc6..000000000 --- a/src/jmap/shape/Signal/ESigRoute.js +++ /dev/null @@ -1,48 +0,0 @@ -import Polygon from 'zrender/src/graphic/shape/Polygon'; -import Group from 'zrender/src/container/Group'; -import { triangular } from '../utils/ShapePoints'; - -class ESigDrict extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } - - create() { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; - - this.isNew = true; - this.sigDrict = new Polygon({ - zlevel: model.zlevel, - z: model.z, - shape: { - points: triangular(model.x, model.y, model.drict, style.Signal.lamp.radiusR) - }, - style: { - stroke: style.backgroundColor, - lineWidth: 0.5, - fill: style.Signal.route.routeColor - } - }); - - this.add(this.sigDrict); - } - } - - // 隐藏 - hide() { - this.create(); - this.sigDrict.hide(); - } - - // 显示 - show() { - this.create(); - this.sigDrict.show(); - } -} - -export default ESigDrict; diff --git a/src/jmap/shape/Signal/index.js b/src/jmap/shape/Signal/index.js deleted file mode 100644 index 8f06e76eb..000000000 --- a/src/jmap/shape/Signal/index.js +++ /dev/null @@ -1,518 +0,0 @@ -/* -* 信号机 -*/ - -import ESigPost from './ESigPost'; -import ESigLamp from './ESigLamp'; -import ESigAuto from './ESigAuto'; -import ESigRoute from './ESigRoute'; -import ESigButton from './ESigButton'; -import ESigDelay from './ESigDelay'; -import ESigName from './ESigName'; -import EMouse from './EMouse'; -import Group from 'zrender/src/container/Group'; -import BoundingRect from 'zrender/src/core/BoundingRect'; - -class Signal extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.model = model; - this.style = style; - this.count = parseInt(model.lampPositionType); - this.lamps = new Array(this.count); - this.zlevel = model.zlevel; - this.z = 7; - this.create(); - this.createMouseEvent(); - this.transformRotation(this); - this.setState(model); - } - - create() { - const model = this.model; - const style = this.style; - const drict = this.model.directionShowType == '01' ? -1 : 1; // 朝向 左:右 - const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下 - - // 信号机高柱矮柱 - this.sigPost = new ESigPost({ - zlevel: this.zlevel, - z: this.z, - style: style, - drict: drict, - type: model.lampPostType, - x: model.position.x, - y: model.position.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR) - }); - - // 信号灯 - const endPoint = this.sigPost.getLampPosition(model.lampPostType); - this.lamps = []; - for (let i = 0; i < this.count; i++) { - const lamp = new ESigLamp({ - zlevel: this.zlevel, - z: this.z, - style: style, - drict: drict, - x: endPoint.x + i * drict * style.Signal.lamp.radiusR * 2, - y: endPoint.y, - originX: model.position.x, - originY: model.position.y - }); - - this.lamps.push(lamp); - } - - // 信号机名称 - const sigNameX = model.position.x - drict * (style.Signal.post.standardWidth) + model.namePosition.x; - const sigNameY = model.position.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.directionShowType == '01' ? 'right' : 'left'; - const textVerticalAlign = posit == 1 ? 'top' : 'bottom'; - this.sigName = new ESigName({ - zlevel: this.zlevel, - z: this.z, - silent: false, - isNoRotation: style.Signal.text.isNoRotation, - style: style, - x: sigNameX, - y: sigNameY, - text: model.name, - fontWeight: style.Signal.text.fontWeight, - fontSize: style.Signal.text.fontSize, - fontFamily: style.fontFamily, - textFill: style.Signal.text.defaultColor, - textAlign: textAlign, - textVerticalAlign: textVerticalAlign - }); - - // 自动进路 - const sigRouteH = style.Signal.route.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2; - const sigRouteX = endPoint.x + (style.Signal.route.offset.x + sigRouteH) * drict; - const sigRouteY = endPoint.y + (style.Signal.route.offset.y); - this.sigRoute = new ESigRoute({ - zlevel: this.zlevel, - z: this.z, - style: style, - x: sigRouteX, - y: sigRouteY, - drict: drict - }); - - // 自动通过 - const sigAutoH = style.Signal.auto.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2; - const sigAutoX = endPoint.x + (style.Signal.auto.offset.x + sigAutoH) * drict; - const sigAutoY = endPoint.y + (style.Signal.auto.offset.y); - this.sigAuto = new ESigAuto({ - zlevel: this.zlevel, - z: this.z, - style: style, - count: this.count, - drict: drict, - x: sigAutoX, - y: sigAutoY, - width: style.Signal.auto.width, - fill: style.Signal.auto.autoRoute, - lineWidth: 0.6, - stroke: style.sidelineColor - }); - - // 延迟解锁 - const sigDelayH = style.Signal.delay.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2; - const sigDelayX = endPoint.x + (style.Signal.delay.offset.x + sigDelayH) * drict; - const sigDelayY = endPoint.y - (style.Signal.delay.offset.y) * posit; - this.sigDelay = new ESigDelay({ - zlevel: this.zlevel, - z: this.z, - style: style, - x: sigDelayX, - y: sigDelayY, - fontWeight: style.Signal.delay.fontWeight, - fontSize: style.Signal.delay.fontSize, - fontFamily: style.fontFamily, - text: this.model.delayCount || '0', - textFill: style.Signal.delay.fontColor, - textAlign: drict > 0 ? 'right' : 'left', - textVerticalAlign: 'middle' - }); - - // 信号灯按钮 - this.sigButton = new ESigButton({ - zlevel: this.zlevel, - z: this.z, - style: style, - posit: posit, - show: model.buttonShow, - x: model.buttonPosition.x, - y: model.buttonPosition.y - posit * (style.Signal.button.distance + style.Signal.lamp.radiusR * 2) - }); - - this.add(this.sigPost); - this.lamps.forEach(lamp => { this.add(lamp); }); - this.add(this.sigName); - - this.style.Signal.text.show && model.nameShow ? this.sigName.show() : this.sigName.hide(); - this.add(this.sigAuto); - this.add(this.sigRoute); - this.add(this.sigDelay); - // this.add(this.sigButton); - } - - createMouseEvent() { - if (this.style.Signal.mouseOverStyle) { - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - } - - // 整体旋转信号灯 - transformRotation(device) { - if (this.model.rotate) { - device.eachChild(item => { - if (item instanceof Group) { - this.transformRotation(item); - } else if (item && item.model && item.model.isNoRotation) { - item.origin = [this.model.position.x, this.model.position.y]; - item.rotation = -Math.PI / 180 * Number(this.model.rotate); - item.dirty(); - } - }); - } - } - - // 关闭 - close() { - if (this.count == 2 && this.model.lightType == '01') { // 双灯 物理点灯 - if (this.lamps[0]) { - this.lamps[0].setStop(false); - this.lamps[0].setColor(this.style.Signal.lamp.redColor); - } - if (this.lamps[1]) { - this.lamps[1].setStop(false); - this.lamps[1].setColor(this.style.backgroundColor); - } - } else if (this.count == 2 && this.model.lightType == '02') { // 双灯 逻辑点灯 - if (this.lamps[0]) { - this.lamps[0].setStop(true); - this.lamps[0].setColor(this.style.Signal.lamp.redColor); - } - if (this.lamps[1]) { - this.lamps[1].setStop(true); - this.lamps[1].setColor(this.style.backgroundColor); - } - } else if (this.count == 1 && this.model.lightType == '01') { // 单灯 物理点灯 - if (this.lamps[0]) { - this.lamps[0].setStop(false); - if (this.model.useType == '05') { - this.lamps[0].setColor(this.style.Signal.lamp.blueColor); - } else { - this.lamps[0].setColor(this.style.Signal.lamp.redColor); - } - } - } else if (this.count == 1 && this.model.lightType == '02') { // 单灯 逻辑点灯 - if (this.lamps[0]) { - this.lamps[0].setStop(true); - if (this.model.useType == '05') { - this.lamps[0].setColor(this.style.Signal.lamp.blueColor); - } else { - this.lamps[0].setColor(this.style.Signal.lamp.redColor); - } - } - } else if (this.count == 1) { - if (this.lamps[0]) { - if (this.model.useType == '05') { - this.lamps[0].setColor(this.style.Signal.lamp.blueColor); - } else { - this.lamps[0].setColor(this.style.Signal.lamp.redColor); - } - } - } - } - - /* count 1单灯 2双灯 lightType 01物理点灯 02逻辑点灯*/ - openPositive() { - if (this.count == 2 && this.model.lightType == '01') { - if (this.lamps[0]) { - this.lamps[0].setStop(false); - this.lamps[0].setColor(this.style.Signal.lamp.greenColor); - } - if (this.lamps[1]) { - this.lamps[1].setStop(false); - this.lamps[1].setColor(this.style.backgroundColor); - } - } else if (this.count == 2 && this.model.lightType == '02') { - if (this.lamps[0]) { - this.lamps[0].setStop(true); - this.lamps[0].setColor(this.style.Signal.lamp.greenColor); - } - if (this.lamps[1]) { - this.lamps[1].setStop(true); - this.lamps[1].setColor(this.style.backgroundColor); - } - } else if (this.count == 1 && this.model.lightType == '01') { - if (this.lamps[0]) { - this.lamps[0].setStop(false); - this.lamps[0].setColor(this.style.Signal.lamp.greenColor); - } - } else if (this.count == 1 && this.model.lightType == '02') { - if (this.lamps[0]) { - this.lamps[0].setStop(true); - this.lamps[0].setColor(this.style.Signal.lamp.greenColor); - } - } - } - /* count 1单灯 2双灯 lightType 01物理点灯 02逻辑点灯*/ - openLateral() { - if (this.count == 2 && this.model.lightType == '01') { - if (this.lamps[0]) { - this.lamps[0].setStop(false); - this.lamps[0].setColor(this.style.backgroundColor); - } - if (this.lamps[1]) { - this.lamps[1].setStop(false); - this.lamps[1].setColor(this.style.Signal.lamp.yellowColor); - } - } else if (this.count == 2 && this.model.lightType == '02') { - if (this.lamps[0]) { - this.lamps[0].setStop(true); - this.lamps[0].setColor(this.style.backgroundColor); - } - if (this.lamps[1]) { - this.lamps[1].setStop(true); - this.lamps[1].setColor(this.style.Signal.lamp.yellowColor); - } - } else if (this.count == 1 && this.model.lightType == '01') { - if (this.lamps[0]) { - this.lamps[0].setStop(false); - // 出站信号机/阻隔信号机 - if (['02', '06'].includes(this.model.useType)) { - this.lamps[0].setColor(this.style.Signal.lamp.greenColor); - } else { - this.lamps[0].setColor(this.style.Signal.lamp.whiteColor); - } - } - } else if (this.count == 1 && this.model.lightType == '02') { - if (this.lamps[0]) { - this.lamps[0].setStop(true); - this.lamps[0].setColor(this.style.Signal.lamp.greenColor); - } - } - } - // 列车进路 - trainRoute() { - if (this.count == 1) { - /** 单灯 列兼调信号*/ - this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.yellowColor); - } - } - - // 调车进路 - shuntRoute() { - if (this.count == 1) { - /** 单灯 列兼调信号*/ - /** 单灯 阻挡兼调车信号*/ - this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.whiteColor); - } - } - - // 引导 - guid() { - if (this.count == 2 && this.model.lightType == '01' && this.style.Signal.lamp.guidName != 'chengdu_03') { // 双灯 物理点灯 允许引导信号 - if (this.lamps[0]) { - this.lamps[0].setStop(false); - this.lamps[0].setColor(this.style.Signal.lamp.redColor); - } - if (this.lamps[1]) { - this.lamps[1].setStop(false); - this.lamps[1].setColor(this.style.Signal.lamp.yellowColor); - } - } else if (this.count == 1 && this.model.lightType == '01' && this.style.Signal.lamp.guidName == 'chengdu_03') { - this.lamps[0].setStop(false); - this.lamps[0].setStyle({ fill: this.style.Signal.lamp.yellowColor, stroke: this.style.Signal.lamp.redColor, lineWidth: 2.5 }); - } - } - - // 封锁 - block() { - if (this.count == 1) { - this.lamps[0].setColor(this.style.Signal.lamp.redColor); - // this.siglamp.setNameBorder(1) - } - this.sigName.setColor(this.style.Signal.text.blockColor); - if (this.style.Signal.text.nameBorderShow) { - this.sigName.setStyle({textBorderWidth: 1}); - this.sigName.setColor('#fff'); - } - } - - // 功能封锁 - functionBlock() { - if (this.count == 1) { - this.lamps[0].setColor(this.style.Signal.lamp.redColor); - // this.siglamp.setRectBlockByIndex(1, true); - } - } - - // 信号保护区段监视状态显示 - signalCheck() { - if (this.count == 1) { - this.lamps[0].setColor(this.style.Signal.lamp.redColor); - this.sigName.setColor(this.style.Signal.text.checkColor); - } - } - - // 故障 - fault() { - if (this.count == 2 && this.model.lightType == '01') { // 双灯 物理点灯 - if (this.lamps[0]) { - this.lamps[0].setStop(false); - this.lamps[0].setColor(this.style.Signal.lamp.blueColor); - } - if (this.lamps[1]) { - this.lamps[1].setStop(false); - this.lamps[1].setColor(this.style.Signal.lamp.blueColor); - } - } - } - - // 物理点灯 - logicalLight() { - this.lamps.forEach(lamp => { lamp.setStop(false); }); - } - - // 逻辑点灯 - physicsLight() { - this.lamps.forEach(lamp => { lamp.setStop(true); }); - } - - // 设置自动进路模式状态类型 - setAutoRouteOpen() { - this.sigAuto.setColor(this.style.Signal.auto.autoRoute); - if (this.model.linkageAutoRouteShow) { - this.sigAuto.show(); - } else { - this.sigAuto.hide(); - } - } - - // 信号机进路自动触发模式状态类型 - setAutoTriggerOpen() { - this.sigAuto.setColor(this.style.Signal.auto.autoTrigger); - if (this.model.atsAutoTriggerShow) { - this.sigAuto.show(); - } else { - this.sigAuto.hide(); - } - } - - // 设置自动信号模式状态类型 - setAutoSignalOpen() { - this.sigRoute.show(); - } - - // 隐藏自动信号和自动进路 - setAutoClose() { - this.sigAuto.hide(); - this.sigAuto.setColor(this.style.backgroundColor); - this.sigRoute.hide(); - } - - // 自动信号和自动进路开始动画 - setAutoFlicker() { - this.sigAuto.arrowsAnimation(); - } - - // 设置延时解锁 - setDelayUnlock() { - this.sigDelay.show(); - } - - // 恢复状态 - recover() { - this.sigName.setStyle({textBorderWidth: 0}); - this.sigAuto.hide(); - this.sigRoute.hide(); - this.sigDelay.hide(); - this.sigAuto.animationRecover(); - this.sigName.setColor(this.style.Signal.text.defaultColor); - if (this.style.Signal.lamp.guidName == 'chengdu_03') { - this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth }); - } - } - - setState(model) { - this.recover(); - /** 设置状态 (点灯类型)*/ - switch (model.status) { - case '01': this.close(); break; // 关闭 - case '02': this.openPositive(); break; // 开放正向 - case '03': this.openLateral(); break; // 开放侧向 - case '04': this.guid(); break; // 引导 - case '05': this.block(); break; // 封锁 - case '06': this.fault(); break; // 故障 - case '07': this.block(); break; // 功能封锁 - case '08': this.signalCheck(); break; // 信号保护区段检测 - } - - /** 进路性质类型*/ - switch (model.natureType) { - case '01': this.trainRoute(); break; // 列车进路 - case '02': this.shuntRoute(); break; // 调车进路 - } - - /** 设置点灯类型*/ - switch (model.lightType) { - case '01': this.logicalLight(); break; // 设置逻辑点灯 - case '02': this.physicsLight(); break; // 设置物理点灯 - } - - /** 设置自动类型*/ - switch (model.autoType) { - case '01': this.setAutoClose(); break; // 隐藏 隐藏自动信号和自动进路 - case '02': this.setAutoSignalOpen(); break; // 显示 设置自动信号模式状态类型 - case '03': this.setAutoRouteOpen(); break; // 显示 设置自动进路模式状态类型 - case '04': this.setAutoTriggerOpen(); break; // 显示 信号机进路自动触发模式状态类型 - } - - /** 延时解锁*/ - switch (model.delayType) { - case '01': break; // 未延时解锁 - case '02': this.setDelayUnlock(); break; // 人工闭塞延时解锁 - case '03': this.setDelayUnlock(); break; // 自动闭塞延时解锁 - } - - /** 信号机进路办理,先停止动画,再判断当前颜色是否闪烁*/ - if (model.routeSetting && (model.autoType == '03' || model.autoType == '04')) { - this.setAutoFlicker(); - } - } - - getBoundingRect() { - const rect = this.sigPost.getBoundingRect(); - this.lamps.forEach(elem => { - rect.union(elem.getBoundingRect()); - }); - return rect; - } - - getShapeTipPoint(opts) { - var rect = new BoundingRect(0, 0, 0, 0); - var drict = this.model.directionShowType == '01' ? -1 : 1; // 朝向 左:右 - var offsetY = this.model.positionType == '01' ? this.style.Signal.text.fontSize : 0; // 位置 上:下 - if (opts.val == '1' || opts.val == '2') { - rect = this.sigButton.getBoundingRect(); - } else { - rect = this.sigPost.getBoundingRect(); - } - - return { - x: rect.x + drict * this.style.Signal.post.standardWidth, - y: rect.y - offsetY - }; - } -} - -export default Signal; diff --git a/src/jmap/shape/Station/index.js b/src/jmap/shape/Station/index.js deleted file mode 100644 index 68afa99e9..000000000 --- a/src/jmap/shape/Station/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/* -* 车站 -*/ -import Group from 'zrender/src/container/Group'; -import ETextName from '../element/ETextName'; // 名称文字 (共有) - -export default class Station extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.z = 40; - this.model = model; - this.style = style; - this.create(); - this.setState(model); - } - - create() { - const model = this.model; - const style = this.style; - - if (model.visible) { - // 公里标名称是否显示 - this.stationText = new ETextName({ - zlevel: this.zlevel, - z: this.z, - position: [0, 0], - x: model.position.x, - y: model.position.y, - fontWeight: model.fontWeight, - fontSize: model.nameFont || 18, - fontFamily: style.fontFamily, - text: model.name, - textAlign: 'middle', - textVerticalAlign: 'top', - textFill: model.nameFontColor - }); - this.add(this.stationText); - const path = window.location.href; - if (style.Station.kmPostShow || path.includes('/map/draw')) { - // 公里标是否显示 - let direction = 1; - if (this.style.Station.kilometerPosition == 'up') { - direction = -1; - } - this.mileageText = new ETextName({ - zlevel: this.zlevel, - z: this.z, - position: [0, 0], - x: model.position.x, - y: model.position.y + ((parseInt(model.nameFont) + 2) * direction), - fontWeight: model.fontWeight, - fontSize: model.kmPostFont || 18, - fontFamily: style.fontFamily, - text: model.kmPost, - textAlign: 'middle', - textVerticalAlign: 'top', - textFill: model.kmPostFontColor - }); - this.add(this.mileageText); - model.kmPostShow ? this.mileageText.show() : this.mileageText.hide(); - } - } - } - - // eslint-disable-next-line no-unused-vars - setState(model) { - } - - getShapeTipPoint() { - return null; - } -} diff --git a/src/jmap/shape/StationControl/EArrow.js b/src/jmap/shape/StationControl/EArrow.js deleted file mode 100644 index 7ed64d3fb..000000000 --- a/src/jmap/shape/StationControl/EArrow.js +++ /dev/null @@ -1,52 +0,0 @@ -import Polygon from 'zrender/src/graphic/shape/Polygon'; -import Group from 'zrender/src/container/Group'; - -class ESigAuto extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - - create() { - const model = this.model; - - this.arrow = new Polygon({ - zlevel: model.zlevel, - z: model.z, - shape: { - points: model.point - }, - style: { - stroke: model.stroke, - lineWidth: model.lineWidth, - fill: model.fill - } - }); - this.add(this.arrow); - } - - // 停止动画 - animationRecover() { - this.arrow.stopAnimation(false); - } - - // 箭头颜色 - setColor(color) { - this.arrow.setStyle('fill', color); - } - - // 箭头闪烁 - arrowsAnimation() { - const style = this.model.style; - const fill = this.arrow.style.Signal.fill; - this.arrow.animateStyle(true) - .when(1000, { fill: style.backgroundColor, stroke: style.backgroundColor }) - .when(2000, { fill: fill, stroke: style.Signal.sidelineColor }) - .when(3000, { fill: style.backgroundColor, stroke: style.backgroundColor }) - .when(4000, { fill: fill, stroke: style.Signal.sidelineColor }) - .start(); - } -} - -export default ESigAuto; diff --git a/src/jmap/shape/StationControl/EMouse.js b/src/jmap/shape/StationControl/EMouse.js deleted file mode 100644 index a26e61025..000000000 --- a/src/jmap/shape/StationControl/EMouse.js +++ /dev/null @@ -1,62 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -export default class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.create(); - } - create() { - this.text = new Text({ - _subType: 'Text', - zlevel: this.device.zlevel, - z: this.device.z + 1, - position: [0, 0], - style: { - x: this.device.model.position.x - this.device.style.StationControl.lamp.distance / 2 + this.device.style.StationControl.lamp.offset.x, - y: this.device.model.position.y + this.device.style.StationControl.lamp.offset.y + this.device.style.StationControl.lamp.radiusR + this.device.style.StationControl.text.distance - 40, - fontWeight: this.device.style.StationControl.mouseOverStyle.fontWeight, - fontSize: this.device.style.StationControl.mouseOverStyle.fontSize, - fontFamily: this.device.style.StationControl.mouseOverStyle.fontFormat, - text: '', - textFill: this.device.style.StationControl.mouseOverStyle.fontColor, - textAlign: this.device.style.StationControl.mouseOverStyle.textAlign, - textVerticalAlign: this.device.style.StationControl.mouseOverStyle.textVerticalAlign - } - }); - - this.add(this.text); - this.text.hide(); - } - setTextContext(text) { - if (text) { - this.text.setStyle('text', text); - } - } - mouseover(e) { - if (e.target) { - let name = ''; - switch (e.target.parent._subType) { - case 'emergency': - name = '紧急站控'; - break; - case 'center': - name = '中控'; - break; - case 'substation': - name = '站控'; - break; - } - // debugger; - this.setTextContext(name); - this.text.show(); - } - } - - mouseout(e) { - if (!this.device.model.down) { - this.text.hide(); - } - } -} diff --git a/src/jmap/shape/StationControl/ESingleControl.js b/src/jmap/shape/StationControl/ESingleControl.js deleted file mode 100644 index 0fc00029e..000000000 --- a/src/jmap/shape/StationControl/ESingleControl.js +++ /dev/null @@ -1,73 +0,0 @@ -import Arc from 'zrender/src/graphic/shape/Arc'; -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -/** 单个控制灯*/ -export default class ESingleControl extends Group { - constructor(model) { - super(); - this.model = model; - this.zlevel = model.zlevel; - this._subType = model._subType; - this.z = 20; - this.onmouseover = model.mouseover; - this.onmouseout = model.mouseout; - this.create(model); - } - - create(model) { - var _subType = 'ControlSignal'; - var _val = '0'; - if (model.pop) { - _subType = 'ControlButton'; - _val = '1'; - } - var _nameType = this._subType; - this.control = new Arc({ - pop: model.pop, - _subType: _subType, - _nameType: _nameType, - _val: _val, - zlevel: this.zlevel, - z: this.z, - shape: { - cx: model.point.x, - cy: model.point.y, - r: model.style.StationControl.lamp.radiusR - }, - style: { - lineWidth: 0.5, - fill: model.style.StationControl.lamp.grayColor, - stroke: model.style.StationControl.lamp.grayColor - } - }); - - this.text = new Text({ - pop: model.pop, - _subType: _subType, - zlevel: this.zlevel, - z: this.z, - position: [0, 0], - style: { - x: model.point.x, - y: model.point.y + model.style.StationControl.lamp.radiusR + model.style.StationControl.text.distance, - fontWeight: model.style.StationControl.text.fontWeight, - fontSize: model.style.StationControl.text.fontSize, - fontFamily: model.style.StationControl.text.fontFormat, - text: model.context, - textFill: model.style.StationControl.text.fontColor, - textAlign: model.style.StationControl.text.textAlign, - textVerticalAlign: model.style.StationControl.text.textVerticalAlign - } - }); - - this.add(this.control); - this.add(this.text); - } - - setColor(color) { - if (color) { - this.control.setStyle('fill', color); - } - } -} diff --git a/src/jmap/shape/StationControl/index.js b/src/jmap/shape/StationControl/index.js deleted file mode 100644 index 953981194..000000000 --- a/src/jmap/shape/StationControl/index.js +++ /dev/null @@ -1,166 +0,0 @@ -/* -* 控制模式 -*/ -import Group from 'zrender/src/container/Group'; -import ESingleControl from './ESingleControl'; // 单个信号灯 (私有) -import EArrow from './EArrow'; -import { arrow } from '../utils/ShapePoints'; -import EMouse from './EMouse'; - -/** 控制模式*/ -export default class StationControl extends Group { - constructor(model, style) { - super(); - this.selected = false; - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.z = 1; - this.model = model; - this.style = style; - this.create(); - this.createMouseEvent(); - this.setState(model); - } - - create() { - const model = this.model; - // 紧急站控 - if (this.style.StationControl.lamp.emergencyControlShow) { - this.emergencyControl = new ESingleControl({ - _subType: 'emergency', - style: this.style, - zlevel: this.zlevel, - z: this.z, - point: { - x: model.position.x - this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x, - y: model.position.y + this.style.StationControl.lamp.offset.y - }, - context: model.jjzkContent, - pop: false - }); - this.add(this.emergencyControl); - } - // 中控按钮 - if (this.style.StationControl.lamp.centerControlShow) { - this.centerControl = new ESingleControl({ - _subType: 'center', - style: this.style, - zlevel: this.zlevel, - z: this.z, - point: { - x: model.position.x - this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x, - y: model.position.y + this.style.StationControl.lamp.offset.y - }, - context: model.zokContent, - pop: false - }); - this.add(this.centerControl); - } - // 站控按钮 - if (this.style.StationControl.lamp.substationControlShow) { - this.substationControl = new ESingleControl({ - _subType: 'substation', - style: this.style, - zlevel: this.zlevel, - z: this.z, - point: { - x: model.position.x + this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x, - y: model.position.y + this.style.StationControl.lamp.offset.y - }, - context: model.zakContent, - pop: false - }); - this.add(this.substationControl); - } - // 联锁控 - if (this.style.StationControl.lamp.interconnectedControlShow) { - this.interconnectedControl = new ESingleControl({ - _subType: 'interconnected', - style: this.style, - zlevel: this.zlevel, - z: this.z, - point: { - x: model.position.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x, - y: model.position.y + this.style.StationControl.lamp.offset.y - }, - context: model.lskContent || '联锁控', - pop: false - }); - this.add(this.interconnectedControl); - } - // 箭头 - if (this.style.StationControl.arrow.show) { - const point = arrow(this.model.position.x, this.model.position.y + this.style.StationControl.lamp.radiusR / 2, this.style.StationControl.lamp.distance / 6, this.style.StationControl.lamp.radiusR * 0.8); - this.arrowsControl = new EArrow({ - zlevel: this.zlevel, - z: this.z, - style: this.style, - count: this.count, - drict: 1, - point: point, - x: model.position.x + this.style.StationControl.lamp.offset.x, - y: model.position.y + this.style.StationControl.lamp.radiusR / 2 + this.style.StationControl.lamp.offset.y, - fill: this.style.StationControl.lamp.grayColor, - lineWidth: 1, - stroke: this.style.sidelineColor - }); - this.add(this.arrowsControl); - } - } - - // 设置状态 - setState(model) { - switch (model.status) { - case '00': // 无状态 - this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor); - this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor); - this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor); - break; - case '01': // 中控 - this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor); - this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor); - this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.greenColor); - break; - case '02': // 站控 - this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor); - this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.yellowColor); - this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor); - break; - case '03': // 紧急站控 - this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.redColor); - this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor); - this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor); - break; - } - } - - /** 按钮是否按下*/ - isPop(e) { - for (var i = 0; i < this.childCount(); i++) { - var rect = this.childAt(i).getBoundingRect(); - if (rect.contain(e.offsetX, e.offsetY) && this.childAt(i).pop) { - return true; - } - } - } - createMouseEvent() { - if (this.style.ZcControl.mouseOverStyle) { - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - } - getShapeTipPoint() { - if (this.stationControl) { - var distance = 2; - var rect = this.stationControl.getBoundingRect(); - return { - x: rect.x + rect.width / 2, - y: rect.y - distance - }; - } - return null; - } -} diff --git a/src/jmap/shape/StationCounter/index.js b/src/jmap/shape/StationCounter/index.js deleted file mode 100644 index 710a97585..000000000 --- a/src/jmap/shape/StationCounter/index.js +++ /dev/null @@ -1,90 +0,0 @@ -/* -* 计数器 -*/ -import Polyline from 'zrender/src/graphic/shape/Polyline'; -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -export default class StationCounter extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.model = model; - this.style = style; - this.zlevel = model.zlevel; - this.z = 30; - this.create(); - this.setState(model); - } - - create() { - const model = this.model; - const style = this.style; - this.counter = new Text({ - zlevel: this.zlevel, - z: this.z, - position: [0, 0], - style: { - x: model.position.x, - y: model.position.y, - fontWeight: 'normal', - fontSize: style.textFontSize, - fontFamily: style.fontFamily, - text: model.val, - textFill: style.StationCounter.text.fontColor, - textAlign: 'middle', - textStrokeWidth: 1 - } - }); - - this.rect = this.counter.getBoundingRect(); - - this.vPadding = 0; - this.lPadding = 2; - this.table = new Polyline({ - zlevel: this.zlevel, - z: this.z, - shape: { - points: [ - [this.rect.x - this.lPadding, this.rect.y - this.vPadding], - [this.rect.x + this.lPadding + this.rect.width, this.rect.y - this.vPadding], - [this.rect.x + this.lPadding + this.rect.width, this.rect.y + this.vPadding + this.rect.height], - [this.rect.x - this.lPadding, this.rect.y + this.vPadding + this.rect.height], - [this.rect.x - this.lPadding, this.rect.y - this.vPadding]] - }, - style: { - stroke: style.StationCounter.text.borderColor - } - }); - - this.counterName = new Text({ - zlevel: this.zlevel, - z: this.z, - position: [0, 0], - style: { - x: model.position.x, - y: model.position.y + this.rect.width + this.vPadding + style.textFontSize + style.StationCounter.text.distance, - fontWeight: 'bold', - fontSize: style.textFontSize, - fontFamily: style.fontFamily, - text: model.name, - textFill: style.StationCounter.text.fontColor, - textAlign: 'middle', - textVerticalAlign: 'top', - textStrokeWidth: 1 - } - }); - this.add(this.counterName); - this.add(this.table); - this.add(this.counter); - } - - setState(model) { - } - - getShapeTipPoint() { - return null; - } -} - diff --git a/src/jmap/shape/StationDelayUnlock/index.js b/src/jmap/shape/StationDelayUnlock/index.js deleted file mode 100644 index 2fe0f7b35..000000000 --- a/src/jmap/shape/StationDelayUnlock/index.js +++ /dev/null @@ -1,107 +0,0 @@ -/* -* 延迟解锁 -*/ -import Rect from 'zrender/src/graphic/shape/Rect'; -import Text from 'zrender/src/graphic/Text'; -import Group from 'zrender/src/container/Group'; - -export default class StationDelayUnlock extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.model = model; - this.style = style; - this.zlevel = model.zlevel; - this.z = 1; - this.create(); - this.setState(model); - } - - create() { - const model = this.model; - const style = this.style; - this.text = new Text({ - zlevel: this.zlevel, - z: this.z, - position: [0, 0], - style: { - x: model.position.x, - y: model.position.y, - fontWeight: 'normal', - fontSize: model.textFont, - fontFamily: style.fontFamily, - text: model.deviceName + ' ', - textFill: style.StationDelayUnlock.text.fontColor, - textStrokeWidth: 1, - textAlign: 'left' - } - }); - - const fontSize = parseInt(model.textFont.split(' ')[0]) || 30; - this.time = new Text({ - zlevel: this.zlevel, - z: this.z, - position: [0, 0], - style: { - x: model.position.x, - y: model.position.y + fontSize + style.StationDelayUnlock.text.distance, - fontWeight: 'normal', - fontSize: model.textFont, - fontFamily: style.fontFamily, - text: model.remainTime || '', - textFill: style.StationDelayUnlock.text.fontColor, - textStrokeWidth: 1, - textAlign: 'left' - } - }); - this.add(this.text); - this.add(this.time); - - this.lPadding = 3; - this.vPadding = 3; - this.rect = this.getBoundingRect(); - if (this.rect.width < 35) this.rect.width = 35; - if (this.rect.height < 20) this.rect.height = 20; - - this.table = new Rect({ - zlevel: this.zlevel, - z: this.z - 1, - shape: { - x: model.position.x - this.lPadding, - y: model.position.y - this.vPadding, - width: this.rect.width + this.lPadding * 2, - height: this.rect.height + this.vPadding * 2 - }, - style: { - stroke: style.StationDelayUnlock.text.borderColor, - fill: style.backgroundColor - } - }); - this.add(this.table); - } - - /** 延时解锁关闭*/ - delayClose() { - this.time.setStyle('text', ''); - this.text.setStyle('text', ''); - this.table.setStyle('stroke', this.style.backgroundColor); - } - - /** 延时解锁计数*/ - delayUnlock() { - this.table.setStyle('stroke', this.style.sidelineColor); - this.time.setStyle('text', '' + this.model.remainTime); - } - - setState(model) { - switch (model.status) { - case '01': this.delayClose(); break; // 关闭 - case '02': this.delayUnlock(); break; // 延迟解锁 - } - } - - getShapeTipPoint() { - return null; - } -} diff --git a/src/jmap/shape/StationStand/EDetain.js b/src/jmap/shape/StationStand/EDetain.js deleted file mode 100644 index 3a118f726..000000000 --- a/src/jmap/shape/StationStand/EDetain.js +++ /dev/null @@ -1,53 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -class EDetain extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } - - create() { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; - - this.isNew = true; - this.detain = new Text({ - zlevel: model.zlevel, - z: model.z, - position: [0, 0], - style: { - x: model.x, - y: model.y, - text: style.StationStand.detainCar.text, - textAlign: model.textAlign, - textVerticalAlign: model.textVerticalAlign, - fontSize: `${style.StationStand.stand.headFontSize} px ${style.fontFamily}`, - textFill: style.StationStand.detainCar.centerTrainColor, - textStroke: style.backgroundColor - } - }); - - this.add(this.detain); - } - } - - setColor(color) { - this.create(); - this.detain.setStyle('textFill', color); - } - - hide() { - this.create(); - this.detain.hide(); - } - - show() { - this.create(); - this.detain.show(); - } -} - -export default EDetain; diff --git a/src/jmap/shape/StationStand/EJump.js b/src/jmap/shape/StationStand/EJump.js deleted file mode 100644 index aad405c95..000000000 --- a/src/jmap/shape/StationStand/EJump.js +++ /dev/null @@ -1,87 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; -import Arc from 'zrender/src/graphic/shape/Arc'; - -class EJump extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - this.create(); - this.setStatus(model.jumpStopStatus); - } - - create() { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; - - this.isNew = true; - this.jump = new Text({ - zlevel: model.zlevel, - z: model.z, - style: { - x: model.x, - y: model.y, - fontWeight: 'normal', - fontSize: style.StationStand.common.textFontSize, - fontFamily: style.fontFamily, - text: style.StationStand.jump.text, - textFill: style.StationStand.jump.textColor, - textAlign: model.textAlign, - textVerticalAlign: model.textVerticalAlign - } - }); - this.jumpArc = new Arc({ - zlevel: model.zlevel, - z: model.z, - shape: { - cx: model.cx, - cy: model.cy, - r: style.StationStand.jump.r - }, - style: { - stroke: style.StationStand.jump.arcColor, - fill: style.StationStand.jump.fillColor - } - }); - this.add(this.jumpArc); - this.add(this.jump); - this.jumpArc.hide(); - } - } - - setName(val) { - this.create(); - this.jump.setStyle('text', val); - } - setStatus(val) { - switch (val) { - case '03': - this.jumpArc.show(); - break; - case '02': - this.jumpArc.hide(); - break; - case '01': - this.jumpArc.hide(); - break; - } - } - setColor(color) { - this.create(); - this.jump.setStyle('textFill', color); - } - - hide() { - this.create(); - this.jump.hide(); - } - - show() { - this.create(); - this.jump.show(); - } -} - -export default EJump; diff --git a/src/jmap/shape/StationStand/ELevel.js b/src/jmap/shape/StationStand/ELevel.js deleted file mode 100644 index 4f5e8ae39..000000000 --- a/src/jmap/shape/StationStand/ELevel.js +++ /dev/null @@ -1,57 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -class ELevel extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } - - create() { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; - - this.isNew = true; - this.level = new Text({ - zlevel: model.zlevel, - z: model.z, - style: { - x: model.x, - y: model.y, - fontWeight: 'normal', - fontSize: style.StationStand.common.textFontSize, - fontFamily: style.fontFamily, - text: model.name, - textFill: style.StationStand.level.textColor, - textAlign: 'middle' - } - }); - - this.add(this.level); - } - } - - setName(val) { - this.create(); - this.level.setStyle('text', val); - } - - setColor(color) { - this.create(); - this.level.setStyle('textFill', color); - } - - hide() { - this.create(); - this.level.hide(); - } - - show() { - this.create(); - this.level.show(); - } -} - -export default ELevel; diff --git a/src/jmap/shape/StationStand/EMouse.js b/src/jmap/shape/StationStand/EMouse.js deleted file mode 100644 index ecf66d1c9..000000000 --- a/src/jmap/shape/StationStand/EMouse.js +++ /dev/null @@ -1,38 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Rect from 'zrender/src/graphic/shape/Rect'; - -export default class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.zlevel = device.zlevel; - this.style = device.style; - this.create(); - } - - create() { - this.border = new Rect({ - silent: true, - zlevel: this.zlevel, - z: 0, - shape: this.device.getBoundingRect(), - style: { - lineDash: this.style.StationStand.mouseOverStyle.borderLineDash, - stroke: this.style.StationStand.mouseOverStyle.borderLineColor, - fill: this.style.transparentColor - } - }); - this.border.hide(); - this.add(this.border); - } - - mouseover(e) { - this.border.show(); - } - - mouseout(e) { - if (!this.device.model.down) { - this.border.hide(); - } - } -} diff --git a/src/jmap/shape/StationStand/EReentry.js b/src/jmap/shape/StationStand/EReentry.js deleted file mode 100644 index 1c32388b9..000000000 --- a/src/jmap/shape/StationStand/EReentry.js +++ /dev/null @@ -1,49 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Polygon from 'zrender/src/graphic/shape/Polygon'; -import { flashlight } from '../utils/ShapePoints.js'; - -class EReentry extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } - - create() { - if (!this.isNew) { - const model = this.model; - - this.isNew = true; - this.reentry = new Polygon({ - zlevel: model.zlevel, - z: model.z, - shape: { - points: flashlight(model.x, model.y, model.drict, 10, 5, 0, 0, 4) - }, - style: { - lineWidth: model.lineWidth, - fill: model.fill - } - }); - - this.add(this.reentry); - } - } - - setColor(color) { - this.create(); - this.reentry.setStyle('textFill', color); - } - - hide() { - this.create(); - this.reentry.hide(); - } - - show() { - this.create(); - this.reentry.show(); - } -} - -export default EReentry; diff --git a/src/jmap/shape/StationStand/ESafeDoor.js b/src/jmap/shape/StationStand/ESafeDoor.js deleted file mode 100644 index 7e51251f7..000000000 --- a/src/jmap/shape/StationStand/ESafeDoor.js +++ /dev/null @@ -1,80 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Rect from 'zrender/src/graphic/shape/Rect'; - -class ESafeDoor extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - - create() { - const model = this.model; - const style = this.model.style; - const padding = 0.1; - - this.safeL = new Rect({ - zlevel: model.zlevel, - z: model.z, - shape: { - x: model.x - model.width / 2 - padding, - y: model.y, - width: model.width / 4 + padding, - height: model.height - }, - style: { - lineWidth: 0, - stroke: style.StationStand.safetyDoor.defaultColor, - fill: style.StationStand.safetyDoor.defaultColor - } - }); - - this.safeC = new Rect({ - zlevel: model.zlevel, - z: model.z, - shape: { - x: model.x - model.width / 4 - padding, - y: model.y, - width: model.width / 2 + padding * 2, - height: model.height - }, - style: { - lineWidth: 0, - stroke: style.StationStand.safetyDoor.defaultColor, - fill: style.StationStand.safetyDoor.defaultColor - } - }); - - this.safeR = new Rect({ - zlevel: model.zlevel, - z: model.z, - shape: { - x: model.x + model.width / 4, - y: model.y, - width: model.width / 4 + padding, - height: model.height - }, - style: { - lineWidth: 0, - stroke: style.StationStand.safetyDoor.defaultColor, - fill: style.StationStand.safetyDoor.defaultColor - } - }); - - this.add(this.safeL); - this.add(this.safeC); - this.add(this.safeR); - } - - hasDoor(show) { - show ? this.safeC.hide() : this.safeC.show(); - } - - setColor(color) { - this.safeL.setStyle('fill', color); - this.safeC.setStyle('fill', color); - this.safeR.setStyle('fill', color); - } -} - -export default ESafeDoor; diff --git a/src/jmap/shape/StationStand/ESafeEmergent.js b/src/jmap/shape/StationStand/ESafeEmergent.js deleted file mode 100644 index 350398f51..000000000 --- a/src/jmap/shape/StationStand/ESafeEmergent.js +++ /dev/null @@ -1,48 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Isogon from 'zrender/src/graphic/shape/Isogon'; - -class ESafeEmergent extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } - - create() { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; - - this.isNew = true; - this.emergent = new Isogon({ - zlevel: model.zlevel, - z: model.z, - shape: { - x: model.x, - y: model.y, - r: model.r, - n: model.n - }, - style: { - lineWidth: 0, - stroke: style.StationStand.standEmergent.closeColor, - fill: style.StationStand.standEmergent.closeColor - } - }); - - this.add(this.emergent); - } - } - - hide() { - this.create(); - this.emergent.hide(); - } - - show() { - this.create(); - this.emergent.show(); - } -} - -export default ESafeEmergent; diff --git a/src/jmap/shape/StationStand/ESafeStand.js b/src/jmap/shape/StationStand/ESafeStand.js deleted file mode 100644 index d9b6d7e91..000000000 --- a/src/jmap/shape/StationStand/ESafeStand.js +++ /dev/null @@ -1,39 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Rect from 'zrender/src/graphic/shape/Rect'; - -class ESafeStand extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - - create() { - const model = this.model; - const style = this.model.style; - - this.stand = new Rect({ - zlevel: model.zlevel, - z: model.z, - shape: { - x: model.x, - y: model.y, - width: model.width, - height: model.height - }, - style: { - lineWidth: 0, - stroke: style.sidelineColor, - fill: style.StationStand.stand.spareColor - } - }); - - this.add(this.stand); - } - - setColor(color) { - this.stand.setStyle('fill', color); - } -} - -export default ESafeStand; diff --git a/src/jmap/shape/StationStand/ETime.js b/src/jmap/shape/StationStand/ETime.js deleted file mode 100644 index 436f01981..000000000 --- a/src/jmap/shape/StationStand/ETime.js +++ /dev/null @@ -1,57 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -class ETime extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } - - create() { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; - - this.isNew = true; - this.time = new Text({ - zlevel: model.zlevel, - z: model.z, - style: { - x: model.x, - y: model.y, - fontWeight: 'normal', - fontSize: style.StationStand.common.textFontSize, - fontFamily: style.fontFamily, - text: model.name, - textFill: style.StationStand.stopTime.textColor, - textAlign: 'middle' - } - }); - - this.add(this.time); - } - } - - setName(val) { - this.create(); - this.time.setStyle('text', val); - } - - setColor(color) { - this.create(); - this.time.setStyle('textFill', color); - } - - hide() { - this.create(); - this.time.hide(); - } - - show() { - this.create(); - this.time.show(); - } -} - -export default ETime; diff --git a/src/jmap/shape/StationStand/index.js b/src/jmap/shape/StationStand/index.js deleted file mode 100644 index f9afaa17d..000000000 --- a/src/jmap/shape/StationStand/index.js +++ /dev/null @@ -1,417 +0,0 @@ -/**/ -import Group from 'zrender/src/container/Group'; -import ETime from './ETime'; -import ELevel from './ELevel'; -import EReentry from './EReentry'; -import EDetain from './EDetain'; -import ESafeDoor from './ESafeDoor'; -import ESafeStand from './ESafeStand'; -import ESafeEmergent from './ESafeEmergent'; -import EMouse from './EMouse'; -import EJump from './EJump'; - -class StationStand extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.model = model; - this.style = style; - this.zlevel = model.zlevel; - this.z = 1; - this.doors = new Group(); - this.create(); - this.createMouseEvent(); - this.setVisible(model.visible); - this.setState(model); - } - create() { - const model = this.model; - const style = this.style; - const drict = model.doorLocationType == '01' ? 1 : -1; - - /** 列车站台*/ - const standH = drict > 0 ? style.StationStand.safetyDoor.height : model.height; - const standX = model.position.x - model.width / 2; - const standY = model.position.y + drict * (style.StationStand.safetyDoor.distance + standH); - this.safeStand = new ESafeStand({ - zlevel: this.zlevel, - z: this.z, - style: style, - x: standX, - y: standY, - width: model.width, - height: model.height - }); - this.add(this.safeStand); - - if (model.direction != '03') { - /** 屏蔽门*/ - this.safeDoor = new ESafeDoor({ - zlevel: this.zlevel, - z: this.z, - style: style, - x: model.position.x, - y: model.position.y, - width: model.width, - height: style.StationStand.safetyDoor.height, - show: model.hasDoor - }); - - /** 站台紧急关闭*/ - const emergentH = drict > 0 ? style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.height : style.StationStand.standEmergent.mergentR; - const emergentX = model.position.x + drict * (style.StationStand.standEmergent.offset.x); - const emergentY = model.position.y + drict * (style.StationStand.standEmergent.offset.y + emergentH); - this.emergent = new ESafeEmergent({ - zlevel: this.zlevel, - z: this.z + 1, - style: style, - x: emergentX, - y: emergentY, - r: style.StationStand.standEmergent.mergentR, - n: 4 - }); - - /** 站台折返策略*/ - const reentryD = style.StationStand.reentry.position ? model.height + 6 : -style.StationStand.safetyDoor.distance - style.StationStand.safetyDoor.height; - const reentryH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + reentryD; - const reentryX = model.position.x - (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.x - model.width / 2); - const reentryY = model.position.y + (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.y) + drict * reentryH; - this.reentry = new EReentry({ - zlevel: this.zlevel, - z: this.z + 1, - style: style, - drict: drict, - x: reentryX, - y: reentryY, - lineWidth: 0, - fill: style.StationStand.reentry.noHumanColor - }); - - const distance = style.StationStand.safetyDoor.height * 2 - style.StationStand.stand.headFontSize / 2 - 2; - - /** 站台扣车*/ - const detainD = style.StationStand.detainCar.position ? model.height - distance : -style.StationStand.safetyDoor.height; - const detainH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + detainD; - const detainX = model.position.x - (style.StationStand.detainCar.position || drict) * (style.StationStand.detainCar.offset.x - model.width / 2); - const detainY = model.position.y + (style.StationStand.detainCar.position || drict) * (style.StationStand.detainCar.offset.y) + drict * detainH; - this.detain = new EDetain({ - zlevel: this.zlevel, - z: this.z, - style: style, - x: detainX, - y: detainY, - textAlign: 'middle', - textVerticalAlign: 'top' - }); - - /** 停站时间*/ - const timeD = style.StationStand.stopTime.position ? model.height - distance : -style.StationStand.safetyDoor.height; - const timeH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + timeD; - const timeX = model.position.x - (style.StationStand.stopTime.position || drict) * (style.StationStand.stopTime.offset.x - model.width / 2); - const timeY = model.position.y + (style.StationStand.stopTime.position || drict) * (style.StationStand.stopTime.offset.y) + drict * timeH; - this.time = new ETime({ - zlevel: this.zlevel, - z: this.z + 1, - style: style, - x: timeX, - y: timeY, - name: model.parkingTime || '30' - }); - - /** 运行等级*/ - const levelD = style.StationStand.level.position ? model.height - distance : -style.StationStand.safetyDoor.height; - const levelH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + levelD; - const levelX = model.position.x - (style.StationStand.level.position || drict) * (style.StationStand.level.offset.x - model.width / 2); - const levelY = model.position.y + (style.StationStand.level.position || drict) * (style.StationStand.level.offset.y) + drict * levelH; - this.level = new ELevel({ - zlevel: this.zlevel, - z: this.z + 1, - style: style, - x: levelX, - y: levelY, - name: model.intervalRunTime || '5' - }); - - /** 列车停跳 */ - if (style.StationStand.common.haveJumpShow) { - const jumpD = style.StationStand.jump.position ? model.height - distance : -style.StationStand.safetyDoor.height; - const jumpH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + jumpD; - const jumpX = model.position.x - (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.x - model.width / 2); - const jumpY = model.position.y + (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.y) + drict * jumpH; - const jumpCX = model.position.x - (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.x - model.width / 2); - const jumpCY = model.position.y + (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.y - style.StationStand.common.textFontSize / 2) + drict * jumpH; - this.jump = new EJump({ - zlevel: this.zlevel, - z: this.z + 1, - style: style, - x: jumpX, - y: jumpY, - cx: jumpCX, - cy: jumpCY, - textAlign: 'middle', - textVerticalAlign: 'top', - jumpStopStatus: model.jumpStopStatus - }); - this.add(this.jump); - } - - this.add(this.safeDoor); - this.add(this.emergent); - this.add(this.detain); - this.add(this.reentry); - this.add(this.time); - this.add(this.level); - } - } - - createMouseEvent() { - if (this.style.StationStand.mouseOverStyle) { - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - } - - setVisible(visible) { - if (visible) { - this.eachChild(elem => { elem.show(); }); - } else { - this.eachChild(elem => { elem.hide(); }); - } - } - - /** 恢复初始状态*/ - recover() { - this.time && this.time.hide(); - this.level && this.level.hide(); - this.detain && this.detain.hide(); - this.reentry && this.reentry.hide(); - this.emergent && this.emergent.hide(); - this.jump && this.jump.hide(); - if (this.model.visible) { this.safeDoor && this.safeDoor.hasDoor(false); } - this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor); - } - - /** 空闲*/ - spare() { - this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor); - } - - /** 列车停站*/ - stop() { - this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.stopColor); - } - - /** 指定列车跳站*/ - designatedJumpStop() { - this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor); - this.jump && this.jump.show(); - this.jump && this.jump.setStatus(this.model.jumpStopStatus); - } - - /** 站台紧急关闭*/ - emergentClose() { - this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor); - this.emergent && this.emergent.show(); - } - - /** 未设置跳停*/ - unJumpStop() { - this.jump && this.jump.hide(); - this.jump && this.jump.setStatus(this.model.jumpStopStatus); - } - - /** 站台跳停*/ - jumpStop() { - this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor); - this.jump && this.jump.show(); - this.jump && this.jump.setStatus(this.model.jumpStopStatus); - } - - /** 未设置扣车*/ - unDetainTrain() { - this.detain && this.detain.hide(); - } - - /** 车站扣车*/ - standDetainTrain() { - this.detain && this.detain.show(); - this.detain && this.detain.setColor(this.style.StationStand.detainCar.detainTrainTextColor); - } - - /** 中心扣车*/ - centerDetainTrain() { - this.detain && this.detain.show(); - this.detain && this.detain.setColor(this.style.StationStand.detainCar.centerTrainColor); - } - - /** 中心+车站扣车*/ - standAndCenterDetainTrain() { - this.detain && this.detain.show(); - this.detain && this.detain.setColor(this.style.StationStand.detainCar.andCenterTrainColor); - } - - /** 人工设置停战时间*/ - setManuallyArmisticeTime(val) { - this.time && this.time.show(); - this.time && this.time.setName(val); - } - - /** 人工设置运行等级*/ - setManuallyOperationLevel(val) { - this.level && this.level.show(); - this.level && this.level.setName(val); - } - - /** 开门*/ - openDoor() { - this.safeDoor && this.safeDoor.hasDoor(true); - } - - /** 关门*/ - closeDoor() { - this.safeDoor && this.safeDoor.hasDoor(false); - } - - /** 屏蔽门正常*/ - doorNormal() { - this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor); - } - - /** 屏蔽门故障*/ - doorFault() { - this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.splitDoorColor); - } - - /** 屏蔽门切除*/ - doorSplit() { - this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.splitDoorColor); - } - - /** 无折返(默认)*/ - noReentry() { - this.reentry && this.reentry.hide(); - } - - /** 无人折返*/ - noHumanReentry() { - this.reentry && this.reentry.show(); - this.reentry && this.reentry.setColor(this.style.StationStand.reentry.noHumanColor); - } - /** 自动换端*/ - autoChangeEnds() { - this.reentry && this.reentry.show(); - this.reentry && this.reentry.setColor(this.style.StationStand.reentry.autoChangeEndsColor); - } - - setState(model) { - this.recover(); - switch (model.status) { - case '01': /** 空闲*/ - this.spare(); - break; - case '02': /** 列车停站*/ - this.stop(); - break; - case '03': /** 站台紧急关闭*/ - this.emergentClose(); - break; - } - - if (Number(model.parkingTime) >= 0) { - this.setManuallyArmisticeTime(model.parkingTime); - } - - if (Number(model.intervalRunTime) > 0) { - this.setManuallyOperationLevel(model.intervalRunTime); - } - - /** 设置跳停*/ - if (model.status == '01') { - switch (model.jumpStopStatus) { - case '01': /** 未设置跳停*/ - this.unJumpStop(); - break; - case '02': /** 指定站台跳停*/ - this.designatedJumpStop(); - break; - case '03': /** 站台全部跳停*/ - this.jumpStop(); - break; - } - } - - /** 设置扣车*/ - switch (model.holdStatus) { - case '01': /** 未设置扣车*/ - this.unDetainTrain(); - break; - case '02': /** 车站扣车*/ - this.standDetainTrain(); - break; - case '03': /** 中心扣车*/ - this.centerDetainTrain(); - break; - case '04': /** 中心+车站扣车*/ - this.standAndCenterDetainTrain(); - break; - } - - /** 设置屏蔽门开关*/ - switch (model.screenDoorOpenStatus) { - case '01': - this.closeDoor(); /** 关门*/ - break; - case '02': - this.openDoor(); /** 开门*/ - break; - } - - /** 设置屏蔽门状态*/ - switch (model.screenDoorStatus) { - case '01': - this.doorNormal(); /** 正常*/ - break; - case '02': - this.doorFault(); /** 故障*/ - break; - case '03': - this.doorSplit(); /** 切除*/ - } - - /** 设置折返策略*/ - switch (model.reentryStrategy) { - case '04': /** 默认*/ - case '01': - this.noReentry(); /** 无折返策略*/ - break; - case '02': - this.noHumanReentry(); /** 无人折返*/ - break; - case '03': - this.autoChangeEnds(); /** 自动换端*/ - break; - } - } - - getBoundingRect() { - const rect = this.safeStand.getBoundingRect(); - this.safeDoor && rect.union(this.safeDoor.getBoundingRect()); - - return rect; - } - - getShapeTipPoint() { - const rect = this.getBoundingRect(); - if (rect) { - return { - x: rect.x + rect.width / 2, - y: rect.y - }; - } - return null; - } -} -export default StationStand; diff --git a/src/jmap/shape/Switch/ELockRect.js b/src/jmap/shape/Switch/ELockRect.js deleted file mode 100644 index 1ee66d84f..000000000 --- a/src/jmap/shape/Switch/ELockRect.js +++ /dev/null @@ -1,21 +0,0 @@ -import Rect from 'zrender/src/graphic/shape/Rect'; - -/** 名称元素*/ -export default function ELockRect(model) { - const TextName = new Rect({ - zlevel: model.zlevel, - z: model.z + 2, - shape: { - x: model.x, - y: model.y, - width: model.width, - height: model.width - }, - style: { - lineWidth: model.lineWidth, - stroke: model.stroke, - fill: model.fill - } - }); - return TextName; -} diff --git a/src/jmap/shape/Switch/EMouse.js b/src/jmap/shape/Switch/EMouse.js deleted file mode 100644 index 0645e4f5d..000000000 --- a/src/jmap/shape/Switch/EMouse.js +++ /dev/null @@ -1,128 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Rect from 'zrender/src/graphic/shape/Rect'; -import store from '@/store/index_APP_TARGET'; -class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.create(); - this.craeteSwitchBorder(); - } - create() { - if (this.device.name) { - // 创建锁闭框 - const rect = this.device.name.getNameText().getBoundingRect(); - let textWidth = rect.width * 0.8; - if (this.device.triangle.drictx !== 1) { - // rect.x += rect.width; - textWidth = -textWidth; - } - - this.textRect = new Rect({ - zlevel: this.device.zlevel, - z: this.device.z, - silent: true, - shape: { - x: rect.x, - y: rect.y, - width: textWidth, - height: rect.height - }, - style: { - lineWidth: 1, - lineDash: [3, 3], - stroke: this.device.style.Switch.mouseOverStyle.borderColor, - fill: this.device.style.Switch.mouseOverStyle.borderBackgroundColor - } - }); - this.add(this.textRect); - this.textRect.hide(); - } - } - - // 创建道岔边框 - craeteSwitchBorder() { - const sectionA = this.getInstanceByCode(this.device.model.sectionACode); - const sectionB = this.getInstanceByCode(this.device.model.sectionBCode); - const sectionC = this.getInstanceByCode(this.device.model.sectionCCode); - const rect = this.device.getBoundingRect(); - - sectionA && rect.union(sectionA.getBoundingRect()); - sectionB && rect.union(sectionB.getBoundingRect()); - sectionC && rect.union(sectionC.getBoundingRect()); - - this.switchBorder = new Rect({ - zlevel: this.device.model.zlevel, - z: this.device.z, - silent: true, - shape: Object.assign({ r: 4 }, rect), - style: { - lineDash: [3, 3], - stroke: this.device.style.Switch.mouseOverStyle.borderColor, - fill: this.device.style.transparentColor - } - }); - - this.add(this.switchBorder); - this.switchBorder.hide(); - } - - getInstanceByCode(code) { - return (store.getters['map/getDeviceByCode'](code) || {}).instance; - } - - mouseout(e) { - if (!this.device.model.down) { - this.switchBorder && this.switchBorder.hide(); - this.device.setTextStyle({ - textFill: this.device.style.backgroundColor - }); - this.textRect && this.textRect.hide(); - this.device.setState(this.device.model); - - const section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {}; - const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {}; - const instance = this.getInstanceByCode(parentSection.trainWindowCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseLeave) { - instance.mouseEvent.mouseLeave(e); - } - } - } - - mouseover(e) { - this.switchBorder && this.switchBorder.show(); - this.device.setLossAction(false); - this.device.setSwitchCoreColor(this.device.style.Switch.mouseOverStyle.borderBackgroundColor); - this.device.setTextStyle({ - textFill: '#000' - }); - this.textRect && this.textRect.show(); - - const section = store.getters['map/getDeviceByCode'](this.device.model.sectionACode) || {}; - const parentSection = store.getters['map/getDeviceByCode'](section.parentCode) || {}; - const instance = this.getInstanceByCode(parentSection.trainWindowCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) { - instance.mouseEvent.mouseEnter(e); - } - } - - mouseEnter(e) { - this.switchBorder && this.switchBorder.show(); - this.device.setLossAction(false); - this.device.setSwitchCoreColor(this.device.style.Switch.mouseOverStyle.borderBackgroundColor); - this.device.setTextStyle({ - textFill: '#000' - }); - this.textRect && this.textRect.show(); - } - - mouseLeave(e) { - this.switchBorder && this.switchBorder.hide(); - this.device.setTextStyle({ - textFill: this.device.style.backgroundColor - }); - this.textRect && this.textRect.hide(); - this.device.setState(this.device.model); - } -} -export default EMouse; diff --git a/src/jmap/shape/Switch/ESwCore.js b/src/jmap/shape/Switch/ESwCore.js deleted file mode 100644 index 7c7f86e2a..000000000 --- a/src/jmap/shape/Switch/ESwCore.js +++ /dev/null @@ -1,77 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Line from 'zrender/src/graphic/shape/Line'; - -class ESwCore extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - - create() { - const model = this.model; - const style = this.model.style; - this.skewLine = new Line({ - zlevel: model.zlevel, - z: model.z, - silent: true, - shape: { - x1: model.intersectionX, - y1: model.intersectionY, - x2: model.intersectionX + model.triangle.drictx * model.triangle.getCotRate() * model.coverLength, - y2: model.intersectionY + model.triangle.dricty * model.coverLength - }, - style: { - lineWidth: model.lineWidth, - stroke: style.backgroundColor - } - }); - - this.line = new Line({ - zlevel: model.zlevel, - z: model.z, - silent: true, - shape: { - x1: model.intersectionX - model.triangle.getCotRate() * model.coverLength, - y1: model.intersectionY, - x2: model.intersectionX + model.triangle.getCotRate() * model.coverLength, - y2: model.intersectionY - }, - style: { - lineWidth: model.lineWidth, - stroke: style.backgroundColor - } - }); - - this.add(this.line); - this.add(this.skewLine); - } - - hide() { - this.line.hide(); - this.skewLine.hide(); - } - - show() { - this.line.show(); - this.skewLine.show(); - } - - setColor(color) { - this.line.setStyle('stroke', color); - this.skewLine.setStyle('stroke', color); - } - - stopAnimation(flag) { - this.line.stopAnimation(flag); - this.skewLine.stopAnimation(flag); - } - - animateStyle(cb) { - this.eachChild((child) => { - cb(child); - }); - } -} - -export default ESwCore; diff --git a/src/jmap/shape/Switch/ESwLnversion.js b/src/jmap/shape/Switch/ESwLnversion.js deleted file mode 100644 index 8cbc78f9c..000000000 --- a/src/jmap/shape/Switch/ESwLnversion.js +++ /dev/null @@ -1,69 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Polygon from 'zrender/src/graphic/shape/Polygon'; - -class ESwLnversion extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - - create() { - const model = this.model; - const style = this.model.style; - this.relocShelter = new Polygon({ - zlevel: model.zlevel, - z: model.z, - shape: { - points: model.shelterPoints - }, - style: { - fill: style.backgroundColor - }, - cursor: model.cursor, - onmouseover: model.onmouseover, - onmouseout: model.onmouseout - }); - const rpx = Math.abs(model.triangle.getCos(model.halfWidth)) + 0.2; - this.relocShelter.position = [-model.triangle.drictx * rpx, -model.triangle.dricty * 0.2]; - - this.section = new Polygon({ - zlevel: model.zlevel, - z: model.z + 1, - shape: { - points: model.sectionPoints - }, - style: { - fill: style.Section.line.spareColor - }, - cursor: model.cursor, - onmouseover: model.onmouseover, - onmouseout: model.onmouseout - }); - - this.hide(); - this.add(this.relocShelter); - this.add(this.section); - } - - hide() { - this.relocShelter.hide(); - this.section.hide(); - } - - show() { - this.relocShelter.show(); - this.section.show(); - } - - stopAnimation(flag) { - this.section.stopAnimation(flag); - } - - getSection() { - return this.section; - } - -} - -export default ESwLnversion; diff --git a/src/jmap/shape/Switch/ESwLocal.js b/src/jmap/shape/Switch/ESwLocal.js deleted file mode 100644 index 9541d68cd..000000000 --- a/src/jmap/shape/Switch/ESwLocal.js +++ /dev/null @@ -1,44 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Polygon from 'zrender/src/graphic/shape/Polygon'; - -class ESwLocal extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - - create() { - const model = this.model; - const style = this.model.style; - - this.locShelter = new Polygon({ - zlevel: model.zlevel, - z: model.z, - shape: { - points: model.shelterPoints - }, - style: { - fill: style.backgroundColor - }, - cursor: model.cursor, - onmouseover: model.onmouseover, - onmouseout: model.onmouseout - }); - - const lpx = Math.abs(model.triangle.getCos(1)); - this.locShelter.position = [model.triangle.drictx * lpx, -model.triangle.dricty * 0.2]; - this.locShelter.show(); - this.add(this.locShelter); - } - - hide() { - this.locShelter.hide(); - } - - show() { - this.locShelter.show(); - } -} - -export default ESwLocal; diff --git a/src/jmap/shape/Switch/ESwName.js b/src/jmap/shape/Switch/ESwName.js deleted file mode 100644 index 8471024c7..000000000 --- a/src/jmap/shape/Switch/ESwName.js +++ /dev/null @@ -1,98 +0,0 @@ -import LangStorage from '@/utils/lang'; -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; -import Rect from 'zrender/src/graphic/shape/Rect'; - -class ESwName extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - - create() { - const model = this.model; - const style = this.model.style; - - this.nameText = new Text({ - zlevel: model.zlevel, - z: model.z + 6, - style: { - x: model.nameTextX, - y: model.nameTextY, - fontWeight: style.Switch.text.fontWeight, - fontSize: style.Switch.text.fontSize, - fontFamily: style.fontFamily, - text: model.name, - textAlign: model.triangle.drictx === 1 ? 'left' : 'right', - textVerticalAlign: 'middle', - textFill: style.Switch.text.fontColor - } - }); - - const rect = this.nameText.getBoundingRect(); - let textWidth = rect.width * 0.8; - if (model.triangle.drictx !== 1) { - rect.x += rect.width; - textWidth = -textWidth; - } - - this.textRect = new Rect({ - zlevel: model.zlevel, - z: model.z + 10, - silent: true, - shape: { - x: rect.x, - y: rect.y, - width: textWidth, - height: rect.height - }, - style: { - lineWidth: 0, - // lineDash: [3, 3], - stroke: style.Switch.text.borderColor, - fill: style.transparentColor - } - }); - - const data = LangStorage.getLang() == 'en' ? 'Turnout section' : '道岔区段名称'; - - this.arrowText = new Text({ - zlevel: model.zlevel, - z: model.z + 20, - style: { - x: model.arrowTextX, - y: model.arrowTextY, - fontSize: style.arrowFontSize, - fontWeight: style.Switch.text.fontWeight, - fontFamily: style.fontFamily, - text: `${data}: ${model.sectionName}`, - textFill: '#000', - textAlign: 'left', - textPadding: 3, - textBackgroundColor: style.tipBackgroundColor - } - }); - - this.add(this.textRect); - this.add(this.nameText); - this.add(this.arrowText); - - this.arrowText.hide(); - model.nameShow ? this.nameText.show() : this.nameText.hide(); - } - - getArrowText() { - return this.arrowText; - } - - getNameText() { - return this.nameText; - } - - getTextRect() { - return this.textRect; - } -} - -export default ESwName; diff --git a/src/jmap/shape/Switch/index.js b/src/jmap/shape/Switch/index.js deleted file mode 100644 index 81ca5bba9..000000000 --- a/src/jmap/shape/Switch/index.js +++ /dev/null @@ -1,426 +0,0 @@ -/* -* 道岔 -*/ -import Line from 'zrender/src/graphic/shape/Line'; -import Group from 'zrender/src/container/Group'; -import JTriangle from '../../utils/JTriangle'; -import ESwName from './ESwName.js'; -import ESwCore from './ESwCore.js'; -import ESwLocal from './ESwLocal.js'; -import ESwLnversion from './ESwLnversion'; -import ELockRect from './ELockRect'; -import EMouse from './EMouse'; - -export default class Switch extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.model = model; - this.style = style; - this.zlevel = model.zlevel; - this.z = 6; - this.triangle = new JTriangle(model.intersection, model.skew); - this.create(); - this.createLockRect(); // 创建单锁矩形框显示 - this.createMouseEvent(); - this.setState(model); - } - - createMouseEvent() { - // 鼠标事件 - if (this.style.Switch.mouseOverStyle) { - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - } - - create() { - const model = this.model; - const style = this.style; - - let halfWidth = style.Section.line.width / 2; - const switchWidth = style.Section.line.width + style.Section.line.beyondWidth * 2 + 0.8; - const swPadding = style.Switch.core.length; - const directx = this.triangle.drictx; - const directy = this.triangle.dricty; - const direct = -this.triangle.drictx * this.triangle.dricty; - const coverLength = switchWidth * 1.5; - - this.swCore = new ESwCore({ - zlevel: this.zlevel, - z: this.z, - style: style, - intersectionX: model.intersection.x, - intersectionY: model.intersection.y, - coverLength: coverLength, - lineWidth: switchWidth, - triangle: this.triangle - }); - - halfWidth += 0.3; - const point1 = [model.intersection.x - directx * halfWidth, model.intersection.y + directy * halfWidth]; - const point2 = [point1[0] + directx * switchWidth / this.triangle.getSinRate(), point1[1]]; - const point3 = [point2[0] + directx * this.triangle.getCotRate() * swPadding, point2[1] + directy * swPadding]; - const point4 = [point3[0] + direct * this.triangle.getSin(switchWidth), point3[1] - direct * this.triangle.getCos(switchWidth)]; - this.locShelter = new ESwLocal({ // 定位 - zlevel: this.zlevel, - z: this.z, - style: style, - shelterPoints: [point1, point2, point3, point4], - cursor: 'pointer', - triangle: this.triangle, - onmouseover: () => { this.name.getArrowText().show(); }, - onmouseout: () => { this.name.getArrowText().hide(); } - }); - - const slen = switchWidth / this.triangle.getSinRate(); - const rpoint1 = [model.intersection.x + directx * halfWidth, model.intersection.y - directy * halfWidth]; - const rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.getCotRate()), rpoint1[1]]; - const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth]; - const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)]; - - const switchWidth1 = style.Section.line.width / 2 + 0.1; - const width1 = switchWidth1 * this.triangle.getSinRate(); - const height1 = switchWidth1 * this.triangle.getCosRate(); - const width2 = (height1 + switchWidth1) / this.triangle.getTanRate(); - const width3 = (style.Section.line.width / this.triangle.getSinRate()) - width2 - width1; - const spoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1]; - const spoint2 = [spoint1[0] - directx * (width2 + width1) - directx * width3, spoint1[1]]; - const spoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1]; - const spoint4 = [spoint1[0] + directx * (width2 + width1) - directx * width3, spoint3[1]]; - - this.relocShelter = new ESwLnversion({ // 反位 - zlevel: this.zlevel, - z: this.z, - style: style, - shelterPoints: [rpoint1, rpoint2, rpoint3, rpoint4], - sectionPoints: [spoint1, spoint2, spoint3, spoint4], - cursor: 'pointer', - halfWidth: halfWidth, - triangle: this.triangle, - onmouseover: () => { this.name.getArrowText().show(); }, - onmouseout: () => { this.name.getArrowText().hide(); } - }); - - this.releaseBackground = new Line({ // 区段上遮盖段 - zlevel: this.zlevel, - z: this.z, - shape: { - x1: model.intersection.x - (coverLength * this.triangle.getCotRate()), - y1: model.intersection.y, - x2: model.intersection.x + (coverLength * this.triangle.getCotRate()), - y2: model.intersection.y - }, - style: { - lineWidth: style.Section.line.width + style.Section.line.beyondWidth + 1, - stroke: style.backgroundColor - } - }); - - const arrowTextX = model.intersection.x + 10; - const arrowTextY = model.intersection.y + 15; - const nameTextX = model.namePosition.x + model.intersection.x + directx * (style.Section.line.width * 3 + style.Switch.text.offset.x) * this.triangle.getCotRate(); - const nameTextY = model.namePosition.y + model.intersection.y + style.Switch.text.offset.y * (style.Switch.text.position || directy); - - this.name = new ESwName({ - zlevel: this.zlevel, - z: this.z, - style: style, - arrowTextX: arrowTextX, - arrowTextY: arrowTextY, - nameTextX: nameTextX, - nameTextY: nameTextY, - sectionName: model.sectionName, - name: model.name, - nameShow: style.Switch.text.show, - triangle: this.triangle - }); - - this.add(this.swCore); // 岔芯link - this.add(this.locShelter); - this.add(this.relocShelter); - this.add(this.releaseBackground); - this.add(this.name); - style.Switch.text.show && model.nameShow ? this.name.show() : this.name.hide(); - } - - createLockRect() { - const offsetX = this.model.locateType == '01' ? 3 : 0; - this.lockRect = new ELockRect({ // 锁定矩形 - zlevel: this.zlevel, - z: this.z + 6, - x: this.model.intersection.x - this.style.Switch.monolock.rectWidth / 2 + offsetX, - y: this.model.intersection.y - this.style.Switch.monolock.rectWidth / 2, - width: this.style.Switch.monolock.rectWidth, - lineWidth: 1.8, - stroke: this.style.Switch.monolock.rectBorderColor, - fill: this.style.transparentColor - }); - this.add(this.lockRect); - this.lockRect.hide(); - } - - /** 名称动画*/ - nameTextAnimation() { - this.name.getNameText().animateStyle(true) - .when(0, { textFill: this.style.backgroundColor }) - .when(1000, { textFill: this.style.Switch.text.lossColor }) - .when(2000, { textFill: this.style.backgroundColor }) - .start(); - - this.name.getTextRect().animateStyle(true) - .when(0, { textFill: this.style.backgroundColor }) - .when(1000, { textFill: this.style.Switch.text.borderColor }) - .when(2000, { textFill: this.style.backgroundColor }) - .start(); - } - - /** 设置岔芯是否隐藏*/ - setSwitchCoreInvisible(invisible) { - if (invisible) { - this.swCore.hide(); - } else { - this.swCore.show(); - } - } - - /** 设置岔芯颜色*/ - setSwitchCoreColor(color) { - this.swCore && this.swCore.setColor(color); - } - - /** 设置道岔文字颜色*/ - setTextColor(color) { - this.name.getNameText().setStyle({textFill: color}); - } - - /** 设置道岔背景颜色*/ - setTextStyle(style) { - this.name.getNameText().setStyle(style); - } - - /** 设置道岔文字边框颜色 (道岔封锁) */ - setHasTextBorder(width) { - this.name.getTextRect().setStyle({lineWidth: width}); - } - - /** 恢复状态*/ - recover() { - this.lockRect.hide(); - this.setSwitchCoreColor(this.style.backgroundColor); - this.name.getNameText().stopAnimation(false); - this.swCore.stopAnimation(false); - this.relocShelter.stopAnimation(false); - this.relocShelter.hide(); - this.releaseBackground.hide(); - this.setHasTextBorder(0); - } - - /** 定位*/ - setLocationAction() { - this.recover(); - this.setSwitchCoreInvisible(true); - this.locShelter.show(); - this.relocShelter.hide(); - this.setTextColor(this.style.Switch.text.locateColor); - } - - /** 反位*/ - setInversionAction() { - this.recover(); - this.setSwitchCoreInvisible(true); - this.setTextColor(this.style.Switch.text.inversionColor); - this.locShelter.hide(); - this.relocShelter.show(); - this.setSectionState(this.relocShelter.getSection(), 'fill', this.model); - } - - /** 失去*/ - setLossAction(nameFlicker) { - this.recover(); - this.locShelter.hide(); - this.relocShelter.hide(); - this.setSwitchCoreInvisible(false); - this.setTextColor(this.style.Switch.text.lossColor); - nameFlicker && this.nameTextAnimation(); - } - - /** 挤叉*/ - setForkAction() { - this.setLossAction(true); - this.swCore.animateStyle(item => { - item.animateStyle(true) - .when(0, { stroke: this.style.backgroundColor }) - .when(1000, { stroke: 'red' }) - .when(2000, { stroke: this.style.backgroundColor }) - .start(); - }); - } - - /** 空闲*/ - spare() { - } - - /** 单锁*/ - setMonolock() { - if (this.style.Switch.monolock.rectShow) { // 判断单锁矩形是否显示 - this.lockRect.show(); - } - switch (this.model.locateType) { - case '01': // 定位 - this.setTextColor(this.style.Switch.monolock.locationColor); // 设置道岔名称颜色 - break; - case '02': // 反位 - this.setTextColor(this.style.Switch.monolock.inversionColor); // 设置道岔名称颜色 - break; - } - } - - /** 封锁 */ - block() { - if (this.style.Switch.block.nameBorderShow) { - this.setHasTextBorder(1); - } else if (this.style.Switch.block.contentRectShow) { - this.lockRect.show(); - this.lockRect.setStyle({stroke: this.style.Switch.block.contentRectColor}); - } - } - - /** 延时释放*/ - timeRelease() { - this.setSwitchCoreInvisible(true); - this.releaseBackground.show(); - } - - /** 设置道岔切除*/ - setSwitchCutOff() { - this.setSwitchCoreInvisible(true); - switch (this.model.locateType) { - case '01': - this.releaseBackground.hide(); - break; - case '02': - this.relocShelter && this.relocShelter.getSection().animateStyle(true) - .when(1000, { fill: this.style.backgroundColor }) - .start(); - break; - } - } - - sectionCutOff(section) { - const lineWidth = this.style.Section.line.width + (this.model.sectionAstatus != '01' ? this.style.Section.line.beyondWidth : 0); - if (section) { - section.animateStyle(true, [ - { time: 0, styles: { lineWidth: lineWidth } }, - { time: 1000, styles: { stroke: this.style.backgroundColor } }, - { time: 2000, styles: { lineWidth: lineWidth } } - ]); - } - } - - setSectionState(section, style, state) { - if (section && !section.animators.length) { - switch (state.sectionAstatus) { - case '00': break; - case '01': /** 空闲*/ - section.setStyle(style, this.style.Section.line.spareColor); - break; - case '02': /** 通信车占用*/ - section.setStyle(style, this.style.Section.line.communicationOccupiedColor); - break; - case '03': /** 非通信车占用*/ - section.setStyle(style, this.style.Section.line.unCommunicationOccupiedColor); - break; - case '04': /** 进路锁闭*/ - section.setStyle(style, this.style.Section.line.routeLockColor); - break; - case '05': /** 故障锁闭*/ - section.setStyle(style, this.style.Section.line.faultLockColor); - break; - case '06': /** 封锁*/ - section.setStyle(style, this.style.Section.line.blockColor); - break; - case '07': /** ATC切除*/ - section.setStyle(style, this.style.Section.line.atcExcisionColor); - break; - case '08': /** ATS切除*/ - section.setStyle(style, this.style.Section.line.atsExcisionColor); - section.animateStyle(true) - .when(1000, { fill: this.style.backgroundColor }) - .when(2000, { fill: this.style.Section.line.atsExcisionColor }) - .start(); - break; - case '09': /** 进路延续保护 */ - section.setStyle(style, this.style.Section.line.protectiveLockColor); - break; - } - - if (state.cutOff) { - this.sectionCutOff(section); - } - } - - } - - setLocateType(model) { - switch (model.locateType) { - case '01': - this.setLocationAction(); /** 定位*/ - break; - case '02': - this.setInversionAction(); /** 反位*/ - break; - case '03': - this.setLossAction(true); /** 失去*/ - break; - case '04': - this.setForkAction(); /** 挤岔*/ - break; - default: - this.setLocationAction(); - } - } - - setState(model) { - this.setLocateType(model); - - switch (model.status) { - case '01': - this.spare(); /** 空闲*/ - break; - case '10': - this.setMonolock(); /** 单锁*/ - break; - case '13': - this.timeRelease(); /** 延时释放*/ - break; - case '14': - this.block(); /** 封锁*/ - break; - } - - /** 区段切除*/ - if (model.cutOff) { - this.setSwitchCutOff(); - } - } - - getBoundingRect() { - return this.name.getBoundingRect(); - } - - getShapeTipPoint() { - const text = this.name.getNameText(); - if (text) { - const rect = text.getBoundingRect(); - return { - x: rect.x + rect.width / 2, - y: rect.y - }; - } - return null; - } -} diff --git a/src/jmap/shape/Text/index.js b/src/jmap/shape/Text/index.js deleted file mode 100644 index 08b27ddf3..000000000 --- a/src/jmap/shape/Text/index.js +++ /dev/null @@ -1,44 +0,0 @@ -import Text from 'zrender/src/graphic/Text'; -import Group from 'zrender/src/container/Group'; - -export default class Text2 extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.name = model.code; - this.zlevel = model.zlevel; - this.model = model; - this.style = style; - this.z = 6; - this.create(); - this.setState(model); - } - - create() { - var model = this.model; - var [direction, content] = model.content.split('::'); - if (direction == 'V') { - content = content.split('').join('\n'); - } else if (direction != 'H') { - content = model.content; - } - - this.text = new Text({ - zlevel: this.zlevel, - z: this.z, - style: { - x: model.position.x, - y: model.position.y, - text: content, - textFont: model.font, - textFill: model.fontColor, - textAlign: 'middle' - } - }); - this.add(this.text); - } - - setState(model) { - } -} diff --git a/src/jmap/shape/Train/EMouse.js b/src/jmap/shape/Train/EMouse.js deleted file mode 100644 index b4d8d7211..000000000 --- a/src/jmap/shape/Train/EMouse.js +++ /dev/null @@ -1,66 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; -import LangStorage from '@/utils/lang'; - -class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.create(); - } - create() { - let destinationText = ''; - switch (this.device.model.destinationStatus) { - case '01': destinationText = LangStorage.getLang() == 'en' ? 'on time' : '准点'; break; - case '02': destinationText = LangStorage.getLang() == 'en' ? 'early' : '早点'; break; - case '03': destinationText = LangStorage.getLang() == 'en' ? 'early seriously' : '严重早点'; break; - case '04': destinationText = LangStorage.getLang() == 'en' ? 'late' : '晚点'; break; - case '05': destinationText = LangStorage.getLang() == 'en' ? 'late seriously ' : '严重晚点'; break; - default: destinationText = LangStorage.getLang() == 'en' ? 'unknown' : '未知'; break; - } - let trainType = ''; - switch (this.device.model.type) { - case '01': trainType = LangStorage.getLang() == 'en' ? 'Plan the car' : '计划车'; break; - case '02': trainType = LangStorage.getLang() == 'en' ? 'Head size car' : '头码车'; break; - case '03': trainType = LangStorage.getLang() == 'en' ? 'Artificial car' : '人工车'; break; - default: trainType = LangStorage.getLang() == 'en' ? 'unknown' : '未知'; break; - } - let text = ''; - if (LangStorage.getLang() == 'en') { - text = ` The planned train: ${trainType} \n Table No.: ${this.device.model.serviceNumber} \n Train Trip No.: ${this.device.model.tripNumber}\n Destination: ${this.device.model.targetCode ? this.device.model.targetCode : ''}\n Train No.: ${this.device.model.groupNumber}\n Early or late: ${destinationText}\n Direction: ${this.device.model.directionType == '02' ? 'up' : 'down'}\n Crew No.: \n Start Station: \n Terminal Station: \n Occupied Track: ${this.device.model.sectionModel ? this.device.model.sectionModel.name : ''}\n Current Station: \n Train-ground communication: normal \n Operation Speed level: 4 \n Detained: ${this.device.model.runControlStatus == '01' ? 'Normal' : this.device.model.runControlStatus == '03' ? 'Skip to continue moving' : 'Detained'}\n Stationary: ${this.device.model.runStatus == '02' ? 'No' : 'Yes'}\n Blocked: No \n Speed: ${this.device.model.speed || 0} km/h \n Authorized Distance: ${this.device.model.maLen || 0} m`; - } else { - text = `列车类型: ${trainType} \n表\0\0\0\0号: ${this.device.model.serviceNumber}\n车\0次\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.targetCode ? this.device.model.targetCode : ''}\n车\0组\0号: ${this.device.model.groupNumber}\n早\0晚\0点: ${destinationText}\n运行方向: ${this.device.model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${this.device.model.sectionModel ? this.device.model.sectionModel.name : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${this.device.model.runControlStatus == '01' ? '正常' : this.device.model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${this.device.model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${this.device.model.speed || 0} km/h\n列车移动授权距离: ${this.device.model.maLen || 0} m`; - } - // 文字描述 - this.arrowText = new Text({ - zlevel: this.device.model.zlevel, - z: this.device.model.z + 10, - style: { - x: this.device.model.point.x + 50, - y: this.device.model.point.y + 25, - text: text, - textFill: '#000', - textAlign: 'letf', - textFont: 10 + 'px consolas', - textPadding: 3, - textBackgroundColor: this.device.model.style.tipBackgroundColor - } - }); - this.add(this.arrowText); - this.arrowText.hide(); - } - - mouseover() { - this.device.deviceModel.down = true; - this.arrowText.show(); - } - - mouseout() { - if (this.device.deviceModel.down) { - this.arrowText.hide(); - this.device.deviceModel.down = false; - } - } - -} -export default EMouse; diff --git a/src/jmap/shape/Train/TrainBody.js b/src/jmap/shape/Train/TrainBody.js deleted file mode 100644 index 559d56f6a..000000000 --- a/src/jmap/shape/Train/TrainBody.js +++ /dev/null @@ -1,240 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import TrainBodyBox from './TrainBodyBox'; -import '../StationStand/EDetain'; -import ETextName from '../element/ETextName'; // 名称文字 (共有) -import EMouse from './EMouse'; -import store from '@/store/index_APP_TARGET'; - -/** 车身*/ -export default class TrainBody extends Group { - constructor(model) { - super(); - this.model = model; - this.deviceModel = model.model; - this.nameFormat = model.nameFormat; - this.create(); - this.createMouse(); // 鼠标事件 - } - - createMouse() { - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - if (this.deviceModel.down) { - store.dispatch('map/setTrainDetails', this.deviceModel); - this.mouseEvent.mouseover(); - } - - this.on('mouseover', () => { - store.dispatch('map/setTrainDetails', this.deviceModel); - this.mouseEvent.mouseover(); - }); - this.on('mouseout', () => { - store.dispatch('map/setTrainDetails', null); - this.mouseEvent.mouseout(); - }); - } - - create() { - const model = this.model; - const style = this.model.style; - this.trainBodyBox = new TrainBodyBox({ - zlevel: model.zlevel, - z: model.z, - point: model.point, - style: style - }); - - const beginX = (model.point.x + style.Train.trainBody.lrPadding); - const beginY = (model.point.y - style.Train.hsda.trainHSDATextFontSize - style.Train.hsda.upPaddingHSDA); - const margin = (style.Train.common.trainWidth - style.Train.hsda.lrPaddingHSDA * 2) / 4; - - this.textH = style.Train.common.haveTextHSDA ? new ETextName({ - zlevel: model.zlevel, - z: model.z, - x: parseInt(beginX + margin * 0), - y: parseInt(beginY), - text: style.Train.hsda.textHContent, - textFill: style.trainYellowColor, - fontSize: style.Train.hsda.trainHSDATextFontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'middle', - textVerticalAlign: 'top' - }) : ''; - this.textS = style.Train.common.haveTextHSDA ? new ETextName({ - zlevel: model.zlevel, - z: model.z, - x: parseInt(beginX + margin * 1), - y: parseInt(beginY), - text: style.Train.hsda.textSContent, - textFill: style.trainBlueColor, - fontSize: style.Train.hsda.trainHSDATextFontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'middle', - textVerticalAlign: 'top' - }) : ''; - this.textD = style.Train.common.haveTextHSDA ? new ETextName({ - zlevel: model.zlevel, - z: model.z, - x: parseInt(beginX + margin * 2), - y: parseInt(beginY), - text: style.Train.hsda.textDContent, - textFill: style.trainGreenColor, - fontSize: style.Train.hsda.trainHSDATextFontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'middle', - textVerticalAlign: 'top' - }) : ''; - this.textA = style.Train.common.haveTextHSDA ? new ETextName({ - zlevel: model.zlevel, - z: model.z, - x: parseInt(beginX + margin * 3), - y: parseInt(beginY), - text: style.Train.hsda.textAContent, - textFill: style.trainRedColor, - fontSize: style.Train.hsda.trainHSDATextFontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'middle', - textVerticalAlign: 'top' - }) : ''; - const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || style.Train.trainServer.defaultServiceNumber) + '';// 服务号(表号) - const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode - ? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber) - : model.tripNumber || style.Train.trainTarget.defaultTripNumber) + ''; // 车次号 - const targetCode = style.Train.trainNumber.targetCodePrefix + (model.targetCode || style.Train.trainNumber.defaultTargetCode) + ''; // 目的地码 - const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber) + ''; // 车组号 - this.textTrainServer = new ETextName({ - zlevel: model.zlevel, - z: model.z + 1, - x: parseInt(model.point.x + style.Train.trainServer.trainServerOffset.x), - y: parseInt(model.point.y + style.Train.trainServer.trainServerOffset.y), - text: serviceNumber.substring(serviceNumber.length - style.Train.trainServer.serviceNumberPrefix.length), - textFill: style.trainTextColor, - fontSize: model.fontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'left', - textVerticalAlign: 'top' - }); - this.textTrainTarget = new ETextName({ - zlevel: this.model.zlevel, - z: this.model.z + 1, - x: parseInt(model.point.x + model.style.Train.trainTarget.trainTargetOffset.x), - y: parseInt(model.point.y + model.style.Train.trainTarget.trainTargetOffset.y), - text: tripNumber.substring(tripNumber.length - style.Train.trainTarget.tripNumberPrefix.length), - textFill: style.trainTextColor, - fontSize: model.fontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: style.Train.trainTarget.trainTargetTextAlign, - textVerticalAlign: 'top' - }); - this.textTrainNumber = new ETextName({ - zlevel: model.zlevel, - z: model.z + 1, - x: parseInt(model.point.x + style.Train.trainNumber.trainNumberOffset.x), - y: parseInt(model.point.y + style.Train.trainNumber.trainNumberOffset.y), - text: targetCode.substring(targetCode.length - 3), - textFill: style.trainTextColor, - textStroke: style.trainTextColor, - fontWeight: 400, - textStrokeWidth: 0, - fontSize: model.fontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'left', - textVerticalAlign: 'top' - }); - this.textTrainTargetNumber = new ETextName({ - zlevel: model.zlevel, - z: model.z + 1, - x: parseInt(model.point.x - style.Train.trainBody.lrPadding), - y: parseInt(model.point.y + style.Train.trainBody.upPadding), - text: groupNumber.substring(groupNumber.length - 3), - textFill: style.trainTextColor, - textStroke: style.trainTextColor, - textStrokeWidth: 0, - fontSize: model.fontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'left', - textVerticalAlign: 'top' - }); - this.formatChangePosition(model, style); - this.add(this.trainBodyBox); - if (style.Train.common.haveTextHSDA) { - this.add(this.textH); - this.add(this.textS); - this.add(this.textD); - this.add(this.textA); - } - } - - removeTrainDetail() { - this.mouseEvent.mouseout(); - store.dispatch('map/setTrainDetails', null); - this.deviceModel.down = false; - } - setTrainColor(color) { - this.trainBodyBox && this.trainBodyBox.setStyle('fill', color); - } - setTextTrainServerColor(color) { - this.textTrainServer && this.textTrainServer.setStyle('textFill', color); - this.textTrainServer && this.textTrainServer.setStyle('textStroke', color); - } - setTextTrainTargetColor(color) { - this.textTrainTarget && this.textTrainTarget.setStyle('textFill', color); - this.textTrainTarget && this.textTrainTarget.setStyle('textStroke', color); - } - setTextTrainNumberColor(color) { - this.textTrainNumber && this.textTrainNumber.setStyle('textFill', color); - this.textTrainNumber && this.textTrainNumber.setStyle('textStroke', color); - } - setTextTrainTargetNumberColor(color) { - this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle('textFill', color); - this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle('textStroke', color); - } - setHShow(isShow) { - if (this.textH) { - isShow ? this.textH.show() : this.textH.hide(); - } - } - setSShow(isShow) { - if (this.textS) { - isShow ? this.textS.show() : this.textS.hide(); - } - } - setDShow(isShow) { - if (this.textD) { - isShow ? this.textD.show() : this.textD.hide(); - } - } - setAShow(isShow) { - if (this.textA) { - isShow ? this.textA.show() : this.textA.hide(); - } - } - setBodyBoxShape(key, color) { - this.trainBodyBox && this.trainBodyBox.setColor(key, color); - } - formatChangePosition(model, style) { - if (this.nameFormat) { - const arr = this.nameFormat.split(':'); - let widthText = 0; - arr.forEach(ele => { - if (ele == 'targetCode') { - this.textTrainNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) ); - widthText += this.textTrainNumber.getBoundingRect().width; - this.add(this.textTrainNumber); - } else if (ele == 'serviceNumber') { - this.textTrainServer.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); - widthText += this.textTrainServer.getBoundingRect().width; - this.add(this.textTrainServer); - } else if (ele == 'tripNumber') { - this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); - widthText += this.textTrainTarget.getBoundingRect().width; - this.add(this.textTrainTarget); - } else if (ele == 'groupNumber') { - this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); - widthText += this.textTrainTargetNumber.getBoundingRect().width; - this.add(this.textTrainTargetNumber); - } - }); - } - } -} diff --git a/src/jmap/shape/Train/TrainBodyBox.js b/src/jmap/shape/Train/TrainBodyBox.js deleted file mode 100644 index d3e442232..000000000 --- a/src/jmap/shape/Train/TrainBodyBox.js +++ /dev/null @@ -1,33 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Rect from 'zrender/src/graphic/shape/Rect'; - -export default class TrainBodyBox extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - create() { - const model = this.model; - this.trainBodyBox = new Rect({ - zlevel: model.zlevel, - z: model.z, - shape: { - x: model.point.x, - y: model.point.y, - width: model.style.Train.common.trainWidth, - height: model.style.Train.common.trainHeight - }, - style: { - lineWidth: model.style.Train.trainBody.trainBodyLineWidth, - stroke: model.style.trainSidelineColor, - fill: model.style.Train.trainBody.trainBodyFillColor - }, - cursor: 'pointer' - }); - this.add(this.trainBodyBox); - } - setColor(key, color) { - this.trainBodyBox.setStyle(key, color); - } -} diff --git a/src/jmap/shape/Train/TrainHead.js b/src/jmap/shape/Train/TrainHead.js deleted file mode 100644 index feea74c7c..000000000 --- a/src/jmap/shape/Train/TrainHead.js +++ /dev/null @@ -1,61 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Rect from 'zrender/src/graphic/shape/Rect'; -import Polygon from 'zrender/src/graphic/shape/Polygon'; - -/** 车头*/ -export default class TrainHead extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } - create() { - const model = this.model; - const style = this.model.style; - const baseMargin = (model.drect === -1 ? 1 : 0); - this.line = new Rect({ - zlevel: model.zlevel, - z: model.z, - shape: { - x: model.point.x - baseMargin * (style.Train.trainHead.trainConntWidth), - y: model.point.y, - width: style.Train.trainHead.trainConntWidth * model.scale, - height: style.Train.trainHead.trainHeadRectHeight - }, - style: { - lineWidth: 0.1, - stroke: style.trainSidelineColor, - fill: style.Train.trainHead.trainHeadFillColor - } - }); - this.arrow = new Polygon({ - zlevel: model.zlevel, - z: model.z, - shape: { - points: [ - [model.point.x + model.drect * (style.Train.trainHead.trainHeadTriangleFirst.x), model.point.y + style.Train.trainHead.trainHeadTriangleFirst.y], - [model.point.x + model.drect * (style.Train.trainHead.trainHeadTriangleSecond.x), model.point.y + style.Train.trainHead.trainHeadTriangleSecond.y], - [model.point.x + model.drect * (style.Train.trainHead.trainHeadTriangleThird.x), model.point.y + style.Train.trainHead.trainHeadTriangleThird.y] - ] - }, - style: { - lineWidth: 0.1, - stroke: style.trainSidelineColor, - fill: style.Train.trainHead.trainHeadFillColor - } - }); - - this.add(this.line); - this.add(this.arrow); - } - setColor(color) { - this.line && this.line.setStyle('fill', color); - this.arrow && this.arrow.setStyle('fill', color); - } - setLineShow(isShow) { - isShow ? this.line.show() : this.line.hide(); - } - setArrowShow(isShow) { - isShow ? this.arrow.show() : this.arrow.hide(); - } -} diff --git a/src/jmap/shape/Train/index.js b/src/jmap/shape/Train/index.js deleted file mode 100644 index 2c526caa9..000000000 --- a/src/jmap/shape/Train/index.js +++ /dev/null @@ -1,409 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import TrainHead from './TrainHead'; -import TrainBody from './TrainBody'; -import BoundingRect from 'zrender/src/core/BoundingRect'; -import Rect from 'zrender/src/graphic/shape/Rect'; - -/** 列车 */ -export default class Train extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.model = model; - this.style = style; - this.z = 40; - this.size = 0; - this.section = null; - this.fontSize = style.Train.common.useSelfText ? style.Train.common.nameFontSize || style.Train.common.trainTextFontSize : model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize; - this.newScale = this.fontSize / style.Train.common.trainTextFontSize; - this.nameFormat = style.Train.common.useSelfFormat ? style.Train.trainBody.trainNameFormat : model.nameFormat || style.Train.trainBody.trainNameFormat; - if ( style.Train.trainBody.specialTrainType.length > 0) { - style.Train.trainBody.specialTrainType.some((item) =>{ - if (model.type === item.type) { - this.nameFormat = item.nameFormat; - model.serviceNumber = item.serviceNumber ? item.serviceNumber : model.serviceNumber; - return true; - } - }); - } - this.create(); - this.setState(model); - } - - _computed() { - const model = this.model; - const style = this.style; - if (model.trainWindowModel) { - this.point = { - x: model.trainWindowModel.point.x, - y: model.trainWindowModel.point.y - }; - switch (model.directionType) { - case '01': // 未知方向 - this.point.x = this.point.x + model.trainWindowModel.width / 2 + Math.abs((style.Train.common.trainWidth - model.trainWindowModel.width) / 2); - break; - case '02': // 从左向右 - this.point.x = this.point.x + model.trainWindowModel.width / 2 - style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth; - break; - case '03': // 从右向左 - this.point.x = this.point.x - model.trainWindowModel.width / 2 + style.Train.trainHead.trainConntWidth * this.newScale; - break; - } - } else { - this.point = model.position; - this.traingle = null; - } - } - create() { - this._computed(); - this.isChangeTrainWidth(this.model, this.style); - const model = this.model; - const style = this.style; - if (this.point) { - this.trainB = new TrainBody({ - zlevel: this.zlevel, - z: this.z, - style: style, - point: this.point, - destinationStatus: model.destinationStatus, - serviceNumber: model.serviceNumber, - tripNumber: model.tripNumber, - targetCode: model.targetCode, - groupNumber: model.groupNumber, - directionType: model.directionType, - directionCode: model.directionCode, - sectionModel: model.sectionModel, - runControlStatus: model.runControlStatus, - runStatus: model.runStatus, - fontSize: this.fontSize, - nameFormat: this.nameFormat, - type: model.type, - speed: model.speed, - maLen: model.maLen, - model: model - }); - this.trainL = new TrainHead({ - style: style, - zlevel: this.zlevel, - z: this.z, - point: { - x: this.point.x - style.Train.common.trainHeadDistance, - y: this.point.y - }, - drect: -1, - scale: this.newScale - }); - - this.trainR = new TrainHead({ - style: style, - zlevel: this.zlevel, - z: this.z, - point: { - x: this.point.x + style.Train.common.trainWidth + style.Train.common.trainHeadDistance, - y: this.point.y - }, - drect: 1, - scale: this.newScale - }); - - this.add(this.trainB); - this.add(this.trainL); - this.add(this.trainR); - } - if (style.Train.common.haveTrainBorder) { - this.createTrainBorder(); - } - } - - // 获取设备提示坐标 - getShapeTipPoint() { - } - - // 恢复颜色状态 - recover() { - this.trainB && this.trainB.setHShow(false); - this.trainB && this.trainB.setSShow(false); - this.trainB && this.trainB.setDShow(false); - this.trainB && this.trainB.setAShow(false); - - this.trainL && this.trainL.setLineShow(false); - this.trainR && this.trainR.setLineShow(false); - this.trainL && this.trainL.setArrowShow(false); - this.trainR && this.trainR.setArrowShow(false); - } - - // 设置服务号状态类型 - setServerNoType(type) { - if (this.style.Train.trainStatusStyle.serverNoType.length > 0) { - const flag = this.style.Train.trainStatusStyle.serverNoType.some((item) =>{ - if (type === item.type) { - this.trainB && this.trainB.setTextTrainServerColor(item.showColor); - return true; - } - }); - if (this.style.Train.trainStatusStyle.defaultServerNoColor && !flag) { - this.trainB && this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultServerNoColor); - } - } - } - - // 设置目的地状态 - setDestinationStatus(status) { - if (this.style.Train.trainStatusStyle.destinationStatus.length > 0) { - const flag = this.style.Train.trainStatusStyle.destinationStatus.some((item) =>{ - if (status === item.status) { - switch (this.style.Train.trainStatusStyle.destinationStatusSetText) { - case 'trainTarget': - this.trainB && this.trainB.setTextTrainTargetColor(item.showColor); - break; - case 'trainServer': - this.trainB && this.trainB.setTextTrainServerColor(item.showColor); - break; - case 'trainWindowBorder': - this.trainB && this.trainB.setBodyBoxShape('stroke', item.showColor); - break; - default: - this.trainB && this.trainB.setTextTrainTargetColor(item.showColor); - } - return true; - } - }); - if (this.style.Train.trainStatusStyle.defaultDestinationColor && !flag) { - switch (this.style.Train.trainStatusStyle.destinationStatusSetText) { - case 'trainTarget': - this.trainB && this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor); - break; - case 'trainServer': - this.trainB && this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultDestinationColor); - break; - case 'trainWindowBorder': - this.trainB && this.trainB.setBodyBoxShape('stroke', this.style.Train.trainStatusStyle.defaultDestinationColor); - break; - default: - this.trainB && this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor); - } - } - } - } - - // 设置运行方向状态类型 - setDirectionType(type, flag) { - if (this.style.Train.trainStatusStyle.directionType.length > 0) { - this.style.Train.trainStatusStyle.directionType.forEach((item) => { - if (type === item.type) { - let lineLShow = item.lineLShow; - let arrowLShow = item.arrowLShow; - let lineRShow = item.lineRShow; - let arrowRShow = item.arrowRShow; - if (flag) { - lineLShow = !item.lineLShow; - arrowLShow = !item.arrowLShow; - lineRShow = !item.lineRShow; - arrowRShow = !item.arrowRShow; - } - this.trainL && this.trainL.setLineShow(lineLShow); - this.trainL && this.trainL.setArrowShow(arrowLShow); - this.trainR && this.trainR.setLineShow(lineRShow); - this.trainR && this.trainR.setArrowShow(arrowRShow); - return true; - } - }); - } - } - // 设置列车停止方向类型 - setDirectionStopType(type) { - if (this.style.Train.trainStatusStyle.directionStopType.length > 0) { - this.style.Train.trainStatusStyle.directionStopType.forEach((item) => { - if (type === item.type) { - this.trainL && this.trainL.setLineShow(item.lineLShow); - this.trainR && this.trainR.setLineShow(item.lineRShow); - return true; - } - }); - } - } - // 设置运行状态 - setRunStatus(status, flag) { - switch (status) { - case '01': // 停止 - this.setDirectionStopType(this.model.directionType); // 设置运行方向状态类型 - break; - case '02': // 运行 - this.setDirectionType(this.model.directionType, flag); // 设置运行方向状态类型 - break; - } - - } - // 设置运行模式 - setRunMode(status) { - if (this.style.Train.trainStatusStyle.runModeStatus.length > 0) { - this.style.Train.trainStatusStyle.runModeStatus.some((item) => { - if (status === item.status) { - this.trainL && this.trainL.setColor(item.trainLColor); - this.trainR && this.trainR.setColor(item.trainRColor); - return true; - } - }); - } - } - // 设置运行控制状态类型 - setRunControlStatus(status) { - if (this.style.Train.trainStatusStyle.runControlStatus.length > 0) { - this.style.Train.trainStatusStyle.runControlStatus.some((item) => { - if (status === item.status) { - this.trainB && this.trainB.setHShow(item.hShow); - this.trainB && this.trainB.setSShow(item.sShow); - return true; - } - }); - } - } - // 设置车门状态类型 - setDoorStatus(status) { - if (this.style.Train.trainStatusStyle.doorStatus.length > 0) { - this.style.Train.trainStatusStyle.doorStatus.some((item) => { - if (status === item.status) { - this.trainB && this.trainB.setDShow(item.dShow); - return true; - } - }); - } - } - // 设置通信状态类型 - setCommunicationStatus() { - if (this.style.Train.trainStatusStyle.communicationStatus.length > 0) { - this.style.Train.trainStatusStyle.communicationStatus.some((item) => { - if (status === item.status) { - this.trainB && this.trainB.setTrainColor(item.trainColor); - return true; - } - }); - } - } - // 设置报警状态 - setAlarmStatus(status) { - if (this.style.Train.trainStatusStyle.alarmStatus.length > 0) { - this.style.Train.trainStatusStyle.alarmStatus.some((item) => { - if (status === item.status) { - this.trainB && this.trainB.setAShow(item.aShow); - return true; - } - }); - } - } - setTrainTypeStatus(type) { - if (this.style.Train.trainStatusStyle.trainTypeStatus) { - this.style.Train.trainStatusStyle.trainTypeStatus.some((item) => { - if ( type === item.type) { - item.serviceNumberColor && this.trainB && this.trainB.setTextTrainServerColor(item.serviceNumberColor); - item.trainNumberColor && this.trainB && this.trainB.setTextTrainNumberColor(item.trainNumberColor); - item.trainTargetColor && this.trainB && this.trainB.setTextTrainTargetColor(item.trainTargetColor); - item.groupNumberColor && this.trainB && this.trainB.setTextTrainTargetNumberColor(item.groupNumberColor); - } - }); - } - } - // 设置状态 - setState(model) { - this.model = model; - // let points = []; - const flag = false; - // if (this.model.sectionModel && this.model.sectionModel.points) { - // points = this.model.sectionModel.points; - // if (points.length) { - // const pointFlag = points[0].x - points[points.length - 1].x; - // if (pointFlag > 0) { - // flag = true; // 方向去反 - // } - // } - // } - if (model) { - this.recover(); - this.setServerNoType(model.serverNoType); // 设置服务号状态类型 - this.setDestinationStatus(model.destinationStatus); // 设置目的地状态 - this.setRunStatus(model.runStatus, flag); // 设置运行状态 - this.setRunMode(model.runMode); // 设置运行模式 - this.setRunControlStatus(model.runControlStatus); // 设置运行控制状态类型 - this.setDoorStatus(model.doorStatus); // 设置车门状态类型 - this.setCommunicationStatus(model.communicationStatus); // 设置通信状态类型 - this.setAlarmStatus(model.alarmStatus); // 设置报警状态 - this.setTrainTypeStatus(model.type); // 根据列车类型设置列车识别号样式 - } - } - // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 - isChangeTrainWidth(model, style) { - if (!style.Train.trainBody.changeTrainWidth) { return; } - if (this.nameFormat) { - const arr = this.nameFormat.split(':'); - arr.forEach(ele => { - switch (ele) { - case 'targetCode': { - this.size += (style.Train.trainNumber.targetCodePrefix || '').length; - break; - } - case 'serviceNumber': { - this.size += (style.Train.trainServer.serviceNumberPrefix || '').length; - break; - } - case 'tripNumber': { - this.size += (style.Train.trainTarget.tripNumberPrefix || '').length; - break; - } - case 'groupNumber': { - this.size += (style.Train.trainTargetNumber.groupNumberPrefix || '').length; - break; - } - } - }); - } else { - this.size = 9; - } - this.style.Train.common.trainWidth = this.size * this.fontSize * this.style.Train.common.aspectRatio + this.style.Train.common.trainWidthMoreText; - } - removeTrainDetail() { - this.trainB && this.trainB.removeTrainDetail(); - } - - getBoundingRect() { - const list = [this.trainB, this.trainL, this.trainR]; - let rect = null; - - list.forEach(elem => { - if (elem) { - const tempRect = elem.getBoundingRect(); - if (tempRect.x && tempRect.y && tempRect.width && tempRect.height) { - if (rect) { - rect.union(tempRect); - } else { - rect = tempRect; - } - } - } - }); - - return rect || new BoundingRect(0, 0, 0, 0); - } - createTrainBorder() { - const rect = Object.assign({}, this.getBoundingRect()); - rect.x -= this.style.Train.common.trainWidth / 2; - rect.y -= 5; - rect.width += this.style.Train.common.trainWidth; - rect.height += 10; - - this.trainBorder = new Rect({ - zlevel: this.zlevel, - z: this.z, - silent: true, - shape: rect, - style: { - lineDash: [3, 3], - stroke: this.style.borderColor, - fill: this.style.transparentColor - } - }); - - this.add(this.trainBorder); - } -} diff --git a/src/jmap/shape/TrainWindow/EMouse.js b/src/jmap/shape/TrainWindow/EMouse.js deleted file mode 100644 index d059089c0..000000000 --- a/src/jmap/shape/TrainWindow/EMouse.js +++ /dev/null @@ -1,37 +0,0 @@ -export default class EMouse { - constructor(device) { - this.device = device; - } - - mouseover(e) { - if (this.device.prdType) { - this.device.setVisible(true); - const instance = this.device.getInstanceByCode(this.device.model.sectionCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseover) { - instance.mouseEvent.mouseEnter(e); - } - } - } - - mouseout(e) { - if (this.device.prdType) { - this.device.setVisible(false || this.device.model.trainWindowShow); - const instance = this.device.getInstanceByCode(this.device.model.sectionCode); - if (instance && instance.mouseEvent && instance.mouseEvent.mouseout) { - instance.mouseEvent.mouseLeave(e); - } - } - } - - mouseEnter(e) { - if (this.device.prdType) { - this.device.setVisible(true); - } - } - - mouseLeave(e) { - if (this.device.prdType ) { - this.device.setVisible(false); - } - } -} diff --git a/src/jmap/shape/TrainWindow/index.js b/src/jmap/shape/TrainWindow/index.js deleted file mode 100644 index 3403d39df..000000000 --- a/src/jmap/shape/TrainWindow/index.js +++ /dev/null @@ -1,83 +0,0 @@ -/* 车次窗*/ -import Polygon from 'zrender/src/graphic/shape/Polygon'; -import Group from 'zrender/src/container/Group'; -import EMouse from './EMouse'; -import store from '@/store/index_APP_TARGET'; - -class TrainWindow extends Group { - constructor(model, style) { - super(); - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.model = model; - this.style = style; - this.z = 9; - this.prdType = store.state.training.prdType; - this.create(model); - this.createMouseEvent(); - this.setState(model); - } - create(model) { - if (this.prdType !== '01') { - this.createTrainWindow(); - } - } - - createMouseEvent() { - this.mouseEvent = new EMouse(this); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - - /** 创建车次窗*/ - createTrainWindow() { - const model = this.model; - const point = model.point || model.position; - this.trainRect = new Polygon({ - _subType: 'TrainWindow', - zlevel: this.zlevel, - z: this.z - 1, - shape: { - smooth: this.style.TrainWindow.trainWindowSmooth, - points: [ - [point.x - model.width / 2, point.y], - [point.x + model.width / 2, point.y], - [point.x + model.width / 2, point.y + model.height], - [point.x - model.width / 2, point.y + model.height] - ] - }, - style: { - lineDash: this.style.TrainWindow.lineDash, - lineWidth: this.style.TrainWindow.lineWidth, - stroke: this.style.TrainWindow.lineColor, - fill: this.style.transparentColor - } - }); - this.add(this.trainRect); - } - - isPop(e) { - for (var i = 0; i < this.childCount(); i++) { - var rect = this.childAt(i).getBoundingRect(); - if (rect.contain(e.offsetX, e.offsetY) && this.childAt(i).pop) { - return true; - } - } - } - - setState(model) { - this.setVisible(model.trainWindowShow); - } - - setVisible(show) { - this.trainRect && this.trainRect.setStyle('lineWidth', show ? 1 : 0); - - } - - getInstanceByCode(code) { - return (store.getters['map/getDeviceByCode'](code) || {}).instance; - } -} - -export default TrainWindow; diff --git a/src/jmap/shape/ZcControl/EMouse.js b/src/jmap/shape/ZcControl/EMouse.js deleted file mode 100644 index 0855053f9..000000000 --- a/src/jmap/shape/ZcControl/EMouse.js +++ /dev/null @@ -1,54 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -export default class EMouse extends Group { - constructor(device) { - super(); - this.device = device; - this.create(); - } - create() { - this.text = new Text({ - _subType: 'Text', - zlevel: this.device.zlevel, - z: this.device.z+1, - position: [0, 0], - style: { - x: this.device.model.position.x, - y: this.device.model.position.y + this.device.style.ZcControl.lamp.radiusR + this.device.style.ZcControl.text.distance-30, - fontWeight: this.device.style.ZcControl.mouseOverStyle.fontWeight, - fontSize: this.device.style.ZcControl.mouseOverStyle.fontSize, - fontFamily: this.device.style.ZcControl.mouseOverStyle.fontFormat, - text: this.device.model.name, - textFill: this.device.style.ZcControl.mouseOverStyle.fontColor, - textAlign: this.device.style.ZcControl.mouseOverStyle.textAlign, - textVerticalAlign: this.device.style.ZcControl.mouseOverStyle.textVerticalAlign - } - }); - this.add(this.text); - this.text.hide(); - } - mouseover(e) { - if (e.target && e.target._subType == 'Text') { - this.text.show(); - } else { - this.device.control.setControlColor(this.device.style.ZcControl.mouseOverStyle.arcColor); - this.device.control.setTextColor(this.device.style.ZcControl.mouseOverStyle.textColor); - this.device.control.setTextBorder(true); - this.device.control.setArcBorder(true); - } - } - - mouseout(e) { - if (!this.device.model.down) { - if (e.target && e.target._subType == 'Text') { - this.text.hide(); - } else { - this.device.control.setControlColor(this.device.style.ZcControl.lamp.controlColor); - this.device.control.setTextColor('#FFFFFF'); - this.device.control.setTextBorder(false); - this.device.control.setArcBorder(false); - } - } - } -} diff --git a/src/jmap/shape/ZcControl/index.js b/src/jmap/shape/ZcControl/index.js deleted file mode 100644 index 425016973..000000000 --- a/src/jmap/shape/ZcControl/index.js +++ /dev/null @@ -1,80 +0,0 @@ -/* -* ZC区域控制模式 -*/ -import Group from 'zrender/src/container/Group'; -import EControl from '../element/EControl'; -import EMouse from './EMouse'; - -export default class ZcControl extends Group { - constructor(model, style) { - super(); - this.z = 20; - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.model = model; - this.style = style; - this.create(model); - this.createMouseEvent(); - this.setState(model); - - } - - create(model) { - this.control = new EControl({ - zlevel: this.zlevel, - z: this.z, - arc: { - shape: { - cx: model.position.x, - cy: model.position.y, - r: this.style.ZcControl.lamp.radiusR - }, - lineWidth: 0, - fill: this.style.ZcControl.lamp.controlColor, - mouseover: this.mouseoverArc, - mouseout: this.mouseoutArc - }, - text: { - position: [0, 0], - x: model.position.x, - y: model.position.y + this.style.ZcControl.lamp.radiusR + this.style.ZcControl.text.distance, - fontWeight: this.style.ZcControl.text.fontWeight, - fontSize: this.style.ZcControl.text.fontSize, - fontFamily: this.style.fontFamily, - text: model.name, - textFill: '#fff', - textAlign: 'middle', - textVerticalAlign: 'top', - mouseover: this.mouseoverText, - mouseout: this.mouseoutText - }, - style: this.style - }); - - this.add(this.control); - } - - // 设置状态 - setState(model) { - } - createMouseEvent() { - if (this.style.ZcControl.mouseOverStyle) { - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - } - getShapeTipPoint() { - if (this.control) { - var distance = 2; - var rect = this.control.getBoundingRect(); - return { - x: rect.x + rect.width / 2, - y: rect.y - distance - }; - } - return null; - } -} diff --git a/src/jmap/shape/checkBox/checkBox.js b/src/jmap/shape/checkBox/checkBox.js deleted file mode 100644 index 55ad94de6..000000000 --- a/src/jmap/shape/checkBox/checkBox.js +++ /dev/null @@ -1,46 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Rect from 'zrender/src/graphic/shape/Rect'; - -export default class checkBox extends Group { - constructor(model, style) { - super(); - this.model = model; - this._type = model._type; - this._code = model.code; - this.zlevel = model.zlevel; - this.z = model.z; - this.create(); - } - - create() { - const model = this.model; - this.grouper = new Group({ - id: model.code, - position: [model.point.x, model.point.y] - }); - this.box = new Rect({ - zlevel: model.zlevel, - z: model.z, - draggable: false, - shape: { - x: 0, - y: 0, - width: this.model.width, - height: this.model.height - }, - style: { - fill: 'rgb(135,206,250,0.2)' - } - }); - this.grouper.add(this.box); - this.add(this.grouper); - } - setModel(dx, dy) { - this.model.point.x += dx; - this.model.point.y += dy; - } - setSize(width, height) { - this.model.width = width; - this.model.height = height; - } -} diff --git a/src/jmap/shape/element/EControl.js b/src/jmap/shape/element/EControl.js deleted file mode 100644 index 650411dff..000000000 --- a/src/jmap/shape/element/EControl.js +++ /dev/null @@ -1,106 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Arc from 'zrender/src/graphic/shape/Arc'; -import Text from 'zrender/src/graphic/Text'; -import { createBoundingRect } from '../../utils/parser'; -import Rect from 'zrender/src/graphic/shape/Rect'; - -/** lc zc limit 单灯元素*/ -export default class EControl extends Group { - constructor(model) { - super(); - this.model = model; - this.zlevel = model.zlevel; - this.z = model.z; - this.style = model.style; - this.textStyle = model.text; - this.arcStyle = model.arc; - this.create(); - } - - create() { - this.control = new Arc({ - _subType: 'Control', - zlevel: this.zlevel, - z: this.z, - shape: this.arcStyle.shape, - style: { - lineWidth: this.arcStyle.lineWidth, - fill: this.arcStyle.fill - }, - onmouseover: this.arcStyle.mouseover, - onmouseout: this.arcStyle.mouseout - }); - - this.text = new Text({ - _subType: 'Text', - zlevel: this.zlevel, - z: this.z, - position: this.textStyle.position, - style: { - x: this.textStyle.x, - y: this.textStyle.y, - fontWeight: this.textStyle.fontWeight, - fontSize: this.textStyle.fontSize, - fontFamily: this.textStyle.fontFamily, - text: this.textStyle.text, - textFill: this.textStyle.textFill, - textAlign: this.textStyle.textAlign, - textVerticalAlign: this.textStyle.textVerticalAlign - }, - onmouseover: this.textStyle.mouseover, - onmouseout: this.textStyle.mouseout - }); - const arcRect = this.getArcBoundingRect(); - const textRect = this.getTextBoundingRect(); - this.arcBorder = new Rect({ - zlevel: this.zlevel, - z: this.z, - silent: true, - shape: arcRect, - style: { - lineDash: this.style.arcBorderStyle.lineDash, - stroke: this.style.arcBorderStyle.stroke, - fill: this.style.arcBorderStyle.fill - } - }); - this.textBorder = new Rect({ - zlevel: this.zlevel, - z: this.z-1, - silent: true, - shape: textRect, - style: { - lineDash: this.style.textBorderStyle.lineDash, - stroke: this.style.textBorderStyle.stroke, - fill: this.style.textBorderStyle.fill - } - }); - this.add(this.control); - this.add(this.text); - this.add(this.textBorder); - this.add(this.arcBorder); - this.textBorder.hide(); - this.arcBorder.hide(); - } - setTextBorder(flag) { - flag?this.textBorder.show():this.textBorder.hide(); - } - setArcBorder(flag) { - flag?this.arcBorder.show():this.arcBorder.hide(); - } - getTextBoundingRect() { - return createBoundingRect(this.text); - } - getArcBoundingRect() { - return createBoundingRect(this.control); - } - setControlColor(color) { - if (color) { - this.control.setStyle('fill', color); - } - } - setTextColor(color) { - if (color) { - this.text.setStyle('textFill', color); - } - } -} diff --git a/src/jmap/shape/element/ETextName.js b/src/jmap/shape/element/ETextName.js deleted file mode 100644 index 50bcb9fdc..000000000 --- a/src/jmap/shape/element/ETextName.js +++ /dev/null @@ -1,71 +0,0 @@ -// import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -/** 名称元素*/ -export default function ETextName(model) { - const TextName = new Text({ - _subType: 'Text', - zlevel: model.zlevel, - z: model.z, - silent: model.silent || false, - style: { - x: model.x, - y: model.y, - fontWeight: model.fontWeight, - fontSize: model.fontSize, - fontFamily: model.fontFamily, - text: model.text, - textStrokeWidth: model.textStrokeWidth, - textFill: model.textFill, - textAlign: model.textAlign, - textPosition: model.textPosition || 'inside', - textVerticalAlign: model.textVerticalAlign || null - } - }); - return TextName; -} -// export default class ETextName extends Group { -// constructor(model) { -// super(); -// this.model = model; -// this.zlevel = model.zlevel; -// this.z = model.z; -// this.create(); -// } - -// create() { -// this.TextName = new Text({ -// _subType: this.model._subType, -// zlevel: this.zlevel, -// z: this.z, -// silent: this.model.silent || false, -// style: { -// x: this.model.x, -// y: this.model.y, -// text: this.model.text, -// textFont: this.model.textFont, -// textFill: this.model.textFill, -// textAlign: this.model.textAlign, -// textPosition: this.model.textPosition || 'inside', -// textVerticalAlign: this.model.textVerticalAlign || null -// } -// }); -// this.add(this.TextName); -// } - -// setStyle(model) { -// this.TextName.setStyle(model); -// } - -// setColor(color) { -// this.TextName.setStyle('textFill', color); -// } - -// hide() { -// this.TextName.hide(); -// } - -// show() { -// this.TextName.show(); -// } -// } diff --git a/src/jmap/shape/factory.js b/src/jmap/shape/factory.js deleted file mode 100644 index a19e73986..000000000 --- a/src/jmap/shape/factory.js +++ /dev/null @@ -1,53 +0,0 @@ -import deviceType from '../constant/deviceType'; -import Link from './Link/index.js'; -import Section from './Section/index.js'; -import Signal from './Signal/index.js'; -import Station from './Station/index.js'; -import StationControl from './StationControl/index.js'; -import ImageControl from './ImageControl/index.js'; -import LcControl from './LcControl/index.js'; -import LimitControl from './LimitControl/index.js'; -import Switch from './Switch/index.js'; -import ZcControl from './ZcControl/index.js'; -import ButtonControl from './ButtonControl/index.js'; -import StationCounter from './StationCounter/index.js'; -import StationDelayUnlock from './StationDelayUnlock/index.js'; -import StationStand from './StationStand/index.js'; -import TrainWindow from './TrainWindow/index.js'; -import Train from './Train/index.js'; -import Line from './Line/index.js'; -import Text2 from './Text/index.js'; -import CheckBox from './checkBox/checkBox.js'; - -/** 图库*/ -const mapShape = {}; -mapShape[deviceType.Link] = Link; -mapShape[deviceType.Section] = Section; -mapShape[deviceType.Signal] = Signal; -mapShape[deviceType.Station] = Station; -mapShape[deviceType.StationControl] = StationControl; -mapShape[deviceType.ImageControl] = ImageControl; -mapShape[deviceType.LcControl] = LcControl; -mapShape[deviceType.LimitControl] = LimitControl; -mapShape[deviceType.Switch] = Switch; -mapShape[deviceType.ZcControl] = ZcControl; -mapShape[deviceType.ButtonControl] = ButtonControl; -mapShape[deviceType.StationCounter] = StationCounter; -mapShape[deviceType.StationDelayUnlock] = StationDelayUnlock; -mapShape[deviceType.StationStand] = StationStand; -mapShape[deviceType.TrainWindow] = TrainWindow; -mapShape[deviceType.Train] = Train; -mapShape[deviceType.Line] = Line; -mapShape[deviceType.Text] = Text2; -mapShape[deviceType.CheckBox] = CheckBox; - -function shapefactory(device, jmap) { - const type = device._type; - const shape = mapShape[type]; - if (shape instanceof Function) { - // eslint-disable-next-line - return new shape(device, jmap.style); - } -} - -export default shapefactory; diff --git a/src/jmap/shape/utils/ShapePoints.js b/src/jmap/shape/utils/ShapePoints.js deleted file mode 100644 index ffba459d6..000000000 --- a/src/jmap/shape/utils/ShapePoints.js +++ /dev/null @@ -1,102 +0,0 @@ -import Path from 'zrender/src/graphic/Path'; - -/** 指向箭头坐标*/ -export function arrow(modelX, modelY, length, radius) { - return [ - [modelX - length, modelY], - [modelX - length + radius / 1.5, modelY - radius / 1.2], - [modelX - length + radius / 1.5, modelY - radius / 3], - [modelX + length, modelY - radius / 3], - [modelX + length, modelY + radius / 3], - [modelX - length + radius / 1.5, modelY + radius / 3], - [modelX - length + radius / 1.5, modelY + radius / 1.2] - ]; -} - -/** 指向三角形坐标*/ -export function triangular(modelX, modelY, drict, radius) { - return [ - [modelX, modelY], - [modelX - drict * (radius + 2), modelY - radius], - [modelX - drict * (radius + 2), modelY + radius] - ]; -} - -/** 屏蔽门手电筒*/ -export function flashlight(modelX, modelY, drict, width, height, offsetx, offsety, beyond) { - return [ - [modelX + drict * (offsetx), modelY + drict * offsety - (height + beyond) / 2], - [modelX + drict * (offsetx + beyond), modelY + drict * offsety - height / 2], - [modelX + drict * (offsetx + beyond + width), modelY + drict * offsety - height / 2], - [modelX + drict * (offsetx + beyond + width), modelY + drict * offsety + height / 2], - [modelX + drict * (offsetx + beyond), modelY + drict * offsety + height / 2], - [modelX + drict * (offsetx), modelY + drict * offsety + (height + beyond) / 2] - ]; -} - -/** 区段限速体带方向*/ -export function limitArrows(modelX, modelY, drict, radius) { - return [ - [modelX + drict * radius, modelY - radius], - [modelX + drict * radius, modelY + radius], - [modelX - drict * radius, modelY + radius], - [modelX - drict * radius * 1.8, modelY], - [modelX - drict * radius, modelY - radius] - ]; -} - -/** 区段折返标记*/ -export function turnbackArrows(modelX, modelY, drict, width, height) { - return [ - [modelX - drict * (width - 1), modelY + height], - [modelX + drict * width / 2, modelY + height], - [modelX + drict * width / 2, modelY - height], - [modelX - drict * (width - 3), modelY - height] - ]; -} - -export const Ugraph = Path.extend({ - type: 'ugraph', - - shape: { - points: null, - counterclockwise: true - }, - - style: { - stroke: '#000', - fill: null - }, - - buildPath: function (ctx, shape) { - var points = shape.points; - var r = Math.abs(points[1][1] - points[2][1]) / 2; - var x = Math.abs(points[1][0] + points[2][0]) / 2; - var y = Math.abs(points[1][1] + points[2][1]) / 2; - ctx.moveTo(points[0][0], points[0][1]); - ctx.lineTo(points[1][0], points[1][1]); - - shape.counterclockwise && ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false); - shape.counterclockwise || ctx.arc(x, y, r, Math.PI / 2, -Math.PI / 2, true); - - ctx.moveTo(points[2][0], points[2][1]); - ctx.lineTo(points[3][0], points[3][1]); - - ctx.closePath(); - - points = shape.points; - r = Math.abs(points[1][1] - points[2][1]) / 2; - x = Math.abs(points[1][0] + points[2][0]) / 2; - y = Math.abs(points[1][1] + points[2][1]) / 2; - ctx.moveTo(points[0][0], points[0][1]); - ctx.lineTo(points[1][0], points[1][1]); - - shape.counterclockwise && ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false); - shape.counterclockwise || ctx.arc(x, y, r, Math.PI / 2, -Math.PI / 2, true); - - ctx.moveTo(points[2][0], points[2][1]); - ctx.lineTo(points[3][0], points[3][1]); - - ctx.closePath(); - } -}); diff --git a/src/jmap/theme/factory.js b/src/jmap/theme/factory.js deleted file mode 100644 index 717cd04d8..000000000 --- a/src/jmap/theme/factory.js +++ /dev/null @@ -1,34 +0,0 @@ -class Theme { - constructor(code) { - this._code = '02'; - this._mapMenu = { - // '01': 'chengdu_04', - '02': 'fuzhou_01', - // '03': 'beijing_01', - // '04': 'chengdu_03', - '05': 'fuzhou_01' // 国际版运行图皮肤 指向05 福州线路 - }; - } - - // 加载菜单组件 - loadMenuComponent(code) { - return Object.assign({}, require(`./${this._mapMenu[code || this._code]}/menus/index`).default); - } - - // 加载运行图计划表组件 - loadPlanComponent(code) { - return Object.assign({}, require(`./${this._mapMenu[code || this._code]}/planSchedule/index`).default); - } - - // 加载运行图解析和转化函数 - loadPlanConvert(code) { - return require(`./${this._mapMenu[code || this._code]}/planConvert`).default; - } - - // 共有字段转换 - loadPropConvert(code) { - return require(`./${this._mapMenu[code || this._code]}/model`).default; - } -} - -export default Theme; diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/childDialog/noticeInfo.vue b/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/childDialog/noticeInfo.vue deleted file mode 100644 index c85893d53..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/childDialog/noticeInfo.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmControl.vue deleted file mode 100644 index b9216b44b..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmControl.vue +++ /dev/null @@ -1,372 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmControlSpeed.vue b/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmControlSpeed.vue deleted file mode 100644 index 1fd034f26..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmControlSpeed.vue +++ /dev/null @@ -1,165 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmTrain.vue b/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmTrain.vue deleted file mode 100644 index 7a690368f..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmTrain.vue +++ /dev/null @@ -1,180 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/routeCmdControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/routeCmdControl.vue deleted file mode 100644 index 330b23760..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/routeCmdControl.vue +++ /dev/null @@ -1,453 +0,0 @@ - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/routeControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/routeControl.vue deleted file mode 100644 index 0b5a45fe7..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/routeControl.vue +++ /dev/null @@ -1,332 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/routeDetail.vue b/src/jmap/theme/fuzhou_01/menus/dialog/routeDetail.vue deleted file mode 100644 index d9279fb05..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/routeDetail.vue +++ /dev/null @@ -1,165 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/routeHandControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/routeHandControl.vue deleted file mode 100644 index 019ea38fa..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/routeHandControl.vue +++ /dev/null @@ -1,317 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/routeLock.vue b/src/jmap/theme/fuzhou_01/menus/dialog/routeLock.vue deleted file mode 100644 index a2072d2fc..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/routeLock.vue +++ /dev/null @@ -1,167 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/routeSelection.vue b/src/jmap/theme/fuzhou_01/menus/dialog/routeSelection.vue deleted file mode 100644 index ca7261a8b..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/routeSelection.vue +++ /dev/null @@ -1,262 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/sectionCmdControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/sectionCmdControl.vue deleted file mode 100644 index 59cf14ae0..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/sectionCmdControl.vue +++ /dev/null @@ -1,457 +0,0 @@ - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/sectionControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/sectionControl.vue deleted file mode 100644 index dc81675d1..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/sectionControl.vue +++ /dev/null @@ -1,200 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/speedCmdControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/speedCmdControl.vue deleted file mode 100644 index eaa7c36e2..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/speedCmdControl.vue +++ /dev/null @@ -1,583 +0,0 @@ - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/standBackStrategy.vue b/src/jmap/theme/fuzhou_01/menus/dialog/standBackStrategy.vue deleted file mode 100644 index e1f941d26..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/standBackStrategy.vue +++ /dev/null @@ -1,251 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/standControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/standControl.vue deleted file mode 100644 index e98e938f1..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/standControl.vue +++ /dev/null @@ -1,270 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/standDetail.vue b/src/jmap/theme/fuzhou_01/menus/dialog/standDetail.vue deleted file mode 100644 index 04a74f495..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/standDetail.vue +++ /dev/null @@ -1,179 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/standDetainTrainAll.vue b/src/jmap/theme/fuzhou_01/menus/dialog/standDetainTrainAll.vue deleted file mode 100644 index 6bb042531..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/standDetainTrainAll.vue +++ /dev/null @@ -1,191 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/standRunLevel.vue b/src/jmap/theme/fuzhou_01/menus/dialog/standRunLevel.vue deleted file mode 100644 index e0d40525b..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/standRunLevel.vue +++ /dev/null @@ -1,269 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/standStopTime.vue b/src/jmap/theme/fuzhou_01/menus/dialog/standStopTime.vue deleted file mode 100644 index 9ade50cee..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/standStopTime.vue +++ /dev/null @@ -1,255 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/stationCmdControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/stationCmdControl.vue deleted file mode 100644 index 49224d1fa..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/stationCmdControl.vue +++ /dev/null @@ -1,409 +0,0 @@ - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/stationHumanControlAll.vue b/src/jmap/theme/fuzhou_01/menus/dialog/stationHumanControlAll.vue deleted file mode 100644 index 743cad27c..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/stationHumanControlAll.vue +++ /dev/null @@ -1,124 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/stationSetRouteControlAll.vue b/src/jmap/theme/fuzhou_01/menus/dialog/stationSetRouteControlAll.vue deleted file mode 100644 index 02267fc87..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/stationSetRouteControlAll.vue +++ /dev/null @@ -1,143 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/switchCmdControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/switchCmdControl.vue deleted file mode 100644 index 297349843..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/switchCmdControl.vue +++ /dev/null @@ -1,481 +0,0 @@ - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/switchControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/switchControl.vue deleted file mode 100644 index 1de0cba4d..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/switchControl.vue +++ /dev/null @@ -1,285 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/trainControl.vue b/src/jmap/theme/fuzhou_01/menus/dialog/trainControl.vue deleted file mode 100644 index 9d28dc08d..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/trainControl.vue +++ /dev/null @@ -1,467 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/trainCreate.vue b/src/jmap/theme/fuzhou_01/menus/dialog/trainCreate.vue deleted file mode 100644 index 46c366226..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/trainCreate.vue +++ /dev/null @@ -1,153 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/trainEditNumber.vue b/src/jmap/theme/fuzhou_01/menus/dialog/trainEditNumber.vue deleted file mode 100644 index 441427f74..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/trainEditNumber.vue +++ /dev/null @@ -1,136 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/trainMove.vue b/src/jmap/theme/fuzhou_01/menus/dialog/trainMove.vue deleted file mode 100644 index 5a3bff7cb..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/trainMove.vue +++ /dev/null @@ -1,199 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/trainSwitch.vue b/src/jmap/theme/fuzhou_01/menus/dialog/trainSwitch.vue deleted file mode 100644 index 90174fdbc..000000000 --- a/src/jmap/theme/fuzhou_01/menus/dialog/trainSwitch.vue +++ /dev/null @@ -1,204 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuBar.vue b/src/jmap/theme/fuzhou_01/menus/menuBar.vue deleted file mode 100644 index 322e3c49f..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuBar.vue +++ /dev/null @@ -1,827 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/twoConfirmation.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/twoConfirmation.vue deleted file mode 100644 index d7a64af6b..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/twoConfirmation.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/userAdd.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/userAdd.vue deleted file mode 100644 index 81009d4c1..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/userAdd.vue +++ /dev/null @@ -1,172 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/userDelete.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/userDelete.vue deleted file mode 100644 index 7e07a21db..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/userDelete.vue +++ /dev/null @@ -1,143 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/userEdit.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/userEdit.vue deleted file mode 100644 index 6e3bf3039..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/childDialog/userEdit.vue +++ /dev/null @@ -1,189 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/helpAbout.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/helpAbout.vue deleted file mode 100644 index f19854741..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/helpAbout.vue +++ /dev/null @@ -1,140 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/manageUser.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/manageUser.vue deleted file mode 100644 index c1b8e15a0..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/manageUser.vue +++ /dev/null @@ -1,309 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/passwordBox.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/passwordBox.vue deleted file mode 100644 index c349ac7cd..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/passwordBox.vue +++ /dev/null @@ -1,229 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/stationControlConvert.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/stationControlConvert.vue deleted file mode 100644 index 9fa2d1bcf..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/stationControlConvert.vue +++ /dev/null @@ -1,472 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue deleted file mode 100644 index 096fb45a5..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewDevice.vue +++ /dev/null @@ -1,166 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewName.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewName.vue deleted file mode 100644 index 83006fcf3..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewName.vue +++ /dev/null @@ -1,234 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue deleted file mode 100644 index 65cd96542..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue +++ /dev/null @@ -1,209 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuSection.vue b/src/jmap/theme/fuzhou_01/menus/menuSection.vue deleted file mode 100644 index f2a03250d..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuSection.vue +++ /dev/null @@ -1,407 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuSignal.vue b/src/jmap/theme/fuzhou_01/menus/menuSignal.vue deleted file mode 100644 index 1bc1ac780..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuSignal.vue +++ /dev/null @@ -1,538 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuStation.vue b/src/jmap/theme/fuzhou_01/menus/menuStation.vue deleted file mode 100644 index a5cbb4993..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuStation.vue +++ /dev/null @@ -1,302 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuStationControl.vue b/src/jmap/theme/fuzhou_01/menus/menuStationControl.vue deleted file mode 100644 index ddecefc8a..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuStationControl.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuStationStand.vue b/src/jmap/theme/fuzhou_01/menus/menuStationStand.vue deleted file mode 100644 index 260d7fdf7..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuStationStand.vue +++ /dev/null @@ -1,488 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuSwitch.vue b/src/jmap/theme/fuzhou_01/menus/menuSwitch.vue deleted file mode 100644 index 8c18ebee9..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuSwitch.vue +++ /dev/null @@ -1,485 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/menuTrain.vue b/src/jmap/theme/fuzhou_01/menus/menuTrain.vue deleted file mode 100644 index 40679a35d..000000000 --- a/src/jmap/theme/fuzhou_01/menus/menuTrain.vue +++ /dev/null @@ -1,321 +0,0 @@ - - - diff --git a/src/jmap/theme/fuzhou_01/menus/passiveDialog/control.vue b/src/jmap/theme/fuzhou_01/menus/passiveDialog/control.vue deleted file mode 100644 index 0ee717b7d..000000000 --- a/src/jmap/theme/fuzhou_01/menus/passiveDialog/control.vue +++ /dev/null @@ -1,315 +0,0 @@ - - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/statusDownTrainDetail.vue b/src/jmap/theme/fuzhou_01/menus/statusDownTrainDetail.vue deleted file mode 100644 index ac712152d..000000000 --- a/src/jmap/theme/fuzhou_01/menus/statusDownTrainDetail.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/statusUpTrainDetail.vue b/src/jmap/theme/fuzhou_01/menus/statusUpTrainDetail.vue deleted file mode 100644 index bb1e0cee3..000000000 --- a/src/jmap/theme/fuzhou_01/menus/statusUpTrainDetail.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menus/utils/menuItemStatus.js b/src/jmap/theme/fuzhou_01/menus/utils/menuItemStatus.js deleted file mode 100644 index c41559f8c..000000000 --- a/src/jmap/theme/fuzhou_01/menus/utils/menuItemStatus.js +++ /dev/null @@ -1,570 +0,0 @@ -import store from '@/store/index_APP_TARGET'; -import deviceState from '@/jmap/constant/deviceState'; -import { OperateMode } from '@/scripts/ConstDic'; - -export function getCurrentStateObject() { - return store.getters['menuOperation/selected']; -} - -/** 系统类型 */ -export const SystemType = { - '01': 'local', // 现地工作站 - '02': 'central' // 中心调度工作站 -}; - -export const StationControlType = { - '01': 'center', // 中控 - '02': 'station', // 站控 - '03': 'station' -}; - -// 控制禁用 -export const MenuDisabledState = { - Section: { - // 故障解锁 - fault() { - }, - // 切除 - split() { - const device = getCurrentStateObject(); - if (device && device.cutOff != deviceState.Section.cutOff.Default) { - return true; - } - }, - // 激活 - active() { - const device = getCurrentStateObject(); - if (device && device.cutOff == deviceState.Section.cutOff.Default) { - return true; - } - }, - // 区段封锁 - lock() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.Section.status.State06) { - return true; - } - }, - // 区段解禁 - unlock() { - const device = getCurrentStateObject(); - if (device && device.status != deviceState.Section.status.State06) { - return true; - } - }, - // 区段设置限速 - setSpeed() { - const device = getCurrentStateObject(); - if (device && device.speedUpperLimit != deviceState.Section.speedUpperLimit.Default) { - return true; - } - }, - // 区段取消限速 - cancelSpeed() { - const device = getCurrentStateObject(); - if (device && device.speedUpperLimit == deviceState.Section.speedUpperLimit.Default) { - return true; - } - }, - // 新建列车 - newTrain() { - }, - // 计轴预复位 - axlePreReset() { - }, - // 设置故障 - setStoppage() { - const device = getCurrentStateObject(); - if (device && device.fault) { - return true; - } - }, - // 取消故障 - cancelStoppage() { - const device = getCurrentStateObject(); - if (device && !device.fault) { - return true; - } - } - }, - Signal: { - // 进路选排 - arrangementRoute() { - - }, - // 进路取消 - cancelTrainRoute() { - }, - // 信号封闭 - lock() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.Signal.status.State05) { - return true; - } - }, - // 信号解封 - unlock() { - const device = getCurrentStateObject(); - if (device && device.status != deviceState.Signal.status.State05) { - return true; - } - }, - // 信号重开 - reopenSignal() { - }, - // 进路引导 - guide() { - }, - // 设置联锁自动进路 - setAutoInterlock() { - }, - // 取消联锁自动进路 - cancelAutoInterlock() { - }, - // 设置联锁自动触发 - setAutoTrigger() { - }, - // 取消联锁自动触发 - cancelAutoTrigger() { - }, - // 关灯 - signalClose() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.Signal.status.State01) { - return true; - } - }, - // 人工控 - humanControl() { - }, - // ats自动控 - atsAutoControl() { - }, - // 查询进路状态 - detail() { - }, - // 设置故障 - setStoppage() { - const device = getCurrentStateObject(); - if (device && device.fault) { - return true; - } - }, - // 取消故障 - cancelStoppage() { - const device = getCurrentStateObject(); - if (device && !device.fault) { - return true; - } - } - }, - Station: { - // 全站设置联锁自动触发 - setAutoTrigger() { - }, - // 全站取消联锁自动触发 - cancelAutoTrigger() { - }, - // 上电解锁 - powerUnLock() { - }, - // 执行关键操作测试 - execKeyOperationTest() { - }, - // 所有进路自排开 - atsAutoControlALL() { - }, - // 所有进路自排关 - humanControlALL() { - }, - // 设置ZC故障 - setStoppage() { - const device = getCurrentStateObject(); - if (device && device.fault) { - return true; - } - }, - // 取消ZC故障 - cancelStoppage() { - const device = getCurrentStateObject(); - if (device && !device.fault) { - return true; - } - } - }, - StationControl: { - // 紧急站控 - emergencyStationControl() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.StationControl.status.State03) { - return true; - } - }, - // 请求站控 - requestStationControl() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.StationControl.status.State02) { - return true; - } - }, - // 强行站控 - forcedStationControl() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.StationControl.status.State02) { - return true; - } - }, - // 请求中控 - requestCentralControl() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.StationControl.status.State01) { - return true; - } - }, - // 设置故障 - setStoppage() { - const device = getCurrentStateObject(); - if (device && device.fault) { - return true; - } - }, - // 取消故障 - cancelStoppage() { - const device = getCurrentStateObject(); - if (device && !device.fault) { - return true; - } - } - }, - StationStand: { - // 设置扣车 - setDetainTrain() { - const device = getCurrentStateObject(); - if (store.state.training.prdType == '02') { // 中心行调模式 - if (device && device.holdStatus == deviceState.StationStand.holdStatus.State04) { - return true; - } else if (device && device.holdStatus == deviceState.StationStand.holdStatus.State03) { - return true; - } - } else { // 现地模式 - if (device && device.holdStatus == deviceState.StationStand.holdStatus.State04) { - return true; - } else if (device && device.holdStatus == deviceState.StationStand.holdStatus.State02) { - return true; - } - } - }, - // 取消扣车 - cancelDetainTrain() { - const device = getCurrentStateObject(); - if (store.state.training.prdType == '02') { - if (device && device.holdStatus == deviceState.StationStand.holdStatus.State04) { - return false; - } else if (device && device.holdStatus != deviceState.StationStand.holdStatus.State03) { - return true; - } - } else { - if (device && device.holdStatus == deviceState.StationStand.holdStatus.State04) { - return false; - } else if (device && device.holdStatus != deviceState.StationStand.holdStatus.State02) { - return true; - } - } - }, - // 强制取消扣车 - cancelDetainTrainForce() { - const device = getCurrentStateObject(); - if (device && device.holdStatus == deviceState.StationStand.holdStatus.State01) { - return true; - } - }, - // 设置全站扣车 - cancelDetainTrainAll() { - }, - // 设置运行等级 - setRunLevel() { - }, - // 设置停站时间 - setStopTime() { - }, - // 设置跳停 - setJumpStop() { - const device = getCurrentStateObject(); - if (device && device.jumpStopStatus != deviceState.StationStand.jumpStopStatus.State01) { - return true; - } - }, - // 取消跳停 - cancelJumpStop() { - const device = getCurrentStateObject(); - if (device && device.jumpStopStatus == deviceState.StationStand.jumpStopStatus.State01) { - return true; - } - }, - // 提前发车 - earlyDeparture() { - }, - // 站台详细信息 - detail() { - }, - // 设置折返策略 - setBackStrategy() { - }, - // 设置故障 - setStoppage() { - const device = getCurrentStateObject(); - if (device && device.fault) { - return true; - } - }, - // 取消故障 - cancelStoppage() { - const device = getCurrentStateObject(); - if (device && !device.fault) { - return true; - } - } - }, - Switch: { - // 单锁 - lock() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.Switch.status.State10) { - return true; - } - }, - // 解锁 - unlock() { - const device = getCurrentStateObject(); - if (device && device.status != deviceState.Switch.status.State10) { - return true; - } - }, - // 封锁 - block() { - const device = getCurrentStateObject(); - if (device && device.status == deviceState.Switch.status.State14) { - return true; - } - }, - // 解封 - unblock() { - const device = getCurrentStateObject(); - if (device && device.status != deviceState.Switch.status.State14) { - return true; - } - }, - // 强扳 - switchTurnoutForce() { - }, - // 转动 - switchTurnout() { - }, - // 道岔故障解锁 - fault() { - }, - // 计轴预复位 - axlePreReset() { - }, - // 道岔切除 - split() { - }, - // 道岔激活 - active() { - }, - // 道岔设置速度 - setSpeed() { - // const device = getCurrentStateObject(); - }, - // 道岔取消速度 - cancelSpeed() { - }, - // 设置故障 - setStoppage() { - const device = getCurrentStateObject(); - if (device && device.fault) { - return true; - } - }, - // 取消故障 - cancelStoppage() { - const device = getCurrentStateObject(); - if (device && !device.fault) { - return true; - } - } - }, - Train: { - // 添加列车识别号 - addTrainId() { - }, - // 删除列车识别号 - delTrainId() { - }, - // 修改列车识别号 - editTrainId() { - }, - // 修改车组号 - editTrainNo() { - }, - // 移动列车识别号 - moveTrainId() { - }, - // 交换列车识别号 - switchTrainId() { - }, - // 设置限速 - limitSpeed() { - }, - // 设置通信故障 - setStoppage() { - const device = getCurrentStateObject(); - if (device && device.fault) { - return true; - } - }, - // 取消通信故障 - cancelStoppage() { - const device = getCurrentStateObject(); - if (device && !device.fault) { - return true; - } - } - } -}; - -export function checkOperationValidity() { - if (store.state.training.prdType == '02') { - return true; - } -} - -/** - * 将menu的disabled属性使用disabledCallback计算并返回 - * @param {Array} menu - */ -export function menuConvert(menu) { - if (menu.constructor === Array) { - menu.forEach(elem => { - if (elem.type === 'separator') { - elem.show = true; - return; - } - - if (elem.disabledCallback.constructor === Function) { - elem.disabled = elem.defaultDisabled; - if (!elem.defaultDisabled) { - elem.disabled = elem.disabledCallback(); - } - } - }); - } - return menu; -} - -/** - * 根据产品类型,返回对应的menuBar - * @param {*} menuObj - */ -export function menuBarConvert(menu, mode) { - if (menu) { - if (mode === OperateMode.NORMAL) { - menu.forEach(item => { - if (item.type === 'separator') { - item.show = true; - return; - } - - item.show = false; - if (!item.click) { - item.click = () => { }; - } - - if (!item.froce) { - item.show = true; - if (item.children && item.children.length > 0) { - menuBarConvert(item.children, mode); - } - } - }); - } else if (mode === OperateMode.ADMIN) { - menu.forEach(item => { - item.show = true; - if (!item.click) { - item.click = () => { }; - } - if (item.children && item.children.length > 0) { - menuBarConvert(item.children, mode); - } - }); - } - } - return menu || []; -} - -/** - * 将menu的show属性过滤返回 - * @param {Array} menu - */ -export function menuFiltration(menuObj) { - var selected = getCurrentStateObject(); - var control; - var menu = []; - - if (selected._type == 'StationStand') { - control = store.getters['map/getStationControlByStationCode'](selected.deviceStationCode); - } else if (selected._type == 'Station') { - control = store.getters['map/getStationControlByStationCode'](selected.code); - } else { - control = store.getters['map/getStationControlByStationCode'](selected.stationCode); - } - - if (control) { - if (store.state.training.prdType != '') { - const type = SystemType[store.state.training.prdType]; - const status = StationControlType[control.status]; - menu = [...menuObj[type]]; - if (menu.constructor === Array) { - menu.forEach(elem => { - if (elem.type === 'separator') { - elem.show = true; - return; - } - - if (elem.auth.constructor === Object) { - elem.show = true; - if (!elem.auth['station'] && !elem.auth['center']) { // 控制不显示 - elem.show = false; - } - elem.defaultDisabled = !elem.auth[status]; - } - }); - } - } - } - - return menu; -} - -/** - * 将train menu的show属性过滤返回 - */ -export function trainMenuFiltration(menuObj) { - var menu = []; - if (store.state.training.prdType != '') { - const type = SystemType[store.state.training.prdType]; - menu = [...menuObj[type]]; - if (menu.constructor === Array) { - menu.forEach(elem => { - if (elem.auth.constructor === Object) { - elem.show = true; - if (!elem.auth['station'] && !elem.auth['center']) { // 控制不显示 - elem.show = false; - } - } - }); - } - } - return menu; -} - diff --git a/src/jmap/theme/fuzhou_01/menusPlan/addTask.vue b/src/jmap/theme/fuzhou_01/menusPlan/addTask.vue deleted file mode 100644 index b9e6c42e8..000000000 --- a/src/jmap/theme/fuzhou_01/menusPlan/addTask.vue +++ /dev/null @@ -1,175 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menusPlan/chooseTemplatePlan.vue b/src/jmap/theme/fuzhou_01/menusPlan/chooseTemplatePlan.vue deleted file mode 100644 index 78abc470e..000000000 --- a/src/jmap/theme/fuzhou_01/menusPlan/chooseTemplatePlan.vue +++ /dev/null @@ -1,115 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menusPlan/components/dataTable.vue b/src/jmap/theme/fuzhou_01/menusPlan/components/dataTable.vue deleted file mode 100644 index cfaac866d..000000000 --- a/src/jmap/theme/fuzhou_01/menusPlan/components/dataTable.vue +++ /dev/null @@ -1,206 +0,0 @@ - - - - - diff --git a/src/jmap/theme/fuzhou_01/menusPlan/createTodayPlan.vue b/src/jmap/theme/fuzhou_01/menusPlan/createTodayPlan.vue deleted file mode 100644 index e53fffb54..000000000 --- a/src/jmap/theme/fuzhou_01/menusPlan/createTodayPlan.vue +++ /dev/null @@ -1,135 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menusPlan/createWeekPlan.vue b/src/jmap/theme/fuzhou_01/menusPlan/createWeekPlan.vue deleted file mode 100644 index 09f3abfa4..000000000 --- a/src/jmap/theme/fuzhou_01/menusPlan/createWeekPlan.vue +++ /dev/null @@ -1,137 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menusPlan/deleteTask.vue b/src/jmap/theme/fuzhou_01/menusPlan/deleteTask.vue deleted file mode 100644 index 363f3c8ab..000000000 --- a/src/jmap/theme/fuzhou_01/menusPlan/deleteTask.vue +++ /dev/null @@ -1,73 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menusPlan/deleteTodayPlan.vue b/src/jmap/theme/fuzhou_01/menusPlan/deleteTodayPlan.vue deleted file mode 100644 index be003663e..000000000 --- a/src/jmap/theme/fuzhou_01/menusPlan/deleteTodayPlan.vue +++ /dev/null @@ -1,62 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menusPlan/managePlanList.vue b/src/jmap/theme/fuzhou_01/menusPlan/managePlanList.vue deleted file mode 100644 index e619bcbbf..000000000 --- a/src/jmap/theme/fuzhou_01/menusPlan/managePlanList.vue +++ /dev/null @@ -1,143 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menusPlan/modifyingPlan.vue b/src/jmap/theme/fuzhou_01/menusPlan/modifyingPlan.vue deleted file mode 100644 index 6cba11edc..000000000 --- a/src/jmap/theme/fuzhou_01/menusPlan/modifyingPlan.vue +++ /dev/null @@ -1,177 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/menusPlan/modifyingTask.vue b/src/jmap/theme/fuzhou_01/menusPlan/modifyingTask.vue deleted file mode 100644 index 2ebad67a8..000000000 --- a/src/jmap/theme/fuzhou_01/menusPlan/modifyingTask.vue +++ /dev/null @@ -1,326 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/planConvert.js b/src/jmap/theme/fuzhou_01/planConvert.js deleted file mode 100644 index a535ca5e1..000000000 --- a/src/jmap/theme/fuzhou_01/planConvert.js +++ /dev/null @@ -1,364 +0,0 @@ -import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, prefixTime, convertSheetToList } from '@/utils/runPlan'; - -export default { - /** 边缘高度*/ - EdgeHeight: 3, - - /** 间隔高度*/ - CoordMultiple: 3, - - /** 偏移时间*/ - TranslationTime: 60 * 60 * 2, - - /** excel解析配置*/ - ExcelConfig: { - beginRow: 1, - beginCol: 0, - // fieldNum: 10, - columns: { - '默认上行折返轨': { key: 'upTrack', formatter: (val) => { return val; } }, - '默认下行折返轨': { key: 'downTrack', formatter: (val) => { return val; } } - } - }, - - /** 解析exal数据转换为Json后台数据*/ - importData(Sheet, JsonData) { - const dataList = convertSheetToList(Sheet, true); - const needList = Object.keys(this.ExcelConfig.columns); - const tripObj = { upTrack: '', downTrack: '' }; - if (dataList && dataList.length && dataList[1] && dataList[0]) { - const tIndex = dataList.findIndex(it => { return it[0]; }); - if (dataList[0][0] == needList[0] && dataList[1][0] == needList[1]) { - for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += 1) { - var isContinue = true; - - for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) { - isContinue = false; - - var title = dataList[colIndex][0]; - var value = dataList[colIndex][rowIndex]; - - if (title && value) { - // 数据列解析 - isContinue = true; - var titleStr = `${title}`.replace(/\s*/g, ''); - var valueStr = `${value}`.replace(/\s*/g, ''); - - // 取需要的字段 - if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) { - tripObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr); - } - } - - } - } - } else { - /** 解析二维数组为json对象*/ - const reg0 = /^[↑|↓|¡|ü|ý|]+(.*)/; // ↑|↓ - const reg1 = /^([▼|▲|¡ø|¨‹]+)\s*(\d+:\d+:\d+)/; // ▲ 06:10:00 - const reg2 = /^(\d+:\d+:\d+)\s*([▼|▲|¡ø|¨‹]+)/; // 06:10:00 ▲ - const reg3 = /^(\d+:\d+:\d+)\s*(\d+:\d+:\d+|)/; // 06:10:00 06:12:00 - const reg4 = /[▼|▲|¡|ø|¨|‹]+/; // ▲ - - dataList.forEach((elem, i) => { - var begin = -1; - /** 跳过名称所在的行*/ - if (i != tIndex && elem && elem.length > 0) { - elem.forEach((item, j) => { - /** 过滤空值*/ - if (item) { - var value = `${item}`.trim(); - var title = `${dataList[tIndex][j]}`.replace(/\s*/g, ''); - /** 匹配到开始位置或者结束位置*/ - if (reg0.test(value)) { - if (begin == -1) { - begin = value; // 设置初始索引 - JsonData.push({ - code: reg0.exec(value)[1], - arrivalList: [] - }); - } else if (begin === value) { - begin = -1; // 清空初始索引 - } - } else if (begin !== -1) { - /** 匹配到中间位置*/ - var begTime, endTime; - var runFlag = JsonData[JsonData.length - 1].code[2]; - var stationName = title.replace(/\s/, ''); - var need = false; - var flag = false; - if (reg1.test(value)) { - /** 含有特殊字符的时间格式*/ - [, begTime, endTime] = reg1.exec(value); - - begTime = reg4.test(begTime) ? '' : begTime; - endTime = reg4.test(endTime) ? '' : endTime; - - /** 下行方向时间互换*/ - if (runFlag === '2') { - [begTime, endTime] = [endTime, begTime]; - } - - /** 设置标志*/ - [need, flag] = [true, true]; - } else if (reg2.test(value)) { - /** 含有特殊字符的时间格式*/ - [, begTime, endTime] = reg2.exec(value); - - begTime = reg4.test(begTime) ? '' : begTime; - endTime = reg4.test(endTime) ? '' : endTime; - - /** 下行方向时间互换*/ - if (runFlag === '2') { - [begTime, endTime] = [endTime, begTime]; - } - - /** 设置标志*/ - [need, flag] = [true, true]; - } else if (reg3.test(value)) { - /** 正常时间格式*/ - [, begTime, endTime] = reg3.exec(value); - - /** 如果只存在一个数据时,则开始和结束设置一样*/ - endTime = endTime || begTime; - - /** 下行方向时间互换*/ - if (runFlag === '2') { - [begTime, endTime] = [endTime, begTime]; - } - - /** 设置标志*/ - [need, flag] = [true, false]; - } - - /** 添加json数据*/ - if (need) { // 储存非空 数据 - var stationObj = { - stationName: stationName - }; - - if (begTime) { stationObj['arriveTime'] = prefixTime(begTime); } - if (endTime) { stationObj['departureTime'] = prefixTime(endTime); } - if (flag) { stationObj['flag'] = flag; } // 是否转换轨 - JsonData[JsonData.length - 1].arrivalList.push(stationObj); - } - } - } - }); - } - }); - } - } - JsonData.forEach(item => { - item['upTrack'] = tripObj.upTrack; - item['downTrack'] = tripObj.downTrack; - }); - - return JsonData; - }, - - /** 将后台数据解析成图表*/ - convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) { - var models = []; - - if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) { - /** 按服务遍历数据*/ - data.serviceNumberDataList.forEach((service) => { - /** 按车次遍历数据*/ - var isBackup = true; - var opt = { name: '', markPointData: [], data: [] }; - if (service.tripNumberDataList && service.tripNumberDataList.length) { - service.tripNumberDataList.forEach((train, j) => { - var pointdata = {}; - var idx = 0; - var lastPoint = null; - var nextPoint = null; - - /** 创建标记点名称和坐标*/ - pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`; - pointdata.color = '#000' || lineStyle.color; - pointdata.directionCode = train.directionCode; - pointdata.coord = [train.stationTimeList[0].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[0], train.directionCode, false)]; - - /** 给服务对象添加服务名称和标记点*/ - opt.name = '' + service.serviceNumber; - opt.markPointData.push(createMartPoint(pointdata)); - - /** 计算非折返点车次点坐标集合*/ - train.stationTimeList.forEach((elem, index) => { - idx = index; - const aa = `${train.directionCode}${train.tripNumber}`; - opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa]); - }); - - /** 计算折返点车次坐标点集合*/ - if (!train.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) { - lastPoint = train.stationTimeList[idx]; - nextPoint = service.tripNumberDataList[j + 1].stationTimeList[0]; - const aa = `${train.directionCode}${train.tripNumber}`; - opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true), lastPoint.stationCode, aa, '折返轨']); - opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true), lastPoint.stationCode, aa, '折返轨']); - } - - /** 如果是备用车,按车次添加线*/ - if (train.backup) { - /** 创建一条完成的服务数据*/ - opt.name += j; - // var model = createSeriesModel(opt, Object.assign({ color: hexColor.toCreate() }, lineStyle)); - var model = createSeriesModel(opt, Object.assign({ color: '#000' }, lineStyle)); - if (model) { - models.push(model); - opt = { name: '', markPointData: [], data: [] }; - } - } - - isBackup = train.backup; - }); - - // 不是备用车,按服务添加线 - if (!isBackup) { - /** 创建一条完成的服务数据*/ - // var model = createSeriesModel(opt, Object.assign({ color: hexColor.toCreate() }, lineStyle)); - var model = createSeriesModel(opt, Object.assign({ color: '#000' }, lineStyle)); - if (model) { - models.push(model); - } - } - } - }); - return models; - } else { - return []; - } - }, - - /** 更新数据并解析成图表*/ - updateDataToModels(data, stations, kmRangeCoordMap, runPlanData, series, lineStyle) { - if (data && data.length) { - data.forEach(elem => { - /** 判断此条记录的服务号是否存在*/ - if (!runPlanData[elem.serviceNumber]) { - /** 创建一个新服务号标记*/ - runPlanData[elem.serviceNumber] = {}; - - /** 不存在此服务号,则需要创建一条新的line*/ - series.push(createSeriesModel({ - zlevel: 1, - name: `run${elem.serviceNumber}`, - data: [], - markPointData: [] - }, Object.assign({ color: hexColor.toCreate() }, lineStyle))); - } - - /** 添加数据*/ - series.forEach(serie => { - /** 找到服务号所在图数据的位置*/ - if (serie.name == `run${elem.serviceNumber}`) { - /** 添加车组号记录标记*/ - if (!runPlanData[elem.serviceNumber][elem.tripNumber]) { - runPlanData[elem.serviceNumber][elem.tripNumber] = []; - } - - runPlanData[elem.serviceNumber][elem.tripNumber].push(elem); - runPlanData[elem.serviceNumber][elem.tripNumber].sort((a, b) => { - return parseInt(a.secondTime) - parseInt(b.secondTime); - }); - - /** 如果此记录车组号的数据为第一条时,则打上标签*/ - if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) { - serie.markPoint.data.push(createMartPoint({ - directionCode: elem.directionCode, - coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem)], - name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`, - color: lineStyle.color || '#000' - })); - } - - /** 计算折返点*/ - var nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.directionCode]; - if (serie.data.length > 0) { - var lastPoint = serie.data[serie.data.length - 1]; - if (lastPoint[2] !== nextPoint[2]) { - serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[2]), lastPoint[2]]); - serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2]), lastPoint[2]]); - } - } - - /** 添加车组号数据到对应的服务图数据中*/ - serie.data.push(nextPoint); - - /** 保证原始数据排序*/ - serie.data.sort((a, b) => { - return parseInt(a[0]) - parseInt(b[0]); - }); - } - }); - }); - } - - return series; - }, - - /** 将后台数据转换为试图序列模型*/ - convertStationsToMap(stations) { - var map = {}; - if (stations && stations.length) { - stations.forEach((elem, index) => { - map[`${elem.kmRange}`] = this.EdgeHeight + index * this.CoordMultiple; - }); - } - - return map; - }, - /** 初始化Y轴*/ - initializeYaxis(stations) { - return createMarkLineModels(stations, (elem, index) => { - return this.EdgeHeight + index * this.CoordMultiple; - }); - }, - - /** 计算y轴最小值*/ - computedYaxisMinValue() { - return 0; - }, - - /** 计算y轴最大值*/ - computedYaxisMaxValue(stations) { - return this.EdgeHeight * 2 + (stations.length - 1) * this.CoordMultiple; - }, - - /** 格式化y轴数据*/ - computedFormatYAxis(stations, params) { - var yText = ''; - var index = Math.floor((parseInt(params.value) - this.EdgeHeight) / this.CoordMultiple); - if (index >= 0 && index < stations.length) { - yText = stations[index].kmRange + 'm'; - } - return yText; - }, - - /** 根据方向计算y折返偏移量*/ - getYvalueByDirectionCode(defaultVlue, directionCode) { - if (directionCode === '1') { - defaultVlue -= this.EdgeHeight / 2; - } else if (directionCode === '2') { - defaultVlue += this.EdgeHeight / 2; - } - - return defaultVlue; - }, - - /** 根据elem计算y值*/ - getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, isSpecial) { - var defaultVlue = 0; - var station = stations.find(it => { return it.code == elem.stationCode; }); - if (station) { - defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; - if (isSpecial) { - defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode); - } - } - - return defaultVlue; - } -}; diff --git a/src/jmap/theme/fuzhou_01/planSchedule/index.vue b/src/jmap/theme/fuzhou_01/planSchedule/index.vue deleted file mode 100644 index 0555c8878..000000000 --- a/src/jmap/theme/fuzhou_01/planSchedule/index.vue +++ /dev/null @@ -1,403 +0,0 @@ - - - - - diff --git a/src/jmap/theme/fuzhou_01/planSchedule/menuBar.vue b/src/jmap/theme/fuzhou_01/planSchedule/menuBar.vue deleted file mode 100644 index b58115ead..000000000 --- a/src/jmap/theme/fuzhou_01/planSchedule/menuBar.vue +++ /dev/null @@ -1,518 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/planSchedule/schedule.vue b/src/jmap/theme/fuzhou_01/planSchedule/schedule.vue deleted file mode 100644 index d157b4e01..000000000 --- a/src/jmap/theme/fuzhou_01/planSchedule/schedule.vue +++ /dev/null @@ -1,482 +0,0 @@ - - - - diff --git a/src/jmap/theme/fuzhou_01/planSchedule/statusBar.vue b/src/jmap/theme/fuzhou_01/planSchedule/statusBar.vue deleted file mode 100644 index d21265950..000000000 --- a/src/jmap/theme/fuzhou_01/planSchedule/statusBar.vue +++ /dev/null @@ -1,107 +0,0 @@ - - - - - diff --git a/src/jmap/theme/fuzhou_01/planSchedule/titleBar.vue b/src/jmap/theme/fuzhou_01/planSchedule/titleBar.vue deleted file mode 100644 index 56e459044..000000000 --- a/src/jmap/theme/fuzhou_01/planSchedule/titleBar.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - - diff --git a/src/jmap/transformHandle.js b/src/jmap/transformHandle.js deleted file mode 100644 index 92cc58f01..000000000 --- a/src/jmap/transformHandle.js +++ /dev/null @@ -1,74 +0,0 @@ - -import {createTransform, createBoundingRect} from './utils/parser'; - -class TransformHandle { - constructor(painter) { - this.$painter = painter; - - this.parentLevel = painter.getParentLevel(); - - this.rect = { x: 0, y: 0, width: 0, height: 0 }; - - this.transform = createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 }); - } - - checkVisible(view) { - if (view._type != 'Link') { - return createBoundingRect(view).intersect(this.rect); - } else { - return true; - } - } - - revisibleView(view) { - if (this.checkVisible(view)) { - view.show(); - } else { - view.hide(); - } - - view.dirty(); - } - - // 视图进行缩放/平移 - transformView(view) { - if (view) { - view.transform = this.transform; - view.decomposeTransform(); - this.revisibleView(view); - } - } - - // 处理所有视图缩放/平移 - transformAll() { - this.traverse(this.transformView, this); - } - - // 重新计算显示图形 - revisibleAll() { - this.traverse(this.revisibleView, this); - } - - // 更新偏移量 - updateTransform(opts) { - this.transform = createTransform(opts); - this.transformAll(); - } - - // 更新画布尺寸 - updateZrSize(opts) { - this.rect = { x: 0, y: 0, width: opts.width, height: opts.height }; - this.revisibleAll(); - } - - // 遍历group执行回调 - traverse(cb, context) { - this.parentLevel.eachChild(level => { - level.eachChild((view) => { - cb.call(context, view); - }, context); - }, context); - } -} - -export default TransformHandle; diff --git a/src/jmap/utils/JTriangle.js b/src/jmap/utils/JTriangle.js deleted file mode 100644 index 082e0e342..000000000 --- a/src/jmap/utils/JTriangle.js +++ /dev/null @@ -1,67 +0,0 @@ -/** 三角函数计算 */ -function JTriangle(beg, end) { - this.init(beg, end); -} -JTriangle.prototype = { - constructor: JTriangle, - beg: null, - end: null, - abspowx: 0, - abspowy: 0, - abspowz: 0, - drictx: 0, - dricty: 0, - drict: 0, - - init (beg, end) { - this.beg = beg; - this.end = end; - this.abspowx = Math.pow(this.end.x - this.beg.x, 2); - this.abspowy = Math.pow(this.end.y - this.beg.y, 2); - this.abspowz = this.abspowx + this.abspowy; - this.absx = Math.abs(this.end.x - this.beg.x); - this.absy = Math.abs(this.end.y - this.beg.y); - this.absz = Math.sqrt(Math.pow(this.end.x - this.beg.x, 2), Math.pow(this.end.y - this.beg.y, 2)); - this.drictx = this.end.x > this.beg.x ? 1 : -1; - this.dricty = this.end.y > this.beg.y ? 1 : -1; - this.drict = this.drictx * this.dricty; - this.diff_x = end.x - beg.x; - this.diff_y = end.y - beg.y; - }, - getRotation () { - return Math.atan(this.diff_y / this.diff_x); - }, - getAngle () { - return 360 * Math.atan(this.diff_y / this.diff_x) / (2 * Math.PI); - }, - getCos (n) { - return this.drictx * Math.sqrt(Math.pow(n, 2) * this.abspowx / this.abspowz); - }, - getSin (n) { - return this.dricty * Math.sqrt(Math.pow(n, 2) * this.abspowy / this.abspowz); - }, - getCosRate () { - return Math.sqrt(this.abspowx / this.abspowz); - }, - getSinRate () { - return Math.sqrt(this.abspowy / this.abspowz); - }, - getTanRate () { - var diff_x = this.end.x - this.beg.x; - var diff_y = this.end.y - this.beg.y; - return Math.abs(diff_y / diff_x); - }, - getCotRate () { - var diff_x = this.end.x - this.beg.x; - var diff_y = this.end.y - this.beg.y; - return Math.abs(diff_x / diff_y); - }, - middlePoint () { - return { - x: Math.min(this.end.x, this.beg.x) + Math.abs(this.end.x - this.beg.x) / 2, - y: Math.min(this.end.y, this.beg.y) + Math.abs(this.end.y - this.beg.y) / 2 - }; - } -}; - -export default JTriangle; diff --git a/src/jmap/utils/Uid.js b/src/jmap/utils/Uid.js deleted file mode 100644 index 386cefc4a..000000000 --- a/src/jmap/utils/Uid.js +++ /dev/null @@ -1,11 +0,0 @@ -var base = 0; - -/** - * @public - * @param {string} type - * @return {string} - */ -export function getUID(type) { - // use Math.random to make id as unique as possible. - return [(type || ''), base++, Math.random().toFixed(5)].join('_'); -} diff --git a/src/jmap/utils/Uname.js b/src/jmap/utils/Uname.js deleted file mode 100644 index 0e7ee5a42..000000000 --- a/src/jmap/utils/Uname.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @public - * @param {string} type - * @return {string} - */ -export function getUName(list) { - var base = 1; - if (list) { - list.forEach(elem => { - if (elem.hasOwnProperty('name') && Number.isInteger(parseInt(elem.name)) && parseInt(elem.name) >= base) { - base = parseInt(elem.name) + 1; - } - }); - } - return base.toString(); -} diff --git a/src/jmap/utils/parser.js b/src/jmap/utils/parser.js deleted file mode 100644 index 71aabb2bb..000000000 --- a/src/jmap/utils/parser.js +++ /dev/null @@ -1,211 +0,0 @@ -import * as zrUtil from 'zrender/src/core/util'; -import * as matrix from 'zrender/src/core/matrix'; -import deviceType from '../constant/deviceType'; -import deviceRender from '../constant/deviceRender'; -import Vue from 'vue'; -import { deepClone } from '@/utils/index'; - -export function createTransform(opts) { - let transform = matrix.create(); - transform = matrix.scale(matrix.create(), transform, [opts.scaleRate, opts.scaleRate]); - transform = matrix.translate(matrix.create(), transform, [-opts.offsetX, -opts.offsetY]); - return transform; -} - -export function createBoundingRect(view) { - const rect = view.getBoundingRect(); - const scale = view.scale[0]; - const offsetX = view.position[0]; - const offsetY = view.position[1]; - rect.x = rect.x * scale + offsetX; - rect.y = rect.y * scale + offsetY; - rect.width = rect.width * scale; - rect.height = rect.height * scale; - return rect; -} - -export function calculateDCenter(viewRect, zrbound) { - var dx = (zrbound.width - viewRect.width) / 2 - viewRect.x; - var dy = 0; - return { dx: dx, dy: dy }; -} - -export function deviceFactory(type, elem) { - return {...deviceRender[type], ...elem}; -} - -export function createDevice(type, elem, propConvert) { - const device = deviceFactory(type, Object.assign(elem, { _type: type } )); - return propConvert ? propConvert.initPrivateProps(device) : device; -} - -export function parser(data, skinCode) { - var mapDevice = {}; - var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null; - if (data) { - zrUtil.each(data.linkList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Link, elem, propConvert); - }, this); - - zrUtil.each(data.sectionList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert); - }, this); - - zrUtil.each(data.signalList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Signal, elem, propConvert); - }, this); - - zrUtil.each(data.stationList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert); - }, this); - - zrUtil.each(data.stationStandList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert); - }, this); - - zrUtil.each(data.stationControlList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.StationControl, elem, propConvert); - }, this); - - zrUtil.each(data.counterList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.StationCounter, elem, propConvert); - }, this); - - zrUtil.each(data.delayShowList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.StationDelayUnlock, elem, propConvert); - }, this); - - zrUtil.each(data.lineList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert); - }, this); - - zrUtil.each(data.textList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert); - }, this); - - zrUtil.each(data.zcList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert); - }, this); - - zrUtil.each(data.buttonList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.ButtonControl, elem, propConvert); - }, this); - - zrUtil.each(data.lcList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert); - }, this); - - zrUtil.each(data.tempSpeedLimitList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.LimitControl, elem, propConvert); - }, this); - - zrUtil.each(data.resourceList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.ImageControl, elem, propConvert); - }, this); - - zrUtil.each(data.trainList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert); - }, this); - - zrUtil.each(data.Line || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert); - }, this); - - zrUtil.each(data.Text || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert); - }, this); - - zrUtil.each(data.trainWindowList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.TrainWindow, elem, propConvert); - if (elem.sectionCode) { - const section = mapDevice[elem.sectionCode]; - if (section) { - section['trainWindowCode'] = elem.code; - } - } - }, this); - - zrUtil.each(data.switchList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Switch, elem, propConvert); - const cnodeSection = mapDevice[mapDevice[elem.code].sectionACode]; - const lnodeSection = mapDevice[mapDevice[elem.code].sectionBCode]; - const rnodeSection = mapDevice[mapDevice[elem.code].sectionCCode]; - - if (cnodeSection && lnodeSection && rnodeSection) { - cnodeSection['switch'] = lnodeSection['switch'] = rnodeSection['switch'] = mapDevice[elem.code]; - const cnode = mapDevice[cnodeSection.linkCode]; - if (cnode && cnode.leftFdCode === lnodeSection.linkCode && cnode.leftSdCode === rnodeSection.linkCode) { - mapDevice[elem.code].intersection = { - x: cnodeSection.points[0].x, - y: cnodeSection.points[0].y - }; - mapDevice[elem.code].skew = { - x: rnodeSection.points[rnodeSection.points.length - 2].x, - y: rnodeSection.points[rnodeSection.points.length - 2].y - }; - } else if (cnode && cnode.rightFdCode === lnodeSection.linkCode && cnode.rightSdCode === rnodeSection.linkCode) { - mapDevice[elem.code].intersection = { - x: cnodeSection.points[cnodeSection.points.length - 1].x, - y: cnodeSection.points[cnodeSection.points.length - 1].y - }; - mapDevice[elem.code].skew = { - x: rnodeSection.points[1].x, - y: rnodeSection.points[1].y - }; - } - - const section = mapDevice[cnodeSection.parentCode]; - if (section) { - mapDevice[elem.code].sectionName = section.name; - section['relSwitchCode'] = elem.code; - } - - rnodeSection['layer'] = -1; - } - }, this); - } - - return mapDevice; -} - -// 同步绘制数据到原始数据 -export function updateForList(model, state, liststr) { - const list = state.map[liststr]; - if (list && list instanceof Array) { - const i = list.findIndex(elem => { return elem.code == model.code; }); - if (model._dispose) { - i >= 0 && list.splice(i, 1); // 删除 - } else if (!list[i]) { - list.push(deepClone(model)); // 新增 - } else if (i >= 0) { - list[i] = deepClone(model); // item map 数据 model 页面表单数据 - } - } else { - state.map[liststr] = [model]; - } -} - -export function updateMapData(state, model) { - if (state.map && model) { - switch (model._type) { - case deviceType.Link: updateForList(model, state, 'linkList'); break; - case deviceType.Section: updateForList(model, state, 'sectionList'); break; - case deviceType.Switch: updateForList(model, state, 'switchList'); break; - case deviceType.Signal: updateForList(model, state, 'signalList'); break; - case deviceType.Station: updateForList(model, state, 'stationList'); break; - case deviceType.StationStand: updateForList(model, state, 'stationStandList'); break; - case deviceType.StationControl: updateForList(model, state, 'stationControlList'); break; - case deviceType.StationCounter: updateForList(model, state, 'stationCounterList'); break; - case deviceType.ZcControl: updateForList(model, state, 'zcControlList'); break; - case deviceType.StationDelayUnlock:updateForList(model, state, 'stationDelayUnlockList'); break; - case deviceType.LcControl: updateForList(model, state, 'lcControlList'); break; - case deviceType.ButtonControl: updateForList(model, state, 'buttonList'); break; - case deviceType.LimitControl: updateForList(model, state, 'tempSpeedLimitList'); break; - case deviceType.ImageControl: updateForList(model, state, 'imageControl'); break; - case deviceType.Train: updateForList(model, state, 'trainList'); break; - case deviceType.TrainWindow: updateForList(model, state, 'trainWindowList'); break; - case deviceType.Line: updateForList(model, state, 'lineList'); break; - case deviceType.Text: updateForList(model, state, 'textList'); break; - } - } -} diff --git a/src/jmapNew/config/deviceStyle.js b/src/jmapNew/config/deviceStyle.js index 30d366b60..0a866fe5c 100644 --- a/src/jmapNew/config/deviceStyle.js +++ b/src/jmapNew/config/deviceStyle.js @@ -3,13 +3,15 @@ const mapDeviceStyle = { '02': 'fuzhou_01', '03': 'bejing_01', '04': 'chengdu_03', + '05': 'fuzhou_01', '06': 'ningbo_01', '07': 'haerbin_01', '08': 'foshan_01', '09': 'xian_02', '10': 'xian_01', // 西安一号线 '11': 'xian_01', // 西安三号线 - '12': 'ningbo_03' // 宁波三号线 + '12': 'ningbo_03', // 宁波三号线 + '13': 'race_01' // 2020国赛线路 }; export function selectLineCode(code) { diff --git a/src/jmapNew/config/skinCode/bejing_01.js b/src/jmapNew/config/skinCode/bejing_01.js index c06efa81f..7020047f3 100644 --- a/src/jmapNew/config/skinCode/bejing_01.js +++ b/src/jmapNew/config/skinCode/bejing_01.js @@ -19,7 +19,8 @@ class SkinCode extends defaultStyle { fontColor: '#FFFFFF', // 字体颜色 textAlign: 'center', // 水平对齐方式 textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#FFFFFF' }, logicText: { // 逻辑区段名称 z: 10, @@ -362,9 +363,6 @@ class SkinCode extends defaultStyle { fontWeight: 'normal', // 字体粗细 distance: 5 // 灯跟文字距离 } - // trainStop: {}, // 停车标志 - // trainDepart: {}, // 停车计时 - }; this[deviceType.StationCounter] = { diff --git a/src/jmapNew/config/skinCode/chengdu_01.js b/src/jmapNew/config/skinCode/chengdu_01.js index 6bf0a590a..e628cb1dd 100644 --- a/src/jmapNew/config/skinCode/chengdu_01.js +++ b/src/jmapNew/config/skinCode/chengdu_01.js @@ -19,7 +19,8 @@ class SkinCode extends defaultStyle { fontColor: 'lightgreen', // 字体颜色 textAlign: 'center', // 水平对齐方式 textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#FFFFFF' }, logicText: { // 逻辑区段名称 z: 10, @@ -107,6 +108,7 @@ class SkinCode extends defaultStyle { }, speedLimitName: { z: 10, + limitValueDistance: -15, kilometerFontSize: 8, // 公里标大小 kilometerColor: '#fff', // 公里标颜色 nameNumberFontSize: 11, // 限速值大小 diff --git a/src/jmapNew/config/skinCode/chengdu_03.js b/src/jmapNew/config/skinCode/chengdu_03.js index d57469786..e0f8d37e6 100644 --- a/src/jmapNew/config/skinCode/chengdu_03.js +++ b/src/jmapNew/config/skinCode/chengdu_03.js @@ -19,7 +19,8 @@ class SkinCode extends defaultStyle { fontColor: '#FFFFFF', // 字体颜色 textAlign: 'center', // 水平对齐方式 textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#FFFFFF' }, logicText: { z: 10, @@ -107,6 +108,7 @@ class SkinCode extends defaultStyle { }, speedLimitName: { z: 10, + limitValueDistance: -15, kilometerFontSize: 8, // 公里标大小 kilometerColor: '#fff', // 公里标颜色 nameNumberFontSize: 11, // 限速值大小 diff --git a/src/jmapNew/config/skinCode/foshan_01.js b/src/jmapNew/config/skinCode/foshan_01.js index 80e729f99..e8b94c833 100644 --- a/src/jmapNew/config/skinCode/foshan_01.js +++ b/src/jmapNew/config/skinCode/foshan_01.js @@ -19,7 +19,8 @@ class SkinCode extends defaultStyle { fontColor: '#FFFFFF', // 字体颜色 textAlign: 'center', // 水平对齐方式 textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#FFFFFF' }, logicText: { z: 10, @@ -430,7 +431,8 @@ class SkinCode extends defaultStyle { // 延续保护计时 this[deviceType.OverAp] = { - show: true + show: true, + textColor: '#FFF' }; this[deviceType.Switch] = { diff --git a/src/jmapNew/config/skinCode/fuzhou_01.js b/src/jmapNew/config/skinCode/fuzhou_01.js index 27969c9cf..a4c9e1311 100644 --- a/src/jmapNew/config/skinCode/fuzhou_01.js +++ b/src/jmapNew/config/skinCode/fuzhou_01.js @@ -19,7 +19,8 @@ class SkinCode extends defaultStyle { fontColor: '#FFFFFF', // 字体颜色 textAlign: 'center', // 水平对齐方式 textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#FFFFFF' }, logicText: { z: 10, diff --git a/src/jmapNew/config/skinCode/haerbin_01.js b/src/jmapNew/config/skinCode/haerbin_01.js index 259d57b30..258e96671 100644 --- a/src/jmapNew/config/skinCode/haerbin_01.js +++ b/src/jmapNew/config/skinCode/haerbin_01.js @@ -19,7 +19,8 @@ class SkinCode extends defaultStyle { fontColor: '#FFFFFF', // 字体颜色 textAlign: 'center', // 水平对齐方式 textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#FFFFFF' }, logicText: { z: 10, @@ -265,7 +266,7 @@ class SkinCode extends defaultStyle { z:1, position: 1, // 停跳方向 text: 'S', // 停跳显示内容 - offset: { x: 10, y: 20 }, + offset: { x: 20, y: 21 }, textColor: '#00FF00', // 停跳文字颜色 fontWeight: 'bold', // 文字居中 fontSize: 18 // 文字大小 diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index 73a543f3b..f31865164 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -19,7 +19,8 @@ class SkinCode extends defaultStyle { fontColor: 'lightgreen', // 字体颜色 textAlign: 'center', // 水平对齐方式 textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#FFFFFF' }, logicText: { // 逻辑区段名称 z: 10, @@ -300,6 +301,7 @@ class SkinCode extends defaultStyle { }, arcBlcok: { // 圆形封锁图形 show: true, // 显示 + shapeR: 5, arcBorderColor: 'green', // 默认边框颜色 locationColor: 'green', // 定位封锁颜色 inversionColor: '#FFFF00' // 反位封锁颜色 diff --git a/src/jmapNew/config/skinCode/ningbo_03.js b/src/jmapNew/config/skinCode/ningbo_03.js index ea4cf05a7..7cc2e3bc6 100644 --- a/src/jmapNew/config/skinCode/ningbo_03.js +++ b/src/jmapNew/config/skinCode/ningbo_03.js @@ -20,7 +20,8 @@ class SkinCode extends defaultStyle { fontColor: '#000', // 字体颜色 textAlign: 'center', // 水平对齐方式 textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#FFFFFF' }, logicText: { // 逻辑区段名称 z: 10, diff --git a/src/jmapNew/config/skinCode/race_01.js b/src/jmapNew/config/skinCode/race_01.js new file mode 100644 index 000000000..b03a1a6d8 --- /dev/null +++ b/src/jmapNew/config/skinCode/race_01.js @@ -0,0 +1,795 @@ +import defaultStyle from '../defaultStyle'; +import deviceType from '../../constant/deviceType'; + +class SkinCode extends defaultStyle { + constructor() { + super(); + this.fontFamily = '宋体'; + this[deviceType.Section] = { + elemnetType:['name', 'standTrackText', 'reentryTrackText', 'transferTrackText', 'destinationText', 'line', 'separator', 'speedLimit', 'speedLimitName'], + active: { + routeColor: false // 进路触发颜色 + }, + name: { // 物理区段名称 + z: 10, + position: -1, // 区段名称位置 1 上面 -1 下面 0 对称 + distance: 11, // 文字离区段距离 + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + fontColor: '#FFFFFF', // 字体颜色 + textAlign: 'center', // 水平对齐方式 + textPosition: 'inside', // 文字位置 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#0F0' // 接近区段文字颜色 + }, + logicText: { // 逻辑区段名称 + z: 10, + position: -1, // 区段名称位置 1 上面 -1 下面 0 对称 + distance: 11, // 文字离区段距离 + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + fontColor: '#FFFFFF', // 字体颜色 + textAlign: 'center', // 水平对齐方式 + textPosition: 'inside', // 文字位置 + textVerticalAlign: 'middle' // 文字垂直对齐方式 + }, + standTrackText: { // 站台轨名称 + z: 10, + position: 1, // 区段名称位置 1 上面 -1 下面 0 对称 + distance: 11, // 文字离区段距离 + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + fontColor: '#FFFFFF', // 字体颜色 + textAlign: 'center', // 水平对齐方式 + textPosition: 'inside', // 文字位置 + textVerticalAlign: 'middle' // 文字垂直对齐方式 + }, + reentryTrackText: { // 折返轨名称 + z: 10, + position: 1, // 区段名称位置 1 上面 -1 下面 0 对称 + distance: 11, // 文字离区段距离 + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + fontColor: '#FFFFFF', // 字体颜色 + textAlign: 'center', // 水平对齐方式 + textPosition: 'inside', // 文字位置 + textVerticalAlign: 'middle' // 文字垂直对齐方式 + }, + transferTrackText: { // 转换轨名称 + z: 10, + position: 1, // 区段名称位置 1 上面 -1 下面 0 对称 + distance: 11, // 文字离区段距离 + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + fontColor: '#FFFFFF', // 字体颜色 + textAlign: 'center', // 水平对齐方式 + textPosition: 'inside', // 文字位置 + textVerticalAlign: 'middle' // 文字垂直对齐方式 + }, + speedLimitName: { + z: 10, + limitValueDistance: 15, // 限速值距离 + kilometerFontSize: 0, // 公里标大小 + kilometerColor: '#000', // 公里标颜色 + nameNumberFontSize: 11, // 限速值大小 + nameNumberColor: '#C0C000', // 限速值颜色 + nameBackground: 'rgba(0, 0, 0, 0)', // 限速名称背景颜色 + drogueWidth: 19, // 浮标宽度 + drogueHeight: 12 // 浮标高度 + }, + destinationText: { // 目的码名称 + z: 10, + position: 1, // 区段名称位置 1 上面 -1 下面 0 对称 + distance: 11, // 文字离区段距离 + fontSize: 11, // 字体大小 + fontWeight: 'bold', // 字体粗细 + fontColor: 'yellow', // 字体颜色 + textAlign: 'center', // 水平对齐方式 + textPosition: 'inside', // 文字位置 + textVerticalAlign: 'middle' // 文字垂直对齐方式 + }, + mouseOverStyle: { + borderColor: '#fff', + borderBackgroundColor: '#22DFDF', + textShadowColor: '#22DFDF', + nameShow: true, + lineDash: [3, 3], + lineWidthMore: 2.5 + }, + line: { + z: 0, + width: 5, // 区段宽度 + beyondWidth: 0, // 区段宽超出宽度 + invadeColor: '#EF0C08', // 区段侵入颜色 + spareColor: '#808080', // 区段空闲颜色 + communicationOccupiedColor: '#FF0000', // 区段通信车占用颜色 + unCommunicationOccupiedColor: '#800080', // 区段非通讯车占用颜色 + routeLockColor: '#FFFFFF', // 区段路由锁定颜色 + faultLockColor: '#00FF00', // 区段故障锁定颜色 + undefinedColor: '#0071C1', // 区段未定义颜色 + protectionLockedColor: '#FEFF00', // 保护区段锁闭(未用) + blockColor: '#800080', // 区段封锁颜色 + atcExcisionColor: '#A0522D', // 区段atc切除颜色 + atsExcisionColor: '#A0522D', // 区段ats切除颜色 + invalidColor: '#AC8F40', // 计轴故障颜色 + timeReleaseColor: '#3F3F3F', // 区段延时释放颜色 + protectiveLockColor: '#FFFF00', // 区段保护锁闭 + protectiveTimeReleaseColor: '#0071C1', // 区段保护延时解锁 + logicalColor: '#FFFF00', // 逻辑区段颜色 (未用) + logicalTextColor: '#C0C0C0' // 逻辑区段名称颜色 (未用) + }, + speedLimit: { // 限速元素 + z: 2, + width: 1, // 限速线的宽度 + distance: 5, // 限速线距离区段距离 + lineColor: '#FFFF00', // 限速线颜色 + nameShow: false // 名称显示 + }, + separator: { + z: 3, // 分割符层级 + width: 1.5, // 分隔符宽度 + endWidth: 1.5, // 尽头分隔符宽度 + endColor: '#7F7F7F', // 尽头分隔符颜色 + color: '#7F7F7F', // 区段边界符颜色 + halfHeight: 5 // 区段分隔符高度的一半 + }, + trainPosition:{ + display: false // 列车实时位置显示 + } + }; + + this[deviceType.Signal] = { + distance: 0, // 设备距离区段的距离 + xColor: '#C0C0C0', // 信号灯x颜色 + post: { + standardLength: 6, // 高柱长度 + standardHeight: 6, // 灯柱高度 + standardColor: '#969696', // 灯灯柱颜色 + standardWidth: 3 // 灯柱宽度 + }, + text: { + show: true, // 信号机名称显示 + distance: 3, // 文字和灯杆的距离 + isAlignCenter: false, // 信号字体对其方式 + fontSize: 11, // 信号机名称字体大小 + fontWeight: 'bold', // 信号机名称字体粗细 + defaultColor: '#C0C0C0', // 信号灯字体默认色 + blockColor: '#EF0C08', // 信号灯字体锁定颜色 + checkColor: '#00FF00' // 信号字体 + }, + lamp: { + bgShow: false, // 是否被选中 + guidName: 'defult', // 默认引导类型 + stopWidth: 1, // 禁止线宽度 + borderVariable: false, // 信号灯边框可变 + borderWidth: 1, // 信号灯边框线宽度 + borderColor: '#c0c0c0', // 信号灯边框线颜色 + radiusR: 5, // 信号机宽度 + blockColor: '#EF0C08', // 信号灯锁闭 + grayColor: '#7F7F7F', // 信号灯灰色 + redColor: '#FF0000', // 信号灯红色 + greenColor: '#00FF00', // 信号灯绿色 + yellowColor: '#FFFF00', // 信号灯黄色 + whiteColor: '#FFFFFF', // 信号灯白色 + blueColor: '#0070C0' // 信号灯蓝色 + }, + route: { + direction: false, // 自动进路方向 + offset: { x: 1, y: -2 }, // 自动进路偏移量 + routeColor: '#00FF00', // 自动进路 + radiusR: 6 + }, + auto: { + signalFrontTriangle: true, // 信号灯前三角展示 + direction: true, // 自动通过方向 + offset: { x: -4, y: 0 }, // 自动通过偏移量 + width: 5, // 自动宽度 + autoRoute: '#00FF00', // 自动进路 + autoTrigger: '#FFFF00', // 自动触发 + manualControl: '#FFFF00', // 人工控制 + outConflict: '#C00808' // 出车冲突 + }, + delay: { + direction: false, // 延时解锁方向 + offset: { x: 0, y: -5 }, // 延时解锁偏移量 + fontSize: 9, // 延迟解锁字体大小 + fontColor: '#FF0000', // 延迟解锁颜色 + fontWeight: 'bold' // 字体粗细 + }, + button: { + distance: 5, // 信号灯按钮距离区段的距离 + borderDashColor: '#FFFFFF', // 信号灯按钮边线 + buttonColor: 'darkgreen', // 信号灯按钮颜色 + buttonLightenColor: '#E4EF50' // 信号灯按钮闪烁颜色 + }, + mouseOverStyle: { + borderLineColor: '#FFFFFF', + borderLineDash: [3, 3], + nameBackgroundColor: '#22DFDF', + lampBorderLineColor: '#22DFDF' + }, + lowButton:{ + display: true, // 现地 信号机按钮 + strokeColor:'#ffffff', + fillColor:'#025e01', + fillActiveColor:'#ffff00' + } + }; + + this[deviceType.StationTurnBack] = { // 站后折返 + displayCondition: '01', // 显示条件 (01所有模式下显示 02 行调显示 03现地显示) + lamp: { + fill: '#f1f1f1', // 填充色 + radiusR: 7 // 控制灯大小 + }, + text: { + titleTextShow: true, + fontWeight: 580, + fontSize: 10, + distance: 10 + }, + rect: { + fill: 'rgba(0,0,0,0)', + stroke: '#fff', + lineWidth: 0, + padding: 6 + } + }; + + this[deviceType.AutoTurnBack] = { + // 是否显示 + visibleConditions: '03', + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + subtitleText: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 17 // 等于副标题距离 + }, + lamp: { + lineDash: null, // 灯的包围框 + borderShow: false, // 是否显示边框 + stroke: '#FFFFFF', // 框的颜色 + fill: 'rgba(0,0,0,0)', // 填充色 + radiusR: 6, // 控制灯大小 + controlColor: '#b5b3b3', // 控制灯颜色 (灰色) + lightUpColor: '#ffff00' // 点亮灯颜色 + }, + OutFrame: { + + } + }; + + /** 引导总锁 */ + this[deviceType.GuideLock] = { + // 是否显示 + displayCondition: '03', // 显示条件 prdType + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + fill: 'rgba(0,0,0,0)', // 填充色 + radiusR: 6, // 控制灯大小 + controlColor: '#b5b3b3', // 控制灯颜色 (灰色) + lightUpColor: '#FF0000' // 点亮灯颜色 + } + }; + + // 供电线路 + this[deviceType.Power] = { + lineColor: '#FFFFFF', // 线条颜色 + strokeColor: 'red', // 线条颜色 + extendLength: 10 // 延伸长度 + }; + + // 延续保护计时 + this[deviceType.OverAp] = { + show: true, + textColor: '#FF0', + textPadding: [1, 3], + textBorderColor: '#FF0', + textBorderWidth: 1 + }; + + // 屏蔽门 + this[deviceType.Psd] = { + // 北京线屏蔽门 + elemnetType:['safetyDoorNormal'], + safetyDoorNormal: { // 屏蔽门 + z:0, + height: 1.6, // 站台屏蔽门高度 + distance: 9, // 站台和屏蔽门之间的距离 + defaultColor: '#00FF00', // 屏蔽门默认颜色 + splitDoorColor: '#F61107' // 屏蔽门切除颜色 + } + }; + + // 站台 + this[deviceType.StationStand] = { + // 北京线站台元素 站台 站台紧急关闭 扣车元素 停站时间 运行等级 + elemnetType:['solidStand', 'emergentRhombus', 'detainNormal', 'stopTime', 'level', 'jump'], + // 站台 + solidStand:{ + // 层级 + z:0, + spareColor: '#FFF', // 站台空闲颜色 + jumpStopColor: '#AB82FF', // 站台跳停颜色 + designatedJumpStopColor: '#AB82FF', // 站台指定列车跳停颜色 + headFontSize: 8, // 站台首端字体大小 + stopColor: '#FEFE00' // 站台列车停站颜色 + }, + // 站台紧急关闭 + emergentRhombus:{ + z:1, + mergentR: 4, // 站台紧急关闭半径 + mergentN: 4, // 站台紧急关闭边数 + insideOffset: { x: 0, y: -40 }, // 内站台紧急关闭偏移量 + outsideOffset: { x: 0, y: 20 }, // 外站台紧急关闭偏移量 + closeColor: '#F61107' // 站台紧急关闭颜色 + }, + // 扣车元素 普通扣车 + detainNormal:{ + z:0, + position: -1, // 扣车标识在站台上显示方向 + text: 'H', // 扣车显示内容 + offset: { x: -8, y: 13 }, // 扣车偏移量 + centerTrainColor: '#00FF00', // 中心扣车颜色 + andCenterTrainColor: '#00FF00', // 车站+中心扣车颜色 + detainTrainTextColor: '#00FF00', // 车站扣车文字颜色 + fontSize: 25, // 字体大小 + fontWeight: 'normal' + }, + // 停站时间 + stopTime:{ + z:1, + textFontSize: 8, // 停站时间字体大小 + textColor: '#FFFFFF', // 停站时间字体颜色 + position: 1, // 停站时间方向 + offset: { x: -8, y: 25 } // 停站时间偏移量 + }, + jump: { + z:1, + position: 1, // 停跳方向 + text: 'S', // 停跳显示内容 + offset: {x: -8, y: -8}, + textColor: '#FA80F5', // 停跳文字颜色 + arcColor: '#000000', // 停跳圆圈颜色 + fillColor: 'rgba(0,0,0,0)', // 透明填充颜色 + fontWeight: 'normal', // 文字居中 + fontSize: 25 // 文字大小 + }, + // 运行等级 + level:{ + z:1, + textFontSize: 8, // 运行等级字体大小 + position: 1, // 运行等级方向 + offset: { x: -8, y: 10 }, // 运行等级偏移量 + textColor: '#FFFFFF' // 停站等级字体颜色 + }, + // 鼠标事件样式 + mouseOverStyle: { + borderLineColor: '#FFFFFF', + borderLineDash: [3, 3] + }, + // reentry: {}, // 站台折返策略 + common: { // 通用属性 + textFontSize: 8, // 站台默认字体大小 + functionButtonShow: '03' // 功能灯按钮显示条件(01所有模式下显示 02 行调显示 03现地显示) + }, + lamp: { + radiusR: 6, // 控制灯大小 + lampColor: '#5A5D5A' // 功能按钮颜色 + }, + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + } + // trainStop: {}, // 停车标志 + // trainDepart: {}, // 停车计时 + + }; + + this[deviceType.StationCounter] = { + text: { + distance: 2, // 计数器名称和文字的距离 + fontColor: '#FFFFFF', // 计数器字体颜色 + borderColor: '#E4EF50' // 计数器边框颜色 + } + }; + + this[deviceType.StationDelayUnlock] = { + text: { + distance: 3, // 延迟解锁和设备之间的距离 + fontColor: '#FFFFFF', // 延时解锁字体颜色 + borderColor: '#FFFFFF' // 延迟解锁边框颜色 + } + }; + + this[deviceType.Station] = { + // text: { + // show: true // 公里标名称显示 + // }, + kmPostShow: true, // 公里标显示 + kilometerPosition: 'down', // 公里标位置 + fontWeight: 'bold', // 文字错细 + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, // 控制灯大小 + controlColor: '#FFFF00' // 控制灯颜色 + }, + turnBack: { // 按图折返 + lamp: 1, // 灯数量 + lampSpace: 60 // 灯间距 + }, + StationControl: { + text: { + distance: 2, // 灯和文字之间的距离 + fontSize: 10, // 控制模式字体大小 + fontFormat: 'consolas', // 控制模式字体格式 + fontColor: '#ffffff', // 控制模式字体颜色 + fontWeight: 'normal', // 控制模式字体粗细 + textAlign: 'middle', // 控制模式水平对齐 + textVerticalAlign: 'top' // 控制模式垂直对齐 + }, + lamp: { + count: 3, // 控制模式灯个数 + offset: { x: 0, y: 0 }, // 偏移量 + radiusR: 6, // 控制模式灯的半径 + distance: 46, // 控制模式之间灯之间的距离 + grayColor: '#7F7F7F', // 控制模式灰色 + greenColor: '#00FF00', // 控制模式绿色 + redColor: '#FF0000', // 控制模式红色 + yellowColor: '#FFFF00', // 控制模式黄色 + textColorNoChange: true // 控制灯颜色不随控制灯改变 + }, + emergencyControl: { // 紧急站控 + show: true, + offset: { x: 92, y: 0 }, + text: '紧急站控', + arrowShow: false, + grayColor: '#7F7F7F' + }, + centerControl: { // 中控 + show: true, + offset: { x: -46, y: 0 }, + text: '遥控', + buttonShow: false, + arrowShow: false, + grayColor: '#7F7F7F' + }, + substationControl: { // 站控按钮 + show: true, + offset: { x: -46, y: 0 }, + text: '站控', + arrowShow: false, + grayColor: '#7F7F7F' + }, + interconnectedControl: { // 联锁控 + show: false, + offset: { x: 0, y: 0 }, + text: '联锁控', + arrowShow: false, + grayColor: '#7F7F7F' + }, + mouseOverStyle: { // 鼠标悬浮样式 + fontSize: 10, + fontFormat: 'consolas', + fontColor: '#FFF000', + fontWeight: 'normal', + textAlign: 'middle', + textVerticalAlign: 'top' + } + } + }; + + this[deviceType.Switch] = { + text: { + show: true, // 道岔名称显示 + position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 + offset: { x: 5, y: -10 }, // 道岔名称与区段距离 + fontSize: 11, // 字体大小 + fontColor: '#C0C0C0', // 道岔名称颜色 + fontWeight: 'normal', // 字体粗细 + borderColor: '#FE0000', // 道岔边框颜色 + lossColor: '#FE0000', // 道岔失去颜色 + locateColor: '#00FF00', // 道岔定位颜色 + inversionColor: '#FFFF00', // 道岔反位颜色 + monolockLocationColor: '#c00000', // 道岔单锁'定位'颜色 (红色) + monolockInversionColor: '#c00000', // 道岔单锁'反位'颜色 (红色) + block: true, // 封锁名称 + faultFlashing: true // 故障闪烁 + }, + sectionAction: { + flag: false, // 道岔 关联区段显示 + spareColor: '#5b5b5b' // 区段显示颜色 + }, + core: { + length: 6, // 道岔单边长度 + graphShow: true // 图形显示 + }, + jointImg: { // 道岔 A B C D四元素属性配置 + trapezoidLength: 8, // 直角梯形元素默认长度 + fork: true, // 挤岔专用(如有挤岔操作 变为true) + faultStatus: true, // 挤岔表示 + forKColor: 'red' // 挤岔颜色 配合挤岔专用 + }, + arcBlcok: { // 圆形封锁图形 + show: true, // 显示 + shapeR: 15, + arcBorderColor: 'green', // 默认边框颜色 + locationColor: 'green', // 定位封锁颜色 + inversionColor: '#FFFF00' // 反位封锁颜色 + }, + rectLock: { // 矩形封锁框图形 + rectWidth: 22, // 矩形框 宽高 + rectBorderColor: '#fff', // 矩形边框颜色 + monolock: false, // 单锁显示 + block: false // 封锁显示 + } + }; + + this[deviceType.LcControl] = { + text: { + fontSize: 10, // 灯字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, // 灯大小 + controlColor: '#FFFF00' // 灯颜色 + }, + mouseOverStyle: { + fontSize: 10, + fontFormat: 'consolas', + fontColor: '#FFF000', + fontWeight: 'normal', + textAlign: 'middle', + textVerticalAlign: 'top', + arcColor: '#00FFFF', + textColor: '#000000' + } + }; + this[deviceType.ZcControl] = { + // 是否显示 + visible: true, + text: { + fontSize: 10, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, // 灯大小 + controlColor: '#00FF00', // 灯颜色 + activeColor:'#ff0000' // 控制灯激活颜色 + }, + mouseOverStyle: { + fontSize: 10, + fontFormat: 'consolas', + fontColor: '#FFF000', + fontWeight: 'normal', + textAlign: 'middle', + textVerticalAlign: 'top', + arcColor: '#00FFFF', + textColor: '#000000' + } + }; + + this[deviceType.LimitControl] = { + text: { + fontSize: 10, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, // 灯大小 + controlColor: '#ECE9D8' // 灯颜色 + }, + mouseOverStyle: { + fontSize: 10, + fontFormat: 'consolas', + fontColor: '#FFF000', + fontWeight: 'normal', + textAlign: 'middle', + textVerticalAlign: 'top', + textColor: '#000000', + arcColor: '#00FFFF' + } + }; + + this[deviceType.Line] = { + lineColor: '#FFFFFF' // 线条颜色 + }; + this[deviceType.AutomaticRoute] = { + // 是否显示 + displayCondition: '03', // 显示条件 prdType + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + fill: 'rgba(0,0,0,0)', // 填充色 + radiusR: 6, // 控制灯大小 + controlColor: '#b5b3b3' // 控制灯颜色 (灰色) + } + }; + this[deviceType.TrainWindow] = { + lineColor: '#FFF', // 车次窗颜色 + lineDash: [3, 3], // 车次窗虚线间隔 + lineWidth: 1, // 车次窗线宽 + trainWindowSmooth: 0.01, // 车次窗矩形圆滑程度 + show: true // 车次窗是否显示 + }; + this[deviceType.SplitStation] = { + lineLength: 15, // 箭头线长度 + lineWidth: 2, // 线宽 + height: 35, // 分隔整体高度 + strokeColor: '#00FF00', // 线颜色 + triangleFillColor: '#00FF00', // 三角填充颜色 + textFill: '#FFFFFF', // 文字颜色 + verticalDistance: 10, // 箭头三角垂直高度 + horizontalDistance: 7// 箭头三角水平高度 + }; + this[deviceType.Train] = { + trainBody: { + fontFamily: 'consolas', + trainBodyLineWidth: 1, // 车身line宽 + changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 + specialTrainType: [ + { + type: '03', + serviceNumber: 'M0', + nameFormat: 'serviceNumber:groupNumber' + }, + { + type: '02', + nameFormat: 'targetCode:groupNumber' + } + ], // 特殊列车类型需设置显示格式 + lrPadding: 4, // 两边间隔 + upPadding: 4, // 上边距离 + trainBodyFillColor: 'rgba(0,0,0,0)', // 列车车身填充颜色 + trainNameFormat: 'serviceNumber:tripNumber', // 列车显示格式 + trainSidelineColor:'#A5A5A5' // 列车边框颜色 + }, + soonerOrLater: { + level: 6, + // serviceNumber: true, + smallLateColor:'#FFFF00', + bigEarlyColor:'#00C900', + bigLateColor:'#FF0000', + normalColor: '#A5A5A5' + }, + directionArrow: { + }, + hsda: { + lrPaddingHSDA: 3, // HSDA两边间隔 + upPaddingHSDA: 4, // HSDA上边距离 + trainHSDATextFontSize: 9, // 列车HDSA字号 + textHContent: 'H', // textH文本 + textSContent: 'S', // textS文本 + textDContent: 'D', // textD文本 + textAContent: 'A'// textA文本 + }, + trainNumber: { + targetCodePrefix: '000', // 目的地码前缀 + trainNumberOffset: { x: 0, y: 1 }// 目的地码偏移量 + }, + trainServer: { + serviceNumberPrefix: '00', // 服务号(表号)前缀 + defaultServiceNumber: 'AA', // 默认服务号(表号) + defaultServiceHeadNum: 'MM', // 人工车号 + trainServerOffset: { x: 4, y: 4 }// 列车服务号偏移 + }, + trainTarget: { + tripNumberPrefix: '0000', // 车次号前缀 + defaultTripNumber: 'BBBB', // 默认车次号2 + trainTargetOffset: { x: 36, y: 4 }, // 列车车次号偏移 + trainTargetTextAlign: 'left'// 车次号文字显示位置 + }, + trainTargetNumber: { + groupNumberPrefix: '000', // 车组号前缀 + defaultGroupNumber: 'EEE', // 默认车组号 + trainTargetNumberOffset: { x: -4, y: 4 }// 车组号偏移量 + }, + trainHead: { + trainHeadRectHeight: 20, // 列车车头矩形高度 + trainConntWidth: 3, // 列车竖杠的宽度 + trainHeadFillColor: '#000000', // 列车车头矩形填充颜色 + directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常 + trainHeadHeight: 'trainBox', // 列车车头高度取决于trainBox高度 + trainHeadArrowWidth: 6, // 列车车头三角宽度 + trainHeadArrowOffsetX: 7 // 列车车头三角偏移 + }, + common: { + trainHeight: 20, // 列车高度 + trainHeadDistance: 4, // 列车和车头之间的间距 + trainWidth: 48, // 列车长度 + trainTextFontSize: 12, // 列车字号 + fontFamily: 'consolas', // 默认字体 族类 + haveTextHSDA: true, // 是否需创建textHSDA对象 + haveArrowText: true, // 是否需创建arrowText对象 + textOffset: 4, // 字体偏移(用以控制字体据车头的距离) + trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 + displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 + trainTip:true // 鼠标悬停列车状态信息框是否显示 + }, + trainStatusStyle: { + destinationStatus: [ + { status: '01', showColor: '#FFFFFF' }, + { status: '02', showColor: '#00FF00' }, + { status: '03', showColor: '#A0522D' }, + { status: '04', showColor: '#FFFF00' } + ], // 目的地状态 01准点 02早点 03晚点 04头码车 + defaultDestinationColor: '#FFFFFF', // 默认目的地状态显示颜色 + destinationStatusSetText: 'trainTarget', // 目的地状态设置的对应哪个text的颜色 + directionType: [ + { + type: 1, + lineLShow: false, + lineRShow: true, + arrowLShow: false, + arrowRShow: true + }, + { + type: 0, + lineLShow: true, + lineRShow: false, + arrowLShow: true, + arrowRShow: false + } + ], // 列车运行方向状态类型对应车头显示状态 1从左往右 0从右往左 + directionStopType: [ + { type: 1, lineLShow: false, lineRShow: true }, + { type: 0, lineLShow: true, lineRShow: false } + ], // 列车停止方向类型对应车头显示状态 1从左往右 0从右往左 + driveModeStatus: [ + { + status: 'AM', + trainLColor: '#00FF00', + trainRColor: '#00FF00' + }, + { + status: 'CM', + trainLColor: '#FFFF00', + trainRColor: '#FFFF00' + }, + { + status: 'RM', + trainLColor: '#A0522D', + trainRColor: '#A0522D' + }, + { + status: 'NRM', + trainLColor: '#A0522D', + trainRColor: '#A0522D' + } + ], // 列车运行模式对应车头颜色 ATO自动驾驶模式AM ATP监控下的人工驾驶模式CM 限制人工驾驶模式RM 非限制人工驾驶模式NRM + communicationStatus: [ + {status: 'CBTC', trainColor: '#725A64'}, + {status: 'ITC', trainColor: '#C0C0C0'}, + {status: 'IL', trainColor: '#C0C0C0'} + ], // 设置通信状态 cbtc级别CBTC 点式通信ITC 联锁级IL + serverNoType: [ + { type: '01', showColor: '#FFFFFF' }, + { type: '02', showColor: '#FFF000' } + ], // 服务号状态类型 01显示服务号 计划车 02显示车组号: 头码车与人工车 + defaultServerNoColor: '#FFFFFF' // 默认服务号状态显示颜色 + } + }; + this[deviceType.FloodGate] = {}; + this[deviceType.DirectionRod] = {}; + } +} + +export default new SkinCode(); diff --git a/src/jmapNew/config/skinCode/xian_01.js b/src/jmapNew/config/skinCode/xian_01.js index 84323ae0c..0cebb94a4 100644 --- a/src/jmapNew/config/skinCode/xian_01.js +++ b/src/jmapNew/config/skinCode/xian_01.js @@ -19,7 +19,8 @@ class SkinCode extends defaultStyle { fontColor: '#FFFFFF', // 字体颜色 textAlign: 'center', // 水平对齐方式 textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#FFFFFF' }, logicText: { z: 10, diff --git a/src/jmapNew/config/skinCode/xian_02.js b/src/jmapNew/config/skinCode/xian_02.js index 0dad06395..56be9107e 100644 --- a/src/jmapNew/config/skinCode/xian_02.js +++ b/src/jmapNew/config/skinCode/xian_02.js @@ -19,7 +19,8 @@ class SkinCode extends defaultStyle { fontColor: '#FFFFFF', // 字体颜色 textAlign: 'center', // 水平对齐方式 textPosition: 'inside', // 文字位置 - textVerticalAlign: 'middle' // 文字垂直对齐方式 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + approachColor: '#FFFFFF' }, logicText: { // 逻辑区段名称 z: 10, diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index 125263262..1fe49d8ea 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -248,15 +248,6 @@ class Jlmap { (list || []).forEach(elem => { const code = elem.code; const type = elem._type; - if (type == 'OverAp') { - const overlapRoute = store.state.map.overlapData[code]; - const model = this.mapDevice[overlapRoute.pathList[0].sectionList[0]]; - if (overlapRoute.pathList[0].right) { - elem['points'] = { x: model.points[0].x, y: model.points[0].y }; - } else { - elem['points'] = { x: model.points[model.points.length - 1].x, y: model.points[model.points.length - 1].y }; - } - } // const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig); const oDevice = deviceFactory(type, elem, this.showConfig); // const nDevice = deepAssign(oDevice || {}, elem); @@ -347,7 +338,7 @@ class Jlmap { }); } setUpdateMapDevice(list) { - store.dispatch('map/updateMapDevice', list); + store.commit('map/updateMapDevice', list); (list || []).forEach(elem => { const code = elem.code; const type = elem._type; @@ -492,8 +483,7 @@ class Jlmap { } else { if (elem.deviceType === 'TRAIN') { this.isUpdateShowTrainList = true; - store.dispatch('map/updateActiveTrainList', elem); - // store.dispatch('map/updateTrainState', elem); + store.commit('map/updateActiveTrainList', elem); } else if (elem.deviceType === 'STAND') { store.dispatch('map/updateStationStand', elem); const psdDevice = this.mapDevice[this.mapDevice[elem.code].psdCode]; @@ -514,9 +504,7 @@ class Jlmap { if (elem.dispose) { this.$painter.delete(oDevice); } else { - // if (this.hookHandle(oDevice, elem)) { this.$painter.update(oDevice); - // } } } }); diff --git a/src/jmapNew/mouseController.js b/src/jmapNew/mouseController.js index 4b7918e82..7ef0a8514 100644 --- a/src/jmapNew/mouseController.js +++ b/src/jmapNew/mouseController.js @@ -85,8 +85,8 @@ class MouseController extends Eventful { mousedown(e) { // if (eventTool.notLeftMouse(e)) { // return; - // } - this.$zr.dom.focus(); + // } + this.$zr.dom.focus(); if (e.which == 1 || e.which == 3) { var x = e.offsetX; var y = e.offsetY; @@ -287,7 +287,7 @@ class MouseController extends Eventful { } }); this.deviceList = includeDeviceList; - store.dispatch('map/setSeclectDeviceList', this.deviceList); // 给store设置框选的 model + store.commit('map/setSeclectDeviceList', this.deviceList); // 给store设置框选的 model } // 生成包围盒对象坐标 createFakeBoundingRect(instance) { diff --git a/src/jmapNew/shape/AutomacticRoute/index.js b/src/jmapNew/shape/AutomacticRoute/index.js index 6463e7ae4..eac3df196 100644 --- a/src/jmapNew/shape/AutomacticRoute/index.js +++ b/src/jmapNew/shape/AutomacticRoute/index.js @@ -18,7 +18,7 @@ export default class AutomacticRoute extends Group { this.model = model; this.style = style; this.isShowShape = true; - if (isShowThePrdType(model.prdType, style.AutomaticRoute.displayCondition) || model.previewOrMapDraw) { + if (isShowThePrdType(model.prdType, (style.AutomaticRoute || {}).displayCondition) || model.previewOrMapDraw) { this.create(); this.createMouseEvent(); this.setState(model); @@ -134,7 +134,7 @@ export default class AutomacticRoute extends Group { setShowMode() { const showMode = this.model.showMode; - const showConditions = this.style.AutomaticRoute.displayCondition; + const showConditions = (this.style.AutomaticRoute || {}).displayCondition; if (!showConditions || showConditions === '01' || showMode === showConditions) { this.showMode(); } else { diff --git a/src/jmapNew/shape/AxleReset/index.js b/src/jmapNew/shape/AxleReset/index.js index 2b7ba7688..e4ae37973 100644 --- a/src/jmapNew/shape/AxleReset/index.js +++ b/src/jmapNew/shape/AxleReset/index.js @@ -18,7 +18,7 @@ export default class AxleReset extends Group { this.model = model; this.style = style; this.isShowShape = true; - if (isShowThePrdType(model.prdType, style.AxleReset.displayCondition) || model.previewOrMapDraw) { + if (isShowThePrdType(model.prdType, (style.AxleReset || {}).displayCondition) || model.previewOrMapDraw) { this.create(); this.createMouseEvent(); this.setState(model); @@ -129,7 +129,7 @@ export default class AxleReset extends Group { } setShowMode() { const showMode = this.model.showMode; - const showConditions = this.style.AxleReset.displayCondition; + const showConditions = (this.style.AxleReset || {}).displayCondition; if (!showConditions || showConditions === '01' || showMode === showConditions) { this.showMode(); } else { diff --git a/src/jmapNew/shape/DirectionRod/index.js b/src/jmapNew/shape/DirectionRod/index.js index 25fb310c1..63518ce31 100644 --- a/src/jmapNew/shape/DirectionRod/index.js +++ b/src/jmapNew/shape/DirectionRod/index.js @@ -13,7 +13,7 @@ export default class DirectionRod extends Group { this.model = model; this.style = style; this.isShowShape = true; - if (isShowThePrdType(model.prdType, style.DirectionRod.displayCondition) || model.previewOrMapDraw) { + if (isShowThePrdType(model.prdType, (style.DirectionRod || {}).displayCondition) || model.previewOrMapDraw) { this.create(); this.createMouseEvent(); this.setState(model); @@ -91,7 +91,7 @@ export default class DirectionRod extends Group { setShowMode() { const showMode = this.model.showMode; - const showConditions = this.style.DirectionRod.displayCondition; + const showConditions = (this.style.DirectionRod || {}).displayCondition; if (!showConditions || showConditions === '01' || showMode === showConditions) { this.showMode(); } else { diff --git a/src/jmapNew/shape/FloodGate/index.js b/src/jmapNew/shape/FloodGate/index.js index 9457a382d..8aec39cb2 100644 --- a/src/jmapNew/shape/FloodGate/index.js +++ b/src/jmapNew/shape/FloodGate/index.js @@ -16,7 +16,7 @@ export default class FloodGate extends Group { this.model = model; this.style = style; this.isShowShape = true; - if (isShowThePrdType(model.prdType, style.FloodGate.displayCondition) || model.previewOrMapDraw) { + if (isShowThePrdType(model.prdType, (style.FloodGate || {}).displayCondition) || model.previewOrMapDraw) { this.create(); this.createMouseEvent(); this.setState(model); @@ -58,7 +58,7 @@ export default class FloodGate extends Group { setShowMode() { const showMode = this.model.showMode; - const showConditions = this.style.FloodGate.displayCondition; + const showConditions = (this.style.FloodGate || {}).displayCondition; if (!showConditions || showConditions === '01' || showMode === showConditions) { this.showMode(); } else { diff --git a/src/jmapNew/shape/GuideLock/index.js b/src/jmapNew/shape/GuideLock/index.js index b95937551..0f7e0dcf7 100644 --- a/src/jmapNew/shape/GuideLock/index.js +++ b/src/jmapNew/shape/GuideLock/index.js @@ -18,7 +18,7 @@ export default class GuideLock extends Group { this.model = model; this.style = style; this.isShowShape = true; - if (isShowThePrdType(model.prdType, style.GuideLock.displayCondition) || model.previewOrMapDraw) { + if (isShowThePrdType(model.prdType, (style.GuideLock || {}).displayCondition) || model.previewOrMapDraw) { this.create(); this.createMouseEvent(); this.setState(model); @@ -134,7 +134,7 @@ export default class GuideLock extends Group { } setShowMode() { const showMode = this.model.showMode; - const showConditions = this.style.GuideLock.displayCondition; + const showConditions = (this.style.GuideLock || {}).displayCondition; if (!showConditions || showConditions === '01' || showMode === showConditions) { this.showMode(); } else { diff --git a/src/jmapNew/shape/OverAp/index.js b/src/jmapNew/shape/OverAp/index.js index 317ef97fa..af29915e6 100644 --- a/src/jmapNew/shape/OverAp/index.js +++ b/src/jmapNew/shape/OverAp/index.js @@ -33,9 +33,12 @@ export default class OverAp extends Group { textPosition: style.Section.name.textPosition, fontSize: 12, fontFamily: style.fontFamily, - textFill: '#FFF', + textFill: style.OverAp.textColor, textAlign: 'center', - textVerticalAlign: 'middle' + textVerticalAlign: 'middle', + textPadding: style.OverAp.textPadding, + textBorderColor: style.OverAp.textBorderColor, + textBorderWidth: style.OverAp.textBorderWidth }); this.add(this.text); } diff --git a/src/jmapNew/shape/Power/index.js b/src/jmapNew/shape/Power/index.js index 89b0af2eb..bf4b0114e 100644 --- a/src/jmapNew/shape/Power/index.js +++ b/src/jmapNew/shape/Power/index.js @@ -85,6 +85,20 @@ export default class Line2 extends Group { } } + getBoundingRect() { + const rect = this.line.getBoundingRect().clone(); + if (this.model.leftTerminal) { + const subheadText = this.leftTerminal.getBoundingRect().clone(); + rect.union(subheadText); + return rect; + } + if (this.model.rightTerminal) { + const subheadText = this.rightTerminal.getBoundingRect().clone(); + rect.union(subheadText); + } + return rect; + } + setLineType(type) { switch (type) { case '01': break; diff --git a/src/jmapNew/shape/SaidLamp/index.js b/src/jmapNew/shape/SaidLamp/index.js index 82e818890..a395e12e3 100644 --- a/src/jmapNew/shape/SaidLamp/index.js +++ b/src/jmapNew/shape/SaidLamp/index.js @@ -23,7 +23,7 @@ export default class SaidLamp extends Group { this.deviceStyle = style[model._type]; if (this.deviceStyle) { this.isShowShape = true; - if (isShowThePrdType(model.prdType, this.deviceStyle.displayCondition) || model.previewOrMapDraw) { + if (isShowThePrdType(model.prdType, (this.deviceStyle || {}).displayCondition) || model.previewOrMapDraw) { this.create(); this.createMouseEvent(); this.setState(model); @@ -206,7 +206,7 @@ export default class SaidLamp extends Group { setShowMode() { const showMode = this.model.showMode; if (this.deviceStyle) { - const showConditions = this.deviceStyle.displayCondition; + const showConditions = (this.deviceStyle || {}).displayCondition; if (showConditions === '01' || showMode === showConditions) { this.control && this.control.show(); } else { diff --git a/src/jmapNew/shape/Section/ELimitLines.js b/src/jmapNew/shape/Section/ELimitLines.js index c42947db7..6a5302730 100644 --- a/src/jmapNew/shape/Section/ELimitLines.js +++ b/src/jmapNew/shape/Section/ELimitLines.js @@ -89,7 +89,7 @@ export default class ELimitLines extends Group { const beg = Object.assign({}, model.points[0]); const end = Object.assign({}, model.points[model.points.length - 1]); if (model.isSwitchSection && beg.y !== end.y) { - const swch = Vue.prototype.$jlmap.mapDevice[model.switch.code]; // 获取道岔model 及状态数据 + const swch = Vue.prototype.$jlmap.mapDevice[model.relSwitchCode]; // 获取道岔model 及状态数据 if (swch && swch.instance) { const traingle = new JTriangle(swch.intersection, swch.skew); diff --git a/src/jmapNew/shape/Section/ELimitName.js b/src/jmapNew/shape/Section/ELimitName.js index b81f6a7b6..6b2640a1e 100644 --- a/src/jmapNew/shape/Section/ELimitName.js +++ b/src/jmapNew/shape/Section/ELimitName.js @@ -14,87 +14,118 @@ export default class ELimitName extends Group { create() { /** 创建区段*/ const model = this.model.modelData; - // 开头 起点位置 - const speedLimitNameLeft = this.createName({ - drict: -1, - x: model.points[0].x, - y: model.points[0].y - 15 - }); - // 终点位置 - const speedLimitNameRight = this.createName({ - drict: 1, - x: model.points[model.points.length - 1].x, - y: model.points[model.points.length - 1].y - 15 - }); - speedLimitNameLeft.forEach(item => { - this.add(item); - }); - speedLimitNameRight.forEach(item => { - this.add(item); - }); - } - - createName(model) { - const dataList = []; const style = this.model.style; const rectW = style.Section.speedLimitName.drogueWidth; const rectH = style.Section.speedLimitName.drogueHeight; - - dataList.push(new Polygon({ + const x1 = model.points[0].x; + const y1 = model.points[0].y + style.Section.speedLimitName.limitValueDistance; + const x2 = model.points[model.points.length - 1].x; + const y2 = model.points[model.points.length - 1].y + style.Section.speedLimitName.limitValueDistance; + this.leftPolygon = new Polygon({ zlevel: this.zlevel, z: this.z + 9, shape: { points: [ - [model.x, model.y], - [model.x - model.drict * rectW, model.y], - [model.x - model.drict * (rectW + rectH / 2), model.y - rectH / 2], - [model.x - model.drict * rectW, model.y - rectH], - [model.x, model.y - rectH] + [x1, y1], + [x1 + rectW, y1], + [x1 + (rectW + rectH / 2), y1 - rectH / 2], + [x1 + rectW, y1 - rectH], + [x1, y1 - rectH] ] }, style: { lineWidth: 0, fill: style.Section.speedLimitName.nameBackground } - })); - - // 公里标内容 - dataList.push(new Text({ + }); + this.rightPolygon = new Polygon({ + zlevel: this.zlevel, + z: this.z + 9, + shape: { + points: [ + [x2, y2], + [x2 - rectW, y2], + [x2 - (rectW + rectH / 2), y2 - rectH / 2], + [x2 - rectW, y2 - rectH], + [x2, y2 - rectH] + ] + }, + style: { + lineWidth: 0, + fill: style.Section.speedLimitName.nameBackground + } + }); + this.leftLimitValue = new Text({ zlevel: this.zlevel, z: this.z + 10, style: { - x: model.x - model.drict * 2, - y: model.y, + x: x1 + 2, + y: y1, fontWeight: 'normal', fontSize: style.Section.speedLimitName.nameNumberFontSize, fontFamily: style.fontFamily, - text: '15', + text: '', textFill: style.Section.speedLimitName.nameNumberColor, - textAlign: model.drict == -1 ? 'left' : 'right', + textAlign: 'left', textPosition: style.Section.name.textPosition || 'inside', textVerticalAlign: 'bottom' } - })); - - // 公里值 - dataList.push(new Text({ + }); + this.rightLimitValue = new Text({ zlevel: this.zlevel, z: this.z + 10, style: { - x: model.x, - y: model.y + 12, + x: x2 - 2, + y: y2, + fontWeight: 'normal', + fontSize: style.Section.speedLimitName.nameNumberFontSize, + fontFamily: style.fontFamily, + text: '', + textFill: style.Section.speedLimitName.nameNumberColor, + textAlign: 'right', + textPosition: style.Section.name.textPosition || 'inside', + textVerticalAlign: 'bottom' + } + }); + this.leftKilometerValue = new Text({ + zlevel: this.zlevel, + z: this.z + 10, + style: { + x: x1, + y: y1 + 12, fontWeight: 'normal', fontSize: style.Section.speedLimitName.kilometerFontSize, fontFamily: style.fontFamily, text: '17.981km', textFill: style.Section.speedLimitName.kilometerColor, - textAlign: model.drict == -1 ? 'left' : 'right', + textAlign: 'left', textPosition: style.Section.name.textPosition || 'inside', textVerticalAlign: 'bottom' } - })); - return dataList; + }); + this.rightKilometerValue = new Text({ + zlevel: this.zlevel, + z: this.z + 10, + style: { + x: x2, + y: y2 + 12, + fontWeight: 'normal', + fontSize: style.Section.speedLimitName.kilometerFontSize, + fontFamily: style.fontFamily, + text: '17.981km', + textFill: style.Section.speedLimitName.kilometerColor, + textAlign: 'right', + textPosition: style.Section.name.textPosition || 'inside', + textVerticalAlign: 'bottom' + } + }); + this.add(this.leftPolygon); + this.add(this.rightPolygon); + this.add(this.leftLimitValue); + this.add(this.rightLimitValue); + this.add(this.leftKilometerValue); + this.add(this.rightKilometerValue); } hide() { @@ -102,9 +133,11 @@ export default class ELimitName extends Group { child.hide(); }); } - show() { + show(speedUpLimit) { this.eachChild((child) => { child.show(); }); + this.leftLimitValue && this.leftLimitValue.setStyle({text: speedUpLimit}); + this.rightLimitValue && this.rightLimitValue.setStyle({text: speedUpLimit}); } } diff --git a/src/jmapNew/shape/Section/ELines.js b/src/jmapNew/shape/Section/ELines.js index 9f9a76431..4f31954d4 100644 --- a/src/jmapNew/shape/Section/ELines.js +++ b/src/jmapNew/shape/Section/ELines.js @@ -243,7 +243,7 @@ export default class ELines extends Group { animateStyle(loop, animates) { if (animates && animates.length) { - if (this.section.animateStyle && this.section.isLine) { + if (this.section && this.section.animateStyle && this.section.isLine) { let an = this.section.animateStyle(loop); animates.forEach(elem => { an = an.when(elem.time, elem.styles); diff --git a/src/jmapNew/shape/Section/ETextName.js b/src/jmapNew/shape/Section/ETextName.js index 6f2d5bb4d..06523e0ab 100644 --- a/src/jmapNew/shape/Section/ETextName.js +++ b/src/jmapNew/shape/Section/ETextName.js @@ -126,7 +126,7 @@ class ETextName extends Group { fontSize: styleModel.fontSize, fontFamily: styleModel.fontFamily || this.model.style.fontFamily, text: styleName, - textFill: styleModel.fontColor, + textFill: model.approach && this.model.type === 'name' ? styleModel.approachColor : styleModel.fontColor, textAlign: styleModel.textAlign, textPosition: styleModel.textPosition || 'inside', textVerticalAlign: styleModel.textVerticalAlign || null diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index 75508f463..9772e0ba8 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -228,12 +228,12 @@ export default class Section extends Group { } /** 设置限速*/ - setSpeedUpperLimit() { + setSpeedUpperLimit(speedUpLimit) { if (this.style.Section.line.speedLimitColor) { // 宁波三号线 独有 this.line.setStyle({stroke: this.style.Section.line.speedLimitColor}); } else { this.speedLimit && this.speedLimit.show(); - this.speedLimitName && this.speedLimitName.show(); + this.speedLimitName && this.speedLimitName.show(speedUpLimit); } } @@ -272,7 +272,7 @@ export default class Section extends Group { /** 区段切除*/ model.cutOff && this.sectionCutOff(); /** 是否限速*/ - model.speedUpLimit > 0 && this.setSpeedUpperLimit(); + model.speedUpLimit > 0 && this.setSpeedUpperLimit(model.speedUpLimit); // 区段计轴预复位状态 (未处理) // 区段故障锁闭 model.fault && this.faultLock(); @@ -290,7 +290,7 @@ export default class Section extends Group { getShapeTipPoint() { let rect = this.getBoundingRect(); const distance = this.style.Section.line.width / 2; - if (this.line) { + if (this.line && this.line.getBoundingRect()) { rect = this.line.getBoundingRect(); } return { diff --git a/src/jmapNew/shape/Signal/ESigLamp.js b/src/jmapNew/shape/Signal/ESigLamp.js index d21838664..7cc6492a3 100644 --- a/src/jmapNew/shape/Signal/ESigLamp.js +++ b/src/jmapNew/shape/Signal/ESigLamp.js @@ -64,14 +64,14 @@ class ESigLamp extends Group { y: model.originY }, shape: { - x1: model.x + (style.Signal.lamp.radiusR + 1) * Math.cos(Math.PI / 4), - y1: model.y + (style.Signal.lamp.radiusR + 1) * Math.sin(Math.PI / 4), - x2: model.x - (style.Signal.lamp.radiusR + 1) * Math.cos(Math.PI / 4), - y2: model.y - (style.Signal.lamp.radiusR + 1) * Math.sin(Math.PI / 4) + x1: model.x + (style.Signal.lamp.radiusR + 0.5) * Math.cos(Math.PI / 4), + y1: model.y + (style.Signal.lamp.radiusR + 0.5) * Math.sin(Math.PI / 4), + x2: model.x - (style.Signal.lamp.radiusR + 0.5) * Math.cos(Math.PI / 4), + y2: model.y - (style.Signal.lamp.radiusR + 0.5) * Math.sin(Math.PI / 4) }, style: { lineWidth: style.Signal.lamp.stopWidth, - stroke: style.backgroundColor + stroke: style.Signal.xColor || style.backgroundColor } }); this.rstop = new Line({ @@ -84,14 +84,14 @@ class ESigLamp extends Group { y: model.originY }, shape: { - x1: model.x + (style.Signal.lamp.radiusR + 1) * Math.cos(Math.PI / 4), - y1: model.y + (style.Signal.lamp.radiusR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)), - x2: model.x - (style.Signal.lamp.radiusR + 1) * Math.cos(Math.PI / 4), - y2: model.y - (style.Signal.lamp.radiusR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)) + x1: model.x + (style.Signal.lamp.radiusR + 0.5) * Math.cos(Math.PI / 4), + y1: model.y + (style.Signal.lamp.radiusR + 0.5) * (Math.sin(Math.PI / 4) - Math.sqrt(2)), + x2: model.x - (style.Signal.lamp.radiusR + 0.5) * Math.cos(Math.PI / 4), + y2: model.y - (style.Signal.lamp.radiusR + 0.5) * (Math.sin(Math.PI / 4) - Math.sqrt(2)) }, style: { lineWidth: style.Signal.lamp.stopWidth, - stroke: style.backgroundColor + stroke: style.Signal.xColor || style.backgroundColor } }); } diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index 8ce875cd5..6c852fe24 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -371,6 +371,10 @@ class Signal extends Group { } else { this.lamps[0].setColor(this.style.Signal.lamp.redColor); } + } else if (this.count == 3) { + this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.redColor); + this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor); + this.lamps[2] && this.lamps[2].setColor(this.style.backgroundColor); } } } diff --git a/src/jmapNew/shape/Station/ESingleControl.js b/src/jmapNew/shape/Station/ESingleControl.js index 3d87a0ec7..68188592d 100644 --- a/src/jmapNew/shape/Station/ESingleControl.js +++ b/src/jmapNew/shape/Station/ESingleControl.js @@ -72,7 +72,7 @@ export default class ESingleControl extends Group { } setTextColor(color) { - if (color) { + if (color && !this.model.style.Station.StationControl.lamp.textColorNoChange) { this.text.setStyle('textFill', color); } } diff --git a/src/jmapNew/shape/StationStand/EEarlyStart.js b/src/jmapNew/shape/StationStand/EEarlyStart.js new file mode 100644 index 000000000..351541379 --- /dev/null +++ b/src/jmapNew/shape/StationStand/EEarlyStart.js @@ -0,0 +1,76 @@ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; + +class EEarlyStart extends Group { + constructor(model) { + super(); + this.model = model; + this.detain = null; + this.isNew = false; + } + + create(deviceParam) { + if (!this.isNew) { + const model = this.model.modelData; + const style = this.model.style; + this.isNew = true; + + /** 提前发车*/ + const startD = model.right ? 1 : -1; + const startX = model.position.x - startD * (deviceParam.offset.x - model.width / 2); + const startY = model.position.y + startD * (deviceParam.offset.y - model.height / 2); + + this.earlyStart = new Text({ + zlevel: this.model.zlevel, + z: this.model.z, + position: [0, 0], + style: { + x: startX, + y: startY, + text: deviceParam.text, + fontSize: deviceParam.fontSize, + fontFamily: style.fontFamily, + fontWeight: deviceParam.fontWeight, + textFill: deviceParam.centerTrainColor, + textStroke: style.backgroundColor, + textAlign: style.textStyle.textAlign, + textVerticalAlign: deviceParam.textVerticalAlign || style.textStyle.textVerticalAlign + } + }); + this.add(this.earlyStart); + } + } + + setColor(color) { + this.earlyStart.setStyle('textFill', color); + } + + recover() { + this.hideMode(); + } + + hideMode() { + this.earlyStart && this.earlyStart.hide(); + } + + showMode(deviceParam) { + this.create(deviceParam); + this.earlyStart && this.earlyStart.show(); + } + + setState(model, deviceParam = this.model.style.StationStand.detainNormal) { + // /** 设置扣车*/ + // if (model.stationHoldTrain && model.centerHoldTrain) { + // this.showMode(deviceParam); + // this.setColor(deviceParam.andCenterTrainColor); + // } else if (model.stationHoldTrain) { + // this.showMode(deviceParam); + // this.setColor(deviceParam.detainTrainTextColor); + // } else if (model.centerHoldTrain) { + // this.showMode(deviceParam); + // this.setColor(deviceParam.centerTrainColor); + // } + } +} + +export default EEarlyStart; diff --git a/src/jmapNew/shape/StationStand/detain/EDetain.js b/src/jmapNew/shape/StationStand/detain/EDetain.js index b2594f417..9e152d560 100644 --- a/src/jmapNew/shape/StationStand/detain/EDetain.js +++ b/src/jmapNew/shape/StationStand/detain/EDetain.js @@ -37,7 +37,6 @@ class EDetain extends Group { textVerticalAlign: deviceParam.textVerticalAlign || style.textStyle.textVerticalAlign } }); - console.log(this.detain, '************'); this.add(this.detain); } } diff --git a/src/jmapNew/shape/StationStand/functionButton/ECancelStopJumpLamp.js b/src/jmapNew/shape/StationStand/functionButton/ECancelStopJumpLamp.js new file mode 100644 index 000000000..17e0922e4 --- /dev/null +++ b/src/jmapNew/shape/StationStand/functionButton/ECancelStopJumpLamp.js @@ -0,0 +1,45 @@ + +import Group from 'zrender/src/container/Group'; +import EControl from '../../element/EControl'; + +class ECancelStopJumpLamp extends Group { + constructor(model) { + super(); + this.model = model; + this.create(); + } + create() { + const model = this.model.modelData; + const style = this.model.style; + this.cancelStopJumpLamp = new EControl({ + zlevel: this.model.zlevel, + z: this.model.z, + arc: { + shape: { + cx: model.cancelStopJumpLampPoint.x, + cy: model.cancelStopJumpLampPoint.y, + r: style.Station.lamp.radiusR + }, + subType: 'CancelStopJumpLamp', + lineWidth: 0, + fill: style.StationStand.lamp.lampColor + }, + text: { + position: [0, 0], + x: model.cancelStopJumpLampPoint.x, + y: model.cancelStopJumpLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance, + fontWeight: style.StationStand.text.fontWeight, + fontSize: style.StationStand.text.fontSize, + fontFamily: style.fontFamily, + text: '取消跳停', + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top' + }, + style: style + }); + this.add(this.cancelStopJumpLamp); + } +} + +export default ECancelStopJumpLamp; diff --git a/src/jmapNew/shape/StationStand/functionButton/EDownDetainLamp.js b/src/jmapNew/shape/StationStand/functionButton/EDownDetainLamp.js new file mode 100644 index 000000000..5ee6e6a5c --- /dev/null +++ b/src/jmapNew/shape/StationStand/functionButton/EDownDetainLamp.js @@ -0,0 +1,45 @@ +import Group from 'zrender/src/container/Group'; +import EControl from '../../element/EControl'; + +class EDownDetainLamp extends Group { + constructor(model) { + super(); + this.model = model; + this.create(); + } + create() { + const model = this.model.modelData; + const style = this.model.style; + + this.downDetainLamp = new EControl({ + zlevel: this.model.zlevel, + z: this.model.z, + arc: { + shape: { + cx: model.downDetainLampPoint.x, + cy: model.downDetainLampPoint.y, + r: style.Station.lamp.radiusR + }, + subType: 'DownDetainLamp', + lineWidth: 0, + fill: style.StationStand.lamp.lampColor + }, + text: { + position: [0, 0], + x: model.downDetainLampPoint.x, + y: model.downDetainLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance, + fontWeight: style.StationStand.text.fontWeight, + fontSize: style.StationStand.text.fontSize, + fontFamily: style.fontFamily, + text: '下行扣车', + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top' + }, + style: style + }); + this.add(this.downDetainLamp); + } +} + +export default EDownDetainLamp; diff --git a/src/jmapNew/shape/StationStand/functionButton/EStopJumpLamp.js b/src/jmapNew/shape/StationStand/functionButton/EStopJumpLamp.js new file mode 100644 index 000000000..ab2d39054 --- /dev/null +++ b/src/jmapNew/shape/StationStand/functionButton/EStopJumpLamp.js @@ -0,0 +1,45 @@ + +import Group from 'zrender/src/container/Group'; +import EControl from '../../element/EControl'; + +class EStopJumpLampButton extends Group { + constructor(model) { + super(); + this.model = model; + this.create(); + } + create() { + const model = this.model.modelData; + const style = this.model.style; + this.stopJumpLampButton = new EControl({ + zlevel: this.model.zlevel, + z: this.model.z, + arc: { + shape: { + cx: model.stopJumpLampPoint.x, + cy: model.stopJumpLampPoint.y, + r: style.Station.lamp.radiusR + }, + subType: 'StopJumpLamp', + lineWidth: 0, + fill: style.StationStand.lamp.lampColor + }, + text: { + position: [0, 0], + x: model.stopJumpLampPoint.x, + y: model.stopJumpLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance, + fontWeight: style.StationStand.text.fontWeight, + fontSize: style.StationStand.text.fontSize, + fontFamily: style.fontFamily, + text: '跳停', + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top' + }, + style: style + }); + this.add(this.stopJumpLampButton); + } +} + +export default EStopJumpLampButton; diff --git a/src/jmapNew/shape/StationStand/functionButton/EUpDetainLamp.js b/src/jmapNew/shape/StationStand/functionButton/EUpDetainLamp.js new file mode 100644 index 000000000..42edf8fcc --- /dev/null +++ b/src/jmapNew/shape/StationStand/functionButton/EUpDetainLamp.js @@ -0,0 +1,45 @@ +import Group from 'zrender/src/container/Group'; +import EControl from '../../element/EControl'; + +class EUpDetainLamp extends Group { + constructor(model) { + super(); + this.model = model; + this.create(); + } + create() { + const model = this.model.modelData; + const style = this.model.style; + + this.upDetainLamp = new EControl({ + zlevel: this.model.zlevel, + z: this.model.z, + arc: { + shape: { + cx: model.upDetainLampPoint.x, + cy: model.upDetainLampPoint.y, + r: style.Station.lamp.radiusR + }, + subType: 'UpDetainLamp', + lineWidth: 0, + fill: style.StationStand.lamp.lampColor + }, + text: { + position: [0, 0], + x: model.upDetainLampPoint.x, + y: model.upDetainLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance, + fontWeight: style.StationStand.text.fontWeight, + fontSize: style.StationStand.text.fontSize, + fontFamily: style.fontFamily, + text: '上行扣车', + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top' + }, + style: style + }); + this.add(this.upDetainLamp); + } +} + +export default EUpDetainLamp; diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index dde33a609..8f92346e6 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -26,11 +26,15 @@ import EMouse from './EMouse'; import EHighlight from '../element/EHighlight'; import ETrainStop from './ETrainStop'; import ETrainDepart from './ETrainDepart'; -import EControl from '../element/EControl'; import EPatternFilter from './EPatternFilter'; +import EStopJumpLamp from './functionButton/EStopJumpLamp'; +import ECancelStopJumpLamp from './functionButton/ECancelStopJumpLamp'; +import EUpDetainLamp from './functionButton/EUpDetainLamp'; +import EDownDetainLamp from './functionButton/EDownDetainLamp'; + import {isShowThePrdType} from '../../utils/handlePath'; -import {traverseLineElements} from '../utils/ShapeStatusCovert'; +import {traverseLineElements, traverseStatusElements} from '../utils/ShapeStatusCovert'; class StationStand extends Group { constructor(model, style) { @@ -44,17 +48,17 @@ class StationStand extends Group { this.isShowShape = true; this.create(); this.createMouseEvent(); - if (isShowThePrdType(model.prdType, style.StationStand.common.functionButtonShow) || model.previewOrMapDraw) { - this.createFunctionButton(); - } - if (model.previewOrMapDraw) { - this.setShowMode(); - } + // if (isShowThePrdType(model.prdType, style.StationStand.common.functionButtonShow) || model.previewOrMapDraw) { + // this.createFunctionButton(); + // } + // if (model.previewOrMapDraw) { + // this.setShowMode(); + // } this.setVisible(model.visible); this.setState(model); - this.checkIsDrawMap(); } create() { + // 加载皮肤控制的元素 const model = this.model; const style = this.style; // // 站台所有的绘图元素 @@ -85,139 +89,34 @@ class StationStand extends Group { }; // 遍历当前线路下的绘图元素 组合模式 traverseLineElements(style.StationStand, elementTypeList, model, style, this); + + // 加载后端返回的状态控制的绘图 + const statusElementList = { + 'stopJumpLamp':EStopJumpLamp, + 'cancelStopJumpLamp':ECancelStopJumpLamp, + 'upDetainLamp':EUpDetainLamp, + 'downDetainLamp':EDownDetainLamp + }; + // 遍历后端返回的状态控制的绘图 + if (model.previewOrMapDraw || isShowThePrdType(model.prdType, style.StationStand.common.functionButtonShow)) { + traverseStatusElements(statusElementList, model, style, this); + } } createMouseEvent() { - if (this.style.StationStand.mouseOverStyle) { - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); - this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); - } - } - - createFunctionButton() { - const model = this.model; - const style = this.style; - if (model.stopJumpLamp) { - this.stopJumpLampButton = new EControl({ - zlevel: this.zlevel, - z: this.z, - arc: { - shape: { - cx: model.stopJumpLampPoint.x, - cy: model.stopJumpLampPoint.y, - r: style.Station.lamp.radiusR - }, - subType: 'StopJumpLamp', - lineWidth: 0, - fill: style.StationStand.lamp.lampColor - }, - text: { - position: [0, 0], - x: model.stopJumpLampPoint.x, - y: model.stopJumpLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance, - fontWeight: style.StationStand.text.fontWeight, - fontSize: style.StationStand.text.fontSize, - fontFamily: style.fontFamily, - text: '跳停', - textFill: '#fff', - textAlign: 'middle', - textVerticalAlign: 'top' - }, - style: this.style - }); - this.add(this.stopJumpLampButton); - } - if (model.cancelStopJumpLamp) { - this.cancelStopJumpLampButton = new EControl({ - zlevel: this.zlevel, - z: this.z, - arc: { - shape: { - cx: model.cancelStopJumpLampPoint.x, - cy: model.cancelStopJumpLampPoint.y, - r: style.Station.lamp.radiusR - }, - subType: 'CancelStopJumpLamp', - lineWidth: 0, - fill: style.StationStand.lamp.lampColor - }, - text: { - position: [0, 0], - x: model.cancelStopJumpLampPoint.x, - y: model.cancelStopJumpLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance, - fontWeight: style.StationStand.text.fontWeight, - fontSize: style.StationStand.text.fontSize, - fontFamily: style.fontFamily, - text: '取消跳停', - textFill: '#fff', - textAlign: 'middle', - textVerticalAlign: 'top' - }, - style: this.style - }); - this.add(this.cancelStopJumpLampButton); - } - if (model.upDetainLamp) { - this.upDetainLampButton = new EControl({ - zlevel: this.zlevel, - z: this.z, - arc: { - shape: { - cx: model.upDetainLampPoint.x, - cy: model.upDetainLampPoint.y, - r: style.Station.lamp.radiusR - }, - subType: 'UpDetainLamp', - lineWidth: 0, - fill: style.StationStand.lamp.lampColor - }, - text: { - position: [0, 0], - x: model.upDetainLampPoint.x, - y: model.upDetainLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance, - fontWeight: style.StationStand.text.fontWeight, - fontSize: style.StationStand.text.fontSize, - fontFamily: style.fontFamily, - text: '上行扣车', - textFill: '#fff', - textAlign: 'middle', - textVerticalAlign: 'top' - }, - style: this.style - }); - this.add(this.upDetainLampButton); - } - if (model.downDetainLamp) { - this.downDetainLampButton = new EControl({ - zlevel: this.zlevel, - z: this.z, - arc: { - shape: { - cx: model.downDetainLampPoint.x, - cy: model.downDetainLampPoint.y, - r: style.Station.lamp.radiusR - }, - subType: 'DownDetainLamp', - lineWidth: 0, - fill: style.StationStand.lamp.lampColor - }, - text: { - position: [0, 0], - x: model.downDetainLampPoint.x, - y: model.downDetainLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance, - fontWeight: style.StationStand.text.fontWeight, - fontSize: style.StationStand.text.fontSize, - fontFamily: style.fontFamily, - text: '下行扣车', - textFill: '#fff', - textAlign: 'middle', - textVerticalAlign: 'top' - }, - style: this.style - }); - this.add(this.downDetainLampButton); + const path = window.location.href; + if (path.includes('/map/draw')) { + this.highlight = new EHighlight(this); + this.add(this.highlight); + this.on('mouseout', () => { this.highlight.mouseout(); }); + this.on('mouseover', () => { this.highlight.mouseover(); }); + } else { + if (this.style.StationStand.mouseOverStyle) { + this.mouseEvent = new EMouse(this); + this.add(this.mouseEvent); + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); + } } } @@ -266,19 +165,19 @@ class StationStand extends Group { } switch (opts.subDeviceType) { case 'StopJumpLamp': { - rect = this.stopJumpLampButton.getBoundingRect(); + rect = this.stopJumpLamp.getBoundingRect(); break; } case 'CancelStopJumpLamp': { - rect = this.cancelStopJumpLampButton.getBoundingRect(); + rect = this.cancelStopJumpLamp.getBoundingRect(); break; } case 'UpDetainLamp': { - rect = this.upDetainLampButton.getBoundingRect(); + rect = this.upDetainLamp.getBoundingRect(); break; } case 'DownDetainLamp': { - rect = this.downDetainLampButton.getBoundingRect(); + rect = this.downDetainLamp.getBoundingRect(); break; } default: { @@ -299,31 +198,18 @@ class StationStand extends Group { this.highlight && this.highlight.drawSelected(selected); } - checkIsDrawMap() { - const path = window.location.href; - if (path.includes('/map/draw')) { - this.highlight = new EHighlight(this); - this.add(this.highlight); - this.on('mouseout', () => { this.highlight.mouseout(); }); - this.on('mouseover', () => { this.highlight.mouseover(); }); - } - } // 设置显示模式 setShowMode() { const showMode = this.model.showMode; const showConditions = this.style.StationStand.common.functionButtonShow; if (!showConditions || showConditions === '01' || showMode === showConditions) { - this.stopJumpLampButton && this.stopJumpLampButton.show(); - this.cancelStopJumpLampButton && this.cancelStopJumpLampButton.show(); - this.upDetainLampButton && this.upDetainLampButton.show(); - this.downDetainLampButton && this.downDetainLampButton.show(); + this.stopJumpLamp && this.stopJumpLamp.show(); + this.cancelStopJumpLamp && this.cancelStopJumpLamp.show(); this.upDetainLamp && this.upDetainLamp.show(); this.downDetainLamp && this.downDetainLamp.show(); } else { - this.stopJumpLampButton && this.stopJumpLampButton.hide(); - this.cancelStopJumpLampButton && this.cancelStopJumpLampButton.hide(); - this.upDetainLampButton && this.upDetainLampButton.hide(); - this.downDetainLampButton && this.downDetainLampButton.hide(); + this.stopJumpLamp && this.stopJumpLamp.hide(); + this.cancelStopJumpLamp && this.cancelStopJumpLamp.hide(); this.upDetainLamp && this.upDetainLamp.hide(); this.downDetainLamp && this.downDetainLamp.hide(); } diff --git a/src/jmapNew/shape/StationTurnBack/index.js b/src/jmapNew/shape/StationTurnBack/index.js index 518949840..ab88a8ad8 100644 --- a/src/jmapNew/shape/StationTurnBack/index.js +++ b/src/jmapNew/shape/StationTurnBack/index.js @@ -160,7 +160,7 @@ export default class StationTurnBack extends Group { setShowMode() { const showMode = this.model.showMode; - const showConditions = this.style.StationTurnBack.displayCondition; + const showConditions = (this.style.StationTurnBack || {}).displayCondition; if (!showConditions || showConditions == '01' || showMode === showConditions) { this.eachChild(item => item.show() ); } else { diff --git a/src/jmapNew/shape/Switch/index.js b/src/jmapNew/shape/Switch/index.js index b66d244aa..7eeb5e62c 100644 --- a/src/jmapNew/shape/Switch/index.js +++ b/src/jmapNew/shape/Switch/index.js @@ -198,12 +198,12 @@ export default class Switch extends Group { this.add(this.lockRect); this.lockRect.hide(); if (this.style.Switch.arcBlcok || this.style.Switch.interlocking) { - this.lockArc = new ELockArc({ // 单锁圆形 只有宁波线路使用 + this.lockArc = new ELockArc({ // 单锁圆形 只有宁波线路使用 国赛线 zlevel: this.zlevel, z: this.z + 6, x: this.model.intersection.x, y: this.model.intersection.y, - shapeR: 5, + shapeR: this.style.Switch.arcBlcok.shapeR, lineWidth: 1.2, stroke: this.style.Switch.arcBlcok.arcBorderColor, fill: this.style.transparentColor @@ -278,6 +278,7 @@ export default class Switch extends Group { this.shapeModelB.show(); this.shapeModelB.setColor(this.style.Section.line.spareColor); this.shapeModelC.show(); + this.shapeModelC.setColor(this.style.backgroundColor); } if (this.style.Switch.core.graphShow) { // 佛山线路显示 this.shapeModelB.show(); @@ -324,8 +325,8 @@ export default class Switch extends Group { .when(1000, { stroke: this.style.backgroundColor }) .start(); } - setSwitchFault(split) { - if (this.style.Switch.jointImg.faultStatus && split) { // 宁波线失表状态 + setSwitchFault(split, normalPosition, reversePosition) { + if (this.style.Switch.jointImg.faultStatus && split && !reversePosition && !normalPosition ) { // 宁波线失表状态 this.setForkAction(); // 道岔挤岔 } else { if (this.model.switchFaultCode && split) { @@ -374,7 +375,7 @@ export default class Switch extends Group { } /** 单锁*/ - setMonolock() { + setMonolock(normalPosition, reversePosition) { if (this.style.Switch.rectLock.monolock) { // 判断单锁矩形是否显示 this.lockRect.show(); if (this.style.Switch.rectLock.rectBorderFillColor) { // 西安二号线 专用显示 @@ -386,7 +387,11 @@ export default class Switch extends Group { } if (this.style.Switch.arcBlcok.show) { // 圆形单锁是否显示 this.lockArc.show(); - this.lockArc.setStyle({ stroke: this.style.Switch.arcBlcok.locationColor }); + if (normalPosition) { + this.lockArc.setStyle({ stroke: this.style.Switch.arcBlcok.locationColor }); + } else if (reversePosition) { + this.lockArc.setStyle({ stroke: this.style.Switch.arcBlcok.inversionColor }); + } } this.model.normalPosition && this.setTextColor(this.style.Switch.text.monolockLocationColor); // 定位 设置道岔名称颜色 this.model.reversePosition && this.setTextColor(this.style.Switch.text.monolockInversionColor); // 反位 设置道岔名称颜色 @@ -511,6 +516,7 @@ export default class Switch extends Group { setState(model) { if (!this.isShowShape) return; this.recover(); + this.setSwitchFault(model.split, model.normalPosition, model.reversePosition); if (model.normalPosition) { this.setLocationAction(model); /** 定位*/ } else if (model.reversePosition) { @@ -519,9 +525,8 @@ export default class Switch extends Group { this.setLossAction(); // 失去 } model.isCiConfirm && this.setCiConfirm(); // 道岔使能显示 - this.setSwitchFault(model.split); - model.singleLock && this.setMonolock(); // 道岔单锁 + model.singleLock && this.setMonolock(model.normalPosition, model.reversePosition); // 道岔单锁 model.blockade && this.block(); // 道岔封锁 model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态 const path = window.location.href; diff --git a/src/jmapNew/shape/Train/TrainBody.js b/src/jmapNew/shape/Train/TrainBody.js index 7e9cdd3b2..1b5a6e889 100644 --- a/src/jmapNew/shape/Train/TrainBody.js +++ b/src/jmapNew/shape/Train/TrainBody.js @@ -40,12 +40,22 @@ export default class TrainBody extends Group { create() { const model = this.model; const style = this.model.style; - const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber);// 服务号(表号) + this.nameFormat = model.nameFormat; const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode ? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber) - : model.tripNumber || style.Train.trainTarget.defaultTripNumber); // 车次号 - let targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); // 目的地码 + : model.tripNumber || style.Train.trainTarget.defaultTripNumber); // 车次号 const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (style.Train.trainTargetNumber.lineNumber || '') + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber); // 车组号 + let serviceNumber = ''; // 服务号(表号) + if (this.model.type == 'PLAN') { // 计划车 + serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber); + } else if (this.model.type == 'HEAD') { // 头码车 + serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); + this.nameFormat = 'serviceNumber:groupNumber'; + } else if (this.model.type == 'MANUAL') { // 人工车 + serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceHeadNum); + this.nameFormat = 'serviceNumber:groupNumber'; + } + let targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); // 目的地码 if (Vue.prototype.$jlmap.lineCode == '09') { // 暂时先写死 后面有了删掉就好 targetCode = '01'; } @@ -378,6 +388,16 @@ export default class TrainBody extends Group { this.style.Train.soonerOrLater.destinationCode && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.soonerOrLater.lateColor}); this.style.Train.soonerOrLater.trainBody && this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.lateColor}); } + } else if (this.style.Train.soonerOrLater && this.style.Train.soonerOrLater.level === 6) { + if (dt <= 59 && dt >= -59) { + this.style.Train.soonerOrLater.trainBody && this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.normalColor}); + } else if (dt < -59 && dt >= -300) { + this.style.Train.soonerOrLater.trainBody && this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.smallLateColor}); + } else if (dt > 300) { + this.style.Train.soonerOrLater.trainBody && this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.bigEarlyColor}); + } else if (dt < -300) { + this.style.Train.soonerOrLater.trainBody && this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.bigLateColor}); + } } } formatChangePosition(model, style) { diff --git a/src/jmapNew/shape/element/ETextName.js b/src/jmapNew/shape/element/ETextName.js index 9966bc56f..ddf41b2e9 100644 --- a/src/jmapNew/shape/element/ETextName.js +++ b/src/jmapNew/shape/element/ETextName.js @@ -19,7 +19,10 @@ export default function ETextName(model) { textFill: model.textFill, textAlign: model.textAlign, textPosition: model.textPosition || 'inside', - textVerticalAlign: model.textVerticalAlign || null + textVerticalAlign: model.textVerticalAlign || null, + textBorderColor: model.textBorderColor || null, + textBorderWidth: model.textBorderWidth || null, + textPadding: model.textPadding || 0 } }); return TextName; diff --git a/src/jmapNew/shape/utils/ShapeStatusCovert.js b/src/jmapNew/shape/utils/ShapeStatusCovert.js index 6e315a972..181e218c3 100644 --- a/src/jmapNew/shape/utils/ShapeStatusCovert.js +++ b/src/jmapNew/shape/utils/ShapeStatusCovert.js @@ -14,3 +14,20 @@ export function traverseLineElements(currentType, elementTypeList, model, style, obj.add(obj[element]); }); } +// 遍历后端返回的状态控制的绘图 +export function traverseStatusElements(statusElementList, model, style, obj) { + // if (model.showMode == undefined || model.showMode) { + Object.keys(statusElementList).forEach(element => { + const ClassName = statusElementList[element]; + if (model[element]) { + obj[element] = new ClassName({ + zlevel: model.zlevel, + z: 1, + style: style, + modelData:model + }); + obj.add(obj[element]); + } + }); + // } +} diff --git a/src/jmapNew/theme/aus_00/planConvert-.js b/src/jmapNew/theme/aus_00/planConvert-.js deleted file mode 100644 index 218bf41ef..000000000 --- a/src/jmapNew/theme/aus_00/planConvert-.js +++ /dev/null @@ -1,139 +0,0 @@ -import { createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan'; - -export default { - /** 边缘高度*/ - EdgeHeight: 600, - - /** 间隔高度*/ - CoordMultiple: 1, - - /** 偏移时间*/ - TranslationTime: 0, - - /** 将后台数据解析成图表*/ - convertDataToModels(tripList, stations, kmRangeCoordMap, lineStyle) { - var models = []; - /** 按车次遍历数据*/ - if (tripList && tripList.length) { - tripList.forEach(trip => { - const opt = { - name: `run-${trip.tripNo}`, - type: 'line', - legendHoverLink: false, - symbolSize: 6, - lineStyle: { - color: '#000', - width: 1, - }, - markPoint: { data: [] }, - data: [] - }; - - // const length = trip.stationTimeList.length; - // if (trip.tripNo && - // trip.stationTimeList.length) { - // opt.markPoint.data.push(createMartPointReverse({ - // name: `${trip.tripNo}`, - // color: '#000' || lineStyle.color, - // coord: [ - // trip.stationTimeList[0].arrivalTime, - // this.getCoordYByElem(stations, kmRangeCoordMap, trip.stationTimeList[0]) - // ] - // })); - // } - - /** 计算停站点坐标集合*/ - trip.stationTimeList.forEach((elem,idx) => { - if (elem.arrivalTime) { - opt.data.push([elem.arrivalTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]); - } - - if (elem.departureTime) { - opt.data.push([elem.departureTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]); - } - }); - - models.push(opt); - }); - } - - return models; -}, - - /** 更新数据并解析成图表*/ - updateDataToModels(tripList, stations, kmRangeCoordMap, runPlanData, series, lineStyle) { - if (tripList && tripList.length) { - } - return series; - }, - - /** 初始化Y轴*/ - initializeYaxis(stations) { - return createMarkLineModels(stations, (elem) => { - return this.EdgeHeight + elem.kmRange * this.CoordMultiple; - }); - }, - - /** 将后台数据转换为试图序列模型*/ - convertStationsToMap(stations) { - var map = {}; - if (stations && stations.length) { - stations.forEach((elem) => { - map[`${elem.kmRange}`] = this.EdgeHeight + elem.kmRange * this.CoordMultiple; - }); - } - - return map; - }, - - /** 计算y轴最小值*/ - computedYaxisMinValue(stations) { - return stations[0].kmRange * this.CoordMultiple; - }, - - /** 计算y轴最大值*/ - computedYaxisMaxValue(stations) { - return stations[stations.length - 1].kmRange * this.CoordMultiple + this.EdgeHeight * 2; - }, - - /** 格式化y轴数据*/ - computedFormatYAxis(stations, params) { - var yText = '0m'; - - stations.forEach(elem => { - if (elem.kmRange < parseInt(params.value) / this.CoordMultiple - this.EdgeHeight) { - yText = Math.floor(elem.kmRange) + 'm'; - } - }); - - return yText; - }, - - /** 根据是否和上一个车次是否相交,计算下一个车次的折返的高度*/ - computedReentryNumber(code) { - // return parseInt(code || 1) % 2 ? 1 : 2; - return 1; - }, - - /** 根据方向计算y折返偏移量*/ - getYvalueByDirectionCode(defaultVlue, directionCode, num) { - if (directionCode === '1') { - defaultVlue += this.EdgeHeight / 2 * num; - } else if (directionCode === '2') { - defaultVlue -= this.EdgeHeight / 2 * num; - } - - return defaultVlue; - }, - - /** 根据elem计算y值*/ - getCoordYByElem(stations, kmRangeCoordMap, elem) { - var defaultVlue = 0; - var station = stations.find(it => { return it.code == elem.stationCode; }); - if (station) { - defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; - } - - return defaultVlue; - } -}; diff --git a/src/jmapNew/theme/aus_00/planConvert.js b/src/jmapNew/theme/aus_00/planConvert.js index 686a10a81..64c674c71 100644 --- a/src/jmapNew/theme/aus_00/planConvert.js +++ b/src/jmapNew/theme/aus_00/planConvert.js @@ -1,119 +1,285 @@ -import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, prefixTime, convertSheetToList } from '@/utils/runPlan'; +import { createSeriesModel, createMarkLineModels, createRectArea, createMartPoint } from './utils'; +import { toTimeStamp } from '@/utils/date'; export default { + /** 最小时间*/ + MinTime: 0, + + /** 最大时间*/ + MaxTime: 3600*24-1, + /** 边缘高度*/ - EdgeHeight: 3, + EdgeHeight: 600, /** 间隔高度*/ - CoordMultiple: 3, + CoordMultiple: 1, /** 偏移时间*/ - TranslationTime: 0, + TranslationTime: 0, - /** 将后台数据解析成图表*/ - convertDataToModels(tripList, stations, kmRangeCoordMap, lineStyle) { - var models = []; - /** 按车次遍历数据*/ - if (tripList && tripList.length) { - tripList.forEach(trip => { - const opt = { - name: `run-${trip.tripNo}`, - type: 'line', - legendHoverLink: false, - symbolSize: 6, - lineStyle: { - color: '#000', - width: 1, - }, - markPoint: { data: [] }, - data: [] - }; + /** 转换model为Rect数据*/ + calcAreaArgsByModel(chart, model) { + const fartherKmRange = model.fartherKmRange; + const closerKmRange = model.closerKmRange; + const startTime = model.startTime; + const endTime = model.endTime; + const point1 = [ startTime, this.getCoordinateYByKmRange(fartherKmRange)]; + const point2 = [ endTime, this.getCoordinateYByKmRange(closerKmRange)] + const position1 = chart.convertToPixel('grid', point1); + const position2 = chart.convertToPixel('grid', point2); + const position = position1; + const width = Math.abs(position1[0] - position2[0]); + const height = Math.abs(position1[1] - position2[1]); - /** 计算停站点坐标集合*/ - trip.stationTimeList.forEach((elem,idx) => { - if (elem.arrivalTime) { - opt.data.push([elem.arrivalTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]); - } + return { + model, + position, + point1, + point2, + width, + height + } + }, - if (elem.departureTime) { - opt.data.push([elem.departureTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]); - } - }); + /** 将后台数据解析成图形*/ + parseDataToGraph(chart, planData) { + const graphs = []; + if (planData && + planData.areaList && + planData.areaList.length) { + planData.areaList.forEach(model => { + if (typeof model.startTime == 'string') model.startTime = toTimeStamp(model.startTime); + if (typeof model.endTime == 'string') model.endTime = toTimeStamp(model.endTime); + graphs.push(createRectArea(this.calcAreaArgsByModel(chart, model))); + }) + } - models.push(opt); - }); + return graphs; + }, + + /** 将后台数据解析成折线*/ + parseDataToSeries(chart, planData, stations) { + const models = []; + if (planData && + planData.serviceList && + planData.serviceList.length) { + planData.serviceList.forEach((service,i) => { + if (service.tripList && + service.tripList.length) { + + const opt = { + name: `service${service.serviceNo}`, + type: 'line', + symbolSize: 1, + showAllSymbol: true, + markPoint: { data: [] }, + data: [] + }; + + service.tripList.forEach((trip,j) => { + var lastPoint = null; + var nextPoint = null; + var pointData = { + name: `${service.serviceNo}-${trip.tripNo}`, + color: '#000', + direction: trip.direction, + coord: [trip.stationTimeList[0].departureTime, this.getCoordinateYByStationId(stations, trip.stationTimeList[0].stationId)], + }; + + opt.markPoint.data.push(createMartPoint(pointData)); + + trip.stationTimeList.forEach(elem => { + if (elem.arrivalTime) { + opt.data.push([elem.arrivalTime, this.getCoordinateYByStationId(stations, elem.stationId), { + stationId: elem.stationId, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + silent: false + }]); + } + + if (elem.departureTime) { + opt.data.push([elem.departureTime, this.getCoordinateYByStationId(stations, elem.stationId), { + stationId: elem.stationId, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + silent: false + }]); + } + }); + + if (service.tripList[j + 1] && + service.tripList[j + 1].stationTimeList) { + + lastPoint = trip.stationTimeList[trip.stationTimeList.length-1]; + nextPoint = service.tripList[j + 1].stationTimeList[0]; + + opt.data.push({ + value: [lastPoint.arrivalTime, this.getCoordinateYByStationId(stations, lastPoint.stationId, true, trip.direction), { + stationId: lastPoint.stationId, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + silent: true + }], + symbol: 'none', + symbolSize: 1, + }); + opt.data.push({ + value: [nextPoint.departureTime, this.getCoordinateYByStationId(stations, lastPoint.stationId, true, trip.direction), { + stationId: lastPoint.stationId, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + silent: true + }], + symbol: 'none', + symbolSize: 1, + }); + } + }); + + const model = createSeriesModel(opt, + { color: '#000', width: 1 }, + { color: '#000', fill: '#000'} + ); + models.push(model); + } + }) } return models; - }, +}, - /** 更新数据并解析成图表*/ - updateDataToModels(tripList, stations, kmRangeCoordMap, runPlanData, series, lineStyle) { - if (tripList && tripList.length) { + /** 更新数据并解析成折线*/ + updateDataToModels(chart, planData, stations, series) { + if (planData && planData.length) { } return series; }, - /** 将后台数据转换为试图序列模型*/ - convertStationsToMap(stations) { - var map = {}; - if (stations && stations.length) { - stations.forEach((elem, index) => { - map[`${elem.kmRange}`] = this.EdgeHeight + index * this.CoordMultiple; - }); - } - - return map; - }, /** 初始化Y轴*/ initializeYaxis(stations) { - return createMarkLineModels(stations, (elem, index) => { - return this.EdgeHeight + index * this.CoordMultiple; + return createMarkLineModels(stations, (elem) => { + return elem.kmRange * this.CoordMultiple; }); }, /** 计算y轴最小值*/ - computedYaxisMinValue() { - return 0; + computedYaxisMinValue(stations) { + return stations[0].kmRange * this.CoordMultiple - this.EdgeHeight; }, /** 计算y轴最大值*/ computedYaxisMaxValue(stations) { - return this.EdgeHeight * 2 + (stations.length - 1) * this.CoordMultiple; + return stations[stations.length - 1].kmRange * this.CoordMultiple + this.EdgeHeight; }, /** 格式化y轴数据*/ computedFormatYAxis(stations, params) { var yText = '0m'; - var index = Math.floor((parseInt(params.value) - this.EdgeHeight) / this.CoordMultiple); - if (index >= 0 && index < stations.length) { - yText = Math.floor(stations[index].kmRange) + 'm'; - } - return yText; - }, - /** 根据方向计算y折返偏移量*/ - getYvalueByDirectionCode(defaultVlue, directionCode) { - if (directionCode === '1') { - defaultVlue -= this.EdgeHeight / 2; - } else if (directionCode === '2') { - defaultVlue += this.EdgeHeight / 2; - } - - return defaultVlue; - }, - - /** 根据elem计算y值*/ - getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, isSpecial) { - var defaultVlue = 0; - var station = stations.find(it => { return it.code == elem.stationCode; }); - if (station) { - defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; - if (isSpecial) { - defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode); + stations.forEach(elem => { + if (elem.kmRange < parseInt(params.value) / this.CoordMultiple) { + yText = Math.floor(elem.kmRange) + 'm'; } + }); + + return yText; + }, + + /** 根据方向计算y折返偏移量*/ + getOffsetY(isSpecial, direction) { + if (isSpecial) { + if (direction === '1') { + return -this.EdgeHeight / 2; + } else if (direction === '2') { + return +this.EdgeHeight / 2; + } + } + + return 0; + }, + + /** 通过y坐标获取车站公里表*/ + getKmRangeByCoordinateY(y) { + return parseInt(y/this.CoordMultiple); + }, + + /** 通过公里表获取坐标值*/ + getCoordinateYByKmRange(k) { + return k * this.CoordMultiple + }, + + /** 通过站信息获取y坐标*/ + getCoordinateYByStationId(stations, stationId, isSpecial=false, direction='01') { + var value = 0; + var station = stations.find(it => { return it.id == stationId; }); + if (station) { + value = this.getCoordinateYByKmRange(station.kmRange) + this.getOffsetY(isSpecial, direction); } - return defaultVlue; - } + return value; + }, + + /** 通过y坐标获取站信息 */ + getStationByCoordinateY(stations, y) { + for(var i = stations.length-1; i >= 0; i--) { + const station = stations[i]; + const edge = this.EdgeHeight/2; + const preKm = i == 0? edge*2: Math.abs(station.kmRange-stations[i-1].kmRange)/2; + const nxtKm = i == stations.length-1? edge: Math.abs(station.kmRange-stations[i+1].kmRange)/2; + const min = edge + station.kmRange - preKm; + const max = edge + station.kmRange + nxtKm; + if (y >= min && y <= max) { + return station; + } + } + return null; + }, + + /**限制区域范围 */ + limitAreaTime(model) { + if (model) { + model.startTime = model.startTime < this.MinTime + ? this.MinTime + : model.startTime > this.MaxTime + ? this.MaxTime + : model.startTime; + + model.endTime = model.endTime < this.MinTime + ? this.MinTime + : model.endTime > this.MaxTime + ? this.MaxTime + : model.endTime; + } + return model; + }, + + /** 检查公里表是否超出范围*/ + limitAreaKmRange(stations, model) { + const closerKmRange = model.closerKmRange; + const fartherKmRange = model.fartherKmRange; + const length = stations.length; + const first = stations[0]||{}; + const last = stations[length-1]||{}; + const minRange = first.kmRange-this.EdgeHeight; + const maxRange = last.kmRange; + const tolerant = 0; + + if (closerKmRange < minRange - tolerant) { + const offset = closerKmRange - minRange; + model.closerKmRange = minRange; + model.fartherKmRange -= offset; + return true; + } else if (fartherKmRange > maxRange + tolerant) { + const offset = fartherKmRange - maxRange; + model.fartherKmRange = maxRange; + model.closerKmRange -= offset; + return true; + } + return false; + } }; diff --git a/src/jmapNew/theme/aus_00/utils.js b/src/jmapNew/theme/aus_00/utils.js new file mode 100644 index 000000000..e6bc7efc2 --- /dev/null +++ b/src/jmapNew/theme/aus_00/utils.js @@ -0,0 +1,228 @@ +import store from '@/store/index_APP_TARGET'; +import { timeFormat } from '@/utils/date'; + +/** 创建一个车次数据点*/ +export function createMartPoint(opt) { + const rotate = opt.direction == '2' ? 45 : (opt.direction == '1' ? -45 : 0); + const position = opt.type ? 'insideBottomLeft' : 'insideTopLeft'; + return { + coord: opt.coord, + name: opt.name, + label: { + normal: { + rotate: rotate, + formatter: '{b}', + backgroundColor: 'rgb(242,242,242,0.1)', + color: 'black', + position: position + } + } + }; +} + +/** 创建一个服务数据序列*/ +export function createSeriesModel(opt, lineStyle={}, itemStyle={}) { + return { + z: opt.z || 2, + type: 'line', + name: opt.name, + data: opt.data, + sampling: 'average', + symbolSize: opt.symbolSize, + showAllSymbol: opt.showAllSymbol||'auto', + lineStyle: lineStyle, + itemStyle: itemStyle, + animation: false, + markPoint: { + symbol: 'roundRect', + symbolSize: 1, + data: opt.markPoint.data + } + }; +} + +/** + * 创建一个区域 + */ +export function createRectArea(opt, style={}) { + return { + type: 'rect', + subType: 'area', + position: opt.position, + point1: opt.point1, + point2: opt.point2, + model: opt.model, + culling: true, + progressive: true, + shape: { + x: 0, + y: 0, + width: opt.width, + height: opt.height + }, + style: { + fill: 'rgb(255,0,0, 0.3)', + stroke: 'rgb(255, 0, 0, 0.8)', + textPadding: [3, 6], + textOffset: [-opt.width/2, -opt.height/2], + text: opt.model.text, + textFill: 'rgb(0, 0, 0)', + fontSize: 18, + fontWeight: 500, + textVerticalAlign: 'top', + textAlign: 'left', + ...style + }, + z: 50 + } +} + +/** 创建标记横线*/ +export function createMarkLineModels(stations, computedYaxis) { + const markLineModel = {}; + if (stations && stations.length) { + markLineModel.type = 'line'; + markLineModel.name = 'markline'; + markLineModel.silent = true; + markLineModel.animation = false; + markLineModel.markLine = {}; + markLineModel.markLine.silent = true; + markLineModel.markLine.data = []; + markLineModel.markLine.lineStyle = { color: '#B0C4DE', width: 0.5 }; + markLineModel.markLine.symbol = 'none'; + markLineModel.elements = [] + stations.forEach((elem, index) => { + markLineModel.markLine.data.push( + { + label: { + show: true, + position: 'start', + formatter: elem.name, + color: elem.transferable ? '#000': '#000', + backgroundColor: elem.transferable ? '#008800': '', + padding: [5,3,3,3], + }, + lineStyle: { + type: 'solid', + color: elem.transferable? '#008800': '#000', + width: 0.5, + opacity: 0.5 + }, + yAxis: computedYaxis(elem, index) + } + ); + }); + } + return markLineModel; +} + +/** 对list数据进行排序, 相同元素保持原有顺序*/ +export function sortListByCb(list, callback) { + list.map((elem, index) => { elem[`oldIndex`] = index; }); + list.sort((a, b) => { + return callback(a, b) || a.oldIndex - b.oldIndex; + }); + return list; +} + +/** 将数字转换成asc码*/ +export function numToAsc(num) { + const nmA = 'A'.charCodeAt(0); + const nmZ = 'Z'.charCodeAt(0); + const len = nmZ - nmA + 1; + let str = ''; + + while (num >= 0) { + str = String.fromCharCode(num % len + nmA) + str; + num = Math.floor(num / len) - 1; + } + + return str; +} + +/** 将asc码转换成数字*/ +export function ascToNum(asc) { + const base = 'A'.charCodeAt() - 1; + let idx = asc.length - 1; + let num = 0; + let mulFactor = 1; + while (idx >= 0) { + num += (asc[idx].charCodeAt() - base) * mulFactor; + mulFactor *= 26; + idx -= 1; + } + + return num; +} + +/** 根据索引获取单元格的数据*/ +export function getCellValue(Sheet, index) { + let value; + const cell = Sheet[index]; + if (cell) { + value = cell.w || cell.v; + } + + return value; +} + +/** 转换sheet数据为json数据*/ +export function convertSheetToList(Sheet, isReverse) { + const dataList = []; + + if (Sheet) { + const refarea = Sheet['!ref']; + const regular = /([a-zA-Z]+)([0-9]+):([a-zA-Z]+)([0-9]+)/i; + + if (refarea == null) return []; // "A1:M698" + if (regular.test(refarea)) { + /** 正则转换解析行列数据*/ + const CoordList = regular.exec(refarea); + /** 转换数据为二维数组*/ + const colBeg = ascToNum(CoordList[1]); + const colEnd = ascToNum(CoordList[3]); + const rowBeg = Number(CoordList[2]); + const rowEnd = Number(CoordList[4]); + + if (isReverse) { + for (let i = colBeg - 1; i < colEnd; i++) { + dataList.push([]); + for (let j = rowBeg; j <= rowEnd; j++) { + dataList[dataList.length - 1].push(getCellValue(Sheet, numToAsc(i) + j)); + } + } + } else { + for (let i = rowBeg; i <= rowEnd; i++) { + dataList.push([]); + for (let j = colBeg - 1; j < colEnd; j++) { + dataList[dataList.length - 1].push(getCellValue(Sheet, numToAsc(j) + i)); + } + } + } + } + } + + return dataList; +} + +/** 通过time将时间格式化*/ +export function formatTime(time) { + if (Number.isInteger(time)) { + return timeFormat(time); + } else { + return ''; + } +} + +/** 将时间格式化前补零*/ +export function prefixTime(time) { + let str = `${time}` || ''; + if (str) { + const list = str.split(':'); + str = list.map(elem => { + return `00000${elem}`.substr(-2); + }).join(':'); + } + + return str; +} diff --git a/src/jmapNew/theme/beijing_01/menus/menuSection.vue b/src/jmapNew/theme/beijing_01/menus/menuSection.vue index fa2ef6ef8..88a30e2ac 100644 --- a/src/jmapNew/theme/beijing_01/menus/menuSection.vue +++ b/src/jmapNew/theme/beijing_01/menus/menuSection.vue @@ -7,6 +7,7 @@ + @@ -25,6 +26,7 @@ import CMD from '@/scripts/cmdPlugin/CommandEnum'; import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; import SetFault from '@/jmapNew/theme/components/menus/dialog/setFault'; import TrainAddPlan from '@/jmapNew/theme/components/menus/dialog/trainAddPlan'; +import LoadSpareTrain from '@/jmapNew/theme/components/menus/dialog/loadSpareTrain'; export default { name: 'SectionMenu', @@ -35,7 +37,8 @@ export default { AlxeEffective, NoticeInfo, SetFault, - TrainAddPlan + TrainAddPlan, + LoadSpareTrain }, props: { selected: { @@ -74,6 +77,11 @@ export default { label: '设置临时限速', handler: this.setSpeed, cmdType: CMD.Section.CMD_SECTION_SET_LIMIT_SPEED + }, + { + label: '取消临时限速', + handler: this.cancelSpeed, + cmdType: CMD.Section.CMD_SECTION_CANCEL_LIMIT_SPEED } ] }, @@ -92,6 +100,11 @@ export default { label: '触发故障管理', handler: this.triggerFaultManagement, cmdType: CMD.Fault.CMD_TRIGGER_FAULT + }, + { + label: '设置备用车', + handler: this.loadSpare, + cmdType: CMD.Section.CMD_TRAIN_LOAD_SPARE_TRAIN } ] }; @@ -183,6 +196,13 @@ export default { } }); }, + loadSpare() { + commitOperate(menuOperate.Section.loadSpareTrain, {sectionCode:this.selected.code}).then(({valid, operate})=>{ + if (valid) { + this.$refs.loadSpareTrain.doShow(operate, this.selected); + } + }); + }, // // 设置计轴失效 // alxeFailure() { // const operate = { @@ -290,6 +310,17 @@ export default { }, triggerFaultManagement() { this.$store.dispatch('training/setTriggerFaultCount', this.selected); + }, + cancelSpeed() { + let sectionCode = this.selected.code; + if (this.selected.type == '02' || this.selected.type == '03') { + sectionCode = this.selected.parentCode; + } + commitOperate(menuOperate.Section.cancelSpeed, {sectionCode:sectionCode}).then(({valid, operate})=>{ + if (valid) { + this.$refs.speedLimitControl.doShow(operate, this.selected); + } + }); } } }; diff --git a/src/jmapNew/theme/beijing_01/planConvert.js b/src/jmapNew/theme/beijing_01/planConvert.js index 1d9e22507..08dadbb83 100644 --- a/src/jmapNew/theme/beijing_01/planConvert.js +++ b/src/jmapNew/theme/beijing_01/planConvert.js @@ -128,7 +128,8 @@ export default { if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode || index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime || index > 0 && index < train.stationTimeList.length - 1) { - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa]); } }); @@ -138,7 +139,8 @@ export default { lastPoint = train.stationTimeList[idx - 1]; nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1]; num = this.computedReentryNumber(train.tripNumber); - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode, aa]); opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode, aa]); } diff --git a/src/jmapNew/theme/chengdu_01/menus/menuSection.vue b/src/jmapNew/theme/chengdu_01/menus/menuSection.vue index 0dfa44083..e870caf44 100644 --- a/src/jmapNew/theme/chengdu_01/menus/menuSection.vue +++ b/src/jmapNew/theme/chengdu_01/menus/menuSection.vue @@ -7,6 +7,7 @@ + @@ -24,6 +25,7 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler'; import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; +import LoadSpareTrain from '@/jmapNew/theme/components/menus/dialog/loadSpareTrain'; export default { name: 'SectionMenu', @@ -34,7 +36,8 @@ export default { SectionControl, SectionCmdControl, SetFault, - TrainAddPlan + TrainAddPlan, + LoadSpareTrain }, props: { selected: { @@ -83,6 +86,11 @@ export default { label: '触发故障管理', handler: this.triggerFaultManagement, cmdType: CMD.Fault.CMD_TRIGGER_FAULT + }, + { + label: '设置备用车', + handler: this.loadSpare, + cmdType: CMD.Section.CMD_TRAIN_LOAD_SPARE_TRAIN } ] }; @@ -214,6 +222,13 @@ export default { } }); }, + loadSpare() { + commitOperate(menuOperate.Section.loadSpareTrain, {sectionCode:this.selected.code}).then(({valid, operate})=>{ + if (valid) { + this.$refs.loadSpareTrain.doShow(operate, this.selected); + } + }); + }, lock() { const step = { start: true, diff --git a/src/jmapNew/theme/chengdu_01/operationConfig.js b/src/jmapNew/theme/chengdu_01/operationConfig.js new file mode 100644 index 000000000..a9a9e5619 --- /dev/null +++ b/src/jmapNew/theme/chengdu_01/operationConfig.js @@ -0,0 +1,19 @@ +import CMD from '@/scripts/cmdPlugin/CommandEnum'; +export default { + list: [ + { + maxDuration: 8, + minDuration: 5, + operateType:CMD.Stand.CMD_STAND_SET_HOLD_TRAIN.value, + skinCode: '03', + trainingName: '设置扣车({10}-{12} 站台)', + trainingRemark: '设置扣车功能', + trainingType:'Stand', + productTypes: ['02'], // 产品类型 01 现地 02 行调 + stepVOList: [ + { deviceType: '06', orderNum: 1, operateCode: '504', tip: '鼠标右键菜单选择【设置扣车】'}, + { deviceType: '06', orderNum: 2, operateCode: '504', tip: '鼠标左键点击【确定】按钮' } + ] + } + ] +}; diff --git a/src/jmapNew/theme/chengdu_01/planConvert.js b/src/jmapNew/theme/chengdu_01/planConvert.js index d9d827c31..9f9441ee4 100644 --- a/src/jmapNew/theme/chengdu_01/planConvert.js +++ b/src/jmapNew/theme/chengdu_01/planConvert.js @@ -128,7 +128,8 @@ export default { if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode || index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime || index > 0 && index < train.stationTimeList.length - 1) { - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa]); } }); @@ -138,7 +139,8 @@ export default { lastPoint = train.stationTimeList[idx - 1]; nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1]; num = this.computedReentryNumber(train.tripNumber); - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode, aa]); opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode, aa]); } diff --git a/src/jmapNew/theme/chengdu_03/menus/menuBar.vue b/src/jmapNew/theme/chengdu_03/menus/menuBar.vue index c9cf5c801..ccebb5430 100644 --- a/src/jmapNew/theme/chengdu_03/menus/menuBar.vue +++ b/src/jmapNew/theme/chengdu_03/menus/menuBar.vue @@ -126,7 +126,8 @@ export default { Local: [ { title: '系统', - operate: OperationEvent.Command.mBar.system, + // operate: OperationEvent.Command.mBar.system, + operate: '', children: [ { title: '登录', @@ -174,7 +175,8 @@ export default { }, { title: '查看', - operate: OperationEvent.Command.mBar.check, + // operate: OperationEvent.Command.mBar.check, + operate: '', children: [ { title: '运行图', @@ -287,7 +289,8 @@ export default { }, { title: '显示', - operate: OperationEvent.Command.mBar.view, + // operate: OperationEvent.Command.mBar.view, + operate: '', hide: true, children: [ { diff --git a/src/jmapNew/theme/chengdu_03/menus/menuSection.vue b/src/jmapNew/theme/chengdu_03/menus/menuSection.vue index 793c7d90d..d4d2a75a7 100644 --- a/src/jmapNew/theme/chengdu_03/menus/menuSection.vue +++ b/src/jmapNew/theme/chengdu_03/menus/menuSection.vue @@ -6,6 +6,7 @@ + @@ -22,6 +23,7 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler'; import { menuOperate, commitOperate } from '@/jmapNew/theme/components/utils/menuOperate'; +import LoadSpareTrain from '@/jmapNew/theme/components/menus/dialog/loadSpareTrain'; export default { name: 'SectionMenu', @@ -31,7 +33,8 @@ export default { SectionDetail, NoticeInfo, TrainAddPlan, - SetFault + SetFault, + LoadSpareTrain }, props: { selected: { @@ -63,7 +66,6 @@ export default { handler: this.detail, cmdType: CMD.Section.CMD_SECTION_DETAILS } - ] }, menuForce: [ @@ -81,6 +83,11 @@ export default { label: '触发故障管理', handler: this.triggerFaultManagement, cmdType: CMD.Fault.CMD_TRIGGER_FAULT + }, + { + label: '设置备用车', + handler: this.loadSpare, + cmdType: CMD.Section.CMD_TRAIN_LOAD_SPARE_TRAIN } ] }; @@ -141,6 +148,13 @@ export default { this.$refs.popMenu.close(); } }, + loadSpare() { + commitOperate(menuOperate.Section.loadSpareTrain, {sectionCode:this.selected.code}).then(({valid, operate})=>{ + if (valid) { + this.$refs.loadSpareTrain.doShow(operate, this.selected); + } + }); + }, // 设置计轴失效 alxeFailure() { const step = { diff --git a/src/jmapNew/theme/chengdu_03/planConvert.js b/src/jmapNew/theme/chengdu_03/planConvert.js index c4029af74..921c6f4da 100644 --- a/src/jmapNew/theme/chengdu_03/planConvert.js +++ b/src/jmapNew/theme/chengdu_03/planConvert.js @@ -106,7 +106,8 @@ export default { if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode || index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime || index > 0 && index < train.stationTimeList.length - 1) { - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa]); } }); @@ -116,7 +117,8 @@ export default { lastPoint = train.stationTimeList[idx - 1]; nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1]; num = this.computedReentryNumber(train.tripNumber); - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode, aa]); opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode, aa]); } diff --git a/src/jmapNew/theme/components/menus/dialog/loadSpareTrain.vue b/src/jmapNew/theme/components/menus/dialog/loadSpareTrain.vue new file mode 100644 index 000000000..9a6c8e71a --- /dev/null +++ b/src/jmapNew/theme/components/menus/dialog/loadSpareTrain.vue @@ -0,0 +1,178 @@ + + + + diff --git a/src/jmapNew/theme/components/menus/dialog/setFault.vue b/src/jmapNew/theme/components/menus/dialog/setFault.vue index 0bdb2fb57..9a80448ff 100644 --- a/src/jmapNew/theme/components/menus/dialog/setFault.vue +++ b/src/jmapNew/theme/components/menus/dialog/setFault.vue @@ -119,7 +119,11 @@ export default { if (selected._type == 'Train') { name = selected.serviceNumber; } - this.deviceName = deviceType[selected._type] + '-' + name; + if (name) { + this.deviceName = deviceType[selected._type] + '-' + name; + } else { + this.deviceName = deviceType[selected._type]; + } this.faultList = deviceFaultType[selected._type]; if (this.faultList && this.faultList.length) { this.form.faultType = this.faultList[0].value; diff --git a/src/jmapNew/theme/components/menus/dialog/speedCmdControl.vue b/src/jmapNew/theme/components/menus/dialog/speedCmdControl.vue index 5b0c0f51c..2332d8b53 100644 --- a/src/jmapNew/theme/components/menus/dialog/speedCmdControl.vue +++ b/src/jmapNew/theme/components/menus/dialog/speedCmdControl.vue @@ -455,7 +455,8 @@ export default { cmdType: '', param: { speedLimitValue: this.speed - } + }, + val: this.speed }; if (this.operation == OperationEvent.Section.setSpeed.menu.operation) { diff --git a/src/jmapNew/theme/components/menus/dialog/switchHookLock.vue b/src/jmapNew/theme/components/menus/dialog/switchHookLock.vue index bb9a09244..d86171936 100644 --- a/src/jmapNew/theme/components/menus/dialog/switchHookLock.vue +++ b/src/jmapNew/theme/components/menus/dialog/switchHookLock.vue @@ -39,13 +39,14 @@ 取 消 - + + + diff --git a/src/jmapNew/theme/haerbin_01/menus/menuDialog/alarmTableLow.vue b/src/jmapNew/theme/haerbin_01/menus/menuDialog/alarmTableLow.vue new file mode 100644 index 000000000..a716ade30 --- /dev/null +++ b/src/jmapNew/theme/haerbin_01/menus/menuDialog/alarmTableLow.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/src/jmapNew/theme/haerbin_01/menus/menuSection.vue b/src/jmapNew/theme/haerbin_01/menus/menuSection.vue index f67947d95..74e129a5d 100644 --- a/src/jmapNew/theme/haerbin_01/menus/menuSection.vue +++ b/src/jmapNew/theme/haerbin_01/menus/menuSection.vue @@ -4,6 +4,7 @@ + @@ -17,6 +18,7 @@ import { mapGetters } from 'vuex'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler'; import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; +import LoadSpareTrain from '@/jmapNew/theme/components/menus/dialog/loadSpareTrain'; export default { name: 'SectionMenu', @@ -24,7 +26,8 @@ export default { PopMenu, NoticeInfo, TrainAddPlan, - SetFault + SetFault, + LoadSpareTrain }, props: { selected: { @@ -58,6 +61,11 @@ export default { label: '触发故障管理', handler: this.triggerFaultManagement, cmdType: CMD.Fault.CMD_TRIGGER_FAULT + }, + { + label: '设置备用车', + handler: this.loadSpare, + cmdType: CMD.Section.CMD_TRAIN_LOAD_SPARE_TRAIN } ] }; @@ -106,6 +114,13 @@ export default { this.menu = this.menuForce; } }, + loadSpare() { + commitOperate(menuOperate.Section.loadSpareTrain, {sectionCode:this.selected.code}).then(({valid, operate})=>{ + if (valid) { + this.$refs.loadSpareTrain.doShow(operate, this.selected); + } + }); + }, doShow(point) { this.clickEvent(); this.initMenu(); diff --git a/src/jmapNew/theme/haerbin_01/planConvert.js b/src/jmapNew/theme/haerbin_01/planConvert.js index 8e99a545d..be09d33f1 100644 --- a/src/jmapNew/theme/haerbin_01/planConvert.js +++ b/src/jmapNew/theme/haerbin_01/planConvert.js @@ -188,7 +188,8 @@ export default { /** 计算非折返点车次点坐标集合*/ train.stationTimeList.forEach((elem, index) => { idx = index; - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa]); }); @@ -196,7 +197,8 @@ export default { if (!train.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) { lastPoint = train.stationTimeList[idx]; nextPoint = service.tripNumberDataList[j + 1].stationTimeList[0]; - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true), lastPoint.stationCode, aa, '折返轨']); opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true), lastPoint.stationCode, aa, '折返轨']); } diff --git a/src/jmapNew/theme/ningbo_01/menus/menuSection.vue b/src/jmapNew/theme/ningbo_01/menus/menuSection.vue index 3a924be67..a5f7a871b 100644 --- a/src/jmapNew/theme/ningbo_01/menus/menuSection.vue +++ b/src/jmapNew/theme/ningbo_01/menus/menuSection.vue @@ -8,6 +8,7 @@ + @@ -15,6 +16,7 @@ import PopMenu from '@/components/PopMenu'; import SectionControl from '@/jmapNew/theme/components/menus/dialog/sectionControl'; import TrainAddPlan from '@/jmapNew/theme/components/menus/dialog/trainAddPlan'; +import LoadSpareTrain from '@/jmapNew/theme/components/menus/dialog/loadSpareTrain'; import SetFault from '@/jmapNew/theme/components/menus/dialog/setFault'; import SectionUnLock from '@/jmapNew/theme/components/menus/dialog/sectionUnLock'; import SpeedLimitControl from '@/jmapNew/theme/components/menus/dialog/speedCmdControl'; @@ -36,7 +38,8 @@ export default { AlxeEffective, NoticeInfo, TrainAddPlan, - SetFault + SetFault, + LoadSpareTrain }, props: { selected: { @@ -120,6 +123,11 @@ export default { label: '触发故障管理', handler: this.triggerFaultManagement, cmdType: CMD.Fault.CMD_TRIGGER_FAULT + }, + { + label: '设置备用车', + handler: this.loadSpare, + cmdType: CMD.Section.CMD_TRAIN_LOAD_SPARE_TRAIN } ] }; @@ -270,6 +278,13 @@ export default { } }); }, + loadSpare() { + commitOperate(menuOperate.Section.loadSpareTrain, {sectionCode:this.selected.code}).then(({valid, operate})=>{ + if (valid) { + this.$refs.loadSpareTrain.doShow(operate, this.selected); + } + }); + }, // 设置故障 setStoppage() { commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{ diff --git a/src/jmapNew/theme/ningbo_01/menus/menuSwitch.vue b/src/jmapNew/theme/ningbo_01/menus/menuSwitch.vue index 2ff620c8f..18d8095d1 100644 --- a/src/jmapNew/theme/ningbo_01/menus/menuSwitch.vue +++ b/src/jmapNew/theme/ningbo_01/menus/menuSwitch.vue @@ -184,15 +184,15 @@ export default { this.menu = MenuContextHandler.covert(this.menuNormal); // 故障模式菜单列表 if (this.operatemode === OperateMode.FAULT) { - if (!this.$store.state.scriptRecord.bgSet) { - const menuHook = [{ - label: '道岔钩锁', - handler: this.hookLock - }]; - this.menu = [...this.menuForce, ...menuHook]; - } else { - this.menu = this.menuForce; - } + // if (!this.$store.state.scriptRecord.bgSet) { + const menuHook = [{ + label: '道岔钩锁', + handler: this.hookLock + }]; + this.menu = [...this.menuForce, ...menuHook]; + // } else { + // this.menu = this.menuForce; + // } } }, doShow(point) { diff --git a/src/jmapNew/theme/ningbo_01/planConvert.js b/src/jmapNew/theme/ningbo_01/planConvert.js index 69faa50a4..5e73b8dc2 100644 --- a/src/jmapNew/theme/ningbo_01/planConvert.js +++ b/src/jmapNew/theme/ningbo_01/planConvert.js @@ -152,7 +152,8 @@ export default { if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode || index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime || index > 0 && index < train.stationTimeList.length - 1) { - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]); } }); diff --git a/src/jmapNew/theme/ningbo_03/menus/menuSwitch.vue b/src/jmapNew/theme/ningbo_03/menus/menuSwitch.vue index 7f153a998..a666f4f4f 100644 --- a/src/jmapNew/theme/ningbo_03/menus/menuSwitch.vue +++ b/src/jmapNew/theme/ningbo_03/menus/menuSwitch.vue @@ -179,15 +179,15 @@ export default { this.menu = MenuContextHandler.covert(this.menuNormal); // 故障模式菜单列表 if (this.operatemode === OperateMode.FAULT) { - if (!this.$store.state.scriptRecord.bgSet) { - const menuHook = [{ - label: '道岔钩锁', - handler: this.hookLock - }]; - this.menu = [...this.menuForce, ...menuHook]; - } else { - this.menu = this.menuForce; - } + // if (!this.$store.state.scriptRecord.bgSet) { + const menuHook = [{ + label: '道岔钩锁', + handler: this.hookLock + }]; + this.menu = [...this.menuForce, ...menuHook]; + // } else { + // this.menu = this.menuForce; + // } } }, doShow(point) { diff --git a/src/jmapNew/theme/ningbo_03/planConvert.js b/src/jmapNew/theme/ningbo_03/planConvert.js index 32d2fd84b..1cf586631 100644 --- a/src/jmapNew/theme/ningbo_03/planConvert.js +++ b/src/jmapNew/theme/ningbo_03/planConvert.js @@ -138,7 +138,8 @@ export default { if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode || index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime || index > 0 && index < train.stationTimeList.length - 1) { - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa]); } }); @@ -148,7 +149,8 @@ export default { lastPoint = train.stationTimeList[idx - 1]; nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1]; num = this.computedReentryNumber(train.tripNumber); - const aa = `${train.directionCode}${train.tripNumber}`; + // ${train.directionCode} + const aa = `${train.tripNumber}`; opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode, aa]); opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode, aa]); } diff --git a/src/jmapNew/theme/race_01/menus/dialog/alxeEffective.vue b/src/jmapNew/theme/race_01/menus/dialog/alxeEffective.vue new file mode 100644 index 000000000..3335a31b9 --- /dev/null +++ b/src/jmapNew/theme/race_01/menus/dialog/alxeEffective.vue @@ -0,0 +1,407 @@ + + + + diff --git a/src/jmapNew/theme/race_01/menus/dialog/childDialog/confirmControl.vue b/src/jmapNew/theme/race_01/menus/dialog/childDialog/confirmControl.vue new file mode 100644 index 000000000..6666d8f79 --- /dev/null +++ b/src/jmapNew/theme/race_01/menus/dialog/childDialog/confirmControl.vue @@ -0,0 +1,152 @@ + + + + diff --git a/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmSignalUnlock.vue b/src/jmapNew/theme/race_01/menus/dialog/childDialog/confirmSignalUnlock.vue similarity index 90% rename from src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmSignalUnlock.vue rename to src/jmapNew/theme/race_01/menus/dialog/childDialog/confirmSignalUnlock.vue index 7ee9783b4..378e19ce1 100644 --- a/src/jmap/theme/fuzhou_01/menus/dialog/childDialog/confirmSignalUnlock.vue +++ b/src/jmapNew/theme/race_01/menus/dialog/childDialog/confirmSignalUnlock.vue @@ -1,7 +1,7 @@ - + + + diff --git a/src/views/competitionManage/bankList/question-create-page.vue b/src/views/competitionManage/bankList/question-create-page.vue index 804953422..2a4275618 100644 --- a/src/views/competitionManage/bankList/question-create-page.vue +++ b/src/views/competitionManage/bankList/question-create-page.vue @@ -2,7 +2,7 @@
- + diff --git a/src/views/iscs/iscsSystem/stationConfig/dialog/incident.vue b/src/views/iscs/iscsSystem/stationConfig/dialog/incident.vue new file mode 100644 index 000000000..ea7bb3d5b --- /dev/null +++ b/src/views/iscs/iscsSystem/stationConfig/dialog/incident.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/src/views/iscs/iscsSystem/stationConfig/dialog/malfunction.vue b/src/views/iscs/iscsSystem/stationConfig/dialog/malfunction.vue new file mode 100644 index 000000000..f03419ef2 --- /dev/null +++ b/src/views/iscs/iscsSystem/stationConfig/dialog/malfunction.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/src/views/iscs/iscsSystem/stationConfig/dialog/valve.vue b/src/views/iscs/iscsSystem/stationConfig/dialog/valve.vue index fe38feba4..b7b079b69 100644 --- a/src/views/iscs/iscsSystem/stationConfig/dialog/valve.vue +++ b/src/views/iscs/iscsSystem/stationConfig/dialog/valve.vue @@ -59,6 +59,7 @@ - - - diff --git a/src/views/jlmap3d/devicetrain/jl3ddevicetrain.vue b/src/views/jlmap3d/devicetrain/jl3ddevicetrain.vue deleted file mode 100644 index 490451a74..000000000 --- a/src/views/jlmap3d/devicetrain/jl3ddevicetrain.vue +++ /dev/null @@ -1,559 +0,0 @@ - - - diff --git a/src/views/jlmap3d/drive/drivecontrol/centerpane.vue b/src/views/jlmap3d/drive/drivecontrol/centerpane.vue index 28cb67120..016b93185 100644 --- a/src/views/jlmap3d/drive/drivecontrol/centerpane.vue +++ b/src/views/jlmap3d/drive/drivecontrol/centerpane.vue @@ -35,10 +35,6 @@ }, props: { - drawWay: { - type: String, - default: 'false' - }, groupNum: { type: String, default: null diff --git a/src/views/jlmap3d/drive/drivecontrol/drivecontrol.vue b/src/views/jlmap3d/drive/drivecontrol/drivecontrol.vue index 570ba0974..2b9f3672f 100644 --- a/src/views/jlmap3d/drive/drivecontrol/drivecontrol.vue +++ b/src/views/jlmap3d/drive/drivecontrol/drivecontrol.vue @@ -16,7 +16,7 @@
- + @@ -87,7 +87,6 @@ import axios from 'axios'; trainlist:null, groupnum:"", userrole:'', - drawWay:'', nowdrive:null, tuoguanbutton:false, diff --git a/src/views/jlmap3d/drive/drivecontrol/toprightpane.vue b/src/views/jlmap3d/drive/drivecontrol/toprightpane.vue index 29794f493..70fb4dc5b 100644 --- a/src/views/jlmap3d/drive/drivecontrol/toprightpane.vue +++ b/src/views/jlmap3d/drive/drivecontrol/toprightpane.vue @@ -17,7 +17,7 @@
BM/CBTC
-
--> +
@@ -83,20 +83,20 @@
--> - + - + +
@@ -193,6 +193,11 @@ doorleftimg:JL3D_LOCAL_STATIC+"/jl3d/control/green.png", doorrightimg:JL3D_LOCAL_STATIC+"/jl3d/control/green.png", + //升降弓灯亮light暗dark + sgl:JL3D_LOCAL_STATIC+"/jl3d/control/greenz.png", + jgl:JL3D_LOCAL_STATIC+"/jl3d/control/redz.png", + sgd:JL3D_LOCAL_STATIC+"/jl3d/control/greenz.png", + jgd:JL3D_LOCAL_STATIC+"/jl3d/control/redz.png", } }, watch: { diff --git a/src/views/jlmap3d/drive/sceneview/tmscomponent/tmsfault.vue b/src/views/jlmap3d/drive/sceneview/tmscomponent/tmsfault.vue new file mode 100644 index 000000000..cce1a2b75 --- /dev/null +++ b/src/views/jlmap3d/drive/sceneview/tmscomponent/tmsfault.vue @@ -0,0 +1,95 @@ + + + + + + diff --git a/src/views/jlmap3d/drive/sceneview/tmsview.vue b/src/views/jlmap3d/drive/sceneview/tmsview.vue index 9d2b603f4..cc3b0e810 100644 --- a/src/views/jlmap3d/drive/sceneview/tmsview.vue +++ b/src/views/jlmap3d/drive/sceneview/tmsview.vue @@ -1,6 +1,7 @@ diff --git a/src/views/planMonitor/editToolAUS/components/drawer.vue b/src/views/planMonitor/editToolAUS/components/drawer.vue new file mode 100644 index 000000000..2aa0e4195 --- /dev/null +++ b/src/views/planMonitor/editToolAUS/components/drawer.vue @@ -0,0 +1,146 @@ + + + diff --git a/src/views/planMonitor/editToolAUS/index.vue b/src/views/planMonitor/editToolAUS/index.vue deleted file mode 100644 index c4f5b36e5..000000000 --- a/src/views/planMonitor/editToolAUS/index.vue +++ /dev/null @@ -1,99 +0,0 @@ - - - - - diff --git a/src/views/planMonitor/editToolAUS/line/index.vue b/src/views/planMonitor/editToolAUS/line/index.vue new file mode 100644 index 000000000..b055adfee --- /dev/null +++ b/src/views/planMonitor/editToolAUS/line/index.vue @@ -0,0 +1,173 @@ + + + + + diff --git a/src/views/planMonitor/editToolAUS/line/modify.vue b/src/views/planMonitor/editToolAUS/line/modify.vue new file mode 100644 index 000000000..08020c0cf --- /dev/null +++ b/src/views/planMonitor/editToolAUS/line/modify.vue @@ -0,0 +1,116 @@ + + + + + diff --git a/src/views/planMonitor/editToolAUS/line/stations.vue b/src/views/planMonitor/editToolAUS/line/stations.vue new file mode 100644 index 000000000..044f3ff48 --- /dev/null +++ b/src/views/planMonitor/editToolAUS/line/stations.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/views/planMonitor/editToolAUS/monitor.js b/src/views/planMonitor/editToolAUS/monitor.js deleted file mode 100644 index c37087877..000000000 --- a/src/views/planMonitor/editToolAUS/monitor.js +++ /dev/null @@ -1,360 +0,0 @@ -import echarts from 'echarts'; -import { DeviceMenu } from '@/scripts/ConstDic'; -import { timeFormat } from '@/utils/date'; - -export default { - data() { - return { - createModel: { - endStationCode: '', - startStationCode: '', - startTime: '' - }, - selected: null, - dragging: false - } - }, - watch: { - myChart: function() { - this.listenersBind(); - } - }, - beforeDestroy() { - this.listenersOff(); - }, - methods: { - getStationByCoord1(stations, y) { - for(var i = stations.length-1; i >= 0; i--) { - const station = stations[i]; - const edge = this.planConvert.EdgeHeight - const preKm = i == 0? edge*2: Math.abs(station.kmRange-stations[i-1].kmRange)/2; - const nxtKm = i == stations.length-1? edge: Math.abs(station.kmRange-stations[i+1].kmRange)/2; - const min = edge + station.kmRange - preKm; - const max = edge + station.kmRange + nxtKm; - if (y >= min && y <= max) { - return station; - } - } - return null; - }, - getStationByCoord(stations, y) { - for(var i = stations.length-1; i >= 0; i--) { - const station = stations[i]; - const edge = this.planConvert.EdgeHeight; - const rate = this.planConvert.CoordMultiple; - - const preKm = i == 0? edge*2: rate/2; - const nxtKm = i == stations.length-1? edge: rate/2; - const min = edge + i*rate - preKm; - const max = edge + i*rate + nxtKm; - - if (y >= min && y <= max) { - return station; - } - } - return null; - }, - pixelExecCb(e, cb) { - const event = e.componentType ? e.event: e; - const myChart = this.myChart; - const pointInPixel = [event.offsetX, event.offsetY] - if (myChart.containPixel('grid', pointInPixel) && this.planConvert) { - const pointInGrid = myChart.convertFromPixel({seriesIndex:0},pointInPixel); - const xIndex = pointInGrid[0]; - const yIndex = pointInGrid[1]; - const option = myChart.getOption(); - const minY = option.yAxis[0].min; - const xVal = option.xAxis[0].data[xIndex]; - const yObj = this.getStationByCoord(this.stations, yIndex-minY); - if (yObj && cb) { - cb({yObj, xVal, pointInPixel, e}); - } - } - }, - listenersBind() { - if (this.myChart) { - const zr = this.myChart.getZr(); - - zr.on('click', this.onClick, this) - this.myChart.on('mousedown', this.onMouseDown); - this.myChart.on('mouseover', this.onMouseOver); - this.myChart.on('mouseup', this.onMouseUP); - this.myChart.on('datazoom', this.onUpdatePosition); - window.addEventListener('resize', this.onUpdatePosition); - } - }, - listenersOff() { - if (this.myChart) { - const zr = this.myChart.getZr(); - - zr.off('click', this.onClick); - this.myChart.off('mousedown', this.onMouseDown); - this.myChart.off('mouseover', this.onMouseOver); - this.myChart.off('mouseup', this.onMouseUP); - this.myChart.off('datazoom', this.onUpdatePosition); - window.removeEventListener('resize', this.onUpdatePosition); - } - }, - onUpdatePosition(e) { - const option = this.myChart.getOption(); - const elements = option.graphic[0].elements - const graphic = echarts.util.map(elements, (item) => { - return { position: this.myChart.convertToPixel('grid', item.data) }; - }) - this.myChart.setOption({graphic}); - }, - onClick(e) { - switch(this.action) { - case 'Add': - this.pixelExecCb(e, this.handleCreateMark); - break; - } - }, - onMouseDown(e) { - switch(this.action) { - case 'Edit': - this.pixelExecCb(e, this.handlePopDialog); - break; - } - }, - onMouseOver(e) { - this.pixelExecCb(e, this.handleSelectLine); - }, - onMouseUP(e) { - switch(this.action) { - case 'Translate': - if (this.dragging) { - this.dragging = false; - this.handleTranslate(this.createModel) - } - break; - } - }, - onShapePointDragging(e) { - if (this.selected) { - this.dragging = true; - - this.myChart.dispatchAction({ - type: 'showTip', - seriesIndex: this.selected.seriesIndex, - dataIndex: this.selected.dataIndex - }); - - this.pixelExecCb(e, this.handleDragging); - } - }, - setLineLight() { - if (this.selected) { - this.myChart.setOption({ - series: { - name: this.selected.seriesName, - symbolSize: 10, - showAllSymbol: true, - lineStyle: { - width: 2, - color: 'red' - } - } - }); - } - }, - setLineReset() { - if (this.selected) { - this.myChart.setOption({ - series: { - name: this.selected.seriesName, - symbolSize: 6, - showAllSymbol: 'auto', - lineStyle: { - width: 1, - color: '#000' - } - } - }); - } - }, - clearGraphic(labels) { - const option = this.myChart.getOption(); - const elements = option.graphic[0].elements; - option.graphic[0].elements = elements.filter(el => { return !labels.includes(el.subType)}); - this.myChart.setOption(option, {notMerge: true}); - }, - createDragGraphicObj(point) { - return { - type: 'circle', - subType: 'drag', - position: this.myChart.convertToPixel('grid', point), - data: [...point], - shape: { - cx: 0, - cy: 0, - r: 10 - }, - style: { - fill: 'rgba(0,0,0,0.0)' - }, - draggable: 'horizontal', - ondrag: echarts.util.curry(this.onShapePointDragging), - z: 100 - } - }, - createMarkPointObj(point) { - return { - type: 'group', - subType: 'mark', - z: 100, - position: point, - point, - children: [ - { - type: 'circle', - z: 100, - shape: { - cx: 0, - cy: 0, - r: 5 - }, - style: { - fill: 'rgba(0,0,0,0.3)' - } - }, - { - type: 'circle', - z: 100, - shape: { - cx: 0, - cy: 0, - r: 10 - }, - style: { - fill: 'rgba(0,0,0,0.3)' - } - } - ] - } - }, - handlePopDialog({e, pointInPixel}) { - if (e.componentType == "series" && - e.componentSubType == "line" && - e.seriesName.includes('run-')) { - const value = e.value; - const point = { - x: pointInPixel[0], - y: pointInPixel[1] - } - const option = this.myChart.getOption(); - const dataList = option.series[e.seriesIndex].data; - const length = dataList.length; - const nxt = dataList[e.dataIndex+1]; - const pre = dataList[e.dataIndex-1]; - - this.selected = { - dataIndex: e.dataIndex, - seriesIndex: e.seriesIndex, - seriesName: e.seriesName, - seriesId: e.seriesName.replace('run-', ''), - depTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, - runTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, - stationCode: value[2], - _x: value[0], - dx: 0, - time: 0 - } - - if (e.dataIndex == length - 1 || - e.dataIndex < length - 1 && value[1] == nxt[1]) { - this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: DeviceMenu.planJustDeparture }); - } else if (e.dataIndex == 0 || - e.dataIndex > 0 && value[1] == pre[1]) { - this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: DeviceMenu.planJustArrival }); - } - } - }, - handleSelectLine({e}) { - if (e.componentType == "series" && - e.componentSubType == "line" && - e.seriesName.includes('run-')) { - const value = e.value; - const option = this.myChart.getOption(); - const dataList = option.series[e.seriesIndex].data; - const length = dataList.length; - const nxt = dataList[e.dataIndex+1]; - const pre = dataList[e.dataIndex-1]; - - if (this.selected && - this.selected.seriesName != e.seriesName) { - this.setLineReset(); - } - - this.selected = { - dataIndex: e.dataIndex, - seriesIndex: e.seriesIndex, - seriesName: e.seriesName, - seriesId: e.seriesName.replace('run-', ''), - depTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, - runTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, - stationCode: value[2], - _x: value[0], - dx: 0, - time: 0 - } - - this.setLineLight(); - - switch(this.action) { - case 'Translate': - this.handleCreateDrag({e}) - break; - } - } - }, - handleCreateDrag({e}) { - const option = this.myChart.getOption(); - const filters = option.graphic[0].elements.filter(el => { return el.subType != 'drag'}); - - filters.push(this.createDragGraphicObj(e.value)) - option.graphic[0].elements = filters; - - this.myChart.setOption(option, {notMerge: true}); - }, - handleCreateMark({pointInPixel, yObj, xVal}) { - const myChart = this.myChart; - const option = this.myChart.getOption(); - const graphic = option.graphic; - const elements = graphic[0].elements; - - elements.push(this.createMarkPointObj(pointInPixel)) - - myChart.setOption(option, {notMerge: true}); - - const filters = elements.filter(el => { return el.subType == 'mark'}); - - if (filters.length == 1) { - this.createModel.startStationCode = yObj.code; - this.createModel.startTime = timeFormat(xVal); - } else if (filters.length >= 2) { - this.createModel.endStationCode = yObj.code; - this.handleCreate(this.createModel); - } - }, - handleDragging({e, xVal}) { - this.selected.dx = xVal - this.selected._x; - this.selected.time += this.selected.dx; - this.selected._x = xVal; - - const option = this.myChart.getOption(); - const model = option.series[this.selected.seriesIndex] - if (model) { - model.data.forEach(el => { - el[0] += this.selected.dx; - }); - } - - if (e.target && e.target.position) { - e.target.data.x += this.selected.dx; - } - - this.myChart.setOption(option, {notMerge: true}); - } - } -} diff --git a/src/views/planMonitor/editToolAUS/schedule.vue b/src/views/planMonitor/editToolAUS/schedule.vue deleted file mode 100644 index 6104f2357..000000000 --- a/src/views/planMonitor/editToolAUS/schedule.vue +++ /dev/null @@ -1,550 +0,0 @@ - - - - diff --git a/src/views/planMonitor/editToolAUS/tool/dialog/planCreate.vue b/src/views/planMonitor/editToolAUS/tool/dialog/planCreate.vue new file mode 100644 index 000000000..95bdca82c --- /dev/null +++ b/src/views/planMonitor/editToolAUS/tool/dialog/planCreate.vue @@ -0,0 +1,74 @@ + + + diff --git a/src/views/planMonitor/editToolAUS/tool/dialog/planExport.vue b/src/views/planMonitor/editToolAUS/tool/dialog/planExport.vue new file mode 100644 index 000000000..d9620e7d9 --- /dev/null +++ b/src/views/planMonitor/editToolAUS/tool/dialog/planExport.vue @@ -0,0 +1,271 @@ + + + + + diff --git a/src/views/planMonitor/editToolAUS/tool/dialog/planJustRunning.vue b/src/views/planMonitor/editToolAUS/tool/dialog/planJustRunning.vue new file mode 100644 index 000000000..0a18c2f20 --- /dev/null +++ b/src/views/planMonitor/editToolAUS/tool/dialog/planJustRunning.vue @@ -0,0 +1,104 @@ + + + diff --git a/src/views/planMonitor/editToolAUS/dialog/planJustStop.vue b/src/views/planMonitor/editToolAUS/tool/dialog/planJustStop.vue similarity index 68% rename from src/views/planMonitor/editToolAUS/dialog/planJustStop.vue rename to src/views/planMonitor/editToolAUS/tool/dialog/planJustStop.vue index 154ad05ca..e0bc09a51 100644 --- a/src/views/planMonitor/editToolAUS/dialog/planJustStop.vue +++ b/src/views/planMonitor/editToolAUS/tool/dialog/planJustStop.vue @@ -2,7 +2,7 @@ - + s @@ -14,7 +14,7 @@ diff --git a/src/views/planMonitor/editToolAUS/tool/index.vue b/src/views/planMonitor/editToolAUS/tool/index.vue new file mode 100644 index 000000000..a3b1ab730 --- /dev/null +++ b/src/views/planMonitor/editToolAUS/tool/index.vue @@ -0,0 +1,691 @@ +