diff --git a/src/jmap/components/batong_01/menus/dialog/childDialog/childDialog/noticeInfo.vue b/src/jmap/components/batong_01/menus/dialog/childDialog/childDialog/noticeInfo.vue new file mode 100644 index 000000000..c5005cae8 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/childDialog/childDialog/noticeInfo.vue @@ -0,0 +1,77 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/childDialog/confirmControl.vue b/src/jmap/components/batong_01/menus/dialog/childDialog/confirmControl.vue new file mode 100644 index 000000000..48ea2bacb --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/childDialog/confirmControl.vue @@ -0,0 +1,360 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/childDialog/confirmControlSpeed.vue b/src/jmap/components/batong_01/menus/dialog/childDialog/confirmControlSpeed.vue new file mode 100644 index 000000000..3a945a9e6 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/childDialog/confirmControlSpeed.vue @@ -0,0 +1,153 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/childDialog/confirmSignalUnlock.vue b/src/jmap/components/batong_01/menus/dialog/childDialog/confirmSignalUnlock.vue new file mode 100644 index 000000000..61399a921 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/childDialog/confirmSignalUnlock.vue @@ -0,0 +1,118 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/childDialog/confirmTrain.vue b/src/jmap/components/batong_01/menus/dialog/childDialog/confirmTrain.vue new file mode 100644 index 000000000..dbfc5c3d1 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/childDialog/confirmTrain.vue @@ -0,0 +1,168 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/routeCmdControl.vue b/src/jmap/components/batong_01/menus/dialog/routeCmdControl.vue new file mode 100644 index 000000000..82e446065 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/routeCmdControl.vue @@ -0,0 +1,430 @@ + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/routeControl.vue b/src/jmap/components/batong_01/menus/dialog/routeControl.vue new file mode 100644 index 000000000..53853eec9 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/routeControl.vue @@ -0,0 +1,236 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/routeDetail.vue b/src/jmap/components/batong_01/menus/dialog/routeDetail.vue new file mode 100644 index 000000000..88bb40c8b --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/routeDetail.vue @@ -0,0 +1,147 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/routeHandControl.vue b/src/jmap/components/batong_01/menus/dialog/routeHandControl.vue new file mode 100644 index 000000000..fc3909ee6 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/routeHandControl.vue @@ -0,0 +1,298 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/routeLock.vue b/src/jmap/components/batong_01/menus/dialog/routeLock.vue new file mode 100644 index 000000000..570a4ee4f --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/routeLock.vue @@ -0,0 +1,154 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/routeSelection.vue b/src/jmap/components/batong_01/menus/dialog/routeSelection.vue new file mode 100644 index 000000000..de8d0a13d --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/routeSelection.vue @@ -0,0 +1,231 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/standControl.vue b/src/jmap/components/batong_01/menus/dialog/standControl.vue new file mode 100644 index 000000000..ce3fa3281 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/standControl.vue @@ -0,0 +1,279 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/trainControl.vue b/src/jmap/components/batong_01/menus/dialog/trainControl.vue new file mode 100644 index 000000000..e4a8a0419 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/trainControl.vue @@ -0,0 +1,425 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/trainCreate.vue b/src/jmap/components/batong_01/menus/dialog/trainCreate.vue new file mode 100644 index 000000000..48a0c0e93 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/trainCreate.vue @@ -0,0 +1,155 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/trainDelete.vue b/src/jmap/components/batong_01/menus/dialog/trainDelete.vue new file mode 100644 index 000000000..3b8e01df3 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/trainDelete.vue @@ -0,0 +1,156 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/trainEditNumber.vue b/src/jmap/components/batong_01/menus/dialog/trainEditNumber.vue new file mode 100644 index 000000000..c12d370af --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/trainEditNumber.vue @@ -0,0 +1,131 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/trainMove.vue b/src/jmap/components/batong_01/menus/dialog/trainMove.vue new file mode 100644 index 000000000..df2c76842 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/trainMove.vue @@ -0,0 +1,186 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/dialog/trainSwitch.vue b/src/jmap/components/batong_01/menus/dialog/trainSwitch.vue new file mode 100644 index 000000000..843068108 --- /dev/null +++ b/src/jmap/components/batong_01/menus/dialog/trainSwitch.vue @@ -0,0 +1,187 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/index.vue b/src/jmap/components/batong_01/menus/index.vue new file mode 100644 index 000000000..33126c241 --- /dev/null +++ b/src/jmap/components/batong_01/menus/index.vue @@ -0,0 +1,357 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuBar.vue b/src/jmap/components/batong_01/menus/menuBar.vue new file mode 100644 index 000000000..83c535d4c --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuBar.vue @@ -0,0 +1,889 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuCancel.vue b/src/jmap/components/batong_01/menus/menuCancel.vue new file mode 100644 index 000000000..c51791b9f --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuCancel.vue @@ -0,0 +1,149 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/childDialog/twoConfirmation.vue b/src/jmap/components/batong_01/menus/menuDialog/childDialog/twoConfirmation.vue new file mode 100644 index 000000000..16201064f --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/childDialog/twoConfirmation.vue @@ -0,0 +1,126 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/childDialog/userAdd.vue b/src/jmap/components/batong_01/menus/menuDialog/childDialog/userAdd.vue new file mode 100644 index 000000000..2c42b0224 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/childDialog/userAdd.vue @@ -0,0 +1,162 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/childDialog/userDelete.vue b/src/jmap/components/batong_01/menus/menuDialog/childDialog/userDelete.vue new file mode 100644 index 000000000..7ebe5ef7b --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/childDialog/userDelete.vue @@ -0,0 +1,134 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/childDialog/userEdit.vue b/src/jmap/components/batong_01/menus/menuDialog/childDialog/userEdit.vue new file mode 100644 index 000000000..000f3f3a6 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/childDialog/userEdit.vue @@ -0,0 +1,178 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/passwordBox.vue b/src/jmap/components/batong_01/menus/menuDialog/passwordBox.vue new file mode 100644 index 000000000..605f912fe --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/passwordBox.vue @@ -0,0 +1,221 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/splitModule.vue b/src/jmap/components/batong_01/menus/menuDialog/splitModule.vue new file mode 100644 index 000000000..6ed7d0a09 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/splitModule.vue @@ -0,0 +1,201 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/stationControlConvert.vue b/src/jmap/components/batong_01/menus/menuDialog/stationControlConvert.vue new file mode 100644 index 000000000..edbb61b8b --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/stationControlConvert.vue @@ -0,0 +1,416 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/stationStantSplit.vue b/src/jmap/components/batong_01/menus/menuDialog/stationStantSplit.vue new file mode 100644 index 000000000..e468fe903 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/stationStantSplit.vue @@ -0,0 +1,187 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/trainAdd.vue b/src/jmap/components/batong_01/menus/menuDialog/trainAdd.vue new file mode 100644 index 000000000..8cb070100 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/trainAdd.vue @@ -0,0 +1,162 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/trainControl.vue b/src/jmap/components/batong_01/menus/menuDialog/trainControl.vue new file mode 100644 index 000000000..c1762373f --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/trainControl.vue @@ -0,0 +1,181 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/trainDelete.vue b/src/jmap/components/batong_01/menus/menuDialog/trainDelete.vue new file mode 100644 index 000000000..a015b7c12 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/trainDelete.vue @@ -0,0 +1,149 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/trainTranstalet.vue b/src/jmap/components/batong_01/menus/menuDialog/trainTranstalet.vue new file mode 100644 index 000000000..ff494f1cc --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/trainTranstalet.vue @@ -0,0 +1,152 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/viewDevice.vue b/src/jmap/components/batong_01/menus/menuDialog/viewDevice.vue new file mode 100644 index 000000000..90dddb3b3 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/viewDevice.vue @@ -0,0 +1,165 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/viewName.vue b/src/jmap/components/batong_01/menus/menuDialog/viewName.vue new file mode 100644 index 000000000..da36809b3 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/viewName.vue @@ -0,0 +1,265 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuDialog/viewTrainId.vue b/src/jmap/components/batong_01/menus/menuDialog/viewTrainId.vue new file mode 100644 index 000000000..e2a2d4c02 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuDialog/viewTrainId.vue @@ -0,0 +1,183 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuSection.vue b/src/jmap/components/batong_01/menus/menuSection.vue new file mode 100644 index 000000000..765cbfac2 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuSection.vue @@ -0,0 +1,389 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuSignal.vue b/src/jmap/components/batong_01/menus/menuSignal.vue new file mode 100644 index 000000000..47b12c509 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuSignal.vue @@ -0,0 +1,537 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuStation.vue b/src/jmap/components/batong_01/menus/menuStation.vue new file mode 100644 index 000000000..3cca5808e --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuStation.vue @@ -0,0 +1,299 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuStationControl.vue b/src/jmap/components/batong_01/menus/menuStationControl.vue new file mode 100644 index 000000000..c1e20104e --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuStationControl.vue @@ -0,0 +1,68 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuStationStand.vue b/src/jmap/components/batong_01/menus/menuStationStand.vue new file mode 100644 index 000000000..c06007bdf --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuStationStand.vue @@ -0,0 +1,485 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuSwitch.vue b/src/jmap/components/batong_01/menus/menuSwitch.vue new file mode 100644 index 000000000..3a40c9d3d --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuSwitch.vue @@ -0,0 +1,483 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuTool.vue b/src/jmap/components/batong_01/menus/menuTool.vue new file mode 100644 index 000000000..dc32a9673 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuTool.vue @@ -0,0 +1,205 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/menuTrain.vue b/src/jmap/components/batong_01/menus/menuTrain.vue new file mode 100644 index 000000000..c793796d2 --- /dev/null +++ b/src/jmap/components/batong_01/menus/menuTrain.vue @@ -0,0 +1,318 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/passiveDialog/alarm.vue b/src/jmap/components/batong_01/menus/passiveDialog/alarm.vue new file mode 100644 index 000000000..53e990525 --- /dev/null +++ b/src/jmap/components/batong_01/menus/passiveDialog/alarm.vue @@ -0,0 +1,215 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/passiveDialog/control.vue b/src/jmap/components/batong_01/menus/passiveDialog/control.vue new file mode 100644 index 000000000..9ed6b012d --- /dev/null +++ b/src/jmap/components/batong_01/menus/passiveDialog/control.vue @@ -0,0 +1,286 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/passiveDialog/timeout.vue b/src/jmap/components/batong_01/menus/passiveDialog/timeout.vue new file mode 100644 index 000000000..d4ef4bb7c --- /dev/null +++ b/src/jmap/components/batong_01/menus/passiveDialog/timeout.vue @@ -0,0 +1,107 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/statusBar.vue b/src/jmap/components/batong_01/menus/statusBar.vue new file mode 100644 index 000000000..0fad48767 --- /dev/null +++ b/src/jmap/components/batong_01/menus/statusBar.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/statusDownTrainDetail.vue b/src/jmap/components/batong_01/menus/statusDownTrainDetail.vue new file mode 100644 index 000000000..ce4f82f65 --- /dev/null +++ b/src/jmap/components/batong_01/menus/statusDownTrainDetail.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/statusUpTrainDetail.vue b/src/jmap/components/batong_01/menus/statusUpTrainDetail.vue new file mode 100644 index 000000000..9bd682637 --- /dev/null +++ b/src/jmap/components/batong_01/menus/statusUpTrainDetail.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/batong_01/menus/utils/menuItemStatus.js b/src/jmap/components/batong_01/menus/utils/menuItemStatus.js new file mode 100644 index 000000000..3bb6bdb33 --- /dev/null +++ b/src/jmap/components/batong_01/menus/utils/menuItemStatus.js @@ -0,0 +1,526 @@ +import store from '@/store'; +import { mapStatusEnum, getStatusObject } from '@/scripts/StatusDic'; +import { OperateMode } from '@/scripts/ConstDic'; +// import { stat } from 'fs'; + +export function getCurrentStatusObject() { + return getStatusObject(store.getters['menuOperation/selected']); +} + +/** 系统类型 */ +export const SystemType = { + '01': 'local', // 现地工作站 + '02': 'central' // 中心调度工作站 +}; + +export const StationControlType = { + '01': 'center', // 中控 + '02': 'station',// 站控 + '03': 'station', +}; + +// 控制禁用 +export const MenuDisabledStatus = { + Section: { + //故障解锁 + fault() { + }, + //切除 + split() { + let device = getCurrentStatusObject(); + if (device && device.cutOff != mapStatusEnum.Section.cutOff.Default) { + return true; + } + }, + //激活 + active() { + let device = getCurrentStatusObject(); + if (device && device.cutOff == mapStatusEnum.Section.cutOff.Default) { + return true; + } + }, + //区段封锁 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Section.status.Status06) { + return true; + } + }, + //区段解禁 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Section.status.Status06) { + return true; + } + }, + //区段设置限速 + setSpeed() { + let device = getCurrentStatusObject(); + if (device && device.speedUpperLimit != mapStatusEnum.Section.speedUpperLimit.Default) { + return true; + } + }, + //区段取消限速 + cancelSpeed() { + let device = getCurrentStatusObject(); + if (device && device.speedUpperLimit == mapStatusEnum.Section.speedUpperLimit.Default) { + return true; + } + }, + //新建列车 + newTrain() { + }, + //计轴预复位 + axlePreReset() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Signal: { + //进路选排 + arrangementRoute() { + + }, + //进路取消 + cancelTrainRoute() { + }, + //信号封闭 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Signal.status.Status04) { + return true; + } + }, + //信号解封 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Signal.status.Status04) { + return true; + } + }, + //信号重开 + reopenSignal() { + }, + //进路引导 + guide() { + }, + //设置联锁自动进路 + setAutoInterlock() { + }, + //取消联锁自动进路 + cancelAutoInterlock() { + }, + //设置联锁自动触发 + setAutoTrigger() { + }, + //取消联锁自动触发 + cancelAutoTrigger() { + }, + //关灯 + signalClose() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Signal.status.Status01) { + return true; + } + }, + //人工控 + humanControl() { + }, + //ats自动控 + atsAutoControl() { + }, + //查询进路状态 + detail() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Station: { + //全站设置联锁自动触发 + setAutoTrigger() { + }, + //全站取消联锁自动触发 + cancelAutoTrigger() { + }, + //上电解锁 + powerUnLock() { + }, + //执行关键操作测试 + execKeyOperationTest() { + }, + //所有进路自排开 + atsAutoControlALL() { + }, + //所有进路自排关 + humanControlALL() { + }, + //设置ZC故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消ZC故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + StationControl: { + //紧急站控 + emergencyStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status03) { + return true; + } + }, + //请求站控 + requestStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status02) { + return true; + } + }, + //强行站控 + forcedStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status02) { + return true; + } + }, + //请求中控 + requestCentralControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status01) { + return true; + } + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + StationStand: { + //设置扣车 + setDetainTrain() { + let device = getCurrentStatusObject(); + if (device && device.holdStatus != mapStatusEnum.StationStand.holdStatus.Status01) { + return true; + } + }, + //取消扣车 + cancelDetainTrain() { + let device = getCurrentStatusObject(); + if (device && device.holdStatus == mapStatusEnum.StationStand.holdStatus.Status01) { + return true; + } + }, + //强制取消扣车 + cancelDetainTrainForce() { + let device = getCurrentStatusObject(); + if (device && device.holdStatus == mapStatusEnum.StationStand.holdStatus.Status01) { + return true; + } + }, + //设置全站扣车 + cancelDetainTrainAll() { + }, + //设置运行等级 + setRunLevel() { + }, + //设置停站时间 + setStopTime() { + }, + //设置跳停 + setJumpStop() { + let device = getCurrentStatusObject(); + if (device && device.jumpStopStatus != mapStatusEnum.StationStand.jumpStopStatus.Status01) { + return true; + } + }, + //取消跳停 + cancelJumpStop() { + let device = getCurrentStatusObject(); + if (device && device.jumpStopStatus == mapStatusEnum.StationStand.jumpStopStatus.Status01) { + return true; + } + }, + //提前发车 + earlyDeparture() { + }, + //站台详细信息 + detail() { + }, + //设置折返策略 + setBackStrategy() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Switch: { + //单锁 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Switch.status.Status10) { + return true; + } + }, + //解锁 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Switch.status.Status10) { + return true; + } + }, + //封锁 + block() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Switch.status.Status14) { + return true; + } + }, + //解封 + unblock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Switch.status.Status14) { + return true; + } + }, + //强扳 + switchTurnoutForce() { + }, + //转动 + switchTurnout() { + }, + //道岔故障解锁 + fault() { + }, + //计轴预复位 + axlePreReset() { + }, + //道岔切除 + split() { + }, + //道岔激活 + active() { + }, + //道岔设置速度 + setSpeed() { + // let device = getCurrentStatusObject(); + }, + //道岔取消速度 + cancelSpeed() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Train: { + //添加列车识别号 + addTrainId() { + }, + //删除列车识别号 + delTrainId() { + }, + //修改列车识别号 + editTrainId() { + }, + //修改车组号 + editTrainNo() { + }, + //移动列车识别号 + moveTrainId() { + }, + //交换列车识别号 + switchTrainId() { + }, + //设置限速 + limitSpeed() { + }, + //设置通信故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消通信故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + } +}; + +/** + * 将menu的disabled属性使用disabledCallback计算并返回 + * @param {Array} menu + */ +export function menuConvert(menu) { + if (menu.constructor === Array) { + menu.forEach(elem => { + 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 => { + 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) { + let selected = store.getters['menuOperation/selected']; + let control, 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) { + let controlStatus = getStatusObject(control); + if (store.state.map.prdType != '') { + let type = SystemType[store.state.map.prdType]; + let status = StationControlType[controlStatus.status]; + 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; + } + elem.defaultDisabled = !elem.auth[status]; + } + }); + } + } + } + return menu; +} + +/** + * 将train menu的show属性过滤返回 + */ +export function trainMenuFiltration(menuObj) { + let menu = []; + if (store.state.map.prdType != '') { + let type = SystemType[store.state.map.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; +} \ No newline at end of file diff --git a/src/jmap/components/batong_01/model.js b/src/jmap/components/batong_01/model.js new file mode 100644 index 000000000..75c141c89 --- /dev/null +++ b/src/jmap/components/batong_01/model.js @@ -0,0 +1,71 @@ +/** + * 公共字段部分默认初始值 + */ +const modelPublicInitialValue = { + Signal: { + lampPositionType: '02', + lampPostType: '02' + } +}; + +/** + * 在绘图创建Model数据时,根据皮肤类型修改公共属性默认值 + * @param {Object} model + */ +export function InitPublicProperties(model) { + if (model) { + let modelInitial = modelPublicInitialValue[model._type]; + if (modelInitial) { + for (let prop in modelInitial) { + model[prop] = modelInitial[prop]; + } + } + } + + return model; +} + +/** + * 私有字段部分默认初始值 + */ +const modelPrivateInitialValue = { + StationControl: { + indicatorShow: true //标识灯名称显示 + }, + Section: { + borderBorderShow: true, //区段边界显示 + standTrackNameShow: true, //站台轨名称显示 + reentryTrackNameShow: true, //折返轨名称显示 + transferTrackNameShow: true, //转换轨名称显示 + + }, + Signal: { + linkageAutoRouteShow: true, //联锁自动进路表示灯显示 + atsAutoTriggerShow: true //ATS自动触发表示灯显示 + }, + Train: { + nameFormat: 'targetCode:serverNo:trainNo', //字体格式 + nameFontSize: 10, //字体大小 + }, + TrainWindow: { + // trainWindowShow: true, //是否显示 + trainWindowShow: false, + } +}; + +/** + * 加载Model数据时,根据皮肤类型修改前端私有属性默认值 + * @param {Object} model + */ +export function InitPrivateProperties(model) { + if (model) { + let modelInitial = modelPrivateInitialValue[model._type]; + if (modelInitial) { + for (let prop in modelInitial) { + model[prop] = modelInitial[prop]; + } + } + } + + return model; +} \ No newline at end of file diff --git a/src/jmap/components/batong_01/shape/Section.js b/src/jmap/components/batong_01/shape/Section.js new file mode 100644 index 000000000..f1da625a1 --- /dev/null +++ b/src/jmap/components/batong_01/shape/Section.js @@ -0,0 +1,960 @@ +import Group from 'zrender/src/container/Group'; +import Polyline from 'zrender/src/graphic/shape/Polyline'; +import Circle from 'zrender/src/graphic/shape/Circle'; +import Line from 'zrender/src/graphic/shape/Line'; +import Text from 'zrender/src/graphic/Text'; +import JTriangle from '@/jlmap/util/JTriangle'; +import store from '@/store'; + +/** 计轴*/ +class SectionAxle extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 5; + this._create(model); + } + + _create(model) { + if (model && model.theme && model.traingle) { + let axleLength = 2 * model.theme.sectionAxleR; + let positionx = model.point.x + model.drictx * (model.traingle.GetCos(axleLength)); + let positiony = model.point.y + model.dricty * (model.traingle.GetCos(axleLength)); + + this.line = new Line({ + zlevel: this.zlevel, + z: this.z, + 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.theme.sectionAxleColor + } + }); + this.axle = new Circle({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: positionx - model.dricty * model.traingle.GetSin(axleLength), + cy: positiony + model.drictx * model.traingle.GetSin(axleLength), + r: model.theme.sectionAxleR + }, + style: { + GBaseLineWidth: 1, + stroke: model.theme.sectionAxleColor, + fill: 'rgb(0,0,0,0)' + } + }); + + this.add(this.line); + this.add(this.axle); + } + } +} + +/** 分隔符*/ +class SectionSeparator extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 6; + this._create(model); + } + + _create(model) { + if (model && model.theme) { + this.partition = new Polyline({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + [model.point.x, model.point.y], + [model.point.x, model.point.y] + ] + }, + style: { + lineWidth: model.theme.sectionWidth / 3, + stroke: model.theme.sectionSeparatorColor + } + }); + + this.circle = new Circle({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.point.x, + cy: model.point.y, + r: 2 * model.theme.sectionWidth + }, + style: { + GBaseLineWidth: 1, + stroke: 'red', + fill: model.theme.transparentColor + } + }); + + this.add(this.partition); + this.setType(model.sepType, model.borderBorderShow); + } + } + + setType(type, show) { + let model = this.model; + if (model && model.theme && model.traingle) { + this.remove(this.circle); + if (type === '00') { + this.partition.setShape('points', [ + [model.point.x, model.point.y], + [model.point.x, model.point.y] + ]); + } else if (type === '01') { + this.partition.setShape('points', [ + [model.point.x, model.point.y - (model.theme.sectionWidth * 0.8)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 0.8)] + ]); + } else if (type === '02') { + this.partition.setShape('points', [ + [model.point.x + model.drict * (model.theme.sectionWidth), model.point.y - (model.theme.sectionWidth * 1.5)], + [model.point.x, model.point.y - (model.theme.sectionWidth * 1.5)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 1.5)] + ]); + } else if (type === '03') { + this.partition.setShape('points', [ + [model.point.x + model.drict * (model.theme.sectionWidth + 5), model.point.y - (model.theme.sectionWidth * 1.2)], + [model.point.x, model.point.y - (model.theme.sectionWidth * 1.2)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 1.2)], + [model.point.x + model.drict * (model.theme.sectionWidth + 5), model.point.y + (model.theme.sectionWidth * 1.2)], + ]); + this.partition.setStyle('stroke', '#C0C0C0'); + this.partition.setStyle('lineWidth', model.theme.sectionWidth * 0.2); + } else if (type === '04') { + this.add(this.circle); + } + } + + if (type === '03' && !show) { + this.partition.hide(); + } else { + this.partition.show(); + } + } +} + +/** 创建区段限速限集合*/ +class LimitLines 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) { + let 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, + z: this.z + 10, + culling: true, + shape: shape, + position: model.position, + style: { + lineWidth: model.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor, + fillOpacity: 0, + } + })); + } else { + let swPadding = model.theme.switchLen; //定位和反位时区段距离岔芯的距离 + var switchWidth = model.theme.sectionWidth + model.theme.sectionBeyondWidth; // 道岔宽度 + let beg = Object.assign({}, model.points[0]); + let end = Object.assign({}, model.points[model.points.length - 1]); + if (model.isSwitchSection && beg.y !== end.y) { + let swch = store.getters['map/getDeviceByCode'](model.relSwitchCode); + if (swch) { + let 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, + z: this.z, + position: model.position, + shape: { + x1: beg.x, + y1: beg.y, + x2: end.x, + y2: end.y, + }, + style: { + lineWidth: model.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } else { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + + for (let i = 1; i < (model.points.length - 2); i++) { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + z: this.z, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } + + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + z: this.z, + position: model.position, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } + } + } + } +} + +/** 创建区段线集合*/ +class Lines 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) { + for (let i = 0; i < (model.points.length - 1); i++) { + this.add(new Line({ + zlevel: this.zlevel, + z: model.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.theme.sectionWidth, + stroke: model.theme.sectionSpareColor + } + })); + } + } + } + + setStyle(styles) { + this.eachChild((child) => { + for (let prop in styles) { + child.setStyle(prop, styles[prop]); + } + }); + } + + animateStyle(loop, animates) { + if (animates && animates.length) { + this.eachChild((child) => { + let an = child.animateStyle(loop); + animates.forEach(elem => { + an = an.when(elem.time, elem.styles); + }); + an.start(); + }); + } + } + + stopAnimation(flag) { + this.eachChild((child) => { + child.stopAnimation(flag); + }); + } +} + +/** 区段*/ +export default class Section extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = model.layer || 0; + this._create(model); + } + + _create(model) { + //01:物理区段;02逻辑区段;03道岔区段 + this.createSectionText(); //创建区段文字 + if (model.sectionType === '01' && ( + model.logicSectionNum.length <= 0 || + model.logicSectionNum.length == 1 && model.logicSectionNum[0] == 0) || + model.sectionType === '02') { + this.createSection(); //创建区段 + this.createSeparator(); //创建分隔符 + if (model.sectionType === '01') { + this.createAxles(); //创建计轴 + } + this.setStatus(model); + } + } + + /** 创建区段*/ + createSection() { + let model = this.model; + let theme = this.theme; + + //创建区段 + this.section = new Lines({ + zlevel: this.zlevel, + z: this.z, + points: model.points, + theme: theme + }); + + //创建延时释放 + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + this.release = new Line({ + zlevel: model.zlevel + 1, + 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), + }, + style: { + lineWidth: theme.sectionWidth, + stroke: theme.sectionSpareColor + } + }); + this.release.hide(); + + let x = traingle.drictx * (theme.sectionSpeedLimitDistance + theme.sectionWidth / 2) * traingle.GetSinRate(); + let y = traingle.dricty * (theme.sectionSpeedLimitDistance + theme.sectionWidth / 2) * traingle.GetCosRate(); + if (x == Infinity) { x = 0; } + if (y == Infinity) { y = 0; } + + + //创建限速线 + this.speedLimitLeft = new LimitLines({ + zlevel: this.zlevel + 4, + z: this.z, + position: [x, -y], + points: model.points, + isSwitchSection: model.isSwitchSection, + relSwitchCode: model.relSwitchCode, + theme: theme, + }); + + this.speedLimitRight = new LimitLines({ + zlevel: this.zlevel + 4, + z: this.z, + position: [-x, y], + points: model.points, + isSwitchSection: model.isSwitchSection, + relSwitchCode: model.relSwitchCode, + theme: theme, + }); + + this.add(this.section); + this.add(this.release); + this.add(this.speedLimitLeft); + this.add(this.speedLimitRight); + } + + /** 创建区段名称*/ + createSectionText() { + let model = this.model; + let theme = this.theme; + + if (model && theme) { + //计算区段坐标位置 + let 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 + model.namePoint.x; + let 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 + model.namePoint.y; + + /**区段名称*/ + if (model.nameShow) { + let tempx = x; + let tempy = y; + + //根据列车上下行进行坐标偏移 + let drict = 1; + if (model.trainPosType === '01') { + drict = -1; + tempy -= (theme.sectionWidth + theme.textFontSize); + } + + if (model.sectionType !== '03') { + //计算文字和物理区段的距离 + //如果不是逻辑区段,让名称和区段保持点距离 + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + if (model.sectionType === '01') { + tempx += traingle.GetSin(theme.nameDistance); + tempy += traingle.GetCos(theme.nameDistance) * drict; + } + } else { + tempy += theme.nameDistance * drict; + } + + //创建区段名称 + this.sectionText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: tempx, + y: tempy, + text: model.name, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.sectionText); + } + + /**站台轨名称*/ + if (model.isStandTrack && model.standTrackNameShow) { + let tempx = x; + let tempy = y; + //根据列车上下行进行坐标偏移 + let drict = 1; + if (model.trainPosType != '01') { + drict = -1; + tempy -= (theme.sectionWidth + theme.textFontSize); + } + + //计算文字和物理区段的距离 + if (model.sectionType !== '02') { + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + tempx += traingle.GetSin(theme.nameDistance); + tempy += traingle.GetCos(theme.nameDistance) * drict; + } + + //创建站台轨名称 + this.standTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: tempx + model.standTrackNamePosition.x, + y: tempy + model.standTrackNamePosition.y, + text: model.standTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.standTrackText); + + } + + /**折返轨名称*/ + if (model.isReentryTrack && model.reentryTrackNameShow) { + //创建折返轨名称 + this.reentryTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.reentryTrackNamePosition.x, + y: y + model.reentryTrackNamePosition.y, + text: model.reentryTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.reentryTrackText); + } + + /**转换轨名称*/ + if (model.isTransferTrack && model.transferTrackNameShow) { + //转换轨名称 + this.transferTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.transferTrackNamePosition.x, + y: y + model.transferTrackNamePosition.y, + text: model.transferTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.transferTrackText); + } + + /**目的码名称*/ + if (model.destinationCode && model.destinationCodeShow) { + //转换轨名称 + this.destinationText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.destinationCodePoint.x, + y: y + model.destinationCodePoint.y, + text: model.destinationCode, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.destinationTextFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.destinationText); + } + } + } + + /** 创建计轴*/ + createAxles() { + let model = this.model; + let theme = this.theme; + + /** 创建四个计轴*/ + let traingle = null; + if (model && theme && model.isShowAxle && model.points && model.points.length > 1) { + traingle = new JTriangle(model.points[0], model.points[1]); + this.lUpAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: -1, + traingle: traingle + }); + this.lBottomAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: 1, + traingle: traingle + }); + + traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); + this.rUpAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: -1, + traingle: traingle + }); + this.rBottomAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: 1, + traingle: traingle + }); + + this.add(this.lUpAxle); + this.add(this.rUpAxle); + this.add(this.lBottomAxle); + this.add(this.rBottomAxle); + } + } + + /** 创建分隔符*/ + createSeparator() { + let model = this.model; + let theme = this.theme; + let traingle = null; + + if (model && theme && model.points && model.points.length > 1) { + /** 创建左侧分隔符*/ + traingle = new JTriangle(model.points[0], model.points[1]); + this.lPartition = new SectionSeparator({ + theme: theme, + borderBorderShow: model.borderBorderShow, + zlevel: this.zlevel + 2, + traingle: traingle, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + sepType: model.l.sepType, + drict: -1 + }); + + /** 创建右侧分隔符*/ + traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); + this.rPartition = new SectionSeparator({ + theme: theme, + borderBorderShow: model.borderBorderShow, + zlevel: this.zlevel + 2, + traingle: traingle, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + sepType: model.r.sepType, + drict: 1 + }); + + /** 添加视图*/ + this.add(this.lPartition); + this.add(this.rPartition); + } + } + + setInvisible() { + let invisible = this.model.sectionType === '02' && this.model.isShowLogical; + this.eachChild((child) => { + child.attr('invisible', invisible); + }); + } + + recover() { + if (this.section && this.theme) { + this.section.stopAnimation(true); + this.section.setStyle({ + fill: this.theme.backgroundColor, + stroke: this.theme.sectionSpareColor, + lineWidth: this.theme.sectionWidth + }); + + this.release.hide(); + this.speedLimitLeft.hide(); + this.speedLimitRight.hide(); + } + } + + /** 未定义状态*/ + undefine() { + if (this.section && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionUndefinedColor, + lineWidth: this.theme.sectionWidth + }); + } + } + + /** 空闲状态*/ + spare() { + if (this.section && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionSpareColor, + lineWidth: this.theme.sectionWidth + }); + } + } + + /** 通信车占用状态*/ + communicationOccupied() { + if (this.section && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionCommunicationOccupiedColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 非通信车占用状态*/ + unCommunicationOccupied() { + if (this.section && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionUnCommunicationOccupiedColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 进路锁闭*/ + routeLock() { + if (this.section && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionRouteLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 封锁*/ + block() { + if (this.section && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionBlockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 故障锁定状态*/ + faultLock() { + if (this.section && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionFaultLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** atc切除状态*/ + atcExcision() { + if (this.section && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionAtcExcisionColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** ats切除状态*/ + atsExcision() { + if (this.section && this.theme) { + this.atcExcision(); + this.section.animateStyle(true, [ + { time: 1000, styles: { stroke: this.theme.backgroundColor, } }, + { time: 2000, styles: { stroke: this.theme.sectionAtsExcisionColor, lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth } } + ]); + } + } + + /** 保护区段锁闭*/ + protectiveLock() { + if (this.section && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionProtectiveLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + } + } + + /** 延时释放*/ + timeRelease() { + if (this.release && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionRouteLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + this.release.show(); + this.release.setStyle('lineWidth', this.theme.sectionWidth + this.theme.sectionBeyondWidth); + this.release.setStyle('stroke', this.theme.sectionRouteLockColor); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.sectionRouteLockColor }) + .when(2000, { stroke: this.theme.sectionTimeReleaseColor }) + .start(); + } + } + + /** 保护区段延时解锁*/ + protectiveTimeRelease() { + if (this.release && this.theme) { + this.section.setStyle({ + stroke: this.theme.sectionProtectiveLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + this.release.show(); + this.release.setStyle('lineWidth', this.theme.sectionWidth + this.theme.sectionBeyondWidth); + this.release.setStyle('stroke', this.theme.sectionProtectiveLockColor); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.sectionProtectiveLockColor }) + .when(2000, { stroke: this.theme.sectionProtectiveTimeReleaseColor }) + .start(); + } + } + + /** 区段切除*/ + sectionCutOff() { + if (this.release && this.theme) { + let lineWidth = this.theme.sectionWidth + (this.model.status != '01' ? this.theme.sectionBeyondWidth : 0); + this.section.animateStyle(true, [ + { time: 0, styles: { lineWidth: lineWidth } }, + { time: 1000, styles: { stroke: this.theme.backgroundColor, } }, + { time: 2000, styles: { lineWidth: lineWidth } }, + ]); + } + } + + /** 设置限速*/ + setSpeedUpperLimit() { + if (this.section) { + this.speedLimitLeft.show(); + this.speedLimitRight.show(); + } + } + + /** 计轴预复位*/ + axleReset() { + if (this.release) { + this.release.show(); + this.release.setStyle({ + stroke: this.theme.sectionAxleResetColor + }); + } + } + + /** 设置状态*/ + setStatus(model) { + this.recover(); + 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(); + } + } + + + /** 区段切除*/ + if (model.cutOff) { + this.sectionCutOff(); + } + + /** 是否限速*/ + if (model.speedUpperLimit >= 0) { + this.setSpeedUpperLimit(); + } + } + + /** 计算提示位置*/ + getShapeTipPoint() { + let rect = this.getBoundingRect(); + let distance = this.theme.sectionWidth / 2; + if (this.section) { + rect = this.section.getBoundingRect(); + if (this.model.sectionType !== '02' && this.model.nameShow) { + if (this.model.trainPosType == '01') { + distance = distance + this.theme.nameDistance + this.theme.textFontSize; + } + } + } + + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2.7 - distance + }; + } +} diff --git a/src/jmap/components/batong_01/shape/Signal.js b/src/jmap/components/batong_01/shape/Signal.js new file mode 100644 index 000000000..661f4b7b0 --- /dev/null +++ b/src/jmap/components/batong_01/shape/Signal.js @@ -0,0 +1,730 @@ +/* +* 信号机 +*/ +import Line from 'zrender/src/graphic/shape/Line'; +import Text from 'zrender/src/graphic/Text'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import Polyline from 'zrender/src/graphic/shape/Polyline'; +import Arc from 'zrender/src/graphic/shape/Arc'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Group from 'zrender/src/container/Group'; +import { arrows, triangular } from './libs/ShapePoints'; + +class Lamp extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + this.lamp = new Arc({ + name: model.index, + zlevel: this.zlevel + 1, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: model.theme.signalR + }, + style: { + fill: model.theme.signalLampGrayColor, + lineWidth: 0, + stroke: model.theme.signalLampStandardColor + } + }); + + let shapeDate; + if (model.highType === '01') { + // 矮柱 + if (model.drict != 1) { + // 左侧 + shapeDate = { + x: model.origin.x + model.drict * model.lampCount * 2 * model.theme.signalR - 2.5, + y: model.origin.y + model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } else { + shapeDate = { + x: model.origin.x - model.drict + 1.5, + y: model.origin.y - model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } + } else { + // 高柱 + if (model.drict != 1) { + // 左侧 + shapeDate = { + x: model.origin.x + model.drict * model.lampCount * 2 * model.theme.signalR - 2.5 - 3, + y: model.origin.y + model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } else { + shapeDate = { + x: model.origin.x - model.drict + 1.5 + 3, + y: model.origin.y - model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } + } + + this.lampRect = new Rect({ + zlevel: this.zlevel - 1, + z: this.z, + shape: shapeDate, + style: { + lineWidth: 0.4, + stroke: 'red', + } + }); + + this.lstop = new Line({ + zlevel: this.zlevel + 1, + z: this.z, + origin: model.origin, + rotation: -Math.PI / 180 * model.rotate, + shape: { + x1: model.position.x + (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y1: model.position.y + (model.theme.signalR + 1) * Math.sin(Math.PI / 4), + x2: model.position.x - (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y2: model.position.y - (model.theme.signalR + 1) * Math.sin(Math.PI / 4) + }, + style: { + lineWidth: 1, + stroke: model.theme.backgroundColor, + } + }); + + this.rstop = new Line({ + zlevel: this.zlevel + 1, + z: this.z, + origin: model.origin, + rotation: -Math.PI / 180 * model.rotate, + shape: { + x1: model.position.x + (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y1: model.position.y + (model.theme.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)), + x2: model.position.x - (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y2: model.position.y - (model.theme.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)) + }, + style: { + lineWidth: 1, + stroke: model.theme.backgroundColor, + } + }); + this.add(this.lamp); + } + + setColor(color) { + if (color) { + this.lamp.setStyle('fill', color); + } + } + + // 两条交叉黑线 + setStop(has) { + if (has) { + this.add(this.lstop); + this.add(this.rstop); + } else { + this.remove(this.lstop); + this.remove(this.rstop); + } + } + + // 功能封锁矩形框 + setRectBlock(has) { + if (has) { + this.lampRect.attrKV('rotation', -Math.PI / 180 * this.model.rotate); + this.lampRect.attrKV('origin', [this.model.origin.x, this.model.origin.y]); + this.add(this.lampRect); + } else { + this.remove(this.lampRect); + } + } +} + +// 自动进路箭头 +class AutoSig extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + let rotation = Math.PI; + if (model.drict != 1) { + // 右侧 + rotation = 0; + } + + let x = model.position.x - model.drict * (model.lampCount * model.theme.signalR + 1) * 2; + let y = model.position.y - model.theme.signalR / 2; + // 箭头 + this.arrowsControl = new Polygon({ + zlevel: this.zlevel, + rotation: rotation, + origin: [x, y], + shape: { + points: arrows(x, y, model.theme.stationControlDistance / 8, model.theme.signalR * 1.3) + }, + style: { + stroke: model.theme.sidelineColor, + lineWidth: 0.6, + fill: model.theme.signalLampGreenColor + } + }); + this.add(this.arrowsControl); + } + + // 停止动画 + animationRecover() { + this.arrowsControl.stopAnimation(false); + } + + // 箭头颜色 + setColor(color) { + if (color) { + this.arrowsControl.setStyle('fill', color); + } + } + + // 箭头闪烁 + arrowsAnimation() { + let fill = this.arrowsControl.style.fill; + let theme = this.model.theme; + this.arrowsControl.animate('style', true) + .when(1000, { fill: theme.backgroundColor, stroke: theme.backgroundColor }) + .when(2000, { fill: fill, stroke: theme.sidelineColor }) + .when(3000, { fill: theme.backgroundColor, stroke: theme.backgroundColor }) + .when(4000, { fill: fill, stroke: theme.sidelineColor }) + .start(); + } +} + +// 运行方向三角 +class JSigDrict extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + this.sigDrict = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: triangular(model.position.x, model.position.y + model.drict * model.theme.signalR * 0.8, model.drict, model.theme.signalR) + }, + style: { + stroke: model.theme.backgroundColor, + lineWidth: 0.5, + fill: model.theme.signalLampYellowColor + } + }); + this.add(this.sigDrict); + } +} + +// 信号灯 几灯、高柱等 +class JSiglamp extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this.lamps = new Group(); + this._subType = 'SignalLamp'; + this._val = '3'; /** 信号机*/ + this._create(model); + } + + _create(model) { + this.text = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x + model.namePosition.x, + y: model.position.y + model.posit * (model.theme.signalR + model.namePosition.y), + text: model.name, + textAlign: 'middle', + textVerticalAlign: model.posit === 1 ? 'top' : 'bottom', + textFont: model.theme.textFontSize + 'px ' + model.theme.textFontFormat, + textFill: model.theme.singaltextFontColor, + textBorderColor: model.theme.signalBlockColor, + textBorderWidth: 0 + } + }); + + this.ver = new Polyline({ + zlevel: this.zlevel - 2, + z: this.z, + shape: { + points: [ + [model.position.x, model.position.y + model.theme.signalR * 3 / 2], + [model.position.x, model.position.y - model.theme.signalR * 3 / 2] + ] + }, + style: { + lineWidth: model.theme.sectionWidth / 3, + stroke: model.theme.signalLampStandardColor + } + }); + + this.hor = new Polyline({ + zlevel: this.zlevel - 1, + z: this.z, + shape: { + points: [ + [model.position.x, model.position.y], + [model.position.x + model.drict * model.theme.signalR * 3 / 2, model.position.y] + ] + }, + style: { + lineWidth: model.theme.sectionWidth / 3, + stroke: model.theme.signalLampStandardColor + } + }); + + this.add(this.lamps); + this.setShowName(model.isShowName); + this.setShowHighSigType(model.highType); + + //旋转 + if (model.rotate) { + this.transformRotation(this.ver); + this.transformRotation(this.hor); + } + } + + setShowName(isShow) { + if (isShow) this.add(this.text); else this.remove(this.text); + } + + // 显示信号灯名称边框 + setNameBorder(width) { + this.text.setStyle('textBorderWidth', width); + } + + // 显示信号灯名称颜色 + setNameColor(color) { + this.text.setStyle('textFill', color); + } + + setShowHighSigType(type) { + this.lamps.removeAll(); + let model = this.model; + this.add(this.ver); + if (type === '01') this.remove(this.hor); else this.add(this.hor); + let highPosition = this.getEndPosition(model.highType); + for (let i = 0; i < model.lampCount; i++) { + let lamp = new Lamp({ + theme: model.theme, + zlevel: this.zlevel, + lampCount: model.lampCount, + position: { + x: highPosition.x + i * model.drict * model.theme.signalR * 2, + y: highPosition.y + }, + index: i + 1, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + drict: model.drict, + highType: model.highType, + }); + this.lamps.add(lamp); + } + + this.sigDriction = new JSigDrict({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: model.position.x - model.drict * model.theme.signalR / 4, + y: model.position.y + }, + drict: model.drict, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + }); + + this.autoSig = new AutoSig({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: highPosition.x, + y: highPosition.y + }, + lampCount: model.lampCount, + drict: model.drict, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + }); + + //旋转 + if (model.rotate) { + this.transformRotation(this.sigDriction); + this.transformRotation(this.autoSig); + this.transformRotation(this.lamps); + } + } + + // 整体旋转信号灯 + transformRotation(item) { + if (this.model.rotate) { + let origin = [this.model.position.x, this.model.position.y]; + let rotation = -Math.PI / 180 * Number(this.model.rotate); + item.origin = origin; + item.rotation = rotation; + item.dirty(); + } + } + + setColorByIndex(index, color) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setColor(color); + return; + } + } + } + + setStopByIndex(index, has) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setStop(has); + return; + } + } + } + + setRectBlockByIndex(index, has) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setRectBlock(has); + return; + } + } + } + + setAnimation() { + this.autoSig.arrowsAnimation(); + } + + setRecover() { + this.autoSig.animationRecover(); + } + + setColorSig(color) { + this.autoSig.setColor(color); + } + + getEndPosition(type) { + if (type === '01') { + return { + x: this.model.position.x + this.model.drict * this.model.theme.signalR * 3 / 2, + y: this.model.position.y + }; + } else { + return { + x: this.hor.shape.points[1][0] + this.model.drict * this.model.theme.signalR, + y: this.hor.shape.points[1][1] + }; + } + } + + setShowSigDrict(showSigDrict) { + if (showSigDrict) this.add(this.sigDriction); else this.remove(this.sigDriction); + } + + setAutoSig(isShow) { + if (isShow) this.add(this.autoSig); else this.remove(this.autoSig); + } + + getShapeTipPoint() { + if (this.lamps) { + this.lamps.dirty(); + let x1 = this.model.drict * (this.model.theme.signalR * 2.5); + let y1 = this.model.drict * (this.model.theme.signalR * 1.2); + let model = { + x: this.model.position.x + x1 * Math.cos(Number(this.model.rotate)) - y1 * Math.sin(Number(this.model.rotate)), + y: this.model.position.y + x1 * Math.sin(Number(this.model.rotate)) + y1 * Math.cos(Number(this.model.rotate)) + }; + + return model; + } + return null; + } +} + +export default class Signal extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.lampCount = parseInt(model.lampPositionType); + this._create(model, theme); + } + + _create(model, theme) { + var drict = model.directionType === '01' ? -1 : 1; + var posit = model.positionType === '01' ? -1 : 1; + // 信号灯文字说明 + this.siglamp = new JSiglamp({ + theme: theme, + zlevel: this.zlevel, + position: { + x: model.position.x, + y: model.position.y + posit * theme.signalDistance + }, + drict: drict, + posit: posit, + name: model.name, + namePosition: model.namePosition, + isShowName: model.nameShow, + highType: model.lampPostType, + lampCount: parseInt(model.lampPositionType), + showSigDrict: this.showSigDrict, + pop: true, + rotate: model.rotate, + }); + this.add(this.siglamp); + + this.setShowButton(model); + this.setButtonStatus(model); + this.setStatus(model); + } + + setShowSigDrict(isShow) { + this.siglamp.setShowSigDrict(isShow); + } + + setAutoSig(isShow) { + this.siglamp.setAutoSig(isShow); + } + + setShowHighSigType(hightp) { + if (this.siglamp) { + this.highType = hightp; + this.siglamp.setShowHighSigType(hightp); + } + } + + setShowButton(model) { + if (model.buttonShow) { + this.add(this.sigButton); + } else { + this.remove(this.sigButton); + } + } + + setButtonStatus(model) { + if (this.sigButton) { + this.sigButton.setButtonStatus(model.buttonStatus); + } + } + + isPop(e) { + for (var i = 0; i < this.childCount(); i++) { + let rect = this.childAt(i).getBoundingRect(); + if (rect.contain(e.offsetX, e.offsetY) && this.childAt(i).pop) { + return true; + } + } + } + + //关闭 (红灯-缺省值) + close() { + if (this.lampCount === 2 && this.model.lightType === '01') { /** 双灯 物理点灯 */ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampGrayColor); + } else if (this.lampCount === 2 && this.model.lightType === '02') { /** 双灯 逻辑点灯*/ + this.siglamp.setStopByIndex(1, true); + this.siglamp.setStopByIndex(2, true); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampGrayColor); + } else if (this.lampCount === 1 && this.model.lightType === '01') { /** 单灯 物理点灯 */ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + } else if (this.lampCount === 1 && this.model.lightType === '02') { /** 单灯 逻辑点灯*/ + this.siglamp.setStopByIndex(1, true); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + } + } + + //开放 + open() { + if (this.lampCount === 2 && this.model.lightType === '01' && this.model.switchLocateType === '01') { /** 双灯 物理点灯 道岔定位*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampGreenColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampGrayColor); + } else if (this.lampCount === 2 && this.model.lightType === '02' && this.model.switchLocateType === '01') { /** 双灯 逻辑点灯 道岔定位*/ + this.siglamp.setStopByIndex(1, true); + this.siglamp.setStopByIndex(2, true); + this.siglamp.setColorByIndex(1, this.theme.signalLampGreenColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampGrayColor); + } else if (this.lampCount === 2 && this.model.lightType === '01' && this.model.switchLocateType === '02') { /** 双灯 物理点灯 道岔反位*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampGrayColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampYellowColor); + } else if (this.lampCount === 2 && this.model.lightType === '02' && this.model.switchLocateType === '02') { /** 双灯 逻辑点灯 道岔反位*/ + this.siglamp.setStopByIndex(1, true); + this.siglamp.setStopByIndex(2, true); + this.siglamp.setColorByIndex(1, this.theme.signalLampGrayColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampYellowColor); + } else if (this.lampCount === 1 && this.model.lightType === '01' && this.model.switchLocateType === '02') { /** 单灯 物理点灯 允许调车*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampWhiteColor); + } + } + + //引导 + guid() { + if (this.lampCount === 2 && this.model.lightType === '01') { /** 双灯 物理点灯 允许引导信号*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampYellowColor); + } + } + + //封锁 + block() { + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setNameBorder(1); + } + + //功能封锁 + functionBlock() { + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setRectBlockByIndex(1, true); + } + + //信号保护区段监视状态显示 + signalblock() { + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setNameColor(this.theme.signalLampGreenColor); + } + + //故障 + fault() { + if (this.lampCount === 2 && this.model.lightType === '01') { /** 双灯 物理点灯*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampBlueColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampBlueColor); + } + } + + //设置自动进路模式状态类型 + setAutoRouteOpen() { + if (this.model.linkageAutoRouteShow) { + this.siglamp.setAutoSig(true); + } else { + this.siglamp.setAutoSig(false); + } + + this.siglamp.setRecover(); + this.siglamp.setColorSig(this.theme.signalLampGreenColor); + } + + //信号机进路自动触发模式状态类型 + setAutoAccessOpen() { + if (this.model.atsAutoTriggerShow) { + this.siglamp.setAutoSig(true); + } else { + this.siglamp.setAutoSig(false); + } + + this.siglamp.setRecover(); + this.siglamp.setColorSig(this.theme.signalLampYellowColor); + } + + //设置自动信号模式状态类型 + setAutoSignalOpen() { + this.siglamp.setShowSigDrict(true); + } + + //隐藏自动信号和自动进路 + setAutoClose() { + this.siglamp.setColorSig(this.theme.signalLampGrayColor); + this.siglamp.setAutoSig(false); + this.siglamp.setShowSigDrict(false); + } + + //自动信号和自动进路开始动画 + setAutoFlicker() { + this.siglamp.setAnimation(); + } + + //恢复状态 + recover() { + this.siglamp.setNameBorder(0); + this.siglamp.setRecover(); + } + + setStatus(model) { + this.recover(); + /** 设置状态 (点灯类型)*/ + switch (model.status) { + case '01': { this.close(); } break; //关闭 + case '02': { this.open(); } break; //开放 + case '03': { this.guid(); } break; //引导 + case '04': { this.block(); } break; //封锁 + case '05': { this.fault(); } break; //故障 + case '06': { this.block(); } break; //功能封锁 + case '07': { this.signalblock(); } break; //信号保护区段检测 + } + + /** 设置自动类型*/ + switch (model.autoType) { + case '01': { this.setAutoClose(); } break; // 隐藏 隐藏自动信号和自动进路 + case '02': { this.setAutoSignalOpen(); } break; // 显示 设置自动信号模式状态类型 + case '03': { this.setAutoRouteOpen(); } break; // 显示 设置自动进路模式状态类型 + case '04': { this.setAutoAccessOpen(); } break; // 显示 信号机进路自动触发模式状态类型 + } + + /** 信号机进路办理,先停止动画,再判断当前颜色是否闪烁*/ + if (model.routeSetting && (model.autoType == '03' || model.autoType == '04')) { + this.setAutoFlicker(); + } + } + + getShapeTipPoint(val) { + if (val === '1' || val === '2') { + return this.sigButton.getShapeTipPoint(val); + } else { + return this.siglamp.getShapeTipPoint(val); + } + } + +} + diff --git a/src/jmap/components/batong_01/shape/Station.js b/src/jmap/components/batong_01/shape/Station.js new file mode 100644 index 000000000..af387460b --- /dev/null +++ b/src/jmap/components/batong_01/shape/Station.js @@ -0,0 +1,71 @@ +/* +* 车站 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; + +export default class Station extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + if (model.visible) { + this.mileageText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.point.x, + y: model.point.y - 15, + text: model.kmPost, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.kmPostFont || '8px ' + theme.textFontFormat, + textFill: model.kmPostColor + } + }); + this.stationText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.point.x, + y: model.point.y, + text: model.name, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.nameFont || '14px ' + theme.textFontFormat, + textFill: model.nameColor + } + }); + this.add(this.mileageText); + this.add(this.stationText); + this.setShowMileageText(model.kmPostShow); + this.setStatus(model); + } + } + + setShowMileageText(show) { + if (show) { + this.mileageText.show(); + } else { + this.mileageText.hide(); + } + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } + + getShapeTipPoint() { + return null; + } +} diff --git a/src/jmap/components/batong_01/shape/StationControl.js b/src/jmap/components/batong_01/shape/StationControl.js new file mode 100644 index 000000000..0d045f383 --- /dev/null +++ b/src/jmap/components/batong_01/shape/StationControl.js @@ -0,0 +1,193 @@ +/* +* 控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +import Text from 'zrender/src/graphic/Text'; +// import Polygon from 'zrender/src/graphic/shape/Polygon'; +import Group from 'zrender/src/container/Group'; +// import { arrows } from './libs/ShapePoints'; + +// 控制(单灯) +class SingleControl extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 20; + this._create(model); + } + + _create(model) { + var _subType = 'ControlSignal'; + var _val = '0'; + if (model.pop) { + _subType = 'ControlButton'; + _val = '1'; + } + this.control = new Arc({ + pop: model.pop, + _subType: _subType, + _val: _val, + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.point.x, + cy: model.point.y, + r: model.theme.stationControlmodeR + }, + style: { + lineWidth: 0, + fill: model.theme.stationControlGrayColor, + stroke: model.theme.sidelineColor + } + }); + + 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.theme.stationControlmodeR - model.theme.nameDistance - 10, + text: model.context, + textFill: model.theme.textFontColor, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.theme.stationControlTextSize + 'px ' + model.theme.textFontFormat + } + }); + + this.add(this.control); + this.add(this.text); + this.setNameShow(this.model.nameShow); + } + + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + + setTextColor(color) { + if (color) { + this.text.setStyle('textFill', color); + } + } + + setNameShow(show) { + if (show) { + this.text.show(); + } else { + this.text.hide(); + } + } +} + +export default class StationControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 20; + this.model = model; + this.theme = theme; + this._create(model); + } + + _create(model) { + // 总报警 + this.generalAlarmControl = new SingleControl({ + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x - this.theme.stationControlDistance, + y: model.position.y + }, + context: model.zbjkContent, + nameShow: model.indicatorShow, + pop: false + }); + + // 中控 + this.centerControl = new SingleControl({ + theme: this.theme, + zlevel: this.zlevel, + point: { + // x: model.position.x - this.theme.stationControlDistance / 2, + x: model.position.x, + y: model.position.y + }, + context: model.zokContent, + nameShow: model.indicatorShow, + pop: false + }); + + // 站控 + this.substationControl = new SingleControl({ + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x + this.theme.stationControlDistance, + y: model.position.y + }, + context: model.zakContent, + nameShow: model.indicatorShow, + pop: false + }); + + this.add(this.centerControl); + this.add(this.substationControl); + this.add(this.generalAlarmControl); + this.setStatus(model); + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + this.substationControl.setControlColor(this.theme.stationControlGrayColor); + this.centerControl.setControlColor(this.theme.stationControlGrayColor); + this.generalAlarmControl.setControlColor(this.theme.stationControlGrayColor); + } break; + case '01': { //中控(缺省值) + this.substationControl.setControlColor(this.theme.stationControlGrayColor); + this.centerControl.setControlColor(this.theme.stationControlGreenColor); + this.generalAlarmControl.setControlColor(this.theme.stationControlGrayColor); + } break; + case '02': { //站控且允许转为中控 + this.substationControl.setControlColor(this.theme.stationControlYellowColor); + this.centerControl.setControlColor(this.theme.stationControlGrayColor); + this.generalAlarmControl.setControlColor(this.theme.stationControlGrayColor); + } break; + case '03': { //站控且不允许转为中控 + this.substationControl.setControlColor(this.theme.stationControlYellowColor); + this.centerControl.setControlColor(this.theme.stationControlGrayColor); + this.generalAlarmControl.setControlColor(this.theme.stationControlGrayColor); + } 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; + } + } + } + + 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/components/batong_01/shape/StationCounter.js b/src/jmap/components/batong_01/shape/StationCounter.js new file mode 100644 index 000000000..759b582a4 --- /dev/null +++ b/src/jmap/components/batong_01/shape/StationCounter.js @@ -0,0 +1,85 @@ +/* +* 计数器 +*/ +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, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 30; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + this.counter = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y, + text: model.val, + textFill: theme.stationCounterTextColor, + textAlign: 'middle', + textStrokeWidth: 1, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + } + }); + + 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: theme.stationCounterBorderColor + } + }); + + 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 + theme.textFontSize + theme.nameDistance, + text: model.name, + textFill: theme.stationCounterTextColor, + textAlign: 'middle', + textVerticalAlign: 'top', + textStrokeWidth: 1, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + } + }); + this.add(this.counterName); + this.add(this.table); + this.add(this.counter); + this.setStatus(model); + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } + + getShapeTipPoint() { + return null; + } +} + diff --git a/src/jmap/components/batong_01/shape/StationDelayUnlock.js b/src/jmap/components/batong_01/shape/StationDelayUnlock.js new file mode 100644 index 000000000..c931401f6 --- /dev/null +++ b/src/jmap/components/batong_01/shape/StationDelayUnlock.js @@ -0,0 +1,121 @@ +/* +* 延迟解锁 +*/ +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, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = 1; + this._create(model, theme); + } + + _create(model, theme) { + this.text = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y, + text: model.deviceName + ' ', + textFill: theme.stationDelayUnlockTextColor, + textStrokeWidth: 1, + textFont: model.textFont + 'px ' + theme.textFontFormat, + textAlign: 'left' + } + }); + + let fontSize = parseInt(model.textFont.split(' ')[0]) || 30; + this.time = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + fontSize + theme.stationDelayUnlockDistance, + text: model.remainTime || '', + textFill: theme.stationDelayUnlockTextColor, + textStrokeWidth: 1, + textFont: model.textFont + 'px ' + theme.textFontFormat, + 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 - 1, + z: this.z, + 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: theme.stationDelayUnlockBorderColor, + fill: theme.backgroundColor + } + }); + this.add(this.table); + + this.setStatus(model); + } + + /** 延时解锁关闭*/ + delayClose() { + this.time.setStyle('text', ''); + this.text.setStyle('text', ''); + this.table.setStyle('stroke', this.theme.backgroundColor); + } + + /** 延时解锁计数*/ + delayUnlock() { + this.table.setStyle('stroke', 'white'); + this.time.setStyle('text', '' + this.model.remainTime); + } + + // animation() { + // this.table.setStyle('stroke', 'white'); + // this.time.setStyle('text', '' + this.model.delayTime); + + // this.counter = this.model.delayTime; + // this.timer = setInterval(() => { + // if (this.counter <= 0) { + // this.counter = ''; + // clearInterval(this.timer); + // this.timer = null; + // this.close(); + // } else { + // this.counter -= 1; + // } + // this.time.setStyle('text', '' + this.counter); + // }, 1000); + + // } + + setStatus(model) { + switch (model.status) { + case '01': { this.delayClose(); } break; //关闭 + case '02': { this.delayUnlock(); } break; //延迟解锁 + } + } + + getShapeTipPoint() { + return null; + } +} diff --git a/src/jmap/components/batong_01/shape/StationStand.js b/src/jmap/components/batong_01/shape/StationStand.js new file mode 100644 index 000000000..86b35a3ad --- /dev/null +++ b/src/jmap/components/batong_01/shape/StationStand.js @@ -0,0 +1,480 @@ +/* +* 站台 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Isogon from 'zrender/src/graphic/shape/Isogon'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import { flashlight } from './libs/ShapePoints'; + +export default class StationStand extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + this.stationStand = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x - model.width / 2, + y: 0, + width: model.width, + height: model.height + }, + style: { + lineWidth: 0, + stroke: this.theme.sidelineColor, + fill: this.theme.stationStandSpareColor + } + }); + + /** 站台折返策略*/ + let beyond = 4; + let height = 5; + let width = 10; + let offsetx = (model.width - width / 2); + let offsety = (model.height + height + this.theme.stationStandDistance) / 2; + let drict = model.doorLocationType == '01' ? 1 : -1; + + this.reentry = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: flashlight(model.position.x, model.position.y, drict, width, height, offsetx, offsety, beyond) + }, + style: { + lineWidth: 0, + fill: this.theme.stationStandNoHumanReentryColor + } + }); + this.add(this.reentry); + + /** 站台扣车*/ + let distance = 0; + this.text = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: [0, 0], + style: { + x: model.position.x - ((model.width + theme.stationStandHeadFontSize) / 2 + distance), + y: 0, + text: 'H', + textAlign: 'middle', + textVerticalAlign: 'top', + fontSize: theme.stationStandHeadFontSize + 'px ' + theme.textFontFormat, + textFill: theme.stationStandCenterDetainTrainColor, + textStroke: theme.backgroundColor, + } + }); + this.add(this.text); + + let textLevelT = [0, 12]; + if (model.doorLocationType == '01') { + textLevelT = [0, -3]; + } + // 停站时间 + this.time = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: textLevelT, + style: { + x: model.position.x + (model.width / 2 + theme.textFontSize + distance), + y: 0, + text: model.parkingTime, + textFill: theme.stationStandTimeTextColor, + textAlign: 'middle', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat + } + }); + this.add(this.time); + + let textLevelP = [0, 1]; + if (model.doorLocationType == '01') { + textLevelP = [0, 20]; + } + // 区间运行时间 + this.level = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: textLevelP, + style: { + x: model.position.x + (model.width / 2 + theme.textFontSize + distance), + y: model.position.y, + text: model.intervalRunTime, + textFill: theme.stationStandTimeTextColor, + textAlign: 'middle', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat + } + }); + this.add(this.level); + + /** 站台紧急关闭*/ + this.emergent = new Isogon({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x, + y: 0, + r: theme.stationStandDistance / 2, + n: 4, + }, + style: { + lineWidth: 0, + stroke: theme.stationStandEmergentCloseColor, + fill: theme.stationStandEmergentCloseColor + } + }); + this.add(this.emergent); + + /** 屏蔽门*/ + let padding = 1; + let safeHeight = 4; + // let safeR = [theme.stationStandDistance, theme.stationStandDistance]; + this.safeDoorL = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + // r: safeR, + x: model.position.x - model.width / 2 - padding, + y: model.position.y, + width: model.width / 3 + padding, + height: safeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.safeDoorC = new Rect({ + zlevel: this.zlevel, + z: this.z + 1, + shape: { + x: model.position.x - model.width / 6 - padding, + y: model.position.y, + width: model.width / 3 + padding * 2, + height: safeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.safeDoorR = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + // r: safeR, + x: model.position.x + model.width / 6, + y: model.position.y, + width: model.width / 3 + padding, + height: safeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.setDrict(model.doorLocationType); + this.setHasSafeDoor(model.hasDoor); + this.setVisible(model.visible); + this.setStatus(model); + } + + setDrict(doorLocationType) { + let model = this.model; + let theme = this.theme; + if (doorLocationType === '01') { + let distance = model.position.y + theme.stationStandDistance * 3 / 2; + this.text.setStyle('y', distance + model.height / 2 - theme.stationStandHeadFontSize / 2); + this.time.setStyle('y', distance + model.height - theme.textFontSize); + this.level.setStyle('y', distance - model.height + theme.textFontSize / 1.2); + this.emergent.setShape('y', distance - theme.stationStandDistance / 2); + this.stationStand.setShape('y', distance); + } else { + let distance = model.position.y - theme.stationStandDistance; + this.text.setStyle('y', distance - model.height / 2 - theme.stationStandHeadFontSize / 2); + this.time.setStyle('y', distance - model.height + theme.textFontSize); + this.level.setStyle('y', distance - model.height - theme.textFontSize / 2); + this.emergent.setShape('y', distance + theme.stationStandDistance / 2); + this.stationStand.setShape('y', distance - model.height); + } + this.add(this.stationStand); + } + + setHasSafeDoor(hasDoor) { + if (hasDoor) { + this.add(this.safeDoorL); + this.add(this.safeDoorC); + this.add(this.safeDoorR); + } else { + this.remove(this.safeDoorL); + this.remove(this.safeDoorC); + this.remove(this.safeDoorR); + } + } + + setVisible(visible) { + if (visible) { + this.eachChild((it) => { + it.show(); + }); + } else { + this.eachChild((it) => { + it.hide(); + }); + } + } + + //恢复初始状态 + recover() { + this.time.hide(); + this.level.hide(); + this.text.hide(); + this.emergent.hide(); + this.reentry.hide(); + if (this.model.visible) { this.safeDoorC.show(); } + this.safeDoorL.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandDoorDefaultColor); + } + + //空闲 + spare() { + this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + } + + //列车停站 + stop() { + this.stationStand.setStyle('fill', this.theme.stationStandStopColor); + } + + //指定列车跳站 + designatedJumpStop() { + this.stationStand.setStyle('fill', this.theme.stationStandDesignatedJumpStopColor); + } + + //站台紧急关闭 + emergentClose() { + this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.emergent.show(); + } + + //未设置跳停 + unJumpStop() { + } + + //站台跳停 + jumpStop() { + this.stationStand.setStyle('fill', this.theme.stationStandJumpStopColor); + } + + //未设置扣车 + unDetainTrain() { + this.text.hide(); + } + + //车站扣车 + standDetainTrain() { + // this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.text.show(); + this.text.setStyle('textFill', this.theme.stationstandDetainTrainTextColor); + } + + //中心扣车 + centerDetainTrain() { + // this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.text.show(); + this.text.setStyle('textFill', '#fff'); + } + + //中心+车站扣车 + standAndCenterDetainTrain() { + // this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.text.show(); + } + + //人工设置停战时间 + setManuallyArmisticeTime(val) { + this.time.show(); + this.time.attr({ + style: { + text: val + }, + }); + } + + //人工设置运行等级 + setManuallyOperationLevel(val) { + // this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.level.show(); + this.level.attr({ + style: { + text: val + }, + }); + } + + //开门 + openDoor() { + this.safeDoorC.hide(); + } + + //关门 + closeDoor() { + if (this.model.visible) { this.safeDoorC.show(); } + } + + //屏蔽门正常 + doorNormal() { + this.safeDoorL.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandDoorDefaultColor); + } + + //屏蔽门故障 + doorFault() { + this.safeDoorL.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandSplitDoorColor); + } + + //屏蔽门切除 + doorSplit() { + this.safeDoorL.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandSplitDoorColor); + } + + //无折返(默认) + noReentry() { + this.reentry.hide(); + } + + //无人折返 + noHumanReentry() { + this.reentry.show(); + this.reentry.setStyle('fill', this.theme.stationStandNoHumanReentryColor); + } + //自动换端 + autoChangeEnds() { + this.reentry.show(); + this.reentry.setStyle('fill', this.theme.stationStandAutoChangeEndsColor); + } + + setStatus(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(); + } + } + } + + /** 设置扣车*/ + 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; + } + } + + getShapeTipPoint() { + let rect = this.stationStand.getBoundingRect(); + if (rect) { + return { + x: rect.x + rect.width / 2, + y: rect.y + }; + } + return null; + } +} diff --git a/src/jmap/components/batong_01/shape/Switch.js b/src/jmap/components/batong_01/shape/Switch.js new file mode 100644 index 000000000..ab8ec5ab7 --- /dev/null +++ b/src/jmap/components/batong_01/shape/Switch.js @@ -0,0 +1,525 @@ +/* +* 道岔 +*/ +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Line from 'zrender/src/graphic/shape/Line'; +import Group from 'zrender/src/container/Group'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import JTriangle from '@/jlmap/util/JTriangle'; + +export default class Switch extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.intersection = model.intersection; + this.zlevel = model.zlevel; + this.z = 8; + this.model = model; + this.theme = theme; + this._create(model); + } + + _create(model) { + this.triangle = new JTriangle(model.intersection, model.skew); + this.createSwitch(); + this.createNameText(); + this.setStatus(model); + } + + /** 道岔实体,不显示,响应鼠标事件*/ + createSwitch() { + let model = this.model; + let theme = this.theme; + + var halfWidth = theme.sectionWidth / 2 + 0.2; //一般宽度 + var switchWidth = theme.sectionWidth + theme.sectionBeyondWidth + theme.sectionBeyondWidth + 0.8; // 道岔宽度,增大遮挡宽度 + var swPadding = theme.switchLen; //定位和反位时区段距离岔芯的距离 + var directx = this.triangle.drictx; + var directy = this.triangle.dricty; + var direct = -this.triangle.drictx * this.triangle.dricty; + var coverLength = switchWidth * 1.4; + + // 道岔遮挡 + var line = new Line({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: { + x1: model.intersection.x - coverLength, + y1: model.intersection.y, + x2: model.intersection.x + coverLength, + y2: model.intersection.y + }, + style: { + lineWidth: switchWidth, + stroke: theme.backgroundColor + } + }); + var skewLine = new Line({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: { + x1: model.intersection.x, + y1: model.intersection.y, + x2: model.intersection.x + directx * this.triangle.GetCotRate() * coverLength, + y2: model.intersection.y + directy * coverLength, + }, + style: { + lineWidth: switchWidth, + stroke: theme.backgroundColor + } + }); + this.switchView = new Group(); + this.switchView.add(line); + this.switchView.add(skewLine); + + // 定位遮挡 + halfWidth += 0.6; // 0.3 + var point1 = [model.intersection.x - directx * halfWidth, model.intersection.y + directy * halfWidth]; + var point2 = [point1[0] + directx * switchWidth / this.triangle.GetSinRate(), point1[1]]; + var point3 = [point2[0] + directx * this.triangle.GetCotRate() * swPadding, point2[1] + directy * swPadding]; + var point4 = [point3[0] + direct * this.triangle.GetSin(switchWidth), point3[1] - direct * this.triangle.GetCos(switchWidth)]; + + this.locShelter = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + point1, point2, point3, point4 + ] + }, + style: { + fill: theme.backgroundColor + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + var lpx = Math.abs(this.triangle.GetCos(1)); + this.locShelter.position = [directx * lpx, -directy * 0.2]; + this.locShelter.show(); + + // 反位遮挡 + var slen = switchWidth / this.triangle.GetSinRate(); // 斜切长度 + var rpoint1 = [model.intersection.x + directx * halfWidth, model.intersection.y - directy * halfWidth]; + var rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.GetCotRate()), rpoint1[1]]; + var rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth]; + var rpoint4 = [rpoint1[0] + this.triangle.GetCos(slen), rpoint1[1] + this.triangle.GetSin(slen)]; + this.relocShelter = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + rpoint1, rpoint2, rpoint3, rpoint4 + ] + }, + style: { + fill: theme.backgroundColor + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + var rpx = Math.abs(this.triangle.GetCos(halfWidth)) + 0.2; + this.relocShelter.position = [-directx * rpx, -directy * 0.2]; + this.relocShelter.hide(); + + // 岔芯红框 + this.forkCore = new Rect({ + zlevel: this.zlevel, + z: this.z + 2, + shape: { + x: model.intersection.x - theme.switchLen, + y: model.intersection.y - theme.switchLen, + width: theme.switchLen * 2, + height: theme.switchLen * 2 + }, + style: { + lineWidth: 0.4, + stroke: theme.switchTextBorderColor, + fill: theme.transparentColor, + lineDash: [5, 1] + } + }); + + // 反位/平行四边形 遮挡 + var sinX = theme.sectionWidth / this.triangle.GetSinRate(); + var switchWidth1 = theme.sectionWidth / 2; + var width1 = switchWidth1 * this.triangle.GetSinRate(); + var height1 = switchWidth1 * this.triangle.GetCosRate(); + var width2 = (height1 + switchWidth1) / this.triangle.GetTanRate(); + var width3 = sinX - width2 - width1; + var switchPoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1]; + var switchPoint2 = [switchPoint1[0] - directx * (width2 + width1) - directx * width3, switchPoint1[1]]; + var switchPoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1]; + var switchPoint4 = [switchPoint1[0] + directx * (width2 + width1) - directx * width3, switchPoint3[1]]; + this.reserveSection = new Polygon({ + zlevel: this.zlevel, + shape: { + points: [ + switchPoint1, switchPoint2, switchPoint3, switchPoint4 + ] + }, + style: { + fill: theme.sectionSpareColor, + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + this.reserveSection.hide(); + + // 失去 + this.release = new Line({ + zlevel: this.zlevel, + z: this.z + 2, + 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: theme.sectionWidth, + stroke: theme.sectionTimeReleaseColor, + } + }); + 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: theme.sectionWidth + theme.sectionBeyondWidth + 0.5, + stroke: theme.backgroundColor, + } + }); + + // 添加 + this.add(this.switchView); + this.add(this.locShelter); + this.add(this.relocShelter); + this.add(this.reserveSection); + this.add(this.forkCore); + this.add(this.release); + this.add(this.releaseBackground); + } + + /** 道岔名称,显示,响应鼠标事件*/ + createNameText() { + let model = this.model; + let theme = this.theme; + + // 道岔名称详情 + this.arrowText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.intersection.x + 10, + y: model.intersection.y + 15, + text: `道岔区段名称: ${model.sectionName}`, + textFill: '#000', + textAlign: 'letf', + textFont: 10 + 'px consolas', + textPadding: 3, + textBackgroundColor: theme.tipBackgroundColor, + } + }); + this.arrowText.hide(); + this.add(this.arrowText); + + //创建道岔名称 + this.nameText = new Text({ + zlevel: this.zlevel, + z: this.z + 3, + silent: false, + style: { + x: model.namePoint.x + model.intersection.x + this.triangle.drictx * (theme.sectionWidth * 3 + theme.nameDistance) * this.triangle.GetCotRate(), + y: model.namePoint.y + model.intersection.y + this.triangle.dricty * (theme.nameDistance), + text: model.name, + textAlign: this.triangle.drictx === 1 ? 'left' : 'right', + textVerticalAlign: this.triangle.dricty === 1 ? 'top' : 'bottom', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.switchTextColor + } + }); + //添加道岔名称视图 + this.add(this.nameText); + //设置道岔名称视图显隐 + model.nameShow ? this.nameText.show() : this.nameText.hide(); + + //创建锁闭文字框 + let rect = this.nameText.getBoundingRect(); + let textWidth = rect.width * 0.8; + if (this.triangle.drictx !== 1) { + rect.x += rect.width; + textWidth = -textWidth; + } + + this.textRect = new Rect({ + zlevel: this.zlevel, + z: this.z + 3, + shape: { + x: rect.x, + y: rect.y, + width: textWidth, + height: rect.height + }, + style: { + lineWidth: 0, + stroke: theme.switchTextBorderColor, + fill: theme.transparentColor, + lineDash: [2, 1] + } + }); + this.add(this.textRect); + } + + /** 名称动画*/ + nameTextAnimation() { + this.nameText.animateStyle(true) + .when(0, { textFill: this.theme.backgroundColor }) + .when(1000, { textFill: this.theme.switchTextLossColor }) + .when(2000, { textFill: this.theme.backgroundColor }) + .start(); + + this.textRect.animateStyle(true) + .when(0, { textFill: this.theme.backgroundColor }) + .when(1000, { textFill: this.theme.switchTextBorderColor }) + .when(2000, { textFill: this.theme.backgroundColor }) + .start(); + + this.forkCore.animateStyle(true) + .when(0, { stroke: this.theme.backgroundColor }) + .when(1000, { stroke: this.theme.switchTextBorderColor }) + .when(2000, { stroke: this.theme.backgroundColor }) + .start(); + } + + /** 设置是否隐藏*/ + setSwitchInvisible(invisible) { + if (invisible) { + this.switchView.hide(); + } else { + this.switchView.show(); + } + } + + /** 设置道岔文字颜色*/ + setTextColor(color) { + this.nameText.setStyle('textFill', color); + } + + /** 设置道岔文字边框颜色 */ + setHasTextBorder(width) { + this.textRect.setStyle('lineWidth', width); + } + + /** 恢复状态*/ + recover() { + this.nameText.stopAnimation(false); + this.forkCore.stopAnimation(false); + this.release.stopAnimation(false); + this.reserveSection.stopAnimation(false); + + this.release.hide(); + this.relocShelter.hide(); + this.releaseBackground.hide(); + + this.setHasTextBorder(0); + switch (this.model.locateType) { + case '01': { // 定位 + this.setTextColor(this.theme.switchLocateTextColor); + } break; + case '02': { // 反位 + this.setTextColor(this.theme.switchInversionColor); + } break; + default: { // 其他 + this.setTextColor(this.theme.switchTextLossColor); + } + } + } + + /** 定位*/ + setLocationAction() { + this.recover(); + this.setSwitchInvisible(true); + this.locShelter.show(); + this.relocShelter.hide(); + this.reserveSection.hide(); + this.forkCore.hide(); + } + + /** 反位*/ + setInversionAction() { + this.recover(); + this.setSwitchInvisible(true); + this.locShelter.hide(); + this.relocShelter.show(); + this.reserveSection.show(); + this.forkCore.hide(); + } + + /** 失去*/ + setLossAction() { + this.recover(); + this.locShelter.hide(); + this.relocShelter.hide(); + this.reserveSection.hide(); + this.forkCore.show(); + this.setSwitchInvisible(false); + this.nameTextAnimation(); + } + + /** 挤叉*/ + setForkAction() { + this.setLossAction(); + } + + /** 空闲*/ + spare() { + } + + /** 单锁*/ + setMonolock() { + this.setTextColor(this.theme.switchMonolockColor); + } + + /** 封锁 */ + block() { + this.setHasTextBorder(1); + } + + /** 延时释放*/ + timeRelease() { + this.setSwitchInvisible(true); + this.release.show(); + this.releaseBackground.show(); + this.release.setStyle('stroke', this.theme.sectionTimeReleaseColor); + this.release.animateStyle(true) + .when(0, { stroke: this.theme.sectionTimeReleaseColor }) + .when(1000, { stroke: this.theme.backgroundColor }) + .start(); + + } + + /** 设置道岔切除*/ + setSwitchCutOff() { + this.setSwitchInvisible(true); + switch (this.model.locateType) { + case '01': { // 定位 + this.release.show(); + this.releaseBackground.hide(); + this.setSectionstatus(this.release, 'stroke', this.model.sectionAstatus); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.backgroundColor }) + .start(); + } break; + case '02': { // 反位 + this.reserveSection.animateStyle(true) + .when(1000, { fill: this.theme.backgroundColor }) + .start(); + } break; + } + } + + setSectionstatus(section, style, status) { + if (section) { + switch (status) { + case '00': break; + case '01': { /** 空闲*/ + section.setStyle(style, this.theme.sectionSpareColor); + } break; + case '02': { /** 通信车占用*/ + section.setStyle(style, this.theme.sectionCommunicationOccupiedColor); + } break; + case '03': { /** 非通信车占用*/ + section.setStyle(style, this.theme.sectionUnCommunicationOccupiedColor); + } break; + case '04': { /** 进路锁闭*/ + section.setStyle(style, this.theme.sectionRouteLockColor); + } break; + case '05': { /** 故障锁闭*/ + section.setStyle(style, this.theme.sectionFaultLockColor); + } break; + case '06': { /** 封锁*/ + section.setStyle(style, this.theme.sectionBlockColor); + } break; + case '07': { /** ATC切除*/ + section.setStyle(style, this.theme.sectionAtcExcisionColor); + } break; + case '08': { /** ATS切除*/ + section.setStyle(style, this.theme.sectionAtsExcisionColor); + section.animateStyle(true) + .when(1000, { fill: this.theme.backgroundColor }) + .when(2000, { fill: this.theme.sectionAtsExcisionColor }) + .start(); + } break; + case '09': { /** 进路延续保护 */ + section.setStyle(style, this.theme.sectionProtectiveLockColor); + } break; + } + } + } + + setLocateType(model) { + this.setSectionstatus(this.reserveSection, 'fill', model.sectionCstatus); + switch (model.locateType) { + case '01': { + this.setLocationAction(); /** 定位*/ + } break; + case '02': { + this.setInversionAction(); /** 反位*/ + } break; + case '03': { + this.setLossAction(); /** 失去*/ + } break; + case '04': { + this.setForkAction(); /** 挤岔*/ + } break; + } + } + + setStatus(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(); + } + } + + getShapeTipPoint() { + var rect = null; + rect = this.nameText.getBoundingRect(); + if (rect) { + return { + x: rect.x + rect.width / 2, + y: rect.y + }; + } + return null; + } +} diff --git a/src/jmap/components/batong_01/shape/Train.js b/src/jmap/components/batong_01/shape/Train.js new file mode 100644 index 000000000..755b06e59 --- /dev/null +++ b/src/jmap/components/batong_01/shape/Train.js @@ -0,0 +1,591 @@ +/* +* 列车 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import BoundingRect from 'zrender/src/core/BoundingRect'; + +class TrainBody extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + + _create(model) { + let fontSize = model.model.nameFontSize || model.theme.trainTextFontSize; + let textFont = fontSize + 'px consolas'; + let destinationText = ''; + switch (model.model.destinationStatus) { + case '01': destinationText = '准点'; break; + case '02': destinationText = '早点'; break; + case '03': destinationText = '严重早点'; break; + case '04': destinationText = '晚点'; break; + case '05': destinationText = '严重晚点'; break; + default: destinationText = '未知'; break; + } + + // 文字描述 + this.arrowText = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: model.point.x + 50, + y: model.point.y + 25, + text: `列车类型: 计划车\n表\0\0\0\0号: ${model.model.serverNo}\n车\0次\0号: ${model.model.trainNo}\n目的地号: ${model.model.targetCode ? model.model.targetCode : ''}\n车\0组\0号: ${model.model.trainNumber}\n早\0晚\0点: ${destinationText}\n运行方向: ${model.model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${model.model.sectionModel ? model.model.sectionModel.trackName : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${model.model.runControlStatus == '01' ? '正常' : model.model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${model.model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无`, + textFill: '#000', + textAlign: 'letf', + textFont: 10 + 'px consolas', + textPadding: 3, + textBackgroundColor: model.theme.tipBackgroundColor, + } + }); + + this.train = new Rect({ + zlevel: model.zlevel, + z: model.z, + shape: { + x: model.point.x, + y: model.point.y, + width: model.theme.trainWidth, + height: model.theme.trainHeight + }, + style: { + lineWidth: 0, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainBackground + }, + cursor: 'pointer', + onmouseover: () => { this.add(this.arrowText); }, + onmouseout: () => { this.remove(this.arrowText); }, + }); + + let lrPadding = 6; //两边间隔 + let upPadding = 1; //上边距离 + + lrPadding = 1; //两边间隔 + upPadding = 1; //上边距离 + + let targetCode = model.model.targetCode || 'AAA'; // 目的地码 + let serverNo = model.model.serverNo || 'BB'; // 服务号(表号) + let directionNo = model.model.directionNo || 'D'; // 方向 + let trainNo = model.model.trainNo || 'CCC'; // 车次号 + let trainNumber = model.model.trainNumber || 'EEE'; // 车组号 + + serverNo = '00' + serverNo; + trainNo = '0000' + directionNo + '' + trainNo; + targetCode = '000' + targetCode; + trainNumber = '000' + trainNumber; + + // 目的码 + this.textTrainNumber = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x + lrPadding), + y: parseInt(model.point.y + upPadding), + text: targetCode.substring(targetCode.length - 3), + textFill: model.theme.trainTextColor, + textStroke: model.theme.trainTextColor, + fontWeight: 400, + textStrokeWidth: 0, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + }, + cursor: 'pointer', + onmouseover: () => { this.add(this.arrowText); }, + onmouseout: () => { this.remove(this.arrowText); }, + }); + + // 服务号/表号 + this.textTrainServer = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x - lrPadding), + y: parseInt(model.point.y + upPadding), + text: serverNo.substring(serverNo.length - 2), + textFill: model.theme.trainTextColor, + textStroke: model.theme.trainTextColor, + textStrokeWidth: 0, + fontWeight: 100, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + }, + cursor: 'pointer', + onmouseover: () => { this.add(this.arrowText); }, + onmouseout: () => { this.remove(this.arrowText); }, + }); + + // 车次号 + this.textTrainTarget = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x - lrPadding), + y: parseInt(model.point.y + upPadding), + text: trainNo.substring(trainNo.length - 4), + textFill: model.theme.trainTextColor, + textStroke: model.theme.trainTextColor, + textStrokeWidth: 0, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + }, + cursor: 'pointer', + onmouseover: () => { this.add(this.arrowText); }, + onmouseout: () => { this.remove(this.arrowText); }, + }); + + // 车组号 + this.textTrainTargetNumber = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x - lrPadding), + y: parseInt(model.point.y + upPadding), + text: trainNumber.substring(trainNumber.length - 3), + textFill: model.theme.trainTextColor, + textStroke: model.theme.trainTextColor, + textStrokeWidth: 0, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + }, + cursor: 'pointer', + onmouseover: () => { this.add(this.arrowText); }, + onmouseout: () => { this.remove(this.arrowText); }, + }); + + this.add(this.train); + + if (model.model.nameFormat) { + let arr = model.model.nameFormat.split(':'); + arr.forEach(ele => { + if (ele == 'targetCode') { + this.add(this.textTrainNumber); + } else if (ele == 'serverNo') { + let show = arr.includes('targetCode'); + if (show) { + this.textTrainServer.setStyle('x', parseInt(model.point.x + (3 * model.model.nameFontSize * (2 / 3)) - 3 - lrPadding)); + } + this.add(this.textTrainServer); + } else if (ele == 'trainNo') { + let show = arr.includes('targetCode'); + let serverNoShow = arr.includes('serverNo'); + if (show) { + this.textTrainTarget.setStyle('x', parseInt(model.point.x + (3 * model.model.nameFontSize * (2 / 3)) - 3 - lrPadding)); + } + if (serverNoShow) { + this.textTrainTarget.setStyle('x', parseInt(model.point.x + (2 * model.model.nameFontSize * (2 / 3)) - 3 - lrPadding)); + } + if (serverNoShow && show) { + this.textTrainTarget.setStyle('x', parseInt(model.point.x + (5 * model.model.nameFontSize * (2 / 3)) - 6.5 - lrPadding)); + } + this.add(this.textTrainTarget); + } else if (ele == 'trainNumber') { + let show = arr.includes('targetCode'); + let serverNoShow = arr.includes('serverNo'); + if (show) { + this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + (3 * model.model.nameFontSize * (2 / 3)) - 3 - lrPadding)); + } + if (serverNoShow) { + this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + (2 * model.model.nameFontSize * (2 / 3)) - 3 - lrPadding)); + } + if (serverNoShow && show) { + this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + (5 * model.model.nameFontSize * (2 / 3)) - 6.5 - lrPadding)); + } + this.add(this.textTrainTargetNumber); + } + }); + } else { + this.textTrainServer.setStyle('x', parseInt(model.point.x + 27 - lrPadding)); + this.textTrainTarget.setStyle('x', parseInt(model.point.x + 43 - lrPadding)); + this.add(this.textTrainServer); + this.add(this.textTrainTarget); + this.add(this.textTrainNumber); + } + } + + setTextTrainServerColor(color) { + this.textTrainServer.setStyle('textFill', color); + this.textTrainServer.setStyle('textStroke', color); + } + + setTextTrainTargetColor(color) { + this.textTrainTarget.setStyle('textFill', color); + this.textTrainTarget.setStyle('textStroke', color); + } +} + +class TrainHead extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + + _create(model) { + let baseMargin = (model.drect === -1 ? 1 : 0); + + this.line = new Rect({ + zlevel: model.zlevel, + z: model.z, + shape: { + x: model.point.x - baseMargin * (model.theme.trainConntWidth), + y: model.point.y, + width: model.theme.trainConntWidth * this.model.scale, + height: model.bound.height + }, + style: { + lineWidth: 0.1, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainRedColor + } + }); + + this.arrow = new Polygon({ + zlevel: model.zlevel, + z: model.z, + shape: { + points: [ + [model.point.x, model.point.y], + [model.point.x + model.drect * (model.theme.trainConntWidth * this.model.scale), model.point.y + (model.bound.height + model.theme.trainMoreLength) / 2], + [model.point.x, model.point.y + model.bound.height] + ] + }, + style: { + lineWidth: 0.1, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainRedColor + } + }); + + 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(); + } + + setInvisible(invisible) { + this.eachChild((child) => { + child.attr('invisible', invisible); + }); + } +} + +export default class Train extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.size = 0; + this.model = model; + this.theme = theme; + this.fontSize = model.nameFontSize || theme.trainTextFontSize; + this.newScale = this.fontSize / theme.trainTextFontSize; + this._create(model, theme); + } + + _create(model, theme) { + //计算画图坐标点 + this._computed(model, theme); + + if (model.nameFormat) { + let arr = model.nameFormat.split(':'); + arr.forEach(ele => { + switch (ele) { + case 'targetCode': { + this.size += 3; + break; + } + case 'serverNo': { + this.size += 2; + break; + } + case 'trainNo': { + this.size += 4; + break; + } + case 'trainNumber': { + this.size += 3; + break; + } + } + }); + } else { + this.size = 9; + } + + theme.trainWidth = this.size * this.fontSize * (2 / 3) - 16; + + //画图 + if (this.point) { + // body + this.trainB = new TrainBody({ + model: model, + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: this.point, + scale: this.newScale, + }); + let bound = this.trainB.getBoundingRect(); + // left 头 + this.trainL = new TrainHead({ + bound: bound, + model: model, + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: { + x: this.point.x - theme.trainHeadDistance, + y: this.point.y + }, + drect: -1, + scale: this.newScale + }); + // right 头 + this.trainR = new TrainHead({ + bound: bound, + model: model, + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: { + x: this.point.x + bound.width + theme.trainHeadDistance, + y: this.point.y + }, + drect: 1, + scale: this.newScale + }); + //添加视图 + this.add(this.trainB); + this.add(this.trainL); + this.add(this.trainR); + this.setStatus(model); + } + } + + _computed(model, theme) { + 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((theme.trainWidth - model.trainWindowModel.width) / 2); + } break; + case '02': { //从左向右 + this.point.x = this.point.x + model.trainWindowModel.width / 2 - theme.trainConntWidth * this.newScale - theme.trainWidth; + } break; + case '03': { //从右向左 + this.point.x = this.point.x - model.trainWindowModel.width / 2 + theme.trainConntWidth * this.newScale; + } break; + } + } else { + this.point = model.position; + this.traingle = null; + } + } + + //恢复颜色状态 + recover() { + this.trainL.setLineShow(false); + this.trainR.setLineShow(false); + this.trainL.setArrowShow(false); + this.trainR.setArrowShow(false); + } + + //设置运行方向状态类型 + setDirectionType(type) { + switch (type) { + case '01': { //未知方向 + } break; + case '02': { //从左往右 + this.trainR.setArrowShow(true); + } break; + case '03': { //从右往左 + this.trainL.setArrowShow(true); + } break; + } + } + + // 设置列车停止方向类型 + setDirectionStopType(type) { + switch (type) { + case '01': { //未知方向 + } break; + case '02': { //从左往右 + this.trainR.setLineShow(true); + } break; + case '03': { //从右往左 + this.trainL.setLineShow(true); + } break; + } + } + + //设置运行状态 + setRunStatus(status) { + switch (status) { + case '01': { //停止 + this.setDirectionStopType(this.model.directionType); //设置运行方向状态类型 + } break; + case '02': { //运行 + this.setDirectionType(this.model.directionType); //设置运行方向状态类型 + } break; + } + } + + //设置运行模式 (驾驶模式类型) + setRunMode(status) { + switch (status) { + case '01': { //信号中断 + this.trainL.setColor(this.theme.trainRedColor); + this.trainR.setColor(this.theme.trainRedColor); + } break; + case '02': { //ATO自动驾驶模式 + this.trainL.setColor(this.theme.trainGreenColor); + this.trainR.setColor(this.theme.trainGreenColor); + } break; + case '03': { //ATP监控下的人工驾驶模式 + this.trainL.setColor(this.theme.trainYellowColor); + this.trainR.setColor(this.theme.trainYellowColor); + } break; + case '04': { //限制人工驾驶模式 + this.trainL.setColor(this.theme.trainOrangeColor); + this.trainR.setColor(this.theme.trainOrangeColor); + } break; + case '05': { //非限制人工驾驶模式 + this.trainL.setColor(this.theme.trainBrownColor); + this.trainR.setColor(this.theme.trainBrownColor); + } break; + } + } + + //设置目的地状态 + setDestinationStatus(status) { + switch (status) { + case '01': { //准点 + this.trainB.setTextTrainServerColor(this.theme.trainWitheColor); + } break; + case '02': { //早点 + this.trainB.setTextTrainServerColor(this.theme.trainGreenColor); + } break; + case '03': { //严重早点 + this.trainB.setTextTrainServerColor(this.theme.trainBlueColor); + } break; + case '04': { //晚点 + this.trainB.setTextTrainServerColor(this.theme.trainBrownColor); + } break; + case '05': { //严重晚点 + this.trainB.setTextTrainServerColor(this.theme.trainRedColor); + } break; + case '06': { //头码车 + this.trainB.setTextTrainServerColor(this.theme.trainWitheColor); + } break; + case '07': { //ATP切除 + this.trainB.setTextTrainServerColor(this.theme.trainYellowColor); + } break; + } + } + + //设置服务号状态类型 + // eslint-disable-next-line no-unused-vars + setServerNoType(type) { + } + + //设置AA类型 + // eslint-disable-next-line no-unused-vars + setPlanConflictControlStatus(status) { + } + + //设置BBB类型 + // eslint-disable-next-line no-unused-vars + setAlarmControlStatus(status) { + } + + //设置运行控制状态类型 + // eslint-disable-next-line no-unused-vars + setRunControlStatus(status) { + } + + //设置车门状态类型 + // eslint-disable-next-line no-unused-vars + setDoorStatus(status) { + } + + //设置通信状态类型 + // eslint-disable-next-line no-unused-vars + setCommunicationStatus(status) { + } + + // 设置计划冲突状态 + // eslint-disable-next-line no-unused-vars + setPlanConflictStatus(status) { + } + + // 设置报警状态 + // eslint-disable-next-line no-unused-vars + setAlarmStatus(status) { + } + + //设置状态 + setStatus(model) { + if (model) { + this.recover(); + this.setRunStatus(model.runStatus); //设置运行状态 + this.setRunMode(model.runMode); //设置运行模式 + this.setDestinationStatus(model.destinationStatus); //设置目的地状态 + } + } + + + //获取设备提示坐标 + getShapeTipPoint() { + return { + x: (this.train.shape.x), + y: (this.train.shape.y) + }; + } + + //获取列车包围框 + getBoundingRect() { + let list = [this.trainB, this.trainL, this.trainR]; + let rect = null; + + list.forEach(elem => { + if (elem) { + let 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); + } +} diff --git a/src/jmap/components/batong_01/shape/TrainWindow.js b/src/jmap/components/batong_01/shape/TrainWindow.js new file mode 100644 index 000000000..1088a1a40 --- /dev/null +++ b/src/jmap/components/batong_01/shape/TrainWindow.js @@ -0,0 +1,91 @@ +/* +* 车次窗 +*/ +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import Group from 'zrender/src/container/Group'; +import store from '@/store'; + +export default class TrainWindow extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 1; + this.model = model; + this.theme = theme; + this._create(model); + } + + _create(model) { + let prdType = store.state.map.prdType; + if (prdType !== '01') { + this.createTrainWindow(); + this.setTrainWindow(model.trainWindowShow); + this.setStatus(model); + } + } + + /** 创建车次窗*/ + createTrainWindow() { + let model = this.model; + let theme = this.theme; + + this.trainRect = new Polygon({ + _subType: 'TrainWindow', + zlevel: this.zlevel - 1, + z: this.z, + shape: { + points: [ + [model.point.x - model.width / 2, model.point.y], + [model.point.x + model.width / 2, model.point.y], + [model.point.x + model.width / 2, model.point.y + model.height], + [model.point.x - model.width / 2, model.point.y + model.height], + ] + }, + style: { + lineWidth: 1.5, + stroke: theme.trainWindowColor, + fill: theme.transparentColor + }, + onmouseover: () => { this.setTrainWindow(true); }, + onmouseout: () => { this.setTrainWindow(false); }, + }); + this.add(this.trainRect); + } + + setTrainWindow(show) { + if (this.trainRect && !this.model.trainWindowShow) { + let lineWidth = 0; + if (show) { + lineWidth = 1; + } + this.trainRect.setStyle('lineWidth', lineWidth); + } + } + + 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; + } + } + } + + //设置状态 + setStatus() { + } + + 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/components/batong_01/shape/ZcControl.js b/src/jmap/components/batong_01/shape/ZcControl.js new file mode 100644 index 000000000..a2fe4a2b2 --- /dev/null +++ b/src/jmap/components/batong_01/shape/ZcControl.js @@ -0,0 +1,102 @@ +/* +* ZC区域控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +import Text from 'zrender/src/graphic/Text'; +import Group from 'zrender/src/container/Group'; + + +export default class ZcControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 20; + this.model = model; + this.theme = theme; + this._create(model); + } + + _create(model) { + this.control = new Arc({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: this.theme.zcControlmodeR + }, + style: { + lineWidth: 0, + fill: this.theme.zcControlGrayColor, + } + }); + + this.text = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: this.theme.stationControlTextSize + 'px ' + this.theme.textFontFormat + } + }); + + if (this.model.visible) { + this.add(this.control); + this.add(this.text); + } + this.setStatus(model); + } + + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + + } break; + case '01': { //中控(缺省值) + + } break; + case '02': { //站控且允许转为中控 + + } break; + case '03': { //站控且不允许转为中控 + + } 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; + } + } + } + + 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/components/batong_01/shape/index.js b/src/jmap/components/batong_01/shape/index.js new file mode 100644 index 000000000..b54cf0693 --- /dev/null +++ b/src/jmap/components/batong_01/shape/index.js @@ -0,0 +1,25 @@ +import Section from './Section'; +import Signal from './Signal'; +import Station from './Station'; +import StationControl from './StationControl'; +import StationCounter from './StationCounter'; +import StationDelayUnlock from './StationDelayUnlock'; +import StationStand from './StationStand'; +import Switch from './Switch'; +import Train from './Train'; +import TrainWindow from './TrainWindow'; +import ZcControl from './ZcControl'; + +export default { + Section, + Signal, + Station, + StationControl, + StationCounter, + StationDelayUnlock, + StationStand, + Switch, + Train, + TrainWindow, + ZcControl +}; \ No newline at end of file diff --git a/src/jmap/components/batong_01/shape/libs/ShapePoints.js b/src/jmap/components/batong_01/shape/libs/ShapePoints.js new file mode 100644 index 000000000..6edfaa545 --- /dev/null +++ b/src/jmap/components/batong_01/shape/libs/ShapePoints.js @@ -0,0 +1,36 @@ + + +/** 指向箭头坐标*/ +export function arrows(modelX, modelY, length, radius) { + return [ + [modelX - length, modelY], + [modelX - length + radius / 1.5, modelY - radius / 1.5], + [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.5] + ]; + +} + +/** 指向三角形坐标*/ +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], + ]; +} \ No newline at end of file diff --git a/src/jmap/components/batong_01/theme.js b/src/jmap/components/batong_01/theme.js new file mode 100644 index 000000000..a8f2278fc --- /dev/null +++ b/src/jmap/components/batong_01/theme.js @@ -0,0 +1,397 @@ +import { enableClassExtend, enableClassCheck } from '@/jlmap/util/clazz'; + +/** + * 皮肤风格主题 + * @param {*} opts + */ +function Theme() { + +} + +Theme.prototype = { + + constructor: Theme, + + //道岔字体颜色 + switchTextColor: '#FF00C0', + + /** 皮肤风格编码 */ + code: '02', + + /** 默认背景 颜色*/ + backgroundColor: '#000000', + + /** 默认提示背景 颜色*/ + tipBackgroundColor: 'yellow', + + /** 默认边线 颜色*/ + sidelineColor: '#FFFFFF', + + /** 透明填充 颜色*/ + transparentColor: 'rgba(0,0,0,0)', + + /** 默认字体 大小*/ + textFontSize: 8.2, + + /** 默认字体 族类*/ + textFontFormat: '宋体', //consolas + + /** 默认字体颜色*/ + textFontColor: '#C0C0C0', + + // 信号机名称颜色 + singaltextFontColor: '#00FF00', + + /** 默认字体颜色*/ + destinationTextFontColor: 'yellow', + + /** 默认名称和设备的距离*/ + nameDistance: 10, + + /** line 颜色*/ + lineWidthColor: '#FFFFFF', + + + /** link 宽度*/ + linkWidth: 4, + + /** link 线条颜色*/ + linkColor: '#0000FF',//#4e8de6 + + /** link 字体颜色*/ + linkTextColor: '#FFFFFF', //#3399cc #3399cc + + zcControlGrayColor: '#00FF00', + + zcControlmodeR: 7, + + /** StopPoint 颜色*/ + stopPointColor: '#FE0000', + + /** StopPoint 字体颜色*/ + stopPointTextColor: '#FFFFFF', + + + /** 区段 宽度*/ + sectionWidth: 5, + + /** 区段宽超出宽度*/ + sectionBeyondWidth: 1, + + /** 计轴 半径*/ + sectionAxleR: 3, + + /** 计轴和区段之间的距离*/ /** 需要添加*/ + sectionAxleDistance: 5, + + /** 限速线的宽短*/ + sectionSpeedLimitLinewidth: 1, + + /** 限速线距离区段距离*/ + sectionSpeedLimitDistance: 5, + + /** 区段侵入颜色*/ + sectionInvadeColor: '#EF0C08', + + /** 限速线颜色*/ + sectionSpeedLimitColor: '#FFFF00', + + /** 区段计轴颜色*/ + sectionAxleColor: '#FFFFFF', + + /** 区段边界符颜色*/ + sectionSeparatorColor: '#C0C0C0', // '#3149C3', + + /** 区段空闲颜色*/ + sectionSpareColor: '#0000FF', + + /** 逻辑区段名称颜色*/ + sectionLogicalTextColor: '#C0C0C0', + + /** 区段通信车占用颜色**/ + sectionCommunicationOccupiedColor: '#FF329A', + + /** 区段非通讯车占用颜色*/ + sectionUnCommunicationOccupiedColor: '#FE0000', + + /** 区段路由锁定颜色*/ + sectionRouteLockColor: '#FFFFFF', + + /** 区段故障锁定颜色*/ + sectionFaultLockColor: '#9B4A0A', + + /** 区段未定义颜色*/ + sectionUndefinedColor: '#0071C1', + + /** 保护区段锁闭*/ + sectionProtectionSectionLockedColor: '#FEFF00', + + /** 区段计轴预复位*/ + sectionAxleResetColor: '#00FFFF', + + /** 区段封锁颜色*/ + sectionBlockColor: '#800080', + + /** 区段atc切除颜色*/ + sectionAtcExcisionColor: '#A0522D', + + /** 区段ats切除颜色*/ + sectionAtsExcisionColor: '#A0522D', + + /** 区段延时释放颜色*/ + sectionTimeReleaseColor: '#3F3F3F', + + /** 区段保护锁闭*/ + sectionProtectiveLockColor: '#FFFF00', + + /** 区段保护延时解锁*/ + sectionProtectiveTimeReleaseColor: '#0071C1', + + + /** 道岔单边长度 */ + switchLen: 10, + + /** 道岔边框颜色*/ + switchTextBorderColor: '#FE0000', + + /** 道岔失去颜色*/ + switchTextLossColor: '#FFFFFF', + + /** 道岔定位颜色*/ + switchLocateTextColor: '#FF00C0', + + /** 道岔反位颜色*/ + switchInversionColor: '#FF00C0', //#9C9D09 + + /** 道岔单锁颜色*/ + switchMonolockColor: '#870E10', + + + /** 信号机宽度 */ + signalR: 5, + + /** 设备距离区段的距离*/ + signalDistance: 19, + + /** 信号灯按钮颜色*/ + signalButtonColor: 'darkgreen', + + /** 信号灯按钮闪烁颜色*/ + signalButtonLightenColor: '#E4EF50', + + /** 信号灯灯柱颜色*/ + signalLampStandardColor: '#C0C0C0', //#3E44BE, + + /** 信号灯锁闭*/ + signalBlockColor: '#EF0C08', + + /** 信号灯灰色*/ + signalLampGrayColor: '#808080', + + /** 信号灯红色*/ + signalLampRedColor: '#EF0C08', + + /** 信号灯绿色*/ + signalLampGreenColor: '#4DD43F', + + /** 信号灯黄色*/ + signalLampYellowColor: '#E4EF50', + + /** 信号灯白色*/ + signalLampWhiteColor: '#FFFFFF', + + /** 信号灯蓝色*/ + signalLampBlueColor: '#3E44BE', + + + /** 控制模式灯的半径 */ + stationControlmodeR: 5, + + /** 控制模式之间灯之间的距离*/ + stationControlDistance: 44, + + /** 控制模式字体大小*/ + stationControlTextSize: 12, + + /** 控制模式灰色*/ + stationControlGrayColor: '#74747C', + + /** 控制模式绿色*/ + stationControlGreenColor: '#4DD43F', + + /** 控制模式红色*/ + stationControlRedColor: '#EF0C08', + + /** 控制模式黄色*/ + stationControlYellowColor: '#E4EF50', + + + /** 站台和屏蔽门之间的距离*/ + stationStandDistance: 8, + + /** 站台首端字体大小*/ + stationStandHeadFontSize: 10, + + /** 站台无人折返*/ + stationStandNoHumanReentryColor: '#0F16DA', + + /** 站台自动换端*/ + stationStandAutoChangeEndsColor: '#0BF400', + + /** 站台空闲颜色*/ + stationStandSpareColor: '#fff', + + /** 站台列车停站颜色*/ + stationStandStopColor: '#FEFE00', + + /** 站台跳停颜色*/ + stationStandJumpStopColor: '#9A99FF', + + /** 站台指定列车跳停颜色*/ + stationStandDesignatedJumpStopColor: 'lightSkyBlue', + + /** 站台紧急关闭颜色*/ + stationStandEmergentCloseColor: '#F61107', + + /** 停站时间字体颜色*/ + stationStandTimeTextColor: '#FFFFFF', + + /** 车站扣车颜色*/ + stationStandStandDetainTrainColor: '#E4EF50', + + /** 中心扣车颜色*/ + stationStandCenterDetainTrainColor: '#FFFFFF', + + /** 车站+中心扣车颜色*/ + stationStandStandAndCenterDetainTrainColor: '#F61107', + + /** 屏蔽门默认颜色*/ + stationStandDoorDefaultColor: '#4DD43F', + + /** 屏蔽门切除颜色*/ + stationStandSplitDoorColor: '#F61107', + + /** 车站扣除文字颜色*/ + stationstandDetainTrainTextColor: '#E4EF50', + + + /** 计数器字体颜色*/ + stationCounterTextColor: '#FFFFFF', + + /** 计数器边框颜色*/ + stationCounterBorderColor: '#E4EF50', + + + /** 延迟解锁倒计时和设备文字之间的距离*/ + stationDelayUnlockDistance: 3, + + /** 延时解锁字体颜色*/ + stationDelayUnlockTextColor: '#FFFFFF', + + /** 延迟解锁边框颜色*/ + stationDelayUnlockBorderColor: '#FFFFFF', + + + // 停车点目的码文字大小 + textPointFontSize: 6, + + // 停车点折返点目的码名字颜色 + stopPointTexDestCodetColor: '#FFF07B', + + + + /** 列车长度*/ + trainWidth: 76, + + /** 列车高度*/ + trainHeight: 17, + + /** 列车字号*/ + trainTextFontSize: 15, + + // 列车文字间距 + trainTextSpaceBetween: 27, + + + /** 列车HDSA字号*/ + trainHSDATextFontSize: 8, + + /** 列车信号的半径*/ + trainConflictR: 3, + + /** 列车信号距离车的距离*/ + trainConflictDistance: 5, + + /** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/ + trainMoreLength: 1, + + /** 列车和车头之间的间距*/ + trainHeadDistance: 2, + + /** 列车竖杠的宽度*/ + trainConntWidth: 4, + + /** 列车竖杠和方向之间的间隔*/ + trainPadding: 1, + + /** 列车方向的宽度*/ + trainArrowWidth: 6, + + /** 列车和区段之间的距离*/ + trainDistance: 18, + + /** 列车背景*/ + trainBackground: 'rgba(0,0,0,0)', + + /** 列车边线颜色*/ + trainSidelineColor: '#C0C0C0', + + /** 列车文字颜色*/ + trainTextColor: '#ffffff', + + /** 列车 灰色*/ + trainGrayColor: '#C0C0C0', + + /** 列车 白色*/ + trainWitheColor: '#FFFFFF', + + /** 列车 棕色*/ + trainBrownColor: '#9B4A09', + + /** 列车 黄色*/ + trainYellowColor: '#FFFF00', + + /** 列车 绿色*/ + trainGreenColor: '#00AF50', + + /** 列车 蓝色*/ + trainBlueColor: '#3265FF', + + /** 列车 红色*/ + trainRedColor: '#EF0C08', + + /** 列车 橘色*/ + trainOrangeColor: '#EA700D', + + /** 列车 紫色*/ + trainPurpleColor: 'purple', + + /** 列车 粉色*/ + trainPinkColor: 'pink', + + + /** 车次窗高度*/ + trainWindowWidth: 40, + + /** 车次窗高度*/ + trainWindowHeight: 15, + + /** 车次窗颜色*/ + trainWindowColor: '#4DD43F' +}; + +// Enable Theme.extend. +enableClassExtend(Theme); +enableClassCheck(Theme); + +export default Theme; \ No newline at end of file diff --git a/src/jmap/components/beijing_01/convert.js b/src/jmap/components/beijing_01/convert.js new file mode 100644 index 000000000..a33e08d61 --- /dev/null +++ b/src/jmap/components/beijing_01/convert.js @@ -0,0 +1,309 @@ +import { createMartPoint, createSeriesModel, createMarkLineModels, HexColor, ConvertSheetToList } from '@/utils/runPlan'; + +export default { + /** 边缘高度*/ + EdgeHeight: 600, + + /** 间隔高度*/ + CoordMultiple: 1, + + /** 偏移时间*/ + TranslationTime: 60 * 60 * 2, + + /** excel解析配置*/ + ExcelConfig: { + beginRow: 1, + beginCol: 0, + fieldNum: 10, + sepField: '车次', + columns: { + '车站名': { key: 'stationName', formatter: (val) => { return val; } }, + '到点': { key: 'arriveTime', formatter: (val) => { return val; } }, + '发点': { key: 'departureTime', formatter: (val) => { return val; } }, + } + }, + + /** 解析exal数据转换为Json后台数据*/ + importData(Sheet, JsonData) { + let dataList = ConvertSheetToList(Sheet, true); + let needList = Object.keys(this.ExcelConfig.columns); + + if (dataList && dataList.length) { + for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += this.ExcelConfig.fieldNum + 1) { + let isContinue = true; + let tripObj = { code: '', arrivalList: [] }; + + for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) { + isContinue = false; + + let stationObj = {}; + for (var index = 0; index < this.ExcelConfig.fieldNum; index += 1) { + if (dataList[colIndex + index]) { + let title = dataList[colIndex + index][0]; + let value = dataList[colIndex + index][rowIndex]; + + if (title && value) { + // 数据列解析 + isContinue = true; + let titleStr = `${title}`.trim(); + let valueStr = `${value}`.trim(); + + if (titleStr == this.ExcelConfig.sepField) { + if (tripObj.code) { + let length = tripObj.arrivalList.length; + if (length == 1) { + tripObj.arrivalList[0]['flag'] = true; + } + JsonData.push(tripObj); + tripObj = { code: valueStr, arrivalList: [] }; + } else { + tripObj.code = valueStr; + } + } + + // 取需要的字段 + if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) { + stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr); + } + } + } + } + + // 添加字段值 + if (Object.keys(stationObj).length) { + tripObj.arrivalList.push(stationObj); + } + } + + // 添加最后那条没有车次的记录 + if (tripObj.code) { + let length = tripObj.arrivalList.length; + if (length) { + tripObj.arrivalList[length - 1]['flag'] = true; + } + JsonData.push(tripObj); + } + } + } + + return JsonData; + }, + + /** 将后台数据解析成图表*/ + convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) { + let models = []; + + if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) { + /** 按服务遍历数据*/ + data.serviceNumberDataList.forEach((service) => { + /** 按车次遍历数据*/ + let opt = { name: '', markPointData: [], data: [] }; + if (service.tripNumberDataList && service.tripNumberDataList.length) { + service.tripNumberDataList.forEach((train, j) => { + let pointdata = {}; + let idx = 0; + let num = 0; + let lastPoint = null; + let nextPoint = null; + + /** 如果车次号为空,不显示名称*/ + if (train.tripNumber) { + /** 创建标记点名称和坐标*/ + pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`; + pointdata.color = '#000' || lineStyle.color; + pointdata.directionCode = train.directionCode; + pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)]; + + /** 给服务对象添加服务名称和标记点*/ + opt.markPointData.push(createMartPoint(pointdata)); + /** 创建服务号名称*/ + opt.name = `${service.serviceNumber}`; + } + + /** 计算非折返点车次点坐标集合*/ + train.stationTimeList.forEach((elem, index) => { + idx = index; + 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) { + opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode]); + } + }); + + /** 计算折返点车次坐标点集合*/ + if (!service.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) { + lastPoint = train.stationTimeList[idx - 1]; + nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1]; + num = this.computedReentryNumber(train.tripNumber); + opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode]); + opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode]); + } + + /** 如果是备用车,按车次添加线*/ + if (service.backup) { + /** 创建一条完成的服务数据*/ + opt.name += j; + let model = createSeriesModel(opt, Object.assign({ color: HexColor.toCreate() }, lineStyle)); + if (model) { + models.push(model); + opt = { name: '', markPointData: [], data: [] }; + } + } + }); + + //不是备用车,按服务添加线 + if (!service.backup) { + /** 创建一条完成的服务数据*/ + let model = createSeriesModel(opt, Object.assign({ color: HexColor.toCreate() }, 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, false)], + name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`, + color: lineStyle.color || '#000' + })); + } + + /** 计算折返点*/ + let nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false), elem.directionCode]; + if (serie.data.length > 0) { + let lastPoint = serie.data[serie.data.length - 1]; + if (lastPoint[2] !== nextPoint[2]) { + let num = this.computedReentryNumber(elem.tripNumber); + serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[2], num), lastPoint[2]]); + serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2], num), lastPoint[2]]); + } + } + + /** 添加车组号数据到对应的服务图数据中*/ + serie.data.push(nextPoint); + + /** 保证原始数据排序*/ + serie.data.sort((a, b) => { + return parseInt(a[0]) - parseInt(b[0]); + }); + } + }); + }); + } + + return series; + }, + + /** 初始化Y轴*/ + initializeYaxis(stations) { + return createMarkLineModels(stations, (elem) => { + return this.EdgeHeight + elem.kmRange * this.CoordMultiple; + }); + }, + + /** 将后台数据转换为试图序列模型*/ + convertStationsToMap(stations) { + let 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) { + let yText = ''; + + stations.forEach(elem => { + if (elem.kmRange < parseInt(params.value) / this.CoordMultiple - this.EdgeHeight) { + yText = elem.kmRange + 'm'; + } + }); + + return yText; + }, + + /** 根据是否和上一个车次是否相交,计算下一个车次的折返的高度*/ + computedReentryNumber(code) { + return parseInt(code || 1) % 2 ? 1 : 2; + }, + + /** 根据方向计算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, directionCode, isSpecial, num) { + let defaultVlue = 0; + let station = stations.find(it => { return it.code == elem.stationCode; }); + if (station) { + defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; + if (isSpecial) { + defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode, num); + } + } + + return defaultVlue; + } +}; \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/alxeEffective.vue b/src/jmap/components/beijing_01/menus/dialog/alxeEffective.vue new file mode 100644 index 000000000..301aa8966 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/alxeEffective.vue @@ -0,0 +1,414 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/cancelAllLimit.vue b/src/jmap/components/beijing_01/menus/dialog/cancelAllLimit.vue new file mode 100644 index 000000000..b5fa18d53 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/cancelAllLimit.vue @@ -0,0 +1,355 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/childDialog/childDialog/noticeInfo.vue b/src/jmap/components/beijing_01/menus/dialog/childDialog/childDialog/noticeInfo.vue new file mode 100644 index 000000000..0b3c0676a --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/childDialog/childDialog/noticeInfo.vue @@ -0,0 +1,77 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmControl.vue b/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmControl.vue new file mode 100644 index 000000000..25e224a51 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmControl.vue @@ -0,0 +1,360 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmControlSpeed.vue b/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmControlSpeed.vue new file mode 100644 index 000000000..a4abfd9c4 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmControlSpeed.vue @@ -0,0 +1,153 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmSignalUnlock.vue b/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmSignalUnlock.vue new file mode 100644 index 000000000..9f0177313 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmSignalUnlock.vue @@ -0,0 +1,118 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmTip.vue b/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmTip.vue new file mode 100644 index 000000000..0edcbe768 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmTip.vue @@ -0,0 +1,68 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmTrain.vue b/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmTrain.vue new file mode 100644 index 000000000..7b6ea7caf --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/childDialog/confirmTrain.vue @@ -0,0 +1,168 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/childDialog/popupAlarm.vue b/src/jmap/components/beijing_01/menus/dialog/childDialog/popupAlarm.vue new file mode 100644 index 000000000..617c619e0 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/childDialog/popupAlarm.vue @@ -0,0 +1,90 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/routeCmdControl.vue b/src/jmap/components/beijing_01/menus/dialog/routeCmdControl.vue new file mode 100644 index 000000000..4e3400843 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/routeCmdControl.vue @@ -0,0 +1,432 @@ + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/routeControl.vue b/src/jmap/components/beijing_01/menus/dialog/routeControl.vue new file mode 100644 index 000000000..62b586ff1 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/routeControl.vue @@ -0,0 +1,223 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/routeDetail.vue b/src/jmap/components/beijing_01/menus/dialog/routeDetail.vue new file mode 100644 index 000000000..6850fde63 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/routeDetail.vue @@ -0,0 +1,154 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/routeHandControl.vue b/src/jmap/components/beijing_01/menus/dialog/routeHandControl.vue new file mode 100644 index 000000000..326767c7a --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/routeHandControl.vue @@ -0,0 +1,319 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/routeLock.vue b/src/jmap/components/beijing_01/menus/dialog/routeLock.vue new file mode 100644 index 000000000..b7b452f9a --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/routeLock.vue @@ -0,0 +1,158 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/routeSelection.vue b/src/jmap/components/beijing_01/menus/dialog/routeSelection.vue new file mode 100644 index 000000000..8b81913e9 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/routeSelection.vue @@ -0,0 +1,257 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/sectionCmdControl.vue b/src/jmap/components/beijing_01/menus/dialog/sectionCmdControl.vue new file mode 100644 index 000000000..718e5f776 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/sectionCmdControl.vue @@ -0,0 +1,435 @@ + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/sectionControl.vue b/src/jmap/components/beijing_01/menus/dialog/sectionControl.vue new file mode 100644 index 000000000..2342a69c0 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/sectionControl.vue @@ -0,0 +1,207 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/speedCmdControl.vue b/src/jmap/components/beijing_01/menus/dialog/speedCmdControl.vue new file mode 100644 index 000000000..15715e46d --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/speedCmdControl.vue @@ -0,0 +1,783 @@ + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/speedLimitControl.vue b/src/jmap/components/beijing_01/menus/dialog/speedLimitControl.vue new file mode 100644 index 000000000..d21d7f8f7 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/speedLimitControl.vue @@ -0,0 +1,554 @@ + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/standBackStrategy.vue b/src/jmap/components/beijing_01/menus/dialog/standBackStrategy.vue new file mode 100644 index 000000000..8f3ee3a7d --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/standBackStrategy.vue @@ -0,0 +1,212 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/standControl.vue b/src/jmap/components/beijing_01/menus/dialog/standControl.vue new file mode 100644 index 000000000..03dce356a --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/standControl.vue @@ -0,0 +1,287 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/standDetail.vue b/src/jmap/components/beijing_01/menus/dialog/standDetail.vue new file mode 100644 index 000000000..9dc3d40e8 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/standDetail.vue @@ -0,0 +1,261 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/standDetainTrainAll.vue b/src/jmap/components/beijing_01/menus/dialog/standDetainTrainAll.vue new file mode 100644 index 000000000..b6a48e229 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/standDetainTrainAll.vue @@ -0,0 +1,181 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/standJumpStopControl.vue b/src/jmap/components/beijing_01/menus/dialog/standJumpStopControl.vue new file mode 100644 index 000000000..ba5413943 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/standJumpStopControl.vue @@ -0,0 +1,333 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/standRunLevel.vue b/src/jmap/components/beijing_01/menus/dialog/standRunLevel.vue new file mode 100644 index 000000000..af03c3ffc --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/standRunLevel.vue @@ -0,0 +1,336 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/standStopTime.vue b/src/jmap/components/beijing_01/menus/dialog/standStopTime.vue new file mode 100644 index 000000000..cc6795fae --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/standStopTime.vue @@ -0,0 +1,238 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/stationCmdControl.vue b/src/jmap/components/beijing_01/menus/dialog/stationCmdControl.vue new file mode 100644 index 000000000..2b7a083d2 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/stationCmdControl.vue @@ -0,0 +1,389 @@ + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/stationHumanControlAll.vue b/src/jmap/components/beijing_01/menus/dialog/stationHumanControlAll.vue new file mode 100644 index 000000000..5c4fcc0d6 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/stationHumanControlAll.vue @@ -0,0 +1,118 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/stationSetRouteControlAll.vue b/src/jmap/components/beijing_01/menus/dialog/stationSetRouteControlAll.vue new file mode 100644 index 000000000..ae4f0e6d5 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/stationSetRouteControlAll.vue @@ -0,0 +1,138 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/switchCmdControl.vue b/src/jmap/components/beijing_01/menus/dialog/switchCmdControl.vue new file mode 100644 index 000000000..3fc7ff8ae --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/switchCmdControl.vue @@ -0,0 +1,459 @@ + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/switchControl.vue b/src/jmap/components/beijing_01/menus/dialog/switchControl.vue new file mode 100644 index 000000000..aa8d70b2f --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/switchControl.vue @@ -0,0 +1,259 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainAddPlan.vue b/src/jmap/components/beijing_01/menus/dialog/trainAddPlan.vue new file mode 100644 index 000000000..1abfc88eb --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainAddPlan.vue @@ -0,0 +1,176 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainCreate.vue b/src/jmap/components/beijing_01/menus/dialog/trainCreate.vue new file mode 100644 index 000000000..982fb92a6 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainCreate.vue @@ -0,0 +1,151 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainDefine.vue b/src/jmap/components/beijing_01/menus/dialog/trainDefine.vue new file mode 100644 index 000000000..3b97333a1 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainDefine.vue @@ -0,0 +1,172 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainDelete.vue b/src/jmap/components/beijing_01/menus/dialog/trainDelete.vue new file mode 100644 index 000000000..cd391ffa1 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainDelete.vue @@ -0,0 +1,160 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainDeletePlan.vue b/src/jmap/components/beijing_01/menus/dialog/trainDeletePlan.vue new file mode 100644 index 000000000..5d3c4e0d6 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainDeletePlan.vue @@ -0,0 +1,165 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainEdit.vue b/src/jmap/components/beijing_01/menus/dialog/trainEdit.vue new file mode 100644 index 000000000..22d282ec6 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainEdit.vue @@ -0,0 +1,172 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainFlag.vue b/src/jmap/components/beijing_01/menus/dialog/trainFlag.vue new file mode 100644 index 000000000..91aad6262 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainFlag.vue @@ -0,0 +1,151 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainMove.vue b/src/jmap/components/beijing_01/menus/dialog/trainMove.vue new file mode 100644 index 000000000..02df72e8a --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainMove.vue @@ -0,0 +1,172 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainMoveEvently.vue b/src/jmap/components/beijing_01/menus/dialog/trainMoveEvently.vue new file mode 100644 index 000000000..2549bf35a --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainMoveEvently.vue @@ -0,0 +1,185 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainSetHead.vue b/src/jmap/components/beijing_01/menus/dialog/trainSetHead.vue new file mode 100644 index 000000000..8eb1c5c40 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainSetHead.vue @@ -0,0 +1,172 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainSetPlan.vue b/src/jmap/components/beijing_01/menus/dialog/trainSetPlan.vue new file mode 100644 index 000000000..9c3a6ebeb --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainSetPlan.vue @@ -0,0 +1,156 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/dialog/trainSetWork.vue b/src/jmap/components/beijing_01/menus/dialog/trainSetWork.vue new file mode 100644 index 000000000..769e77c1c --- /dev/null +++ b/src/jmap/components/beijing_01/menus/dialog/trainSetWork.vue @@ -0,0 +1,156 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/index.vue b/src/jmap/components/beijing_01/menus/index.vue new file mode 100644 index 000000000..96aade877 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/index.vue @@ -0,0 +1,372 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuBar.vue b/src/jmap/components/beijing_01/menus/menuBar.vue new file mode 100644 index 000000000..97e4ac2f6 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuBar.vue @@ -0,0 +1,1204 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuButton.vue b/src/jmap/components/beijing_01/menus/menuButton.vue new file mode 100644 index 000000000..0220568d0 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuButton.vue @@ -0,0 +1,346 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuCancel.vue b/src/jmap/components/beijing_01/menus/menuCancel.vue new file mode 100644 index 000000000..193e22632 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuCancel.vue @@ -0,0 +1,150 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/childDialog/twoConfirmation.vue b/src/jmap/components/beijing_01/menus/menuDialog/childDialog/twoConfirmation.vue new file mode 100644 index 000000000..53e1eceb7 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/childDialog/twoConfirmation.vue @@ -0,0 +1,120 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/childDialog/userAdd.vue b/src/jmap/components/beijing_01/menus/menuDialog/childDialog/userAdd.vue new file mode 100644 index 000000000..0c7555a39 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/childDialog/userAdd.vue @@ -0,0 +1,162 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/childDialog/userDelete.vue b/src/jmap/components/beijing_01/menus/menuDialog/childDialog/userDelete.vue new file mode 100644 index 000000000..ec304506c --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/childDialog/userDelete.vue @@ -0,0 +1,134 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/childDialog/userEdit.vue b/src/jmap/components/beijing_01/menus/menuDialog/childDialog/userEdit.vue new file mode 100644 index 000000000..ec87e0f81 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/childDialog/userEdit.vue @@ -0,0 +1,178 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/detainTrainContorl.vue b/src/jmap/components/beijing_01/menus/menuDialog/detainTrainContorl.vue new file mode 100644 index 000000000..89b7c5ae6 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/detainTrainContorl.vue @@ -0,0 +1,184 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/detainTrainContorlUpDown.vue b/src/jmap/components/beijing_01/menus/menuDialog/detainTrainContorlUpDown.vue new file mode 100644 index 000000000..8e46a5dde --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/detainTrainContorlUpDown.vue @@ -0,0 +1,184 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/helpAbout.vue b/src/jmap/components/beijing_01/menus/menuDialog/helpAbout.vue new file mode 100644 index 000000000..3881848e4 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/helpAbout.vue @@ -0,0 +1,131 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/manageUser.vue b/src/jmap/components/beijing_01/menus/menuDialog/manageUser.vue new file mode 100644 index 000000000..2ec6fadfa --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/manageUser.vue @@ -0,0 +1,290 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/stationControl.vue b/src/jmap/components/beijing_01/menus/menuDialog/stationControl.vue new file mode 100644 index 000000000..54ab6268c --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/stationControl.vue @@ -0,0 +1,238 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/trainAdd.vue b/src/jmap/components/beijing_01/menus/menuDialog/trainAdd.vue new file mode 100644 index 000000000..6bf8c82a0 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/trainAdd.vue @@ -0,0 +1,162 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/trainDelete.vue b/src/jmap/components/beijing_01/menus/menuDialog/trainDelete.vue new file mode 100644 index 000000000..bbdd4bb4f --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/trainDelete.vue @@ -0,0 +1,149 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/trainTranstalet.vue b/src/jmap/components/beijing_01/menus/menuDialog/trainTranstalet.vue new file mode 100644 index 000000000..8b62effb9 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/trainTranstalet.vue @@ -0,0 +1,152 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/viewDevice.vue b/src/jmap/components/beijing_01/menus/menuDialog/viewDevice.vue new file mode 100644 index 000000000..143eb207f --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/viewDevice.vue @@ -0,0 +1,166 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/viewName.vue b/src/jmap/components/beijing_01/menus/menuDialog/viewName.vue new file mode 100644 index 000000000..88433b586 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/viewName.vue @@ -0,0 +1,265 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuDialog/viewTrainId.vue b/src/jmap/components/beijing_01/menus/menuDialog/viewTrainId.vue new file mode 100644 index 000000000..d97963dd9 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuDialog/viewTrainId.vue @@ -0,0 +1,183 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuLimit.vue b/src/jmap/components/beijing_01/menus/menuLimit.vue new file mode 100644 index 000000000..44fcba0e7 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuLimit.vue @@ -0,0 +1,118 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuSection.vue b/src/jmap/components/beijing_01/menus/menuSection.vue new file mode 100644 index 000000000..55b4675fa --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuSection.vue @@ -0,0 +1,410 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuSignal.vue b/src/jmap/components/beijing_01/menus/menuSignal.vue new file mode 100644 index 000000000..f09c06734 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuSignal.vue @@ -0,0 +1,498 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuStation.vue b/src/jmap/components/beijing_01/menus/menuStation.vue new file mode 100644 index 000000000..66b9ab6cb --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuStation.vue @@ -0,0 +1,304 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuStationControl.vue b/src/jmap/components/beijing_01/menus/menuStationControl.vue new file mode 100644 index 000000000..02efad115 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuStationControl.vue @@ -0,0 +1,69 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuStationStand.vue b/src/jmap/components/beijing_01/menus/menuStationStand.vue new file mode 100644 index 000000000..027e41ed0 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuStationStand.vue @@ -0,0 +1,506 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuSwitch.vue b/src/jmap/components/beijing_01/menus/menuSwitch.vue new file mode 100644 index 000000000..b3be3a390 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuSwitch.vue @@ -0,0 +1,446 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuTool.vue b/src/jmap/components/beijing_01/menus/menuTool.vue new file mode 100644 index 000000000..17ecde773 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuTool.vue @@ -0,0 +1,204 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/menuTrain.vue b/src/jmap/components/beijing_01/menus/menuTrain.vue new file mode 100644 index 000000000..a4356b4db --- /dev/null +++ b/src/jmap/components/beijing_01/menus/menuTrain.vue @@ -0,0 +1,598 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/passiveDialog/alarm.vue b/src/jmap/components/beijing_01/menus/passiveDialog/alarm.vue new file mode 100644 index 000000000..02ffc2026 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/passiveDialog/alarm.vue @@ -0,0 +1,214 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/passiveDialog/control.vue b/src/jmap/components/beijing_01/menus/passiveDialog/control.vue new file mode 100644 index 000000000..3d9cb637d --- /dev/null +++ b/src/jmap/components/beijing_01/menus/passiveDialog/control.vue @@ -0,0 +1,286 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/passiveDialog/timeout.vue b/src/jmap/components/beijing_01/menus/passiveDialog/timeout.vue new file mode 100644 index 000000000..e8ec3b556 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/passiveDialog/timeout.vue @@ -0,0 +1,106 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/statusBar.vue b/src/jmap/components/beijing_01/menus/statusBar.vue new file mode 100644 index 000000000..0fad48767 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/statusBar.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/statusDownTrainDetail.vue b/src/jmap/components/beijing_01/menus/statusDownTrainDetail.vue new file mode 100644 index 000000000..ce4f82f65 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/statusDownTrainDetail.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/statusUpTrainDetail.vue b/src/jmap/components/beijing_01/menus/statusUpTrainDetail.vue new file mode 100644 index 000000000..9bd682637 --- /dev/null +++ b/src/jmap/components/beijing_01/menus/statusUpTrainDetail.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menus/utils/menuItemStatus.js b/src/jmap/components/beijing_01/menus/utils/menuItemStatus.js new file mode 100644 index 000000000..905687e5a --- /dev/null +++ b/src/jmap/components/beijing_01/menus/utils/menuItemStatus.js @@ -0,0 +1,570 @@ +import store from '@/store'; +import ModelType from '@/jlmap/model/ModelType'; +import { mapStatusEnum, getStatusObject } from '@/scripts/StatusDic'; +import { OperateMode } from '@/scripts/ConstDic'; + +export function getCurrentStatusObject() { + return getStatusObject(store.getters['menuOperation/selected']); +} + +/** 系统类型 */ +export const SystemType = { + '01': 'local', // 现地工作站 + '02': 'central', // 中心调度工作站 +}; + +export const StationControlType = { + '01': 'center', // 中控 + '02': 'station', // 站控 +}; + +// 控制禁用 +export const MenuDisabledStatus = { + Section: { + //故障解锁 + fault() { + }, + //切除 + split() { + let device = getCurrentStatusObject(); + if (device && device.cutOff != mapStatusEnum.Section.cutOff.Default) { + return true; + } + }, + //激活 + active() { + let device = getCurrentStatusObject(); + if (device && device.cutOff == mapStatusEnum.Section.cutOff.Default) { + return true; + } + }, + //区段封锁 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Section.status.Status06) { + return true; + } + }, + //区段解禁 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Section.status.Status06) { + return true; + } + }, + //区段设置限速 + setSpeed() { + }, + //区段取消限速 + cancelSpeed() { + let device = getCurrentStatusObject(); + if (device && device.speedUpperLimit == mapStatusEnum.Section.speedUpperLimit.Default) { + return true; + } + }, + //新建列车 + newTrain() { + }, + //计轴预复位 + axlePreReset() { + }, + //设置计轴有效 + alxeEffective() { + }, + //设置计轴失效 + alxeFailure() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Section.status.Status13) { + return true; + } + }, + }, + Signal: { + //进路选排 + arrangementRoute() { + + }, + //进路取消 + cancelTrainRoute() { + }, + //信号封闭 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Signal.status.Status04) { + return true; + } + }, + //信号解封 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Signal.status.Status04) { + return true; + } + }, + //信号重开 + reopenSignal() { + }, + //进路引导 + guide() { + }, + //设置联锁自动进路 + setAutoInterlock() { + }, + //取消联锁自动进路 + cancelAutoInterlock() { + }, + //设置联锁自动触发 + setAutoTrigger() { + }, + //取消联锁自动触发 + cancelAutoTrigger() { + }, + //关灯 + signalClose() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Signal.status.Status01) { + return true; + } + }, + //人工控 + humanControl() { + }, + //ats自动控 + atsAutoControl() { + }, + //查询进路状态 + detail() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Station: { + //全站设置联锁自动触发 + setAutoTrigger() { + }, + //全站取消联锁自动触发 + cancelAutoTrigger() { + }, + //上电解锁 + powerUnLock() { + }, + //执行关键操作测试 + execKeyOperationTest() { + }, + //所有进路自排开 + atsAutoControlALL() { + }, + //所有进路自排关 + humanControlALL() { + }, + //设置ZC故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消ZC故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + StationControl: { + //紧急站控 + emergencyStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status03) { + return true; + } + }, + //请求站控 + requestStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status02) { + return true; + } + }, + //强行站控 + forcedStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status02) { + return true; + } + }, + //请求中控 + requestCentralControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status01) { + return true; + } + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + StationStand: { + //设置扣车 + setDetainTrain() { + let device = getCurrentStatusObject(); + if (device && device.holdStatus != mapStatusEnum.StationStand.holdStatus.Status01) { + return true; + } + }, + //取消扣车 + cancelDetainTrain() { + let device = getCurrentStatusObject(); + if (device && device.holdStatus == mapStatusEnum.StationStand.holdStatus.Status01) { + return true; + } + }, + //强制取消扣车 + cancelDetainTrainForce() { + let device = getCurrentStatusObject(); + if (device && device.holdStatus == mapStatusEnum.StationStand.holdStatus.Status01) { + return true; + } + }, + //设置全站扣车 + cancelDetainTrainAll() { + }, + //设置运行等级 + setRunLevel() { + }, + //设置停站时间 + setStopTime() { + }, + //设置跳停 + setJumpStop() { + let device = getCurrentStatusObject(); + if (device && device.jumpStopStatus != mapStatusEnum.StationStand.jumpStopStatus.Status01) { + return true; + } + }, + //取消跳停 + cancelJumpStop() { + let device = getCurrentStatusObject(); + if (device && device.jumpStopStatus == mapStatusEnum.StationStand.jumpStopStatus.Status01) { + return true; + } + }, + //提前发车 + earlyDeparture() { + }, + //站台详细信息 + detail() { + }, + //设置折返策略 + setBackStrategy() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Switch: { + //单锁 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Switch.status.Status10) { + return true; + } + }, + //解锁 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Switch.status.Status10) { + return true; + } + }, + //封锁 + block() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Switch.status.Status14) { + return true; + } + }, + //解封 + unblock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Switch.status.Status14) { + return true; + } + }, + //强扳 + switchTurnoutForce() { + }, + //转动 + switchTurnout() { + }, + //道岔故障解锁 + fault() { + }, + //计轴预复位 + axlePreReset() { + }, + //道岔切除 + split() { + }, + //道岔激活 + active() { + }, + //道岔设置速度 + setSpeed() { + // let device = getCurrentStatusObject(); + }, + //设置计轴有效 + alxeEffective() { + }, + //道岔取消速度 + cancelSpeed() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Train: { + //添加列车识别号 + addTrainId() { + }, + //删除列车识别号 + delTrainId() { + }, + //修改列车识别号 + editTrainId() { + }, + //修改车组号 + editTrainNo() { + }, + //移动列车识别号 + moveTrainId() { + }, + //交换列车识别号 + switchTrainId() { + }, + //设置限速 + limitSpeed() { + }, + //设置通信故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消通信故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + }, + //添加计划车 + addPlanTrain() { + }, + //设置计划车 + setPlanTrain() { + }, + //设置头码车 + setHeadTrain() { + }, + //设置人工车 + setWorkTrain() { + }, + //标记重点车 + trainToFlag() { + }, + //取消标记重点车 + trainUnFlag() { + } + } +}; + +/** + * 将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) { + 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) { + let selected = store.getters['menuOperation/selected']; + let control, 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 if (selected._type == 'LimitControl') { + control = store.getters['map/getStationControlByStationCode'](selected.code); + } else { + control = store.getters['map/getStationControlByStationCode'](selected.stationCode); + } + if (control) { + let controlStatus = getStatusObject(control); + if (store.state.map.prdType != '') { + let type = SystemType[store.state.map.prdType]; + let status = StationControlType[controlStatus.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) { + let menu = []; + if (store.state.map.prdType != '') { + let type = SystemType[store.state.map.prdType]; + 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; + } + } + }); + } + } + return menu; +} + +/** + * 离开菜单以及执行完菜单取消选中状态 + */ +export function mouseCancelStatus(device) { + Object.assign(device, { _selected: false }); + let viewInstance = store.state.map.jlmap.getViewInstanceByDevice({ _type: device._type, _code: device.code }); + if (viewInstance && viewInstance['mouseleave']) { + viewInstance['selected'] = false; + viewInstance['mouseleave'](store.state.map.jlmap._zr.curEvent); + } +} \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menusPlan/addTask.vue b/src/jmap/components/beijing_01/menusPlan/addTask.vue new file mode 100644 index 000000000..10a8fd228 --- /dev/null +++ b/src/jmap/components/beijing_01/menusPlan/addTask.vue @@ -0,0 +1,163 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menusPlan/chooseTemplatePlan.vue b/src/jmap/components/beijing_01/menusPlan/chooseTemplatePlan.vue new file mode 100644 index 000000000..721ec4684 --- /dev/null +++ b/src/jmap/components/beijing_01/menusPlan/chooseTemplatePlan.vue @@ -0,0 +1,119 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menusPlan/components/dataTable.vue b/src/jmap/components/beijing_01/menusPlan/components/dataTable.vue new file mode 100644 index 000000000..6d0ad3146 --- /dev/null +++ b/src/jmap/components/beijing_01/menusPlan/components/dataTable.vue @@ -0,0 +1,203 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menusPlan/createTodayPlan.vue b/src/jmap/components/beijing_01/menusPlan/createTodayPlan.vue new file mode 100644 index 000000000..8badd98e4 --- /dev/null +++ b/src/jmap/components/beijing_01/menusPlan/createTodayPlan.vue @@ -0,0 +1,154 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menusPlan/createWeekPlan.vue b/src/jmap/components/beijing_01/menusPlan/createWeekPlan.vue new file mode 100644 index 000000000..c6f6f74b7 --- /dev/null +++ b/src/jmap/components/beijing_01/menusPlan/createWeekPlan.vue @@ -0,0 +1,127 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menusPlan/deleteTask.vue b/src/jmap/components/beijing_01/menusPlan/deleteTask.vue new file mode 100644 index 000000000..b661ed20e --- /dev/null +++ b/src/jmap/components/beijing_01/menusPlan/deleteTask.vue @@ -0,0 +1,64 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menusPlan/deleteTodayPlan.vue b/src/jmap/components/beijing_01/menusPlan/deleteTodayPlan.vue new file mode 100644 index 000000000..284028f97 --- /dev/null +++ b/src/jmap/components/beijing_01/menusPlan/deleteTodayPlan.vue @@ -0,0 +1,53 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menusPlan/managePlanList.vue b/src/jmap/components/beijing_01/menusPlan/managePlanList.vue new file mode 100644 index 000000000..ea2a60641 --- /dev/null +++ b/src/jmap/components/beijing_01/menusPlan/managePlanList.vue @@ -0,0 +1,124 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menusPlan/modifyingPlan.vue b/src/jmap/components/beijing_01/menusPlan/modifyingPlan.vue new file mode 100644 index 000000000..c9b645b7c --- /dev/null +++ b/src/jmap/components/beijing_01/menusPlan/modifyingPlan.vue @@ -0,0 +1,179 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/menusPlan/modifyingTask.vue b/src/jmap/components/beijing_01/menusPlan/modifyingTask.vue new file mode 100644 index 000000000..5f197a1ff --- /dev/null +++ b/src/jmap/components/beijing_01/menusPlan/modifyingTask.vue @@ -0,0 +1,315 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/model.js b/src/jmap/components/beijing_01/model.js new file mode 100644 index 000000000..a772b863a --- /dev/null +++ b/src/jmap/components/beijing_01/model.js @@ -0,0 +1,70 @@ +/** + * 公共字段部分默认初始值 + */ +const modelPublicInitialValue = { + Signal: { + lampPositionType: '02', + lampPostType: '02' + } +}; + +/** + * 在绘图创建Model数据时,根据皮肤类型修改公共属性默认值 + * @param {Object} model + */ +export function InitPublicProperties(model) { + if (model) { + let modelInitial = modelPublicInitialValue[model._type]; + if (modelInitial) { + for (let prop in modelInitial) { + model[prop] = modelInitial[prop]; + } + } + } + + return model; +} + +/** + * 私有字段部分默认初始值 + */ +const modelPrivateInitialValue = { + StationControl: { + indicatorShow: true //标识灯名称显示 + }, + Section: { + borderBorderShow: true, //区段边界显示 + standTrackNameShow: true, //站台轨名称显示 + reentryTrackNameShow: true, //折返轨名称显示 + transferTrackNameShow: true, //转换轨名称显示 + + }, + Signal: { + linkageAutoRouteShow: true, //联锁自动进路表示灯显示 + atsAutoTriggerShow: true //ATS自动触发表示灯显示 + }, + Train: { + nameFormat: 'targetCode:serviceNumber:tripNumber', //字体格式 + nameFontSize: 10, //字体大小 + }, + TrainWindow: { + trainWindowShow: true, + } +}; + +/** + * 加载Model数据时,根据皮肤类型修改前端私有属性默认值 + * @param {Object} model + */ +export function InitPrivateProperties(model) { + if (model) { + let modelInitial = modelPrivateInitialValue[model._type]; + if (modelInitial) { + for (let prop in modelInitial) { + model[prop] = modelInitial[prop]; + } + } + } + + return model; +} \ No newline at end of file diff --git a/src/jmap/components/beijing_01/planSchedule/index.vue b/src/jmap/components/beijing_01/planSchedule/index.vue new file mode 100644 index 000000000..31c94ac96 --- /dev/null +++ b/src/jmap/components/beijing_01/planSchedule/index.vue @@ -0,0 +1,413 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/planSchedule/menuBar.vue b/src/jmap/components/beijing_01/planSchedule/menuBar.vue new file mode 100644 index 000000000..8ee4f4a83 --- /dev/null +++ b/src/jmap/components/beijing_01/planSchedule/menuBar.vue @@ -0,0 +1,505 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/planSchedule/menuTool.vue b/src/jmap/components/beijing_01/planSchedule/menuTool.vue new file mode 100644 index 000000000..d3ecde016 --- /dev/null +++ b/src/jmap/components/beijing_01/planSchedule/menuTool.vue @@ -0,0 +1,172 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/planSchedule/schedule.vue b/src/jmap/components/beijing_01/planSchedule/schedule.vue new file mode 100644 index 000000000..a81ee9a31 --- /dev/null +++ b/src/jmap/components/beijing_01/planSchedule/schedule.vue @@ -0,0 +1,491 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/planSchedule/statusBar.vue b/src/jmap/components/beijing_01/planSchedule/statusBar.vue new file mode 100644 index 000000000..f85d6c6ce --- /dev/null +++ b/src/jmap/components/beijing_01/planSchedule/statusBar.vue @@ -0,0 +1,100 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/planSchedule/titleBar.vue b/src/jmap/components/beijing_01/planSchedule/titleBar.vue new file mode 100644 index 000000000..689c3486a --- /dev/null +++ b/src/jmap/components/beijing_01/planSchedule/titleBar.vue @@ -0,0 +1,75 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/beijing_01/shape/ImageControl.js b/src/jmap/components/beijing_01/shape/ImageControl.js new file mode 100644 index 000000000..fa17e1e11 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/ImageControl.js @@ -0,0 +1,65 @@ +/* +* ZC区域控制模式 +*/ +import Group from 'zrender/src/container/Group'; +import Image from 'zrender/src/graphic/Image'; + +export default class ImageControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = model.zIndex || 5; + this.model = model; + this.theme = theme; + this._create(model); + } + + _create(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); + } + } + + // 整体图片 + transformRotation(item) { + if (this.model.rotate) { + let origin = [this.model.position.x, this.model.position.y]; + let 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/components/beijing_01/shape/Section.js b/src/jmap/components/beijing_01/shape/Section.js new file mode 100644 index 000000000..d2939a58d --- /dev/null +++ b/src/jmap/components/beijing_01/shape/Section.js @@ -0,0 +1,1143 @@ +import Group from 'zrender/src/container/Group'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Polyline from 'zrender/src/graphic/shape/Polyline'; +import Circle from 'zrender/src/graphic/shape/Circle'; +import Line from 'zrender/src/graphic/shape/Line'; +import BezierCurve from 'zrender/src/graphic/shape/BezierCurve'; +import Text from 'zrender/src/graphic/Text'; +import JTriangle from '@/jlmap/util/JTriangle'; +import ModelType from '@/jlmap/model/ModelType'; +import store from '@/store'; + + +/** 计轴*/ +class SectionAxle extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 5; + this._create(model); + } + + _create(model) { + if (model && model.theme && model.traingle) { + let axleLength = 2 * model.theme.sectionAxleR; + let positionx = model.point.x + model.drictx * (model.traingle.GetCos(axleLength)); + let positiony = model.point.y + model.dricty * (model.traingle.GetCos(axleLength)); + + this.line = new Line({ + zlevel: this.zlevel, + z: this.z, + 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.theme.sectionAxleColor + } + }); + this.axle = new Circle({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: positionx - model.dricty * model.traingle.GetSin(axleLength), + cy: positiony + model.drictx * model.traingle.GetSin(axleLength), + r: model.theme.sectionAxleR + }, + style: { + GBaseLineWidth: 1, + stroke: model.theme.sectionAxleColor, + fill: model.theme.transparentColor + } + }); + + this.add(this.line); + this.add(this.axle); + } + } +} + +/** 分隔符*/ +class SectionSeparator extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 6; + this._create(model); + } + + _create(model) { + if (model && model.theme) { + this.partition = new Polyline({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + [model.point.x, model.point.y], + [model.point.x, model.point.y] + ] + }, + style: { + lineWidth: model.theme.sectionSeparatorWidth, + stroke: model.theme.sectionSeparatorColor + } + }); + + this.circle = new Circle({ + zlevel: this.zlevel, + z: this.z + 9, + shape: { + cx: model.point.x, + cy: model.point.y, + r: model.theme.sectionWidth + }, + style: { + stroke: model.theme.sectionInvadeColor, + GBaseLineWidth: 0.5, + fill: model.theme.transparentColor + } + }); + + this.add(this.partition); + this.setType(model.sepType, model.borderBorderShow); + } + } + + setType(type, show) { + let model = this.model; + if (model && model.theme && model.traingle) { + this.remove(this.circle); + if (type === '00') { + this.partition.setShape('points', [ + [model.point.x, model.point.y], + [model.point.x, model.point.y] + ]); + } else if (type === '01') { + this.partition.setShape('points', [ + [model.point.x, model.point.y - (model.theme.sectionWidth)], + [model.point.x, model.point.y + (model.theme.sectionWidth)] + ]); + this.add(this.partition); + } else if (type === '02') { + this.partition.setShape('points', [ + [model.point.x + model.drict * (model.theme.sectionWidth), model.point.y - (model.theme.sectionWidth * 1.5)], + [model.point.x, model.point.y - (model.theme.sectionWidth * 1.5)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 1.5)] + ]); + this.add(this.partition); + } else if (type === '03') { + this.partition.setShape('points', [ + [model.point.x + model.drict * (model.theme.sectionWidth) * 1.2, model.point.y - (model.theme.sectionWidth * 1.2)], + [model.point.x, model.point.y - (model.theme.sectionWidth * 1.2)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 1.2)], + [model.point.x + model.drict * (model.theme.sectionWidth) * 1.2, model.point.y + (model.theme.sectionWidth * 1.2)], + ]); + this.add(this.partition); + } else if (type === '04') { + this.add(this.circle); + } + } + + 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(); //可以无需调用 + } + + if (this.partition) { + if (type === '03' && !show) { + this.partition.hide(); + } else { + this.partition.show(); + } + } + } +} + +/** 创建区段限速限集合*/ +class LimitLines 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) { + let 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, + z: this.z + 10, + culling: true, + shape: shape, + position: model.position, + style: { + lineWidth: model.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor, + fillOpacity: 0, + } + })); + } else { + let swPadding = model.theme.switchLen; //定位和反位时区段距离岔芯的距离 + var switchWidth = model.theme.sectionWidth + model.theme.sectionBeyondWidth; // 道岔宽度 + let beg = Object.assign({}, model.points[0]); + let end = Object.assign({}, model.points[model.points.length - 1]); + if (model.isSwitchSection && beg.y !== end.y) { + let swch = store.getters['map/getDeviceByCode'](model.relSwitchCode); + if (swch) { + let 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, + z: this.z, + position: model.position, + shape: { + x1: beg.x, + y1: beg.y, + x2: end.x, + y2: end.y, + }, + style: { + lineWidth: model.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } else { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + + for (let i = 1; i < (model.points.length - 2); i++) { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + z: this.z, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } + + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + z: this.z, + position: model.position, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } + } + } + } +} + +/** 创建区段线集合*/ +class Lines 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) { + let 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, + z: this.z + 10, + culling: true, + shape: shape, + style: { + lineWidth: model.theme.sectionWidth, + stroke: model.theme.sectionSpareColor, + fillOpacity: 0, + } + })); + } else { + for (let i = 0; i < (model.points.length - 1); i++) { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + 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.theme.sectionWidth, + stroke: model.theme.sectionSpareColor, + } + })); + } + } + + if (!model.isSwitchSection) { + this.lineBorder = new Rect({ + zlevel: this.zlevel, + z: this.z - 1, + silent: true, + shape: this.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: model.theme.borderColor, + fill: model.theme.transparentColor + } + }) + + this.add(this.lineBorder); + } + } + } + + 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(); + } + } +} + +/** 区段*/ +export default class Section extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.selected = false; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = model.layer || 0; + this._create(model); + + this.on('mousedown', this.mouseclick); + this.on('mouseout', this.mouseleave); + this.on('mouseover', this.mouseenter); + } + + _create(model) { + //01:物理区段;02逻辑区段;03道岔区段 + this.createSectionText(); //创建区段文字 + if (model.sectionType === '01' && ( + model.logicSectionNum.length <= 0 || + model.logicSectionNum.length == 1 && model.logicSectionNum[0] == 0) || + model.sectionType === '02') { + this.createSection(); //创建区段 + this.createSeparator(); //创建分隔符 + if (model.sectionType === '01') { + this.createAxles(); //创建计轴 + } + this.setStatus(model); + } + + this.mouseStatusRecover(); + } + + /** 创建区段*/ + createSection() { + let model = this.model; + let theme = this.theme; + + //创建区段 + this.section = new Lines({ + zlevel: this.zlevel, + z: this.z, + isSwitchSection: model.isSwitchSection, + isCurve: model.isCurve, + points: model.points, + theme: theme + }); + + //创建延时释放 + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + this.release = new Line({ + zlevel: model.zlevel + 1, + 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), + }, + style: { + lineWidth: theme.sectionWidth, + stroke: theme.sectionSpareColor + } + }); + + let x = traingle.drictx * (theme.sectionSpeedLimitDistance) * traingle.GetSinRate(); + let y = traingle.dricty * (theme.sectionSpeedLimitDistance) * traingle.GetCosRate(); + if (x == Infinity) { x = 0; } + if (y == Infinity) { y = 0; } + + //创建限速线 + this.speedLimitLeft = new LimitLines({ + zlevel: this.zlevel + 4, + z: this.z, + position: [x, -y], + isCurve: model.isCurve, + points: model.points, + isSwitchSection: model.isSwitchSection, + relSwitchCode: model.relSwitchCode, + theme: theme, + }); + + this.speedLimitRight = new LimitLines({ + zlevel: this.zlevel + 4, + z: this.z, + position: [-x, y], + isCurve: model.isCurve, + points: model.points, + isSwitchSection: model.isSwitchSection, + relSwitchCode: model.relSwitchCode, + theme: theme, + }); + + this.add(this.section); + this.add(this.release); + this.add(this.speedLimitLeft); + this.add(this.speedLimitRight); + } + + /** 创建区段名称*/ + createSectionText() { + let model = this.model; + let theme = this.theme; + + if (model && theme) { + //计算区段坐标位置 + let 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 + model.namePoint.x; + let 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 + model.namePoint.y; + + /**区段名称*/ + if (model.nameShow) { + let tempx = x; + let tempy = y - (theme.sectionWidth + theme.textFontSize + theme.nameDistance); + + //如果不是道岔区段 + if (model.sectionType !== '03') { + //如果逻辑区段,让名称和区段距离减少 + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + if (model.sectionType === '02') { + tempx += traingle.GetSin(theme.textFontSize * 0.8 + theme.nameDistance); + tempy += traingle.GetCos(theme.textFontSize * 0.8 + theme.nameDistance) - theme.textFontSize * 2; + let parent = store.getters['map/getDeviceByCode'](model.parentCode); + if (parent) { + model.name = `${parent.name}-${model.name}`; + } + } + } + + //创建区段名称 + let fontSize = theme.sectionType == '02' ? theme.textFontSize + 2 : theme.textFontSize; + this.sectionText = new Text({ + _subType: 'Text', + zlevel: this.zlevel + 3, + z: 6, + style: { + x: tempx, + y: tempy, + text: model.name, + textFont: fontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside' + } + }); + this.add(this.sectionText); + + if (!model.isSwitchSection) { + this.sectionTextBorder = new Rect({ + zlevel: model.zlevel + 3, + z: 5, + shape: this.sectionText.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: '#fff', //白色 + fill: model.sectionType == '02' ? theme.sectionLogicalBackgroundColor : '#00FFFF' //蓝色 + } + }) + this.add(this.sectionTextBorder); + } + + this.sectionTextShadow = new Text({ + zlevel: this.zlevel + 3, + z: 5, + position: [4, -2], + silent: true, + style: { + x: tempx, + y: tempy, + text: model.name, + textFill: theme.textShadowColor, //黄色 + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: 'bold ' + (fontSize + 1) + 'px ' + theme.textFontFormat + } + }) + this.add(this.sectionTextShadow); + } + + /**站台轨名称*/ + if (model.isStandTrack && model.standTrackNameShow) { + let tempx = x; + let tempy = y; + + //计算文字和物理区段的距离 + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + tempx += traingle.GetSin(theme.nameDistance); + tempy += traingle.GetCos(theme.nameDistance); + + //创建站台轨名称 + this.standTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: tempx + model.standTrackNamePosition.x, + y: tempy + model.standTrackNamePosition.y, + text: model.standTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.standTrackText); + + } + + /**折返轨名称*/ + if (model.isReentryTrack && model.reentryTrackNameShow) { + //创建折返轨名称 + this.reentryTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.reentryTrackNamePosition.x, + y: y + model.reentryTrackNamePosition.y + theme.nameDistance + theme.textFontSize, + text: model.reentryTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.reentryTrackText); + } + + /**转换轨名称*/ + if (model.isTransferTrack && model.transferTrackNameShow) { + //转换轨名称 + this.transferTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.transferTrackNamePosition.x, + y: y + model.transferTrackNamePosition.y + theme.nameDistance + theme.textFontSize * 2, + text: model.transferTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.transferTrackText); + } + + /**目的码名称*/ + if (model.destinationCode && model.destinationCodeShow) { + //转换轨名称 + this.destinationText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.destinationCodePoint.x, + y: y + model.destinationCodePoint.y, + text: model.destinationCode, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.destinationTextFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.destinationText); + } + } + } + + /** 创建计轴*/ + createAxles() { + let model = this.model; + let theme = this.theme; + + /** 创建四个计轴*/ + let traingle = null; + if (model && theme && model.isShowAxle && model.points && model.points.length > 1) { + traingle = new JTriangle(model.points[0], model.points[1]); + this.lUpAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: -1, + traingle: traingle + }); + this.lBottomAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: 1, + traingle: traingle + }); + + traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); + this.rUpAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: -1, + traingle: traingle + }); + this.rBottomAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: 1, + traingle: traingle + }); + + this.add(this.lUpAxle); + this.add(this.rUpAxle); + this.add(this.lBottomAxle); + this.add(this.rBottomAxle); + } + } + + /** 创建分隔符*/ + createSeparator() { + let model = this.model; + let theme = this.theme; + let traingle = null; + + if (model && theme && model.points && model.points.length > 1) { + /** 创建左侧分隔符*/ + traingle = new JTriangle(model.points[0], model.points[1]); + this.lPartition = new SectionSeparator({ + theme: theme, + borderBorderShow: model.borderBorderShow, + zlevel: this.zlevel - 2, + traingle: traingle, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + sepType: model.l.sepType, + drict: -1 + }); + + /** 创建右侧分隔符*/ + traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); + this.rPartition = new SectionSeparator({ + theme: theme, + borderBorderShow: model.borderBorderShow, + zlevel: this.zlevel - 2, + traingle: traingle, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + sepType: model.r.sepType, + drict: 1 + }); + + /** 添加视图*/ + this.add(this.lPartition); + this.add(this.rPartition); + } + } + + /** 设置区段集合显隐*/ + setInvisible() { + let invisible = this.model.sectionType === '02' && this.model.isShowLogical; + this.eachChild((child) => { + child.attr('invisible', invisible); + }); + } + + /** 设置区段恢复默认状态*/ + recover() { + if (this.section) { + this.section.stopAnimation(true); + this.section.setStyle({ + fill: this.theme.backgroundColor, + stroke: this.theme.sectionSpareColor, + lineWidth: this.theme.sectionWidth + }); + + this.release.hide(); + this.speedLimitLeft.hide(); + this.speedLimitRight.hide(); + } + } + + /** 未定义状态*/ + undefine() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionUndefinedColor, + lineWidth: this.theme.sectionWidth + }); + } + } + + /** 空闲状态*/ + spare() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionSpareColor, + lineWidth: this.theme.sectionWidth + }); + } + } + + /** 通信车占用状态*/ + communicationOccupied() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionCommunicationOccupiedColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 非通信车占用状态*/ + unCommunicationOccupied() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionUnCommunicationOccupiedColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 进路锁闭*/ + routeLock() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionRouteLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 封锁*/ + block() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionBlockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 故障锁定状态*/ + faultLock() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionFaultLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** atc切除状态*/ + atcExcision() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionAtcExcisionColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** ats切除状态*/ + atsExcision() { + if (this.section) { + this.atcExcision(); + this.section.animateStyle(true, [ + { time: 1000, styles: { stroke: this.theme.backgroundColor, } }, + { time: 2000, styles: { stroke: this.theme.sectionAtsExcisionColor, lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth } } + ]); + } + } + + /** 保护区段锁闭*/ + protectiveLock() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionProtectiveLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + } + } + + /** 延时释放*/ + timeRelease() { + if (this.release) { + this.section.setStyle({ + stroke: this.theme.sectionRouteLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + this.release.show(); + this.release.setStyle('lineWidth', this.theme.sectionWidth + this.theme.sectionBeyondWidth); + this.release.setStyle('stroke', this.theme.sectionRouteLockColor); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.sectionRouteLockColor }) + .when(2000, { stroke: this.theme.sectionTimeReleaseColor }) + .start(); + } + } + + /** 保护区段延时解锁*/ + protectiveTimeRelease() { + if (this.release) { + this.section.setStyle({ + stroke: this.theme.sectionProtectiveLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + this.release.show(); + this.release.setStyle('lineWidth', this.theme.sectionWidth + this.theme.sectionBeyondWidth); + this.release.setStyle('stroke', this.theme.sectionProtectiveLockColor); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.sectionProtectiveLockColor }) + .when(2000, { stroke: this.theme.sectionProtectiveTimeReleaseColor }) + .start(); + } + } + + /** 区段切除*/ + sectionCutOff() { + if (this.release) { + let lineWidth = this.theme.sectionWidth + (this.model.status != '01' ? this.theme.sectionBeyondWidth : 0); + this.section.animateStyle(true, [ + { time: 0, styles: { lineWidth: lineWidth } }, + { time: 1000, styles: { stroke: this.theme.backgroundColor, } }, + { time: 2000, styles: { lineWidth: lineWidth } }, + ]); + } + } + + /** 设置限速*/ + setSpeedUpperLimit() { + if (this.section) { + this.speedLimitLeft.show(); + this.speedLimitRight.show(); + } + } + + /** 计轴预复位*/ + axleReset() { + if (this.release) { + this.release.show(); + this.release.setStyle({ + stroke: this.theme.sectionAxleResetColor + }); + } + } + + /** 计轴失效*/ + alxeFailure() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionAxleFailure, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 设置状态*/ + setStatus(model) { + this.recover(); + 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(); + } + } + + /** 区段切除*/ + if (model.cutOff) { + this.sectionCutOff(); + } + + /** 是否限速*/ + if (model.speedUpperLimit >= 0) { + this.setSpeedUpperLimit(); + } + } + + /** 计算提示位置*/ + getShapeTipPoint() { + let rect = this.getBoundingRect(); + let distance = this.theme.sectionWidth / 2; + if (this.section) { + rect = this.section.getBoundingRect(); + if (this.model.sectionType !== '02' && this.model.nameShow) { + if (this.model.trainPosType == '01') { + distance = distance + this.theme.nameDistance + this.theme.textFontSize; + } + } + } + + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2.7 - distance + }; + } + + setTrainWindowEventShow(show) { + let trainWindowCode = this.model.trainWindowCode; + if (this.model.isSwitchSection && this.model.parentCode) { + let device = store.getters['map/getDeviceByCode'](this.model.parentCode); + if (device) { + trainWindowCode = device.trainWindowCode; + } + } + + let trainWindow = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.TrainWindow, _code: trainWindowCode }); + if (trainWindow) { + trainWindow.setTrainWindowEventShow(show); + } + } + + mouseStatusVisible(subType) { + this.setTrainWindowEventShow(true); + if (this.model.isSwitchSection) { + if (subType == 'Text') { + this.sectionTextShadow && this.sectionTextShadow.show(); + } else { + // 道岔区段 + let refSwitch = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Switch, _code: this.model.relSwitchCode }); + refSwitch && refSwitch.mouseStatusVisible(); + } + } else { + this.section && this.section.setBorderVisible(true); + this.sectionTextBorder && this.sectionTextBorder.show(); + this.sectionText && this.sectionText.setStyle({ textFill: '#000' }); + if (this.model.sectionType == '02' && this.model.parentCode) { + this.sectionText && this.sectionText.show(); + } + } + } + + mouseStatusRecover() { + this.setTrainWindowEventShow(false); + this.sectionTextShadow && this.sectionTextShadow.hide(); + if (this.model.isSwitchSection) { + // 道岔区段 + let refSwitch = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Switch, _code: this.model.relSwitchCode }); + refSwitch && refSwitch.mouseStatusRecover(); + } else { + this.section && this.section.setBorderVisible(false); + this.sectionTextBorder && this.sectionTextBorder.hide(); + this.sectionText && this.sectionText.setStyle({ textFill: '#fff' }); + if (this.model.sectionType == '02' && this.model.parentCode) { + this.sectionText && this.sectionText.hide(); + } + } + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusVisible(e.target._subType); + } + } + } + + mouseenter(e) { + if (!this.selected) { + this.mouseStatusVisible(e.target._subType); + } + } + + mouseleave(e) { + if (!this.selected) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/beijing_01/shape/Signal.js b/src/jmap/components/beijing_01/shape/Signal.js new file mode 100644 index 000000000..908a12e3f --- /dev/null +++ b/src/jmap/components/beijing_01/shape/Signal.js @@ -0,0 +1,1037 @@ +/* +* 信号机 +*/ +import Line from 'zrender/src/graphic/shape/Line'; +import Text from 'zrender/src/graphic/Text'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +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'; +import { arrows, triangular } from './libs/ShapePoints'; + +class Lamp extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + this.lamp = new Arc({ + name: model.index, + zlevel: this.zlevel + 1, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: model.theme.signalR + }, + style: { + lineWidth: 0.5, + fill: model.theme.backgroundColor, + stroke: model.theme.signalLampStandardColor + } + }); + + let shapeDate; + if (model.highType === '01') { + // 矮柱 + if (model.drict != 1) { + // 左侧 + shapeDate = { + x: model.origin.x + model.drict * model.lampCount * 2 * model.theme.signalR - 2.5, + y: model.origin.y + model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } else { + shapeDate = { + x: model.origin.x - model.drict + 1.5, + y: model.origin.y - model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } + } else { + // 高柱 + if (model.drict != 1) { + // 左侧 + shapeDate = { + x: model.origin.x + model.drict * model.lampCount * 2 * model.theme.signalR - 2.5 - 3, + y: model.origin.y + model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } else { + shapeDate = { + x: model.origin.x - model.drict + 1.5 + 3, + y: model.origin.y - model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } + } + + this.lampRect = new Rect({ + zlevel: this.zlevel - 1, + z: this.z, + shape: shapeDate, + style: { + lineWidth: 0.4, + stroke: model.theme.signalBlockColor, + } + }); + + this.lstop = new Line({ + zlevel: this.zlevel + 1, + z: this.z, + origin: model.origin, + rotation: -Math.PI / 180 * model.rotate, + shape: { + x1: model.position.x + (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y1: model.position.y + (model.theme.signalR + 1) * Math.sin(Math.PI / 4), + x2: model.position.x - (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y2: model.position.y - (model.theme.signalR + 1) * Math.sin(Math.PI / 4) + }, + style: { + lineWidth: 1, + stroke: model.theme.backgroundColor, + } + }); + + this.rstop = new Line({ + zlevel: this.zlevel + 1, + z: this.z, + origin: model.origin, + rotation: -Math.PI / 180 * model.rotate, + shape: { + x1: model.position.x + (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y1: model.position.y + (model.theme.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)), + x2: model.position.x - (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y2: model.position.y - (model.theme.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)) + }, + style: { + lineWidth: 1, + stroke: model.theme.backgroundColor, + } + }); + this.add(this.lamp); + } + + setColor(color) { + if (color) { + this.lamp.setStyle('fill', color); + } + } + + // 两条交叉黑线 + setStop(has) { + if (has) { + this.add(this.lstop); + this.add(this.rstop); + } else { + this.remove(this.lstop); + this.remove(this.rstop); + } + } + + // 功能封锁矩形框 + setRectBlock(has) { + if (has) { + this.lampRect.attrKV('rotation', -Math.PI / 180 * this.model.rotate); + this.lampRect.attrKV('origin', [this.model.origin.x, this.model.origin.y]); + this.add(this.lampRect); + } else { + this.remove(this.lampRect); + } + } +} + +// 自动进路箭头 +class AutoSig extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + let rotation = Math.PI; + if (model.drict != 1) { + // 右侧 + rotation = 0; + } + + // 箭头 + let x = model.position.x + model.drict * (model.lampCount * model.theme.signalR + model.theme.signalLampStandardWidth) * 2; + let y = model.position.y - model.theme.signalLampStandardWidth; + this.arrowsControl = new Polygon({ + zlevel: this.zlevel, + rotation: rotation, + origin: [x, y], + shape: { + points: arrows(x, y, model.theme.stationControlDistance / 8, model.theme.signalR * 0.8) + }, + style: { + stroke: model.theme.sidelineColor, + lineWidth: 0.6, + fill: model.theme.signalLampGreenColor + } + }); + this.add(this.arrowsControl); + } + + // 停止动画 + animationRecover() { + this.arrowsControl.stopAnimation(false); + } + + // 箭头颜色 + setColor(color) { + if (color) { + this.arrowsControl.setStyle('fill', color); + } + } + + // 箭头闪烁 + arrowsAnimation() { + let fill = this.arrowsControl.style.fill; + let theme = this.model.theme; + this.arrowsControl.animate('style', true) + .when(1000, { fill: theme.backgroundColor, stroke: theme.backgroundColor }) + .when(2000, { fill: fill, stroke: theme.sidelineColor }) + .when(3000, { fill: theme.backgroundColor, stroke: theme.backgroundColor }) + .when(4000, { fill: fill, stroke: theme.sidelineColor }) + .start(); + } +} + +// 运行方向三角 +class JSigDrict extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + // 箭头 + this.sigDrict = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + // points: triangular(model.position.x, model.position.y + model.drict * model.theme.signalLampStandardWidth, model.drict, model.theme.signalR), + points: triangular(model.position.x, model.position.y, model.drict, model.theme.signalR), + }, + style: { + stroke: model.theme.backgroundColor, + lineWidth: 0.5, + fill: model.theme.signalLampYellowColor + } + }); + this.add(this.sigDrict); + } +} + +// 信号灯 几灯、高柱等 +class JSiglamp extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this.lamps = new Group(); + this.poles = new Group(); + this._subType = 'SignalLamp'; + this._val = '3'; /** 信号机*/ + this._create(model); + } + + _create(model) { + this.text = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x + model.namePosition.x, + y: model.position.y + model.posit * (model.theme.signalR + model.namePosition.y), + text: model.name, + textAlign: 'middle', + textVerticalAlign: model.posit === 1 ? 'top' : 'bottom', + textFont: 'bold ' + (model.theme.textFontSize + 1) + 'px ' + model.theme.textFontFormat, + textFill: model.theme.signalTextColor, + textBorderColor: model.theme.signalBlockColor, + textBorderWidth: 0 + } + }); + + this.ver = new Polyline({ + zlevel: this.zlevel, + z: this.z - 2, + shape: { + points: [ + [model.position.x, model.position.y + model.theme.signalR], + [model.position.x, model.position.y - model.theme.signalR] + ] + }, + style: { + lineWidth: model.theme.signalLampStandardWidth, + stroke: model.theme.signalLampStandardColor + } + }); + + this.hor = new Polyline({ + zlevel: this.zlevel, + z: this.z - 1, + shape: { + points: [ + [model.position.x, model.position.y], + [model.position.x + model.drict * model.theme.signalR, model.position.y] + ] + }, + style: { + lineWidth: model.theme.signalLampStandardWidth, + stroke: model.theme.signalLampStandardColor + } + }); + + this.add(this.lamps); + this.add(this.poles); + this.setShowName(model.isShowName); + this.setShowHighSigType(model.highType); + + //旋转 + if (model.rotate) { + this.transformRotation(this.ver); + this.transformRotation(this.hor); + } + } + + // border显示 + setBorderVisible(isVisible) { + if (isVisible) { + this.textBorder.show(); + this.lampsBorder.show(); + } else { + this.textBorder.hide(); + this.lampsBorder.hide(); + } + } + + // 设置显示信号灯名称 + setShowName(isShow) { + if (isShow) this.add(this.text); else this.remove(this.text); + } + + // 显示信号灯名称边框 + setNameBorder(width) { + this.text.setStyle('textBorderWidth', width); + } + + // 显示信号灯名称颜色 + setNameColor(color) { + this.text.setStyle({ textFill: color }); + } + + setShowHighSigType(type) { + let model = this.model; + this.lamps.removeAll(); + this.poles.removeAll(); + this.poles.add(this.ver); + if (type === '01') this.poles.remove(this.hor); else this.poles.add(this.hor); + let highPosition = this.getEndPosition(model.highType); + for (let i = 0; i < model.lampCount; i++) { + let lamp = new Lamp({ + theme: model.theme, + zlevel: this.zlevel, + lampCount: model.lampCount, + position: { + x: highPosition.x + i * model.drict * model.theme.signalR * 2, + y: highPosition.y + }, + index: i + 1, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + drict: model.drict, + highType: model.highType, + }); + this.lamps.add(lamp); + } + + this.sigDriction = new JSigDrict({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: model.position.x - model.theme.signalLampStandardWidth * model.drict, + y: model.position.y + model.theme.signalLampStandardWidth + }, + drict: model.drict, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + }); + + this.autoSig = new AutoSig({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: highPosition.x, + y: highPosition.y + }, + lampCount: model.lampCount, + drict: model.drict, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + }); + + //旋转 + if (model.rotate) { + this.transformRotation(this.sigDriction); + this.transformRotation(this.autoSig); + this.transformRotation(this.lamps); + } + + let rect = this.lamps.getBoundingRect(); + rect.union(this.hor.getBoundingRect()); + this.lampsBorder = new Rect({ + zlevel: this.zlevel, + z: this.z - 3, + silent: true, + shape: rect, + style: { + lineDash: [3, 3], + stroke: model.theme.borderColor, + fill: model.theme.transparentColor + } + }); + + this.textBorder = new Rect({ + zlevel: this.zlevel, + z: this.z - 1, + silent: true, + shape: this.text.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: model.theme.borderColor, + fill: model.theme.borderContextBackgroundColor + } + }); + + this.add(this.lampsBorder); + this.add(this.textBorder); + } + + // 整体旋转信号灯 + transformRotation(item) { + if (this.model.rotate) { + let origin = [this.model.position.x, this.model.position.y]; + let rotation = -Math.PI / 180 * Number(this.model.rotate); + item.origin = origin; + item.rotation = rotation; + item.dirty(); + } + } + + setColorByIndex(index, color) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setColor(color); + return; + } + } + } + + setStopByIndex(index, has) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setStop(has); + return; + } + } + } + + setRectBlockByIndex(index, has) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setRectBlock(has); + return; + } + } + } + + setAnimation() { + this.autoSig.arrowsAnimation(); + } + + setRecover() { + this.autoSig.animationRecover(); + } + + setColorSig(color) { + this.autoSig.setColor(color); + } + + getEndPosition(type) { + if (type === '01') { + return { + x: this.model.position.x + this.model.drict * this.model.theme.signalR * 3 / 2, + y: this.model.position.y + }; + } else { + return { + x: this.hor.shape.points[1][0] + this.model.drict * this.model.theme.signalR, + y: this.hor.shape.points[1][1] + }; + } + } + + setShowSigDrict(showSigDrict) { + if (showSigDrict) this.add(this.sigDriction); else this.remove(this.sigDriction); + } + + setAutoSig(isShow) { + if (isShow) this.add(this.autoSig); else this.remove(this.autoSig); + } + + getShapeTipPoint() { + if (this.lamps) { + var distance = this.model.theme.signalR; + this.lamps.dirty(); + let rect = this.lamps.getBoundingRect(); + return { + x: rect.x + Math.cos(Number(this.model.rotate)) * rect.width / 2 || (this.model.position.x), + y: rect.y + Math.cos(Number(this.model.rotate)) * rect.height / 2 - distance || (this.model.position.y - distance) + }; + } + return null; + } +} + +/** 按钮*/ +class SigButton extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this._subType = 'SignalButton'; + this.z = 10; + this._create(model); + } + + _create(model) { + this.sigNormalButtom = new Rect({ + zlevel: this.zlevel, + z: this.z, + _subType: this._subType, + _val: '1', + shape: { + x: model.position.x - model.theme.signalR, + y: 0, + width: model.theme.signalR * 2, + height: model.theme.signalR * 2 + }, + style: { + lineWidth: 0.2, + stroke: model.theme.signalButtonDashColor, + fill: model.theme.signalButtonColor + }, + }); + + this.sigNormalButtomDown = new Polyline({ + zlevel: this.zlevel, + z: this.z + 1, + silent: true, + shape: { points: [] }, + style: { + lineWidth: 0.8, + stroke: model.theme.backgroundColor + } + }); + + this.sigReentryButton = new Circle({ + zlevel: this.zlevel, + z: this.z, + _subType: this._subType, + _val: '2', //折返按钮 + shape: { + cx: model.position.x, + cy: 0, + r: model.theme.signalR + }, + style: { + lineWidth: 0.2, + stroke: model.theme.signalButtonDashColor, + fill: model.theme.signalButtonColor + }, + }); + + this.sigReentryButtonDown = new Arc({ + zlevel: this.zlevel, + z: this.z + 1, + silent: true, + shape: { + cx: 0, + cy: 0, + r: 0, + startAngle: Math.PI * 8 / 5, + endAngle: Math.PI * 4 / 5, + clockwise: false + }, + style: { + lineWidth: 0.8, + stroke: model.theme.backgroundColor, + } + }); + + this.add(this.sigNormalButtom); + this.add(this.sigReentryButton); + this.setSigDrict(); + } + + setSigDrict() { + let padding = 1; + let model = this.model; + let r = model.theme.signalR * 0.8; + if (model.drict === 1) { + this.sigNormalButtom.attrKV('shape', { + y: model.position.y - 1 / 2 * r + }); + this.sigReentryButton.attrKV('shape', { + cy: model.position.y - 5 / 2 * r + }); + } else { + this.sigReentryButton.attrKV('shape', { + cy: model.position.y + 5 / 2 * r + }); + this.sigNormalButtom.attrKV('shape', { + y: model.position.y - 3 / 2 * r + }); + } + + this.sigNormalButtomDown.attrKV('shape', { + points: [ + [model.position.x - padding + r, this.sigNormalButtom.shape.y + padding], + [model.position.x + padding - r, this.sigNormalButtom.shape.y + padding], + [model.position.x + padding - r, this.sigNormalButtom.shape.y + padding * 2 + r], + ] + }); + + this.sigReentryButtonDown.attrKV('shape', { + cx: this.sigReentryButton.shape.cx, + cy: this.sigReentryButton.shape.cy, + r: this.sigReentryButton.shape.r - padding + }); + } + + colorRecover() { + this.sigNormalButtom.setStyle('fill', this.model.theme.signalButtonColor); + this.sigReentryButton.setStyle('fill', this.model.theme.signalButtonColor); + } + + animationRecover() { + this.sigNormalButtom.stopAnimation(true); + this.sigReentryButton.stopAnimation(true); + } + + recover() { + this.colorRecover(); + this.animationRecover(); + } + + setButtonStatus(buttonStatus) { + switch (buttonStatus) { + case '00': + case '01': { + this.remove(this.sigNormalButtomDown); + this.remove(this.sigReentryButtonDown); + this.recover(); + } break; + case '02': { + this.add(this.sigNormalButtomDown); + } break; + case '03': { + this.add(this.sigReentryButtonDown); + } break; + case '04': { + this.remove(this.sigNormalButtomDown); + this.sigNormalButtom.animateStyle(true) + .when(1000, { + fill: this.model.theme.signalButtonLightenColor + }) + .when(2000, { + fill: this.model.theme.backgroundColor + }) + .start(); + } break; + case '05': { + this.remove(this.sigReentryButtonDown); + this.sigReentryButton.animateStyle(true) + .when(1000, { + fill: this.model.theme.signalButtonLightenColor + }) + .when(2000, { + fill: this.model.theme.backgroundColor + }) + .start(); + } break; + } + } + + getShapeTipPoint(val) { + var view = null; + switch (val) { + case '1': { + view = this.sigNormalButtom; + break; + } + case '2': { + view = this.sigReentryButton; + break; + } + default: { + break; + } + } + if (view) { + var distance = 2; + var rect = view.getBoundingRect(); + return { + x: rect.x + rect.width / 2, + y: rect.y - distance + }; + } + return null; + } +} + +export default class Signal extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.selected = false; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.lampCount = parseInt(model.lampPositionType); + this._create(model, theme); + + this.on('mousedown', this.mouseclick); + this.on('mouseout', this.mouseleave); + this.on('mouseover', this.mouseenter); + } + + _create(model, theme) { + var drict = model.directionType === '01' ? -1 : 1; + var posit = model.positionType === '01' ? -1 : 1; + // 信号灯文字说明 + this.siglamp = new JSiglamp({ + theme: theme, + zlevel: this.zlevel, + position: { + x: model.position.x, + y: model.position.y + posit * theme.signalDistance + }, + drict: drict, + posit: posit, + name: model.name, + namePosition: model.namePosition, + isShowName: model.nameShow, + highType: model.lampPostType, + lampCount: parseInt(model.lampPositionType), + showSigDrict: this.showSigDrict, + pop: true, + rotate: model.rotate, + }); + + // 信号灯按钮 + this.sigButton = new SigButton({ + theme: theme, + zlevel: this.zlevel, + position: { + x: model.buttonPosition.x, + y: model.buttonPosition.y - posit * theme.signalDistance + }, + drict: posit, + pop: false, + }); + + this.add(this.siglamp); + this.setStatus(model); + this.mouseStatusRecover(); + } + + setButtonStatus(model) { + if (model.buttonShow) { + this.add(this.sigButton); + } else { + this.remove(this.sigButton); + } + + if (this.sigButton) { + this.sigButton.setButtonStatus(model.buttonStatus); + } + } + + setShowSigDrict(isShow) { + this.siglamp.setShowSigDrict(isShow); + } + + setAutoSig(isShow) { + this.siglamp.setAutoSig(isShow); + } + + setShowHighSigType(hightp) { + if (this.siglamp) { + this.highType = hightp; + this.siglamp.setShowHighSigType(hightp); + } + } + + isPop(e) { + for (var i = 0; i < this.childCount(); i++) { + let rect = this.childAt(i).getBoundingRect(); + if (rect.contain(e.offsetX, e.offsetY) && this.childAt(i).pop) { + return true; + } + } + } + + //关闭 + close() { + if (this.lampCount === 1) { + if (this.model.useType === '05') { + /** 单灯 调车信号机*/ + this.siglamp.setColorByIndex(1, this.theme.signalLampBlueColor); + } else { + /** 单灯 出站信号机 */ + /** 单灯 阻挡信号机*/ + /** 单灯 阻挡兼调车信号 */ + /** 单灯 列兼调信号机 */ + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + } + } + } + + //开放 + open() { + if (this.lampCount === 1) { + /** 单灯 出站信号机*/ + /** 单灯 阻隔信号机*/ + this.siglamp.setColorByIndex(1, this.theme.signalLampGreenColor); + } + } + + + //列车进路 + trainRoute() { + if (this.lampCount === 1) { + /** 单灯 列兼调信号*/ + this.siglamp.setColorByIndex(1, this.theme.signalLampYellowColor); + } + } + + //调车进路 + shuntRoute() { + if (this.lampCount === 1) { + /** 单灯 列兼调信号*/ + /** 单灯 阻挡兼调车信号*/ + this.siglamp.setColorByIndex(1, this.theme.signalLampWhiteColor); + } + } + + //引导 + guid() { + // if (this.lampCount === 1 && this.model.lightType === '01') { /** 双灯 物理点灯 允许引导信号*/ + // this.siglamp.setStopByIndex(1, false); + // this.siglamp.setStopByIndex(2, false); + // this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + // this.siglamp.setColorByIndex(2, this.theme.signalLampYellowColor); + // } + } + + //封锁 + block() { + // this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setNameBorder(1); + } + + //功能封锁 + functionBlock() { + // this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + // this.siglamp.setRectBlockByIndex(1, true); + } + + //信号保护区段监视状态显示 + signalblock() { + // this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + // this.siglamp.setNameColor(this.theme.signalLampGreenColor); + } + + //故障 + fault() { + // if (this.lampCount === 2 && this.model.lightType === '01') { /** 双灯 物理点灯*/ + // this.siglamp.setStopByIndex(1, false); + // this.siglamp.setStopByIndex(2, false); + // this.siglamp.setColorByIndex(1, this.theme.signalLampBlueColor); + // this.siglamp.setColorByIndex(2, this.theme.signalLampBlueColor); + // } + } + + //物理点灯 + logicalLight() { + for (var i = 0; i < this.lampCount; i++) { + this.siglamp.setStopByIndex(i + 1, false); + } + } + + //逻辑点灯 + physicsLight() { + for (var i = 0; i < this.lampCount; i++) { + this.siglamp.setStopByIndex(i + 1, true); + } + } + + //设置自动进路模式状态类型 + setAutoRouteOpen() { + if (this.model.linkageAutoRouteShow) { + this.siglamp.setAutoSig(true); + } else { + this.siglamp.setAutoSig(false); + } + + this.siglamp.setRecover(); + this.siglamp.setColorSig(this.theme.signalLampGreenColor); + } + + //信号机进路自动触发模式状态类型 + setAutoAccessOpen() { + if (this.model.atsAutoTriggerShow) { + this.siglamp.setAutoSig(true); + } else { + this.siglamp.setAutoSig(false); + } + + this.siglamp.setRecover(); + this.siglamp.setColorSig(this.theme.signalLampYellowColor); + } + + //设置自动信号模式状态类型 + setAutoSignalOpen() { + this.siglamp.setShowSigDrict(true); + } + + //隐藏自动信号和自动进路 + setAutoClose() { + this.siglamp.setColorSig(this.theme.backgroundColor); + this.siglamp.setAutoSig(false); + this.siglamp.setShowSigDrict(false); + } + + //自动信号和自动进路开始动画 + setAutoFlicker() { + this.siglamp.setAnimation(); + } + + //恢复状态 + recover() { + this.siglamp.setRecover(); + } + + setStatus(model) { + this.recover(); + + /** 设置状态 (点灯类型)*/ + switch (model.status) { + case '01': { this.close(); } break; //关闭 + case '02': { this.open(); } break; //开放 + case '03': { this.guid(); } break; //引导 + case '04': { this.block(); } break; //封锁 + case '05': { this.fault(); } break; //故障 + case '06': { this.block(); } break; //功能封锁 + case '07': { this.signalblock(); } 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.setAutoAccessOpen(); } break; // 显示 信号机进路自动触发模式状态类型 + } + + /** 信号机进路办理,先停止动画,再判断当前颜色是否闪烁*/ + if (model.routeSetting && (model.autoType == '03' || model.autoType == '04')) { + this.setAutoFlicker(); + } + } + + getShapeTipPoint(val) { + if (val === '1' || val === '2') { + return this.sigButton.getShapeTipPoint(val); + } else { + return this.siglamp.getShapeTipPoint(val); + } + } + + mouseStatusVisible() { + this.siglamp.setBorderVisible(true); + this.siglamp.setNameColor('#000'); + } + + mouseStatusRecover() { + this.siglamp.setBorderVisible(false); + this.siglamp.setNameColor(this.theme.signalTextColor); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusVisible(); + } + } + } + + mouseenter() { + if (!this.selected) { + this.mouseStatusVisible(); + } + } + + mouseleave() { + if (!this.selected) { + this.mouseStatusRecover(); + } + } +} + diff --git a/src/jmap/components/beijing_01/shape/Station.js b/src/jmap/components/beijing_01/shape/Station.js new file mode 100644 index 000000000..0a73e2245 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/Station.js @@ -0,0 +1,74 @@ +/* +* 车站 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; + +export default class Station extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + if (model.visible) { + this.stationText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.point.x, + y: model.point.y, + text: model.name, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.nameFont || '14px ' + theme.textFontFormat, + textFill: model.nameColor + } + }); + + this.mileageText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.point.x, + y: model.point.y + parseInt(model.nameFont) + 2, + text: model.kmPost, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.kmPostFont || '8px ' + theme.textFontFormat, + textFill: model.kmPostColor + } + }); + + this.add(this.stationText); + this.add(this.mileageText); + this.setShowMileageText(model.kmPostShow); + this.setStatus(model); + } + } + + /** 设置公里标是否显示*/ + setShowMileageText(show) { + if (show) { + this.mileageText.show(); + } else { + this.mileageText.hide(); + } + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } + + getShapeTipPoint() { + return null; + } +} diff --git a/src/jmap/components/beijing_01/shape/StationControl.js b/src/jmap/components/beijing_01/shape/StationControl.js new file mode 100644 index 000000000..94586e6c6 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/StationControl.js @@ -0,0 +1,221 @@ +/* +* 控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +import Text from 'zrender/src/graphic/Text'; +import Group from 'zrender/src/container/Group'; + +/** 单个控制灯*/ +class SingleControl extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this._subType = model._subType; + this.z = 20; + this._create(model); + } + + _create(model) { + var _subType = 'ControlSignal'; + var _val = '0'; + if (model.pop) { + _subType = 'ControlButton'; + _val = '1'; + } + this.control = new Arc({ + pop: model.pop, + _subType: _subType, + _val: _val, + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.point.x, + cy: model.point.y, + r: model.theme.stationControlmodeR + }, + style: { + lineWidth: 0.5, + fill: model.theme.stationControlGrayColor, + stroke: model.theme.stationControlGrayColor + } + }); + + 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.theme.stationControlmodeR + model.theme.nameDistance, + text: model.context, + textFill: model.theme.textFontColor, + textFont: model.theme.textFontSize + 'px ' + model.theme.textFontFormat, + textAlign: 'middle', + textVerticalAlign: 'top' + } + }); + + this.add(this.control); + this.add(this.text); + } + + setColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } +} + +/** 控制模式*/ +export default class StationControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.selected = false; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this._create(model, theme); + this.on('mouseout', this.mouseleave); + this.on('mouseover', this.mouseenter); + } + + _create() { + let model = this.model; + this.emergencyControl = new SingleControl({ + _subType: 'emergency', + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x - this.theme.stationControlDistance, + y: model.position.y + }, + context: model.jjzkContent, + pop: false + }); + + this.centerControl = new SingleControl({ + _subType: 'center', + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x, + y: model.position.y + }, + context: model.zokContent, + pop: false + }); + + this.substationControl = new SingleControl({ + _subType: 'substation', + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x + this.theme.stationControlDistance, + y: model.position.y + }, + context: model.zakContent, + pop: false + }); + + this.textShadow = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, -4], + silent: true, + style: { + x: model.position.x, + y: model.position.y, + text: '', + textFill: this.theme.textShadowColor, //黄色 + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: 'bold ' + (this.theme.stationControlTextSize + 1) + 'px ' + this.theme.textFontFormat + } + }) + + this.add(this.substationControl); + this.add(this.centerControl); + this.add(this.emergencyControl); + this.add(this.textShadow); + this.setStatus(model); + this.mouseStatusRecover(); + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + this.emergencyControl.setColor(this.theme.stationControlGrayColor); + this.substationControl.setColor(this.theme.stationControlGrayColor); + this.centerControl.setColor(this.theme.stationControlGrayColor); + } break; + case '01': { //中控 + this.emergencyControl.setColor(this.theme.stationControlGrayColor); + this.substationControl.setColor(this.theme.stationControlGrayColor); + this.centerControl.setColor(this.theme.stationControlGreenColor); + } break; + case '02': { //站控 + this.emergencyControl.setColor(this.theme.stationControlGrayColor); + this.substationControl.setColor(this.theme.stationControlYellowColor); + this.centerControl.setColor(this.theme.stationControlGrayColor); + } break; + case '03': { //紧急站控 + this.emergencyControl.setColor(this.theme.stationControlRedColor); + this.substationControl.setColor(this.theme.stationControlGrayColor); + this.centerControl.setColor(this.theme.stationControlGrayColor); + } 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; + } + } + } + + 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; + } + + mouseStatusVisible(subType) { + switch (subType) { + case 'emergency': { this.textShadow.setStyle({ text: this.model.jjzkContent }); } break; + case 'center': { this.textShadow.setStyle({ text: this.model.zokContent }) }; break; + case 'substation': { this.textShadow.setStyle({ text: this.model.zakContent }); } break; + } + this.textShadow.show(); + } + + mouseStatusRecover() { + this.textShadow.hide(); + } + + mouseenter(e) { + if (e.target.parent && e.target.parent._subType) { + this.mouseStatusVisible(e.target.parent._subType); + } + } + + mouseleave(e) { + if (e.target._subType) { + this.mouseStatusRecover(); + } + } +} \ No newline at end of file diff --git a/src/jmap/components/beijing_01/shape/StationCounter.js b/src/jmap/components/beijing_01/shape/StationCounter.js new file mode 100644 index 000000000..759b582a4 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/StationCounter.js @@ -0,0 +1,85 @@ +/* +* 计数器 +*/ +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, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 30; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + this.counter = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y, + text: model.val, + textFill: theme.stationCounterTextColor, + textAlign: 'middle', + textStrokeWidth: 1, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + } + }); + + 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: theme.stationCounterBorderColor + } + }); + + 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 + theme.textFontSize + theme.nameDistance, + text: model.name, + textFill: theme.stationCounterTextColor, + textAlign: 'middle', + textVerticalAlign: 'top', + textStrokeWidth: 1, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + } + }); + this.add(this.counterName); + this.add(this.table); + this.add(this.counter); + this.setStatus(model); + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } + + getShapeTipPoint() { + return null; + } +} + diff --git a/src/jmap/components/beijing_01/shape/StationDelayUnlock.js b/src/jmap/components/beijing_01/shape/StationDelayUnlock.js new file mode 100644 index 000000000..054c86ce9 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/StationDelayUnlock.js @@ -0,0 +1,102 @@ +/* +* 延迟解锁 +*/ +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, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = 1; + this._create(model, theme); + } + + _create(model, theme) { + this.text = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y, + text: model.deviceName + ' ', + textFill: theme.stationDelayUnlockTextColor, + textStrokeWidth: 1, + textFont: model.textFont + 'px ' + theme.textFontFormat, + textAlign: 'left' + } + }); + + let fontSize = parseInt(model.textFont.split(' ')[0]) || 30; + this.time = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + fontSize + theme.stationDelayUnlockDistance, + text: model.remainTime || '', + textFill: theme.stationDelayUnlockTextColor, + textStrokeWidth: 1, + textFont: model.textFont + 'px ' + theme.textFontFormat, + 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 - 1, + z: this.z, + 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: theme.stationDelayUnlockBorderColor, + fill: theme.backgroundColor + } + }); + this.add(this.table); + + this.setStatus(model); + } + + /** 延时解锁关闭*/ + delayClose() { + this.time.setStyle('text', ''); + this.text.setStyle('text', ''); + this.table.setStyle('stroke', this.theme.backgroundColor); + } + + /** 延时解锁计数*/ + delayUnlock() { + this.table.setStyle('stroke', this.theme.sidelineColor); + this.time.setStyle('text', '' + this.model.remainTime); + } + + setStatus(model) { + switch (model.status) { + case '01': { this.delayClose(); } break; //关闭 + case '02': { this.delayUnlock(); } break; //延迟解锁 + } + } + + getShapeTipPoint() { + return null; + } +} diff --git a/src/jmap/components/beijing_01/shape/StationStand.js b/src/jmap/components/beijing_01/shape/StationStand.js new file mode 100644 index 000000000..da4e90a93 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/StationStand.js @@ -0,0 +1,537 @@ +/* +* 站台 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Isogon from 'zrender/src/graphic/shape/Isogon'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import { flashlight } from './libs/ShapePoints'; + + +export default class StationStand extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.selected = false; + this.model = model; + this.theme = theme; + this.doors = new Group(); + this._create(model, theme); + + this.on('mousedown', this.mouseclick); + this.on('mouseout', this.mouseleave); + this.on('mouseover', this.mouseenter); + } + + _create(model, theme) { + // 方向值 + let drict = model.doorLocationType == '01' ? 1 : -1; + + this.stationStand = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x - model.width / 2, + y: 0, + width: model.width, + height: model.height + }, + style: { + lineWidth: 0, + stroke: this.theme.sidelineColor, + fill: this.theme.stationStandSpareColor + } + }); + + /** 站台折返策略*/ + let beyond = 4; + let height = 5; + let width = 10; + let offsetx = (model.width - width / 2); + let offsety = (model.height + height + this.theme.stationStandDistance) / 2; + + this.reentry = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: flashlight(model.position.x, model.position.y, drict, width, height, offsetx, offsety, beyond) + }, + style: { + lineWidth: 0, + fill: this.theme.stationStandNoHumanReentryColor + } + }); + this.add(this.reentry); + + /** 站台扣车*/ + let distance = 0; + let textX = model.position.x + drict * (model.width / 2 + theme.textFontSize + distance); + this.text = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: [0, 0], + style: { + x: textX, + y: 0, + text: 'H', + textAlign: 'middle', + textVerticalAlign: 'top', + fontSize: theme.stationStandHeadFontSize + 'px ' + theme.textFontFormat, + textFill: theme.stationStandCenterDetainTrainColor, + textStroke: theme.backgroundColor, + } + }); + this.add(this.text); + + // 停站时间 + let textLevelT = [0, 0]; + if (model.doorLocationType == '02') { + textLevelT = [0, 5]; + } + let timeX = model.position.x - drict * (model.width / 2 + theme.textFontSize + distance); + this.time = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: textLevelT, + style: { + x: timeX, + y: 0, + text: model.parkingTime, + textFill: theme.stationStandTimeTextColor, + textAlign: 'middle', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat + } + }); + this.add(this.time); + + // 区间运行时间 + let textLevelP = [0, 2]; + if (model.doorLocationType == '01') { + textLevelP = [0, 15]; + } + let levelX = model.position.x - drict * (model.width / 2 + theme.textFontSize + distance); + this.level = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: textLevelP, + style: { + x: levelX, + y: 0, + text: model.intervalRunTime, + textFill: theme.stationStandTimeTextColor, + textAlign: 'middle', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat + } + }); + this.add(this.level); + + /** 站台紧急关闭*/ + this.emergent = new Isogon({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x, + y: 0, + r: theme.stationStandDistance / 2, + n: 4, + }, + style: { + lineWidth: 0, + stroke: theme.stationStandEmergentCloseColor, + fill: theme.stationStandEmergentCloseColor + } + }); + this.doors.add(this.emergent); + + /** 屏蔽门*/ + let padding = 0.1; + + this.safeDoorL = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x - model.width / 2 - padding, + y: model.position.y, + width: model.width / 4 + padding, + height: theme.statonStandSafeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.safeDoorC = new Rect({ + zlevel: this.zlevel, + z: this.z + 1, + shape: { + x: model.position.x - model.width / 4 - padding, + y: model.position.y, + width: model.width / 2 + padding * 2, + height: theme.statonStandSafeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.safeDoorR = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x + model.width / 4, + y: model.position.y, + width: model.width / 4 + padding, + height: theme.statonStandSafeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.setHasSafeDoor(model.hasDoor); + this.setDrict(model.doorLocationType); + this.setVisible(model.visible); + this.setStatus(model); + this.mouseStatusRecover(); + } + + setDrict(doorLocationType) { + let model = this.model; + let theme = this.theme; + if (doorLocationType === '01') { + let distance = model.position.y + theme.stationStandDistance + theme.statonStandSafeHeight; + this.text.setStyle('y', distance + model.height / 2 - theme.stationStandHeadFontSize / 2); + this.time.setStyle('y', distance + model.height - theme.textFontSize); + this.level.setStyle('y', distance - model.height + theme.textFontSize / 1.2); + this.emergent.setShape('y', distance - theme.stationStandDistance / 2); + this.stationStand.setShape('y', distance); + } else { + let distance = model.position.y - theme.stationStandDistance; + this.text.setStyle('y', distance - model.height / 2 - theme.stationStandHeadFontSize / 2); + this.time.setStyle('y', distance - model.height + theme.textFontSize); + this.level.setStyle('y', distance - model.height - theme.textFontSize / 2); + this.emergent.setShape('y', distance + theme.stationStandDistance / 2); + this.stationStand.setShape('y', distance - model.height); + } + this.add(this.doors); + this.add(this.stationStand); + + + let rect = this.stationStand.getBoundingRect(); + rect.union(this.doors.getBoundingRect()); + this.standBorder = new Rect({ + zlevel: model.zlevel, + silent: true, + z: this.z - 1, + shape: rect, + style: { + lineDash: [3, 3], + stroke: theme.borderColor, + fill: theme.transparentColor + } + }) + this.add(this.standBorder); + } + + setHasSafeDoor(hasDoor) { + if (hasDoor) { + this.doors.add(this.safeDoorL); + this.doors.add(this.safeDoorC); + this.doors.add(this.safeDoorR); + } else { + this.doors.remove(this.safeDoorL); + this.doors.remove(this.safeDoorC); + this.doors.remove(this.safeDoorR); + } + } + + setVisible(visible) { + if (visible) { + this.eachChild((it) => { + it.show(); + }); + } else { + this.eachChild((it) => { + it.hide(); + }); + } + } + + //恢复初始状态 + recover() { + this.time.hide(); + this.level.hide(); + this.text.hide(); + this.emergent.hide(); + this.reentry.hide(); + if (this.model.visible) { this.safeDoorC.show(); } + this.safeDoorL.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandDoorDefaultColor); + } + + //空闲 + spare() { + this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + } + + //列车停站 + stop() { + this.stationStand.setStyle('fill', this.theme.stationStandStopColor); + } + + //指定列车跳站 + designatedJumpStop() { + this.stationStand.setStyle('fill', this.theme.stationStandDesignatedJumpStopColor); + } + + //站台紧急关闭 + emergentClose() { + this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.emergent.show(); + } + + //未设置跳停 + unJumpStop() { + } + + //站台跳停 + jumpStop() { + this.stationStand.setStyle('fill', this.theme.stationStandJumpStopColor); + } + + //未设置扣车 + unDetainTrain() { + this.text.hide(); + } + + //车站扣车 + standDetainTrain() { + this.text.show(); + this.text.setStyle('textFill', this.theme.stationStandDetainTrainTextColor); + } + + //中心扣车 + centerDetainTrain() { + this.text.show(); + this.text.setStyle('textFill', this.theme.stationStandCenterDetainTrainColor); + } + + //中心+车站扣车 + standAndCenterDetainTrain() { + this.text.show(); + } + + //人工设置停战时间 + setManuallyArmisticeTime(val) { + this.time.show(); + this.time.attr({ + style: { + text: val + }, + }); + } + + //人工设置运行等级 + setManuallyOperationLevel(val) { + this.level.show(); + this.level.attr({ + style: { + text: val + }, + }); + } + + //开门 + openDoor() { + this.safeDoorC.hide(); + } + + //关门 + closeDoor() { + if (this.model.visible) { this.safeDoorC.show(); } + } + + //屏蔽门正常 + doorNormal() { + this.safeDoorL.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandDoorDefaultColor); + } + + //屏蔽门故障 + doorFault() { + this.safeDoorL.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandSplitDoorColor); + } + + //屏蔽门切除 + doorSplit() { + this.safeDoorL.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandSplitDoorColor); + } + + //无折返(默认) + noReentry() { + this.reentry.hide(); + } + + //无人折返 + noHumanReentry() { + this.reentry.show(); + this.reentry.setStyle('fill', this.theme.stationStandNoHumanReentryColor); + } + //自动换端 + autoChangeEnds() { + this.reentry.show(); + this.reentry.setStyle('fill', this.theme.stationStandAutoChangeEndsColor); + } + + setStatus(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(); + } + } + } + + /** 设置扣车*/ + 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; + } + } + + getShapeTipPoint() { + let rect = this.stationStand.getBoundingRect(); + if (rect) { + return { + x: rect.x + rect.width / 2, + y: rect.y + }; + } + return null; + } + + mouseStatusVisible() { + this.standBorder.show(); + this.stationStand.setStyle({ fill: this.theme.borderContextBackgroundColor }) + } + + mouseStatusRecover() { + this.standBorder.hide(); + this.stationStand.setStyle({ fill: this.theme.stationStandSpareColor }) + this.setStatus(this.model); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusRecover(); + this.mouseStatusVisible(); + } + } + } + + mouseenter(e) { + if (!this.selected) { + this.mouseStatusRecover(); + this.mouseStatusVisible(); + } + } + + mouseleave(e) { + if (!this.selected) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/beijing_01/shape/Switch.js b/src/jmap/components/beijing_01/shape/Switch.js new file mode 100644 index 000000000..04fb343e5 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/Switch.js @@ -0,0 +1,606 @@ +/* +* 道岔 +*/ +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Line from 'zrender/src/graphic/shape/Line'; +import Group from 'zrender/src/container/Group'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import JTriangle from '@/jlmap/util/JTriangle'; +import ModelType from '@/jlmap/model/ModelType'; +import store from '@/store'; + +export default class Switch extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.intersection = model.intersection; + this.selected = false; + this.zlevel = model.zlevel; + this.z = 8; + this.model = model; + this.theme = theme; + this._create(model); + this.on('mousedown', this.mouseclick); + this.on('mouseout', this.mouseleave); + this.on('mouseover', this.mouseenter); + } + + _create(model) { + this.triangle = new JTriangle(model.intersection, model.skew); + this.createSwitch(); + this.createNameText(); + this.craeteSwitchBorder(); + this.setStatus(model); + this.mouseStatusRecover(); + } + + /** 道岔实体,不显示,响应鼠标事件*/ + createSwitch() { + let model = this.model; + let theme = this.theme; + + var halfWidth = theme.sectionWidth / 2; //一般宽度 + var switchWidth = theme.sectionWidth + theme.sectionBeyondWidth + theme.sectionBeyondWidth + 0.8; // 道岔宽度, 增大遮挡宽度0.8 + var swPadding = theme.switchLen; //定位和反位时区段距离岔芯的距离 + var directx = this.triangle.drictx; + var directy = this.triangle.dricty; + var direct = -this.triangle.drictx * this.triangle.dricty; + var coverLength = switchWidth * 1.5; + + // 道岔遮挡 + var line = new Line({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: { + x1: model.intersection.x - coverLength, + y1: model.intersection.y, + x2: model.intersection.x + coverLength, + y2: model.intersection.y + }, + style: { + lineWidth: switchWidth, + stroke: theme.backgroundColor + } + }); + var skewLine = new Line({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: { + x1: model.intersection.x, + y1: model.intersection.y, + x2: model.intersection.x + directx * this.triangle.GetCotRate() * coverLength, + y2: model.intersection.y + directy * coverLength, + }, + style: { + lineWidth: switchWidth, + stroke: theme.backgroundColor + } + }); + this.switchView = new Group(); + this.switchView.add(line); + this.switchView.add(skewLine); + + // 定位遮挡 + halfWidth += 0.3; + var point1 = [model.intersection.x - directx * halfWidth, model.intersection.y + directy * halfWidth]; + var point2 = [point1[0] + directx * switchWidth / this.triangle.GetSinRate(), point1[1]]; + var point3 = [point2[0] + directx * this.triangle.GetCotRate() * swPadding, point2[1] + directy * swPadding]; + var point4 = [point3[0] + direct * this.triangle.GetSin(switchWidth), point3[1] - direct * this.triangle.GetCos(switchWidth)]; + + this.locShelter = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + point1, point2, point3, point4 + ] + }, + style: { + fill: theme.backgroundColor + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + var lpx = Math.abs(this.triangle.GetCos(1)); + this.locShelter.position = [directx * lpx, -directy * 0.2]; + this.locShelter.show(); + + // 反位遮挡 + var slen = switchWidth / this.triangle.GetSinRate(); // 斜切长度 + var rpoint1 = [model.intersection.x + directx * halfWidth, model.intersection.y - directy * halfWidth]; + var rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.GetCotRate()), rpoint1[1]]; + var rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth]; + var rpoint4 = [rpoint1[0] + this.triangle.GetCos(slen), rpoint1[1] + this.triangle.GetSin(slen)]; + this.relocShelter = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + rpoint1, rpoint2, rpoint3, rpoint4 + ] + }, + style: { + fill: theme.backgroundColor + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + var rpx = Math.abs(this.triangle.GetCos(halfWidth)) + 0.2; + this.relocShelter.position = [-directx * rpx, -directy * 0.2]; + this.relocShelter.hide(); + + // 反位/平行四边形 遮挡 + var sinX = theme.sectionWidth / this.triangle.GetSinRate(); + var switchWidth1 = theme.sectionWidth / 2; + var width1 = switchWidth1 * this.triangle.GetSinRate(); + var height1 = switchWidth1 * this.triangle.GetCosRate(); + var width2 = (height1 + switchWidth1) / this.triangle.GetTanRate(); + var width3 = sinX - width2 - width1; + var switchPoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1]; + var switchPoint2 = [switchPoint1[0] - directx * (width2 + width1) - directx * width3, switchPoint1[1]]; + var switchPoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1]; + var switchPoint4 = [switchPoint1[0] + directx * (width2 + width1) - directx * width3, switchPoint3[1]]; + this.reserveSection = new Polygon({ + zlevel: this.zlevel, + shape: { + points: [ + switchPoint1, switchPoint2, switchPoint3, switchPoint4 + ] + }, + style: { + fill: theme.sectionSpareColor, + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + this.reserveSection.hide(); + + // 失去 + // this.release = new Line({ + // zlevel: this.zlevel, + // z: this.z + 2, + // 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: theme.sectionWidth, + // stroke: theme.sectionTimeReleaseColor, + // } + // }); + + + //释放解锁 + 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: theme.sectionWidth + theme.sectionBeyondWidth + 1, + stroke: theme.backgroundColor, + } + }); + + // 添加 + this.add(this.switchView); + this.add(this.locShelter); + this.add(this.relocShelter); + this.add(this.reserveSection); + // this.add(this.release); + this.add(this.releaseBackground); + } + + /** 创建道岔边框*/ + craeteSwitchBorder() { + let sectionA = this.getSectionInstance({ _type: ModelType.Section, _code: this.model.sectionACode }); + let sectionB = this.getSectionInstance({ _type: ModelType.Section, _code: this.model.sectionBCode }); + let sectionC = this.getSectionInstance({ _type: ModelType.Section, _code: this.model.sectionCCode }); + let rect = this.getBoundingRect(); + + sectionA && rect.union(sectionA.getBoundingRect()); + sectionB && rect.union(sectionB.getBoundingRect()); + sectionC && rect.union(sectionC.getBoundingRect()); + + this.switchBorder = new Rect({ + zlevel: this.model.zlevel, + z: this.z, + silent: true, + shape: Object.assign({ r: 4 }, rect), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.transparentColor + } + }) + + this.add(this.switchBorder); + } + + /** 道岔名称,显示,响应鼠标事件*/ + createNameText() { + let model = this.model; + let theme = this.theme; + + //描述文字 + this.arrowText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.intersection.x + 10, + y: model.intersection.y + 15, + text: `道岔区段名称: ${model.sectionName}`, + textFill: '#000', + textAlign: 'letf', + textFont: 10 + 'px consolas', + textPadding: 3, + textBackgroundColor: theme.tipBackgroundColor, + } + }); + this.arrowText.hide(); + this.add(this.arrowText); + + //创建道岔名称 + this.nameText = new Text({ + zlevel: this.zlevel, + z: this.z + 3, + style: { + x: model.namePoint.x + model.intersection.x + this.triangle.drictx * (theme.sectionWidth * 3 + theme.nameDistance) * this.triangle.GetCotRate(), + y: model.namePoint.y + model.intersection.y + this.triangle.dricty * (theme.nameDistance), + text: model.name, + textAlign: this.triangle.drictx === 1 ? 'left' : 'right', + textVerticalAlign: this.triangle.dricty === 1 ? 'top' : 'bottom', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.switchTextLossColor + } + }); + //添加道岔名称视图 + this.add(this.nameText); + //设置道岔名称视图显隐 + model.nameShow ? this.nameText.show() : this.nameText.hide(); + + //创建锁闭文字框 + let rect = this.nameText.getBoundingRect(); + let textWidth = rect.width * 0.8; + if (this.triangle.drictx !== 1) { + rect.x += rect.width; + textWidth = -textWidth; + } + + this.textRect = new Rect({ + zlevel: this.zlevel, + z: this.z + 2, + silent: true, + shape: { + x: rect.x, + y: rect.y, + width: textWidth, + height: rect.height + }, + style: { + lineWidth: 0, + lineDash: [3, 3], + stroke: theme.switchTextBorderColor, + fill: theme.transparentColor, + } + }); + this.add(this.textRect); + } + + /** 名称动画*/ + nameTextAnimation() { + this.nameText.animateStyle(true) + .when(0, { textFill: this.theme.backgroundColor }) + .when(1000, { textFill: this.theme.switchTextLossColor }) + .when(2000, { textFill: this.theme.backgroundColor }) + .start(); + + this.textRect.animateStyle(true) + .when(0, { textFill: this.theme.backgroundColor }) + .when(1000, { textFill: this.theme.switchTextBorderColor }) + .when(2000, { textFill: this.theme.backgroundColor }) + .start(); + } + + /** 设置岔芯是否隐藏*/ + setSwitchCoreInvisible(invisible) { + if (invisible) { + this.switchView.hide(); + } else { + this.switchView.show(); + } + } + + /** 设置岔芯颜色*/ + setSwitchCoreColor(color) { + this.switchView.eachChild(child => { + child.setStyle({ stroke: color }); + }) + } + + /** 设置道岔文字颜色*/ + setTextColor(color) { + this.nameText.setStyle('textFill', color); + } + + /** 设置道岔文字边框颜色 */ + setHasTextBorder(width) { + this.textRect.setStyle('lineWidth', width); + } + + /** 恢复状态*/ + recover() { + this.setSwitchCoreColor(this.theme.backgroundColor); + this.nameText.stopAnimation(false); + // this.release.stopAnimation(false); + this.reserveSection.stopAnimation(false); + this.switchView.eachChild((child) => { + child.stopAnimation(false); + }); + + // this.release.hide(); + this.relocShelter.hide(); + this.releaseBackground.hide(); + + + this.setHasTextBorder(0); + switch (this.model.locateType) { + case '01': { // 定位 + this.setTextColor(this.theme.switchLocateTextColor); + } break; + case '02': { // 反位 + this.setTextColor(this.theme.switchInversionColor); + } break; + default: { // 其他 + this.setTextColor(this.theme.switchTextLossColor); + } + } + } + + /** 定位*/ + setLocationAction() { + this.recover(); + this.setSwitchCoreInvisible(true); + this.locShelter.show(); + this.relocShelter.hide(); + this.reserveSection.hide(); + } + + /** 反位*/ + setInversionAction() { + this.recover(); + this.setSwitchCoreInvisible(true); + this.locShelter.hide(); + this.relocShelter.show(); + this.reserveSection.show(); + } + + /** 失去*/ + setLossAction(nameFlicker) { + this.recover(); + this.locShelter.hide(); + this.relocShelter.hide(); + this.reserveSection.hide(); + this.setSwitchCoreInvisible(false); + nameFlicker && this.nameTextAnimation(); + } + + /** 挤叉*/ + setForkAction() { + this.setLossAction(true); + this.switchView.eachChild((child) => { + child.animateStyle(true) + .when(0, { stroke: this.theme.backgroundColor }) + .when(1000, { stroke: 'red' }) + .when(2000, { stroke: this.theme.backgroundColor }) + .start(); + }); + } + + /** 空闲*/ + spare() { + } + + /** 单锁*/ + setMonolock() { + this.setTextColor(this.theme.switchMonolockColor); + } + + /** 封锁 */ + block() { + this.setHasTextBorder(1); + } + + /** 延时释放*/ + timeRelease() { + this.setSwitchCoreInvisible(true); + // this.release.show(); + this.releaseBackground.show(); + // this.release.setStyle('stroke', this.theme.sectionTimeReleaseColor); + // this.release.animateStyle(true) + // .when(0, { stroke: this.theme.sectionTimeReleaseColor }) + // .when(1000, { stroke: this.theme.backgroundColor }) + // .start(); + + } + + /** 设置道岔切除*/ + setSwitchCutOff() { + this.setSwitchCoreInvisible(true); + switch (this.model.locateType) { + case '01': { // 定位 + // this.release.show(); + this.releaseBackground.hide(); + this.setSectionstatus(this.release, 'stroke', this.model.sectionAstatus); + // this.release.animateStyle(true) + // .when(1000, { stroke: this.theme.backgroundColor }) + // .start(); + } break; + case '02': { // 反位 + this.reserveSection.animateStyle(true) + .when(1000, { fill: this.theme.backgroundColor }) + .start(); + } break; + } + } + + setSectionstatus(section, style, status) { + if (section) { + switch (status) { + case '00': break; + case '01': { /** 空闲*/ + section.setStyle(style, this.theme.sectionSpareColor); + } break; + case '02': { /** 通信车占用*/ + section.setStyle(style, this.theme.sectionCommunicationOccupiedColor); + } break; + case '03': { /** 非通信车占用*/ + section.setStyle(style, this.theme.sectionUnCommunicationOccupiedColor); + } break; + case '04': { /** 进路锁闭*/ + section.setStyle(style, this.theme.sectionRouteLockColor); + } break; + case '05': { /** 故障锁闭*/ + section.setStyle(style, this.theme.sectionFaultLockColor); + } break; + case '06': { /** 封锁*/ + section.setStyle(style, this.theme.sectionBlockColor); + } break; + case '07': { /** ATC切除*/ + section.setStyle(style, this.theme.sectionAtcExcisionColor); + } break; + case '08': { /** ATS切除*/ + section.setStyle(style, this.theme.sectionAtsExcisionColor); + section.animateStyle(true) + .when(1000, { fill: this.theme.backgroundColor }) + .when(2000, { fill: this.theme.sectionAtsExcisionColor }) + .start(); + } break; + case '09': { /** 进路延续保护 */ + section.setStyle(style, this.theme.sectionProtectiveLockColor); + } break; + } + } + } + + setLocateType(model) { + this.setSectionstatus(this.reserveSection, 'fill', model.sectionCstatus); + switch (model.locateType) { + case '01': { + this.setLocationAction(); /** 定位*/ + } break; + case '02': { + this.setInversionAction(); /** 反位*/ + } break; + case '03': { + this.setLossAction(true); /** 失去*/ + } break; + case '04': { + this.setForkAction(); /** 挤岔*/ + } break; + } + } + + setStatus(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(); + } + } + + getShapeTipPoint() { + var rect = null; + rect = this.nameText.getBoundingRect(); + if (rect) { + return { + x: rect.x + rect.width / 2, + y: rect.y + }; + } + return null; + } + + getSectionInstance(device) { + return store.getters['map/getViewInstanceByDevice'](device); + } + + mouseStatusVisible() { + let section = this.getSectionInstance({ _type: ModelType.Section, _code: this.model.switchSectionCode }); + section && section.setTrainWindowEventShow(true); + + this.switchBorder.show(); + this.setLossAction(false); + this.setSwitchCoreColor(this.theme.borderContextBackgroundColor); + this.setTextColor(this.theme.backgroundColor); + this.textRect.setStyle({ + lineWidth: 1, + stroke: this.theme.borderColor, + fill: this.theme.borderContextBackgroundColor + }); + } + + mouseStatusRecover() { + let section = this.getSectionInstance({ _type: ModelType.Section, _code: this.model.switchSectionCode }); + section && section.setTrainWindowEventShow(false); + + this.switchBorder.hide(); + this.setSwitchCoreColor(this.theme.backgroundColor); + this.textRect.setStyle({ + lineWidth: 0, + stroke: this.theme.switchTextBorderColor, + fill: this.theme.transparentColor, + }) + this.setStatus(this.model); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusVisible(); + } + } + } + + mouseenter(e) { + if (!this.selected) { + this.mouseStatusVisible(); + } + } + + mouseleave(e) { + if (!this.selected) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/beijing_01/shape/Train.js b/src/jmap/components/beijing_01/shape/Train.js new file mode 100644 index 000000000..dcbaaef99 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/Train.js @@ -0,0 +1,620 @@ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import BoundingRect from 'zrender/src/core/BoundingRect'; +import ModelType from '@/jlmap/model/ModelType'; +import store from '@/store'; + +/** 车身*/ +class TrainBody extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + + _create(model) { + let textFont = model.theme.trainTextFontSize + 'px ' + model.theme.textFontFormat; + let TextFontHSDA = model.theme.trainHSDATextFontSize + 'px ' + model.theme.textFontFormat; + + let destinationText = ''; + switch (model.model.destinationStatus) { + case '01': destinationText = '准点'; break; + case '02': destinationText = '早点'; break; + case '03': destinationText = '严重早点'; break; + case '04': destinationText = '晚点'; break; + case '05': destinationText = '严重晚点'; break; + default: destinationText = '未知'; break; + } + + // 文字描述 + this.arrowText = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: model.point.x + 50, + y: model.point.y + 25, + text: `列车类型: 计划车\n表\0\0\0\0号: ${model.model.serviceNumber}\n车\0次\0号: ${model.model.tripNumber}\n目的地号: ${model.model.targetCode ? model.model.targetCode : ''}\n车\0组\0号: ${model.model.groupNumber}\n早\0晚\0点: ${destinationText}\n运行方向: ${model.model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${model.model.sectionModel ? model.model.sectionModel.trackName : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${model.model.runControlStatus == '01' ? '正常' : model.model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${model.model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${model.model.speed || 0} km/h\n列车移动授权距离: ${model.model.maLen || 0} m`, + textFill: '#000', + textAlign: 'letf', + textFont: 10 + 'px consolas', + textPadding: 3, + textBackgroundColor: this.model.theme.tipBackgroundColor, + } + }); + + this.train = new Rect({ + zlevel: model.zlevel, + z: model.z, + shape: { + x: model.point.x, + y: model.point.y, + width: model.theme.trainWidth, + height: model.theme.trainHeight + }, + style: { + lineWidth: 0.1, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainBrown1Color + }, + cursor: 'pointer' + }); + + let lrPadding = 3; //两边间隔 + let upPadding = 4; //上边距离 + let beginX = (model.point.x + lrPadding); + let beginY = (model.point.y - model.theme.trainHSDATextFontSize - upPadding); + let margin = (model.theme.trainWidth - lrPadding * 2) / 4; + this.textH = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 0), + y: parseInt(beginY), + text: 'H', + textFill: model.theme.trainYellowColor, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + this.textS = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 1), + y: parseInt(beginY), + text: 'S', + textFill: model.theme.trainBlueColor, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + this.textD = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 2), + y: parseInt(beginY), + text: 'D', + textFill: model.theme.trainGreenColor, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + this.textA = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 3), + y: parseInt(beginY), + text: 'A', + textFill: model.theme.trainRedColor, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + lrPadding = 4; //两边间隔 + upPadding = 4; //上边距离 + let serviceNumber = model.model.serviceNumber || 'AA'; + let tripNumber = model.model.tripNumber || 'DDD'; + + serviceNumber = '00' + serviceNumber; + tripNumber = '000' + tripNumber; + this.textTrainServer = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x + lrPadding), + y: parseInt(model.point.y + upPadding), + text: serviceNumber.substring(serviceNumber.length - 2), + textFill: model.theme.trainBrownColor, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + } + }); + + this.textTrainTarget = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x + model.theme.trainWidth - lrPadding), + y: parseInt(model.point.y + upPadding), + text: tripNumber.substring(tripNumber.length - 3), + textFill: model.theme.trainYellowColor, + textFont: textFont, + textAlign: 'right', + textVerticalAlign: 'top', + } + }); + this.add(this.train); + this.add(this.textH); + this.add(this.textS); + this.add(this.textD); + this.add(this.textA); + this.add(this.textTrainServer); + this.add(this.textTrainTarget); + } + setMouseOver() { + store.dispatch('map/setTrainDetails', this.model); + this.details = store.state.map.trainDetails; + this.add(this.arrowText); + this.arrowText.attr({ + style: { + x: this.details.point.x + 50, + y: this.details.point.y + 25, + } + }); + } + setMouseOut() { + this.remove(this.arrowText); + store.dispatch('map/setTrainDetails', null); + } + setTrainColor(color) { + this.train && this.train.setStyle('fill', color); + } + setTextTrainServerColor(color) { + this.textTrainServer.setStyle('textFill', color); + this.textTrainServer.setStyle('textStroke', color); + } + setTextTrainTargetColor(color) { + this.textTrainTarget.setStyle('textFill', color); + this.textTrainTarget.setStyle('textStroke', color); + } + setHShow(isShow) { + isShow ? this.textH.show() : this.textH.hide(); + } + setSShow(isShow) { + isShow ? this.textS.show() : this.textS.hide(); + } + setDShow(isShow) { + isShow ? this.textD.show() : this.textD.hide(); + } + setAShow(isShow) { + isShow ? this.textA.show() : this.textA.hide(); + } + +} + +/** 车头*/ +class TrainHead extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + _create(model) { + let baseMargin = (model.drect === -1 ? 1 : 0); + this.line = new Rect({ + zlevel: model.zlevel, + z: model.z, + shape: { + x: model.point.x - baseMargin * (model.theme.trainConntWidth), + y: model.point.y, + width: model.theme.trainConntWidth, + height: model.theme.trainHeight + 2 * model.theme.trainMoreLength + }, + style: { + lineWidth: 0.1, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainBackground + } + }); + + let arrowMargin = model.theme.trainPadding + model.theme.trainConntWidth; + this.arrow = new Polygon({ + zlevel: model.zlevel, + z: model.z, + shape: { + points: [ + [model.point.x + model.drect * (arrowMargin), model.point.y + 1 - model.theme.trainMoreLength], + [model.point.x + model.drect * (arrowMargin + model.theme.trainArrowWidth), model.point.y + (model.theme.trainHeight + model.theme.trainMoreLength) / 2], + [model.point.x + model.drect * (arrowMargin), model.point.y - 1 + model.theme.trainHeight + model.theme.trainMoreLength] + ] + }, + style: { + lineWidth: 0.1, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainBackground + } + }); + + 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(); + } + setInvisible(invisible) { + this.eachChild((child) => { + child.attr('invisible', invisible); + }); + } +} + +/** 列车*/ +export default class Train extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this.section = null; + this.selected = false; + this.fontSize = model.nameFontSize || theme.trainTextFontSize; + this.newScale = this.fontSize / theme.trainTextFontSize; + this._create(model, theme); + this.on('mousedown', this.mouseclick); + this.on('mouseout', this.mouseleave); + this.on('mouseover', this.mouseenter); + } + + _computed(model, theme) { + 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((theme.trainWidth - model.trainWindowModel.width) / 2); + } break; + case '02': { //从左向右 + this.point.x = this.point.x + model.trainWindowModel.width / 2 - theme.trainConntWidth * this.newScale - theme.trainWidth; + } break; + case '03': { //从右向左 + this.point.x = this.point.x - model.trainWindowModel.width / 2 + theme.trainConntWidth * this.newScale; + } break; + } + } else { + this.point = model.position; + this.traingle = null; + } + } + + _create(model, theme) { + //计算画图坐标点 + this._computed(model, theme); + + //画图 + if (this.point) { + // body + this.trainB = new TrainBody({ + model: model, + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: this.point + }); + // left 头 + this.trainL = new TrainHead({ + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: { + x: this.point.x - theme.trainHeadDistance, + y: this.point.y + }, + drect: -1 + }); + // right 头 + this.trainR = new TrainHead({ + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: { + x: this.point.x + theme.trainWidth + theme.trainHeadDistance, + y: this.point.y + }, + drect: 1 + }); + this.add(this.trainB); + this.add(this.trainL); + this.add(this.trainR); + + let rect = Object.assign({}, this.getBoundingRect()); + rect.x -= theme.trainWidth / 2; + rect.y -= 5; + rect.width += theme.trainWidth; + rect.height += 10; + + this.trainBorder = new Rect({ + zlevel: model.zlevel, + z: this.z, + silent: true, + shape: rect, + style: { + lineDash: [3, 3], + stroke: theme.borderColor, + fill: theme.transparentColor + } + }) + + this.add(this.trainBorder); + this.setStatus(model); + this.mouseStatusRecover(); + } + } + getShapeTipPoint() { + return { + x: (this.train.shape.x), + y: (this.train.shape.y) + }; + } + //恢复颜色状态 + recover() { + this.trainB.setHShow(false); + this.trainB.setSShow(false); + this.trainB.setDShow(false); + this.trainB.setAShow(false); + this.trainL.setLineShow(false); + this.trainR.setLineShow(false); + this.trainL.setArrowShow(false); + this.trainR.setArrowShow(false); + } + //设置服务号状态类型 + setServerNoType(type) { + switch (type) { + case '01': { //显示服务号 计划车 + this.trainB.setTextTrainServerColor(this.theme.trainWitheColor); + } break; + case '02': { //显示车组号: 头码车与人工车 + this.trainB.setTextTrainServerColor(this.theme.trainYellowColor); + } break; + default: { + this.trainB.setTextTrainServerColor(this.theme.backgroundColor); + } + } + } + //设置目的地状态 + setDestinationStatus(status) { + switch (status) { + case '01': { //准点 + this.trainB.setTextTrainTargetColor(this.theme.trainWitheColor); + } break; + case '02': { //早点 + this.trainB.setTextTrainTargetColor(this.theme.trainGreenColor); + } break; + case '03': { //晚点 + this.trainB.setTextTrainTargetColor(this.theme.trainBrownColor); + } break; + case '04': { //头码车 + this.trainB.setTextTrainTargetColor(this.theme.trainYellowColor); + } break; + default: { + this.trainB.setTextTrainTargetColor(this.theme.backgroundColor); + } + } + } + //设置运行方向状态类型 + setDirectionType(type) { + switch (type) { + case '01': { //未知方向 + this.trainL.setLineShow(true); + this.trainR.setLineShow(true); + } break; + case '02': { //从左往右 上行 + this.trainR.setLineShow(true); + this.trainR.setArrowShow(true); + } break; + case '03': { //从右往左 下行 + this.trainL.setLineShow(true); + this.trainL.setArrowShow(true); + } break; + } + } + // 设置列车停止方向类型 + setDirectionStopType(type) { + switch (type) { + case '01': { //未知方向 + } break; + case '02': { //从左往右 上行 + this.trainR.setLineShow(true); + } break; + case '03': { //从右往左 下行 + this.trainL.setLineShow(true); + } break; + } + } + //设置运行状态 + setRunStatus(status) { + switch (status) { + case '01': { //停止 + this.setDirectionStopType(this.model.directionType); //设置运行方向状态类型 + } break; + case '02': { //运行 + this.setDirectionType(this.model.directionType); //设置运行方向状态类型 + } break; + } + + } + //设置运行模式 + setRunMode(status) { + switch (status) { + case '01': { //未知 + this.trainL.setColor(this.theme.trainWitheColor); + this.trainR.setColor(this.theme.trainWitheColor); + } break; + case '02': { //ATO自动驾驶模式 AM + this.trainL.setColor(this.theme.trainGreenColor); + this.trainR.setColor(this.theme.trainGreenColor); + } break; + case '03': { //ATP监控下的人工驾驶模式 CM + this.trainL.setColor(this.theme.trainYellowColor); + this.trainR.setColor(this.theme.trainYellowColor); + } break; + case '04': { //限制人工驾驶模式 RM + this.trainL.setColor(this.theme.trainBrownColor); + this.trainR.setColor(this.theme.trainBrownColor); + } break; + case '05': { //非限制人工驾驶模式 RM + this.trainL.setColor(this.theme.trainBrownColor); + this.trainR.setColor(this.theme.trainBrownColor); + } break; + } + } + + //设置运行控制状态类型 + setRunControlStatus(status) { + switch (status) { + case '01': { //正常 + this.trainB.setHShow(false); + this.trainB.setSShow(false); + } break; + case '02': { //扣车 + this.trainB.setHShow(true); + } break; + case '03': { //跳停 + this.trainB.setSShow(true); + } break; + } + } + //设置车门状态类型 + setDoorStatus(status) { + switch (status) { + case '01': { //关门 + this.trainB.setDShow(false); + } break; + case '02': { //开门 + this.trainB.setDShow(true); + } break; + } + } + //设置通信状态类型 + setCommunicationStatus() { + switch (status) { + case '01': { //正常 + this.trainB.setTrainColor(this.theme.trainBrown1Color); + } break; + case '02': { //故障 + this.trainB.setTrainColor(this.theme.trainGrayColor); + } break; + } + } + //设置报警状态 + setAlarmStatus(status) { + switch (status) { + case '01': { //不报警 + this.trainB.setAShow(false); + } break; + case '02': { //报警 + this.trainB.setAShow(true); + } break; + } + } + + //设置状态 + setStatus(model) { + if (model) { + this.recover(); + this.setServerNoType(model.serverNoType); //设置服务号状态类型 + this.setDestinationStatus(model.destinationStatus); //设置目的地状态 + this.setRunStatus(model.runStatus); //设置运行状态 + this.setRunMode(model.runMode); //设置运行模式 + this.setRunControlStatus(model.runControlStatus); //设置运行控制状态类型 + this.setDoorStatus(model.doorStatus); //设置车门状态类型 + this.setCommunicationStatus(model.communicationStatus); //设置通信状态类型 + this.setAlarmStatus(model.alarmStatus); //设置报警状态 + } + } + + //获取列车包围框 + getBoundingRect() { + let list = [this.trainB, this.trainL, this.trainR]; + let rect = null; + + list.forEach(elem => { + if (elem) { + let 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); + } + + setSectionBorderShow(show) { + let section = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Section, _code: this.model.sectionCode }); + show && section && section.mouseStatusVisible(); + show || section && section.mouseStatusRecover(); + } + + mouseStatusVisible() { + this.trainBorder.show(); + this.setSectionBorderShow(true); + this.trainB.setMouseOver(); + } + + mouseStatusRecover() { + this.trainBorder.hide(); + this.setSectionBorderShow(false); + this.trainB.setMouseOut(); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusVisible(); + } + } + } + + mouseenter(e) { + if (!this.selected) { + this.mouseStatusVisible(); + } + } + + mouseleave(e) { + if (!this.selected) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/beijing_01/shape/TrainWindow.js b/src/jmap/components/beijing_01/shape/TrainWindow.js new file mode 100644 index 000000000..c0334fbdd --- /dev/null +++ b/src/jmap/components/beijing_01/shape/TrainWindow.js @@ -0,0 +1,138 @@ +/* +* 车次窗 +*/ +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import Group from 'zrender/src/container/Group'; +import ModelType from '@/jlmap/model/ModelType'; +import store from '@/store'; + +export default class TrainWindow extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 1; + this.selected = false; + this.model = model; + this.theme = theme; + this._create(model); + this.on('mousedown', this.mouseclick); + this.on('mouseout', this.mouseleave); + this.on('mouseover', this.mouseenter); + } + + _create(model) { + let prdType = store.state.map.prdType; + if (prdType !== '01') { + this.createTrainWindow(); + this.setTrainWindowEventShow(model.trainWindowShow); + this.setStatus(model); + this.mouseStatusRecover(); + } + } + + /** 创建车次窗*/ + createTrainWindow() { + let model = this.model; + let theme = this.theme; + + this.trainRect = new Polygon({ + _subType: 'TrainWindow', + zlevel: this.zlevel - 1, + z: this.z, + shape: { + smooth: 0.01, + points: [ + [model.point.x - model.width / 2, model.point.y], + [model.point.x + model.width / 2, model.point.y], + [model.point.x + model.width / 2, model.point.y + model.height], + [model.point.x - model.width / 2, model.point.y + model.height], + ] + }, + style: { + lineDash: [3, 3], + lineWidth: 1, + stroke: theme.trainWindowColor, + fill: theme.transparentColor + } + }); + this.add(this.trainRect); + } + + setTrainWindowEventShow(show) { + let lineWidth = show ? 1 : 0; + this.trainRect && this.trainRect.setStyle('lineWidth', lineWidth); + } + + 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; + } + } + } + + //设置状态 + setStatus() { + } + + 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; + } + + setSectionEventShow(e, show) { + let section = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Section, _code: this.model.sectionCode }); + // if (section && section.model.isSwitchSection && !section.model.parentCode) { + // let swch = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Switch, _code: section.model.relSwitchCode }); + // show && swch && swch.mouseStatusVisible(e); + // show || swch && swch.mouseStatusRecover(e); + // } else { + // show && section && section.mouseStatusVisible(e); + // show || section && section.mouseStatusRecover(e); + // } + + show && section && section.mouseStatusVisible(e); + show || section && section.mouseStatusRecover(e); + } + + mouseStatusRecover(e) { + this.setTrainWindowEventShow(false); + this.setSectionEventShow(e, false); + } + + mouseStatusVisible(e) { + this.setTrainWindowEventShow(true); + this.setSectionEventShow(e, true); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusVisible(e); + } + } + } + + mouseenter(e) { + if (!this.selected) { + this.mouseStatusVisible(e); + } + } + + mouseleave(e) { + if (!this.selected) { + this.mouseStatusRecover(e); + } + } +} diff --git a/src/jmap/components/beijing_01/shape/ZcControl.js b/src/jmap/components/beijing_01/shape/ZcControl.js new file mode 100644 index 000000000..05d67f691 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/ZcControl.js @@ -0,0 +1,181 @@ +/* +* ZC区域控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +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 ZcControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 20; + this.model = model; + this.theme = theme; + this._create(model); + + this.on('mouseout', this.mouseleave); + this.on('mouseover', this.mouseenter); + } + + _create(model) { + this.control = new Arc({ + _subType: 'Control', + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: this.theme.zcControlmodeR + }, + style: { + lineWidth: 0, + fill: this.theme.zcControlGrayColor, + } + }); + + this.text = new Text({ + _subType: 'Text', + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: this.theme.stationControlTextSize + 'px ' + this.theme.textFontFormat + } + }); + + if (this.model.visible) { + this.add(this.control); + this.add(this.text); + } + + this.textShadow = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [4, -4], + silent: true, + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: this.theme.textShadowColor, //黄色 + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: 'bold ' + (this.theme.stationControlTextSize + 1) + 'px ' + this.theme.textFontFormat + } + }) + this.controlBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.control.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.transparentColor + } + }) + + this.textBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.text.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.borderContextBackgroundColor + } + }) + + this.add(this.control); + this.add(this.text); + this.add(this.textShadow); + this.add(this.textBorder); + this.add(this.controlBorder); + this.setStatus(model); + this.mouseStatusRecover(); + } + + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + + } break; + case '01': { //中控(缺省值) + + } break; + case '02': { //站控且允许转为中控 + + } break; + case '03': { //站控且不允许转为中控 + + } break; + } + } + + 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; + } + + mouseStatusVisible(subType) { + if (subType == 'Text') { + this.textShadow.show(); + } + + if (subType == 'Control') { + this.textBorder.show(); + this.controlBorder.show(); + this.text.setStyle({ textFill: '#000' }); + this.control.setStyle({ fill: this.theme.borderContextBackgroundColor }); + } + } + + mouseStatusRecover() { + this.textShadow.hide(); + this.textBorder.hide(); + this.controlBorder.hide(); + this.text.setStyle({ textFill: '#fff' }); + this.control.setStyle({ fill: this.theme.zcControlGrayColor }); + this.setStatus(this.model); + } + + + mouseenter(e) { + if (e.target._subType) { + this.mouseStatusRecover(); + this.mouseStatusVisible(e.target._subType); + } + } + + mouseleave(e) { + if (e.target._subType) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/beijing_01/shape/index.js b/src/jmap/components/beijing_01/shape/index.js new file mode 100644 index 000000000..f88c3efb5 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/index.js @@ -0,0 +1,31 @@ +import Section from './Section'; +import Signal from './Signal'; +import Station from './Station'; +import StationControl from './StationControl'; +import StationCounter from './StationCounter'; +import StationDelayUnlock from './StationDelayUnlock'; +import StationStand from './StationStand'; +import Switch from './Switch'; +import Train from './Train'; +import TrainWindow from './TrainWindow'; +import ZcControl from './ZcControl'; +import LimitControl from './limitControl'; +import LcControl from './lcControl'; +import ImageControl from './ImageControl'; + +export default { + Section, + Signal, + Station, + StationControl, + StationCounter, + StationDelayUnlock, + StationStand, + Switch, + Train, + TrainWindow, + ZcControl, + LimitControl, + LcControl, + ImageControl, +}; \ No newline at end of file diff --git a/src/jmap/components/beijing_01/shape/lcControl.js b/src/jmap/components/beijing_01/shape/lcControl.js new file mode 100644 index 000000000..a33894be6 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/lcControl.js @@ -0,0 +1,175 @@ +/* +* ZC区域控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +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 LcControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 20; + this.model = model; + this.theme = theme; + this._create(model); + + this.on('mouseout', this.mouseleave); + this.on('mouseover', this.mouseenter); + } + + _create(model) { + this.control = new Arc({ + _subType: 'Control', + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: this.theme.zcControlmodeR + }, + style: { + lineWidth: 0, + fill: this.theme.lcControlColor, + } + }); + + this.text = new Text({ + _subType: 'Text', + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: this.theme.stationControlTextSize + 'px ' + this.theme.textFontFormat + } + }); + + this.textShadow = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [4, -2], + silent: true, + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: this.theme.textShadowColor, //黄色 + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: 'bold ' + (this.theme.stationControlTextSize + 1) + 'px ' + this.theme.textFontFormat + } + }) + this.controlBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.control.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.transparentColor + } + }) + + this.textBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.text.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.borderContextBackgroundColor + } + }) + + this.add(this.control); + this.add(this.text); + this.add(this.textShadow); + this.add(this.textBorder); + this.add(this.controlBorder); + this.setStatus(model); + this.mouseStatusRecover(); + } + + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + + } break; + case '01': { //中控(缺省值) + + } break; + case '02': { //站控且允许转为中控 + + } break; + case '03': { //站控且不允许转为中控 + + } break; + } + } + + 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; + } + + mouseStatusVisible(subType) { + if (subType == 'Text') { + this.textShadow.show(); + } + + if (subType == 'Control') { + this.textBorder.show(); + this.controlBorder.show(); + this.text.setStyle({ textFill: '#000' }); + this.control.setStyle({ fill: this.theme.borderContextBackgroundColor }); + } + } + + mouseStatusRecover() { + this.textShadow.hide(); + this.textBorder.hide(); + this.controlBorder.hide(); + this.text.setStyle({ textFill: '#fff' }); + this.control.setStyle({ fill: this.theme.lcControlColor }); + this.setStatus(this.model); + } + + mouseenter(e) { + if (e.target._subType) { + this.mouseStatusRecover(); + this.mouseStatusVisible(e.target._subType); + } + } + + mouseleave(e) { + if (e.target._subType) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/beijing_01/shape/libs/ShapePoints.js b/src/jmap/components/beijing_01/shape/libs/ShapePoints.js new file mode 100644 index 000000000..01dc57b69 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/libs/ShapePoints.js @@ -0,0 +1,33 @@ +/** 指向箭头坐标*/ +export function arrows(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], + ]; +} \ No newline at end of file diff --git a/src/jmap/components/beijing_01/shape/limitControl.js b/src/jmap/components/beijing_01/shape/limitControl.js new file mode 100644 index 000000000..3ffa16a24 --- /dev/null +++ b/src/jmap/components/beijing_01/shape/limitControl.js @@ -0,0 +1,190 @@ +/* +* ZC区域控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +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 LimitControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 20; + this.selected = false; + this.model = model; + this.theme = theme; + this._create(model); + + this.on('mousedown', this.mouseclick); + this.on('mouseout', this.mouseleave); + this.on('mouseover', this.mouseenter); + } + + _create(model) { + this.control = new Arc({ + _subType: 'Control', + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: this.theme.zcControlmodeR + }, + style: { + lineWidth: 0, + fill: this.theme.limitControlColor, + } + }); + + this.text = new Text({ + _subType: 'Text', + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: this.theme.stationControlTextSize + 'px ' + this.theme.textFontFormat, + } + }); + + this.textShadow = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [4, -4], + silent: true, + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: this.theme.textShadowColor, //黄色 + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: 'bold ' + (this.theme.stationControlTextSize + 1) + 'px ' + this.theme.textFontFormat + } + }); + + this.controlBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.control.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.transparentColor + } + }); + + this.textBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.text.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.borderContextBackgroundColor + } + }); + + this.add(this.control); + this.add(this.text); + this.add(this.textShadow); + this.add(this.textBorder); + this.add(this.controlBorder); + this.setStatus(model); + this.mouseStatusRecover(); + } + + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + + } break; + case '01': { //中控(缺省值) + + } break; + case '02': { //站控且允许转为中控 + + } break; + case '03': { //站控且不允许转为中控 + + } break; + } + } + + 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; + } + + mouseStatusVisible(subType) { + if (subType == 'Text') { + this.textShadow.show(); + } + + if (subType == 'Control') { + this.textBorder.show(); + this.controlBorder.show(); + this.text.setStyle({ textFill: '#000' }); + this.control.setStyle({ fill: this.theme.borderContextBackgroundColor }); + } + } + + mouseStatusRecover() { + this.textShadow.hide(); + this.textBorder.hide(); + this.controlBorder.hide(); + this.text.setStyle({ textFill: '#fff' }); + this.control.setStyle({ fill: this.theme.limitControlColor }); + this.setStatus(this.model); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusRecover(); + this.mouseStatusVisible('Control'); + } + } + } + + mouseenter(e) { + if (!this.selected && e.target._subType) { + this.mouseStatusRecover(); + this.mouseStatusVisible(e.target._subType); + } + } + + mouseleave(e) { + if (e.target && e.target._subType) { + if (!this.selected && e.target._subType) { + this.mouseStatusRecover(); + } + } + + } +} diff --git a/src/jmap/components/beijing_01/theme.js b/src/jmap/components/beijing_01/theme.js new file mode 100644 index 000000000..465f921a1 --- /dev/null +++ b/src/jmap/components/beijing_01/theme.js @@ -0,0 +1,430 @@ +import { enableClassExtend, enableClassCheck } from '@/jlmap/util/clazz'; + +/** + * 皮肤风格主题 + * @param {*} opts + */ +function Theme() { + +} + +Theme.prototype = { + + constructor: Theme, + + //道岔字体颜色 + switchTextColor: 'lightgreen', + + /** 皮肤风格编码 */ + code: '03', + + /** 默认背景 颜色*/ + backgroundColor: '#000000', + + /** 默认提示背景 颜色*/ + tipBackgroundColor: 'yellow', + + /** 默认边线 颜色*/ + sidelineColor: '#FFFFFF', + + /** 透明填充 颜色*/ + transparentColor: 'rgba(0,0,0,0)', + + /** 默认字体 大小*/ + textFontSize: 8.2, + + /** 默认字体 族类*/ + textFontFormat: 'consolas', + + /** 默认字体颜色*/ + textFontColor: '#C0C0C0', + + /** 默认字体阴影颜色*/ + textShadowColor: '#FFFF00', + + /** 默认border文字背景色*/ + borderContextBackgroundColor: '#00FFFF', + + /** 默认border颜色*/ + borderColor: '#fff', + + /** 默认border线宽*/ + borderWidth: 1, + + /** 默认名称和设备的距离*/ + nameDistance: 2, + + /** 目的码字体颜色*/ + destinationTextFontColor: 'yellow', + + /** line 颜色*/ + lineWidthColor: '#FFFFFF', + + + /** link 宽度*/ + linkWidth: 4.4, + + /** link 线条颜色*/ + linkColor: '#3F3F3F', + + /** link 字体颜色*/ + linkTextColor: '#FFFFFF', + + + /** StopPoint 颜色*/ + stopPointColor: '#FE0000', + + /** StopPoint 字体颜色*/ + stopPointTextColor: '#FFFFFF', + + zcControlGrayColor: '#00FF00', + + limitControlColor: '#ECE9D8', + + lcControlColor: '#FFFF00', + + zcControlmodeR: 4, + + /** 区段 宽度*/ + sectionWidth: 4.4, + + /** 区段宽超出宽度*/ + sectionBeyondWidth: 0, + + /** 计轴 半径*/ + sectionAxleR: 3, + + /** 计轴和区段之间的距离*/ + sectionAxleDistance: 5, + + /** 限速线的宽度*/ + sectionSpeedLimitLinewidth: 1, + + /** 限速线距离区段距离*/ + sectionSpeedLimitDistance: 5, + + /** 分隔符宽度*/ + sectionSeparatorWidth: 1.2, + + /** 区段侵入颜色*/ + sectionInvadeColor: '#EF0C08', + + /** 限速线颜色*/ + sectionSpeedLimitColor: '#FFFF00', + + /** 逻辑区段颜色*/ + sectionLogicalBackgroundColor: '#FFFF00', + + /** 区段计轴颜色*/ + sectionAxleColor: '#C0C0C0', + + /** 区段边界符颜色*/ + sectionSeparatorColor: '#7F7F7F', + + /** 区段空闲颜色*/ + sectionSpareColor: '#606060', + + /** 逻辑区段名称颜色*/ + sectionLogicalTextColor: '#C0C0C0', + + /** 区段通信车占用颜色**/ + sectionCommunicationOccupiedColor: '#FF0000', + + /** 区段非通讯车占用颜色*/ + sectionUnCommunicationOccupiedColor: '#800080', + + /** 区段路由锁定颜色*/ + sectionRouteLockColor: '#FFFFFF', + + /** 区段故障锁定颜色*/ + sectionFaultLockColor: '#006400', + + /** 区段未定义颜色*/ + sectionUndefinedColor: '#0071C1', + + /** 保护区段锁闭*/ + sectionProtectionSectionLockedColor: '#FEFF00', + + /** 区段计轴预复位*/ + sectionAxleResetColor: '#00FFFF', + + /** 区段封锁颜色*/ + sectionBlockColor: '#800080', + + /** 区段atc切除颜色*/ + sectionAtcExcisionColor: '#A0522D', + + /** 区段ats切除颜色*/ + sectionAtsExcisionColor: '#A0522D', + + /** 区段延时释放颜色*/ + sectionTimeReleaseColor: '#3F3F3F', + + /** 区段保护锁闭*/ + sectionProtectiveLockColor: '#FFFF00', + + /** 区段保护延时解锁*/ + sectionProtectiveTimeReleaseColor: '#0071C1', + + /** 计轴失效*/ + sectionAxleFailure: '#E6A23C', //#FFFF00 + + + /** 道岔单边长度 */ + switchLen: 6, + + /** 道岔边框颜色*/ + switchTextBorderColor: '#FE0000', + + /** 道岔失去颜色*/ + switchTextLossColor: '#FFFFFF', + + /** 道岔定位颜色*/ + switchLocateTextColor: '#00FF00', + + /** 道岔反位颜色*/ + switchInversionColor: '#9C9D09', + + /** 道岔单锁颜色*/ + switchMonolockColor: '#870E10', + + + /** 信号机宽度 */ + signalR: 4, + + /** 灯柱宽度*/ + signalLampStandardWidth: 1.2, + + /** 设备距离区段的距离*/ + signalDistance: 8, + + /** 信号灯按钮边线*/ + signalButtonDashColor: '#FFFFFF', //'#C0C0C0' + + /** 信号灯按钮颜色*/ + signalButtonColor: 'darkgreen', + + /** 信号灯按钮闪烁颜色*/ + signalButtonLightenColor: '#E4EF50', + + /** 信号灯字体颜色*/ + signalTextColor: '#007600', + + /** 信号灯灯柱颜色*/ + signalLampStandardColor: '#5578B6', + + /** 信号灯锁闭*/ + signalBlockColor: '#EF0C08', + + /** 信号灯灰色*/ + signalLampGrayColor: '#7F7F7F', + + /** 信号灯红色*/ + signalLampRedColor: '#FF0000', + + /** 信号灯绿色*/ + signalLampGreenColor: '#00FF00', + + /** 信号灯黄色*/ + signalLampYellowColor: '#FFFF00', + + /** 信号灯白色*/ + signalLampWhiteColor: '#FFFFFF', + + /** 信号灯蓝色*/ + signalLampBlueColor: '#0070C0', + + + /** 公里表距离车站距离*/ + stationKmRangeDistance: 22, + + + /** 控制模式字体大小*/ + stationControlTextSize: 10, + + /** 控制模式灯的半径 */ + stationControlmodeR: 4, + + /** 控制模式之间灯之间的距离*/ + stationControlDistance: 36, + + /** 控制模式灰色*/ + stationControlGrayColor: '#7F7F7F', + + /** 控制模式绿色*/ + stationControlGreenColor: '#00FF00', + + /** 控制模式红色*/ + stationControlRedColor: '#FF0000', + + /** 控制模式黄色*/ + stationControlYellowColor: '#FFFF00', + + + /** 站台和屏蔽门之间的距离*/ + stationStandDistance: 9, + + /** 站台屏蔽门高度*/ + statonStandSafeHeight: 1.6, + + /** 站台首端字体大小*/ + stationStandHeadFontSize: 9, + + /** 站台无人折返*/ + stationStandNoHumanReentryColor: '#0F16DA', + + /** 站台自动换端*/ + stationStandAutoChangeEndsColor: '#0BF400', + + /** 站台空闲颜色*/ + stationStandSpareColor: '#606060', + + /** 站台列车停站颜色*/ + stationStandStopColor: '#FEFE00', + + /** 站台跳停颜色*/ + stationStandJumpStopColor: '#9A99FF', + + /** 站台指定列车跳停颜色*/ + stationStandDesignatedJumpStopColor: 'lightSkyBlue', + + /** 站台紧急关闭颜色*/ + stationStandEmergentCloseColor: '#F61107', + + /** 停站时间字体颜色*/ + stationStandTimeTextColor: '#FFFFFF', + + /** 车站扣车颜色*/ + stationStandStandDetainTrainColor: '#E4EF50', + + /** 中心扣车颜色*/ + stationStandCenterDetainTrainColor: '#FFFFFF', + + /** 车站+中心扣车颜色*/ + stationStandStandAndCenterDetainTrainColor: '#F61107', + + /** 屏蔽门默认颜色*/ + stationStandDoorDefaultColor: '#00FF00', + + /** 屏蔽门切除颜色*/ + stationStandSplitDoorColor: '#F61107', + + /** 车站扣除文字颜色*/ + stationStandDetainTrainTextColor: '#E4EF50', + + + /** 计数器字体颜色*/ + stationCounterTextColor: '#FFFFFF', + + /** 计数器边框颜色*/ + stationCounterBorderColor: '#E4EF50', + + + /** 延迟解锁倒计时和设备文字之间的距离*/ + stationDelayUnlockDistance: 3, + + /** 延时解锁字体颜色*/ + stationDelayUnlockTextColor: '#FFFFFF', + + /** 延迟解锁边框颜色*/ + stationDelayUnlockBorderColor: '#FFFFFF', + + // 停车点折返点目的码名字颜色 + stopPointTexDestCodetColor: '#FFF07B', + + + /** 停车点目的码文字大小*/ + textPointFontSize: 10, + + + /** 列车长度*/ + trainWidth: 40, + + /** 列车高度*/ + trainHeight: 20, + + /** 列车字号*/ + trainTextFontSize: 12, + + /** 列车HDSA字号*/ + trainHSDATextFontSize: 9, + + /** 列车信号的半径*/ + trainConflictR: 3, + + /** 列车信号距离车的距离*/ + trainConflictDistance: 5, + + /** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/ + trainMoreLength: 0, + + /** 列车和车头之间的间距*/ + trainHeadDistance: 4, + + /** 列车竖杠的宽度*/ + trainConntWidth: 3, + + /** 列车竖杠和方向之间的间隔*/ + trainPadding: 4, + + /** 列车方向的宽度*/ + trainArrowWidth: 6, + + /** 列车和区段之间的距离*/ + trainDistance: 30, + + /** 列车边线颜色*/ + trainSidelineColor: '#C0C0C0', + + /** 列车背景*/ + trainBackground: '#000000', + + /** 列车 灰色*/ + trainGrayColor: '#C0C0C0', + + /** 列车 白色*/ + trainWitheColor: '#FFFFFF', + + /** 列车 棕色*/ + trainBrownColor: '#A0522D', + + /** 列车 黄色*/ + trainYellowColor: '#FFFF00', + + /** 列车 棕灰色 */ + trainBrown1Color: '#725A64', + + /** 列车 绿色*/ + trainGreenColor: '#00FF00', + + /** 列车 蓝色*/ + trainBlueColor: '#3265FF', + + /** 列车 红色*/ + trainRedColor: '#FF0000', + + /** 列车 橘色*/ + trainOrangeColor: 'orange', + + /** 列车 紫色*/ + trainPurpleColor: 'purple', + + /** 列车 粉色*/ + trainPinkColor: 'pink', + + + /** 车次窗高度*/ + trainWindowWidth: 40, + + /** 车次窗高度*/ + trainWindowHeight: 15, + + /** 车次窗颜色*/ + trainWindowColor: '#fff', +}; + +// Enable Theme.extend. +enableClassExtend(Theme); +enableClassCheck(Theme); + +export default Theme; \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/convert.js b/src/jmap/components/chengdou_03/convert.js new file mode 100644 index 000000000..c0d9c5fae --- /dev/null +++ b/src/jmap/components/chengdou_03/convert.js @@ -0,0 +1,309 @@ +import { createMartPoint, createSeriesModel, createMarkLineModels, HexColor, ConvertSheetToList } from '@/utils/runPlan'; + +export default { + /** 边缘高度*/ + EdgeHeight: 600, + + /** 间隔高度*/ + CoordMultiple: 1, + + /** 偏移时间*/ + TranslationTime: 60 * 60 * 2, + + /** excel解析配置*/ + ExcelConfig: { + beginRow: 1, + beginCol: 0, + fieldNum: 10, + sepField: '车次', + columns: { + '车站名': { key: 'stationName', formatter: (val) => { return val; } }, + '到点': { key: 'arriveTime', formatter: (val) => { return val; } }, + '发点': { key: 'departureTime', formatter: (val) => { return val; } }, + } + }, + + /** 解析exal数据转换为Json后台数据*/ + importData(Sheet, JsonData) { + let dataList = ConvertSheetToList(Sheet, true); + let needList = Object.keys(this.ExcelConfig.columns); + + if (dataList && dataList.length) { + for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += this.ExcelConfig.fieldNum + 1) { + let isContinue = true; + let tripObj = { code: '', arrivalList: [] }; + + for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) { + isContinue = false; + + let stationObj = {}; + for (var index = 0; index < this.ExcelConfig.fieldNum; index += 1) { + if (dataList[colIndex + index]) { + let title = dataList[colIndex + index][0]; + let value = dataList[colIndex + index][rowIndex]; + + if (title && value) { + // 数据列解析 + isContinue = true; + let titleStr = `${title}`.trim(); + let valueStr = `${value}`.trim(); + + if (titleStr == this.ExcelConfig.sepField) { + if (tripObj.code) { + let length = tripObj.arrivalList.length; + if (length == 1) { + tripObj.arrivalList[0]['flag'] = true; + } + JsonData.push(tripObj); + tripObj = { code: valueStr, arrivalList: [] }; + } else { + tripObj.code = valueStr; + } + } + + // 取需要的字段 + if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) { + stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr); + } + } + } + } + + // 添加字段值 + if (Object.keys(stationObj).length) { + tripObj.arrivalList.push(stationObj); + } + } + + // 添加最后那条没有车次的记录 + if (tripObj.code) { + let length = tripObj.arrivalList.length; + if (length) { + tripObj.arrivalList[length - 1]['flag'] = true; + } + JsonData.push(tripObj); + } + } + } + + return JsonData; + }, + + /** 将后台数据解析成图表*/ + convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) { + let models = []; + + if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) { + /** 按服务遍历数据*/ + data.serviceNumberDataList.forEach((service) => { + /** 按车次遍历数据*/ + let opt = { name: '', markPointData: [], data: [] }; + if (service.tripNumberDataList && service.tripNumberDataList.length) { + service.tripNumberDataList.forEach((train, j) => { + let pointdata = {}; + let idx = 0; + let num = 0; + let lastPoint = null; + let nextPoint = null; + + /** 如果车次号为空,不显示名称*/ + if (train.tripNumber) { + /** 创建标记点名称和坐标*/ + pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`; + pointdata.color = '#000' || lineStyle.color; + pointdata.directionCode = train.directionCode; + pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)]; + + /** 给服务对象添加服务名称和标记点*/ + opt.markPointData.push(createMartPoint(pointdata)); + /** 创建服务号名称*/ + opt.name = `${service.serviceNumber}`; + } + + /** 计算非折返点车次点坐标集合*/ + train.stationTimeList.forEach((elem, index) => { + idx = index; + 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) { + opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode]); + } + }); + + /** 计算折返点车次坐标点集合*/ + if (!service.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) { + lastPoint = train.stationTimeList[idx - 1]; + nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1]; + num = this.computedReentryNumber(train.tripNumber); + opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode]); + opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode]); + } + + /** 如果是备用车,按车次添加线*/ + if (service.backup) { + /** 创建一条完成的服务数据*/ + opt.name += j; + let model = createSeriesModel(opt, Object.assign({ color: HexColor.toCreate() }, lineStyle)); + if (model) { + models.push(model); + opt = { name: '', markPointData: [], data: [] }; + } + } + }); + + //不是备用车,按服务添加线 + if (!service.backup) { + /** 创建一条完成的服务数据*/ + let model = createSeriesModel(opt, Object.assign({ color: HexColor.toCreate() }, 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, false)], + name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`, + color: lineStyle.color || '#000' + })); + } + + /** 计算折返点*/ + let nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false), elem.directionCode]; + if (serie.data.length > 0) { + let lastPoint = serie.data[serie.data.length - 1]; + if (lastPoint[2] !== nextPoint[2]) { + let num = this.computedReentryNumber(elem.tripNumber); + serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[2], num), lastPoint[2]]); + serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2], num), lastPoint[2]]); + } + } + + /** 添加车组号数据到对应的服务图数据中*/ + serie.data.push(nextPoint); + + /** 保证原始数据排序*/ + serie.data.sort((a, b) => { + return parseInt(a[0]) - parseInt(b[0]); + }); + } + }); + }); + } + + return series; + }, + + /** 初始化Y轴*/ + initializeYaxis(stations) { + return createMarkLineModels(stations, (elem) => { + return this.EdgeHeight + elem.kmRange * this.CoordMultiple; + }); + }, + + /** 将后台数据转换为试图序列模型*/ + convertStationsToMap(stations) { + let 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) { + let yText = ''; + + stations.forEach(elem => { + if (elem.kmRange < parseInt(params.value) / this.CoordMultiple - this.EdgeHeight) { + yText = elem.kmRange + 'm'; + } + }); + + return yText; + }, + + /** 根据是否和上一个车次是否相交,计算下一个车次的折返的高度*/ + computedReentryNumber(code) { + return parseInt(code || 1) % 2 ? 1 : 2; + }, + + /** 根据方向计算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, directionCode, isSpecial, num) { + let defaultVlue = 0; + let station = stations.find(it => { return it.code == elem.stationCode; }); + if (station) { + defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; + if (isSpecial) { + defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode, num); + } + } + + return defaultVlue; + } +}; \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/alxeEffective.vue b/src/jmap/components/chengdou_03/menus/dialog/alxeEffective.vue new file mode 100644 index 000000000..007eaa841 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/alxeEffective.vue @@ -0,0 +1,381 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/cancelAllLimit.vue b/src/jmap/components/chengdou_03/menus/dialog/cancelAllLimit.vue new file mode 100644 index 000000000..422668df6 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/cancelAllLimit.vue @@ -0,0 +1,355 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/childDialog/childDialog/noticeInfo.vue b/src/jmap/components/chengdou_03/menus/dialog/childDialog/childDialog/noticeInfo.vue new file mode 100644 index 000000000..85c64832c --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/childDialog/childDialog/noticeInfo.vue @@ -0,0 +1,77 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmControl.vue b/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmControl.vue new file mode 100644 index 000000000..bbb3a2587 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmControl.vue @@ -0,0 +1,360 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmControlSpeed.vue b/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmControlSpeed.vue new file mode 100644 index 000000000..31d4587e0 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmControlSpeed.vue @@ -0,0 +1,153 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmSignalUnlock.vue b/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmSignalUnlock.vue new file mode 100644 index 000000000..c6f069ffe --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmSignalUnlock.vue @@ -0,0 +1,118 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmTip.vue b/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmTip.vue new file mode 100644 index 000000000..6917c9a94 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmTip.vue @@ -0,0 +1,68 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmTrain.vue b/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmTrain.vue new file mode 100644 index 000000000..ccfcf9036 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/childDialog/confirmTrain.vue @@ -0,0 +1,168 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/childDialog/password.vue b/src/jmap/components/chengdou_03/menus/dialog/childDialog/password.vue new file mode 100644 index 000000000..e69de29bb diff --git a/src/jmap/components/chengdou_03/menus/dialog/childDialog/passwordInputBox.vue b/src/jmap/components/chengdou_03/menus/dialog/childDialog/passwordInputBox.vue new file mode 100644 index 000000000..dda9defa7 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/childDialog/passwordInputBox.vue @@ -0,0 +1,206 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/childDialog/popupAlarm.vue b/src/jmap/components/chengdou_03/menus/dialog/childDialog/popupAlarm.vue new file mode 100644 index 000000000..e3375f76f --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/childDialog/popupAlarm.vue @@ -0,0 +1,90 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/routeControl.vue b/src/jmap/components/chengdou_03/menus/dialog/routeControl.vue new file mode 100644 index 000000000..7b9c86dd9 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/routeControl.vue @@ -0,0 +1,363 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/routeDetail.vue b/src/jmap/components/chengdou_03/menus/dialog/routeDetail.vue new file mode 100644 index 000000000..80eb337e1 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/routeDetail.vue @@ -0,0 +1,141 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/routeGuide.vue b/src/jmap/components/chengdou_03/menus/dialog/routeGuide.vue new file mode 100644 index 000000000..08324230b --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/routeGuide.vue @@ -0,0 +1,269 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/routeSelection.vue b/src/jmap/components/chengdou_03/menus/dialog/routeSelection.vue new file mode 100644 index 000000000..bef8f5c64 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/routeSelection.vue @@ -0,0 +1,256 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/sectionCmdControl.vue b/src/jmap/components/chengdou_03/menus/dialog/sectionCmdControl.vue new file mode 100644 index 000000000..7c03bcabb --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/sectionCmdControl.vue @@ -0,0 +1,435 @@ + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/sectionControl.vue b/src/jmap/components/chengdou_03/menus/dialog/sectionControl.vue new file mode 100644 index 000000000..7b68241a3 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/sectionControl.vue @@ -0,0 +1,215 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/sectionDetail.vue b/src/jmap/components/chengdou_03/menus/dialog/sectionDetail.vue new file mode 100644 index 000000000..1715a0c72 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/sectionDetail.vue @@ -0,0 +1,116 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/speedCmdControl.vue b/src/jmap/components/chengdou_03/menus/dialog/speedCmdControl.vue new file mode 100644 index 000000000..6b5d96853 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/speedCmdControl.vue @@ -0,0 +1,783 @@ + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/standControl.vue b/src/jmap/components/chengdou_03/menus/dialog/standControl.vue new file mode 100644 index 000000000..8a7572679 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/standControl.vue @@ -0,0 +1,621 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/standDetail.vue b/src/jmap/components/chengdou_03/menus/dialog/standDetail.vue new file mode 100644 index 000000000..8dc8e9136 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/standDetail.vue @@ -0,0 +1,211 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/stationCmdControl.vue b/src/jmap/components/chengdou_03/menus/dialog/stationCmdControl.vue new file mode 100644 index 000000000..60b673402 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/stationCmdControl.vue @@ -0,0 +1,389 @@ + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/switchCmdControl.vue b/src/jmap/components/chengdou_03/menus/dialog/switchCmdControl.vue new file mode 100644 index 000000000..0e48b5abc --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/switchCmdControl.vue @@ -0,0 +1,459 @@ + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/switchControl.vue b/src/jmap/components/chengdou_03/menus/dialog/switchControl.vue new file mode 100644 index 000000000..5b1ff0a3e --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/switchControl.vue @@ -0,0 +1,416 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/trainControl.vue b/src/jmap/components/chengdou_03/menus/dialog/trainControl.vue new file mode 100644 index 000000000..e4a8b6b0f --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/trainControl.vue @@ -0,0 +1,326 @@ + + + + diff --git a/src/jmap/components/chengdou_03/menus/dialog/trainCreate.vue b/src/jmap/components/chengdou_03/menus/dialog/trainCreate.vue new file mode 100644 index 000000000..dd23e839e --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/trainCreate.vue @@ -0,0 +1,158 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/trainCreateNumber.vue b/src/jmap/components/chengdou_03/menus/dialog/trainCreateNumber.vue new file mode 100644 index 000000000..f58075978 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/trainCreateNumber.vue @@ -0,0 +1,181 @@ + + + + diff --git a/src/jmap/components/chengdou_03/menus/dialog/trainDelete.vue b/src/jmap/components/chengdou_03/menus/dialog/trainDelete.vue new file mode 100644 index 000000000..b18896a78 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/trainDelete.vue @@ -0,0 +1,143 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/trainDeleteNumber.vue b/src/jmap/components/chengdou_03/menus/dialog/trainDeleteNumber.vue new file mode 100644 index 000000000..3defdd46a --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/trainDeleteNumber.vue @@ -0,0 +1,176 @@ + + + + diff --git a/src/jmap/components/chengdou_03/menus/dialog/trainDetailInfo.vue b/src/jmap/components/chengdou_03/menus/dialog/trainDetailInfo.vue new file mode 100644 index 000000000..6e69ed613 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/trainDetailInfo.vue @@ -0,0 +1,376 @@ + + + + diff --git a/src/jmap/components/chengdou_03/menus/dialog/trainEditNumber.vue b/src/jmap/components/chengdou_03/menus/dialog/trainEditNumber.vue new file mode 100644 index 000000000..1a374fc09 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/trainEditNumber.vue @@ -0,0 +1,192 @@ + + + + diff --git a/src/jmap/components/chengdou_03/menus/dialog/trainMove.vue b/src/jmap/components/chengdou_03/menus/dialog/trainMove.vue new file mode 100644 index 000000000..5f700640b --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/trainMove.vue @@ -0,0 +1,190 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/dialog/trainMoveNumber.vue b/src/jmap/components/chengdou_03/menus/dialog/trainMoveNumber.vue new file mode 100644 index 000000000..bfb840a44 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/trainMoveNumber.vue @@ -0,0 +1,194 @@ + + + + diff --git a/src/jmap/components/chengdou_03/menus/dialog/trainSwitch.vue b/src/jmap/components/chengdou_03/menus/dialog/trainSwitch.vue new file mode 100644 index 000000000..c831b3746 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/dialog/trainSwitch.vue @@ -0,0 +1,195 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/index.vue b/src/jmap/components/chengdou_03/menus/index.vue new file mode 100644 index 000000000..6590ced81 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/index.vue @@ -0,0 +1,360 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuBar.vue b/src/jmap/components/chengdou_03/menus/menuBar.vue new file mode 100644 index 000000000..58b00a99e --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuBar.vue @@ -0,0 +1,1198 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuCancel.vue b/src/jmap/components/chengdou_03/menus/menuCancel.vue new file mode 100644 index 000000000..1402f1d29 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuCancel.vue @@ -0,0 +1,150 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/twoConfirmation.vue b/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/twoConfirmation.vue new file mode 100644 index 000000000..747b7cbfc --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/twoConfirmation.vue @@ -0,0 +1,127 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/userAdd.vue b/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/userAdd.vue new file mode 100644 index 000000000..2bea83e3e --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/userAdd.vue @@ -0,0 +1,162 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/userDelete.vue b/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/userDelete.vue new file mode 100644 index 000000000..9316bb37b --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/userDelete.vue @@ -0,0 +1,134 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/userEdit.vue b/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/userEdit.vue new file mode 100644 index 000000000..95e4e8fa8 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/childDialog/userEdit.vue @@ -0,0 +1,178 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/helpAbout.vue b/src/jmap/components/chengdou_03/menus/menuDialog/helpAbout.vue new file mode 100644 index 000000000..698bd5429 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/helpAbout.vue @@ -0,0 +1,131 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/limitSpeed.vue b/src/jmap/components/chengdou_03/menus/menuDialog/limitSpeed.vue new file mode 100644 index 000000000..0ac49d4d4 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/limitSpeed.vue @@ -0,0 +1,135 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/manageUser.vue b/src/jmap/components/chengdou_03/menus/menuDialog/manageUser.vue new file mode 100644 index 000000000..f7a2e1589 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/manageUser.vue @@ -0,0 +1,290 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/passwordBox.vue b/src/jmap/components/chengdou_03/menus/menuDialog/passwordBox.vue new file mode 100644 index 000000000..9feaf8232 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/passwordBox.vue @@ -0,0 +1,221 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/setLimitSpeed.vue b/src/jmap/components/chengdou_03/menus/menuDialog/setLimitSpeed.vue new file mode 100644 index 000000000..6f19587a8 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/setLimitSpeed.vue @@ -0,0 +1,275 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/stationControlConvert.vue b/src/jmap/components/chengdou_03/menus/menuDialog/stationControlConvert.vue new file mode 100644 index 000000000..f71a87c7e --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/stationControlConvert.vue @@ -0,0 +1,416 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/trainAdd.vue b/src/jmap/components/chengdou_03/menus/menuDialog/trainAdd.vue new file mode 100644 index 000000000..7ddcff22c --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/trainAdd.vue @@ -0,0 +1,162 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/trainDelete.vue b/src/jmap/components/chengdou_03/menus/menuDialog/trainDelete.vue new file mode 100644 index 000000000..398ccb370 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/trainDelete.vue @@ -0,0 +1,149 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/trainTranstalet.vue b/src/jmap/components/chengdou_03/menus/menuDialog/trainTranstalet.vue new file mode 100644 index 000000000..c82352003 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/trainTranstalet.vue @@ -0,0 +1,152 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/viewDevice.vue b/src/jmap/components/chengdou_03/menus/menuDialog/viewDevice.vue new file mode 100644 index 000000000..0ac0b1c92 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/viewDevice.vue @@ -0,0 +1,166 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/viewName.vue b/src/jmap/components/chengdou_03/menus/menuDialog/viewName.vue new file mode 100644 index 000000000..5389803c5 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/viewName.vue @@ -0,0 +1,265 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuDialog/viewTrainId.vue b/src/jmap/components/chengdou_03/menus/menuDialog/viewTrainId.vue new file mode 100644 index 000000000..3e8ad4617 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuDialog/viewTrainId.vue @@ -0,0 +1,183 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuLimit.vue b/src/jmap/components/chengdou_03/menus/menuLimit.vue new file mode 100644 index 000000000..44fcba0e7 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuLimit.vue @@ -0,0 +1,118 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuSection.vue b/src/jmap/components/chengdou_03/menus/menuSection.vue new file mode 100644 index 000000000..d077b7218 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuSection.vue @@ -0,0 +1,403 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuSignal.vue b/src/jmap/components/chengdou_03/menus/menuSignal.vue new file mode 100644 index 000000000..6aee6412f --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuSignal.vue @@ -0,0 +1,584 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuStation.vue b/src/jmap/components/chengdou_03/menus/menuStation.vue new file mode 100644 index 000000000..ded0d7dfc --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuStation.vue @@ -0,0 +1,153 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuStationControl.vue b/src/jmap/components/chengdou_03/menus/menuStationControl.vue new file mode 100644 index 000000000..02efad115 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuStationControl.vue @@ -0,0 +1,69 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuStationStand.vue b/src/jmap/components/chengdou_03/menus/menuStationStand.vue new file mode 100644 index 000000000..09d474532 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuStationStand.vue @@ -0,0 +1,372 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuSwitch.vue b/src/jmap/components/chengdou_03/menus/menuSwitch.vue new file mode 100644 index 000000000..879dd46d3 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuSwitch.vue @@ -0,0 +1,463 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuTool.vue b/src/jmap/components/chengdou_03/menus/menuTool.vue new file mode 100644 index 000000000..dc32a9673 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuTool.vue @@ -0,0 +1,205 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/menuTrain.vue b/src/jmap/components/chengdou_03/menus/menuTrain.vue new file mode 100644 index 000000000..e9dffdfad --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/menuTrain.vue @@ -0,0 +1,488 @@ + + + diff --git a/src/jmap/components/chengdou_03/menus/passiveDialog/alarm.vue b/src/jmap/components/chengdou_03/menus/passiveDialog/alarm.vue new file mode 100644 index 000000000..268e5011f --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/passiveDialog/alarm.vue @@ -0,0 +1,214 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/passiveDialog/control.vue b/src/jmap/components/chengdou_03/menus/passiveDialog/control.vue new file mode 100644 index 000000000..6936f85fc --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/passiveDialog/control.vue @@ -0,0 +1,286 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/passiveDialog/timeout.vue b/src/jmap/components/chengdou_03/menus/passiveDialog/timeout.vue new file mode 100644 index 000000000..91cb2849d --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/passiveDialog/timeout.vue @@ -0,0 +1,106 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/statusBar.vue b/src/jmap/components/chengdou_03/menus/statusBar.vue new file mode 100644 index 000000000..0fad48767 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/statusBar.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/statusDownTrainDetail.vue b/src/jmap/components/chengdou_03/menus/statusDownTrainDetail.vue new file mode 100644 index 000000000..ce4f82f65 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/statusDownTrainDetail.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/statusUpTrainDetail.vue b/src/jmap/components/chengdou_03/menus/statusUpTrainDetail.vue new file mode 100644 index 000000000..9bd682637 --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/statusUpTrainDetail.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menus/utils/menuItemStatus.js b/src/jmap/components/chengdou_03/menus/utils/menuItemStatus.js new file mode 100644 index 000000000..29b12690e --- /dev/null +++ b/src/jmap/components/chengdou_03/menus/utils/menuItemStatus.js @@ -0,0 +1,589 @@ +import store from '@/store'; +import { mapStatusEnum, getStatusObject } from '@/scripts/StatusDic'; +import { OperateMode } from '@/scripts/ConstDic'; + +export function getCurrentStatusObject() { + return getStatusObject(store.getters['menuOperation/selected']); +} + +/** 系统类型 */ +export const SystemType = { + '01': 'local', // 现地工作站 + '02': 'central' // 中心调度工作站 +}; + +export const StationControlType = { + '01': 'center', // 中控 + '02': 'station',// 站控 + '03': 'station', +}; + +// 控制禁用 +export const MenuDisabledStatus = { + Section: { + //故障解锁 + fault() { + }, + //切除 + split() { + let device = getCurrentStatusObject(); + if (device && device.cutOff != mapStatusEnum.Section.cutOff.Default) { + return true; + } + }, + //激活 + active() { + let device = getCurrentStatusObject(); + if (device && device.cutOff == mapStatusEnum.Section.cutOff.Default) { + return true; + } + }, + //区段封锁 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Section.status.Status06) { + return true; + } + }, + //区段解禁 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Section.status.Status06) { + return true; + } + }, + //区段设置限速 + setSpeed() { + }, + //区段取消限速 + cancelSpeed() { + let device = getCurrentStatusObject(); + if (device && device.speedUpperLimit == mapStatusEnum.Section.speedUpperLimit.Default) { + return true; + } + }, + //新建列车 + newTrain() { + }, + //计轴预复位 + axlePreReset() { + }, + //设置计轴有效 + alxeEffective() { + }, + //设置计轴失效 + alxeFailure() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Section.status.Status13) { + return true; + } + }, + }, + Signal: { + //进路选排 + arrangementRoute() { + + }, + //进路取消 + cancelTrainRoute() { + }, + //信号封闭 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Signal.status.Status04) { + return true; + } + }, + //信号解封 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Signal.status.Status04) { + return true; + } + }, + //信号重开 + reopenSignal() { + }, + //进路引导 + guide() { + }, + //设置联锁自动进路 + setAutoInterlock() { + }, + //取消联锁自动进路 + cancelAutoInterlock() { + }, + //设置联锁自动触发 + setAutoTrigger() { + }, + //取消联锁自动触发 + cancelAutoTrigger() { + }, + //关灯 + signalClose() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Signal.status.Status01) { + return true; + } + }, + //总人解 + humanTrainRoute() { + }, + //人工控 + humanControl() { + }, + //ats自动控 + atsAutoControl() { + }, + //查询进路状态 + detail() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Station: { + //全站设置联锁自动触发 + setAutoTrigger() { + }, + //全站取消联锁自动触发 + cancelAutoTrigger() { + }, + //上电解锁 + powerUnLock() { + }, + //执行关键操作测试 + execKeyOperationTest() { + }, + //所有进路自排开 + atsAutoControlALL() { + }, + //所有进路自排关 + humanControlALL() { + }, + //设置ZC故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消ZC故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + StationControl: { + //紧急站控 + emergencyStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status03) { + return true; + } + }, + //请求站控 + requestStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status02) { + return true; + } + }, + //强行站控 + forcedStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status02) { + return true; + } + }, + //请求中控 + requestCentralControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status01) { + return true; + } + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + StationStand: { + //设置扣车 + setDetainTrain() { + let device = getCurrentStatusObject(); + if (device && device.holdStatus != mapStatusEnum.StationStand.holdStatus.Status01) { + return true; + } + }, + //取消扣车 + cancelDetainTrain() { + let device = getCurrentStatusObject(); + if (device && device.holdStatus == mapStatusEnum.StationStand.holdStatus.Status01) { + return true; + } + }, + //强制取消扣车 + cancelDetainTrainForce() { + let device = getCurrentStatusObject(); + if (device && device.holdStatus == mapStatusEnum.StationStand.holdStatus.Status01) { + return true; + } + }, + //设置全站扣车 + cancelDetainTrainAll() { + }, + //设置运行等级 + setRunLevel() { + }, + //设置停站时间 + setStopTime() { + }, + //设置跳停 + setJumpStop() { + let device = getCurrentStatusObject(); + if (device && device.jumpStopStatus != mapStatusEnum.StationStand.jumpStopStatus.Status01) { + return true; + } + }, + //取消跳停 + cancelJumpStop() { + let device = getCurrentStatusObject(); + if (device && device.jumpStopStatus == mapStatusEnum.StationStand.jumpStopStatus.Status01) { + return true; + } + }, + //提前发车 + earlyDeparture() { + }, + //站台详细信息 + detail() { + }, + //设置折返策略 + setBackStrategy() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Switch: { + //单锁 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Switch.status.Status10) { + return true; + } + }, + //解锁 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Switch.status.Status10) { + return true; + } + }, + //封锁 + block() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Switch.status.Status14) { + return true; + } + }, + //解封 + unblock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Switch.status.Status14) { + return true; + } + }, + //强扳 + switchTurnoutForce() { + }, + //转动 + switchTurnout() { + }, + //道岔故障解锁 + fault() { + }, + //计轴预复位 + axlePreReset() { + }, + //道岔切除 + split() { + }, + //道岔激活 + active() { + }, + //道岔设置速度 + setSpeed() { + // let device = getCurrentStatusObject(); + }, + //设置计轴有效 + alxeEffective() { + }, + //道岔取消速度 + cancelSpeed() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + }, + //单操到定位 + locate() { + }, + //单操到反位 + reverse() { + }, + //区故解 + solution() { + }, + //属性 + property() { + } + }, + Train: { + //添加列车识别号 + addTrainId() { + }, + //删除列车识别号 + delTrainId() { + }, + //修改列车识别号 + editTrainId() { + }, + //修改车组号 + editTrainNo() { + }, + //创建车组号 + createTrainNo() { + }, + //移动车组号 + moveTrainNo() { + }, + //删除车组号 + deleteTrainNo() { + }, + //移动列车识别号 + moveTrainId() { + }, + //交换列车识别号 + switchTrainId() { + }, + //设计划车 + setPlanTrainId() { + }, + //设目的地车 + destinationTrainId() { + }, + //设人工车 + artificialTrainId() { + }, + //详细列车信息 + detailTrainInfo() { + }, + //设置限速 + limitSpeed() { + }, + //设置通信故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消通信故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + 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) { + let selected = store.getters['menuOperation/selected']; + let control, 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 if (selected._type == 'LimitControl') { + control = store.getters['map/getStationControlByStationCode'](selected.code); + } else { + control = store.getters['map/getStationControlByStationCode'](selected.stationCode); + } + if (control) { + let controlStatus = getStatusObject(control); + if (store.state.map.prdType != '') { + let type = SystemType[store.state.map.prdType]; + let status = StationControlType[controlStatus.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) { + let menu = []; + if (store.state.map.prdType != '') { + let type = SystemType[store.state.map.prdType]; + 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; + } + } + }); + } + } + return menu; +} + +/** + * 离开菜单以及执行完菜单取消选中状态 + */ +export function mouseCancelStatus(device) { + Object.assign(device, { _selected: false }); + let viewInstance = store.state.map.jlmap.getViewInstanceByDevice({ _type: device._type, _code: device.code }); + if (viewInstance && viewInstance['mouseleave']) { + viewInstance['selected'] = false; + viewInstance['mouseleave'](store.state.map.jlmap._zr.curEvent); + } +} diff --git a/src/jmap/components/chengdou_03/menusPlan/addTask.vue b/src/jmap/components/chengdou_03/menusPlan/addTask.vue new file mode 100644 index 000000000..10a8fd228 --- /dev/null +++ b/src/jmap/components/chengdou_03/menusPlan/addTask.vue @@ -0,0 +1,163 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menusPlan/chooseTemplatePlan.vue b/src/jmap/components/chengdou_03/menusPlan/chooseTemplatePlan.vue new file mode 100644 index 000000000..721ec4684 --- /dev/null +++ b/src/jmap/components/chengdou_03/menusPlan/chooseTemplatePlan.vue @@ -0,0 +1,119 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menusPlan/components/dataTable.vue b/src/jmap/components/chengdou_03/menusPlan/components/dataTable.vue new file mode 100644 index 000000000..6d0ad3146 --- /dev/null +++ b/src/jmap/components/chengdou_03/menusPlan/components/dataTable.vue @@ -0,0 +1,203 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menusPlan/createTodayPlan.vue b/src/jmap/components/chengdou_03/menusPlan/createTodayPlan.vue new file mode 100644 index 000000000..8badd98e4 --- /dev/null +++ b/src/jmap/components/chengdou_03/menusPlan/createTodayPlan.vue @@ -0,0 +1,154 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menusPlan/createWeekPlan.vue b/src/jmap/components/chengdou_03/menusPlan/createWeekPlan.vue new file mode 100644 index 000000000..c6f6f74b7 --- /dev/null +++ b/src/jmap/components/chengdou_03/menusPlan/createWeekPlan.vue @@ -0,0 +1,127 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menusPlan/deleteTask.vue b/src/jmap/components/chengdou_03/menusPlan/deleteTask.vue new file mode 100644 index 000000000..b661ed20e --- /dev/null +++ b/src/jmap/components/chengdou_03/menusPlan/deleteTask.vue @@ -0,0 +1,64 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menusPlan/deleteTodayPlan.vue b/src/jmap/components/chengdou_03/menusPlan/deleteTodayPlan.vue new file mode 100644 index 000000000..284028f97 --- /dev/null +++ b/src/jmap/components/chengdou_03/menusPlan/deleteTodayPlan.vue @@ -0,0 +1,53 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menusPlan/managePlanList.vue b/src/jmap/components/chengdou_03/menusPlan/managePlanList.vue new file mode 100644 index 000000000..ea2a60641 --- /dev/null +++ b/src/jmap/components/chengdou_03/menusPlan/managePlanList.vue @@ -0,0 +1,124 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menusPlan/modifyingPlan.vue b/src/jmap/components/chengdou_03/menusPlan/modifyingPlan.vue new file mode 100644 index 000000000..c9b645b7c --- /dev/null +++ b/src/jmap/components/chengdou_03/menusPlan/modifyingPlan.vue @@ -0,0 +1,179 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/menusPlan/modifyingTask.vue b/src/jmap/components/chengdou_03/menusPlan/modifyingTask.vue new file mode 100644 index 000000000..5f197a1ff --- /dev/null +++ b/src/jmap/components/chengdou_03/menusPlan/modifyingTask.vue @@ -0,0 +1,315 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/model.js b/src/jmap/components/chengdou_03/model.js new file mode 100644 index 000000000..a772b863a --- /dev/null +++ b/src/jmap/components/chengdou_03/model.js @@ -0,0 +1,70 @@ +/** + * 公共字段部分默认初始值 + */ +const modelPublicInitialValue = { + Signal: { + lampPositionType: '02', + lampPostType: '02' + } +}; + +/** + * 在绘图创建Model数据时,根据皮肤类型修改公共属性默认值 + * @param {Object} model + */ +export function InitPublicProperties(model) { + if (model) { + let modelInitial = modelPublicInitialValue[model._type]; + if (modelInitial) { + for (let prop in modelInitial) { + model[prop] = modelInitial[prop]; + } + } + } + + return model; +} + +/** + * 私有字段部分默认初始值 + */ +const modelPrivateInitialValue = { + StationControl: { + indicatorShow: true //标识灯名称显示 + }, + Section: { + borderBorderShow: true, //区段边界显示 + standTrackNameShow: true, //站台轨名称显示 + reentryTrackNameShow: true, //折返轨名称显示 + transferTrackNameShow: true, //转换轨名称显示 + + }, + Signal: { + linkageAutoRouteShow: true, //联锁自动进路表示灯显示 + atsAutoTriggerShow: true //ATS自动触发表示灯显示 + }, + Train: { + nameFormat: 'targetCode:serviceNumber:tripNumber', //字体格式 + nameFontSize: 10, //字体大小 + }, + TrainWindow: { + trainWindowShow: true, + } +}; + +/** + * 加载Model数据时,根据皮肤类型修改前端私有属性默认值 + * @param {Object} model + */ +export function InitPrivateProperties(model) { + if (model) { + let modelInitial = modelPrivateInitialValue[model._type]; + if (modelInitial) { + for (let prop in modelInitial) { + model[prop] = modelInitial[prop]; + } + } + } + + return model; +} \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/planSchedule/index.vue b/src/jmap/components/chengdou_03/planSchedule/index.vue new file mode 100644 index 000000000..31c94ac96 --- /dev/null +++ b/src/jmap/components/chengdou_03/planSchedule/index.vue @@ -0,0 +1,413 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/planSchedule/menuBar.vue b/src/jmap/components/chengdou_03/planSchedule/menuBar.vue new file mode 100644 index 000000000..8ee4f4a83 --- /dev/null +++ b/src/jmap/components/chengdou_03/planSchedule/menuBar.vue @@ -0,0 +1,505 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/planSchedule/menuTool.vue b/src/jmap/components/chengdou_03/planSchedule/menuTool.vue new file mode 100644 index 000000000..d3ecde016 --- /dev/null +++ b/src/jmap/components/chengdou_03/planSchedule/menuTool.vue @@ -0,0 +1,172 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/planSchedule/schedule.vue b/src/jmap/components/chengdou_03/planSchedule/schedule.vue new file mode 100644 index 000000000..a81ee9a31 --- /dev/null +++ b/src/jmap/components/chengdou_03/planSchedule/schedule.vue @@ -0,0 +1,491 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/planSchedule/statusBar.vue b/src/jmap/components/chengdou_03/planSchedule/statusBar.vue new file mode 100644 index 000000000..f85d6c6ce --- /dev/null +++ b/src/jmap/components/chengdou_03/planSchedule/statusBar.vue @@ -0,0 +1,100 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/planSchedule/titleBar.vue b/src/jmap/components/chengdou_03/planSchedule/titleBar.vue new file mode 100644 index 000000000..689c3486a --- /dev/null +++ b/src/jmap/components/chengdou_03/planSchedule/titleBar.vue @@ -0,0 +1,75 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/shape/ImageControl.js b/src/jmap/components/chengdou_03/shape/ImageControl.js new file mode 100644 index 000000000..fa17e1e11 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/ImageControl.js @@ -0,0 +1,65 @@ +/* +* ZC区域控制模式 +*/ +import Group from 'zrender/src/container/Group'; +import Image from 'zrender/src/graphic/Image'; + +export default class ImageControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = model.zIndex || 5; + this.model = model; + this.theme = theme; + this._create(model); + } + + _create(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); + } + } + + // 整体图片 + transformRotation(item) { + if (this.model.rotate) { + let origin = [this.model.position.x, this.model.position.y]; + let 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/components/chengdou_03/shape/Section.js b/src/jmap/components/chengdou_03/shape/Section.js new file mode 100644 index 000000000..6747752a2 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/Section.js @@ -0,0 +1,1328 @@ +import Group from 'zrender/src/container/Group'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import Polyline from 'zrender/src/graphic/shape/Polyline'; +import Circle from 'zrender/src/graphic/shape/Circle'; +import Line from 'zrender/src/graphic/shape/Line'; +import BezierCurve from 'zrender/src/graphic/shape/BezierCurve'; +import Text from 'zrender/src/graphic/Text'; +import JTriangle from '@/jlmap/util/JTriangle'; +import ModelType from '@/jlmap/model/ModelType'; +import { limitArrows, turnbackArrows, triangular, Ugraph } from './libs/ShapePoints'; +import store from '@/store'; + + +/** 计轴*/ +class SectionAxle extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 5; + this._create(model); + } + + _create(model) { + if (model && model.theme && model.traingle) { + let axleLength = 2 * model.theme.sectionAxleR; + let positionx = model.point.x + model.drictx * (model.traingle.GetCos(axleLength)); + let positiony = model.point.y + model.dricty * (model.traingle.GetCos(axleLength)); + + this.line = new Line({ + zlevel: this.zlevel, + z: this.z, + 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.theme.sectionAxleColor + } + }); + this.axle = new Circle({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: positionx - model.dricty * model.traingle.GetSin(axleLength), + cy: positiony + model.drictx * model.traingle.GetSin(axleLength), + r: model.theme.sectionAxleR + }, + style: { + GBaseLineWidth: 1, + stroke: model.theme.sectionAxleColor, + fill: model.theme.transparentColor + } + }); + + this.add(this.line); + this.add(this.axle); + } + } +} + +/** 分隔符*/ +class SectionSeparator extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = model.z; + this._create(model); + } + + _create(model) { + if (model && model.theme) { + this.partition = new Polyline({ + zlevel: this.zlevel, + z: this.z + 10, + shape: { + points: [ + [model.point.x, model.point.y], + [model.point.x, model.point.y] + ] + }, + style: { + lineWidth: model.theme.sectionSeparatorWidth, + stroke: model.theme.sectionSeparatorColor + } + }); + + this.circle = new Circle({ + zlevel: this.zlevel, + z: this.z + 9, + shape: { + cx: model.point.x, + cy: model.point.y, + r: model.theme.sectionWidth + }, + style: { + stroke: model.theme.sectionInvadeColor, + GBaseLineWidth: 0.5, + fill: model.theme.transparentColor + } + }); + + this.add(this.partition); + this.setType(model.sepType, model.borderBorderShow); + } + } + + setType(type, show) { + let model = this.model; + if (model && model.theme && model.traingle) { + this.remove(this.circle); + if (type === '00') { + this.partition.setShape('points', [ + [model.point.x, model.point.y], + [model.point.x, model.point.y] + ]); + } else if (type === '01') { + this.partition.setShape('points', [ + [model.point.x, model.point.y - (model.theme.sectionWidth)], + [model.point.x, model.point.y + (model.theme.sectionWidth)] + ]); + this.add(this.partition); + } else if (type === '02') { + this.partition.setShape('points', [ + [model.point.x + model.drict * (model.theme.sectionWidth), model.point.y - (model.theme.sectionWidth * 1.2)], + [model.point.x, model.point.y - (model.theme.sectionWidth * 1.2)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 1.2)] + ]); + this.add(this.partition); + } else if (type === '03') { + this.partition.setShape('points', [ + [model.point.x + model.drict * (model.theme.sectionWidth) * 1.2, model.point.y - (model.theme.sectionWidth * 1.2)], + [model.point.x, model.point.y - (model.theme.sectionWidth * 1.2)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 1.2)], + [model.point.x + model.drict * (model.theme.sectionWidth) * 1.2, model.point.y + (model.theme.sectionWidth * 1.2)], + ]); + this.add(this.partition); + } else if (type === '04') { + this.add(this.circle); + } + } + + 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(); //可以无需调用 + } + + if (this.partition) { + if (type === '03' && !show) { + this.partition.hide(); + } else { + this.partition.show(); + } + } + } +} + +/** 创建区段限速限集合*/ +class LimitLines 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) { + let 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, + z: this.z + 10, + culling: true, + shape: shape, + position: model.position, + style: { + lineWidth: model.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor, + fillOpacity: 0, + } + })); + } else { + let swPadding = model.theme.switchLen; //定位和反位时区段距离岔芯的距离 + var switchWidth = model.theme.sectionWidth + model.theme.sectionBeyondWidth; // 道岔宽度 + let beg = Object.assign({}, model.points[0]); + let end = Object.assign({}, model.points[model.points.length - 1]); + if (model.isSwitchSection && beg.y !== end.y) { + let swch = store.getters['map/getDeviceByCode'](model.relSwitchCode); + if (swch) { + let 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, + z: this.z, + position: model.position, + shape: { + x1: beg.x, + y1: beg.y, + x2: end.x, + y2: end.y, + }, + style: { + lineWidth: model.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } else { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + + for (let i = 1; i < (model.points.length - 2); i++) { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + z: this.z, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } + + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + z: this.z, + position: model.position, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } + } + } + } +} + +/** 创建区段线集合*/ +class Lines 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) { + let 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, + z: this.z + 10, + culling: true, + shape: shape, + style: { + lineWidth: model.theme.sectionWidth, + stroke: model.theme.sectionSpareColor, + fillOpacity: 0, + } + })); + } else { + for (let i = 0; i < (model.points.length - 1); i++) { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + 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.theme.sectionWidth, + stroke: model.theme.sectionSpareColor, + } + })); + } + } + + if (!model.isSwitchSection) { + this.lineBorder = new Rect({ + zlevel: this.zlevel, + z: this.z - 1, + silent: true, + shape: this.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: model.theme.borderColor, + fill: model.theme.transparentColor + } + }) + + this.add(this.lineBorder); + } + } + } + + 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(); + } + } +} + +/** 创建限速*/ +class LimitKmrange extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = model.z; + this._create(model); + } + _create(model) { + let lx = model.x - model.drict * model.radius * 1.2; + let ly = model.y - model.limitDistance; + this.limit = new Polygon({ + zlevel: this.zlevel + 10, + z: this.z, + shape: { + points: limitArrows(lx, ly, model.drict, model.radius) + }, + style: { + fill: model.theme.sectionSpeedLimitColor, + text: '22', + textFill: model.theme.sectionInvadeColor, + textFont: 'bold ' + (model.theme.textFontSize + 6) + 'px ' + model.theme.textFontFormat, + textOffset: [model.drict * model.radius * 0.5, 0] + } + }) + + + let kmx = model.x; + let kmy = model.y - model.kmDistance; + this.kmRange = new Text({ + zlevel: this.zlevel + 10, + z: this.z, + style: { + x: kmx, + y: kmy, + text: '11111', + textFont: model.theme.textFontSize + 'px ' + model.theme.textFontFormat, + textFill: model.theme.textFontColor, + textAlign: 'left', + textVerticalAlign: 'bottom', + textPosition: 'inside', + } + }); + + this.add(this.limit); + this.add(this.kmRange); + } +} + +/** 创建折返*/ +class TurnBack extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = model.z; + this._create(model); + } + + _create(model) { + let radius = 3; + let points = model.model.points; + let x = -model.drict * model.width * 1.2; + let y = - model.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.line = new Ugraph({ + zlevel: this.zlevel + 10, + z: this.z, + shape: { + counterclockwise: model.drict == -1, + points: turnbackArrows(x, y, model.drict, model.width, model.height) + }, + style: { + lineWidth: model.theme.sectionSeparatorWidth, + stroke: model.theme.sectionSeparatorColor + } + }) + + + this.arrow = new Polygon({ + zlevel: this.zlevel + 10, + z: this.z, + shape: { + points: triangular(x - model.drict * model.width, y - model.height, -model.drict, radius) + }, + style: { + fill: model.theme.sectionSeparatorColor, + } + }) + + this.add(this.line); + this.add(this.arrow); + } +} + +/** 区段*/ +export default class Section extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.selected = false; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = model.layer || 0; + this._create(model); + + // this.on('mousedown', this.mouseclick); + // this.on('mouseout', this.mouseleave); + // this.on('mouseover', this.mouseenter); + } + + _create(model) { + //01:物理区段;02逻辑区段;03道岔区段 + this.createSectionText(); //创建区段文字 + if (model.sectionType === '01' && ( + model.logicSectionNum.length <= 0 || + model.logicSectionNum.length == 1 && model.logicSectionNum[0] == 0) || + model.sectionType === '02') { + this.createSection(); //创建区段 + this.createSeparator(); //创建分隔符 + this.createLimitKmrangeAndTurnBack(); //创建限速值和公里标和折返 + if (model.sectionType === '01') { + this.createAxles(); //创建计轴 + } + } + + this.mouseStatusRecover(); + this.setStatus(model); + } + + /** 创建区段*/ + createSection() { + let model = this.model; + let theme = this.theme; + + //创建区段 + this.section = new Lines({ + zlevel: this.zlevel, + z: this.z, + isSwitchSection: model.isSwitchSection, + sectionType: model.sectionType, + isShowLogical: model.isShowLogical, + isCurve: model.isCurve, + points: model.points, + theme: theme + }); + + //创建延时释放 + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + this.release = new Line({ + zlevel: model.zlevel + 1, + 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), + }, + style: { + lineWidth: theme.sectionWidth, + stroke: theme.sectionSpareColor + } + }); + + let x = traingle.drictx * (theme.sectionSpeedLimitDistance) * traingle.GetSinRate(); + let y = traingle.dricty * (theme.sectionSpeedLimitDistance) * traingle.GetCosRate(); + if (x == Infinity) { x = 0; } + if (y == Infinity) { y = 0; } + + this.speedLimitLeft = new LimitLines({ + zlevel: this.zlevel + 4, + z: this.z, + position: [x, -y], + points: model.points, + isSwitchSection: model.isSwitchSection, + relSwitchCode: model.relSwitchCode, + theme: theme, + }); + + this.speedLimitRight = new LimitLines({ + zlevel: this.zlevel + 4, + z: this.z, + position: [-x, y], + points: model.points, + isSwitchSection: model.isSwitchSection, + relSwitchCode: model.relSwitchCode, + theme: theme, + }); + + this.add(this.section); + this.add(this.release); + this.add(this.speedLimitLeft); + this.add(this.speedLimitRight); + } + + /** 创建区段名称*/ + createSectionText() { + let model = this.model; + let theme = this.theme; + + if (model && theme) { + //计算区段坐标位置 + let 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 + model.namePoint.x; + let 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 + model.namePoint.y; + + /**区段名称*/ + if (model.nameShow) { + let tempx = x; + let tempy = y - (theme.sectionWidth + theme.textFontSize + theme.nameDistance); + + //如果不是道岔区段 + if (model.sectionType !== '03') { + //如果逻辑区段,让名称和区段距离减少 + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + if (model.sectionType === '02') { + tempx += traingle.GetSin(theme.textFontSize * 0.8 + theme.nameDistance); + tempy += traingle.GetCos(theme.textFontSize * 0.8 + theme.nameDistance) - theme.textFontSize * 2; + let parent = store.getters['map/getDeviceByCode'](model.parentCode); + if (parent) { + model.name = `${parent.name}-${model.name}`; + } + } + } + + //创建区段名称 + let fontSize = theme.sectionType == '02' ? theme.textFontSize + 2 : theme.textFontSize; + this.sectionText = new Text({ + _subType: 'Text', + zlevel: this.zlevel + 3, + z: 6, + style: { + x: tempx, + y: tempy, + text: model.name, + textFont: fontSize + 'px ' + theme.textFontFormat, + textFill: theme.sectionTextWhite, + textAlign: 'center', + textPosition: 'inside' + } + }); + this.add(this.sectionText); + + if (!model.isSwitchSection) { + this.sectionTextBorder = new Rect({ + zlevel: model.zlevel + 3, + z: 5, + shape: this.sectionText.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: '#fff', //白色 + fill: '#00FFFF' //蓝色 + } + }) + this.add(this.sectionTextBorder); + } + + this.sectionTextShadow = new Text({ + zlevel: this.zlevel + 3, + z: 5, + position: [4, -2], + silent: true, + style: { + x: tempx, + y: tempy, + text: model.name, + textFill: theme.textShadowColor, //黄色 + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: 'bold ' + (fontSize + 1) + 'px ' + theme.textFontFormat + } + }) + this.add(this.sectionTextShadow); + } + + /**站台轨名称*/ + if (model.isStandTrack && model.standTrackNameShow) { + let tempx = x; + let tempy = y; + + //计算文字和物理区段的距离 + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + tempx += traingle.GetSin(theme.nameDistance); + tempy += traingle.GetCos(theme.nameDistance); + + //创建站台轨名称 + this.standTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: tempx + model.standTrackNamePosition.x, + y: tempy + model.standTrackNamePosition.y, + text: model.standTrackName, + textFont: 'bold ' + theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.sectionTextWhite, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.standTrackText); + + } + + /**折返轨名称*/ + if (model.isReentryTrack && model.reentryTrackNameShow) { + //创建折返轨名称 + this.reentryTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.reentryTrackNamePosition.x, + y: y + model.reentryTrackNamePosition.y + theme.nameDistance + theme.textFontSize, + text: model.reentryTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.sectionTextWhite, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.reentryTrackText); + } + + /**转换轨名称*/ + if (model.isTransferTrack && model.transferTrackNameShow) { + //转换轨名称 + this.transferTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.transferTrackNamePosition.x, + y: y + model.transferTrackNamePosition.y + theme.nameDistance + theme.textFontSize * 2, + text: model.transferTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.sectionTextWhite, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.transferTrackText); + } + + /**目的码名称*/ + if (model.destinationCode && model.destinationCodeShow) { + //转换轨名称 + this.destinationText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.destinationCodePoint.x, + y: y + model.destinationCodePoint.y, + text: model.destinationCode, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.destinationTextFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.destinationText); + } + } + } + + /** 创建计轴*/ + createAxles() { + let model = this.model; + let theme = this.theme; + + /** 创建四个计轴*/ + let traingle = null; + if (model && theme && model.isShowAxle && model.points && model.points.length > 1) { + traingle = new JTriangle(model.points[0], model.points[1]); + this.lUpAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: -1, + traingle: traingle + }); + this.lBottomAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: 1, + traingle: traingle + }); + + traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); + this.rUpAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: -1, + traingle: traingle + }); + this.rBottomAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: 1, + traingle: traingle + }); + + this.add(this.lUpAxle); + this.add(this.rUpAxle); + this.add(this.lBottomAxle); + this.add(this.rBottomAxle); + } + } + + /** 创建分隔符*/ + createSeparator() { + let model = this.model; + let theme = this.theme; + let traingle = null; + + if (model && theme && model.points && model.points.length > 1) { + /** 创建左侧分隔符*/ + traingle = new JTriangle(model.points[0], model.points[1]); + this.lPartition = new SectionSeparator({ + zlevel: this.zlevel, + z: this.z, + theme: theme, + borderBorderShow: model.borderBorderShow, + traingle: traingle, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + sepType: model.l.sepType, + drict: -1 + }); + + /** 创建右侧分隔符*/ + traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); + this.rPartition = new SectionSeparator({ + zlevel: this.zlevel, + z: this.z, + theme: theme, + borderBorderShow: model.borderBorderShow, + traingle: traingle, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + sepType: model.r.sepType, + drict: 1 + }); + + /** 添加视图*/ + this.add(this.lPartition); + this.add(this.rPartition); + } + } + + /** 创建限速值和公里标和折返*/ + createLimitKmrangeAndTurnBack() { + let model = this.model; + let theme = this.theme; + + if (model && theme && model.points && model.points.length > 1) { + let radius = theme.sectionWidth * 1.2; // 矩形体半径 + let limitDistance = theme.sectionSpeedLimitDistance + radius * 2.5; + let kmDistance = theme.sectionSpeedLimitDistance * 0.6; + let turnBackDistance = theme.sectionSpeedLimitDistance + radius * 4; + + /** 旋转设备*/ + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + + this.limitKmrangeL = new LimitKmrange({ + zlevel: this.zlevel + 10, + z: this.z, + x: model.points[0].x, + y: model.points[0].y, + theme: theme, + traingle: traingle, + radius: radius, + limitDistance: limitDistance, + kmDistance: kmDistance, + drict: -1 + }) + + + this.limitKmrangeR = new LimitKmrange({ + zlevel: this.zlevel + 10, + z: this.z, + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y, + theme: theme, + traingle: traingle, + radius: radius, + limitDistance: limitDistance, + kmDistance: kmDistance, + drict: 1 + }) + + this.turnBack = new TurnBack({ + zlevel: this.zlevel, + z: this.z, + width: theme.sectionWidth * 2, + height: theme.sectionWidth * 1, + model: model, + theme: theme, + traingle: traingle, + turnBackDistance: turnBackDistance, + drict: 1, + }) + + this.add(this.limitKmrangeL); + this.add(this.limitKmrangeR); + this.add(this.turnBack); + } + } + + /** 设置区段集合显隐*/ + setInvisible() { + let invisible = this.model.sectionType === '02' && this.model.isShowLogical; + this.eachChild((child) => { + child.attr('invisible', invisible); + }); + } + + /** 设置区段恢复默认状态*/ + recover() { + if (this.section) { + this.section.stopAnimation(true); + this.section.setStyle({ + fill: this.theme.backgroundColor, + stroke: this.theme.sectionSpareColor, + lineWidth: this.theme.sectionWidth + }); + this.release.hide(); + this.speedLimitLeft.hide(); + this.speedLimitRight.hide(); + } + + if (this.sectionText) { + this.sectionText.setStyle({ textFill: this.theme.sectionTextWhite }); + } + + if (this.section && this.model.points && this.model.points.length > 1) { + this.limitKmrangeL.hide(); + this.limitKmrangeR.hide(); + this.turnBack.hide(); + } + } + + /** 未定义状态*/ + undefine() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionUndefinedColor, + lineWidth: this.theme.sectionWidth + }); + } + } + + /** 空闲状态*/ + spare() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionSpareColor, + lineWidth: this.theme.sectionWidth + }); + } + } + + /** 通信车占用状态*/ + communicationOccupied() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionCommunicationOccupiedColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 非通信车占用状态*/ + unCommunicationOccupied() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionUnCommunicationOccupiedColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 进路锁闭*/ + routeLock() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionRouteLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + + if (this.sectionText) { + this.sectionText.setStyle({ textFill: this.theme.sectionTextGreen }); + } + } + + /** 封锁*/ + block() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionBlockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 故障锁定状态*/ + faultLock() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionFaultLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** atc切除状态*/ + atcExcision() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionAtcExcisionColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** ats切除状态*/ + atsExcision() { + if (this.section) { + this.atcExcision(); + this.section.animateStyle(true, [ + { time: 1000, styles: { stroke: this.theme.backgroundColor, } }, + { time: 2000, styles: { stroke: this.theme.sectionAtsExcisionColor, lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth } } + ]); + } + } + + /** 保护区段锁闭*/ + protectiveLock() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionProtectiveLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + } + + if (this.sectionText) { + this.sectionText.setStyle({ textFill: this.theme.sectionTextGreen }); + } + } + + /** 延时释放*/ + timeRelease() { + if (this.release) { + this.section.setStyle({ + stroke: this.theme.sectionRouteLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + this.release.show(); + this.release.setStyle('lineWidth', this.theme.sectionWidth + this.theme.sectionBeyondWidth); + this.release.setStyle('stroke', this.theme.sectionRouteLockColor); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.sectionRouteLockColor }) + .when(2000, { stroke: this.theme.sectionTimeReleaseColor }) + .start(); + } + } + + /** 保护区段延时解锁*/ + protectiveTimeRelease() { + if (this.release) { + this.section.setStyle({ + stroke: this.theme.sectionProtectiveLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + this.release.show(); + this.release.setStyle('lineWidth', this.theme.sectionWidth + this.theme.sectionBeyondWidth); + this.release.setStyle('stroke', this.theme.sectionProtectiveLockColor); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.sectionProtectiveLockColor }) + .when(2000, { stroke: this.theme.sectionProtectiveTimeReleaseColor }) + .start(); + } + } + + /** 区段切除*/ + sectionCutOff() { + if (this.release) { + let lineWidth = this.theme.sectionWidth + (this.model.status != '01' ? this.theme.sectionBeyondWidth : 0); + this.section.animateStyle(true, [ + { time: 0, styles: { lineWidth: lineWidth } }, + { time: 1000, styles: { stroke: this.theme.backgroundColor, } }, + { time: 2000, styles: { lineWidth: lineWidth } }, + ]); + } + } + + /** 设置限速*/ + setSpeedUpperLimit() { + if (this.section) { + this.speedLimitLeft.show(); + this.speedLimitRight.show(); + } + } + + /** 计轴预复位*/ + axleReset() { + if (this.release) { + this.release.show(); + this.release.setStyle({ + stroke: this.theme.sectionAxleResetColor + }); + } + } + + /** 计轴失效*/ + alxeFailure() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionAxleFailure, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 设置状态*/ + setStatus(model) { + this.recover(); + 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(); + } + } + + + /** 区段切除*/ + if (model.cutOff) { + this.sectionCutOff(); + } + + /** 是否限速*/ + if (model.speedUpperLimit >= 0) { + this.setSpeedUpperLimit(); + } + } + + /** 计算提示位置*/ + getShapeTipPoint() { + let rect = this.getBoundingRect(); + let distance = this.theme.sectionWidth / 2; + if (this.section) { + rect = this.section.getBoundingRect(); + if (this.model.sectionType !== '02' && this.model.nameShow) { + if (this.model.trainPosType == '01') { + distance = distance + this.theme.nameDistance + this.theme.textFontSize; + } + } + } + + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2.7 - distance + }; + } + + setTrainWindowEventShow(show) { + let trainWindowCode = this.model.trainWindowCode; + if (this.model.isSwitchSection && this.model.parentCode) { + let device = store.getters['map/getDeviceByCode'](this.model.parentCode); + if (device) { + trainWindowCode = device.trainWindowCode; + } + } + + let trainWindow = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.TrainWindow, _code: trainWindowCode }); + if (trainWindow) { + trainWindow.setTrainWindowEventShow(show); + } + } + + mouseStatusVisible(subType) { + this.setTrainWindowEventShow(true); + if (this.model.isSwitchSection) { + if (subType == 'Text') { + this.sectionTextShadow && this.sectionTextShadow.show(); + } else { + // 道岔区段 + let refSwitch = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Switch, _code: this.model.relSwitchCode }); + refSwitch && refSwitch.mouseStatusVisible(); + } + } else { + this.section && this.section.setBorderVisible(true); + this.sectionTextBorder && this.sectionTextBorder.show(); + this.sectionText && this.sectionText.setStyle({ textFill: this.theme.sectionTextWhite }); + if (this.model.sectionType == '02' && this.model.parentCode) { + this.sectionText && this.sectionText.show(); + } + } + } + + mouseStatusRecover() { + this.setTrainWindowEventShow(false); + this.sectionTextShadow && this.sectionTextShadow.hide(); + if (this.model.isSwitchSection) { + // 道岔区段 + let refSwitch = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Switch, _code: this.model.relSwitchCode }); + refSwitch && refSwitch.mouseStatusRecover(); + } else { + this.section && this.section.setBorderVisible(false); + this.sectionTextBorder && this.sectionTextBorder.hide(); + this.sectionText && this.sectionText.setStyle({ textFill: this.theme.sectionTextWhite }); + if (this.model.sectionType == '02' && this.model.parentCode) { + this.sectionText && this.sectionText.hide(); + } + } + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusVisible(e.target._subType); + } + } + } + + mouseenter(e) { + if (!this.selected) { + this.mouseStatusVisible(e.target._subType); + } + } + + mouseleave(e) { + if (!this.selected) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/chengdou_03/shape/Signal.js b/src/jmap/components/chengdou_03/shape/Signal.js new file mode 100644 index 000000000..06a7207cd --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/Signal.js @@ -0,0 +1,1020 @@ +/* +* 信号机 +*/ +import Line from 'zrender/src/graphic/shape/Line'; +import Text from 'zrender/src/graphic/Text'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +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'; +import { arrows, triangular } from './libs/ShapePoints'; + +class Lamp extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + this.lamp = new Arc({ + name: model.index, + zlevel: this.zlevel + 1, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: model.theme.signalR + }, + style: { + lineWidth: 0.4, + fill: model.theme.backgroundColor, + stroke: model.theme.signalLampStandardColor + } + }); + + let shapeDate = null; + if (model.highType === '01') { + // 矮柱 + if (model.drict != 1) { + // 左侧 + shapeDate = { + x: model.origin.x + model.drict * model.lampCount * 2 * model.theme.signalR - 2.5, + y: model.origin.y + model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } else { + shapeDate = { + x: model.origin.x - model.drict + 1.5, + y: model.origin.y - model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } + } else { + // 高柱 + if (model.drict != 1) { + // 左侧 + shapeDate = { + x: model.origin.x + model.drict * model.lampCount * 2 * model.theme.signalR - 2.5 - 3, + y: model.origin.y + model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } else { + shapeDate = { + x: model.origin.x - model.drict + 1.5 + 3, + y: model.origin.y - model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } + } + + this.lstop = new Line({ + zlevel: this.zlevel + 1, + z: this.z, + origin: model.origin, + rotation: -Math.PI / 180 * model.rotate, + shape: { + x1: model.position.x + (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y1: model.position.y + (model.theme.signalR + 1) * Math.sin(Math.PI / 4), + x2: model.position.x - (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y2: model.position.y - (model.theme.signalR + 1) * Math.sin(Math.PI / 4) + }, + style: { + lineWidth: 1.5, + stroke: model.theme.backgroundColor, + } + }); + + this.rstop = new Line({ + zlevel: this.zlevel + 1, + z: this.z, + origin: model.origin, + rotation: -Math.PI / 180 * model.rotate, + shape: { + x1: model.position.x + (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y1: model.position.y + (model.theme.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)), + x2: model.position.x - (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y2: model.position.y - (model.theme.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)) + }, + style: { + lineWidth: 1.5, + stroke: model.theme.backgroundColor, + } + }); + this.add(this.lamp); + } + + setColor(color) { + if (color) { + this.lamp.setStyle('fill', color); + } + } + + // 两条交叉黑线 + setStop(has) { + if (has) { + this.add(this.lstop); + this.add(this.rstop); + } else { + this.remove(this.lstop); + this.remove(this.rstop); + } + } +} + +// 自动进路箭头 +class AutoSig extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + let rotation = Math.PI; + if (model.drict != 1) { + // 右侧 + rotation = 0; + } + + // 箭头 + let x = model.position.x + model.drict * (model.lampCount * model.theme.signalR + model.theme.signalLampStandardWidth) * 2; + let y = model.position.y - model.theme.signalLampStandardWidth; + this.arrowsControl = new Polygon({ + zlevel: this.zlevel, + rotation: rotation, + origin: [x, y], + shape: { + points: arrows(x, y, model.theme.stationControlDistance / 8, model.theme.signalR * 0.8) + }, + style: { + stroke: model.theme.sidelineColor, + lineWidth: 0.6, + fill: model.theme.signalLampGreenColor + } + }); + this.add(this.arrowsControl); + } + + // 停止动画 + animationRecover() { + this.arrowsControl.stopAnimation(false); + } + + // 箭头颜色 + setColor(color) { + if (color) { + this.arrowsControl.setStyle('fill', color); + } + } + + // 箭头闪烁 + arrowsAnimation() { + let fill = this.arrowsControl.style.fill; + let theme = this.model.theme; + this.arrowsControl.animate('style', true) + .when(1000, { fill: theme.backgroundColor, stroke: theme.backgroundColor }) + .when(2000, { fill: fill, stroke: theme.sidelineColor }) + .when(3000, { fill: theme.backgroundColor, stroke: theme.backgroundColor }) + .when(4000, { fill: fill, stroke: theme.sidelineColor }) + .start(); + } +} + +// 运行方向三角 +class JSigDrict extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + // 箭头 + this.sigDrict = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + // points: triangular(model.position.x, model.position.y + model.drict * model.theme.signalLampStandardWidth, model.drict, model.theme.signalR), + points: triangular(model.position.x, model.position.y, model.drict, model.theme.signalR), + }, + style: { + stroke: model.theme.backgroundColor, + lineWidth: 0.5, + fill: model.theme.signalLampYellowColor + } + }); + this.add(this.sigDrict); + } +} + +// 信号灯 几灯、高柱等 +class JSiglamp extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this.lamps = new Group(); + this.poles = new Group(); + this._subType = 'SignalLamp'; + this._val = '3'; /** 信号机*/ + this._create(model); + } + + _create(model) { + this.text = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x + model.namePosition.x, + y: model.position.y + model.posit * (model.theme.signalR + model.namePosition.y), + text: model.name, + textAlign: 'middle', + textVerticalAlign: model.posit === 1 ? 'top' : 'bottom', + textFont: 'bold ' + (model.theme.textFontSize + 1) + 'px ' + model.theme.textFontFormat, + textFill: model.theme.signalTextGreen + } + }); + + this.ver = new Polyline({ + zlevel: this.zlevel, + z: this.z - 2, + shape: { + points: [ + [model.position.x, model.position.y + model.theme.signalR * 1.2], + [model.position.x, model.position.y - model.theme.signalR * 1.2] + ] + }, + style: { + lineWidth: model.theme.signalLampStandardWidth, + stroke: model.theme.signalLampStandardColor + } + }); + + this.hor = new Polyline({ + zlevel: this.zlevel, + z: this.z - 1, + shape: { + points: [ + [model.position.x, model.position.y], + [model.position.x + model.drict * model.theme.signalR * 1.2, model.position.y] + ] + }, + style: { + lineWidth: model.theme.signalLampStandardWidth, + stroke: model.theme.signalLampStandardColor + } + }); + + this.add(this.lamps); + this.add(this.poles); + this.setShowName(model.isShowName); + this.setShowHighSigType(model.highType); + + //旋转 + if (model.rotate) { + this.transformRotation(this.ver); + this.transformRotation(this.hor); + } + } + + // border显示 + setBorderVisible(isVisible) { + if (isVisible) { + this.textBorder.show(); + this.lampsBorder.show(); + } else { + this.textBorder.hide(); + this.lampsBorder.hide(); + } + } + + // 设置显示信号灯名称 + setShowName(isShow) { + if (isShow) this.add(this.text); else this.remove(this.text); + } + + // 显示信号灯名称颜色 + setNameColor(color) { + this.text.setStyle({ textFill: color }); + } + + setShowHighSigType(type) { + let model = this.model; + this.lamps.removeAll(); + this.poles.removeAll(); + this.poles.add(this.ver); + if (type === '01') this.poles.remove(this.hor); else this.poles.add(this.hor); + let highPosition = this.getEndPosition(model.highType); + for (let i = 0; i < model.lampCount; i++) { + let lamp = new Lamp({ + theme: model.theme, + zlevel: this.zlevel, + lampCount: model.lampCount, + position: { + x: highPosition.x + i * model.drict * model.theme.signalR * 2, + y: highPosition.y + }, + index: i + 1, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + drict: model.drict, + highType: model.highType, + }); + this.lamps.add(lamp); + } + + this.delay = new Text({ + zlevel: this.zlevel, + style: { + x: model.position.x - model.drict * (model.theme.signalLampStandardWidth), + y: model.position.y, + text: this.model.delayCount || 0, + textAlign: model.drict > 0 ? 'right' : 'left', + textVerticalAlign: 'middle', + textFont: 'bold ' + (model.theme.textFontSize + 1) + 'px ' + model.theme.textFontFormat, + textFill: model.theme.signalTextRed + } + }) + this.add(this.delay); + + this.sigDriction = new JSigDrict({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: highPosition.x + model.drict * (model.lampCount * model.theme.signalR * 2 + model.theme.signalR - 1), + y: model.position.y + }, + drict: model.drict, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + }); + + this.autoSig = new AutoSig({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: highPosition.x, + y: highPosition.y + }, + lampCount: model.lampCount, + drict: model.drict, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + }); + + //旋转 + if (model.rotate) { + this.transformRotation(this.sigDriction); + this.transformRotation(this.autoSig); + this.transformRotation(this.lamps); + this.transformRotation(this.delay); + } + + let rect = this.lamps.getBoundingRect(); + rect.union(this.hor.getBoundingRect()); + this.lampsBorder = new Rect({ + zlevel: this.zlevel, + z: this.z - 3, + silent: true, + shape: rect, + style: { + lineDash: [3, 3], + stroke: model.theme.borderColor, + fill: model.theme.transparentColor + } + }); + + this.textBorder = new Rect({ + zlevel: this.zlevel, + z: this.z - 1, + silent: true, + shape: this.text.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: model.theme.borderColor, + fill: model.theme.borderContextBackgroundColor + } + }); + + this.add(this.lampsBorder); + this.add(this.textBorder); + } + + // 整体旋转信号灯 + transformRotation(item) { + if (this.model.rotate) { + let origin = [this.model.position.x, this.model.position.y]; + let rotation = -Math.PI / 180 * Number(this.model.rotate); + item.origin = origin; + item.rotation = rotation; + item.dirty(); + } + } + + setColorByIndex(index, color) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setColor(color); + return; + } + } + } + + setStopByIndex(index, has) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setStop(has); + return; + } + } + } + + setDelayUnlockAnimation() { + this.delay.show(); + } + + setAutoFlickerAnimation() { + this.autoSig.arrowsAnimation(); + } + + setRecover() { + this.delay.hide(); + this.autoSig.animationRecover(); + this.setNameColor(this.model.theme.signalTextGreen); + } + + setColorSig(color) { + this.autoSig.setColor(color); + } + + getEndPosition(type) { + if (type === '01') { + return { + x: this.model.position.x + this.model.drict * this.model.theme.signalR * 3 / 2, + y: this.model.position.y + }; + } else { + return { + x: this.hor.shape.points[1][0] + this.model.drict * this.model.theme.signalR, + y: this.hor.shape.points[1][1] + }; + } + } + + setShowSigDrict(showSigDrict) { + if (showSigDrict) this.add(this.sigDriction); else this.remove(this.sigDriction); + } + + setAutoSig(isShow) { + if (isShow) this.add(this.autoSig); else this.remove(this.autoSig); + } + + getShapeTipPoint() { + if (this.lamps) { + var distance = this.model.theme.signalR; + this.lamps.dirty(); + let rect = this.lamps.getBoundingRect(); + return { + x: rect.x + Math.cos(Number(this.model.rotate)) * rect.width / 2 || (this.model.position.x), + y: rect.y + Math.cos(Number(this.model.rotate)) * rect.height / 2 - distance || (this.model.position.y - distance) + }; + } + return null; + } +} + +/** 按钮*/ +class SigButton extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this._subType = 'SignalButton'; + this.z = 10; + this._create(model); + } + + _create(model) { + this.sigNormalButtom = new Rect({ + zlevel: this.zlevel, + z: this.z, + _subType: this._subType, + _val: '1', + shape: { + x: model.position.x - model.theme.signalR, + y: 0, + width: model.theme.signalR * 2, + height: model.theme.signalR * 2 + }, + style: { + lineWidth: 0.2, + stroke: model.theme.signalButtonDashColor, + fill: model.theme.signalButtonColor + }, + }); + + this.sigNormalButtomDown = new Polyline({ + zlevel: this.zlevel, + z: this.z + 1, + silent: true, + shape: { points: [] }, + style: { + lineWidth: 0.8, + stroke: model.theme.backgroundColor + } + }); + + this.sigReentryButton = new Circle({ + zlevel: this.zlevel, + z: this.z, + _subType: this._subType, + _val: '2', //折返按钮 + shape: { + cx: model.position.x, + cy: 0, + r: model.theme.signalR + }, + style: { + lineWidth: 0.2, + stroke: model.theme.signalButtonDashColor, + fill: model.theme.signalButtonColor + }, + }); + + this.sigReentryButtonDown = new Arc({ + zlevel: this.zlevel, + z: this.z + 1, + silent: true, + shape: { + cx: 0, + cy: 0, + r: 0, + startAngle: Math.PI * 8 / 5, + endAngle: Math.PI * 4 / 5, + clockwise: false + }, + style: { + lineWidth: 0.8, + stroke: model.theme.backgroundColor, + } + }); + + this.add(this.sigNormalButtom); + this.add(this.sigReentryButton); + this.setSigDrict(); + } + + setSigDrict() { + let padding = 1; + let model = this.model; + let r = model.theme.signalR * 0.8; + if (model.drict === 1) { + this.sigNormalButtom.attrKV('shape', { + y: model.position.y - 1 / 2 * r + }); + this.sigReentryButton.attrKV('shape', { + cy: model.position.y - 5 / 2 * r + }); + } else { + this.sigReentryButton.attrKV('shape', { + cy: model.position.y + 5 / 2 * r + }); + this.sigNormalButtom.attrKV('shape', { + y: model.position.y - 3 / 2 * r + }); + } + + this.sigNormalButtomDown.attrKV('shape', { + points: [ + [model.position.x - padding + r, this.sigNormalButtom.shape.y + padding], + [model.position.x + padding - r, this.sigNormalButtom.shape.y + padding], + [model.position.x + padding - r, this.sigNormalButtom.shape.y + padding * 2 + r], + ] + }); + + this.sigReentryButtonDown.attrKV('shape', { + cx: this.sigReentryButton.shape.cx, + cy: this.sigReentryButton.shape.cy, + r: this.sigReentryButton.shape.r - padding + }); + } + + colorRecover() { + this.sigNormalButtom.setStyle('fill', this.model.theme.signalButtonColor); + this.sigReentryButton.setStyle('fill', this.model.theme.signalButtonColor); + } + + animationRecover() { + this.sigNormalButtom.stopAnimation(true); + this.sigReentryButton.stopAnimation(true); + } + + recover() { + this.colorRecover(); + this.animationRecover(); + } + + setButtonStatus(buttonStatus) { + switch (buttonStatus) { + case '00': + case '01': { + this.remove(this.sigNormalButtomDown); + this.remove(this.sigReentryButtonDown); + this.recover(); + } break; + case '02': { + this.add(this.sigNormalButtomDown); + } break; + case '03': { + this.add(this.sigReentryButtonDown); + } break; + case '04': { + this.remove(this.sigNormalButtomDown); + this.sigNormalButtom.animateStyle(true) + .when(1000, { + fill: this.model.theme.signalButtonLightenColor + }) + .when(2000, { + fill: this.model.theme.backgroundColor + }) + .start(); + } break; + case '05': { + this.remove(this.sigReentryButtonDown); + this.sigReentryButton.animateStyle(true) + .when(1000, { + fill: this.model.theme.signalButtonLightenColor + }) + .when(2000, { + fill: this.model.theme.backgroundColor + }) + .start(); + } break; + } + } + + getShapeTipPoint(val) { + var view = null; + switch (val) { + case '1': { + view = this.sigNormalButtom; + break; + } + case '2': { + view = this.sigReentryButton; + break; + } + default: { + break; + } + } + if (view) { + var distance = 2; + var rect = view.getBoundingRect(); + return { + x: rect.x + rect.width / 2, + y: rect.y - distance + }; + } + return null; + } +} + +export default class Signal extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.selected = false; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.lampCount = parseInt(model.lampPositionType); + this._create(model, theme); + + // this.on('mousedown', this.mouseclick); + // this.on('mouseout', this.mouseleave); + // this.on('mouseover', this.mouseenter); + } + + _create(model, theme) { + var drict = model.directionType === '01' ? -1 : 1; + var posit = model.positionType === '01' ? -1 : 1; + // 信号灯文字说明 + this.siglamp = new JSiglamp({ + theme: theme, + zlevel: this.zlevel, + position: { + x: model.position.x, + y: model.position.y + posit * theme.signalDistance + }, + drict: drict, + posit: posit, + name: model.name, + namePosition: model.namePosition, + isShowName: model.nameShow, + highType: model.lampPostType, + lampCount: parseInt(model.lampPositionType), + showSigDrict: this.showSigDrict, + pop: true, + rotate: model.rotate, + }); + + // 信号灯按钮 + this.sigButton = new SigButton({ + theme: theme, + zlevel: this.zlevel, + position: { + x: model.buttonPosition.x, + y: model.buttonPosition.y - posit * theme.signalDistance + }, + drict: posit, + pop: false, + }); + + this.add(this.siglamp); + + this.mouseStatusRecover(); + this.setStatus(model); + } + + setButtonStatus(model) { + if (model.buttonShow) { + this.add(this.sigButton); + } else { + this.remove(this.sigButton); + } + + if (this.sigButton) { + this.sigButton.setButtonStatus(model.buttonStatus); + } + } + + setShowSigDrict(isShow) { + this.siglamp.setShowSigDrict(isShow); + } + + setAutoSig(isShow) { + this.siglamp.setAutoSig(isShow); + } + + setShowHighSigType(hightp) { + if (this.siglamp) { + this.highType = hightp; + this.siglamp.setShowHighSigType(hightp); + } + } + + isPop(e) { + for (var i = 0; i < this.childCount(); i++) { + let rect = this.childAt(i).getBoundingRect(); + if (rect.contain(e.offsetX, e.offsetY) && this.childAt(i).pop) { + return true; + } + } + } + + //关闭 + close() { + if (this.lampCount === 1) { + if (this.model.useType === '05') { + /** 单灯 调车信号机*/ + this.siglamp.setColorByIndex(1, this.theme.signalLampBlueColor); + } else { + /** 单灯 出站信号机 */ + /** 单灯 阻挡信号机*/ + /** 单灯 阻挡兼调车信号 */ + /** 单灯 列兼调信号机 */ + this.siglamp.setColorByIndex(1, this.theme.signalTextRed); + } + } + } + + //开放 + open() { + if (this.lampCount === 1) { + /** 单灯 出站信号机*/ + /** 单灯 阻隔信号机*/ + this.siglamp.setColorByIndex(1, this.theme.signalLampGreenColor); + } + } + + + //列车进路 + trainRoute() { + if (this.lampCount === 1) { + /** 单灯 列兼调信号*/ + this.siglamp.setColorByIndex(1, this.theme.signalLampYellowColor); + } + } + + //调车进路 + shuntRoute() { + if (this.lampCount === 1) { + /** 单灯 列兼调信号*/ + /** 单灯 阻挡兼调车信号*/ + this.siglamp.setColorByIndex(1, this.theme.signalLampWhiteColor); + } + } + + //引导 + guid() { + + } + + //封锁 + block() { + this.siglamp.setColorByIndex(1, this.theme.signalTextRed); + this.siglamp.setNameColor(this.theme.sectionBlockTextColor); + } + + //功能封锁 + functionBlock() { + + } + + //信号保护区段监视状态显示 + signalblock() { + } + + //故障 + fault() { + } + + //物理点灯 + logicalLight() { + for (var i = 0; i < this.lampCount; i++) { + this.siglamp.setStopByIndex(i + 1, false); + } + } + + //逻辑点灯 + physicsLight() { + for (var i = 0; i < this.lampCount; i++) { + this.siglamp.setStopByIndex(i + 1, true); + } + } + + //设置自动进路模式状态类型 + setAutoRouteOpen() { + if (this.model.linkageAutoRouteShow) { + this.siglamp.setAutoSig(true); + } else { + this.siglamp.setAutoSig(false); + } + + this.siglamp.setRecover(); + this.siglamp.setColorSig(this.theme.signalLampGreenColor); + } + + //信号机进路自动触发模式状态类型 + setAutoAccessOpen() { + if (this.model.atsAutoTriggerShow) { + this.siglamp.setAutoSig(true); + } else { + this.siglamp.setAutoSig(false); + } + + this.siglamp.setRecover(); + this.siglamp.setColorSig(this.theme.signalLampYellowColor); + } + + //设置自动信号模式状态类型 + setAutoSignalOpen() { + this.siglamp.setShowSigDrict(true); + } + + //隐藏自动信号和自动进路 + setAutoClose() { + this.siglamp.setColorSig(this.theme.backgroundColor); + this.siglamp.setAutoSig(false); + this.siglamp.setShowSigDrict(false); + } + + //自动信号和自动进路开始动画 + setAutoFlicker() { + this.siglamp.setAutoFlickerAnimation(); + } + + //设置延时解锁 + setDelayUnlock() { + this.siglamp.setDelayUnlockAnimation(); + } + + //恢复状态 + recover() { + this.siglamp.setRecover(); + } + + setStatus(model) { + this.recover(); + + /** 设置状态 (点灯类型)*/ + switch (model.status) { + case '01': { this.close(); } break; //关闭 + case '02': { this.open(); } break; //开放 + case '03': { this.guid(); } break; //引导 + case '04': { this.block(); } break; //封锁 + case '05': { this.fault(); } break; //故障 + case '06': { this.block(); } break; //功能封锁 + case '07': { this.signalblock(); } 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.setAutoAccessOpen(); } break; // 显示 信号机进路自动触发模式状态类型 + } + + /** 延时解锁*/ + model.delayType = '02'; + switch (model.delayType) { + case '01': { } // 未延时解锁 + case '02': { } // 人工闭塞延时解锁 + case '03': { } // 自动闭塞延时解锁 + } + + /** 信号机进路办理,先停止动画,再判断当前颜色是否闪烁*/ + if (model.routeSetting && (model.autoType == '03' || model.autoType == '04')) { + this.setAutoFlicker(); + } + } + + getShapeTipPoint(val) { + if (val === '1' || val === '2') { + return this.sigButton.getShapeTipPoint(val); + } else { + return this.siglamp.getShapeTipPoint(val); + } + } + + mouseStatusVisible() { + this.siglamp.setBorderVisible(true); + this.siglamp.setNameColor('#000'); + } + + mouseStatusRecover() { + this.siglamp.setBorderVisible(false); + this.siglamp.setNameColor(this.theme.signalTextGreen); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusVisible(); + } + } + } + + mouseenter() { + if (!this.selected) { + this.mouseStatusVisible(); + } + } + + mouseleave() { + if (!this.selected) { + this.mouseStatusRecover(); + } + } +} + diff --git a/src/jmap/components/chengdou_03/shape/Station.js b/src/jmap/components/chengdou_03/shape/Station.js new file mode 100644 index 000000000..0a73e2245 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/Station.js @@ -0,0 +1,74 @@ +/* +* 车站 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; + +export default class Station extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + if (model.visible) { + this.stationText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.point.x, + y: model.point.y, + text: model.name, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.nameFont || '14px ' + theme.textFontFormat, + textFill: model.nameColor + } + }); + + this.mileageText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.point.x, + y: model.point.y + parseInt(model.nameFont) + 2, + text: model.kmPost, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.kmPostFont || '8px ' + theme.textFontFormat, + textFill: model.kmPostColor + } + }); + + this.add(this.stationText); + this.add(this.mileageText); + this.setShowMileageText(model.kmPostShow); + this.setStatus(model); + } + } + + /** 设置公里标是否显示*/ + setShowMileageText(show) { + if (show) { + this.mileageText.show(); + } else { + this.mileageText.hide(); + } + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } + + getShapeTipPoint() { + return null; + } +} diff --git a/src/jmap/components/chengdou_03/shape/StationControl.js b/src/jmap/components/chengdou_03/shape/StationControl.js new file mode 100644 index 000000000..01776003d --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/StationControl.js @@ -0,0 +1,222 @@ +/* +* 控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +import Text from 'zrender/src/graphic/Text'; +import Group from 'zrender/src/container/Group'; + +/** 单个控制灯*/ +class SingleControl extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this._subType = model._subType; + this.z = 20; + this._create(model); + } + + _create(model) { + var _subType = 'ControlSignal'; + var _val = '0'; + if (model.pop) { + _subType = 'ControlButton'; + _val = '1'; + } + this.control = new Arc({ + pop: model.pop, + _subType: _subType, + _val: _val, + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.point.x, + cy: model.point.y, + r: model.theme.stationControlmodeR + }, + style: { + lineWidth: 0.5, + fill: model.theme.stationControlGrayColor, + stroke: model.theme.stationControlGrayColor + } + }); + + 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.theme.stationControlmodeR + model.theme.nameDistance, + text: model.context, + textFill: model.theme.textFontColor, + textFont: model.theme.textFontSize + 'px ' + model.theme.textFontFormat, + textAlign: 'middle', + textVerticalAlign: 'top' + } + }); + + this.add(this.control); + this.add(this.text); + } + + setColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } +} + +/** 控制模式*/ +export default class StationControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.selected = false; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this._create(model, theme); + // this.on('mouseout', this.mouseleave); + // this.on('mouseover', this.mouseenter); + } + + _create() { + let model = this.model; + this.emergencyControl = new SingleControl({ + _subType: 'emergency', + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x - this.theme.stationControlDistance, + y: model.position.y + }, + context: model.jjzkContent, + pop: false + }); + + this.centerControl = new SingleControl({ + _subType: 'center', + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x, + y: model.position.y + }, + context: model.zokContent, + pop: false + }); + + this.substationControl = new SingleControl({ + _subType: 'substation', + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x + this.theme.stationControlDistance, + y: model.position.y + }, + context: model.zakContent, + pop: false + }); + + this.textShadow = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, -4], + silent: true, + style: { + x: model.position.x, + y: model.position.y, + text: '', + textFill: this.theme.textShadowColor, //黄色 + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: 'bold ' + (this.theme.stationControlTextSize + 1) + 'px ' + this.theme.textFontFormat + } + }) + + this.add(this.substationControl); + this.add(this.centerControl); + this.add(this.emergencyControl); + this.add(this.textShadow); + + this.mouseStatusRecover(); + this.setStatus(model); + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + this.emergencyControl.setColor(this.theme.stationControlGrayColor); + this.substationControl.setColor(this.theme.stationControlGrayColor); + this.centerControl.setColor(this.theme.stationControlGrayColor); + } break; + case '01': { //中控 + this.emergencyControl.setColor(this.theme.stationControlGrayColor); + this.substationControl.setColor(this.theme.stationControlGrayColor); + this.centerControl.setColor(this.theme.stationControlGreenColor); + } break; + case '02': { //站控 + this.emergencyControl.setColor(this.theme.stationControlGrayColor); + this.substationControl.setColor(this.theme.stationControlYellowColor); + this.centerControl.setColor(this.theme.stationControlGrayColor); + } break; + case '03': { //紧急站控 + this.emergencyControl.setColor(this.theme.stationControlRedColor); + this.substationControl.setColor(this.theme.stationControlGrayColor); + this.centerControl.setColor(this.theme.stationControlGrayColor); + } 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; + } + } + } + + 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; + } + + mouseStatusVisible(subType) { + switch (subType) { + case 'emergency': { this.textShadow.setStyle({ text: this.model.jjzkContent }); } break; + case 'center': { this.textShadow.setStyle({ text: this.model.zokContent }) }; break; + case 'substation': { this.textShadow.setStyle({ text: this.model.zakContent }); } break; + } + this.textShadow.show(); + } + + mouseStatusRecover() { + this.textShadow.hide(); + } + + mouseenter(e) { + if (e.target.parent && e.target.parent._subType) { + this.mouseStatusVisible(e.target.parent._subType); + } + } + + mouseleave(e) { + if (e.target._subType) { + this.mouseStatusRecover(); + } + } +} \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/shape/StationCounter.js b/src/jmap/components/chengdou_03/shape/StationCounter.js new file mode 100644 index 000000000..759b582a4 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/StationCounter.js @@ -0,0 +1,85 @@ +/* +* 计数器 +*/ +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, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 30; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + this.counter = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y, + text: model.val, + textFill: theme.stationCounterTextColor, + textAlign: 'middle', + textStrokeWidth: 1, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + } + }); + + 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: theme.stationCounterBorderColor + } + }); + + 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 + theme.textFontSize + theme.nameDistance, + text: model.name, + textFill: theme.stationCounterTextColor, + textAlign: 'middle', + textVerticalAlign: 'top', + textStrokeWidth: 1, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + } + }); + this.add(this.counterName); + this.add(this.table); + this.add(this.counter); + this.setStatus(model); + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } + + getShapeTipPoint() { + return null; + } +} + diff --git a/src/jmap/components/chengdou_03/shape/StationDelayUnlock.js b/src/jmap/components/chengdou_03/shape/StationDelayUnlock.js new file mode 100644 index 000000000..054c86ce9 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/StationDelayUnlock.js @@ -0,0 +1,102 @@ +/* +* 延迟解锁 +*/ +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, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = 1; + this._create(model, theme); + } + + _create(model, theme) { + this.text = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y, + text: model.deviceName + ' ', + textFill: theme.stationDelayUnlockTextColor, + textStrokeWidth: 1, + textFont: model.textFont + 'px ' + theme.textFontFormat, + textAlign: 'left' + } + }); + + let fontSize = parseInt(model.textFont.split(' ')[0]) || 30; + this.time = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + fontSize + theme.stationDelayUnlockDistance, + text: model.remainTime || '', + textFill: theme.stationDelayUnlockTextColor, + textStrokeWidth: 1, + textFont: model.textFont + 'px ' + theme.textFontFormat, + 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 - 1, + z: this.z, + 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: theme.stationDelayUnlockBorderColor, + fill: theme.backgroundColor + } + }); + this.add(this.table); + + this.setStatus(model); + } + + /** 延时解锁关闭*/ + delayClose() { + this.time.setStyle('text', ''); + this.text.setStyle('text', ''); + this.table.setStyle('stroke', this.theme.backgroundColor); + } + + /** 延时解锁计数*/ + delayUnlock() { + this.table.setStyle('stroke', this.theme.sidelineColor); + this.time.setStyle('text', '' + this.model.remainTime); + } + + setStatus(model) { + switch (model.status) { + case '01': { this.delayClose(); } break; //关闭 + case '02': { this.delayUnlock(); } break; //延迟解锁 + } + } + + getShapeTipPoint() { + return null; + } +} diff --git a/src/jmap/components/chengdou_03/shape/StationStand.js b/src/jmap/components/chengdou_03/shape/StationStand.js new file mode 100644 index 000000000..a3533311e --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/StationStand.js @@ -0,0 +1,616 @@ +/* +* 站台 +*/ +import Group from 'zrender/src/container/Group'; +import Arc from 'zrender/src/graphic/shape/Arc'; +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Isogon from 'zrender/src/graphic/shape/Isogon'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import { flashlight } from './libs/ShapePoints'; + +class Jump extends Group { + constructor(model) { + super(); + this.zlevel = model.zlevel; + this.z = model.z; + this.model = model; + this.theme = model.theme; + this._create(this.model, this.theme); + } + _create(model, theme) { + /** 站台跳停*/ + this.name = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: model.position, + style: { + x: model.x, + y: model.y, + text: '跳', + textAlign: 'center', + textVerticalAlign: 'middle', + textFont: theme.stationStandHeadFontSize + 'px ' + theme.textFontFormat, + textFill: theme.stationStandJumpStopColor, + textStroke: theme.backgroundColor, + } + }) + + this.arcs = new Arc({ + zlevel: this.zlevel, + z: this.z + 2, + position: model.position, + shape: { + cx: model.x, + cy: model.y, + r: theme.stationStandHeadFontSize * 0.8, + startAngle: 0, + endAngle: Math.PI * 2, + }, + style: { + lineWidth: theme.stationStandJumpArcWidth, + stroke: theme.stationStandJumpStopColor, + } + }) + + this.add(this.name); + this.add(this.arcs); + } + + setPositionY(value) { + this.name.setStyle('y', value); + this.arcs.setShape('cy', value); + } + + setArcVisible(visible) { + visible ? this.arcs.show() : this.arcs.hide(); + } +} + +export default class StationStand extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.selected = false; + this.model = model; + this.theme = theme; + this.doors = new Group(); + this._create(model, theme); + + // this.on('mousedown', this.mouseclick); + // this.on('mouseout', this.mouseleave); + // this.on('mouseover', this.mouseenter); + } + + _create(model, theme) { + // 方向值 + let drict = model.doorLocationType == '01' ? 1 : -1; + + this.stationStand = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x - model.width / 2, + y: 0, + width: model.width, + height: model.height + }, + style: { + lineWidth: 0, + stroke: this.theme.sidelineColor, + fill: this.theme.stationStandSpareColor + } + }); + + /** 站台折返策略*/ + let beyond = 4; + let height = 5; + let width = 10; + let offsetx = (model.width - width / 2); + let offsety = (model.height + height + this.theme.stationStandDistance) / 2; + + this.reentry = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: flashlight(model.position.x, model.position.y, drict, width, height, offsetx, offsety, beyond) + }, + style: { + lineWidth: 0, + fill: this.theme.stationStandNoHumanReentryColor + } + }); + this.add(this.reentry); + + /** 站台扣车*/ + let distance = 2; + let detainX = model.position.x + drict * (model.width / 2 + theme.textFontSize + distance); + this.detain = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: [0, 0], + style: { + x: detainX, + y: 0, + text: '扣', + textAlign: 'center', + textVerticalAlign: 'top', + textFont: theme.stationStandHeadFontSize + 'px ' + theme.textFontFormat, + textFill: theme.stationStandCenterDetainTrainColor, + textStroke: theme.backgroundColor, + } + }); + this.add(this.detain); + + /** 站台跳停*/ + this.jump = new Jump({ + zlevel: this.zlevel, + z: this.z + 2, + x: detainX, + y: 0, + position: [0, 0], + theme: theme + }) + + this.add(this.jump); + + + // 停站时间 + let textLevelT = [0, 0]; + if (model.doorLocationType == '02') { + textLevelT = [0, 5]; + } + let timeX = model.position.x - drict * (model.width / 2 + theme.textFontSize + distance); + this.time = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: textLevelT, + style: { + x: timeX, + y: 0, + text: model.parkingTime, + textFill: theme.stationStandTimeTextColor, + textAlign: 'middle', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat + } + }); + this.add(this.time); + + // 区间运行时间 + let textLevelP = [0, 2]; + if (model.doorLocationType == '01') { + textLevelP = [0, 15]; + } + let levelX = model.position.x - drict * (model.width / 2 + theme.textFontSize + distance); + this.level = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: textLevelP, + style: { + x: levelX, + y: 0, + text: model.intervalRunTime, + textFill: theme.stationStandRunLevelColor, + textAlign: 'middle', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat + } + }); + this.add(this.level); + + /** 站台紧急关闭*/ + this.emergent = new Isogon({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x, + y: 0, + r: theme.statonStandSafeHeight, + n: 4, + }, + style: { + lineWidth: 0, + stroke: theme.stationStandEmergentCloseColor, + fill: theme.stationStandEmergentCloseColor + } + }); + this.doors.add(this.emergent); + + /** 屏蔽门*/ + let padding = 0.1; + + this.safeDoorL = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x - model.width / 2 - padding, + y: model.position.y, + width: model.width / 4 + padding, + height: theme.statonStandSafeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.safeDoorC = new Rect({ + zlevel: this.zlevel, + z: this.z + 1, + shape: { + x: model.position.x - model.width / 4 - padding, + y: model.position.y, + width: model.width / 2 + padding * 2, + height: theme.statonStandSafeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.safeDoorR = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x + model.width / 4, + y: model.position.y, + width: model.width / 4 + padding, + height: theme.statonStandSafeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.setHasSafeDoor(model.hasDoor); + this.setDrict(model.doorLocationType); + this.setVisible(model.visible); + + this.mouseStatusRecover(); + this.setStatus(model); + } + + setDrict(doorLocationType) { + let model = this.model; + let theme = this.theme; + if (doorLocationType === '01') { + let distance = model.position.y + theme.stationStandDistance + theme.statonStandSafeHeight; + this.detain.setStyle('y', distance - model.height / 2 + theme.stationStandHeadFontSize); + this.jump.setPositionY(distance + model.height / 2 + theme.stationStandHeadFontSize); + this.time.setStyle('y', distance + model.height / 2 + theme.textFontSize * 2); + this.level.setStyle('y', distance - model.height); + this.emergent.setShape('y', distance - theme.statonStandSafeHeight * 3 - theme.stationStandDistance); + this.stationStand.setShape('y', distance); + } else { + let distance = model.position.y - theme.stationStandDistance; + this.detain.setStyle('y', distance + model.height / 2 - theme.stationStandHeadFontSize * 2); + this.jump.setPositionY(distance - model.height); + this.level.setStyle('y', distance - model.height / 2 + theme.textFontSize * 2 + theme.stationStandDistance); + this.time.setStyle('y', distance - model.height - theme.textFontSize * 2); + this.emergent.setShape('y', distance + theme.statonStandSafeHeight * 3 + theme.stationStandDistance); + this.stationStand.setShape('y', distance - model.height); + } + this.add(this.doors); + this.add(this.stationStand); + + + let rect = this.stationStand.getBoundingRect(); + rect.union(this.doors.getBoundingRect()); + this.standBorder = new Rect({ + zlevel: model.zlevel, + silent: true, + z: this.z - 1, + shape: rect, + style: { + lineDash: [3, 3], + stroke: theme.borderColor, + fill: theme.transparentColor + } + }) + this.add(this.standBorder); + } + + setHasSafeDoor(hasDoor) { + if (hasDoor) { + this.doors.add(this.safeDoorL); + this.doors.add(this.safeDoorC); + this.doors.add(this.safeDoorR); + } else { + this.doors.remove(this.safeDoorL); + this.doors.remove(this.safeDoorC); + this.doors.remove(this.safeDoorR); + } + } + + setVisible(visible) { + if (visible) { + this.eachChild((it) => { + it.show(); + }); + } else { + this.eachChild((it) => { + it.hide(); + }); + } + } + + //恢复初始状态 + recover() { + this.time.hide(); + this.level.hide(); + this.jump.hide(); + this.detain.hide(); + this.emergent.hide(); + this.reentry.hide(); + if (this.model.visible) { this.safeDoorC.show(); } + this.safeDoorL.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandDoorDefaultColor); + } + + //空闲 + spare() { + this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + } + + //列车停站 + stop() { + this.stationStand.setStyle('fill', this.theme.stationStandStopColor); + } + + //站台紧急关闭 + emergentClose() { + this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.emergent.show(); + } + + //未设置跳停 + unJumpStop() { + this.jump.hide(); + } + + //指定列车跳站 + designatedJumpStop() { + this.jump.setArcVisible(false); + this.jump.show(); + } + + //站台跳停 + jumpStop() { + this.jump.setArcVisible(true); + this.jump.show(); + } + + //未设置扣车 + unDetainTrain() { + this.detain.hide(); + } + + //车站扣车 + standDetainTrain() { + this.detain.show(); + this.detain.setStyle('textFill', this.theme.stationStandDetainTrainTextColor); + } + + //中心扣车 + centerDetainTrain() { + this.detain.show(); + this.detain.setStyle('textFill', this.theme.stationStandCenterDetainTrainColor); + } + + //中心+车站扣车 + standAndCenterDetainTrain() { + this.detain.show(); + this.detain.setStyle('textFill', this.theme.stationStandStandAndCenterDetainTrainColor); + } + + //人工设置停战时间 + setManuallyArmisticeTime(val) { + this.time.show(); + this.time.attr({ + style: { + text: val + }, + }); + } + + //人工设置运行等级 + setManuallyOperationLevel(val) { + this.level.show(); + this.level.attr({ + style: { + text: val + }, + }); + } + + //开门 + openDoor() { + this.safeDoorC.hide(); + } + + //关门 + closeDoor() { + if (this.model.visible) { this.safeDoorC.show(); } + } + + //屏蔽门正常 + doorNormal() { + this.safeDoorL.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandDoorDefaultColor); + } + + //屏蔽门故障 + doorFault() { + this.safeDoorL.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandSplitDoorColor); + } + + //屏蔽门切除 + doorSplit() { + this.safeDoorL.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandSplitDoorColor); + } + + //无折返(默认) + noReentry() { + this.reentry.hide(); + } + + //无人折返 + noHumanReentry() { + this.reentry.show(); + this.reentry.setStyle('fill', this.theme.stationStandNoHumanReentryColor); + } + //自动换端 + autoChangeEnds() { + this.reentry.show(); + this.reentry.setStyle('fill', this.theme.stationStandAutoChangeEndsColor); + } + + setStatus(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(); + } + } + } + + /** 设置扣车*/ + 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; + } + } + + getShapeTipPoint() { + let rect = this.stationStand.getBoundingRect(); + if (rect) { + return { + x: rect.x + rect.width / 2, + y: rect.y + }; + } + return null; + } + + mouseStatusVisible() { + this.standBorder.show(); + this.stationStand.setStyle({ fill: this.theme.borderContextBackgroundColor }) + } + + mouseStatusRecover() { + this.standBorder.hide(); + this.stationStand.setStyle({ fill: this.theme.stationStandSpareColor }) + this.setStatus(this.model); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusRecover(); + this.mouseStatusVisible(); + } + } + } + + mouseenter(e) { + if (!this.selected) { + this.mouseStatusRecover(); + this.mouseStatusVisible(); + } + } + + mouseleave(e) { + if (!this.selected) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/chengdou_03/shape/Switch.js b/src/jmap/components/chengdou_03/shape/Switch.js new file mode 100644 index 000000000..5cb845a39 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/Switch.js @@ -0,0 +1,581 @@ +/* +* 道岔 +*/ +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Line from 'zrender/src/graphic/shape/Line'; +import Group from 'zrender/src/container/Group'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import JTriangle from '@/jlmap/util/JTriangle'; +import ModelType from '@/jlmap/model/ModelType'; +import store from '@/store'; + +export default class Switch extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.intersection = model.intersection; + this.selected = false; + this.zlevel = model.zlevel; + this.z = 8; + this.model = model; + this.theme = theme; + this._create(model); + + // this.on('mousedown', this.mouseclick); + // this.on('mouseout', this.mouseleave); + // this.on('mouseover', this.mouseenter); + } + + _create(model) { + this.triangle = new JTriangle(model.intersection, model.skew); + this.createSwitch(); + this.createNameText(); + this.craeteSwitchBorder(); + + this.mouseStatusRecover(); + this.setStatus(model); + } + + /** 道岔实体,不显示,响应鼠标事件*/ + createSwitch() { + let model = this.model; + let theme = this.theme; + + var halfWidth = theme.sectionWidth / 2; //一般宽度 + var switchWidth = theme.sectionWidth + theme.sectionBeyondWidth + theme.sectionBeyondWidth + 0.8; // 道岔宽度, 增大遮挡宽度0.8 + var swPadding = theme.switchLen; //定位和反位时区段距离岔芯的距离 + var directx = this.triangle.drictx; + var directy = this.triangle.dricty; + var direct = -this.triangle.drictx * this.triangle.dricty; + var coverLength = switchWidth * 1.5; + + // 道岔遮挡 + var line = new Line({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: { + x1: model.intersection.x - coverLength, + y1: model.intersection.y, + x2: model.intersection.x + coverLength, + y2: model.intersection.y + }, + style: { + lineWidth: switchWidth, + stroke: theme.backgroundColor + } + }); + var skewLine = new Line({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: { + x1: model.intersection.x, + y1: model.intersection.y, + x2: model.intersection.x + directx * this.triangle.GetCotRate() * coverLength, + y2: model.intersection.y + directy * coverLength, + }, + style: { + lineWidth: switchWidth, + stroke: theme.backgroundColor + } + }); + this.switchView = new Group(); + this.switchView.add(line); + this.switchView.add(skewLine); + + // 定位遮挡 + halfWidth += 0.3; + var point1 = [model.intersection.x - directx * halfWidth, model.intersection.y + directy * halfWidth]; + var point2 = [point1[0] + directx * switchWidth / this.triangle.GetSinRate(), point1[1]]; + var point3 = [point2[0] + directx * this.triangle.GetCotRate() * swPadding, point2[1] + directy * swPadding]; + var point4 = [point3[0] + direct * this.triangle.GetSin(switchWidth), point3[1] - direct * this.triangle.GetCos(switchWidth)]; + + this.locShelter = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + point1, point2, point3, point4 + ] + }, + style: { + fill: theme.backgroundColor + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + var lpx = Math.abs(this.triangle.GetCos(1)); + this.locShelter.position = [directx * lpx, -directy * 0.2]; + this.locShelter.show(); + + // 反位遮挡 + var slen = switchWidth / this.triangle.GetSinRate(); // 斜切长度 + var rpoint1 = [model.intersection.x + directx * halfWidth, model.intersection.y - directy * halfWidth]; + var rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.GetCotRate()), rpoint1[1]]; + var rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth]; + var rpoint4 = [rpoint1[0] + this.triangle.GetCos(slen), rpoint1[1] + this.triangle.GetSin(slen)]; + this.relocShelter = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + rpoint1, rpoint2, rpoint3, rpoint4 + ] + }, + style: { + fill: theme.backgroundColor + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + var rpx = Math.abs(this.triangle.GetCos(halfWidth)) + 0.2; + this.relocShelter.position = [-directx * rpx, -directy * 0.2]; + this.relocShelter.hide(); + + // 反位/平行四边形 遮挡 + var sinX = theme.sectionWidth / this.triangle.GetSinRate(); + var switchWidth1 = theme.sectionWidth / 2; + var width1 = switchWidth1 * this.triangle.GetSinRate(); + var height1 = switchWidth1 * this.triangle.GetCosRate(); + var width2 = (height1 + switchWidth1) / this.triangle.GetTanRate(); + var width3 = sinX - width2 - width1; + var switchPoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1]; + var switchPoint2 = [switchPoint1[0] - directx * (width2 + width1) - directx * width3, switchPoint1[1]]; + var switchPoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1]; + var switchPoint4 = [switchPoint1[0] + directx * (width2 + width1) - directx * width3, switchPoint3[1]]; + this.reserveSection = new Polygon({ + zlevel: this.zlevel, + shape: { + points: [ + switchPoint1, switchPoint2, switchPoint3, switchPoint4 + ] + }, + style: { + fill: theme.sectionSpareColor, + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + this.reserveSection.hide(); + + // 失去 + this.release = new Line({ + zlevel: this.zlevel, + z: this.z + 2, + 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: theme.sectionWidth, + stroke: theme.sectionTimeReleaseColor, + } + }); + + + //释放解锁 + 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: theme.sectionWidth + theme.sectionBeyondWidth + 1, + stroke: theme.backgroundColor, + } + }); + + //单锁 + let lockR = 12; + this.lock = new Rect({ + zlevel: this.zlevel, + z: this.z + 5, + shape: { + x: model.intersection.x - lockR + this.triangle.GetCos(lockR), + y: model.intersection.y - lockR + this.triangle.GetSin(lockR) * 0.6, + width: lockR * 2, + height: lockR * 2 + }, + style: { + lineWidth: theme.sectionWidth / 3, + stroke: this.theme.switchMonolockColor, + fill: this.theme.transparentColor + } + }) + + // 添加 + this.add(this.switchView); + this.add(this.locShelter); + this.add(this.relocShelter); + this.add(this.reserveSection); + this.add(this.release); + this.add(this.releaseBackground); + this.add(this.lock); + } + + /** 创建道岔边框*/ + craeteSwitchBorder() { + let sectionA = this.getSectionInstance({ _type: ModelType.Section, _code: this.model.sectionACode }); + let sectionB = this.getSectionInstance({ _type: ModelType.Section, _code: this.model.sectionBCode }); + let sectionC = this.getSectionInstance({ _type: ModelType.Section, _code: this.model.sectionCCode }); + let rect = this.getBoundingRect(); + + sectionA && rect.union(sectionA.getBoundingRect()); + sectionB && rect.union(sectionB.getBoundingRect()); + sectionC && rect.union(sectionC.getBoundingRect()); + + this.switchBorder = new Rect({ + zlevel: this.model.zlevel, + z: this.z, + silent: true, + shape: Object.assign({ r: 4 }, rect), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.transparentColor + } + }) + + this.add(this.switchBorder); + } + + /** 道岔名称,显示,响应鼠标事件*/ + createNameText() { + let model = this.model; + let theme = this.theme; + + //描述文字 + this.arrowText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.intersection.x + 10, + y: model.intersection.y + 15, + text: `道岔区段名称: ${model.sectionName}`, + textFill: '#000', + textAlign: 'letf', + textFont: 10 + 'px consolas', + textPadding: 3, + textBackgroundColor: theme.tipBackgroundColor, + } + }); + this.arrowText.hide(); + this.add(this.arrowText); + + //创建道岔名称 + this.nameText = new Text({ + zlevel: this.zlevel, + z: this.z + 3, + style: { + x: model.namePoint.x + model.intersection.x + this.triangle.drictx * (theme.sectionWidth * 3 + theme.nameDistance) * this.triangle.GetCotRate(), + y: model.namePoint.y + model.intersection.y + this.triangle.dricty * (theme.nameDistance), + text: model.name, + textAlign: this.triangle.drictx === 1 ? 'left' : 'right', + textVerticalAlign: this.triangle.dricty === 1 ? 'top' : 'bottom', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.switchTextLossColor + } + }); + //添加道岔名称视图 + this.add(this.nameText); + //设置道岔名称视图显隐 + model.nameShow ? this.nameText.show() : this.nameText.hide(); + } + + /** 名称动画*/ + nameTextAnimation() { + this.nameText.animateStyle(true) + .when(0, { textFill: this.theme.backgroundColor }) + .when(1000, { textFill: this.theme.switchTextLossColor }) + .when(2000, { textFill: this.theme.backgroundColor }) + .start(); + } + + /** 设置岔芯是否隐藏*/ + setSwitchCoreInvisible(invisible) { + if (invisible) { + this.switchView.hide(); + } else { + this.switchView.show(); + } + } + + /** 设置岔芯颜色*/ + setSwitchCoreColor(color) { + this.switchView.eachChild(child => { + child.setStyle({ stroke: color }); + }) + } + + /** 设置道岔文字颜色*/ + setTextColor(color) { + this.nameText.setStyle('textFill', color); + } + + /** 恢复状态*/ + recover() { + this.setSwitchCoreColor(this.theme.backgroundColor); + this.nameText.stopAnimation(false); + this.release.stopAnimation(false); + this.reserveSection.stopAnimation(false); + this.switchView.eachChild((child) => { + child.stopAnimation(false); + }); + + this.release.hide(); + this.relocShelter.hide(); + this.releaseBackground.hide(); + + this.lock.hide(); + + switch (this.model.locateType) { + case '01': { // 定位 + this.setTextColor(this.theme.switchLocateTextColor); + } break; + case '02': { // 反位 + this.setTextColor(this.theme.switchInversionColor); + } break; + default: { // 其他 + this.setTextColor(this.theme.switchTextLossColor); + } + } + } + + /** 定位*/ + setLocationAction() { + this.recover(); + this.setSwitchCoreInvisible(true); + this.locShelter.show(); + this.relocShelter.hide(); + this.reserveSection.hide(); + } + + /** 反位*/ + setInversionAction() { + this.recover(); + this.setSwitchCoreInvisible(true); + this.locShelter.hide(); + this.relocShelter.show(); + this.reserveSection.show(); + } + + /** 失去*/ + setLossAction(nameFlicker) { + this.recover(); + this.locShelter.hide(); + this.relocShelter.hide(); + this.reserveSection.hide(); + this.setSwitchCoreInvisible(false); + nameFlicker && this.nameTextAnimation(); + } + + /** 挤叉*/ + setForkAction() { + this.setLossAction(true); + this.switchView.eachChild((child) => { + child.animateStyle(true) + .when(0, { stroke: this.theme.backgroundColor }) + .when(1000, { stroke: this.theme.switchTextLossColor }) + .when(2000, { stroke: this.theme.backgroundColor }) + .start(); + }); + } + + /** 空闲*/ + spare() { + } + + /** 单锁*/ + setMonolock() { + this.lock.setStyle('stroke', this.theme.switchMonolockColor); + this.lock.show(); + } + + /** 封锁 */ + setBlockLock() { + this.lock.setStyle('stroke', this.theme.switchBlockLockColor); + this.lock.show(); + } + + /** 延时释放*/ + timeRelease() { + this.setSwitchCoreInvisible(true); + this.release.show(); + this.releaseBackground.show(); + this.release.setStyle('stroke', this.theme.sectionTimeReleaseColor); + this.release.animateStyle(true) + .when(0, { stroke: this.theme.sectionTimeReleaseColor }) + .when(1000, { stroke: this.theme.backgroundColor }) + .start(); + + } + + /** 设置道岔切除*/ + setSwitchCutOff() { + this.setSwitchCoreInvisible(true); + switch (this.model.locateType) { + case '01': { // 定位 + this.release.show(); + this.releaseBackground.hide(); + this.setSectionstatus(this.release, 'stroke', this.model.sectionAstatus); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.backgroundColor }) + .start(); + } break; + case '02': { // 反位 + this.reserveSection.animateStyle(true) + .when(1000, { fill: this.theme.backgroundColor }) + .start(); + } break; + } + } + + setSectionstatus(section, style, status) { + if (section) { + switch (status) { + case '00': break; + case '01': { /** 空闲*/ + section.setStyle(style, this.theme.sectionSpareColor); + } break; + case '02': { /** 通信车占用*/ + section.setStyle(style, this.theme.sectionCommunicationOccupiedColor); + } break; + case '03': { /** 非通信车占用*/ + section.setStyle(style, this.theme.sectionUnCommunicationOccupiedColor); + } break; + case '04': { /** 进路锁闭*/ + section.setStyle(style, this.theme.sectionRouteLockColor); + } break; + case '05': { /** 故障锁闭*/ + section.setStyle(style, this.theme.sectionFaultLockColor); + } break; + case '06': { /** 封锁*/ + section.setStyle(style, this.theme.sectionBlockColor); + } break; + case '07': { /** ATC切除*/ + section.setStyle(style, this.theme.sectionAtcExcisionColor); + } break; + case '08': { /** ATS切除*/ + section.setStyle(style, this.theme.sectionAtsExcisionColor); + section.animateStyle(true) + .when(1000, { fill: this.theme.backgroundColor }) + .when(2000, { fill: this.theme.sectionAtsExcisionColor }) + .start(); + } break; + case '09': { /** 进路延续保护 */ + section.setStyle(style, this.theme.sectionProtectiveLockColor); + } break; + } + } + } + + setLocateType(model) { + this.setSectionstatus(this.reserveSection, 'fill', model.sectionCstatus); + switch (model.locateType) { + case '01': { + this.setLocationAction(); /** 定位*/ + } break; + case '02': { + this.setInversionAction(); /** 反位*/ + } break; + case '03': { + this.setLossAction(true); /** 失去*/ + } break; + case '04': { + this.setForkAction(); /** 挤岔*/ + } break; + } + } + + setStatus(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.setBlockLock(); /** 封锁*/ + } break; + } + + /** 区段切除*/ + if (model.cutOff) { + this.setSwitchCutOff(); + } + } + + getShapeTipPoint() { + var rect = null; + rect = this.nameText.getBoundingRect(); + if (rect) { + return { + x: rect.x + rect.width / 2, + y: rect.y + }; + } + return null; + } + + getSectionInstance(device) { + return store.getters['map/getViewInstanceByDevice'](device); + } + + mouseStatusVisible() { + let section = this.getSectionInstance({ _type: ModelType.Section, _code: this.model.switchSectionCode }); + section && section.setTrainWindowEventShow(true); + + this.switchBorder.show(); + this.setLossAction(false); + this.setSwitchCoreColor(this.theme.borderContextBackgroundColor); + this.setTextColor(this.theme.switchTextLossColor); + } + + mouseStatusRecover() { + let section = this.getSectionInstance({ _type: ModelType.Section, _code: this.model.switchSectionCode }); + section && section.setTrainWindowEventShow(false); + + this.switchBorder.hide(); + this.setSwitchCoreColor(this.theme.backgroundColor); + this.setStatus(this.model); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusVisible(); + } + } + } + + mouseenter(e) { + if (!this.selected) { + this.mouseStatusVisible(); + } + } + + mouseleave(e) { + if (!this.selected) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/chengdou_03/shape/Train.js b/src/jmap/components/chengdou_03/shape/Train.js new file mode 100644 index 000000000..68f19e5bc --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/Train.js @@ -0,0 +1,578 @@ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import BoundingRect from 'zrender/src/core/BoundingRect'; +import ModelType from '@/jlmap/model/ModelType'; +import store from '@/store'; + +/** 车身*/ +class TrainBody extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + + _create(model) { + let textFont = model.theme.trainTextFontSize + 'px ' + model.theme.textFontFormat; + let TextFontHSDA = model.theme.trainHSDATextFontSize + 'px ' + model.theme.textFontFormat; + + this.train = new Rect({ + zlevel: model.zlevel, + z: model.z, + shape: { + x: model.point.x, + y: model.point.y, + width: model.theme.trainWidth, + height: model.theme.trainHeight + }, + style: { + lineWidth: 0.5, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainBlueColor + } + + }); + + let lrPadding = 4; //两边间隔 + let upPadding = 4; //上边距离 + let beginX = (model.point.x + lrPadding); + let beginY = (model.point.y - model.theme.trainHSDATextFontSize - upPadding); + let margin = (model.theme.trainWidth - lrPadding * 2) / 4; + this.textH = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 0), + y: parseInt(beginY), + text: '扣', + textFill: model.theme.trainYellowColor, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + this.textS = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 1), + y: parseInt(beginY), + text: '跳', + textFill: model.theme.trainBlueColor, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + this.textD = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 2), + y: parseInt(beginY), + text: '门', + textFill: model.theme.trainGreenColor, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + this.textA = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 3), + y: parseInt(beginY), + text: '警', + textFill: model.theme.trainRedColor, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + lrPadding = 4; //两边间隔 + upPadding = 4; //上边距离 + let serviceNumber = model.model.serviceNumber || 'AA'; + let tripNumber = model.model.tripNumber || 'DDD'; + + serviceNumber = '00' + serviceNumber; + tripNumber = '000' + tripNumber; + this.textTrainServer = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x + lrPadding), + y: parseInt(model.point.y + upPadding), + text: serviceNumber.substring(serviceNumber.length - 2), + textFill: model.theme.trainBrownColor, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + } + }); + + this.textTrainTarget = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x + model.theme.trainWidth - lrPadding), + y: parseInt(model.point.y + upPadding), + text: tripNumber.substring(tripNumber.length - 3), + textFill: model.theme.trainYellowColor, + textFont: textFont, + textAlign: 'right', + textVerticalAlign: 'top', + } + }); + this.add(this.train); + this.add(this.textH); + this.add(this.textS); + this.add(this.textD); + this.add(this.textA); + this.add(this.textTrainServer); + this.add(this.textTrainTarget); + } + setTrainColor(color) { + this.train && this.train.setStyle('fill', color); + } + setTextTrainServerColor(color) { + this.textTrainServer.setStyle('textFill', color); + this.textTrainServer.setStyle('textStroke', color); + } + setTextTrainTargetColor(color) { + this.textTrainTarget.setStyle('textFill', color); + this.textTrainTarget.setStyle('textStroke', color); + } + setHShow(isShow) { + isShow ? this.textH.show() : this.textH.hide(); + } + setSShow(isShow) { + isShow ? this.textS.show() : this.textS.hide(); + } + setDShow(isShow) { + isShow ? this.textD.show() : this.textD.hide(); + } + setAShow(isShow) { + isShow ? this.textA.show() : this.textA.hide(); + } +} + +/** 车头*/ +class TrainHead extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + _create(model) { + let baseMargin = (model.drect === -1 ? 1 : 0); + this.line = new Rect({ + zlevel: model.zlevel, + z: model.z, + shape: { + x: model.point.x - baseMargin * (model.theme.trainConntWidth), + y: model.point.y, + width: model.theme.trainConntWidth, + height: model.theme.trainHeight + }, + style: { + lineWidth: 0.1, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainBackground + } + }); + + let arrowMargin = model.theme.trainPadding + model.theme.trainConntWidth; + this.arrow = new Polygon({ + zlevel: model.zlevel, + z: model.z, + shape: { + points: [ + [model.point.x + model.drect * (arrowMargin), model.point.y + 1 - model.theme.trainMoreLength], + [model.point.x + model.drect * (arrowMargin + model.theme.trainArrowWidth), model.point.y + (model.theme.trainHeight + model.theme.trainMoreLength) / 2], + [model.point.x + model.drect * (arrowMargin), model.point.y - 1 + model.theme.trainHeight + model.theme.trainMoreLength] + ] + }, + style: { + lineWidth: 0.1, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainBackground + } + }); + + 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(); + } + setInvisible(invisible) { + this.eachChild((child) => { + child.attr('invisible', invisible); + }); + } +} + +/** 列车*/ +export default class Train extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this.section = null; + this.selected = false; + this.fontSize = model.nameFontSize || theme.trainTextFontSize; + this.newScale = this.fontSize / theme.trainTextFontSize; + this._create(model, theme); + + // this.on('mousedown', this.mouseclick); + // this.on('mouseout', this.mouseleave); + // this.on('mouseover', this.mouseenter); + } + + _computed(model, theme) { + 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((theme.trainWidth - model.trainWindowModel.width) / 2); + } break; + case '02': { //从左向右 + this.point.x = this.point.x + model.trainWindowModel.width / 2 - theme.trainConntWidth * this.newScale - theme.trainWidth; + } break; + case '03': { //从右向左 + this.point.x = this.point.x - model.trainWindowModel.width / 2 + theme.trainConntWidth * this.newScale; + } break; + } + } else { + this.point = model.position; + this.traingle = null; + } + } + + _create(model, theme) { + //计算画图坐标点 + this._computed(model, theme); + + //画图 + if (this.point) { + // body + this.trainB = new TrainBody({ + model: model, + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: this.point + }); + // left 头 + this.trainL = new TrainHead({ + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: { + x: this.point.x - theme.trainHeadDistance, + y: this.point.y + }, + drect: -1 + }); + // right 头 + this.trainR = new TrainHead({ + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: { + x: this.point.x + theme.trainWidth + theme.trainHeadDistance, + y: this.point.y + }, + drect: 1 + }); + this.add(this.trainB); + this.add(this.trainL); + this.add(this.trainR); + + let rect = Object.assign({}, this.getBoundingRect()); + rect.x -= theme.trainWidth / 2; + rect.y -= 5; + rect.width += theme.trainWidth; + rect.height += 10; + + this.trainBorder = new Rect({ + zlevel: model.zlevel, + z: this.z, + silent: true, + shape: rect, + style: { + lineDash: [3, 3], + stroke: theme.borderColor, + fill: theme.transparentColor + } + }) + + this.add(this.trainBorder); + + this.mouseStatusRecover(); + this.setStatus(model); + } + } + getShapeTipPoint() { + return { + x: (this.train.shape.x), + y: (this.train.shape.y) + }; + } + //恢复颜色状态 + recover() { + this.trainB.setHShow(false); + this.trainB.setSShow(false); + this.trainB.setDShow(false); + this.trainB.setAShow(false); + this.trainL.setLineShow(false); + this.trainR.setLineShow(false); + this.trainL.setArrowShow(false); + this.trainR.setArrowShow(false); + } + //设置服务号状态类型 + setServerNoType(type) { + switch (type) { + case '01': { //显示服务号 计划车 + // this.trainB.setTextTrainServerColor(this.theme.trainWitheColor); + } break; + case '02': { //显示车组号: 头码车与人工车 + // this.trainB.setTextTrainServerColor(this.theme.trainYellowColor); + } break; + default: { + // this.trainB.setTextTrainServerColor(this.theme.backgroundColor); + } + } + } + //设置目的地状态 + setDestinationStatus(status) { + switch (status) { + case '01': { //准点 + // this.trainB.setTextTrainTargetColor(this.theme.trainWitheColor); + } break; + case '02': { //早点 + // this.trainB.setTextTrainTargetColor(this.theme.trainGreenColor); + } break; + case '03': { //晚点 + // this.trainB.setTextTrainTargetColor(this.theme.trainBrownColor); + } break; + case '04': { //头码车 + // this.trainB.setTextTrainTargetColor(this.theme.trainYellowColor); + } break; + default: { + // this.trainB.setTextTrainTargetColor(this.theme.backgroundColor); + } + } + } + //设置运行方向状态类型 + setDirectionType(type) { + switch (type) { + case '01': { //未知方向 + this.trainL.setLineShow(true); + this.trainR.setLineShow(true); + } break; + case '02': { //从左往右 上行 + this.trainR.setLineShow(true); + this.trainR.setArrowShow(true); + } break; + case '03': { //从右往左 下行 + this.trainL.setLineShow(true); + this.trainL.setArrowShow(true); + } break; + } + } + // 设置列车停止方向类型 + setDirectionStopType(type) { + switch (type) { + case '01': { //未知方向 + } break; + case '02': { //从左往右 上行 + this.trainR.setLineShow(true); + } break; + case '03': { //从右往左 下行 + this.trainL.setLineShow(true); + } break; + } + } + //设置运行状态 + setRunStatus(status) { + switch (status) { + case '01': { //停止 + this.setDirectionStopType(this.model.directionType); //设置运行方向状态类型 + } break; + case '02': { //运行 + this.setDirectionType(this.model.directionType); //设置运行方向状态类型 + } break; + } + + } + //设置运行模式 + setRunMode(status) { + switch (status) { + case '01': { //未知 + this.trainL.setColor(this.theme.trainWitheColor); + this.trainR.setColor(this.theme.trainWitheColor); + } break; + case '02': { //ATO自动驾驶模式 AM + this.trainL.setColor(this.theme.trainGreenColor); + this.trainR.setColor(this.theme.trainGreenColor); + } break; + case '03': { //ATP监控下的人工驾驶模式 CM + this.trainL.setColor(this.theme.trainYellowColor); + this.trainR.setColor(this.theme.trainYellowColor); + } break; + case '04': { //限制人工驾驶模式 RM + this.trainL.setColor(this.theme.trainBrownColor); + this.trainR.setColor(this.theme.trainBrownColor); + } break; + case '05': { //非限制人工驾驶模式 RM + this.trainL.setColor(this.theme.trainBrownColor); + this.trainR.setColor(this.theme.trainBrownColor); + } break; + } + } + + //设置运行控制状态类型 + setRunControlStatus(status) { + switch (status) { + case '01': { //正常 + this.trainB.setHShow(false); + this.trainB.setSShow(false); + } break; + case '02': { //扣车 + this.trainB.setHShow(true); + } break; + case '03': { //跳停 + this.trainB.setSShow(true); + } break; + } + } + //设置车门状态类型 + setDoorStatus(status) { + switch (status) { + case '01': { //关门 + this.trainB.setDShow(false); + } break; + case '02': { //开门 + this.trainB.setDShow(true); + } break; + } + } + //设置通信状态类型 + setCommunicationStatus(status) { + switch (status) { + case '01': { //正常 + // this.trainB.setTrainColor(this.theme.trainBrown1Color); + } break; + case '02': { //故障 + // this.trainB.setTrainColor(this.theme.trainGrayColor); + } break; + } + } + //设置报警状态 + setAlarmStatus(status) { + switch (status) { + case '01': { //不报警 + this.trainB.setAShow(false); + } break; + case '02': { //报警 + this.trainB.setAShow(true); + } break; + } + } + + //设置状态 + setStatus(model) { + if (model) { + this.recover(); + this.setServerNoType(model.serverNoType); //设置服务号状态类型 + this.setDestinationStatus(model.destinationStatus); //设置目的地状态 + this.setRunStatus(model.runStatus); //设置运行状态 + this.setRunMode(model.runMode); //设置运行模式 + this.setRunControlStatus(model.runControlStatus); //设置运行控制状态类型 + this.setDoorStatus(model.doorStatus); //设置车门状态类型 + this.setCommunicationStatus(model.communicationStatus); //设置通信状态类型 + this.setAlarmStatus(model.alarmStatus); //设置报警状态 + } + } + + //获取列车包围框 + getBoundingRect() { + let list = [this.trainB, this.trainL, this.trainR]; + let rect = null; + + list.forEach(elem => { + if (elem) { + let 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); + } + + setSectionBorderShow(show) { + let section = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Section, _code: this.model.sectionCode }); + show && section && section.mouseStatusVisible(); + show || section && section.mouseStatusRecover(); + } + + mouseStatusVisible() { + this.trainBorder.show(); + this.setSectionBorderShow(true); + } + + mouseStatusRecover() { + this.trainBorder.hide(); + this.setSectionBorderShow(false); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusVisible(); + } + } + } + + mouseenter(e) { + if (!this.selected) { + this.mouseStatusVisible(); + } + } + + mouseleave(e) { + if (!this.selected) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/chengdou_03/shape/TrainWindow.js b/src/jmap/components/chengdou_03/shape/TrainWindow.js new file mode 100644 index 000000000..331782467 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/TrainWindow.js @@ -0,0 +1,131 @@ +/* +* 车次窗 +*/ +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import Group from 'zrender/src/container/Group'; +import ModelType from '@/jlmap/model/ModelType'; +import store from '@/store'; + +export default class TrainWindow extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 1; + this.selected = false; + this.model = model; + this.theme = theme; + this._create(model); + + // this.on('mousedown', this.mouseclick); + // this.on('mouseout', this.mouseleave); + // this.on('mouseover', this.mouseenter); + } + + _create(model) { + let prdType = store.state.map.prdType; + if (prdType !== '01') { + this.createTrainWindow(); + this.setTrainWindowEventShow(model.trainWindowShow); + + this.mouseStatusRecover(); + this.setStatus(model); + } + } + + /** 创建车次窗*/ + createTrainWindow() { + let model = this.model; + let theme = this.theme; + + this.trainRect = new Polygon({ + _subType: 'TrainWindow', + zlevel: this.zlevel - 1, + z: this.z, + shape: { + smooth: 0.01, + points: [ + [model.point.x - model.width / 2, model.point.y], + [model.point.x + model.width / 2, model.point.y], + [model.point.x + model.width / 2, model.point.y + model.height], + [model.point.x - model.width / 2, model.point.y + model.height], + ] + }, + style: { + lineDash: [3, 3], + lineWidth: 1, + stroke: theme.trainWindowColor, + fill: theme.transparentColor + } + }); + this.add(this.trainRect); + } + + setTrainWindowEventShow(show) { + let lineWidth = show ? 1 : 0; + this.trainRect && this.trainRect.setStyle('lineWidth', lineWidth); + } + + 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; + } + } + } + + //设置状态 + setStatus() { + } + + 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; + } + + setSectionEventShow(e, show) { + let section = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Section, _code: this.model.sectionCode }); + show && section && section.mouseStatusVisible(e); + show || section && section.mouseStatusRecover(e); + } + + mouseStatusRecover(e) { + this.setTrainWindowEventShow(false); + this.setSectionEventShow(e, false); + } + + mouseStatusVisible(e) { + this.setTrainWindowEventShow(true); + this.setSectionEventShow(e, true); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusVisible(e); + } + } + } + + mouseenter(e) { + if (!this.selected) { + this.mouseStatusVisible(e); + } + } + + mouseleave(e) { + if (!this.selected) { + this.mouseStatusRecover(e); + } + } +} diff --git a/src/jmap/components/chengdou_03/shape/ZcControl.js b/src/jmap/components/chengdou_03/shape/ZcControl.js new file mode 100644 index 000000000..a104c0359 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/ZcControl.js @@ -0,0 +1,182 @@ +/* +* ZC区域控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +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 ZcControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 20; + this.model = model; + this.theme = theme; + this._create(model); + + // this.on('mouseout', this.mouseleave); + // this.on('mouseover', this.mouseenter); + } + + _create(model) { + this.control = new Arc({ + _subType: 'Control', + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: this.theme.zcControlmodeR + }, + style: { + lineWidth: 0, + fill: this.theme.zcControlGrayColor, + } + }); + + this.text = new Text({ + _subType: 'Text', + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: this.theme.stationControlTextSize + 'px ' + this.theme.textFontFormat + } + }); + + if (this.model.visible) { + this.add(this.control); + this.add(this.text); + } + + this.textShadow = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [4, -4], + silent: true, + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: this.theme.textShadowColor, //黄色 + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: 'bold ' + (this.theme.stationControlTextSize + 1) + 'px ' + this.theme.textFontFormat + } + }) + this.controlBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.control.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.transparentColor + } + }) + + this.textBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.text.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.borderContextBackgroundColor + } + }) + + this.add(this.control); + this.add(this.text); + this.add(this.textShadow); + this.add(this.textBorder); + this.add(this.controlBorder); + + this.mouseStatusRecover(); + this.setStatus(model); + } + + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + + } break; + case '01': { //中控(缺省值) + + } break; + case '02': { //站控且允许转为中控 + + } break; + case '03': { //站控且不允许转为中控 + + } break; + } + } + + 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; + } + + mouseStatusVisible(subType) { + if (subType == 'Text') { + this.textShadow.show(); + } + + if (subType == 'Control') { + this.textBorder.show(); + this.controlBorder.show(); + this.text.setStyle({ textFill: '#000' }); + this.control.setStyle({ fill: this.theme.borderContextBackgroundColor }); + } + } + + mouseStatusRecover() { + this.textShadow.hide(); + this.textBorder.hide(); + this.controlBorder.hide(); + this.text.setStyle({ textFill: '#fff' }); + this.control.setStyle({ fill: this.theme.zcControlGrayColor }); + this.setStatus(this.model); + } + + + mouseenter(e) { + if (e.target._subType) { + this.mouseStatusRecover(); + this.mouseStatusVisible(e.target._subType); + } + } + + mouseleave(e) { + if (e.target._subType) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/chengdou_03/shape/index.js b/src/jmap/components/chengdou_03/shape/index.js new file mode 100644 index 000000000..f88c3efb5 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/index.js @@ -0,0 +1,31 @@ +import Section from './Section'; +import Signal from './Signal'; +import Station from './Station'; +import StationControl from './StationControl'; +import StationCounter from './StationCounter'; +import StationDelayUnlock from './StationDelayUnlock'; +import StationStand from './StationStand'; +import Switch from './Switch'; +import Train from './Train'; +import TrainWindow from './TrainWindow'; +import ZcControl from './ZcControl'; +import LimitControl from './limitControl'; +import LcControl from './lcControl'; +import ImageControl from './ImageControl'; + +export default { + Section, + Signal, + Station, + StationControl, + StationCounter, + StationDelayUnlock, + StationStand, + Switch, + Train, + TrainWindow, + ZcControl, + LimitControl, + LcControl, + ImageControl, +}; \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/shape/lcControl.js b/src/jmap/components/chengdou_03/shape/lcControl.js new file mode 100644 index 000000000..f5301e811 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/lcControl.js @@ -0,0 +1,176 @@ +/* +* ZC区域控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +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 LcControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 20; + this.model = model; + this.theme = theme; + this._create(model); + + // this.on('mouseout', this.mouseleave); + // this.on('mouseover', this.mouseenter); + } + + _create(model) { + this.control = new Arc({ + _subType: 'Control', + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: this.theme.zcControlmodeR + }, + style: { + lineWidth: 0, + fill: this.theme.lcControlColor, + } + }); + + this.text = new Text({ + _subType: 'Text', + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: this.theme.stationControlTextSize + 'px ' + this.theme.textFontFormat + } + }); + + this.textShadow = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [4, -2], + silent: true, + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: this.theme.textShadowColor, //黄色 + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: 'bold ' + (this.theme.stationControlTextSize + 1) + 'px ' + this.theme.textFontFormat + } + }) + this.controlBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.control.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.transparentColor + } + }) + + this.textBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.text.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.borderContextBackgroundColor + } + }) + + this.add(this.control); + this.add(this.text); + this.add(this.textShadow); + this.add(this.textBorder); + this.add(this.controlBorder); + + this.mouseStatusRecover(); + this.setStatus(model); + } + + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + + } break; + case '01': { //中控(缺省值) + + } break; + case '02': { //站控且允许转为中控 + + } break; + case '03': { //站控且不允许转为中控 + + } break; + } + } + + 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; + } + + mouseStatusVisible(subType) { + if (subType == 'Text') { + this.textShadow.show(); + } + + if (subType == 'Control') { + this.textBorder.show(); + this.controlBorder.show(); + this.text.setStyle({ textFill: '#000' }); + this.control.setStyle({ fill: this.theme.borderContextBackgroundColor }); + } + } + + mouseStatusRecover() { + this.textShadow.hide(); + this.textBorder.hide(); + this.controlBorder.hide(); + this.text.setStyle({ textFill: '#fff' }); + this.control.setStyle({ fill: this.theme.lcControlColor }); + this.setStatus(this.model); + } + + mouseenter(e) { + if (e.target._subType) { + this.mouseStatusRecover(); + this.mouseStatusVisible(e.target._subType); + } + } + + mouseleave(e) { + if (e.target._subType) { + this.mouseStatusRecover(); + } + } +} diff --git a/src/jmap/components/chengdou_03/shape/libs/ShapePoints.js b/src/jmap/components/chengdou_03/shape/libs/ShapePoints.js new file mode 100644 index 000000000..dfc6dd6b1 --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/libs/ShapePoints.js @@ -0,0 +1,102 @@ +import Path from 'zrender/src/graphic/Path'; + + + +/** 指向箭头坐标*/ +export function arrows(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 var 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(); 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(); + } +}); \ No newline at end of file diff --git a/src/jmap/components/chengdou_03/shape/limitControl.js b/src/jmap/components/chengdou_03/shape/limitControl.js new file mode 100644 index 000000000..789a6febf --- /dev/null +++ b/src/jmap/components/chengdou_03/shape/limitControl.js @@ -0,0 +1,191 @@ +/* +* ZC区域控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +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 LimitControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 20; + this.selected = false; + this.model = model; + this.theme = theme; + this._create(model); + + // this.on('mousedown', this.mouseclick); + // this.on('mouseout', this.mouseleave); + // this.on('mouseover', this.mouseenter); + } + + _create(model) { + this.control = new Arc({ + _subType: 'Control', + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: this.theme.zcControlmodeR + }, + style: { + lineWidth: 0, + fill: this.theme.limitControlColor, + } + }); + + this.text = new Text({ + _subType: 'Text', + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: this.theme.stationControlTextSize + 'px ' + this.theme.textFontFormat, + } + }); + + this.textShadow = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [4, -4], + silent: true, + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: this.theme.textShadowColor, //黄色 + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: 'bold ' + (this.theme.stationControlTextSize + 1) + 'px ' + this.theme.textFontFormat + } + }); + + this.controlBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.control.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.transparentColor + } + }); + + this.textBorder = new Rect({ + zlevel: model.zlevel, + z: this.z - 1, + silent: true, + shape: this.text.getBoundingRect(), + style: { + lineDash: [3, 3], + stroke: this.theme.borderColor, + fill: this.theme.borderContextBackgroundColor + } + }); + + this.add(this.control); + this.add(this.text); + this.add(this.textShadow); + this.add(this.textBorder); + this.add(this.controlBorder); + + this.mouseStatusRecover(); + this.setStatus(model); + } + + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + + } break; + case '01': { //中控(缺省值) + + } break; + case '02': { //站控且允许转为中控 + + } break; + case '03': { //站控且不允许转为中控 + + } break; + } + } + + 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; + } + + mouseStatusVisible(subType) { + if (subType == 'Text') { + this.textShadow.show(); + } + + if (subType == 'Control') { + this.textBorder.show(); + this.controlBorder.show(); + this.text.setStyle({ textFill: '#000' }); + this.control.setStyle({ fill: this.theme.borderContextBackgroundColor }); + } + } + + mouseStatusRecover() { + this.textShadow.hide(); + this.textBorder.hide(); + this.controlBorder.hide(); + this.text.setStyle({ textFill: '#fff' }); + this.control.setStyle({ fill: this.theme.limitControlColor }); + this.setStatus(this.model); + } + + mouseclick(e) { + if ([3].includes(e.which)) { + this.selected = !this.selected; + if (this.selected) { + this.mouseStatusRecover(); + this.mouseStatusVisible('Control'); + } + } + } + + mouseenter(e) { + if (!this.selected && e.target._subType) { + this.mouseStatusRecover(); + this.mouseStatusVisible(e.target._subType); + } + } + + mouseleave(e) { + if (e.target && e.target._subType) { + if (!this.selected && e.target._subType) { + this.mouseStatusRecover(); + } + } + + } +} diff --git a/src/jmap/components/chengdou_03/theme.js b/src/jmap/components/chengdou_03/theme.js new file mode 100644 index 000000000..a0efcdb0d --- /dev/null +++ b/src/jmap/components/chengdou_03/theme.js @@ -0,0 +1,442 @@ +import { enableClassExtend, enableClassCheck } from '@/jlmap/util/clazz'; + +/** + * 皮肤风格主题 + * @param {*} opts + */ +function Theme() { + +} + +Theme.prototype = { + + constructor: Theme, + + /** 皮肤风格编码 */ + code: '03', + + /** 默认背景 颜色*/ + backgroundColor: '#000000', + + /** 默认提示背景 颜色*/ + tipBackgroundColor: 'yellow', + + /** 默认边线 颜色*/ + sidelineColor: '#C0C0C0', + + /** 透明填充 颜色*/ + transparentColor: 'rgba(0,0,0,0)', + + /** 默认字体 大小*/ + textFontSize: 8.2, + + /** 默认字体 族类*/ + textFontFormat: 'consolas', + + /** 默认字体颜色*/ + textFontColor: '#C0C0C0', + + /** 默认字体阴影颜色*/ + textShadowColor: '#FFFF00', + + /** 默认border文字背景色*/ + borderContextBackgroundColor: '#00FFFF', + + /** 默认border颜色*/ + borderColor: '#C0C0C0', + + /** 默认border线宽*/ + borderWidth: 1, + + /** 默认名称和设备的距离*/ + nameDistance: 2, + + /** 目的码字体颜色*/ + destinationTextFontColor: 'yellow', + + /** line 颜色*/ + lineWidthColor: '#FFFF00', + + + /** link 宽度*/ + linkWidth: 4.4, + + /** link 线条颜色*/ + linkColor: '#3F3F3F', + + /** link 字体颜色*/ + linkTextColor: '#C0C0C0', + + /** StopPoint 颜色*/ + stopPointColor: '#FE0000', + + /** StopPoint 字体颜色*/ + stopPointTextColor: '#C0C0C0', + + zcControlGrayColor: '#00FF00', + + limitControlColor: '#ECE9D8', + + lcControlColor: '#FFFF00', + + zcControlmodeR: 4, + + + /** 区段 宽度*/ + sectionWidth: 4.4, + + /** 区段宽超出宽度*/ + sectionBeyondWidth: 0, + + /** 计轴 半径*/ + sectionAxleR: 3, + + /** 计轴和区段之间的距离*/ + sectionAxleDistance: 5, + + /** 限速线的宽度*/ + sectionSpeedLimitLinewidth: 1, + + /** 限速线距离区段距离*/ + sectionSpeedLimitDistance: 4, + + /** 分隔符宽度*/ + sectionSeparatorWidth: 1.5, + + /** 区段字体白色*/ + sectionTextWhite: '#FFFFFF', + + /** 区段字体绿色*/ + sectionTextGreen: '#00FF00', + + /** 区段侵入颜色*/ + sectionInvadeColor: '#C00808', + + /** 限速线颜色*/ + sectionSpeedLimitColor: '#C0C000', + + /** 区段计轴颜色*/ + sectionAxleColor: '#C0C0C0', + + /** 区段边界符颜色*/ + sectionSeparatorColor: '#C0C0C0', + + /** 区段空闲颜色*/ + sectionSpareColor: '#5B5893', //#484468 //#5578B6 + + /** 逻辑区段名称颜色*/ + sectionLogicalTextColor: '#FFFFFF', + + /** 区段通信车占用颜色**/ + sectionCommunicationOccupiedColor: '#FF00FF', + + /** 区段非通讯车占用颜色*/ + sectionUnCommunicationOccupiedColor: '#DE310C', + + /** 区段路由锁定颜色*/ + sectionRouteLockColor: '#00FF00', + + /** 区段故障锁定颜色*/ + sectionFaultLockColor: '#FFFFFF', + + /** 区段未定义颜色*/ + sectionUndefinedColor: '#0071C1', + + /** 保护区段锁闭*/ + sectionProtectionSectionLockedColor: '#00FF00', + + /** 区段计轴预复位*/ + sectionAxleResetColor: '#00FFFF', + + /** 区段封锁颜色*/ + sectionBlockTextColor: '#E20F0A', + + /** 区段锁闭颜色*/ + sectionBlockColor: '#00C957', + + /** 区段atc切除颜色*/ + sectionAtcExcisionColor: '#A0522D', + + /** 区段ats切除颜色*/ + sectionAtsExcisionColor: '#A0522D', + + /** 区段延时释放颜色*/ + sectionTimeReleaseColor: '#3F3F3F', + + /** 区段保护锁闭*/ + sectionProtectiveLockColor: '#00C957', + + /** 区段保护延时解锁*/ + sectionProtectiveTimeReleaseColor: '#0071C1', + + /** 计轴失效*/ + sectionAxleFailure: '#B18F38', + + + /** 道岔单边长度 */ + switchLen: 7, + + //道岔字体颜色 + switchTextColor: 'lightgreen', + + /** 道岔边框颜色*/ + switchTextBorderColor: '#FE0000', + + /** 道岔失去颜色*/ + switchTextLossColor: '#C00808', + + /** 道岔定位颜色*/ + switchLocateTextColor: '#08C008', + + /** 道岔反位颜色*/ + switchInversionColor: '#C0C000', + + /** 道岔单锁颜色*/ + switchMonolockColor: '#FFFFFF', + + /** 道岔封锁*/ + switchBlockLockColor: '#E20F0A', + + + /** 信号机宽度 */ + signalR: 6.5, + + /** 灯柱宽度*/ + signalLampStandardWidth: 1.5, + + /** 设备距离区段的距离*/ + signalDistance: 13, + + /** 信号灯按钮边线*/ + signalButtonDashColor: '#C0C0C0', //'#C0C0C0' + + /** 信号灯按钮颜色*/ + signalButtonColor: 'darkgreen', + + /** 信号灯按钮闪烁颜色*/ + signalButtonLightenColor: '#E4EF50', + + /** 信号灯字体红色*/ + signalTextRed: '#C00808', + + /** 信号灯字体绿色*/ + signalTextGreen: '#00FF00', + + /** 信号灯灯柱颜色*/ + signalLampStandardColor: '#FFFFFF', + + /** 信号灯灰色*/ + signalLampGrayColor: '#7F7F7F', + + /** 信号灯绿色*/ + signalLampGreenColor: '#00FF00', + + /** 信号灯黄色*/ + signalLampYellowColor: '#FFFF00', + + /** 信号灯白色*/ + signalLampWhiteColor: '#FFFFFF', + + /** 信号灯蓝色*/ + signalLampBlueColor: '#0000FF', + + + /** 公里表距离车站距离*/ + stationKmRangeDistance: 22, + + + /** 控制模式字体大小*/ + stationControlTextSize: 10, + + /** 控制模式灯的半径 */ + stationControlmodeR: 6.5, + + /** 控制模式之间灯之间的距离*/ + stationControlDistance: 36, + + /** 控制模式灰色*/ + stationControlGrayColor: '#7D7D7D', + + /** 控制模式绿色*/ + stationControlGreenColor: '#08C008', + + /** 控制模式红色*/ + stationControlRedColor: '#C00808', + + /** 控制模式黄色*/ + stationControlYellowColor: '#FFFF00', + + /** 控制模式紫色*/ + stationControlPurple: '800080', + + + /** 站台和屏蔽门之间的距离*/ + stationStandDistance: 1.5, + + /** 站台屏蔽门高度*/ + statonStandSafeHeight: 4, + + /** 站台首端字体大小*/ + stationStandHeadFontSize: 12, + + /** 跳停圈的宽度*/ + stationStandJumpArcWidth: 2, + + /** 站台无人折返*/ + stationStandNoHumanReentryColor: '#0F16DA', + + /** 站台自动换端*/ + stationStandAutoChangeEndsColor: '#0BF400', + + /** 站台空闲颜色*/ + stationStandSpareColor: '#808080', + + /** 站台列车停站颜色*/ + stationStandStopColor: '#FEFE00', + + /** 站台跳停颜色*/ + stationStandJumpStopColor: '#0000FF', // #9A99FF + + /** 站台紧急关闭颜色*/ + stationStandEmergentCloseColor: '#C00808', + + /** 停站时间字体颜色*/ + stationStandTimeTextColor: '#C0C0C0', + + /** 设置人工运行等级颜色*/ + stationStandRunLevelColor: '#FFFF00', + + /** 车站扣车颜色*/ + stationStandStandDetainTrainColor: '#FFFF00', + + /** 中心扣车颜色*/ + stationStandCenterDetainTrainColor: '#C0C0C0', + + /** 车站+中心扣车颜色*/ + stationStandStandAndCenterDetainTrainColor: '#C00808', + + /** 屏蔽门默认颜色*/ + stationStandDoorDefaultColor: '#08C008', + + /** 屏蔽门切除颜色*/ + stationStandSplitDoorColor: '#F61107', + + /** 车站扣除文字颜色*/ + stationStandDetainTrainTextColor: '#E4EF50', + + + /** 计数器字体颜色*/ + stationCounterTextColor: '#C0C0C0', + + /** 计数器边框颜色*/ + stationCounterBorderColor: '#E4EF50', + + + /** 延迟解锁倒计时和设备文字之间的距离*/ + stationDelayUnlockDistance: 3, + + /** 延时解锁字体颜色*/ + stationDelayUnlockTextColor: '#C0C0C0', + + /** 延迟解锁边框颜色*/ + stationDelayUnlockBorderColor: '#C0C0C0', + + // 停车点折返点目的码名字颜色 + stopPointTexDestCodetColor: '#FFF07B', + + + /** 停车点目的码文字大小*/ + textPointFontSize: 10, + + + /** 列车长度*/ + trainWidth: 60, + + /** 列车高度*/ + trainHeight: 18, + + /** 列车字号*/ + trainTextFontSize: 12, + + /** 列车HDSA字号*/ + trainHSDATextFontSize: 9, + + /** 列车信号的半径*/ + trainConflictR: 3, + + /** 列车信号距离车的距离*/ + trainConflictDistance: 5, + + /** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/ + trainMoreLength: 1, + + /** 列车和车头之间的间距*/ + trainHeadDistance: 2, + + /** 列车竖杠的宽度*/ + trainConntWidth: 2, + + /** 列车竖杠和方向之间的间隔*/ + trainPadding: 2, + + /** 列车方向的宽度*/ + trainArrowWidth: 6, + + /** 列车和区段之间的距离*/ + trainDistance: 30, + + /** 列车边线颜色*/ + trainSidelineColor: '#FFFFFF', + + /** 列车背景*/ + trainBackground: '#000000', + + /** 列车 灰色*/ + trainGrayColor: '#C0C0C0', + + /** 列车 白色*/ + trainWitheColor: '#C0C0C0', + + /** 列车 棕色*/ + trainBrownColor: '#A0522D', + + /** 列车 黄色*/ + trainYellowColor: '#FFFF00', + + /** 列车 棕灰色 */ + trainBrown1Color: '#725A64', + + /** 列车 绿色*/ + trainGreenColor: '#00FF00', + + /** 列车 蓝色*/ + trainBlueColor: '#10013A', //#000099 + + /** 列车 红色*/ + trainRedColor: '#FF0000', + + /** 列车 橘色*/ + trainOrangeColor: 'orange', + + /** 列车 紫色*/ + trainPurpleColor: 'purple', + + /** 列车 粉色*/ + trainPinkColor: 'pink', + + + /** 车次窗高度*/ + trainWindowWidth: 40, + + /** 车次窗高度*/ + trainWindowHeight: 15, + + /** 车次窗颜色*/ + trainWindowColor: '#C0C0C0', +}; + +// Enable Theme.extend. +enableClassExtend(Theme); +enableClassCheck(Theme); + +export default Theme; \ No newline at end of file diff --git a/src/jmap/components/default/convert.js b/src/jmap/components/default/convert.js new file mode 100644 index 000000000..022250693 --- /dev/null +++ b/src/jmap/components/default/convert.js @@ -0,0 +1,308 @@ +import { createMartPoint, createSeriesModel, createMarkLineModels, HexColor, ConvertSheetToList } from '@/utils/runPlan'; + +export default { + /** 边缘高度*/ + EdgeHeight: 600, + + /** 间隔高度*/ + CoordMultiple: 1, + + /** 偏移时间*/ + TranslationTime: 60 * 60 * 2, + + /** excel解析配置*/ + ExcelConfig: { + beginRow: 1, + beginCol: 0, + fieldNum: 10, + sepField: '车次', + columns: { + '车站名': { key: 'stationName', formatter: (val) => { return val; } }, + '到点': { key: 'arriveTime', formatter: (val) => { return val; } }, + '发点': { key: 'departureTime', formatter: (val) => { return val; } }, + } + }, + + /** 解析exal数据转换为Json后台数据*/ + importData(Sheet, JsonData) { + let dataList = ConvertSheetToList(Sheet, true); + let needList = Object.keys(this.ExcelConfig.columns); + + if (dataList && dataList.length) { + for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += this.ExcelConfig.fieldNum + 1) { + let isContinue = true; + let tripObj = { code: '', arrivalList: [] }; + + for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) { + isContinue = false; + + let stationObj = {}; + for (var index = 0; index < this.ExcelConfig.fieldNum; index += 1) { + if (dataList[colIndex + index]) { + let title = dataList[colIndex + index][0]; + let value = dataList[colIndex + index][rowIndex]; + + if (title && value) { + // 数据列解析 + isContinue = true; + let titleStr = `${title}`.trim(); + let valueStr = `${value}`.trim(); + + if (titleStr == this.ExcelConfig.sepField) { + if (tripObj.code) { + let length = tripObj.arrivalList.length; + if (length == 1) { + tripObj.arrivalList[0]['flag'] = true; + } + JsonData.push(tripObj); + tripObj = { code: valueStr, arrivalList: [] }; + } else { + tripObj.code = valueStr; + } + } + + // 取需要的字段 + if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) { + stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr); + } + } + } + } + + // 添加字段值 + if (Object.keys(stationObj).length) { + tripObj.arrivalList.push(stationObj); + } + } + + // 添加最后那条没有车次的记录 + if (tripObj.code) { + let length = tripObj.arrivalList.length; + if (length) { + tripObj.arrivalList[length - 1]['flag'] = true; + } + JsonData.push(tripObj); + } + } + } + + return JsonData; + }, + + /** 将后台数据解析成图表*/ + convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) { + let models = []; + + if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) { + /** 按服务遍历数据*/ + data.serviceNumberDataList.forEach((service) => { + /** 按车次遍历数据*/ + let opt = { name: '', markPointData: [], data: [] }; + if (service.tripNumberDataList && service.tripNumberDataList.length) { + service.tripNumberDataList.forEach((train, j) => { + let pointdata = {}; + let idx = 0; + let num = 0; + let lastPoint = null; + let nextPoint = null; + + /** 如果车次号为空,不显示名称*/ + if (train.tripNumber) { + /** 创建标记点名称和坐标*/ + pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`; + pointdata.color = '#000' || lineStyle.color; + pointdata.directionCode = train.directionCode; + pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)]; + + /** 给服务对象添加服务名称和标记点*/ + opt.markPointData.push(createMartPoint(pointdata)); + /** 创建服务号名称*/ + opt.name = `${service.serviceNumber}`; + } + + /** 计算非折返点车次点坐标集合*/ + train.stationTimeList.forEach((elem, index) => { + idx = index; + 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) { + opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode]); + } + }); + + /** 计算折返点车次坐标点集合*/ + if (!service.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) { + lastPoint = train.stationTimeList[idx - 1]; + nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1]; + num = this.computedReentryNumber(train.tripNumber); + opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode]); + opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode]); + } + + /** 如果是备用车,按车次添加线*/ + if (service.backup) { + /** 创建一条完成的服务数据*/ + opt.name += j; + let model = createSeriesModel(opt, Object.assign({ color: HexColor.toCreate() }, lineStyle)); + if (model) { + models.push(model); + opt = { name: '', markPointData: [], data: [] }; + } + } + }); + + //不是备用车,按服务添加线 + if (!service.backup) { + /** 创建一条完成的服务数据*/ + let model = createSeriesModel(opt, Object.assign({ color: HexColor.toCreate() }, 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, false)], + name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`, + })); + } + + /** 计算折返点*/ + let nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false), elem.directionCode]; + if (serie.data.length > 0) { + let lastPoint = serie.data[serie.data.length - 1]; + if (lastPoint[2] !== nextPoint[2]) { + let num = this.computedReentryNumber(elem.tripNumber); + serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[2], num), lastPoint[2]]); + serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2], num), lastPoint[2]]); + } + } + + /** 添加车组号数据到对应的服务图数据中*/ + serie.data.push(nextPoint); + + /** 保证原始数据排序*/ + serie.data.sort((a, b) => { + return parseInt(a[0]) - parseInt(b[0]); + }); + } + }); + }); + } + + return series; + }, + + /** 初始化Y轴*/ + initializeYaxis(stations) { + return createMarkLineModels(stations, (elem) => { + return this.EdgeHeight + elem.kmRange * this.CoordMultiple; + }); + }, + + /** 将后台数据转换为试图序列模型*/ + convertStationsToMap(stations) { + let 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) { + let yText = ''; + + stations.forEach(elem => { + if (elem.kmRange < parseInt(params.value) / this.CoordMultiple - this.EdgeHeight) { + yText = elem.kmRange + 'm'; + } + }); + + return yText; + }, + + /** 根据是否和上一个车次是否相交,计算下一个车次的折返的高度*/ + computedReentryNumber(code) { + return parseInt(code || 1) % 2 ? 1 : 2; + }, + + /** 根据方向计算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, directionCode, isSpecial, num) { + let defaultVlue = 0; + let station = stations.find(it => { return it.code == elem.stationCode; }); + if (station) { + defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; + if (isSpecial) { + defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode, num); + } + } + + return defaultVlue; + } +}; \ No newline at end of file diff --git a/src/jmap/components/default/menus/dialog/routecancel.vue b/src/jmap/components/default/menus/dialog/routecancel.vue new file mode 100644 index 000000000..2f1245b34 --- /dev/null +++ b/src/jmap/components/default/menus/dialog/routecancel.vue @@ -0,0 +1,114 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/dialog/routerelieve.vue b/src/jmap/components/default/menus/dialog/routerelieve.vue new file mode 100644 index 000000000..59767ec8b --- /dev/null +++ b/src/jmap/components/default/menus/dialog/routerelieve.vue @@ -0,0 +1,91 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/dialog/routesetting.vue b/src/jmap/components/default/menus/dialog/routesetting.vue new file mode 100644 index 000000000..ed2b35a74 --- /dev/null +++ b/src/jmap/components/default/menus/dialog/routesetting.vue @@ -0,0 +1,171 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/dialog/sectioncontrol.vue b/src/jmap/components/default/menus/dialog/sectioncontrol.vue new file mode 100644 index 000000000..e6a9de274 --- /dev/null +++ b/src/jmap/components/default/menus/dialog/sectioncontrol.vue @@ -0,0 +1,145 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/dialog/sectionfault.vue b/src/jmap/components/default/menus/dialog/sectionfault.vue new file mode 100644 index 000000000..ea05a0fb7 --- /dev/null +++ b/src/jmap/components/default/menus/dialog/sectionfault.vue @@ -0,0 +1,237 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/dialog/signalreopen.vue b/src/jmap/components/default/menus/dialog/signalreopen.vue new file mode 100644 index 000000000..8892e3f8a --- /dev/null +++ b/src/jmap/components/default/menus/dialog/signalreopen.vue @@ -0,0 +1,119 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/dialog/standearlydeparture.vue b/src/jmap/components/default/menus/dialog/standearlydeparture.vue new file mode 100644 index 000000000..19f488a54 --- /dev/null +++ b/src/jmap/components/default/menus/dialog/standearlydeparture.vue @@ -0,0 +1,137 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/dialog/standjumpstop.vue b/src/jmap/components/default/menus/dialog/standjumpstop.vue new file mode 100644 index 000000000..a0a5f2e33 --- /dev/null +++ b/src/jmap/components/default/menus/dialog/standjumpstop.vue @@ -0,0 +1,242 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/dialog/switchcontrol.vue b/src/jmap/components/default/menus/dialog/switchcontrol.vue new file mode 100644 index 000000000..c1ccee409 --- /dev/null +++ b/src/jmap/components/default/menus/dialog/switchcontrol.vue @@ -0,0 +1,151 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/dialog/traincreate.vue b/src/jmap/components/default/menus/dialog/traincreate.vue new file mode 100644 index 000000000..d68876cf2 --- /dev/null +++ b/src/jmap/components/default/menus/dialog/traincreate.vue @@ -0,0 +1,135 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/index.vue b/src/jmap/components/default/menus/index.vue new file mode 100644 index 000000000..69112ae99 --- /dev/null +++ b/src/jmap/components/default/menus/index.vue @@ -0,0 +1,251 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/menuButton.vue b/src/jmap/components/default/menus/menuButton.vue new file mode 100644 index 000000000..8cb2a393e --- /dev/null +++ b/src/jmap/components/default/menus/menuButton.vue @@ -0,0 +1,305 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/menuCancel.vue b/src/jmap/components/default/menus/menuCancel.vue new file mode 100644 index 000000000..f0e06159f --- /dev/null +++ b/src/jmap/components/default/menus/menuCancel.vue @@ -0,0 +1,119 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/menuSection.vue b/src/jmap/components/default/menus/menuSection.vue new file mode 100644 index 000000000..db9e278e2 --- /dev/null +++ b/src/jmap/components/default/menus/menuSection.vue @@ -0,0 +1,357 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/menuSignal.vue b/src/jmap/components/default/menus/menuSignal.vue new file mode 100644 index 000000000..0cceede77 --- /dev/null +++ b/src/jmap/components/default/menus/menuSignal.vue @@ -0,0 +1,351 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/menuStation.vue b/src/jmap/components/default/menus/menuStation.vue new file mode 100644 index 000000000..e69de29bb diff --git a/src/jmap/components/default/menus/menuStationControl.vue b/src/jmap/components/default/menus/menuStationControl.vue new file mode 100644 index 000000000..5e8f9ae50 --- /dev/null +++ b/src/jmap/components/default/menus/menuStationControl.vue @@ -0,0 +1,206 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/menuStationStand.vue b/src/jmap/components/default/menus/menuStationStand.vue new file mode 100644 index 000000000..e7da83773 --- /dev/null +++ b/src/jmap/components/default/menus/menuStationStand.vue @@ -0,0 +1,277 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/menuSwitch.vue b/src/jmap/components/default/menus/menuSwitch.vue new file mode 100644 index 000000000..826bad038 --- /dev/null +++ b/src/jmap/components/default/menus/menuSwitch.vue @@ -0,0 +1,277 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/menuTrain.vue b/src/jmap/components/default/menus/menuTrain.vue new file mode 100644 index 000000000..de066cb30 --- /dev/null +++ b/src/jmap/components/default/menus/menuTrain.vue @@ -0,0 +1,201 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/default/menus/utils/menuItemStatus.js b/src/jmap/components/default/menus/utils/menuItemStatus.js new file mode 100644 index 000000000..6705a01c5 --- /dev/null +++ b/src/jmap/components/default/menus/utils/menuItemStatus.js @@ -0,0 +1,301 @@ +import store from '@/store'; +import { mapStatusEnum, getStatusObject } from '@/scripts/StatusDic'; +export function getCurrentStatusObject() { + return getStatusObject(store.getters['menuOperation/selected']); +} + +export const MenuDisabledStatus = { + Section: { + //封锁 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Section.status.Status06) { + return true; + } + }, + //解禁 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Section.status.Status06) { + return true; + } + }, + //区故解 + fault() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Section.status.Status05) { + return true; + } + }, + //区段跟踪激活 + active() { + + }, + //区段跟踪切除 + splite() { + + }, + //确认计轴有效 + sureAxleEffective() { + // 未开发 + }, + //设置临时限速 + setTemporarySpeedLimit() { + // 未开发 + }, + //查看设备状态 + viewDeviceStatus() { + // 未开发 + }, + //新建列车 + newTrain() { + + }, + //空闲 + spare() { + // 未开发 + }, + //故障锁闭 + faultLock() { + // 未开发 + }, + //设置故障 + setStoppage() { + }, + //取消故障 + cancelStoppage() { + }, + //强制开门 + forceOpenDoor() { + }, + //强制关门 + forceCloseDoor() { + } + }, + Signal: { + //排列进路 + arrangementRoute() { + + }, + //取消列车进路 + cancelTrainRoute() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Signal.status.Status01) { + return true; + } + }, + //人解列车进路 + humanTrainRoute() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Signal.status.Status01) { + return true; + } + }, + //封锁 + lock() { + // 未开发 + }, + //解锁 + unlock() { + // 未开发 + }, + //设置自动通过进路 + setUpAutomaticRoute() { + // 未开发 + }, + //信号重开 + reopenSignal() { + + }, + //引导 + guide() { + // 未开发 + }, + //进路交人工控 + routeToIndustrialControl() { + // 未开发 + }, + //进路交自动控 + routeToAutomaticControl() { + // 未开发 + }, + //查询进路控制状态 + queryRouteAutomaticState() { + // 未开发 + }, + //设置故障 + setStoppage() { + }, + //取消故障 + cancelStoppage() { + } + }, + Station: { + }, + StationControl: { + //紧急站控 + emergencyStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status03) { + return true; + } + }, + //请求站控 + requestStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status02) { + return true; + } + }, + //强行站控 + forcedStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status02) { + return true; + } + }, + //请求中控 + requestCentralControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status01) { + return true; + } + }, + //设置故障 + setStoppage() { + }, + //取消故障 + cancelStoppage() { + } + }, + StationStand: { + //设置扣车 + setDetainTrain() { + // 未开发 + }, + //取消扣车 + cancelDetainTrain() { + // 未开发 + }, + //设置跳停 + setJumpStop() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationStand.status.Status03 || device && device.status == mapStatusEnum.StationStand.status.Status04) { + return true; + } + }, + //取消跳停 + cancelJumpStop() { + }, + //提前发车 + earlyDeparture() { + }, + //站台详细信息 + stationStandDetail() { + // 未开发 + }, + //设置故障 + setStoppage() { + }, + //取消故障 + cancelStoppage() { + } + }, + Switch: { + //定操 + normalIndication() { + let device = getCurrentStatusObject(); + if (device && device.locateType == mapStatusEnum.Switch.locateType.Status01) { + return true; + } + }, + //反操 + reverseIndication() { + let device = getCurrentStatusObject(); + if (device && device.locateType == mapStatusEnum.Switch.locateType.Status02) { + return true; + } + }, + //单锁 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Switch.status.Status10) { + return true; + } + }, + //解锁 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Switch.status.Status10) { + return true; + } + }, + //封锁 + block() { + // 未开发 + }, + //区故解 + fault() { + // 未开发 + }, + //区段跟踪激活 + active() { + // 未开发 + }, + //区段跟踪切除 + splite() { + // 未开发 + }, + //查看设备状态 + viewDeviceStatus() { + // 未开发 + }, + //设置故障 + setStoppage() { + }, + //取消故障 + cancelStoppage() { + } + }, + Train: { + //删除列车 + remove() { + // 未开发 + }, + //运行 + run() { + let device = getCurrentStatusObject(); + if (device && device.runStatus == mapStatusEnum.Train.runStatus.Status02) { + return true; + } + }, + //停止 + stop() { + let device = getCurrentStatusObject(); + if (device && device.runStatus == mapStatusEnum.Train.runStatus.Status01) { + return true; + } + }, + //设置故障 + setStoppage() { + }, + //取消故障 + cancelStoppage() { + } + } +}; + +/** + * 将menu的disabled属性使用disabledCallback计算并返回 + * @param {Array} menu + */ +export function menuConvert(menu) { + if (menu.constructor === Array) { + menu.forEach(elem => { + if (elem.disabledCallback.constructor === Function) { + elem.disabled = elem.disabledCallback(); + } + }); + } + return menu; +} \ No newline at end of file diff --git a/src/jmap/components/default/menusPlan/components/dataTable.vue b/src/jmap/components/default/menusPlan/components/dataTable.vue new file mode 100644 index 000000000..6d0ad3146 --- /dev/null +++ b/src/jmap/components/default/menusPlan/components/dataTable.vue @@ -0,0 +1,203 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/default/model.js b/src/jmap/components/default/model.js new file mode 100644 index 000000000..2c74b67fc --- /dev/null +++ b/src/jmap/components/default/model.js @@ -0,0 +1,22 @@ +export const modelPublicInitialValue = { + +}; + +/** + * 在创建Model数据时,根据皮肤类型修改默认值 + * @param {Object} model + */ +export function InitPublicProperties(model) { + if (model) { + let modelInitial = modelPublicInitialValue[model._type]; + if (modelInitial) { + for (let prop in modelInitial) { + if (prop && modelInitial[prop]) { + model[prop] = modelInitial[prop]; + } + } + } + } + + return model; +} \ No newline at end of file diff --git a/src/jmap/components/default/planSchedule/index.vue b/src/jmap/components/default/planSchedule/index.vue new file mode 100644 index 000000000..4e2f632f8 --- /dev/null +++ b/src/jmap/components/default/planSchedule/index.vue @@ -0,0 +1,391 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/default/planSchedule/menuBar.vue b/src/jmap/components/default/planSchedule/menuBar.vue new file mode 100644 index 000000000..5f478bdf5 --- /dev/null +++ b/src/jmap/components/default/planSchedule/menuBar.vue @@ -0,0 +1,472 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/planSchedule/menuTool.vue b/src/jmap/components/default/planSchedule/menuTool.vue new file mode 100644 index 000000000..d3ecde016 --- /dev/null +++ b/src/jmap/components/default/planSchedule/menuTool.vue @@ -0,0 +1,172 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/planSchedule/schedule.vue b/src/jmap/components/default/planSchedule/schedule.vue new file mode 100644 index 000000000..57815da03 --- /dev/null +++ b/src/jmap/components/default/planSchedule/schedule.vue @@ -0,0 +1,491 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/planSchedule/statusBar.vue b/src/jmap/components/default/planSchedule/statusBar.vue new file mode 100644 index 000000000..f85d6c6ce --- /dev/null +++ b/src/jmap/components/default/planSchedule/statusBar.vue @@ -0,0 +1,100 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/default/planSchedule/titleBar.vue b/src/jmap/components/default/planSchedule/titleBar.vue new file mode 100644 index 000000000..689c3486a --- /dev/null +++ b/src/jmap/components/default/planSchedule/titleBar.vue @@ -0,0 +1,75 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/default/shape/Line.js b/src/jmap/components/default/shape/Line.js new file mode 100644 index 000000000..657a2bb37 --- /dev/null +++ b/src/jmap/components/default/shape/Line.js @@ -0,0 +1,53 @@ +import Line from 'zrender/src/graphic/shape/Line'; +import Group from 'zrender/src/container/Group'; + +export default class Line2 extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 0; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + 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: theme.lineWidthColor + } + })); + } + } + + this.setStatus(model); + } + + setLineType(type) { + switch (type) { + case '01': break; + case '02': { + this.eachChild((child) => { + child.setStyle('lineDash', [4]); + }); + } break; + } + } + + setStatus(model) { + this.setLineType(model.type); + } +} diff --git a/src/jmap/components/default/shape/Link.js b/src/jmap/components/default/shape/Link.js new file mode 100644 index 000000000..027d65aa4 --- /dev/null +++ b/src/jmap/components/default/shape/Link.js @@ -0,0 +1,53 @@ +import Line from 'zrender/src/graphic/shape/Line'; +import Group from 'zrender/src/container/Group'; + +export default class Link extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + let textPosition = 'insideBottom'; + if (model.beg.x !== model.end.x && model.beg.y !== model.end.y) { + textPosition = model.beg.y > model.end.y ? 'insideLeft' : 'insideRight'; + } + this.link = new Line({ + zlevel: this.zlevel, + shape: { + x1: model.beg.x, + y1: model.beg.y, + x2: model.end.x, + y2: model.end.y, + }, + style: { + lineWidth: theme.linkWidth, + stroke: theme.linkColor, + text: model.name, + textDistance: theme.linkWidth * 2, + textPosition: textPosition, + textAlign: 'middle', + fontSize: theme.textFontSize, + textFill: theme.linkTextColor, + textStroke: theme.backgroundColor, + } + }); + this.add(this.link); + } + + setStatus() { + } + + tipBasePoint() { + return { + x: (this.link.shape.x1 + this.link.shape.x2) / 2, + y: (this.link.shape.y1 + this.link.shape.y2) / 2 + }; + } + +} diff --git a/src/jmap/components/default/shape/Section.js b/src/jmap/components/default/shape/Section.js new file mode 100644 index 000000000..97d54b030 --- /dev/null +++ b/src/jmap/components/default/shape/Section.js @@ -0,0 +1,515 @@ +import Group from 'zrender/src/container/Group'; +import Polyline from 'zrender/src/graphic/shape/Polyline'; +import Circle from 'zrender/src/graphic/shape/Circle'; +import Line from 'zrender/src/graphic/shape/Line'; +import Text from 'zrender/src/graphic/Text'; +import JTriangle from '@/jlmap/util/JTriangle'; + +/** 计轴*/ +class SectionAxle extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 5; + this._create(model); + } + _create(model) { + if (model && model.theme && model.triangle) { + let axleLength = 2 * model.theme.sectionAxleR; + let positionx = model.point.x + model.drictx * (model.triangle.GetCos(axleLength)); + let positiony = model.point.y + model.dricty * (model.triangle.GetCos(axleLength)); + + this.line = new Line({ + zlevel: this.zlevel, + z: this.z, + shape: { + x1: positionx - model.triangle.GetCos(axleLength) - model.dricty * model.triangle.GetSin(axleLength), + y1: positiony + model.drictx * model.triangle.GetSin(axleLength) - model.triangle.GetSin(axleLength), + x2: positionx + model.triangle.GetCos(axleLength) - model.dricty * model.triangle.GetSin(axleLength), + y2: positiony + model.drictx * model.triangle.GetSin(axleLength) + model.triangle.GetSin(axleLength) + }, + style: { + GBaseLineWidth: 1, + stroke: model.theme.sectionAxleColor + } + }); + this.axle = new Circle({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: positionx - model.dricty * model.triangle.GetSin(axleLength), + cy: positiony + model.drictx * model.triangle.GetSin(axleLength), + r: model.theme.sectionAxleR + }, + style: { + GBaseLineWidth: 1, + stroke: model.theme.sectionAxleColor, + fill: 'rgb(0,0,0,0)' + } + }); + + this.add(this.line); + this.add(this.axle); + } + } +} + +/** 分隔符*/ +class SectionSeparator extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 6; + this._create(model); + } + + _create(model) { + if (model && model.theme) { + this.partition = new Polyline({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + [model.point.x, model.point.y], + [model.point.x, model.point.y] + ] + }, + style: { + GBaseLineWidth: 2, + stroke: model.theme.sectionSeparatorColor + } + }); + this.circle = new Circle({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.point.x, + cy: model.point.y, + r: 2 * model.theme.sectionWidth + }, + style: { + GBaseLineWidth: 1, + stroke: 'red', + fill: model.theme.transparentColor + } + }); + this.add(this.partition); + this.setType(model.type); + } + } + + setType(type) { + let model = this.model; + if (model && model.theme && model.triangle) { + this.remove(this.circle); + if (type === '00') { + this.partition.setShape('points', [ + [model.point.x, model.point.y], + [model.point.x, model.point.y] + ]); + } else if (type === '01') { + this.partition.setShape('points', [ + [model.point.x, model.point.y - (model.theme.sectionWidth * 0.5)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 0.5)] + ]); + } else if (type === '02') { + this.partition.setShape('points', [ + [model.point.x + model.drict * (model.theme.sectionWidth), model.point.y - (model.theme.sectionWidth * 1.5)], + [model.point.x, model.point.y - (model.theme.sectionWidth * 1.5)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 1.5)] + ]); + } else if (type === '03') { + this.partition.setShape('points', [ + [model.point.x + model.drict * (model.theme.sectionWidth), model.point.y - (model.theme.sectionWidth * 1.5)], + [model.point.x, model.point.y - (model.theme.sectionWidth * 1.5)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 1.5)], + [model.point.x + model.drict * (model.theme.sectionWidth), model.point.y + (model.theme.sectionWidth * 1.5)], + ]); + } else if (type === '04') { + this.add(this.circle); + } + } + + if (model.triangle) { + this.origin = [model.point.x, model.point.y]; + this.rotation = Math.PI * 2 - Math.atan2(model.triangle.absy, model.triangle.absx) * model.triangle.drictx * model.triangle.dricty; + this.dirty(); //可以无需调用 + } + + } +} + +/** 创建区段线集合*/ +class Lines 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) { + for (let i = 0; i < (model.points.length - 1); i++) { + this.add(new Line({ + zlevel: this.zlevel, + 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.theme.sectionWidth, + stroke: model.theme.sectionSpareColor + } + })); + } + } + } + + setStyle(porp, value) { + this.eachChild((child) => { + child.setStyle(porp, value); + }); + } + + animateStyle(loop, animates) { + if (animates && animates.length) { + this.eachChild((child) => { + let an = child.animateStyle(loop); + animates.forEach(elem => { + an = an.when(elem.time, elem.styles); + }); + an.start(); + }); + } + } +} + +/** 区段*/ +export default class Section extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = model.layer || 1; + this.z += model.isLogic ? 1 : 0; + this._create(); + } + + _create() { + if (!this.model.isLogic || this.model.isShowLogical) { + this.createSection(); //创建区段 + this.createSectionText(); //创建区段文字 + this.createAxles(); //创建计轴 + this.createSeparator(); //创建分隔符 + this.setInvisible(); //是否显示 + this.setStatus(); + } + } + + /** 创建区段*/ + createSection() { + let model = this.model; + let theme = this.theme; + + /** 创建区段*/ + this.section = new Lines({ + zlevel: this.zlevel, + z: this.z, + isLogic: model.isLogic, + points: model.points, + theme: theme + }); + + /** 添加视图*/ + this.add(this.section); + } + + /** 创建区段名称*/ + createSectionText() { + let model = this.model; + let theme = this.theme; + + if (model && model.nameShow && theme) { + /** 计算文字位置*/ + let textPosition = 'insideTop'; + + /** 创建区段名称*/ + let 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 + model.namePoint.x; + let 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 + model.namePoint.y; + if (!model.isLogic) { + let triangle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + x += triangle.GetSin(theme.nameDistance); + y += triangle.GetCos(theme.nameDistance); + } + this.text = new Text({ + zlevel: this.zlevel, + z: 6, + style: { + x: x, + y: y, + text: model.name, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.sectionTextColor, + textAlign: 'center', + textPosition: textPosition, + textDistance: 2 * theme.sectionWidth + } + }); + /** 添加视图*/ + this.add(this.text); + } + } + + /** 创建计轴*/ + createAxles() { + let model = this.model; + let theme = this.theme; + + /** 创建四个计轴*/ + let triangle = null; + if (model && theme && model.isShowAxle && model.points && model.points.length > 1) { + triangle = new JTriangle(model.points[0], model.points[1]); + this.lUpAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: -1, + triangle: triangle + }); + this.lBottomAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: 1, + triangle: triangle + }); + + triangle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); + this.rUpAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: -1, + triangle: triangle + }); + this.rBottomAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: 1, + triangle: triangle + }); + + this.add(this.lUpAxle); + this.add(this.rUpAxle); + this.add(this.lBottomAxle); + this.add(this.rBottomAxle); + } + } + + /** 创建分隔符*/ + createSeparator() { + let model = this.model; + let theme = this.theme; + let triangle = null; + if (model && theme && model.points && model.points.length > 1) { + /** 创建左侧分隔符*/ + triangle = new JTriangle(model.points[0], model.points[1]); + this.lPartition = new SectionSeparator({ + theme: theme, + zlevel: this.zlevel + 2, + triangle: triangle, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + type: model.l.sectionPartitionType, + drict: -1 + }); + + /** 创建右侧分隔符*/ + triangle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); + this.rPartition = new SectionSeparator({ + theme: theme, + zlevel: this.zlevel + 2, + triangle: triangle, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + type: model.r.sectionPartitionType, + drict: 1 + }); + + /** 添加视图*/ + this.add(this.lPartition); + this.add(this.rPartition); + } + } + + setInvisible() { + let invisible = this.model.isLogic && this.model.logicSectionShow; + this.eachChild((child) => { + child.attr('invisible', invisible); + }); + } + + recover() { + this.animationRecover(); + this.section.setStyle('fill', this.theme.backgroundColor); + } + + animationRecover() { + this.section.stopAnimation(true); + } + + /** 空闲状态*/ + spare() { + if (this.section && this.theme) { + this.recover(); + this.section.setStyle('stroke', this.theme.sectionSpareColor); + } + } + + /** 通信车占用状态*/ + communicationOccupied() { + if (this.section) { + this.recover(); + this.section.setStyle('stroke', this.theme.sectionCommunicationOccupiedColor); + } + } + + /** 非通信车占用状态*/ + unCommunicationOccupied() { + if (this.section) { + this.recover(); + this.section.setStyle('stroke', this.theme.sectionUnCommunicationOccupiedColor); + } + } + + /** 路由锁定状态*/ + routeLock() { + if (this.section) { + this.recover(); + this.section.setStyle('stroke', this.theme.sectionRouteLockColor); + } + } + + /** 封锁*/ + block() { + if (this.section) { + this.recover(); + this.section.setStyle('fill', this.theme.sectionBlockColor); + } + } + + /** 故障锁定状态*/ + faultLock() { + if (this.section) { + this.recover(); + this.section.setStyle('stroke', this.theme.sectionFaultLockColor); + } + } + + /** atc切除状态*/ + atcExcision() { + if (this.section) { + this.recover(); + this.section.setStyle('stroke', this.theme.sectionAtcExcisionColor); + } + } + + /** ats切除状态*/ + atsExcision() { + if (this.section) { + this.atcExcision(); + this.section.animateStyle(true, [ + { time: 1000, styles: { stroke: this.theme.backgroundColor } }, + { time: 2000, styles: { stroke: this.theme.sectionAtsExcisionColor } } + ]); + } + } + + /** 进路延续保护*/ + routeContinuationProtection() { + if (this.section) { + this.recover(); + this.section.setStyle('stroke', this.theme.sectionRouteContinuationProtectionColor); + } + } + + /** 设置状态*/ + setStatus() { + let status = this.model.status; + switch (status) { + case '00': 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.routeContinuationProtection(); + } break; + } + } + + /** 计算提示位置*/ + getShapeTipPoint() { + if (this.section) { + var distance = this.theme.sectionWidth / 2; + var rect = this.section.getBoundingRect(); + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2.7 - distance + }; + } + return null; + } +} diff --git a/src/jmap/components/default/shape/Signal.js b/src/jmap/components/default/shape/Signal.js new file mode 100644 index 000000000..a0f40e2e6 --- /dev/null +++ b/src/jmap/components/default/shape/Signal.js @@ -0,0 +1,780 @@ +import Line from 'zrender/src/graphic/shape/Line'; +import Text from 'zrender/src/graphic/Text'; +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 Isogon from 'zrender/src/graphic/shape/Isogon'; +import Group from 'zrender/src/container/Group'; + +/** 灯*/ +class Lamp extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + this.lamp = new Arc({ + name: model.index, + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: model.theme.signalR + }, + style: { + fill: model.theme.backgroundColor, + stroke: model.theme.signalLampGrayColor, + lineWidth: 0.2 + } + }); + + this.lstop = new Line({ + zlevel: this.zlevel, + z: this.z, + shape: { + x1: model.position.x + model.theme.signalR * Math.cos(Math.PI / 4), + y1: model.position.y + model.theme.signalR * Math.sin(Math.PI / 4), + x2: model.position.x - model.theme.signalR * Math.cos(Math.PI / 4), + y2: model.position.y - model.theme.signalR * Math.sin(Math.PI / 4) + }, + style: { + lineWidth: 1, + stroke: model.theme.backgroundColor + } + }); + + this.rstop = new Line({ + zlevel: this.zlevel, + z: this.z, + shape: { + x1: model.position.x + model.theme.signalR * Math.cos(Math.PI / 4), + y1: model.position.y + model.theme.signalR * (Math.sin(Math.PI / 4) - Math.sqrt(2)), + x2: model.position.x - model.theme.signalR * Math.cos(Math.PI / 4), + y2: model.position.y - model.theme.signalR * (Math.sin(Math.PI / 4) - Math.sqrt(2)) + }, + style: { + lineWidth: 1, + stroke: model.theme.backgroundColor + } + }); + this.add(this.lamp); + } + + setColor(color) { + if (color) { + this.lamp.setStyle('fill', color); + } + } + + setStop(has) { + if (has) { + this.add(this.lstop); + this.add(this.rstop); + } else { + this.remove(this.lstop); + this.remove(this.rstop); + } + } +} + +/** 自动行驶*/ +class AutoSig extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + this.autoLine = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + r: [model.theme.signalR, model.theme.signalR], + x: model.position.x - model.theme.signalR, + y: model.position.y - model.theme.signalR / 2 + 1, + width: model.theme.signalR * 2, + height: model.theme.signalR - 2 + }, + style: { + lineWidth: 0.1, + stroke: '#C0C0C0', + fill: model.theme.signalLampGreenColor + } + }); + this.autoDrict = new Isogon({ + zlevel: this.zlevel, + z: this.z, + rotation: Math.PI * 3 / 2, + origin: [model.position.x + model.theme.signalR * 3 / 2, model.position.y], + shape: { + x: model.position.x + model.theme.signalR * 3 / 2, + y: model.position.y, + r: model.theme.signalR, + n: 3 + }, + style: { + lineWidth: 0.1, + stroke: '#C0C0C0', + fill: model.theme.signalLampGreenColor + } + }); + this.add(this.autoDrict); + this.add(this.autoLine); + } +} + +/** 行驶方向*/ +class SigDrict extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + this.sigDrict = new Isogon({ + zlevel: this.zlevel, + z: this.z, + rotation: 0, + origin: [0, 0], + shape: { + x: model.position.x, + y: model.position.y, + r: model.theme.signalR, + n: 3 + }, + style: { + lineWidth: 0.1, + fill: model.theme.signalLampYellowColor + } + }); + this.setSigDrict(model.drict); + this.add(this.sigDrict); + } + + setSigDrict(drict) { + let model = this.model; + this.direct = drict; + if (drict === 1) { + this.point = { + x: model.position.x - model.theme.signalR / 2, + y: model.position.y + }; + this.sigDrict.attrKV('shape', { + x: model.position.x, + y: model.position.y + }); + this.sigDrict.attrKV('rotation', Math.PI * 3 / 2); + this.sigDrict.attrKV('origin', [model.position.x, model.position.y]); + } else { + this.sigDrict.attrKV('rotation', Math.PI / 2); + this.sigDrict.attrKV('origin', [model.position.x, model.position.y]); + } + } +} + +/** 信号灯 几灯、高柱等 */ +class Siglamp extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this.lamps = new Group(); + this._subType = 'SignalLamp'; + this._val = '3'; //信号机 + this._create(model); + } + + _create(model) { + this.add(this.lamps); + this.text = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x + model.namePosition.x, + y: model.position.y + model.posit * (model.theme.signalR + model.theme.nameDistance + model.namePosition.y), + text: model.name, + textAlign: 'middle', + textVerticalAlign: model.posit === 1 ? 'top' : 'bottom', + textFont: model.theme.textFontSize + 'px ' + model.theme.textFontFormat, + textFill: model.theme.signalTextColor, + } + }); + this.ver = new Line({ + zlevel: this.zlevel, + z: this.z, + shape: { + x1: model.position.x, + y1: model.position.y + model.theme.signalR * 3 / 2, + x2: model.position.x, + y2: model.position.y - model.theme.signalR * 3 / 2 + }, + style: { + lineWidth: model.theme.signalR / 2, + stroke: model.theme.signalLampStandardColor + } + }); + this.hor = new Line({ + zlevel: this.zlevel, + z: this.z, + shape: { + x1: model.position.x + model.drict * model.theme.signalR / 2, + y1: model.position.y, + x2: model.position.x + model.drict * model.theme.signalR * 3 / 2, + y2: model.position.y + }, + style: { + lineWidth: model.theme.signalR / 2, + stroke: model.theme.signalLampStandardColor + } + }); + this.setShowName(model.isShowName); + this.setShowHighSigType(model.highType); + } + + setShowName(isShow) { + if (isShow) this.add(this.text); else this.remove(this.text); + } + + setShowHighSigType(type) { + this.lamps.removeAll(); + let model = this.model; + this.add(this.ver); + if (type === '01') this.remove(this.hor); else this.add(this.hor); + let highPosition = this.getEndPosition(model.highType); + for (let i = 0; i < model.lampCount; i++) { + let lamp = new Lamp({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: highPosition.x + i * model.drict * model.theme.signalR * 2, + y: highPosition.y + }, + index: i + 1, + }); + this.lamps.add(lamp); + } + this.sigDriction = new SigDrict({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: model.position.x - model.drict * model.theme.signalR * 3 / 2, + y: model.position.y + }, + drict: model.drict, + }); + this.autoSig = new AutoSig({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: highPosition.x + model.drict * model.lampCount * model.theme.signalR * 2, + y: highPosition.y + }, + drict: model.drict, + }); + } + + setColorByIndex(index, color) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setColor(color); + return; + } + } + } + + setStopByIndex(index, has) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setStop(has); + return; + } + } + } + + getEndPosition(type) { + if (type === '01') { + return { + x: this.model.position.x + this.model.drict * this.model.theme.signalR * 3 / 2, + y: this.model.position.y + }; + } else { + return { + x: this.hor.shape.x2 + this.model.drict * this.model.theme.signalR, + y: this.hor.shape.y2 + }; + } + } + + setShowSigDrict(showSigDrict) { + if (showSigDrict === '01') this.add(this.sigDriction); else this.remove(this.sigDriction); + } + + setAutoSig(isShow) { + if (isShow) this.add(this.autoSig); else this.remove(this.autoSig); + } + + getShapeTipPoint() { + if (this.lamps) { + var distance = 2; + var rect = this.lamps.getBoundingRect(); + return { + x: rect.x + rect.width / 2, + y: rect.y - distance + }; + } + return null; + } +} + +/** 按钮*/ +class SigButton extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this._subType = 'SignalButton'; + this.z = 10; + this._create(model); + } + + _create(model) { + this.sigNormalButtom = new Rect({ + zlevel: this.zlevel, + z: this.z, + _subType: this._subType, + _val: '1', + shape: { + x: model.position.x - model.theme.signalR, + y: 0, + width: model.theme.signalR * 2, + height: model.theme.signalR * 2 + }, + style: { + lineWidth: 0.3, + stroke: '#C0C0C0', + fill: model.theme.signalButtonColor + }, + }); + this.sigNormalButtomDown = new Polyline({ + zlevel: this.zlevel, + z: this.z + 1, + silent: true, + shape: { + points: [] + }, + style: { + lineWidth: 0.8, + stroke: model.theme.backgroundColor + } + }); + this.sigReentryButton = new Circle({ + zlevel: this.zlevel, + z: this.z, + _subType: this._subType, + _val: '2', //折返按钮 + shape: { + cx: model.position.x, + cy: 0, + r: model.theme.signalR + }, + style: { + lineWidth: 0.3, + stroke: '#C0C0C0', + fill: model.theme.signalButtonColor + }, + }); + this.sigReentryButtonDown = new Arc({ + zlevel: this.zlevel, + z: this.z + 1, + silent: true, + shape: { + cx: 0, + cy: 0, + r: 0, + startAngle: Math.PI * 8 / 5, + endAngle: Math.PI * 4 / 5, + clockwise: false + }, + style: { + lineWidth: 0.8, + stroke: model.theme.backgroundColor, + } + }); + this.add(this.sigNormalButtom); + this.add(this.sigReentryButton); + this.setSigDrict(); + } + + setSigDrict() { + let padding = 1; + let model = this.model; + if (model.drict === 1) { + this.sigNormalButtom.attrKV('shape', { + y: model.position.y - 1 / 2 * model.theme.signalR + }); + this.sigReentryButton.attrKV('shape', { + cy: model.position.y - 5 / 2 * model.theme.signalR + }); + } else { + this.sigReentryButton.attrKV('shape', { + cy: model.position.y + 5 / 2 * model.theme.signalR + }); + this.sigNormalButtom.attrKV('shape', { + y: model.position.y - 3 / 2 * model.theme.signalR + }); + } + this.sigNormalButtomDown.attrKV('shape', { + points: [ + [model.position.x - padding + model.theme.signalR, this.sigNormalButtom.shape.y + padding], + [model.position.x + padding - model.theme.signalR, this.sigNormalButtom.shape.y + padding], + [model.position.x + padding - model.theme.signalR, this.sigNormalButtom.shape.y + padding * 2 + model.theme.signalR], + ] + }); + this.sigReentryButtonDown.attrKV('shape', { + cx: this.sigReentryButton.shape.cx, + cy: this.sigReentryButton.shape.cy, + r: this.sigReentryButton.shape.r - padding + }); + } + + colorRecover() { + this.sigNormalButtom.setStyle('fill', this.model.theme.signalButtonColor); + this.sigReentryButton.setStyle('fill', this.model.theme.signalButtonColor); + } + + animationRecover() { + this.sigNormalButtom.stopAnimation(true); + this.sigReentryButton.stopAnimation(true); + } + + recover() { + this.colorRecover(); + this.animationRecover(); + } + + setButtonStatus(buttonStatus) { + switch (buttonStatus) { + case '00': + case '01': { + this.remove(this.sigNormalButtomDown); + this.remove(this.sigReentryButtonDown); + this.recover(); + } break; + case '02': { + this.add(this.sigNormalButtomDown); + } break; + case '03': { + this.add(this.sigReentryButtonDown); + } break; + case '04': { + this.remove(this.sigNormalButtomDown); + this.sigNormalButtom.animateStyle(true) + .when(1000, { + fill: this.model.theme.signalButtonLightenColor + }) + .when(2000, { + fill: this.model.theme.backgroundColor + }) + .start(); + } break; + case '05': { + this.remove(this.sigReentryButtonDown); + this.sigReentryButton.animateStyle(true) + .when(1000, { + fill: this.model.theme.signalButtonLightenColor + }) + .when(2000, { + fill: this.model.theme.backgroundColor + }) + .start(); + } break; + } + } + + getShapeTipPoint(val) { + var view = null; + switch (val) { + case '1': { + view = this.sigNormalButtom; + break; + } + case '2': { + view = this.sigReentryButton; + break; + } + default: { + break; + } + } + if (view) { + var distance = 2; + var rect = view.getBoundingRect(); + return { + x: rect.x + rect.width / 2, + y: rect.y - distance + }; + } + return null; + } +} + +/** 指导信号灯*/ +class SigGuide extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + this.lamp = new Arc({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: model.theme.signalR + }, + style: { + lineWidth: 0.1, + stroke: '#C0C0C0', + fill: '#C0C0C0' + } + }); + this.add(this.lamp); + } +} + +/** 信号机*/ +export default class Signal extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.lampCount = parseInt(model.lampPositionType); + this._create(model, theme); + } + _create(model, theme) { + var drict = model.directionType === '01' ? -1 : 1; + var posit = model.positionType === '01' ? -1 : 1; + // 信号灯按钮 + this.sigButton = new SigButton({ + theme: theme, + zlevel: this.zlevel, + position: { + x: model.buttonPosition.x, + y: model.buttonPosition.y - posit * theme.signalDistance + }, + drict: posit, + pop: false, + }); + // 信号灯文字说明 + this.siglamp = new Siglamp({ + theme: theme, + zlevel: this.zlevel, + position: { + x: model.position.x, + y: model.position.y + posit * theme.signalDistance + }, + drict: drict, + posit: posit, + name: model.name, + namePosition: model.namePosition, + isShowName: model.nameShow, + highType: model.lampPostType, + lampCount: parseInt(model.lampPositionType), + showSigDrict: this.showSigDrict, + pop: true, + }); + // 线上的圆圈 + this.sigGuide = new SigGuide({ + theme: theme, + zlevel: this.zlevel, + position: { + x: model.guidePosition.x, + y: model.guidePosition.y + }, + pop: false, + }); + this.add(this.siglamp); + this.add(this.sigButton); + this.setShowButton(model.buttonShow); + this.setShowGuide(model.guideShow); + this.setStatus(model); + } + + setShowSigDrict() { + this.siglamp.setShowSigDrict(this.showSigDrict); + } + + setShowHighSigType(hightp) { + if (this.siglamp) { + this.highType = hightp; + this.siglamp.setShowHighSigType(hightp); + } + } + + setShowGuide(guideShow) { + if (guideShow) { + this.add(this.sigGuide); + } else { + this.remove(this.sigGuide); + } + } + + setShowButton(buttonShow) { + if (buttonShow) { + this.add(this.sigButton); + } else { + this.remove(this.sigButton); + } + } + + isPop(e) { + for (var i = 0; i < this.childCount(); i++) { + let rect = this.childAt(i).getBoundingRect(); + if (rect.contain(e.offsetX, e.offsetY) && this.childAt(i).pop) { + return true; + } + } + } + + //关闭 + close(model) { + if (this.lampCount === 1 && model.lightType === '01') { /** 单灯 物理点灯 (出站 调车 阻挡)*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setColorByIndex(1, 'red'); + } else if (this.lampCount === 1 && model.lightType === '02' && + (model.useType === '02' || model.useType === '05' || model.useType === '06')) { /** 单灯 逻辑点灯 (出站 调车 阻挡)*/ + this.siglamp.setStopByIndex(1, true); + this.siglamp.setColorByIndex(1, 'red'); + } else if (this.lampCount === 2 && model.lightType === '01' && + (model.useType === '01' || model.useType === '04')) { /** 双灯 物理点灯 [进站 防护 ]*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, '#C0C0C0'); + this.siglamp.setColorByIndex(2, 'red'); + } else if (this.lampCount === 2 && model.lightType === '02' && + (model.useType === '04')) { /** 双灯 逻辑点灯 [防护]*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, true); + this.siglamp.setColorByIndex(1, '#C0C0C0'); + this.siglamp.setColorByIndex(2, 'red'); + } else if (this.lampCount === 2 && model.lightType == '01' && + (model.useType === '05')) { /** 双灯 物理点灯 [调车]*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, 'red'); + this.siglamp.setColorByIndex(2, '#C0C0C0'); + } + } + + //开放 + open(model) { + if (this.lampCount === 1 && model.lightType === '01') { /** 单灯 物理点灯 (出站 阻挡)*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setColorByIndex(1, 'green'); + } else if (this.lampCount === 1 && model.lightType === '02') { /** 单灯 逻辑点灯 (出站 阻挡)*/ + this.siglamp.setStopByIndex(1, true); + this.siglamp.setColorByIndex(1, 'green'); + } else if (this.lampCount === 1 && model.lightType === '01' && + (model.useType === '05')) { /** 单灯 物理点灯 (调车)*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setColorByIndex(1, 'white'); + } else if (this.lampCount === 2 && model.lightType === '01' && + (model.useType === '05')) { /** 双灯 物理点灯 (调车)*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, '#C0C0C0'); + this.siglamp.setColorByIndex(2, 'white'); + } else if (this.lampCount === 2 && model.lightType === '01' && + (model.useType === '01')) { /** 双灯 物理点灯 (进站)*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, '#C0C0C0'); + this.siglamp.setColorByIndex(2, 'green'); + } else if (this.lampCount === 2 && model.lightType === '01' && + (model.useType === '04')) { /** 双灯 物理点灯 (防护)*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, '#C0C0C0'); + this.siglamp.setColorByIndex(2, 'yellow'); /**道岔定位*/ + this.siglamp.setColorByIndex(2, 'green'); /**道岔反位*/ + } else if (this.lampCount === 2 && model.lightType === '02' && + (model.useType === '04')) { /** 双灯 逻辑点灯 (防护)*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, true); + this.siglamp.setColorByIndex(1, '#C0C0C0'); + this.siglamp.setColorByIndex(2, 'yellow'); /**道岔定位*/ + this.siglamp.setColorByIndex(2, 'green'); /**道岔反位*/ + } + } + + //引导 + guid(model) { + if (this.lampCount === 2 && model.lightType === '01' && + (this.model.useType === '01' && this.model.useType === '04')) { /** 双灯 物理点灯 [进站 防护]*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, 'red'); + this.siglamp.setColorByIndex(2, 'yellow'); + } + } + + //封锁 + block() { + } + + //故障 + fault() { + } + + setButtonStatus(buttonStatus) { + if (this.sigButton) { + this.sigButton.setButtonStatus(buttonStatus); + } + } + + //设置状态 + setStatus(model) { + if (model) { + switch (model.status) { + case '00': + case '01': { this.close(model); } break; //关闭 + case '02': { this.open(model); } break; //开放 + case '03': { this.guid(model); } break; //引导 + case '04': { this.block(model); } break; //封锁 + case '05': { this.fault(model); } break; //故障 + } + } + + this.setButtonStatus(model.buttonStatus); + } + + getShapeTipPoint(val) { + if (val === '1' || val === '2') { + return this.sigButton.getShapeTipPoint(val); + } else { + return this.siglamp.getShapeTipPoint(val); + } + } +} \ No newline at end of file diff --git a/src/jmap/components/default/shape/Station.js b/src/jmap/components/default/shape/Station.js new file mode 100644 index 000000000..05a1953f4 --- /dev/null +++ b/src/jmap/components/default/shape/Station.js @@ -0,0 +1,71 @@ +/* +* 车站 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; + +export default class Station extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + this.mileageText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.point.x, + y: model.point.y + 20, + text: model.kmPost, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.kmPostFont || '8px ' + theme.textFontFormat, + textFill: model.kmPostColor + } + }); + + this.stationText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.point.x, + y: model.point.y, + text: model.name, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.nameFont || '14px ' + theme.textFontFormat, + textFill: model.nameColor + } + }); + + this.add(this.mileageText); + this.add(this.stationText); + this.setShowMileageText(model.kmPostShow); + this.setStatus(model); + } + + setShowMileageText(show) { + if (show) { + this.mileageText.show(); + } else { + this.mileageText.hide(); + } + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } + + getShapeTipPoint() { + return null; + } +} \ No newline at end of file diff --git a/src/jmap/components/default/shape/StationControl.js b/src/jmap/components/default/shape/StationControl.js new file mode 100644 index 000000000..dd71285fb --- /dev/null +++ b/src/jmap/components/default/shape/StationControl.js @@ -0,0 +1,179 @@ +/* +* 控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +import Text from 'zrender/src/graphic/Text'; +import Group from 'zrender/src/container/Group'; + +/** 单个控制灯*/ +class SingleControl extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 20; + this._create(model); + } + + _create(model) { + var _subType = 'ControlSignal'; + var _val = '0'; + if (model.pop) { + _subType = 'ControlButton'; + _val = '1'; + } + this.control = new Arc({ + pop: model.pop, + _subType: _subType, + _val: _val, + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.point.x, + cy: model.point.y, + r: model.theme.controlmodeR + }, + style: { + lineWidth: 0.1, + fill: model.theme.stationControlGrayColor + } + }); + + 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.theme.controlmodeR + model.theme.nameDistance, + text: model.context, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.theme.textFontSize + 'px ' + model.theme.textFontFormat + } + }); + + this.add(this.control); + this.add(this.text); + } + + setColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } +} + +/** 控制模式*/ +export default class StationControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create() { + let model = this.model; + this.emergencyControl = new SingleControl({ + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x - this.theme.controlDistance * 3 / 2, + y: model.position.y + }, + context: model.jjzkContent, + pop: false + }); + + this.substationControl = new SingleControl({ + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x - this.theme.controlDistance / 2, + y: model.position.y + }, + context: model.zakContent, + pop: false + }); + + this.centerControl = new SingleControl({ + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x + this.theme.controlDistance / 2, + y: model.position.y + }, + context: model.zokContent, + pop: false + }); + this.stationControl = new SingleControl({ + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x + this.theme.controlDistance * 3 / 2, + y: model.position.y + }, + context: model.zzkContent, + pop: true, + }); + this.add(this.centerControl); + this.add(this.substationControl); + this.add(this.emergencyControl); + this.add(this.stationControl); + this.setStatus(model); + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + this.emergencyControl.setColor(this.theme.stationControlGrayColor); + this.substationControl.setColor(this.theme.stationControlGrayColor); + this.centerControl.setColor(this.theme.stationControlGrayColor); + } break; + case '01': { //中控 + this.emergencyControl.setColor(this.theme.stationControlGrayColor); + this.substationControl.setColor(this.theme.stationControlGrayColor); + this.centerControl.setColor(this.theme.stationControlGreenColor); + } break; + case '02': { //站控 + this.emergencyControl.setColor(this.theme.stationControlGrayColor); + this.substationControl.setColor(this.theme.stationControlYellowColor); + this.centerControl.setColor(this.theme.stationControlGrayColor); + } break; + case '03': { //紧急站控 + this.emergencyControl.setColor(this.theme.stationControlRedColor); + this.substationControl.setColor(this.theme.stationControlGrayColor); + this.centerControl.setColor(this.theme.stationControlGrayColor); + } 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; + } + } + } + + 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; + } +} \ No newline at end of file diff --git a/src/jmap/components/default/shape/StationCounter.js b/src/jmap/components/default/shape/StationCounter.js new file mode 100644 index 000000000..49578d3a5 --- /dev/null +++ b/src/jmap/components/default/shape/StationCounter.js @@ -0,0 +1,85 @@ +/* +* 计数器 +*/ +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, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 30; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + this.counter = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y, + text: model.val, + textFill: theme.stationCounterTextColor, + textAlign: 'middle', + textStrokeWidth: 1, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + } + }); + + 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: theme.stationCounterBorderColor + } + }); + + 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 + theme.textFontSize + theme.nameDistance, + text: model.name, + textFill: theme.stationCounterTextColor, + textAlign: 'middle', + textVerticalAlign: 'top', + textStrokeWidth: 1, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + } + }); + this.add(this.counterName); + this.add(this.table); + this.add(this.counter); + this.setStatus(model); + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } + + getShapeTipPoint() { + return null; + } +} \ No newline at end of file diff --git a/src/jmap/components/default/shape/StationDelayUnlock.js b/src/jmap/components/default/shape/StationDelayUnlock.js new file mode 100644 index 000000000..b0989af4a --- /dev/null +++ b/src/jmap/components/default/shape/StationDelayUnlock.js @@ -0,0 +1,121 @@ +/* +* 延迟解锁 +*/ +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, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = 1; + this._create(model, theme); + } + + _create(model, theme) { + this.text = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y, + text: model.deviceName + ' ', + textFill: theme.stationDelayUnlockTextColor, + textStrokeWidth: 1, + textFont: model.textFont + 'px ' + theme.textFontFormat, + textAlign: 'left' + } + }); + + let fontSize = parseInt(model.textFont.split(' ')[0]) || 30; + this.time = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + fontSize + theme.stationDelayUnlockDistance, + text: model.remainTime || '', + textFill: theme.stationDelayUnlockTextColor, + textStrokeWidth: 1, + textFont: model.textFont + 'px ' + theme.textFontFormat, + 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 - 1, + z: this.z, + 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: theme.stationDelayUnlockBorderColor, + fill: theme.backgroundColor + } + }); + + this.add(this.table); + this.setStatus(model); + } + + /** 延时解锁关闭*/ + delayClose() { + this.time.setStyle('text', ''); + this.text.setStyle('text', ''); + this.table.setStyle('stroke', this.theme.backgroundColor); + } + + /** 延时解锁计数*/ + delayUnlock() { + this.table.setStyle('stroke', 'white'); + this.time.setStyle('text', '' + this.model.remainTime); + } + + // animation() { + // this.table.setStyle('stroke', 'white'); + // this.time.setStyle('text', '' + this.model.delayTime); + + // this.counter = this.model.delayTime; + // this.timer = setInterval(() => { + // if (this.counter <= 0) { + // this.counter = ''; + // clearInterval(this.timer); + // this.timer = null; + // this.close(); + // } else { + // this.counter -= 1; + // } + // this.time.setStyle('text', '' + this.counter); + // }, 1000); + // } + + setStatus(model) { + switch (model.status) { + case '01': { this.delayClose(); } break; //关闭 + case '02': { this.delayUnlock(); } break; //延迟解锁 + } + } + + getShapeTipPoint() { + return null; + } +} \ No newline at end of file diff --git a/src/jmap/components/default/shape/StationStand.js b/src/jmap/components/default/shape/StationStand.js new file mode 100644 index 000000000..63a931466 --- /dev/null +++ b/src/jmap/components/default/shape/StationStand.js @@ -0,0 +1,370 @@ +/* +* 站台 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Isogon from 'zrender/src/graphic/shape/Isogon'; + +export default class StationStand extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + this.stationStand = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x - model.width / 2, + y: 0, + width: model.width, + height: model.height + }, + style: { + lineWidth: 0, + stroke: 'white', + fill: 'white' + } + }); + + let drect = (model.doorLocationType === '01' ? -1 : 1); + let distance = 0; + this.text = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: [0, 0], + style: { + x: model.position.x + drect * ((model.width + theme.stationStandHeadFontSize) / 2 + distance), + y: 0, + text: 'H', + textAlign: 'middle', + textVerticalAlign: 'top', + fontSize: theme.stationStandHeadFontSize + 'px ' + theme.textFontFormat, + textFill: 'red', //theme.backgroundColor, + textStroke: theme.backgroundColor, + } + }); + this.add(this.text); + + this.time = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: [0, 0], + style: { + x: model.position.x - drect * (model.width / 2 + theme.textFontSize + distance), + y: 0, + text: '30', + textFill: theme.stationStandTimeTextColor, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat + } + }); + this.add(this.time); + + this.emergent = new Isogon({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x, + y: 0, + r: theme.stationStandDistance / 2, + n: 4, + }, + style: { + lineWidth: 0, + stroke: theme.stationStandEmergentCloseColor, + fill: theme.stationStandEmergentCloseColor + } + }); + this.add(this.emergent); + + let padding = 1; + this.safeDoorL = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + r: [theme.stationStandDistance, theme.stationStandDistance], + x: model.position.x - model.width / 2 - padding, + y: model.position.y, + width: model.width / 3 + padding, + height: theme.stationStandDistance / 2 + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.safeDoorC = new Rect({ + zlevel: this.zlevel, + z: this.z + 1, + shape: { + x: model.position.x - model.width / 6 - padding, + y: model.position.y, + width: model.width / 3 + padding * 2, + height: theme.stationStandDistance / 2 + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.safeDoorR = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + r: [theme.stationStandDistance, theme.stationStandDistance], + x: model.position.x + model.width / 6, + y: model.position.y, + width: model.width / 3 + padding, + height: theme.stationStandDistance / 2 + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.setDrict(model.doorLocationType); + this.setHasSafeDoor(model.hasDoor); + this.setVisible(model.visible); + this.setStatus(model); + } + + setDrict(doorLocationType) { + let model = this.model; + let theme = this.theme; + + if (doorLocationType === '01') { + let distance = model.position.y + theme.stationStandDistance * 3 / 2; + this.text.setStyle('y', distance + model.height / 2 - theme.stationStandHeadFontSize / 2); + this.time.setStyle('y', distance + model.height - theme.textFontSize); + this.emergent.setShape('y', distance - theme.stationStandDistance / 2); + this.stationStand.setShape('y', distance); + } else { + let distance = model.position.y - theme.stationStandDistance; + this.text.setStyle('y', distance - model.height / 2 - theme.stationStandHeadFontSize / 2); + this.time.setStyle('y', distance - model.height - theme.textFontSize / 2); + this.emergent.setShape('y', distance + theme.stationStandDistance / 2); + this.stationStand.setShape('y', distance - model.height); + } + this.add(this.stationStand); + } + + setHasSafeDoor(hasDoor) { + if (hasDoor) { + this.add(this.safeDoorL); + this.add(this.safeDoorC); + this.add(this.safeDoorR); + } else { + this.remove(this.safeDoorL); + this.remove(this.safeDoorC); + this.remove(this.safeDoorR); + } + } + + setVisible(visible) { + if (visible) { + this.eachChild((it) => { + it.show(); + }); + } else { + this.eachChild((it) => { + it.hide(); + }); + } + } + + //恢复初始状态 + recover() { + this.time.hide(); + this.text.hide(); + this.emergent.hide(); + if (this.model.visible) { this.safeDoorC.show(); } + this.safeDoorL.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandDoorDefaultColor); + } + + //空闲 + spare() { + this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + } + + //列车停站 + stop() { + this.stationStand.setStyle('fill', this.theme.stationStandStopColor); + } + + //指定列车跳站 + designatedJumpStop() { + this.stationStand.setStyle('fill', this.theme.stationStandDesignatedJumpStopColor); + } + + //站台紧急关闭 + emergentClose() { + this.emergent.show(); + } + + //停站时间 + stopTime() { + this.time.show(); + } + + //未设置跳停 + unJumpStop() { + + } + + //站台跳停 + jumpStop() { + this.stationStand.setStyle('fill', this.theme.stationStandJumpStopColor); + } + + //未设置扣车 + unDetainTrain() { + this.text.hide(); + } + + //车站扣车 + detainTrain() { + this.text.show(); + this.text.setStyle('fill', this.theme.stationStandStandDetainTrainColor); + } + + //中心扣车 + centerDetainTrain() { + this.text.show(); + this.text.setStyle('fill', this.theme.stationStandCenterDetainTrainColor); + } + + //中心+车站扣车 + standAndCenterDetainTrain() { + this.text.show(); + this.text.setStyle('fill', this.theme.stationStandStandAndCenterDetainTrainColor); + } + + //开门 + openDoor() { + this.safeDoorC.hide(); + } + + //关门 + closeDoor() { + if (this.model.visible) { this.safeDoorC.show(); } + } + + //屏蔽门正常 + doorNormal() { + this.safeDoorL.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandDoorDefaultColor); + } + //屏蔽门故障 + doorFault() { + this.safeDoorL.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandSplitDoorColor); + } + //屏蔽门切除 + doorSplit() { + this.safeDoorL.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandSplitDoorColor); + } + + setStatus(model) { + this.recover(); + switch (model.status) { + case '01': { //空闲 + this.spare(); + } break; + case '02': { //列车停站 + this.stop(); + } break; + case '04': { //站台紧急关闭 + this.emergentClose(); + } break; + } + + // case '05': { //停站时间 + // this.stopTimeCount(); + // } break; + + /** 设置跳停*/ + if (model.status == '02') { + switch (model.jumpStopStatus) { + case '01': { //未设置跳停 + this.unJumpStop(); + } break; + case '02': { //指定站台跳停 + this.designatedJumpStop(); + } break; + case '03': { //站台全部跳停 + this.jumpStop(); + } + } + } + + /** 设置扣车*/ + switch (model.holdStatus) { + case '01': { //未设置扣车 + this.unDetainTrain(); + } break; + case '02': { //车站扣车 + this.detainTrain(); + } 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(); //切除 + } + } + } + + getShapeTipPoint() { + let rect = this.stationStand.getBoundingRect(); + if (rect) { + return { + x: rect.x + rect.width / 2, + y: rect.y + }; + } + return null; + } +} \ No newline at end of file diff --git a/src/jmap/components/default/shape/StopPoint.js b/src/jmap/components/default/shape/StopPoint.js new file mode 100644 index 000000000..f6ca7fe10 --- /dev/null +++ b/src/jmap/components/default/shape/StopPoint.js @@ -0,0 +1,69 @@ +/* +* 站台 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; +import Isogon from 'zrender/src/graphic/shape/Isogon'; + +export default class StopPoint extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 0; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + /** 添加视图*/ + this.point = new Isogon({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x, + y: model.position.y + theme.linkWidth / 6, + r: theme.linkWidth / 3, + n: 3, + }, + style: { + stroke: theme.stopPointColor, + fill: theme.stopPointColor + } + }); + + this.textPoint = new Text({ + zlevel: this.zlevel, + z: 6, + style: { + x: model.position.x + model.destCodePosition.x, + y: model.position.y + model.destCodePosition.y, + text: model.destCode, + textFont: theme.textPointFontSize + 'px ' + theme.textFontFormat, + textFill: theme.stopPointTexDestCodetColor, + textAlign: 'center', + } + }); + this.add(this.point); + this.handleShow(model.destCodeShow, model.isTurningPoint); + this.setStatus(model); + } + + handleShow(showd, showP) { + if (showd && showP) { + this.add(this.textPoint); + } else { + this.remove(this.textPoint); + } + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } + + getShapeTipPoint() { + return null; + } +} \ No newline at end of file diff --git a/src/jmap/components/default/shape/StopTextPoint.js b/src/jmap/components/default/shape/StopTextPoint.js new file mode 100644 index 000000000..f7ed67f0e --- /dev/null +++ b/src/jmap/components/default/shape/StopTextPoint.js @@ -0,0 +1,80 @@ +/* +* 站台 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; +import Isogon from 'zrender/src/graphic/shape/Isogon'; + +export default class StopTextPoint extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 0; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + + /** 添加视图*/ + this.point = new Isogon({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x, + y: model.position.y, + r: theme.linkWidth, + n: 4, + }, + style: { + lineWidth: 0, + stroke: theme.stopPointColor, + fill: theme.stopPointColor, + text: model.name, + textDistance: theme.linkWidth * 2, + textPosition: 'insideTop', + textAlign: 'middle', + fontSize: theme.textFontSize, + textFill: theme.stopPointTextColor, + textStroke: theme.backgroundColor, + } + }); + + this.textPoint = new Text({ + zlevel: this.zlevel, + z: 6, + style: { + x: model.position.x + model.destCodePosition.x, + y: model.position.y + model.destCodePosition.y, + text: model.destCode, + textFont: theme.textPointFontSize + 'px ' + theme.textFontFormat, + textFill: theme.stopPointTexDestCodetColor, + textAlign: 'center', + textPosition: 'insideTop', + textDistance: 2 * theme.linkWidth + } + }); + + this.handleShow(model.destCodeShow, model.isTurningPoint); + this.setStatus(model); + } + + handleShow(showd, showP) { + if (showd && showP) { + this.add(this.textPoint); + } else { + this.remove(this.textPoint); + } + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } + + getShapeTipPoint() { + return null; + } +} \ No newline at end of file diff --git a/src/jmap/components/default/shape/Switch.js b/src/jmap/components/default/shape/Switch.js new file mode 100644 index 000000000..0eada12d1 --- /dev/null +++ b/src/jmap/components/default/shape/Switch.js @@ -0,0 +1,387 @@ +import Text from 'zrender/src/graphic/Text'; +import Line from 'zrender/src/graphic/shape/Line'; +import Group from 'zrender/src/container/Group'; +import Circle from 'zrender/src/graphic/shape/Circle'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import JTriangle from '@/jlmap/util/JTriangle'; + +export default class Switch extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.intersection = model.intersection; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + this.triangle = new JTriangle(model.intersection, model.skew); + this.switchWidth = theme.sectionWidth + 0.4; // 道岔宽度 + this.createSwitch(); + this.createShelter(); + this.createNameText(); + this.createLocker(); + + this.setLocateType(); + this.setStatus(model); + } + + /** + * 道岔实体,不显示,响应鼠标事件 + */ + createSwitch() { + this.switchView = new Group(); + var line = new Line({ + zlevel: this.zlevel, + invisible: true, + silent: true, + shape: { + x1: this.model.intersection.x - this.theme.switchLen, + y1: this.model.intersection.y, + x2: this.model.intersection.x + this.theme.switchLen, + y2: this.model.intersection.y + }, + style: { + lineWidth: this.switchWidth, + stroke: this.theme.backgroundColor + } + }); + var skewLine = new Line({ + zlevel: this.zlevel, + invisible: true, + silent: true, + shape: { + x1: this.model.intersection.x, + y1: this.model.intersection.y, + x2: this.model.intersection.x + this.triangle.GetCos(this.theme.switchLen), + y2: this.model.intersection.y + this.triangle.GetSin(this.theme.switchLen) + }, + style: { + lineWidth: this.switchWidth, + stroke: this.theme.backgroundColor + } + }); + this.switchView.add(line); + this.switchView.add(skewLine); + this.add(this.switchView); + } + + setSwitchInvisible(invisible) { + this.switchView.eachChild((child) => { + child.attr('invisible', invisible); + }); + } + + /** + * 道岔名称,显示,响应鼠标事件 + */ + createNameText() { + this.nameText = new Text({ + zlevel: this.zlevel, + style: { + x: this.model.namePoint.x + this.model.intersection.x + this.triangle.drictx * (this.theme.sectionWidth * 3 + this.theme.nameDistance) * this.triangle.GetCotRate(), + y: this.model.namePoint.y + this.model.intersection.y + this.triangle.dricty * (this.theme.nameDistance / 2), + text: this.model.name, + textAlign: this.triangle.drictx === 1 ? 'left' : 'right', + textVerticalAlign: this.triangle.dricty === 1 ? 'top' : 'bottom', + fontSize: this.theme.textFontSize + 'px ' + this.theme.textFontFormat, + textFill: 'white' + } + }); + this.add(this.nameText); + } + + /** + * 道岔锁 + */ + createLocker() { + this.locker = new Circle({ + zlevel: this.zlevel, + shape: { + cx: this.model.intersection.x, + cy: this.model.intersection.y, + r: this.theme.sectionWidth + }, + style: { + stroke: 'white', + fill: this.theme.transparentColor + } + }); + this.locker.hide(); + this.add(this.locker); + } + + /** + * 定位反位遮挡,显示,不响应鼠标事件 + */ + createShelter() { + var halfWidth = this.theme.sectionWidth / 2 + 0.3; // 一半宽度 + var switchWidth = this.theme.sectionWidth + 1.3; // 道岔宽度 + var swPadding = 6; //道岔距离区段的间隔 + var directx = this.triangle.drictx; + var directy = this.triangle.dricty; + var direct = -this.triangle.drictx * this.triangle.dricty; + + // 定位遮挡 + var point1 = [this.model.intersection.x - directx * halfWidth, this.model.intersection.y + directy * halfWidth]; + var point2 = [point1[0] + directx * switchWidth / this.triangle.GetSinRate(), point1[1]]; + var point3 = [point2[0] + directx * this.triangle.GetCotRate() * swPadding, point2[1] + directy * swPadding]; + var point4 = [point3[0] + direct * this.triangle.GetSin(switchWidth), point3[1] - direct * this.triangle.GetCos(switchWidth)]; + + this.locShelter = new Polygon({ + zlevel: this.zlevel, + shape: { + points: [ + point1, point2, point3, point4 + ] + }, + style: { + fill: this.theme.backgroundColor + } + }); + var lpx = Math.abs(this.triangle.GetCos(1)); + this.locShelter.position = [directx * lpx, -directy * 0.2]; + this.locShelter.show(); + + // 反位遮挡 + var slen = switchWidth / this.triangle.GetSinRate(); // 斜切长度 + var rpoint1 = [this.model.intersection.x + directx * halfWidth, this.model.intersection.y - directy * halfWidth]; + var rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.GetCotRate()), rpoint1[1]]; + var rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth]; + var rpoint4 = [rpoint1[0] + this.triangle.GetCos(slen), rpoint1[1] + this.triangle.GetSin(slen)]; + this.relocShelter = new Polygon({ + zlevel: this.zlevel, + shape: { + points: [ + rpoint1, rpoint2, rpoint3, rpoint4 + ] + }, + style: { + fill: this.theme.backgroundColor, + } + }); + var rpx = Math.abs(this.triangle.GetCos(halfWidth)) + 0.3; + this.relocShelter.position = [-directx * rpx, -directy * 0.4]; + this.relocShelter.hide(); + + // 反位/平行四边形 遮挡 + var sinX = this.theme.sectionWidth / this.triangle.GetSinRate(); + var switchWidth1 = this.theme.sectionWidth / 2; + var width1 = switchWidth1 * this.triangle.GetSinRate(); + var height1 = switchWidth1 * this.triangle.GetCosRate(); + var width2 = (height1 + switchWidth1) / this.triangle.GetTanRate(); + var width3 = sinX - width2 - width1; + var switchPoint1 = [this.model.intersection.x + directx * width3, this.model.intersection.y - directy * switchWidth1]; + var switchPoint2 = [switchPoint1[0] - directx * (width2 + width1) - directx * width3, switchPoint1[1]]; + var switchPoint3 = [this.model.intersection.x - directx * width3, this.model.intersection.y + directy * switchWidth1]; + var switchPoint4 = [switchPoint1[0] + directx * (width2 + width1) - directx * width3, switchPoint3[1]]; + this.reserveSection = new Polygon({ + zlevel: this.zlevel, + shape: { + points: [ + switchPoint1, switchPoint2, switchPoint3, switchPoint4 + ] + }, + style: { + fill: this.theme.sectionSpareColor, + } + }); + this.reserveSection.hide(); + // 添加 + this.add(this.locShelter); + this.add(this.relocShelter); + this.add(this.reserveSection); + } + + setShowName(nameShow) { + this.nameShow = nameShow; + if (nameShow) { + this.nameText.show(); + } else { + this.nameText.hide(); + } + } + + colorRecover() { + this.nameText.setStyle('textFill', this.theme.switchTextColor); + } + + /** + * 停止动画 + */ + animationRecover() { + this.nameText.stopAnimation(false); + this.switchView.eachChild((child) => { + child.stopAnimation(false); + }); + } + + /** + * 道岔岔尖动画 + */ + switchAnimation() { + this.switchView.eachChild((child) => { + child.animateStyle(true) + .when(0, { stroke: this.theme.backgroundColor }) + .when(1000, { stroke: 'red' }) + .when(2000, { stroke: this.theme.backgroundColor }) + .start(); + }); + } + + /** + * 道岔名称动画 + */ + nameTextAnimation() { + this.nameText.animateStyle(true) + .when(0, { textFill: this.theme.backgroundColor }) + .when(1000, { textFill: 'red' }) + .when(2000, { textFill: this.theme.backgroundColor }) + .start(); + } + + /** 定位*/ + setLocationAction() { + this.colorRecover(); + this.setSwitchInvisible(true); + this.locShelter.show(); + this.relocShelter.hide(); + this.reserveSection.hide(); + this.nameText.attr('style.textFill', this.theme.switchTextColor); + this.animationRecover(); + } + + /** 反位*/ + setInversionAction() { + this.colorRecover(); + this.setSwitchInvisible(true); + this.locShelter.hide(); + this.relocShelter.show(); + this.reserveSection.show(); + this.nameText.attr('style.textFill', 'yellow'); + this.animationRecover(); + } + + /** 失去*/ + setLossAction() { + this.locShelter.hide(); + this.relocShelter.hide(); + this.reserveSection.hide(); + this.setSwitchInvisible(false); + this.animationRecover(); + this.nameTextAnimation(); + } + + /** 挤叉*/ + setForkAction() { + this.setLossAction(); + this.switchAnimation(); + } + + /** 单锁*/ + setMonolock() { + switch (this.model.locateType) { + case '01': { + this.locker.setStyle('stroke', this.theme.switchTextColor); + this.locker.show(); + } break; + case '02': { + this.locker.setStyle('stroke', 'yellow'); + this.locker.show(); + } break; + default: { + this.locker.hide(); + break; + } + } + } + + /** 空闲*/ + spare() { + this.locker.hide(); + } + + setSectionCstatus(model) { + switch (model.setLocateType) { + case '00': break; + case '01': { /** 空闲*/ + this.reserveSection.setStyle('fill', this.theme.sectionSpareColor); + } break; + case '02': { /** 通信车占用*/ + this.reserveSection.setStyle('fill', this.theme.sectionCommunicationOccupiedColor); + } break; + case '03': { /** 非通信车占用*/ + this.reserveSection.setStyle('fill', this.theme.sectionUnCommunicationOccupiedColor); + } break; + case '04': { /** 进路锁闭*/ + this.reserveSection.setStyle('fill', this.theme.sectionRouteLockColor); + } break; + case '05': { /** 故障锁闭*/ + this.reserveSection.setStyle('fill', this.theme.sectionFaultLockColor); + } break; + case '06': { /** 封锁*/ + this.reserveSection.setStyle('fill', this.theme.sectionBlockColor); + } break; + case '07': { /** ATC切除*/ + this.reserveSection.setStyle('fill', this.theme.sectionAtcExcisionColor); + } break; + case '08': { /** ATS切除*/ + this.reserveSection.setStyle('fill', this.theme.sectionAtsExcisionColor); + this.reserveSection.animateStyle(true) + .when(1000, { fill: this.theme.backgroundColor }) + .when(2000, { fill: this.theme.sectionAtsExcisionColor }) + .start(); + + } break; + case '09': { /** 进路延续保护 */ + this.reserveSection.setStyle('fill', this.theme.sectionRouteContinuationProtectionColor); + } break; + } + } + + setLocateType(model) { + this.setSectionCstatus(model); + switch (model.locateType) { + case '01': { + this.setLocationAction(); /** 定位*/ + } break; + case '02': { + this.setInversionAction(); /** 反位*/ + } break; + case '03': { + this.setLossAction(); /** 失去*/ + } break; + case '04': { + this.setForkAction(); /** 挤岔*/ + } break; + } + } + + setStatus(model) { + switch (model.status) { + case '01': { + this.spare(); /** 空闲*/ + } break; + case '10': { + this.setMonolock(); /** 单锁*/ + } break; + } + + this.setLocateType(model); + } + + getShapeTipPoint() { + var rect = null; + rect = this.nameText.getBoundingRect(); + if (rect) { + return { + x: rect.x + rect.width / 2, + y: rect.y + }; + } + return null; + } +} \ No newline at end of file diff --git a/src/jmap/components/default/shape/Text.js b/src/jmap/components/default/shape/Text.js new file mode 100644 index 000000000..3b1b00937 --- /dev/null +++ b/src/jmap/components/default/shape/Text.js @@ -0,0 +1,43 @@ +import Text from 'zrender/src/graphic/Text'; +import Group from 'zrender/src/container/Group'; + +export default class Text2 extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = 6; + this._create(model, theme); + } + + _create(model) { + let [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); + this.setStatus(model); + } + + // eslint-disable-next-line no-unused-vars + setStatus(model) { + } +} diff --git a/src/jmap/components/default/shape/Train.js b/src/jmap/components/default/shape/Train.js new file mode 100644 index 000000000..9ba5d3008 --- /dev/null +++ b/src/jmap/components/default/shape/Train.js @@ -0,0 +1,620 @@ +import Group from 'zrender/src/container/Group'; +import Arc from 'zrender/src/graphic/shape/Arc'; +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import JTriangle from '@/jlmap/util/JTriangle'; + +/** 车身*/ +class TrainBody extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + + _create(model) { + let textFont = model.theme.trainTextFontSize + 'px Consolas'; //consolas + let TextFontHSDA = model.theme.trainHSDATextFontSize + 'px Consolas'; + + this.conflict = new Arc({ + zlevel: model.zlevel, + z: model.z, + shape: { + cx: model.point.x + model.theme.trainConflictR * 2, + cy: model.point.y - model.theme.trainConflictR - model.theme.trainConflictDistance, + r: model.theme.trainConflictR + }, + style: { + lineWidth: 0.1, + stroke: 'white', + fill: '#C0C0C0' + } + + }); + + this.train = new Rect({ + zlevel: model.zlevel, + z: model.z, + shape: { + x: model.point.x, + y: model.point.y, + width: model.theme.trainWidth, + height: model.theme.trainHeight + }, + style: { + lineWidth: 0.1, + stroke: 'white', + fill: '#C0C0C0' + } + + }); + + let lrPadding = 6; //两边间隔 + let upPadding = 5; //上边距离 + let beginX = (model.point.x + model.theme.trainConflictR + lrPadding); + let beginY = (model.point.y - model.theme.trainHSDATextFontSize - upPadding); + let margin = (model.theme.trainWidth - lrPadding * 2) / 5; + this.textH = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 1), + y: parseInt(beginY), + text: 'H', + textFill: model.theme.backgroundColor, + textStroke: model.theme.backgroundColor, + textStrokeWidth: 0, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + this.textS = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 2), + y: parseInt(beginY), + text: 'S', + textFill: model.theme.backgroundColor, + textStroke: model.theme.backgroundColor, + textStrokeWidth: 0, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + this.textD = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 3), + y: parseInt(beginY), + text: 'D', + textFill: model.theme.backgroundColor, + textStroke: model.theme.backgroundColor, + textStrokeWidth: 0, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + this.textA = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(beginX + margin * 4), + y: parseInt(beginY), + text: 'A', + textFill: model.theme.backgroundColor, + textStroke: model.theme.backgroundColor, + textStrokeWidth: 0, + textFont: TextFontHSDA, + textAlign: 'middle', + textVerticalAlign: 'top', + } + }); + + lrPadding = 1; //两边间隔 + upPadding = 1; //上边距离 + let serviceNumber = model.model.serviceNumber || 'AAA'; + let tripNumber = model.model.tripNumber || 'DDD'; + + serviceNumber = '000' + serviceNumber; + tripNumber = '000' + tripNumber; + this.textTrainServer = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x + lrPadding), + y: parseInt(model.point.y + upPadding), + text: serviceNumber.substring(serviceNumber.length - 3), + textFill: model.theme.backgroundColor, + textStroke: model.theme.backgroundColor, + textStrokeWidth: 0, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + } + }); + + this.textTrainTarget = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x + model.theme.trainWidth - lrPadding), + y: parseInt(model.point.y + upPadding), + text: tripNumber.substring(tripNumber.length - 3), + textFill: model.theme.backgroundColor, + textStroke: model.theme.backgroundColor, + textStrokeWidth: 0, + textFont: textFont, + textAlign: 'right', + textVerticalAlign: 'top', + } + }); + this.add(this.conflict); + this.add(this.train); + this.add(this.textH); + this.add(this.textS); + this.add(this.textD); + this.add(this.textA); + this.add(this.textTrainServer); + this.add(this.textTrainTarget); + } + + setConflictColor(color) { + this.conflict && this.conflict.setStyle('fill', color); + } + + setTrainColor(color) { + this.train && this.train.setStyle('fill', color); + } + + setTextTrainServerColor(color) { + this.textTrainServer.setStyle('textFill', color); + this.textTrainServer.setStyle('textStroke', color); + } + + setTextTrainTargetColor(color) { + this.textTrainTarget.setStyle('textFill', color); + this.textTrainTarget.setStyle('textStroke', color); + } + setConflictShow(isShow) { + isShow ? this.conflict.show() : this.conflict.hide(); + } + setHShow(isShow) { + isShow ? this.textH.show() : this.textH.hide(); + } + setSShow(isShow) { + isShow ? this.textS.show() : this.textS.hide(); + } + setDShow(isShow) { + isShow ? this.textD.show() : this.textD.hide(); + } + setAShow(isShow) { + isShow ? this.textA.show() : this.textA.hide(); + } + setHColor(color) { + this.textH.setStyle('textFill', color); + this.textH.setStyle('textStroke', color); + } + setSColor(color) { + this.textS.setStyle('textFill', color); + this.textS.setStyle('textStroke', color); + } + setDColor(color) { + this.textD.setStyle('textFill', color); + this.textD.setStyle('textStroke', color); + } + setAColor(color) { + this.textA.setStyle('textFill', color); + this.textA.setStyle('textStroke', color); + } +} + +/** 车头*/ +class TrainHead extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + _create(model) { + let baseMargin = (model.drect === -1 ? 1 : 0); + this.line = new Rect({ + zlevel: model.zlevel, + z: model.z, + shape: { + x: model.point.x - baseMargin * (model.theme.trainConntWidth), + y: model.point.y - model.theme.trainMoreLength, + width: model.theme.trainConntWidth, + height: model.theme.trainHeight + 2 * model.theme.trainMoreLength + }, + style: { + lineWidth: 0.1, + stroke: 'white', + fill: '#C0C0C0' + } + }); + + let arrowMargin = model.theme.trainPadding + model.theme.trainConntWidth; + this.arrow = new Polygon({ + zlevel: model.zlevel, + z: model.z, + shape: { + points: [ + [model.point.x + model.drect * (arrowMargin), model.point.y - model.theme.trainMoreLength], + [model.point.x + model.drect * (arrowMargin + model.theme.trainArrowWidth), model.point.y + (model.theme.trainHeight + model.theme.trainMoreLength) / 2], + [model.point.x + model.drect * (arrowMargin), model.point.y + model.theme.trainHeight + model.theme.trainMoreLength] + ] + }, + style: { + lineWidth: 0.1, + stroke: 'white', + fill: '#C0C0C0' + } + }); + + 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(); + } + setInvisible(invisible) { + this.eachChild((child) => { + child.attr('invisible', invisible); + }); + } +} + +/** 列车*/ +export default class Train extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _computed(model, theme) { + if (model.sectionModel) { + this.beg = model.sectionModel.points[0]; + this.end = model.sectionModel.points[model.sectionModel.points.length - 1]; + this.traingle = new JTriangle(this.beg, this.end); + this.point = this.traingle.middlePoint(); + this.point.x += this.traingle.GetSin(theme.trainHeight / 2); + this.point.y -= this.traingle.GetCos(theme.trainHeight / 2); + if (this.beg.y === this.end.y) { + let distance = (theme.trainDistance + theme.trainHeight + theme.trainConflictR * 2); + if (model.sectionModel.trainPosType === '01') { + this.point.y -= distance; + } + if (model.sectionModel.trainPosType === '02') { + this.point.y += distance; + } + } else { + let distance = (theme.trainDistance / 2 + theme.trainHeight + theme.trainConflictR * 2); + if (model.directionType === '02') { + this.point.x -= this.traingle.GetSin(distance) * this.traingle.dricty; + this.point.y += this.traingle.GetCos(distance) * this.traingle.dricty; + + } + if (model.directionType === '03') { + this.point.x += this.traingle.GetSin(distance) * this.traingle.dricty; + this.point.y -= this.traingle.GetCos(distance) * this.traingle.dricty; + } + } + if (this.point) { + let trainLength = theme.trainWidth / 2; + this.point.x -= this.traingle.GetCos(trainLength); + this.point.y -= this.traingle.GetSin(trainLength); + } + } else { + this.point = model.position; + this.traingle = null; + } + } + _create(model, theme) { + //计算画图坐标点 + this._computed(model, theme); + + //画图 + if (this.point) { + // body + this.trainB = new TrainBody({ + model: model, + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: this.point + }); + // left 头 + this.trainL = new TrainHead({ + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: { + x: this.point.x - theme.trainHeadDistance, + y: this.point.y + }, + drect: -1 + }); + // right 头 + this.trainR = new TrainHead({ + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: { + x: this.point.x + theme.trainWidth + theme.trainHeadDistance, + y: this.point.y + }, + drect: 1 + }); + + //旋转 + if (this.traingle) { + this.transformRotation(this.trainB); + this.transformRotation(this.trainL); + this.transformRotation(this.trainR); + } + + //添加视图 + this.add(this.trainB); + this.add(this.trainL); + this.add(this.trainR); + this.setStatus(model); + } + } + transformRotation(itemGroup) { + if (itemGroup instanceof Group && this.traingle && this.beg.y !== this.end.y) { + let origin = [this.point.x, this.point.y]; + let rotation = 0; + if (this.model.directionType === '02') { + rotation = Math.PI * 2 - Math.atan2(this.traingle.absy, this.traingle.absx) * this.traingle.drictx * this.traingle.dricty; + } + if (this.model.directionType === '03') { + rotation = Math.PI * 2 - Math.atan2(this.traingle.absy, this.traingle.absx) * this.traingle.drictx * this.traingle.dricty; + } + + //深度遍历设置旋转 + itemGroup.traverse(elem => { + elem.origin = origin; + elem.rotation = rotation; + }); + this.dirty(); //可以无需调用 + } + } + getShapeTipPoint() { + return { + x: (this.train.shape.x), + y: (this.train.shape.y) + }; + } + //恢复颜色状态 + colorRecover() { + this.trainB.setTrainColor('#C0C0C0'); + this.trainB.setConflictColor('#C0C0C0'); + this.trainL.setColor('#C0C0C0'); + this.trainR.setColor('#C0C0C0'); + this.trainB.setHColor('black'); + this.trainB.setSColor('black'); + this.trainB.setDColor('black'); + this.trainB.setAColor('black'); + } + //设置服务号状态类型 + setServerNoType(type) { + switch (type) { + case '01': { //显示服务号 + this.trainB.setTextTrainServerColor('white'); + } break; + case '02': { //显示车组号: 计划车、头码车 + this.trainB.setTextTrainServerColor('yellow'); + } break; + case '03': { //显示车组号: 人工车 + this.trainB.setTextTrainServerColor('pink'); + } break; + default: { + this.trainB.setTextTrainServerColor('black'); + } + } + } + //设置目的地状态 + setDestinationStatus(status) { + switch (status) { + case '01': { //准点 + this.trainB.setTextTrainTargetColor('green'); + } break; + case '02': { //早点 + this.trainB.setTextTrainTargetColor('blue'); + } break; + case '03': { //晚点 + this.trainB.setTextTrainTargetColor('red'); + } break; + case '04': { //头码车 + this.trainB.setTextTrainTargetColor('white'); + } break; + case '05': { //ATP切除 + this.trainB.setTextTrainTargetColor('yellow'); + } break; + default: { + this.trainB.setTextTrainTargetColor('black'); + } + } + } + //设置运行方向状态类型 + setDirectionType(type) { + switch (type) { + case '01': { //未知方向 + this.trainL.setLineShow(true); + this.trainR.setLineShow(true); + } break; + case '02': { //从左往右 + this.trainL.setLineShow(false); + this.trainR.setLineShow(true); + this.trainL.setArrowShow(false); + this.trainR.setArrowShow(true); + } break; + case '03': { //从右往左 + this.trainL.setLineShow(true); + this.trainR.setLineShow(false); + this.trainL.setArrowShow(true); + this.trainR.setArrowShow(false); + } break; + default: { + this.trainL.setLineShow(false); + this.trainR.setLineShow(false); + } + } + } + //设置运行状态 + setRunStatus(status) { + switch (status) { + case '01': { //停止 + this.trainL.setArrowShow(false); + this.trainR.setArrowShow(false); + } break; + case '02': { //运行 + } break; + default: { + this.trainL.setArrowShow(false); + this.trainR.setArrowShow(false); + } + } + } + //设置运行模式 + setRunMode(status) { + switch (status) { + case '01': { //未知 + this.trainL.setColor('red'); + this.trainR.setColor('red'); + } break; + case '02': { //ATO-CBTC通信车 + this.trainL.setColor('orange'); + this.trainR.setColor('orange'); + } break; + case '03': { //ATP-CBTC通信车 + this.trainL.setColor('yellow'); + this.trainR.setColor('yellow'); + } break; + case '04': { //ATB通信车 + this.trainL.setColor('blue'); + this.trainR.setColor('blue'); + } break; + case '05': { //ATO-BM非通信车 + this.trainL.setColor('purple'); + this.trainR.setColor('purple'); + } break; + case '06': { //ATP-BM非通信车 + this.trainL.setColor('pink'); + this.trainR.setColor('pink'); + } break; + case '07': { //RM + this.trainL.setColor('#C0C0C0'); + this.trainR.setColor('#C0C0C0'); + } break; + case '08': { //通信故障或非装备列车 + this.trainL.setInvisible(false); + this.trainR.setInvisible(false); + } break; + } + } + //设置运行控制状态类型 + setRunControlStatus(status) { + switch (status) { + case '01': { //正常 + this.trainB.setHShow(false); + this.trainB.setSShow(false); + } break; + case '02': { //扣车 + this.trainB.setHColor('yellow'); + this.trainB.setHShow(true); + this.trainB.setSShow(false); + } break; + case '03': { //跳停 + this.trainB.setSColor('lightblue'); + this.trainB.setSShow(true); + this.trainB.setHShow(false); + } break; + } + } + //设置车门状态类型 + setDoorStatus(status) { + switch (status) { + case '01': { //关门 + this.trainB.setDShow(false); + } break; + case '02': { //开门 + this.trainB.setDColor('green'); + } break; + case '03': { + this.trainB.setDColor('red'); + } + } + } + //设置通信状态类型 + setCommunicationStatus(status) { + switch (status) { + case '01': { //正常 + this.trainB.setTrainColor('#A0522D'); + } break; + case '02': { //故障 + this.trainB.setTrainColor('#C0C0C0'); + } break; + } + } + //设置计划冲突状态 + setPlanConflictStatus(status) { + switch (status) { + case '01': { //无冲突 + this.trainB.setConflictShow(false); + } break; + case '02': { //有冲突 + this.trainB.setConflictColor('white'); + } break; + } + } + //设置报警状态 + setAlarmStatus(status) { + switch (status) { + case '01': { //不报警 + this.trainB.setAShow(false); + } break; + case '02': { //报警 + this.trainB.setAColor('red'); + } break; + } + } + + //设置状态 + setStatus(model) { + if (model) { + this.setServerNoType(model.serverNoType); //设置服务号状态类型 + this.setDestinationStatus(model.destinationStatus); //设置目的地状态 + this.setDirectionType(model.directionType); //设置运行方向状态类型 + this.setRunStatus(model.runStatus); //设置运行状态 + this.setRunMode(model.runMode); //设置运行模式 + this.setRunControlStatus(model.runControlStatus); //设置运行控制状态类型 + this.setDoorStatus(model.doorStatus); //设置车门状态类型 + this.setCommunicationStatus(model.communicationStatus); //设置通信状态类型 + this.setPlanConflictStatus(model.planConflictStatus); //设置计划冲突状态 + this.setAlarmStatus(model.alarmStatus); //设置报警状态 + } + } +} diff --git a/src/jmap/components/default/shape/index.js b/src/jmap/components/default/shape/index.js new file mode 100644 index 000000000..ac20b6da7 --- /dev/null +++ b/src/jmap/components/default/shape/index.js @@ -0,0 +1,31 @@ +import Link from './Link'; +import Section from './Section'; +import Signal from './Signal'; +import Station from './Station'; +import StationControl from './StationControl'; +import StationCounter from './StationCounter'; +import StationDelayUnlock from './StationDelayUnlock'; +import StationStand from './StationStand'; +// import StopPoint from './StopPoint'; +import StopTextPoint from './StopTextPoint'; +import Switch from './Switch'; +import Train from './Train'; +import Text2 from './Text'; +import Line2 from './Line'; + +export default { + Link, + Section, + Signal, + Station, + StationControl, + StationCounter, + StationDelayUnlock, + StationStand, + // StopPoint, + StopTextPoint, + Switch, + Train, + Text: Text2, + Line: Line2 +}; \ No newline at end of file diff --git a/src/jmap/components/default/theme.js b/src/jmap/components/default/theme.js new file mode 100644 index 000000000..9b1912b2b --- /dev/null +++ b/src/jmap/components/default/theme.js @@ -0,0 +1,268 @@ +import { enableClassExtend, enableClassCheck } from '@/jlmap/util/clazz'; + +/** + * 皮肤风格主题 + * @param {*} opts + */ +function Theme() { + +} + +Theme.prototype = { + constructor: Theme, + + //道岔字体颜色 + switchTextColor: 'lightgreen', + + /** 皮肤风格编码 */ + code: 'default', + + /** 默认背景 颜色*/ + backgroundColor: '#000000', + + /** 透明填充 颜色*/ + transparentColor: 'rgba(0,0,0,0)', + + /** 默认字体 大小*/ + textFontSize: 8, + + /** 默认字体 族类*/ + textFontFormat: 'consolas', //consolas + + /** 默认名称和设备的距离*/ + nameDistance: 1, + + /** line 颜色*/ + lineWidthColor: '#FFFFFF', + + + /** link 宽度*/ + linkWidth: 4, + + /** link 线条颜色*/ + linkColor: '#4e8de6',//#4e8de6 + + /** link 字体颜色*/ + linkTextColor: '#FFFFFF', //#3399cc #3399cc + + + /** StopPoint 颜色*/ + stopPointColor: '#FE0000', + + /** StopPoint 字体颜色*/ + stopPointTextColor: '#FFFFFF', + + + /** 区段 宽度*/ + sectionWidth: 5, + + /** 计轴 半径*/ + sectionAxleR: 3, + + /** 计轴和区段之间的距离*/ /** 需要添加*/ + sectionAxleDistance: 5, + + /** 区段字体颜色*/ + sectionTextColor: 'lightgreen', + + /** 区段计轴颜色*/ + sectionAxleColor: 'white', + + /** 区段边界符颜色*/ + sectionSeparatorColor: 'white', + + /** 逻辑区段分隔符颜色*/ + sectionLogicalPartitionColor: 'black', + + /** 逻辑区段名称颜色*/ + sectionLogicalTextColor: 'white', + + /** 区段空闲颜色*/ + sectionSpareColor: '#4e8de6', + + /** 区段通信车占用颜色**/ + sectionCommunicationOccupiedColor: 'lightpink', + + /** 区段非通讯车占用颜色*/ + sectionUnCommunicationOccupiedColor: 'red', + + /** 区段路由锁定颜色*/ + sectionRouteLockColor: 'rgba(0, 255, 0, 1)', + + /** 区段故障锁定颜色*/ + sectionFaultLockColor: 'white', + + /** 区段封锁颜色*/ + sectionBlockColor: 'pink', + + /** 区段atc切除颜色*/ + sectionAtcExcisionColor: '#A0522D', + + /** 区段ats切除颜色*/ + sectionAtsExcisionColor: '#A0522D', + + /** 区段延续保护状态颜色*/ + sectionRouteContinuationProtectionColor: '#92D14F', + + + /** 道岔单边长度 */ + switchLen: 10, + + + /** 信号机宽度 */ + signalR: 3, + + /** 设备距离区段的距离*/ + signalDistance: 18, + + /** 信号灯按钮颜色*/ + signalButtonColor: 'darkgreen', + + /** 信号灯按钮闪烁颜色*/ + signalButtonLightenColor: 'yellow', + + /** 信号灯字体颜色*/ + signalTextColor: 'white', + + /** 信号灯灯柱颜色*/ + signalLampStandardColor: '#C0C0C0', + + /** 信号灯灰色*/ + signalLampGrayColor: '#C0C0C0', + + /** 信号灯红色*/ + signalLampRedColor: 'red', + + /** 信号灯绿色*/ + signalLampGreenColor: 'green', + + /** 信号灯黄色*/ + signalLampYellowColor: 'yellow', + + /** 控制模式灯的半径 */ + controlmodeR: 4, + + /** 控制模式之间灯之间的距离*/ + controlDistance: 36, + + /** 控制模式字体大小*/ + stationControlTextSize: 12, + + /** 控制模式灰色*/ + stationControlGrayColor: '#C0C0C0', + + /** 控制模式绿色*/ + stationControlGreenColor: 'green', + + /** 控制模式红色*/ + stationControlRedColor: 'red', + + /** 控制模式黄色*/ + stationControlYellowColor: 'yellow', + + + /** 站台和屏蔽门之间的距离*/ + stationStandDistance: 4, + + /** 站台首端字体大小*/ + stationStandHeadFontSize: 10, + + /** 站台空闲颜色*/ + stationStandSpareColor: 'white', + + /** 站台列车停站颜色*/ + stationStandStopColor: 'yellow', + + /** 站台跳停颜色*/ + stationStandJumpStopColor: 'blue', + + /** 站台指定列车跳停颜色*/ + stationStandDesignatedJumpStopColor: 'lightSkyBlue', + + /** 站台紧急关闭颜色*/ + stationStandEmergentCloseColor: 'red', + + /** 停站时间字体颜色*/ + stationStandTimeTextColor: 'white', + + /** 车站扣车颜色*/ + stationStandStandDetainTrainColor: 'yellow', + + /** 中心扣车颜色*/ + stationStandCenterDetainTrainColor: 'white', + + /** 车站+中心扣车颜色*/ + stationStandStandAndCenterDetainTrainColor: 'red', + + /** 屏蔽门默认颜色*/ + stationStandDoorDefaultColor: 'green', + + /** 屏蔽门切除颜色*/ + stationStandSplitDoorColor: 'green', + + + + /** 计数器字体颜色*/ + stationCounterTextColor: 'white', + + /** 计数器边框颜色*/ + stationCounterBorderColor: 'yellow', + + // 停车点目的码文字大小 + textPointFontSize: 6, + + + /** 延迟解锁倒计时和设备文字之间的距离*/ + stationDelayUnlockDistance: 3, + + /** 延时解锁字体颜色*/ + stationDelayUnlockTextColor: 'white', + + /** 延迟解锁边框颜色*/ + stationDelayUnlockBorderColor: 'white', + + // 停车点折返点目的码名字颜色 + stopPointTexDestCodetColor: '#FFF07B', + + /** 列车长度*/ + trainWidth: 55, + + /** 列车高度*/ + trainHeight: 20, + + /** 列车字号*/ + trainTextFontSize: 16, + + /** 列车HDSA字号*/ + trainHSDATextFontSize: 8, + + /** 列车信号的半径*/ + trainConflictR: 3, + + /** 列车信号距离车的距离*/ + trainConflictDistance: 5, + + /** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/ + trainMoreLength: 1, + + /** 列车和车头之间的间距*/ + trainHeadDistance: 2, + + /** 列车竖杠的宽度*/ + trainConntWidth: 4, + + /** 列车竖杠和方向之间的间隔*/ + trainPadding: 1, + + /** 列车方向的宽度*/ + trainArrowWidth: 6, + + /** 列车和区段之间的距离*/ + trainDistance: 30 +}; + +// Enable Theme.extend. +enableClassExtend(Theme); +enableClassCheck(Theme); + +export default Theme; \ No newline at end of file diff --git a/src/jmap/components/deviceMenu.js b/src/jmap/components/deviceMenu.js new file mode 100644 index 000000000..5589c306e --- /dev/null +++ b/src/jmap/components/deviceMenu.js @@ -0,0 +1,50 @@ +const Default = '01'; +const themePathDict = { + '01': "./default", + '02': "./fuzhou_01", + '03': "./beijing_01", + '04': "./chengdou_03", + '05': "./batong_01", +}; + + + + + +// 加载菜单组件 +function loadMenusComponent(code) { + return Object.assign({}, require(`${themePathDict[code || Default]}/menus/index`).default); +} + +// 加载运行图计划表组件 +function loadPlanScheduleComponent(code) { + return Object.assign({}, require(`${themePathDict[code || Default]}/planSchedule/index`).default); +} + +// model字段转换器 +function modelConvert(code) { + let convert = require(`${themePathDict[code || Default]}/model`) || {}; + + //如果没有转换器,则补全转换器为直接返回原model + if (!convert.hasOwnProperty('InitPublicProperties')) { + convert.InitPublicProperties = (model) => { return model; }; + } + if (!convert.hasOwnProperty('InitPrivateProperties')) { + convert.InitPrivateProperties = (model) => { return model; }; + } + + return convert; +} + +// 加载运行图解析和转化函数 +function loadPlanConvert(code) { + return require(`${themePathDict[code || Default]}/convert`).default; +} + +export default { + Default, + loadMenusComponent, + loadPlanScheduleComponent, + loadPlanConvert, + modelConvert +}; \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/convert.js b/src/jmap/components/fuzhou_01/convert.js new file mode 100644 index 000000000..91f755b21 --- /dev/null +++ b/src/jmap/components/fuzhou_01/convert.js @@ -0,0 +1,319 @@ +import { createMartPoint, createSeriesModel, createMarkLineModels, HexColor, FormatTime, ConvertSheetToList } from '@/utils/runPlan'; + +export default { + /** 边缘高度*/ + EdgeHeight: 3, + + /** 间隔高度*/ + CoordMultiple: 3, + + /** 偏移时间*/ + TranslationTime: 60 * 60 * 2, + + /** 解析exal数据转换为Json后台数据*/ //福州 + importData(Sheet, JsonData) { + let dataList = ConvertSheetToList(Sheet, true); + + if (dataList && dataList.length) { + let tIndex = dataList.findIndex(it => { return it[0]; }); + + /** 解析二维数组为json对象*/ + const reg0 = /^[↑|↓|¡|ü|ý|]+(.*)/; + const reg1 = /^([▼|▲|¡ø|¨‹]+)\s*(\d+:\d+:\d+)/; + const reg2 = /^(\d+:\d+:\d+)\s*([▼|▲|¡ø|¨‹]+)/; + const reg3 = /^(\d+:\d+:\d+)\s*(\d+:\d+:\d+|)/; + const reg4 = /[▼|▲|¡|ø|¨|‹]+/; + + dataList.forEach((elem, i) => { + let begin = -1; + /** 跳过名称所在的行*/ + if (i != tIndex && elem && elem.length > 0) { + elem.forEach((item, j) => { + /** 过滤空值*/ + if (item) { + let value = `${item}`.trim(); + let title = `${dataList[tIndex][j]}`.trim(); + /** 匹配到开始位置或者结束位置*/ + 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) { + /** 匹配到中间位置*/ + let begTime, endTime; + let runFlag = JsonData[JsonData.length - 1].code[2]; + let stationName = title.replace(/\s/, ''); + let need = false, 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 = true, flag = 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 = true, flag = true; + } else if (reg3.test(value)) { + /** 正常时间格式*/ + [, begTime, endTime] = reg3.exec(value); + + /** 如果只存在一个数据时,则开始和结束设置一样*/ + endTime = endTime ? endTime : begTime; + + /** 下行方向时间互换*/ + if (runFlag === '2') { + [begTime, endTime] = [endTime, begTime]; + } + + /** 设置标志*/ + need = true, flag = false; + } + + /** 添加json数据*/ + if (need) { + let stationObj = { + stationName: stationName + }; + + if (begTime) { stationObj['arriveTime'] = FormatTime(begTime); } + if (endTime) { stationObj['departureTime'] = FormatTime(endTime); } + if (flag) { stationObj['flag'] = flag; } + JsonData[JsonData.length - 1].arrivalList.push(stationObj); + } + } + } + }); + } + }); + } + + return JsonData; + }, + + /** 将后台数据解析成图表*/ + convertDataToModels(data, stations, kmRangeCoordMap, lineStyle) { + let models = []; + + if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) { + /** 按服务遍历数据*/ + data.serviceNumberDataList.forEach((service) => { + /** 按车次遍历数据*/ + let opt = { name: '', markPointData: [], data: [] }; + if (service.tripNumberDataList && service.tripNumberDataList.length) { + service.tripNumberDataList.forEach((train, j) => { + let pointdata = {}; + let idx = 0; + let lastPoint = null; + let 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; + opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode]); + }); + + /** 计算折返点车次坐标点集合*/ + if (!service.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) { + lastPoint = train.stationTimeList[idx]; + nextPoint = service.tripNumberDataList[j + 1].stationTimeList[0]; + opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true), lastPoint.stationCode]); + opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true), lastPoint.stationCode]); + } + + /** 如果是备用车,按车次添加线*/ + if (service.backup) { + /** 创建一条完成的服务数据*/ + opt.name += j; + let model = createSeriesModel(opt, Object.assign({ color: HexColor.toCreate() }, lineStyle)); + if (model) { + models.push(model); + opt = { name: '', markPointData: [], data: [] }; + } + } + }); + + //不是备用车,按服务添加线 + if (!service.backup) { + /** 创建一条完成的服务数据*/ + let model = createSeriesModel(opt, Object.assign({ color: HexColor.toCreate() }, 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' + })); + } + + /** 计算折返点*/ + let nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.directionCode]; + if (serie.data.length > 0) { + let 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) { + let 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) { + let yText = ''; + let 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) { + let defaultVlue = 0; + let station = stations.find(it => { return it.code == elem.stationCode; }); + if (station) { + defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; + if (isSpecial) { + defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode); + } + } + + return defaultVlue; + } + + +}; \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/childDialog/childDialog/noticeInfo.vue b/src/jmap/components/fuzhou_01/menus/dialog/childDialog/childDialog/noticeInfo.vue new file mode 100644 index 000000000..8c0fa7ed6 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/childDialog/childDialog/noticeInfo.vue @@ -0,0 +1,77 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmControl.vue new file mode 100644 index 000000000..720e0baa5 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmControl.vue @@ -0,0 +1,360 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmControlSpeed.vue b/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmControlSpeed.vue new file mode 100644 index 000000000..e7611354b --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmControlSpeed.vue @@ -0,0 +1,153 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmSignalUnlock.vue b/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmSignalUnlock.vue new file mode 100644 index 000000000..a79c917f9 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmSignalUnlock.vue @@ -0,0 +1,118 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmTrain.vue b/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmTrain.vue new file mode 100644 index 000000000..8c8d9299e --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/childDialog/confirmTrain.vue @@ -0,0 +1,168 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/routeCmdControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/routeCmdControl.vue new file mode 100644 index 000000000..24aa4389b --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/routeCmdControl.vue @@ -0,0 +1,430 @@ + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/routeControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/routeControl.vue new file mode 100644 index 000000000..1651001da --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/routeControl.vue @@ -0,0 +1,325 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/routeDetail.vue b/src/jmap/components/fuzhou_01/menus/dialog/routeDetail.vue new file mode 100644 index 000000000..5513cb14e --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/routeDetail.vue @@ -0,0 +1,150 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/routeHandControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/routeHandControl.vue new file mode 100644 index 000000000..f39f30aac --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/routeHandControl.vue @@ -0,0 +1,294 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/routeLock.vue b/src/jmap/components/fuzhou_01/menus/dialog/routeLock.vue new file mode 100644 index 000000000..00a1b87d9 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/routeLock.vue @@ -0,0 +1,154 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/routeSelection.vue b/src/jmap/components/fuzhou_01/menus/dialog/routeSelection.vue new file mode 100644 index 000000000..c38ec1a8a --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/routeSelection.vue @@ -0,0 +1,238 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/sectionCmdControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/sectionCmdControl.vue new file mode 100644 index 000000000..92286fd58 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/sectionCmdControl.vue @@ -0,0 +1,433 @@ + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/sectionControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/sectionControl.vue new file mode 100644 index 000000000..dd1ffe1d6 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/sectionControl.vue @@ -0,0 +1,190 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/speedCmdControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/speedCmdControl.vue new file mode 100644 index 000000000..c3f21a37b --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/speedCmdControl.vue @@ -0,0 +1,553 @@ + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/standBackStrategy.vue b/src/jmap/components/fuzhou_01/menus/dialog/standBackStrategy.vue new file mode 100644 index 000000000..0801ed774 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/standBackStrategy.vue @@ -0,0 +1,228 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/standControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/standControl.vue new file mode 100644 index 000000000..04230ce75 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/standControl.vue @@ -0,0 +1,260 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/standDetail.vue b/src/jmap/components/fuzhou_01/menus/dialog/standDetail.vue new file mode 100644 index 000000000..b3347c33a --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/standDetail.vue @@ -0,0 +1,173 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/standDetainTrainAll.vue b/src/jmap/components/fuzhou_01/menus/dialog/standDetainTrainAll.vue new file mode 100644 index 000000000..9de4510da --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/standDetainTrainAll.vue @@ -0,0 +1,177 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/standRunLevel.vue b/src/jmap/components/fuzhou_01/menus/dialog/standRunLevel.vue new file mode 100644 index 000000000..7866d3faa --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/standRunLevel.vue @@ -0,0 +1,260 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/standStopTime.vue b/src/jmap/components/fuzhou_01/menus/dialog/standStopTime.vue new file mode 100644 index 000000000..3af58400e --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/standStopTime.vue @@ -0,0 +1,239 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/stationCmdControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/stationCmdControl.vue new file mode 100644 index 000000000..36470fecd --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/stationCmdControl.vue @@ -0,0 +1,385 @@ + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/stationHumanControlAll.vue b/src/jmap/components/fuzhou_01/menus/dialog/stationHumanControlAll.vue new file mode 100644 index 000000000..5af495d1f --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/stationHumanControlAll.vue @@ -0,0 +1,114 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/stationSetRouteControlAll.vue b/src/jmap/components/fuzhou_01/menus/dialog/stationSetRouteControlAll.vue new file mode 100644 index 000000000..517de7beb --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/stationSetRouteControlAll.vue @@ -0,0 +1,134 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/switchCmdControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/switchCmdControl.vue new file mode 100644 index 000000000..2f85c506c --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/switchCmdControl.vue @@ -0,0 +1,457 @@ + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/switchControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/switchControl.vue new file mode 100644 index 000000000..f8a6124a8 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/switchControl.vue @@ -0,0 +1,271 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/trainControl.vue b/src/jmap/components/fuzhou_01/menus/dialog/trainControl.vue new file mode 100644 index 000000000..cf0f36ab2 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/trainControl.vue @@ -0,0 +1,425 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/trainCreate.vue b/src/jmap/components/fuzhou_01/menus/dialog/trainCreate.vue new file mode 100644 index 000000000..13e07b766 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/trainCreate.vue @@ -0,0 +1,156 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/trainDelete.vue b/src/jmap/components/fuzhou_01/menus/dialog/trainDelete.vue new file mode 100644 index 000000000..ca46681eb --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/trainDelete.vue @@ -0,0 +1,156 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/trainEditNumber.vue b/src/jmap/components/fuzhou_01/menus/dialog/trainEditNumber.vue new file mode 100644 index 000000000..7ea02e67d --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/trainEditNumber.vue @@ -0,0 +1,131 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/trainMove.vue b/src/jmap/components/fuzhou_01/menus/dialog/trainMove.vue new file mode 100644 index 000000000..aa0da2032 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/trainMove.vue @@ -0,0 +1,186 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/dialog/trainSwitch.vue b/src/jmap/components/fuzhou_01/menus/dialog/trainSwitch.vue new file mode 100644 index 000000000..542eaf34b --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/dialog/trainSwitch.vue @@ -0,0 +1,191 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/index.vue b/src/jmap/components/fuzhou_01/menus/index.vue new file mode 100644 index 000000000..e2a16821c --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/index.vue @@ -0,0 +1,360 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuBar.vue b/src/jmap/components/fuzhou_01/menus/menuBar.vue new file mode 100644 index 000000000..35a1efe42 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuBar.vue @@ -0,0 +1,807 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuCancel.vue b/src/jmap/components/fuzhou_01/menus/menuCancel.vue new file mode 100644 index 000000000..9311a3d17 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuCancel.vue @@ -0,0 +1,145 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/twoConfirmation.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/twoConfirmation.vue new file mode 100644 index 000000000..6e5ac7042 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/twoConfirmation.vue @@ -0,0 +1,133 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/userAdd.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/userAdd.vue new file mode 100644 index 000000000..5c6b913a2 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/userAdd.vue @@ -0,0 +1,162 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/userDelete.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/userDelete.vue new file mode 100644 index 000000000..1072742eb --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/userDelete.vue @@ -0,0 +1,134 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/userEdit.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/userEdit.vue new file mode 100644 index 000000000..fe69bab58 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/childDialog/userEdit.vue @@ -0,0 +1,178 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/helpAbout.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/helpAbout.vue new file mode 100644 index 000000000..a2f848882 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/helpAbout.vue @@ -0,0 +1,131 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/manageUser.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/manageUser.vue new file mode 100644 index 000000000..ef901c1bd --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/manageUser.vue @@ -0,0 +1,290 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/passwordBox.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/passwordBox.vue new file mode 100644 index 000000000..6f6f760ee --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/passwordBox.vue @@ -0,0 +1,221 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/stationControlConvert.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/stationControlConvert.vue new file mode 100644 index 000000000..fe357a120 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/stationControlConvert.vue @@ -0,0 +1,443 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/trainAdd.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/trainAdd.vue new file mode 100644 index 000000000..bf8dc4c48 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/trainAdd.vue @@ -0,0 +1,162 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/trainDelete.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/trainDelete.vue new file mode 100644 index 000000000..2cc0045d3 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/trainDelete.vue @@ -0,0 +1,149 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/trainTranstalet.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/trainTranstalet.vue new file mode 100644 index 000000000..d437716e9 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/trainTranstalet.vue @@ -0,0 +1,152 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/viewDevice.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/viewDevice.vue new file mode 100644 index 000000000..784d7ef82 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/viewDevice.vue @@ -0,0 +1,166 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/viewName.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/viewName.vue new file mode 100644 index 000000000..64786c7b4 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/viewName.vue @@ -0,0 +1,266 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuDialog/viewTrainId.vue b/src/jmap/components/fuzhou_01/menus/menuDialog/viewTrainId.vue new file mode 100644 index 000000000..0e8041065 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuDialog/viewTrainId.vue @@ -0,0 +1,183 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuSection.vue b/src/jmap/components/fuzhou_01/menus/menuSection.vue new file mode 100644 index 000000000..980e41522 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuSection.vue @@ -0,0 +1,404 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuSignal.vue b/src/jmap/components/fuzhou_01/menus/menuSignal.vue new file mode 100644 index 000000000..fcfec7df4 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuSignal.vue @@ -0,0 +1,536 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuStation.vue b/src/jmap/components/fuzhou_01/menus/menuStation.vue new file mode 100644 index 000000000..ed629db35 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuStation.vue @@ -0,0 +1,299 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuStationControl.vue b/src/jmap/components/fuzhou_01/menus/menuStationControl.vue new file mode 100644 index 000000000..c1e20104e --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuStationControl.vue @@ -0,0 +1,68 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuStationStand.vue b/src/jmap/components/fuzhou_01/menus/menuStationStand.vue new file mode 100644 index 000000000..3d9565546 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuStationStand.vue @@ -0,0 +1,485 @@ + + + diff --git a/src/jmap/components/fuzhou_01/menus/menuSwitch.vue b/src/jmap/components/fuzhou_01/menus/menuSwitch.vue new file mode 100644 index 000000000..e47e7525e --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuSwitch.vue @@ -0,0 +1,483 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuTool.vue b/src/jmap/components/fuzhou_01/menus/menuTool.vue new file mode 100644 index 000000000..dc32a9673 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuTool.vue @@ -0,0 +1,205 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/menuTrain.vue b/src/jmap/components/fuzhou_01/menus/menuTrain.vue new file mode 100644 index 000000000..c793796d2 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/menuTrain.vue @@ -0,0 +1,318 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/passiveDialog/alarm.vue b/src/jmap/components/fuzhou_01/menus/passiveDialog/alarm.vue new file mode 100644 index 000000000..292f16bd0 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/passiveDialog/alarm.vue @@ -0,0 +1,215 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/passiveDialog/control.vue b/src/jmap/components/fuzhou_01/menus/passiveDialog/control.vue new file mode 100644 index 000000000..1d1a1f62e --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/passiveDialog/control.vue @@ -0,0 +1,297 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/passiveDialog/timeout.vue b/src/jmap/components/fuzhou_01/menus/passiveDialog/timeout.vue new file mode 100644 index 000000000..f6c7007c5 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/passiveDialog/timeout.vue @@ -0,0 +1,106 @@ + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/statusBar.vue b/src/jmap/components/fuzhou_01/menus/statusBar.vue new file mode 100644 index 000000000..0fad48767 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/statusBar.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/statusDownTrainDetail.vue b/src/jmap/components/fuzhou_01/menus/statusDownTrainDetail.vue new file mode 100644 index 000000000..ce4f82f65 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/statusDownTrainDetail.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/statusUpTrainDetail.vue b/src/jmap/components/fuzhou_01/menus/statusUpTrainDetail.vue new file mode 100644 index 000000000..9bd682637 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/statusUpTrainDetail.vue @@ -0,0 +1,31 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menus/utils/menuItemStatus.js b/src/jmap/components/fuzhou_01/menus/utils/menuItemStatus.js new file mode 100644 index 000000000..4fae4cf4f --- /dev/null +++ b/src/jmap/components/fuzhou_01/menus/utils/menuItemStatus.js @@ -0,0 +1,557 @@ +import store from '@/store'; +import { mapStatusEnum, getStatusObject } from '@/scripts/StatusDic'; +import { OperateMode } from '@/scripts/ConstDic'; +// import { stat } from 'fs'; + +export function getCurrentStatusObject() { + return getStatusObject(store.getters['menuOperation/selected']); +} + +/** 系统类型 */ +export const SystemType = { + '01': 'local', // 现地工作站 + '02': 'central' // 中心调度工作站 +}; + +export const StationControlType = { + '01': 'center', // 中控 + '02': 'station',// 站控 + '03': 'station', +}; + +// 控制禁用 +export const MenuDisabledStatus = { + Section: { + //故障解锁 + fault() { + }, + //切除 + split() { + let device = getCurrentStatusObject(); + if (device && device.cutOff != mapStatusEnum.Section.cutOff.Default) { + return true; + } + }, + //激活 + active() { + let device = getCurrentStatusObject(); + if (device && device.cutOff == mapStatusEnum.Section.cutOff.Default) { + return true; + } + }, + //区段封锁 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Section.status.Status06) { + return true; + } + }, + //区段解禁 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Section.status.Status06) { + return true; + } + }, + //区段设置限速 + setSpeed() { + let device = getCurrentStatusObject(); + if (device && device.speedUpperLimit != mapStatusEnum.Section.speedUpperLimit.Default) { + return true; + } + }, + //区段取消限速 + cancelSpeed() { + let device = getCurrentStatusObject(); + if (device && device.speedUpperLimit == mapStatusEnum.Section.speedUpperLimit.Default) { + return true; + } + }, + //新建列车 + newTrain() { + }, + //计轴预复位 + axlePreReset() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Signal: { + //进路选排 + arrangementRoute() { + + }, + //进路取消 + cancelTrainRoute() { + }, + //信号封闭 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Signal.status.Status04) { + return true; + } + }, + //信号解封 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Signal.status.Status04) { + return true; + } + }, + //信号重开 + reopenSignal() { + }, + //进路引导 + guide() { + }, + //设置联锁自动进路 + setAutoInterlock() { + }, + //取消联锁自动进路 + cancelAutoInterlock() { + }, + //设置联锁自动触发 + setAutoTrigger() { + }, + //取消联锁自动触发 + cancelAutoTrigger() { + }, + //关灯 + signalClose() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Signal.status.Status01) { + return true; + } + }, + //人工控 + humanControl() { + }, + //ats自动控 + atsAutoControl() { + }, + //查询进路状态 + detail() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Station: { + //全站设置联锁自动触发 + setAutoTrigger() { + }, + //全站取消联锁自动触发 + cancelAutoTrigger() { + }, + //上电解锁 + powerUnLock() { + }, + //执行关键操作测试 + execKeyOperationTest() { + }, + //所有进路自排开 + atsAutoControlALL() { + }, + //所有进路自排关 + humanControlALL() { + }, + //设置ZC故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消ZC故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + StationControl: { + //紧急站控 + emergencyStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status03) { + return true; + } + }, + //请求站控 + requestStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status02) { + return true; + } + }, + //强行站控 + forcedStationControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status02) { + return true; + } + }, + //请求中控 + requestCentralControl() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.StationControl.status.Status01) { + return true; + } + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + StationStand: { + //设置扣车 + setDetainTrain() { + let device = getCurrentStatusObject(); + if (store.state.map.prdType == '02') { + if (device && device.holdStatus == mapStatusEnum.StationStand.holdStatus.Status03) { + return true; + } + } else { + if (device && device.holdStatus == mapStatusEnum.StationStand.holdStatus.Status02) { + return true; + } + } + }, + //取消扣车 + cancelDetainTrain() { + let device = getCurrentStatusObject(); + if (store.state.map.prdType == '02') { + if (device && device.holdStatus == mapStatusEnum.StationStand.holdStatus.Status03) { + return true; + } + } else { + if (device && device.holdStatus != mapStatusEnum.StationStand.holdStatus.Status02) { + return true; + } + } + }, + //强制取消扣车 + cancelDetainTrainForce() { + let device = getCurrentStatusObject(); + if (device && device.holdStatus == mapStatusEnum.StationStand.holdStatus.Status01) { + return true; + } + }, + //设置全站扣车 + cancelDetainTrainAll() { + }, + //设置运行等级 + setRunLevel() { + }, + //设置停站时间 + setStopTime() { + }, + //设置跳停 + setJumpStop() { + let device = getCurrentStatusObject(); + if (device && device.jumpStopStatus != mapStatusEnum.StationStand.jumpStopStatus.Status01) { + return true; + } + }, + //取消跳停 + cancelJumpStop() { + let device = getCurrentStatusObject(); + if (device && device.jumpStopStatus == mapStatusEnum.StationStand.jumpStopStatus.Status01) { + return true; + } + }, + //提前发车 + earlyDeparture() { + }, + //站台详细信息 + detail() { + }, + //设置折返策略 + setBackStrategy() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Switch: { + //单锁 + lock() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Switch.status.Status10) { + return true; + } + }, + //解锁 + unlock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Switch.status.Status10) { + return true; + } + }, + //封锁 + block() { + let device = getCurrentStatusObject(); + if (device && device.status == mapStatusEnum.Switch.status.Status14) { + return true; + } + }, + //解封 + unblock() { + let device = getCurrentStatusObject(); + if (device && device.status != mapStatusEnum.Switch.status.Status14) { + return true; + } + }, + //强扳 + switchTurnoutForce() { + }, + //转动 + switchTurnout() { + }, + //道岔故障解锁 + fault() { + }, + //计轴预复位 + axlePreReset() { + }, + //道岔切除 + split() { + }, + //道岔激活 + active() { + }, + //道岔设置速度 + setSpeed() { + // let device = getCurrentStatusObject(); + }, + //道岔取消速度 + cancelSpeed() { + }, + //设置故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + }, + Train: { + //添加列车识别号 + addTrainId() { + }, + //删除列车识别号 + delTrainId() { + }, + //修改列车识别号 + editTrainId() { + }, + //修改车组号 + editTrainNo() { + }, + //移动列车识别号 + moveTrainId() { + }, + //交换列车识别号 + switchTrainId() { + }, + //设置限速 + limitSpeed() { + }, + //设置通信故障 + setStoppage() { + let device = getCurrentStatusObject(); + if (device && device.fault) { + return true; + } + }, + //取消通信故障 + cancelStoppage() { + let device = getCurrentStatusObject(); + if (device && !device.fault) { + return true; + } + } + } +}; +export function checkOperationValidity(){ + if (store.state.map.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) { + let selected = store.getters['menuOperation/selected']; + let control, 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) { + let controlStatus = getStatusObject(control); + if (store.state.map.prdType != '') { + let type = SystemType[store.state.map.prdType]; + let status = StationControlType[controlStatus.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) { + let menu = []; + if (store.state.map.prdType != '') { + let type = SystemType[store.state.map.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/components/fuzhou_01/menusPlan/addTask.vue b/src/jmap/components/fuzhou_01/menusPlan/addTask.vue new file mode 100644 index 000000000..64c594845 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menusPlan/addTask.vue @@ -0,0 +1,163 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menusPlan/chooseTemplatePlan.vue b/src/jmap/components/fuzhou_01/menusPlan/chooseTemplatePlan.vue new file mode 100644 index 000000000..ec8c3d3c7 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menusPlan/chooseTemplatePlan.vue @@ -0,0 +1,119 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menusPlan/components/dataTable.vue b/src/jmap/components/fuzhou_01/menusPlan/components/dataTable.vue new file mode 100644 index 000000000..6d0ad3146 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menusPlan/components/dataTable.vue @@ -0,0 +1,203 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menusPlan/createTodayPlan.vue b/src/jmap/components/fuzhou_01/menusPlan/createTodayPlan.vue new file mode 100644 index 000000000..0de6ebd0a --- /dev/null +++ b/src/jmap/components/fuzhou_01/menusPlan/createTodayPlan.vue @@ -0,0 +1,154 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menusPlan/createWeekPlan.vue b/src/jmap/components/fuzhou_01/menusPlan/createWeekPlan.vue new file mode 100644 index 000000000..1381ca79e --- /dev/null +++ b/src/jmap/components/fuzhou_01/menusPlan/createWeekPlan.vue @@ -0,0 +1,127 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menusPlan/deleteTask.vue b/src/jmap/components/fuzhou_01/menusPlan/deleteTask.vue new file mode 100644 index 000000000..a6b886196 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menusPlan/deleteTask.vue @@ -0,0 +1,64 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menusPlan/deleteTodayPlan.vue b/src/jmap/components/fuzhou_01/menusPlan/deleteTodayPlan.vue new file mode 100644 index 000000000..543f171e5 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menusPlan/deleteTodayPlan.vue @@ -0,0 +1,53 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menusPlan/managePlanList.vue b/src/jmap/components/fuzhou_01/menusPlan/managePlanList.vue new file mode 100644 index 000000000..9fb505a5c --- /dev/null +++ b/src/jmap/components/fuzhou_01/menusPlan/managePlanList.vue @@ -0,0 +1,124 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menusPlan/modifyingPlan.vue b/src/jmap/components/fuzhou_01/menusPlan/modifyingPlan.vue new file mode 100644 index 000000000..ff0299381 --- /dev/null +++ b/src/jmap/components/fuzhou_01/menusPlan/modifyingPlan.vue @@ -0,0 +1,179 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/menusPlan/modifyingTask.vue b/src/jmap/components/fuzhou_01/menusPlan/modifyingTask.vue new file mode 100644 index 000000000..2b153891a --- /dev/null +++ b/src/jmap/components/fuzhou_01/menusPlan/modifyingTask.vue @@ -0,0 +1,315 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/model.js b/src/jmap/components/fuzhou_01/model.js new file mode 100644 index 000000000..a772b863a --- /dev/null +++ b/src/jmap/components/fuzhou_01/model.js @@ -0,0 +1,70 @@ +/** + * 公共字段部分默认初始值 + */ +const modelPublicInitialValue = { + Signal: { + lampPositionType: '02', + lampPostType: '02' + } +}; + +/** + * 在绘图创建Model数据时,根据皮肤类型修改公共属性默认值 + * @param {Object} model + */ +export function InitPublicProperties(model) { + if (model) { + let modelInitial = modelPublicInitialValue[model._type]; + if (modelInitial) { + for (let prop in modelInitial) { + model[prop] = modelInitial[prop]; + } + } + } + + return model; +} + +/** + * 私有字段部分默认初始值 + */ +const modelPrivateInitialValue = { + StationControl: { + indicatorShow: true //标识灯名称显示 + }, + Section: { + borderBorderShow: true, //区段边界显示 + standTrackNameShow: true, //站台轨名称显示 + reentryTrackNameShow: true, //折返轨名称显示 + transferTrackNameShow: true, //转换轨名称显示 + + }, + Signal: { + linkageAutoRouteShow: true, //联锁自动进路表示灯显示 + atsAutoTriggerShow: true //ATS自动触发表示灯显示 + }, + Train: { + nameFormat: 'targetCode:serviceNumber:tripNumber', //字体格式 + nameFontSize: 10, //字体大小 + }, + TrainWindow: { + trainWindowShow: true, + } +}; + +/** + * 加载Model数据时,根据皮肤类型修改前端私有属性默认值 + * @param {Object} model + */ +export function InitPrivateProperties(model) { + if (model) { + let modelInitial = modelPrivateInitialValue[model._type]; + if (modelInitial) { + for (let prop in modelInitial) { + model[prop] = modelInitial[prop]; + } + } + } + + return model; +} \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/planSchedule/index.vue b/src/jmap/components/fuzhou_01/planSchedule/index.vue new file mode 100644 index 000000000..667fd2ebc --- /dev/null +++ b/src/jmap/components/fuzhou_01/planSchedule/index.vue @@ -0,0 +1,413 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/planSchedule/menuBar.vue b/src/jmap/components/fuzhou_01/planSchedule/menuBar.vue new file mode 100644 index 000000000..8ee4f4a83 --- /dev/null +++ b/src/jmap/components/fuzhou_01/planSchedule/menuBar.vue @@ -0,0 +1,505 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/planSchedule/menuTool.vue b/src/jmap/components/fuzhou_01/planSchedule/menuTool.vue new file mode 100644 index 000000000..d3ecde016 --- /dev/null +++ b/src/jmap/components/fuzhou_01/planSchedule/menuTool.vue @@ -0,0 +1,172 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/planSchedule/schedule.vue b/src/jmap/components/fuzhou_01/planSchedule/schedule.vue new file mode 100644 index 000000000..5329c39c1 --- /dev/null +++ b/src/jmap/components/fuzhou_01/planSchedule/schedule.vue @@ -0,0 +1,491 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/planSchedule/statusBar.vue b/src/jmap/components/fuzhou_01/planSchedule/statusBar.vue new file mode 100644 index 000000000..f85d6c6ce --- /dev/null +++ b/src/jmap/components/fuzhou_01/planSchedule/statusBar.vue @@ -0,0 +1,100 @@ + + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/planSchedule/titleBar.vue b/src/jmap/components/fuzhou_01/planSchedule/titleBar.vue new file mode 100644 index 000000000..689c3486a --- /dev/null +++ b/src/jmap/components/fuzhou_01/planSchedule/titleBar.vue @@ -0,0 +1,75 @@ + + + + \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/shape/Section.js b/src/jmap/components/fuzhou_01/shape/Section.js new file mode 100644 index 000000000..0ca7a705c --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/Section.js @@ -0,0 +1,933 @@ +import Group from 'zrender/src/container/Group'; +import Polyline from 'zrender/src/graphic/shape/Polyline'; +import Circle from 'zrender/src/graphic/shape/Circle'; +import Line from 'zrender/src/graphic/shape/Line'; +import Text from 'zrender/src/graphic/Text'; +import JTriangle from '@/jlmap/util/JTriangle'; +import store from '@/store'; + +/** 计轴*/ +class SectionAxle extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 5; + this._create(model); + } + + _create(model) { + if (model && model.theme && model.traingle) { + let axleLength = 2 * model.theme.sectionAxleR; + let positionx = model.point.x + model.drictx * (model.traingle.GetCos(axleLength)); + let positiony = model.point.y + model.dricty * (model.traingle.GetCos(axleLength)); + + this.line = new Line({ + zlevel: this.zlevel, + z: this.z, + 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.theme.sectionAxleColor + } + }); + this.axle = new Circle({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: positionx - model.dricty * model.traingle.GetSin(axleLength), + cy: positiony + model.drictx * model.traingle.GetSin(axleLength), + r: model.theme.sectionAxleR + }, + style: { + GBaseLineWidth: 1, + stroke: model.theme.sectionAxleColor, + fill: 'rgb(0,0,0,0)' + } + }); + + this.add(this.line); + this.add(this.axle); + } + } +} + +/** 分隔符*/ +class SectionSeparator extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 6; + this._create(model); + } + + _create(model) { + if (model && model.theme) { + this.partition = new Polyline({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + [model.point.x, model.point.y], + [model.point.x, model.point.y] + ] + }, + style: { + lineWidth: model.theme.sectionWidth / 3, + stroke: model.theme.sectionSeparatorColor + } + }); + + this.circle = new Circle({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.point.x, + cy: model.point.y, + r: 2 * model.theme.sectionWidth + }, + style: { + GBaseLineWidth: 1, + stroke: 'red', + fill: model.theme.transparentColor + } + }); + + this.add(this.partition); + this.setType(model.sepType, model.borderBorderShow); + } + } + + setType(type, show) { + let model = this.model; + if (model && model.theme && model.traingle) { + this.remove(this.circle); + if (type === '00') { + this.partition.setShape('points', [ + [model.point.x, model.point.y], + [model.point.x, model.point.y] + ]); + } else if (type === '01') { + this.partition.setShape('points', [ + [model.point.x, model.point.y - (model.theme.sectionWidth * 0.8)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 0.8)] + ]); + } else if (type === '02') { + this.partition.setShape('points', [ + [model.point.x + model.drict * (model.theme.sectionWidth), model.point.y - (model.theme.sectionWidth * 1.5)], + [model.point.x, model.point.y - (model.theme.sectionWidth * 1.5)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 1.5)] + ]); + } else if (type === '03') { + this.partition.setShape('points', [ + [model.point.x + model.drict * (model.theme.sectionWidth + 5), model.point.y - (model.theme.sectionWidth * 1.2)], + [model.point.x, model.point.y - (model.theme.sectionWidth * 1.2)], + [model.point.x, model.point.y + (model.theme.sectionWidth * 1.2)], + [model.point.x + model.drict * (model.theme.sectionWidth + 5), model.point.y + (model.theme.sectionWidth * 1.2)], + ]); + this.partition.setStyle('stroke', '#3F3F3F'); + this.partition.setStyle('lineWidth', model.theme.sectionWidth - 2); + } else if (type === '04') { + this.add(this.circle); + } + } + + if (type === '03' && !show) { + this.partition.hide(); + } else { + this.partition.show(); + } + } +} + + +/** 创建区段限速限集合*/ +class LimitLines 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) { + let swPadding = model.theme.switchLen; //定位和反位时区段距离岔芯的距离 + var switchWidth = model.theme.sectionWidth + model.theme.sectionBeyondWidth; // 道岔宽度 + let beg = Object.assign({}, model.points[0]); + let end = Object.assign({}, model.points[model.points.length - 1]); + if (model.isSwitchSection && beg.y !== end.y) { + let swch = store.getters['map/getDeviceByCode'](model.relSwitchCode); + if (swch) { + let 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, + z: this.z, + position: model.position, + shape: { + x1: beg.x, + y1: beg.y, + x2: end.x, + y2: end.y, + }, + style: { + lineWidth: model.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } else { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + + for (let i = 1; i < (model.points.length - 2); i++) { + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + z: this.z, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } + + this.add(new Line({ + isLine: true, + zlevel: this.zlevel, + z: this.z, + position: model.position, + 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.theme.sectionSpeedLimitLinewidth, + stroke: model.theme.sectionSpeedLimitColor + } + })); + } + } + } +} + +/** 创建区段线集合*/ +class Lines 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) { + for (let i = 0; i < (model.points.length - 1); i++) { + this.add(new Line({ + zlevel: this.zlevel, + z: model.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.theme.sectionWidth, + stroke: model.theme.sectionSpareColor + } + })); + } + } + } + + setStyle(styles) { + this.eachChild((child) => { + for (let prop in styles) { + child.setStyle(prop, styles[prop]); + } + }); + } + + animateStyle(loop, animates) { + if (animates && animates.length) { + this.eachChild((child) => { + let an = child.animateStyle(loop); + animates.forEach(elem => { + an = an.when(elem.time, elem.styles); + }); + an.start(); + }); + } + } + + stopAnimation(flag) { + this.eachChild((child) => { + child.stopAnimation(flag); + }); + } +} + +/** 区段*/ +export default class Section extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = model.layer || 0; + this._create(model); + } + + _create(model) { + //01:物理区段;02逻辑区段;03道岔区段 + this.createSectionText(); //创建区段文字 + if (model.sectionType === '01' && ( + model.logicSectionNum.length <= 0 || + model.logicSectionNum.length == 1 && model.logicSectionNum[0] == 0) || + model.sectionType === '02') { + this.createSection(); //创建区段 + this.createSeparator(); //创建分隔符 + if (model.sectionType === '01') { + this.createAxles(); //创建计轴 + } + this.setStatus(model); + } + } + + /** 创建区段*/ + createSection() { + let model = this.model; + let theme = this.theme; + + //创建区段 + this.section = new Lines({ + zlevel: this.zlevel, + z: this.z, + points: model.points, + theme: theme + }); + + //创建延时释放 + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + this.release = new Line({ + zlevel: model.zlevel + 1, + 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), + }, + style: { + lineWidth: theme.sectionWidth, + stroke: theme.sectionSpareColor + } + }); + this.release.hide(); + + let x = traingle.drictx * (theme.sectionSpeedLimitDistance + theme.sectionWidth / 2) * traingle.GetSinRate(); + let y = traingle.dricty * (theme.sectionSpeedLimitDistance + theme.sectionWidth / 2) * traingle.GetCosRate(); + if (x == Infinity) { x = 0; } + if (y == Infinity) { y = 0; } + + //创建限速线 + this.speedLimitLeft = new LimitLines({ + zlevel: this.zlevel + 4, + z: this.z, + position: [x, -y], + points: model.points, + isSwitchSection: model.isSwitchSection, + relSwitchCode: model.relSwitchCode, + theme: theme, + }); + + this.speedLimitRight = new LimitLines({ + zlevel: this.zlevel + 4, + z: this.z, + position: [-x, y], + points: model.points, + isSwitchSection: model.isSwitchSection, + relSwitchCode: model.relSwitchCode, + theme: theme, + }); + + this.add(this.section); + this.add(this.release); + this.add(this.speedLimitLeft); + this.add(this.speedLimitRight); + } + + /** 创建区段名称*/ + createSectionText() { + let model = this.model; + let theme = this.theme; + + if (model && theme) { + //计算区段坐标位置 + let 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 + model.namePoint.x; + let 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 + model.namePoint.y; + + /**区段名称*/ + if (model.nameShow) { + let tempx = x; + let tempy = y; + + //根据列车上下行进行坐标偏移 + let drict = 1; + if (model.trainPosType === '01') { + drict = -1; + tempy -= (theme.sectionWidth + theme.textFontSize); + } + + if (model.sectionType !== '03') { + //计算文字和物理区段的距离 + //如果不是逻辑区段,让名称和区段保持点距离 + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + if (model.sectionType === '01') { + tempx += traingle.GetSin(theme.nameDistance); + tempy += traingle.GetCos(theme.nameDistance) * drict; + } + } else { + tempy += theme.nameDistance * drict; + } + + //创建区段名称 + this.sectionText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: tempx, + y: tempy, + text: model.name, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.sectionText); + } + + /**站台轨名称*/ + if (model.isStandTrack && model.standTrackNameShow) { + let tempx = x; + let tempy = y; + //根据列车上下行进行坐标偏移 + let drict = 1; + if (model.trainPosType != '01') { + drict = -1; + tempy -= (theme.sectionWidth + theme.textFontSize); + } + + //计算文字和物理区段的距离 + if (model.sectionType !== '02') { + let traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + tempx += traingle.GetSin(theme.nameDistance); + tempy += traingle.GetCos(theme.nameDistance) * drict; + } + + //创建站台轨名称 + this.standTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: tempx + model.standTrackNamePosition.x, + y: tempy + model.standTrackNamePosition.y, + text: model.standTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.standTrackText); + + } + + /**折返轨名称*/ + if (model.isReentryTrack && model.reentryTrackNameShow) { + //创建折返轨名称 + this.reentryTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.reentryTrackNamePosition.x, + y: y + model.reentryTrackNamePosition.y, + text: model.reentryTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.reentryTrackText); + } + + /**转换轨名称*/ + if (model.isTransferTrack && model.transferTrackNameShow) { + //转换轨名称 + this.transferTrackText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.transferTrackNamePosition.x, + y: y + model.transferTrackNamePosition.y, + text: model.transferTrackName, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.textFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.transferTrackText); + } + + /**目的码名称*/ + if (model.destinationCode && model.destinationCodeShow) { + //转换轨名称 + this.destinationText = new Text({ + zlevel: this.zlevel + 3, + z: 6, + style: { + x: x + model.destinationCodePoint.x, + y: y + model.destinationCodePoint.y, + text: model.destinationCode, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.destinationTextFontColor, + textAlign: 'center', + textPosition: 'inside', + } + }); + + //添加视图 + this.add(this.destinationText); + } + } + } + + /** 创建计轴*/ + createAxles() { + let model = this.model; + let theme = this.theme; + + /** 创建四个计轴*/ + let traingle = null; + if (model && theme && model.isShowAxle && model.points && model.points.length > 1) { + traingle = new JTriangle(model.points[0], model.points[1]); + this.lUpAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: -1, + traingle: traingle + }); + this.lBottomAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: 1, + traingle: traingle + }); + + traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); + this.rUpAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: -1, + traingle: traingle + }); + this.rBottomAxle = new SectionAxle({ + theme: theme, + zlevel: this.zlevel, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: 1, + traingle: traingle + }); + + this.add(this.lUpAxle); + this.add(this.rUpAxle); + this.add(this.lBottomAxle); + this.add(this.rBottomAxle); + } + } + + /** 创建分隔符*/ + createSeparator() { + let model = this.model; + let theme = this.theme; + let traingle = null; + + if (model && theme && model.points && model.points.length > 1) { + /** 创建左侧分隔符*/ + traingle = new JTriangle(model.points[0], model.points[1]); + this.lPartition = new SectionSeparator({ + theme: theme, + borderBorderShow: model.borderBorderShow, + zlevel: this.zlevel + 2, + traingle: traingle, + point: { + x: model.points[0].x, + y: model.points[0].y + }, + sepType: model.l.sepType, + drict: -1 + }); + + /** 创建右侧分隔符*/ + traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); + this.rPartition = new SectionSeparator({ + theme: theme, + borderBorderShow: model.borderBorderShow, + zlevel: this.zlevel + 2, + traingle: traingle, + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + sepType: model.r.sepType, + drict: 1 + }); + + /** 添加视图*/ + this.add(this.lPartition); + this.add(this.rPartition); + } + } + + setInvisible() { + let invisible = this.model.sectionType === '02' && this.model.isShowLogical; + this.eachChild((child) => { + child.attr('invisible', invisible); + }); + } + + recover() { + if (this.section) { + this.section.stopAnimation(true); + this.section.setStyle({ + fill: this.theme.backgroundColor, + stroke: this.theme.sectionSpareColor, + lineWidth: this.theme.sectionWidth + }); + + this.release.hide(); + this.speedLimitLeft.hide(); + this.speedLimitRight.hide(); + } + } + + /** 未定义状态*/ + undefine() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionUndefinedColor, + lineWidth: this.theme.sectionWidth + }); + } + } + + /** 空闲状态*/ + spare() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionSpareColor, + lineWidth: this.theme.sectionWidth + }); + } + } + + /** 通信车占用状态*/ + communicationOccupied() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionCommunicationOccupiedColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 非通信车占用状态*/ + unCommunicationOccupied() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionUnCommunicationOccupiedColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 进路锁闭*/ + routeLock() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionRouteLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 封锁*/ + block() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionBlockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** 故障锁定状态*/ + faultLock() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionFaultLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** atc切除状态*/ + atcExcision() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionAtcExcisionColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth, + }); + } + } + + /** ats切除状态*/ + atsExcision() { + if (this.section) { + this.atcExcision(); + this.section.animateStyle(true, [ + { time: 1000, styles: { stroke: this.theme.backgroundColor, } }, + { time: 2000, styles: { stroke: this.theme.sectionAtsExcisionColor, lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth } } + ]); + } + } + + /** 保护区段锁闭*/ + protectiveLock() { + if (this.section) { + this.section.setStyle({ + stroke: this.theme.sectionProtectiveLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + } + } + + /** 延时释放*/ + timeRelease() { + if (this.release) { + this.section.setStyle({ + stroke: this.theme.sectionRouteLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + this.release.show(); + this.release.setStyle('lineWidth', this.theme.sectionWidth + this.theme.sectionBeyondWidth); + this.release.setStyle('stroke', this.theme.sectionRouteLockColor); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.sectionRouteLockColor }) + .when(2000, { stroke: this.theme.sectionTimeReleaseColor }) + .start(); + } + } + + /** 保护区段延时解锁*/ + protectiveTimeRelease() { + if (this.release) { + this.section.setStyle({ + stroke: this.theme.sectionProtectiveLockColor, + lineWidth: this.theme.sectionWidth + this.theme.sectionBeyondWidth + }); + this.release.show(); + this.release.setStyle('lineWidth', this.theme.sectionWidth + this.theme.sectionBeyondWidth); + this.release.setStyle('stroke', this.theme.sectionProtectiveLockColor); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.sectionProtectiveLockColor }) + .when(2000, { stroke: this.theme.sectionProtectiveTimeReleaseColor }) + .start(); + } + } + + /** 区段切除*/ + sectionCutOff() { + if (this.release) { + let lineWidth = this.theme.sectionWidth + (this.model.status != '01' ? this.theme.sectionBeyondWidth : 0); + this.section.animateStyle(true, [ + { time: 0, styles: { lineWidth: lineWidth } }, + { time: 1000, styles: { stroke: this.theme.backgroundColor, } }, + { time: 2000, styles: { lineWidth: lineWidth } }, + ]); + } + } + + /** 设置限速*/ + setSpeedUpperLimit() { + if (this.section) { + this.speedLimitLeft.show(); + this.speedLimitRight.show(); + } + } + + /** 计轴预复位*/ + axleReset() { + if (this.release) { + this.release.show(); + this.release.setStyle({ + stroke: this.theme.sectionAxleResetColor + }); + } + } + + /** 设置状态*/ + setStatus(model) { + this.recover(); + 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(); + } + } + + + /** 区段切除*/ + if (model.cutOff) { + this.sectionCutOff(); + } + + /** 是否限速*/ + if (model.speedUpperLimit >= 0) { + this.setSpeedUpperLimit(); + } + } + + /** 计算提示位置*/ + getShapeTipPoint() { + let rect = this.getBoundingRect(); + let distance = this.theme.sectionWidth / 2; + if (this.section) { + rect = this.section.getBoundingRect(); + if (this.model.sectionType !== '02' && this.model.nameShow) { + if (this.model.trainPosType == '01') { + distance = distance + this.theme.nameDistance + this.theme.textFontSize; + } + } + } + + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2.7 - distance + }; + } +} diff --git a/src/jmap/components/fuzhou_01/shape/Signal.js b/src/jmap/components/fuzhou_01/shape/Signal.js new file mode 100644 index 000000000..c17978b73 --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/Signal.js @@ -0,0 +1,730 @@ +/* +* 信号机 +*/ +import Line from 'zrender/src/graphic/shape/Line'; +import Text from 'zrender/src/graphic/Text'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import Polyline from 'zrender/src/graphic/shape/Polyline'; +import Arc from 'zrender/src/graphic/shape/Arc'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Group from 'zrender/src/container/Group'; +import { arrows, triangular } from './libs/ShapePoints'; + +class Lamp extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + this.lamp = new Arc({ + name: model.index, + zlevel: this.zlevel + 1, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: model.theme.signalR + }, + style: { + fill: model.theme.backgroundColor, + lineWidth: 0.8, + stroke: model.theme.signalLampStandardColor + } + }); + + let shapeDate; + if (model.highType === '01') { + // 矮柱 + if (model.drict != 1) { + // 左侧 + shapeDate = { + x: model.origin.x + model.drict * model.lampCount * 2 * model.theme.signalR - 2.5, + y: model.origin.y + model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } else { + shapeDate = { + x: model.origin.x - model.drict + 1.5, + y: model.origin.y - model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } + } else { + // 高柱 + if (model.drict != 1) { + // 左侧 + shapeDate = { + x: model.origin.x + model.drict * model.lampCount * 2 * model.theme.signalR - 2.5 - 3, + y: model.origin.y + model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } else { + shapeDate = { + x: model.origin.x - model.drict + 1.5 + 3, + y: model.origin.y - model.drict * model.theme.signalR - 1, + width: model.theme.signalR * 2 * model.lampCount + 2, + height: model.theme.signalR * 2 + 2 + }; + } + } + + this.lampRect = new Rect({ + zlevel: this.zlevel - 1, + z: this.z, + shape: shapeDate, + style: { + lineWidth: 0.4, + stroke: 'red', + } + }); + + this.lstop = new Line({ + zlevel: this.zlevel + 1, + z: this.z, + origin: model.origin, + rotation: -Math.PI / 180 * model.rotate, + shape: { + x1: model.position.x + (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y1: model.position.y + (model.theme.signalR + 1) * Math.sin(Math.PI / 4), + x2: model.position.x - (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y2: model.position.y - (model.theme.signalR + 1) * Math.sin(Math.PI / 4) + }, + style: { + lineWidth: 1, + stroke: model.theme.backgroundColor, + } + }); + + this.rstop = new Line({ + zlevel: this.zlevel + 1, + z: this.z, + origin: model.origin, + rotation: -Math.PI / 180 * model.rotate, + shape: { + x1: model.position.x + (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y1: model.position.y + (model.theme.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)), + x2: model.position.x - (model.theme.signalR + 1) * Math.cos(Math.PI / 4), + y2: model.position.y - (model.theme.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)) + }, + style: { + lineWidth: 1, + stroke: model.theme.backgroundColor, + } + }); + this.add(this.lamp); + } + + setColor(color) { + if (color) { + this.lamp.setStyle('fill', color); + } + } + + // 两条交叉黑线 + setStop(has) { + if (has) { + this.add(this.lstop); + this.add(this.rstop); + } else { + this.remove(this.lstop); + this.remove(this.rstop); + } + } + + // 功能封锁矩形框 + setRectBlock(has) { + if (has) { + this.lampRect.attrKV('rotation', -Math.PI / 180 * this.model.rotate); + this.lampRect.attrKV('origin', [this.model.origin.x, this.model.origin.y]); + this.add(this.lampRect); + } else { + this.remove(this.lampRect); + } + } +} + +// 自动进路箭头 +class AutoSig extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + let rotation = Math.PI; + if (model.drict != 1) { + // 右侧 + rotation = 0; + } + + let x = model.position.x - model.drict * (model.lampCount * model.theme.signalR + 1) * 2; + let y = model.position.y - model.theme.signalR / 2; + // 箭头 + this.arrowsControl = new Polygon({ + zlevel: this.zlevel, + rotation: rotation, + origin: [x, y], + shape: { + points: arrows(x, y, model.theme.stationControlDistance / 8, model.theme.signalR * 1.3) + }, + style: { + stroke: model.theme.sidelineColor, + lineWidth: 0.6, + fill: model.theme.signalLampGreenColor + } + }); + this.add(this.arrowsControl); + } + + // 停止动画 + animationRecover() { + this.arrowsControl.stopAnimation(false); + } + + // 箭头颜色 + setColor(color) { + if (color) { + this.arrowsControl.setStyle('fill', color); + } + } + + // 箭头闪烁 + arrowsAnimation() { + let fill = this.arrowsControl.style.fill; + let theme = this.model.theme; + this.arrowsControl.animate('style', true) + .when(1000, { fill: theme.backgroundColor, stroke: theme.backgroundColor }) + .when(2000, { fill: fill, stroke: theme.sidelineColor }) + .when(3000, { fill: theme.backgroundColor, stroke: theme.backgroundColor }) + .when(4000, { fill: fill, stroke: theme.sidelineColor }) + .start(); + } +} + +// 运行方向三角 +class JSigDrict extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this._create(model); + } + + _create(model) { + this.sigDrict = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: triangular(model.position.x, model.position.y + model.drict * model.theme.signalR * 0.8, model.drict, model.theme.signalR) + }, + style: { + stroke: model.theme.backgroundColor, + lineWidth: 0.5, + fill: model.theme.signalLampYellowColor + } + }); + this.add(this.sigDrict); + } +} + +// 信号灯 几灯、高柱等 +class JSiglamp extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 10; + this.lamps = new Group(); + this._subType = 'SignalLamp'; + this._val = '3'; /** 信号机*/ + this._create(model); + } + + _create(model) { + this.text = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x + model.namePosition.x, + y: model.position.y + model.posit * (model.theme.signalR + model.namePosition.y), + text: model.name, + textAlign: 'middle', + textVerticalAlign: model.posit === 1 ? 'top' : 'bottom', + textFont: model.theme.textFontSize + 'px ' + model.theme.textFontFormat, + textFill: model.theme.textFontColor, + textBorderColor: model.theme.signalBlockColor, + textBorderWidth: 0 + } + }); + + this.ver = new Polyline({ + zlevel: this.zlevel - 2, + z: this.z, + shape: { + points: [ + [model.position.x, model.position.y + model.theme.signalR * 3 / 2], + [model.position.x, model.position.y - model.theme.signalR * 3 / 2] + ] + }, + style: { + lineWidth: model.theme.sectionWidth / 3, + stroke: model.theme.signalLampStandardColor + } + }); + + this.hor = new Polyline({ + zlevel: this.zlevel - 1, + z: this.z, + shape: { + points: [ + [model.position.x, model.position.y], + [model.position.x + model.drict * model.theme.signalR * 3 / 2, model.position.y] + ] + }, + style: { + lineWidth: model.theme.sectionWidth / 3, + stroke: model.theme.signalLampStandardColor + } + }); + + this.add(this.lamps); + this.setShowName(model.isShowName); + this.setShowHighSigType(model.highType); + + //旋转 + if (model.rotate) { + this.transformRotation(this.ver); + this.transformRotation(this.hor); + } + } + + setShowName(isShow) { + if (isShow) this.add(this.text); else this.remove(this.text); + } + + // 显示信号灯名称边框 + setNameBorder(width) { + this.text.setStyle('textBorderWidth', width); + } + + // 显示信号灯名称颜色 + setNameColor(color) { + this.text.setStyle('textFill', color); + } + + setShowHighSigType(type) { + this.lamps.removeAll(); + let model = this.model; + this.add(this.ver); + if (type === '01') this.remove(this.hor); else this.add(this.hor); + let highPosition = this.getEndPosition(model.highType); + for (let i = 0; i < model.lampCount; i++) { + let lamp = new Lamp({ + theme: model.theme, + zlevel: this.zlevel, + lampCount: model.lampCount, + position: { + x: highPosition.x + i * model.drict * model.theme.signalR * 2, + y: highPosition.y + }, + index: i + 1, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + drict: model.drict, + highType: model.highType, + }); + this.lamps.add(lamp); + } + + this.sigDriction = new JSigDrict({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: model.position.x - model.drict * model.theme.signalR / 4, + y: model.position.y + }, + drict: model.drict, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + }); + + this.autoSig = new AutoSig({ + theme: model.theme, + zlevel: this.zlevel, + position: { + x: highPosition.x, + y: highPosition.y + }, + lampCount: model.lampCount, + drict: model.drict, + origin: { + x: model.position.x, + y: model.position.y + }, + rotate: model.rotate, + }); + + //旋转 + if (model.rotate) { + this.transformRotation(this.sigDriction); + this.transformRotation(this.autoSig); + this.transformRotation(this.lamps); + } + } + + // 整体旋转信号灯 + transformRotation(item) { + if (this.model.rotate) { + let origin = [this.model.position.x, this.model.position.y]; + let rotation = -Math.PI / 180 * Number(this.model.rotate); + item.origin = origin; + item.rotation = rotation; + item.dirty(); + } + } + + setColorByIndex(index, color) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setColor(color); + return; + } + } + } + + setStopByIndex(index, has) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setStop(has); + return; + } + } + } + + setRectBlockByIndex(index, has) { + for (let i = 0; i < this.model.lampCount; i++) { + if (this.lamps.childAt(i).model.index === index) { + this.lamps.childAt(i).setRectBlock(has); + return; + } + } + } + + setAnimation() { + this.autoSig.arrowsAnimation(); + } + + setRecover() { + this.autoSig.animationRecover(); + } + + setColorSig(color) { + this.autoSig.setColor(color); + } + + getEndPosition(type) { + if (type === '01') { + return { + x: this.model.position.x + this.model.drict * this.model.theme.signalR * 3 / 2, + y: this.model.position.y + }; + } else { + return { + x: this.hor.shape.points[1][0] + this.model.drict * this.model.theme.signalR, + y: this.hor.shape.points[1][1] + }; + } + } + + setShowSigDrict(showSigDrict) { + if (showSigDrict) this.add(this.sigDriction); else this.remove(this.sigDriction); + } + + setAutoSig(isShow) { + if (isShow) this.add(this.autoSig); else this.remove(this.autoSig); + } + + getShapeTipPoint() { + if (this.lamps) { + this.lamps.dirty(); + let x1 = this.model.drict * (this.model.theme.signalR * 2.5); + let y1 = this.model.drict * (this.model.theme.signalR * 1.2); + let model = { + x: this.model.position.x + x1 * Math.cos(Number(this.model.rotate)) - y1 * Math.sin(Number(this.model.rotate)), + y: this.model.position.y + x1 * Math.sin(Number(this.model.rotate)) + y1 * Math.cos(Number(this.model.rotate)) + }; + + return model; + } + return null; + } +} + +export default class Signal extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.lampCount = parseInt(model.lampPositionType); + this._create(model, theme); + } + + _create(model, theme) { + var drict = model.directionType === '01' ? -1 : 1; + var posit = model.positionType === '01' ? -1 : 1; + // 信号灯文字说明 + this.siglamp = new JSiglamp({ + theme: theme, + zlevel: this.zlevel, + position: { + x: model.position.x, + y: model.position.y + posit * theme.signalDistance + }, + drict: drict, + posit: posit, + name: model.name, + namePosition: model.namePosition, + isShowName: model.nameShow, + highType: model.lampPostType, + lampCount: parseInt(model.lampPositionType), + showSigDrict: this.showSigDrict, + pop: true, + rotate: model.rotate, + }); + this.add(this.siglamp); + + this.setShowButton(model); + this.setButtonStatus(model); + this.setStatus(model); + } + + setShowSigDrict(isShow) { + this.siglamp.setShowSigDrict(isShow); + } + + setAutoSig(isShow) { + this.siglamp.setAutoSig(isShow); + } + + setShowHighSigType(hightp) { + if (this.siglamp) { + this.highType = hightp; + this.siglamp.setShowHighSigType(hightp); + } + } + + setShowButton(model) { + if (model.buttonShow) { + this.add(this.sigButton); + } else { + this.remove(this.sigButton); + } + } + + setButtonStatus(model) { + if (this.sigButton) { + this.sigButton.setButtonStatus(model.buttonStatus); + } + } + + isPop(e) { + for (var i = 0; i < this.childCount(); i++) { + let rect = this.childAt(i).getBoundingRect(); + if (rect.contain(e.offsetX, e.offsetY) && this.childAt(i).pop) { + return true; + } + } + } + + //关闭 (红灯-缺省值) + close() { + if (this.lampCount === 2 && this.model.lightType === '01') { /** 双灯 物理点灯 */ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setColorByIndex(2, this.theme.backgroundColor); + } else if (this.lampCount === 2 && this.model.lightType === '02') { /** 双灯 逻辑点灯*/ + this.siglamp.setStopByIndex(1, true); + this.siglamp.setStopByIndex(2, true); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setColorByIndex(2, this.theme.backgroundColor); + } else if (this.lampCount === 1 && this.model.lightType === '01') { /** 单灯 物理点灯 */ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + } else if (this.lampCount === 1 && this.model.lightType === '02') { /** 单灯 逻辑点灯*/ + this.siglamp.setStopByIndex(1, true); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + } + } + + //开放 + open() { + if (this.lampCount === 2 && this.model.lightType === '01' && this.model.switchLocateType === '01') { /** 双灯 物理点灯 道岔定位*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampGreenColor); + this.siglamp.setColorByIndex(2, this.theme.backgroundColor); + } else if (this.lampCount === 2 && this.model.lightType === '02' && this.model.switchLocateType === '01') { /** 双灯 逻辑点灯 道岔定位*/ + this.siglamp.setStopByIndex(1, true); + this.siglamp.setStopByIndex(2, true); + this.siglamp.setColorByIndex(1, this.theme.signalLampGreenColor); + this.siglamp.setColorByIndex(2, this.theme.backgroundColor); + } else if (this.lampCount === 2 && this.model.lightType === '01' && this.model.switchLocateType === '02') { /** 双灯 物理点灯 道岔反位*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, this.theme.backgroundColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampYellowColor); + } else if (this.lampCount === 2 && this.model.lightType === '02' && this.model.switchLocateType === '02') { /** 双灯 逻辑点灯 道岔反位*/ + this.siglamp.setStopByIndex(1, true); + this.siglamp.setStopByIndex(2, true); + this.siglamp.setColorByIndex(1, this.theme.backgroundColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampYellowColor); + } else if (this.lampCount === 1 && this.model.lightType === '01' && this.model.switchLocateType === '02') { /** 单灯 物理点灯 允许调车*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampWhiteColor); + } + } + + //引导 + guid() { + if (this.lampCount === 2 && this.model.lightType === '01') { /** 双灯 物理点灯 允许引导信号*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampYellowColor); + } + } + + //封锁 + block() { + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setNameBorder(1); + } + + //功能封锁 + functionBlock() { + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setRectBlockByIndex(1, true); + } + + //信号保护区段监视状态显示 + signalblock() { + this.siglamp.setColorByIndex(1, this.theme.signalLampRedColor); + this.siglamp.setNameColor(this.theme.signalLampGreenColor); + } + + //故障 + fault() { + if (this.lampCount === 2 && this.model.lightType === '01') { /** 双灯 物理点灯*/ + this.siglamp.setStopByIndex(1, false); + this.siglamp.setStopByIndex(2, false); + this.siglamp.setColorByIndex(1, this.theme.signalLampBlueColor); + this.siglamp.setColorByIndex(2, this.theme.signalLampBlueColor); + } + } + + //设置自动进路模式状态类型 + setAutoRouteOpen() { + if (this.model.linkageAutoRouteShow) { + this.siglamp.setAutoSig(true); + } else { + this.siglamp.setAutoSig(false); + } + + this.siglamp.setRecover(); + this.siglamp.setColorSig(this.theme.signalLampGreenColor); + } + + //信号机进路自动触发模式状态类型 + setAutoAccessOpen() { + if (this.model.atsAutoTriggerShow) { + this.siglamp.setAutoSig(true); + } else { + this.siglamp.setAutoSig(false); + } + + this.siglamp.setRecover(); + this.siglamp.setColorSig(this.theme.signalLampYellowColor); + } + + //设置自动信号模式状态类型 + setAutoSignalOpen() { + this.siglamp.setShowSigDrict(true); + } + + //隐藏自动信号和自动进路 + setAutoClose() { + this.siglamp.setColorSig(this.theme.backgroundColor); + this.siglamp.setAutoSig(false); + this.siglamp.setShowSigDrict(false); + } + + //自动信号和自动进路开始动画 + setAutoFlicker() { + this.siglamp.setAnimation(); + } + + //恢复状态 + recover() { + this.siglamp.setNameBorder(0); + this.siglamp.setRecover(); + } + + setStatus(model) { + this.recover(); + /** 设置状态 (点灯类型)*/ + switch (model.status) { + case '01': { this.close(); } break; //关闭 + case '02': { this.open(); } break; //开放 + case '03': { this.guid(); } break; //引导 + case '04': { this.block(); } break; //封锁 + case '05': { this.fault(); } break; //故障 + case '06': { this.block(); } break; //功能封锁 + case '07': { this.signalblock(); } break; //信号保护区段检测 + } + + /** 设置自动类型*/ + switch (model.autoType) { + case '01': { this.setAutoClose(); } break; // 隐藏 隐藏自动信号和自动进路 + case '02': { this.setAutoSignalOpen(); } break; // 显示 设置自动信号模式状态类型 + case '03': { this.setAutoRouteOpen(); } break; // 显示 设置自动进路模式状态类型 + case '04': { this.setAutoAccessOpen(); } break; // 显示 信号机进路自动触发模式状态类型 + } + + /** 信号机进路办理,先停止动画,再判断当前颜色是否闪烁*/ + if (model.routeSetting && (model.autoType == '03' || model.autoType == '04')) { + this.setAutoFlicker(); + } + } + + getShapeTipPoint(val) { + if (val === '1' || val === '2') { + return this.sigButton.getShapeTipPoint(val); + } else { + return this.siglamp.getShapeTipPoint(val); + } + } + +} + diff --git a/src/jmap/components/fuzhou_01/shape/Station.js b/src/jmap/components/fuzhou_01/shape/Station.js new file mode 100644 index 000000000..1a1ef4dc8 --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/Station.js @@ -0,0 +1,70 @@ +/* +* 车站 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; + +export default class Station extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + if (model.visible) { + this.mileageText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.point.x, + y: model.point.y - 15, + text: model.kmPost, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.kmPostFont || '8px ' + theme.textFontFormat, + textFill: model.kmPostColor + } + }); + this.stationText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.point.x, + y: model.point.y, + text: model.name, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.nameFont || '14px ' + theme.textFontFormat, + textFill: model.nameColor + } + }); + this.add(this.mileageText); + this.add(this.stationText); + this.setShowMileageText(model.kmPostShow); + this.setStatus(model); + } + } + + setShowMileageText(show) { + if (show) { + this.mileageText.show(); + } else { + this.mileageText.hide(); + } + } + + setStatus() { + } + + getShapeTipPoint() { + return null; + } +} diff --git a/src/jmap/components/fuzhou_01/shape/StationControl.js b/src/jmap/components/fuzhou_01/shape/StationControl.js new file mode 100644 index 000000000..f5839e470 --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/StationControl.js @@ -0,0 +1,229 @@ +/* +* 控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +import Text from 'zrender/src/graphic/Text'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import Group from 'zrender/src/container/Group'; +import { arrows } from './libs/ShapePoints'; + +// 控制(单灯) +class SingleControl extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = 20; + this._create(model); + } + + _create(model) { + var _subType = 'ControlSignal'; + var _val = '0'; + if (model.pop) { + _subType = 'ControlButton'; + _val = '1'; + } + this.control = new Arc({ + pop: model.pop, + _subType: _subType, + _val: _val, + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.point.x, + cy: model.point.y, + r: model.theme.stationControlmodeR + }, + style: { + lineWidth: 1, + fill: model.theme.stationControlGrayColor, + stroke: model.theme.sidelineColor + } + }); + + 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.theme.stationControlmodeR + model.theme.nameDistance, + text: model.context, + textFill: model.theme.textFontColor, + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: model.theme.stationControlTextSize + 'px ' + model.theme.textFontFormat + } + }); + + this.add(this.control); + this.add(this.text); + this.setNameShow(this.model.nameShow); + } + + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + + setTextColor(color) { + if (color) { + this.text.setStyle('textFill', color); + } + } + + setNameShow(show) { + if (show) { + this.text.show(); + } else { + this.text.hide(); + } + } +} + +export default class StationControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 20; + this.model = model; + this.theme = theme; + this._create(model); + } + + _create(model) { + // 中控 + this.centerControl = new SingleControl({ + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x - this.theme.stationControlDistance / 2, + y: model.position.y + }, + context: model.zokContent, + nameShow: model.indicatorShow, + pop: false + }); + + // 站控 + this.substationControl = new SingleControl({ + theme: this.theme, + zlevel: this.zlevel, + point: { + x: model.position.x + this.theme.stationControlDistance / 2, + y: model.position.y + }, + context: model.zakContent, + nameShow: model.indicatorShow, + pop: false + }); + + // 箭头 + let point = arrows(model.position.x, model.position.y + this.theme.stationControlmodeR / 2, this.theme.stationControlDistance / 6, this.theme.stationControlmodeR * 0.8); + this.arrowsControl = new Polygon({ + zlevel: this.zlevel, + shape: { + points: point + }, + style: { + stroke: this.theme.sidelineColor, + fill: this.theme.stationControlGrayColor, + lineWidth: 1 + }, + cursor: 'pointer', + // 图形元素上绑定事件 + onmouseover: () => { + if (model.status == '03') { + this.add(this.arrowText); + } + }, + onmouseout: () => { + if (model.status == '03') { + this.remove(this.arrowText); + } + }, + }); + + // 文字描述 + this.arrowText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x + 10, + y: model.position.y + 20, + text: '与中心通讯中断!', + textFill: this.theme.backgroundColor, + textAlign: 'letf', + textVerticalAlign: 'top', + textFont: 10 + 'px ', + textBackgroundColor: this.theme.tipBackgroundColor, + } + }); + + this.add(this.centerControl); + this.add(this.substationControl); + this.add(this.arrowsControl); + this.setStatus(model); + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + this.substationControl.setTextColor(this.theme.stationControlGrayColor); + this.centerControl.setTextColor(this.theme.stationControlGrayColor); + this.substationControl.setControlColor(this.theme.stationControlGrayColor); + this.centerControl.setControlColor(this.theme.stationControlGrayColor); + } break; + case '01': { //中控(缺省值) + this.substationControl.setTextColor(this.theme.stationControlGrayColor); + this.centerControl.setTextColor(this.theme.stationControlGreenColor); + this.substationControl.setControlColor(this.theme.stationControlGrayColor); + this.centerControl.setControlColor(this.theme.stationControlGreenColor); + this.arrowsControl.setStyle('fill', this.theme.stationControlGrayColor); + } break; + case '02': { //站控且允许转为中控 + this.substationControl.setTextColor(this.theme.stationControlYellowColor); + this.centerControl.setTextColor(this.theme.stationControlGrayColor); + this.substationControl.setControlColor(this.theme.stationControlYellowColor); + this.centerControl.setControlColor(this.theme.stationControlGrayColor); + this.arrowsControl.setStyle('fill', this.theme.stationControlGreenColor); + } break; + case '03': { //站控且不允许转为中控 + this.substationControl.setTextColor(this.theme.stationControlYellowColor); + this.centerControl.setTextColor(this.theme.stationControlGrayColor); + this.substationControl.setControlColor(this.theme.stationControlYellowColor); + this.centerControl.setControlColor(this.theme.stationControlGrayColor); + this.arrowsControl.setStyle('fill', this.theme.stationControlGrayColor); + } 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; + } + } + } + + 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/components/fuzhou_01/shape/StationCounter.js b/src/jmap/components/fuzhou_01/shape/StationCounter.js new file mode 100644 index 000000000..83dc9fbf2 --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/StationCounter.js @@ -0,0 +1,84 @@ +/* +* 计数器 +*/ +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, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 30; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + this.counter = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y, + text: model.val, + textFill: theme.stationCounterTextColor, + textAlign: 'middle', + textStrokeWidth: 1, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + } + }); + + 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: theme.stationCounterBorderColor + } + }); + + 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 + theme.textFontSize + theme.nameDistance, + text: model.name, + textFill: theme.stationCounterTextColor, + textAlign: 'middle', + textVerticalAlign: 'top', + textStrokeWidth: 1, + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + } + }); + this.add(this.counterName); + this.add(this.table); + this.add(this.counter); + this.setStatus(model); + } + + setStatus() { + } + + getShapeTipPoint() { + return null; + } +} + diff --git a/src/jmap/components/fuzhou_01/shape/StationDelayUnlock.js b/src/jmap/components/fuzhou_01/shape/StationDelayUnlock.js new file mode 100644 index 000000000..c931401f6 --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/StationDelayUnlock.js @@ -0,0 +1,121 @@ +/* +* 延迟解锁 +*/ +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, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.model = model; + this.theme = theme; + this.z = 1; + this._create(model, theme); + } + + _create(model, theme) { + this.text = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y, + text: model.deviceName + ' ', + textFill: theme.stationDelayUnlockTextColor, + textStrokeWidth: 1, + textFont: model.textFont + 'px ' + theme.textFontFormat, + textAlign: 'left' + } + }); + + let fontSize = parseInt(model.textFont.split(' ')[0]) || 30; + this.time = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + fontSize + theme.stationDelayUnlockDistance, + text: model.remainTime || '', + textFill: theme.stationDelayUnlockTextColor, + textStrokeWidth: 1, + textFont: model.textFont + 'px ' + theme.textFontFormat, + 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 - 1, + z: this.z, + 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: theme.stationDelayUnlockBorderColor, + fill: theme.backgroundColor + } + }); + this.add(this.table); + + this.setStatus(model); + } + + /** 延时解锁关闭*/ + delayClose() { + this.time.setStyle('text', ''); + this.text.setStyle('text', ''); + this.table.setStyle('stroke', this.theme.backgroundColor); + } + + /** 延时解锁计数*/ + delayUnlock() { + this.table.setStyle('stroke', 'white'); + this.time.setStyle('text', '' + this.model.remainTime); + } + + // animation() { + // this.table.setStyle('stroke', 'white'); + // this.time.setStyle('text', '' + this.model.delayTime); + + // this.counter = this.model.delayTime; + // this.timer = setInterval(() => { + // if (this.counter <= 0) { + // this.counter = ''; + // clearInterval(this.timer); + // this.timer = null; + // this.close(); + // } else { + // this.counter -= 1; + // } + // this.time.setStyle('text', '' + this.counter); + // }, 1000); + + // } + + setStatus(model) { + switch (model.status) { + case '01': { this.delayClose(); } break; //关闭 + case '02': { this.delayUnlock(); } break; //延迟解锁 + } + } + + getShapeTipPoint() { + return null; + } +} diff --git a/src/jmap/components/fuzhou_01/shape/StationStand.js b/src/jmap/components/fuzhou_01/shape/StationStand.js new file mode 100644 index 000000000..86b35a3ad --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/StationStand.js @@ -0,0 +1,480 @@ +/* +* 站台 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Isogon from 'zrender/src/graphic/shape/Isogon'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import { flashlight } from './libs/ShapePoints'; + +export default class StationStand extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.model = model; + this.theme = theme; + this._create(model, theme); + } + + _create(model, theme) { + this.stationStand = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x - model.width / 2, + y: 0, + width: model.width, + height: model.height + }, + style: { + lineWidth: 0, + stroke: this.theme.sidelineColor, + fill: this.theme.stationStandSpareColor + } + }); + + /** 站台折返策略*/ + let beyond = 4; + let height = 5; + let width = 10; + let offsetx = (model.width - width / 2); + let offsety = (model.height + height + this.theme.stationStandDistance) / 2; + let drict = model.doorLocationType == '01' ? 1 : -1; + + this.reentry = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: flashlight(model.position.x, model.position.y, drict, width, height, offsetx, offsety, beyond) + }, + style: { + lineWidth: 0, + fill: this.theme.stationStandNoHumanReentryColor + } + }); + this.add(this.reentry); + + /** 站台扣车*/ + let distance = 0; + this.text = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: [0, 0], + style: { + x: model.position.x - ((model.width + theme.stationStandHeadFontSize) / 2 + distance), + y: 0, + text: 'H', + textAlign: 'middle', + textVerticalAlign: 'top', + fontSize: theme.stationStandHeadFontSize + 'px ' + theme.textFontFormat, + textFill: theme.stationStandCenterDetainTrainColor, + textStroke: theme.backgroundColor, + } + }); + this.add(this.text); + + let textLevelT = [0, 12]; + if (model.doorLocationType == '01') { + textLevelT = [0, -3]; + } + // 停站时间 + this.time = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: textLevelT, + style: { + x: model.position.x + (model.width / 2 + theme.textFontSize + distance), + y: 0, + text: model.parkingTime, + textFill: theme.stationStandTimeTextColor, + textAlign: 'middle', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat + } + }); + this.add(this.time); + + let textLevelP = [0, 1]; + if (model.doorLocationType == '01') { + textLevelP = [0, 20]; + } + // 区间运行时间 + this.level = new Text({ + zlevel: this.zlevel, + z: this.z + 2, + position: textLevelP, + style: { + x: model.position.x + (model.width / 2 + theme.textFontSize + distance), + y: model.position.y, + text: model.intervalRunTime, + textFill: theme.stationStandTimeTextColor, + textAlign: 'middle', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat + } + }); + this.add(this.level); + + /** 站台紧急关闭*/ + this.emergent = new Isogon({ + zlevel: this.zlevel, + z: this.z, + shape: { + x: model.position.x, + y: 0, + r: theme.stationStandDistance / 2, + n: 4, + }, + style: { + lineWidth: 0, + stroke: theme.stationStandEmergentCloseColor, + fill: theme.stationStandEmergentCloseColor + } + }); + this.add(this.emergent); + + /** 屏蔽门*/ + let padding = 1; + let safeHeight = 4; + // let safeR = [theme.stationStandDistance, theme.stationStandDistance]; + this.safeDoorL = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + // r: safeR, + x: model.position.x - model.width / 2 - padding, + y: model.position.y, + width: model.width / 3 + padding, + height: safeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.safeDoorC = new Rect({ + zlevel: this.zlevel, + z: this.z + 1, + shape: { + x: model.position.x - model.width / 6 - padding, + y: model.position.y, + width: model.width / 3 + padding * 2, + height: safeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.safeDoorR = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + // r: safeR, + x: model.position.x + model.width / 6, + y: model.position.y, + width: model.width / 3 + padding, + height: safeHeight + }, + style: { + lineWidth: 0, + stroke: theme.stationStandDoorDefaultColor, + fill: theme.stationStandDoorDefaultColor + } + }); + + this.setDrict(model.doorLocationType); + this.setHasSafeDoor(model.hasDoor); + this.setVisible(model.visible); + this.setStatus(model); + } + + setDrict(doorLocationType) { + let model = this.model; + let theme = this.theme; + if (doorLocationType === '01') { + let distance = model.position.y + theme.stationStandDistance * 3 / 2; + this.text.setStyle('y', distance + model.height / 2 - theme.stationStandHeadFontSize / 2); + this.time.setStyle('y', distance + model.height - theme.textFontSize); + this.level.setStyle('y', distance - model.height + theme.textFontSize / 1.2); + this.emergent.setShape('y', distance - theme.stationStandDistance / 2); + this.stationStand.setShape('y', distance); + } else { + let distance = model.position.y - theme.stationStandDistance; + this.text.setStyle('y', distance - model.height / 2 - theme.stationStandHeadFontSize / 2); + this.time.setStyle('y', distance - model.height + theme.textFontSize); + this.level.setStyle('y', distance - model.height - theme.textFontSize / 2); + this.emergent.setShape('y', distance + theme.stationStandDistance / 2); + this.stationStand.setShape('y', distance - model.height); + } + this.add(this.stationStand); + } + + setHasSafeDoor(hasDoor) { + if (hasDoor) { + this.add(this.safeDoorL); + this.add(this.safeDoorC); + this.add(this.safeDoorR); + } else { + this.remove(this.safeDoorL); + this.remove(this.safeDoorC); + this.remove(this.safeDoorR); + } + } + + setVisible(visible) { + if (visible) { + this.eachChild((it) => { + it.show(); + }); + } else { + this.eachChild((it) => { + it.hide(); + }); + } + } + + //恢复初始状态 + recover() { + this.time.hide(); + this.level.hide(); + this.text.hide(); + this.emergent.hide(); + this.reentry.hide(); + if (this.model.visible) { this.safeDoorC.show(); } + this.safeDoorL.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandDoorDefaultColor); + } + + //空闲 + spare() { + this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + } + + //列车停站 + stop() { + this.stationStand.setStyle('fill', this.theme.stationStandStopColor); + } + + //指定列车跳站 + designatedJumpStop() { + this.stationStand.setStyle('fill', this.theme.stationStandDesignatedJumpStopColor); + } + + //站台紧急关闭 + emergentClose() { + this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.emergent.show(); + } + + //未设置跳停 + unJumpStop() { + } + + //站台跳停 + jumpStop() { + this.stationStand.setStyle('fill', this.theme.stationStandJumpStopColor); + } + + //未设置扣车 + unDetainTrain() { + this.text.hide(); + } + + //车站扣车 + standDetainTrain() { + // this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.text.show(); + this.text.setStyle('textFill', this.theme.stationstandDetainTrainTextColor); + } + + //中心扣车 + centerDetainTrain() { + // this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.text.show(); + this.text.setStyle('textFill', '#fff'); + } + + //中心+车站扣车 + standAndCenterDetainTrain() { + // this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.text.show(); + } + + //人工设置停战时间 + setManuallyArmisticeTime(val) { + this.time.show(); + this.time.attr({ + style: { + text: val + }, + }); + } + + //人工设置运行等级 + setManuallyOperationLevel(val) { + // this.stationStand.setStyle('fill', this.theme.stationStandSpareColor); + this.level.show(); + this.level.attr({ + style: { + text: val + }, + }); + } + + //开门 + openDoor() { + this.safeDoorC.hide(); + } + + //关门 + closeDoor() { + if (this.model.visible) { this.safeDoorC.show(); } + } + + //屏蔽门正常 + doorNormal() { + this.safeDoorL.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandDoorDefaultColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandDoorDefaultColor); + } + + //屏蔽门故障 + doorFault() { + this.safeDoorL.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandSplitDoorColor); + } + + //屏蔽门切除 + doorSplit() { + this.safeDoorL.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorC.setStyle('fill', this.theme.stationStandSplitDoorColor); + this.safeDoorR.setStyle('fill', this.theme.stationStandSplitDoorColor); + } + + //无折返(默认) + noReentry() { + this.reentry.hide(); + } + + //无人折返 + noHumanReentry() { + this.reentry.show(); + this.reentry.setStyle('fill', this.theme.stationStandNoHumanReentryColor); + } + //自动换端 + autoChangeEnds() { + this.reentry.show(); + this.reentry.setStyle('fill', this.theme.stationStandAutoChangeEndsColor); + } + + setStatus(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(); + } + } + } + + /** 设置扣车*/ + 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; + } + } + + getShapeTipPoint() { + let rect = this.stationStand.getBoundingRect(); + if (rect) { + return { + x: rect.x + rect.width / 2, + y: rect.y + }; + } + return null; + } +} diff --git a/src/jmap/components/fuzhou_01/shape/Switch.js b/src/jmap/components/fuzhou_01/shape/Switch.js new file mode 100644 index 000000000..5db360ed7 --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/Switch.js @@ -0,0 +1,525 @@ +/* +* 道岔 +*/ +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Line from 'zrender/src/graphic/shape/Line'; +import Group from 'zrender/src/container/Group'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import JTriangle from '@/jlmap/util/JTriangle'; + +export default class Switch extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.intersection = model.intersection; + this.zlevel = model.zlevel; + this.z = 8; + this.model = model; + this.theme = theme; + this._create(model); + } + + _create(model) { + this.triangle = new JTriangle(model.intersection, model.skew); + this.createSwitch(); + this.createNameText(); + this.setStatus(model); + } + + /** 道岔实体,不显示,响应鼠标事件*/ + createSwitch() { + let model = this.model; + let theme = this.theme; + + var halfWidth = theme.sectionWidth / 2 + 0.2; //一般宽度 + var switchWidth = theme.sectionWidth + theme.sectionBeyondWidth + theme.sectionBeyondWidth + 0.8; // 道岔宽度,增大遮挡宽度 + var swPadding = theme.switchLen; //定位和反位时区段距离岔芯的距离 + var directx = this.triangle.drictx; + var directy = this.triangle.dricty; + var direct = -this.triangle.drictx * this.triangle.dricty; + var coverLength = switchWidth * 1.4; + + // 道岔遮挡 + var line = new Line({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: { + x1: model.intersection.x - coverLength, + y1: model.intersection.y, + x2: model.intersection.x + coverLength, + y2: model.intersection.y + }, + style: { + lineWidth: switchWidth, + stroke: theme.backgroundColor + } + }); + var skewLine = new Line({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: { + x1: model.intersection.x, + y1: model.intersection.y, + x2: model.intersection.x + directx * this.triangle.GetCotRate() * coverLength, + y2: model.intersection.y + directy * coverLength, + }, + style: { + lineWidth: switchWidth, + stroke: theme.backgroundColor + } + }); + this.switchView = new Group(); + this.switchView.add(line); + this.switchView.add(skewLine); + + // 定位遮挡 + halfWidth += 0.6; // 0.3 + var point1 = [model.intersection.x - directx * halfWidth, model.intersection.y + directy * halfWidth]; + var point2 = [point1[0] + directx * switchWidth / this.triangle.GetSinRate(), point1[1]]; + var point3 = [point2[0] + directx * this.triangle.GetCotRate() * swPadding, point2[1] + directy * swPadding]; + var point4 = [point3[0] + direct * this.triangle.GetSin(switchWidth), point3[1] - direct * this.triangle.GetCos(switchWidth)]; + + this.locShelter = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + point1, point2, point3, point4 + ] + }, + style: { + fill: theme.backgroundColor + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + var lpx = Math.abs(this.triangle.GetCos(1)); + this.locShelter.position = [directx * lpx, -directy * 0.2]; + this.locShelter.show(); + + // 反位遮挡 + var slen = switchWidth / this.triangle.GetSinRate(); // 斜切长度 + var rpoint1 = [model.intersection.x + directx * halfWidth, model.intersection.y - directy * halfWidth]; + var rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.GetCotRate()), rpoint1[1]]; + var rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth]; + var rpoint4 = [rpoint1[0] + this.triangle.GetCos(slen), rpoint1[1] + this.triangle.GetSin(slen)]; + this.relocShelter = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + rpoint1, rpoint2, rpoint3, rpoint4 + ] + }, + style: { + fill: theme.backgroundColor + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + var rpx = Math.abs(this.triangle.GetCos(halfWidth)) + 0.2; + this.relocShelter.position = [-directx * rpx, -directy * 0.2]; + this.relocShelter.hide(); + + // 岔芯红框 + this.forkCore = new Rect({ + zlevel: this.zlevel, + z: this.z + 2, + shape: { + x: model.intersection.x - theme.switchLen, + y: model.intersection.y - theme.switchLen, + width: theme.switchLen * 2, + height: theme.switchLen * 2 + }, + style: { + lineWidth: 0.4, + stroke: theme.switchTextBorderColor, + fill: theme.transparentColor, + lineDash: [5, 1] + } + }); + + // 反位/平行四边形 遮挡 + var sinX = theme.sectionWidth / this.triangle.GetSinRate(); + var switchWidth1 = theme.sectionWidth / 2; + var width1 = switchWidth1 * this.triangle.GetSinRate(); + var height1 = switchWidth1 * this.triangle.GetCosRate(); + var width2 = (height1 + switchWidth1) / this.triangle.GetTanRate(); + var width3 = sinX - width2 - width1; + var switchPoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1]; + var switchPoint2 = [switchPoint1[0] - directx * (width2 + width1) - directx * width3, switchPoint1[1]]; + var switchPoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1]; + var switchPoint4 = [switchPoint1[0] + directx * (width2 + width1) - directx * width3, switchPoint3[1]]; + this.reserveSection = new Polygon({ + zlevel: this.zlevel, + shape: { + points: [ + switchPoint1, switchPoint2, switchPoint3, switchPoint4 + ] + }, + style: { + fill: theme.sectionSpareColor, + }, + cursor: 'pointer', + onmouseover: () => { this.arrowText.show(); }, + onmouseout: () => { this.arrowText.hide(); }, + }); + this.reserveSection.hide(); + + // 失去 + this.release = new Line({ + zlevel: this.zlevel, + z: this.z + 2, + 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: theme.sectionWidth, + stroke: theme.sectionTimeReleaseColor, + } + }); + 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: theme.sectionWidth + theme.sectionBeyondWidth + 0.5, + stroke: theme.backgroundColor, + } + }); + + // 添加 + this.add(this.switchView); + this.add(this.locShelter); + this.add(this.relocShelter); + this.add(this.reserveSection); + this.add(this.forkCore); + this.add(this.release); + this.add(this.releaseBackground); + } + + /** 道岔名称,显示,响应鼠标事件*/ + createNameText() { + let model = this.model; + let theme = this.theme; + + //描述文字 + this.arrowText = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.intersection.x + 10, + y: model.intersection.y + 15, + text: `道岔区段名称: ${model.sectionName}`, + textFill: '#000', + textAlign: 'letf', + textFont: 10 + 'px consolas', + textPadding: 3, + textBackgroundColor: theme.tipBackgroundColor, + } + }); + this.arrowText.hide(); + this.add(this.arrowText); + + //创建道岔名称 + this.nameText = new Text({ + zlevel: this.zlevel, + z: this.z + 3, + silent: false, + style: { + x: model.namePoint.x + model.intersection.x + this.triangle.drictx * (theme.sectionWidth * 3 + theme.nameDistance) * this.triangle.GetCotRate(), + y: model.namePoint.y + model.intersection.y + this.triangle.dricty * (theme.nameDistance), + text: model.name, + textAlign: this.triangle.drictx === 1 ? 'left' : 'right', + textVerticalAlign: this.triangle.dricty === 1 ? 'top' : 'bottom', + textFont: theme.textFontSize + 'px ' + theme.textFontFormat, + textFill: theme.switchTextLossColor + } + }); + //添加道岔名称视图 + this.add(this.nameText); + //设置道岔名称视图显隐 + model.nameShow ? this.nameText.show() : this.nameText.hide(); + + //创建锁闭文字框 + let rect = this.nameText.getBoundingRect(); + let textWidth = rect.width * 0.8; + if (this.triangle.drictx !== 1) { + rect.x += rect.width; + textWidth = -textWidth; + } + + this.textRect = new Rect({ + zlevel: this.zlevel, + z: this.z + 3, + shape: { + x: rect.x, + y: rect.y, + width: textWidth, + height: rect.height + }, + style: { + lineWidth: 0, + stroke: theme.switchTextBorderColor, + fill: theme.transparentColor, + lineDash: [2, 1] + } + }); + this.add(this.textRect); + } + + /** 名称动画*/ + nameTextAnimation() { + this.nameText.animateStyle(true) + .when(0, { textFill: this.theme.backgroundColor }) + .when(1000, { textFill: this.theme.switchTextLossColor }) + .when(2000, { textFill: this.theme.backgroundColor }) + .start(); + + this.textRect.animateStyle(true) + .when(0, { textFill: this.theme.backgroundColor }) + .when(1000, { textFill: this.theme.switchTextBorderColor }) + .when(2000, { textFill: this.theme.backgroundColor }) + .start(); + + this.forkCore.animateStyle(true) + .when(0, { stroke: this.theme.backgroundColor }) + .when(1000, { stroke: this.theme.switchTextBorderColor }) + .when(2000, { stroke: this.theme.backgroundColor }) + .start(); + } + + /** 设置是否隐藏*/ + setSwitchInvisible(invisible) { + if (invisible) { + this.switchView.hide(); + } else { + this.switchView.show(); + } + } + + /** 设置道岔文字颜色*/ + setTextColor(color) { + this.nameText.setStyle('textFill', color); + } + + /** 设置道岔文字边框颜色 */ + setHasTextBorder(width) { + this.textRect.setStyle('lineWidth', width); + } + + /** 恢复状态*/ + recover() { + this.nameText.stopAnimation(false); + this.forkCore.stopAnimation(false); + this.release.stopAnimation(false); + this.reserveSection.stopAnimation(false); + + this.release.hide(); + this.relocShelter.hide(); + this.releaseBackground.hide(); + + this.setHasTextBorder(0); + switch (this.model.locateType) { + case '01': { // 定位 + this.setTextColor(this.theme.switchLocateTextColor); + } break; + case '02': { // 反位 + this.setTextColor(this.theme.switchInversionColor); + } break; + default: { // 其他 + this.setTextColor(this.theme.switchTextLossColor); + } + } + } + + /** 定位*/ + setLocationAction() { + this.recover(); + this.setSwitchInvisible(true); + this.locShelter.show(); + this.relocShelter.hide(); + this.reserveSection.hide(); + this.forkCore.hide(); + } + + /** 反位*/ + setInversionAction() { + this.recover(); + this.setSwitchInvisible(true); + this.locShelter.hide(); + this.relocShelter.show(); + this.reserveSection.show(); + this.forkCore.hide(); + } + + /** 失去*/ + setLossAction() { + this.recover(); + this.locShelter.hide(); + this.relocShelter.hide(); + this.reserveSection.hide(); + this.forkCore.show(); + this.setSwitchInvisible(false); + this.nameTextAnimation(); + } + + /** 挤叉*/ + setForkAction() { + this.setLossAction(); + } + + /** 空闲*/ + spare() { + } + + /** 单锁*/ + setMonolock() { + this.setTextColor(this.theme.switchMonolockColor); + } + + /** 封锁 */ + block() { + this.setHasTextBorder(1); + } + + /** 延时释放*/ + timeRelease() { + this.setSwitchInvisible(true); + this.release.show(); + this.releaseBackground.show(); + this.release.setStyle('stroke', this.theme.sectionTimeReleaseColor); + this.release.animateStyle(true) + .when(0, { stroke: this.theme.sectionTimeReleaseColor }) + .when(1000, { stroke: this.theme.backgroundColor }) + .start(); + + } + + /** 设置道岔切除*/ + setSwitchCutOff() { + this.setSwitchInvisible(true); + switch (this.model.locateType) { + case '01': { // 定位 + this.release.show(); + this.releaseBackground.hide(); + this.setSectionstatus(this.release, 'stroke', this.model.sectionAstatus); + this.release.animateStyle(true) + .when(1000, { stroke: this.theme.backgroundColor }) + .start(); + } break; + case '02': { // 反位 + this.reserveSection.animateStyle(true) + .when(1000, { fill: this.theme.backgroundColor }) + .start(); + } break; + } + } + + setSectionstatus(section, style, status) { + if (section) { + switch (status) { + case '00': break; + case '01': { /** 空闲*/ + section.setStyle(style, this.theme.sectionSpareColor); + } break; + case '02': { /** 通信车占用*/ + section.setStyle(style, this.theme.sectionCommunicationOccupiedColor); + } break; + case '03': { /** 非通信车占用*/ + section.setStyle(style, this.theme.sectionUnCommunicationOccupiedColor); + } break; + case '04': { /** 进路锁闭*/ + section.setStyle(style, this.theme.sectionRouteLockColor); + } break; + case '05': { /** 故障锁闭*/ + section.setStyle(style, this.theme.sectionFaultLockColor); + } break; + case '06': { /** 封锁*/ + section.setStyle(style, this.theme.sectionBlockColor); + } break; + case '07': { /** ATC切除*/ + section.setStyle(style, this.theme.sectionAtcExcisionColor); + } break; + case '08': { /** ATS切除*/ + section.setStyle(style, this.theme.sectionAtsExcisionColor); + section.animateStyle(true) + .when(1000, { fill: this.theme.backgroundColor }) + .when(2000, { fill: this.theme.sectionAtsExcisionColor }) + .start(); + } break; + case '09': { /** 进路延续保护 */ + section.setStyle(style, this.theme.sectionProtectiveLockColor); + } break; + } + } + } + + setLocateType(model) { + this.setSectionstatus(this.reserveSection, 'fill', model.sectionCstatus); + switch (model.locateType) { + case '01': { + this.setLocationAction(); /** 定位*/ + } break; + case '02': { + this.setInversionAction(); /** 反位*/ + } break; + case '03': { + this.setLossAction(); /** 失去*/ + } break; + case '04': { + this.setForkAction(); /** 挤岔*/ + } break; + } + } + + setStatus(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(); + } + } + + getShapeTipPoint() { + var rect = null; + rect = this.nameText.getBoundingRect(); + if (rect) { + return { + x: rect.x + rect.width / 2, + y: rect.y + }; + } + return null; + } +} diff --git a/src/jmap/components/fuzhou_01/shape/Train.js b/src/jmap/components/fuzhou_01/shape/Train.js new file mode 100644 index 000000000..dcd73d720 --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/Train.js @@ -0,0 +1,642 @@ +/* +* 列车 +*/ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; +import Rect from 'zrender/src/graphic/shape/Rect'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import BoundingRect from 'zrender/src/core/BoundingRect'; +import store from '@/store'; + +class TrainBody extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + + _create(model) { + let destinationText = ''; + switch (model.model.destinationStatus) { + case '01': destinationText = '准点'; break; + case '02': destinationText = '早点'; break; + case '03': destinationText = '严重早点'; break; + case '04': destinationText = '晚点'; break; + case '05': destinationText = '严重晚点'; break; + default: destinationText = '未知'; break; + } + + // 文字描述 + this.arrowText = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: model.point.x + 50, + y: model.point.y + 25, + text: `列车类型: 计划车\n表\0\0\0\0号: ${model.model.serviceNumber}\n车\0次\0号: ${model.model.tripNumber}\n目的地号: ${model.model.targetCode ? model.model.targetCode : ''}\n车\0组\0号: ${model.model.groupNumber}\n早\0晚\0点: ${destinationText}\n运行方向: ${model.model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${model.model.sectionModel ? model.model.sectionModel.trackName : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${model.model.runControlStatus == '01' ? '正常' : model.model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${model.model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${model.model.speed || 0} km/h\n列车移动授权距离: ${model.model.maLen || 0} m`, + textFill: '#000', + textAlign: 'letf', + textFont: 10 + 'px consolas', + textPadding: 3, + textBackgroundColor: this.model.theme.tipBackgroundColor, + } + }); + + this.train = new Rect({ + zlevel: model.zlevel, + z: model.z + 1, + shape: { + x: model.point.x, + y: model.point.y, + width: model.theme.trainWidth, + height: model.theme.trainHeight + }, + style: { + lineWidth: 0, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainBackground + }, + cursor: 'pointer', + onmouseover: () => { + store.dispatch('map/setTrainDetails', model); + this.details = store.state.map.trainDetails; + this.add(this.arrowText); + this.arrowText.attr({ + style: { + x: this.details.point.x + 50, + y: this.details.point.y + 25, + } + }); + }, + onmouseout: () => { + this.remove(this.arrowText); + store.dispatch('map/setTrainDetails', null); + }, + }); + + let selectTrain = store.getters['map/trainDetails']; + if (selectTrain && selectTrain.model._code == model.model._code) { + this.add(this.arrowText); + this.arrowText.attr({ + style: { + x: selectTrain.point.x + 50, + y: selectTrain.point.y + 25, + } + }); + } + this.add(this.train); + } + + removeTrainDetail() { + this.remove(this.arrowText); + store.dispatch('map/setTrainDetails', null); + } +} + +class TrainTextBody extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + + _create(model) { + let fontSize = model.model.nameFontSize || model.theme.trainTextFontSize; + let textFont = fontSize + 'px consolas'; + + let lrPadding = 6; //两边间隔 + let upPadding = 1; //上边距离 + + lrPadding = 1; //两边间隔 + upPadding = 1; //上边距离 + + let targetCode = `000${model.model.targetCode || 'AAA'}`; // 目的地码 + let serviceNumber = `00${model.model.serviceNumber || 'BB'}`; // 服务号(表号) + let tripNumber = `0000${model.model.directionCode || 'D'}${model.model.tripNumber || 'CCC'}`; // 车次号 + let groupNumber = `000${model.model.groupNumber || 'EEE'}`; // 车组号 + + // 根据列车类型设置显示格式 + switch (model.model.type) { + case '03': { + serviceNumber = 'MM'; + model.model.nameFormat = 'serviceNumber:groupNumber'; + } break; + } + + // 目的码 + this.textTrainNumber = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x + lrPadding), + y: parseInt(model.point.y + upPadding), + text: targetCode.substring(targetCode.length - 3), + textFill: model.theme.trainTextColor, + textStroke: model.theme.trainTextColor, + fontWeight: 400, + textStrokeWidth: 0, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + }, + cursor: 'pointer', + }); + + // 服务号/表号 + this.textTrainServer = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x - lrPadding), + y: parseInt(model.point.y + upPadding), + text: serviceNumber.substring(serviceNumber.length - 2), + textFill: model.theme.trainTextColor, + textStroke: model.theme.trainTextColor, + textStrokeWidth: 0, + fontWeight: 100, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + }, + cursor: 'pointer', + }); + + // 车次号 + this.textTrainTarget = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x - lrPadding), + y: parseInt(model.point.y + upPadding), + text: tripNumber.substring(tripNumber.length - 4), + textFill: model.theme.trainTextColor, + textStroke: model.theme.trainTextColor, + textStrokeWidth: 0, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + }, + cursor: 'pointer', + }); + + // 车组号 + this.textTrainTargetNumber = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: parseInt(model.point.x - lrPadding), + y: parseInt(model.point.y + upPadding), + text: groupNumber.substring(groupNumber.length - 3), + textFill: model.theme.trainTextColor, + textStroke: model.theme.trainTextColor, + textStrokeWidth: 0, + textFont: textFont, + textAlign: 'left', + textVerticalAlign: 'top', + }, + cursor: 'pointer', + }); + + this.add(this.train); + + if (model.model.nameFormat) { + let arr = model.model.nameFormat.split(':'); + arr.forEach(ele => { + if (ele == 'targetCode') { + this.add(this.textTrainNumber); + } else if (ele == 'serviceNumber') { + let show = arr.includes('targetCode'); + if (show) { + this.textTrainServer.setStyle('x', parseInt(model.point.x + (3 * fontSize * (2 / 3)) - 3 - lrPadding)); + } + this.add(this.textTrainServer); + } else if (ele == 'tripNumber') { + let show = arr.includes('targetCode'); + let serverNoShow = arr.includes('serviceNumber'); + if (show) { + this.textTrainTarget.setStyle('x', parseInt(model.point.x + (3 * fontSize * (2 / 3)) - 3 - lrPadding)); + } + if (serverNoShow) { + this.textTrainTarget.setStyle('x', parseInt(model.point.x + (2 * fontSize * (2 / 3)) - 3 - lrPadding)); + } + if (serverNoShow && show) { + this.textTrainTarget.setStyle('x', parseInt(model.point.x + (5 * fontSize * (2 / 3)) - 6.5 - lrPadding)); + } + this.add(this.textTrainTarget); + } else if (ele == 'groupNumber') { + let show = arr.includes('targetCode'); + let serverNoShow = arr.includes('serviceNumber'); + if (show) { + this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + (3 * fontSize * (2 / 3)) - 3 - lrPadding)); + } + if (serverNoShow) { + this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + (2 * fontSize * (2 / 3)) - 3 - lrPadding)); + } + if (serverNoShow && show) { + this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + (5 * fontSize * (2 / 3)) - 6.5 - lrPadding)); + } + this.add(this.textTrainTargetNumber); + } + }); + } else { + this.textTrainServer.setStyle('x', parseInt(model.point.x + 27 - lrPadding)); + this.textTrainTarget.setStyle('x', parseInt(model.point.x + 43 - lrPadding)); + this.add(this.textTrainServer); + this.add(this.textTrainTarget); + this.add(this.textTrainNumber); + } + } + + setTextTrainServerColor(color) { + this.textTrainServer.setStyle('textFill', color); + this.textTrainServer.setStyle('textStroke', color); + } + + setTextTrainTargetColor(color) { + this.textTrainTarget.setStyle('textFill', color); + this.textTrainTarget.setStyle('textStroke', color); + } +} + +class TrainHead extends Group { + constructor(model) { + super(); + this.model = model; + this._create(model); + } + + _create(model) { + let baseMargin = (model.drect === -1 ? 1 : 0); + + this.line = new Rect({ + zlevel: model.zlevel, + z: model.z, + shape: { + x: model.point.x - baseMargin * (model.theme.trainConntWidth), + y: model.point.y, + width: model.theme.trainConntWidth * this.model.scale, + height: model.bound.height + }, + style: { + lineWidth: 0.1, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainRedColor + } + }); + + this.arrow = new Polygon({ + zlevel: model.zlevel, + z: model.z, + shape: { + points: [ + [model.point.x, model.point.y], + [model.point.x + model.drect * (model.theme.trainConntWidth * this.model.scale), model.point.y + (model.bound.height + model.theme.trainMoreLength) / 2], + [model.point.x, model.point.y + model.bound.height] + ] + }, + style: { + lineWidth: 0.1, + stroke: model.theme.trainSidelineColor, + fill: model.theme.trainRedColor + } + }); + + 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(); + } + + setInvisible(invisible) { + this.eachChild((child) => { + child.attr('invisible', invisible); + }); + } + +} + +export default class Train extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 40; + this.size = 0; + this.model = model; + this.theme = theme; + this.fontSize = model.nameFontSize || theme.trainTextFontSize; + this.newScale = this.fontSize / theme.trainTextFontSize; + this._create(model, theme); + } + + _create(model, theme) { + //计算画图坐标点 + this._computed(model, theme); + + if (model.nameFormat) { + let arr = model.nameFormat.split(':'); + arr.forEach(ele => { + switch (ele) { + case 'targetCode': { + this.size += 3; + break; + } + case 'serviceNumber': { + this.size += 2; + break; + } + case 'tripNumber': { + this.size += 4; + break; + } + case 'groupNumber': { + this.size += 3; + break; + } + } + }); + } else { + this.size = 9; + } + + theme.trainWidth = this.size * this.fontSize * (2 / 3) - 16; + + //画图 + if (this.point) { + // body + this.trainB = new TrainBody({ + model: model, + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: this.point, + scale: this.newScale + }); + // bodyText + this.trainText = new TrainTextBody({ + model: model, + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: this.point, + scale: this.newScale + }); + let bound = this.trainText.getBoundingRect(); + // left 头 + this.trainL = new TrainHead({ + bound: bound, + model: model, + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: { + x: this.point.x - theme.trainHeadDistance, + y: this.point.y + }, + drect: -1, + scale: this.newScale + }); + // right 头 + this.trainR = new TrainHead({ + bound: bound, + model: model, + theme: theme, + zlevel: this.zlevel, + z: this.z, + point: { + x: this.point.x + bound.width + theme.trainHeadDistance, + y: this.point.y + }, + drect: 1, + scale: this.newScale + }); + //添加视图 + this.add(this.trainB); + this.add(this.trainText); + this.add(this.trainL); + this.add(this.trainR); + this.setStatus(model); + } + } + + _computed(model, theme) { + 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((theme.trainWidth - model.trainWindowModel.width) / 2); + } break; + case '02': { //从左向右 + this.point.x = this.point.x + model.trainWindowModel.width / 2 - theme.trainConntWidth * this.newScale - theme.trainWidth; + } break; + case '03': { //从右向左 + this.point.x = this.point.x - model.trainWindowModel.width / 2 + theme.trainConntWidth * this.newScale; + } break; + } + } else { + this.point = model.position; + this.traingle = null; + } + } + + removeTrainDetail() { + this.trainB.removeTrainDetail(); + } + + //恢复颜色状态 + recover() { + this.trainL.setLineShow(false); + this.trainR.setLineShow(false); + this.trainL.setArrowShow(false); + this.trainR.setArrowShow(false); + } + + //设置运行方向状态类型 + setDirectionType(type) { + switch (type) { + case '01': { //未知方向 + } break; + case '02': { //从左往右 + this.trainR.setArrowShow(true); + } break; + case '03': { //从右往左 + this.trainL.setArrowShow(true); + } break; + } + } + + // 设置列车停止方向类型 + setDirectionStopType(type) { + switch (type) { + case '01': { //未知方向 + } break; + case '02': { //从左往右 + this.trainR.setLineShow(true); + } break; + case '03': { //从右往左 + this.trainL.setLineShow(true); + } break; + } + } + + //设置运行状态 + setRunStatus(status) { + switch (status) { + case '01': { //停止 + this.setDirectionStopType(this.model.directionType); //设置运行方向状态类型 + } break; + case '02': { //运行 + this.setDirectionType(this.model.directionType); //设置运行方向状态类型 + } break; + } + } + + //设置运行模式 (驾驶模式类型) + setRunMode(status) { + switch (status) { + case '01': { //信号中断 + this.trainL.setColor(this.theme.trainRedColor); + this.trainR.setColor(this.theme.trainRedColor); + } break; + case '02': { //ATO自动驾驶模式 + this.trainL.setColor(this.theme.trainGreenColor); + this.trainR.setColor(this.theme.trainGreenColor); + } break; + case '03': { //ATP监控下的人工驾驶模式 + this.trainL.setColor(this.theme.trainYellowColor); + this.trainR.setColor(this.theme.trainYellowColor); + } break; + case '04': { //限制人工驾驶模式 + this.trainL.setColor(this.theme.trainOrangeColor); + this.trainR.setColor(this.theme.trainOrangeColor); + } break; + case '05': { //非限制人工驾驶模式 + this.trainL.setColor(this.theme.trainBrownColor); + this.trainR.setColor(this.theme.trainBrownColor); + } break; + } + } + + //设置目的地状态 + setDestinationStatus(status) { + switch (status) { + case '01': { //准点 + this.trainText.setTextTrainServerColor(this.theme.trainWitheColor); + } break; + case '02': { //早点 + this.trainText.setTextTrainServerColor(this.theme.trainGreenColor); + } break; + case '03': { //严重早点 + this.trainText.setTextTrainServerColor(this.theme.trainBlueColor); + } break; + case '04': { //晚点 + this.trainText.setTextTrainServerColor(this.theme.trainBrownColor); + } break; + case '05': { //严重晚点 + this.trainText.setTextTrainServerColor(this.theme.trainRedColor); + } break; + case '06': { //头码车 + this.trainText.setTextTrainServerColor(this.theme.trainWitheColor); + } break; + case '07': { //ATP切除 + this.trainText.setTextTrainServerColor(this.theme.trainYellowColor); + } break; + } + } + + //设置服务号状态类型 + // eslint-disable-next-line no-unused-vars + setServerNoType(type) { + } + + //设置AA类型 + // eslint-disable-next-line no-unused-vars + setPlanConflictControlStatus(status) { + } + + //设置BBB类型 + // eslint-disable-next-line no-unused-vars + setAlarmControlStatus(status) { + } + + //设置运行控制状态类型 + // eslint-disable-next-line no-unused-vars + setRunControlStatus(status) { + } + + //设置车门状态类型 + // eslint-disable-next-line no-unused-vars + setDoorStatus(status) { + } + + //设置通信状态类型 + // eslint-disable-next-line no-unused-vars + setCommunicationStatus(status) { + } + + // 设置计划冲突状态 + // eslint-disable-next-line no-unused-vars + setPlanConflictStatus(status) { + } + + // 设置报警状态 + // eslint-disable-next-line no-unused-vars + setAlarmStatus(status) { + } + + //设置状态 + setStatus(model) { + if (model) { + this.recover(); + this.setRunStatus(model.runStatus); //设置运行状态 + this.setRunMode(model.runMode); //设置运行模式 + this.setDestinationStatus(model.destinationStatus); //设置目的地状态 + } + } + + + //获取设备提示坐标 + getShapeTipPoint() { + return { + x: (this.train.shape.x), + y: (this.train.shape.y) + }; + } + + //获取列车包围框 + getBoundingRect() { + let list = [this.trainText, this.trainL, this.trainR]; + let rect = null; + + list.forEach(elem => { + if (elem) { + let 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); + } +} diff --git a/src/jmap/components/fuzhou_01/shape/TrainWindow.js b/src/jmap/components/fuzhou_01/shape/TrainWindow.js new file mode 100644 index 000000000..1088a1a40 --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/TrainWindow.js @@ -0,0 +1,91 @@ +/* +* 车次窗 +*/ +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import Group from 'zrender/src/container/Group'; +import store from '@/store'; + +export default class TrainWindow extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 1; + this.model = model; + this.theme = theme; + this._create(model); + } + + _create(model) { + let prdType = store.state.map.prdType; + if (prdType !== '01') { + this.createTrainWindow(); + this.setTrainWindow(model.trainWindowShow); + this.setStatus(model); + } + } + + /** 创建车次窗*/ + createTrainWindow() { + let model = this.model; + let theme = this.theme; + + this.trainRect = new Polygon({ + _subType: 'TrainWindow', + zlevel: this.zlevel - 1, + z: this.z, + shape: { + points: [ + [model.point.x - model.width / 2, model.point.y], + [model.point.x + model.width / 2, model.point.y], + [model.point.x + model.width / 2, model.point.y + model.height], + [model.point.x - model.width / 2, model.point.y + model.height], + ] + }, + style: { + lineWidth: 1.5, + stroke: theme.trainWindowColor, + fill: theme.transparentColor + }, + onmouseover: () => { this.setTrainWindow(true); }, + onmouseout: () => { this.setTrainWindow(false); }, + }); + this.add(this.trainRect); + } + + setTrainWindow(show) { + if (this.trainRect && !this.model.trainWindowShow) { + let lineWidth = 0; + if (show) { + lineWidth = 1; + } + this.trainRect.setStyle('lineWidth', lineWidth); + } + } + + 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; + } + } + } + + //设置状态 + setStatus() { + } + + 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/components/fuzhou_01/shape/ZcControl.js b/src/jmap/components/fuzhou_01/shape/ZcControl.js new file mode 100644 index 000000000..a2fe4a2b2 --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/ZcControl.js @@ -0,0 +1,102 @@ +/* +* ZC区域控制模式 +*/ +import Arc from 'zrender/src/graphic/shape/Arc'; +import Text from 'zrender/src/graphic/Text'; +import Group from 'zrender/src/container/Group'; + + +export default class ZcControl extends Group { + constructor(model, theme) { + super(); + this._type = model._type; + this.name = model._code; + this.zlevel = model.zlevel; + this.z = 20; + this.model = model; + this.theme = theme; + this._create(model); + } + + _create(model) { + this.control = new Arc({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: this.theme.zcControlmodeR + }, + style: { + lineWidth: 0, + fill: this.theme.zcControlGrayColor, + } + }); + + this.text = new Text({ + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + this.theme.zcControlmodeR + this.theme.nameDistance, + text: model.name, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top', + textFont: this.theme.stationControlTextSize + 'px ' + this.theme.textFontFormat + } + }); + + if (this.model.visible) { + this.add(this.control); + this.add(this.text); + } + this.setStatus(model); + } + + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + + // 设置状态 + setStatus(model) { + switch (model.status) { + case '00': { //无状态 + + } break; + case '01': { //中控(缺省值) + + } break; + case '02': { //站控且允许转为中控 + + } break; + case '03': { //站控且不允许转为中控 + + } 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; + } + } + } + + 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/components/fuzhou_01/shape/index.js b/src/jmap/components/fuzhou_01/shape/index.js new file mode 100644 index 000000000..b927e6d1c --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/index.js @@ -0,0 +1,25 @@ +import Section from './Section'; +import Signal from './Signal'; +import Station from './Station'; +import StationControl from './StationControl'; +import StationCounter from './StationCounter'; +import StationDelayUnlock from './StationDelayUnlock'; +import StationStand from './StationStand'; +import Switch from './Switch'; +import Train from './Train'; +import TrainWindow from './TrainWindow'; +import ZcControl from './ZcControl'; + +export default { + Section, + Signal, + Station, + StationControl, + StationCounter, + StationDelayUnlock, + StationStand, + Switch, + Train, + TrainWindow, + ZcControl, +}; \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/shape/libs/ShapePoints.js b/src/jmap/components/fuzhou_01/shape/libs/ShapePoints.js new file mode 100644 index 000000000..6edfaa545 --- /dev/null +++ b/src/jmap/components/fuzhou_01/shape/libs/ShapePoints.js @@ -0,0 +1,36 @@ + + +/** 指向箭头坐标*/ +export function arrows(modelX, modelY, length, radius) { + return [ + [modelX - length, modelY], + [modelX - length + radius / 1.5, modelY - radius / 1.5], + [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.5] + ]; + +} + +/** 指向三角形坐标*/ +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], + ]; +} \ No newline at end of file diff --git a/src/jmap/components/fuzhou_01/theme.js b/src/jmap/components/fuzhou_01/theme.js new file mode 100644 index 000000000..25f99dcc0 --- /dev/null +++ b/src/jmap/components/fuzhou_01/theme.js @@ -0,0 +1,394 @@ +import { enableClassExtend, enableClassCheck } from '@/jlmap/util/clazz'; + +/** + * 皮肤风格主题 + * @param {*} opts + */ +function Theme() { + +} + +Theme.prototype = { + + constructor: Theme, + + //道岔字体颜色 + switchTextColor: 'lightgreen', + + /** 皮肤风格编码 */ + code: '02', + + /** 默认背景 颜色*/ + backgroundColor: '#000000', + + /** 默认提示背景 颜色*/ + tipBackgroundColor: 'yellow', + + /** 默认边线 颜色*/ + sidelineColor: '#FFFFFF', + + /** 透明填充 颜色*/ + transparentColor: 'rgba(0,0,0,0)', + + /** 默认字体 大小*/ + textFontSize: 8.2, + + /** 默认字体 族类*/ + textFontFormat: '宋体', //consolas + + /** 默认字体颜色*/ + textFontColor: '#E6E6E6', + + /** 目的码字体颜色*/ + destinationTextFontColor: 'yellow', + + /** 默认名称和设备的距离*/ + nameDistance: 10, + + /** line 颜色*/ + lineWidthColor: '#FFFFFF', + + + /** link 宽度*/ + linkWidth: 4, + + /** link 线条颜色*/ + linkColor: '#3F3F3F',//#4e8de6 + + /** link 字体颜色*/ + linkTextColor: '#FFFFFF', //#3399cc #3399cc + + + /** StopPoint 颜色*/ + stopPointColor: '#FE0000', + + /** StopPoint 字体颜色*/ + stopPointTextColor: '#FFFFFF', + + + /** 区段 宽度*/ + sectionWidth: 5, + + /** 区段宽超出宽度*/ + sectionBeyondWidth: 1, + + /** 计轴 半径*/ + sectionAxleR: 3, + + /** 计轴和区段之间的距离*/ /** 需要添加*/ + sectionAxleDistance: 5, + + /** 限速线的宽短*/ + sectionSpeedLimitLinewidth: 1, + + /** 限速线距离区段距离*/ + sectionSpeedLimitDistance: 5, + + /** 区段侵入颜色*/ + sectionInvadeColor: '#EF0C08', + + /** 限速线颜色*/ + sectionSpeedLimitColor: '#FFFF00', + + /** 区段计轴颜色*/ + sectionAxleColor: '#FFFFFF', + + /** 区段边界符颜色*/ + sectionSeparatorColor: '#3149C3', + + /** 区段空闲颜色*/ + sectionSpareColor: '#3F3F3F', + + /** 逻辑区段名称颜色*/ + sectionLogicalTextColor: '#FFFFFF', + + /** 区段通信车占用颜色**/ + sectionCommunicationOccupiedColor: '#FF329A', + + /** 区段非通讯车占用颜色*/ + sectionUnCommunicationOccupiedColor: '#FE0000', + + /** 区段路由锁定颜色*/ + sectionRouteLockColor: '#FFFFFF', + + /** 区段故障锁定颜色*/ + sectionFaultLockColor: '#9B4A0A', + + /** 区段未定义颜色*/ + sectionUndefinedColor: '#0071C1', + + /** 保护区段锁闭*/ + sectionProtectionSectionLockedColor: '#FEFF00', + + /** 区段计轴预复位*/ + sectionAxleResetColor: '#00FFFF', + + /** 区段封锁颜色*/ + sectionBlockColor: '#800080', + + /** 区段atc切除颜色*/ + sectionAtcExcisionColor: '#A0522D', + + /** 区段ats切除颜色*/ + sectionAtsExcisionColor: '#A0522D', + + /** 区段延时释放颜色*/ + sectionTimeReleaseColor: '#3F3F3F', + + /** 区段保护锁闭*/ + sectionProtectiveLockColor: '#FFFF00', + + /** 区段保护延时解锁*/ + sectionProtectiveTimeReleaseColor: '#0071C1', + + + /** 道岔单边长度 */ + switchLen: 10, + + /** 道岔边框颜色*/ + switchTextBorderColor: '#FE0000', + + /** 道岔失去颜色*/ + switchTextLossColor: '#FFFFFF', + + /** 道岔定位颜色*/ + switchLocateTextColor: '#027437', + + /** 道岔反位颜色*/ + switchInversionColor: '#9C9D09', + + /** 道岔单锁颜色*/ + switchMonolockColor: '#870E10', + + zcControlGrayColor: '#00FF00', + + zcControlmodeR: 7, + + /** 信号机宽度 */ + signalR: 5, + + /** 设备距离区段的距离*/ + signalDistance: 19, + + /** 信号灯按钮颜色*/ + signalButtonColor: 'darkgreen', + + /** 信号灯按钮闪烁颜色*/ + signalButtonLightenColor: '#E4EF50', + + /** 信号灯灯柱颜色*/ + signalLampStandardColor: '#3149C3', //#3E44BE, + + /** 信号灯锁闭*/ + signalBlockColor: '#EF0C08', + + /** 信号灯灰色*/ + signalLampGrayColor: '#51545D', + + /** 信号灯红色*/ + signalLampRedColor: '#EF0C08', + + /** 信号灯绿色*/ + signalLampGreenColor: '#4DD43F', + + /** 信号灯黄色*/ + signalLampYellowColor: '#E4EF50', + + /** 信号灯白色*/ + signalLampWhiteColor: '#FFFFFF', + + /** 信号灯蓝色*/ + signalLampBlueColor: '#3E44BE', + + + /** 控制模式灯的半径 */ + stationControlmodeR: 7, + + /** 控制模式之间灯之间的距离*/ + stationControlDistance: 44, + + /** 控制模式字体大小*/ + stationControlTextSize: 12, + + /** 控制模式灰色*/ + stationControlGrayColor: '#74747C', + + /** 控制模式绿色*/ + stationControlGreenColor: '#4DD43F', + + /** 控制模式红色*/ + stationControlRedColor: '#EF0C08', + + /** 控制模式黄色*/ + stationControlYellowColor: '#E4EF50', + + + /** 站台和屏蔽门之间的距离*/ + stationStandDistance: 8, + + /** 站台首端字体大小*/ + stationStandHeadFontSize: 10, + + /** 站台无人折返*/ + stationStandNoHumanReentryColor: '#0F16DA', + + /** 站台自动换端*/ + stationStandAutoChangeEndsColor: '#0BF400', + + /** 站台空闲颜色*/ + stationStandSpareColor: '#74747C', + + /** 站台列车停站颜色*/ + stationStandStopColor: '#FEFE00', + + /** 站台跳停颜色*/ + stationStandJumpStopColor: '#9A99FF', + + /** 站台指定列车跳停颜色*/ + stationStandDesignatedJumpStopColor: 'lightSkyBlue', + + /** 站台紧急关闭颜色*/ + stationStandEmergentCloseColor: '#F61107', + + /** 停站时间字体颜色*/ + stationStandTimeTextColor: '#FFFFFF', + + /** 车站扣车颜色*/ + stationStandStandDetainTrainColor: '#E4EF50', + + /** 中心扣车颜色*/ + stationStandCenterDetainTrainColor: '#FFFFFF', + + /** 车站+中心扣车颜色*/ + stationStandStandAndCenterDetainTrainColor: '#F61107', + + /** 屏蔽门默认颜色*/ + stationStandDoorDefaultColor: '#4DD43F', + + /** 屏蔽门切除颜色*/ + stationStandSplitDoorColor: '#F61107', + + /** 车站扣除文字颜色*/ + stationstandDetainTrainTextColor: '#E4EF50', + + + /** 计数器字体颜色*/ + stationCounterTextColor: '#FFFFFF', + + /** 计数器边框颜色*/ + stationCounterBorderColor: '#E4EF50', + + + /** 延迟解锁倒计时和设备文字之间的距离*/ + stationDelayUnlockDistance: 3, + + /** 延时解锁字体颜色*/ + stationDelayUnlockTextColor: '#FFFFFF', + + /** 延迟解锁边框颜色*/ + stationDelayUnlockBorderColor: '#FFFFFF', + + + // 停车点目的码文字大小 + textPointFontSize: 6, + + // 停车点折返点目的码名字颜色 + stopPointTexDestCodetColor: '#FFF07B', + + + + /** 列车长度*/ + trainWidth: 76, + + /** 列车高度*/ + trainHeight: 17, + + /** 列车字号*/ + trainTextFontSize: 15, + + // 列车文字间距 + trainTextSpaceBetween: 27, + + + /** 列车HDSA字号*/ + trainHSDATextFontSize: 8, + + /** 列车信号的半径*/ + trainConflictR: 3, + + /** 列车信号距离车的距离*/ + trainConflictDistance: 5, + + /** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/ + trainMoreLength: 1, + + /** 列车和车头之间的间距*/ + trainHeadDistance: 2, + + /** 列车竖杠的宽度*/ + trainConntWidth: 4, + + /** 列车竖杠和方向之间的间隔*/ + trainPadding: 1, + + /** 列车方向的宽度*/ + trainArrowWidth: 6, + + /** 列车和区段之间的距离*/ + trainDistance: 18, + + /** 列车背景*/ + trainBackground: 'rgba(0,0,0,0)', + + /** 列车边线颜色*/ + trainSidelineColor: '#C0C0C0', + + /** 列车文字颜色*/ + trainTextColor: '#ffffff', + + /** 列车 灰色*/ + trainGrayColor: '#C0C0C0', + + /** 列车 白色*/ + trainWitheColor: '#FFFFFF', + + /** 列车 棕色*/ + trainBrownColor: '#9B4A09', + + /** 列车 黄色*/ + trainYellowColor: '#FFFF00', + + /** 列车 绿色*/ + trainGreenColor: '#00AF50', + + /** 列车 蓝色*/ + trainBlueColor: '#3265FF', + + /** 列车 红色*/ + trainRedColor: '#EF0C08', + + /** 列车 橘色*/ + trainOrangeColor: '#EA700D', + + /** 列车 紫色*/ + trainPurpleColor: 'purple', + + /** 列车 粉色*/ + trainPinkColor: 'pink', + + + /** 车次窗高度*/ + trainWindowWidth: 40, + + /** 车次窗高度*/ + trainWindowHeight: 15, + + /** 车次窗颜色*/ + trainWindowColor: '#4DD43F' +}; + +// Enable Theme.extend. +enableClassExtend(Theme); +enableClassCheck(Theme); + +export default Theme; \ No newline at end of file diff --git a/src/jmap/config/defaultSkin.js b/src/jmap/config/defaultStyle.js similarity index 98% rename from src/jmap/config/defaultSkin.js rename to src/jmap/config/defaultStyle.js index 4839b41cf..55f10343d 100644 --- a/src/jmap/config/defaultSkin.js +++ b/src/jmap/config/defaultStyle.js @@ -1,4 +1,4 @@ -export default class DefaultSkin { +export default class defaultStyle { constructor() { /** 默认背景 颜色*/ this.backgroundColor = '#000000'; diff --git a/src/jmap/config/deviceStyle.js b/src/jmap/config/deviceStyle.js index d9c5497e6..c377fd47c 100644 --- a/src/jmap/config/deviceStyle.js +++ b/src/jmap/config/deviceStyle.js @@ -1,16 +1,10 @@ -import beijingSkin from '../theme/bejing'; -import fuzhouSkin from '../theme/fuzhou'; -import chengduSkin from '../theme/chengdu'; -import batongSkin from '../theme/batong'; - -/** 皮肤配置*/ -const deviceSkin = { - '02': fuzhouSkin, - '03': beijingSkin, - '04': chengduSkin, - '05': batongSkin +const mapDeviceStyle = { + '02': 'fuzhou_01', + '03': 'bejing_01', + '04': 'chengdu_03', + '05': 'batong_01' }; export function selectSkinStyle(code) { - return deviceSkin[code]; + return require(`./theme/${mapDeviceStyle[code]}`).default; } diff --git a/src/jmap/theme/batong.js b/src/jmap/config/theme/batong_01.js similarity index 98% rename from src/jmap/theme/batong.js rename to src/jmap/config/theme/batong_01.js index ec1af9a5d..43e7abbff 100644 --- a/src/jmap/theme/batong.js +++ b/src/jmap/config/theme/batong_01.js @@ -1,7 +1,7 @@ -import defaultSkin from '../config/defaultSkin'; -import deviceType from '../constant/deviceType'; +import defaultStyle from '../defaultStyle'; +import deviceType from '../../constant/deviceType'; -class Batong extends defaultSkin { +class SkinStyle extends defaultStyle { constructor() { super(); this[deviceType.Link] = { @@ -373,6 +373,4 @@ class Batong extends defaultSkin { } } -const batongSkin = new Batong(); - -export default batongSkin; +export default new SkinStyle(); diff --git a/src/jmap/theme/bejing.js b/src/jmap/config/theme/bejing_01.js similarity index 98% rename from src/jmap/theme/bejing.js rename to src/jmap/config/theme/bejing_01.js index 2bce78b2e..f6c766566 100644 --- a/src/jmap/theme/bejing.js +++ b/src/jmap/config/theme/bejing_01.js @@ -1,7 +1,7 @@ -import defaultSkin from '../config/defaultSkin'; -import deviceType from '../constant/deviceType'; +import defaultStyle from '../defaultStyle'; +import deviceType from '../../constant/deviceType'; -class Beijing extends defaultSkin { +class SkinStyle extends defaultStyle { constructor() { super(); this[deviceType.Link] = { @@ -426,6 +426,4 @@ class Beijing extends defaultSkin { } } -const beijingSkin = new Beijing(); - -export default beijingSkin; +export default new SkinStyle(); diff --git a/src/jmap/theme/chengdu.js b/src/jmap/config/theme/chengdu_03.js similarity index 98% rename from src/jmap/theme/chengdu.js rename to src/jmap/config/theme/chengdu_03.js index b5f185018..521c1e353 100644 --- a/src/jmap/theme/chengdu.js +++ b/src/jmap/config/theme/chengdu_03.js @@ -1,7 +1,7 @@ -import defaultSkin from '../config/defaultSkin'; -import deviceType from '../constant/deviceType'; +import defaultStyle from '../defaultStyle'; +import deviceType from '../../constant/deviceType'; -class Beijing extends defaultSkin { +class SkinStyle extends defaultStyle { constructor() { super(); this[deviceType.Link] = { @@ -378,6 +378,4 @@ class Beijing extends defaultSkin { } } -const chengduSkin = new Beijing(); - -export default chengduSkin; +export default new SkinStyle(); diff --git a/src/jmap/theme/fuzhou.js b/src/jmap/config/theme/fuzhou_01.js similarity index 98% rename from src/jmap/theme/fuzhou.js rename to src/jmap/config/theme/fuzhou_01.js index 76874fb82..74140db61 100644 --- a/src/jmap/theme/fuzhou.js +++ b/src/jmap/config/theme/fuzhou_01.js @@ -1,7 +1,7 @@ -import defaultSkin from '../config/defaultSkin'; -import deviceType from '../constant/deviceType'; +import defaultStyle from '../defaultStyle'; +import deviceType from '../../constant/deviceType'; -class Fuzhou extends defaultSkin { +class SkinStyle extends defaultStyle { constructor() { super(); this[deviceType.Link] = { @@ -368,6 +368,4 @@ class Fuzhou extends defaultSkin { } } -const fuzhouSkin = new Fuzhou(); - -export default fuzhouSkin; +export default new SkinStyle(); diff --git a/src/jmap/map.js b/src/jmap/map.js index 2fae18d8d..80d7a6579 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -8,7 +8,6 @@ import deviceState from './constant/deviceState'; import { selectSkinStyle } from './config/deviceStyle'; import deviceType from './constant/deviceType'; import { parser, deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser'; -import { lstat } from 'fs'; const renderer = 'canvas'; const devicePixelRatio = 1; diff --git a/src/jmap/shape/Switch/index.js b/src/jmap/shape/Switch/index.js index 3ccbae572..f3c0889d7 100644 --- a/src/jmap/shape/Switch/index.js +++ b/src/jmap/shape/Switch/index.js @@ -325,6 +325,8 @@ export default class Switch extends Group { case '04': this.setForkAction(); /** 挤岔*/ break; + default: + this.setLocationAction(); } } diff --git a/src/jmap/utils/Uid.js b/src/jmap/utils/Uid.js index 5a9a33d71..386cefc4a 100644 --- a/src/jmap/utils/Uid.js +++ b/src/jmap/utils/Uid.js @@ -6,6 +6,6 @@ var base = 0; * @return {string} */ export function getUID(type) { - // use Math.random to make id as unique as possible. - return [(type || ''), base++, Math.random().toFixed(5)].join('_'); -} \ No newline at end of file + // 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 index 6e255628a..2567e7ac7 100644 --- a/src/jmap/utils/Uname.js +++ b/src/jmap/utils/Uname.js @@ -4,13 +4,13 @@ * @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(); + 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(); } \ No newline at end of file