2019-11-29 12:51:58 +08:00
|
|
|
import Group from 'zrender/src/container/Group';
|
2020-09-15 17:08:28 +08:00
|
|
|
// 站台元素
|
|
|
|
import ESolidStand from './safeStand/ESolidStand';
|
|
|
|
import EHollowStand from './safeStand/EHollowStand';
|
|
|
|
import EGapStand from './safeStand/EGapStand';
|
|
|
|
// 扣车元素
|
|
|
|
import EDetain from './detain/EDetain';
|
|
|
|
import EDetainHollow from './detain/EDetainHollow';
|
|
|
|
import EDetainCircle from './detain/EDetainCircle';
|
|
|
|
import EDetainRect from './detain/EDetainRect';
|
|
|
|
// 跳停元素
|
|
|
|
import EJump from './jump/EJump';
|
|
|
|
import EJumpCircle from './jump/EJumpCircle';
|
|
|
|
|
2019-11-29 12:51:58 +08:00
|
|
|
import ETime from './ETime';
|
|
|
|
import ELevel from './ELevel';
|
|
|
|
import EReentry from './EReentry';
|
2020-09-15 17:08:28 +08:00
|
|
|
|
|
|
|
// 紧急停车
|
|
|
|
import EEmergentCross from './emergent/EEmergentCross';
|
|
|
|
import EEmergentArrow from './emergent/EEmergentArrow';
|
|
|
|
import EEmergentRhombus from './emergent/EEmergentRhombus';
|
|
|
|
|
2019-11-29 12:51:58 +08:00
|
|
|
import EMouse from './EMouse';
|
2020-09-15 17:08:28 +08:00
|
|
|
|
2019-12-04 11:32:30 +08:00
|
|
|
import EHighlight from '../element/EHighlight';
|
2020-02-03 17:17:56 +08:00
|
|
|
import ETrainStop from './ETrainStop';
|
|
|
|
import ETrainDepart from './ETrainDepart';
|
2020-09-15 17:08:28 +08:00
|
|
|
|
2020-04-24 18:23:17 +08:00
|
|
|
import EPatternFilter from './EPatternFilter';
|
2020-10-27 15:11:06 +08:00
|
|
|
import EStopJumpLamp from './functionButton/EStopJumpLamp';
|
|
|
|
import ECancelStopJumpLamp from './functionButton/ECancelStopJumpLamp';
|
|
|
|
import EUpDetainLamp from './functionButton/EUpDetainLamp';
|
|
|
|
import EDownDetainLamp from './functionButton/EDownDetainLamp';
|
|
|
|
|
2020-11-03 16:06:11 +08:00
|
|
|
import ETrainSetButton from './ETrainSetButton';
|
2021-01-18 18:06:08 +08:00
|
|
|
import EStationPlatform from './EStationPlatform';
|
2020-11-03 16:06:11 +08:00
|
|
|
|
2020-03-11 15:10:08 +08:00
|
|
|
import {isShowThePrdType} from '../../utils/handlePath';
|
2020-10-27 15:11:06 +08:00
|
|
|
import {traverseLineElements, traverseStatusElements} from '../utils/ShapeStatusCovert';
|
2019-11-29 12:51:58 +08:00
|
|
|
|
|
|
|
class StationStand extends Group {
|
|
|
|
constructor(model, style) {
|
|
|
|
super();
|
|
|
|
this._code = model.code;
|
|
|
|
this._type = model._type;
|
|
|
|
this.model = model;
|
|
|
|
this.style = style;
|
|
|
|
this.zlevel = model.zlevel;
|
|
|
|
this.z = 1;
|
2020-03-13 13:01:58 +08:00
|
|
|
this.isShowShape = true;
|
2019-11-29 12:51:58 +08:00
|
|
|
this.create();
|
|
|
|
this.createMouseEvent();
|
|
|
|
this.setVisible(model.visible);
|
2020-12-14 15:22:47 +08:00
|
|
|
this.setShowMode();
|
2019-11-29 12:51:58 +08:00
|
|
|
this.setState(model);
|
|
|
|
}
|
|
|
|
create() {
|
2020-10-27 15:11:06 +08:00
|
|
|
// 加载皮肤控制的元素
|
2019-11-29 12:51:58 +08:00
|
|
|
const model = this.model;
|
|
|
|
const style = this.style;
|
2020-11-13 10:21:36 +08:00
|
|
|
|
2020-12-14 15:51:14 +08:00
|
|
|
// // 站台所有的绘图元素
|
2020-09-09 13:55:42 +08:00
|
|
|
const elementTypeList = {
|
2020-09-15 17:08:28 +08:00
|
|
|
'solidStand':ESolidStand, // 矩形实心站台 (普通站台样式)
|
|
|
|
'hollowStand':EHollowStand, // 矩形空心站台 (西安二号线站台样式)
|
|
|
|
'gapStand':EGapStand, // 分割站台(哈尔滨站台特有)
|
|
|
|
|
2020-09-15 18:28:32 +08:00
|
|
|
'emergentCross':EEmergentCross, // 站台紧急关闭 西安二号线 正八边形
|
2020-09-15 17:08:28 +08:00
|
|
|
'emergentArrow':EEmergentArrow, // 站台紧急关闭 哈尔滨 箭头型
|
2020-09-15 18:28:32 +08:00
|
|
|
'emergentRhombus':EEmergentRhombus, // 站台紧急关闭 普通 菱形
|
2020-09-15 17:08:28 +08:00
|
|
|
|
|
|
|
'jump':EJump, // 列车跳停
|
|
|
|
'jumpCircle':EJumpCircle, // 列车跳停(带圆圈)
|
|
|
|
|
|
|
|
'detainNormal':EDetain, // 普通扣车图标
|
|
|
|
'detainHollow':EDetainHollow, // 含空心圆的扣车图标
|
2020-09-09 13:55:42 +08:00
|
|
|
'detainCircle':EDetainCircle, // 圆形扣车图标
|
|
|
|
'detainRect':EDetainRect, // 矩形扣车图标
|
2020-09-15 17:08:28 +08:00
|
|
|
|
2020-09-09 13:55:42 +08:00
|
|
|
'stopTime':ETime, // 停站时间
|
|
|
|
'level':ELevel, // 运行等级
|
|
|
|
'patternFilter':EPatternFilter, // 模式筛选标识(西安二号线特殊的情况)
|
2020-09-15 17:08:28 +08:00
|
|
|
|
2020-09-09 13:55:42 +08:00
|
|
|
'reentry':EReentry, // 站台折返策略
|
2020-09-15 18:28:32 +08:00
|
|
|
'trainStop':ETrainStop, // 列车停车点标识 哈尔滨一号线
|
2020-11-03 16:06:11 +08:00
|
|
|
'trainDepart':ETrainDepart, // 列车停站时间 哈尔滨一号线
|
2021-01-18 18:06:08 +08:00
|
|
|
'trainSetButton':ETrainSetButton, // 站台 扣车/取消扣车,越站/取消越站 设置按钮 哈尔滨一号线
|
|
|
|
'stationPlatform':EStationPlatform // 站台 月台 南京二号线 使用
|
2020-09-09 13:55:42 +08:00
|
|
|
};
|
2020-09-15 17:08:28 +08:00
|
|
|
// 遍历当前线路下的绘图元素 组合模式
|
|
|
|
traverseLineElements(style.StationStand, elementTypeList, model, style, this);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2020-10-27 15:11:06 +08:00
|
|
|
// 加载后端返回的状态控制的绘图
|
|
|
|
const statusElementList = {
|
|
|
|
'stopJumpLamp':EStopJumpLamp,
|
|
|
|
'cancelStopJumpLamp':ECancelStopJumpLamp,
|
|
|
|
'upDetainLamp':EUpDetainLamp,
|
|
|
|
'downDetainLamp':EDownDetainLamp
|
|
|
|
};
|
|
|
|
// 遍历后端返回的状态控制的绘图
|
|
|
|
if (model.previewOrMapDraw || isShowThePrdType(model.prdType, style.StationStand.common.functionButtonShow)) {
|
|
|
|
traverseStatusElements(statusElementList, model, style, this);
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
}
|
2020-09-09 13:55:42 +08:00
|
|
|
|
2020-10-27 15:11:06 +08:00
|
|
|
createMouseEvent() {
|
|
|
|
const path = window.location.href;
|
|
|
|
if (path.includes('/map/draw')) {
|
|
|
|
this.highlight = new EHighlight(this);
|
|
|
|
this.add(this.highlight);
|
2021-01-18 16:22:26 +08:00
|
|
|
this.on('mouseout', () => { this.highlight.mouseout(); });
|
|
|
|
this.on('mouseover', () => { this.highlight.mouseover(); });
|
2020-10-27 15:11:06 +08:00
|
|
|
} else {
|
|
|
|
if (this.style.StationStand.mouseOverStyle) {
|
|
|
|
this.mouseEvent = new EMouse(this);
|
|
|
|
this.add(this.mouseEvent);
|
|
|
|
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
|
|
|
|
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
|
|
|
|
}
|
2020-11-03 16:06:11 +08:00
|
|
|
if (this.style.StationStand.common.bgShow) {
|
|
|
|
this.highlight = new EHighlight(this);
|
|
|
|
this.add(this.highlight);
|
|
|
|
}
|
2020-03-06 10:05:21 +08:00
|
|
|
}
|
2020-03-05 18:17:47 +08:00
|
|
|
}
|
2020-09-15 17:08:28 +08:00
|
|
|
|
2019-11-29 12:51:58 +08:00
|
|
|
setVisible(visible) {
|
|
|
|
if (visible) {
|
|
|
|
this.eachChild(elem => { elem.show(); });
|
|
|
|
} else {
|
|
|
|
this.eachChild(elem => { elem.hide(); });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 恢复初始状态*/
|
|
|
|
recover() {
|
2020-09-09 13:55:42 +08:00
|
|
|
const currentTypeList = this.style.StationStand.elemnetType;
|
|
|
|
currentTypeList.forEach(element => {
|
|
|
|
this[element].recover();
|
|
|
|
});
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
setState(model) {
|
2020-03-13 13:01:58 +08:00
|
|
|
if (!this.isShowShape) return;
|
2020-09-09 13:55:42 +08:00
|
|
|
// // 新版地图使用新版状态变更方式
|
2019-11-29 12:51:58 +08:00
|
|
|
this.recover();
|
2020-09-09 13:55:42 +08:00
|
|
|
|
2020-09-15 18:28:32 +08:00
|
|
|
// 更新状态
|
2020-09-15 17:08:28 +08:00
|
|
|
const currentTypeList = this.style.StationStand.elemnetType;
|
|
|
|
currentTypeList.forEach(element => {
|
|
|
|
this[element].setState(model);
|
|
|
|
});
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
getBoundingRect() {
|
2020-09-15 17:08:28 +08:00
|
|
|
const element = this.style.StationStand.elemnetType[0];
|
|
|
|
const rect = this[element].getBoundingRect().clone();
|
2019-11-29 12:51:58 +08:00
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
2020-04-07 17:19:28 +08:00
|
|
|
getShapeTipPoint(opts) {
|
|
|
|
let rect;
|
|
|
|
if (opts.subDeviceType == 'DetainLamp') {
|
|
|
|
if (this.model.right) {
|
|
|
|
opts.subDeviceType = 'UpDetainLamp';
|
|
|
|
} else {
|
|
|
|
opts.subDeviceType = 'DownDetainLamp';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch (opts.subDeviceType) {
|
|
|
|
case 'StopJumpLamp': {
|
2020-10-27 15:11:06 +08:00
|
|
|
rect = this.stopJumpLamp.getBoundingRect();
|
2020-04-07 17:19:28 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'CancelStopJumpLamp': {
|
2020-10-27 15:11:06 +08:00
|
|
|
rect = this.cancelStopJumpLamp.getBoundingRect();
|
2020-04-07 17:19:28 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'UpDetainLamp': {
|
2020-10-27 15:11:06 +08:00
|
|
|
rect = this.upDetainLamp.getBoundingRect();
|
2020-04-07 17:19:28 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'DownDetainLamp': {
|
2020-10-27 15:11:06 +08:00
|
|
|
rect = this.downDetainLamp.getBoundingRect();
|
2020-04-07 17:19:28 +08:00
|
|
|
break;
|
|
|
|
}
|
2020-11-03 16:06:11 +08:00
|
|
|
case 'trainSetButton': {
|
|
|
|
rect = this.trainSetButton.getBoundingRect();
|
|
|
|
break;
|
|
|
|
}
|
2020-04-07 17:19:28 +08:00
|
|
|
default: {
|
|
|
|
rect = this.getBoundingRect();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
if (rect) {
|
|
|
|
return {
|
|
|
|
x: rect.x + rect.width / 2,
|
|
|
|
y: rect.y
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2019-12-04 11:32:30 +08:00
|
|
|
|
|
|
|
drawSelected(selected) {
|
|
|
|
this.highlight && this.highlight.drawSelected(selected);
|
|
|
|
}
|
|
|
|
|
2020-03-11 15:10:08 +08:00
|
|
|
// 设置显示模式
|
|
|
|
setShowMode() {
|
|
|
|
const showMode = this.model.showMode;
|
|
|
|
const showConditions = this.style.StationStand.common.functionButtonShow;
|
|
|
|
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
2020-10-27 15:11:06 +08:00
|
|
|
this.stopJumpLamp && this.stopJumpLamp.show();
|
|
|
|
this.cancelStopJumpLamp && this.cancelStopJumpLamp.show();
|
2020-03-11 15:10:08 +08:00
|
|
|
this.upDetainLamp && this.upDetainLamp.show();
|
|
|
|
this.downDetainLamp && this.downDetainLamp.show();
|
|
|
|
} else {
|
2020-10-27 15:11:06 +08:00
|
|
|
this.stopJumpLamp && this.stopJumpLamp.hide();
|
|
|
|
this.cancelStopJumpLamp && this.cancelStopJumpLamp.hide();
|
2020-03-11 15:10:08 +08:00
|
|
|
this.upDetainLamp && this.upDetainLamp.hide();
|
|
|
|
this.downDetainLamp && this.downDetainLamp.hide();
|
|
|
|
}
|
|
|
|
}
|
2020-03-13 13:01:58 +08:00
|
|
|
setShowStation(stationCode) {
|
2020-05-08 18:52:46 +08:00
|
|
|
if ((!stationCode || this.model.deviceStationCode === stationCode) && this.model.visible) {
|
2020-03-13 13:01:58 +08:00
|
|
|
this.eachChild(item => {
|
|
|
|
item.show();
|
|
|
|
});
|
|
|
|
this.isShowShape = true;
|
|
|
|
this.setState(this.model);
|
|
|
|
} else {
|
|
|
|
this.eachChild(item => {
|
|
|
|
item.hide();
|
|
|
|
});
|
|
|
|
this.isShowShape = false;
|
|
|
|
}
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
export default StationStand;
|