rt-sim-training-client/src/views/newMap/newMapdraft/mapoperate/models.js
2020-07-02 18:47:39 +08:00

167 lines
6.1 KiB
JavaScript

// import { deepAssign } from '@/utils/index';
class Model {
constructor(type) {
this[`${type}Model`]();
}
SectionModel() {
this._type = 'Section';
this.code = '';
this.name = '';
this.type = '01';
this.relStandCode = ''; // 关联站台编码
this.leftStopPointOffset = 0; // 左向停车点偏移量
this.rightStopPointOffset = 0; // 右向停车点偏移量
this.destinationCode = ''; // 目的地码
this.destinationCodePoint = { x: 0, y: 0 }; // 目的地码坐标
this.namePosition = { x: 0, y: 0 };
this.kmRangeRight = 0;
this.kmRangeLeft = 0;
this.region = '';
this.logicSectionCodeList = [];
this.logicSectionShow = false; // 是否显示逻辑区段
this.standTrack = false; // 是否站台轨
this.standTrackName = '';
this.standTrackNamePosition = { x: 0, y: 0 };
this.reentryTrack = false; // 是否折返轨
this.reentryTrackName = '';
this.reentryTrackNamePosition = { x: 0, y: 0 };
this.transferTrack = false; // 是否转换轨
this.transferTrackName = '';
this.transferTrackNamePosition = { x: 0, y: 0 };
this.switchSection = false; // 是否关联道岔
this.relSwitchCode = '';
this.stationCode = '';
this.nameShow = true;
this.logicSectionNameSort = true;
this.sepTypeLeft = '00';
this.sepTypeRight = '00';
this.parentCode = '';
this.points = [];
this.lengthFact = 0;
this.curve = false; // 是否曲线
this.leftSectionCode = '';
this.rightSectionCode = '';
this.trainWindowCode = '';
this.relevanceSectionList = [];
this.logicSectionStartOffset = 0;
this.logicSectionEndOffset = 0;
this.leftAxlePosition = 0;
this.rightAxlePosition = 0;
this.roadType = null;
this.firstTurnBack = false;
this.belongStation = ''; // 所属车站
this.rightAxleOffset = { x: 0, y: 0 };
this.leftAxleOffset = { x: 0, y: 0 };
}
SignalModel() {
this._type = 'Signal';
this.code = '';
this.name = '';
this.type = 'PROTECTION';
this.uniqueName = '';
this.nameShow = true;
this.lampPostType = '01'; // 灯柱类型
this.lampPositionType = '01';
this.leftOrRight = 'L';
this.right = false;
this.virtual = false; // 是否虚拟信号机
this.positionType = '01';
this.namePosition = { x: 0, y: 0 };
this.stationCode = '';
this.sectionOffset = 0;
this.rotate = 0;
this.nameRotated = false;
this.sectionCode = '';
this.guideShow = false;
this.buttonShow = false;
this.position = { x: 0, y: 0 };
this.positionPoint = { x: 0, y: 0 };
this.buttonPosition = { x: 0, y: 0 };
this.guidePosition = { x: 0, y: 0 };
this.interlockStationCode = '';
this.callOn = true;
this.turnBack = false;
this.ctc = true; // 是否灭灯显示
this.noOverlap = false; // 是否无延续保护
}
SwitchModel() {
this._type = 'Switch';
this.code = '';
this.name = '';
this.turnTime = 0;
this.nameShow = true;
this.namePosition = { x: 0, y: 0 };
this.stationCode = '';
this.timeoutShow = false;
this.sectionACode = '';
this.sectionBCode = '';
this.sectionCCode = '';
this.tp = { x: 0, y: 0 };
}
StationModel() {
this._type = 'Station';
this.centralized = false;
this.ciStation = false; // 是否联锁站
this.depot = false; // 是否停车场或者车辆段
this.reentry = false; // 是否折返车站
this.smallRouting = false; // 是否小交路
this.number = ''; // 编号
this.code = '';
this.zcCode = '';
this.visible = true;
this.runPlanName = '';
this.name = '';
this.nameFont = '22';
this.nameFontColor = '#FFFFFF';
this.subheadDisplay = false;
this.subhead = ''; // 副标题
this.subheadFont = '22';
this.subheadFontColor = '#FFFFFF';
this.subheadPosition = { x: 0, y: 0 };
this.kmPostShow = true;
this.kmRange = 0;
this.kmPost = '1000km~2000km';
this.kmPostFont = '8';
this.kmPostFontColor = '#FFFFFF';
this.isShowControlMode = '';
this.chargeStationCodeList = [];
this.relStationCodeList = []; // 联锁站关联车站列表
this.position = { x: 0, y: 0 };
this.kilometerPosition = { x: 0, y: 0 }; // 公里标偏移坐标
this.createControlMode = false;
this.createTurnBack = false;
this.turnBackPoint = {x: 0, y: 0}; // 按图折返坐标
this.controlModePoint = { x: 0, y: 0 }; // 控制模式坐标
}
StationStandModel() {
this._type = 'StationStand';
this.code = '';
this.name = '';
this.deviceStationCode = ''; // 设备集中站
this.width = 0;
this.height = 0;
this.stationCode = ''; // 所属车站
this.position = { x: 0, y: 0 };
this.visible = true; // 是否显示
this.inside = false; // 内外站台显示
this.right = true;
this.standTrackCode = ''; // 关联站台轨
this.small = false;
this.defaultReentryStrategy = ''; // 默认折返策略
this.stopJumpLamp = false; // 跳停功能按钮
this.stopJumpLampPoint = {x: 0, y: 0}; // 跳停功能按钮坐标
this.cancelStopJumpLamp = false; // 取消跳停功能按钮
this.cancelStopJumpLampPoint = {x: 0, y: 0}; // 取消跳停功能按钮坐标
this.upDetainLamp = false; // 上行扣车功能按钮
this.upDetainLampPoint = {x: 0, y: 0}; // 上行扣车功能按钮坐标
this.downDetainLamp = false; // 下行扣车功能按钮
this.downDetainLampPoint = {x: 0, y: 0}; // 下行扣车功能按钮坐标
}
}
export default function getModel(type) {
const model = new Model(type);
return model;
}