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';
|
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;
|
|
|
|
this.doors = new Group();
|
|
|
|
this.create();
|
|
|
|
this.createMouseEvent();
|
|
|
|
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 = model.doorLocationType == '01' ? 1 : -1;
|
|
|
|
const drict = 1;
|
2019-11-29 12:51:58 +08:00
|
|
|
|
|
|
|
/** 列车站台*/
|
2019-12-11 17:07:29 +08:00
|
|
|
// const standH = drict > 0 ? style.StationStand.safetyDoor.height : model.height;
|
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,
|
|
|
|
width: model.width,
|
|
|
|
height: model.height
|
|
|
|
});
|
|
|
|
this.add(this.safeStand);
|
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
// if (model.direction != '03') {
|
|
|
|
// /** 屏蔽门*/
|
|
|
|
// this.safeDoor = new ESafeDoor({
|
|
|
|
// zlevel: this.zlevel,
|
|
|
|
// z: this.z,
|
|
|
|
// style: style,
|
|
|
|
// x: model.position.x,
|
|
|
|
// y: model.position.y,
|
|
|
|
// width: model.width,
|
|
|
|
// height: style.StationStand.safetyDoor.height,
|
|
|
|
// show: model.hasDoor
|
|
|
|
// });
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
/** 站台紧急关闭*/
|
|
|
|
const emergentH = drict > 0 ? style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.height : style.StationStand.standEmergent.mergentR;
|
|
|
|
const emergentX = model.position.x + drict * (style.StationStand.standEmergent.offset.x);
|
|
|
|
const emergentY = model.position.y + drict * (style.StationStand.standEmergent.offset.y + emergentH);
|
|
|
|
this.emergent = new ESafeEmergent({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
|
|
|
x: emergentX,
|
|
|
|
y: emergentY,
|
|
|
|
r: style.StationStand.standEmergent.mergentR,
|
|
|
|
n: 4
|
|
|
|
});
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
/** 站台折返策略*/
|
|
|
|
const reentryD = style.StationStand.reentry.position ? model.height + 6 : -style.StationStand.safetyDoor.distance - style.StationStand.safetyDoor.height;
|
|
|
|
const reentryH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + reentryD;
|
|
|
|
const reentryX = model.position.x - (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.x - model.width / 2);
|
|
|
|
const reentryY = model.position.y + (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.y) + drict * reentryH;
|
|
|
|
this.reentry = new EReentry({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
|
|
|
drict: drict,
|
|
|
|
x: reentryX,
|
|
|
|
y: reentryY,
|
|
|
|
lineWidth: 0,
|
|
|
|
fill: style.StationStand.reentry.noHumanColor
|
|
|
|
});
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
const distance = style.StationStand.safetyDoor.height * 2 - style.StationStand.stand.headFontSize / 2 - 2;
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
/** 站台扣车*/
|
|
|
|
const detainD = style.StationStand.detainCar.position ? model.height - distance : -style.StationStand.safetyDoor.height;
|
|
|
|
const detainH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + detainD;
|
|
|
|
const detainX = model.position.x - (style.StationStand.detainCar.position || drict) * (style.StationStand.detainCar.offset.x - model.width / 2);
|
|
|
|
const detainY = model.position.y + (style.StationStand.detainCar.position || drict) * (style.StationStand.detainCar.offset.y) + drict * detainH;
|
|
|
|
this.detain = new EDetain({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: style,
|
|
|
|
x: detainX,
|
|
|
|
y: detainY,
|
|
|
|
textAlign: 'middle',
|
|
|
|
textVerticalAlign: 'top'
|
|
|
|
});
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
/** 停站时间*/
|
|
|
|
const timeD = style.StationStand.stopTime.position ? model.height - distance : -style.StationStand.safetyDoor.height;
|
|
|
|
const timeH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + timeD;
|
|
|
|
const timeX = model.position.x - (style.StationStand.stopTime.position || drict) * (style.StationStand.stopTime.offset.x - model.width / 2);
|
|
|
|
const timeY = model.position.y + (style.StationStand.stopTime.position || drict) * (style.StationStand.stopTime.offset.y) + drict * timeH;
|
|
|
|
this.time = new ETime({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
|
|
|
x: timeX,
|
|
|
|
y: timeY,
|
|
|
|
name: model.parkingTime || '30'
|
|
|
|
});
|
|
|
|
|
|
|
|
/** 运行等级*/
|
|
|
|
const levelD = style.StationStand.level.position ? model.height - distance : -style.StationStand.safetyDoor.height;
|
|
|
|
const levelH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + levelD;
|
|
|
|
const levelX = model.position.x - (style.StationStand.level.position || drict) * (style.StationStand.level.offset.x - model.width / 2);
|
|
|
|
const levelY = model.position.y + (style.StationStand.level.position || drict) * (style.StationStand.level.offset.y) + drict * levelH;
|
|
|
|
this.level = new ELevel({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 1,
|
|
|
|
style: style,
|
|
|
|
x: levelX,
|
|
|
|
y: levelY,
|
|
|
|
name: model.intervalRunTime || '5'
|
|
|
|
});
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-11 17:07:29 +08:00
|
|
|
/** 列车停跳 */
|
|
|
|
if (style.StationStand.common.haveJumpShow) {
|
|
|
|
const jumpD = style.StationStand.jump.position ? model.height - distance : -style.StationStand.safetyDoor.height;
|
|
|
|
const jumpH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + jumpD;
|
|
|
|
const jumpX = model.position.x - (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.x - model.width / 2);
|
|
|
|
const jumpY = model.position.y + (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.y) + drict * jumpH;
|
|
|
|
const jumpCX = model.position.x - (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.x - model.width / 2);
|
|
|
|
const jumpCY = model.position.y + (style.StationStand.jump.position || drict) * (style.StationStand.jump.offset.y - style.StationStand.common.textFontSize / 2) + drict * jumpH;
|
|
|
|
this.jump = new EJump({
|
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,
|
|
|
|
textAlign: 'middle',
|
|
|
|
textVerticalAlign: 'top',
|
2020-01-07 09:23:04 +08:00
|
|
|
allSkip: model.allSkip,
|
|
|
|
assignSkip: model.assignSkip
|
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
|
|
|
}
|
2019-12-11 17:07:29 +08:00
|
|
|
|
|
|
|
this.add(this.safeDoor);
|
|
|
|
this.add(this.emergent);
|
|
|
|
this.add(this.detain);
|
|
|
|
this.add(this.reentry);
|
|
|
|
this.add(this.time);
|
|
|
|
this.add(this.level);
|
|
|
|
// }
|
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); });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setVisible(visible) {
|
|
|
|
if (visible) {
|
|
|
|
this.eachChild(elem => { elem.show(); });
|
|
|
|
} else {
|
|
|
|
this.eachChild(elem => { elem.hide(); });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 恢复初始状态*/
|
|
|
|
recover() {
|
|
|
|
this.time && this.time.hide();
|
|
|
|
this.level && this.level.hide();
|
|
|
|
this.detain && this.detain.hide();
|
|
|
|
this.reentry && this.reentry.hide();
|
|
|
|
this.emergent && this.emergent.hide();
|
|
|
|
this.jump && this.jump.hide();
|
|
|
|
if (this.model.visible) { this.safeDoor && this.safeDoor.hasDoor(false); }
|
|
|
|
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 空闲*/
|
|
|
|
spare() {
|
|
|
|
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 列车停站*/
|
|
|
|
stop() {
|
|
|
|
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.stopColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 站台紧急关闭*/
|
|
|
|
emergentClose() {
|
|
|
|
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor);
|
|
|
|
this.emergent && this.emergent.show();
|
|
|
|
}
|
|
|
|
|
2020-01-07 09:23:04 +08:00
|
|
|
/** 指定列车跳站*/
|
|
|
|
designatedJumpStop(allSkip, assignSkip) {
|
|
|
|
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor);
|
|
|
|
this.jump && this.jump.show();
|
|
|
|
this.jump && this.jump.setStatus(allSkip, assignSkip);
|
|
|
|
}
|
|
|
|
|
2019-11-29 12:51:58 +08:00
|
|
|
/** 未设置跳停*/
|
2020-01-07 09:23:04 +08:00
|
|
|
unJumpStop(allSkip, assignSkip) {
|
2019-11-29 12:51:58 +08:00
|
|
|
this.jump && this.jump.hide();
|
2020-01-07 09:23:04 +08:00
|
|
|
this.jump && this.jump.setStatus(allSkip, assignSkip);
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 站台跳停*/
|
2020-01-07 09:23:04 +08:00
|
|
|
jumpStop(allSkip, assignSkip) {
|
2019-11-29 12:51:58 +08:00
|
|
|
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor);
|
|
|
|
this.jump && this.jump.show();
|
2020-01-07 09:23:04 +08:00
|
|
|
this.jump && this.jump.setStatus(allSkip, assignSkip);
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 未设置扣车*/
|
|
|
|
unDetainTrain() {
|
|
|
|
this.detain && this.detain.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 车站扣车*/
|
|
|
|
standDetainTrain() {
|
|
|
|
this.detain && this.detain.show();
|
|
|
|
this.detain && this.detain.setColor(this.style.StationStand.detainCar.detainTrainTextColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 中心扣车*/
|
|
|
|
centerDetainTrain() {
|
|
|
|
this.detain && this.detain.show();
|
|
|
|
this.detain && this.detain.setColor(this.style.StationStand.detainCar.centerTrainColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 中心+车站扣车*/
|
|
|
|
standAndCenterDetainTrain() {
|
|
|
|
this.detain && this.detain.show();
|
|
|
|
this.detain && this.detain.setColor(this.style.StationStand.detainCar.andCenterTrainColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 人工设置停战时间*/
|
|
|
|
setManuallyArmisticeTime(val) {
|
|
|
|
this.time && this.time.show();
|
|
|
|
this.time && this.time.setName(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 人工设置运行等级*/
|
|
|
|
setManuallyOperationLevel(val) {
|
|
|
|
this.level && this.level.show();
|
|
|
|
this.level && this.level.setName(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 开门*/
|
|
|
|
openDoor() {
|
|
|
|
this.safeDoor && this.safeDoor.hasDoor(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 关门*/
|
|
|
|
closeDoor() {
|
|
|
|
this.safeDoor && this.safeDoor.hasDoor(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 屏蔽门正常*/
|
|
|
|
doorNormal() {
|
|
|
|
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 屏蔽门故障*/
|
|
|
|
doorFault() {
|
|
|
|
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.splitDoorColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 屏蔽门切除*/
|
|
|
|
doorSplit() {
|
|
|
|
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.splitDoorColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 无折返(默认)*/
|
|
|
|
noReentry() {
|
|
|
|
this.reentry && this.reentry.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 无人折返*/
|
|
|
|
noHumanReentry() {
|
|
|
|
this.reentry && this.reentry.show();
|
|
|
|
this.reentry && this.reentry.setColor(this.style.StationStand.reentry.noHumanColor);
|
|
|
|
}
|
|
|
|
/** 自动换端*/
|
|
|
|
autoChangeEnds() {
|
|
|
|
this.reentry && this.reentry.show();
|
|
|
|
this.reentry && this.reentry.setColor(this.style.StationStand.reentry.autoChangeEndsColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(model) {
|
|
|
|
this.recover();
|
|
|
|
switch (model.status) {
|
|
|
|
case '01': /** 空闲*/
|
|
|
|
this.spare();
|
|
|
|
break;
|
|
|
|
case '02': /** 列车停站*/
|
|
|
|
this.stop();
|
|
|
|
break;
|
|
|
|
case '03': /** 站台紧急关闭*/
|
|
|
|
this.emergentClose();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Number(model.parkingTime) >= 0) {
|
|
|
|
this.setManuallyArmisticeTime(model.parkingTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Number(model.intervalRunTime) > 0) {
|
|
|
|
this.setManuallyOperationLevel(model.intervalRunTime);
|
|
|
|
}
|
|
|
|
|
2020-01-07 09:23:04 +08:00
|
|
|
// /** 设置跳停*/
|
|
|
|
// if (model.status == '01') {
|
|
|
|
// switch (model.jumpStopStatus) {
|
|
|
|
// case '01': /** 未设置跳停*/
|
|
|
|
// this.unJumpStop();
|
|
|
|
// break;
|
|
|
|
// case '02': /** 指定站台跳停*/
|
|
|
|
// this.designatedJumpStop();
|
|
|
|
// break;
|
|
|
|
// case '03': /** 站台全部跳停*/
|
|
|
|
// this.jumpStop();
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
this.unJumpStop(model.allSkip, model.assignSkip); // 未设置跳停
|
|
|
|
if (model.assignSkip) {
|
|
|
|
this.designatedJumpStop(model.allSkip, model.assignSkip); // 指定站台跳停
|
|
|
|
} else if (model.allSkip) {
|
|
|
|
this.jumpStop(model.allSkip, model.assignSkip); // 站台全部跳停
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
/** 设置扣车*/
|
2020-01-07 09:23:04 +08:00
|
|
|
this.unDetainTrain(); // 默认状态
|
|
|
|
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.screenDoorOpenStatus) {
|
|
|
|
case '01':
|
|
|
|
this.closeDoor(); /** 关门*/
|
|
|
|
break;
|
|
|
|
case '02':
|
|
|
|
this.openDoor(); /** 开门*/
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 设置屏蔽门状态*/
|
|
|
|
switch (model.screenDoorStatus) {
|
|
|
|
case '01':
|
|
|
|
this.doorNormal(); /** 正常*/
|
|
|
|
break;
|
|
|
|
case '02':
|
|
|
|
this.doorFault(); /** 故障*/
|
|
|
|
break;
|
|
|
|
case '03':
|
|
|
|
this.doorSplit(); /** 切除*/
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 设置折返策略*/
|
|
|
|
switch (model.reentryStrategy) {
|
|
|
|
case '04': /** 默认*/
|
|
|
|
case '01':
|
|
|
|
this.noReentry(); /** 无折返策略*/
|
|
|
|
break;
|
|
|
|
case '02':
|
|
|
|
this.noHumanReentry(); /** 无人折返*/
|
|
|
|
break;
|
|
|
|
case '03':
|
|
|
|
this.autoChangeEnds(); /** 自动换端*/
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getBoundingRect() {
|
|
|
|
const rect = this.safeStand.getBoundingRect();
|
|
|
|
this.safeDoor && rect.union(this.safeDoor.getBoundingRect());
|
|
|
|
|
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
|
|
|
getShapeTipPoint() {
|
|
|
|
const rect = this.getBoundingRect();
|
|
|
|
if (rect) {
|
|
|
|
return {
|
|
|
|
x: rect.x + rect.width / 2,
|
|
|
|
y: rect.y
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
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(); });
|
|
|
|
}
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
export default StationStand;
|