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;
|
2020-03-13 13:01:58 +08:00
|
|
|
this.isShowShape = true;
|
2019-12-06 18:03:13 +08:00
|
|
|
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,
|
2020-03-06 12:04:00 +08:00
|
|
|
z: this.z + 1,
|
2019-12-06 18:03:13 +08:00
|
|
|
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,
|
2020-02-19 16:19:37 +08:00
|
|
|
height: model.height || style.StationStand.safetyDoor.height
|
|
|
|
// show: model.hasDoor
|
2019-12-06 18:03:13 +08:00
|
|
|
});
|
|
|
|
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-03-13 13:01:58 +08:00
|
|
|
if (!this.isShowShape) return;
|
2020-01-13 13:45:39 +08:00
|
|
|
/** 设置屏蔽门开关*/
|
2020-03-09 17:02:13 +08:00
|
|
|
// if (model.name == 'Psd44') {
|
|
|
|
// console.log(model, model.screenDoorOpenStatus, '1 为关门 0 为开门');
|
|
|
|
// }
|
2020-02-19 16:46:34 +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(); });
|
|
|
|
}
|
|
|
|
}
|
2020-03-11 15:10:08 +08:00
|
|
|
setShowMode() {}
|
2020-03-13 13:01:58 +08:00
|
|
|
setShowStation(flag) {
|
|
|
|
if (flag) {
|
|
|
|
this.safeDoor && this.safeDoor.show();
|
|
|
|
this.isShowShape = true;
|
|
|
|
this.setState(this.model);
|
|
|
|
} else {
|
|
|
|
this.safeDoor && this.safeDoor.hide();
|
|
|
|
this.isShowShape = false;
|
|
|
|
}
|
|
|
|
}
|
2019-12-06 18:03:13 +08:00
|
|
|
}
|