2019-11-29 12:51:58 +08:00
|
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
|
import TrainHead from './TrainHead';
|
|
|
|
|
import TrainBody from './TrainBody';
|
|
|
|
|
import BoundingRect from 'zrender/src/core/BoundingRect';
|
2020-03-10 20:15:47 +08:00
|
|
|
|
import ETriangle from '../Train/ETriangle';
|
2020-04-01 13:47:29 +08:00
|
|
|
|
import store from '@/store/index_APP_TARGET';
|
2020-03-25 17:32:57 +08:00
|
|
|
|
import EDirection from './EDirection';
|
2019-11-29 12:51:58 +08:00
|
|
|
|
|
|
|
|
|
/** 列车 */
|
|
|
|
|
export default class Train extends Group {
|
|
|
|
|
constructor(model, style) {
|
|
|
|
|
super();
|
|
|
|
|
this._code = model.code;
|
|
|
|
|
this._type = model._type;
|
|
|
|
|
this.zlevel = model.zlevel;
|
|
|
|
|
this.model = model;
|
|
|
|
|
this.style = style;
|
2020-05-10 16:00:55 +08:00
|
|
|
|
this.size = 0;
|
2019-11-29 12:51:58 +08:00
|
|
|
|
this.z = 40;
|
|
|
|
|
this.section = null;
|
2020-03-13 13:01:58 +08:00
|
|
|
|
this.isShowShape = true;
|
2020-06-12 10:51:06 +08:00
|
|
|
|
this.fontSize = model.nameFontSize || style.Train.common.trainTextFontSize;
|
2019-11-29 12:51:58 +08:00
|
|
|
|
this.newScale = this.fontSize / style.Train.common.trainTextFontSize;
|
2020-06-12 10:51:06 +08:00
|
|
|
|
this.nameFormat = model.nameFormat || style.Train.trainBody.trainNameFormat;
|
2020-05-10 15:58:08 +08:00
|
|
|
|
if (style.Train.trainBody.specialTrainType.length > 0) {
|
|
|
|
|
style.Train.trainBody.specialTrainType.some((item) => {
|
2019-11-29 12:51:58 +08:00
|
|
|
|
if (model.type === item.type) {
|
|
|
|
|
this.nameFormat = item.nameFormat;
|
2020-05-26 16:17:16 +08:00
|
|
|
|
model.specialServiceNumber = item.serviceNumber ? item.serviceNumber : model.serviceNumber;
|
2019-11-29 12:51:58 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
this.create();
|
2020-03-10 20:15:47 +08:00
|
|
|
|
this.setState(model, this);
|
2020-03-13 13:01:58 +08:00
|
|
|
|
this.initShowStation(model);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_computed() {
|
|
|
|
|
const model = this.model;
|
|
|
|
|
const style = this.style;
|
|
|
|
|
if (model.trainWindowModel) {
|
|
|
|
|
this.point = {
|
|
|
|
|
x: model.trainWindowModel.point.x,
|
|
|
|
|
y: model.trainWindowModel.point.y
|
|
|
|
|
};
|
2020-02-13 13:12:22 +08:00
|
|
|
|
if (model.right) {
|
2020-03-09 18:25:25 +08:00
|
|
|
|
this.point.x = this.point.x - style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth / 2;
|
2020-03-10 20:15:47 +08:00
|
|
|
|
this.point.y = this.point.y - style.Train.common.trainHeight / 2;
|
2020-02-13 13:12:22 +08:00
|
|
|
|
} else {
|
2020-03-09 18:25:25 +08:00
|
|
|
|
this.point.x = this.point.x + style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth / 2;
|
2020-03-10 20:15:47 +08:00
|
|
|
|
this.point.y = this.point.y + model.trainWindowModel.height - style.Train.common.trainHeight / 2;
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.point = model.position;
|
|
|
|
|
this.traingle = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
create() {
|
|
|
|
|
this._computed();
|
|
|
|
|
const model = this.model;
|
|
|
|
|
const style = this.style;
|
|
|
|
|
if (this.point) {
|
|
|
|
|
this.trainB = new TrainBody({
|
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
|
z: this.z,
|
|
|
|
|
style: style,
|
|
|
|
|
point: this.point,
|
|
|
|
|
destinationStatus: model.destinationStatus,
|
|
|
|
|
serviceNumber: model.serviceNumber,
|
|
|
|
|
tripNumber: model.tripNumber,
|
2020-03-12 14:41:53 +08:00
|
|
|
|
destinationCode: model.destinationCode,
|
2019-11-29 12:51:58 +08:00
|
|
|
|
groupNumber: model.groupNumber,
|
2020-04-21 17:00:19 +08:00
|
|
|
|
right: model.right,
|
2019-11-29 12:51:58 +08:00
|
|
|
|
directionCode: model.directionCode,
|
|
|
|
|
sectionModel: model.sectionModel,
|
|
|
|
|
runStatus: model.runStatus,
|
|
|
|
|
fontSize: this.fontSize,
|
|
|
|
|
nameFormat: this.nameFormat,
|
|
|
|
|
type: model.type,
|
|
|
|
|
speed: model.speed,
|
|
|
|
|
maLen: model.maLen,
|
2020-06-08 10:46:01 +08:00
|
|
|
|
hold:model.hold,
|
|
|
|
|
jump:model.jump,
|
2020-06-12 13:16:03 +08:00
|
|
|
|
stop:model.stop,
|
2020-05-20 17:08:21 +08:00
|
|
|
|
dt: model.dt,
|
2020-07-03 11:02:35 +08:00
|
|
|
|
driveMode: model.driveMode,
|
2019-11-29 12:51:58 +08:00
|
|
|
|
model: model
|
|
|
|
|
});
|
2020-05-29 16:55:25 +08:00
|
|
|
|
const rect = this.trainB.getBoundingRectOfFont().clone();
|
|
|
|
|
const height = rect.height;
|
2019-11-29 12:51:58 +08:00
|
|
|
|
this.trainL = new TrainHead({
|
|
|
|
|
style: style,
|
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
|
z: this.z,
|
|
|
|
|
point: {
|
|
|
|
|
x: this.point.x - style.Train.common.trainHeadDistance,
|
|
|
|
|
y: this.point.y
|
|
|
|
|
},
|
|
|
|
|
drect: -1,
|
2020-05-29 16:55:25 +08:00
|
|
|
|
height: height,
|
|
|
|
|
fontSize: this.fontSize,
|
2019-11-29 12:51:58 +08:00
|
|
|
|
scale: this.newScale
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.trainR = new TrainHead({
|
|
|
|
|
style: style,
|
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
|
z: this.z,
|
|
|
|
|
point: {
|
|
|
|
|
x: this.point.x + style.Train.common.trainWidth + style.Train.common.trainHeadDistance,
|
|
|
|
|
y: this.point.y
|
|
|
|
|
},
|
|
|
|
|
drect: 1,
|
2020-05-29 16:55:25 +08:00
|
|
|
|
height: height,
|
|
|
|
|
fontSize: this.fontSize,
|
2019-11-29 12:51:58 +08:00
|
|
|
|
scale: this.newScale
|
|
|
|
|
});
|
|
|
|
|
|
2020-03-12 14:41:53 +08:00
|
|
|
|
if (style.Section.trainPosition.display) {
|
|
|
|
|
const data = this.model.physicalCode;
|
|
|
|
|
const oldmodel = store.getters['map/getDeviceByCode'](data);
|
|
|
|
|
const leftPoint = oldmodel.points[0];
|
|
|
|
|
const rightPoint = oldmodel.points[oldmodel.points.length - 1];
|
2020-03-13 19:39:36 +08:00
|
|
|
|
this.startX = this.model.right == 1 ? leftPoint.x : rightPoint.x;
|
|
|
|
|
this.startY = this.model.right == 1 ? leftPoint.y : rightPoint.y;
|
2020-03-12 14:41:53 +08:00
|
|
|
|
// 算出折线的长度
|
|
|
|
|
this.lineLength = 0;
|
|
|
|
|
let oldPoint = null;
|
2020-03-16 10:36:01 +08:00
|
|
|
|
this.pointList = [];
|
2020-05-10 15:58:08 +08:00
|
|
|
|
oldmodel.points.forEach((point) => {
|
2020-03-12 14:41:53 +08:00
|
|
|
|
if (oldPoint) {
|
|
|
|
|
const temp = Math.sqrt(
|
|
|
|
|
Math.pow(point.x - oldPoint.x, 2) +
|
2020-06-17 13:35:21 +08:00
|
|
|
|
Math.pow(point.y - oldPoint.y, 2),
|
2020-03-12 14:41:53 +08:00
|
|
|
|
);
|
2020-05-10 15:58:08 +08:00
|
|
|
|
this.pointList.push({ length: temp, pointStart: { x: oldPoint.x, y: oldPoint.y }, pointEnd: { x: point.x, y: point.y } });
|
2020-03-12 14:41:53 +08:00
|
|
|
|
this.lineLength += temp;
|
|
|
|
|
}
|
|
|
|
|
oldPoint = point;
|
|
|
|
|
});
|
2020-03-16 10:36:01 +08:00
|
|
|
|
oldPoint = 0;
|
2020-05-10 15:58:08 +08:00
|
|
|
|
this.pointList.forEach(point => {
|
2020-03-16 10:36:01 +08:00
|
|
|
|
point.percentStart = oldPoint / this.lineLength;
|
|
|
|
|
oldPoint += point.length;
|
|
|
|
|
point.percentEnd = oldPoint / this.lineLength;
|
|
|
|
|
});
|
|
|
|
|
|
2020-03-12 14:41:53 +08:00
|
|
|
|
this.triangle = new ETriangle({
|
|
|
|
|
style: this.style,
|
|
|
|
|
zlevel: this.zlevel,
|
2020-05-10 15:58:08 +08:00
|
|
|
|
z: 10,
|
2020-03-12 14:41:53 +08:00
|
|
|
|
right: this.model.right,
|
2020-05-10 15:58:08 +08:00
|
|
|
|
point: { x: this.startX, y: this.startY }
|
2020-03-12 14:41:53 +08:00
|
|
|
|
});
|
|
|
|
|
this.add(this.triangle);
|
|
|
|
|
}
|
2020-03-10 20:15:47 +08:00
|
|
|
|
|
2019-11-29 12:51:58 +08:00
|
|
|
|
this.add(this.trainB);
|
|
|
|
|
this.add(this.trainL);
|
|
|
|
|
this.add(this.trainR);
|
|
|
|
|
}
|
2020-06-12 13:16:21 +08:00
|
|
|
|
if (style.Train.directionArrow.hasArrow) { // 列车运行上下方箭头(eg:宁波yi)
|
2020-05-10 15:58:08 +08:00
|
|
|
|
const arrowPoint = { x: 0, y: 0 };
|
2020-03-25 17:32:57 +08:00
|
|
|
|
if (model.trainWindowModel) {
|
|
|
|
|
arrowPoint.x = model.trainWindowModel.point.x;
|
|
|
|
|
arrowPoint.y = model.right ? model.trainWindowModel.point.y + style.Train.directionArrow.distanceBottom : model.trainWindowModel.point.y - style.Train.directionArrow.distanceTop;
|
|
|
|
|
}
|
|
|
|
|
this.directionArrow = new EDirection({
|
|
|
|
|
zlevel: this.zlevel,
|
2020-05-10 15:58:08 +08:00
|
|
|
|
z: 10,
|
2020-03-25 17:32:57 +08:00
|
|
|
|
right: model.right,
|
|
|
|
|
x: arrowPoint.x,
|
|
|
|
|
y: arrowPoint.y,
|
|
|
|
|
style: style
|
|
|
|
|
});
|
|
|
|
|
this.add(this.directionArrow);
|
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取设备提示坐标
|
|
|
|
|
getShapeTipPoint() {
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-06 15:27:31 +08:00
|
|
|
|
updateSection() {
|
|
|
|
|
const train = this.model;
|
2020-03-12 14:41:53 +08:00
|
|
|
|
if (train.physicalCode && train.offsetp && this.triangle) {
|
2020-05-10 15:58:08 +08:00
|
|
|
|
this.pointList.forEach(point => {
|
2020-03-16 10:36:01 +08:00
|
|
|
|
if (train.offsetp > point.percentStart && train.offsetp <= point.percentEnd) {
|
|
|
|
|
this.startX = point.pointStart.x + (point.pointEnd.x - point.pointStart.x) * (train.offsetp - point.percentStart);
|
|
|
|
|
this.startY = point.pointStart.y + (point.pointEnd.y - point.pointStart.y) * (train.offsetp - point.percentStart);
|
2020-03-13 19:39:36 +08:00
|
|
|
|
}
|
2020-03-16 10:36:01 +08:00
|
|
|
|
});
|
2020-05-10 15:58:08 +08:00
|
|
|
|
const point = { x: this.startX, y: this.startY };
|
2020-03-12 14:41:53 +08:00
|
|
|
|
this.triangle.point = point;
|
|
|
|
|
this.triangle.updateTriangle(point, train.right);
|
|
|
|
|
this.triangle.dirty();
|
2020-03-06 15:27:31 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 12:51:58 +08:00
|
|
|
|
// 恢复颜色状态
|
|
|
|
|
recover() {
|
|
|
|
|
this.trainB && this.trainB.setHShow(false);
|
|
|
|
|
this.trainB && this.trainB.setSShow(false);
|
|
|
|
|
this.trainB && this.trainB.setDShow(false);
|
|
|
|
|
this.trainB && this.trainB.setAShow(false);
|
|
|
|
|
|
|
|
|
|
this.trainL && this.trainL.setLineShow(false);
|
|
|
|
|
this.trainR && this.trainR.setLineShow(false);
|
|
|
|
|
this.trainL && this.trainL.setArrowShow(false);
|
|
|
|
|
this.trainR && this.trainR.setArrowShow(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置运行方向状态类型
|
2020-02-13 13:12:22 +08:00
|
|
|
|
setDirectionType(right, flag) {
|
2019-11-29 12:51:58 +08:00
|
|
|
|
if (this.style.Train.trainStatusStyle.directionType.length > 0) {
|
|
|
|
|
this.style.Train.trainStatusStyle.directionType.forEach((item) => {
|
2020-06-23 09:26:58 +08:00
|
|
|
|
if (right == item.type) {
|
2019-11-29 12:51:58 +08:00
|
|
|
|
let lineLShow = item.lineLShow;
|
|
|
|
|
let arrowLShow = item.arrowLShow;
|
|
|
|
|
let lineRShow = item.lineRShow;
|
|
|
|
|
let arrowRShow = item.arrowRShow;
|
|
|
|
|
if (flag) {
|
|
|
|
|
lineLShow = !item.lineLShow;
|
|
|
|
|
arrowLShow = !item.arrowLShow;
|
|
|
|
|
lineRShow = !item.lineRShow;
|
|
|
|
|
arrowRShow = !item.arrowRShow;
|
|
|
|
|
}
|
|
|
|
|
this.trainL && this.trainL.setLineShow(lineLShow);
|
|
|
|
|
this.trainL && this.trainL.setArrowShow(arrowLShow);
|
|
|
|
|
this.trainR && this.trainR.setLineShow(lineRShow);
|
|
|
|
|
this.trainR && this.trainR.setArrowShow(arrowRShow);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 设置列车停止方向类型
|
2020-02-13 13:12:22 +08:00
|
|
|
|
setDirectionStopType(right) {
|
2019-11-29 12:51:58 +08:00
|
|
|
|
if (this.style.Train.trainStatusStyle.directionStopType.length > 0) {
|
|
|
|
|
this.style.Train.trainStatusStyle.directionStopType.forEach((item) => {
|
2020-06-23 09:26:58 +08:00
|
|
|
|
if (right == item.type) {
|
2020-05-14 10:22:13 +08:00
|
|
|
|
if (this.style.Train.trainHead.directionStopType == 'special') {
|
|
|
|
|
this.trainL && this.trainL.setArrowShow(item.lineLShow);
|
|
|
|
|
this.trainR && this.trainR.setArrowShow(item.lineRShow);
|
|
|
|
|
} else {
|
|
|
|
|
this.trainL && this.trainL.setLineShow(item.lineLShow);
|
|
|
|
|
this.trainR && this.trainR.setLineShow(item.lineRShow);
|
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 设置运行状态
|
|
|
|
|
setRunStatus(status, flag) {
|
2020-02-13 13:12:22 +08:00
|
|
|
|
if (status) {
|
|
|
|
|
this.setDirectionStopType(this.model.right); // 设置运行方向状态类型
|
|
|
|
|
} else {
|
|
|
|
|
this.setDirectionType(this.model.right, flag); // 设置运行方向状态类型
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 设置运行模式
|
2020-02-19 11:47:38 +08:00
|
|
|
|
setDriveMode(status) {
|
|
|
|
|
if (this.style.Train.trainStatusStyle.driveModeStatus.length > 0) {
|
|
|
|
|
this.style.Train.trainStatusStyle.driveModeStatus.some((item) => {
|
2019-11-29 12:51:58 +08:00
|
|
|
|
if (status === item.status) {
|
|
|
|
|
this.trainL && this.trainL.setColor(item.trainLColor);
|
|
|
|
|
this.trainR && this.trainR.setColor(item.trainRColor);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-20 17:08:21 +08:00
|
|
|
|
// 早晚点状态
|
|
|
|
|
setSoonerOrLater(dt) {
|
|
|
|
|
this.trainB && this.trainB.setSoonerOrLater(dt);
|
|
|
|
|
}
|
2020-03-06 20:47:39 +08:00
|
|
|
|
// 设置扣车状态
|
|
|
|
|
setHoldStatus(status) {
|
|
|
|
|
if (status) {
|
|
|
|
|
this.trainB && this.trainB.setHShow(true);
|
|
|
|
|
} else {
|
|
|
|
|
this.trainB && this.trainB.setHShow(false);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-06 20:47:39 +08:00
|
|
|
|
|
|
|
|
|
// 设置跳停状态
|
|
|
|
|
setJumpStatus(status) {
|
|
|
|
|
if (status) {
|
|
|
|
|
this.trainB && this.trainB.setSShow(true);
|
|
|
|
|
} else {
|
|
|
|
|
this.trainB && this.trainB.setSShow(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 12:51:58 +08:00
|
|
|
|
// 设置车门状态类型
|
|
|
|
|
setDoorStatus(status) {
|
2020-03-06 20:57:24 +08:00
|
|
|
|
if (status != undefined) {
|
|
|
|
|
if (status) {
|
|
|
|
|
this.trainB && this.trainB.setDShow(false);
|
|
|
|
|
} else {
|
|
|
|
|
this.trainB && this.trainB.setDShow(true);
|
|
|
|
|
}
|
2020-03-06 20:47:39 +08:00
|
|
|
|
} else {
|
|
|
|
|
this.trainB && this.trainB.setDShow(false);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 设置通信状态类型
|
|
|
|
|
setCommunicationStatus() {
|
|
|
|
|
if (this.style.Train.trainStatusStyle.communicationStatus.length > 0) {
|
|
|
|
|
this.style.Train.trainStatusStyle.communicationStatus.some((item) => {
|
|
|
|
|
if (status === item.status) {
|
|
|
|
|
this.trainB && this.trainB.setTrainColor(item.trainColor);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 设置报警状态
|
|
|
|
|
setAlarmStatus(status) {
|
2020-03-06 20:47:39 +08:00
|
|
|
|
if (status) {
|
|
|
|
|
this.trainB && this.trainB.setAShow(true);
|
|
|
|
|
} else {
|
|
|
|
|
this.trainB && this.trainB.setAShow(false);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 设置状态
|
2020-03-10 20:15:47 +08:00
|
|
|
|
setState(model, object) {
|
2020-03-13 13:01:58 +08:00
|
|
|
|
if (!this.isShowShape) return;
|
2020-02-13 13:12:22 +08:00
|
|
|
|
const flag = model.trainWindowModel ? model.trainWindowModel.reversal : false;
|
|
|
|
|
if (model) {
|
|
|
|
|
this.recover();
|
2020-03-02 16:29:09 +08:00
|
|
|
|
if (this.style.Train.common.trainHeadColorChangeMode) {
|
|
|
|
|
this.setDriveMode(model.driveMode + model.runLevel);
|
|
|
|
|
} else {
|
|
|
|
|
this.setDriveMode(model.driveMode);
|
|
|
|
|
}
|
2020-02-13 13:12:22 +08:00
|
|
|
|
this.setRunStatus(model.stop, flag);
|
2020-02-19 11:47:38 +08:00
|
|
|
|
this.setCommunicationStatus(model.runLevel);
|
|
|
|
|
this.setDoorStatus(model.doorCloseLock);
|
2020-03-06 20:47:39 +08:00
|
|
|
|
this.setAlarmStatus(model.alarmStatus);
|
|
|
|
|
this.setHoldStatus(model.hold);
|
|
|
|
|
this.setJumpStatus(model.jump);
|
2020-05-20 17:08:21 +08:00
|
|
|
|
this.setSoonerOrLater(model.dt);
|
2020-05-22 14:47:19 +08:00
|
|
|
|
this.setTrainTypeColor(model.type);
|
2020-05-28 09:07:29 +08:00
|
|
|
|
this.setPlanRoutingTypeColor(model.planRoutingType);
|
2020-03-06 15:27:31 +08:00
|
|
|
|
const style = this.style;
|
|
|
|
|
if (style.Section.trainPosition.display) {
|
2020-03-10 20:15:47 +08:00
|
|
|
|
this.updateSection(object);
|
2020-03-06 15:27:31 +08:00
|
|
|
|
}
|
2020-02-13 13:12:22 +08:00
|
|
|
|
}
|
2020-05-22 13:05:08 +08:00
|
|
|
|
}
|
2020-05-22 14:47:19 +08:00
|
|
|
|
setTrainTypeColor(type) {
|
|
|
|
|
this.trainB && this.trainB.setTrainTypeColor(type);
|
|
|
|
|
}
|
|
|
|
|
setPlanRoutingTypeColor(planRoutingType) {
|
2020-05-22 13:05:08 +08:00
|
|
|
|
this.trainB && this.trainB.setPlanRoutingTypeColor(planRoutingType);
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|
|
|
|
|
removeTrainDetail() {
|
|
|
|
|
this.trainB && this.trainB.removeTrainDetail();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getBoundingRect() {
|
|
|
|
|
const list = [this.trainB, this.trainL, this.trainR];
|
|
|
|
|
let rect = null;
|
|
|
|
|
list.forEach(elem => {
|
|
|
|
|
if (elem) {
|
|
|
|
|
const tempRect = elem.getBoundingRect();
|
|
|
|
|
if (tempRect.x && tempRect.y && tempRect.width && tempRect.height) {
|
|
|
|
|
if (rect) {
|
|
|
|
|
rect.union(tempRect);
|
|
|
|
|
} else {
|
|
|
|
|
rect = tempRect;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return rect || new BoundingRect(0, 0, 0, 0);
|
|
|
|
|
}
|
2020-05-10 15:58:08 +08:00
|
|
|
|
setShowMode() { }
|
2020-03-13 13:01:58 +08:00
|
|
|
|
initShowStation(model) {
|
|
|
|
|
if (model.trainWindowModel && model.trainWindowModel.instance && !model.trainWindowModel.instance.isShowShape) {
|
|
|
|
|
this.eachChild(item => {
|
|
|
|
|
item.hide();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setShowStation(stationCode) {
|
2020-05-10 15:58:08 +08:00
|
|
|
|
if ((this.model.sectionModel && this.model.sectionModel.stationCode === stationCode) || !stationCode) {
|
2020-03-13 13:01:58 +08:00
|
|
|
|
this.eachChild(item => {
|
|
|
|
|
item.show();
|
|
|
|
|
});
|
|
|
|
|
this.isShowShape = true;
|
|
|
|
|
this.setState(this.model, this);
|
|
|
|
|
} else {
|
|
|
|
|
this.eachChild(item => {
|
|
|
|
|
item.hide();
|
|
|
|
|
});
|
|
|
|
|
this.isShowShape = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
|
}
|