2019-11-29 12:51:58 +08:00
|
|
|
/*
|
|
|
|
* 车站
|
|
|
|
*/
|
|
|
|
import Group from 'zrender/src/container/Group';
|
2019-12-04 11:32:30 +08:00
|
|
|
import ETextName from '../element/ETextName';
|
2019-12-04 18:39:28 +08:00
|
|
|
import EControl from '../element/EControl';
|
2019-12-05 10:25:07 +08:00
|
|
|
import EMouse from './EMouse';
|
2021-02-19 17:27:10 +08:00
|
|
|
import EMouseDraw from './EMouseDraw';
|
2019-12-05 10:19:41 +08:00
|
|
|
import ESingleControl from './ESingleControl';
|
|
|
|
import EArrow from './EArrow';
|
|
|
|
import { arrow } from '../utils/ShapePoints';
|
2020-03-05 14:33:08 +08:00
|
|
|
import Rect from 'zrender/src/graphic/shape/Rect';
|
2020-04-13 17:12:33 +08:00
|
|
|
import Text from 'zrender/src/graphic/Text';
|
2020-12-15 11:18:15 +08:00
|
|
|
import store from '@/store/index';
|
2020-11-13 10:21:36 +08:00
|
|
|
|
|
|
|
import EStationText from './EStationText';
|
2020-12-07 16:10:03 +08:00
|
|
|
import { traverseLineElements } from '../utils/ShapeStatusCovert';
|
2020-11-13 10:21:36 +08:00
|
|
|
|
2020-06-05 10:14:12 +08:00
|
|
|
import Vue from 'vue';
|
2019-11-29 12:51:58 +08:00
|
|
|
|
|
|
|
export default class Station extends Group {
|
2021-02-05 18:01:16 +08:00
|
|
|
constructor(model, {style}) {
|
2019-12-04 11:32:30 +08:00
|
|
|
super();
|
|
|
|
this._code = model.code;
|
|
|
|
this._type = model._type;
|
|
|
|
this.zlevel = model.zlevel;
|
|
|
|
this.z = 40;
|
|
|
|
this.model = model;
|
|
|
|
this.style = style;
|
2021-01-18 14:10:55 +08:00
|
|
|
this.noneBeforeMode = '';
|
2020-03-13 13:01:58 +08:00
|
|
|
this.isShowShape = true;
|
2019-12-04 11:32:30 +08:00
|
|
|
this.create();
|
2019-12-05 10:25:07 +08:00
|
|
|
this.createTurnBack(); // 创建按图折返
|
2019-12-05 10:19:41 +08:00
|
|
|
this.createControlMode();
|
2019-12-04 11:32:30 +08:00
|
|
|
this.setState(model);
|
2019-12-05 10:25:07 +08:00
|
|
|
this.checkIsDrawMap();
|
2020-11-13 10:21:36 +08:00
|
|
|
this.setVisible(model.visible);
|
2021-05-18 17:49:08 +08:00
|
|
|
this.setShowMode();
|
2019-12-04 11:32:30 +08:00
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2019-12-04 11:32:30 +08:00
|
|
|
create() {
|
|
|
|
const model = this.model;
|
|
|
|
const style = this.style;
|
2019-11-29 12:51:58 +08:00
|
|
|
|
2020-12-07 16:10:03 +08:00
|
|
|
// 站台所有的绘图元素
|
2020-11-13 10:21:36 +08:00
|
|
|
const elementTypeList = {
|
2020-12-07 16:10:03 +08:00
|
|
|
'stationText': EStationText // 车站名称 (普通站台样式)
|
2020-11-13 10:21:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// 遍历当前线路下的绘图元素 组合模式
|
|
|
|
traverseLineElements(style.Station, elementTypeList, model, style, this);
|
|
|
|
|
2020-08-07 11:09:49 +08:00
|
|
|
const path = window.location.href;
|
2020-08-10 13:01:59 +08:00
|
|
|
if (style.Station.kmPostShow || path.includes('/map/draw')) { // 公里标是否显示
|
2020-08-07 11:09:49 +08:00
|
|
|
let direction = 1;
|
|
|
|
if (this.style.Station.kilometerPosition == 'up') {
|
|
|
|
direction = -1;
|
|
|
|
}
|
|
|
|
const offset = { x: 0, y: 0 };
|
|
|
|
if (model.kilometerPosition) {
|
|
|
|
offset.x = model.kilometerPosition.x;
|
|
|
|
offset.y = model.kilometerPosition.y;
|
|
|
|
}
|
|
|
|
this.mileageText = new ETextName({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
position: [0, 0],
|
|
|
|
x: model.position.x + offset.x,
|
|
|
|
y: model.position.y + ((parseInt(model.nameFont) + 2) * direction) + offset.y,
|
|
|
|
fontWeight: model.fontWeight,
|
|
|
|
fontSize: model.kmPostFont || 18,
|
|
|
|
fontFamily: style.fontFamily,
|
2020-09-08 15:39:23 +08:00
|
|
|
silent: !model.visible,
|
2020-08-07 11:09:49 +08:00
|
|
|
text: model.kmPost,
|
|
|
|
textAlign: 'middle',
|
|
|
|
textVerticalAlign: 'top',
|
|
|
|
textFill: model.kmPostFontColor
|
|
|
|
});
|
|
|
|
this.add(this.mileageText);
|
2020-12-08 09:52:07 +08:00
|
|
|
model.kmPostShow ? this.mileageText.show() : this.mileageText.hide();
|
|
|
|
if (!model.visible) {
|
|
|
|
this.mileageText.setStyle('fontSize', 0);
|
|
|
|
}
|
2020-08-07 11:09:49 +08:00
|
|
|
}
|
2020-11-13 10:21:36 +08:00
|
|
|
|
|
|
|
// if (!model.visible) { // 隐藏车站
|
|
|
|
// // this.subheadText && this.subheadText.setStyle('textFill', 'rgba(0,0,0,0)');
|
|
|
|
// // this.mileageText && this.mileageText.setStyle('textFill', 'rgba(0,0,0,0)');
|
|
|
|
// // this.stationText && this.stationText.setStyle('textFill', 'rgba(0,0,0,0)');
|
|
|
|
// this.eachChild(elem => { elem.hide(); });
|
|
|
|
// }
|
2019-12-04 11:32:30 +08:00
|
|
|
}
|
2019-12-04 18:39:28 +08:00
|
|
|
createTurnBack() { // 创建按图折返
|
2019-12-04 14:59:04 +08:00
|
|
|
const model = this.model;
|
|
|
|
const style = this.style;
|
2019-12-18 13:05:29 +08:00
|
|
|
if (model.visible && model.createTurnBack) {
|
2019-12-05 10:25:07 +08:00
|
|
|
this.turnBacks = [];
|
2020-04-22 18:24:28 +08:00
|
|
|
if (style.Station.turnBack.topText) {
|
|
|
|
this.turnBackTopText = new Text({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
position: [0, 0],
|
|
|
|
style: {
|
|
|
|
x: model.turnBackPoint.x,
|
|
|
|
y: model.turnBackPoint.y - style.Station.lamp.radiusR - style.Station.turnBack.toptextDistance,
|
|
|
|
fontWeight: style.Station.text.fontWeight,
|
|
|
|
fontSize: style.Station.text.fontSize,
|
|
|
|
fontFamily: style.fontFamily,
|
|
|
|
text: model.name + '站后折返',
|
|
|
|
textFill: '#fff',
|
|
|
|
textAlign: 'middle',
|
|
|
|
textVerticalAlign: 'top'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.turnBackTopText);
|
|
|
|
}
|
2019-12-06 10:31:19 +08:00
|
|
|
for (let index = 0; index < style.Station.turnBack.lamp; index++) {
|
2019-12-05 10:25:07 +08:00
|
|
|
const turnBack = new EControl({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
arc: {
|
|
|
|
shape: {
|
2019-12-06 10:31:19 +08:00
|
|
|
cx: model.turnBackPoint.x + style.Station.turnBack.lampSpace * index,
|
|
|
|
cy: model.turnBackPoint.y,
|
2019-12-05 10:25:07 +08:00
|
|
|
r: style.Station.lamp.radiusR
|
|
|
|
},
|
|
|
|
lineWidth: 0,
|
2020-04-22 18:24:28 +08:00
|
|
|
lineDash: style.Station.turnBack.lineDash,
|
2019-12-05 10:25:07 +08:00
|
|
|
fill: style.Station.lamp.controlColor
|
2019-12-04 18:39:28 +08:00
|
|
|
},
|
2019-12-05 10:25:07 +08:00
|
|
|
text: {
|
|
|
|
position: [0, 0],
|
2019-12-06 10:31:19 +08:00
|
|
|
x: model.turnBackPoint.x + style.Station.turnBack.lampSpace * index,
|
2019-12-19 10:08:12 +08:00
|
|
|
y: model.turnBackPoint.y + style.Station.lamp.radiusR + style.Station.StationControl.text.distance,
|
2019-12-05 10:25:07 +08:00
|
|
|
fontWeight: style.Station.text.fontWeight,
|
|
|
|
fontSize: style.Station.text.fontSize,
|
|
|
|
fontFamily: style.fontFamily,
|
2020-04-22 18:24:28 +08:00
|
|
|
text: style.Station.turnBack.textName || '按图折返',
|
2019-12-05 10:25:07 +08:00
|
|
|
textFill: '#fff',
|
|
|
|
textAlign: 'middle',
|
|
|
|
textVerticalAlign: 'top'
|
|
|
|
},
|
|
|
|
style: this.style
|
|
|
|
});
|
|
|
|
this.turnBacks.push(turnBack);
|
2019-12-06 10:31:19 +08:00
|
|
|
}
|
2020-04-22 18:24:28 +08:00
|
|
|
this.turnBacks.forEach(lamp => {
|
|
|
|
lamp.setArcBorder(style.Station.turnBack.showLampBorder);
|
|
|
|
this.add(lamp);
|
|
|
|
});
|
2019-12-04 14:59:04 +08:00
|
|
|
}
|
|
|
|
}
|
2019-12-05 10:19:41 +08:00
|
|
|
// 创建控制模式
|
|
|
|
createControlMode() {
|
2020-08-07 11:09:49 +08:00
|
|
|
const model = this.model;
|
|
|
|
if (!this.style.Station.StationControl.disPlayNone) {
|
2020-12-31 18:02:55 +08:00
|
|
|
if (this.style.Station.StationControl.special) {
|
|
|
|
if (model.visible && model.createControlMode) { // model.createControlMode 控制模式
|
2021-05-18 17:49:08 +08:00
|
|
|
this.createControlModeAU();
|
2021-03-02 15:06:40 +08:00
|
|
|
this.createControlModeCC();
|
2021-05-18 17:49:08 +08:00
|
|
|
this.createControlModeCL();
|
|
|
|
this.createControlModeVA();
|
2020-12-31 18:02:55 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (model.visible && model.createControlMode) { // model.createControlMode 控制模式
|
|
|
|
this.createEmergencyControl(); // 紧急站控
|
|
|
|
this.createCenterControl(); // 中控按钮
|
|
|
|
this.createSubstationControl(); // 站控按钮
|
|
|
|
this.createInterconnectedControl(); // 联锁控
|
|
|
|
}
|
2020-08-07 11:09:49 +08:00
|
|
|
}
|
2020-12-31 18:02:55 +08:00
|
|
|
|
2020-08-07 11:09:49 +08:00
|
|
|
}
|
2020-06-12 13:19:26 +08:00
|
|
|
this.setState(model);
|
|
|
|
}
|
|
|
|
|
2021-05-18 17:49:08 +08:00
|
|
|
createControlModeAU() { // 西安二
|
2020-12-31 18:02:55 +08:00
|
|
|
const model = this.model;
|
2021-03-02 15:06:40 +08:00
|
|
|
this.stationControlAU = new Text({
|
2020-12-31 18:02:55 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: {
|
2021-05-18 17:49:08 +08:00
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX * -1,
|
2021-03-02 15:06:40 +08:00
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY,
|
|
|
|
fontWeight: this.style.Station.StationControl.text.fontWeight,
|
|
|
|
fontSize: this.style.Station.StationControl.text.fontSize,
|
|
|
|
fontFamily: this.style.fontFamily,
|
|
|
|
text: 'AU',
|
|
|
|
textFill: this.style.Station.StationControl.text.automaticRouteColor,
|
|
|
|
textAlign: this.style.Station.StationControl.text.textAlign,
|
|
|
|
textVerticalAlign: this.style.Station.StationControl.text.textVerticalAlign
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.stationControlAU);
|
|
|
|
}
|
2021-05-18 17:49:08 +08:00
|
|
|
createTroButton() {
|
|
|
|
const model = this.model;
|
|
|
|
const rect = this.stationText.getBoundingRect();
|
|
|
|
this.troButton = new Rect({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
_subType: 'troButton',
|
|
|
|
shape: {
|
|
|
|
x: model.position.x + rect.width / 2 + 5,
|
|
|
|
y: model.position.y,
|
|
|
|
width: 25,
|
|
|
|
height: 25
|
|
|
|
},
|
|
|
|
style: {
|
|
|
|
lineWidth: 1,
|
|
|
|
stroke: '#fff',
|
|
|
|
fill: '#00f'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.troButton);
|
|
|
|
}
|
2021-03-02 15:06:40 +08:00
|
|
|
createControlModeCC() { // 西安二
|
|
|
|
const model = this.model;
|
|
|
|
this.stationControlCC = new Text({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: {
|
2021-05-18 17:49:08 +08:00
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX * 0,
|
2021-03-02 15:06:40 +08:00
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY,
|
2020-12-31 18:02:55 +08:00
|
|
|
fontWeight: this.style.Station.StationControl.text.fontWeight,
|
|
|
|
fontSize: this.style.Station.StationControl.text.fontSize,
|
|
|
|
fontFamily: this.style.fontFamily,
|
|
|
|
text: 'CC',
|
|
|
|
textFill: this.style.Station.StationControl.text.centerControlColor,
|
|
|
|
textAlign: this.style.Station.StationControl.text.textAlign,
|
|
|
|
textVerticalAlign: this.style.Station.StationControl.text.textVerticalAlign
|
|
|
|
}
|
|
|
|
});
|
2021-03-02 15:06:40 +08:00
|
|
|
this.add(this.stationControlCC);
|
|
|
|
}
|
|
|
|
|
2021-05-18 17:49:08 +08:00
|
|
|
createControlModeCL() { // 西安二
|
2021-03-02 15:06:40 +08:00
|
|
|
const model = this.model;
|
|
|
|
this.stationControlCL = new Text({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: {
|
2021-05-18 17:49:08 +08:00
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX * 1,
|
2021-03-02 15:06:40 +08:00
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY,
|
|
|
|
fontWeight: this.style.Station.StationControl.text.fontWeight,
|
|
|
|
fontSize: this.style.Station.StationControl.text.fontSize,
|
|
|
|
fontFamily: this.style.fontFamily,
|
|
|
|
text: 'CL',
|
|
|
|
textFill: this.style.Station.StationControl.text.openCommunicationColor,
|
|
|
|
textAlign: this.style.Station.StationControl.text.textAlign,
|
|
|
|
textVerticalAlign: this.style.Station.StationControl.text.textVerticalAlign
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.stationControlCL);
|
|
|
|
}
|
|
|
|
|
2021-05-18 17:49:08 +08:00
|
|
|
createControlModeVA() { // 西安二
|
2021-03-02 15:06:40 +08:00
|
|
|
const model = this.model;
|
|
|
|
this.stationControlVA = new Text({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: {
|
2021-05-18 17:49:08 +08:00
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX * 2,
|
2021-03-02 15:06:40 +08:00
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY,
|
|
|
|
fontWeight: this.style.Station.StationControl.text.fontWeight,
|
|
|
|
fontSize: this.style.Station.StationControl.text.fontSize,
|
|
|
|
fontFamily: this.style.fontFamily,
|
|
|
|
text: 'VA',
|
|
|
|
textFill: this.style.Station.StationControl.text.testValidColor,
|
|
|
|
textAlign: this.style.Station.StationControl.text.textAlign,
|
|
|
|
textVerticalAlign: this.style.Station.StationControl.text.textVerticalAlign
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.stationControlVA);
|
2020-12-31 18:02:55 +08:00
|
|
|
}
|
|
|
|
|
2020-06-12 13:19:26 +08:00
|
|
|
createEmergencyControl() { // 紧急站控
|
|
|
|
const model = this.model;
|
|
|
|
if (this.style.Station.StationControl.emergencyControl.show) {
|
|
|
|
this.emergencyControl = new ESingleControl({
|
|
|
|
_subType: 'emergency',
|
|
|
|
style: this.style,
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
point: {
|
|
|
|
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.emergencyControl.offset.x,
|
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.emergencyControl.offset.y
|
|
|
|
},
|
|
|
|
context: this.style.Station.StationControl.emergencyControl.text,
|
|
|
|
pop: false
|
|
|
|
});
|
|
|
|
this.add(this.emergencyControl);
|
|
|
|
if (this.style.Station.StationControl.emergencyControl.arrowShow) {
|
|
|
|
const x = model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.emergencyControl.offset.x;
|
|
|
|
const y = model.controlModePoint.y + this.style.Station.StationControl.emergencyControl.offset.y;
|
|
|
|
const point = arrow(x, y + this.style.Station.StationControl.lamp.radiusR / 2, this.style.Station.StationControl.lamp.distance / 6, this.style.Station.StationControl.lamp.radiusR * 0.8);
|
|
|
|
this.emergencyArrowsControl = new EArrow({
|
2019-12-05 10:19:41 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
2020-06-12 13:19:26 +08:00
|
|
|
style: this.style,
|
|
|
|
count: this.count,
|
|
|
|
drict: 1,
|
|
|
|
point: point,
|
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.offset.x,
|
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
|
|
|
|
fill: this.style.Station.StationControl.emergencyControl.grayColor,
|
|
|
|
lineWidth: 1,
|
|
|
|
stroke: this.style.sidelineColor
|
2019-12-05 10:19:41 +08:00
|
|
|
});
|
2020-06-12 13:19:26 +08:00
|
|
|
this.add(this.emergencyArrowsControl);
|
2019-12-05 10:19:41 +08:00
|
|
|
}
|
2020-06-12 13:19:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
createCenterControl() { // 中控按钮
|
|
|
|
const model = this.model;
|
|
|
|
if (this.style.Station.StationControl.centerControl.show) {
|
|
|
|
this.centerControl = new ESingleControl({
|
|
|
|
_subType: 'center',
|
|
|
|
style: this.style,
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
point: {
|
|
|
|
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.centerControl.offset.x,
|
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.centerControl.offset.y
|
|
|
|
},
|
|
|
|
context: this.style.Station.StationControl.centerControl.text,
|
|
|
|
pop: false
|
|
|
|
});
|
|
|
|
this.add(this.centerControl);
|
|
|
|
if (this.style.Station.StationControl.centerControl.arrowShow) {
|
|
|
|
const x = model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.emergencyControl.offset.x;
|
|
|
|
const y = model.controlModePoint.y + this.style.Station.StationControl.emergencyControl.offset.y;
|
|
|
|
const point = arrow(x, y + this.style.Station.StationControl.lamp.radiusR / 2, this.style.Station.StationControl.lamp.distance / 6, this.style.Station.StationControl.lamp.radiusR * 0.8);
|
|
|
|
this.centerArrowsControl = new EArrow({
|
2019-12-05 10:19:41 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: this.style,
|
|
|
|
count: this.count,
|
|
|
|
drict: 1,
|
|
|
|
point: point,
|
2019-12-05 10:52:45 +08:00
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.offset.x,
|
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
|
2020-06-12 13:19:26 +08:00
|
|
|
fill: this.style.Station.StationControl.centerControl.grayColor,
|
2019-12-05 10:19:41 +08:00
|
|
|
lineWidth: 1,
|
|
|
|
stroke: this.style.sidelineColor
|
|
|
|
});
|
2020-06-12 13:19:26 +08:00
|
|
|
this.add(this.centerArrowsControl);
|
2019-12-05 10:19:41 +08:00
|
|
|
}
|
2020-06-12 13:19:26 +08:00
|
|
|
}
|
|
|
|
// 中控按钮
|
|
|
|
if (this.style.Station.StationControl.centerControl.buttonShow) { // 宁波一 显示
|
|
|
|
this.centerControlButton = new ESingleControl({
|
|
|
|
_subType: 'button',
|
|
|
|
style: this.style,
|
|
|
|
zlevel: this.zlevel,
|
2021-05-18 17:49:08 +08:00
|
|
|
z: this.z + 1,
|
2020-06-12 13:19:26 +08:00
|
|
|
point: {
|
2021-02-18 15:38:20 +08:00
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x,
|
2020-06-12 13:19:26 +08:00
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
|
|
|
|
},
|
|
|
|
context: this.style.Station.StationControl.centerControl.buttonText,
|
|
|
|
pop: false
|
|
|
|
});
|
|
|
|
this.add(this.centerControlButton);
|
|
|
|
const arcRect = this.centerControlButton.getArcBoundingRect();
|
|
|
|
this.arcBorder = new Rect({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
silent: true,
|
|
|
|
shape: arcRect,
|
|
|
|
style: {
|
|
|
|
lineDash: null,
|
|
|
|
stroke: this.style.Station.StationControl.lamp.stroke,
|
|
|
|
fill: this.style.Station.StationControl.lamp.fill
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.arcBorder);
|
2020-08-07 11:09:49 +08:00
|
|
|
}
|
2021-02-18 15:38:20 +08:00
|
|
|
if (this.style.Station.StationControl.centerControl.lightShow) {
|
|
|
|
this.controlLight = new ESingleControl({
|
|
|
|
_subType: 'light',
|
|
|
|
style: this.style,
|
|
|
|
zlevel: this.zlevel,
|
2021-05-18 17:49:08 +08:00
|
|
|
z: this.z + 1,
|
2021-02-18 15:38:20 +08:00
|
|
|
point: {
|
2021-02-20 17:10:10 +08:00
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 9 / 2 + this.style.Station.StationControl.lamp.offset.x,
|
2021-02-18 15:38:20 +08:00
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
|
|
|
|
},
|
|
|
|
context: this.style.Station.StationControl.centerControl.lightText,
|
|
|
|
pop: false
|
|
|
|
});
|
|
|
|
this.add(this.controlLight);
|
|
|
|
const arcRect = this.controlLight.getArcBoundingRect();
|
|
|
|
this.lightArcBorder = new Rect({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
silent: true,
|
|
|
|
shape: arcRect,
|
|
|
|
style: {
|
|
|
|
lineDash: null,
|
|
|
|
stroke: this.style.Station.StationControl.lamp.stroke,
|
|
|
|
fill: this.style.Station.StationControl.lamp.fill
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.lightArcBorder);
|
|
|
|
}
|
2021-02-20 17:10:10 +08:00
|
|
|
if (this.style.Station.StationControl.centerControl.preResetShow) {
|
|
|
|
this.controlPreReset = new ESingleControl({
|
|
|
|
_subType: 'preReset',
|
|
|
|
style: this.style,
|
|
|
|
zlevel: this.zlevel,
|
2021-05-18 17:49:08 +08:00
|
|
|
z: this.z + 1,
|
2021-02-20 17:10:10 +08:00
|
|
|
point: {
|
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 + this.style.Station.StationControl.lamp.offset.x,
|
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
|
|
|
|
},
|
|
|
|
context: this.style.Station.StationControl.centerControl.preResetText,
|
|
|
|
pop: false
|
|
|
|
});
|
|
|
|
this.add(this.controlPreReset);
|
|
|
|
const arcRect = this.controlPreReset.getArcBoundingRect();
|
|
|
|
this.preResetArcBorder = new Rect({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
silent: true,
|
|
|
|
shape: arcRect,
|
|
|
|
style: {
|
|
|
|
lineDash: null,
|
|
|
|
stroke: this.style.Station.StationControl.lamp.stroke,
|
|
|
|
fill: this.style.Station.StationControl.lamp.fill
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.preResetArcBorder);
|
|
|
|
}
|
2020-06-12 13:19:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
createSubstationControl() { // 站控按钮
|
|
|
|
const model = this.model;
|
|
|
|
if (this.style.Station.StationControl.substationControl.show) {
|
|
|
|
this.substationControl = new ESingleControl({
|
|
|
|
_subType: 'substation',
|
|
|
|
style: this.style,
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
point: {
|
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.substationControl.offset.x,
|
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.substationControl.offset.y
|
|
|
|
},
|
|
|
|
context: this.style.Station.StationControl.substationControl.text,
|
|
|
|
pop: false
|
|
|
|
});
|
|
|
|
this.add(this.substationControl);
|
|
|
|
if (this.style.Station.StationControl.substationControl.arrowShow) {
|
|
|
|
const x = this.model.controlModePoint.x + this.style.Station.StationControl.substationControl.offset.x;
|
|
|
|
const y = this.model.controlModePoint.y + this.style.Station.StationControl.substationControl.offset.y;
|
|
|
|
const point = arrow(x, y + this.style.Station.StationControl.lamp.radiusR / 2, this.style.Station.StationControl.lamp.distance / 6, this.style.Station.StationControl.lamp.radiusR * 0.8);
|
|
|
|
this.substationArrowsControl = new EArrow({
|
2020-03-05 14:33:08 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
2020-06-12 13:19:26 +08:00
|
|
|
style: this.style,
|
|
|
|
count: this.count,
|
|
|
|
drict: 1,
|
|
|
|
point: point,
|
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.offset.x,
|
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
|
|
|
|
fill: this.style.Station.StationControl.substationControl.grayColor,
|
|
|
|
lineWidth: 1,
|
|
|
|
stroke: this.style.sidelineColor
|
2020-03-05 14:33:08 +08:00
|
|
|
});
|
2020-06-12 13:19:26 +08:00
|
|
|
this.add(this.substationArrowsControl);
|
2020-01-08 14:59:27 +08:00
|
|
|
}
|
2020-08-07 11:09:49 +08:00
|
|
|
}
|
2020-06-12 13:19:26 +08:00
|
|
|
}
|
2019-12-05 10:19:41 +08:00
|
|
|
|
2020-06-12 13:19:26 +08:00
|
|
|
createInterconnectedControl() { // 联锁控
|
|
|
|
const model = this.model;
|
|
|
|
if (this.style.Station.StationControl.interconnectedControl.show) { // 成都三会显示
|
|
|
|
this.interconnectedControl = new ESingleControl({
|
|
|
|
_subType: 'interconnected',
|
|
|
|
style: this.style,
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
point: {
|
|
|
|
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.interconnectedControl.offset.x,
|
|
|
|
y: model.controlModePoint.y + this.style.Station.StationControl.interconnectedControl.offset.y
|
|
|
|
},
|
|
|
|
context: this.style.Station.StationControl.interconnectedControl.text || '联锁控',
|
|
|
|
pop: false
|
|
|
|
});
|
|
|
|
this.add(this.interconnectedControl);
|
2019-12-05 10:19:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-23 13:48:35 +08:00
|
|
|
handleCenter() { // 中控
|
2021-01-18 14:10:55 +08:00
|
|
|
this.noneBeforeMode = 'Center';
|
2020-03-23 13:48:35 +08:00
|
|
|
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.greenColor);
|
2020-08-07 11:09:49 +08:00
|
|
|
this.centerControl && this.centerControl.setTextColor(this.style.Station.StationControl.lamp.greenColor); // 文字颜色
|
2021-02-22 10:15:01 +08:00
|
|
|
if (!this.style.Station.stationText.isSpecialType) {
|
2021-02-20 15:05:25 +08:00
|
|
|
this.stationText.setColor('#1fdc1f');
|
|
|
|
}
|
|
|
|
|
2021-03-02 15:06:40 +08:00
|
|
|
this.stationControlCC && this.stationControlCC.setStyle({text:'CC', textFill:this.style.Station.StationControl.text.centerControlColor});
|
2020-12-31 18:02:55 +08:00
|
|
|
//
|
|
|
|
//
|
2020-11-16 10:08:37 +08:00
|
|
|
// if (this.style.Station.StationControl.disPlayNone) {
|
|
|
|
// this.stationText && this.stationText.setStyle('textFill', '#1fdc1f');
|
|
|
|
// if (this.model.subheadDisplay) { // 副标题
|
|
|
|
// this.subheadText && this.subheadText.setStyle('textFill', '#1fdc1f');
|
|
|
|
// }
|
|
|
|
// }
|
2020-03-23 13:48:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
handleLocal() { // 站控
|
2021-01-18 14:10:55 +08:00
|
|
|
this.noneBeforeMode = 'Local';
|
2020-03-23 13:48:35 +08:00
|
|
|
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.yellowColor);
|
2020-05-28 14:39:06 +08:00
|
|
|
this.substationControl && this.substationControl.setTextColor(this.style.Station.StationControl.lamp.yellowColor); // 文字颜色
|
2020-03-23 13:48:35 +08:00
|
|
|
this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
2020-08-07 11:09:49 +08:00
|
|
|
this.substationArrowsControl && this.substationArrowsControl.setColor(this.style.Station.StationControl.lamp.greenColor);
|
2021-03-02 15:06:40 +08:00
|
|
|
this.stationControlCC && this.stationControlCC.setStyle({text:'LC', textFill:this.style.Station.StationControl.text.stationControlColor});
|
2020-11-16 10:08:37 +08:00
|
|
|
// if (this.style.Station.StationControl.disPlayNone) {
|
|
|
|
// this.stationText && this.stationText.setStyle('textFill', '#fff');
|
|
|
|
// if (this.model.subheadDisplay) { // 副标题
|
|
|
|
// this.subheadText && this.subheadText.setStyle('textFill', '#fff');
|
|
|
|
// }
|
|
|
|
// }
|
2021-02-22 10:15:01 +08:00
|
|
|
if (!this.style.Station.stationText.isSpecialType) {
|
2021-02-20 15:05:25 +08:00
|
|
|
this.stationText.setColor('#fff');
|
|
|
|
}
|
2020-03-23 13:48:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
handleEmergency() { // 紧急站控
|
|
|
|
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.redColor);
|
2020-06-12 13:19:26 +08:00
|
|
|
this.emergencyControl && this.emergencyControl.setTextColor(this.style.Station.StationControl.lamp.redColor); // 紧急 颜色
|
2020-03-23 13:48:35 +08:00
|
|
|
this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
2020-08-07 11:09:49 +08:00
|
|
|
this.emergencyArrowsControl && this.emergencyArrowsControl.setColor(this.style.Station.StationControl.lamp.greenColor);
|
2021-03-02 15:06:40 +08:00
|
|
|
this.stationControlCC && this.stationControlCC.setStyle({text:'EL', textFill:this.style.Station.StationControl.text.emergencyControlColor});
|
2020-11-16 10:08:37 +08:00
|
|
|
// if (this.style.Station.StationControl.disPlayNone) {
|
|
|
|
// this.stationText && this.stationText.setStyle('textFill', '#fff');
|
|
|
|
// if (this.model.subheadDisplay) { // 副标题
|
|
|
|
// this.subheadText && this.subheadText.setStyle('textFill', '#fff');
|
|
|
|
// }
|
|
|
|
// }
|
2021-02-22 10:15:01 +08:00
|
|
|
if (!this.style.Station.stationText.isSpecialType) {
|
2021-02-20 15:05:25 +08:00
|
|
|
this.stationText.setColor('#fff');
|
|
|
|
}
|
2020-08-07 11:09:49 +08:00
|
|
|
}
|
2020-07-28 16:59:32 +08:00
|
|
|
|
2021-02-05 11:01:21 +08:00
|
|
|
handleInterlock() { // 联锁控 成都三号线
|
|
|
|
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.emergencyControl && this.emergencyControl.setTextColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.substationControl && this.substationControl.setTextColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.centerControl && this.centerControl.setTextColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.interconnectedControl && this.interconnectedControl.setColor(this.style.Station.StationControl.lamp.purpleColor);
|
|
|
|
this.interconnectedControl && this.interconnectedControl.setTextColor(this.style.Station.StationControl.lamp.purpleColor);
|
|
|
|
}
|
|
|
|
|
2020-08-07 11:09:49 +08:00
|
|
|
handleNone() { // 空
|
2021-01-18 14:10:55 +08:00
|
|
|
if (this.style.Station.stationText.noneModeColor) {
|
|
|
|
this.stationText.setColor(this.style.Station.stationText.noneModeColor);
|
|
|
|
}
|
|
|
|
if (this.style.Station.stationText.noneModeFlash) {
|
|
|
|
this.stationText.setAnimateStyle(this.noneBeforeMode);
|
|
|
|
}
|
2020-03-23 13:48:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
recover() {
|
|
|
|
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
2020-06-10 16:56:52 +08:00
|
|
|
this.emergencyControl && this.emergencyControl.setTextColor(this.style.Station.StationControl.text.fontColor);
|
2020-03-23 13:48:35 +08:00
|
|
|
this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
2020-06-10 16:56:52 +08:00
|
|
|
this.substationControl && this.substationControl.setTextColor(this.style.Station.StationControl.text.fontColor);
|
2020-03-23 13:48:35 +08:00
|
|
|
this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
2020-06-10 16:56:52 +08:00
|
|
|
this.centerControl && this.centerControl.setTextColor(this.style.Station.StationControl.text.fontColor);
|
2021-02-05 11:01:21 +08:00
|
|
|
this.interconnectedControl && this.interconnectedControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.interconnectedControl && this.interconnectedControl.setTextColor(this.style.Station.StationControl.text.fontColor);
|
2021-02-23 13:34:42 +08:00
|
|
|
this.controlPreReset && this.controlPreReset.setColor(this.style.Station.StationControl.lamp.grayColor);
|
2020-06-12 13:19:26 +08:00
|
|
|
|
|
|
|
this.substationArrowsControl && this.substationArrowsControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
|
|
|
this.emergencyArrowsControl && this.emergencyArrowsControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
2021-02-20 15:05:25 +08:00
|
|
|
if (this.style.Station.stationText.isSpecialType) {
|
2021-02-23 16:37:42 +08:00
|
|
|
// if()
|
2021-02-22 10:15:01 +08:00
|
|
|
this.stationText.setColor(this.style.Station.stationText.noneModeColor);
|
2021-02-23 17:45:54 +08:00
|
|
|
this.stationText.setBackground(this.style.Station.stationText.defaultBackColor);
|
2021-02-24 10:43:07 +08:00
|
|
|
this.stationText && this.stationText.stopAnimate();
|
2021-02-22 10:15:01 +08:00
|
|
|
// sationEle.controller
|
2021-02-20 15:05:25 +08:00
|
|
|
} else {
|
|
|
|
this.stationText && this.stationText.stopAnimate();
|
|
|
|
}
|
2020-03-23 13:48:35 +08:00
|
|
|
}
|
|
|
|
|
2019-12-05 10:19:41 +08:00
|
|
|
// 设置状态
|
2019-12-04 11:32:30 +08:00
|
|
|
setState(model) {
|
2020-03-13 13:01:58 +08:00
|
|
|
if (!this.isShowShape) return;
|
2020-08-07 11:09:49 +08:00
|
|
|
this.recover();
|
2020-05-28 15:02:15 +08:00
|
|
|
model.controlMode && this['handle' + model.controlMode]();
|
2021-02-22 10:15:01 +08:00
|
|
|
|
2021-02-22 18:38:38 +08:00
|
|
|
// if (this.style.Station.syncCentralizeStation && model.controller && model.centralized) {
|
|
|
|
// debugger;
|
|
|
|
// model.chargeStationCodeList.forEach(item => {
|
|
|
|
// const device = store.getters['map/getDeviceByCode'](item);
|
|
|
|
// // device.controller = model.controller;
|
|
|
|
// device && device.instance && device.instance.recover();
|
|
|
|
// device && device.instance && device.instance.handleComplexControl(model.controller);
|
|
|
|
// });
|
|
|
|
// //
|
|
|
|
// }
|
2021-02-23 16:37:42 +08:00
|
|
|
// console.log(model.controller, model.centralized, '5555555555555');
|
2021-02-23 13:34:42 +08:00
|
|
|
model.preResetValidDuration && this.handlePreResetLamp();
|
2021-02-22 18:38:38 +08:00
|
|
|
model.controller && this.handleComplexControl(model.controller);
|
2021-02-24 18:11:50 +08:00
|
|
|
model.emergencyController != undefined && this.handleEmergencyChange(model.emergencyController);
|
2021-02-24 10:43:07 +08:00
|
|
|
// model.controlApplicant
|
|
|
|
model.controlApplicant && this.handleControlApplicant(model);
|
2021-02-24 18:11:50 +08:00
|
|
|
if (this.style.Station.syncCentralizeStation && (model.controlMode || model.controller || model.emergencyController != undefined) && model.centralized) {
|
2021-01-18 10:52:06 +08:00
|
|
|
model.chargeStationCodeList.forEach(item => {
|
|
|
|
const device = store.getters['map/getDeviceByCode'](item);
|
2021-01-18 14:10:55 +08:00
|
|
|
device && device.instance && device.instance.recover();
|
2021-02-24 18:11:50 +08:00
|
|
|
if (model.emergencyController != undefined) {
|
2021-02-23 17:45:54 +08:00
|
|
|
device.emergencyController = model.emergencyController;
|
2021-02-24 18:11:50 +08:00
|
|
|
device && device.instance && device.instance.handleEmergencyChange(model.emergencyController);
|
2021-02-23 17:45:54 +08:00
|
|
|
}
|
2021-02-22 18:38:38 +08:00
|
|
|
if (model.controller) {
|
2021-02-23 16:37:42 +08:00
|
|
|
device.controller = model.controller;
|
2021-02-22 18:38:38 +08:00
|
|
|
device && device.instance && device.instance.handleComplexControl(model.controller);
|
|
|
|
} else {
|
|
|
|
device.controlMode = model.controlMode;
|
|
|
|
device && device.instance && device.instance['handle' + model.controlMode]();
|
|
|
|
}
|
2021-01-18 10:52:06 +08:00
|
|
|
});
|
|
|
|
}
|
2020-06-05 10:14:12 +08:00
|
|
|
if (model.tbStrategyId) {
|
|
|
|
store.state.map.map.tbStrategyList.forEach(item => {
|
|
|
|
if (item.stationCode == model.code) {
|
|
|
|
const modelData = Vue.prototype.$jlmap.mapDevice[item.code];
|
|
|
|
modelData && modelData.instance && modelData.instance.setState(modelData, model.tbStrategyId);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-12-04 11:32:30 +08:00
|
|
|
}
|
2021-02-23 13:34:42 +08:00
|
|
|
handlePreResetLamp() {
|
|
|
|
this.controlPreReset && this.controlPreReset.setColor('#f00');
|
|
|
|
}
|
2021-02-23 17:45:54 +08:00
|
|
|
|
2021-02-24 10:43:07 +08:00
|
|
|
handleControlApplicant(model) {
|
|
|
|
if (this.style.Station.stationText.isSpecialType) {
|
|
|
|
const memberData = store.state.training.memberData;
|
|
|
|
if (memberData[model.controller].userId == store.state.user.id ) {
|
|
|
|
this.stationText.setFlash();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-23 17:45:54 +08:00
|
|
|
handleEmergencyController() {
|
|
|
|
if (this.style.Station.stationText.isSpecialType) {
|
|
|
|
this.stationText.setBackground(this.style.Station.stationText.emergencyBackColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-24 18:11:50 +08:00
|
|
|
handleEmergencyChange(emergencyController) {
|
|
|
|
if (emergencyController) {
|
|
|
|
this.handleEmergencyController();
|
|
|
|
} else {
|
|
|
|
this.stationText.setBackground(this.style.Station.stationText.defaultBackColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-22 10:15:01 +08:00
|
|
|
handleComplexControl(controller) {
|
2021-02-23 16:37:42 +08:00
|
|
|
// const controller = model.controller;
|
2021-02-22 18:38:38 +08:00
|
|
|
const memberData = store.state.training.memberData;
|
2021-02-23 18:12:12 +08:00
|
|
|
// console.log(controller, memberData[controller], memberData[controller].userId, store.state.user.id, '88888888');
|
2021-02-23 16:37:42 +08:00
|
|
|
if (memberData[controller].userId && memberData[controller].userId == store.state.user.id) {
|
|
|
|
this.stationText.setColor(this.style.Station.stationText.currentModeColor);
|
|
|
|
} else {
|
|
|
|
if (memberData[controller].type == 'DISPATCHER') {
|
|
|
|
this.stationText.setColor(this.style.Station.stationText.dispatherColor);
|
|
|
|
} else if (memberData[controller].type == 'STATION_SUPERVISOR') {
|
|
|
|
const deviceCode = memberData[controller].deviceCode;
|
|
|
|
// console.log(deviceCode, '999999999');
|
|
|
|
if (deviceCode) {
|
|
|
|
const device = store.getters['map/getDeviceByCode'](deviceCode);
|
|
|
|
if (device.centralized) {
|
|
|
|
// console.log(device.centralized, '666666666');
|
|
|
|
this.stationText.setColor(this.style.Station.stationText.centralizedColor);
|
|
|
|
} else {
|
|
|
|
this.stationText.setColor(this.style.Station.stationText.noCentralizedColor);
|
2021-02-22 18:38:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-02-22 10:15:01 +08:00
|
|
|
}
|
|
|
|
|
2020-11-13 10:21:36 +08:00
|
|
|
// setState(model) {
|
|
|
|
// if (!this.isShowShape) return;
|
|
|
|
// // // 新版地图使用新版状态变更方式
|
|
|
|
// this.recover();
|
|
|
|
|
|
|
|
// // 更新状态
|
|
|
|
// const currentTypeList = this.style.Station.elemnetType;
|
|
|
|
// currentTypeList.forEach(element => {
|
|
|
|
// this[element].setState(model);
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
|
2020-04-07 13:09:34 +08:00
|
|
|
getShapeTipPoint(opts) {
|
2021-02-05 15:12:57 +08:00
|
|
|
let rect;
|
|
|
|
switch (opts.subDeviceType) {
|
|
|
|
case 'button':
|
|
|
|
rect = this.centerControlButton.getArcBoundingRect();
|
|
|
|
break;
|
|
|
|
case 'center':
|
|
|
|
rect = this.centerControl.getArcBoundingRect();
|
|
|
|
break;
|
|
|
|
case 'substation':
|
|
|
|
rect = this.substationControl.getArcBoundingRect();
|
|
|
|
break;
|
|
|
|
case 'emergency':
|
|
|
|
rect = this.emergencyControl.getArcBoundingRect();
|
|
|
|
break;
|
|
|
|
case 'interconnected':
|
|
|
|
rect = this.interconnectedControl.getArcBoundingRect();
|
|
|
|
break;
|
2021-05-18 17:49:08 +08:00
|
|
|
case 'light':
|
|
|
|
rect = this.controlLight.getBoundingRect();
|
|
|
|
break;
|
|
|
|
case 'preReset':
|
|
|
|
rect = this.controlPreReset.getBoundingRect();
|
|
|
|
break;
|
2021-02-05 15:12:57 +08:00
|
|
|
default:
|
|
|
|
rect = this.stationText.getBoundingRect();
|
|
|
|
break;
|
|
|
|
}
|
2021-01-20 15:53:36 +08:00
|
|
|
|
2020-04-07 13:09:34 +08:00
|
|
|
return {
|
2021-05-18 17:49:08 +08:00
|
|
|
x: rect.x + rect.width / 2,
|
2020-04-07 13:09:34 +08:00
|
|
|
y: rect.y
|
|
|
|
};
|
2019-12-04 11:32:30 +08:00
|
|
|
}
|
2019-12-17 09:13:57 +08:00
|
|
|
|
2019-12-18 09:49:44 +08:00
|
|
|
getBoundingRect() {
|
2020-08-07 11:09:49 +08:00
|
|
|
const rect = this.stationText.getBoundingRect().clone();
|
2020-11-13 10:21:36 +08:00
|
|
|
// if (this.model.subheadDisplay) {
|
|
|
|
// const subheadText = this.subheadText.getBoundingRect().clone();
|
|
|
|
// rect.union(subheadText);
|
|
|
|
// return rect;
|
|
|
|
// } else {
|
|
|
|
// return rect;
|
|
|
|
// }
|
|
|
|
return rect;
|
2019-12-18 09:49:44 +08:00
|
|
|
}
|
2019-12-17 09:13:57 +08:00
|
|
|
|
2019-12-04 11:32:30 +08:00
|
|
|
drawSelected(selected) {
|
2021-03-01 10:29:39 +08:00
|
|
|
this.EMouse &&
|
|
|
|
this.EMouse.drawSelected &&
|
|
|
|
this.EMouse.drawSelected(selected);
|
2019-12-04 11:32:30 +08:00
|
|
|
}
|
|
|
|
|
2019-12-05 10:25:07 +08:00
|
|
|
checkIsDrawMap() {
|
|
|
|
const path = window.location.href;
|
|
|
|
if (path.includes('/map/draw')) {
|
2021-02-19 17:27:10 +08:00
|
|
|
this.EMouse = new EMouseDraw(this);
|
2019-12-05 10:25:07 +08:00
|
|
|
this.add(this.EMouse);
|
2021-02-19 17:27:10 +08:00
|
|
|
this.on('mouseout', e => { this.EMouse.mouseout(e); });
|
|
|
|
this.on('mouseover', e => { this.EMouse.mouseover(e); });
|
|
|
|
} else if (this.style.Station.StationControl.mouseOverStyle) {
|
2021-02-22 10:15:01 +08:00
|
|
|
this.EMouse = new EMouse(this);
|
2021-02-19 17:27:10 +08:00
|
|
|
this.add(this.EMouse);
|
|
|
|
this.on('mouseout', e => { this.EMouse.mouseout(e); });
|
|
|
|
this.on('mouseover', e => { this.EMouse.mouseover(e); });
|
2021-02-22 10:15:01 +08:00
|
|
|
}
|
2019-12-05 10:25:07 +08:00
|
|
|
}
|
2020-03-18 10:31:23 +08:00
|
|
|
setShowMode() {
|
2021-05-18 17:49:08 +08:00
|
|
|
if (this.model.showMode === '05') {
|
|
|
|
this.createTroButton(); // 创建轨道预览按钮
|
|
|
|
}
|
2020-03-18 10:31:23 +08:00
|
|
|
}
|
2020-03-13 13:01:58 +08:00
|
|
|
setShowStation(flag) {
|
|
|
|
if (flag) {
|
2020-12-08 09:52:07 +08:00
|
|
|
if (this.model.visible) {
|
|
|
|
this.eachChild(item => {
|
|
|
|
item.show();
|
|
|
|
});
|
|
|
|
if (this.mileageText) {
|
|
|
|
this.model.kmPostShow ? this.mileageText.show() : this.mileageText.hide();
|
|
|
|
}
|
2020-06-23 13:52:34 +08:00
|
|
|
}
|
2020-03-13 13:01:58 +08:00
|
|
|
this.isShowShape = true;
|
|
|
|
this.setState(this.model);
|
|
|
|
} else {
|
|
|
|
this.eachChild(item => {
|
|
|
|
item.hide();
|
|
|
|
});
|
|
|
|
this.isShowShape = false;
|
|
|
|
}
|
|
|
|
}
|
2020-11-13 10:21:36 +08:00
|
|
|
|
|
|
|
setVisible(visible) {
|
|
|
|
if (visible) {
|
|
|
|
this.eachChild(elem => { elem.show(); });
|
|
|
|
} else {
|
|
|
|
this.eachChild(elem => { elem.hide(); });
|
|
|
|
}
|
|
|
|
}
|
2021-02-05 15:12:57 +08:00
|
|
|
getAnchorPoint() {
|
|
|
|
return this.model.position;
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|