2019-12-06 18:03:13 +08:00
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
import ESafeDoor from './ESafeDoor';
|
2019-12-13 14:19:38 +08:00
|
|
|
import EHighlight from '../element/EHighlight';
|
2019-12-06 18:03:13 +08:00
|
|
|
|
|
|
|
export default class Line2 extends Group {
|
|
|
|
constructor(model, style) {
|
|
|
|
super();
|
|
|
|
this._code = model.code;
|
|
|
|
this._type = model._type;
|
|
|
|
this.zlevel = model.zlevel;
|
|
|
|
this.z = 1;
|
|
|
|
this.model = model;
|
|
|
|
this.style = style;
|
|
|
|
this.create();
|
|
|
|
this.setState(model);
|
2019-12-13 14:19:38 +08:00
|
|
|
this.checkIsDrawMap();
|
2019-12-06 18:03:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
create() {
|
|
|
|
/** 屏蔽门*/
|
|
|
|
const model = this.model;
|
|
|
|
const style = this.style;
|
|
|
|
this.safeDoor = new ESafeDoor({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: style,
|
|
|
|
x: model.position.x,
|
2019-12-12 10:05:28 +08:00
|
|
|
y: model.position.y - (model.height / 2),
|
2019-12-06 18:03:13 +08:00
|
|
|
width: model.width || style.StationStand.safetyDoor.width,
|
|
|
|
height: model.height || style.StationStand.safetyDoor.height,
|
|
|
|
show: model.hasDoor
|
|
|
|
});
|
|
|
|
this.add(this.safeDoor);
|
|
|
|
}
|
|
|
|
|
2020-01-13 13:45:39 +08:00
|
|
|
/** 恢复初始状态*/
|
|
|
|
recover() {
|
|
|
|
this.safeDoor && this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 开门*/
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2019-12-06 18:03:13 +08:00
|
|
|
setState(model) {
|
2020-01-13 13:45:39 +08:00
|
|
|
/** 设置屏蔽门开关*/
|
2020-02-17 17:50:15 +08:00
|
|
|
model.screenDoorOpenStatus != 0 && this.openDoor(); /** 开门*/
|
|
|
|
model.screenDoorOpenStatus == 0 && this.closeDoor(); /** 关门*/
|
2019-12-06 18:03:13 +08:00
|
|
|
|
2020-01-13 13:45:39 +08:00
|
|
|
// /** 设置屏蔽门状态*/
|
|
|
|
// switch (model.screenDoorStatus) {
|
|
|
|
// case '01':
|
|
|
|
// this.doorNormal(); /** 正常*/
|
|
|
|
// break;
|
|
|
|
// case '02':
|
|
|
|
// this.doorFault(); /** 故障*/
|
|
|
|
// break;
|
|
|
|
// case '03':
|
|
|
|
// this.doorSplit(); /** 切除*/
|
|
|
|
// }
|
2019-12-06 18:03:13 +08:00
|
|
|
}
|
2019-12-13 14:19:38 +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-12-06 18:03:13 +08:00
|
|
|
}
|