2019-11-29 12:51:58 +08:00
|
|
|
/**/
|
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
import ETime from './ETime';
|
|
|
|
import ELevel from './ELevel';
|
|
|
|
import EReentry from './EReentry';
|
|
|
|
import EDetain from './EDetain';
|
|
|
|
import ESafeStand from './ESafeStand';
|
|
|
|
import ESafeEmergent from './ESafeEmergent';
|
|
|
|
import EMouse from './EMouse';
|
|
|
|
import EJump from './EJump';
|
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-03-05 18:17:47 +08:00
|
|
|
import EControl from '../element/EControl';
|
2020-03-11 15:10:08 +08:00
|
|
|
import {isShowThePrdType} from '../../utils/handlePath';
|
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.doors = new Group();
|
|
|
|
this.create();
|
|
|
|
this.createMouseEvent();
|
2020-03-11 15:10:08 +08:00
|
|
|
if (isShowThePrdType(model.prdType, style.StationStand.common.functionButtonShow) || model.previewOrMapDraw) {
|
2020-03-06 11:26:52 +08:00
|
|
|
this.createFunctionButton();
|
|
|
|
}
|
2020-03-11 15:10:08 +08:00
|
|
|
if (model.previewOrMapDraw) {
|
|
|
|
this.setShowMode();
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
this.setVisible(model.visible);
|
|
|
|
this.setState(model);
|
2019-12-04 11:32:30 +08:00
|
|
|
this.checkIsDrawMap();
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
create() {
|
|
|
|
const model = this.model;
|
|
|
|
const style = this.style;
|
2019-12-06 18:03:13 +08:00
|
|
|
const drict = 1;
|
2019-11-29 12:51:58 +08:00
|
|
|
|
|
|
|
/** 列车站台*/
|
|
|
|
const standX = model.position.x - model.width / 2;
|
2019-12-11 17:07:29 +08:00
|
|
|
const standY = model.position.y - model.height / 2;
|
2019-11-29 12:51:58 +08:00
|
|
|
this.safeStand = new ESafeStand({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: style,
|
|
|
|
x: standX,
|
|
|
|
y: standY,
|
2020-02-03 17:17:56 +08:00
|
|
|
name: model.name,
|
2020-02-04 11:01:50 +08:00
|
|
|
inside: model.inside,
|
2020-02-04 11:25:21 +08:00
|
|
|
right: model.right,
|
2019-11-29 12:51:58 +08:00
|
|
|
width: model.width,
|
|
|
|
height: model.height
|
|
|
|
});
|
|
|
|
this.add(this.safeStand);
|
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
/** 站台紧急关闭*/
|
2020-02-17 17:50:15 +08:00
|
|
|
const emergentH = model.inside ? model.right ? 1 : -1 : model.right ? -1 : 1;
|
2020-03-24 15:09:25 +08:00
|
|
|
let emergentWidth = 0;
|
|
|
|
if (style.StationStand.stopTime.position) {
|
|
|
|
emergentWidth = model.width / 2;
|
|
|
|
}
|
|
|
|
let emergentX = model.position.x + (style.StationStand.stopTime.position || emergentH) * style.StationStand.standEmergent.offset.x - emergentWidth;
|
2020-02-17 17:50:15 +08:00
|
|
|
let emergentY = model.position.y + emergentH * (model.height / 2 + style.StationStand.standEmergent.offset.y);
|
2020-02-03 17:17:56 +08:00
|
|
|
if (style.StationStand.common.special) {
|
|
|
|
emergentX = model.position.x;
|
|
|
|
emergentY = model.position.y;
|
|
|
|
}
|
2019-12-11 17:07:29 +08:00
|
|
|
this.emergent = new ESafeEmergent({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
2020-02-04 11:01:50 +08:00
|
|
|
inside: model.inside,
|
2020-02-04 11:25:21 +08:00
|
|
|
right: model.right,
|
2020-02-03 17:17:56 +08:00
|
|
|
width: model.width,
|
2019-12-11 17:07:29 +08:00
|
|
|
x: emergentX,
|
|
|
|
y: emergentY,
|
|
|
|
r: style.StationStand.standEmergent.mergentR,
|
|
|
|
n: 4
|
|
|
|
});
|
2020-03-23 13:48:35 +08:00
|
|
|
this.add(this.emergent);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2020-02-03 17:17:56 +08:00
|
|
|
// 列车停站
|
|
|
|
const stopX = model.position.x;
|
|
|
|
const stopY = model.position.y;
|
|
|
|
this.trainStop = new ETrainStop({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
2020-02-04 11:01:50 +08:00
|
|
|
inside: model.inside,
|
2020-02-04 11:25:21 +08:00
|
|
|
right: model.right,
|
2020-02-03 17:17:56 +08:00
|
|
|
width: model.width,
|
|
|
|
x: stopX,
|
|
|
|
y: stopY,
|
|
|
|
r: style.StationStand.standEmergent.mergentR,
|
|
|
|
n: 4
|
|
|
|
});
|
2020-03-23 13:48:35 +08:00
|
|
|
this.add(this.trainStop);
|
2020-02-03 17:17:56 +08:00
|
|
|
|
|
|
|
// 列车出发
|
|
|
|
const departX = model.position.x;
|
|
|
|
const departY = model.position.y;
|
|
|
|
this.trainDepart = new ETrainDepart({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
2020-02-04 11:01:50 +08:00
|
|
|
inside: model.inside,
|
2020-02-04 11:25:21 +08:00
|
|
|
right: model.right,
|
2020-02-03 17:17:56 +08:00
|
|
|
width: model.width,
|
|
|
|
x: departX,
|
2020-02-04 15:43:58 +08:00
|
|
|
y: departY
|
|
|
|
});
|
2020-03-23 13:48:35 +08:00
|
|
|
this.add(this.trainDepart);
|
2020-02-03 17:17:56 +08:00
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
/** 站台折返策略*/
|
2020-01-13 16:52:00 +08:00
|
|
|
const reentryH = style.StationStand.standEmergent.mergentR;
|
2019-12-11 17:07:29 +08:00
|
|
|
const reentryX = model.position.x - (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.x - model.width / 2);
|
|
|
|
const reentryY = model.position.y + (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.y) + drict * reentryH;
|
|
|
|
this.reentry = new EReentry({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
|
|
|
drict: drict,
|
|
|
|
x: reentryX,
|
|
|
|
y: reentryY,
|
|
|
|
lineWidth: 0,
|
|
|
|
fill: style.StationStand.reentry.noHumanColor
|
|
|
|
});
|
2020-03-23 13:48:35 +08:00
|
|
|
this.add(this.reentry);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
/** 站台扣车*/
|
2020-01-13 16:52:00 +08:00
|
|
|
const detainD = model.right ? 1 : -1;
|
2020-03-27 10:17:24 +08:00
|
|
|
const detainX = model.position.x - (detainD) * (style.StationStand.detainCar.offset.x - model.width / 2);
|
|
|
|
const detainY = model.position.y + (detainD) * (style.StationStand.detainCar.offset.y - model.height / 2);
|
2019-12-11 17:07:29 +08:00
|
|
|
this.detain = new EDetain({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: style,
|
|
|
|
x: detainX,
|
|
|
|
y: detainY,
|
2020-02-03 17:17:56 +08:00
|
|
|
width: model.width,
|
2020-02-04 11:01:50 +08:00
|
|
|
inside: model.inside,
|
2020-03-26 15:04:52 +08:00
|
|
|
right: model.right
|
2019-12-11 17:07:29 +08:00
|
|
|
});
|
2020-03-23 13:48:35 +08:00
|
|
|
this.add(this.detain);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
/** 停站时间*/
|
2020-03-27 10:17:24 +08:00
|
|
|
if (style.StationStand.stopTime.offset) {
|
|
|
|
const timeDrict = model.right ? 1 : -1;
|
|
|
|
const timeX = model.position.x - timeDrict * (style.StationStand.stopTime.offset.x - model.width / 2);
|
|
|
|
const timeY = model.position.y + timeDrict * style.StationStand.stopTime.offset.y;
|
|
|
|
this.time = new ETime({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
|
|
|
x: timeX,
|
|
|
|
y: timeY,
|
|
|
|
name: model.parkingTime || '30'
|
|
|
|
});
|
|
|
|
this.add(this.time);
|
|
|
|
}
|
2019-12-11 17:07:29 +08:00
|
|
|
|
|
|
|
/** 运行等级*/
|
2020-02-17 17:50:15 +08:00
|
|
|
const levelDrict = model.right ? 1 : -1;
|
|
|
|
const levelX = model.position.x - levelDrict * (style.StationStand.level.offset.x - model.width / 2);
|
|
|
|
const levelY = model.position.y + levelDrict * (style.StationStand.level.offset.y);
|
2019-12-11 17:07:29 +08:00
|
|
|
this.level = new ELevel({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
|
|
|
x: levelX,
|
|
|
|
y: levelY,
|
2020-01-13 16:52:00 +08:00
|
|
|
name: model.runLevelTime || '5'
|
2019-12-11 17:07:29 +08:00
|
|
|
});
|
2020-03-23 13:48:35 +08:00
|
|
|
this.add(this.level);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
/** 列车停跳 */
|
|
|
|
if (style.StationStand.common.haveJumpShow) {
|
2020-02-17 17:50:15 +08:00
|
|
|
const jumpDirct = model.right ? -1 : 1;
|
2020-03-26 15:04:52 +08:00
|
|
|
const jumpX = model.position.x - jumpDirct * (style.StationStand.jump.offset.x - model.width / 2);
|
|
|
|
const jumpY = model.position.y + jumpDirct * style.StationStand.jump.offset.y;
|
2020-02-17 17:50:15 +08:00
|
|
|
const jumpCX = model.position.x - jumpDirct * (style.StationStand.jump.offset.x - model.width / 2);
|
|
|
|
const jumpCY = model.position.y + jumpDirct * style.StationStand.jump.offset.y;
|
2019-12-11 17:07:29 +08:00
|
|
|
this.jump = new EJump({
|
2019-11-29 12:51:58 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
2019-12-11 17:07:29 +08:00
|
|
|
x: jumpX,
|
|
|
|
y: jumpY,
|
|
|
|
cx: jumpCX,
|
|
|
|
cy: jumpCY,
|
2020-03-07 19:12:19 +08:00
|
|
|
width: model.width,
|
|
|
|
inside: model.inside,
|
2020-03-26 15:04:52 +08:00
|
|
|
right: model.right
|
2019-11-29 12:51:58 +08:00
|
|
|
});
|
2019-12-11 17:07:29 +08:00
|
|
|
this.add(this.jump);
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
createMouseEvent() {
|
|
|
|
if (this.style.StationStand.mouseOverStyle) {
|
|
|
|
this.mouseEvent = new EMouse(this);
|
|
|
|
this.add(this.mouseEvent);
|
|
|
|
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
|
|
|
|
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
|
|
|
|
}
|
|
|
|
}
|
2020-03-26 15:04:52 +08:00
|
|
|
createFunctionButton() {
|
2020-03-06 10:05:21 +08:00
|
|
|
const model = this.model;
|
|
|
|
const style = this.style;
|
|
|
|
if (model.stopJumpLamp) {
|
|
|
|
this.stopJumpLampButton = new EControl({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
arc: {
|
|
|
|
shape: {
|
|
|
|
cx: model.stopJumpLampPoint.x,
|
|
|
|
cy: model.stopJumpLampPoint.y,
|
|
|
|
r: style.Station.lamp.radiusR
|
|
|
|
},
|
2020-03-10 13:05:20 +08:00
|
|
|
subType: 'StopJumpLamp',
|
2020-03-06 10:05:21 +08:00
|
|
|
lineWidth: 0,
|
|
|
|
fill: style.StationStand.lamp.lampColor
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
position: [0, 0],
|
|
|
|
x: model.stopJumpLampPoint.x,
|
|
|
|
y: model.stopJumpLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance,
|
|
|
|
fontWeight: style.StationStand.text.fontWeight,
|
|
|
|
fontSize: style.StationStand.text.fontSize,
|
|
|
|
fontFamily: style.fontFamily,
|
|
|
|
text: '跳停',
|
|
|
|
textFill: '#fff',
|
|
|
|
textAlign: 'middle',
|
|
|
|
textVerticalAlign: 'top'
|
|
|
|
},
|
|
|
|
style: this.style
|
|
|
|
});
|
|
|
|
this.add(this.stopJumpLampButton);
|
|
|
|
}
|
|
|
|
if (model.cancelStopJumpLamp) {
|
|
|
|
this.cancelStopJumpLampButton = new EControl({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
arc: {
|
|
|
|
shape: {
|
|
|
|
cx: model.cancelStopJumpLampPoint.x,
|
|
|
|
cy: model.cancelStopJumpLampPoint.y,
|
|
|
|
r: style.Station.lamp.radiusR
|
|
|
|
},
|
2020-03-10 13:05:20 +08:00
|
|
|
subType: 'CancelStopJumpLamp',
|
2020-03-06 10:05:21 +08:00
|
|
|
lineWidth: 0,
|
|
|
|
fill: style.StationStand.lamp.lampColor
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
position: [0, 0],
|
|
|
|
x: model.cancelStopJumpLampPoint.x,
|
|
|
|
y: model.cancelStopJumpLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance,
|
|
|
|
fontWeight: style.StationStand.text.fontWeight,
|
|
|
|
fontSize: style.StationStand.text.fontSize,
|
|
|
|
fontFamily: style.fontFamily,
|
|
|
|
text: '取消跳停',
|
|
|
|
textFill: '#fff',
|
|
|
|
textAlign: 'middle',
|
|
|
|
textVerticalAlign: 'top'
|
|
|
|
},
|
|
|
|
style: this.style
|
|
|
|
});
|
|
|
|
this.add(this.cancelStopJumpLampButton);
|
|
|
|
}
|
|
|
|
if (model.upDetainLamp) {
|
|
|
|
this.upDetainLampButton = new EControl({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
arc: {
|
|
|
|
shape: {
|
|
|
|
cx: model.upDetainLampPoint.x,
|
|
|
|
cy: model.upDetainLampPoint.y,
|
|
|
|
r: style.Station.lamp.radiusR
|
|
|
|
},
|
2020-03-10 13:05:20 +08:00
|
|
|
subType: 'UpDetainLamp',
|
2020-03-06 10:05:21 +08:00
|
|
|
lineWidth: 0,
|
|
|
|
fill: style.StationStand.lamp.lampColor
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
position: [0, 0],
|
|
|
|
x: model.upDetainLampPoint.x,
|
|
|
|
y: model.upDetainLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance,
|
|
|
|
fontWeight: style.StationStand.text.fontWeight,
|
|
|
|
fontSize: style.StationStand.text.fontSize,
|
|
|
|
fontFamily: style.fontFamily,
|
|
|
|
text: '上行扣车',
|
|
|
|
textFill: '#fff',
|
|
|
|
textAlign: 'middle',
|
|
|
|
textVerticalAlign: 'top'
|
|
|
|
},
|
|
|
|
style: this.style
|
|
|
|
});
|
|
|
|
this.add(this.upDetainLampButton);
|
|
|
|
}
|
|
|
|
if (model.downDetainLamp) {
|
|
|
|
this.downDetainLampButton = new EControl({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
arc: {
|
|
|
|
shape: {
|
|
|
|
cx: model.downDetainLampPoint.x,
|
|
|
|
cy: model.downDetainLampPoint.y,
|
|
|
|
r: style.Station.lamp.radiusR
|
|
|
|
},
|
2020-03-10 13:05:20 +08:00
|
|
|
subType: 'DownDetainLamp',
|
2020-03-06 10:05:21 +08:00
|
|
|
lineWidth: 0,
|
|
|
|
fill: style.StationStand.lamp.lampColor
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
position: [0, 0],
|
|
|
|
x: model.downDetainLampPoint.x,
|
|
|
|
y: model.downDetainLampPoint.y + style.StationStand.lamp.radiusR + style.StationStand.text.distance,
|
|
|
|
fontWeight: style.StationStand.text.fontWeight,
|
|
|
|
fontSize: style.StationStand.text.fontSize,
|
|
|
|
fontFamily: style.fontFamily,
|
2020-03-10 11:16:53 +08:00
|
|
|
text: '下行扣车',
|
2020-03-06 10:05:21 +08:00
|
|
|
textFill: '#fff',
|
|
|
|
textAlign: 'middle',
|
|
|
|
textVerticalAlign: 'top'
|
|
|
|
},
|
|
|
|
style: this.style
|
|
|
|
});
|
|
|
|
this.add(this.downDetainLampButton);
|
|
|
|
}
|
2020-03-05 18:17:47 +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() {
|
|
|
|
this.time && this.time.hide();
|
|
|
|
this.level && this.level.hide();
|
2020-03-07 19:12:19 +08:00
|
|
|
this.detain && this.detain.hide();
|
2019-11-29 12:51:58 +08:00
|
|
|
this.emergent && this.emergent.hide();
|
2020-02-03 17:17:56 +08:00
|
|
|
this.trainStop && this.trainStop.hide(); // 列车停站
|
|
|
|
this.trainDepart && this.trainDepart.hide();
|
|
|
|
this.reentry && this.reentry.hide();
|
2019-11-29 12:51:58 +08:00
|
|
|
this.jump && this.jump.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 空闲*/
|
|
|
|
spare() {
|
2020-02-03 17:17:56 +08:00
|
|
|
if (!this.style.StationStand.common.special) {
|
|
|
|
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor);
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 列车停站*/
|
|
|
|
stop() {
|
2020-02-03 17:17:56 +08:00
|
|
|
if (!this.style.StationStand.common.special) {
|
|
|
|
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.stopColor);
|
2020-02-17 17:50:15 +08:00
|
|
|
} else {
|
2020-02-19 16:19:37 +08:00
|
|
|
this.trainStop && this.trainStop.show();
|
|
|
|
this.trainDepart && this.trainDepart.show();
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 站台紧急关闭*/
|
|
|
|
emergentClose() {
|
2020-02-03 17:17:56 +08:00
|
|
|
if (!this.style.StationStand.common.special) {
|
|
|
|
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor);
|
|
|
|
}
|
2020-03-07 19:12:19 +08:00
|
|
|
if (this.style.StationStand.common.special) {
|
|
|
|
this.detain && this.detain.show('E');
|
|
|
|
this.detain && this.detain.setColor('#fff');
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
this.emergent && this.emergent.show();
|
2020-02-17 17:50:15 +08:00
|
|
|
if (this.style.StationStand.standEmergent.flicker) {
|
|
|
|
this.emergent.getElement().animateStyle(true)
|
|
|
|
.when(0, { fill: this.style.backgroundColor })
|
|
|
|
.when(1000, { fill: this.style.StationStand.standEmergent.closeColor })
|
|
|
|
.when(2000, { fill: this.style.backgroundColor })
|
|
|
|
.start();
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
2020-01-07 09:23:04 +08:00
|
|
|
/** 指定列车跳站*/
|
2020-01-13 13:45:39 +08:00
|
|
|
designatedJumpStop() {
|
2020-01-07 09:23:04 +08:00
|
|
|
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor);
|
2020-03-26 15:04:52 +08:00
|
|
|
this.jump && this.jump.show(0);
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 站台跳停*/
|
2020-01-13 13:45:39 +08:00
|
|
|
jumpStop() {
|
2019-11-29 12:51:58 +08:00
|
|
|
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor);
|
2020-03-26 15:04:52 +08:00
|
|
|
this.jump && this.jump.show(1);
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 车站扣车*/
|
|
|
|
standDetainTrain() {
|
2020-03-07 11:05:38 +08:00
|
|
|
if (this.style.StationStand.common.special) {
|
|
|
|
this.detain && this.detain.show('H');
|
|
|
|
} else {
|
|
|
|
this.detain && this.detain.show();
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
this.detain && this.detain.setColor(this.style.StationStand.detainCar.detainTrainTextColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 中心扣车*/
|
|
|
|
centerDetainTrain() {
|
2020-03-07 11:05:38 +08:00
|
|
|
if (this.style.StationStand.common.special) {
|
|
|
|
this.detain && this.detain.show('H');
|
|
|
|
} else {
|
|
|
|
this.detain && this.detain.show();
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
this.detain && this.detain.setColor(this.style.StationStand.detainCar.centerTrainColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 中心+车站扣车*/
|
|
|
|
standAndCenterDetainTrain() {
|
2020-03-07 11:05:38 +08:00
|
|
|
if (this.style.StationStand.common.special) {
|
|
|
|
this.detain && this.detain.show('H');
|
|
|
|
} else {
|
|
|
|
this.detain && this.detain.show();
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
this.detain && this.detain.setColor(this.style.StationStand.detainCar.andCenterTrainColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 人工设置停战时间*/
|
|
|
|
setManuallyArmisticeTime(val) {
|
|
|
|
this.time && this.time.show();
|
|
|
|
this.time && this.time.setName(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 人工设置运行等级*/
|
|
|
|
setManuallyOperationLevel(val) {
|
|
|
|
this.level && this.level.show();
|
|
|
|
this.level && this.level.setName(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 无折返(默认)*/
|
|
|
|
noReentry() {
|
|
|
|
this.reentry && this.reentry.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 无人折返*/
|
|
|
|
noHumanReentry() {
|
|
|
|
this.reentry && this.reentry.show();
|
|
|
|
this.reentry && this.reentry.setColor(this.style.StationStand.reentry.noHumanColor);
|
|
|
|
}
|
|
|
|
/** 自动换端*/
|
|
|
|
autoChangeEnds() {
|
|
|
|
this.reentry && this.reentry.show();
|
|
|
|
this.reentry && this.reentry.setColor(this.style.StationStand.reentry.autoChangeEndsColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(model) {
|
2020-03-13 13:01:58 +08:00
|
|
|
if (!this.isShowShape) return;
|
2020-01-13 13:45:39 +08:00
|
|
|
// 新版地图使用新版状态变更方式
|
2019-11-29 12:51:58 +08:00
|
|
|
this.recover();
|
2020-01-13 13:45:39 +08:00
|
|
|
model.free && this.spare(); /** 空闲*/
|
|
|
|
model.trainParking && this.stop(); /** 列车停站*/
|
|
|
|
model.emergencyClosed && this.emergentClose(); /** 站台紧急关闭*/
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2020-01-13 13:45:39 +08:00
|
|
|
if (Number(model.parkingTime) > 0) {
|
|
|
|
this.setManuallyArmisticeTime(model.parkingTime); // 设置站台停车时间
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
2020-01-13 13:45:39 +08:00
|
|
|
if (Number(model.runLevelTime) > 0) {
|
2020-01-13 16:52:00 +08:00
|
|
|
this.setManuallyOperationLevel(model.runLevelTime); // 设置站台间运行等级
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
2020-01-13 13:45:39 +08:00
|
|
|
/** 设置跳停*/
|
2020-03-07 19:12:19 +08:00
|
|
|
model.assignSkip && this.designatedJumpStop(); // 指定列车跳停
|
2020-01-13 13:45:39 +08:00
|
|
|
model.allSkip && this.jumpStop(); // 站台全部跳停
|
|
|
|
|
2019-11-29 12:51:58 +08:00
|
|
|
/** 设置扣车*/
|
2020-01-07 09:23:04 +08:00
|
|
|
if (model.stationHoldTrain && model.centerHoldTrain) {
|
|
|
|
this.standAndCenterDetainTrain(); // 中心+车站扣车
|
|
|
|
} else if (model.stationHoldTrain) {
|
|
|
|
this.standDetainTrain(); // 车站扣车
|
|
|
|
} else if (model.centerHoldTrain) {
|
|
|
|
this.centerDetainTrain(); // 中心扣车
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 设置折返策略*/
|
|
|
|
switch (model.reentryStrategy) {
|
2020-02-04 15:43:58 +08:00
|
|
|
case '04': /** 默认*/
|
|
|
|
case '01':
|
|
|
|
this.noReentry(); /** 无折返策略*/
|
|
|
|
break;
|
|
|
|
case '02':
|
|
|
|
this.noHumanReentry(); /** 无人折返*/
|
|
|
|
break;
|
|
|
|
case '03':
|
|
|
|
this.autoChangeEnds(); /** 自动换端*/
|
|
|
|
break;
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getBoundingRect() {
|
2020-01-13 13:45:39 +08:00
|
|
|
const rect = this.safeStand.getBoundingRect().clone();
|
2019-11-29 12:51:58 +08:00
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
|
|
|
getShapeTipPoint() {
|
|
|
|
const rect = this.getBoundingRect();
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
checkIsDrawMap() {
|
|
|
|
const path = window.location.href;
|
|
|
|
if (path.includes('/map/draw')) {
|
|
|
|
this.highlight = new EHighlight(this);
|
|
|
|
this.add(this.highlight);
|
|
|
|
this.on('mouseout', () => { this.highlight.mouseout(); });
|
|
|
|
this.on('mouseover', () => { this.highlight.mouseover(); });
|
|
|
|
}
|
|
|
|
}
|
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) {
|
|
|
|
this.stopJumpLampButton && this.stopJumpLampButton.show();
|
|
|
|
this.cancelStopJumpLampButton && this.cancelStopJumpLampButton.show();
|
|
|
|
this.upDetainLamp && this.upDetainLamp.show();
|
|
|
|
this.downDetainLamp && this.downDetainLamp.show();
|
|
|
|
} else {
|
|
|
|
this.stopJumpLampButton && this.stopJumpLampButton.hide();
|
|
|
|
this.cancelStopJumpLampButton && this.cancelStopJumpLampButton.hide();
|
|
|
|
this.upDetainLamp && this.upDetainLamp.hide();
|
|
|
|
this.downDetainLamp && this.downDetainLamp.hide();
|
|
|
|
}
|
|
|
|
}
|
2020-03-13 13:01:58 +08:00
|
|
|
setShowStation(stationCode) {
|
|
|
|
if (!stationCode || this.model.deviceStationCode === stationCode) {
|
|
|
|
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;
|