调整集中站指示灯状态,绘图显示

This commit is contained in:
zyy 2020-03-05 14:33:08 +08:00
parent 7ff7deae48
commit 3510548b7b
7 changed files with 79 additions and 44 deletions

View File

@ -321,7 +321,7 @@ class SkinCode extends defaultStyle {
}, },
StationControl: { StationControl: {
text: { text: {
distance: 2, // 灯和文字之间的距离 distance: 12, // 灯和文字之间的距离
fontSize: 12, // 字体大小 fontSize: 12, // 字体大小
fontFormat: 'consolas', // 字体格式 fontFormat: 'consolas', // 字体格式
fontColor: '#ffffff', // 字体颜色 fontColor: '#ffffff', // 字体颜色
@ -339,7 +339,7 @@ class SkinCode extends defaultStyle {
lamp: { lamp: {
count: 4, // 控制模式的个数 count: 4, // 控制模式的个数
offset: { x: 20, y: 0 }, // 偏移量 offset: { x: 20, y: 0 }, // 偏移量
radiusR: 4, // 控制模式灯的半径 radiusR: 5, // 控制模式灯的半径
distance: 46, // 控制模式之间灯之间的距离 distance: 46, // 控制模式之间灯之间的距离
grayColor: '#C0C0C0', // 控制模式灰色 grayColor: '#C0C0C0', // 控制模式灰色
greenColor: 'green', // 控制模式绿色 greenColor: 'green', // 控制模式绿色
@ -349,7 +349,9 @@ class SkinCode extends defaultStyle {
centerControlShow: true, // 中控显示 centerControlShow: true, // 中控显示
substationControlShow: true, // 站控按钮显示 substationControlShow: true, // 站控按钮显示
interconnectedControlShow: false, // 联锁控显示 interconnectedControlShow: false, // 联锁控显示
centerControlButtonShow: true // 中控显示 centerControlButtonShow: true, // 中控显示
stroke: '#FFFFFF', // 框的颜色
fill: 'rgba(0,0,0,0)', // 填充色
}, },
arrow: { arrow: {
show: false // 控制模式箭头显隐 show: false // 控制模式箭头显隐

View File

@ -4,7 +4,6 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Arc from 'zrender/src/graphic/shape/Arc'; import Arc from 'zrender/src/graphic/shape/Arc';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
import { createBoundingRect } from '../../utils/parser';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
import EMouse from './EMouse'; import EMouse from './EMouse';

View File

@ -36,7 +36,7 @@ export default class ESingleControl extends Group {
r: model.style.Station.StationControl.lamp.radiusR r: model.style.Station.StationControl.lamp.radiusR
}, },
style: { style: {
lineWidth: 0.5, lineWidth: 0,
fill: model.style.Station.StationControl.lamp.grayColor, fill: model.style.Station.StationControl.lamp.grayColor,
stroke: model.style.Station.StationControl.lamp.grayColor stroke: model.style.Station.StationControl.lamp.grayColor
} }
@ -70,4 +70,16 @@ export default class ESingleControl extends Group {
this.control.setStyle('fill', color); this.control.setStyle('fill', color);
} }
} }
getArcBoundingRect() {
const rect = this.control.getBoundingRect().clone();
const scale = this.control.scale[0];
const offsetX = this.control.position[0];
const offsetY = this.control.position[1];
rect.x = rect.x * scale + offsetX - 2;
rect.y = rect.y * scale + offsetY - 2;
rect.width = rect.width * scale + 4;
rect.height = rect.height * scale + 4;
return rect;
}
} }

View File

@ -8,6 +8,7 @@ import EMouse from './EMouse';
import ESingleControl from './ESingleControl'; import ESingleControl from './ESingleControl';
import EArrow from './EArrow'; import EArrow from './EArrow';
import { arrow } from '../utils/ShapePoints'; import { arrow } from '../utils/ShapePoints';
import Rect from 'zrender/src/graphic/shape/Rect';
import BoundingRect from 'zrender/src/core/BoundingRect'; import BoundingRect from 'zrender/src/core/BoundingRect';
export default class Station extends Group { export default class Station extends Group {
@ -208,7 +209,6 @@ export default class Station extends Group {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x, x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
}, },
// context: model.lskContent || '联锁控',
context: this.style.Station.StationControl.text.interconnectedControlText || '联锁控', context: this.style.Station.StationControl.text.interconnectedControlText || '联锁控',
pop: false pop: false
}); });
@ -247,6 +247,19 @@ export default class Station extends Group {
pop: false pop: false
}); });
this.add(this.centerControlButton); 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);
} }
} }

View File

@ -26,75 +26,75 @@ export default class StationControl extends Group {
create() { create() {
const model = this.model; const model = this.model;
// 紧急站控 // 紧急站控
if (this.style.StationControl.lamp.emergencyControlShow) { if (this.style.Station.StationControl.lamp.emergencyControlShow) {
this.emergencyControl = new ESingleControl({ this.emergencyControl = new ESingleControl({
_subType: 'emergency', _subType: 'emergency',
style: this.style, style: this.style,
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
point: { point: {
x: model.position.x - this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x, x: model.position.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y y: model.position.y + this.style.Station.StationControl.lamp.offset.y
}, },
context: this.style.StationControl.text.emergencyControlText, context: this.style.Station.StationControl.text.emergencyControlText,
// model.jjzkContent, // model.jjzkContent,
pop: false pop: false
}); });
this.add(this.emergencyControl); this.add(this.emergencyControl);
} }
// 中控按钮 // 中控按钮
if (this.style.StationControl.lamp.centerControlShow) { if (this.style.Station.StationControl.lamp.centerControlShow) {
this.centerControl = new ESingleControl({ this.centerControl = new ESingleControl({
_subType: 'center', _subType: 'center',
style: this.style, style: this.style,
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
point: { point: {
x: model.position.x - this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x, x: model.position.x - this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y y: model.position.y + this.style.Station.StationControl.lamp.offset.y
}, },
context: this.style.StationControl.text.centerControlText, context: this.style.Station.StationControl.text.centerControlText,
// model.zokContent, // model.zokContent,
pop: false pop: false
}); });
this.add(this.centerControl); this.add(this.centerControl);
} }
// 站控按钮 // 站控按钮
if (this.style.StationControl.lamp.substationControlShow) { if (this.style.Station.StationControl.lamp.substationControlShow) {
this.substationControl = new ESingleControl({ this.substationControl = new ESingleControl({
_subType: 'substation', _subType: 'substation',
style: this.style, style: this.style,
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
point: { point: {
x: model.position.x + this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x, x: model.position.x + this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y y: model.position.y + this.style.Station.StationControl.lamp.offset.y
}, },
context: this.style.StationControl.text.substationControlText, context: this.style.Station.StationControl.text.substationControlText,
// model.zakContent // model.zakContent
pop: false pop: false
}); });
this.add(this.substationControl); this.add(this.substationControl);
} }
// 联锁控 // 联锁控
if (this.style.StationControl.lamp.interconnectedControlShow) { if (this.style.Station.StationControl.lamp.interconnectedControlShow) {
this.interconnectedControl = new ESingleControl({ this.interconnectedControl = new ESingleControl({
_subType: 'interconnected', _subType: 'interconnected',
style: this.style, style: this.style,
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
point: { point: {
x: model.position.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x, x: model.position.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y y: model.position.y + this.style.Station.StationControl.lamp.offset.y
}, },
context: this.style.StationControl.text.interconnectedControlText || '联锁控', context: this.style.Station.StationControl.text.interconnectedControlText || '联锁控',
pop: false pop: false
}); });
this.add(this.interconnectedControl); this.add(this.interconnectedControl);
} }
// 箭头 // 箭头
if (this.style.StationControl.arrow.show) { if (this.style.Station.StationControl.arrow.show) {
const point = arrow(this.model.position.x, this.model.position.y + this.style.StationControl.lamp.radiusR / 2, this.style.StationControl.lamp.distance / 6, this.style.StationControl.lamp.radiusR * 0.8); const point = arrow(this.model.position.x, this.model.position.y + this.style.Station.StationControl.lamp.radiusR / 2, this.style.Station.StationControl.lamp.distance / 6, this.style.Station.StationControl.lamp.radiusR * 0.8);
this.arrowsControl = new EArrow({ this.arrowsControl = new EArrow({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
@ -102,9 +102,9 @@ export default class StationControl extends Group {
count: this.count, count: this.count,
drict: 1, drict: 1,
point: point, point: point,
x: model.position.x + this.style.StationControl.lamp.offset.x, x: model.position.x + this.style.Station.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.radiusR / 2 + this.style.StationControl.lamp.offset.y, y: model.position.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
fill: this.style.StationControl.lamp.grayColor, fill: this.style.Station.StationControl.lamp.grayColor,
lineWidth: 1, lineWidth: 1,
stroke: this.style.sidelineColor stroke: this.style.sidelineColor
}); });
@ -116,28 +116,40 @@ export default class StationControl extends Group {
setState(model) { setState(model) {
// switch (model.status) { // switch (model.status) {
// case '00': // 无状态 // case '00': // 无状态
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor); // this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor); // this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor); // this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// break; // break;
// case '01': // 中控 // case '01': // 中控
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor); // this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor); // this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.greenColor); // this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.greenColor);
// break; // break;
// case '02': // 站控 // case '02': // 站控
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor); // this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.yellowColor); // this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.yellowColor);
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor); // this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// break; // break;
// case '03': // 紧急站控 // case '03': // 紧急站控
// this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.redColor); // this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.redColor);
// this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor); // this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor); // this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
// break; // break;
// } // }
} }
getArcBoundingRect(view) {
const rect = view.getBoundingRect().clone();
const scale = view.scale[0];
const offsetX = view.position[0];
const offsetY = view.position[1];
rect.x = rect.x * scale + offsetX - 2;
rect.y = rect.y * scale + offsetY - 2;
rect.width = rect.width * scale + 4;
rect.height = rect.height * scale + 4;
return rect;
}
/** 按钮是否按下*/ /** 按钮是否按下*/
isPop(e) { isPop(e) {
for (var i = 0; i < this.childCount(); i++) { for (var i = 0; i < this.childCount(); i++) {

View File

@ -221,7 +221,6 @@ export default {
operate.cmdType = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL; operate.cmdType = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL;
operate.operation = OperationEvent.StationControl.requestStationControl.menu.operation; operate.operation = OperationEvent.StationControl.requestStationControl.menu.operation;
} }
console.log(operate);
this.loading = true; this.loading = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
@ -229,10 +228,10 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch((error) => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate, error.message);
}); });
} }
}, },

View File

@ -116,7 +116,6 @@ export default {
start: true, start: true,
code: this.selected.code, code: this.selected.code,
operation: OperationEvent.StationControl.requestCentralControl.menu.operation, operation: OperationEvent.StationControl.requestCentralControl.menu.operation,
// cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL,
param: { param: {
stationControlCode: this.selected.code stationControlCode: this.selected.code
} }
@ -133,7 +132,6 @@ export default {
start: true, start: true,
code: this.selected.code, code: this.selected.code,
operation: OperationEvent.StationControl.requestStationControl.menu.operation, operation: OperationEvent.StationControl.requestStationControl.menu.operation,
// cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL,
param: { param: {
stationControlCode: this.selected.code stationControlCode: this.selected.code
} }